olympus-ai 4.0.3 → 4.0.4

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 (40) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/features/workflow-engine/artifacts.d.ts.map +1 -1
  3. package/dist/features/workflow-engine/artifacts.js +13 -9
  4. package/dist/features/workflow-engine/artifacts.js.map +1 -1
  5. package/dist/features/workflow-engine/construction/nfr-requirements.js +1 -1
  6. package/dist/features/workflow-engine/construction/nfr-requirements.js.map +1 -1
  7. package/dist/features/workflow-engine/engine.d.ts +1 -1
  8. package/dist/features/workflow-engine/engine.js +2 -2
  9. package/dist/features/workflow-engine/engine.js.map +1 -1
  10. package/dist/features/workflow-engine/inception/stages/units-generation.d.ts.map +1 -1
  11. package/dist/features/workflow-engine/inception/stages/units-generation.js +7 -6
  12. package/dist/features/workflow-engine/inception/stages/units-generation.js.map +1 -1
  13. package/dist/features/workflow-engine/inception/stages/user-stories.d.ts.map +1 -1
  14. package/dist/features/workflow-engine/inception/stages/user-stories.js +5 -3
  15. package/dist/features/workflow-engine/inception/stages/user-stories.js.map +1 -1
  16. package/dist/features/workflow-engine/question-manager.d.ts.map +1 -1
  17. package/dist/features/workflow-engine/question-manager.js +5 -1
  18. package/dist/features/workflow-engine/question-manager.js.map +1 -1
  19. package/dist/features/workflow-engine/state-file.d.ts.map +1 -1
  20. package/dist/features/workflow-engine/state-file.js +4 -2
  21. package/dist/features/workflow-engine/state-file.js.map +1 -1
  22. package/dist/hooks/olympus-hooks.cjs +4 -4
  23. package/dist/installer/index.d.ts +1 -1
  24. package/dist/installer/index.js +1 -1
  25. package/dist/learning/__tests__/project-resolver.test.d.ts +2 -0
  26. package/dist/learning/__tests__/project-resolver.test.d.ts.map +1 -0
  27. package/dist/learning/__tests__/project-resolver.test.js +216 -0
  28. package/dist/learning/__tests__/project-resolver.test.js.map +1 -0
  29. package/dist/learning/project-resolver.d.ts +6 -0
  30. package/dist/learning/project-resolver.d.ts.map +1 -0
  31. package/dist/learning/project-resolver.js +65 -0
  32. package/dist/learning/project-resolver.js.map +1 -0
  33. package/package.json +1 -1
  34. package/resources/rules/common/depth-levels.md +73 -73
  35. package/resources/rules/common/question-format-guide.md +375 -375
  36. package/resources/rules/common/session-continuity.md +47 -47
  37. package/resources/rules/inception/requirements-analysis.md +247 -215
  38. package/resources/rules/inception/workflow-planning.md +487 -487
  39. package/resources/skills/continue/SKILL.md +3 -3
  40. package/resources/skills/plan/SKILL.md +35 -25
@@ -1 +1 @@
1
- {"version":3,"file":"state-file.js","sourceRoot":"","sources":["../../../src/features/workflow-engine/state-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAG/B,MAAM,YAAY,GAAG,YAAY,CAAC;AAClC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAExC,MAAM,MAAM,GAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAEzF,MAAM,qBAAqB,GAAqB;IAC9C,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;IACvB,cAAc;IACd,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;CACnB,CAAC;AAEF,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACzD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,WAAmB;IACtC,MAAM,KAAK,GAAG,WAAW;SACtB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC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let s=i.match(/^##\s+(.+)$/);s?(o&&t.set(o,r.join(`
15
15
  `)),o=s[1].trim(),r=[]):o&&r.push(i)}return o&&t.set(o,r.join(`
16
16
  `)),t}function Qn(e){let t=[],n=e.split(`
17
- `);for(let o of n){let r=o.match(/^\s*[-*+]\s+(?:\[[ x]\]\s+)?(.+)$/);r&&t.push(r[1].trim())}return t}function Uk(e,t){let n=Fk(e);if(t==="intent-to-unit"){let s=Oi(n),a=[],c=s.get("Business Requirements");c&&a.push(...Qn(c));let l=s.get("Implementation Plan");return l&&a.push(...Qn(l)),a}if(t==="unit-to-bolt"){let s=Oi(n),a=[],c=s.get("Acceptance Criteria");c&&a.push(...Qn(c));let l=s.get("Target Files");return l&&a.push(...Qn(l)),a}let o=Oi(n),r=Lk[t],i=[];for(let s of r){let a=o.get(s);if(a){let c=Qn(a);i.push(...c)}}return i}function Wo(e,t,n){try{let o=Uk(e,n);if(o.length===0)return{conformance_score:100,coverage_percentage:100,missing_items:[],passed:!0};let r=t.toLowerCase(),i=[],s=0;for(let d of o){let p=d.toLowerCase();r.includes(p)?s++:i.push(d)}let a=Math.round(s/o.length*100),c=a,l=Iu[n],u=a>=l;return{conformance_score:a,coverage_percentage:c,missing_items:i,passed:u}}catch(o){return console.error("[Alignment] Verification computation failed:",o),{conformance_score:0,coverage_percentage:0,missing_items:["Verification computation error"],passed:!1}}}function Ru(e){let t=jk[e];return[{question:t.verification,answer:null,answered_by:null,passed:null},{question:t.validation,answer:null,answered_by:null,passed:null}]}function Ai(e,t,n,o,r){try{let i=Wo(e,t,r),s=Ru(r),a=s.every(m=>m.answer!==null),c=s.every(m=>m.passed===!0),u={alignment_score:a&&c?100:0,alignment_questions:s,passed:c},d=i.passed&&u.passed;return{source_artifact_id:n,target_artifact_id:o,verification:i,validation:u,alignment_passed:d,checked_at:new Date().toISOString()}}catch(i){return console.error("[Alignment] Alignment check failed:",i),{source_artifact_id:n,target_artifact_id:o,verification:{conformance_score:0,coverage_percentage:0,missing_items:["Alignment check error"],passed:!1},validation:{alignment_score:0,alignment_questions:[],passed:!1},alignment_passed:!1,checked_at:new Date().toISOString()}}}function ln(e,t,n,o,r,i,s,a){let c=Ai(t,e,i,s,o),l=Ai(n,e,a,s,r),u=c.alignment_passed&&l.alignment_passed;return{parentCheck:c,rootCheck:l,passed:u}}function Wk(e,t){let n=0;t>=2&&(n+=10),t>=3&&(n+=10);let o=e-n;return Math.max(0,o)}function Hk(e,t){try{let n=$(e);if(!n){console.error(`[Alignment] Manifest not found at ${e}`);return}n.alignment_checks.push(t),L(e,n)}catch(n){console.error("[Alignment] Failed to record alignment result:",n)}}function Gk(e){return Iu[e]}var Iu,jk,Lk,Ho=B(()=>{"use strict";K();Iu={"intent-to-unit":95,"unit-to-bolt":100,"unit-to-intent":80,"bolt-to-intent":70},jk={"intent-to-unit":{verification:"Does the UNIT cover its assigned scope from the INTENT?",validation:"Will this UNIT produce a working module that contributes to the feature?"},"unit-to-bolt":{verification:"Does the BOLT cover all acceptance criteria from the UNIT?",validation:"Does this BOLT deliver meaningful, testable progress?"},"unit-to-intent":{verification:"Does this UNIT contribute to the INTENT's problem statement?",validation:"Does this UNIT help achieve the INTENT's success metrics?"},"bolt-to-intent":{verification:"Does this BOLT contribute to solving the INTENT's stated problem?",validation:"Is this BOLT still aligned with the original INTENT's goals?"}},Lk={"intent-to-unit":["Business Requirements","Implementation Plan"],"unit-to-bolt":["Acceptance Criteria","Target Files"],"unit-to-intent":["Problem Statement","Success Metrics"],"bolt-to-intent":["Problem Statement","Success Metrics"]}});var Ht={};ot(Ht,{addGateAuditEntry:()=>Ce,cascadeInvalidation:()=>Vk,computeChecksum:()=>Go,createManifest:()=>Bk,detectStaleArtifacts:()=>qk,getArtifactById:()=>Jk,getArtifactsByPhase:()=>zk,getBoltArtifacts:()=>Ze,getBoltsByStatus:()=>$i,getUnitArtifacts:()=>Wt,isWorkflowComplete:()=>xu,linkArtifacts:()=>Pi,loadManifest:()=>$,normalizePath:()=>xi,recoverManifest:()=>Kk,registerArtifact:()=>Ae,revalidateStaleArtifacts:()=>Xk,runAlignmentCheck:()=>Yk,saveManifest:()=>L,transitionToActive:()=>Ni,transitionToDraft:()=>Pu,transitionToFulfilled:()=>Di,transitionToStale:()=>Nu,transitionToViolated:()=>$u,updateContractStatus:()=>Xe,updatePhaseStatus:()=>ct});function xi(e){return e.replace(/\\/g,"/")}function Et(){return{status:"not_started",started_at:null,completed_at:null,gate_result:null,gate_bypassed:!1,bypass_reason:null}}function Bk(e,t,n){let o=Qe.join(n,"aidlc-docs",e),r=Qe.join(o,"manifest.json");try{te.ensureDirSync(o);let i=new Date().toISOString(),s={schema_version:"2.0.0",workflow_id:e,feature_name:t,created_at:i,updated_at:i,phases:{discovery:Et(),inception:Et(),construction:Et(),operations:Et()},depth_assessment:null,artifacts:[],links:[],risks:[],gate_audit:[],metrics:null,alignment_checks:[],risk_tier:null};return te.writeFileSync(r,JSON.stringify(s,null,2),"utf-8"),r}catch(i){throw console.error(`Failed to create manifest at ${r}:`,i),i}}function $(e){try{if(!te.existsSync(e))return null;let t=te.readFileSync(e,"utf-8");return JSON.parse(t)}catch(t){return console.error(`Failed to load manifest at ${e}:`,t),null}}function L(e,t){try{t.updated_at=new Date().toISOString(),te.writeFileSync(e,JSON.stringify(t,null,2),"utf-8")}catch(n){throw console.error(`Failed to save manifest at ${e}:`,n),n}}function Go(e){try{if(!te.existsSync(e))return null;let t=te.readFileSync(e),n=(0,Au.createHash)("sha256");return n.update(t),n.digest("hex")}catch(t){return console.error(`Failed to compute checksum for ${e}:`,t),null}}function Ae(e,t){try{let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=new Date().toISOString(),r=xi(t.path),i=n.artifacts.findIndex(a=>a.id===t.id),s=Go(t.path);if(i>=0){let a=n.artifacts[i];n.artifacts[i]={...a,...t,path:r,updated_at:o,contract_version:a.contract_version+1,checksum:s}}else{let a={...t,path:r,created_at:o,updated_at:o,contract_version:1,contract_status:"draft",stale_reason:null,checksum:s};n.artifacts.push(a)}L(e,n)}catch(n){throw console.error(`Failed to register artifact in ${e}:`,n),n}}function Pi(e,t){try{let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.some(s=>s.id===t.source_id),r=n.artifacts.some(s=>s.id===t.target_id);if(!o)throw new Error(`Source artifact not found: ${t.source_id}`);if(!r)throw new Error(`Target artifact not found: ${t.target_id}`);n.links.some(s=>s.source_id===t.source_id&&s.target_id===t.target_id&&s.link_type===t.link_type)||(n.links.push(t),L(e,n))}catch(n){throw console.error(`Failed to link artifacts in ${e}:`,n),n}}function qk(e){try{let t=$(e);if(!t)return[];let n=[];for(let o of t.artifacts)if(o.checksum&&o.write_complete){let r=Go(o.path);r&&r!==o.checksum&&n.push(o.id)}return n}catch(t){return console.error(`Failed to detect stale artifacts in ${e}:`,t),[]}}function Vk(e,t){try{let n=$(e);if(!n)return;let o=new Set,r=[t];for(;r.length>0;){let i=r.shift();if(o.has(i))continue;o.add(i);let s=n.artifacts.find(c=>c.id===i);if(s){let c=i===t?"Artifact content was modified":`Parent artifact ${i} was modified`;Qk(s,c)}let a=n.links.filter(c=>c.source_id===i);for(let c of a)o.has(c.target_id)||r.push(c.target_id)}L(e,n)}catch(n){console.error(`Failed to cascade invalidation in ${e}:`,n)}}function Yk(e,t,n){try{let o=$(e);if(!o)return;let r=new Date().toISOString(),a={source_artifact_id:t,target_artifact_id:n,verification:{conformance_score:0,coverage_percentage:0,missing_items:[],passed:!1},validation:{alignment_score:0,alignment_questions:[],passed:!1},alignment_passed:!1,checked_at:r};o.alignment_checks.push(a),L(e,o)}catch(o){console.error(`Failed to run alignment check in ${e}:`,o)}}function Kk(e,t){try{let n=Qe.join(e,"aidlc-docs",t);if(!te.existsSync(n))return null;let o=new Date().toISOString(),r={schema_version:"2.0.0",workflow_id:t,feature_name:"Recovered Workflow",created_at:o,updated_at:o,phases:{discovery:Et(),inception:Et(),construction:Et(),operations:Et()},depth_assessment:null,artifacts:[],links:[],risks:[],gate_audit:[],metrics:null,alignment_checks:[],risk_tier:null},i=te.readdirSync(n,{recursive:!0,withFileTypes:!0});for(let s of i)if(s.isFile()&&s.name!=="manifest.json"){let a=Qe.join(s.path,s.name),c=Qe.relative(n,a),l=xi(a),u={id:`recovered-${Date.now()}-${r.artifacts.length}`,type:Qe.extname(s.name)||"unknown",phase:"inception",stage:"intent",path:l,created_at:o,updated_at:o,validation_passed:null,write_complete:!0,checksum:Go(a),contract_status:"draft",contract_version:1,stale_reason:null};r.artifacts.push(u)}return r}catch(n){return console.error(`Failed to recover manifest for workflow ${t}:`,n),null}}function ct(e,t,n,o,r){try{let i=$(e);if(!i)return;i.phases[t].status=n,o!==void 0&&(i.phases[t].started_at=o),r!==void 0&&(i.phases[t].completed_at=r),L(e,i)}catch(i){console.error(`Failed to update phase status in ${e}:`,i)}}function Ce(e,t){try{let n=$(e);if(!n)return;let o={...t,timestamp:new Date().toISOString()};n.gate_audit.push(o),L(e,n)}catch(n){console.error(`Failed to add gate audit entry in ${e}:`,n)}}function Jk(e,t){return e.artifacts.find(n=>n.id===t)}function zk(e,t){return e.artifacts.filter(n=>n.phase===t)}function Xe(e,t,n,o){try{switch(n){case"draft":Pu(e,t);break;case"active":Ni(e,t);break;case"fulfilled":Di(e,t);break;case"violated":$u(e,t);break;case"stale":if(!o)throw new Error('staleReason is required when setting status to "stale"');Nu(e,t,o);break}}catch(r){console.error(`Failed to update contract status in ${e}:`,r)}}function Wt(e){return e.artifacts.filter(t=>t.stage==="unit")}function Ze(e,t){let n=e.artifacts.filter(o=>o.stage==="code-generation");if(t){let o=new Set(e.links.filter(r=>r.source_id===t&&(r.link_type==="derives"||r.link_type==="implements")).map(r=>r.target_id));return n.filter(r=>o.has(r.id))}return n}function $i(e,t){return e.artifacts.filter(n=>n.stage==="code-generation"&&n.contract_status===t)}function xu(e){let t=e.artifacts.filter(n=>n.stage==="code-generation");return t.length===0?!1:t.every(n=>n.contract_status==="fulfilled")}function Qk(e,t){return e.contract_status==="stale"||e.contract_status==="violated"?!1:(e.contract_status="stale",e.stale_reason=t,e.statusHistory||(e.statusHistory=[]),e.statusHistory.push({status:"stale",timestamp:new Date().toISOString()}),!0)}function Pu(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="violated"&&o.contract_status!=="stale")throw new Error(`Cannot transition from '${o.contract_status}' to 'draft'`);o.contract_status="draft",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"draft",timestamp:new Date().toISOString()}),L(e,n)}function Ni(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="draft"&&o.contract_status!=="stale")throw new Error(`Cannot transition from '${o.contract_status}' to 'active'`);o.contract_status="active",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"active",timestamp:new Date().toISOString()}),L(e,n)}function Di(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="active")throw new Error(`Cannot transition from '${o.contract_status}' to 'fulfilled'`);o.contract_status="fulfilled",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"fulfilled",timestamp:new Date().toISOString()}),L(e,n)}function $u(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="active")throw new Error(`Cannot transition from '${o.contract_status}' to 'violated'`);o.contract_status="violated",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"violated",timestamp:new Date().toISOString()}),L(e,n)}function Nu(e,t,n){let o=$(e);if(!o)throw new Error(`Manifest not found at ${e}`);let r=o.artifacts.find(i=>i.id===t);if(!r)throw new Error(`Artifact ${t} not found in manifest`);if(r.contract_status!=="active"&&r.contract_status!=="fulfilled")throw new Error(`Cannot transition from '${r.contract_status}' to 'stale'`);r.contract_status="stale",r.stale_reason=n,r.statusHistory||(r.statusHistory=[]),r.statusHistory.push({status:"stale",timestamp:new Date().toISOString()}),L(e,o)}async function Xk(e,t){let n={restored:[],stillStale:[],errors:[]},o=Qe.join(e,"aidlc-docs",t,"manifest.json"),r=$(o);if(!r)return n.errors.push("Manifest not found"),n;let i=r.artifacts.filter(s=>s.contract_status==="stale");for(let s of i)try{let a=r.links.find(y=>y.target_id===s.id);if(!a){n.stillStale.push(s.id);continue}let c=r.artifacts.find(y=>y.id===a.source_id);if(!c){n.stillStale.push(s.id);continue}let l=r.artifacts.find(y=>y.stage==="intent");if(!l){n.stillStale.push(s.id);continue}let u=te.existsSync(s.path)?te.readFileSync(s.path,"utf-8"):null,d=te.existsSync(c.path)?te.readFileSync(c.path,"utf-8"):null,p=te.existsSync(l.path)?te.readFileSync(l.path,"utf-8"):null;if(!u||!d||!p){n.stillStale.push(s.id);continue}let{runDualValidation:m}=await Promise.resolve().then(()=>(Ho(),Ou)),f,g;if(s.stage==="unit")f="intent-to-unit",g="unit-to-intent";else if(s.stage==="code-generation")f="unit-to-bolt",g="bolt-to-intent";else{n.stillStale.push(s.id);continue}m(u,d,p,f,g,c.id,s.id,l.id).passed?(s.contract_status="active",s.stale_reason=null,s.statusHistory||(s.statusHistory=[]),s.statusHistory.push({status:"active",timestamp:new Date().toISOString()}),n.restored.push(s.id)):n.stillStale.push(s.id)}catch(a){n.errors.push(`Error revalidating ${s.id}: ${a}`),n.stillStale.push(s.id)}return L(o,r),n}var te,Qe,Au,K=B(()=>{"use strict";te=E(ae(),1),Qe=E(require("path"),1),Au=require("crypto")});async function Du(e,t){let n=N.join(e,"aidlc-docs",t),o=N.join(n,"checkpoint.json");try{await de.ensureDir(n),await de.ensureDir(N.join(n,"inception")),await de.ensureDir(N.join(n,"construction")),await de.ensureDir(N.join(n,"construction","design")),await de.ensureDir(N.join(n,"operations")),await de.pathExists(o)||await de.writeJson(o,{workflow_id:t,current_stage:"intent",created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{spaces:2})}catch(r){let i=r;throw i.code==="ENOSPC"?(console.error("[Artifacts] Failed to create workflow directory: Disk full"),console.error("[Artifacts] Please free up disk space and try again."),console.error(`[Artifacts] Attempted path: ${n}`),new Error("Failed to create workflow directory: Disk is full. Please free up space and retry.")):i.code==="EACCES"||i.code==="EPERM"?(console.error("[Artifacts] Failed to create workflow directory: Permission denied"),console.error(`[Artifacts] Path: ${n}`),new Error(`Failed to create workflow directory: Permission denied for ${n}`)):i.code==="EROFS"?(console.error("[Artifacts] Failed to create workflow directory: Read-only filesystem"),console.error(`[Artifacts] Path: ${n}`),new Error("Failed to create workflow directory: Filesystem is read-only")):(console.error(`[Artifacts] Failed to create workflow directory: ${i.message}`),console.error(`[Artifacts] Workflow ID: ${t}`),console.error(`[Artifacts] Path: ${n}`),new Error(`Failed to create workflow directory for ${t}: ${i.message}`))}}function bt(e,t,n,o,r){let i=N.join(e,"aidlc-docs",t);switch(n){case"intent":return N.join(i,"inception","intent.md");case"nfr":return N.join(i,"inception","nfr.md");case"unit":if(!o)throw new Error("artifactId is required for unit artifacts");return N.join(i,"construction",o,"spec.md");case"code-generation":if(!o)throw new Error("artifactId is required for code-generation artifacts");if(!r)throw new Error("unitId is required for code-generation artifacts");return N.join(i,"construction",r,`${o}.md`);case"validation-report":if(!o)throw new Error("artifactId is required for validation-report artifacts");return N.join(i,"construction",o,"validation-report.md");case"interfaces":return N.join(i,"construction","design","interfaces.json");case"data-flow":return N.join(i,"construction","design","data-flow.json");case"components":return N.join(i,"construction","design","components.json");case"deploy-guide":return N.join(i,"operations","deploy-guide.md");case"runbook":return N.join(i,"operations","runbook.md");case"monitoring":return N.join(i,"operations","monitoring.json");case"release-notes":return N.join(i,"operations","release-notes.md");case"state":return N.join(i,"state.md");case"audit":return N.join(i,"audit.md");case"analysis-plan":return N.join(i,"discovery","analysis-plan.md");case"current-state-analysis":return N.join(i,"discovery","current-state-analysis.md");case"regression-baseline":return N.join(i,"discovery","regression-baseline.md");case"change-impact":return N.join(i,"discovery","change-impact.md");case"static-model":return N.join(i,"discovery","static-model.md");case"dynamic-model":return N.join(i,"discovery","dynamic-model.md");case"WORKFLOW_ROUTING":return N.join(i,"inception","plans","workflow-routing.md");case"requirements-qa":return N.join(i,"inception","requirements-questions.md");case"requirements":return N.join(i,"inception","requirements.md");case"personas":return N.join(i,"inception","personas.md");case"user-stories":return N.join(i,"inception","stories.md");case"execution-plan":return N.join(i,"inception","plans","execution-plan.md");case"units-generation":return N.join(i,"inception","unit-of-work.md");case"unit-dependency":return N.join(i,"inception","unit-of-work-dependency.md");case"unit-story-map":return N.join(i,"inception","unit-of-work-story-map.md");default:throw new Error(`Unknown artifact type: ${n}`)}}async function un(e,t,n,o,r,i){let s=bt(e,t,n,r,i),a=await de.pathExists(s);try{await de.ensureDir(N.dirname(s)),await de.writeFile(s,o,"utf-8")}catch(c){let l=c;throw l.code==="ENOSPC"?(console.error(`[Artifacts] Failed to write ${n} artifact: Disk full`),console.error("[Artifacts] Please free up disk space and try again."),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: Disk is full. Please free up space and retry.`)):l.code==="EACCES"||l.code==="EPERM"?(console.error(`[Artifacts] Failed to write ${n} artifact: Permission denied`),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: Permission denied for ${s}`)):l.code==="EROFS"?(console.error(`[Artifacts] Failed to write ${n} artifact: Read-only filesystem`),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: Filesystem is read-only`)):(console.error(`[Artifacts] Failed to write ${n} artifact: ${l.message}`),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: ${l.message}`))}if(a)try{let c=N.join(e,"aidlc-docs",t,"manifest.json"),{cascadeInvalidation:l,loadManifest:u,saveManifest:d,computeChecksum:p}=await Promise.resolve().then(()=>(K(),Ht)),m=u(c);if(m){let f=s.replace(/\\/g,"/"),g=m.artifacts.find(h=>h.path===f||h.path.endsWith(N.basename(s)));if(g){let h=p(s);h&&(g.checksum=h,g.updated_at=new Date().toISOString(),d(c,m)),l(c,g.id)}}}catch(c){console.error("[Artifacts] Cascade invalidation after write failed:",c)}}async function Mi(e,t){let n=N.join(e,"aidlc-docs",t,"discovery");await de.ensureDir(n)}var N,de,ji=B(()=>{"use strict";N=E(require("path"),1),de=E(ae(),1)});function Vu(e){let t={id:(0,qu.randomUUID)(),timestamp:new Date().toISOString(),session_id:e.sessionId,project_path:e.projectPath,event_type:e.success?"success":"revision",agent_used:e.agentName,original_task:e.taskDescription,user_message:`BOLT ${e.boltId} execution ${e.success?"succeeded":"failed"}`,feedback_category:e.success?"praise":"correction",confidence:1,token_usage:e.tokenUsage?{input_tokens:e.tokenUsage.input_tokens,output_tokens:e.tokenUsage.output_tokens,total_tokens:e.tokenUsage.input_tokens+e.tokenUsage.output_tokens,estimated:!0}:void 0};wt(t)}function Yu(e){let t=Io();return Ro(e,t)}var qu,qo=B(()=>{"use strict";qu=require("crypto");ye()});var Vo={};ot(Vo,{CODE_PLAN_FORMAT_INSTRUCTIONS:()=>vw,buildCodeGenerationPrompt:()=>Qu,buildCodePlanPath:()=>Sw,dispatchCodeGeneration:()=>_w,extractSections:()=>qi,extractTargetFiles:()=>Vi,selectAgentForCodeGeneration:()=>zu});function Sw(e,t,n){return(0,mn.join)(e,"aidlc-docs",t,"construction",n,"code-plan.md")}function qi(e,t){if(!e)return"";let n=[],o=e.split(`
17
+ `);for(let o of n){let r=o.match(/^\s*[-*+]\s+(?:\[[ x]\]\s+)?(.+)$/);r&&t.push(r[1].trim())}return t}function Uk(e,t){let n=Fk(e);if(t==="intent-to-unit"){let s=Oi(n),a=[],c=s.get("Business Requirements");c&&a.push(...Qn(c));let l=s.get("Implementation Plan");return l&&a.push(...Qn(l)),a}if(t==="unit-to-bolt"){let s=Oi(n),a=[],c=s.get("Acceptance Criteria");c&&a.push(...Qn(c));let l=s.get("Target Files");return l&&a.push(...Qn(l)),a}let o=Oi(n),r=Lk[t],i=[];for(let s of r){let a=o.get(s);if(a){let c=Qn(a);i.push(...c)}}return i}function Wo(e,t,n){try{let o=Uk(e,n);if(o.length===0)return{conformance_score:100,coverage_percentage:100,missing_items:[],passed:!0};let r=t.toLowerCase(),i=[],s=0;for(let d of o){let p=d.toLowerCase();r.includes(p)?s++:i.push(d)}let a=Math.round(s/o.length*100),c=a,l=Iu[n],u=a>=l;return{conformance_score:a,coverage_percentage:c,missing_items:i,passed:u}}catch(o){return console.error("[Alignment] Verification computation failed:",o),{conformance_score:0,coverage_percentage:0,missing_items:["Verification computation error"],passed:!1}}}function Ru(e){let t=jk[e];return[{question:t.verification,answer:null,answered_by:null,passed:null},{question:t.validation,answer:null,answered_by:null,passed:null}]}function Ai(e,t,n,o,r){try{let i=Wo(e,t,r),s=Ru(r),a=s.every(m=>m.answer!==null),c=s.every(m=>m.passed===!0),u={alignment_score:a&&c?100:0,alignment_questions:s,passed:c},d=i.passed&&u.passed;return{source_artifact_id:n,target_artifact_id:o,verification:i,validation:u,alignment_passed:d,checked_at:new Date().toISOString()}}catch(i){return console.error("[Alignment] Alignment check failed:",i),{source_artifact_id:n,target_artifact_id:o,verification:{conformance_score:0,coverage_percentage:0,missing_items:["Alignment check error"],passed:!1},validation:{alignment_score:0,alignment_questions:[],passed:!1},alignment_passed:!1,checked_at:new Date().toISOString()}}}function ln(e,t,n,o,r,i,s,a){let c=Ai(t,e,i,s,o),l=Ai(n,e,a,s,r),u=c.alignment_passed&&l.alignment_passed;return{parentCheck:c,rootCheck:l,passed:u}}function Wk(e,t){let n=0;t>=2&&(n+=10),t>=3&&(n+=10);let o=e-n;return Math.max(0,o)}function Hk(e,t){try{let n=$(e);if(!n){console.error(`[Alignment] Manifest not found at ${e}`);return}n.alignment_checks.push(t),L(e,n)}catch(n){console.error("[Alignment] Failed to record alignment result:",n)}}function Gk(e){return Iu[e]}var Iu,jk,Lk,Ho=B(()=>{"use strict";K();Iu={"intent-to-unit":95,"unit-to-bolt":100,"unit-to-intent":80,"bolt-to-intent":70},jk={"intent-to-unit":{verification:"Does the UNIT cover its assigned scope from the INTENT?",validation:"Will this UNIT produce a working module that contributes to the feature?"},"unit-to-bolt":{verification:"Does the BOLT cover all acceptance criteria from the UNIT?",validation:"Does this BOLT deliver meaningful, testable progress?"},"unit-to-intent":{verification:"Does this UNIT contribute to the INTENT's problem statement?",validation:"Does this UNIT help achieve the INTENT's success metrics?"},"bolt-to-intent":{verification:"Does this BOLT contribute to solving the INTENT's stated problem?",validation:"Is this BOLT still aligned with the original INTENT's goals?"}},Lk={"intent-to-unit":["Business Requirements","Implementation Plan"],"unit-to-bolt":["Acceptance Criteria","Target Files"],"unit-to-intent":["Problem Statement","Success Metrics"],"bolt-to-intent":["Problem Statement","Success Metrics"]}});var Ht={};ot(Ht,{addGateAuditEntry:()=>Ce,cascadeInvalidation:()=>Vk,computeChecksum:()=>Go,createManifest:()=>Bk,detectStaleArtifacts:()=>qk,getArtifactById:()=>Jk,getArtifactsByPhase:()=>zk,getBoltArtifacts:()=>Ze,getBoltsByStatus:()=>$i,getUnitArtifacts:()=>Wt,isWorkflowComplete:()=>xu,linkArtifacts:()=>Pi,loadManifest:()=>$,normalizePath:()=>xi,recoverManifest:()=>Kk,registerArtifact:()=>Ae,revalidateStaleArtifacts:()=>Xk,runAlignmentCheck:()=>Yk,saveManifest:()=>L,transitionToActive:()=>Ni,transitionToDraft:()=>Pu,transitionToFulfilled:()=>Di,transitionToStale:()=>Nu,transitionToViolated:()=>$u,updateContractStatus:()=>Xe,updatePhaseStatus:()=>ct});function xi(e){return e.replace(/\\/g,"/")}function Et(){return{status:"not_started",started_at:null,completed_at:null,gate_result:null,gate_bypassed:!1,bypass_reason:null}}function Bk(e,t,n){let o=Qe.join(n,"aidlc-docs",e),r=Qe.join(o,"manifest.json");try{te.ensureDirSync(o);let i=new Date().toISOString(),s={schema_version:"2.0.0",workflow_id:e,feature_name:t,created_at:i,updated_at:i,phases:{discovery:Et(),inception:Et(),construction:Et(),operations:Et()},depth_assessment:null,artifacts:[],links:[],risks:[],gate_audit:[],metrics:null,alignment_checks:[],risk_tier:null};return te.writeFileSync(r,JSON.stringify(s,null,2),"utf-8"),r}catch(i){throw console.error(`Failed to create manifest at ${r}:`,i),i}}function $(e){try{if(!te.existsSync(e))return null;let t=te.readFileSync(e,"utf-8");return JSON.parse(t)}catch(t){return console.error(`Failed to load manifest at ${e}:`,t),null}}function L(e,t){try{t.updated_at=new Date().toISOString(),te.writeFileSync(e,JSON.stringify(t,null,2),"utf-8")}catch(n){throw console.error(`Failed to save manifest at ${e}:`,n),n}}function Go(e){try{if(!te.existsSync(e))return null;let t=te.readFileSync(e),n=(0,Au.createHash)("sha256");return n.update(t),n.digest("hex")}catch(t){return console.error(`Failed to compute checksum for ${e}:`,t),null}}function Ae(e,t){try{let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=new Date().toISOString(),r=xi(t.path),i=n.artifacts.findIndex(a=>a.id===t.id),s=Go(t.path);if(i>=0){let a=n.artifacts[i];n.artifacts[i]={...a,...t,path:r,updated_at:o,contract_version:a.contract_version+1,checksum:s}}else{let a={...t,path:r,created_at:o,updated_at:o,contract_version:1,contract_status:"draft",stale_reason:null,checksum:s};n.artifacts.push(a)}L(e,n)}catch(n){throw console.error(`Failed to register artifact in ${e}:`,n),n}}function Pi(e,t){try{let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.some(s=>s.id===t.source_id),r=n.artifacts.some(s=>s.id===t.target_id);if(!o)throw new Error(`Source artifact not found: ${t.source_id}`);if(!r)throw new Error(`Target artifact not found: ${t.target_id}`);n.links.some(s=>s.source_id===t.source_id&&s.target_id===t.target_id&&s.link_type===t.link_type)||(n.links.push(t),L(e,n))}catch(n){throw console.error(`Failed to link artifacts in ${e}:`,n),n}}function qk(e){try{let t=$(e);if(!t)return[];let n=[];for(let o of t.artifacts)if(o.checksum&&o.write_complete){let r=Go(o.path);r&&r!==o.checksum&&n.push(o.id)}return n}catch(t){return console.error(`Failed to detect stale artifacts in ${e}:`,t),[]}}function Vk(e,t){try{let n=$(e);if(!n)return;let o=new Set,r=[t];for(;r.length>0;){let i=r.shift();if(o.has(i))continue;o.add(i);let s=n.artifacts.find(c=>c.id===i);if(s){let c=i===t?"Artifact content was modified":`Parent artifact ${i} was modified`;Qk(s,c)}let a=n.links.filter(c=>c.source_id===i);for(let c of a)o.has(c.target_id)||r.push(c.target_id)}L(e,n)}catch(n){console.error(`Failed to cascade invalidation in ${e}:`,n)}}function Yk(e,t,n){try{let o=$(e);if(!o)return;let r=new Date().toISOString(),a={source_artifact_id:t,target_artifact_id:n,verification:{conformance_score:0,coverage_percentage:0,missing_items:[],passed:!1},validation:{alignment_score:0,alignment_questions:[],passed:!1},alignment_passed:!1,checked_at:r};o.alignment_checks.push(a),L(e,o)}catch(o){console.error(`Failed to run alignment check in ${e}:`,o)}}function Kk(e,t){try{let n=Qe.join(e,"aidlc-docs",t);if(!te.existsSync(n))return null;let o=new Date().toISOString(),r={schema_version:"2.0.0",workflow_id:t,feature_name:"Recovered Workflow",created_at:o,updated_at:o,phases:{discovery:Et(),inception:Et(),construction:Et(),operations:Et()},depth_assessment:null,artifacts:[],links:[],risks:[],gate_audit:[],metrics:null,alignment_checks:[],risk_tier:null},i=te.readdirSync(n,{recursive:!0,withFileTypes:!0});for(let s of i)if(s.isFile()&&s.name!=="manifest.json"){let a=Qe.join(s.path,s.name),c=Qe.relative(n,a),l=xi(a),u={id:`recovered-${Date.now()}-${r.artifacts.length}`,type:Qe.extname(s.name)||"unknown",phase:"inception",stage:"intent",path:l,created_at:o,updated_at:o,validation_passed:null,write_complete:!0,checksum:Go(a),contract_status:"draft",contract_version:1,stale_reason:null};r.artifacts.push(u)}return r}catch(n){return console.error(`Failed to recover manifest for workflow ${t}:`,n),null}}function ct(e,t,n,o,r){try{let i=$(e);if(!i)return;i.phases[t].status=n,o!==void 0&&(i.phases[t].started_at=o),r!==void 0&&(i.phases[t].completed_at=r),L(e,i)}catch(i){console.error(`Failed to update phase status in ${e}:`,i)}}function Ce(e,t){try{let n=$(e);if(!n)return;let o={...t,timestamp:new Date().toISOString()};n.gate_audit.push(o),L(e,n)}catch(n){console.error(`Failed to add gate audit entry in ${e}:`,n)}}function Jk(e,t){return e.artifacts.find(n=>n.id===t)}function zk(e,t){return e.artifacts.filter(n=>n.phase===t)}function Xe(e,t,n,o){try{switch(n){case"draft":Pu(e,t);break;case"active":Ni(e,t);break;case"fulfilled":Di(e,t);break;case"violated":$u(e,t);break;case"stale":if(!o)throw new Error('staleReason is required when setting status to "stale"');Nu(e,t,o);break}}catch(r){console.error(`Failed to update contract status in ${e}:`,r)}}function Wt(e){return e.artifacts.filter(t=>t.stage==="unit")}function Ze(e,t){let n=e.artifacts.filter(o=>o.stage==="code-generation");if(t){let o=new Set(e.links.filter(r=>r.source_id===t&&(r.link_type==="derives"||r.link_type==="implements")).map(r=>r.target_id));return n.filter(r=>o.has(r.id))}return n}function $i(e,t){return e.artifacts.filter(n=>n.stage==="code-generation"&&n.contract_status===t)}function xu(e){let t=e.artifacts.filter(n=>n.stage==="code-generation");return t.length===0?!1:t.every(n=>n.contract_status==="fulfilled")}function Qk(e,t){return e.contract_status==="stale"||e.contract_status==="violated"?!1:(e.contract_status="stale",e.stale_reason=t,e.statusHistory||(e.statusHistory=[]),e.statusHistory.push({status:"stale",timestamp:new Date().toISOString()}),!0)}function Pu(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="violated"&&o.contract_status!=="stale")throw new Error(`Cannot transition from '${o.contract_status}' to 'draft'`);o.contract_status="draft",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"draft",timestamp:new Date().toISOString()}),L(e,n)}function Ni(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="draft"&&o.contract_status!=="stale")throw new Error(`Cannot transition from '${o.contract_status}' to 'active'`);o.contract_status="active",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"active",timestamp:new Date().toISOString()}),L(e,n)}function Di(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="active")throw new Error(`Cannot transition from '${o.contract_status}' to 'fulfilled'`);o.contract_status="fulfilled",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"fulfilled",timestamp:new Date().toISOString()}),L(e,n)}function $u(e,t){let n=$(e);if(!n)throw new Error(`Manifest not found at ${e}`);let o=n.artifacts.find(r=>r.id===t);if(!o)throw new Error(`Artifact ${t} not found in manifest`);if(o.contract_status!=="active")throw new Error(`Cannot transition from '${o.contract_status}' to 'violated'`);o.contract_status="violated",o.stale_reason=null,o.statusHistory||(o.statusHistory=[]),o.statusHistory.push({status:"violated",timestamp:new Date().toISOString()}),L(e,n)}function Nu(e,t,n){let o=$(e);if(!o)throw new Error(`Manifest not found at ${e}`);let r=o.artifacts.find(i=>i.id===t);if(!r)throw new Error(`Artifact ${t} not found in manifest`);if(r.contract_status!=="active"&&r.contract_status!=="fulfilled")throw new Error(`Cannot transition from '${r.contract_status}' to 'stale'`);r.contract_status="stale",r.stale_reason=n,r.statusHistory||(r.statusHistory=[]),r.statusHistory.push({status:"stale",timestamp:new Date().toISOString()}),L(e,o)}async function Xk(e,t){let n={restored:[],stillStale:[],errors:[]},o=Qe.join(e,"aidlc-docs",t,"manifest.json"),r=$(o);if(!r)return n.errors.push("Manifest not found"),n;let i=r.artifacts.filter(s=>s.contract_status==="stale");for(let s of i)try{let a=r.links.find(y=>y.target_id===s.id);if(!a){n.stillStale.push(s.id);continue}let c=r.artifacts.find(y=>y.id===a.source_id);if(!c){n.stillStale.push(s.id);continue}let l=r.artifacts.find(y=>y.stage==="intent");if(!l){n.stillStale.push(s.id);continue}let u=te.existsSync(s.path)?te.readFileSync(s.path,"utf-8"):null,d=te.existsSync(c.path)?te.readFileSync(c.path,"utf-8"):null,p=te.existsSync(l.path)?te.readFileSync(l.path,"utf-8"):null;if(!u||!d||!p){n.stillStale.push(s.id);continue}let{runDualValidation:m}=await Promise.resolve().then(()=>(Ho(),Ou)),f,g;if(s.stage==="unit")f="intent-to-unit",g="unit-to-intent";else if(s.stage==="code-generation")f="unit-to-bolt",g="bolt-to-intent";else{n.stillStale.push(s.id);continue}m(u,d,p,f,g,c.id,s.id,l.id).passed?(s.contract_status="active",s.stale_reason=null,s.statusHistory||(s.statusHistory=[]),s.statusHistory.push({status:"active",timestamp:new Date().toISOString()}),n.restored.push(s.id)):n.stillStale.push(s.id)}catch(a){n.errors.push(`Error revalidating ${s.id}: ${a}`),n.stillStale.push(s.id)}return L(o,r),n}var te,Qe,Au,K=B(()=>{"use strict";te=E(ae(),1),Qe=E(require("path"),1),Au=require("crypto")});async function Du(e,t){let n=N.join(e,"aidlc-docs",t),o=N.join(n,"checkpoint.json");try{await de.ensureDir(n),await de.ensureDir(N.join(n,"inception")),await de.ensureDir(N.join(n,"construction")),await de.ensureDir(N.join(n,"construction","design")),await de.ensureDir(N.join(n,"operations")),await de.pathExists(o)||await de.writeJson(o,{workflow_id:t,current_stage:"intent",created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{spaces:2})}catch(r){let i=r;throw i.code==="ENOSPC"?(console.error("[Artifacts] Failed to create workflow directory: Disk full"),console.error("[Artifacts] Please free up disk space and try again."),console.error(`[Artifacts] Attempted path: ${n}`),new Error("Failed to create workflow directory: Disk is full. Please free up space and retry.")):i.code==="EACCES"||i.code==="EPERM"?(console.error("[Artifacts] Failed to create workflow directory: Permission denied"),console.error(`[Artifacts] Path: ${n}`),new Error(`Failed to create workflow directory: Permission denied for ${n}`)):i.code==="EROFS"?(console.error("[Artifacts] Failed to create workflow directory: Read-only filesystem"),console.error(`[Artifacts] Path: ${n}`),new Error("Failed to create workflow directory: Filesystem is read-only")):(console.error(`[Artifacts] Failed to create workflow directory: ${i.message}`),console.error(`[Artifacts] Workflow ID: ${t}`),console.error(`[Artifacts] Path: ${n}`),new Error(`Failed to create workflow directory for ${t}: ${i.message}`))}}function bt(e,t,n,o,r){let i=N.join(e,"aidlc-docs",t);switch(n){case"intent":return N.join(i,"inception","intent.md");case"nfr":return N.join(i,"inception","requirements","nfr.md");case"unit":if(!o)throw new Error("artifactId is required for unit artifacts");return N.join(i,"construction",o,"spec.md");case"code-generation":if(!o)throw new Error("artifactId is required for code-generation artifacts");if(!r)throw new Error("unitId is required for code-generation artifacts");return N.join(i,"construction",r,`${o}.md`);case"validation-report":if(!o)throw new Error("artifactId is required for validation-report artifacts");return N.join(i,"construction",o,"validation-report.md");case"interfaces":return N.join(i,"construction","design","interfaces.json");case"data-flow":return N.join(i,"construction","design","data-flow.json");case"components":return N.join(i,"construction","design","components.json");case"deploy-guide":return N.join(i,"operations","deploy-guide.md");case"runbook":return N.join(i,"operations","runbook.md");case"monitoring":return N.join(i,"operations","monitoring.json");case"release-notes":return N.join(i,"operations","release-notes.md");case"state":return N.join(i,"state.md");case"audit":return N.join(i,"audit.md");case"analysis-plan":return N.join(i,"discovery","analysis-plan.md");case"current-state-analysis":return N.join(i,"discovery","current-state-analysis.md");case"regression-baseline":return N.join(i,"discovery","regression-baseline.md");case"change-impact":return N.join(i,"discovery","change-impact.md");case"static-model":return N.join(i,"discovery","static-model.md");case"dynamic-model":return N.join(i,"discovery","dynamic-model.md");case"WORKFLOW_ROUTING":return N.join(i,"inception","plans","workflow-routing.md");case"requirements-qa":return N.join(i,"inception","requirements","requirements-analysis-questions.md");case"requirements":return N.join(i,"inception","requirements","requirements.md");case"personas":return N.join(i,"inception","user-stories","personas.md");case"user-stories":return N.join(i,"inception","user-stories","stories.md");case"execution-plan":return N.join(i,"inception","plans","execution-plan.md");case"units-generation":return N.join(i,"inception","application-design","unit-of-work.md");case"unit-dependency":return N.join(i,"inception","application-design","unit-of-work-dependency.md");case"unit-story-map":return N.join(i,"inception","application-design","unit-of-work-story-map.md");default:throw new Error(`Unknown artifact type: ${n}`)}}async function un(e,t,n,o,r,i){let s=bt(e,t,n,r,i),a=await de.pathExists(s);try{await de.ensureDir(N.dirname(s)),await de.writeFile(s,o,"utf-8")}catch(c){let l=c;throw l.code==="ENOSPC"?(console.error(`[Artifacts] Failed to write ${n} artifact: Disk full`),console.error("[Artifacts] Please free up disk space and try again."),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: Disk is full. Please free up space and retry.`)):l.code==="EACCES"||l.code==="EPERM"?(console.error(`[Artifacts] Failed to write ${n} artifact: Permission denied`),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: Permission denied for ${s}`)):l.code==="EROFS"?(console.error(`[Artifacts] Failed to write ${n} artifact: Read-only filesystem`),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: Filesystem is read-only`)):(console.error(`[Artifacts] Failed to write ${n} artifact: ${l.message}`),console.error(`[Artifacts] Path: ${s}`),new Error(`Failed to write ${n} artifact: ${l.message}`))}if(a)try{let c=N.join(e,"aidlc-docs",t,"manifest.json"),{cascadeInvalidation:l,loadManifest:u,saveManifest:d,computeChecksum:p}=await Promise.resolve().then(()=>(K(),Ht)),m=u(c);if(m){let f=s.replace(/\\/g,"/"),g=m.artifacts.find(h=>h.path===f||h.path.endsWith(N.basename(s)));if(g){let h=p(s);h&&(g.checksum=h,g.updated_at=new Date().toISOString(),d(c,m)),l(c,g.id)}}}catch(c){console.error("[Artifacts] Cascade invalidation after write failed:",c)}}async function Mi(e,t){let n=N.join(e,"aidlc-docs",t,"discovery");await de.ensureDir(n)}var N,de,ji=B(()=>{"use strict";N=E(require("path"),1),de=E(ae(),1)});function Vu(e){let t={id:(0,qu.randomUUID)(),timestamp:new Date().toISOString(),session_id:e.sessionId,project_path:e.projectPath,event_type:e.success?"success":"revision",agent_used:e.agentName,original_task:e.taskDescription,user_message:`BOLT ${e.boltId} execution ${e.success?"succeeded":"failed"}`,feedback_category:e.success?"praise":"correction",confidence:1,token_usage:e.tokenUsage?{input_tokens:e.tokenUsage.input_tokens,output_tokens:e.tokenUsage.output_tokens,total_tokens:e.tokenUsage.input_tokens+e.tokenUsage.output_tokens,estimated:!0}:void 0};wt(t)}function Yu(e){let t=Io();return Ro(e,t)}var qu,qo=B(()=>{"use strict";qu=require("crypto");ye()});var Vo={};ot(Vo,{CODE_PLAN_FORMAT_INSTRUCTIONS:()=>vw,buildCodeGenerationPrompt:()=>Qu,buildCodePlanPath:()=>Sw,dispatchCodeGeneration:()=>_w,extractSections:()=>qi,extractTargetFiles:()=>Vi,selectAgentForCodeGeneration:()=>zu});function Sw(e,t,n){return(0,mn.join)(e,"aidlc-docs",t,"construction",n,"code-plan.md")}function qi(e,t){if(!e)return"";let n=[],o=e.split(`
18
18
  `);for(let r=0;r<o.length;r++){let i=o[r],s=i.match(/^##\s+(.+)$/)||i.match(/^###\s+(.+)$/);if(s){let a=s[1].trim();if(t.some(c=>a.includes(c))){let c=[i],l=i.match(/^(#+)/)?.[1].length||2;for(let u=r+1;u<o.length;u++){let d=o[u],p=d.match(/^(#+)\s/);if(p&&p[1].length<=l)break;c.push(d)}n.push(c.join(`
19
19
  `))}}}return n.length>0?n.join(`
20
20
 
@@ -52,7 +52,7 @@ Generate code for this unit according to the spec above.
52
52
  3. Each step should be specific and actionable
53
53
  4. Steps should be ordered by dependency (prerequisites first)
54
54
  5. Include a "## Verification" section with test/validation checkboxes
55
- The plan file is saved at: aidlc-docs/{workflowId}/construction/{unitName}/code-plan.md`});async function Xu(e,t,n){let o=hn.default.join(e,"aidlc-docs",t,"inception","nfr.md"),r=hn.default.join(e,"aidlc-docs",t,"construction",n,"spec.md"),i=hn.default.join(e,"aidlc-docs",t,"construction",n,"nfr-requirements.md"),s="";try{await Bt.default.pathExists(o)&&(s=await Bt.default.readFile(o,"utf-8"))}catch{}let a="";try{await Bt.default.pathExists(r)&&(a=await Bt.default.readFile(r,"utf-8"))}catch{}let c=a.match(/^title:\s*(.+)$/m),l=c?c[1].trim().replace(/^["']|["']$/g,""):n,u=Tw(s,a,l),d=new Date().toISOString(),p=`---
55
+ The plan file is saved at: aidlc-docs/{workflowId}/construction/{unitName}/code-plan.md`});async function Xu(e,t,n){let o=hn.default.join(e,"aidlc-docs",t,"inception","requirements","nfr.md"),r=hn.default.join(e,"aidlc-docs",t,"construction",n,"spec.md"),i=hn.default.join(e,"aidlc-docs",t,"construction",n,"nfr-requirements.md"),s="";try{await Bt.default.pathExists(o)&&(s=await Bt.default.readFile(o,"utf-8"))}catch{}let a="";try{await Bt.default.pathExists(r)&&(a=await Bt.default.readFile(r,"utf-8"))}catch{}let c=a.match(/^title:\s*(.+)$/m),l=c?c[1].trim().replace(/^["']|["']$/g,""):n,u=Tw(s,a,l),d=new Date().toISOString(),p=`---
56
56
  id: ${n}-nfr-requirements
57
57
  parent_unit: ${n}
58
58
  generated_at: ${d}
@@ -337,7 +337,7 @@ ${r}
337
337
  `)}var qt,er,tr,Bw,Qi=B(()=>{"use strict";qt=E(require("path"),1),er=E(require("fs/promises"),1),tr=require("fs");Qo();K();Bw=[{pathway:"bugfix",keywords:["fix","bug","broken","regression","error","crash","issue","defect","patch"]},{pathway:"optimization",keywords:["optimize","performance","speed","cache","reduce","improve latency","memory","bottleneck"]},{pathway:"brownfield-refactor",keywords:["refactor","restructure","migrate","rewrite","reorganize","modernize","upgrade"]},{pathway:"brownfield-enhancement",keywords:["add","new","feature","implement","integrate","extend","support"]}]});function fS(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function mS(e){let t=e.split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");return t.length>80?t.substring(0,77)+"...":t}function gS(e){let{inception_stages:t,current_inception_stage:n}=e;if(!t)return[];let o=[];for(let r of pS){let i=t[r];if(!i)continue;let s=fS(r),a=n===r,c,l;i.status==="completed"?(c="[x]",l=i.completed_at?`(completed ${i.completed_at})`:"(completed)"):i.status==="skipped"?(c="[ ]",l=i.skip_reason?`(skipped -- ${i.skip_reason})`:"(skipped)"):(c="[ ]",l="");let u=` - ${c} ${s} ${l}`.trimEnd();a&&(u+=" <- CURRENT"),o.push(u)}return o}function hS(e){let t=["## Progress"];for(let n of dS){let o=e.phases[n],r,i;o?.completed_at?(r="[x]",i=`(completed ${o.completed_at})`):e.current_phase===n?(r="[ ]",i="(in progress)"):(r="[ ]",i="");let s=n.charAt(0).toUpperCase()+n.slice(1);if(t.push(`- ${r} ${s} ${i}`.trimEnd()),n==="inception"&&e.inception_stages){let a=gS(e);t.push(...a)}}return t.join(`
338
338
  `)}function yS(e){let t=["## Units of Work"];if(!e.construction_units||Object.keys(e.construction_units).length===0)return t.push(""),t.push("_No units defined yet. Populated during Units Generation._"),t.join(`
339
339
  `);t.push(""),t.push("| Unit | Status |"),t.push("|------|--------|");for(let[n,o]of Object.entries(e.construction_units))t.push(`| ${n} | ${o.code_generation_status} |`);return t.join(`
340
- `)}function kS(e,t){let n=["## Key Artifacts",""];n.push("| Artifact | Path | Status |"),n.push("|----------|------|--------|");let o=Sn.join(e,to,t),r=[{name:"Intent Analysis",path:"inception/intent.md"},{name:"Requirements",path:"inception/requirements.md"},{name:"User Stories",path:"inception/stories.md"},{name:"Workflow Plan",path:"inception/workflow-plan.md"},{name:"Unit Definitions",path:"inception/application-design/unit-of-work.md"},{name:"Dependency Matrix",path:"inception/application-design/unit-of-work-dependency.md"}];for(let i of r){let s=dt.existsSync(Sn.join(o,i.path));n.push(`| ${i.name} | ${i.path} | ${s?"created":"pending"} |`)}return n.join(`
340
+ `)}function kS(e,t){let n=["## Key Artifacts",""];n.push("| Artifact | Path | Status |"),n.push("|----------|------|--------|");let o=Sn.join(e,to,t),r=[{name:"Intent Analysis",path:"inception/intent.md"},{name:"Requirements",path:"inception/requirements/requirements.md"},{name:"NFR",path:"inception/requirements/nfr.md"},{name:"User Stories",path:"inception/user-stories/stories.md"},{name:"Personas",path:"inception/user-stories/personas.md"},{name:"Workflow Plan",path:"inception/workflow-plan.md"},{name:"Unit Definitions",path:"inception/application-design/unit-of-work.md"},{name:"Dependency Matrix",path:"inception/application-design/unit-of-work-dependency.md"}];for(let i of r){let s=dt.existsSync(Sn.join(o,i.path));n.push(`| ${i.name} | ${i.path} | ${s?"created":"pending"} |`)}return n.join(`
341
341
  `)}function Xi(e,t,n){let o=Sn.join(e,to,t,$d);try{let r=mS(n.feature_name),i=hS(n),s=yS(n),a=kS(e,t),c=`# ${r}
342
342
 
343
343
  | Field | Value |
@@ -1120,7 +1120,7 @@ created: ${r}
1120
1120
 
1121
1121
  ---
1122
1122
  *Generated by WorkflowEngine based on ${o}*
1123
- `;await un(this.projectPath,this.workflowId,"nfr",a),console.log("[WorkflowEngine] Generated NFR artifact at inception/nfr.md");let c=bt(this.projectPath,this.workflowId,"intent");console.log(`[WorkflowEngine] Validating INTENT artifact at: ${c}`);let l=await Bo(c);l.passed?(console.log("[WorkflowEngine] INTENT validation passed"),console.log(`[WorkflowEngine] Coverage: ${l.coverage_percentage}%`)):(console.log("[WorkflowEngine] INTENT validation failed:",l.blocking_issues),console.log(`[WorkflowEngine] Coverage: ${l.coverage_percentage}%`));let u=await R(this.projectPath,this.workflowId);if(u){let d=u;d.interview_progress={stage:"intent",questions_asked:0,draft_artifact_path:c},u.updated_at=new Date().toISOString(),await M(this.projectPath,u)}}async executeUnitStage(t){throw console.log(`[WorkflowEngine] Executing UNIT stage for feature: ${this.featureName}`),new Error("UNIT stage execution not yet implemented")}async executeCodeGenerationStage(t){throw console.log(`[WorkflowEngine] Executing CODE-GENERATION stage for feature: ${this.featureName}`),new Error("Code generation stage execution not yet implemented")}};Te();var ip={intent:null,unit:null,"code-generation":null,complete:null};function sp(e){switch(e){case"intent":return"capture the problem statement, personas, success metrics, constraints, and define business requirements, technical approach, and proposed UNITs";case"unit":return"decompose into module-scoped UNITs with interface contracts";case"code-generation":return"generate code from the approved code plan";case"complete":return"finalize and validate all workflow artifacts";default:return"proceed with the next stage"}}function ap(e,t,n=!1){let o=t.current_stage,r=ip[o],i=sp(o),s=`You are beginning a structured workflow for feature: ${e}
1123
+ `;await un(this.projectPath,this.workflowId,"nfr",a),console.log("[WorkflowEngine] Generated NFR artifact at inception/requirements/nfr.md");let c=bt(this.projectPath,this.workflowId,"intent");console.log(`[WorkflowEngine] Validating INTENT artifact at: ${c}`);let l=await Bo(c);l.passed?(console.log("[WorkflowEngine] INTENT validation passed"),console.log(`[WorkflowEngine] Coverage: ${l.coverage_percentage}%`)):(console.log("[WorkflowEngine] INTENT validation failed:",l.blocking_issues),console.log(`[WorkflowEngine] Coverage: ${l.coverage_percentage}%`));let u=await R(this.projectPath,this.workflowId);if(u){let d=u;d.interview_progress={stage:"intent",questions_asked:0,draft_artifact_path:c},u.updated_at=new Date().toISOString(),await M(this.projectPath,u)}}async executeUnitStage(t){throw console.log(`[WorkflowEngine] Executing UNIT stage for feature: ${this.featureName}`),new Error("UNIT stage execution not yet implemented")}async executeCodeGenerationStage(t){throw console.log(`[WorkflowEngine] Executing CODE-GENERATION stage for feature: ${this.featureName}`),new Error("Code generation stage execution not yet implemented")}};Te();var ip={intent:null,unit:null,"code-generation":null,complete:null};function sp(e){switch(e){case"intent":return"capture the problem statement, personas, success metrics, constraints, and define business requirements, technical approach, and proposed UNITs";case"unit":return"decompose into module-scoped UNITs with interface contracts";case"code-generation":return"generate code from the approved code plan";case"complete":return"finalize and validate all workflow artifacts";default:return"proceed with the next stage"}}function ap(e,t,n=!1){let o=t.current_stage,r=ip[o],i=sp(o),s=`You are beginning a structured workflow for feature: ${e}
1124
1124
 
1125
1125
  `;return s+=`Current stage: ${o}
1126
1126
  `,s+=`Status: ${t.status}
@@ -24,7 +24,7 @@ export declare const HOOKS_DIR: string;
24
24
  export declare const SETTINGS_FILE: string;
25
25
  export declare const VERSION_FILE: string;
26
26
  /** Current version - MUST match package.json */
27
- export declare const VERSION = "4.0.3";
27
+ export declare const VERSION = "4.0.4";
28
28
  /** Installation result */
29
29
  export interface InstallResult {
30
30
  success: boolean;
@@ -40,7 +40,7 @@ export const HOOKS_DIR = join(CLAUDE_CONFIG_DIR, 'hooks');
40
40
  export const SETTINGS_FILE = join(CLAUDE_CONFIG_DIR, 'settings.json');
41
41
  export const VERSION_FILE = join(CLAUDE_CONFIG_DIR, '.olympus-version.json');
42
42
  /** Current version - MUST match package.json */
43
- export const VERSION = '4.0.3';
43
+ export const VERSION = '4.0.4';
44
44
  /**
45
45
  * Read a content file from the resources/ directory.
46
46
  *
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project-resolver.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-resolver.test.d.ts","sourceRoot":"","sources":["../../../src/learning/__tests__/project-resolver.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,216 @@
1
+ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
2
+ import { join } from 'path';
3
+ import { mkdirSync, rmSync, existsSync } from 'fs';
4
+ const { execSync: mockExecSync } = vi.hoisted(() => ({
5
+ execSync: vi.fn(),
6
+ }));
7
+ vi.mock('child_process', () => ({
8
+ execSync: mockExecSync,
9
+ }));
10
+ const { loadSessionState: mockLoadSessionState, saveSessionState: mockSaveSessionState } = vi.hoisted(() => ({
11
+ loadSessionState: vi.fn(),
12
+ saveSessionState: vi.fn(),
13
+ }));
14
+ vi.mock('../session-state.js', () => ({
15
+ loadSessionState: mockLoadSessionState,
16
+ saveSessionState: mockSaveSessionState,
17
+ }));
18
+ const { mkdirShouldThrowEACCES } = vi.hoisted(() => ({ mkdirShouldThrowEACCES: { value: false } }));
19
+ vi.mock('fs', async (importOriginal) => {
20
+ const actual = await importOriginal();
21
+ return {
22
+ ...actual,
23
+ mkdirSync: (...args) => {
24
+ if (mkdirShouldThrowEACCES.value) {
25
+ const err = new Error('Permission denied');
26
+ err.code = 'EACCES';
27
+ throw err;
28
+ }
29
+ return actual.mkdirSync(...args);
30
+ },
31
+ };
32
+ });
33
+ import { deriveProjectSlug, resolveProjectRoot, getProjectScopedDir, ensureProjectDir, getTestProjectDir, } from '../project-resolver.js';
34
+ const TEST_LEARNING_DIR = join(process.cwd(), '.test-project-resolver-learning-' + Date.now());
35
+ const dirsToCleanup = [];
36
+ beforeEach(() => {
37
+ vi.clearAllMocks();
38
+ mkdirShouldThrowEACCES.value = false;
39
+ process.env.OLYMPUS_TEST_LEARNING_DIR = TEST_LEARNING_DIR;
40
+ mkdirSync(TEST_LEARNING_DIR, { recursive: true });
41
+ });
42
+ afterEach(() => {
43
+ delete process.env.OLYMPUS_TEST_LEARNING_DIR;
44
+ vi.restoreAllMocks();
45
+ for (const dir of dirsToCleanup) {
46
+ rmSync(dir, { recursive: true, force: true });
47
+ }
48
+ dirsToCleanup.length = 0;
49
+ rmSync(TEST_LEARNING_DIR, { recursive: true, force: true });
50
+ const cwd = process.cwd();
51
+ try {
52
+ const entries = require('fs').readdirSync(cwd);
53
+ for (const entry of entries) {
54
+ if (entry.startsWith('.test-project-')) {
55
+ rmSync(join(cwd, entry), { recursive: true, force: true });
56
+ }
57
+ }
58
+ }
59
+ catch {
60
+ }
61
+ });
62
+ describe('deriveProjectSlug', () => {
63
+ it('returns slug for a normal path', () => {
64
+ const slug = deriveProjectSlug('/home/dev/my-project');
65
+ expect(slug).toMatch(/^my-project-[a-f0-9]{8}$/);
66
+ });
67
+ it('sanitizes special characters in basename', () => {
68
+ const slug = deriveProjectSlug('/home/dev/My Project!');
69
+ expect(slug).toMatch(/^my-project-[a-f0-9]{8}$/);
70
+ });
71
+ it('handles root path /', () => {
72
+ const slug = deriveProjectSlug('/');
73
+ expect(slug).toMatch(/^root-[a-f0-9]{8}$/);
74
+ });
75
+ it('handles Windows root C:\\', () => {
76
+ const slug = deriveProjectSlug('C:\\');
77
+ expect(slug).toMatch(/^root-[a-f0-9]{8}$/);
78
+ });
79
+ it('handles drive letter only C:', () => {
80
+ const slug = deriveProjectSlug('C:');
81
+ expect(slug).toMatch(/^root-[a-f0-9]{8}$/);
82
+ });
83
+ it('returns unknown when basename is all special chars', () => {
84
+ const slug = deriveProjectSlug('/home/dev/___');
85
+ expect(slug).toMatch(/^unknown-[a-f0-9]{8}$/);
86
+ });
87
+ it('truncates long basenames to 30 chars before hash', () => {
88
+ const longName = 'a'.repeat(40);
89
+ const slug = deriveProjectSlug(`/home/dev/${longName}`);
90
+ const fullNamePart = slug.substring(0, slug.lastIndexOf('-'));
91
+ expect(fullNamePart.length).toBeLessThanOrEqual(30);
92
+ expect(slug).toMatch(/-[a-f0-9]{8}$/);
93
+ });
94
+ it('is deterministic — same input always gives same output', () => {
95
+ const path = '/home/dev/my-project';
96
+ expect(deriveProjectSlug(path)).toBe(deriveProjectSlug(path));
97
+ });
98
+ it('produces different slugs for different paths', () => {
99
+ const slug1 = deriveProjectSlug('/home/dev/project-a');
100
+ const slug2 = deriveProjectSlug('/home/dev/project-b');
101
+ expect(slug1).not.toBe(slug2);
102
+ });
103
+ it('matches expected format /^[a-z0-9][a-z0-9-]*-[a-f0-9]{8}$/', () => {
104
+ const slug = deriveProjectSlug('/home/dev/my-project');
105
+ expect(slug).toMatch(/^[a-z0-9][a-z0-9-]*-[a-f0-9]{8}$/);
106
+ });
107
+ });
108
+ describe('resolveProjectRoot', () => {
109
+ it('returns cached value from session state without calling execSync', () => {
110
+ mockLoadSessionState.mockReturnValue({ resolved_project_root: '/cached/path' });
111
+ const result = resolveProjectRoot('/some/dir');
112
+ expect(result).toBe('/cached/path');
113
+ expect(mockExecSync).not.toHaveBeenCalled();
114
+ });
115
+ it('calls execSync on cache miss and saves result to state', () => {
116
+ const state = { resolved_project_root: null };
117
+ mockLoadSessionState.mockReturnValue(state);
118
+ mockExecSync.mockReturnValue('/git/root\n');
119
+ const result = resolveProjectRoot('/some/dir');
120
+ expect(mockExecSync).toHaveBeenCalledWith('git rev-parse --show-toplevel', expect.objectContaining({
121
+ cwd: '/some/dir',
122
+ encoding: 'utf-8',
123
+ }));
124
+ expect(result).toMatch(/git[/\\]root/);
125
+ expect(mockSaveSessionState).toHaveBeenCalledWith('/some/dir', expect.objectContaining({
126
+ resolved_project_root: expect.any(String),
127
+ }));
128
+ });
129
+ it('falls back to resolve(directory) when git fails', () => {
130
+ const state = { resolved_project_root: null };
131
+ mockLoadSessionState.mockReturnValue(state);
132
+ mockExecSync.mockImplementation(() => { throw new Error('git not found'); });
133
+ const result = resolveProjectRoot('/fallback/dir');
134
+ expect(result).toContain('fallback');
135
+ expect(mockSaveSessionState).toHaveBeenCalled();
136
+ });
137
+ it('falls back gracefully on git timeout', () => {
138
+ const state = { resolved_project_root: null };
139
+ mockLoadSessionState.mockReturnValue(state);
140
+ const timeoutErr = new Error('Command failed');
141
+ timeoutErr.code = 'ETIMEDOUT';
142
+ mockExecSync.mockImplementation(() => { throw timeoutErr; });
143
+ const result = resolveProjectRoot('/timeout/dir');
144
+ expect(typeof result).toBe('string');
145
+ expect(result.length).toBeGreaterThan(0);
146
+ });
147
+ it('falls back gracefully when git is not found (ENOENT)', () => {
148
+ const state = { resolved_project_root: null };
149
+ mockLoadSessionState.mockReturnValue(state);
150
+ const enoentErr = new Error('spawn git ENOENT');
151
+ enoentErr.code = 'ENOENT';
152
+ mockExecSync.mockImplementation(() => { throw enoentErr; });
153
+ const result = resolveProjectRoot('/no-git/dir');
154
+ expect(typeof result).toBe('string');
155
+ expect(result.length).toBeGreaterThan(0);
156
+ });
157
+ it('always returns an absolute normalized path', () => {
158
+ const state = { resolved_project_root: null };
159
+ mockLoadSessionState.mockReturnValue(state);
160
+ mockExecSync.mockReturnValue('/absolute/path\n');
161
+ const result = resolveProjectRoot('/some/dir');
162
+ expect(result).toMatch(/^([A-Za-z]:[/\\]|\/)/);
163
+ });
164
+ });
165
+ describe('getProjectScopedDir', () => {
166
+ it('returns path under getLearningDir()/projects/{slug}', () => {
167
+ const dir = getProjectScopedDir('/home/dev/my-project');
168
+ expect(dir).toContain('projects');
169
+ expect(dir).toMatch(/my-project-[a-f0-9]{8}/);
170
+ });
171
+ it('respects OLYMPUS_TEST_LEARNING_DIR env var', () => {
172
+ const dir = getProjectScopedDir('/home/dev/my-project');
173
+ expect(dir.startsWith(TEST_LEARNING_DIR)).toBe(true);
174
+ });
175
+ });
176
+ describe('ensureProjectDir', () => {
177
+ it('creates the project directory', () => {
178
+ const testDir = join(process.cwd(), '.test-project-ensure-' + Date.now());
179
+ dirsToCleanup.push(testDir);
180
+ process.env.OLYMPUS_TEST_LEARNING_DIR = testDir;
181
+ ensureProjectDir('/home/dev/test-ensure-project');
182
+ const expectedDir = getProjectScopedDir('/home/dev/test-ensure-project');
183
+ expect(existsSync(expectedDir)).toBe(true);
184
+ });
185
+ it('does not throw when directory already exists (idempotent)', () => {
186
+ ensureProjectDir('/home/dev/idempotent-project');
187
+ expect(() => ensureProjectDir('/home/dev/idempotent-project')).not.toThrow();
188
+ });
189
+ it('logs error on failure without throwing', () => {
190
+ const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => { });
191
+ mkdirShouldThrowEACCES.value = true;
192
+ expect(() => ensureProjectDir('/home/dev/no-permission')).not.toThrow();
193
+ expect(errorSpy).toHaveBeenCalledWith('Failed to create project directory:', expect.any(Error));
194
+ mkdirShouldThrowEACCES.value = false;
195
+ errorSpy.mockRestore();
196
+ });
197
+ });
198
+ describe('getTestProjectDir', () => {
199
+ it('creates a directory with .test-project- prefix', () => {
200
+ const dir = getTestProjectDir('my-test');
201
+ dirsToCleanup.push(dir);
202
+ expect(dir).toContain('.test-project-my-test');
203
+ expect(existsSync(dir)).toBe(true);
204
+ });
205
+ it('returns a string path', () => {
206
+ const dir = getTestProjectDir('string-test');
207
+ dirsToCleanup.push(dir);
208
+ expect(typeof dir).toBe('string');
209
+ });
210
+ it('is idempotent — calling twice does not throw', () => {
211
+ const dir = getTestProjectDir('idempotent-test');
212
+ dirsToCleanup.push(dir);
213
+ expect(() => getTestProjectDir('idempotent-test')).not.toThrow();
214
+ });
215
+ });
216
+ //# sourceMappingURL=project-resolver.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-resolver.test.js","sourceRoot":"","sources":["../../../src/learning/__tests__/project-resolver.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEnD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACnD,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE;CAClB,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9B,QAAQ,EAAE,YAAY;CACvB,CAAC,CAAC,CAAC;AAEJ,MAAM,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3G,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;IACzB,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;CAC1B,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,gBAAgB,EAAE,oBAAoB;IACtC,gBAAgB,EAAE,oBAAoB;CACvC,CAAC,CAAC,CAA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,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,GAAG,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;QAC7C,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,GAAG,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;QACjD,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function resolveProjectRoot(directory: string): string;
2
+ export declare function deriveProjectSlug(canonicalPath: string): string;
3
+ export declare function getProjectScopedDir(canonicalPath: string): string;
4
+ export declare function ensureProjectDir(canonicalPath: string): void;
5
+ export declare function getTestProjectDir(testName: string): string;
6
+ //# sourceMappingURL=project-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-resolver.d.ts","sourceRoot":"","sources":["../../src/learning/project-resolver.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAwB5D;AAED,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAqB/D;AAED,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAS5D;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI1D"}
@@ -0,0 +1,65 @@
1
+ import { resolve, normalize, basename, join } from 'path';
2
+ import { execSync } from 'child_process';
3
+ import { mkdirSync } from 'fs';
4
+ import { createHash } from 'crypto';
5
+ import { getLearningDir } from './storage.js';
6
+ import { loadSessionState, saveSessionState } from './session-state.js';
7
+ export function resolveProjectRoot(directory) {
8
+ const state = loadSessionState(directory);
9
+ if (state.resolved_project_root !== null) {
10
+ return state.resolved_project_root;
11
+ }
12
+ let root;
13
+ try {
14
+ const result = execSync('git rev-parse --show-toplevel', {
15
+ cwd: directory,
16
+ encoding: 'utf-8',
17
+ timeout: 2000,
18
+ stdio: 'pipe',
19
+ });
20
+ root = resolve(normalize(result.trim()));
21
+ }
22
+ catch {
23
+ root = resolve(directory);
24
+ }
25
+ state.resolved_project_root = root;
26
+ saveSessionState(directory, state);
27
+ return root;
28
+ }
29
+ export function deriveProjectSlug(canonicalPath) {
30
+ let name = basename(canonicalPath);
31
+ if (!name || /^[A-Za-z]:[\\/]?$/.test(canonicalPath) || /^[A-Za-z]:$/.test(name)) {
32
+ name = 'root';
33
+ }
34
+ let sanitized = name
35
+ .toLowerCase()
36
+ .replace(/[^a-z0-9]+/g, '-')
37
+ .replace(/-{2,}/g, '-')
38
+ .replace(/^-+|-+$/g, '')
39
+ .substring(0, 30);
40
+ if (!sanitized) {
41
+ sanitized = 'unknown';
42
+ }
43
+ const hash8 = createHash('sha256').update(canonicalPath).digest('hex').substring(0, 8);
44
+ return `${sanitized}-${hash8}`;
45
+ }
46
+ export function getProjectScopedDir(canonicalPath) {
47
+ return join(getLearningDir(), 'projects', deriveProjectSlug(canonicalPath));
48
+ }
49
+ export function ensureProjectDir(canonicalPath) {
50
+ try {
51
+ mkdirSync(getProjectScopedDir(canonicalPath), { recursive: true });
52
+ }
53
+ catch (error) {
54
+ const nodeError = error;
55
+ if (nodeError.code !== 'EEXIST') {
56
+ console.error('Failed to create project directory:', error);
57
+ }
58
+ }
59
+ }
60
+ export function getTestProjectDir(testName) {
61
+ const dir = join(process.cwd(), '.test-project-' + testName);
62
+ mkdirSync(dir, { recursive: true });
63
+ return dir;
64
+ }
65
+ //# sourceMappingURL=project-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-resolver.js","sourceRoot":"","sources":["../../src/learning/project-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,KAAK,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAE1C,IAAI,KAAK,CAAC,qBAAqB,KAAK,IAAI,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC,qBAAqB,CAAC;IACrC,CAAC;IAED,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,+BAA+B,EAAE;YACvD,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACnC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEnC,OAAO,IAAI,CA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CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,GAAG,QAAQ,CAAC,CAAC;IAC7D,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "olympus-ai",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Olympus: Multi-agent orchestration for Claude Code. Summon the gods of code.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",