Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function usage(): void {
console.log(`AXME Code - Persistent memory, decisions, and safety guardrails for Claude Code

Usage:
axme-code setup [path] Initialize project (LLM scan + .mcp.json + CLAUDE.md)
axme-code setup [path] [--force] Initialize project (LLM scan + .mcp.json + CLAUDE.md)
axme-code serve Start MCP server (stdio transport)
axme-code status [path] Show project status
axme-code cleanup legacy-artifacts [--dry-run] Remove pre-PR#7 sessions/logs
Expand All @@ -263,7 +263,9 @@ After setup, run 'claude' as usual. AXME tools are available automatically.`);
async function main() {
switch (command) {
case "setup": {
const projectPath = resolve(args[1] || ".");
const forceSetup = args.includes("--force");
const setupArgs = args.filter(a => a !== "--force");
const projectPath = resolve(setupArgs[1] || ".");
const hasGitDir = existsSync(join(projectPath, ".git"));
const ws = detectWorkspace(projectPath);
const isWorkspace = hasGitDir ? false : ws.type !== "single";
Expand Down Expand Up @@ -299,17 +301,22 @@ async function main() {
}
generateWorkspaceYaml(projectPath, ws);
} else {
const result = await initProjectWithLLM(projectPath, { onProgress: console.log });
console.log(` Oracle: ${result.oracle.files} files (${result.oracle.llm ? "LLM scan" : "deterministic fallback"})`);
console.log(` Decisions: ${result.decisions.count} (${result.decisions.fromScan} LLM + ${result.decisions.fromPresets} presets)`);
console.log(` Memories: ${result.memories.count} (${result.memories.fromPresets} from presets)`);
console.log(` Safety: ${result.safety.llm ? "LLM scan" : "defaults + presets"}`);
if (result.cost.costUsd > 0) console.log(` Cost: $${result.cost.costUsd.toFixed(2)}, ${(result.durationMs / 1000).toFixed(1)}s`);
for (const e of result.errors) console.log(` Warning: ${e}`);
const result = await initProjectWithLLM(projectPath, { onProgress: console.log, force: forceSetup });
if (!result.created && result.durationMs === 0) {
console.log(` Already initialized (skipped LLM scan). Use --force to re-scan.`);
console.log(` Decisions: ${result.decisions.count}, Memories: ${result.memories.count}`);
} else {
console.log(` Oracle: ${result.oracle.files} files (${result.oracle.llm ? "LLM scan" : "deterministic fallback"})`);
console.log(` Decisions: ${result.decisions.count} (${result.decisions.fromScan} LLM + ${result.decisions.fromPresets} presets)`);
console.log(` Memories: ${result.memories.count} (${result.memories.fromPresets} from presets)`);
console.log(` Safety: ${result.safety.llm ? "LLM scan" : "defaults + presets"}`);
if (result.cost.costUsd > 0) console.log(` Cost: $${result.cost.costUsd.toFixed(2)}, ${(result.durationMs / 1000).toFixed(1)}s`);
for (const e of result.errors) console.log(` Warning: ${e}`);
}
}

// Create or update .mcp.json (workspace root + each child repo)
const mcpEntry = { command: "axme-code", args: ["serve"] };
const mcpEntry = { command: "npx", args: ["-y", "@axme/code", "serve"] };
const mcpPaths = [projectPath];
if (isWorkspace) {
for (const p of ws.projects) {
Expand Down