@wizdear/atlas-code 0.2.5 → 0.2.6

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 (64) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-factory.d.ts +2 -4
  3. package/dist/agent-factory.d.ts.map +1 -1
  4. package/dist/agent-factory.js +9 -12
  5. package/dist/agent-factory.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +64 -16
  8. package/dist/cli.js.map +1 -1
  9. package/dist/discovery.d.ts +0 -2
  10. package/dist/discovery.d.ts.map +1 -1
  11. package/dist/discovery.js +0 -1
  12. package/dist/discovery.js.map +1 -1
  13. package/dist/extension.d.ts.map +1 -1
  14. package/dist/extension.js +23 -64
  15. package/dist/extension.js.map +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/orchestrator.d.ts +0 -2
  21. package/dist/orchestrator.d.ts.map +1 -1
  22. package/dist/orchestrator.js +0 -1
  23. package/dist/orchestrator.js.map +1 -1
  24. package/dist/pipeline.d.ts +0 -5
  25. package/dist/pipeline.d.ts.map +1 -1
  26. package/dist/pipeline.js +0 -3
  27. package/dist/pipeline.js.map +1 -1
  28. package/dist/planner.d.ts +0 -2
  29. package/dist/planner.d.ts.map +1 -1
  30. package/dist/planner.js +0 -6
  31. package/dist/planner.js.map +1 -1
  32. package/dist/roles/cicd.d.ts +1 -1
  33. package/dist/roles/cicd.d.ts.map +1 -1
  34. package/dist/roles/cicd.js +5 -0
  35. package/dist/roles/cicd.js.map +1 -1
  36. package/dist/roles/reviewer.d.ts +1 -1
  37. package/dist/roles/reviewer.d.ts.map +1 -1
  38. package/dist/roles/reviewer.js +7 -1
  39. package/dist/roles/reviewer.js.map +1 -1
  40. package/dist/roles/standards-enricher.d.ts +1 -1
  41. package/dist/roles/standards-enricher.d.ts.map +1 -1
  42. package/dist/roles/standards-enricher.js +8 -0
  43. package/dist/roles/standards-enricher.js.map +1 -1
  44. package/dist/roles/tester.d.ts +1 -1
  45. package/dist/roles/tester.d.ts.map +1 -1
  46. package/dist/roles/tester.js +7 -0
  47. package/dist/roles/tester.js.map +1 -1
  48. package/dist/standards.d.ts +37 -11
  49. package/dist/standards.d.ts.map +1 -1
  50. package/dist/standards.js +71 -90
  51. package/dist/standards.js.map +1 -1
  52. package/dist/step-executor.d.ts +13 -2
  53. package/dist/step-executor.d.ts.map +1 -1
  54. package/dist/step-executor.js +125 -29
  55. package/dist/step-executor.js.map +1 -1
  56. package/dist/store.d.ts +0 -10
  57. package/dist/store.d.ts.map +1 -1
  58. package/dist/store.js +0 -41
  59. package/dist/store.js.map +1 -1
  60. package/dist/system-architect.d.ts +0 -2
  61. package/dist/system-architect.d.ts.map +1 -1
  62. package/dist/system-architect.js +0 -6
  63. package/dist/system-architect.js.map +1 -1
  64. package/package.json +1 -1
package/dist/store.js CHANGED
@@ -121,7 +121,6 @@ export class VibeStore {
121
121
  async init() {
122
122
  await mkdir(this.featuresDir, { recursive: true });
123
123
  await mkdir(this.standardsDir, { recursive: true });
124
- await mkdir(this.getSkillsDir(), { recursive: true });
125
124
  const configPath = join(this.vibeDir, "config.json");
126
125
  if (!(await this.fileExists(configPath))) {
127
126
  await writeFile(configPath, `${JSON.stringify(DEFAULT_CONFIG, null, "\t")}\n`, "utf-8");
@@ -617,46 +616,6 @@ export class VibeStore {
617
616
  await unlink(filePath);
618
617
  }
619
618
  }
620
- // ─── Skills ──────────────────────────────────────────────────────────────
621
- /** Returns the path to .vibe/skills/ directory. */
622
- getSkillsDir() {
623
- return join(this.vibeDir, "skills");
624
- }
625
- /** Returns a list of directories under .vibe/skills/ that contain SKILL.md. */
626
- async listSkills() {
627
- const dir = this.getSkillsDir();
628
- if (!(await this.fileExists(dir)))
629
- return [];
630
- const entries = await readdir(dir, { withFileTypes: true });
631
- const skills = [];
632
- for (const entry of entries) {
633
- if (entry.isDirectory()) {
634
- const skillFile = join(dir, entry.name, "SKILL.md");
635
- if (await this.fileExists(skillFile)) {
636
- skills.push(entry.name);
637
- }
638
- }
639
- }
640
- return skills.sort();
641
- }
642
- /** Checks if a specific vibe skill exists. */
643
- async hasSkill(skillName) {
644
- return this.fileExists(join(this.getSkillsDir(), skillName, "SKILL.md"));
645
- }
646
- /** Reads the full contents of a vibe skill's SKILL.md. */
647
- async readSkillContent(skillName) {
648
- return readFile(join(this.getSkillsDir(), skillName, "SKILL.md"), "utf-8");
649
- }
650
- /** Extracts only the description from a vibe skill's SKILL.md frontmatter. Returns null if not found. */
651
- async readSkillDescription(skillName) {
652
- const content = await this.readSkillContent(skillName);
653
- const match = content.match(/^---\s*\n([\s\S]*?)\n---/);
654
- if (!match)
655
- return null;
656
- const frontmatter = match[1];
657
- const descMatch = frontmatter.match(/description:\s*(.+)/);
658
- return descMatch ? descMatch[1].trim() : null;
659
- }
660
619
  // ─── Reset ───────────────────────────────────────────────────────────────
661
620
  /** Deletes the entire .vibe/ directory and re-initializes from scratch. */
662
621
  async reset() {
package/dist/store.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAqB,UAAU,EAAmB,MAAM,aAAa,CAAC;AAYjG,kCAAkC;AAClC,MAAM,iBAAiB,GAAqD;IAC3E,OAAO,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC;IAC3C,SAAS,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC;IAC7D,S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;QACb,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,KAAK,CAAC;QACd,CAAC;IAAA,CACD;CACD","sourcesContent":["import { access, mkdir, readdir, readFile, rm, stat, unlink, writeFile } from \"node:fs/promises\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { createModuleLogger, type ModuleLogger, noopLogger, type VibeLogger } from \"./logger.js\";\nimport type {\n\tAgentCheckpoint,\n\tArtifactName,\n\tFeatureStatus,\n\tFeatureStatusValue,\n\tOrchestrationState,\n\tPersistedPipeline,\n\tPlanData,\n\tVibeConfig,\n} from \"./types.js\";\n\n/** Valid state transition map. */\nconst VALID_TRANSITIONS: Record<FeatureStatusValue, FeatureStatusValue[]> = {\n\tplanned: [\"designing\", \"blocked\", \"failed\"],\n\tdesigning: [\"branching\", \"implementing\", \"blocked\", \"failed\"],\n\tbranching: [\"implementing\", \"blocked\", \"failed\"],\n\timplementing: [\"testing\", \"done\", \"blocked\", \"failed\"],\n\ttesting: [\"reviewing\", \"implementing\", \"blocked\", \"failed\"],\n\treviewing: [\"done\", \"merging\", \"implementing\", \"blocked\", \"failed\"],\n\tmerging: [\"done\", \"blocked\", \"failed\"],\n\tdone: [],\n\tblocked: [\"planned\", \"designing\", \"branching\", \"implementing\", \"testing\", \"reviewing\", \"merging\", \"failed\"],\n\tfailed: [],\n};\n\n/** Default configuration. */\nconst DEFAULT_CONFIG: VibeConfig = {\n\tautonomyLevel: \"gate_auto\",\n\tgates: {\n\t\trequireRequirementsApproval: true,\n\t\trequirePlanApproval: true,\n\t\trequireDesignApproval: false,\n\t\trequireSystemDesignApproval: true,\n\t\trequireMergeApproval: true,\n\t\trequireDiagnosisApproval: true,\n\t},\n\tretry: {\n\t\tmaxTestRetries: 3,\n\t\tmaxReviewRetries: 2,\n\t\tmaxRegressionRetries: 3,\n\t\tmaxStepRetries: 2,\n\t},\n\tstandards: {\n\t\tsources: [\".vibe/standards/\"],\n\t},\n\tnotifications: {\n\t\tonStepComplete: true,\n\t\tonBlocked: true,\n\t\tonPRReady: true,\n\t\tchannel: \"terminal\",\n\t},\n\tprojectAnalysis: {\n\t\tautoAnalyzeOnInit: true,\n\t\tstaleThresholdDays: 7,\n\t\texcludePaths: [\"node_modules\", \"dist\", \".git\"],\n\t},\n\tdiscovery: {\n\t\tmaxQuestionRounds: 5,\n\t\tskipIfClear: true,\n\t},\n\tcompaction: {\n\t\tenabled: true,\n\t\treserveTokens: 16384,\n\t\tkeepRecentTokens: 20000,\n\t},\n\ttesting: {\n\t\ttestCommand: \"\",\n\t\ttestTimeout: 300,\n\t\trunExistingTests: false,\n\t\texcludePatterns: [],\n\t\tciChecks: [],\n\t},\n};\n\n/** Marker comment used to identify vibe-managed gitignore block. */\nconst VIBE_GITIGNORE_MARKER = \"# >>> vibe managed\";\nconst VIBE_GITIGNORE_MARKER_END = \"# <<< vibe managed\";\n\n/** Gitignore rules appended to project root .gitignore. */\nconst VIBE_GITIGNORE_BLOCK = `${VIBE_GITIGNORE_MARKER}\n.vibe/logs/\n.vibe/orchestration-state.json\n.vibe/requirements.md\n.vibe/project-context.md\n.vibe/agent-history/\n.vibe/features/*/agent-history/\n${VIBE_GITIGNORE_MARKER_END}`;\n\n/** Deep merges two objects. Keys missing from target are taken from defaults. */\nfunction deepMerge(target: Record<string, unknown>, defaults: Record<string, unknown>): Record<string, unknown> {\n\tconst result = { ...defaults };\n\tfor (const key of Object.keys(target)) {\n\t\tconst targetVal = target[key];\n\t\tconst defaultVal = defaults[key];\n\t\tif (\n\t\t\ttargetVal !== undefined &&\n\t\t\ttargetVal !== null &&\n\t\t\ttypeof targetVal === \"object\" &&\n\t\t\t!Array.isArray(targetVal) &&\n\t\t\ttypeof defaultVal === \"object\" &&\n\t\t\tdefaultVal !== null &&\n\t\t\t!Array.isArray(defaultVal)\n\t\t) {\n\t\t\tresult[key] = deepMerge(targetVal as Record<string, unknown>, defaultVal as Record<string, unknown>);\n\t\t} else if (targetVal !== undefined) {\n\t\t\tresult[key] = targetVal;\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Manages .vibe/ directory creation, feature state machine, project config loading,\n * and standard path resolution.\n */\nexport class VibeStore {\n\tprivate readonly vibeDir: string;\n\tprivate readonly featuresDir: string;\n\tprivate readonly standardsDir: string;\n\tprivate readonly log: ModuleLogger;\n\n\tconstructor(\n\t\tprivate readonly projectRoot: string,\n\t\tlogger?: VibeLogger,\n\t) {\n\t\tthis.vibeDir = join(projectRoot, \".vibe\");\n\t\tthis.featuresDir = join(this.vibeDir, \"features\");\n\t\tthis.standardsDir = join(this.vibeDir, \"standards\");\n\t\tthis.log = createModuleLogger(logger ?? noopLogger, \"store\");\n\t}\n\n\t/** Returns the project root path. */\n\tgetProjectRoot(): string {\n\t\treturn this.projectRoot;\n\t}\n\n\t// ─── Directory ───────────────────────────────────────────────────────────\n\n\t/** Initializes the .vibe/ directory structure. */\n\tasync init(): Promise<void> {\n\t\tawait mkdir(this.featuresDir, { recursive: true });\n\t\tawait mkdir(this.standardsDir, { recursive: true });\n\t\tawait mkdir(this.getSkillsDir(), { recursive: true });\n\n\t\tconst configPath = join(this.vibeDir, \"config.json\");\n\t\tif (!(await this.fileExists(configPath))) {\n\t\t\tawait writeFile(configPath, `${JSON.stringify(DEFAULT_CONFIG, null, \"\\t\")}\\n`, \"utf-8\");\n\t\t}\n\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tif (!(await this.fileExists(planPath))) {\n\t\t\tconst emptyPlan: PlanData = {\n\t\t\t\tproject: \"\",\n\t\t\t\tdescription: \"\",\n\t\t\t\tworkflowType: \"new_feature\",\n\t\t\t\tcreatedAt: new Date().toISOString(),\n\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t\tfeatures: [],\n\t\t\t\tdependencyGraph: {},\n\t\t\t};\n\t\t\tawait writeFile(planPath, `${JSON.stringify(emptyPlan, null, \"\\t\")}\\n`, \"utf-8\");\n\t\t}\n\n\t\tawait this.ensureRootGitignore();\n\t}\n\n\t/** Check if .vibe/ directory has been initialized. */\n\tasync isInitialized(): Promise<boolean> {\n\t\treturn this.fileExists(this.vibeDir);\n\t}\n\n\tgetVibeDir(): string {\n\t\treturn this.vibeDir;\n\t}\n\n\tgetFeaturesDir(): string {\n\t\treturn this.featuresDir;\n\t}\n\n\tgetStandardsDir(): string {\n\t\treturn this.standardsDir;\n\t}\n\n\tgetFeatureDir(featureId: string): string {\n\t\treturn join(this.featuresDir, featureId);\n\t}\n\n\t/** Lists all feature IDs (directory names under features/). */\n\tasync listFeatures(): Promise<string[]> {\n\t\tif (!(await this.fileExists(this.featuresDir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(this.featuresDir, { withFileTypes: true });\n\t\treturn entries\n\t\t\t.filter((e) => e.isDirectory())\n\t\t\t.map((e) => e.name)\n\t\t\t.sort();\n\t}\n\n\t/** Creates the feature directory if it doesn't exist and returns the path. */\n\tasync ensureFeatureDir(featureId: string): Promise<string> {\n\t\tconst dir = this.getFeatureDir(featureId);\n\t\tawait mkdir(dir, { recursive: true });\n\t\treturn dir;\n\t}\n\n\t// ─── Config ──────────────────────────────────────────────────────────────\n\n\t/** Reads config.json and returns a complete VibeConfig merged with defaults. */\n\tasync loadConfig(): Promise<VibeConfig> {\n\t\tconst configPath = join(this.vibeDir, \"config.json\");\n\t\tif (!(await this.fileExists(configPath))) {\n\t\t\treturn { ...DEFAULT_CONFIG };\n\t\t}\n\t\tconst raw = await readFile(configPath, \"utf-8\");\n\t\tconst partial = JSON.parse(raw) as Record<string, unknown>;\n\t\treturn deepMerge(partial, DEFAULT_CONFIG as unknown as Record<string, unknown>) as unknown as VibeConfig;\n\t}\n\n\t/** Saves configuration to config.json. */\n\tasync saveConfig(config: VibeConfig): Promise<void> {\n\t\tconst configPath = join(this.vibeDir, \"config.json\");\n\t\tawait writeFile(configPath, `${JSON.stringify(config, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t// ─── Plan ────────────────────────────────────────────────────────────────\n\n\t/** Reads plan.json. */\n\t/** Checks if a meaningful plan exists. Returns true if plan.json exists and has at least one feature. */\n\tasync hasPlan(): Promise<boolean> {\n\t\ttry {\n\t\t\tconst raw = await readFile(join(this.vibeDir, \"plan.json\"), \"utf-8\");\n\t\t\tconst plan = JSON.parse(raw) as PlanData;\n\t\t\treturn plan.features.length > 0;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tasync loadPlan(): Promise<PlanData> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tconst raw = await readFile(planPath, \"utf-8\");\n\t\treturn JSON.parse(raw) as PlanData;\n\t}\n\n\t/** Writes plan.json. */\n\tasync savePlan(plan: PlanData): Promise<void> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tawait writeFile(planPath, `${JSON.stringify(plan, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t// ─── Feature Status ──────────────────────────────────────────────────────\n\n\t/** Reads the feature's status.json. */\n\tasync loadFeatureStatus(featureId: string): Promise<FeatureStatus> {\n\t\tconst statusPath = join(this.getFeatureDir(featureId), \"status.json\");\n\t\tconst raw = await readFile(statusPath, \"utf-8\");\n\t\treturn JSON.parse(raw) as FeatureStatus;\n\t}\n\n\t/**\n\t * Updates feature status. Validates state transitions and syncs status.json with plan.json.\n\t * Auto-creates the feature directory and status.json if they don't exist.\n\t */\n\tasync updateFeatureStatus(featureId: string, newStatus: FeatureStatusValue): Promise<void> {\n\t\tthis.log.debug(`Updating feature status: ${featureId} → ${newStatus}`, { featureId, newStatus });\n\t\tawait this.ensureFeatureDir(featureId);\n\t\tconst statusPath = join(this.getFeatureDir(featureId), \"status.json\");\n\n\t\tlet currentStatus: FeatureStatus;\n\t\tif (await this.fileExists(statusPath)) {\n\t\t\tconst raw = await readFile(statusPath, \"utf-8\");\n\t\t\tcurrentStatus = JSON.parse(raw) as FeatureStatus;\n\n\t\t\t// Idempotent: same-state transition is a no-op\n\t\t\tif (currentStatus.status === newStatus) {\n\t\t\t\tthis.log.debug(`Status already \"${newStatus}\", skipping transition`, { featureId });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst allowed = VALID_TRANSITIONS[currentStatus.status];\n\t\t\tif (!allowed.includes(newStatus)) {\n\t\t\t\tthis.log.warn(`Invalid state transition: \"${currentStatus.status}\" → \"${newStatus}\"`, { featureId });\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid state transition: \"${currentStatus.status}\" → \"${newStatus}\" for feature \"${featureId}\". Allowed transitions: [${allowed.join(\", \")}]`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tcurrentStatus = {\n\t\t\t\tstatus: \"planned\",\n\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t};\n\t\t\t// New features can only start from planned. Validate planned → newStatus transition.\n\t\t\tif (newStatus !== \"planned\") {\n\t\t\t\tconst allowed = VALID_TRANSITIONS.planned;\n\t\t\t\tif (!allowed.includes(newStatus)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid state transition: \"planned\" → \"${newStatus}\" for new feature \"${featureId}\". Allowed transitions: [${allowed.join(\", \")}]`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst updated: FeatureStatus = {\n\t\t\tstatus: newStatus,\n\t\t\tupdatedAt: new Date().toISOString(),\n\t\t};\n\t\tawait writeFile(statusPath, `${JSON.stringify(updated, null, \"\\t\")}\\n`, \"utf-8\");\n\n\t\t// Sync with plan.json\n\t\tawait this.syncPlanFeatureStatus(featureId, newStatus);\n\t}\n\n\t/** Syncs the feature's status within plan.json. */\n\tprivate async syncPlanFeatureStatus(featureId: string, status: FeatureStatusValue): Promise<void> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tif (!(await this.fileExists(planPath))) {\n\t\t\treturn;\n\t\t}\n\t\tconst plan = await this.loadPlan();\n\t\tconst feature = plan.features.find((f) => f.featureId === featureId);\n\t\tif (feature) {\n\t\t\tfeature.status = status;\n\t\t\tplan.updatedAt = new Date().toISOString();\n\t\t\tawait this.savePlan(plan);\n\t\t}\n\t}\n\n\t// ─── Artifacts ───────────────────────────────────────────────────────────\n\n\t/** Returns the absolute path for an artifact file. */\n\tgetArtifactPath(featureId: string, artifact: ArtifactName): string {\n\t\treturn join(this.getFeatureDir(featureId), artifact);\n\t}\n\n\t/** Checks if an artifact file exists. */\n\tasync hasArtifact(featureId: string, artifact: ArtifactName): Promise<boolean> {\n\t\treturn this.fileExists(this.getArtifactPath(featureId, artifact));\n\t}\n\n\t/** Reads an artifact file. */\n\tasync readArtifact(featureId: string, artifact: ArtifactName): Promise<string> {\n\t\treturn readFile(this.getArtifactPath(featureId, artifact), \"utf-8\");\n\t}\n\n\t/** Writes an artifact file. Auto-creates the feature directory if missing. */\n\tasync writeArtifact(featureId: string, artifact: ArtifactName, content: string): Promise<void> {\n\t\tthis.log.debug(`Writing artifact: ${artifact}`, { featureId });\n\t\tawait this.ensureFeatureDir(featureId);\n\t\tawait writeFile(this.getArtifactPath(featureId, artifact), content, \"utf-8\");\n\t}\n\n\t/** Writes a global artifact file to the .vibe/ root. */\n\tasync writeGlobalArtifact(filename: string, content: string): Promise<void> {\n\t\tawait writeFile(join(this.vibeDir, filename), content, \"utf-8\");\n\t}\n\n\t/** Reads a global artifact file from the .vibe/ root. */\n\tasync readGlobalArtifact(filename: string): Promise<string> {\n\t\treturn readFile(join(this.vibeDir, filename), \"utf-8\");\n\t}\n\n\t/** Checks if a global artifact file exists. */\n\tasync hasGlobalArtifact(filename: string): Promise<boolean> {\n\t\treturn this.fileExists(join(this.vibeDir, filename));\n\t}\n\n\t// ─── Standards ───────────────────────────────────────────────────────────\n\n\t/** Returns a list of .md files in .vibe/standards/ (filenames only). */\n\tasync listStandardFiles(): Promise<string[]> {\n\t\tif (!(await this.fileExists(this.standardsDir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(this.standardsDir);\n\t\treturn entries.filter((e) => e.endsWith(\".md\")).sort();\n\t}\n\n\t/** Resolves a standards source path to an absolute path. */\n\tresolveStandardSource(source: string): string {\n\t\tif (isAbsolute(source)) {\n\t\t\treturn source;\n\t\t}\n\t\treturn resolve(this.projectRoot, source);\n\t}\n\n\t/** Checks if a standard file exists in .vibe/standards/. */\n\tasync hasStandardFile(fileName: string): Promise<boolean> {\n\t\treturn this.fileExists(join(this.standardsDir, fileName));\n\t}\n\n\t/** Reads all standard files and returns them as Map<filename, content>. */\n\tasync readAllStandards(): Promise<Map<string, string>> {\n\t\tconst files = await this.listStandardFiles();\n\t\tconst result = new Map<string, string>();\n\t\tfor (const fileName of files) {\n\t\t\tconst content = await readFile(join(this.standardsDir, fileName), \"utf-8\");\n\t\t\tresult.set(fileName, content);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Writes a single standard file. */\n\tasync writeStandard(fileName: string, content: string): Promise<void> {\n\t\tawait writeFile(join(this.standardsDir, fileName), content, \"utf-8\");\n\t}\n\n\t// ─── Requirements ────────────────────────────────────────────────────────\n\n\t/** Returns the path to .vibe/requirements.md. */\n\tgetRequirementsPath(): string {\n\t\treturn join(this.vibeDir, \"requirements.md\");\n\t}\n\n\t/** Checks if requirements.md exists. */\n\tasync hasRequirements(): Promise<boolean> {\n\t\treturn this.fileExists(this.getRequirementsPath());\n\t}\n\n\t/** Reads requirements.md. */\n\tasync readRequirements(): Promise<string> {\n\t\treturn readFile(this.getRequirementsPath(), \"utf-8\");\n\t}\n\n\t/** Writes requirements.md. */\n\tasync writeRequirements(content: string): Promise<void> {\n\t\tawait writeFile(this.getRequirementsPath(), content, \"utf-8\");\n\t}\n\n\t/** Deletes requirements.md. */\n\tasync clearRequirements(): Promise<void> {\n\t\tconst filePath = this.getRequirementsPath();\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t// ─── System Design ───────────────────────────────────────────────────────\n\n\t/** Returns the path to .vibe/system-design.md. */\n\tgetSystemDesignPath(): string {\n\t\treturn join(this.vibeDir, \"system-design.md\");\n\t}\n\n\t/** Checks if system-design.md exists. */\n\tasync hasSystemDesign(): Promise<boolean> {\n\t\treturn this.fileExists(this.getSystemDesignPath());\n\t}\n\n\t/** Reads system-design.md. */\n\tasync readSystemDesign(): Promise<string> {\n\t\treturn readFile(this.getSystemDesignPath(), \"utf-8\");\n\t}\n\n\t/** Writes system-design.md. */\n\tasync writeSystemDesign(content: string): Promise<void> {\n\t\tawait writeFile(this.getSystemDesignPath(), content, \"utf-8\");\n\t}\n\n\t/** Deletes system-design.md. */\n\tasync clearSystemDesign(): Promise<void> {\n\t\tconst filePath = this.getSystemDesignPath();\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t/** Deletes plan.json. */\n\tasync clearPlan(): Promise<void> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tif (await this.fileExists(planPath)) {\n\t\t\tawait unlink(planPath);\n\t\t}\n\t}\n\n\t/** Recursively deletes the entire feature directory. */\n\tasync clearFeatureDir(featureId: string): Promise<void> {\n\t\tconst dir = this.getFeatureDir(featureId);\n\t\tif (await this.fileExists(dir)) {\n\t\t\tawait rm(dir, { recursive: true, force: true });\n\t\t}\n\t}\n\n\t/** Deletes all feature directories under features/. */\n\tasync clearAllFeatures(): Promise<void> {\n\t\tconst dir = this.getFeaturesDir();\n\t\tif (!(await this.fileExists(dir))) return;\n\t\tconst entries = await readdir(dir);\n\t\tfor (const entry of entries) {\n\t\t\tawait rm(join(dir, entry), { recursive: true, force: true });\n\t\t}\n\t}\n\n\t/** Deletes global agent history by role name. (e.g., \"discovery\" → discovery-*.json) */\n\tasync clearGlobalAgentHistoryByRole(role: string): Promise<void> {\n\t\tconst dir = this.getGlobalAgentHistoryDir();\n\t\tif (!(await this.fileExists(dir))) return;\n\t\tconst entries = await readdir(dir);\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.startsWith(`${role}-`) && entry.endsWith(\".json\")) {\n\t\t\t\tawait unlink(join(dir, entry));\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Deletes a global artifact. */\n\tasync clearGlobalArtifact(filename: string): Promise<void> {\n\t\tconst filePath = join(this.vibeDir, filename);\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t// ─── Project Context ─────────────────────────────────────────────────────\n\n\t/** Returns the path to .vibe/project-context.md. */\n\tgetProjectContextPath(): string {\n\t\treturn join(this.vibeDir, \"project-context.md\");\n\t}\n\n\t/** Checks if project-context.md exists. */\n\tasync hasProjectContext(): Promise<boolean> {\n\t\treturn this.fileExists(this.getProjectContextPath());\n\t}\n\n\t/** Reads project-context.md. */\n\tasync readProjectContext(): Promise<string> {\n\t\treturn readFile(this.getProjectContextPath(), \"utf-8\");\n\t}\n\n\t/** Writes project-context.md. */\n\tasync writeProjectContext(content: string): Promise<void> {\n\t\tawait writeFile(this.getProjectContextPath(), content, \"utf-8\");\n\t}\n\n\t/** Checks if project-context.md is older than staleThresholdDays. */\n\tasync isProjectContextStale(thresholdDays: number): Promise<boolean> {\n\t\tconst contextPath = this.getProjectContextPath();\n\t\tif (!(await this.fileExists(contextPath))) {\n\t\t\treturn true;\n\t\t}\n\t\tconst fileStat = await stat(contextPath);\n\t\tconst ageMs = Date.now() - fileStat.mtimeMs;\n\t\tconst ageDays = ageMs / (1000 * 60 * 60 * 24);\n\t\treturn ageDays > thresholdDays;\n\t}\n\n\t// ─── Agent History (Feature Level) ───────────────────────────────────────\n\n\t/** Returns the agent history directory path for a feature. */\n\tgetAgentHistoryDir(featureId: string): string {\n\t\treturn join(this.getFeatureDir(featureId), \"agent-history\");\n\t}\n\n\t/** Returns the agent history file path. */\n\tgetAgentHistoryPath(featureId: string, role: string, action: string): string {\n\t\treturn join(this.getAgentHistoryDir(featureId), `${role}-${action}.json`);\n\t}\n\n\t/** Saves agent history. Auto-creates the directory if missing. */\n\tasync saveAgentHistory(featureId: string, checkpoint: AgentCheckpoint): Promise<void> {\n\t\tthis.log.debug(`Saving agent history: ${checkpoint.role}:${checkpoint.action}`, { featureId });\n\t\tconst dir = this.getAgentHistoryDir(featureId);\n\t\tawait mkdir(dir, { recursive: true });\n\t\tconst filePath = this.getAgentHistoryPath(featureId, checkpoint.role, checkpoint.action);\n\t\tawait writeFile(filePath, JSON.stringify(checkpoint, null, \"\\t\"), \"utf-8\");\n\t}\n\n\t/** Loads agent history. Returns null if not found. */\n\tasync loadAgentHistory(featureId: string, role: string, action: string): Promise<AgentCheckpoint | null> {\n\t\tconst filePath = this.getAgentHistoryPath(featureId, role, action);\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as AgentCheckpoint;\n\t}\n\n\t/** Checks if agent history exists. */\n\tasync hasAgentHistory(featureId: string, role: string, action: string): Promise<boolean> {\n\t\treturn this.fileExists(this.getAgentHistoryPath(featureId, role, action));\n\t}\n\n\t/**\n\t * Loads prior action histories for the same role in chronological order.\n\t * Excludes the currentAction's own history (separated from retry checkpointing).\n\t */\n\tasync loadPriorAgentHistory(featureId: string, role: string, currentAction: string): Promise<AgentCheckpoint[]> {\n\t\tconst dir = this.getAgentHistoryDir(featureId);\n\t\tif (!(await this.fileExists(dir))) return [];\n\n\t\tconst entries = await readdir(dir);\n\t\tconst prefix = `${role}-`;\n\t\tconst checkpoints: AgentCheckpoint[] = [];\n\n\t\tfor (const entry of entries) {\n\t\t\tif (!entry.startsWith(prefix) || !entry.endsWith(\".json\")) continue;\n\t\t\tconst action = entry.slice(prefix.length, -5);\n\t\t\tif (action === currentAction) continue;\n\n\t\t\tconst raw = await readFile(join(dir, entry), \"utf-8\");\n\t\t\tcheckpoints.push(JSON.parse(raw) as AgentCheckpoint);\n\t\t}\n\n\t\treturn checkpoints.sort((a, b) => a.timestamp.localeCompare(b.timestamp));\n\t}\n\n\t/** Returns all agent history filenames for a feature. */\n\tasync listAgentHistory(featureId: string): Promise<string[]> {\n\t\tconst dir = this.getAgentHistoryDir(featureId);\n\t\tif (!(await this.fileExists(dir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(dir);\n\t\treturn entries.filter((e) => e.endsWith(\".json\")).sort();\n\t}\n\n\t// ─── Agent History (Global Level) ────────────────────────────────────────\n\n\t/** Returns the project-level agent history directory path. */\n\tgetGlobalAgentHistoryDir(): string {\n\t\treturn join(this.vibeDir, \"agent-history\");\n\t}\n\n\t/** Returns the project-level agent history file path. */\n\tgetGlobalAgentHistoryPath(role: string, action: string): string {\n\t\treturn join(this.getGlobalAgentHistoryDir(), `${role}-${action}.json`);\n\t}\n\n\t/** Saves project-level agent history. */\n\tasync saveGlobalAgentHistory(checkpoint: AgentCheckpoint): Promise<void> {\n\t\tconst dir = this.getGlobalAgentHistoryDir();\n\t\tawait mkdir(dir, { recursive: true });\n\t\tconst filePath = this.getGlobalAgentHistoryPath(checkpoint.role, checkpoint.action);\n\t\tawait writeFile(filePath, JSON.stringify(checkpoint, null, \"\\t\"), \"utf-8\");\n\t}\n\n\t/** Loads project-level agent history. Returns null if not found. */\n\tasync loadGlobalAgentHistory(role: string, action: string): Promise<AgentCheckpoint | null> {\n\t\tconst filePath = this.getGlobalAgentHistoryPath(role, action);\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as AgentCheckpoint;\n\t}\n\n\t/** Checks if project-level agent history exists. */\n\tasync hasGlobalAgentHistory(role: string, action: string): Promise<boolean> {\n\t\treturn this.fileExists(this.getGlobalAgentHistoryPath(role, action));\n\t}\n\n\t/** Returns a list of project-level agent history files. */\n\tasync listGlobalAgentHistory(): Promise<string[]> {\n\t\tconst dir = this.getGlobalAgentHistoryDir();\n\t\tif (!(await this.fileExists(dir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(dir);\n\t\treturn entries.filter((e) => e.endsWith(\".json\")).sort();\n\t}\n\n\t// ─── Orchestration State Persistence ─────────────────────────────────────\n\n\t/** Returns the path to orchestration-state.json. */\n\tgetOrchestrationStatePath(): string {\n\t\treturn join(this.vibeDir, \"orchestration-state.json\");\n\t}\n\n\t/** Saves orchestration state. Auto-creates .vibe/ directory if missing. */\n\tasync saveOrchestrationState(state: OrchestrationState): Promise<void> {\n\t\tawait mkdir(this.vibeDir, { recursive: true });\n\t\tawait writeFile(this.getOrchestrationStatePath(), `${JSON.stringify(state, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t/** Loads orchestration state. Returns null if not found. */\n\tasync loadOrchestrationState(): Promise<OrchestrationState | null> {\n\t\tconst filePath = this.getOrchestrationStatePath();\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as OrchestrationState;\n\t}\n\n\t/** Deletes the orchestration state file. */\n\tasync clearOrchestrationState(): Promise<void> {\n\t\tconst filePath = this.getOrchestrationStatePath();\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t/** Checks if orchestration state file exists. */\n\tasync hasOrchestrationState(): Promise<boolean> {\n\t\treturn this.fileExists(this.getOrchestrationStatePath());\n\t}\n\n\t// ─── Pipeline State Persistence ──────────────────────────────────────────\n\n\t/** Returns the path to pipeline.json. */\n\tgetPipelineStatePath(featureId: string): string {\n\t\treturn join(this.getFeatureDir(featureId), \"pipeline.json\");\n\t}\n\n\t/** Saves pipeline state. */\n\tasync savePipelineState(featureId: string, state: PersistedPipeline): Promise<void> {\n\t\tawait this.ensureFeatureDir(featureId);\n\t\tawait writeFile(this.getPipelineStatePath(featureId), `${JSON.stringify(state, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t/** Loads pipeline state. Returns null if not found. */\n\tasync loadPipelineState(featureId: string): Promise<PersistedPipeline | null> {\n\t\tconst filePath = this.getPipelineStatePath(featureId);\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as PersistedPipeline;\n\t}\n\n\t/** Deletes the pipeline state file. */\n\tasync clearPipelineState(featureId: string): Promise<void> {\n\t\tconst filePath = this.getPipelineStatePath(featureId);\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t// ─── Skills ──────────────────────────────────────────────────────────────\n\n\t/** Returns the path to .vibe/skills/ directory. */\n\tgetSkillsDir(): string {\n\t\treturn join(this.vibeDir, \"skills\");\n\t}\n\n\t/** Returns a list of directories under .vibe/skills/ that contain SKILL.md. */\n\tasync listSkills(): Promise<string[]> {\n\t\tconst dir = this.getSkillsDir();\n\t\tif (!(await this.fileExists(dir))) return [];\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tconst skills: string[] = [];\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tconst skillFile = join(dir, entry.name, \"SKILL.md\");\n\t\t\t\tif (await this.fileExists(skillFile)) {\n\t\t\t\t\tskills.push(entry.name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn skills.sort();\n\t}\n\n\t/** Checks if a specific vibe skill exists. */\n\tasync hasSkill(skillName: string): Promise<boolean> {\n\t\treturn this.fileExists(join(this.getSkillsDir(), skillName, \"SKILL.md\"));\n\t}\n\n\t/** Reads the full contents of a vibe skill's SKILL.md. */\n\tasync readSkillContent(skillName: string): Promise<string> {\n\t\treturn readFile(join(this.getSkillsDir(), skillName, \"SKILL.md\"), \"utf-8\");\n\t}\n\n\t/** Extracts only the description from a vibe skill's SKILL.md frontmatter. Returns null if not found. */\n\tasync readSkillDescription(skillName: string): Promise<string | null> {\n\t\tconst content = await this.readSkillContent(skillName);\n\t\tconst match = content.match(/^---\\s*\\n([\\s\\S]*?)\\n---/);\n\t\tif (!match) return null;\n\t\tconst frontmatter = match[1];\n\t\tconst descMatch = frontmatter.match(/description:\\s*(.+)/);\n\t\treturn descMatch ? descMatch[1].trim() : null;\n\t}\n\n\t// ─── Reset ───────────────────────────────────────────────────────────────\n\n\t/** Deletes the entire .vibe/ directory and re-initializes from scratch. */\n\tasync reset(): Promise<void> {\n\t\tif (await this.fileExists(this.vibeDir)) {\n\t\t\tawait rm(this.vibeDir, { recursive: true, force: true });\n\t\t}\n\t\tawait this.init();\n\t}\n\n\t// ─── Helpers ─────────────────────────────────────────────────────────────\n\n\t/**\n\t * Ensures the project root .gitignore contains vibe-managed rules.\n\t * Appends a managed block if missing, or replaces it if already present.\n\t */\n\tprivate async ensureRootGitignore(): Promise<void> {\n\t\tconst gitignorePath = join(this.projectRoot, \".gitignore\");\n\t\tlet content = \"\";\n\t\tif (await this.fileExists(gitignorePath)) {\n\t\t\tcontent = await readFile(gitignorePath, \"utf-8\");\n\t\t}\n\n\t\tif (content.includes(VIBE_GITIGNORE_MARKER)) {\n\t\t\t// Replace existing managed block\n\t\t\tconst startIdx = content.indexOf(VIBE_GITIGNORE_MARKER);\n\t\t\tconst endIdx = content.indexOf(VIBE_GITIGNORE_MARKER_END);\n\t\t\tif (endIdx !== -1) {\n\t\t\t\tconst before = content.slice(0, startIdx);\n\t\t\t\tconst after = content.slice(endIdx + VIBE_GITIGNORE_MARKER_END.length);\n\t\t\t\tcontent = before + VIBE_GITIGNORE_BLOCK + after;\n\t\t\t}\n\t\t} else {\n\t\t\t// Append managed block\n\t\t\tconst separator = content.length > 0 && !content.endsWith(\"\\n\") ? \"\\n\\n\" : content.length > 0 ? \"\\n\" : \"\";\n\t\t\tcontent = `${content}${separator}${VIBE_GITIGNORE_BLOCK}\\n`;\n\t\t}\n\n\t\tawait writeFile(gitignorePath, content, \"utf-8\");\n\t}\n\n\tprivate async fileExists(path: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait access(path);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\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;IAAA,CACD;CACD","sourcesContent":["import { access, mkdir, readdir, readFile, rm, stat, unlink, writeFile } from \"node:fs/promises\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { createModuleLogger, type ModuleLogger, noopLogger, type VibeLogger } from \"./logger.js\";\nimport type {\n\tAgentCheckpoint,\n\tArtifactName,\n\tFeatureStatus,\n\tFeatureStatusValue,\n\tOrchestrationState,\n\tPersistedPipeline,\n\tPlanData,\n\tVibeConfig,\n} from \"./types.js\";\n\n/** Valid state transition map. */\nconst VALID_TRANSITIONS: Record<FeatureStatusValue, FeatureStatusValue[]> = {\n\tplanned: [\"designing\", \"blocked\", \"failed\"],\n\tdesigning: [\"branching\", \"implementing\", \"blocked\", \"failed\"],\n\tbranching: [\"implementing\", \"blocked\", \"failed\"],\n\timplementing: [\"testing\", \"done\", \"blocked\", \"failed\"],\n\ttesting: [\"reviewing\", \"implementing\", \"blocked\", \"failed\"],\n\treviewing: [\"done\", \"merging\", \"implementing\", \"blocked\", \"failed\"],\n\tmerging: [\"done\", \"blocked\", \"failed\"],\n\tdone: [],\n\tblocked: [\"planned\", \"designing\", \"branching\", \"implementing\", \"testing\", \"reviewing\", \"merging\", \"failed\"],\n\tfailed: [],\n};\n\n/** Default configuration. */\nconst DEFAULT_CONFIG: VibeConfig = {\n\tautonomyLevel: \"gate_auto\",\n\tgates: {\n\t\trequireRequirementsApproval: true,\n\t\trequirePlanApproval: true,\n\t\trequireDesignApproval: false,\n\t\trequireSystemDesignApproval: true,\n\t\trequireMergeApproval: true,\n\t\trequireDiagnosisApproval: true,\n\t},\n\tretry: {\n\t\tmaxTestRetries: 3,\n\t\tmaxReviewRetries: 2,\n\t\tmaxRegressionRetries: 3,\n\t\tmaxStepRetries: 2,\n\t},\n\tstandards: {\n\t\tsources: [\".vibe/standards/\"],\n\t},\n\tnotifications: {\n\t\tonStepComplete: true,\n\t\tonBlocked: true,\n\t\tonPRReady: true,\n\t\tchannel: \"terminal\",\n\t},\n\tprojectAnalysis: {\n\t\tautoAnalyzeOnInit: true,\n\t\tstaleThresholdDays: 7,\n\t\texcludePaths: [\"node_modules\", \"dist\", \".git\"],\n\t},\n\tdiscovery: {\n\t\tmaxQuestionRounds: 5,\n\t\tskipIfClear: true,\n\t},\n\tcompaction: {\n\t\tenabled: true,\n\t\treserveTokens: 16384,\n\t\tkeepRecentTokens: 20000,\n\t},\n\ttesting: {\n\t\ttestCommand: \"\",\n\t\ttestTimeout: 300,\n\t\trunExistingTests: false,\n\t\texcludePatterns: [],\n\t\tciChecks: [],\n\t},\n};\n\n/** Marker comment used to identify vibe-managed gitignore block. */\nconst VIBE_GITIGNORE_MARKER = \"# >>> vibe managed\";\nconst VIBE_GITIGNORE_MARKER_END = \"# <<< vibe managed\";\n\n/** Gitignore rules appended to project root .gitignore. */\nconst VIBE_GITIGNORE_BLOCK = `${VIBE_GITIGNORE_MARKER}\n.vibe/logs/\n.vibe/orchestration-state.json\n.vibe/requirements.md\n.vibe/project-context.md\n.vibe/agent-history/\n.vibe/features/*/agent-history/\n${VIBE_GITIGNORE_MARKER_END}`;\n\n/** Deep merges two objects. Keys missing from target are taken from defaults. */\nfunction deepMerge(target: Record<string, unknown>, defaults: Record<string, unknown>): Record<string, unknown> {\n\tconst result = { ...defaults };\n\tfor (const key of Object.keys(target)) {\n\t\tconst targetVal = target[key];\n\t\tconst defaultVal = defaults[key];\n\t\tif (\n\t\t\ttargetVal !== undefined &&\n\t\t\ttargetVal !== null &&\n\t\t\ttypeof targetVal === \"object\" &&\n\t\t\t!Array.isArray(targetVal) &&\n\t\t\ttypeof defaultVal === \"object\" &&\n\t\t\tdefaultVal !== null &&\n\t\t\t!Array.isArray(defaultVal)\n\t\t) {\n\t\t\tresult[key] = deepMerge(targetVal as Record<string, unknown>, defaultVal as Record<string, unknown>);\n\t\t} else if (targetVal !== undefined) {\n\t\t\tresult[key] = targetVal;\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Manages .vibe/ directory creation, feature state machine, project config loading,\n * and standard path resolution.\n */\nexport class VibeStore {\n\tprivate readonly vibeDir: string;\n\tprivate readonly featuresDir: string;\n\tprivate readonly standardsDir: string;\n\tprivate readonly log: ModuleLogger;\n\n\tconstructor(\n\t\tprivate readonly projectRoot: string,\n\t\tlogger?: VibeLogger,\n\t) {\n\t\tthis.vibeDir = join(projectRoot, \".vibe\");\n\t\tthis.featuresDir = join(this.vibeDir, \"features\");\n\t\tthis.standardsDir = join(this.vibeDir, \"standards\");\n\t\tthis.log = createModuleLogger(logger ?? noopLogger, \"store\");\n\t}\n\n\t/** Returns the project root path. */\n\tgetProjectRoot(): string {\n\t\treturn this.projectRoot;\n\t}\n\n\t// ─── Directory ───────────────────────────────────────────────────────────\n\n\t/** Initializes the .vibe/ directory structure. */\n\tasync init(): Promise<void> {\n\t\tawait mkdir(this.featuresDir, { recursive: true });\n\t\tawait mkdir(this.standardsDir, { recursive: true });\n\t\tconst configPath = join(this.vibeDir, \"config.json\");\n\t\tif (!(await this.fileExists(configPath))) {\n\t\t\tawait writeFile(configPath, `${JSON.stringify(DEFAULT_CONFIG, null, \"\\t\")}\\n`, \"utf-8\");\n\t\t}\n\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tif (!(await this.fileExists(planPath))) {\n\t\t\tconst emptyPlan: PlanData = {\n\t\t\t\tproject: \"\",\n\t\t\t\tdescription: \"\",\n\t\t\t\tworkflowType: \"new_feature\",\n\t\t\t\tcreatedAt: new Date().toISOString(),\n\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t\tfeatures: [],\n\t\t\t\tdependencyGraph: {},\n\t\t\t};\n\t\t\tawait writeFile(planPath, `${JSON.stringify(emptyPlan, null, \"\\t\")}\\n`, \"utf-8\");\n\t\t}\n\n\t\tawait this.ensureRootGitignore();\n\t}\n\n\t/** Check if .vibe/ directory has been initialized. */\n\tasync isInitialized(): Promise<boolean> {\n\t\treturn this.fileExists(this.vibeDir);\n\t}\n\n\tgetVibeDir(): string {\n\t\treturn this.vibeDir;\n\t}\n\n\tgetFeaturesDir(): string {\n\t\treturn this.featuresDir;\n\t}\n\n\tgetStandardsDir(): string {\n\t\treturn this.standardsDir;\n\t}\n\n\tgetFeatureDir(featureId: string): string {\n\t\treturn join(this.featuresDir, featureId);\n\t}\n\n\t/** Lists all feature IDs (directory names under features/). */\n\tasync listFeatures(): Promise<string[]> {\n\t\tif (!(await this.fileExists(this.featuresDir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(this.featuresDir, { withFileTypes: true });\n\t\treturn entries\n\t\t\t.filter((e) => e.isDirectory())\n\t\t\t.map((e) => e.name)\n\t\t\t.sort();\n\t}\n\n\t/** Creates the feature directory if it doesn't exist and returns the path. */\n\tasync ensureFeatureDir(featureId: string): Promise<string> {\n\t\tconst dir = this.getFeatureDir(featureId);\n\t\tawait mkdir(dir, { recursive: true });\n\t\treturn dir;\n\t}\n\n\t// ─── Config ──────────────────────────────────────────────────────────────\n\n\t/** Reads config.json and returns a complete VibeConfig merged with defaults. */\n\tasync loadConfig(): Promise<VibeConfig> {\n\t\tconst configPath = join(this.vibeDir, \"config.json\");\n\t\tif (!(await this.fileExists(configPath))) {\n\t\t\treturn { ...DEFAULT_CONFIG };\n\t\t}\n\t\tconst raw = await readFile(configPath, \"utf-8\");\n\t\tconst partial = JSON.parse(raw) as Record<string, unknown>;\n\t\treturn deepMerge(partial, DEFAULT_CONFIG as unknown as Record<string, unknown>) as unknown as VibeConfig;\n\t}\n\n\t/** Saves configuration to config.json. */\n\tasync saveConfig(config: VibeConfig): Promise<void> {\n\t\tconst configPath = join(this.vibeDir, \"config.json\");\n\t\tawait writeFile(configPath, `${JSON.stringify(config, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t// ─── Plan ────────────────────────────────────────────────────────────────\n\n\t/** Reads plan.json. */\n\t/** Checks if a meaningful plan exists. Returns true if plan.json exists and has at least one feature. */\n\tasync hasPlan(): Promise<boolean> {\n\t\ttry {\n\t\t\tconst raw = await readFile(join(this.vibeDir, \"plan.json\"), \"utf-8\");\n\t\t\tconst plan = JSON.parse(raw) as PlanData;\n\t\t\treturn plan.features.length > 0;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tasync loadPlan(): Promise<PlanData> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tconst raw = await readFile(planPath, \"utf-8\");\n\t\treturn JSON.parse(raw) as PlanData;\n\t}\n\n\t/** Writes plan.json. */\n\tasync savePlan(plan: PlanData): Promise<void> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tawait writeFile(planPath, `${JSON.stringify(plan, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t// ─── Feature Status ──────────────────────────────────────────────────────\n\n\t/** Reads the feature's status.json. */\n\tasync loadFeatureStatus(featureId: string): Promise<FeatureStatus> {\n\t\tconst statusPath = join(this.getFeatureDir(featureId), \"status.json\");\n\t\tconst raw = await readFile(statusPath, \"utf-8\");\n\t\treturn JSON.parse(raw) as FeatureStatus;\n\t}\n\n\t/**\n\t * Updates feature status. Validates state transitions and syncs status.json with plan.json.\n\t * Auto-creates the feature directory and status.json if they don't exist.\n\t */\n\tasync updateFeatureStatus(featureId: string, newStatus: FeatureStatusValue): Promise<void> {\n\t\tthis.log.debug(`Updating feature status: ${featureId} → ${newStatus}`, { featureId, newStatus });\n\t\tawait this.ensureFeatureDir(featureId);\n\t\tconst statusPath = join(this.getFeatureDir(featureId), \"status.json\");\n\n\t\tlet currentStatus: FeatureStatus;\n\t\tif (await this.fileExists(statusPath)) {\n\t\t\tconst raw = await readFile(statusPath, \"utf-8\");\n\t\t\tcurrentStatus = JSON.parse(raw) as FeatureStatus;\n\n\t\t\t// Idempotent: same-state transition is a no-op\n\t\t\tif (currentStatus.status === newStatus) {\n\t\t\t\tthis.log.debug(`Status already \"${newStatus}\", skipping transition`, { featureId });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst allowed = VALID_TRANSITIONS[currentStatus.status];\n\t\t\tif (!allowed.includes(newStatus)) {\n\t\t\t\tthis.log.warn(`Invalid state transition: \"${currentStatus.status}\" → \"${newStatus}\"`, { featureId });\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid state transition: \"${currentStatus.status}\" → \"${newStatus}\" for feature \"${featureId}\". Allowed transitions: [${allowed.join(\", \")}]`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tcurrentStatus = {\n\t\t\t\tstatus: \"planned\",\n\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t};\n\t\t\t// New features can only start from planned. Validate planned → newStatus transition.\n\t\t\tif (newStatus !== \"planned\") {\n\t\t\t\tconst allowed = VALID_TRANSITIONS.planned;\n\t\t\t\tif (!allowed.includes(newStatus)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid state transition: \"planned\" → \"${newStatus}\" for new feature \"${featureId}\". Allowed transitions: [${allowed.join(\", \")}]`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst updated: FeatureStatus = {\n\t\t\tstatus: newStatus,\n\t\t\tupdatedAt: new Date().toISOString(),\n\t\t};\n\t\tawait writeFile(statusPath, `${JSON.stringify(updated, null, \"\\t\")}\\n`, \"utf-8\");\n\n\t\t// Sync with plan.json\n\t\tawait this.syncPlanFeatureStatus(featureId, newStatus);\n\t}\n\n\t/** Syncs the feature's status within plan.json. */\n\tprivate async syncPlanFeatureStatus(featureId: string, status: FeatureStatusValue): Promise<void> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tif (!(await this.fileExists(planPath))) {\n\t\t\treturn;\n\t\t}\n\t\tconst plan = await this.loadPlan();\n\t\tconst feature = plan.features.find((f) => f.featureId === featureId);\n\t\tif (feature) {\n\t\t\tfeature.status = status;\n\t\t\tplan.updatedAt = new Date().toISOString();\n\t\t\tawait this.savePlan(plan);\n\t\t}\n\t}\n\n\t// ─── Artifacts ───────────────────────────────────────────────────────────\n\n\t/** Returns the absolute path for an artifact file. */\n\tgetArtifactPath(featureId: string, artifact: ArtifactName): string {\n\t\treturn join(this.getFeatureDir(featureId), artifact);\n\t}\n\n\t/** Checks if an artifact file exists. */\n\tasync hasArtifact(featureId: string, artifact: ArtifactName): Promise<boolean> {\n\t\treturn this.fileExists(this.getArtifactPath(featureId, artifact));\n\t}\n\n\t/** Reads an artifact file. */\n\tasync readArtifact(featureId: string, artifact: ArtifactName): Promise<string> {\n\t\treturn readFile(this.getArtifactPath(featureId, artifact), \"utf-8\");\n\t}\n\n\t/** Writes an artifact file. Auto-creates the feature directory if missing. */\n\tasync writeArtifact(featureId: string, artifact: ArtifactName, content: string): Promise<void> {\n\t\tthis.log.debug(`Writing artifact: ${artifact}`, { featureId });\n\t\tawait this.ensureFeatureDir(featureId);\n\t\tawait writeFile(this.getArtifactPath(featureId, artifact), content, \"utf-8\");\n\t}\n\n\t/** Writes a global artifact file to the .vibe/ root. */\n\tasync writeGlobalArtifact(filename: string, content: string): Promise<void> {\n\t\tawait writeFile(join(this.vibeDir, filename), content, \"utf-8\");\n\t}\n\n\t/** Reads a global artifact file from the .vibe/ root. */\n\tasync readGlobalArtifact(filename: string): Promise<string> {\n\t\treturn readFile(join(this.vibeDir, filename), \"utf-8\");\n\t}\n\n\t/** Checks if a global artifact file exists. */\n\tasync hasGlobalArtifact(filename: string): Promise<boolean> {\n\t\treturn this.fileExists(join(this.vibeDir, filename));\n\t}\n\n\t// ─── Standards ───────────────────────────────────────────────────────────\n\n\t/** Returns a list of .md files in .vibe/standards/ (filenames only). */\n\tasync listStandardFiles(): Promise<string[]> {\n\t\tif (!(await this.fileExists(this.standardsDir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(this.standardsDir);\n\t\treturn entries.filter((e) => e.endsWith(\".md\")).sort();\n\t}\n\n\t/** Resolves a standards source path to an absolute path. */\n\tresolveStandardSource(source: string): string {\n\t\tif (isAbsolute(source)) {\n\t\t\treturn source;\n\t\t}\n\t\treturn resolve(this.projectRoot, source);\n\t}\n\n\t/** Checks if a standard file exists in .vibe/standards/. */\n\tasync hasStandardFile(fileName: string): Promise<boolean> {\n\t\treturn this.fileExists(join(this.standardsDir, fileName));\n\t}\n\n\t/** Reads all standard files and returns them as Map<filename, content>. */\n\tasync readAllStandards(): Promise<Map<string, string>> {\n\t\tconst files = await this.listStandardFiles();\n\t\tconst result = new Map<string, string>();\n\t\tfor (const fileName of files) {\n\t\t\tconst content = await readFile(join(this.standardsDir, fileName), \"utf-8\");\n\t\t\tresult.set(fileName, content);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Writes a single standard file. */\n\tasync writeStandard(fileName: string, content: string): Promise<void> {\n\t\tawait writeFile(join(this.standardsDir, fileName), content, \"utf-8\");\n\t}\n\n\t// ─── Requirements ────────────────────────────────────────────────────────\n\n\t/** Returns the path to .vibe/requirements.md. */\n\tgetRequirementsPath(): string {\n\t\treturn join(this.vibeDir, \"requirements.md\");\n\t}\n\n\t/** Checks if requirements.md exists. */\n\tasync hasRequirements(): Promise<boolean> {\n\t\treturn this.fileExists(this.getRequirementsPath());\n\t}\n\n\t/** Reads requirements.md. */\n\tasync readRequirements(): Promise<string> {\n\t\treturn readFile(this.getRequirementsPath(), \"utf-8\");\n\t}\n\n\t/** Writes requirements.md. */\n\tasync writeRequirements(content: string): Promise<void> {\n\t\tawait writeFile(this.getRequirementsPath(), content, \"utf-8\");\n\t}\n\n\t/** Deletes requirements.md. */\n\tasync clearRequirements(): Promise<void> {\n\t\tconst filePath = this.getRequirementsPath();\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t// ─── System Design ───────────────────────────────────────────────────────\n\n\t/** Returns the path to .vibe/system-design.md. */\n\tgetSystemDesignPath(): string {\n\t\treturn join(this.vibeDir, \"system-design.md\");\n\t}\n\n\t/** Checks if system-design.md exists. */\n\tasync hasSystemDesign(): Promise<boolean> {\n\t\treturn this.fileExists(this.getSystemDesignPath());\n\t}\n\n\t/** Reads system-design.md. */\n\tasync readSystemDesign(): Promise<string> {\n\t\treturn readFile(this.getSystemDesignPath(), \"utf-8\");\n\t}\n\n\t/** Writes system-design.md. */\n\tasync writeSystemDesign(content: string): Promise<void> {\n\t\tawait writeFile(this.getSystemDesignPath(), content, \"utf-8\");\n\t}\n\n\t/** Deletes system-design.md. */\n\tasync clearSystemDesign(): Promise<void> {\n\t\tconst filePath = this.getSystemDesignPath();\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t/** Deletes plan.json. */\n\tasync clearPlan(): Promise<void> {\n\t\tconst planPath = join(this.vibeDir, \"plan.json\");\n\t\tif (await this.fileExists(planPath)) {\n\t\t\tawait unlink(planPath);\n\t\t}\n\t}\n\n\t/** Recursively deletes the entire feature directory. */\n\tasync clearFeatureDir(featureId: string): Promise<void> {\n\t\tconst dir = this.getFeatureDir(featureId);\n\t\tif (await this.fileExists(dir)) {\n\t\t\tawait rm(dir, { recursive: true, force: true });\n\t\t}\n\t}\n\n\t/** Deletes all feature directories under features/. */\n\tasync clearAllFeatures(): Promise<void> {\n\t\tconst dir = this.getFeaturesDir();\n\t\tif (!(await this.fileExists(dir))) return;\n\t\tconst entries = await readdir(dir);\n\t\tfor (const entry of entries) {\n\t\t\tawait rm(join(dir, entry), { recursive: true, force: true });\n\t\t}\n\t}\n\n\t/** Deletes global agent history by role name. (e.g., \"discovery\" → discovery-*.json) */\n\tasync clearGlobalAgentHistoryByRole(role: string): Promise<void> {\n\t\tconst dir = this.getGlobalAgentHistoryDir();\n\t\tif (!(await this.fileExists(dir))) return;\n\t\tconst entries = await readdir(dir);\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.startsWith(`${role}-`) && entry.endsWith(\".json\")) {\n\t\t\t\tawait unlink(join(dir, entry));\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Deletes a global artifact. */\n\tasync clearGlobalArtifact(filename: string): Promise<void> {\n\t\tconst filePath = join(this.vibeDir, filename);\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t// ─── Project Context ─────────────────────────────────────────────────────\n\n\t/** Returns the path to .vibe/project-context.md. */\n\tgetProjectContextPath(): string {\n\t\treturn join(this.vibeDir, \"project-context.md\");\n\t}\n\n\t/** Checks if project-context.md exists. */\n\tasync hasProjectContext(): Promise<boolean> {\n\t\treturn this.fileExists(this.getProjectContextPath());\n\t}\n\n\t/** Reads project-context.md. */\n\tasync readProjectContext(): Promise<string> {\n\t\treturn readFile(this.getProjectContextPath(), \"utf-8\");\n\t}\n\n\t/** Writes project-context.md. */\n\tasync writeProjectContext(content: string): Promise<void> {\n\t\tawait writeFile(this.getProjectContextPath(), content, \"utf-8\");\n\t}\n\n\t/** Checks if project-context.md is older than staleThresholdDays. */\n\tasync isProjectContextStale(thresholdDays: number): Promise<boolean> {\n\t\tconst contextPath = this.getProjectContextPath();\n\t\tif (!(await this.fileExists(contextPath))) {\n\t\t\treturn true;\n\t\t}\n\t\tconst fileStat = await stat(contextPath);\n\t\tconst ageMs = Date.now() - fileStat.mtimeMs;\n\t\tconst ageDays = ageMs / (1000 * 60 * 60 * 24);\n\t\treturn ageDays > thresholdDays;\n\t}\n\n\t// ─── Agent History (Feature Level) ───────────────────────────────────────\n\n\t/** Returns the agent history directory path for a feature. */\n\tgetAgentHistoryDir(featureId: string): string {\n\t\treturn join(this.getFeatureDir(featureId), \"agent-history\");\n\t}\n\n\t/** Returns the agent history file path. */\n\tgetAgentHistoryPath(featureId: string, role: string, action: string): string {\n\t\treturn join(this.getAgentHistoryDir(featureId), `${role}-${action}.json`);\n\t}\n\n\t/** Saves agent history. Auto-creates the directory if missing. */\n\tasync saveAgentHistory(featureId: string, checkpoint: AgentCheckpoint): Promise<void> {\n\t\tthis.log.debug(`Saving agent history: ${checkpoint.role}:${checkpoint.action}`, { featureId });\n\t\tconst dir = this.getAgentHistoryDir(featureId);\n\t\tawait mkdir(dir, { recursive: true });\n\t\tconst filePath = this.getAgentHistoryPath(featureId, checkpoint.role, checkpoint.action);\n\t\tawait writeFile(filePath, JSON.stringify(checkpoint, null, \"\\t\"), \"utf-8\");\n\t}\n\n\t/** Loads agent history. Returns null if not found. */\n\tasync loadAgentHistory(featureId: string, role: string, action: string): Promise<AgentCheckpoint | null> {\n\t\tconst filePath = this.getAgentHistoryPath(featureId, role, action);\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as AgentCheckpoint;\n\t}\n\n\t/** Checks if agent history exists. */\n\tasync hasAgentHistory(featureId: string, role: string, action: string): Promise<boolean> {\n\t\treturn this.fileExists(this.getAgentHistoryPath(featureId, role, action));\n\t}\n\n\t/**\n\t * Loads prior action histories for the same role in chronological order.\n\t * Excludes the currentAction's own history (separated from retry checkpointing).\n\t */\n\tasync loadPriorAgentHistory(featureId: string, role: string, currentAction: string): Promise<AgentCheckpoint[]> {\n\t\tconst dir = this.getAgentHistoryDir(featureId);\n\t\tif (!(await this.fileExists(dir))) return [];\n\n\t\tconst entries = await readdir(dir);\n\t\tconst prefix = `${role}-`;\n\t\tconst checkpoints: AgentCheckpoint[] = [];\n\n\t\tfor (const entry of entries) {\n\t\t\tif (!entry.startsWith(prefix) || !entry.endsWith(\".json\")) continue;\n\t\t\tconst action = entry.slice(prefix.length, -5);\n\t\t\tif (action === currentAction) continue;\n\n\t\t\tconst raw = await readFile(join(dir, entry), \"utf-8\");\n\t\t\tcheckpoints.push(JSON.parse(raw) as AgentCheckpoint);\n\t\t}\n\n\t\treturn checkpoints.sort((a, b) => a.timestamp.localeCompare(b.timestamp));\n\t}\n\n\t/** Returns all agent history filenames for a feature. */\n\tasync listAgentHistory(featureId: string): Promise<string[]> {\n\t\tconst dir = this.getAgentHistoryDir(featureId);\n\t\tif (!(await this.fileExists(dir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(dir);\n\t\treturn entries.filter((e) => e.endsWith(\".json\")).sort();\n\t}\n\n\t// ─── Agent History (Global Level) ────────────────────────────────────────\n\n\t/** Returns the project-level agent history directory path. */\n\tgetGlobalAgentHistoryDir(): string {\n\t\treturn join(this.vibeDir, \"agent-history\");\n\t}\n\n\t/** Returns the project-level agent history file path. */\n\tgetGlobalAgentHistoryPath(role: string, action: string): string {\n\t\treturn join(this.getGlobalAgentHistoryDir(), `${role}-${action}.json`);\n\t}\n\n\t/** Saves project-level agent history. */\n\tasync saveGlobalAgentHistory(checkpoint: AgentCheckpoint): Promise<void> {\n\t\tconst dir = this.getGlobalAgentHistoryDir();\n\t\tawait mkdir(dir, { recursive: true });\n\t\tconst filePath = this.getGlobalAgentHistoryPath(checkpoint.role, checkpoint.action);\n\t\tawait writeFile(filePath, JSON.stringify(checkpoint, null, \"\\t\"), \"utf-8\");\n\t}\n\n\t/** Loads project-level agent history. Returns null if not found. */\n\tasync loadGlobalAgentHistory(role: string, action: string): Promise<AgentCheckpoint | null> {\n\t\tconst filePath = this.getGlobalAgentHistoryPath(role, action);\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as AgentCheckpoint;\n\t}\n\n\t/** Checks if project-level agent history exists. */\n\tasync hasGlobalAgentHistory(role: string, action: string): Promise<boolean> {\n\t\treturn this.fileExists(this.getGlobalAgentHistoryPath(role, action));\n\t}\n\n\t/** Returns a list of project-level agent history files. */\n\tasync listGlobalAgentHistory(): Promise<string[]> {\n\t\tconst dir = this.getGlobalAgentHistoryDir();\n\t\tif (!(await this.fileExists(dir))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst entries = await readdir(dir);\n\t\treturn entries.filter((e) => e.endsWith(\".json\")).sort();\n\t}\n\n\t// ─── Orchestration State Persistence ─────────────────────────────────────\n\n\t/** Returns the path to orchestration-state.json. */\n\tgetOrchestrationStatePath(): string {\n\t\treturn join(this.vibeDir, \"orchestration-state.json\");\n\t}\n\n\t/** Saves orchestration state. Auto-creates .vibe/ directory if missing. */\n\tasync saveOrchestrationState(state: OrchestrationState): Promise<void> {\n\t\tawait mkdir(this.vibeDir, { recursive: true });\n\t\tawait writeFile(this.getOrchestrationStatePath(), `${JSON.stringify(state, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t/** Loads orchestration state. Returns null if not found. */\n\tasync loadOrchestrationState(): Promise<OrchestrationState | null> {\n\t\tconst filePath = this.getOrchestrationStatePath();\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as OrchestrationState;\n\t}\n\n\t/** Deletes the orchestration state file. */\n\tasync clearOrchestrationState(): Promise<void> {\n\t\tconst filePath = this.getOrchestrationStatePath();\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t/** Checks if orchestration state file exists. */\n\tasync hasOrchestrationState(): Promise<boolean> {\n\t\treturn this.fileExists(this.getOrchestrationStatePath());\n\t}\n\n\t// ─── Pipeline State Persistence ──────────────────────────────────────────\n\n\t/** Returns the path to pipeline.json. */\n\tgetPipelineStatePath(featureId: string): string {\n\t\treturn join(this.getFeatureDir(featureId), \"pipeline.json\");\n\t}\n\n\t/** Saves pipeline state. */\n\tasync savePipelineState(featureId: string, state: PersistedPipeline): Promise<void> {\n\t\tawait this.ensureFeatureDir(featureId);\n\t\tawait writeFile(this.getPipelineStatePath(featureId), `${JSON.stringify(state, null, \"\\t\")}\\n`, \"utf-8\");\n\t}\n\n\t/** Loads pipeline state. Returns null if not found. */\n\tasync loadPipelineState(featureId: string): Promise<PersistedPipeline | null> {\n\t\tconst filePath = this.getPipelineStatePath(featureId);\n\t\tif (!(await this.fileExists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst raw = await readFile(filePath, \"utf-8\");\n\t\treturn JSON.parse(raw) as PersistedPipeline;\n\t}\n\n\t/** Deletes the pipeline state file. */\n\tasync clearPipelineState(featureId: string): Promise<void> {\n\t\tconst filePath = this.getPipelineStatePath(featureId);\n\t\tif (await this.fileExists(filePath)) {\n\t\t\tawait unlink(filePath);\n\t\t}\n\t}\n\n\t// ─── Reset ───────────────────────────────────────────────────────────────\n\n\t/** Deletes the entire .vibe/ directory and re-initializes from scratch. */\n\tasync reset(): Promise<void> {\n\t\tif (await this.fileExists(this.vibeDir)) {\n\t\t\tawait rm(this.vibeDir, { recursive: true, force: true });\n\t\t}\n\t\tawait this.init();\n\t}\n\n\t// ─── Helpers ─────────────────────────────────────────────────────────────\n\n\t/**\n\t * Ensures the project root .gitignore contains vibe-managed rules.\n\t * Appends a managed block if missing, or replaces it if already present.\n\t */\n\tprivate async ensureRootGitignore(): Promise<void> {\n\t\tconst gitignorePath = join(this.projectRoot, \".gitignore\");\n\t\tlet content = \"\";\n\t\tif (await this.fileExists(gitignorePath)) {\n\t\t\tcontent = await readFile(gitignorePath, \"utf-8\");\n\t\t}\n\n\t\tif (content.includes(VIBE_GITIGNORE_MARKER)) {\n\t\t\t// Replace existing managed block\n\t\t\tconst startIdx = content.indexOf(VIBE_GITIGNORE_MARKER);\n\t\t\tconst endIdx = content.indexOf(VIBE_GITIGNORE_MARKER_END);\n\t\t\tif (endIdx !== -1) {\n\t\t\t\tconst before = content.slice(0, startIdx);\n\t\t\t\tconst after = content.slice(endIdx + VIBE_GITIGNORE_MARKER_END.length);\n\t\t\t\tcontent = before + VIBE_GITIGNORE_BLOCK + after;\n\t\t\t}\n\t\t} else {\n\t\t\t// Append managed block\n\t\t\tconst separator = content.length > 0 && !content.endsWith(\"\\n\") ? \"\\n\\n\" : content.length > 0 ? \"\\n\" : \"\";\n\t\t\tcontent = `${content}${separator}${VIBE_GITIGNORE_BLOCK}\\n`;\n\t\t}\n\n\t\tawait writeFile(gitignorePath, content, \"utf-8\");\n\t}\n\n\tprivate async fileExists(path: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait access(path);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"]}
@@ -17,8 +17,6 @@ export interface SystemArchitectOptions {
17
17
  onMessage?: (message: string) => void;
18
18
  /** User feedback on rejection. Re-generates with feedback applied. */
19
19
  feedback?: string;
20
- /** Lightweight skill index. Included in the agent system prompt. */
21
- availableSkills?: string;
22
20
  /** Callback invoked when the agent is created (for abort wiring). */
23
21
  onAgentCreated?: (agent: Agent) => void;
24
22
  /** Callback invoked when the agent finishes execution. */
@@ -1 +1 @@
1
- {"version":3,"file":"system-architect.d.ts","sourceRoot":"","sources":["../src/system-architect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,0CAA0C;AAC1C,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,qEAAqE;IACrE,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC3C,mDAAmD;IACnD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACxC,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,yCAAyC;AACzC,MAAM,WAAW,qBAAqB;IACrC,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACpH;AAID;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA8ExG","sourcesContent":["import type { Agent, AgentEvent } from \"@mariozechner/pi-agent-core\";\nimport type { Model } from \"@mariozechner/pi-ai\";\nimport type { GetApiKeyFn } from \"./agent-factory.js\";\nimport { createRoleAgent, runAgent } from \"./agent-factory.js\";\nimport { getSystemPromptForRole } from \"./roles/index.js\";\nimport { aggregateUsage, extractArtifactContent } from \"./step-executor.js\";\nimport type { VibeStore } from \"./store.js\";\nimport type { VibeConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** System Architect execution options. */\nexport interface SystemArchitectOptions {\n\tstore: VibeStore;\n\tconfig: VibeConfig;\n\tprojectRoot: string;\n\tgetApiKey?: GetApiKeyFn;\n\t/** Model to use. Uses the Agent's default model if not specified. */\n\tmodel?: Model<any>;\n\t/** Agent event callback for progress display. */\n\tonAgentEvent?: (event: AgentEvent) => void;\n\t/** Callback to relay agent messages externally. */\n\tonMessage?: (message: string) => void;\n\t/** User feedback on rejection. Re-generates with feedback applied. */\n\tfeedback?: string;\n\t/** Lightweight skill index. Included in the agent system prompt. */\n\tavailableSkills?: string;\n\t/** Callback invoked when the agent is created (for abort wiring). */\n\tonAgentCreated?: (agent: Agent) => void;\n\t/** Callback invoked when the agent finishes execution. */\n\tonAgentFinished?: () => void;\n}\n\n/** System Architect execution result. */\nexport interface SystemArchitectResult {\n\t/** Whether system-design.md was generated. */\n\tcompleted: boolean;\n\t/** Aggregated token usage. */\n\tusage?: { input: number; output: number; cacheRead: number; cacheWrite: number; totalTokens: number; cost: number };\n}\n\n// ─── Runner ──────────────────────────────────────────────────────────────────\n\n/**\n * Runs the System Architect agent to generate system-design.md\n * based on requirements.md and project-context.md.\n *\n * 1. Load requirements.md and project-context.md from the store\n * 2. Optionally load existing system-design.md for iterative refinement\n * 3. Create systemArchitect agent\n * 4. Run the agent with a prompt (includes feedback if re-running)\n * 5. Extract system-design.md from the response\n * 6. Write to store\n */\nexport async function runSystemArchitect(options: SystemArchitectOptions): Promise<SystemArchitectResult> {\n\tconst { store, config, projectRoot, getApiKey, model, onAgentEvent, onMessage, feedback } = options;\n\n\t// 1. Load inputs\n\tlet requirements: string | undefined;\n\tif (await store.hasRequirements()) {\n\t\trequirements = await store.readRequirements();\n\t}\n\n\tlet projectContext: string | undefined;\n\tif (await store.hasProjectContext()) {\n\t\tprojectContext = await store.readProjectContext();\n\t}\n\n\tlet existingDesign: string | undefined;\n\tif (await store.hasSystemDesign()) {\n\t\texistingDesign = await store.readSystemDesign();\n\t}\n\n\t// 2. Build feature context (injected into system prompt)\n\tconst featureContext = buildSystemArchitectContext(requirements, existingDesign);\n\n\t// 3. Create agent\n\tconst systemPrompt = getSystemPromptForRole(\"systemArchitect\");\n\tconst agent = await createRoleAgent({\n\t\trole: \"systemArchitect\",\n\t\tsystemPrompt,\n\t\tconfig,\n\t\tprojectRoot,\n\t\tmodel,\n\t\tfeatureContext: featureContext || undefined,\n\t\tgetApiKey,\n\t\tavailableSkills: options.availableSkills,\n\t});\n\n\toptions.onAgentCreated?.(agent);\n\n\t// 4. Build prompt and execute\n\ttry {\n\t\tlet prompt: string;\n\t\tif (feedback) {\n\t\t\tprompt =\n\t\t\t\t`The previous system design was rejected with the following feedback:\\n\\n${feedback}\\n\\n` +\n\t\t\t\t\"Please revise the system design based on this feedback.\\n\\n\" +\n\t\t\t\tbuildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t} else {\n\t\t\tprompt = buildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t}\n\n\t\t// Add QMD search directive when skills are available\n\t\tif (options.availableSkills) {\n\t\t\tprompt +=\n\t\t\t\t\"\\n\\nBefore designing system architecture, search past feature artifacts for related architectural decisions, component boundaries, and API contracts.\";\n\t\t}\n\n\t\tconst response = await runAgent(agent, prompt, onAgentEvent ? { onEvent: onAgentEvent } : undefined);\n\t\tconst usage = aggregateUsage(agent.state.messages);\n\t\tonMessage?.(response);\n\n\t\t// 5. Extract system-design.md\n\t\tconst content = extractArtifactContent(response, \"system-design.md\", false);\n\t\tif (!content) {\n\t\t\treturn { completed: false, usage };\n\t\t}\n\n\t\t// 6. Write to store\n\t\tawait store.writeSystemDesign(content);\n\n\t\treturn { completed: true, usage };\n\t} catch (error) {\n\t\tconst msg = error instanceof Error ? error.message : String(error);\n\t\tif (msg.includes(\"aborted\")) {\n\t\t\treturn { completed: false };\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\toptions.onAgentFinished?.();\n\t}\n}\n\n// ─── Context & Prompt Builders ───────────────────────────────────────────────\n\nfunction buildSystemArchitectContext(requirements?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements\\n\");\n\t\tparts.push(requirements);\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design (for refinement)\\n\");\n\t\tparts.push(existingDesign);\n\t}\n\n\treturn parts.join(\"\\n\\n\");\n}\n\nfunction buildSystemArchitectPrompt(requirements?: string, projectContext?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tparts.push(\n\t\t\"Analyze the following inputs and produce a system-design.md document that establishes component boundaries, API contracts, shared data models, and common patterns.\",\n\t);\n\tparts.push(\"\");\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements Document\");\n\t\tparts.push(\"\");\n\t\tparts.push(requirements);\n\t\tparts.push(\"\");\n\t} else {\n\t\tparts.push(\"Note: No requirements.md found. Use the project context to infer system architecture.\");\n\t\tparts.push(\"\");\n\t}\n\n\tif (projectContext) {\n\t\tparts.push(\"## Project Context\");\n\t\tparts.push(\"\");\n\t\tparts.push(projectContext);\n\t\tparts.push(\"\");\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design\");\n\t\tparts.push(\"\");\n\t\tparts.push(\n\t\t\t\"A previous system-design.md exists. Refine and update it based on the current requirements rather than starting from scratch.\",\n\t\t);\n\t\tparts.push(\"\");\n\t\tparts.push(existingDesign);\n\t\tparts.push(\"\");\n\t}\n\n\tparts.push(\"## Instructions\");\n\tparts.push(\"\");\n\tparts.push(\"1. Identify all system components and their boundaries\");\n\tparts.push(\"2. Define API contracts between components\");\n\tparts.push(\"3. Establish shared data models\");\n\tparts.push(\"4. Define common patterns (auth, error handling, logging)\");\n\tparts.push(\"5. Make infrastructure decisions based on the System Scope requirements\");\n\tparts.push(\"6. Note any decisions deferred to feature-level architects\");\n\tparts.push(\"7. Output the result in a ```system-design.md code block\");\n\n\treturn parts.join(\"\\n\");\n}\n"]}
1
+ {"version":3,"file":"system-architect.d.ts","sourceRoot":"","sources":["../src/system-architect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,0CAA0C;AAC1C,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,qEAAqE;IACrE,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC3C,mDAAmD;IACnD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACxC,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,yCAAyC;AACzC,MAAM,WAAW,qBAAqB;IACrC,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACpH;AAID;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuExG","sourcesContent":["import type { Agent, AgentEvent } from \"@mariozechner/pi-agent-core\";\nimport type { Model } from \"@mariozechner/pi-ai\";\nimport type { GetApiKeyFn } from \"./agent-factory.js\";\nimport { createRoleAgent, runAgent } from \"./agent-factory.js\";\nimport { getSystemPromptForRole } from \"./roles/index.js\";\nimport { aggregateUsage, extractArtifactContent } from \"./step-executor.js\";\nimport type { VibeStore } from \"./store.js\";\nimport type { VibeConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** System Architect execution options. */\nexport interface SystemArchitectOptions {\n\tstore: VibeStore;\n\tconfig: VibeConfig;\n\tprojectRoot: string;\n\tgetApiKey?: GetApiKeyFn;\n\t/** Model to use. Uses the Agent's default model if not specified. */\n\tmodel?: Model<any>;\n\t/** Agent event callback for progress display. */\n\tonAgentEvent?: (event: AgentEvent) => void;\n\t/** Callback to relay agent messages externally. */\n\tonMessage?: (message: string) => void;\n\t/** User feedback on rejection. Re-generates with feedback applied. */\n\tfeedback?: string;\n\t/** Callback invoked when the agent is created (for abort wiring). */\n\tonAgentCreated?: (agent: Agent) => void;\n\t/** Callback invoked when the agent finishes execution. */\n\tonAgentFinished?: () => void;\n}\n\n/** System Architect execution result. */\nexport interface SystemArchitectResult {\n\t/** Whether system-design.md was generated. */\n\tcompleted: boolean;\n\t/** Aggregated token usage. */\n\tusage?: { input: number; output: number; cacheRead: number; cacheWrite: number; totalTokens: number; cost: number };\n}\n\n// ─── Runner ──────────────────────────────────────────────────────────────────\n\n/**\n * Runs the System Architect agent to generate system-design.md\n * based on requirements.md and project-context.md.\n *\n * 1. Load requirements.md and project-context.md from the store\n * 2. Optionally load existing system-design.md for iterative refinement\n * 3. Create systemArchitect agent\n * 4. Run the agent with a prompt (includes feedback if re-running)\n * 5. Extract system-design.md from the response\n * 6. Write to store\n */\nexport async function runSystemArchitect(options: SystemArchitectOptions): Promise<SystemArchitectResult> {\n\tconst { store, config, projectRoot, getApiKey, model, onAgentEvent, onMessage, feedback } = options;\n\n\t// 1. Load inputs\n\tlet requirements: string | undefined;\n\tif (await store.hasRequirements()) {\n\t\trequirements = await store.readRequirements();\n\t}\n\n\tlet projectContext: string | undefined;\n\tif (await store.hasProjectContext()) {\n\t\tprojectContext = await store.readProjectContext();\n\t}\n\n\tlet existingDesign: string | undefined;\n\tif (await store.hasSystemDesign()) {\n\t\texistingDesign = await store.readSystemDesign();\n\t}\n\n\t// 2. Build feature context (injected into system prompt)\n\tconst featureContext = buildSystemArchitectContext(requirements, existingDesign);\n\n\t// 3. Create agent\n\tconst systemPrompt = getSystemPromptForRole(\"systemArchitect\");\n\tconst agent = await createRoleAgent({\n\t\trole: \"systemArchitect\",\n\t\tsystemPrompt,\n\t\tconfig,\n\t\tprojectRoot,\n\t\tmodel,\n\t\tfeatureContext: featureContext || undefined,\n\t\tgetApiKey,\n\t});\n\n\toptions.onAgentCreated?.(agent);\n\n\t// 4. Build prompt and execute\n\ttry {\n\t\tlet prompt: string;\n\t\tif (feedback) {\n\t\t\tprompt =\n\t\t\t\t`The previous system design was rejected with the following feedback:\\n\\n${feedback}\\n\\n` +\n\t\t\t\t\"Please revise the system design based on this feedback.\\n\\n\" +\n\t\t\t\tbuildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t} else {\n\t\t\tprompt = buildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t}\n\n\t\tconst response = await runAgent(agent, prompt, onAgentEvent ? { onEvent: onAgentEvent } : undefined);\n\t\tconst usage = aggregateUsage(agent.state.messages);\n\t\tonMessage?.(response);\n\n\t\t// 5. Extract system-design.md\n\t\tconst content = extractArtifactContent(response, \"system-design.md\", false);\n\t\tif (!content) {\n\t\t\treturn { completed: false, usage };\n\t\t}\n\n\t\t// 6. Write to store\n\t\tawait store.writeSystemDesign(content);\n\n\t\treturn { completed: true, usage };\n\t} catch (error) {\n\t\tconst msg = error instanceof Error ? error.message : String(error);\n\t\tif (msg.includes(\"aborted\")) {\n\t\t\treturn { completed: false };\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\toptions.onAgentFinished?.();\n\t}\n}\n\n// ─── Context & Prompt Builders ───────────────────────────────────────────────\n\nfunction buildSystemArchitectContext(requirements?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements\\n\");\n\t\tparts.push(requirements);\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design (for refinement)\\n\");\n\t\tparts.push(existingDesign);\n\t}\n\n\treturn parts.join(\"\\n\\n\");\n}\n\nfunction buildSystemArchitectPrompt(requirements?: string, projectContext?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tparts.push(\n\t\t\"Analyze the following inputs and produce a system-design.md document that establishes component boundaries, API contracts, shared data models, and common patterns.\",\n\t);\n\tparts.push(\"\");\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements Document\");\n\t\tparts.push(\"\");\n\t\tparts.push(requirements);\n\t\tparts.push(\"\");\n\t} else {\n\t\tparts.push(\"Note: No requirements.md found. Use the project context to infer system architecture.\");\n\t\tparts.push(\"\");\n\t}\n\n\tif (projectContext) {\n\t\tparts.push(\"## Project Context\");\n\t\tparts.push(\"\");\n\t\tparts.push(projectContext);\n\t\tparts.push(\"\");\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design\");\n\t\tparts.push(\"\");\n\t\tparts.push(\n\t\t\t\"A previous system-design.md exists. Refine and update it based on the current requirements rather than starting from scratch.\",\n\t\t);\n\t\tparts.push(\"\");\n\t\tparts.push(existingDesign);\n\t\tparts.push(\"\");\n\t}\n\n\tparts.push(\"## Instructions\");\n\tparts.push(\"\");\n\tparts.push(\"1. Identify all system components and their boundaries\");\n\tparts.push(\"2. Define API contracts between components\");\n\tparts.push(\"3. Establish shared data models\");\n\tparts.push(\"4. Define common patterns (auth, error handling, logging)\");\n\tparts.push(\"5. Make infrastructure decisions based on the System Scope requirements\");\n\tparts.push(\"6. Note any decisions deferred to feature-level architects\");\n\tparts.push(\"7. Output the result in a ```system-design.md code block\");\n\n\treturn parts.join(\"\\n\");\n}\n"]}
@@ -40,7 +40,6 @@ export async function runSystemArchitect(options) {
40
40
  model,
41
41
  featureContext: featureContext || undefined,
42
42
  getApiKey,
43
- availableSkills: options.availableSkills,
44
43
  });
45
44
  options.onAgentCreated?.(agent);
46
45
  // 4. Build prompt and execute
@@ -55,11 +54,6 @@ export async function runSystemArchitect(options) {
55
54
  else {
56
55
  prompt = buildSystemArchitectPrompt(requirements, projectContext, existingDesign);
57
56
  }
58
- // Add QMD search directive when skills are available
59
- if (options.availableSkills) {
60
- prompt +=
61
- "\n\nBefore designing system architecture, search past feature artifacts for related architectural decisions, component boundaries, and API contracts.";
62
- }
63
57
  const response = await runAgent(agent, prompt, onAgentEvent ? { onEvent: onAgentEvent } : undefined);
64
58
  const usage = aggregateUsage(agent.state.messages);
65
59
  onMessage?.(response);
@@ -1 +1 @@
1
- {"version":3,"file":"system-architect.js","sourceRoot":"","sources":["../src/system-architect.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAoC5E,0NAAgF;AAEhF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA+B,EAAkC;IACzG,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEpG,iBAAiB;IACjB,IAAI,YAAgC,CAAC;IACrC,IAAI,MAAM,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC;QACnC,YAAY,GAAG,MAAM,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC/C,CAAC;IAED,IAAI,cAAkC,CAAC;IACvC,IAAI,MAAM,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;QACrC,cAAc,GAAG,MAAM,KAAK,CAAC,kBAAkB,EAAE,CAAC;IACnD,CAAC;IAED,IAAI,cAAkC,CAAC;IACvC,IAAI,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AwD,CAAC,CAAC;IACrE,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IACzD,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IACxE,KAAK,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;IACtF,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IACzE,KAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAEvE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACxB","sourcesContent":["import type { Agent, AgentEvent } from \"@mariozechner/pi-agent-core\";\nimport type { Model } from \"@mariozechner/pi-ai\";\nimport type { GetApiKeyFn } from \"./agent-factory.js\";\nimport { createRoleAgent, runAgent } from \"./agent-factory.js\";\nimport { getSystemPromptForRole } from \"./roles/index.js\";\nimport { aggregateUsage, extractArtifactContent } from \"./step-executor.js\";\nimport type { VibeStore } from \"./store.js\";\nimport type { VibeConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** System Architect execution options. */\nexport interface SystemArchitectOptions {\n\tstore: VibeStore;\n\tconfig: VibeConfig;\n\tprojectRoot: string;\n\tgetApiKey?: GetApiKeyFn;\n\t/** Model to use. Uses the Agent's default model if not specified. */\n\tmodel?: Model<any>;\n\t/** Agent event callback for progress display. */\n\tonAgentEvent?: (event: AgentEvent) => void;\n\t/** Callback to relay agent messages externally. */\n\tonMessage?: (message: string) => void;\n\t/** User feedback on rejection. Re-generates with feedback applied. */\n\tfeedback?: string;\n\t/** Lightweight skill index. Included in the agent system prompt. */\n\tavailableSkills?: string;\n\t/** Callback invoked when the agent is created (for abort wiring). */\n\tonAgentCreated?: (agent: Agent) => void;\n\t/** Callback invoked when the agent finishes execution. */\n\tonAgentFinished?: () => void;\n}\n\n/** System Architect execution result. */\nexport interface SystemArchitectResult {\n\t/** Whether system-design.md was generated. */\n\tcompleted: boolean;\n\t/** Aggregated token usage. */\n\tusage?: { input: number; output: number; cacheRead: number; cacheWrite: number; totalTokens: number; cost: number };\n}\n\n// ─── Runner ──────────────────────────────────────────────────────────────────\n\n/**\n * Runs the System Architect agent to generate system-design.md\n * based on requirements.md and project-context.md.\n *\n * 1. Load requirements.md and project-context.md from the store\n * 2. Optionally load existing system-design.md for iterative refinement\n * 3. Create systemArchitect agent\n * 4. Run the agent with a prompt (includes feedback if re-running)\n * 5. Extract system-design.md from the response\n * 6. Write to store\n */\nexport async function runSystemArchitect(options: SystemArchitectOptions): Promise<SystemArchitectResult> {\n\tconst { store, config, projectRoot, getApiKey, model, onAgentEvent, onMessage, feedback } = options;\n\n\t// 1. Load inputs\n\tlet requirements: string | undefined;\n\tif (await store.hasRequirements()) {\n\t\trequirements = await store.readRequirements();\n\t}\n\n\tlet projectContext: string | undefined;\n\tif (await store.hasProjectContext()) {\n\t\tprojectContext = await store.readProjectContext();\n\t}\n\n\tlet existingDesign: string | undefined;\n\tif (await store.hasSystemDesign()) {\n\t\texistingDesign = await store.readSystemDesign();\n\t}\n\n\t// 2. Build feature context (injected into system prompt)\n\tconst featureContext = buildSystemArchitectContext(requirements, existingDesign);\n\n\t// 3. Create agent\n\tconst systemPrompt = getSystemPromptForRole(\"systemArchitect\");\n\tconst agent = await createRoleAgent({\n\t\trole: \"systemArchitect\",\n\t\tsystemPrompt,\n\t\tconfig,\n\t\tprojectRoot,\n\t\tmodel,\n\t\tfeatureContext: featureContext || undefined,\n\t\tgetApiKey,\n\t\tavailableSkills: options.availableSkills,\n\t});\n\n\toptions.onAgentCreated?.(agent);\n\n\t// 4. Build prompt and execute\n\ttry {\n\t\tlet prompt: string;\n\t\tif (feedback) {\n\t\t\tprompt =\n\t\t\t\t`The previous system design was rejected with the following feedback:\\n\\n${feedback}\\n\\n` +\n\t\t\t\t\"Please revise the system design based on this feedback.\\n\\n\" +\n\t\t\t\tbuildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t} else {\n\t\t\tprompt = buildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t}\n\n\t\t// Add QMD search directive when skills are available\n\t\tif (options.availableSkills) {\n\t\t\tprompt +=\n\t\t\t\t\"\\n\\nBefore designing system architecture, search past feature artifacts for related architectural decisions, component boundaries, and API contracts.\";\n\t\t}\n\n\t\tconst response = await runAgent(agent, prompt, onAgentEvent ? { onEvent: onAgentEvent } : undefined);\n\t\tconst usage = aggregateUsage(agent.state.messages);\n\t\tonMessage?.(response);\n\n\t\t// 5. Extract system-design.md\n\t\tconst content = extractArtifactContent(response, \"system-design.md\", false);\n\t\tif (!content) {\n\t\t\treturn { completed: false, usage };\n\t\t}\n\n\t\t// 6. Write to store\n\t\tawait store.writeSystemDesign(content);\n\n\t\treturn { completed: true, usage };\n\t} catch (error) {\n\t\tconst msg = error instanceof Error ? error.message : String(error);\n\t\tif (msg.includes(\"aborted\")) {\n\t\t\treturn { completed: false };\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\toptions.onAgentFinished?.();\n\t}\n}\n\n// ─── Context & Prompt Builders ───────────────────────────────────────────────\n\nfunction buildSystemArchitectContext(requirements?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements\\n\");\n\t\tparts.push(requirements);\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design (for refinement)\\n\");\n\t\tparts.push(existingDesign);\n\t}\n\n\treturn parts.join(\"\\n\\n\");\n}\n\nfunction buildSystemArchitectPrompt(requirements?: string, projectContext?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tparts.push(\n\t\t\"Analyze the following inputs and produce a system-design.md document that establishes component boundaries, API contracts, shared data models, and common patterns.\",\n\t);\n\tparts.push(\"\");\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements Document\");\n\t\tparts.push(\"\");\n\t\tparts.push(requirements);\n\t\tparts.push(\"\");\n\t} else {\n\t\tparts.push(\"Note: No requirements.md found. Use the project context to infer system architecture.\");\n\t\tparts.push(\"\");\n\t}\n\n\tif (projectContext) {\n\t\tparts.push(\"## Project Context\");\n\t\tparts.push(\"\");\n\t\tparts.push(projectContext);\n\t\tparts.push(\"\");\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design\");\n\t\tparts.push(\"\");\n\t\tparts.push(\n\t\t\t\"A previous system-design.md exists. Refine and update it based on the current requirements rather than starting from scratch.\",\n\t\t);\n\t\tparts.push(\"\");\n\t\tparts.push(existingDesign);\n\t\tparts.push(\"\");\n\t}\n\n\tparts.push(\"## Instructions\");\n\tparts.push(\"\");\n\tparts.push(\"1. Identify all system components and their boundaries\");\n\tparts.push(\"2. Define API contracts between components\");\n\tparts.push(\"3. Establish shared data models\");\n\tparts.push(\"4. Define common patterns (auth, error handling, logging)\");\n\tparts.push(\"5. Make infrastructure decisions based on the System Scope requirements\");\n\tparts.push(\"6. Note any decisions deferred to feature-level architects\");\n\tparts.push(\"7. Output the result in a ```system-design.md code block\");\n\n\treturn parts.join(\"\\n\");\n}\n"]}
1
+ {"version":3,"file":"system-architect.js","sourceRoot":"","sources":["../src/system-architect.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAkC5E,0NAAgF;AAEhF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA+B,EAAkC;IACzG,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEpG,iBAAiB;IACjB,IAAI,YAAgC,CAAC;IACrC,IAAI,MAAM,KAAK,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C;IAChB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;IACrE,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IACzD,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IACxE,KAAK,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;IACtF,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IACzE,KAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAEvE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACxB","sourcesContent":["import type { Agent, AgentEvent } from \"@mariozechner/pi-agent-core\";\nimport type { Model } from \"@mariozechner/pi-ai\";\nimport type { GetApiKeyFn } from \"./agent-factory.js\";\nimport { createRoleAgent, runAgent } from \"./agent-factory.js\";\nimport { getSystemPromptForRole } from \"./roles/index.js\";\nimport { aggregateUsage, extractArtifactContent } from \"./step-executor.js\";\nimport type { VibeStore } from \"./store.js\";\nimport type { VibeConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\n/** System Architect execution options. */\nexport interface SystemArchitectOptions {\n\tstore: VibeStore;\n\tconfig: VibeConfig;\n\tprojectRoot: string;\n\tgetApiKey?: GetApiKeyFn;\n\t/** Model to use. Uses the Agent's default model if not specified. */\n\tmodel?: Model<any>;\n\t/** Agent event callback for progress display. */\n\tonAgentEvent?: (event: AgentEvent) => void;\n\t/** Callback to relay agent messages externally. */\n\tonMessage?: (message: string) => void;\n\t/** User feedback on rejection. Re-generates with feedback applied. */\n\tfeedback?: string;\n\t/** Callback invoked when the agent is created (for abort wiring). */\n\tonAgentCreated?: (agent: Agent) => void;\n\t/** Callback invoked when the agent finishes execution. */\n\tonAgentFinished?: () => void;\n}\n\n/** System Architect execution result. */\nexport interface SystemArchitectResult {\n\t/** Whether system-design.md was generated. */\n\tcompleted: boolean;\n\t/** Aggregated token usage. */\n\tusage?: { input: number; output: number; cacheRead: number; cacheWrite: number; totalTokens: number; cost: number };\n}\n\n// ─── Runner ──────────────────────────────────────────────────────────────────\n\n/**\n * Runs the System Architect agent to generate system-design.md\n * based on requirements.md and project-context.md.\n *\n * 1. Load requirements.md and project-context.md from the store\n * 2. Optionally load existing system-design.md for iterative refinement\n * 3. Create systemArchitect agent\n * 4. Run the agent with a prompt (includes feedback if re-running)\n * 5. Extract system-design.md from the response\n * 6. Write to store\n */\nexport async function runSystemArchitect(options: SystemArchitectOptions): Promise<SystemArchitectResult> {\n\tconst { store, config, projectRoot, getApiKey, model, onAgentEvent, onMessage, feedback } = options;\n\n\t// 1. Load inputs\n\tlet requirements: string | undefined;\n\tif (await store.hasRequirements()) {\n\t\trequirements = await store.readRequirements();\n\t}\n\n\tlet projectContext: string | undefined;\n\tif (await store.hasProjectContext()) {\n\t\tprojectContext = await store.readProjectContext();\n\t}\n\n\tlet existingDesign: string | undefined;\n\tif (await store.hasSystemDesign()) {\n\t\texistingDesign = await store.readSystemDesign();\n\t}\n\n\t// 2. Build feature context (injected into system prompt)\n\tconst featureContext = buildSystemArchitectContext(requirements, existingDesign);\n\n\t// 3. Create agent\n\tconst systemPrompt = getSystemPromptForRole(\"systemArchitect\");\n\tconst agent = await createRoleAgent({\n\t\trole: \"systemArchitect\",\n\t\tsystemPrompt,\n\t\tconfig,\n\t\tprojectRoot,\n\t\tmodel,\n\t\tfeatureContext: featureContext || undefined,\n\t\tgetApiKey,\n\t});\n\n\toptions.onAgentCreated?.(agent);\n\n\t// 4. Build prompt and execute\n\ttry {\n\t\tlet prompt: string;\n\t\tif (feedback) {\n\t\t\tprompt =\n\t\t\t\t`The previous system design was rejected with the following feedback:\\n\\n${feedback}\\n\\n` +\n\t\t\t\t\"Please revise the system design based on this feedback.\\n\\n\" +\n\t\t\t\tbuildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t} else {\n\t\t\tprompt = buildSystemArchitectPrompt(requirements, projectContext, existingDesign);\n\t\t}\n\n\t\tconst response = await runAgent(agent, prompt, onAgentEvent ? { onEvent: onAgentEvent } : undefined);\n\t\tconst usage = aggregateUsage(agent.state.messages);\n\t\tonMessage?.(response);\n\n\t\t// 5. Extract system-design.md\n\t\tconst content = extractArtifactContent(response, \"system-design.md\", false);\n\t\tif (!content) {\n\t\t\treturn { completed: false, usage };\n\t\t}\n\n\t\t// 6. Write to store\n\t\tawait store.writeSystemDesign(content);\n\n\t\treturn { completed: true, usage };\n\t} catch (error) {\n\t\tconst msg = error instanceof Error ? error.message : String(error);\n\t\tif (msg.includes(\"aborted\")) {\n\t\t\treturn { completed: false };\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\toptions.onAgentFinished?.();\n\t}\n}\n\n// ─── Context & Prompt Builders ───────────────────────────────────────────────\n\nfunction buildSystemArchitectContext(requirements?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements\\n\");\n\t\tparts.push(requirements);\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design (for refinement)\\n\");\n\t\tparts.push(existingDesign);\n\t}\n\n\treturn parts.join(\"\\n\\n\");\n}\n\nfunction buildSystemArchitectPrompt(requirements?: string, projectContext?: string, existingDesign?: string): string {\n\tconst parts: string[] = [];\n\n\tparts.push(\n\t\t\"Analyze the following inputs and produce a system-design.md document that establishes component boundaries, API contracts, shared data models, and common patterns.\",\n\t);\n\tparts.push(\"\");\n\n\tif (requirements) {\n\t\tparts.push(\"## Requirements Document\");\n\t\tparts.push(\"\");\n\t\tparts.push(requirements);\n\t\tparts.push(\"\");\n\t} else {\n\t\tparts.push(\"Note: No requirements.md found. Use the project context to infer system architecture.\");\n\t\tparts.push(\"\");\n\t}\n\n\tif (projectContext) {\n\t\tparts.push(\"## Project Context\");\n\t\tparts.push(\"\");\n\t\tparts.push(projectContext);\n\t\tparts.push(\"\");\n\t}\n\n\tif (existingDesign) {\n\t\tparts.push(\"## Existing System Design\");\n\t\tparts.push(\"\");\n\t\tparts.push(\n\t\t\t\"A previous system-design.md exists. Refine and update it based on the current requirements rather than starting from scratch.\",\n\t\t);\n\t\tparts.push(\"\");\n\t\tparts.push(existingDesign);\n\t\tparts.push(\"\");\n\t}\n\n\tparts.push(\"## Instructions\");\n\tparts.push(\"\");\n\tparts.push(\"1. Identify all system components and their boundaries\");\n\tparts.push(\"2. Define API contracts between components\");\n\tparts.push(\"3. Establish shared data models\");\n\tparts.push(\"4. Define common patterns (auth, error handling, logging)\");\n\tparts.push(\"5. Make infrastructure decisions based on the System Scope requirements\");\n\tparts.push(\"6. Note any decisions deferred to feature-level architects\");\n\tparts.push(\"7. Output the result in a ```system-design.md code block\");\n\n\treturn parts.join(\"\\n\");\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wizdear/atlas-code",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "AI Atlas Code Engineering System - Multi-agent orchestration for pi-coding-agent",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",