@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.
- package/CHANGELOG.md +456 -0
- package/CODE_OF_CONDUCT.md +12 -0
- package/CONTRIBUTING.md +13 -0
- package/LICENSE +21 -0
- package/README.md +254 -0
- package/bin/aioson.js +4 -0
- package/docs/en/cli-reference.md +398 -0
- package/docs/en/i18n.md +52 -0
- package/docs/en/json-schemas.md +41 -0
- package/docs/en/mcp.md +56 -0
- package/docs/en/parallel.md +82 -0
- package/docs/en/qa-browser.md +339 -0
- package/docs/en/release-flow.md +22 -0
- package/docs/en/release-notes-template.md +41 -0
- package/docs/en/release.md +28 -0
- package/docs/en/schemas/agent-prompt.schema.json +17 -0
- package/docs/en/schemas/agents.schema.json +32 -0
- package/docs/en/schemas/context-validate.schema.json +36 -0
- package/docs/en/schemas/doctor.schema.json +89 -0
- package/docs/en/schemas/error.schema.json +24 -0
- package/docs/en/schemas/i18n-add.schema.json +15 -0
- package/docs/en/schemas/index.json +116 -0
- package/docs/en/schemas/info.schema.json +39 -0
- package/docs/en/schemas/init.schema.json +48 -0
- package/docs/en/schemas/install.schema.json +60 -0
- package/docs/en/schemas/locale-apply.schema.json +30 -0
- package/docs/en/schemas/mcp-doctor.schema.json +95 -0
- package/docs/en/schemas/mcp-init.schema.json +122 -0
- package/docs/en/schemas/package-test.schema.json +24 -0
- package/docs/en/schemas/parallel-assign.schema.json +57 -0
- package/docs/en/schemas/parallel-doctor.schema.json +86 -0
- package/docs/en/schemas/parallel-init.schema.json +53 -0
- package/docs/en/schemas/parallel-status.schema.json +94 -0
- package/docs/en/schemas/setup-context.schema.json +39 -0
- package/docs/en/schemas/smoke.schema.json +23 -0
- package/docs/en/schemas/update.schema.json +48 -0
- package/docs/en/schemas/workflow-plan.schema.json +30 -0
- package/docs/en/web3.md +54 -0
- package/docs/pt/README.md +46 -0
- package/docs/pt/advisor-spec.md +335 -0
- package/docs/pt/agentes.md +453 -0
- package/docs/pt/cenarios.md +1230 -0
- package/docs/pt/clientes-ai.md +224 -0
- package/docs/pt/comandos-cli.md +511 -0
- package/docs/pt/genome-3.0-spec.md +296 -0
- package/docs/pt/guia-engineer.md +226 -0
- package/docs/pt/inicio-rapido.md +138 -0
- package/docs/pt/profiler-system.md +214 -0
- package/docs/pt/runtime-observability.md +72 -0
- package/docs/pt/squad-genoma.md +777 -0
- package/docs/pt/web3.md +797 -0
- package/docs/testing/genome-2.0-manual-regression.md +23 -0
- package/docs/testing/genome-2.0-matrix.md +36 -0
- package/docs/testing/genome-2.0-rollout.md +184 -0
- package/package.json +50 -0
- package/src/agents.js +56 -0
- package/src/cli.js +497 -0
- package/src/commands/agents.js +142 -0
- package/src/commands/cloud.js +1767 -0
- package/src/commands/config.js +90 -0
- package/src/commands/context-validate.js +91 -0
- package/src/commands/doctor.js +123 -0
- package/src/commands/genome-doctor.js +41 -0
- package/src/commands/genome-migrate.js +49 -0
- package/src/commands/i18n-add.js +56 -0
- package/src/commands/info.js +41 -0
- package/src/commands/init.js +75 -0
- package/src/commands/install.js +68 -0
- package/src/commands/locale-apply.js +51 -0
- package/src/commands/locale-diff.js +126 -0
- package/src/commands/mcp-doctor.js +406 -0
- package/src/commands/mcp-init.js +379 -0
- package/src/commands/package-e2e.js +273 -0
- package/src/commands/parallel-assign.js +403 -0
- package/src/commands/parallel-doctor.js +437 -0
- package/src/commands/parallel-init.js +249 -0
- package/src/commands/parallel-status.js +290 -0
- package/src/commands/qa-doctor.js +185 -0
- package/src/commands/qa-init.js +161 -0
- package/src/commands/qa-report.js +58 -0
- package/src/commands/qa-run.js +873 -0
- package/src/commands/qa-scan.js +337 -0
- package/src/commands/runtime.js +948 -0
- package/src/commands/scan-project.js +1107 -0
- package/src/commands/setup-context.js +650 -0
- package/src/commands/smoke.js +426 -0
- package/src/commands/squad-doctor.js +358 -0
- package/src/commands/squad-export.js +46 -0
- package/src/commands/squad-pipeline.js +97 -0
- package/src/commands/squad-repair-genomes.js +39 -0
- package/src/commands/squad-status.js +424 -0
- package/src/commands/squad-validate.js +230 -0
- package/src/commands/test-agents.js +194 -0
- package/src/commands/update.js +55 -0
- package/src/commands/workflow-next.js +594 -0
- package/src/commands/workflow-plan.js +108 -0
- package/src/constants.js +314 -0
- package/src/context-parse-reason.js +22 -0
- package/src/context-writer.js +150 -0
- package/src/context.js +217 -0
- package/src/detector.js +261 -0
- package/src/doctor.js +289 -0
- package/src/execution-gateway.js +461 -0
- package/src/genome-files.js +198 -0
- package/src/genome-format.js +442 -0
- package/src/genome-schema.js +215 -0
- package/src/genomes/bindings.js +281 -0
- package/src/genomes.js +467 -0
- package/src/i18n/index.js +103 -0
- package/src/i18n/messages/en.js +784 -0
- package/src/i18n/messages/es.js +718 -0
- package/src/i18n/messages/fr.js +725 -0
- package/src/i18n/messages/pt-BR.js +818 -0
- package/src/i18n/scaffold.js +64 -0
- package/src/installer.js +232 -0
- package/src/lib/genomes/compat.js +206 -0
- package/src/lib/genomes/migrate.js +90 -0
- package/src/lib/squads/genome-repair.js +49 -0
- package/src/locales.js +84 -0
- package/src/onboarding.js +305 -0
- package/src/parser.js +53 -0
- package/src/prompt-tool.js +20 -0
- package/src/qa-html-report.js +472 -0
- package/src/runtime-store.js +1527 -0
- package/src/squads/apply-genome.js +21 -0
- package/src/squads/genome-binding-service.js +154 -0
- package/src/updater.js +32 -0
- package/src/utils.js +46 -0
- package/src/version.js +50 -0
- package/template/.aioson/advisors/.gitkeep +1 -0
- package/template/.aioson/agents/analyst.md +225 -0
- package/template/.aioson/agents/architect.md +221 -0
- package/template/.aioson/agents/dev.md +201 -0
- package/template/.aioson/agents/discovery-design-doc.md +196 -0
- package/template/.aioson/agents/genoma.md +300 -0
- package/template/.aioson/agents/orchestrator.md +107 -0
- package/template/.aioson/agents/pm.md +89 -0
- package/template/.aioson/agents/product.md +361 -0
- package/template/.aioson/agents/profiler-enricher.md +266 -0
- package/template/.aioson/agents/profiler-forge.md +188 -0
- package/template/.aioson/agents/profiler-researcher.md +245 -0
- package/template/.aioson/agents/qa.md +344 -0
- package/template/.aioson/agents/setup.md +381 -0
- package/template/.aioson/agents/squad.md +837 -0
- package/template/.aioson/agents/ux-ui.md +416 -0
- package/template/.aioson/config.md +56 -0
- package/template/.aioson/context/.gitkeep +0 -0
- package/template/.aioson/context/parallel/.gitkeep +0 -0
- package/template/.aioson/context/spec.md.template +37 -0
- package/template/.aioson/genomas/.gitkeep +0 -0
- package/template/.aioson/locales/en/agents/analyst.md +214 -0
- package/template/.aioson/locales/en/agents/architect.md +210 -0
- package/template/.aioson/locales/en/agents/dev.md +187 -0
- package/template/.aioson/locales/en/agents/discovery-design-doc.md +27 -0
- package/template/.aioson/locales/en/agents/genoma.md +212 -0
- package/template/.aioson/locales/en/agents/orchestrator.md +105 -0
- package/template/.aioson/locales/en/agents/pm.md +77 -0
- package/template/.aioson/locales/en/agents/product.md +310 -0
- package/template/.aioson/locales/en/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/en/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/en/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/en/agents/qa.md +214 -0
- package/template/.aioson/locales/en/agents/setup.md +342 -0
- package/template/.aioson/locales/en/agents/squad.md +247 -0
- package/template/.aioson/locales/en/agents/ux-ui.md +320 -0
- package/template/.aioson/locales/es/agents/analyst.md +203 -0
- package/template/.aioson/locales/es/agents/architect.md +208 -0
- package/template/.aioson/locales/es/agents/dev.md +183 -0
- package/template/.aioson/locales/es/agents/discovery-design-doc.md +19 -0
- package/template/.aioson/locales/es/agents/genoma.md +102 -0
- package/template/.aioson/locales/es/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/es/agents/pm.md +81 -0
- package/template/.aioson/locales/es/agents/product.md +310 -0
- package/template/.aioson/locales/es/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/es/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/es/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/es/agents/qa.md +163 -0
- package/template/.aioson/locales/es/agents/setup.md +347 -0
- package/template/.aioson/locales/es/agents/squad.md +247 -0
- package/template/.aioson/locales/es/agents/ux-ui.md +201 -0
- package/template/.aioson/locales/fr/agents/analyst.md +203 -0
- package/template/.aioson/locales/fr/agents/architect.md +208 -0
- package/template/.aioson/locales/fr/agents/dev.md +183 -0
- package/template/.aioson/locales/fr/agents/discovery-design-doc.md +19 -0
- package/template/.aioson/locales/fr/agents/genoma.md +102 -0
- package/template/.aioson/locales/fr/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/fr/agents/pm.md +81 -0
- package/template/.aioson/locales/fr/agents/product.md +310 -0
- package/template/.aioson/locales/fr/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/fr/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/fr/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/fr/agents/qa.md +163 -0
- package/template/.aioson/locales/fr/agents/setup.md +347 -0
- package/template/.aioson/locales/fr/agents/squad.md +247 -0
- package/template/.aioson/locales/fr/agents/ux-ui.md +201 -0
- package/template/.aioson/locales/pt-BR/agents/analyst.md +217 -0
- package/template/.aioson/locales/pt-BR/agents/architect.md +213 -0
- package/template/.aioson/locales/pt-BR/agents/dev.md +198 -0
- package/template/.aioson/locales/pt-BR/agents/discovery-design-doc.md +198 -0
- package/template/.aioson/locales/pt-BR/agents/genoma.md +297 -0
- package/template/.aioson/locales/pt-BR/agents/orchestrator.md +108 -0
- package/template/.aioson/locales/pt-BR/agents/pm.md +81 -0
- package/template/.aioson/locales/pt-BR/agents/product.md +316 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-enricher.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-forge.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/profiler-researcher.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/qa.md +217 -0
- package/template/.aioson/locales/pt-BR/agents/setup.md +371 -0
- package/template/.aioson/locales/pt-BR/agents/squad.md +772 -0
- package/template/.aioson/locales/pt-BR/agents/ux-ui.md +322 -0
- package/template/.aioson/mcp/servers.md +24 -0
- package/template/.aioson/profiler-reports/.gitkeep +1 -0
- package/template/.aioson/schemas/content-blueprint.schema.json +30 -0
- package/template/.aioson/schemas/genome-meta.schema.json +150 -0
- package/template/.aioson/schemas/genome.schema.json +115 -0
- package/template/.aioson/schemas/readiness.schema.json +27 -0
- package/template/.aioson/schemas/squad-blueprint.schema.json +172 -0
- package/template/.aioson/schemas/squad-manifest.schema.json +276 -0
- package/template/.aioson/skills/dynamic/README.md +30 -0
- package/template/.aioson/skills/dynamic/cardano-docs.md +16 -0
- package/template/.aioson/skills/dynamic/ethereum-docs.md +17 -0
- package/template/.aioson/skills/dynamic/flux-ui-docs.md +13 -0
- package/template/.aioson/skills/dynamic/laravel-docs.md +41 -0
- package/template/.aioson/skills/dynamic/npm-packages.md +16 -0
- package/template/.aioson/skills/dynamic/solana-docs.md +16 -0
- package/template/.aioson/skills/references/premium-command-center-ui/master-application-prompt.md +79 -0
- package/template/.aioson/skills/references/premium-command-center-ui/operational-ux-playbook.md +253 -0
- package/template/.aioson/skills/references/premium-command-center-ui/quality-validation-checklist.md +82 -0
- package/template/.aioson/skills/references/premium-command-center-ui/visual-system-and-component-patterns.md +270 -0
- package/template/.aioson/skills/static/django-patterns.md +342 -0
- package/template/.aioson/skills/static/fastapi-patterns.md +344 -0
- package/template/.aioson/skills/static/filament-patterns.md +267 -0
- package/template/.aioson/skills/static/flux-ui-components.md +262 -0
- package/template/.aioson/skills/static/git-conventions.md +227 -0
- package/template/.aioson/skills/static/interface-design.md +372 -0
- package/template/.aioson/skills/static/jetstream-setup.md +200 -0
- package/template/.aioson/skills/static/laravel-conventions.md +491 -0
- package/template/.aioson/skills/static/nextjs-patterns.md +321 -0
- package/template/.aioson/skills/static/node-express-patterns.md +317 -0
- package/template/.aioson/skills/static/node-typescript-patterns.md +282 -0
- package/template/.aioson/skills/static/premium-command-center-ui.md +190 -0
- package/template/.aioson/skills/static/rails-conventions.md +307 -0
- package/template/.aioson/skills/static/react-motion-patterns.md +577 -0
- package/template/.aioson/skills/static/static-html-patterns.md +1935 -0
- package/template/.aioson/skills/static/tall-stack-patterns.md +286 -0
- package/template/.aioson/skills/static/ui-ux-modern.md +75 -0
- package/template/.aioson/skills/static/web3-cardano-patterns.md +337 -0
- package/template/.aioson/skills/static/web3-ethereum-patterns.md +310 -0
- package/template/.aioson/skills/static/web3-security-checklist.md +284 -0
- package/template/.aioson/skills/static/web3-solana-patterns.md +324 -0
- package/template/.aioson/squads/.artisan/.gitkeep +0 -0
- package/template/.aioson/squads/.gitkeep +0 -0
- package/template/.aioson/squads/memory.md +5 -0
- package/template/.aioson/tasks/squad-analyze.md +83 -0
- package/template/.aioson/tasks/squad-create.md +99 -0
- package/template/.aioson/tasks/squad-design.md +100 -0
- package/template/.aioson/tasks/squad-export.md +20 -0
- package/template/.aioson/tasks/squad-extend.md +68 -0
- package/template/.aioson/tasks/squad-pipeline.md +122 -0
- package/template/.aioson/tasks/squad-repair.md +85 -0
- package/template/.aioson/tasks/squad-validate.md +58 -0
- package/template/.aioson/templates/squads/content-basic/template.json +21 -0
- package/template/.aioson/templates/squads/media-channel/template.json +24 -0
- package/template/.aioson/templates/squads/research-analysis/template.json +22 -0
- package/template/.aioson/templates/squads/software-delivery/template.json +21 -0
- package/template/.claude/commands/aioson/analyst.md +5 -0
- package/template/.claude/commands/aioson/architect.md +5 -0
- package/template/.claude/commands/aioson/dev.md +5 -0
- package/template/.claude/commands/aioson/orchestrator.md +5 -0
- package/template/.claude/commands/aioson/pm.md +5 -0
- package/template/.claude/commands/aioson/qa.md +5 -0
- package/template/.claude/commands/aioson/setup.md +5 -0
- package/template/.claude/commands/aioson/ux-ui.md +5 -0
- package/template/.gemini/GEMINI.md +10 -0
- package/template/.gemini/commands/aios-analyst.toml +4 -0
- package/template/.gemini/commands/aios-architect.toml +7 -0
- package/template/.gemini/commands/aios-dev.toml +8 -0
- package/template/.gemini/commands/aios-discovery-design-doc.toml +4 -0
- package/template/.gemini/commands/aios-orchestrator.toml +8 -0
- package/template/.gemini/commands/aios-pm.toml +8 -0
- package/template/.gemini/commands/aios-product.toml +4 -0
- package/template/.gemini/commands/aios-qa.toml +6 -0
- package/template/.gemini/commands/aios-setup.toml +3 -0
- package/template/.gemini/commands/aios-ux-ui.toml +8 -0
- package/template/AGENTS.md +67 -0
- package/template/CLAUDE.md +31 -0
- package/template/OPENCODE.md +24 -0
- package/template/aioson-models.json +40 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { normalizeGenomeBindings } = require('../genomes/bindings');
|
|
4
|
+
const { applyGenomeBindingsToSquad } = require('./genome-binding-service');
|
|
5
|
+
|
|
6
|
+
async function applyGenomeToExistingSquad({ projectRoot, squadSlug, squad = [], executors = {} }) {
|
|
7
|
+
const genomeBindings = normalizeGenomeBindings({
|
|
8
|
+
squad,
|
|
9
|
+
executors
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
return applyGenomeBindingsToSquad({
|
|
13
|
+
projectRoot,
|
|
14
|
+
squadSlug,
|
|
15
|
+
genomeBindings
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
applyGenomeToExistingSquad
|
|
21
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const {
|
|
6
|
+
attachBindingsToExecutors,
|
|
7
|
+
mergeGenomeBindings,
|
|
8
|
+
normalizeGenomeBindings
|
|
9
|
+
} = require('../genomes/bindings');
|
|
10
|
+
|
|
11
|
+
function normalizeSlug(value, fallback = '') {
|
|
12
|
+
const normalized = String(value || fallback)
|
|
13
|
+
.trim()
|
|
14
|
+
.toLowerCase()
|
|
15
|
+
.replace(/[^a-z0-9-]+/g, '-')
|
|
16
|
+
.replace(/^-+|-+$/g, '')
|
|
17
|
+
.slice(0, 80);
|
|
18
|
+
|
|
19
|
+
return normalized || fallback;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function readJsonIfExists(filePath) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = await fs.readFile(filePath, 'utf8');
|
|
25
|
+
return JSON.parse(raw);
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function readTextIfExists(filePath) {
|
|
32
|
+
try {
|
|
33
|
+
return await fs.readFile(filePath, 'utf8');
|
|
34
|
+
} catch {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function writeJson(filePath, value) {
|
|
40
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
41
|
+
await fs.writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, 'utf8');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function renderGenomeBindingsSection(genomeBindings) {
|
|
45
|
+
const normalized = normalizeGenomeBindings(genomeBindings);
|
|
46
|
+
const lines = ['## Genome bindings', ''];
|
|
47
|
+
|
|
48
|
+
if (normalized.squad.length === 0 && Object.keys(normalized.executors).length === 0) {
|
|
49
|
+
lines.push('- None', '');
|
|
50
|
+
return lines.join('\n').trimEnd();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (normalized.squad.length > 0) {
|
|
54
|
+
lines.push('### Squad-level');
|
|
55
|
+
for (const binding of normalized.squad) {
|
|
56
|
+
lines.push(`- ${binding.slug} (${binding.mode})`);
|
|
57
|
+
}
|
|
58
|
+
lines.push('');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const executors = Object.entries(normalized.executors);
|
|
62
|
+
if (executors.length > 0) {
|
|
63
|
+
lines.push('### Executor-level');
|
|
64
|
+
for (const [executorSlug, bindings] of executors) {
|
|
65
|
+
lines.push(`- ${executorSlug}: ${bindings.map((binding) => binding.slug).join(', ')}`);
|
|
66
|
+
}
|
|
67
|
+
lines.push('');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return lines.join('\n').trimEnd();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function patchReadiness(content, genomeBindings) {
|
|
74
|
+
const section = renderGenomeBindingsSection(genomeBindings);
|
|
75
|
+
const source = String(content || '').trimEnd();
|
|
76
|
+
const startMatch = source.match(/^## Genome bindings\b/m);
|
|
77
|
+
if (startMatch && startMatch.index !== undefined) {
|
|
78
|
+
const start = startMatch.index;
|
|
79
|
+
const tail = source.slice(start + startMatch[0].length);
|
|
80
|
+
const nextMatch = tail.match(/\n##\s+/);
|
|
81
|
+
const end = nextMatch && nextMatch.index !== undefined ? start + startMatch[0].length + nextMatch.index + 1 : source.length;
|
|
82
|
+
return `${`${source.slice(0, start)}${section}${source.slice(end)}`.trimEnd()}\n`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return `${source ? `${source}\n\n` : ''}${section}\n`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getSquadPaths(projectRoot, squadSlug) {
|
|
89
|
+
const slug = normalizeSlug(squadSlug, 'squad');
|
|
90
|
+
const packageRoot = path.join(projectRoot, '.aioson', 'squads', slug);
|
|
91
|
+
return {
|
|
92
|
+
squadSlug: slug,
|
|
93
|
+
squadRoot: packageRoot,
|
|
94
|
+
manifestPath: path.join(packageRoot, 'squad.manifest.json'),
|
|
95
|
+
blueprintPath: path.join(projectRoot, '.aioson', 'squads', '.designs', `${slug}.blueprint.json`),
|
|
96
|
+
legacyBlueprintPath: path.join(packageRoot, 'docs', 'blueprint.json'),
|
|
97
|
+
readinessPath: path.join(packageRoot, 'docs', 'readiness.md')
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function applyGenomeBindingsToSquad({ projectRoot, squadSlug, genomeBindings }) {
|
|
102
|
+
const paths = getSquadPaths(projectRoot, squadSlug);
|
|
103
|
+
const manifest = await readJsonIfExists(paths.manifestPath);
|
|
104
|
+
|
|
105
|
+
if (!manifest || typeof manifest !== 'object') {
|
|
106
|
+
throw new Error(`Squad manifest not found: ${paths.manifestPath}`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const blueprint =
|
|
110
|
+
(await readJsonIfExists(paths.blueprintPath)) ||
|
|
111
|
+
(await readJsonIfExists(paths.legacyBlueprintPath)) ||
|
|
112
|
+
{};
|
|
113
|
+
|
|
114
|
+
const existingBindings = mergeGenomeBindings({
|
|
115
|
+
blueprintBindings: blueprint?.genomeBindings,
|
|
116
|
+
manifestBindings: manifest?.genomeBindings || manifest?.genomes,
|
|
117
|
+
legacyExecutors: manifest?.executors
|
|
118
|
+
});
|
|
119
|
+
const incoming = normalizeGenomeBindings(genomeBindings);
|
|
120
|
+
const finalBindings = mergeGenomeBindings({
|
|
121
|
+
blueprintBindings: existingBindings,
|
|
122
|
+
manifestBindings: incoming
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const nextBlueprint = {
|
|
126
|
+
...blueprint,
|
|
127
|
+
genomeBindings: finalBindings
|
|
128
|
+
};
|
|
129
|
+
const nextManifest = {
|
|
130
|
+
...manifest,
|
|
131
|
+
genomes: finalBindings,
|
|
132
|
+
genomeBindings: finalBindings,
|
|
133
|
+
executors: attachBindingsToExecutors(manifest.executors || [], finalBindings)
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
await writeJson(paths.blueprintPath, nextBlueprint);
|
|
137
|
+
await writeJson(paths.manifestPath, nextManifest);
|
|
138
|
+
|
|
139
|
+
const readinessText = await readTextIfExists(paths.readinessPath);
|
|
140
|
+
await fs.mkdir(path.dirname(paths.readinessPath), { recursive: true });
|
|
141
|
+
await fs.writeFile(paths.readinessPath, patchReadiness(readinessText, finalBindings), 'utf8');
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
squadSlug: paths.squadSlug,
|
|
145
|
+
paths,
|
|
146
|
+
genomeBindings: finalBindings
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
module.exports = {
|
|
151
|
+
getSquadPaths,
|
|
152
|
+
applyGenomeBindingsToSquad,
|
|
153
|
+
patchReadiness
|
|
154
|
+
};
|
package/src/updater.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { detectExistingInstall, installTemplate } = require('./installer');
|
|
5
|
+
|
|
6
|
+
async function updateInstallation(targetDir, options = {}) {
|
|
7
|
+
const installed = await detectExistingInstall(targetDir);
|
|
8
|
+
if (!installed) {
|
|
9
|
+
return {
|
|
10
|
+
ok: false,
|
|
11
|
+
reason: 'not-installed',
|
|
12
|
+
message: `No AIOSON installation found in ${path.resolve(targetDir)}.`
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const result = await installTemplate(targetDir, {
|
|
17
|
+
overwrite: true,
|
|
18
|
+
dryRun: Boolean(options.dryRun),
|
|
19
|
+
mode: 'update',
|
|
20
|
+
backupOnOverwrite: true,
|
|
21
|
+
frameworkDetection: options.frameworkDetection || null
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
ok: true,
|
|
26
|
+
...result
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = {
|
|
31
|
+
updateInstallation
|
|
32
|
+
};
|
package/src/utils.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
async function exists(filePath) {
|
|
7
|
+
try {
|
|
8
|
+
await fs.access(filePath);
|
|
9
|
+
return true;
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function readTextIfExists(filePath) {
|
|
16
|
+
if (!(await exists(filePath))) return null;
|
|
17
|
+
return fs.readFile(filePath, 'utf8');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function ensureDir(dirPath) {
|
|
21
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function copyFileWithDir(src, dest) {
|
|
25
|
+
await ensureDir(path.dirname(dest));
|
|
26
|
+
await fs.copyFile(src, dest);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function nowStamp() {
|
|
30
|
+
const d = new Date();
|
|
31
|
+
return d.toISOString().replace(/[:]/g, '-');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function toRelativeSafe(baseDir, absolutePath) {
|
|
35
|
+
const rel = path.relative(baseDir, absolutePath);
|
|
36
|
+
return rel.split(path.sep).join('/');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
exists,
|
|
41
|
+
readTextIfExists,
|
|
42
|
+
ensureDir,
|
|
43
|
+
copyFileWithDir,
|
|
44
|
+
nowStamp,
|
|
45
|
+
toRelativeSafe
|
|
46
|
+
};
|
package/src/version.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const fsPromises = require('node:fs/promises');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
|
|
7
|
+
const PACKAGE_JSON_PATH = path.join(__dirname, '..', 'package.json');
|
|
8
|
+
const DEFAULT_VERSION = '0.0.0';
|
|
9
|
+
|
|
10
|
+
let cachedVersion = null;
|
|
11
|
+
|
|
12
|
+
function parseVersionFromPackageJson(text) {
|
|
13
|
+
try {
|
|
14
|
+
const pkg = JSON.parse(String(text || '{}'));
|
|
15
|
+
const version = String(pkg.version || '').trim();
|
|
16
|
+
return version || DEFAULT_VERSION;
|
|
17
|
+
} catch {
|
|
18
|
+
return DEFAULT_VERSION;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getCliVersionSync() {
|
|
23
|
+
if (cachedVersion) return cachedVersion;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const text = fs.readFileSync(PACKAGE_JSON_PATH, 'utf8');
|
|
27
|
+
cachedVersion = parseVersionFromPackageJson(text);
|
|
28
|
+
return cachedVersion;
|
|
29
|
+
} catch {
|
|
30
|
+
return DEFAULT_VERSION;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function getCliVersion() {
|
|
35
|
+
if (cachedVersion) return cachedVersion;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const text = await fsPromises.readFile(PACKAGE_JSON_PATH, 'utf8');
|
|
39
|
+
cachedVersion = parseVersionFromPackageJson(text);
|
|
40
|
+
return cachedVersion;
|
|
41
|
+
} catch {
|
|
42
|
+
return DEFAULT_VERSION;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
getCliVersion,
|
|
48
|
+
getCliVersionSync,
|
|
49
|
+
parseVersionFromPackageJson
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Agent @analyst
|
|
2
|
+
|
|
3
|
+
> ⚡ **ACTIVATED** — You are now operating as @analyst. Execute the instructions in this file immediately.
|
|
4
|
+
|
|
5
|
+
## Mission
|
|
6
|
+
Discover requirements deeply and produce implementation-ready artifacts. For new projects: `discovery.md`. For new features: `requirements-{slug}.md` + `spec-{slug}.md`.
|
|
7
|
+
|
|
8
|
+
## Project rules & docs
|
|
9
|
+
|
|
10
|
+
Before executing your mission, scan for project-specific customizations:
|
|
11
|
+
|
|
12
|
+
1. **`.aioson/rules/`** — If this directory exists, list its `.md` files. For each:
|
|
13
|
+
- Read YAML frontmatter. If `agents:` is absent → load (universal rule).
|
|
14
|
+
- If `agents:` includes `analyst` → load. Otherwise skip.
|
|
15
|
+
- Loaded rules **override** the default conventions in this file.
|
|
16
|
+
2. **`.aioson/docs/`** — If this directory exists, load doc files whose `description` frontmatter is relevant to the current task, or when explicitly mentioned by the user.
|
|
17
|
+
|
|
18
|
+
## Mode detection
|
|
19
|
+
|
|
20
|
+
Check the following before doing anything else:
|
|
21
|
+
|
|
22
|
+
**Feature mode** — a `prd-{slug}.md` file exists in `.aioson/context/`:
|
|
23
|
+
- Read `prd-{slug}.md` to understand the feature scope.
|
|
24
|
+
- Read `design-doc.md` and `readiness.md` if present to understand scope framing and readiness.
|
|
25
|
+
- Read `discovery.md` and `spec.md` if present (project context — entities already built).
|
|
26
|
+
- Run the **Feature discovery** process below (lighter, feature-scoped).
|
|
27
|
+
- Output: `requirements-{slug}.md` + `spec-{slug}.md`.
|
|
28
|
+
|
|
29
|
+
**Project mode** — no `prd-{slug}.md`, only `prd.md` or nothing:
|
|
30
|
+
- Run the full 3-phase project discovery below.
|
|
31
|
+
- Output: `discovery.md`.
|
|
32
|
+
|
|
33
|
+
## Required input
|
|
34
|
+
- `.aioson/context/project.context.md` (always)
|
|
35
|
+
- `.aioson/context/prd-{slug}.md` (feature mode)
|
|
36
|
+
- `.aioson/context/design-doc.md` + `readiness.md` (if present)
|
|
37
|
+
- `.aioson/context/discovery.md` + `spec.md` (feature mode — project context, if present)
|
|
38
|
+
|
|
39
|
+
## Brownfield pre-flight
|
|
40
|
+
|
|
41
|
+
Check `framework_installed` in `project.context.md` before starting any phase.
|
|
42
|
+
|
|
43
|
+
**If `framework_installed=true` AND `.aioson/context/discovery.md` exists:**
|
|
44
|
+
- Skip Phases 1–3 below.
|
|
45
|
+
- Read `skeleton-system.md` first if present — it is the lightweight index of the current structure.
|
|
46
|
+
- Read `discovery.md` AND `spec.md` (if present) together — they are two halves of project memory: discovery.md = structure, spec.md = development decisions.
|
|
47
|
+
- Proceed to enhance or update discovery.md based on the user's request.
|
|
48
|
+
|
|
49
|
+
**If `framework_installed=true` AND no `discovery.md` exists:**
|
|
50
|
+
> ⚠ Existing project detected but no discovery.md found. To save tokens, run the scanner first:
|
|
51
|
+
> ```
|
|
52
|
+
> aioson scan:project
|
|
53
|
+
> ```
|
|
54
|
+
> Then start a new session and run @analyst again.
|
|
55
|
+
|
|
56
|
+
Stop here — do not run Phases 1–3 on a large existing codebase without a pre-generated discovery.
|
|
57
|
+
|
|
58
|
+
> **Rule:** whenever `discovery.md` is present, always read `spec.md` alongside it — never one without the other.
|
|
59
|
+
|
|
60
|
+
## Skills and docs on demand
|
|
61
|
+
|
|
62
|
+
Before deepening discovery:
|
|
63
|
+
|
|
64
|
+
- check whether `design-doc.md` already answers part of the problem
|
|
65
|
+
- use `readiness.md` to avoid unnecessary rediscovery
|
|
66
|
+
- load only the docs that actually matter for this batch
|
|
67
|
+
- consult local skills only when they improve domain mapping or flow clarity
|
|
68
|
+
|
|
69
|
+
Do not inflate context without need.
|
|
70
|
+
|
|
71
|
+
## Process
|
|
72
|
+
|
|
73
|
+
### Phase 1 — Business discovery
|
|
74
|
+
Ask the following questions before any technical work:
|
|
75
|
+
1. What does the system need to do? (describe freely, no rush)
|
|
76
|
+
2. Who will use it? What types of users exist?
|
|
77
|
+
3. What are the 3 most important features for the MVP?
|
|
78
|
+
4. Is there a deadline or defined MVP version?
|
|
79
|
+
5. Do you have a visual reference you admire? (links or descriptions)
|
|
80
|
+
6. Is there a similar system on the market?
|
|
81
|
+
|
|
82
|
+
Wait for answers before proceeding. Do not make assumptions.
|
|
83
|
+
|
|
84
|
+
### Phase 2 — Entity deep dive
|
|
85
|
+
After the free description, identify mentioned entities and ask specific questions for each one. Do not use generic questions — adapt to the actual entities described.
|
|
86
|
+
|
|
87
|
+
Example (user described a scheduling system):
|
|
88
|
+
- Can a client have multiple appointments?
|
|
89
|
+
- Does the appointment have start and end time, or just start with fixed duration?
|
|
90
|
+
- Is cancellation possible? With refund? With minimum notice?
|
|
91
|
+
- Does the provider have unavailability windows?
|
|
92
|
+
- Are notifications required (email/SMS) on booking?
|
|
93
|
+
- Is there a daily limit of appointments per provider?
|
|
94
|
+
|
|
95
|
+
Apply the same depth to every entity in the project: ask about lifecycle states, who can change them, cascade effects, and audit requirements.
|
|
96
|
+
|
|
97
|
+
### Phase 3 — Data design
|
|
98
|
+
For each entity, produce field-level detail (do not stop at high-level):
|
|
99
|
+
|
|
100
|
+
| Field | Type | Nullable | Constraints |
|
|
101
|
+
|-------|------|----------|-------------|
|
|
102
|
+
| id | bigint PK | no | auto-increment |
|
|
103
|
+
| name | string | no | max 255 |
|
|
104
|
+
| email | string | no | unique |
|
|
105
|
+
| status | enum | no | pending, active, cancelled |
|
|
106
|
+
| notes | text | yes | |
|
|
107
|
+
| cancelled_at | timestamp | yes | |
|
|
108
|
+
|
|
109
|
+
Define:
|
|
110
|
+
- Complete field list with types and nullability
|
|
111
|
+
- Enum values for every status field
|
|
112
|
+
- Foreign key relationships and cascade behavior
|
|
113
|
+
- Indexes that will matter in production queries
|
|
114
|
+
|
|
115
|
+
## Classification scoring
|
|
116
|
+
Calculate official score (0–6):
|
|
117
|
+
- User types: `1=0`, `2=1`, `3+=2`
|
|
118
|
+
- External integrations: `0=0`, `1-2=1`, `3+=2`
|
|
119
|
+
- Business rule complexity: `none=0`, `some=1`, `complex=2`
|
|
120
|
+
|
|
121
|
+
Result:
|
|
122
|
+
- 0–1 = MICRO
|
|
123
|
+
- 2–3 = SMALL
|
|
124
|
+
- 4–6 = MEDIUM
|
|
125
|
+
|
|
126
|
+
## Feature discovery (feature mode only)
|
|
127
|
+
|
|
128
|
+
When invoked in feature mode, skip Phases 1–3 and run this focused 2-phase process instead.
|
|
129
|
+
|
|
130
|
+
### Phase A — Understand the feature
|
|
131
|
+
Read `prd-{slug}.md` fully. Then ask only what is needed to map entities and rules — do not re-ask what prd-{slug}.md already answers.
|
|
132
|
+
|
|
133
|
+
Focus questions on:
|
|
134
|
+
- New entities introduced by this feature (fields, types, nullability, enums)
|
|
135
|
+
- Changes to existing entities (new fields, state changes, new relationships)
|
|
136
|
+
- Who can trigger which actions and under what conditions
|
|
137
|
+
- Error states and edge cases not covered in the PRD
|
|
138
|
+
- Data that must be migrated or seeded
|
|
139
|
+
|
|
140
|
+
### Phase B — Feature entity design
|
|
141
|
+
For each new or modified entity, produce field-level detail (same format as Phase 3 of full discovery). Map relationships to existing entities from `discovery.md`. Define migration order for new tables only.
|
|
142
|
+
|
|
143
|
+
### Output contract — feature mode
|
|
144
|
+
|
|
145
|
+
**`requirements-{slug}.md`** — implementation spec for the feature:
|
|
146
|
+
1. Feature summary (1–2 lines from prd-{slug}.md)
|
|
147
|
+
2. New entities and fields (full table format)
|
|
148
|
+
3. Changes to existing entities
|
|
149
|
+
4. Relationships (with existing entities from discovery.md)
|
|
150
|
+
5. Migration additions (ordered)
|
|
151
|
+
6. Business rules
|
|
152
|
+
7. Edge cases
|
|
153
|
+
8. Out of scope for this feature
|
|
154
|
+
|
|
155
|
+
**`spec-{slug}.md`** — feature memory skeleton (will be enriched by @dev):
|
|
156
|
+
|
|
157
|
+
```markdown
|
|
158
|
+
---
|
|
159
|
+
feature: {slug}
|
|
160
|
+
status: in_progress
|
|
161
|
+
started: {ISO-date}
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
# Spec — {Feature Name}
|
|
165
|
+
|
|
166
|
+
## What was built
|
|
167
|
+
[To be filled by @dev during implementation]
|
|
168
|
+
|
|
169
|
+
## Entities added
|
|
170
|
+
[Paste entity list from requirements-{slug}.md]
|
|
171
|
+
|
|
172
|
+
## Key decisions
|
|
173
|
+
- [Date] [Decision] — [Reason]
|
|
174
|
+
|
|
175
|
+
## Edge cases handled
|
|
176
|
+
[From requirements-{slug}.md § Edge cases]
|
|
177
|
+
|
|
178
|
+
## Dependencies
|
|
179
|
+
- Reads: [existing entities this feature queries]
|
|
180
|
+
- Writes: [tables this feature modifies or creates]
|
|
181
|
+
|
|
182
|
+
## Notes
|
|
183
|
+
[Anything @dev or @qa should know before touching this feature]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
After producing both files, tell the user: "Feature spec ready. Activate **@dev** to implement — it will read `prd-{slug}.md`, `requirements-{slug}.md`, and `spec-{slug}.md`."
|
|
187
|
+
|
|
188
|
+
## MICRO shortcut
|
|
189
|
+
If classification is MICRO (score 0–1) or the user describes a clearly single-entity project with no integrations, adapt the process:
|
|
190
|
+
- Phase 1: ask only questions 1–3 (what, who, MVP features). Skip 4–6.
|
|
191
|
+
- Skip Phase 2 entity deep-dive.
|
|
192
|
+
- Skip Phase 3 field-level schema.
|
|
193
|
+
- Deliver a short discovery.md: 2-line summary + entity list (no table) + critical rules only.
|
|
194
|
+
|
|
195
|
+
Full 3-phase discovery on a MICRO project costs more tokens than the implementation itself.
|
|
196
|
+
|
|
197
|
+
## Responsibility boundary
|
|
198
|
+
The `@analyst` owns all technical and structural content: requirements, entities, tables, relationships, business rules, and migration order. This never depends on external content tools.
|
|
199
|
+
|
|
200
|
+
Copy, interface text, onboarding messages, and marketing content are not within `@analyst` scope.
|
|
201
|
+
|
|
202
|
+
## Output contract
|
|
203
|
+
Generate `.aioson/context/discovery.md` with the following sections:
|
|
204
|
+
|
|
205
|
+
1. **What we are building** — 2–3 objective lines
|
|
206
|
+
2. **User types and permissions** — who exists and what each can do
|
|
207
|
+
3. **MVP scope** — prioritized feature list
|
|
208
|
+
4. **Entities and fields** — full table definitions with field types and constraints
|
|
209
|
+
5. **Relationships** — hasMany, belongsTo, manyToMany with cardinality
|
|
210
|
+
6. **Migration order** — ordered list respecting FK dependencies
|
|
211
|
+
7. **Recommended indexes** — only indexes that will matter in real queries
|
|
212
|
+
8. **Critical business rules** — the non-obvious rules that cannot be forgotten
|
|
213
|
+
9. **Classification result** — score breakdown and final class (MICRO/SMALL/MEDIUM)
|
|
214
|
+
10. **Visual references** — links or descriptions provided by the user
|
|
215
|
+
11. **Risks identified** — what could become a problem during development
|
|
216
|
+
12. **Out of scope** — explicitly excluded from the MVP
|
|
217
|
+
|
|
218
|
+
> **`.aioson/context/` rule:** this folder accepts only `.md` files. Never write `.html`, `.css`, `.js`, or any other non-markdown file inside `.aioson/`.
|
|
219
|
+
|
|
220
|
+
## Hard constraints
|
|
221
|
+
- Use `conversation_language` from project context for all interaction and output.
|
|
222
|
+
- Keep output actionable for `@architect` (project mode) or `@dev` (feature mode) without requiring re-discovery.
|
|
223
|
+
- Do not finalize any output file with missing or assumed fields.
|
|
224
|
+
- In feature mode: never duplicate content already in `discovery.md` — only document what is new or changed.
|
|
225
|
+
- If `readiness.md` already says the context is sufficiently clear, do not reopen broad discovery without a good reason.
|