@jaimevalasek/aioson 1.3.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 (288) hide show
  1. package/CHANGELOG.md +456 -0
  2. package/CODE_OF_CONDUCT.md +12 -0
  3. package/CONTRIBUTING.md +13 -0
  4. package/LICENSE +21 -0
  5. package/README.md +254 -0
  6. package/bin/aioson.js +4 -0
  7. package/docs/en/cli-reference.md +398 -0
  8. package/docs/en/i18n.md +52 -0
  9. package/docs/en/json-schemas.md +41 -0
  10. package/docs/en/mcp.md +56 -0
  11. package/docs/en/parallel.md +82 -0
  12. package/docs/en/qa-browser.md +339 -0
  13. package/docs/en/release-flow.md +22 -0
  14. package/docs/en/release-notes-template.md +41 -0
  15. package/docs/en/release.md +28 -0
  16. package/docs/en/schemas/agent-prompt.schema.json +17 -0
  17. package/docs/en/schemas/agents.schema.json +32 -0
  18. package/docs/en/schemas/context-validate.schema.json +36 -0
  19. package/docs/en/schemas/doctor.schema.json +89 -0
  20. package/docs/en/schemas/error.schema.json +24 -0
  21. package/docs/en/schemas/i18n-add.schema.json +15 -0
  22. package/docs/en/schemas/index.json +116 -0
  23. package/docs/en/schemas/info.schema.json +39 -0
  24. package/docs/en/schemas/init.schema.json +48 -0
  25. package/docs/en/schemas/install.schema.json +60 -0
  26. package/docs/en/schemas/locale-apply.schema.json +30 -0
  27. package/docs/en/schemas/mcp-doctor.schema.json +95 -0
  28. package/docs/en/schemas/mcp-init.schema.json +122 -0
  29. package/docs/en/schemas/package-test.schema.json +24 -0
  30. package/docs/en/schemas/parallel-assign.schema.json +57 -0
  31. package/docs/en/schemas/parallel-doctor.schema.json +86 -0
  32. package/docs/en/schemas/parallel-init.schema.json +53 -0
  33. package/docs/en/schemas/parallel-status.schema.json +94 -0
  34. package/docs/en/schemas/setup-context.schema.json +39 -0
  35. package/docs/en/schemas/smoke.schema.json +23 -0
  36. package/docs/en/schemas/update.schema.json +48 -0
  37. package/docs/en/schemas/workflow-plan.schema.json +30 -0
  38. package/docs/en/web3.md +54 -0
  39. package/docs/pt/README.md +46 -0
  40. package/docs/pt/advisor-spec.md +335 -0
  41. package/docs/pt/agentes.md +453 -0
  42. package/docs/pt/cenarios.md +1230 -0
  43. package/docs/pt/clientes-ai.md +224 -0
  44. package/docs/pt/comandos-cli.md +511 -0
  45. package/docs/pt/genome-3.0-spec.md +296 -0
  46. package/docs/pt/guia-engineer.md +226 -0
  47. package/docs/pt/inicio-rapido.md +138 -0
  48. package/docs/pt/profiler-system.md +214 -0
  49. package/docs/pt/runtime-observability.md +72 -0
  50. package/docs/pt/squad-genoma.md +777 -0
  51. package/docs/pt/web3.md +797 -0
  52. package/docs/testing/genome-2.0-manual-regression.md +23 -0
  53. package/docs/testing/genome-2.0-matrix.md +36 -0
  54. package/docs/testing/genome-2.0-rollout.md +184 -0
  55. package/package.json +50 -0
  56. package/src/agents.js +56 -0
  57. package/src/cli.js +497 -0
  58. package/src/commands/agents.js +142 -0
  59. package/src/commands/cloud.js +1767 -0
  60. package/src/commands/config.js +90 -0
  61. package/src/commands/context-validate.js +91 -0
  62. package/src/commands/doctor.js +123 -0
  63. package/src/commands/genome-doctor.js +41 -0
  64. package/src/commands/genome-migrate.js +49 -0
  65. package/src/commands/i18n-add.js +56 -0
  66. package/src/commands/info.js +41 -0
  67. package/src/commands/init.js +75 -0
  68. package/src/commands/install.js +68 -0
  69. package/src/commands/locale-apply.js +51 -0
  70. package/src/commands/locale-diff.js +126 -0
  71. package/src/commands/mcp-doctor.js +406 -0
  72. package/src/commands/mcp-init.js +379 -0
  73. package/src/commands/package-e2e.js +273 -0
  74. package/src/commands/parallel-assign.js +403 -0
  75. package/src/commands/parallel-doctor.js +437 -0
  76. package/src/commands/parallel-init.js +249 -0
  77. package/src/commands/parallel-status.js +290 -0
  78. package/src/commands/qa-doctor.js +185 -0
  79. package/src/commands/qa-init.js +161 -0
  80. package/src/commands/qa-report.js +58 -0
  81. package/src/commands/qa-run.js +873 -0
  82. package/src/commands/qa-scan.js +337 -0
  83. package/src/commands/runtime.js +948 -0
  84. package/src/commands/scan-project.js +1107 -0
  85. package/src/commands/setup-context.js +650 -0
  86. package/src/commands/smoke.js +426 -0
  87. package/src/commands/squad-doctor.js +358 -0
  88. package/src/commands/squad-export.js +46 -0
  89. package/src/commands/squad-pipeline.js +97 -0
  90. package/src/commands/squad-repair-genomes.js +39 -0
  91. package/src/commands/squad-status.js +424 -0
  92. package/src/commands/squad-validate.js +230 -0
  93. package/src/commands/test-agents.js +194 -0
  94. package/src/commands/update.js +55 -0
  95. package/src/commands/workflow-next.js +594 -0
  96. package/src/commands/workflow-plan.js +108 -0
  97. package/src/constants.js +314 -0
  98. package/src/context-parse-reason.js +22 -0
  99. package/src/context-writer.js +150 -0
  100. package/src/context.js +217 -0
  101. package/src/detector.js +261 -0
  102. package/src/doctor.js +289 -0
  103. package/src/execution-gateway.js +461 -0
  104. package/src/genome-files.js +198 -0
  105. package/src/genome-format.js +442 -0
  106. package/src/genome-schema.js +215 -0
  107. package/src/genomes/bindings.js +281 -0
  108. package/src/genomes.js +467 -0
  109. package/src/i18n/index.js +103 -0
  110. package/src/i18n/messages/en.js +784 -0
  111. package/src/i18n/messages/es.js +718 -0
  112. package/src/i18n/messages/fr.js +725 -0
  113. package/src/i18n/messages/pt-BR.js +818 -0
  114. package/src/i18n/scaffold.js +64 -0
  115. package/src/installer.js +232 -0
  116. package/src/lib/genomes/compat.js +206 -0
  117. package/src/lib/genomes/migrate.js +90 -0
  118. package/src/lib/squads/genome-repair.js +49 -0
  119. package/src/locales.js +84 -0
  120. package/src/onboarding.js +305 -0
  121. package/src/parser.js +53 -0
  122. package/src/prompt-tool.js +20 -0
  123. package/src/qa-html-report.js +472 -0
  124. package/src/runtime-store.js +1527 -0
  125. package/src/squads/apply-genome.js +21 -0
  126. package/src/squads/genome-binding-service.js +154 -0
  127. package/src/updater.js +32 -0
  128. package/src/utils.js +46 -0
  129. package/src/version.js +50 -0
  130. package/template/.aioson/advisors/.gitkeep +1 -0
  131. package/template/.aioson/agents/analyst.md +225 -0
  132. package/template/.aioson/agents/architect.md +221 -0
  133. package/template/.aioson/agents/dev.md +201 -0
  134. package/template/.aioson/agents/discovery-design-doc.md +196 -0
  135. package/template/.aioson/agents/genoma.md +300 -0
  136. package/template/.aioson/agents/orchestrator.md +107 -0
  137. package/template/.aioson/agents/pm.md +89 -0
  138. package/template/.aioson/agents/product.md +361 -0
  139. package/template/.aioson/agents/profiler-enricher.md +266 -0
  140. package/template/.aioson/agents/profiler-forge.md +188 -0
  141. package/template/.aioson/agents/profiler-researcher.md +245 -0
  142. package/template/.aioson/agents/qa.md +344 -0
  143. package/template/.aioson/agents/setup.md +381 -0
  144. package/template/.aioson/agents/squad.md +837 -0
  145. package/template/.aioson/agents/ux-ui.md +416 -0
  146. package/template/.aioson/config.md +56 -0
  147. package/template/.aioson/context/.gitkeep +0 -0
  148. package/template/.aioson/context/parallel/.gitkeep +0 -0
  149. package/template/.aioson/context/spec.md.template +37 -0
  150. package/template/.aioson/genomas/.gitkeep +0 -0
  151. package/template/.aioson/locales/en/agents/analyst.md +214 -0
  152. package/template/.aioson/locales/en/agents/architect.md +210 -0
  153. package/template/.aioson/locales/en/agents/dev.md +187 -0
  154. package/template/.aioson/locales/en/agents/discovery-design-doc.md +27 -0
  155. package/template/.aioson/locales/en/agents/genoma.md +212 -0
  156. package/template/.aioson/locales/en/agents/orchestrator.md +105 -0
  157. package/template/.aioson/locales/en/agents/pm.md +77 -0
  158. package/template/.aioson/locales/en/agents/product.md +310 -0
  159. package/template/.aioson/locales/en/agents/profiler-enricher.md +5 -0
  160. package/template/.aioson/locales/en/agents/profiler-forge.md +5 -0
  161. package/template/.aioson/locales/en/agents/profiler-researcher.md +5 -0
  162. package/template/.aioson/locales/en/agents/qa.md +214 -0
  163. package/template/.aioson/locales/en/agents/setup.md +342 -0
  164. package/template/.aioson/locales/en/agents/squad.md +247 -0
  165. package/template/.aioson/locales/en/agents/ux-ui.md +320 -0
  166. package/template/.aioson/locales/es/agents/analyst.md +203 -0
  167. package/template/.aioson/locales/es/agents/architect.md +208 -0
  168. package/template/.aioson/locales/es/agents/dev.md +183 -0
  169. package/template/.aioson/locales/es/agents/discovery-design-doc.md +19 -0
  170. package/template/.aioson/locales/es/agents/genoma.md +102 -0
  171. package/template/.aioson/locales/es/agents/orchestrator.md +108 -0
  172. package/template/.aioson/locales/es/agents/pm.md +81 -0
  173. package/template/.aioson/locales/es/agents/product.md +310 -0
  174. package/template/.aioson/locales/es/agents/profiler-enricher.md +5 -0
  175. package/template/.aioson/locales/es/agents/profiler-forge.md +5 -0
  176. package/template/.aioson/locales/es/agents/profiler-researcher.md +5 -0
  177. package/template/.aioson/locales/es/agents/qa.md +163 -0
  178. package/template/.aioson/locales/es/agents/setup.md +347 -0
  179. package/template/.aioson/locales/es/agents/squad.md +247 -0
  180. package/template/.aioson/locales/es/agents/ux-ui.md +201 -0
  181. package/template/.aioson/locales/fr/agents/analyst.md +203 -0
  182. package/template/.aioson/locales/fr/agents/architect.md +208 -0
  183. package/template/.aioson/locales/fr/agents/dev.md +183 -0
  184. package/template/.aioson/locales/fr/agents/discovery-design-doc.md +19 -0
  185. package/template/.aioson/locales/fr/agents/genoma.md +102 -0
  186. package/template/.aioson/locales/fr/agents/orchestrator.md +108 -0
  187. package/template/.aioson/locales/fr/agents/pm.md +81 -0
  188. package/template/.aioson/locales/fr/agents/product.md +310 -0
  189. package/template/.aioson/locales/fr/agents/profiler-enricher.md +5 -0
  190. package/template/.aioson/locales/fr/agents/profiler-forge.md +5 -0
  191. package/template/.aioson/locales/fr/agents/profiler-researcher.md +5 -0
  192. package/template/.aioson/locales/fr/agents/qa.md +163 -0
  193. package/template/.aioson/locales/fr/agents/setup.md +347 -0
  194. package/template/.aioson/locales/fr/agents/squad.md +247 -0
  195. package/template/.aioson/locales/fr/agents/ux-ui.md +201 -0
  196. package/template/.aioson/locales/pt-BR/agents/analyst.md +217 -0
  197. package/template/.aioson/locales/pt-BR/agents/architect.md +213 -0
  198. package/template/.aioson/locales/pt-BR/agents/dev.md +198 -0
  199. package/template/.aioson/locales/pt-BR/agents/discovery-design-doc.md +198 -0
  200. package/template/.aioson/locales/pt-BR/agents/genoma.md +297 -0
  201. package/template/.aioson/locales/pt-BR/agents/orchestrator.md +108 -0
  202. package/template/.aioson/locales/pt-BR/agents/pm.md +81 -0
  203. package/template/.aioson/locales/pt-BR/agents/product.md +316 -0
  204. package/template/.aioson/locales/pt-BR/agents/profiler-enricher.md +5 -0
  205. package/template/.aioson/locales/pt-BR/agents/profiler-forge.md +5 -0
  206. package/template/.aioson/locales/pt-BR/agents/profiler-researcher.md +5 -0
  207. package/template/.aioson/locales/pt-BR/agents/qa.md +217 -0
  208. package/template/.aioson/locales/pt-BR/agents/setup.md +371 -0
  209. package/template/.aioson/locales/pt-BR/agents/squad.md +772 -0
  210. package/template/.aioson/locales/pt-BR/agents/ux-ui.md +322 -0
  211. package/template/.aioson/mcp/servers.md +24 -0
  212. package/template/.aioson/profiler-reports/.gitkeep +1 -0
  213. package/template/.aioson/schemas/content-blueprint.schema.json +30 -0
  214. package/template/.aioson/schemas/genome-meta.schema.json +150 -0
  215. package/template/.aioson/schemas/genome.schema.json +115 -0
  216. package/template/.aioson/schemas/readiness.schema.json +27 -0
  217. package/template/.aioson/schemas/squad-blueprint.schema.json +172 -0
  218. package/template/.aioson/schemas/squad-manifest.schema.json +276 -0
  219. package/template/.aioson/skills/dynamic/README.md +30 -0
  220. package/template/.aioson/skills/dynamic/cardano-docs.md +16 -0
  221. package/template/.aioson/skills/dynamic/ethereum-docs.md +17 -0
  222. package/template/.aioson/skills/dynamic/flux-ui-docs.md +13 -0
  223. package/template/.aioson/skills/dynamic/laravel-docs.md +41 -0
  224. package/template/.aioson/skills/dynamic/npm-packages.md +16 -0
  225. package/template/.aioson/skills/dynamic/solana-docs.md +16 -0
  226. package/template/.aioson/skills/references/premium-command-center-ui/master-application-prompt.md +79 -0
  227. package/template/.aioson/skills/references/premium-command-center-ui/operational-ux-playbook.md +253 -0
  228. package/template/.aioson/skills/references/premium-command-center-ui/quality-validation-checklist.md +82 -0
  229. package/template/.aioson/skills/references/premium-command-center-ui/visual-system-and-component-patterns.md +270 -0
  230. package/template/.aioson/skills/static/django-patterns.md +342 -0
  231. package/template/.aioson/skills/static/fastapi-patterns.md +344 -0
  232. package/template/.aioson/skills/static/filament-patterns.md +267 -0
  233. package/template/.aioson/skills/static/flux-ui-components.md +262 -0
  234. package/template/.aioson/skills/static/git-conventions.md +227 -0
  235. package/template/.aioson/skills/static/interface-design.md +372 -0
  236. package/template/.aioson/skills/static/jetstream-setup.md +200 -0
  237. package/template/.aioson/skills/static/laravel-conventions.md +491 -0
  238. package/template/.aioson/skills/static/nextjs-patterns.md +321 -0
  239. package/template/.aioson/skills/static/node-express-patterns.md +317 -0
  240. package/template/.aioson/skills/static/node-typescript-patterns.md +282 -0
  241. package/template/.aioson/skills/static/premium-command-center-ui.md +190 -0
  242. package/template/.aioson/skills/static/rails-conventions.md +307 -0
  243. package/template/.aioson/skills/static/react-motion-patterns.md +577 -0
  244. package/template/.aioson/skills/static/static-html-patterns.md +1935 -0
  245. package/template/.aioson/skills/static/tall-stack-patterns.md +286 -0
  246. package/template/.aioson/skills/static/ui-ux-modern.md +75 -0
  247. package/template/.aioson/skills/static/web3-cardano-patterns.md +337 -0
  248. package/template/.aioson/skills/static/web3-ethereum-patterns.md +310 -0
  249. package/template/.aioson/skills/static/web3-security-checklist.md +284 -0
  250. package/template/.aioson/skills/static/web3-solana-patterns.md +324 -0
  251. package/template/.aioson/squads/.artisan/.gitkeep +0 -0
  252. package/template/.aioson/squads/.gitkeep +0 -0
  253. package/template/.aioson/squads/memory.md +5 -0
  254. package/template/.aioson/tasks/squad-analyze.md +83 -0
  255. package/template/.aioson/tasks/squad-create.md +99 -0
  256. package/template/.aioson/tasks/squad-design.md +100 -0
  257. package/template/.aioson/tasks/squad-export.md +20 -0
  258. package/template/.aioson/tasks/squad-extend.md +68 -0
  259. package/template/.aioson/tasks/squad-pipeline.md +122 -0
  260. package/template/.aioson/tasks/squad-repair.md +85 -0
  261. package/template/.aioson/tasks/squad-validate.md +58 -0
  262. package/template/.aioson/templates/squads/content-basic/template.json +21 -0
  263. package/template/.aioson/templates/squads/media-channel/template.json +24 -0
  264. package/template/.aioson/templates/squads/research-analysis/template.json +22 -0
  265. package/template/.aioson/templates/squads/software-delivery/template.json +21 -0
  266. package/template/.claude/commands/aioson/analyst.md +5 -0
  267. package/template/.claude/commands/aioson/architect.md +5 -0
  268. package/template/.claude/commands/aioson/dev.md +5 -0
  269. package/template/.claude/commands/aioson/orchestrator.md +5 -0
  270. package/template/.claude/commands/aioson/pm.md +5 -0
  271. package/template/.claude/commands/aioson/qa.md +5 -0
  272. package/template/.claude/commands/aioson/setup.md +5 -0
  273. package/template/.claude/commands/aioson/ux-ui.md +5 -0
  274. package/template/.gemini/GEMINI.md +10 -0
  275. package/template/.gemini/commands/aios-analyst.toml +4 -0
  276. package/template/.gemini/commands/aios-architect.toml +7 -0
  277. package/template/.gemini/commands/aios-dev.toml +8 -0
  278. package/template/.gemini/commands/aios-discovery-design-doc.toml +4 -0
  279. package/template/.gemini/commands/aios-orchestrator.toml +8 -0
  280. package/template/.gemini/commands/aios-pm.toml +8 -0
  281. package/template/.gemini/commands/aios-product.toml +4 -0
  282. package/template/.gemini/commands/aios-qa.toml +6 -0
  283. package/template/.gemini/commands/aios-setup.toml +3 -0
  284. package/template/.gemini/commands/aios-ux-ui.toml +8 -0
  285. package/template/AGENTS.md +67 -0
  286. package/template/CLAUDE.md +31 -0
  287. package/template/OPENCODE.md +24 -0
  288. package/template/aioson-models.json +40 -0
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs/promises');
4
+ const os = require('node:os');
5
+ const path = require('node:path');
6
+
7
+ const CONFIG_DIR = path.join(os.homedir(), '.aioson');
8
+ const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
9
+
10
+ async function readConfig() {
11
+ try {
12
+ const raw = await fs.readFile(CONFIG_FILE, 'utf8');
13
+ return JSON.parse(raw);
14
+ } catch {
15
+ return {};
16
+ }
17
+ }
18
+
19
+ async function writeConfig(data) {
20
+ await fs.mkdir(CONFIG_DIR, { recursive: true });
21
+ await fs.writeFile(CONFIG_FILE, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
22
+ }
23
+
24
+ async function runConfig({ args, options, logger, t }) {
25
+ const subcommand = args[0];
26
+
27
+ if (subcommand === 'set') {
28
+ const pair = args[1];
29
+ if (!pair || !pair.includes('=')) {
30
+ logger.error(t('config.usage_error'));
31
+ return { ok: false, error: { code: 'usage_error' } };
32
+ }
33
+ const eqIdx = pair.indexOf('=');
34
+ const key = pair.slice(0, eqIdx).trim();
35
+ const value = pair.slice(eqIdx + 1).trim();
36
+ if (!key) {
37
+ logger.error(t('config.usage_error'));
38
+ return { ok: false, error: { code: 'usage_error' } };
39
+ }
40
+ const config = await readConfig();
41
+ config[key] = value;
42
+ await writeConfig(config);
43
+ logger.log(t('config.set_ok', { key, path: CONFIG_FILE }));
44
+ return { ok: true, key, path: CONFIG_FILE };
45
+ }
46
+
47
+ if (subcommand === 'get') {
48
+ const key = args[1];
49
+ if (!key) {
50
+ logger.error(t('config.usage_error'));
51
+ return { ok: false, error: { code: 'usage_error' } };
52
+ }
53
+ const config = await readConfig();
54
+ if (!Object.prototype.hasOwnProperty.call(config, key)) {
55
+ logger.log(t('config.key_not_found', { key }));
56
+ return { ok: true, key, value: null };
57
+ }
58
+ logger.log(t('config.get_line', { key, value: config[key] }));
59
+ return { ok: true, key, value: config[key] };
60
+ }
61
+
62
+ if (!subcommand || subcommand === 'show') {
63
+ const config = await readConfig();
64
+ const keys = Object.keys(config);
65
+ logger.log(t('config.show_header', { path: CONFIG_FILE }));
66
+ if (keys.length === 0) {
67
+ logger.log(t('config.show_empty'));
68
+ } else {
69
+ for (const key of keys) {
70
+ const raw = String(config[key]);
71
+ const masked = key.toLowerCase().includes('key') || key.toLowerCase().includes('secret')
72
+ ? `${raw.slice(0, 6)}${'*'.repeat(Math.max(0, raw.length - 6))}`
73
+ : raw;
74
+ logger.log(t('config.show_line', { key, value: masked }));
75
+ }
76
+ }
77
+ return { ok: true, config };
78
+ }
79
+
80
+ logger.error(t('config.usage_error'));
81
+ return { ok: false, error: { code: 'usage_error' } };
82
+ }
83
+
84
+ module.exports = {
85
+ runConfig,
86
+ readConfig,
87
+ writeConfig,
88
+ CONFIG_DIR,
89
+ CONFIG_FILE
90
+ };
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ const path = require('node:path');
4
+ const { validateProjectContextFile } = require('../context');
5
+ const { localizeContextParseReason } = require('../context-parse-reason');
6
+
7
+ async function runContextValidate({ args, options = {}, logger, t }) {
8
+ const targetDir = path.resolve(process.cwd(), args[0] || '.');
9
+ const jsonMode = Boolean(options.json);
10
+ const result = await validateProjectContextFile(targetDir);
11
+
12
+ const base = {
13
+ targetDir
14
+ };
15
+
16
+ if (!result.exists) {
17
+ const output = {
18
+ ok: false,
19
+ reason: 'missing_file',
20
+ ...base,
21
+ ...result
22
+ };
23
+ if (jsonMode) {
24
+ return output;
25
+ }
26
+ logger.log(t('context_validate.missing_file', { path: result.filePath }));
27
+ logger.log(t('context_validate.hint_setup'));
28
+ return output;
29
+ }
30
+
31
+ if (!result.parsed) {
32
+ const output = {
33
+ ok: false,
34
+ reason: 'invalid_frontmatter',
35
+ ...base,
36
+ ...result
37
+ };
38
+ if (jsonMode) {
39
+ return output;
40
+ }
41
+ logger.log(t('context_validate.invalid_frontmatter'));
42
+ logger.log(t('context_validate.file_path', { path: result.filePath }));
43
+ logger.log(
44
+ t('context_validate.parse_reason', {
45
+ reason: localizeContextParseReason(result.parseError, t)
46
+ })
47
+ );
48
+ logger.log(t('context_validate.hint_fix_frontmatter'));
49
+ return output;
50
+ }
51
+
52
+ if (!result.valid) {
53
+ const output = {
54
+ ok: false,
55
+ reason: 'invalid_fields',
56
+ ...base,
57
+ ...result
58
+ };
59
+ if (jsonMode) {
60
+ return output;
61
+ }
62
+ logger.log(t('context_validate.invalid_fields'));
63
+ logger.log(t('context_validate.file_path', { path: result.filePath }));
64
+ for (const issue of result.issues) {
65
+ logger.log(
66
+ t('context_validate.issue_line', {
67
+ issue: t(issue.key, issue.params || {})
68
+ })
69
+ );
70
+ }
71
+ return output;
72
+ }
73
+
74
+ const output = {
75
+ ok: true,
76
+ reason: 'valid',
77
+ ...base,
78
+ ...result
79
+ };
80
+ if (jsonMode) {
81
+ return output;
82
+ }
83
+ logger.log(t('context_validate.valid'));
84
+ logger.log(t('context_validate.file_path', { path: result.filePath }));
85
+ return output;
86
+ }
87
+
88
+ module.exports = {
89
+ runContextValidate,
90
+ localizeParseReason: localizeContextParseReason
91
+ };
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ const path = require('node:path');
4
+ const { runDoctor, applyDoctorFixes } = require('../doctor');
5
+
6
+ function printDoctorChecks(report, logger, t) {
7
+ for (const check of report.checks) {
8
+ const icon = check.ok ? t('doctor.ok') : t('doctor.fail');
9
+ logger.log(
10
+ t('doctor.check_line', {
11
+ icon,
12
+ message: t(check.key, check.params)
13
+ })
14
+ );
15
+ if (!check.ok && check.hintKey) {
16
+ logger.log(
17
+ t('doctor.hint_line', {
18
+ hint: t(check.hintKey, check.hintParams || check.params)
19
+ })
20
+ );
21
+ }
22
+ }
23
+ }
24
+
25
+ function printFixAction(action, logger, t, dryRun) {
26
+ logger.log(
27
+ t('doctor.fix_action_line', {
28
+ action: t(`doctor.fix_action_${action.id}`)
29
+ })
30
+ );
31
+ if (action.skipped) {
32
+ logger.log(
33
+ t('doctor.detail_line', {
34
+ text: t('doctor.fix_not_applicable')
35
+ })
36
+ );
37
+ return;
38
+ }
39
+ logger.log(
40
+ t('doctor.detail_line', {
41
+ text: t('doctor.fix_target_count', { count: action.missingCount || action.count || 0 })
42
+ })
43
+ );
44
+ logger.log(
45
+ t('doctor.detail_line', {
46
+ text: t(dryRun ? 'doctor.fix_planned_count' : 'doctor.fix_applied_count', {
47
+ count: action.count || 0
48
+ })
49
+ })
50
+ );
51
+ if (action.locale) {
52
+ logger.log(
53
+ t('doctor.detail_line', {
54
+ text: t('doctor.fix_locale', { locale: action.locale })
55
+ })
56
+ );
57
+ }
58
+ }
59
+
60
+ async function runDoctorCommand({ args, options = {}, logger, t }) {
61
+ const targetDir = path.resolve(process.cwd(), args[0] || '.');
62
+ const fix = Boolean(options.fix);
63
+ const dryRun = Boolean(options['dry-run']);
64
+ const jsonMode = Boolean(options.json);
65
+
66
+ let report = await runDoctor(targetDir);
67
+ let fixResult = null;
68
+
69
+ if (fix) {
70
+ if (!jsonMode) {
71
+ logger.log(dryRun ? t('doctor.fix_start_dry_run') : t('doctor.fix_start'));
72
+ }
73
+ fixResult = await applyDoctorFixes(targetDir, report, { dryRun });
74
+ if (!jsonMode) {
75
+ for (const action of fixResult.actions) {
76
+ printFixAction(action, logger, t, dryRun);
77
+ }
78
+
79
+ logger.log(
80
+ dryRun
81
+ ? t('doctor.fix_summary_dry_run', { count: fixResult.changedCount })
82
+ : t('doctor.fix_summary', { count: fixResult.changedCount })
83
+ );
84
+ logger.log('');
85
+ }
86
+ report = await runDoctor(targetDir);
87
+ }
88
+
89
+ const output = {
90
+ ok: report.ok,
91
+ targetDir,
92
+ fix: {
93
+ enabled: fix,
94
+ dryRun,
95
+ ...(fixResult
96
+ ? {
97
+ changedCount: fixResult.changedCount,
98
+ actions: fixResult.actions
99
+ }
100
+ : {})
101
+ },
102
+ report
103
+ };
104
+
105
+ if (jsonMode) {
106
+ return output;
107
+ }
108
+
109
+ printDoctorChecks(report, logger, t);
110
+
111
+ logger.log('');
112
+ if (!report.ok) {
113
+ logger.log(t('doctor.diagnosis_fail', { count: report.failedCount }));
114
+ } else {
115
+ logger.log(t('doctor.diagnosis_ok'));
116
+ }
117
+
118
+ return output;
119
+ }
120
+
121
+ module.exports = {
122
+ runDoctorCommand
123
+ };
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs/promises');
4
+ const path = require('node:path');
5
+ const { loadCompatibleGenome } = require('../lib/genomes/compat');
6
+
7
+ async function runGenomeDoctor({ args, options = {}, logger }) {
8
+ const target = args[0];
9
+ if (!target) {
10
+ throw new Error('Usage: aioson genome:doctor <file>');
11
+ }
12
+
13
+ const filePath = path.resolve(process.cwd(), target);
14
+ const raw = await fs.readFile(filePath, 'utf8');
15
+ const loaded = loadCompatibleGenome(raw, { filePath });
16
+ const result = {
17
+ ok: true,
18
+ file: filePath,
19
+ detectedFormat: loaded.format,
20
+ migrated: loaded.migrated,
21
+ slug: loaded.document.slug,
22
+ type: loaded.document.type,
23
+ depth: loaded.document.depth,
24
+ evidenceMode: loaded.document.evidenceMode
25
+ };
26
+
27
+ if (options.json) return result;
28
+
29
+ logger.log(`Genome file: ${filePath}`);
30
+ logger.log(`Format: ${result.detectedFormat}`);
31
+ logger.log(`Migrated internally: ${result.migrated ? 'yes' : 'no'}`);
32
+ logger.log(`Slug: ${result.slug}`);
33
+ logger.log(`Type: ${result.type}`);
34
+ logger.log(`Depth: ${result.depth}`);
35
+ logger.log(`Evidence mode: ${result.evidenceMode}`);
36
+ return result;
37
+ }
38
+
39
+ module.exports = {
40
+ runGenomeDoctor
41
+ };
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs/promises');
4
+ const path = require('node:path');
5
+ const { migrateGenomeDirectory, migrateGenomeFile } = require('../lib/genomes/migrate');
6
+
7
+ async function runGenomeMigrate({ args, options = {}, logger }) {
8
+ const target = args[0];
9
+ if (!target) {
10
+ throw new Error('Usage: aioson genome:migrate <file-or-dir> [--write] [--no-backup]');
11
+ }
12
+
13
+ const resolvedTarget = path.resolve(process.cwd(), target);
14
+ const write = Boolean(options.write);
15
+ const backup = !Boolean(options['no-backup']);
16
+ const stat = await fs.stat(resolvedTarget);
17
+ const payload = stat.isDirectory()
18
+ ? await migrateGenomeDirectory(resolvedTarget, { dryRun: !write, write, backup })
19
+ : await migrateGenomeFile(resolvedTarget, { dryRun: !write, write, backup });
20
+ const result = {
21
+ ok: true,
22
+ target: resolvedTarget,
23
+ write,
24
+ dryRun: !write,
25
+ backup,
26
+ ...(stat.isDirectory()
27
+ ? { kind: 'directory', ...payload }
28
+ : { kind: 'file', ...payload })
29
+ };
30
+
31
+ if (options.json) return result;
32
+
33
+ logger.log(`Genome migrate target: ${resolvedTarget}`);
34
+ logger.log(`Mode: ${result.dryRun ? 'dry-run' : 'write'}`);
35
+ if (result.kind === 'directory') {
36
+ logger.log(`Files scanned: ${result.total}`);
37
+ logger.log(`Files changed: ${result.changed}`);
38
+ } else {
39
+ logger.log(`Detected format: ${result.detectedFormat}`);
40
+ logger.log(`Changed: ${result.changed ? 'yes' : 'no'}`);
41
+ if (result.backupPath) logger.log(`Backup: ${result.backupPath}`);
42
+ }
43
+
44
+ return result;
45
+ }
46
+
47
+ module.exports = {
48
+ runGenomeMigrate
49
+ };
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ const { createLocaleScaffold } = require('../i18n/scaffold');
4
+
5
+ async function runI18nAdd({ args, options, logger, t }) {
6
+ const requestedLocale = args[0];
7
+ if (!requestedLocale) {
8
+ throw new Error(t('i18n_add.usage_error'));
9
+ }
10
+
11
+ const force = Boolean(options.force);
12
+ const dryRun = Boolean(options['dry-run']);
13
+
14
+ let result;
15
+ try {
16
+ result = await createLocaleScaffold(requestedLocale, { force, dryRun });
17
+ } catch (error) {
18
+ if (error.code === 'INVALID_LOCALE') {
19
+ throw new Error(t('i18n_add.invalid_locale', { locale: requestedLocale }));
20
+ }
21
+ if (error.code === 'BASE_LOCALE') {
22
+ throw new Error(t('i18n_add.base_locale'));
23
+ }
24
+ if (error.code === 'LOCALE_EXISTS') {
25
+ throw new Error(t('i18n_add.locale_exists', { path: error.path }));
26
+ }
27
+ throw error;
28
+ }
29
+
30
+ if (result.dryRun) {
31
+ logger.log(
32
+ result.overwritten
33
+ ? t('i18n_add.dry_run_overwritten', { locale: result.locale })
34
+ : t('i18n_add.dry_run_created', { locale: result.locale })
35
+ );
36
+ } else {
37
+ logger.log(
38
+ result.overwritten
39
+ ? t('i18n_add.overwritten', { locale: result.locale })
40
+ : t('i18n_add.created', { locale: result.locale })
41
+ );
42
+ }
43
+ logger.log(t('i18n_add.file_path', { path: result.filePath }));
44
+ logger.log(t('i18n_add.next_steps'));
45
+ logger.log(t('i18n_add.step_translate'));
46
+ logger.log(t('i18n_add.step_try', { locale: result.locale }));
47
+
48
+ return {
49
+ ok: true,
50
+ ...result
51
+ };
52
+ }
53
+
54
+ module.exports = {
55
+ runI18nAdd
56
+ };
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ const path = require('node:path');
4
+ const { detectFramework } = require('../detector');
5
+ const { detectExistingInstall } = require('../installer');
6
+ const { getCliVersion } = require('../version');
7
+
8
+ async function runInfo({ args, options = {}, logger, t }) {
9
+ const targetDir = path.resolve(process.cwd(), args[0] || '.');
10
+ const jsonMode = Boolean(options.json);
11
+ const version = await getCliVersion();
12
+
13
+ const installed = await detectExistingInstall(targetDir);
14
+ const detection = await detectFramework(targetDir);
15
+
16
+ const result = {
17
+ ok: true,
18
+ version,
19
+ targetDir,
20
+ installed,
21
+ detection
22
+ };
23
+
24
+ if (jsonMode) {
25
+ return result;
26
+ }
27
+
28
+ logger.log(t('info.cli_version', { version }));
29
+ logger.log(t('info.directory', { targetDir }));
30
+ logger.log(t('info.installed_here', { value: installed ? t('info.yes') : t('info.no') }));
31
+ logger.log(t('info.framework_detected', { framework: detection.framework || t('info.none') }));
32
+ if (detection.evidence) {
33
+ logger.log(t('info.evidence', { evidence: detection.evidence }));
34
+ }
35
+
36
+ return result;
37
+ }
38
+
39
+ module.exports = {
40
+ runInfo
41
+ };
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs/promises');
4
+ const path = require('node:path');
5
+ const { installTemplate } = require('../installer');
6
+ const { applyAgentLocale } = require('../locales');
7
+ const { resolvePromptTool } = require('../prompt-tool');
8
+
9
+ async function directoryIsEmpty(dirPath) {
10
+ try {
11
+ const entries = await fs.readdir(dirPath);
12
+ return entries.length === 0;
13
+ } catch (error) {
14
+ if (error && error.code === 'ENOENT') return true;
15
+ throw error;
16
+ }
17
+ }
18
+
19
+ async function runInit({ args, options, logger, t }) {
20
+ const projectName = args[0];
21
+ if (!projectName) {
22
+ throw new Error(t('init.usage_error'));
23
+ }
24
+
25
+ const targetDir = path.resolve(process.cwd(), projectName);
26
+ const force = Boolean(options.force);
27
+ const dryRun = Boolean(options['dry-run']);
28
+ const requestedLanguage = options.lang || options.language;
29
+ const promptTool = resolvePromptTool(options.tool);
30
+
31
+ await fs.mkdir(targetDir, { recursive: true });
32
+
33
+ if (!(await directoryIsEmpty(targetDir)) && !force) {
34
+ throw new Error(t('init.non_empty_dir', { targetDir }));
35
+ }
36
+
37
+ const result = await installTemplate(targetDir, {
38
+ overwrite: true,
39
+ dryRun,
40
+ mode: 'init'
41
+ });
42
+
43
+ let localeApply = null;
44
+ if (requestedLanguage) {
45
+ localeApply = await applyAgentLocale(targetDir, requestedLanguage, { dryRun });
46
+ if (dryRun) {
47
+ logger.log(t('locale_apply.dry_run_applied', { locale: localeApply.locale }));
48
+ } else {
49
+ logger.log(t('locale_apply.applied', { locale: localeApply.locale }));
50
+ }
51
+ }
52
+
53
+ logger.log(t('init.created_at', { targetDir }));
54
+ logger.log(t('init.files_copied', { count: result.copied.length }));
55
+ if (result.skipped.length > 0) {
56
+ logger.log(t('init.files_skipped', { count: result.skipped.length }));
57
+ }
58
+ logger.log(t('init.next_steps'));
59
+ logger.log(t('init.step_cd', { projectName }));
60
+ logger.log(t('init.step_setup'));
61
+ logger.log(t('init.step_agents'));
62
+ logger.log(t('init.step_agent_prompt', { tool: promptTool }));
63
+
64
+ return {
65
+ ok: true,
66
+ targetDir,
67
+ ...result,
68
+ localeApply
69
+ };
70
+ }
71
+
72
+ module.exports = {
73
+ runInit,
74
+ directoryIsEmpty
75
+ };
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ const path = require('node:path');
4
+ const { detectFramework } = require('../detector');
5
+ const { installTemplate } = require('../installer');
6
+ const { applyAgentLocale } = require('../locales');
7
+ const { resolvePromptTool } = require('../prompt-tool');
8
+
9
+ async function runInstall({ args, options, logger, t }) {
10
+ const targetDir = path.resolve(process.cwd(), args[0] || '.');
11
+ const force = Boolean(options.force);
12
+ const dryRun = Boolean(options['dry-run']);
13
+ const requestedLanguage = options.lang || options.language;
14
+ const promptTool = resolvePromptTool(options.tool);
15
+
16
+ const detection = await detectFramework(targetDir);
17
+ if (detection.installed) {
18
+ logger.log(t('install.framework_detected', {
19
+ framework: detection.framework,
20
+ evidence: detection.evidence
21
+ }));
22
+ } else {
23
+ logger.log(t('install.framework_not_detected'));
24
+ }
25
+
26
+ const result = await installTemplate(targetDir, {
27
+ overwrite: force,
28
+ dryRun,
29
+ mode: 'install',
30
+ frameworkDetection: detection.framework
31
+ });
32
+
33
+ let localeApply = null;
34
+ if (requestedLanguage) {
35
+ localeApply = await applyAgentLocale(targetDir, requestedLanguage, { dryRun });
36
+ if (dryRun) {
37
+ logger.log(t('locale_apply.dry_run_applied', { locale: localeApply.locale }));
38
+ } else {
39
+ logger.log(t('locale_apply.applied', { locale: localeApply.locale }));
40
+ }
41
+ }
42
+
43
+ logger.log(t('install.done_at', { targetDir }));
44
+ logger.log(t('install.files_copied', { count: result.copied.length }));
45
+ logger.log(t('install.files_skipped', { count: result.skipped.length }));
46
+ logger.log(t('install.next_steps'));
47
+ logger.log(t('install.step_setup_context'));
48
+ logger.log(t('install.step_agents'));
49
+ logger.log(t('install.step_agent_prompt', { tool: promptTool }));
50
+
51
+ if (result.isExistingProject) {
52
+ logger.log('');
53
+ logger.log(t('install.existing_project_detected', { count: result.projectFileCount }));
54
+ logger.log(t('install.existing_project_scan_hint'));
55
+ }
56
+
57
+ return {
58
+ ok: true,
59
+ targetDir,
60
+ detection,
61
+ ...result,
62
+ localeApply
63
+ };
64
+ }
65
+
66
+ module.exports = {
67
+ runInstall
68
+ };
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ const path = require('node:path');
4
+ const { applyAgentLocale, resolveAgentLocale } = require('../locales');
5
+ const { validateProjectContextFile } = require('../context');
6
+
7
+ async function runLocaleApply({ args, options, logger, t }) {
8
+ const targetDir = path.resolve(process.cwd(), args[0] || '.');
9
+ const dryRun = Boolean(options['dry-run']);
10
+
11
+ let requestedLanguage = options.language || options.lang || '';
12
+ if (!requestedLanguage) {
13
+ const context = await validateProjectContextFile(targetDir);
14
+ if (context.parsed && context.data && context.data.conversation_language) {
15
+ requestedLanguage = context.data.conversation_language;
16
+ }
17
+ }
18
+
19
+ const locale = resolveAgentLocale(requestedLanguage || 'en');
20
+ const result = await applyAgentLocale(targetDir, locale, { dryRun });
21
+
22
+ logger.log(
23
+ dryRun
24
+ ? t('locale_apply.dry_run_applied', { locale: result.locale })
25
+ : t('locale_apply.applied', { locale: result.locale })
26
+ );
27
+ logger.log(t('locale_apply.copied_count', { count: result.copied.length }));
28
+
29
+ if (result.missing.length > 0) {
30
+ logger.log(t('locale_apply.missing_count', { count: result.missing.length }));
31
+ }
32
+
33
+ for (const item of result.copied) {
34
+ logger.log(
35
+ t('locale_apply.copy_line', {
36
+ source: item.source,
37
+ target: item.target
38
+ })
39
+ );
40
+ }
41
+
42
+ return {
43
+ ok: true,
44
+ targetDir,
45
+ ...result
46
+ };
47
+ }
48
+
49
+ module.exports = {
50
+ runLocaleApply
51
+ };