aios-core 4.2.13 → 4.2.14

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 (97) hide show
  1. package/.aios-core/core/code-intel/helpers/dev-helper.js +206 -0
  2. package/.aios-core/core/registry/registry-schema.json +166 -166
  3. package/.aios-core/core/synapse/diagnostics/collectors/hook-collector.js +3 -3
  4. package/.aios-core/data/entity-registry.yaml +27 -0
  5. package/.aios-core/development/scripts/approval-workflow.js +642 -642
  6. package/.aios-core/development/scripts/backup-manager.js +606 -606
  7. package/.aios-core/development/scripts/branch-manager.js +389 -389
  8. package/.aios-core/development/scripts/code-quality-improver.js +1311 -1311
  9. package/.aios-core/development/scripts/commit-message-generator.js +849 -849
  10. package/.aios-core/development/scripts/conflict-resolver.js +674 -674
  11. package/.aios-core/development/scripts/dependency-analyzer.js +637 -637
  12. package/.aios-core/development/scripts/diff-generator.js +351 -351
  13. package/.aios-core/development/scripts/elicitation-engine.js +384 -384
  14. package/.aios-core/development/scripts/elicitation-session-manager.js +299 -299
  15. package/.aios-core/development/scripts/git-wrapper.js +461 -461
  16. package/.aios-core/development/scripts/manifest-preview.js +244 -244
  17. package/.aios-core/development/scripts/metrics-tracker.js +775 -775
  18. package/.aios-core/development/scripts/modification-validator.js +554 -554
  19. package/.aios-core/development/scripts/pattern-learner.js +1224 -1224
  20. package/.aios-core/development/scripts/performance-analyzer.js +757 -757
  21. package/.aios-core/development/scripts/refactoring-suggester.js +1138 -1138
  22. package/.aios-core/development/scripts/rollback-handler.js +530 -530
  23. package/.aios-core/development/scripts/security-checker.js +358 -358
  24. package/.aios-core/development/scripts/template-engine.js +239 -239
  25. package/.aios-core/development/scripts/template-validator.js +278 -278
  26. package/.aios-core/development/scripts/test-generator.js +843 -843
  27. package/.aios-core/development/scripts/transaction-manager.js +589 -589
  28. package/.aios-core/development/scripts/usage-tracker.js +673 -673
  29. package/.aios-core/development/scripts/validate-filenames.js +226 -226
  30. package/.aios-core/development/scripts/version-tracker.js +526 -526
  31. package/.aios-core/development/scripts/yaml-validator.js +396 -396
  32. package/.aios-core/development/tasks/build-autonomous.md +10 -4
  33. package/.aios-core/development/tasks/create-service.md +23 -0
  34. package/.aios-core/development/tasks/dev-develop-story.md +12 -6
  35. package/.aios-core/development/tasks/dev-suggest-refactoring.md +7 -1
  36. package/.aios-core/development/tasks/publish-npm.md +3 -3
  37. package/.aios-core/hooks/unified/README.md +1 -1
  38. package/.aios-core/install-manifest.yaml +65 -61
  39. package/.aios-core/manifests/schema/manifest-schema.json +190 -190
  40. package/.aios-core/product/templates/component-react-tmpl.tsx +98 -98
  41. package/.aios-core/product/templates/engine/schemas/adr.schema.json +102 -102
  42. package/.aios-core/product/templates/engine/schemas/dbdr.schema.json +205 -205
  43. package/.aios-core/product/templates/engine/schemas/epic.schema.json +175 -175
  44. package/.aios-core/product/templates/engine/schemas/pmdr.schema.json +175 -175
  45. package/.aios-core/product/templates/engine/schemas/prd-v2.schema.json +300 -300
  46. package/.aios-core/product/templates/engine/schemas/prd.schema.json +152 -152
  47. package/.aios-core/product/templates/engine/schemas/story.schema.json +222 -222
  48. package/.aios-core/product/templates/engine/schemas/task.schema.json +154 -154
  49. package/.aios-core/product/templates/eslintrc-security.json +32 -32
  50. package/.aios-core/product/templates/github-actions-cd.yml +212 -212
  51. package/.aios-core/product/templates/github-actions-ci.yml +172 -172
  52. package/.aios-core/product/templates/shock-report-tmpl.html +502 -502
  53. package/.aios-core/product/templates/token-exports-css-tmpl.css +240 -240
  54. package/.aios-core/quality/schemas/quality-metrics.schema.json +233 -233
  55. package/.aios-core/scripts/migrate-framework-docs.sh +300 -300
  56. package/README.en.md +747 -0
  57. package/README.md +4 -2
  58. package/bin/aios.js +7 -4
  59. package/package.json +1 -1
  60. package/packages/aios-pro-cli/src/recover.js +1 -1
  61. package/packages/installer/src/wizard/ide-config-generator.js +6 -6
  62. package/packages/installer/src/wizard/pro-setup.js +3 -3
  63. package/scripts/package-synapse.js +5 -5
  64. package/scripts/validate-package-completeness.js +3 -3
  65. package/.aios-core/.session/current-session.json +0 -14
  66. package/.aios-core/data/registry-update-log.jsonl +0 -191
  67. package/.aios-core/docs/SHARD-TRANSLATION-GUIDE.md +0 -335
  68. package/.aios-core/docs/component-creation-guide.md +0 -458
  69. package/.aios-core/docs/session-update-pattern.md +0 -307
  70. package/.aios-core/docs/standards/AIOS-FRAMEWORK-MASTER.md +0 -1963
  71. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1-SUMMARY.md +0 -1190
  72. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1.md +0 -439
  73. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO.md +0 -5398
  74. package/.aios-core/docs/standards/V3-ARCHITECTURAL-DECISIONS.md +0 -523
  75. package/.aios-core/docs/template-syntax.md +0 -267
  76. package/.aios-core/docs/troubleshooting-guide.md +0 -625
  77. package/.aios-core/infrastructure/tests/utilities-audit-results.json +0 -501
  78. package/.aios-core/manifests/agents.csv +0 -29
  79. package/.aios-core/manifests/tasks.csv +0 -198
  80. package/.aios-core/manifests/workers.csv +0 -204
  81. package/.claude/rules/agent-authority.md +0 -105
  82. package/.claude/rules/coderabbit-integration.md +0 -93
  83. package/.claude/rules/ids-principles.md +0 -112
  84. package/.claude/rules/story-lifecycle.md +0 -139
  85. package/.claude/rules/workflow-execution.md +0 -150
  86. package/pro/README.md +0 -66
  87. package/pro/license/degradation.js +0 -220
  88. package/pro/license/errors.js +0 -450
  89. package/pro/license/feature-gate.js +0 -354
  90. package/pro/license/index.js +0 -181
  91. package/pro/license/license-api.js +0 -651
  92. package/pro/license/license-cache.js +0 -523
  93. package/pro/license/license-crypto.js +0 -303
  94. package/scripts/glue/README.md +0 -355
  95. package/scripts/glue/compose-agent-prompt.cjs +0 -362
  96. /package/.claude/hooks/{precompact-session-digest.js → precompact-session-digest.cjs} +0 -0
  97. /package/.claude/hooks/{synapse-engine.js → synapse-engine.cjs} +0 -0
@@ -1,362 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Compose Agent Prompt - Glue Script for Execute-Epic
4
- *
5
- * Deterministic prompt composition for autonomous agents.
6
- * Reads agent file + task file + context → outputs complete prompt to stdout.
7
- *
8
- * Usage:
9
- * node compose-agent-prompt.cjs --agent dev --mission develop-story --context path/to/story.md
10
- * node compose-agent-prompt.cjs --agent qa --mission gate --context path/to/story.md
11
- * node compose-agent-prompt.cjs --agent po --mission validate-story --context story.md --context accumulated.md
12
- * node compose-agent-prompt.cjs --agent dev --mission develop-story --context story.md --extra-instruction "Focus on tests"
13
- *
14
- * Options:
15
- * --agent <id> Agent ID (dev, qa, po, sm, architect, etc.)
16
- * --mission <keyword> Mission keyword from agent's Mission Router
17
- * --context <path> Context file (can be repeated for multiple files)
18
- * --extra-instruction <s> Additional instruction to append
19
- * --verbose Show debug info to stderr
20
- * --list-missions List available missions for the agent
21
- *
22
- * Output: Complete prompt ready for Task(subagent_type: "general-purpose", prompt: <output>)
23
- *
24
- * Architecture: Clockwork Stage 1 - Thin Glue Script
25
- */
26
-
27
- const fs = require('fs');
28
- const path = require('path');
29
-
30
- // Parse arguments (supports repeated --context)
31
- const args = process.argv.slice(2);
32
- const getArg = (name) => {
33
- const idx = args.indexOf(`--${name}`);
34
- return idx !== -1 && args[idx + 1] && !args[idx + 1].startsWith('--') ? args[idx + 1] : null;
35
- };
36
- const getAllArgs = (name) => {
37
- const results = [];
38
- for (let i = 0; i < args.length; i++) {
39
- if (args[i] === `--${name}` && args[i + 1] && !args[i + 1].startsWith('--')) {
40
- results.push(args[i + 1]);
41
- }
42
- }
43
- return results;
44
- };
45
- const hasFlag = (name) => args.includes(`--${name}`);
46
-
47
- const agentId = getArg('agent');
48
- const mission = getArg('mission');
49
- const contextPaths = getAllArgs('context');
50
- const extraInstruction = getArg('extra-instruction');
51
- const verbose = hasFlag('verbose');
52
- const listMissions = hasFlag('list-missions');
53
-
54
- // Mission aliases (common shortcuts)
55
- const missionAliases = {
56
- 'review': 'gate',
57
- 'review-story': 'gate',
58
- 'expand': 'create-story',
59
- 'expand-story': 'create-story',
60
- 'draft': 'create-story',
61
- 'validate': 'validate-story',
62
- 'backlog': 'backlog-review',
63
- 'develop': 'develop-story',
64
- 'implement': 'develop-story'
65
- };
66
-
67
- const log = (msg) => verbose && console.error(`[glue] ${msg}`);
68
-
69
- if (!agentId) {
70
- console.error('Usage: compose-agent-prompt.cjs --agent <id> --mission <keyword> [--context <path>...]');
71
- console.error(' compose-agent-prompt.cjs --agent <id> --list-missions');
72
- console.error('');
73
- console.error('Examples:');
74
- console.error(' compose-agent-prompt.cjs --agent dev --mission develop-story --context story.md');
75
- console.error(' compose-agent-prompt.cjs --agent qa --mission gate --context story.md --context impl-log.md');
76
- console.error(' compose-agent-prompt.cjs --agent po --list-missions');
77
- process.exit(1);
78
- }
79
-
80
- // Paths
81
- const projectRoot = process.cwd();
82
- const aiosCoreTasks = path.join(projectRoot, '.aios-core', 'development', 'tasks');
83
- const aiosCoreAgents = path.join(projectRoot, '.aios-core', 'development', 'agents');
84
-
85
- // Agent file resolution (priority order)
86
- // 1. .claude/agents/aios-{id}.md (AIOS core)
87
- // 2. .claude/agents/{id}.md (standalone like db-sage)
88
- // 3. squads/{squad}/agents/{id}.md (squad agents - derive squad from agent id or use --squad)
89
- const squadId = getArg('squad');
90
- const agentPaths = [
91
- path.join(projectRoot, '.claude', 'agents', `aios-${agentId}.md`),
92
- path.join(projectRoot, '.claude', 'agents', `${agentId}.md`),
93
- ];
94
-
95
- // Add squad paths if squad is specified or try common squads
96
- if (squadId) {
97
- agentPaths.push(path.join(projectRoot, 'squads', squadId, 'agents', `${agentId}.md`));
98
- } else {
99
- // Try common squad mappings
100
- const squadMappings = {
101
- 'db-sage': 'db-sage',
102
- 'brad-frost': 'design',
103
- 'design-chief': 'design',
104
- 'cyber-chief': 'cybersecurity',
105
- 'copy-chief': 'copy',
106
- 'story-chief': 'storytelling',
107
- 'finops-chief': 'finops',
108
- 'hr-chief': 'hr',
109
- 'legal-chief': 'legal',
110
- 'data-chief': 'data',
111
- };
112
- const mappedSquad = squadMappings[agentId];
113
- if (mappedSquad) {
114
- agentPaths.push(path.join(projectRoot, 'squads', mappedSquad, 'agents', `${agentId}.md`));
115
- }
116
- // Also try .claude/commands/{Squad}/agents/ (synced from squads)
117
- agentPaths.push(path.join(projectRoot, '.claude', 'commands', 'db-sage', 'agents', `${agentId}.md`));
118
- }
119
-
120
- // Find first existing agent file and track its source
121
- let agentFile = null;
122
- let agentSource = null; // 'aios-core', 'standalone', 'squad:{name}'
123
- for (const p of agentPaths) {
124
- if (fs.existsSync(p)) {
125
- agentFile = p;
126
- // Determine source for task resolution
127
- if (p.includes('.claude/agents/aios-')) {
128
- agentSource = 'aios-core';
129
- } else if (p.includes('.claude/agents/')) {
130
- agentSource = 'standalone';
131
- } else if (p.includes('squads/')) {
132
- const match = p.match(/squads\/([^/]+)\//);
133
- agentSource = match ? `squad:${match[1]}` : 'squad';
134
- }
135
- log(`Agent file found: ${p} (source: ${agentSource})`);
136
- break;
137
- }
138
- }
139
-
140
- if (!agentFile) {
141
- console.error(`Agent file not found. Tried:`);
142
- agentPaths.forEach(p => console.error(` - ${p}`));
143
- console.error(`\nHint: Use --squad <squad-name> to specify squad, or check agent ID.`);
144
- process.exit(1);
145
- }
146
- const agentContent = fs.readFileSync(agentFile, 'utf8');
147
-
148
- // Parse Mission Router from agent file (format: "## 3. Mission Router" or "## Mission Router")
149
- const missionRouterMatch = agentContent.match(/## (?:\d+\. )?Mission Router[\s\S]*?(\|.*\|[\s\S]*?)(?=\n## |\n###|$)/);
150
- let taskFile = null;
151
- let extraResources = [];
152
- const availableMissions = [];
153
-
154
- if (missionRouterMatch) {
155
- const tableContent = missionRouterMatch[1];
156
- const rows = tableContent.split('\n').filter(r => r.includes('|') && !r.includes('---') && !r.includes('Mission Keyword'));
157
-
158
- for (const row of rows) {
159
- const cols = row.split('|').map(c => c.trim()).filter(Boolean);
160
- if (cols.length >= 2) {
161
- // Extract mission keyword (remove backticks, parenthetical notes like "(default)")
162
- const rawKeyword = cols[0].replace(/`/g, '').trim();
163
- // Handle multiple keywords like "create-story / draft"
164
- const keywords = rawKeyword.split('/').map(k => k.replace(/\s*\([^)]*\)/g, '').trim());
165
- const taskFileName = cols[1].replace(/`/g, '').trim();
166
-
167
- // Collect for --list-missions
168
- availableMissions.push({ keywords, taskFile: taskFileName, extras: cols[2] || '' });
169
-
170
- // Skip if we're just listing missions
171
- if (listMissions) continue;
172
-
173
- // Resolve alias
174
- const resolvedMission = missionAliases[mission?.toLowerCase()] || mission;
175
-
176
- // Check if any keyword matches
177
- for (const keyword of keywords) {
178
- if (keyword.toLowerCase() === resolvedMission?.toLowerCase()) {
179
- taskFile = taskFileName;
180
- // Extract extra resources if present
181
- if (cols[2]) {
182
- const resourceMatches = cols[2].match(/`([^`]+\.md)`/g);
183
- if (resourceMatches) {
184
- extraResources = resourceMatches.map(r => r.replace(/`/g, ''));
185
- }
186
- }
187
- break;
188
- }
189
- }
190
- if (taskFile) break;
191
- }
192
- }
193
- }
194
-
195
- // Handle --list-missions
196
- if (listMissions) {
197
- console.log(`\n## Available Missions for agent: ${agentId}\n`);
198
- console.log('| Mission Keyword(s) | Task File | Extra Resources |');
199
- console.log('|-------------------|-----------|-----------------|');
200
- for (const m of availableMissions) {
201
- console.log(`| ${m.keywords.join(' / ')} | ${m.taskFile} | ${m.extras || '—'} |`);
202
- }
203
- console.log('\n## Aliases (shortcuts)\n');
204
- for (const [alias, target] of Object.entries(missionAliases)) {
205
- console.log(` ${alias} → ${target}`);
206
- }
207
- process.exit(0);
208
- }
209
-
210
- // Now require mission if not listing
211
- if (!mission) {
212
- console.error('Error: --mission is required (or use --list-missions to see available missions)');
213
- process.exit(1);
214
- }
215
-
216
- log(`Agent: ${agentId}, Mission: ${mission}, Resolved: ${missionAliases[mission?.toLowerCase()] || mission}`);
217
- log(`Task file: ${taskFile || 'not found'}`);
218
- log(`Extra resources: ${extraResources.join(', ') || 'none'}`);
219
-
220
- // Build the prompt
221
- const promptParts = [];
222
-
223
- // 1. Agent persona (from .aios-core/development/agents/ if exists, else from agent file)
224
- const fullAgentFile = path.join(aiosCoreAgents, `${agentId}.md`);
225
- if (fs.existsSync(fullAgentFile)) {
226
- promptParts.push(`## Agent Persona\n\n${fs.readFileSync(fullAgentFile, 'utf8')}`);
227
- } else {
228
- promptParts.push(`## Agent Instructions\n\n${agentContent}`);
229
- }
230
-
231
- // 2. Task workflow (if found in router) - check multiple paths
232
- if (taskFile) {
233
- // Build task path candidates based on agent source
234
- const taskPaths = [path.join(aiosCoreTasks, taskFile)];
235
-
236
- // If agent is from a squad, also check squad tasks
237
- if (agentSource && agentSource.startsWith('squad:')) {
238
- const squadName = agentSource.split(':')[1];
239
- taskPaths.unshift(path.join(projectRoot, 'squads', squadName, 'tasks', taskFile));
240
- }
241
-
242
- // For standalone agents, check if there's a matching squad
243
- if (agentSource === 'standalone') {
244
- const squadMappings = {
245
- 'db-sage': 'db-sage',
246
- 'brad-frost': 'design',
247
- 'design-chief': 'design',
248
- 'cyber-chief': 'cybersecurity',
249
- };
250
- const mappedSquad = squadMappings[agentId];
251
- if (mappedSquad) {
252
- taskPaths.unshift(path.join(projectRoot, 'squads', mappedSquad, 'tasks', taskFile));
253
- }
254
- }
255
-
256
- // Find first existing task file
257
- let foundTaskPath = null;
258
- for (const tp of taskPaths) {
259
- if (fs.existsSync(tp)) {
260
- foundTaskPath = tp;
261
- log(`Task file found: ${tp}`);
262
- break;
263
- }
264
- }
265
-
266
- if (foundTaskPath) {
267
- promptParts.push(`## Task Workflow: ${mission}\n\n${fs.readFileSync(foundTaskPath, 'utf8')}`);
268
- } else {
269
- log(`Task file not found. Tried: ${taskPaths.join(', ')}`);
270
- promptParts.push(`## Mission: ${mission}\n\nTask file not found: ${taskFile}. Execute mission based on agent expertise.`);
271
- }
272
- } else {
273
- promptParts.push(`## Mission: ${mission}\n\nNo router entry found. Execute mission based on agent expertise.`);
274
- }
275
-
276
- // 2.5. Extra resources (checklists, templates) - check multiple paths
277
- const aiosCoreChecklists = path.join(projectRoot, '.aios-core', 'development', 'checklists');
278
- const aiosCoreProductChecklists = path.join(projectRoot, '.aios-core', 'product', 'checklists');
279
-
280
- for (const resource of extraResources) {
281
- // Build checklist path candidates based on agent source
282
- const checklistPaths = [];
283
-
284
- // If agent is from a squad, check squad checklists first
285
- if (agentSource && agentSource.startsWith('squad:')) {
286
- const squadName = agentSource.split(':')[1];
287
- checklistPaths.push(path.join(projectRoot, 'squads', squadName, 'checklists', resource));
288
- }
289
-
290
- // For standalone agents with squad mappings
291
- if (agentSource === 'standalone') {
292
- const squadMappings = {
293
- 'db-sage': 'db-sage',
294
- 'brad-frost': 'design',
295
- 'design-chief': 'design',
296
- 'cyber-chief': 'cybersecurity',
297
- };
298
- const mappedSquad = squadMappings[agentId];
299
- if (mappedSquad) {
300
- checklistPaths.push(path.join(projectRoot, 'squads', mappedSquad, 'checklists', resource));
301
- }
302
- }
303
-
304
- // Always fallback to AIOS core checklists
305
- checklistPaths.push(path.join(aiosCoreChecklists, resource));
306
- checklistPaths.push(path.join(aiosCoreProductChecklists, resource));
307
-
308
- // Find first existing checklist
309
- let foundChecklistPath = null;
310
- for (const cp of checklistPaths) {
311
- if (fs.existsSync(cp)) {
312
- foundChecklistPath = cp;
313
- log(`Checklist found: ${cp}`);
314
- break;
315
- }
316
- }
317
-
318
- if (foundChecklistPath) {
319
- promptParts.push(`## Checklist: ${resource}\n\n${fs.readFileSync(foundChecklistPath, 'utf8')}`);
320
- } else {
321
- log(`Checklist not found: ${resource}`);
322
- }
323
- }
324
-
325
- // 3. Context files (supports multiple)
326
- if (contextPaths.length > 0) {
327
- const contextSections = [];
328
- for (let i = 0; i < contextPaths.length; i++) {
329
- const ctxPath = contextPaths[i];
330
- const ctxLabel = contextPaths.length === 1 ? 'Context' : `Context ${i + 1}`;
331
- if (fs.existsSync(ctxPath)) {
332
- log(`Loading context: ${ctxPath}`);
333
- contextSections.push(`### ${ctxLabel}: ${path.basename(ctxPath)}\n\nFile: ${ctxPath}\n\n${fs.readFileSync(ctxPath, 'utf8')}`);
334
- } else {
335
- contextSections.push(`### ${ctxLabel}\n\nFile not found: ${ctxPath}`);
336
- log(`Warning: context file not found: ${ctxPath}`);
337
- }
338
- }
339
- promptParts.push(`## Context\n\n${contextSections.join('\n\n---\n\n')}`);
340
- }
341
-
342
- // 4. Execution directive
343
- const extraInstructionBlock = extraInstruction ? `\n\n**Additional Instruction:** ${extraInstruction}` : '';
344
- promptParts.push(`## Execution Directive
345
-
346
- Execute the mission "${mission}" following the task workflow above.
347
- - Follow ALL steps in the task workflow exactly
348
- - Use Self-Critique checkpoints if defined in the workflow
349
- - Output artifacts as specified in the workflow
350
- - Mark success/failure clearly at the end${extraInstructionBlock}`);
351
-
352
- // Output complete prompt
353
- const output = promptParts.join('\n\n---\n\n');
354
- console.log(output);
355
-
356
- // Stats to stderr (always shown in verbose mode)
357
- if (verbose) {
358
- const lineCount = output.split('\n').length;
359
- const charCount = output.length;
360
- console.error(`\n[glue] Prompt stats: ${lineCount} lines, ${charCount} chars`);
361
- console.error(`[glue] Sections: ${promptParts.length} (persona, task${extraResources.length > 0 ? ', ' + extraResources.length + ' checklists' : ''}, ${contextPaths.length} contexts, directive)`);
362
- }