@defai.digital/cli 13.1.16 → 13.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA+DtD;;GAEG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoCzD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI;IAC3B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,YAAY,CAAC;CACnC,CAMA"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAiEtD;;GAEG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoCzD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI;IAC3B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,YAAY,CAAC;CACnC,CAMA"}
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseArgs, formatOutput } from './parser.js';
2
- import { runCommand, listCommand, traceCommand, doctorCommand, guardCommand, callCommand, agentCommand, abilityCommand, sessionCommand, setupCommand, configCommand, reviewCommand, scaffoldCommand, discussCommand, helpCommand, versionCommand,
2
+ import { runCommand, listCommand, traceCommand, doctorCommand, guardCommand, callCommand, agentCommand, abilityCommand, sessionCommand, setupCommand, initCommand, configCommand, reviewCommand, scaffoldCommand, discussCommand, helpCommand, versionCommand,
3
3
  // High-value additions
4
4
  resumeCommand, historyCommand, statusCommand, cleanupCommand, iterateCommand,
5
5
  // MCP server
@@ -20,6 +20,7 @@ const COMMANDS = {
20
20
  ability: abilityCommand,
21
21
  session: sessionCommand,
22
22
  setup: setupCommand,
23
+ init: initCommand,
23
24
  config: configCommand,
24
25
  review: reviewCommand,
25
26
  scaffold: scaffoldCommand,
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,EACX,cAAc;AACd,uBAAuB;AACvB,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,cAAc;AACd,aAAa;AACb,UAAU;AACV,SAAS;AACT,aAAa,GACd,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AACH,MAAM,QAAQ,GAAmC;IAC/C,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,aAAa;IACrB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,cAAc;IACvB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,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACrE,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IAKvB,OAAO;QACL,GAAG;QACH,SAAS;QACT,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAO7D,eAAO,MAAM,WAAW,QAAc,CAAC;AAyJvC;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,aAAa,CAAC,CAOxB"}
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAO7D,eAAO,MAAM,WAAW,QAAc,CAAC;AA4JvC;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,aAAa,CAAC,CAOxB"}
@@ -15,7 +15,8 @@ Usage:
15
15
  ax <command> [options]
16
16
 
17
17
  Commands:
18
- setup Initialize AutomatosX configuration
18
+ setup Global setup (detect providers, create config)
19
+ init Per-project init (create .automatosx/, register MCP)
19
20
  config <subcommand> Manage configuration (show, get, set, reset, path)
20
21
  run <workflow-id> Execute a workflow
21
22
  list List available workflows
@@ -119,6 +120,8 @@ Options:
119
120
  Examples:
120
121
  ax setup
121
122
  ax setup --force
123
+ ax init
124
+ ax init --force
122
125
  ax config show
123
126
  ax config get logLevel
124
127
  ax config set logLevel debug
@@ -1 +1 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C;;GAEG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkJjB,CAAC,IAAI,EAAE,CAAC;AAET;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,KAAe,EACf,QAAoB;IAEpB,OAAO,OAAO,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,CAAC;KACZ,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;A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E,WAAW,EAAE;QAC9B,QAAQ,EAAE,CAAC;KACZ,CAAC,CAAC;AACL,CAAC"}
@@ -8,6 +8,7 @@ export { agentCommand } from './agent.js';
8
8
  export { abilityCommand } from './ability.js';
9
9
  export { sessionCommand } from './session.js';
10
10
  export { setupCommand } from './setup.js';
11
+ export { initCommand } from './init.js';
11
12
  export { configCommand } from './config.js';
12
13
  export { reviewCommand } from './review.js';
13
14
  export { scaffoldCommand } from './scaffold.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC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,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
@@ -8,6 +8,7 @@ export { agentCommand } from './agent.js';
8
8
  export { abilityCommand } from './ability.js';
9
9
  export { sessionCommand } from './session.js';
10
10
  export { setupCommand } from './setup.js';
11
+ export { initCommand } from './init.js';
11
12
  export { configCommand } from './config.js';
12
13
  export { reviewCommand } from './review.js';
13
14
  export { scaffoldCommand } from './scaffold.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,E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c,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAErE,uBAAuB;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,aAAa;AACb,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Init command - Per-project initialization for AutomatosX
3
+ *
4
+ * Creates project-local structure and registers MCP with provider CLIs.
5
+ * Run this in each project directory to set up AutomatosX integration.
6
+ *
7
+ * Separation of concerns:
8
+ * - `ax setup`: Global, one-time system setup (provider detection, global config)
9
+ * - `ax init`: Per-project initialization (project structure, MCP registration)
10
+ */
11
+ import type { CommandResult, CLIOptions } from '../types.js';
12
+ /**
13
+ * Init command handler
14
+ *
15
+ * Initializes AutomatosX for the current project:
16
+ * 1. Creates .automatosx/ project structure
17
+ * 2. Registers MCP with all detected provider CLIs
18
+ *
19
+ * Usage:
20
+ * ax init Initialize current project
21
+ * ax init --force Overwrite existing files
22
+ * ax init --skip-mcp Skip MCP registration
23
+ * ax init --silent Minimal output
24
+ */
25
+ export declare function initCommand(args: string[], options: CLIOptions): Promise<CommandResult>;
26
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8d7D;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,aAAa,CAAC,CA2JxB"}
@@ -0,0 +1,526 @@
1
+ /**
2
+ * Init command - Per-project initialization for AutomatosX
3
+ *
4
+ * Creates project-local structure and registers MCP with provider CLIs.
5
+ * Run this in each project directory to set up AutomatosX integration.
6
+ *
7
+ * Separation of concerns:
8
+ * - `ax setup`: Global, one-time system setup (provider detection, global config)
9
+ * - `ax init`: Per-project initialization (project structure, MCP registration)
10
+ */
11
+ import { exec } from 'node:child_process';
12
+ import { promisify } from 'node:util';
13
+ import { mkdir, writeFile, readFile, access } from 'node:fs/promises';
14
+ import { join } from 'node:path';
15
+ import { DATA_DIR_NAME, CONFIG_FILENAME, TIMEOUT_SETUP_ADD, TIMEOUT_SETUP_REMOVE, DEFAULT_SCHEMA_VERSION, ITERATE_MAX_DEFAULT, ITERATE_TIMEOUT_DEFAULT, } from '@defai.digital/contracts';
16
+ import { CONTEXT_DIRECTORY } from '@defai.digital/context-domain';
17
+ import { createConfigStore } from '@defai.digital/config-domain';
18
+ import { PROVIDER_CHECKS, checkProviderCLI } from './doctor.js';
19
+ const execAsync = promisify(exec);
20
+ // ============================================================================
21
+ // Constants
22
+ // ============================================================================
23
+ /** MCP server name registered with provider CLIs */
24
+ const MCP_SERVER_NAME = 'automatosx';
25
+ /** MCP subcommands */
26
+ const MCP_COMMANDS = {
27
+ add: 'mcp add',
28
+ remove: 'mcp remove',
29
+ serverArgs: 'mcp server',
30
+ };
31
+ /** MCP command flags for different formats */
32
+ const MCP_FLAGS = {
33
+ claudeScope: '-s local',
34
+ command: '-c',
35
+ args: '-a',
36
+ };
37
+ /** Pattern to detect successful MCP server addition in output */
38
+ const MCP_SUCCESS_PATTERN = /Added MCP server|server.*added|successfully added/i;
39
+ /** Fallback CLI command when binary path cannot be determined */
40
+ const CLI_FALLBACK_COMMAND = 'ax';
41
+ /** Node.js executable for running scripts */
42
+ const NODE_EXECUTABLE = 'node';
43
+ /** Conventions file name in context directory */
44
+ const CONVENTIONS_FILENAME = 'conventions.md';
45
+ /** Default error message when error type is unknown */
46
+ const FALLBACK_ERROR_MESSAGE = 'Unknown error';
47
+ /** Stderr redirect suffix for shell commands */
48
+ const STDERR_REDIRECT = '2>&1';
49
+ /** JSON formatting indentation */
50
+ const JSON_INDENT = 2;
51
+ /** Exit codes for CLI commands */
52
+ const EXIT_CODE = {
53
+ SUCCESS: 0,
54
+ FAILURE: 1,
55
+ };
56
+ /** Health check status values */
57
+ const HEALTH_STATUS = {
58
+ PASS: 'pass',
59
+ FAIL: 'fail',
60
+ };
61
+ /** CLI argument flags */
62
+ const CLI_FLAGS = {
63
+ force: ['--force', '-f'],
64
+ silent: ['--silent', '-s'],
65
+ skipMcp: ['--skip-mcp', '--no-mcp'],
66
+ };
67
+ /** Terminal color codes */
68
+ const COLORS = {
69
+ reset: '\x1b[0m',
70
+ green: '\x1b[32m',
71
+ red: '\x1b[31m',
72
+ yellow: '\x1b[33m',
73
+ cyan: '\x1b[36m',
74
+ bold: '\x1b[1m',
75
+ dim: '\x1b[2m',
76
+ };
77
+ /** Terminal output icons */
78
+ const ICONS = {
79
+ check: `${COLORS.green}\u2713${COLORS.reset}`,
80
+ cross: `${COLORS.red}\u2717${COLORS.reset}`,
81
+ warn: `${COLORS.yellow}\u26A0${COLORS.reset}`,
82
+ arrow: `${COLORS.cyan}\u2192${COLORS.reset}`,
83
+ };
84
+ const PROVIDER_MCP_CONFIGS = {
85
+ claude: { cliName: 'claude', format: 'claude' },
86
+ gemini: { cliName: 'gemini', format: 'standard' },
87
+ codex: { cliName: 'codex', format: 'standard' },
88
+ qwen: { cliName: 'qwen', format: 'standard' },
89
+ glm: { cliName: 'ax-glm', format: 'ax-wrapper' },
90
+ grok: { cliName: 'ax-grok', format: 'ax-wrapper' },
91
+ 'ax-cli': null,
92
+ };
93
+ function getCLIBinaryPath() {
94
+ const binaryPath = process.argv[1];
95
+ return binaryPath || CLI_FALLBACK_COMMAND;
96
+ }
97
+ function isAbsolutePath(filePath) {
98
+ return filePath.startsWith('/') || filePath.includes('\\');
99
+ }
100
+ function buildMCPServerCommand(binaryPath) {
101
+ if (isAbsolutePath(binaryPath)) {
102
+ return { executable: NODE_EXECUTABLE, arguments: `"${binaryPath}" ${MCP_COMMANDS.serverArgs}` };
103
+ }
104
+ return { executable: binaryPath, arguments: MCP_COMMANDS.serverArgs };
105
+ }
106
+ function buildMCPAddCommand(providerId) {
107
+ const mcpConfig = PROVIDER_MCP_CONFIGS[providerId];
108
+ if (!mcpConfig)
109
+ return null;
110
+ const binaryPath = getCLIBinaryPath();
111
+ const { executable, arguments: execArgs } = buildMCPServerCommand(binaryPath);
112
+ const { cliName, format } = mcpConfig;
113
+ switch (format) {
114
+ case 'standard':
115
+ return `${cliName} ${MCP_COMMANDS.add} ${MCP_SERVER_NAME} ${executable} ${execArgs}`;
116
+ case 'claude':
117
+ return `${cliName} ${MCP_COMMANDS.add} ${MCP_SERVER_NAME} ${MCP_FLAGS.claudeScope} ${executable} ${execArgs}`;
118
+ case 'ax-wrapper': {
119
+ const command = isAbsolutePath(binaryPath) ? NODE_EXECUTABLE : CLI_FALLBACK_COMMAND;
120
+ const commandArgs = isAbsolutePath(binaryPath) ? `${binaryPath} ${MCP_COMMANDS.serverArgs}` : MCP_COMMANDS.serverArgs;
121
+ return `${cliName} ${MCP_COMMANDS.add} ${MCP_SERVER_NAME} ${MCP_FLAGS.command} ${command} ${MCP_FLAGS.args} ${commandArgs}`;
122
+ }
123
+ default:
124
+ return null;
125
+ }
126
+ }
127
+ function buildMCPRemoveCommand(providerId) {
128
+ const mcpConfig = PROVIDER_MCP_CONFIGS[providerId];
129
+ if (!mcpConfig)
130
+ return null;
131
+ const scopeFlag = mcpConfig.format === 'claude' ? ` ${MCP_FLAGS.claudeScope}` : '';
132
+ return `${mcpConfig.cliName} ${MCP_COMMANDS.remove} ${MCP_SERVER_NAME}${scopeFlag}`;
133
+ }
134
+ function getAxWrapperSettingsPath(cliName) {
135
+ return join(process.cwd(), `.${cliName}`, 'settings.json');
136
+ }
137
+ async function configureAxWrapperMCP(cliName) {
138
+ const binaryPath = getCLIBinaryPath();
139
+ const settingsPath = getAxWrapperSettingsPath(cliName);
140
+ const settingsDir = join(process.cwd(), `.${cliName}`);
141
+ try {
142
+ await mkdir(settingsDir, { recursive: true });
143
+ let existingConfig = { mcpServers: {} };
144
+ try {
145
+ const content = await readFile(settingsPath, 'utf-8');
146
+ existingConfig = JSON.parse(content);
147
+ if (!existingConfig.mcpServers) {
148
+ existingConfig.mcpServers = {};
149
+ }
150
+ }
151
+ catch {
152
+ // File doesn't exist or is invalid
153
+ }
154
+ const args = isAbsolutePath(binaryPath)
155
+ ? [binaryPath, 'mcp', 'server']
156
+ : ['mcp', 'server'];
157
+ const command = isAbsolutePath(binaryPath) ? NODE_EXECUTABLE : binaryPath;
158
+ existingConfig.mcpServers[MCP_SERVER_NAME] = {
159
+ name: MCP_SERVER_NAME,
160
+ transport: {
161
+ type: 'stdio',
162
+ command,
163
+ args,
164
+ env: {},
165
+ framing: 'ndjson',
166
+ },
167
+ };
168
+ await writeFile(settingsPath, JSON.stringify(existingConfig, null, JSON_INDENT) + '\n');
169
+ return { success: true, skipped: false };
170
+ }
171
+ catch (err) {
172
+ return {
173
+ success: false,
174
+ skipped: false,
175
+ error: err instanceof Error ? err.message : FALLBACK_ERROR_MESSAGE,
176
+ };
177
+ }
178
+ }
179
+ function isMCPAdditionSuccessful(commandOutput) {
180
+ return MCP_SUCCESS_PATTERN.test(commandOutput);
181
+ }
182
+ function extractErrorMessage(rawError) {
183
+ if (rawError.includes('Command failed')) {
184
+ return rawError.split('\n').pop() || rawError;
185
+ }
186
+ return rawError;
187
+ }
188
+ async function configureMCPForProvider(providerId) {
189
+ const mcpConfig = PROVIDER_MCP_CONFIGS[providerId];
190
+ if (!mcpConfig) {
191
+ return { success: true, skipped: true };
192
+ }
193
+ if (mcpConfig.format === 'ax-wrapper') {
194
+ return configureAxWrapperMCP(mcpConfig.cliName);
195
+ }
196
+ const addCommand = buildMCPAddCommand(providerId);
197
+ const removeCommand = buildMCPRemoveCommand(providerId);
198
+ if (!addCommand) {
199
+ return { success: true, skipped: true };
200
+ }
201
+ try {
202
+ if (removeCommand) {
203
+ try {
204
+ await execAsync(`${removeCommand} ${STDERR_REDIRECT}`, { timeout: TIMEOUT_SETUP_REMOVE });
205
+ }
206
+ catch {
207
+ // Server might not exist
208
+ }
209
+ }
210
+ const { stdout, stderr } = await execAsync(`${addCommand} ${STDERR_REDIRECT}`, { timeout: TIMEOUT_SETUP_ADD });
211
+ const commandOutput = `${stdout}${stderr}`;
212
+ if (isMCPAdditionSuccessful(commandOutput)) {
213
+ return { success: true, skipped: false };
214
+ }
215
+ return { success: true, skipped: false };
216
+ }
217
+ catch (err) {
218
+ const execResult = err;
219
+ const errorMsg = execResult.message || FALLBACK_ERROR_MESSAGE;
220
+ const fullOutput = `${execResult.stdout || ''}${execResult.stderr || ''}${errorMsg}`;
221
+ if (isMCPAdditionSuccessful(fullOutput)) {
222
+ return { success: true, skipped: false };
223
+ }
224
+ return {
225
+ success: false,
226
+ skipped: false,
227
+ error: extractErrorMessage(errorMsg),
228
+ };
229
+ }
230
+ }
231
+ async function getInstalledProviderCLIs() {
232
+ const results = new Map();
233
+ for (const provider of PROVIDER_CHECKS) {
234
+ const checkResult = await checkProviderCLI(provider);
235
+ results.set(provider.id, checkResult);
236
+ }
237
+ return results;
238
+ }
239
+ async function configureMCPForAllProviders() {
240
+ const result = {
241
+ configured: [],
242
+ skipped: [],
243
+ notInstalled: [],
244
+ failed: [],
245
+ };
246
+ const installedProviders = await getInstalledProviderCLIs();
247
+ for (const [providerId, healthCheck] of installedProviders) {
248
+ if (healthCheck.status === HEALTH_STATUS.FAIL) {
249
+ result.notInstalled.push(providerId);
250
+ continue;
251
+ }
252
+ const configResult = await configureMCPForProvider(providerId);
253
+ if (configResult.skipped) {
254
+ result.skipped.push(providerId);
255
+ }
256
+ else if (configResult.success) {
257
+ result.configured.push(providerId);
258
+ }
259
+ else {
260
+ result.failed.push({
261
+ providerId,
262
+ error: configResult.error || FALLBACK_ERROR_MESSAGE,
263
+ });
264
+ }
265
+ }
266
+ return result;
267
+ }
268
+ // ============================================================================
269
+ // Project Structure Creation
270
+ // ============================================================================
271
+ const CONVENTIONS_TEMPLATE = `# Project Conventions
272
+
273
+ ## Code Style
274
+ <!-- Describe your coding standards -->
275
+ - Example: Use TypeScript strict mode
276
+ - Example: Prefer functional components over class components
277
+ - Example: Use named exports over default exports
278
+
279
+ ## Architecture
280
+ <!-- Describe your project structure -->
281
+ - Example: Domain-driven design with packages/core/*/
282
+ - Example: Contract-first: all types in packages/contracts/
283
+ - Example: No circular dependencies between packages
284
+
285
+ ## Testing
286
+ <!-- Describe testing practices -->
287
+ - Example: Use vitest for unit tests
288
+ - Example: Co-locate tests with source: *.test.ts
289
+ - Example: Mock external dependencies, not internal modules
290
+
291
+ ## Naming Conventions
292
+ <!-- Describe naming conventions -->
293
+ - Example: Use camelCase for variables and functions
294
+ - Example: Use PascalCase for types and classes
295
+ - Example: Prefix interfaces with I (e.g., IUserService)
296
+ `;
297
+ const PROJECT_CONFIG_TEMPLATE = {
298
+ version: DEFAULT_SCHEMA_VERSION,
299
+ iterate: {
300
+ maxIterations: ITERATE_MAX_DEFAULT,
301
+ maxTimeMs: ITERATE_TIMEOUT_DEFAULT,
302
+ autoConfirm: false,
303
+ },
304
+ };
305
+ async function fileExists(path) {
306
+ try {
307
+ await access(path);
308
+ return true;
309
+ }
310
+ catch {
311
+ return false;
312
+ }
313
+ }
314
+ async function createProjectStructure(projectDir, force) {
315
+ const created = [];
316
+ const skipped = [];
317
+ const automatosxDir = join(projectDir, DATA_DIR_NAME);
318
+ const contextDir = join(automatosxDir, CONTEXT_DIRECTORY);
319
+ const configPath = join(automatosxDir, CONFIG_FILENAME);
320
+ const conventionsPath = join(contextDir, CONVENTIONS_FILENAME);
321
+ try {
322
+ await mkdir(automatosxDir, { recursive: true });
323
+ }
324
+ catch {
325
+ // Directory may already exist
326
+ }
327
+ try {
328
+ await mkdir(contextDir, { recursive: true });
329
+ }
330
+ catch {
331
+ // Directory may already exist
332
+ }
333
+ const configExists = await fileExists(configPath);
334
+ if (!configExists || force) {
335
+ await writeFile(configPath, JSON.stringify(PROJECT_CONFIG_TEMPLATE, null, JSON_INDENT) + '\n');
336
+ created.push(`${DATA_DIR_NAME}/${CONFIG_FILENAME}`);
337
+ }
338
+ else {
339
+ skipped.push(`${DATA_DIR_NAME}/${CONFIG_FILENAME} (already exists)`);
340
+ }
341
+ const conventionsExists = await fileExists(conventionsPath);
342
+ if (!conventionsExists || force) {
343
+ await writeFile(conventionsPath, CONVENTIONS_TEMPLATE);
344
+ created.push(`${DATA_DIR_NAME}/${CONTEXT_DIRECTORY}/${CONVENTIONS_FILENAME}`);
345
+ }
346
+ else {
347
+ skipped.push(`${DATA_DIR_NAME}/${CONTEXT_DIRECTORY}/${CONVENTIONS_FILENAME} (already exists)`);
348
+ }
349
+ return { created, skipped };
350
+ }
351
+ function matchesFlag(arg, flags) {
352
+ return flags.includes(arg);
353
+ }
354
+ function parseInitArgs(args) {
355
+ let force = false;
356
+ let silent = false;
357
+ let skipMcp = false;
358
+ for (const arg of args) {
359
+ if (matchesFlag(arg, CLI_FLAGS.force)) {
360
+ force = true;
361
+ }
362
+ else if (matchesFlag(arg, CLI_FLAGS.silent)) {
363
+ silent = true;
364
+ }
365
+ else if (matchesFlag(arg, CLI_FLAGS.skipMcp)) {
366
+ skipMcp = true;
367
+ }
368
+ }
369
+ return { force, silent, skipMcp };
370
+ }
371
+ /**
372
+ * Init command handler
373
+ *
374
+ * Initializes AutomatosX for the current project:
375
+ * 1. Creates .automatosx/ project structure
376
+ * 2. Registers MCP with all detected provider CLIs
377
+ *
378
+ * Usage:
379
+ * ax init Initialize current project
380
+ * ax init --force Overwrite existing files
381
+ * ax init --skip-mcp Skip MCP registration
382
+ * ax init --silent Minimal output
383
+ */
384
+ export async function initCommand(args, options) {
385
+ const initOptions = parseInitArgs(args);
386
+ const isJsonFormat = options.format === 'json';
387
+ const isSilent = initOptions.silent;
388
+ const showOutput = !isJsonFormat && !isSilent;
389
+ const outputLines = [];
390
+ try {
391
+ // Check if global config exists (warning only, don't block)
392
+ const configStore = createConfigStore();
393
+ const globalConfigExists = await configStore.exists('global');
394
+ if (showOutput) {
395
+ outputLines.push('');
396
+ outputLines.push(`${COLORS.bold}AutomatosX Project Init${COLORS.reset}`);
397
+ outputLines.push(`${COLORS.dim}Initializing project: ${process.cwd()}${COLORS.reset}`);
398
+ outputLines.push('');
399
+ if (!globalConfigExists) {
400
+ outputLines.push(`${ICONS.warn} Global config not found. Consider running ${COLORS.cyan}ax setup${COLORS.reset} first.`);
401
+ outputLines.push('');
402
+ }
403
+ }
404
+ // Check if project is already initialized
405
+ const projectDir = process.cwd();
406
+ const automatosxDir = join(projectDir, DATA_DIR_NAME);
407
+ const projectAlreadyInitialized = await fileExists(join(automatosxDir, CONFIG_FILENAME));
408
+ // Step 1: Create project structure
409
+ if (showOutput) {
410
+ if (projectAlreadyInitialized && !initOptions.force) {
411
+ outputLines.push(`${COLORS.bold}Step 1: Project Structure${COLORS.reset} ${COLORS.dim}(already initialized)${COLORS.reset}`);
412
+ }
413
+ else {
414
+ outputLines.push(`${COLORS.bold}Step 1: Project Structure${COLORS.reset}`);
415
+ }
416
+ }
417
+ const projectStructure = await createProjectStructure(process.cwd(), initOptions.force);
418
+ if (showOutput) {
419
+ if (projectStructure.created.length > 0) {
420
+ for (const filePath of projectStructure.created) {
421
+ outputLines.push(` ${ICONS.check} Created ${filePath}`);
422
+ }
423
+ }
424
+ if (projectStructure.skipped.length > 0) {
425
+ for (const filePath of projectStructure.skipped) {
426
+ outputLines.push(` ${ICONS.check} Verified ${filePath.replace(' (already exists)', '')}`);
427
+ }
428
+ }
429
+ outputLines.push('');
430
+ }
431
+ // Step 2: Configure MCP for all detected providers
432
+ let mcpResult;
433
+ if (!initOptions.skipMcp) {
434
+ if (showOutput) {
435
+ outputLines.push(`${COLORS.bold}Step 2: MCP Registration${COLORS.reset}`);
436
+ outputLines.push(` ${COLORS.dim}Registering AutomatosX MCP server with provider CLIs...${COLORS.reset}`);
437
+ }
438
+ mcpResult = await configureMCPForAllProviders();
439
+ if (showOutput) {
440
+ for (const providerId of mcpResult.configured) {
441
+ outputLines.push(` ${ICONS.check} ${providerId}: MCP registered`);
442
+ }
443
+ for (const providerId of mcpResult.notInstalled) {
444
+ outputLines.push(` ${COLORS.dim} - ${providerId}: CLI not installed${COLORS.reset}`);
445
+ }
446
+ for (const { providerId, error } of mcpResult.failed) {
447
+ outputLines.push(` ${ICONS.warn} ${providerId}: ${error}`);
448
+ }
449
+ if (mcpResult.configured.length === 0 && mcpResult.failed.length === 0) {
450
+ outputLines.push(` ${ICONS.warn} No provider CLIs detected. Run 'ax doctor' to check.`);
451
+ }
452
+ outputLines.push('');
453
+ }
454
+ }
455
+ else if (showOutput) {
456
+ outputLines.push(`${COLORS.bold}Step 2: MCP Registration${COLORS.reset}`);
457
+ outputLines.push(` ${COLORS.dim}Skipped (--skip-mcp)${COLORS.reset}`);
458
+ outputLines.push('');
459
+ }
460
+ // Summary
461
+ if (showOutput) {
462
+ outputLines.push(`${COLORS.bold}Done!${COLORS.reset}`);
463
+ outputLines.push(` Project files: ${projectStructure.created.length} created, ${projectStructure.skipped.length} skipped`);
464
+ if (mcpResult) {
465
+ outputLines.push(` MCP registered: ${mcpResult.configured.length} provider(s)`);
466
+ }
467
+ outputLines.push('');
468
+ outputLines.push(`${COLORS.bold}Next Steps${COLORS.reset}`);
469
+ outputLines.push(` 1. Edit ${COLORS.cyan}${DATA_DIR_NAME}/${CONTEXT_DIRECTORY}/${CONVENTIONS_FILENAME}${COLORS.reset} to add your project conventions`);
470
+ outputLines.push(` 2. Run ${COLORS.cyan}ax doctor${COLORS.reset} to verify providers`);
471
+ outputLines.push(` 3. Use ${COLORS.cyan}ax call claude "your task"${COLORS.reset} to start`);
472
+ outputLines.push('');
473
+ }
474
+ if (isJsonFormat) {
475
+ return {
476
+ success: true,
477
+ message: undefined,
478
+ data: {
479
+ success: true,
480
+ projectDir: process.cwd(),
481
+ globalConfigExists,
482
+ alreadyInitialized: projectAlreadyInitialized,
483
+ projectStructure: {
484
+ created: projectStructure.created,
485
+ skipped: projectStructure.skipped,
486
+ },
487
+ mcpConfiguration: mcpResult
488
+ ? {
489
+ configured: mcpResult.configured,
490
+ skipped: mcpResult.skipped,
491
+ notInstalled: mcpResult.notInstalled,
492
+ failed: mcpResult.failed,
493
+ }
494
+ : undefined,
495
+ },
496
+ exitCode: EXIT_CODE.SUCCESS,
497
+ };
498
+ }
499
+ return {
500
+ success: true,
501
+ message: outputLines.join('\n'),
502
+ data: undefined,
503
+ exitCode: EXIT_CODE.SUCCESS,
504
+ };
505
+ }
506
+ catch (err) {
507
+ const errorMsg = err instanceof Error ? err.message : FALLBACK_ERROR_MESSAGE;
508
+ if (isJsonFormat) {
509
+ return {
510
+ success: false,
511
+ message: undefined,
512
+ data: { error: errorMsg },
513
+ exitCode: EXIT_CODE.FAILURE,
514
+ };
515
+ }
516
+ outputLines.push(`${ICONS.cross} Init failed: ${errorMsg}`);
517
+ outputLines.push('');
518
+ return {
519
+ success: false,
520
+ message: outputLines.join('\n'),
521
+ data: undefined,
522
+ exitCode: EXIT_CODE.FAILURE,
523
+ };
524
+ }
525
+ }
526
+ //# sourceMappingURL=init.js.map