refactor: rename project from memohome to memoh

This commit is contained in:
Acbox
2026-01-12 17:31:21 +08:00
parent 88f0f14700
commit 3094cb19fb
74 changed files with 365 additions and 365 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ export async function startInteractiveMode(options: { maxContextTime?: string; l
try {
requireAuth()
console.log(chalk.green.bold('🤖 MemoHome Agent Interactive Mode'))
console.log(chalk.green.bold('🤖 Memoh Agent Interactive Mode'))
console.log(chalk.dim('Type /exit or /quit to exit, type /help for help\n'))
const { createInterface } = await import('readline')
+2 -2
View File
@@ -8,7 +8,7 @@ import { formatError } from '../../utils'
export function authCommands(program: Command) {
program
.command('login')
.description('Login to MemoHome')
.description('Login to Memoh')
.option('-u, --username <username>', 'Username')
.option('-p, --password <password>', 'Password')
.action(async (options) => {
@@ -75,7 +75,7 @@ export function authCommands(program: Command) {
try {
if (!authCore.isLoggedIn()) {
console.log(chalk.yellow('Not currently logged in'))
console.log(chalk.dim('Use "memohome auth login" to login'))
console.log(chalk.dim('Use "memoh auth login" to login'))
return
}
+1 -1
View File
@@ -121,7 +121,7 @@ export function memoryCommands(program: Command) {
try {
if (!options.start || !options.end) {
console.error(chalk.red('Please provide start and end dates'))
console.log(chalk.dim('Example: memohome memory filter -s 2024-01-01T00:00:00Z -e 2024-12-31T23:59:59Z'))
console.log(chalk.dim('Example: memoh memory filter -s 2024-01-01T00:00:00Z -e 2024-12-31T23:59:59Z'))
process.exit(1)
}
+2 -2
View File
@@ -15,8 +15,8 @@ import { debugCommands } from './commands/debug'
const program = new Command()
program
.name('memohome')
.description(chalk.bold.blue('🏠 MemoHome Agent'))
.name('memoh')
.description(chalk.bold.blue('🏠 Memoh Agent'))
.version('1.0.0')
// Authentication commands
+5 -5
View File
@@ -1,5 +1,5 @@
import { requireAuth, getToken, getApiUrl } from './client'
import type { MemoHomeContext } from './context'
import type { MemohContext } from './context'
export interface ChatParams {
message: string
@@ -22,7 +22,7 @@ export type StreamCallback = (event: StreamEvent) => void | Promise<void>
export async function chatStream(
params: ChatParams,
onEvent: StreamCallback,
context?: MemoHomeContext
context?: MemohContext
): Promise<void> {
requireAuth(context)
const token = getToken(context)!
@@ -37,7 +37,7 @@ export async function chatStream(
export async function chatStreamAsync(
params: ChatParams,
onEvent: StreamCallback,
context?: MemoHomeContext
context?: MemohContext
): Promise<void> {
requireAuth(context)
const token = getToken(context)!
@@ -126,7 +126,7 @@ async function performStreamChat(
/**
* Chat with AI Agent (non-streaming, collect full response) - sync version
*/
export async function chat(params: ChatParams, context?: MemoHomeContext): Promise<string> {
export async function chat(params: ChatParams, context?: MemohContext): Promise<string> {
let fullResponse = ''
await chatStream(params, async (event) => {
@@ -143,7 +143,7 @@ export async function chat(params: ChatParams, context?: MemoHomeContext): Promi
/**
* Chat with AI Agent (non-streaming, collect full response) - async version
*/
export async function chatAsync(params: ChatParams, context?: MemoHomeContext): Promise<string> {
export async function chatAsync(params: ChatParams, context?: MemohContext): Promise<string> {
let fullResponse = ''
await chatStreamAsync(params, async (event) => {
+8 -8
View File
@@ -1,5 +1,5 @@
import { createClient } from './client'
import { getContext, type MemoHomeContext } from './context'
import { getContext, type MemohContext } from './context'
export interface LoginParams {
username: string
@@ -28,11 +28,11 @@ export interface ConfigInfo {
}
/**
* Login to MemoHome API (sync version for file storage)
* Login to Memoh API (sync version for file storage)
* @param params - Login parameters
* @param context - Optional context
*/
export async function login(params: LoginParams, context?: MemoHomeContext): Promise<LoginResult> {
export async function login(params: LoginParams, context?: MemohContext): Promise<LoginResult> {
const client = createClient(context)
const response = await client.auth.login.post({
@@ -70,7 +70,7 @@ export async function login(params: LoginParams, context?: MemoHomeContext): Pro
* Logout current user
* @param context - Optional context
*/
export function logout(context?: MemoHomeContext): void {
export function logout(context?: MemohContext): void {
const ctx = context || getContext()
const storage = ctx.storage
@@ -85,7 +85,7 @@ export function logout(context?: MemoHomeContext): void {
* Check if user is logged in
* @param context - Optional context
*/
export function isLoggedIn(context?: MemoHomeContext): boolean {
export function isLoggedIn(context?: MemohContext): boolean {
const ctx = context || getContext()
const storage = ctx.storage
@@ -102,7 +102,7 @@ export function isLoggedIn(context?: MemoHomeContext): boolean {
* Get current logged in user info
* @param context - Optional context
*/
export async function getCurrentUser(context?: MemoHomeContext): Promise<UserInfo> {
export async function getCurrentUser(context?: MemohContext): Promise<UserInfo> {
const ctx = context || getContext()
const storage = ctx.storage
@@ -136,7 +136,7 @@ export async function getCurrentUser(context?: MemoHomeContext): Promise<UserInf
* Get current API configuration
* @param context - Optional context
*/
export function getConfig(context?: MemoHomeContext): ConfigInfo {
export function getConfig(context?: MemohContext): ConfigInfo {
const ctx = context || getContext()
const storage = ctx.storage
@@ -158,7 +158,7 @@ export function getConfig(context?: MemoHomeContext): ConfigInfo {
* @param url - API URL
* @param context - Optional context
*/
export function setConfig(url: string, context?: MemoHomeContext): void {
export function setConfig(url: string, context?: MemohContext): void {
const ctx = context || getContext()
const storage = ctx.storage
+6 -6
View File
@@ -1,11 +1,11 @@
import { getContext, type MemoHomeContext } from './context'
import { createClient as createClientApi } from '@memohome/api/client'
import { getContext, type MemohContext } from './context'
import { createClient as createClientApi } from '@memoh/api/client'
/**
* Create API client
* @param context - Optional context, uses global context if not provided
*/
export function createClient(context?: MemoHomeContext) {
export function createClient(context?: MemohContext) {
const ctx = context || getContext()
const storage = ctx.storage
@@ -44,7 +44,7 @@ export function createClient(context?: MemoHomeContext) {
* Throws error if not authenticated
* @param context - Optional context, uses global context if not provided
*/
export function requireAuth(context?: MemoHomeContext): string {
export function requireAuth(context?: MemohContext): string {
const ctx = context || getContext()
const storage = ctx.storage
@@ -67,7 +67,7 @@ export function requireAuth(context?: MemoHomeContext): string {
* Get API URL
* @param context - Optional context, uses global context if not provided
*/
export function getApiUrl(context?: MemoHomeContext): string {
export function getApiUrl(context?: MemohContext): string {
const ctx = context || getContext()
const storage = ctx.storage
@@ -86,7 +86,7 @@ export function getApiUrl(context?: MemoHomeContext): string {
* Get token
* @param context - Optional context, uses global context if not provided
*/
export function getToken(context?: MemoHomeContext): string | null {
export function getToken(context?: MemohContext): string | null {
const ctx = context || getContext()
const storage = ctx.storage
+6 -6
View File
@@ -1,5 +1,5 @@
/**
* MemoHome Core Context
* Memoh Core Context
*
* Provides a configurable context for core functions to use different storage backends
*/
@@ -10,7 +10,7 @@ import { FileTokenStorage } from './storage/file'
/**
* Global context for core functions
*/
export interface MemoHomeContext {
export interface MemohContext {
storage: TokenStorage
currentUserId?: string
}
@@ -18,14 +18,14 @@ export interface MemoHomeContext {
/**
* Default context (uses file storage for CLI)
*/
let defaultContext: MemoHomeContext = {
let defaultContext: MemohContext = {
storage: new FileTokenStorage(),
}
/**
* Get the current context
*/
export function getContext(): MemoHomeContext {
export function getContext(): MemohContext {
return defaultContext
}
@@ -33,7 +33,7 @@ export function getContext(): MemoHomeContext {
* Set the global context
* Use this to configure storage backend (e.g., Redis for Telegram bot)
*/
export function setContext(context: Partial<MemoHomeContext>): void {
export function setContext(context: Partial<MemohContext>): void {
defaultContext = { ...defaultContext, ...context }
}
@@ -44,7 +44,7 @@ export function setContext(context: Partial<MemoHomeContext>): void {
export function createContext(options: {
storage: TokenStorage
userId?: string
}): MemoHomeContext {
}): MemohContext {
return {
storage: options.storage,
currentUserId: options.userId,
+3 -3
View File
@@ -1,5 +1,5 @@
import { getApiUrl, getToken } from './client'
import type { MemoHomeContext } from './context'
import type { MemohContext } from './context'
export interface PingResult {
success: boolean
@@ -12,7 +12,7 @@ export interface PingResult {
* Test API server connection
* @param context - Optional context, uses global context if not provided
*/
export async function ping(context?: MemoHomeContext): Promise<PingResult> {
export async function ping(context?: MemohContext): Promise<PingResult> {
const apiUrl = getApiUrl(context)
const token = getToken(context)
@@ -67,7 +67,7 @@ export async function ping(context?: MemoHomeContext): Promise<PingResult> {
* Get connection info
* @param context - Optional context, uses global context if not provided
*/
export function getConnectionInfo(context?: MemoHomeContext): {
export function getConnectionInfo(context?: MemohContext): {
apiUrl: string
hasToken: boolean
} {
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* MemoHome Core API
* Memoh Core API
*
* This module provides core functionality that can be used by CLI and other applications.
* All functions are independent of CLI-specific UI concerns (no chalk, ora, inquirer, etc.)
@@ -11,7 +11,7 @@ export {
setContext,
createContext,
resetContext,
type MemoHomeContext,
type MemohContext,
} from './context'
// Storage
+2 -2
View File
@@ -3,7 +3,7 @@ import { join } from 'path'
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs'
import type { TokenStorage, Config } from '../storage'
const CONFIG_DIR = join(homedir(), '.memohome')
const CONFIG_DIR = join(homedir(), '.memoh')
const CONFIG_FILE = join(CONFIG_DIR, 'config.json')
const DEFAULT_CONFIG: Config = {
@@ -12,7 +12,7 @@ const DEFAULT_CONFIG: Config = {
/**
* File-based token storage for CLI
* Stores config in ~/.memohome/config.json
* Stores config in ~/.memoh/config.json
*/
export class FileTokenStorage implements TokenStorage {
private ensureConfigDir() {
+5 -5
View File
@@ -1,19 +1,19 @@
/**
* MemoHome CLI Package
* Memoh CLI Package
*
* This package provides both:
* 1. A command-line interface (CLI) for interacting with MemoHome API
* 1. A command-line interface (CLI) for interacting with Memoh API
* 2. Core functionality that can be imported and used in other projects
*
* @example CLI Usage (from terminal)
* ```bash
* memohome auth login
* memohome agent chat "Hello"
* memoh auth login
* memoh agent chat "Hello"
* ```
*
* @example Core API Usage (from code)
* ```typescript
* import { login, chat, listModels } from '@memohome/cli'
* import { login, chat, listModels } from '@memoh/cli'
*
* // Login
* await login({ username: 'admin', password: 'password' })