@bhimudev/gnanai 0.4.0

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.
Files changed (274) hide show
  1. package/README.md +270 -0
  2. package/dist/bin/cli.d.ts +3 -0
  3. package/dist/bin/cli.d.ts.map +1 -0
  4. package/dist/bin/cli.js +188 -0
  5. package/dist/bin/cli.js.map +1 -0
  6. package/dist/commands/cleanup.d.ts +21 -0
  7. package/dist/commands/cleanup.d.ts.map +1 -0
  8. package/dist/commands/cleanup.js +380 -0
  9. package/dist/commands/cleanup.js.map +1 -0
  10. package/dist/commands/dispatch.d.ts +13 -0
  11. package/dist/commands/dispatch.d.ts.map +1 -0
  12. package/dist/commands/dispatch.js +85 -0
  13. package/dist/commands/dispatch.js.map +1 -0
  14. package/dist/commands/doctor.d.ts +2 -0
  15. package/dist/commands/doctor.d.ts.map +1 -0
  16. package/dist/commands/doctor.js +155 -0
  17. package/dist/commands/doctor.js.map +1 -0
  18. package/dist/commands/generate.d.ts +3 -0
  19. package/dist/commands/generate.d.ts.map +1 -0
  20. package/dist/commands/generate.js +167 -0
  21. package/dist/commands/generate.js.map +1 -0
  22. package/dist/commands/init.d.ts +10 -0
  23. package/dist/commands/init.d.ts.map +1 -0
  24. package/dist/commands/init.js +711 -0
  25. package/dist/commands/init.js.map +1 -0
  26. package/dist/commands/knowledge-sync.d.ts +69 -0
  27. package/dist/commands/knowledge-sync.d.ts.map +1 -0
  28. package/dist/commands/knowledge-sync.js +661 -0
  29. package/dist/commands/knowledge-sync.js.map +1 -0
  30. package/dist/commands/knowledge.d.ts +35 -0
  31. package/dist/commands/knowledge.d.ts.map +1 -0
  32. package/dist/commands/knowledge.js +254 -0
  33. package/dist/commands/knowledge.js.map +1 -0
  34. package/dist/commands/rollback.d.ts +13 -0
  35. package/dist/commands/rollback.d.ts.map +1 -0
  36. package/dist/commands/rollback.js +186 -0
  37. package/dist/commands/rollback.js.map +1 -0
  38. package/dist/commands/setup-config.d.ts +6 -0
  39. package/dist/commands/setup-config.d.ts.map +1 -0
  40. package/dist/commands/setup-config.js +663 -0
  41. package/dist/commands/setup-config.js.map +1 -0
  42. package/dist/commands/setup-project.d.ts +6 -0
  43. package/dist/commands/setup-project.d.ts.map +1 -0
  44. package/dist/commands/setup-project.js +361 -0
  45. package/dist/commands/setup-project.js.map +1 -0
  46. package/dist/commands/setup.d.ts +3 -0
  47. package/dist/commands/setup.d.ts.map +1 -0
  48. package/dist/commands/setup.js +293 -0
  49. package/dist/commands/setup.js.map +1 -0
  50. package/dist/commands/status.d.ts +51 -0
  51. package/dist/commands/status.d.ts.map +1 -0
  52. package/dist/commands/status.js +182 -0
  53. package/dist/commands/status.js.map +1 -0
  54. package/dist/commands/uninstall.d.ts +3 -0
  55. package/dist/commands/uninstall.d.ts.map +1 -0
  56. package/dist/commands/uninstall.js +173 -0
  57. package/dist/commands/uninstall.js.map +1 -0
  58. package/dist/commands/update.d.ts +10 -0
  59. package/dist/commands/update.d.ts.map +1 -0
  60. package/dist/commands/update.js +435 -0
  61. package/dist/commands/update.js.map +1 -0
  62. package/dist/commands/worktree.d.ts +30 -0
  63. package/dist/commands/worktree.d.ts.map +1 -0
  64. package/dist/commands/worktree.js +262 -0
  65. package/dist/commands/worktree.js.map +1 -0
  66. package/dist/generator/claude-cli.d.ts +24 -0
  67. package/dist/generator/claude-cli.d.ts.map +1 -0
  68. package/dist/generator/claude-cli.js +239 -0
  69. package/dist/generator/claude-cli.js.map +1 -0
  70. package/dist/generator/prompt-builder.d.ts +7 -0
  71. package/dist/generator/prompt-builder.d.ts.map +1 -0
  72. package/dist/generator/prompt-builder.js +144 -0
  73. package/dist/generator/prompt-builder.js.map +1 -0
  74. package/dist/index.d.ts +36 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +45 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/mcp/embeddings.d.ts +53 -0
  79. package/dist/mcp/embeddings.d.ts.map +1 -0
  80. package/dist/mcp/embeddings.js +68 -0
  81. package/dist/mcp/embeddings.js.map +1 -0
  82. package/dist/mcp/hybrid-search.d.ts +25 -0
  83. package/dist/mcp/hybrid-search.d.ts.map +1 -0
  84. package/dist/mcp/hybrid-search.js +72 -0
  85. package/dist/mcp/hybrid-search.js.map +1 -0
  86. package/dist/mcp/knowledge-server.d.ts +4 -0
  87. package/dist/mcp/knowledge-server.d.ts.map +1 -0
  88. package/dist/mcp/knowledge-server.js +294 -0
  89. package/dist/mcp/knowledge-server.js.map +1 -0
  90. package/dist/mcp/knowledge-utils.d.ts +65 -0
  91. package/dist/mcp/knowledge-utils.d.ts.map +1 -0
  92. package/dist/mcp/knowledge-utils.js +207 -0
  93. package/dist/mcp/knowledge-utils.js.map +1 -0
  94. package/dist/mcp/search-factory.d.ts +9 -0
  95. package/dist/mcp/search-factory.d.ts.map +1 -0
  96. package/dist/mcp/search-factory.js +23 -0
  97. package/dist/mcp/search-factory.js.map +1 -0
  98. package/dist/mcp/search-index.d.ts +45 -0
  99. package/dist/mcp/search-index.d.ts.map +1 -0
  100. package/dist/mcp/search-index.js +2 -0
  101. package/dist/mcp/search-index.js.map +1 -0
  102. package/dist/mcp/search-minisearch.d.ts +46 -0
  103. package/dist/mcp/search-minisearch.d.ts.map +1 -0
  104. package/dist/mcp/search-minisearch.js +99 -0
  105. package/dist/mcp/search-minisearch.js.map +1 -0
  106. package/dist/mcp/search-sqlite.d.ts +30 -0
  107. package/dist/mcp/search-sqlite.d.ts.map +1 -0
  108. package/dist/mcp/search-sqlite.js +188 -0
  109. package/dist/mcp/search-sqlite.js.map +1 -0
  110. package/dist/mcp/vector-store.d.ts +52 -0
  111. package/dist/mcp/vector-store.d.ts.map +1 -0
  112. package/dist/mcp/vector-store.js +183 -0
  113. package/dist/mcp/vector-store.js.map +1 -0
  114. package/dist/scaffold/copy-core-agents.d.ts +2 -0
  115. package/dist/scaffold/copy-core-agents.d.ts.map +1 -0
  116. package/dist/scaffold/copy-core-agents.js +90 -0
  117. package/dist/scaffold/copy-core-agents.js.map +1 -0
  118. package/dist/scaffold/create-claude-settings.d.ts +40 -0
  119. package/dist/scaffold/create-claude-settings.d.ts.map +1 -0
  120. package/dist/scaffold/create-claude-settings.js +422 -0
  121. package/dist/scaffold/create-claude-settings.js.map +1 -0
  122. package/dist/scaffold/create-config.d.ts +14 -0
  123. package/dist/scaffold/create-config.d.ts.map +1 -0
  124. package/dist/scaffold/create-config.js +199 -0
  125. package/dist/scaffold/create-config.js.map +1 -0
  126. package/dist/scaffold/create-project-description.d.ts +12 -0
  127. package/dist/scaffold/create-project-description.d.ts.map +1 -0
  128. package/dist/scaffold/create-project-description.js +104 -0
  129. package/dist/scaffold/create-project-description.js.map +1 -0
  130. package/dist/scaffold/create-structure.d.ts +2 -0
  131. package/dist/scaffold/create-structure.d.ts.map +1 -0
  132. package/dist/scaffold/create-structure.js +146 -0
  133. package/dist/scaffold/create-structure.js.map +1 -0
  134. package/dist/types/dependency-analysis.d.ts +11 -0
  135. package/dist/types/dependency-analysis.d.ts.map +1 -0
  136. package/dist/types/dependency-analysis.js +2 -0
  137. package/dist/types/dependency-analysis.js.map +1 -0
  138. package/dist/types/index.d.ts +526 -0
  139. package/dist/types/index.d.ts.map +1 -0
  140. package/dist/types/index.js +3 -0
  141. package/dist/types/index.js.map +1 -0
  142. package/dist/types/task.d.ts +25 -0
  143. package/dist/types/task.d.ts.map +1 -0
  144. package/dist/types/task.js +3 -0
  145. package/dist/types/task.js.map +1 -0
  146. package/dist/utils/analyze-files.d.ts +7 -0
  147. package/dist/utils/analyze-files.d.ts.map +1 -0
  148. package/dist/utils/analyze-files.js +27 -0
  149. package/dist/utils/analyze-files.js.map +1 -0
  150. package/dist/utils/backup.d.ts +102 -0
  151. package/dist/utils/backup.d.ts.map +1 -0
  152. package/dist/utils/backup.js +352 -0
  153. package/dist/utils/backup.js.map +1 -0
  154. package/dist/utils/ci-provider.d.ts +23 -0
  155. package/dist/utils/ci-provider.d.ts.map +1 -0
  156. package/dist/utils/ci-provider.js +525 -0
  157. package/dist/utils/ci-provider.js.map +1 -0
  158. package/dist/utils/ci-status.d.ts +57 -0
  159. package/dist/utils/ci-status.d.ts.map +1 -0
  160. package/dist/utils/ci-status.js +349 -0
  161. package/dist/utils/ci-status.js.map +1 -0
  162. package/dist/utils/dependency-analysis.d.ts +34 -0
  163. package/dist/utils/dependency-analysis.d.ts.map +1 -0
  164. package/dist/utils/dependency-analysis.js +298 -0
  165. package/dist/utils/dependency-analysis.js.map +1 -0
  166. package/dist/utils/detect-git.d.ts +57 -0
  167. package/dist/utils/detect-git.d.ts.map +1 -0
  168. package/dist/utils/detect-git.js +439 -0
  169. package/dist/utils/detect-git.js.map +1 -0
  170. package/dist/utils/detect-mcp.d.ts +32 -0
  171. package/dist/utils/detect-mcp.d.ts.map +1 -0
  172. package/dist/utils/detect-mcp.js +178 -0
  173. package/dist/utils/detect-mcp.js.map +1 -0
  174. package/dist/utils/detect-project.d.ts +3 -0
  175. package/dist/utils/detect-project.d.ts.map +1 -0
  176. package/dist/utils/detect-project.js +155 -0
  177. package/dist/utils/detect-project.js.map +1 -0
  178. package/dist/utils/file-comparison.d.ts +89 -0
  179. package/dist/utils/file-comparison.d.ts.map +1 -0
  180. package/dist/utils/file-comparison.js +301 -0
  181. package/dist/utils/file-comparison.js.map +1 -0
  182. package/dist/utils/file-merger.d.ts +74 -0
  183. package/dist/utils/file-merger.d.ts.map +1 -0
  184. package/dist/utils/file-merger.js +350 -0
  185. package/dist/utils/file-merger.js.map +1 -0
  186. package/dist/utils/logger.d.ts +26 -0
  187. package/dist/utils/logger.d.ts.map +1 -0
  188. package/dist/utils/logger.js +72 -0
  189. package/dist/utils/logger.js.map +1 -0
  190. package/dist/utils/managed-process.d.ts +109 -0
  191. package/dist/utils/managed-process.d.ts.map +1 -0
  192. package/dist/utils/managed-process.js +481 -0
  193. package/dist/utils/managed-process.js.map +1 -0
  194. package/dist/utils/merge-claude-settings.d.ts +65 -0
  195. package/dist/utils/merge-claude-settings.d.ts.map +1 -0
  196. package/dist/utils/merge-claude-settings.js +133 -0
  197. package/dist/utils/merge-claude-settings.js.map +1 -0
  198. package/dist/utils/migration.d.ts +74 -0
  199. package/dist/utils/migration.d.ts.map +1 -0
  200. package/dist/utils/migration.js +345 -0
  201. package/dist/utils/migration.js.map +1 -0
  202. package/dist/utils/process-health.d.ts +51 -0
  203. package/dist/utils/process-health.d.ts.map +1 -0
  204. package/dist/utils/process-health.js +123 -0
  205. package/dist/utils/process-health.js.map +1 -0
  206. package/dist/utils/process-registry.d.ts +20 -0
  207. package/dist/utils/process-registry.d.ts.map +1 -0
  208. package/dist/utils/process-registry.js +151 -0
  209. package/dist/utils/process-registry.js.map +1 -0
  210. package/dist/utils/process-tree.d.ts +51 -0
  211. package/dist/utils/process-tree.d.ts.map +1 -0
  212. package/dist/utils/process-tree.js +499 -0
  213. package/dist/utils/process-tree.js.map +1 -0
  214. package/dist/utils/repair-mcp-config.d.ts +15 -0
  215. package/dist/utils/repair-mcp-config.d.ts.map +1 -0
  216. package/dist/utils/repair-mcp-config.js +129 -0
  217. package/dist/utils/repair-mcp-config.js.map +1 -0
  218. package/dist/utils/task-lifecycle.d.ts +60 -0
  219. package/dist/utils/task-lifecycle.d.ts.map +1 -0
  220. package/dist/utils/task-lifecycle.js +310 -0
  221. package/dist/utils/task-lifecycle.js.map +1 -0
  222. package/dist/utils/update-agent-mcp.d.ts +7 -0
  223. package/dist/utils/update-agent-mcp.d.ts.map +1 -0
  224. package/dist/utils/update-agent-mcp.js +115 -0
  225. package/dist/utils/update-agent-mcp.js.map +1 -0
  226. package/dist/utils/update-agent-templates.d.ts +6 -0
  227. package/dist/utils/update-agent-templates.d.ts.map +1 -0
  228. package/dist/utils/update-agent-templates.js +56 -0
  229. package/dist/utils/update-agent-templates.js.map +1 -0
  230. package/dist/utils/update-config-ci.d.ts +7 -0
  231. package/dist/utils/update-config-ci.d.ts.map +1 -0
  232. package/dist/utils/update-config-ci.js +72 -0
  233. package/dist/utils/update-config-ci.js.map +1 -0
  234. package/dist/utils/update-config-git.d.ts +18 -0
  235. package/dist/utils/update-config-git.d.ts.map +1 -0
  236. package/dist/utils/update-config-git.js +146 -0
  237. package/dist/utils/update-config-git.js.map +1 -0
  238. package/dist/utils/update-config-mcp.d.ts +7 -0
  239. package/dist/utils/update-config-mcp.d.ts.map +1 -0
  240. package/dist/utils/update-config-mcp.js +98 -0
  241. package/dist/utils/update-config-mcp.js.map +1 -0
  242. package/dist/utils/validate-config.d.ts +3 -0
  243. package/dist/utils/validate-config.d.ts.map +1 -0
  244. package/dist/utils/validate-config.js +109 -0
  245. package/dist/utils/validate-config.js.map +1 -0
  246. package/dist/utils/version-tracker.d.ts +130 -0
  247. package/dist/utils/version-tracker.d.ts.map +1 -0
  248. package/dist/utils/version-tracker.js +298 -0
  249. package/dist/utils/version-tracker.js.map +1 -0
  250. package/dist/utils/worktree.d.ts +68 -0
  251. package/dist/utils/worktree.d.ts.map +1 -0
  252. package/dist/utils/worktree.js +446 -0
  253. package/dist/utils/worktree.js.map +1 -0
  254. package/package.json +77 -0
  255. package/templates/ARCHAI_README.md +329 -0
  256. package/templates/CLAUDE.md +67 -0
  257. package/templates/PROMPTS.md +506 -0
  258. package/templates/core-agents/boss-agent.md +671 -0
  259. package/templates/core-agents/cleanup-agent.md +145 -0
  260. package/templates/core-agents/code-reviewer.md +175 -0
  261. package/templates/core-agents/critical-reviewer.md +117 -0
  262. package/templates/core-agents/deep-analyst.md +216 -0
  263. package/templates/core-agents/finalization-agent.md +252 -0
  264. package/templates/core-agents/git-coordinator.md +240 -0
  265. package/templates/core-agents/implementation-agent.md +151 -0
  266. package/templates/core-agents/maestro-agent.md +413 -0
  267. package/templates/core-agents/maestro-headless-agent.md +422 -0
  268. package/templates/core-agents/plan-validator.md +198 -0
  269. package/templates/core-agents/quick-fix.md +56 -0
  270. package/templates/core-agents/routing-templates.md +338 -0
  271. package/templates/core-agents/task-orchestrator.md +143 -0
  272. package/templates/core-agents/task-prep.md +202 -0
  273. package/templates/core-agents/tdd-designer.md +143 -0
  274. package/templates/specialist-meta.md +275 -0
@@ -0,0 +1,663 @@
1
+ import inquirer from 'inquirer';
2
+ import chalk from 'chalk';
3
+ import ora from 'ora';
4
+ import fs from 'fs-extra';
5
+ import { logger } from '../utils/logger.js';
6
+ import { getPresetCommands, createClaudeSettings, generatePermissionsMarkdown, } from '../scaffold/create-claude-settings.js';
7
+ const FILE_PATH = 'archai.config.md';
8
+ const PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn', 'bun', 'pip', 'cargo', 'go', 'other'];
9
+ export async function setupConfig(options) {
10
+ logger.banner();
11
+ // Check if file exists
12
+ const exists = await fs.pathExists(FILE_PATH);
13
+ if (!exists) {
14
+ logger.error('archai.config.md not found!');
15
+ console.log('');
16
+ logger.info('Run `archai init` first to create the configuration file.');
17
+ return;
18
+ }
19
+ // Load existing config
20
+ const existing = await parseExistingConfig();
21
+ console.log('');
22
+ logger.section('Configuration Wizard');
23
+ console.log(chalk.gray(' Configure your project settings and define specialists.'));
24
+ console.log(chalk.gray(' Press Enter to keep existing values.'));
25
+ console.log('');
26
+ // Section 1: Tech Stack
27
+ logger.section('1. Tech Stack');
28
+ console.log('');
29
+ const stackAnswers = await inquirer.prompt([
30
+ {
31
+ type: 'input',
32
+ name: 'languages',
33
+ message: 'Programming languages:',
34
+ default: existing.languages || '',
35
+ },
36
+ {
37
+ type: 'input',
38
+ name: 'frameworks',
39
+ message: 'Frameworks/libraries:',
40
+ default: existing.frameworks || '',
41
+ },
42
+ {
43
+ type: 'input',
44
+ name: 'testing',
45
+ message: 'Testing framework:',
46
+ default: existing.testing || '',
47
+ },
48
+ {
49
+ type: 'input',
50
+ name: 'additionalTech',
51
+ message: 'Additional technologies (databases, caching, etc.):',
52
+ default: '',
53
+ },
54
+ ]);
55
+ // Section 2: Commands
56
+ console.log('');
57
+ logger.section('2. Commands');
58
+ console.log('');
59
+ const pmDefault = existing.packageManager || 'npm';
60
+ const pmCommands = getPackageManagerCommands(pmDefault);
61
+ const commandAnswers = await inquirer.prompt([
62
+ {
63
+ type: 'list',
64
+ name: 'packageManager',
65
+ message: 'Package manager:',
66
+ choices: PACKAGE_MANAGERS,
67
+ default: pmDefault,
68
+ },
69
+ {
70
+ type: 'input',
71
+ name: 'installCommand',
72
+ message: 'Install command:',
73
+ default: (answers) => {
74
+ const cmds = getPackageManagerCommands(answers.packageManager);
75
+ return existing.installCommand || cmds.install || '';
76
+ },
77
+ },
78
+ {
79
+ type: 'input',
80
+ name: 'buildCommand',
81
+ message: 'Build command:',
82
+ default: (answers) => {
83
+ const cmds = getPackageManagerCommands(answers.packageManager);
84
+ return existing.buildCommand || cmds.build || '';
85
+ },
86
+ },
87
+ {
88
+ type: 'input',
89
+ name: 'testCommand',
90
+ message: 'Test command:',
91
+ default: (answers) => {
92
+ const cmds = getPackageManagerCommands(answers.packageManager);
93
+ return existing.testCommand || cmds.test || '';
94
+ },
95
+ },
96
+ {
97
+ type: 'input',
98
+ name: 'lintCommand',
99
+ message: 'Lint command:',
100
+ default: (answers) => {
101
+ const cmds = getPackageManagerCommands(answers.packageManager);
102
+ return existing.lintCommand || cmds.lint || '';
103
+ },
104
+ },
105
+ {
106
+ type: 'input',
107
+ name: 'devCommand',
108
+ message: 'Dev/run command:',
109
+ default: (answers) => {
110
+ const cmds = getPackageManagerCommands(answers.packageManager);
111
+ return existing.devCommand || cmds.dev || '';
112
+ },
113
+ },
114
+ ]);
115
+ // Section 3: Project Structure
116
+ console.log('');
117
+ logger.section('3. Project Structure');
118
+ console.log('');
119
+ const structureAnswers = await inquirer.prompt([
120
+ {
121
+ type: 'input',
122
+ name: 'sourceDirectory',
123
+ message: 'Source directory:',
124
+ default: existing.sourceDirectory || 'src/',
125
+ },
126
+ {
127
+ type: 'input',
128
+ name: 'testsDirectory',
129
+ message: 'Tests directory:',
130
+ default: existing.testsDirectory || 'tests/',
131
+ },
132
+ {
133
+ type: 'input',
134
+ name: 'keyFiles',
135
+ message: 'Key files agents should know about (comma-separated, format: "file:purpose"):',
136
+ default: '',
137
+ },
138
+ ]);
139
+ // Section 4: Specialists
140
+ console.log('');
141
+ logger.section('4. Specialist Agents');
142
+ console.log('');
143
+ console.log(chalk.gray(' Define specialist agents for your project.'));
144
+ console.log(chalk.gray(' Common types: frontend, backend, api, database, auth, devops, testing'));
145
+ console.log('');
146
+ const specialists = await specialistWizard();
147
+ // Section 5: Permissions
148
+ console.log('');
149
+ logger.section('5. Permissions');
150
+ console.log('');
151
+ console.log(chalk.gray(' Configure what commands Claude agents can execute.'));
152
+ console.log('');
153
+ const permissionAnswers = await permissionsWizard(commandAnswers.packageManager);
154
+ // Section 6: MCP/Skills info
155
+ console.log('');
156
+ logger.section('6. MCP Servers & Skills');
157
+ console.log('');
158
+ console.log(chalk.gray(' MCP servers extend agent capabilities with external tools.'));
159
+ console.log(chalk.yellow(' Note: MCP configuration is added as a placeholder.'));
160
+ console.log(chalk.yellow(' Edit the config file manually to configure MCP servers.'));
161
+ console.log(chalk.cyan(' → See Claude Code documentation for MCP setup'));
162
+ console.log('');
163
+ // Combine answers
164
+ const answers = {
165
+ ...stackAnswers,
166
+ ...commandAnswers,
167
+ ...structureAnswers,
168
+ specialists,
169
+ ...permissionAnswers,
170
+ };
171
+ // Generate config
172
+ console.log('');
173
+ const spinner = ora('Updating configuration...').start();
174
+ const content = generateConfig(answers, existing);
175
+ await fs.writeFile(FILE_PATH, content);
176
+ // Generate .claude/settings.local.json
177
+ const permissionConfig = {
178
+ preset: answers.permissionPreset,
179
+ packageManager: answers.packageManager,
180
+ customAllowCommands: answers.customAllowCommands,
181
+ customDenyCommands: answers.customDenyCommands,
182
+ };
183
+ await createClaudeSettings(permissionConfig);
184
+ spinner.succeed('Updated archai.config.md');
185
+ if (answers.permissionPreset !== 'skip') {
186
+ console.log(chalk.green(' ✓ Created .claude/settings.local.json'));
187
+ }
188
+ // Final output
189
+ console.log('');
190
+ logger.divider();
191
+ console.log('');
192
+ logger.success('Configuration updated!');
193
+ console.log('');
194
+ if (specialists.length > 0) {
195
+ console.log(chalk.white(`Defined ${specialists.length} specialist(s):`));
196
+ specialists.forEach(s => {
197
+ console.log(chalk.cyan(` • ${s.name}-specialist`));
198
+ });
199
+ console.log('');
200
+ }
201
+ logger.section('Next Steps');
202
+ console.log('');
203
+ console.log(chalk.white('1. Review your configuration:'));
204
+ console.log(chalk.cyan(' → archai.config.md'));
205
+ console.log('');
206
+ console.log(chalk.white('2. Configure MCP servers (optional):'));
207
+ console.log(chalk.cyan(' → Edit the "MCP Servers & Skills" section in archai.config.md'));
208
+ console.log('');
209
+ console.log(chalk.white('3. Generate specialist agents:'));
210
+ console.log(chalk.cyan(' → archai generate'));
211
+ console.log('');
212
+ }
213
+ async function specialistWizard() {
214
+ const specialists = [];
215
+ const { addSpecialists } = await inquirer.prompt([{
216
+ type: 'confirm',
217
+ name: 'addSpecialists',
218
+ message: 'Would you like to define specialist agents?',
219
+ default: true,
220
+ }]);
221
+ if (!addSpecialists) {
222
+ return specialists;
223
+ }
224
+ let addMore = true;
225
+ while (addMore) {
226
+ console.log('');
227
+ const { name } = await inquirer.prompt([{
228
+ type: 'input',
229
+ name: 'name',
230
+ message: 'Specialist name (e.g., "frontend", "api", "database"):',
231
+ validate: (input) => {
232
+ if (!input.trim())
233
+ return 'Name is required';
234
+ if (input.includes(' '))
235
+ return 'Use lowercase with no spaces (e.g., "frontend" not "front end")';
236
+ return true;
237
+ },
238
+ }]);
239
+ const { focus } = await inquirer.prompt([{
240
+ type: 'input',
241
+ name: 'focus',
242
+ message: `What does ${name}-specialist focus on?`,
243
+ default: '',
244
+ }]);
245
+ const { concerns } = await inquirer.prompt([{
246
+ type: 'input',
247
+ name: 'concerns',
248
+ message: 'Key concerns (comma-separated):',
249
+ default: '',
250
+ }]);
251
+ const keyConcerns = concerns
252
+ .split(',')
253
+ .map((c) => c.trim())
254
+ .filter(Boolean);
255
+ specialists.push({ name: name.toLowerCase(), focus, keyConcerns });
256
+ console.log(chalk.green(` ✓ Added ${name}-specialist`));
257
+ const { more } = await inquirer.prompt([{
258
+ type: 'confirm',
259
+ name: 'more',
260
+ message: 'Add another specialist?',
261
+ default: specialists.length < 3,
262
+ }]);
263
+ addMore = more;
264
+ }
265
+ return specialists;
266
+ }
267
+ async function permissionsWizard(packageManager) {
268
+ const { preset } = await inquirer.prompt([{
269
+ type: 'list',
270
+ name: 'preset',
271
+ message: 'Permission level:',
272
+ choices: [
273
+ {
274
+ name: `${chalk.green('Permissive')} - ${chalk.gray('Everything except irreversible actions')}`,
275
+ value: 'permissive',
276
+ },
277
+ {
278
+ name: `${chalk.yellow('Strict')} - ${chalk.gray('Only safe operations (no network, no push)')}`,
279
+ value: 'strict',
280
+ },
281
+ {
282
+ name: `${chalk.cyan('Custom')} - ${chalk.gray('Define your own commands')}`,
283
+ value: 'custom',
284
+ },
285
+ {
286
+ name: `${chalk.gray('Skip')} - ${chalk.gray('Configure manually later')}`,
287
+ value: 'skip',
288
+ },
289
+ ],
290
+ default: 'permissive',
291
+ }]);
292
+ if (preset === 'skip') {
293
+ return { permissionPreset: 'skip' };
294
+ }
295
+ // Show what the preset includes
296
+ const { allow, deny } = getPresetCommands(preset, packageManager);
297
+ console.log('');
298
+ if (preset === 'permissive') {
299
+ console.log(chalk.white(' This mode allows almost everything except:'));
300
+ console.log(chalk.red(' • rm -rf, git push --force, git reset --hard'));
301
+ console.log(chalk.red(' • sudo, credential exposure, remote code execution'));
302
+ console.log(chalk.red(' • Database drops, container destruction'));
303
+ }
304
+ else if (preset === 'strict') {
305
+ console.log(chalk.white(' This mode only allows:'));
306
+ console.log(chalk.green(' • Package manager (install, run, test)'));
307
+ console.log(chalk.green(' • Build tools (tsc, eslint, jest, pytest)'));
308
+ console.log(chalk.green(' • Read operations (cat, grep, ls, find)'));
309
+ console.log(chalk.green(' • Git (status, diff, add, commit, fetch, pull)'));
310
+ console.log(chalk.yellow(' • NO: git push, curl, npm publish'));
311
+ }
312
+ if (preset === 'custom') {
313
+ console.log(chalk.white(' Define allowed commands:'));
314
+ console.log(chalk.gray(' Use * for wildcards (e.g., "npm *", "git status")'));
315
+ console.log('');
316
+ const { allowInput } = await inquirer.prompt([{
317
+ type: 'input',
318
+ name: 'allowInput',
319
+ message: 'Allowed commands (comma-separated):',
320
+ default: `${packageManager} *, git status, git diff, git add *, git commit *`,
321
+ }]);
322
+ const { denyInput } = await inquirer.prompt([{
323
+ type: 'input',
324
+ name: 'denyInput',
325
+ message: 'Additional denied patterns (comma-separated, or Enter for defaults):',
326
+ default: '',
327
+ }]);
328
+ const customAllow = allowInput
329
+ .split(',')
330
+ .map((cmd) => cmd.trim())
331
+ .filter(Boolean);
332
+ const customDeny = denyInput
333
+ .split(',')
334
+ .map((cmd) => cmd.trim())
335
+ .filter(Boolean);
336
+ console.log('');
337
+ console.log(chalk.green(` ✓ ${customAllow.length} allow patterns configured`));
338
+ if (customDeny.length > 0) {
339
+ console.log(chalk.yellow(` ✓ ${customDeny.length} additional deny patterns`));
340
+ }
341
+ return {
342
+ permissionPreset: 'custom',
343
+ customAllowCommands: customAllow,
344
+ customDenyCommands: customDeny,
345
+ };
346
+ }
347
+ // For permissive/strict, ask if they want to add any additional allowed commands
348
+ const { addMore } = await inquirer.prompt([{
349
+ type: 'confirm',
350
+ name: 'addMore',
351
+ message: 'Add any additional allowed commands?',
352
+ default: false,
353
+ }]);
354
+ if (addMore) {
355
+ const { extraCommands } = await inquirer.prompt([{
356
+ type: 'input',
357
+ name: 'extraCommands',
358
+ message: 'Additional allowed commands (comma-separated):',
359
+ default: '',
360
+ }]);
361
+ const extra = extraCommands
362
+ .split(',')
363
+ .map((cmd) => cmd.trim())
364
+ .filter(Boolean);
365
+ if (extra.length > 0) {
366
+ console.log(chalk.green(` ✓ Added ${extra.length} extra commands`));
367
+ return {
368
+ permissionPreset: preset,
369
+ customAllowCommands: [...allow, ...extra],
370
+ };
371
+ }
372
+ }
373
+ console.log(chalk.green(` ✓ ${preset.charAt(0).toUpperCase() + preset.slice(1)} mode selected`));
374
+ return { permissionPreset: preset };
375
+ }
376
+ async function parseExistingConfig() {
377
+ const defaults = {
378
+ projectName: 'my-project',
379
+ projectType: '',
380
+ isMonorepo: false,
381
+ languages: '',
382
+ frameworks: '',
383
+ testing: '',
384
+ packageManager: 'npm',
385
+ installCommand: '',
386
+ buildCommand: '',
387
+ testCommand: '',
388
+ lintCommand: '',
389
+ devCommand: '',
390
+ sourceDirectory: 'src/',
391
+ testsDirectory: 'tests/',
392
+ };
393
+ try {
394
+ const content = await fs.readFile(FILE_PATH, 'utf-8');
395
+ // Parse basic info
396
+ const nameMatch = content.match(/\*\*Name:\*\*\s*(.+)/);
397
+ if (nameMatch)
398
+ defaults.projectName = nameMatch[1].trim();
399
+ const typeMatch = content.match(/\*\*Type:\*\*\s*(.+)/);
400
+ if (typeMatch && !typeMatch[1].includes('[TODO')) {
401
+ defaults.projectType = typeMatch[1].trim();
402
+ }
403
+ const monoMatch = content.match(/\*\*Monorepo:\*\*\s*(Yes|No)/i);
404
+ if (monoMatch)
405
+ defaults.isMonorepo = monoMatch[1].toLowerCase() === 'yes';
406
+ // Parse tech stack
407
+ const langMatch = content.match(/\*\*Languages:\*\*\s*(.+)/);
408
+ if (langMatch && !langMatch[1].includes('[TODO')) {
409
+ defaults.languages = langMatch[1].trim();
410
+ }
411
+ const fwMatch = content.match(/\*\*Frameworks:\*\*\s*(.+)/);
412
+ if (fwMatch && !fwMatch[1].includes('[TODO')) {
413
+ defaults.frameworks = fwMatch[1].trim();
414
+ }
415
+ const testMatch = content.match(/\*\*Testing:\*\*\s*(.+)/);
416
+ if (testMatch && !testMatch[1].includes('[TODO')) {
417
+ defaults.testing = testMatch[1].trim();
418
+ }
419
+ // Parse package manager
420
+ const pmMatch = content.match(/\*\*Package Manager:\*\*\s*(.+)/);
421
+ if (pmMatch && !pmMatch[1].includes('[TODO')) {
422
+ defaults.packageManager = pmMatch[1].trim();
423
+ }
424
+ // Parse commands from table
425
+ const installMatch = content.match(/\| Install \| (.+) \|/);
426
+ if (installMatch && !installMatch[1].includes('[TODO')) {
427
+ defaults.installCommand = installMatch[1].trim();
428
+ }
429
+ const buildMatch = content.match(/\| Build \| (.+) \|/);
430
+ if (buildMatch && !buildMatch[1].includes('[TODO')) {
431
+ defaults.buildCommand = buildMatch[1].trim();
432
+ }
433
+ const testCmdMatch = content.match(/\| Test \| (.+) \|/);
434
+ if (testCmdMatch && !testCmdMatch[1].includes('[TODO')) {
435
+ defaults.testCommand = testCmdMatch[1].trim();
436
+ }
437
+ const lintMatch = content.match(/\| Lint \| (.+) \|/);
438
+ if (lintMatch && !lintMatch[1].includes('[TODO')) {
439
+ defaults.lintCommand = lintMatch[1].trim();
440
+ }
441
+ const devMatch = content.match(/\| Dev \| (.+) \|/);
442
+ if (devMatch && !devMatch[1].includes('[TODO')) {
443
+ defaults.devCommand = devMatch[1].trim();
444
+ }
445
+ // Parse structure
446
+ const srcMatch = content.match(/\*\*Source Directory:\*\*\s*(.+)/);
447
+ if (srcMatch)
448
+ defaults.sourceDirectory = srcMatch[1].trim();
449
+ const testsMatch = content.match(/\*\*Tests Directory:\*\*\s*(.+)/);
450
+ if (testsMatch)
451
+ defaults.testsDirectory = testsMatch[1].trim();
452
+ }
453
+ catch (error) {
454
+ logger.debug('Failed to parse existing config', {
455
+ error: error instanceof Error ? error.message : 'Unknown error'
456
+ });
457
+ }
458
+ return defaults;
459
+ }
460
+ function getPackageManagerCommands(pm) {
461
+ const commands = {
462
+ npm: {
463
+ install: 'npm install',
464
+ build: 'npm run build',
465
+ test: 'npm test',
466
+ lint: 'npm run lint',
467
+ dev: 'npm run dev',
468
+ },
469
+ pnpm: {
470
+ install: 'pnpm install',
471
+ build: 'pnpm build',
472
+ test: 'pnpm test',
473
+ lint: 'pnpm lint',
474
+ dev: 'pnpm dev',
475
+ },
476
+ yarn: {
477
+ install: 'yarn',
478
+ build: 'yarn build',
479
+ test: 'yarn test',
480
+ lint: 'yarn lint',
481
+ dev: 'yarn dev',
482
+ },
483
+ bun: {
484
+ install: 'bun install',
485
+ build: 'bun run build',
486
+ test: 'bun test',
487
+ lint: 'bun run lint',
488
+ dev: 'bun run dev',
489
+ },
490
+ pip: {
491
+ install: 'pip install -r requirements.txt',
492
+ build: 'python -m build',
493
+ test: 'pytest',
494
+ lint: 'ruff check .',
495
+ dev: 'python main.py',
496
+ },
497
+ cargo: {
498
+ install: 'cargo build',
499
+ build: 'cargo build --release',
500
+ test: 'cargo test',
501
+ lint: 'cargo clippy',
502
+ dev: 'cargo run',
503
+ },
504
+ go: {
505
+ install: 'go mod download',
506
+ build: 'go build',
507
+ test: 'go test ./...',
508
+ lint: 'golangci-lint run',
509
+ dev: 'go run .',
510
+ },
511
+ other: {
512
+ install: '',
513
+ build: '',
514
+ test: '',
515
+ lint: '',
516
+ dev: '',
517
+ },
518
+ };
519
+ return commands[pm] || commands.other;
520
+ }
521
+ function generateConfig(answers, existing) {
522
+ const formatAdditionalTech = (input) => {
523
+ if (!input.trim())
524
+ return '-';
525
+ return input.split(',')
526
+ .map(item => `- ${item.trim()}`)
527
+ .filter(Boolean)
528
+ .join('\n');
529
+ };
530
+ const formatKeyFiles = (input) => {
531
+ if (!input.trim())
532
+ return '| | |';
533
+ return input.split(',')
534
+ .map(item => {
535
+ const [file, purpose] = item.split(':').map(s => s.trim());
536
+ return `| ${file || ''} | ${purpose || ''} |`;
537
+ })
538
+ .join('\n');
539
+ };
540
+ const formatSpecialists = (specialists) => {
541
+ if (specialists.length === 0) {
542
+ return `### 1. [TODO: Specialist Name]
543
+ **Focus:** [What this specialist handles]
544
+ **Key Concerns:**
545
+ - [Concern 1]
546
+ - [Concern 2]
547
+
548
+ ### 2. [Add more as needed]
549
+ **Focus:**
550
+ **Key Concerns:**
551
+ -`;
552
+ }
553
+ return specialists.map((s, i) => {
554
+ const concerns = s.keyConcerns.length > 0
555
+ ? s.keyConcerns.map(c => `- ${c}`).join('\n')
556
+ : '- [Add key concerns]';
557
+ return `### ${i + 1}. ${s.name}
558
+ **Focus:** ${s.focus || '[What this specialist handles]'}
559
+ **Key Concerns:**
560
+ ${concerns}`;
561
+ }).join('\n\n');
562
+ };
563
+ return `# archai Project Configuration
564
+
565
+ > Configuration for your archai agent system.
566
+ > Run \`archai generate\` after updating this file.
567
+
568
+ ---
569
+
570
+ ## Project Info
571
+
572
+ **Name:** ${existing.projectName}
573
+ **Type:** ${existing.projectType || '[TODO: web, mobile, cli, game, ml, devops]'}
574
+ **Monorepo:** ${existing.isMonorepo ? 'Yes' : 'No'}
575
+
576
+ ---
577
+
578
+ ## Tech Stack
579
+
580
+ **Languages:** ${answers.languages || '[TODO: TypeScript, Python, Go, etc.]'}
581
+ **Frameworks:** ${answers.frameworks || '[TODO: React, Express, Django, etc.]'}
582
+ **Testing:** ${answers.testing || '[TODO: vitest, jest, pytest, etc.]'}
583
+
584
+ ### Additional Technologies
585
+ ${formatAdditionalTech(answers.additionalTech)}
586
+
587
+ ---
588
+
589
+ ## Commands
590
+
591
+ **Package Manager:** ${answers.packageManager}
592
+
593
+ | Command | Script |
594
+ |---------|--------|
595
+ | Install | ${answers.installCommand || '[TODO]'} |
596
+ | Build | ${answers.buildCommand || '[TODO]'} |
597
+ | Test | ${answers.testCommand || '[TODO]'} |
598
+ | Lint | ${answers.lintCommand || '[TODO]'} |
599
+ | Dev | ${answers.devCommand || '[TODO]'} |
600
+
601
+ ---
602
+
603
+ ## Project Structure
604
+
605
+ **Source Directory:** ${answers.sourceDirectory}
606
+ **Tests Directory:** ${answers.testsDirectory}
607
+
608
+ ### Key Files
609
+ | File | Purpose |
610
+ |------|---------|
611
+ ${formatKeyFiles(answers.keyFiles)}
612
+
613
+ ---
614
+
615
+ ## Specialists to Generate
616
+
617
+ <!--
618
+ These specialist agents will be generated by Claude Code.
619
+ Run \`archai generate\` to create them.
620
+ -->
621
+
622
+ ${formatSpecialists(answers.specialists)}
623
+
624
+ ---
625
+
626
+ ## MCP Servers & Skills
627
+
628
+ <!--
629
+ Configure MCP servers to extend agent capabilities.
630
+ MCP (Model Context Protocol) allows agents to interact with external tools and services.
631
+
632
+ Example configuration (edit manually):
633
+
634
+ ### Database Tools
635
+ - Server: @anthropic/mcp-server-postgres
636
+ - Purpose: Query and manage database
637
+
638
+ ### File System
639
+ - Server: @anthropic/mcp-server-filesystem
640
+ - Purpose: Enhanced file operations
641
+
642
+ For setup instructions, see Claude Code documentation.
643
+ -->
644
+
645
+ [TODO: Configure MCP servers if needed]
646
+
647
+ ---
648
+
649
+ ${generatePermissionsMarkdown({
650
+ preset: answers.permissionPreset,
651
+ packageManager: answers.packageManager,
652
+ customAllowCommands: answers.customAllowCommands,
653
+ customDenyCommands: answers.customDenyCommands,
654
+ })}
655
+ ---
656
+
657
+ ## Notes
658
+
659
+ <!-- Any additional context for agents -->
660
+
661
+ `;
662
+ }
663
+ //# sourceMappingURL=setup-config.js.map