Skip to content

Commit 7f2f984

Browse files
George-iamclaude
andcommitted
fix: revert to binary commands, add setup --force, add npm publish CI
Revert npx-based commands back to binary "axme-code" for .mcp.json, templates/mcp.json, and hook commands in cli.ts. Plugin marketplace uses npm source type which installs binary globally — no npx needed. Changes: - .mcp.json, templates/mcp.json: "axme-code serve" (was npx) - src/cli.ts hooks: "axme-code hook ..." (was npx) - src/cli.ts setup: --force flag for re-scan, skip output when already initialized, fixed mcpEntry (was still hardcoded) - .github/workflows/npm-publish.yml: auto-publish to npm on GitHub release (build + lint + test + publish) Verified: binary flow (status, hooks), npm install -g flow (status, hooks), 413 tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ed1fbe9 commit 7f2f984

4 files changed

Lines changed: 49 additions & 16 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: '20'
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- run: npm ci
21+
- run: npm run build
22+
- run: npm run lint
23+
- run: npm test
24+
- run: npm publish --access public
25+
env:
26+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.mcp.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"mcpServers": {
33
"axme": {
4-
"command": "npx",
5-
"args": ["-y", "@axme/code", "serve"]
4+
"command": "axme-code",
5+
"args": ["serve"]
66
}
77
}
88
}

src/cli.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function configureHooks(projectPath: string): void {
183183
settings.hooks.PreToolUse.push({
184184
hooks: [{
185185
type: "command",
186-
command: `npx -y @axme/code hook pre-tool-use --workspace ${projectPath}`,
186+
command: `axme-code hook pre-tool-use --workspace ${projectPath}`,
187187
timeout: 5,
188188
}],
189189
});
@@ -195,7 +195,7 @@ function configureHooks(projectPath: string): void {
195195
matcher: "Edit|Write|NotebookEdit",
196196
hooks: [{
197197
type: "command",
198-
command: `npx -y @axme/code hook post-tool-use --workspace ${projectPath}`,
198+
command: `axme-code hook post-tool-use --workspace ${projectPath}`,
199199
timeout: 10,
200200
}],
201201
});
@@ -205,7 +205,7 @@ function configureHooks(projectPath: string): void {
205205
settings.hooks.SessionEnd.push({
206206
hooks: [{
207207
type: "command",
208-
command: `npx -y @axme/code hook session-end --workspace ${projectPath}`,
208+
command: `axme-code hook session-end --workspace ${projectPath}`,
209209
timeout: 120,
210210
}],
211211
});
@@ -248,7 +248,7 @@ function usage(): void {
248248
console.log(`AXME Code - Persistent memory, decisions, and safety guardrails for Claude Code
249249
250250
Usage:
251-
axme-code setup [path] Initialize project (LLM scan + .mcp.json + CLAUDE.md)
251+
axme-code setup [path] [--force] Initialize project (LLM scan + .mcp.json + CLAUDE.md)
252252
axme-code serve Start MCP server (stdio transport)
253253
axme-code status [path] Show project status
254254
axme-code cleanup legacy-artifacts [--dry-run] Remove pre-PR#7 sessions/logs
@@ -263,7 +263,9 @@ After setup, run 'claude' as usual. AXME tools are available automatically.`);
263263
async function main() {
264264
switch (command) {
265265
case "setup": {
266-
const projectPath = resolve(args[1] || ".");
266+
const forceSetup = args.includes("--force");
267+
const setupArgs = args.filter(a => a !== "--force");
268+
const projectPath = resolve(setupArgs[1] || ".");
267269
const hasGitDir = existsSync(join(projectPath, ".git"));
268270
const ws = detectWorkspace(projectPath);
269271
const isWorkspace = hasGitDir ? false : ws.type !== "single";
@@ -299,13 +301,18 @@ async function main() {
299301
}
300302
generateWorkspaceYaml(projectPath, ws);
301303
} else {
302-
const result = await initProjectWithLLM(projectPath, { onProgress: console.log });
303-
console.log(` Oracle: ${result.oracle.files} files (${result.oracle.llm ? "LLM scan" : "deterministic fallback"})`);
304-
console.log(` Decisions: ${result.decisions.count} (${result.decisions.fromScan} LLM + ${result.decisions.fromPresets} presets)`);
305-
console.log(` Memories: ${result.memories.count} (${result.memories.fromPresets} from presets)`);
306-
console.log(` Safety: ${result.safety.llm ? "LLM scan" : "defaults + presets"}`);
307-
if (result.cost.costUsd > 0) console.log(` Cost: $${result.cost.costUsd.toFixed(2)}, ${(result.durationMs / 1000).toFixed(1)}s`);
308-
for (const e of result.errors) console.log(` Warning: ${e}`);
304+
const result = await initProjectWithLLM(projectPath, { onProgress: console.log, force: forceSetup });
305+
if (!result.created && result.durationMs === 0) {
306+
console.log(` Already initialized (skipped LLM scan). Use --force to re-scan.`);
307+
console.log(` Decisions: ${result.decisions.count}, Memories: ${result.memories.count}`);
308+
} else {
309+
console.log(` Oracle: ${result.oracle.files} files (${result.oracle.llm ? "LLM scan" : "deterministic fallback"})`);
310+
console.log(` Decisions: ${result.decisions.count} (${result.decisions.fromScan} LLM + ${result.decisions.fromPresets} presets)`);
311+
console.log(` Memories: ${result.memories.count} (${result.memories.fromPresets} from presets)`);
312+
console.log(` Safety: ${result.safety.llm ? "LLM scan" : "defaults + presets"}`);
313+
if (result.cost.costUsd > 0) console.log(` Cost: $${result.cost.costUsd.toFixed(2)}, ${(result.durationMs / 1000).toFixed(1)}s`);
314+
for (const e of result.errors) console.log(` Warning: ${e}`);
315+
}
309316
}
310317

311318
// Create or update .mcp.json (workspace root + each child repo)

templates/mcp.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"mcpServers": {
33
"axme": {
4-
"command": "npx",
5-
"args": ["-y", "@axme/code", "serve"]
4+
"command": "axme-code",
5+
"args": ["serve"]
66
}
77
}
88
}

0 commit comments

Comments
 (0)