mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
docs: rebrand Happy to HAPI and add component documentation
This commit rebrands the project from "Happy" to "HAPI" throughout the codebase, including documentation, comments, logs, and tool references. It also adds comprehensive README files for the server and web components, clarifies the monorepo structure in AGENTS.md and root README.md, and removes the outdated roadmap.md file. Changes include: - Rebrand references from Happy to HAPI in CLI, server, and web components - MCP tool names updated from mcp__happy__ to mcp__hapi__ - Process/service names updated consistently - New server/README.md with deployment and configuration guide - New web/README.md with stack and development instructions - Updated root README.md with quickstart guide - Updated AGENTS.md with cleaner structure documentation - Removed cli/roadmap.md (now superseded by documentation)
This commit is contained in:
@@ -95,7 +95,7 @@ export async function claudeLocal(opts: {
|
||||
}
|
||||
|
||||
if (!claudeCliPath || !existsSync(claudeCliPath)) {
|
||||
throw new Error('Claude local launcher not found. Please ensure HAPPY_PROJECT_ROOT is set correctly for development.');
|
||||
throw new Error('Claude local launcher not found. Please ensure HAPI_PROJECT_ROOT is set correctly for development.');
|
||||
}
|
||||
|
||||
// Prepare environment variables
|
||||
|
||||
@@ -25,7 +25,7 @@ export function registerKillSessionHandler(
|
||||
// should optimistically assume the session is dead.
|
||||
return {
|
||||
success: true,
|
||||
message: 'Killing happy-cli process'
|
||||
message: 'Killing hapi CLI process'
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function runClaude(options: StartOptions = {}): Promise<void> {
|
||||
const sessionTag = randomUUID();
|
||||
|
||||
// Log environment info at startup
|
||||
logger.debugLargeJson('[START] Happy process started', getEnvironmentInfo());
|
||||
logger.debugLargeJson('[START] HAPI process started', getEnvironmentInfo());
|
||||
logger.debug(`[START] Options: startedBy=${options.startedBy}, startingMode=${options.startingMode}`);
|
||||
|
||||
// Validate daemon spawn requirements
|
||||
@@ -121,9 +121,9 @@ export async function runClaude(options: StartOptions = {}): Promise<void> {
|
||||
// Create realtime session
|
||||
const session = api.sessionSyncClient(response);
|
||||
|
||||
// Start Happy MCP server
|
||||
// Start HAPI MCP server
|
||||
const happyServer = await startHappyServer(session);
|
||||
logger.debug(`[START] Happy MCP server started at ${happyServer.url}`);
|
||||
logger.debug(`[START] HAPI MCP server started at ${happyServer.url}`);
|
||||
|
||||
// Print log file path
|
||||
const logPath = logger.logFilePath;
|
||||
@@ -303,7 +303,7 @@ export async function runClaude(options: StartOptions = {}): Promise<void> {
|
||||
await session.close();
|
||||
}
|
||||
|
||||
// Stop Happy MCP server
|
||||
// Stop HAPI MCP server
|
||||
happyServer.stop();
|
||||
|
||||
logger.debug('[START] Cleanup complete, exiting');
|
||||
@@ -339,7 +339,7 @@ export async function runClaude(options: StartOptions = {}): Promise<void> {
|
||||
startingMode: options.startingMode,
|
||||
messageQueue,
|
||||
api,
|
||||
allowedTools: happyServer.toolNames.map(toolName => `mcp__happy__${toolName}`),
|
||||
allowedTools: happyServer.toolNames.map(toolName => `mcp__hapi__${toolName}`),
|
||||
onModeChange: (newMode) => {
|
||||
session.sendSessionEvent({ type: 'switch', mode: newMode });
|
||||
session.updateAgentState((currentState) => ({
|
||||
@@ -351,7 +351,7 @@ export async function runClaude(options: StartOptions = {}): Promise<void> {
|
||||
// Intentionally unused
|
||||
},
|
||||
mcpServers: {
|
||||
'happy': {
|
||||
'hapi': {
|
||||
type: 'http' as const,
|
||||
url: happyServer.url,
|
||||
}
|
||||
@@ -372,9 +372,9 @@ export async function runClaude(options: StartOptions = {}): Promise<void> {
|
||||
logger.debug('Closing session...');
|
||||
await session.close();
|
||||
|
||||
// Stop Happy MCP server
|
||||
// Stop HAPI MCP server
|
||||
happyServer.stop();
|
||||
logger.debug('Stopped Happy MCP server');
|
||||
logger.debug('Stopped HAPI MCP server');
|
||||
|
||||
// Exit
|
||||
process.exit(0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Claude Code SDK integration for Happy CLI
|
||||
* Claude Code SDK integration for HAPI CLI
|
||||
* Provides clean TypeScript implementation without Bun support
|
||||
*/
|
||||
|
||||
@@ -19,4 +19,4 @@ export type {
|
||||
SDKControlRequest,
|
||||
CanCallToolCallback,
|
||||
PermissionResult
|
||||
} from './types'
|
||||
} from './types'
|
||||
|
||||
@@ -118,21 +118,21 @@ function findGlobalClaudePath(): string | null {
|
||||
* Compares global and bundled versions, uses the newer one
|
||||
*
|
||||
* Environment variables:
|
||||
* - HAPPY_CLAUDE_PATH: Force a specific path to claude executable
|
||||
* - HAPPY_USE_BUNDLED_CLAUDE=1: Force use of node_modules version (skip global search)
|
||||
* - HAPPY_USE_GLOBAL_CLAUDE=1: Force use of global version (if available)
|
||||
* - HAPI_CLAUDE_PATH: Force a specific path to claude executable
|
||||
* - HAPI_USE_BUNDLED_CLAUDE=1: Force use of node_modules version (skip global search)
|
||||
* - HAPI_USE_GLOBAL_CLAUDE=1: Force use of global version (if available)
|
||||
*/
|
||||
export function getDefaultClaudeCodePath(): string {
|
||||
const nodeModulesPath = join(__dirname, '..', '..', '..', 'node_modules', '@anthropic-ai', 'claude-code', 'cli.js')
|
||||
|
||||
// Allow explicit override via env var
|
||||
if (process.env.HAPPY_CLAUDE_PATH) {
|
||||
logger.debug(`[Claude SDK] Using HAPPY_CLAUDE_PATH: ${process.env.HAPPY_CLAUDE_PATH}`)
|
||||
return process.env.HAPPY_CLAUDE_PATH
|
||||
if (process.env.HAPI_CLAUDE_PATH) {
|
||||
logger.debug(`[Claude SDK] Using HAPI_CLAUDE_PATH: ${process.env.HAPI_CLAUDE_PATH}`)
|
||||
return process.env.HAPI_CLAUDE_PATH
|
||||
}
|
||||
|
||||
// Force bundled version if requested
|
||||
if (process.env.HAPPY_USE_BUNDLED_CLAUDE === '1') {
|
||||
if (process.env.HAPI_USE_BUNDLED_CLAUDE === '1') {
|
||||
logger.debug(`[Claude SDK] Forced bundled version: ${nodeModulesPath}`)
|
||||
return nodeModulesPath
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Happy MCP server
|
||||
* Provides Happy CLI specific tools including chat session title management
|
||||
* HAPI MCP server
|
||||
* Provides HAPI CLI specific tools including chat session title management
|
||||
*/
|
||||
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
@@ -15,7 +15,7 @@ import { randomUUID } from "node:crypto";
|
||||
export async function startHappyServer(client: ApiSessionClient) {
|
||||
// Handler that sends title updates via the client
|
||||
const handler = async (title: string) => {
|
||||
logger.debug('[happyMCP] Changing title to:', title);
|
||||
logger.debug('[hapiMCP] Changing title to:', title);
|
||||
try {
|
||||
// Send title as a summary message, similar to title generator
|
||||
client.sendClaudeSessionMessage({
|
||||
@@ -35,7 +35,7 @@ export async function startHappyServer(client: ApiSessionClient) {
|
||||
//
|
||||
|
||||
const mcp = new McpServer({
|
||||
name: "Happy MCP",
|
||||
name: "HAPI MCP",
|
||||
version: "1.0.0",
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ export async function startHappyServer(client: ApiSessionClient) {
|
||||
},
|
||||
}, async (args) => {
|
||||
const response = await handler(args.title);
|
||||
logger.debug('[happyMCP] Response:', response);
|
||||
logger.debug('[hapiMCP] Response:', response);
|
||||
|
||||
if (response.success) {
|
||||
return {
|
||||
@@ -105,7 +105,7 @@ export async function startHappyServer(client: ApiSessionClient) {
|
||||
url: baseUrl.toString(),
|
||||
toolNames: ['change_title'],
|
||||
stop: () => {
|
||||
logger.debug('[happyMCP] Stopping server');
|
||||
logger.debug('[hapiMCP] Stopping server');
|
||||
mcp.close();
|
||||
server.close();
|
||||
}
|
||||
|
||||
@@ -5,22 +5,22 @@ import { shouldIncludeCoAuthoredBy } from "./claudeSettings";
|
||||
* Base system prompt shared across all configurations
|
||||
*/
|
||||
const BASE_SYSTEM_PROMPT = (() => trimIdent(`
|
||||
ALWAYS when you start a new chat - you must call a tool "mcp__happy__change_title" to set a chat title. When you think chat title is not relevant anymore - call the tool again to change it. When chat name is too generic and you have a change to make it more specific - call the tool again to change it. This title is needed to easily find the chat in the future. Help human.
|
||||
ALWAYS when you start a new chat - you must call a tool "mcp__hapi__change_title" to set a chat title. When you think chat title is not relevant anymore - call the tool again to change it. When chat name is too generic and you have a change to make it more specific - call the tool again to change it. This title is needed to easily find the chat in the future. Help human.
|
||||
`))();
|
||||
|
||||
/**
|
||||
* Co-authored-by credits to append when enabled
|
||||
*/
|
||||
const CO_AUTHORED_CREDITS = (() => trimIdent(`
|
||||
When making commit messages, instead of just giving co-credit to Claude, also give credit to Happy like so:
|
||||
When making commit messages, instead of just giving co-credit to Claude, also give credit to HAPI like so:
|
||||
|
||||
<main commit message>
|
||||
|
||||
Generated with [Claude Code](https://claude.ai/code)
|
||||
via [Happy](https://happy.engineering)
|
||||
via [HAPI](https://happy.engineering)
|
||||
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
Co-Authored-By: Happy <yesreply@happy.engineering>
|
||||
Co-Authored-By: HAPI <yesreply@happy.engineering>
|
||||
`))();
|
||||
|
||||
/**
|
||||
@@ -35,4 +35,4 @@ export const systemPrompt = (() => {
|
||||
} else {
|
||||
return BASE_SYSTEM_PROMPT;
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user