prjct-cli 3.91.0 → 3.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/bin/hook-chunks/{agent-switch-IQ5KSRKD.mjs → agent-switch-XMFUTNNV.mjs} +1 -1
- package/dist/bin/hook-chunks/{analysis-LBYZSJKT.mjs → analysis-PFGKPYWQ.mjs} +6 -6
- package/dist/bin/hook-chunks/auto-flush-QZ3YIQP6.mjs +8 -0
- package/dist/bin/hook-chunks/{capture-gate-BQCNMHUC.mjs → capture-gate-2FXYVHNF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-6AFM6WRB.mjs → chunk-2HTDCLZD.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-LGJUQEAU.mjs → chunk-2WPR5GFT.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-LPB3HUJ2.mjs → chunk-3X7TBM4A.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-LJLUP4FF.mjs → chunk-5PEHJEFE.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-B7GMU46T.mjs → chunk-7JE6VTLN.mjs} +3 -3
- package/dist/bin/hook-chunks/{chunk-EHBEHLYN.mjs → chunk-AWD2AQVJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-IKUGYUAI.mjs → chunk-BZ5UR7G3.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-HBLR7BVG.mjs → chunk-CDCCAU22.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-YKMJI6TF.mjs → chunk-CPHUFXD2.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-PSP56GGF.mjs → chunk-CQUG6SO2.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-RRWPDRYR.mjs → chunk-DGBDMUBL.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-UQVJQME2.mjs → chunk-DVBBB5BS.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-XEFIIDHM.mjs → chunk-GELCZWKW.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-AW25AWN5.mjs → chunk-HIFIDMH5.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-UHW35BPE.mjs → chunk-HX42HFII.mjs} +4 -4
- package/dist/bin/hook-chunks/{chunk-QZSJSXJV.mjs → chunk-I5BDN25C.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-RJ2BRRMH.mjs → chunk-KB3P6XTL.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-TFGJVT6F.mjs → chunk-MAHTF6JG.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-FEH4IPIC.mjs → chunk-MQVVNX63.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-3WKDMAS7.mjs → chunk-NLDL3N6R.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-OGOCHZ3S.mjs +13 -0
- package/dist/bin/hook-chunks/{chunk-M3ZOJVPA.mjs → chunk-OL6ITIAZ.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-W5OWBOLH.mjs → chunk-OLKNK2HB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-DGQYQSUK.mjs → chunk-OP467HW6.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-PXJKXBTM.mjs → chunk-S4TB2OFJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-AEYONUUY.mjs → chunk-SY2FRLJF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-RAHFKGM6.mjs → chunk-TBM7736J.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-A5MUSARI.mjs → chunk-WSFHSXBZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-D6KT763C.mjs → chunk-XHDNPEAN.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-YG7KBQYJ.mjs → chunk-Y7CKMFNW.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-OIEZAHLC.mjs → chunk-ZNQXFWSI.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-D4S3IRD3.mjs → chunk-ZX6BC2EB.mjs} +1 -1
- package/dist/bin/hook-chunks/{codex-skill-7IURPY6B.mjs → codex-skill-2N6656SR.mjs} +1 -1
- package/dist/bin/hook-chunks/{command-installer-BVHQUSL4.mjs → command-installer-XSKQS3IS.mjs} +1 -1
- package/dist/bin/hook-chunks/{config-manager-KYC7WUOS.mjs → config-manager-YZANYLPV.mjs} +1 -1
- package/dist/bin/hook-chunks/{cwd-changed-56X7BNS6.mjs → cwd-changed-NJ6RYVOJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{distill-6C6YIFOE.mjs → distill-IABVRW2U.mjs} +1 -1
- package/dist/bin/hook-chunks/{enriched-recall-6ZZNKAJZ.mjs → enriched-recall-NDASPZXZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{format-YOYMJSLY.mjs → format-NIBVWBGR.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-receipt-2U7D6HS4.mjs → judgment-receipt-HTNEOJLT.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-cue-SS23JBAX.mjs → land-cue-FNLP4IAB.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-synthesis-OATL5BNP.mjs → land-synthesis-HBPIXP5S.mjs} +1 -1
- package/dist/bin/hook-chunks/{legacy-crew-sweep-NH5EWEXF.mjs → legacy-crew-sweep-2MLYPNQR.mjs} +2 -2
- package/dist/bin/hook-chunks/{memory-index-677MUBCZ.mjs → memory-index-MQCHZFUE.mjs} +1 -1
- package/dist/bin/hook-chunks/{notification-S2IJJ6JW.mjs → notification-VQM2AMNS.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-integrity-L3BL7CGO.mjs → pack-integrity-BKLDNYE5.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-manager-SU53HCKK.mjs → pack-manager-ASWLKYGP.mjs} +1 -1
- package/dist/bin/hook-chunks/{planning-ZYFCFU7N.mjs → planning-QBSY272P.mjs} +2 -2
- package/dist/bin/hook-chunks/{post-edit-JD7YFEBZ.mjs → post-edit-VTLDHWI3.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-bash-VIABNO5E.mjs → pre-bash-JR6257XO.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-commit-NVQVXHZQ.mjs → pre-commit-BYUFDN2N.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-edit-V4RD45C4.mjs → pre-edit-MHROFDS3.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-package-KFJZXI5T.mjs → pre-package-P7CLTJJV.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-search-7KRU5D2O.mjs → pre-search-BCQHPE46.mjs} +1 -1
- package/dist/bin/hook-chunks/{prjct-md-FMCPUMQT.mjs → prjct-md-WE6WFVL3.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-agent-surfaces-TD7BHI25.mjs → project-agent-surfaces-A6HGZPAL.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-memory-ZVZSLPB5.mjs → project-memory-ON54KZEM.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-style-evolution-7JS75AUP.mjs → project-style-evolution-T27I5N65.mjs} +1 -1
- package/dist/bin/hook-chunks/{prompt-S4MMIXH5.mjs → prompt-JIOMJCGV.mjs} +2 -2
- package/dist/bin/hook-chunks/{purge-BDREPWEE.mjs → purge-QQ6XILZD.mjs} +1 -1
- package/dist/bin/hook-chunks/{retention-D2MVQLOF.mjs → retention-E7WGFL47.mjs} +1 -1
- package/dist/bin/hook-chunks/{sdd-ZO4DP23G.mjs → sdd-PV6KWXE4.mjs} +1 -1
- package/dist/bin/hook-chunks/{session-continuity-FNNUMOXB.mjs → session-continuity-5CLT5YBL.mjs} +1 -1
- package/dist/bin/hook-chunks/{session-start-HA7IRBFX.mjs → session-start-ATYLOUKB.mjs} +1 -1
- package/dist/bin/hook-chunks/{setup-7L3NXNRH.mjs → setup-VL7YXVE5.mjs} +2 -2
- package/dist/bin/hook-chunks/{shipping-GX4HFYJ3.mjs → shipping-LVTFVSWJ.mjs} +4 -4
- package/dist/bin/hook-chunks/{spec-context-inference-KER2R3F3.mjs → spec-context-inference-U6BGGB2Q.mjs} +2 -2
- package/dist/bin/hook-chunks/spec-service-2DVDFOR7.mjs +11 -0
- package/dist/bin/hook-chunks/spec-task-breakdown-MPNRRTNZ.mjs +8 -0
- package/dist/bin/hook-chunks/{stop-HPZCLDPM.mjs → stop-GBUGB5OE.mjs} +2 -2
- package/dist/bin/hook-chunks/{subagent-start-7KZUTKV5.mjs → subagent-start-HURF2GI7.mjs} +1 -1
- package/dist/bin/hook-chunks/{subagent-stop-7C72RWGO.mjs → subagent-stop-WJECHEXI.mjs} +1 -1
- package/dist/bin/hook-chunks/{surface-attribution-PDYR6DVA.mjs → surface-attribution-BDKFYUOJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-service-RRFG5P7N.mjs → task-service-BM2JQXMS.mjs} +1 -1
- package/dist/bin/hook-chunks/{tdd-XQUU4C23.mjs → tdd-UJDJUJ3E.mjs} +1 -1
- package/dist/bin/hook-chunks/{template-loader-4QMIMOBY.mjs → template-loader-BFTLPG2W.mjs} +1 -1
- package/dist/bin/hook-chunks/{weak-model-mode-M6D23IIM.mjs → weak-model-mode-GLXXHG32.mjs} +1 -1
- package/dist/bin/hook-chunks/{work-scope-6FG6PSAV.mjs → work-scope-VTF6SKLY.mjs} +1 -1
- package/dist/bin/prjct-core.mjs +686 -682
- package/dist/bin/prjct-hooks.mjs +1 -1
- package/dist/daemon/entry.mjs +589 -585
- package/dist/mcp/server.mjs +299 -296
- package/package.json +1 -1
- package/dist/bin/hook-chunks/auto-flush-GW3FP763.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-LWCHQIJ7.mjs +0 -11
- package/dist/bin/hook-chunks/spec-service-G3RLCJ2G.mjs +0 -11
- package/dist/bin/hook-chunks/spec-task-breakdown-YPJ76OWR.mjs +0 -8
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{a as _,b as R,c as o}from"./chunk-OGOCHZ3S.mjs";import"./chunk-7SI6X3Z7.mjs";import"./chunk-DYHYDHCW.mjs";import{a as v}from"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as y}from"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import{e as w,g as k}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as P,e as A}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{b as E,o as x}from"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as m}from"./chunk-E66B27AL.mjs";A();x();k();import{createHash as I}from"node:crypto";function S(c){let t={goal:c.goal,eli10:c.eli10,stakes:c.stakes,acceptance_criteria:c.acceptance_criteria,scope:c.scope,out_of_scope:c.out_of_scope,risks:c.risks,test_plan:c.test_plan,scenarios:c.scenarios};return I("sha256").update(JSON.stringify(t)).digest("hex")}m(S,"computeAuditCandidateHash");function j(c,t){let e=w.get(c,"SELECT content FROM specs WHERE id = ?",t),s=(()=>{if(!e?.content)return null;try{return JSON.parse(e.content)}catch{return null}})(),r=w.query(c,"SELECT lens FROM spec_selected_reviewer WHERE spec_id = ?",t).map(a=>a.lens),n=new Set(w.query(c,"SELECT lens FROM spec_review WHERE spec_id = ? AND verdict = 'pass'",t).map(a=>a.lens));if(!(r.length>0?r.every(a=>n.has(a)):n.has("strategic")&&n.has("architecture")&&n.has("design")))return!1;let u=s?.audit_candidate_hash;if(!u)return!0;if(S(s)!==u)return!1;let l=s?.reviews??{};for(let a of r.length>0?r:Object.keys(l)){let d=l[a];if(!(!d||d.verdict!=="pass")&&d.candidateHash!==u)return!1}for(let a of r.length>0?r:["strategic","architecture","design"]){if(!n.has(a))continue;let d=l[a];if(!d||d.candidateHash!==u)return!1}return!0}m(j,"reviewsGatePassedRelational");async function D(c){try{let{stdout:t}=await E("git",["rev-parse","HEAD"],{cwd:c}),e=t.trim();return/^[0-9a-f]{7,40}$/.test(e)?e:null}catch{return null}}m(D,"readGitHead");var C=class{static{m(this,"SpecService")}async create(t,e){let s=await this.requireProjectId(t),{classifySpecCreate:r,shouldMirrorSpecToMemory:n}=await import("./precision-classifier-IVVAXE26.mjs"),p=r(e.title,e.content.goal);if(p.action==="refuse")throw new Error(`Cannot create empty spec (${p.reasonCode}): ${p.reason}`);let u=e.autoContext!==!1,l=e.content.notes??"",a=u&&!l.trim()?await import("./spec-context-inference-U6BGGB2Q.mjs").then(async({inferSpecContext:h,warnNoContextMatch:f})=>{let g=await h(e.title,s,t);return g.empty&&f(e.title),g.empty?l:g.notesBlock}):l,d=_.parse({goal:e.content.goal,eli10:e.content.eli10??"",stakes:e.content.stakes??"",acceptance_criteria:e.content.acceptance_criteria??[],scope:e.content.scope??[],out_of_scope:e.content.out_of_scope??[],risks:e.content.risks??[],test_plan:e.content.test_plan??[],reviews:e.content.reviews,linked_tasks:e.content.linked_tasks??[],notes:a}),i=o.create(s,{title:e.title,content:d,tags:e.tags});return n(i.title,i.content.goal)&&await v.remember(t,{type:"spec",content:`${i.title}
|
|
9
|
+
|
|
10
|
+
Goal: ${i.content.goal}`,tags:{...e.tags??{},spec_id:i.id,status:i.status},source:i.id,provenance:"declared"}),i}async get(t,e){let s=await this.requireProjectId(t);return o.get(s,e)}async list(t,e={}){let s=await this.requireProjectId(t);return o.list(s,e)}async setStatus(t,e,s){let r=await this.requireProjectId(t),n=o.setStatus(r,e,s);return n&&await v.remember(t,{type:"spec",content:`Spec status \u2192 ${s}: ${n.title}`,tags:{spec_id:e,status:s,event:"status_change"},source:e}),n}async patch(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=_.parse({...n.content,...s});return this.update(t,e,p)}async applyDelta(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=R(n.content,s);return p===n.content?n:this.update(t,e,p)}async update(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=S(n.content),u=S(s),l=p!==u,a=l?{...s,reviews:{},selected_reviewers:[],audit_candidate_hash:null}:s;return l&&(n.status==="reviewed"||n.status==="in_progress")&&o.setStatus(r,e,"draft"),o.updateContent(r,e,a)}async recordReview(t,e,s,r){let n=await this.requireProjectId(t),p=3,u=50,l=m(async d=>{let i=o.get(n,e);if(!i)return null;let h=i.content.audit_candidate_hash??S(i.content);if(i.content.audit_candidate_hash&&S(i.content)!==i.content.audit_candidate_hash)throw new Error(`SPEC_CANDIDATE_DRIFT: body no longer matches audit_candidate_hash. Re-run \`prjct spec audit ${e}\` then re-record reviews.`);let f={...r,ts:P(),candidateHash:h},g={...i.content,audit_candidate_hash:h,reviews:{...i.content.reviews??{},[s]:f}};if(o.casUpdate(n,e,g,i.updatedAt))return o.get(n,e);if(d+1>=p)throw new Error(`SPEC_RECORD_REVIEW_CONFLICT_RETRY_EXHAUSTED: ${p} retries failed for spec ${e}`);return await new Promise($=>setTimeout($,u)),l(d+1)},"attemptReview"),a=await l(0);if(a&&j(n,e)&&a.status==="draft"){let{assessAcceptanceCriteria:d}=await import("./nyquist-lite-GE7OAFLC.mjs"),i=d(a.content.acceptance_criteria??[]);if(!i.ok&&i.message){let f=await y.readConfig(t).catch(()=>null),g=f?.tdd?.mode==="strict",b=f?.sdd?.mode==="strict";if(g||b)throw new Error(`NYQUIST_LITE_BLOCK: ${i.message}
|
|
11
|
+
Rewrite acceptance criteria with verifiable signals, then re-record the last review.`);try{await v.remember(t,{type:"improvement-signal",content:i.message,tags:{source:"nyquist-lite",spec:e},provenance:"extracted",projectId:n})}catch{}}let h=o.setStatus(n,e,"reviewed");if(h){let{breakdownSpecToTasks:f}=await import("./spec-task-breakdown-MPNRRTNZ.mjs");return await f(n,t,h),o.get(n,e)}return h}return a}async linkTask(t,e,s){let r=await this.requireProjectId(t);return o.linkTask(r,e,s)}async ship(t,e,s){let r=await this.requireProjectId(t);s!==void 0&&o.setShippedPr(r,e,s);let n=await D(t);return n&&o.setShippedSha(r,e,n),o.setStatus(r,e,"shipped")}unmetCriteria(t,e=new Set){return t.content.acceptance_criteria.filter(s=>!e.has(s))}async setSelectedReviewers(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=S(n.content);return o.updateContent(r,e,{...n.content,selected_reviewers:s,audit_candidate_hash:p,reviews:{}})}async requireProjectId(t){let e=await y.readConfig(t);if(!e?.projectId)throw new Error("not a prjct project (run `prjct init` first)");return e.projectId}},oe=new C;export{oe as specService};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{b as m}from"./chunk-NWY5M34K.mjs";import{c as s}from"./chunk-OGOCHZ3S.mjs";import"./chunk-DYHYDHCW.mjs";import{a as w}from"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as h,e as S}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as p}from"./chunk-E66B27AL.mjs";S();async function x(r,a,e){let o=e.content.acceptance_criteria;if(o.length===0)return{taskIds:[],skippedReason:"no_acceptance_criteria"};if(e.content.tasks_created_at!==null)return{taskIds:[],skippedReason:"already_broken_down"};let d=e.content.linked_tasks.length>0,y=(await m.getTasks(r)).filter(t=>t.featureId===e.id),g=new Set,u=o.map(t=>{let n=y.find(_=>_.body===t&&!g.has(_.id));return n&&g.add(n.id),n??null}),c=o.map((t,n)=>({ac:t,i:n})).filter(({i:t})=>u[t]===null),l=c.length>0?await m.addTasks(r,c.map(({ac:t})=>({description:I(t),body:t,priority:"medium",type:"feature",section:"backlog",featureId:e.id,groupId:e.id,groupName:e.title}))):[],b=new Map(c.map(({i:t},n)=>[t,l[n].id])),i=o.map((t,n)=>u[n]?.id??b.get(n));for(let t of i)s.linkTask(r,e.id,t);let k=s.get(r,e.id);if(k){let t={...k.content,tasks_created_at:h()};s.updateContent(r,e.id,t)}let f=i.length-l.length;return await w.remember(a,{type:"spec",content:`Auto-breakdown: ${l.length} tasks created${f>0?`, ${f} adopted`:""} from ${e.title}${d?" (recovered from partial)":""}`,tags:{spec_id:e.id,event:"auto_breakdown",task_count:String(i.length),...d?{recovered:"partial"}:{}},source:e.id}),{taskIds:i,...d?{recoveredFromPartial:!0}:{}}}p(x,"breakdownSpecToTasks");function I(r){let a=r.replace(/\s+/g," ").trim();return a.length<=140?a:`${a.slice(0,137)}\u2026`}p(I,"truncateForDescription");export{x as breakdownSpecToTasks};
|
|
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{a as se,b as v,d as G}from"./chunk-PW3KYKVS.mjs";import{b as re}from"./chunk-45I2C2UB.mjs";import{a as P}from"./chunk-EM6ZDJAK.mjs";import{c as ne}from"./chunk-L4COZ7ZH.mjs";import{b as te}from"./chunk-2UC4DTDO.mjs";import{a as B}from"./chunk-FGQZ62ZP.mjs";import{a as Z,b as ee}from"./chunk-TRMBRDKH.mjs";import"./chunk-TPESWBA7.mjs";import{b as Q}from"./chunk-ODWWIFSN.mjs";import{c as L}from"./chunk-ZZ65CN5F.mjs";import{c as V}from"./chunk-
|
|
8
|
+
import{a as se,b as v,d as G}from"./chunk-PW3KYKVS.mjs";import{b as re}from"./chunk-45I2C2UB.mjs";import{a as P}from"./chunk-EM6ZDJAK.mjs";import{c as ne}from"./chunk-L4COZ7ZH.mjs";import{b as te}from"./chunk-2UC4DTDO.mjs";import{a as B}from"./chunk-FGQZ62ZP.mjs";import{a as Z,b as ee}from"./chunk-TRMBRDKH.mjs";import"./chunk-TPESWBA7.mjs";import{b as Q}from"./chunk-ODWWIFSN.mjs";import{c as L}from"./chunk-ZZ65CN5F.mjs";import{c as V}from"./chunk-OL6ITIAZ.mjs";import"./chunk-Y5NQV46G.mjs";import{a as g}from"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import{g as Ve,h as Qe}from"./chunk-UUULLTQV.mjs";import{a as Y,c as U}from"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as S}from"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import{a as K,b as Ye,e as b,f as I,g as R}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as q,e as ze,s as z,t as Ke}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{e as A,g as D,l as C,o as X}from"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as c,b as M,e as T}from"./chunk-E66B27AL.mjs";import k from"node:fs/promises";import We from"node:path";import Ze from"node:crypto";import et from"node:fs/promises";var ce="friction-detector",ie="friction-promote",oe=5,ae=400,ue=160,tt=[/^\s*no[,.!\s]/i,/^\s*nope\b/i,/^\s*stop\b/i,/^\s*wait\b/i,/^\s*cancel\b/i],rt=[/\bshould be\b/i,/\brather than\b/i,/\binstead\b/i],nt=[/\bdoesn'?t work\b/i,/\bbroken\b/i,/\bagain\b.*\bsame\b/i];async function le(r,e,t,s={}){let n=s.preloadedLines?s.preloadedLines:await et.readFile(e,"utf-8").then(st).catch(()=>null);if(!n)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let i=it(n);if(i.length===0)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let o=i.slice(0,oe).map(p=>({category:p.category,expectedBehavior:"Follow the user constraint without requiring correction.",observedBehavior:`The assistant response triggered user ${p.category}.`,relatedRuleId:null})),a=pt(r),u=fe(r)??void 0;return{...await i.slice(0,oe).reduce(async(p,m)=>{let d=await p,y=de(m.excerpt).slice(0,12);if(a.has(y))return await ut(r,u,m).catch(()=>{}),{...d,signalsSkipped:d.signalsSkipped+1};try{return await g.remember(r,{type:"improvement-signal",content:ct(m),tags:{source:ce,category:m.category,...s.runtime?{runtime:s.runtime}:{},...s.model?{model:s.model}:{},...t?{session:t}:{},key:y},provenance:"extracted",projectId:u}),a.add(y),{...d,signalsRecorded:d.signalsRecorded+1}}catch{return{...d,signalsSkipped:d.signalsSkipped+1}}},Promise.resolve({signalsRecorded:0,signalsSkipped:0})),failures:o}}c(le,"detectFriction");function st(r){return v(r)}c(st,"parseJsonl");function it(r){let e={signals:[],lastAssistantText:""};for(let t of r){let s=t.role??t.message?.role,n=at(t.content??t.message?.content);if(!n)continue;if(s==="assistant"){e.lastAssistantText=n;continue}if(s!=="user")continue;let i=ot(n.slice(0,300));i&&e.signals.push({excerpt:n.slice(0,ae).trim(),category:i,precedingAssistantPreview:e.lastAssistantText.slice(0,ae).trim()})}return e.signals}c(it,"extractSignals");function ot(r){return nt.some(e=>e.test(r))?"complaint":tt.some(e=>e.test(r))?"negation":rt.some(e=>e.test(r))?"correction":null}c(ot,"classify");function at(r){return typeof r=="string"?r:Array.isArray(r)?r.map(e=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"text"in e){let t=e.text;return typeof t=="string"?t:""}return""}).join(`
|
|
9
9
|
`).trim():""}c(at,"textOf");function ct(r){let e=lt(r.category),t=pe(r.excerpt),s=t?`Obey developer constraint: ${t}`:e.lesson,n=t?`Always: ${t}`:e.nextAction;return[`[${r.category}] Lesson: ${s}`,"What happened: The user pushed back after the assistant response.",`Why it mattered: ${e.why}`,`Pattern: ${e.pattern}`,`Anti-pattern: ${e.antiPattern}`,`Next action: ${n}`].join(`
|
|
10
10
|
`)}c(ct,"formatSignal");function pe(r){let e=r.replace(/\s+/g," ").trim();if(!e)return null;let t=e.replace(/^\s*(?:nope|no|stop|wait|cancel)[,.!\s:—-]*/i,"").trim(),s=t.match(/\bshould be\b\s+(.+?)$/i);if(s?.[1])return E(`Prefer ${s[1]}`);let n=t.match(/^(.+?)\s+rather than\s+(.+?)$/i);if(n?.[1]&&n[2])return E(`Prefer ${n[1].trim()} rather than ${n[2].trim()}`);let i=t.match(/\b(?:use|prefer|do|run|ship|write|keep)\s+(.+?)\s+instead(?:\s+of\s+(.+))?$/i);if(i?.[1]){let l=i[2]?` instead of ${i[2].trim()}`:" instead";return E(`Use ${i[1].trim()}${l}`)}let o=t.match(/\binstead of\b\s+(.+?)$/i);if(o?.[1])return E(`Avoid ${o[1].trim()}`);let a=t.match(/\b(?:don'?t|do not|never)\s+(.+?)$/i);if(a?.[1])return E(`Never ${a[1].trim()}`);let u=t.match(/\balways\s+(.+?)$/i);if(u?.[1])return E(`Always ${u[1].trim()}`);if(t.length>=12&&t.length<=ue&&/^(?:run|use|do|ship|write|keep|add|fix|remove|prefer|test|check|verify|read|ask|stop|start)\b/i.test(t)){let l=t.charAt(0).toUpperCase()+t.slice(1);return E(l.replace(/[.!?]+$/,""))}return null}c(pe,"extractSpecificConstraint");function E(r){let e=r.replace(/\s+/g," ").trim().replace(/^[-*•]\s+/,"").replace(/[.!?]+$/,"").slice(0,ue);return e.length<12||/^(?:nope|no|stop|wait|cancel)\b/i.test(e)?null:e}c(E,"cleanConstraint");async function ut(r,e,t){if(!e)return;let s=pe(t.excerpt);if(!s)return;let n=`Always: ${s}`,i=`fp:${de(s).slice(0,12)}`;try{if(g.recall(e,{types:["feedback"],tags:{source:ie,key:i},limit:1,dedupeByKey:!1}).length>0)return;await g.remember(r,{type:"feedback",content:n,tags:{source:ie,key:i,category:t.category,from:"recurring-friction"},provenance:"extracted",projectId:e})}catch{}}c(ut,"maybePromoteStandingPreference");function lt(r){return r==="complaint"?{lesson:"Treat explicit failure complaints as evidence that the last result needs diagnosis, not repetition.",why:"The user reported that the delivered behavior or command did not work.",pattern:"User names a broken or non-working result after an assistant action.",antiPattern:"Retrying the same path or moving on without isolating the failure.",nextAction:"Stop, inspect the failing output or assumption, and propose the smallest verifiable fix."}:r==="correction"?{lesson:"Update the working assumption when the user corrects the intended direction.",why:"The assistant was using an assumption that did not match what the user wanted.",pattern:"User redirects the implementation or workflow with a correction.",antiPattern:"Continuing with the original plan after the user clarified a different target.",nextAction:"Restate the corrected target as an actionable rule before continuing."}:{lesson:"Recalibrate before continuing when the user rejects the assistant\u2019s last step.",why:"The assistant likely violated sequencing, scope, or approval expectations.",pattern:"User immediately rejects an assistant action or proposed next step.",antiPattern:"Treating the rejected action as acceptable and continuing without changing course.",nextAction:"Pause, convert the pushback into a workflow constraint, and adjust the next tool use."}}c(lt,"lessonTemplate");function de(r){let e=r.toLowerCase().replace(/\s+/g," ").trim();return Ze.createHash("sha256").update(e).digest("hex")}c(de,"hashSignal");function pt(r){try{let e=fe(r);if(!e)return new Set;let t=g.recall(e,{types:["improvement-signal"],tags:{source:ce},limit:100,dedupeByKey:!1}),s=new Set;for(let n of t){let i=n.tags.key;i&&s.add(i)}return s}catch{return new Set}}c(pt,"projectMemoryHashes");function fe(r){try{let e=M("node:fs"),s=M("node:path").join(r,".prjct","prjct.config.json"),n=e.readFileSync(s,"utf-8");return JSON.parse(n).projectId??null}catch{return null}}c(fe,"projectIdFromPath");var dt=32;function ge(r={}){let t=(r.hookHost===void 0?process.env.PRJCT_HOOK_HOST:r.hookHost)?.trim().toLowerCase().slice(0,dt);return t&&Z.has(t)?t:r.detectedRuntime??ee()}c(ge,"resolveInstructionRuntime");X();var he="lean-detector",ft="lean-debt-growth",gt=3,me=["off","lite","full","ultra"];function mt(r){let e=r?.lean?.mode;if(e&&me.includes(e))return e;let t=process.env.PRJCT_LEAN_MODE?.toLowerCase();return t&&me.includes(t)?t:"off"}c(mt,"effectiveMode");async function ye(r,e){let t={active:!1,total:0,previous:0,persisted:!1},s=e!==void 0?e:await S.readConfig(r).catch(()=>null);if(!s?.projectId||mt(s)==="off")return t;t.active=!0;try{let n=await ht(r);if(t.total=n,n===0)return t;let i=yt(s.projectId);t.previous=i;let o=n-i;i>0&&o>=gt&&(await g.remember(r,{type:"lean-debt",content:`Lean debt growing: \`lean:\` markers rose by ${o} (now ${n}, was ${i}). Deferred simplifications are accumulating \u2014 consider a leaning pass via \`prjct lean debt\`.`,tags:{source:he,pattern:ft,total:String(n),previous:String(i),delta:String(o)},provenance:"inferred",projectId:s.projectId}),t.persisted=!0)}catch{}return t}c(ye,"detectAndPersistLeanDebt");async function ht(r){let e=await A(["grep","-cI","-e","lean:"],{cwd:r,maxBuffer:16777216});if(!e.ok){if(D(e,1))return 0;C(e)}return e.stdout.split(`
|
|
11
11
|
`).reduce((t,s)=>{let n=s.lastIndexOf(":");if(n<=0)return t;let i=Number.parseInt(s.slice(n+1),10);return Number.isFinite(i)?t+i:t},0)}c(ht,"measureLeanMarkers");function yt(r){try{let{prjctDb:e}=(R(),T(I)),t=e.query(r,"SELECT data FROM events WHERE type = 'memory.remember.lean-debt' ORDER BY id DESC LIMIT 50");for(let s of t){let n=(()=>{try{return JSON.parse(s.data)}catch{return null}})();if(!n||typeof n!="object")continue;let i=n.tags;if(!i||i.source!==he)continue;let o=typeof i.total=="string"?Number.parseInt(i.total,10):0;if(Number.isFinite(o))return o}}catch{}return 0}c(yt,"collectPreviousSnapshot");import wt from"node:path";X();var bt="hot-file",we="pattern-detector-auto",kt="recurring-bug",be="pattern-detector-recurring",Rt="tech-debt-growth",ke="pattern-detector-debt",O=7,St=3,N=30,vt=2,Tt=5,Et=[/^package(-lock)?\.json$/,/^bun\.lock(b)?$/,/^pnpm-lock\.yaml$/,/^yarn\.lock$/,/^CHANGELOG\.md$/,/^\.gitignore$/,/\.snap$/,/^dist\//,/^node_modules\//];async function Re(r,e){let t={scanned:0,hotFiles:[],persisted:0,skipped:[],errors:[]},s=e!==void 0?e:await S.readConfig(r).catch(()=>null);if(!s?.projectId)return t.errors.push("no project config"),t;try{let n=await _t(r);if(t.scanned+=n.length,t.hotFiles=n,n.length>0){let i=Mt(s.projectId);for(let o of n){if(i.has(o.path)){t.skipped.push({reason:"already-marked-this-window",file:o.path});continue}try{await g.remember(r,{type:"learning",content:`Hot file: \`${o.path}\` \u2014 ${o.touches} touches in the last ${O} days. Worth a refactor pass or a deliberate decision about why it churns this often.`,tags:{source:we,pattern:bt,file:o.path,touches:String(o.touches),window_days:String(O)},provenance:"inferred"}),t.persisted+=1}catch(a){t.errors.push(`remember failed for ${o.path}: ${a.message}`)}}}}catch(n){t.errors.push(`hot-file detection failed: ${n.message}`)}try{let n=At(s.projectId);if(n.length>0){let i=Dt(s.projectId);for(let o of n){if(i.has(o.topic)){t.skipped.push({reason:"recurring-bug-already-marked",file:o.topic});continue}try{await g.remember(r,{type:"learning",content:`Recurring bug pattern: gotchas tagged \`topic:${o.topic}\` reported ${o.occurrences} times in the last ${N} days. Likely a real underlying issue \u2014 consider a focused investigation before patching the next instance.`,tags:{source:be,pattern:kt,topic:o.topic,occurrences:String(o.occurrences),window_days:String(N)},provenance:"inferred"}),t.persisted+=1}catch(a){t.errors.push(`remember failed for recurring ${o.topic}: ${a.message}`)}}}}catch(n){t.errors.push(`recurring-bug detection failed: ${n.message}`)}try{let n=await Ct(r);if(n.totalCount>0){let i=xt(s.projectId),o=n.totalCount-i;if(i>0&&o>=Tt)try{await g.remember(r,{type:"learning",content:`Tech debt growing: TODO/FIXME/XXX count rose by ${o} (now ${n.totalCount}, was ${i}). Consider a focused debt-reduction pass before adding more features.`,tags:{source:ke,pattern:Rt,total:String(n.totalCount),previous:String(i),delta:String(o)},provenance:"inferred"}),t.persisted+=1}catch(a){t.errors.push(`remember failed for tech-debt: ${a.message}`)}}}catch(n){t.errors.push(`tech-debt detection failed: ${n.message}`)}return t}c(Re,"detectAndPersistPatterns");async function _t(r){let e=await A(["log",`--since=${O}.days.ago`,"--name-only","--pretty=format:","-z"],{cwd:r,maxBuffer:16777216,timeoutMs:15e3});if(!e.ok){if(e.kind==="exit")return[];C(e)}let t=new Map;for(let n of e.stdout.split("\0")){let i=n.trim();i&&(It(i)||t.set(i,(t.get(i)??0)+1))}let s=[];for(let[n,i]of t)i<St||s.push({path:n,touches:i});return s.sort((n,i)=>i.touches-n.touches),s}c(_t,"detectHotFiles");function It(r){let e=wt.basename(r);for(let t of Et)if(t.test(r)||t.test(e))return!0;return!1}c(It,"isIgnored");function At(r){try{let{prjctDb:e}=(R(),T(I)),t=new Date(Date.now()-N*24*60*60*1e3).toISOString(),s=e.query(r,"SELECT data, timestamp FROM events WHERE type = 'memory.remember.gotcha' AND timestamp >= ? ORDER BY id DESC LIMIT 500",t),n=new Map;for(let o of s){let a=(()=>{try{return JSON.parse(o.data)}catch{return null}})();if(!a||typeof a!="object")continue;let u=a.tags;if(!u||u.source==="transcript-auto")continue;let l=typeof u.topic=="string"?u.topic:void 0,p=typeof u.area=="string"?u.area:void 0,m=l??p;m&&n.set(m,(n.get(m)??0)+1)}let i=[];for(let[o,a]of n)a<vt||i.push({topic:o,occurrences:a});return i.sort((o,a)=>a.occurrences-o.occurrences),i}catch{return[]}}c(At,"detectRecurringBugs");async function Ct(r){let e=await A(["grep","-cE","\\b(TODO|FIXME|XXX)\\b"],{cwd:r,maxBuffer:16777216});if(!e.ok){if(D(e,1))return{totalCount:0};C(e)}return{totalCount:e.stdout.split(`
|
|
@@ -14,4 +14,4 @@ import{a as se,b as v,d as G}from"./chunk-PW3KYKVS.mjs";import{b as re}from"./ch
|
|
|
14
14
|
`).trim():""}c(Kt,"textOf");function Ce(r){let e=new Set;for(let t of r.toLowerCase().split(/[^a-z0-9]+/))t.length<De||Le.has(t)||e.add(t);return e}c(Ce,"tokenize");function Yt(r){let e=[...r].filter(s=>s.length>=Wt);if(e.length>0)return new Set(e);let t=[...r].sort((s,n)=>n.length-s.length||s.localeCompare(n))[0]??"";return t?new Set([t]):new Set}c(Yt,"signatureOf");function j(r){let e=new Set;for(let t of r)for(let s of t.split("/")){let n=s.replace(/\.[a-z0-9]+$/i,"").toLowerCase();n.length>=De&&!Le.has(n)&&e.add(n)}return e}c(j,"fileStems");function xe(r,e){let t=j([r]);for(let s of j([e]))if(t.has(s))return!0;return!1}c(xe,"sharesStem");function Vt(r){let e=r.evidenceFile!==""?`touched \`${r.evidenceFile}\``:"worked the same area";return[`[skill-miss] Unused project knowledge (${r.memType}, ${r.memId}): "${r.excerpt}"`,`This session ${e} but never referenced it. Apply it, or supersede it via: prjct remember decision "<resolution>" --tags resolves:skill-miss,relates:${r.memId}`].join(`
|
|
15
15
|
`)}c(Vt,"formatSkillMiss");function Qt(r,e){let t=`${r}::${e.toLowerCase().replace(/\s+/g," ").trim()}`;return jt.createHash("sha256").update(t).digest("hex")}c(Qt,"hashKey");function Zt(r,e){let t=g.recall(r,{types:[...Ut],limit:120}),s=Date.now()-Bt,n=[];for(let i of t)i.provenance!=="inferred"&&(Date.parse(i.rememberedAt)>s||e&&i.tags.session===e||n.push({id:i.id,type:i.type,content:i.content,fileTag:i.tags.file??"",rememberedAt:i.rememberedAt,provenance:i.provenance,session:i.tags.session??""}));return n}c(Zt,"recallCandidates");function er(r){try{let e=g.recall(r,{types:["improvement-signal"],tags:{source:Me},limit:100,dedupeByKey:!1}),t=new Set;for(let s of e)s.tags.key&&t.add(s.tags.key);return t}catch{return new Set}}c(er,"existingSkillMissKeys");function tr(r){try{let e=M("node:fs"),s=M("node:path").join(r,".prjct","prjct.config.json");return JSON.parse(e.readFileSync(s,"utf-8")).projectId??null}catch{return null}}c(tr,"projectIdFromPath");import rr from"node:crypto";import nr from"node:fs/promises";var $e="transcript-auto",sr="v2",je=80,He=20,H=1500,ir=12,Oe=4,or=[{phrase:"decided to",type:"decision"},{phrase:"we chose",type:"decision"},{phrase:"going with",type:"decision"},{phrase:"the right call",type:"decision"},{phrase:"best approach is",type:"decision"},{phrase:"we will use",type:"decision"},{phrase:"shipping with",type:"decision"},{phrase:"turns out that",type:"learning"},{phrase:"now i understand",type:"learning"},{phrase:"the key insight",type:"learning"},{phrase:"i learned that",type:"learning"},{phrase:"discovered that",type:"learning"},{phrase:"root cause is",type:"learning"},{phrase:"root cause was",type:"learning"},{phrase:"the fix is",type:"learning"},{phrase:"gotcha:",type:"gotcha"},{phrase:"bug:",type:"gotcha"},{phrase:"fails when",type:"gotcha"},{phrase:"breaks when",type:"gotcha"},{phrase:"be careful",type:"gotcha"},{phrase:"never do this",type:"gotcha"},{phrase:"trap:",type:"gotcha"},{phrase:"important:",type:"fact"},{phrase:"always use",type:"fact"},{phrase:"never write",type:"fact"},{phrase:"the pattern is",type:"pattern"},{phrase:"anti-pattern:",type:"anti-pattern"},{phrase:"antipattern:",type:"anti-pattern"}],Fe=[{re:/^(?:[-*•]\s+)?(?:\*\*)?decision(?:\*\*)?\s*[:—-]\s+/i,type:"decision",phrase:"label:decision"},{re:/^(?:[-*•]\s+)?(?:\*\*)?(learning|insight)(?:\*\*)?\s*[:—-]\s+/i,type:"learning",phrase:"label:learning"},{re:/^(?:[-*•]\s+)?(?:\*\*)?(gotcha|trap|warning)(?:\*\*)?\s*[:—-]\s+/i,type:"gotcha",phrase:"label:gotcha"},{re:/^(?:[-*•]\s+)?(?:\*\*)?(fact|note)(?:\*\*)?\s*[:—-]\s+/i,type:"fact",phrase:"label:fact"},{re:/^(?:[-*•]\s+)?(?:\*\*)?root\s*cause(?:\*\*)?\s*[:—-]\s+/i,type:"learning",phrase:"label:root-cause"},{re:/^(?:[-*•]\s+)?(?:\*\*)?pattern(?:\*\*)?\s*[:—-]\s+/i,type:"pattern",phrase:"label:pattern"},{re:/^(?:[-*•]\s+)?(?:\*\*)?anti[- ]?pattern(?:\*\*)?\s*[:—-]\s+/i,type:"anti-pattern",phrase:"label:anti-pattern"}];async function Ue(r,e,t,s={}){let n={scanned:0,ingested:0,skipped:[],errors:[]},i=s.preloadedConfig!==void 0?s.preloadedConfig:await S.readConfig(r).catch(()=>null);if(!i?.projectId)return n.errors.push("no project config"),n;let o=await(async()=>{if(s.preloadedLines)return s.preloadedLines;try{return v(await nr.readFile(e,"utf-8"))}catch(d){return n.errors.push(`transcript read failed: ${d.message}`),null}})();if(o===null)return n;let a=ar(o),u=cr(o);if(n.scanned=a.length+u.length,a.length===0&&u.length===0)return n;let l=[...dr(a),...lr(u)];if(l.length===0)return n;let p=gr(i.projectId),m=t?t.slice(0,12):"unknown";for(let d of l){if(p.has(d.hash)){n.skipped.push({reason:"duplicate",phrase:d.matchedPhrase});continue}try{await g.remember(r,{type:d.type,content:d.content,tags:{source:$e,capture:sr,session:m,hash:d.hash,phrase:d.matchedPhrase},provenance:"inferred",projectId:i.projectId}),n.ingested+=1}catch(y){n.errors.push(`remember failed: ${y.message}`)}}return n}c(Ue,"ingestTranscript");function ar(r){let e=[];for(let t of r){let s=Be(t);if(s!=="assistant")continue;let n=Ge(t);!n||n.length<je||e.push({role:s,text:n})}return e}c(ar,"projectMessages");function cr(r){let e=[];for(let t of r){let s=Be(t);if(s!=="user")continue;let n=Ge(t);!n||n.length<He||e.push({role:s,text:n})}return e}c(cr,"projectUserMessages");var ur=[{re:/^(?:please\s+)?always\b/i,phrase:"user:always"},{re:/^(?:please\s+)?never\b/i,phrase:"user:never"},{re:/\bi (?:always|never|prefer)\b/i,phrase:"user:i-prefer"},{re:/^(?:rule|preference)\s*[:—-]/i,phrase:"user:rule"},{re:/\bno more\s+(?:features?|feature\s+creep)\b/i,phrase:"user:no-more-features"},{re:/\bdon'?t add (?:more )?(?:features?|surface)\b/i,phrase:"user:dont-add-features"}];function lr(r){let e=[],t=new Set;for(let s of r){if(e.length>=Oe)break;let n=s.text.split(/\n/).map(o=>o.replace(/^[-*•]\s+/,"").trim()).filter(o=>o.length>=He),i=n.length>0?n:[s.text.trim()];for(let o of i){if(e.length>=Oe)break;let a=ur.find(p=>p.re.test(o));if(!a)continue;let u=o.length>H?`${o.slice(0,H)}\u2026`:o,l=Je(u);t.has(l)||(t.add(l),e.push({type:"feedback",content:u,hash:l,matchedPhrase:a.phrase}))}}return e}c(lr,"extractUserPreferenceCandidates");function Be(r){let e=r.role;if(typeof e=="string")return Ne(e);let t=r.message;if(t&&typeof t=="object"&&"role"in t){let n=t.role;if(typeof n=="string")return Ne(n)}let s=r.type;return s==="assistant"||s==="user"||s==="system"?s:null}c(Be,"inferRole");function Ne(r){let e=r.toLowerCase();return e==="assistant"||e==="user"||e==="system"?e:null}c(Ne,"normalizeRole");function Ge(r){let e=r.content===void 0&&r.message&&typeof r.message=="object"?r.message.content:r.content;if(typeof e=="string")return e.trim();if(Array.isArray(e)){let t=[];for(let s of e){if(!s||typeof s!="object")continue;let n=s;n.type==="text"&&typeof n.text=="string"&&t.push(n.text)}return t.join(`
|
|
16
16
|
`).trim()}return""}c(Ge,"extractText");function pr(r){let e=r.trim();if(e.length<je)return null;for(let n of Fe)if(n.re.test(e))return{type:n.type,matchedPhrase:n.phrase};let t=e.toLowerCase(),s=or.find(n=>t.includes(n.phrase));return s?{type:s.type,matchedPhrase:s.phrase}:null}c(pr,"classifyCaptureParagraph");function dr(r){let e=[],t=new Set;for(let s of r){let n=fr(s.text);for(let i of n){if(e.length>=ir)return e;let o=pr(i);if(!o)continue;let a=i.length>H?`${i.slice(0,H)}\u2026`:i,u=Je(a);t.has(u)||(t.add(u),e.push({type:o.type,content:a,hash:u,matchedPhrase:o.matchedPhrase}))}}return e}c(dr,"extractCandidates");function fr(r){let e=r.split(/\n\s*\n/).map(s=>s.trim()).filter(Boolean),t=[];for(let s of e){let n=s.split(`
|
|
17
|
-
`).map(o=>o.trim()).filter(Boolean);if(n.some(o=>Fe.some(a=>a.re.test(o)))&&n.length>1)for(let o of n)t.push(o);else t.push(s)}return t}c(fr,"splitParagraphs");function Je(r){return rr.createHash("sha256").update(r.toLowerCase().trim()).digest("hex").slice(0,16)}c(Je,"hashContent");function gr(r){let e=new Set;try{let{prjctDb:t}=(R(),T(I)),{REMEMBER_EVENT_RANGE:s}=(Qe(),T(Ve)),n=t.query(r,"SELECT data FROM events WHERE type >= ? AND type < ? ORDER BY id DESC LIMIT 500",...s);for(let i of n){let o=(()=>{try{return JSON.parse(i.data)}catch{return null}})();if(!o||typeof o!="object")continue;let a=o.tags;if(!a||a.source!==$e)continue;let u=a.hash;typeof u=="string"&&e.add(u)}}catch{}return e}c(gr,"collectExistingAutoHashes");var F=600*1e3,_=new Map;function mr(r){let e=r.replace(/[^a-zA-Z0-9._-]/g,"_");return We.join(te.runDir(),`stop-heavy-${e}.stamp`)}c(mr,"heavyStepStampPath");async function Xe(r,e,t=!0){if(await k.stat(r).then(i=>e-i.mtimeMs<F).catch(()=>!1))return!1;let n=`${r}.lock`;try{await k.mkdir(n)}catch(i){if(i.code!=="EEXIST")throw i;return!await k.stat(n).then(a=>e-a.mtimeMs>=F).catch(()=>!1)||!t?!1:(await k.rmdir(n).catch(()=>{}),Xe(r,e,!1))}try{return await k.stat(r).then(o=>e-o.mtimeMs<F).catch(()=>!1)?!1:(await k.writeFile(r,String(e)),!0)}finally{await k.rmdir(n).catch(()=>{})}}c(Xe,"claimHeavyStep");async function hr(r){let e=Date.now(),t=_.get(r)??0;if(e-t<F)return!1;try{let s=mr(r);await k.mkdir(We.dirname(s),{recursive:!0});let n=await Xe(s,e);return _.size>32&&_.clear(),_.set(r,e),n}catch{}return _.size>32&&_.clear(),_.set(r,e),!0}c(hr,"heavyStepsDue");function Ln(r=process.cwd(),e){return ne({event:"Stop",projectPath:r,afterEmit:c(async(t,s)=>{let n=await S.readConfig(s).catch(()=>null);if(!n?.projectId)return;let i=ge(),o=await hr(n.projectId),a={};if(o&&t.transcript_path){let l=await k.readFile(t.transcript_path,"utf-8").catch(()=>null);l!==null&&(a.transcriptLines=v(l))}let u=se(a.transcriptLines??[]);if(o)try{let{collectActiveTasks:l}=await import("./task-overview-6ZQKJGSH.mjs"),p=await l(n.projectId,s);a.activeTaskId=p.current?.id,a.activeTaskDescription=p.current?.description,a.activeTaskStartedAt=p.current?.startedAt}catch{}if(a.transcriptLines&&a.transcriptLines.length>0)try{if(a.transcriptUsage=G(a.transcriptLines),a.transcriptUsage.tokensIn+a.transcriptUsage.tokensOut>0){let l=a.activeTaskStartedAt?{sinceIso:a.activeTaskStartedAt}:void 0,p=G(a.transcriptLines,l);if(a.activeTaskId&&p.tokensIn+p.tokensOut>0){B(n.projectId,a.activeTaskId,p.tokensIn,p.tokensOut,{description:a.activeTaskDescription,agent:i,source:`${i}-transcript`});try{let{sumTranscriptUsageByModel:m}=await import("./transcript-jsonl-6X4DDD6R.mjs");for(let[d,y]of m(a.transcriptLines,l))y.tokensIn+y.tokensOut<=0||B(n.projectId,a.activeTaskId,y.tokensIn,y.tokensOut,{model:d,agent:i,source:`${i}-transcript:${d}`})}catch{}}}}catch{}if(re({projectId:n.projectId,sessionId:t.session_id,directory:s,taskId:a.activeTaskId,goal:a.activeTaskDescription,tokensIn:a.transcriptUsage?.tokensIn,tokensOut:a.transcriptUsage?.tokensOut,agent:i,model:u}),o&&t.transcript_path)try{await Ue(s,t.transcript_path,t.session_id??null,{preloadedConfig:n,preloadedLines:a.transcriptLines})}catch{}if(o){try{await Re(s,n)}catch{}try{await ye(s,n)}catch{}try{let l=await ve(n.projectId);await Te(n.projectId,l),P.pruneRetained(n.projectId)}catch{}}if(o&&t.transcript_path)try{let l=await le(s,t.transcript_path,t.session_id??null,{preloadedLines:a.transcriptLines,runtime:i,model:u});for(let p of l.failures)try{P.record(n.projectId,{source:"friction-detector",runtime:i,model:u,sessionId:t.session_id??null,taskId:a.activeTaskId??null,...p})}catch{}l.signalsRecorded>0&&a.activeTaskId&&L.penalizeSurfaced(n.projectId,a.activeTaskId)}catch{}if(o&&t.transcript_path)try{let l=await Pe(s,t.transcript_path,t.session_id??null,{preloadedLines:a.transcriptLines,runtime:i,model:u});for(let p of l.failures)try{P.record(n.projectId,{source:"skill-miss-detector",runtime:i,model:u,sessionId:t.session_id??null,taskId:a.activeTaskId??null,...p})}catch{}}catch{}if(o)try{await V.backfill(n.projectId,n,new Date().toISOString())}catch{}if(o&&a.activeTaskId){try{let{synthesizeLandHandoff:l}=await import("./land-synthesis-
|
|
17
|
+
`).map(o=>o.trim()).filter(Boolean);if(n.some(o=>Fe.some(a=>a.re.test(o)))&&n.length>1)for(let o of n)t.push(o);else t.push(s)}return t}c(fr,"splitParagraphs");function Je(r){return rr.createHash("sha256").update(r.toLowerCase().trim()).digest("hex").slice(0,16)}c(Je,"hashContent");function gr(r){let e=new Set;try{let{prjctDb:t}=(R(),T(I)),{REMEMBER_EVENT_RANGE:s}=(Qe(),T(Ve)),n=t.query(r,"SELECT data FROM events WHERE type >= ? AND type < ? ORDER BY id DESC LIMIT 500",...s);for(let i of n){let o=(()=>{try{return JSON.parse(i.data)}catch{return null}})();if(!o||typeof o!="object")continue;let a=o.tags;if(!a||a.source!==$e)continue;let u=a.hash;typeof u=="string"&&e.add(u)}}catch{}return e}c(gr,"collectExistingAutoHashes");var F=600*1e3,_=new Map;function mr(r){let e=r.replace(/[^a-zA-Z0-9._-]/g,"_");return We.join(te.runDir(),`stop-heavy-${e}.stamp`)}c(mr,"heavyStepStampPath");async function Xe(r,e,t=!0){if(await k.stat(r).then(i=>e-i.mtimeMs<F).catch(()=>!1))return!1;let n=`${r}.lock`;try{await k.mkdir(n)}catch(i){if(i.code!=="EEXIST")throw i;return!await k.stat(n).then(a=>e-a.mtimeMs>=F).catch(()=>!1)||!t?!1:(await k.rmdir(n).catch(()=>{}),Xe(r,e,!1))}try{return await k.stat(r).then(o=>e-o.mtimeMs<F).catch(()=>!1)?!1:(await k.writeFile(r,String(e)),!0)}finally{await k.rmdir(n).catch(()=>{})}}c(Xe,"claimHeavyStep");async function hr(r){let e=Date.now(),t=_.get(r)??0;if(e-t<F)return!1;try{let s=mr(r);await k.mkdir(We.dirname(s),{recursive:!0});let n=await Xe(s,e);return _.size>32&&_.clear(),_.set(r,e),n}catch{}return _.size>32&&_.clear(),_.set(r,e),!0}c(hr,"heavyStepsDue");function Ln(r=process.cwd(),e){return ne({event:"Stop",projectPath:r,afterEmit:c(async(t,s)=>{let n=await S.readConfig(s).catch(()=>null);if(!n?.projectId)return;let i=ge(),o=await hr(n.projectId),a={};if(o&&t.transcript_path){let l=await k.readFile(t.transcript_path,"utf-8").catch(()=>null);l!==null&&(a.transcriptLines=v(l))}let u=se(a.transcriptLines??[]);if(o)try{let{collectActiveTasks:l}=await import("./task-overview-6ZQKJGSH.mjs"),p=await l(n.projectId,s);a.activeTaskId=p.current?.id,a.activeTaskDescription=p.current?.description,a.activeTaskStartedAt=p.current?.startedAt}catch{}if(a.transcriptLines&&a.transcriptLines.length>0)try{if(a.transcriptUsage=G(a.transcriptLines),a.transcriptUsage.tokensIn+a.transcriptUsage.tokensOut>0){let l=a.activeTaskStartedAt?{sinceIso:a.activeTaskStartedAt}:void 0,p=G(a.transcriptLines,l);if(a.activeTaskId&&p.tokensIn+p.tokensOut>0){B(n.projectId,a.activeTaskId,p.tokensIn,p.tokensOut,{description:a.activeTaskDescription,agent:i,source:`${i}-transcript`});try{let{sumTranscriptUsageByModel:m}=await import("./transcript-jsonl-6X4DDD6R.mjs");for(let[d,y]of m(a.transcriptLines,l))y.tokensIn+y.tokensOut<=0||B(n.projectId,a.activeTaskId,y.tokensIn,y.tokensOut,{model:d,agent:i,source:`${i}-transcript:${d}`})}catch{}}}}catch{}if(re({projectId:n.projectId,sessionId:t.session_id,directory:s,taskId:a.activeTaskId,goal:a.activeTaskDescription,tokensIn:a.transcriptUsage?.tokensIn,tokensOut:a.transcriptUsage?.tokensOut,agent:i,model:u}),o&&t.transcript_path)try{await Ue(s,t.transcript_path,t.session_id??null,{preloadedConfig:n,preloadedLines:a.transcriptLines})}catch{}if(o){try{await Re(s,n)}catch{}try{await ye(s,n)}catch{}try{let l=await ve(n.projectId);await Te(n.projectId,l),P.pruneRetained(n.projectId)}catch{}}if(o&&t.transcript_path)try{let l=await le(s,t.transcript_path,t.session_id??null,{preloadedLines:a.transcriptLines,runtime:i,model:u});for(let p of l.failures)try{P.record(n.projectId,{source:"friction-detector",runtime:i,model:u,sessionId:t.session_id??null,taskId:a.activeTaskId??null,...p})}catch{}l.signalsRecorded>0&&a.activeTaskId&&L.penalizeSurfaced(n.projectId,a.activeTaskId)}catch{}if(o&&t.transcript_path)try{let l=await Pe(s,t.transcript_path,t.session_id??null,{preloadedLines:a.transcriptLines,runtime:i,model:u});for(let p of l.failures)try{P.record(n.projectId,{source:"skill-miss-detector",runtime:i,model:u,sessionId:t.session_id??null,taskId:a.activeTaskId??null,...p})}catch{}}catch{}if(o)try{await V.backfill(n.projectId,n,new Date().toISOString())}catch{}if(o&&a.activeTaskId){try{let{synthesizeLandHandoff:l}=await import("./land-synthesis-HBPIXP5S.mjs");await l({projectId:n.projectId,projectPath:s,cycleDescription:a.activeTaskDescription??null,cycleId:a.activeTaskId,tokensIn:a.transcriptUsage?.tokensIn,tokensOut:a.transcriptUsage?.tokensOut,model:u})}catch{}try{let{synthesizeJudgmentReceipt:l}=await import("./judgment-receipt-HTNEOJLT.mjs");await l({projectId:n.projectId,projectPath:s,cycleDescription:a.activeTaskDescription??null,cycleId:a.activeTaskId,tokensIn:a.transcriptUsage?.tokensIn,tokensOut:a.transcriptUsage?.tokensOut,model:u})}catch{}}try{let{flushIfLinked:l}=await import("./auto-flush-QZ3YIQP6.mjs");await l(s,n)}catch{}},"afterEmit")},e)}c(Ln,"runStopHook");export{mr as heavyStepStampPath,hr as heavyStepsDue,Ln as runStopHook};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{b as a}from"./chunk-
|
|
8
|
+
import{b as a}from"./chunk-HX42HFII.mjs";import"./chunk-45I2C2UB.mjs";import{c as i}from"./chunk-L4COZ7ZH.mjs";import"./chunk-4KY2EHXS.mjs";import"./chunk-3X7TBM4A.mjs";import"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-ZZ65CN5F.mjs";import"./chunk-WSFHSXBZ.mjs";import"./chunk-OL6ITIAZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import{b as n}from"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import{d as e,g as m}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";m();function l(c=process.cwd(),p){return i({event:"SubagentStart",projectPath:c,build:o((u,t)=>a(t),"build"),afterEmit:o(async(u,t)=>{try{let r=await n.readConfig(t);if(!r?.projectId)return;let{collectActiveTasks:s}=await import("./task-overview-6ZQKJGSH.mjs"),d=await s(r.projectId,t);e.appendEvent(r.projectId,"subagent.spawned",{taskId:d.current?.id??null})}catch{}},"afterEmit")},p)}o(l,"runSubagentStartHook");export{l as runSubagentStartHook};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{a as f,b as p}from"./chunk-X5RDLFPM.mjs";import{c as s}from"./chunk-L4COZ7ZH.mjs";import{a}from"./chunk-ZX2KFQV5.mjs";import{b as c}from"./chunk-NWY5M34K.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as r}from"./chunk-
|
|
8
|
+
import{a as f,b as p}from"./chunk-X5RDLFPM.mjs";import{c as s}from"./chunk-L4COZ7ZH.mjs";import{a}from"./chunk-ZX2KFQV5.mjs";import{b as c}from"./chunk-NWY5M34K.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as r}from"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";function w(u=process.cwd(),g){return s({event:"SubagentStop",projectPath:u,afterEmit:i(async(d,n)=>{let o=await r.readConfig(n).catch(()=>null);if(!o?.projectId||f(o)==="off")return;let e=[];try{let t=await a(o.projectId,n);t.current&&e.push(`active: ${t.current.description}`)}catch{}try{let t=await c.getActiveTasks(o.projectId);t.length>0&&e.push(`pending: ${t.length}`)}catch{}await p("prjct \u2014 subagent finished",e.join(" \xB7 ")||"A subagent finished")},"afterEmit")},g)}i(w,"runSubagentStopHook");export{w as runSubagentStopHook};
|
package/dist/bin/hook-chunks/{surface-attribution-PDYR6DVA.mjs → surface-attribution-BDKFYUOJ.mjs}
RENAMED
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{a}from"./chunk-
|
|
8
|
+
import{a}from"./chunk-MAHTF6JG.mjs";import"./chunk-ZZ65CN5F.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as recordSurfacedForActiveTask};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i}from"./chunk-
|
|
8
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i}from"./chunk-7JE6VTLN.mjs";import"./chunk-5PEHJEFE.mjs";import"./chunk-Q5I2UPD6.mjs";import"./chunk-PSSR7LSW.mjs";import"./chunk-2HTDCLZD.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-CPHUFXD2.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-2OU2MKNS.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-4DDCWMI6.mjs";import"./chunk-WSFHSXBZ.mjs";import"./chunk-OL6ITIAZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{e as TASK_CONTEXT_PROMPT,h as completeActiveTask,a as formatRelatedContextForAgent,b as formatRiskForAgent,i as readLastStatus,d as recallRisksForFiles,g as resolveActiveTask,f as setTaskStatus,c as startTask};
|
|
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{a as c}from"./chunk-
|
|
8
|
+
import{a as c}from"./chunk-NLDL3N6R.mjs";import{a as D,b as l,d as T}from"./chunk-S4TB2OFJ.mjs";import{a as u}from"./chunk-PSSR7LSW.mjs";import{a as d}from"./chunk-2HTDCLZD.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as a}from"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{a as h,o as y}from"./chunk-CTWZQ7YI.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import{e as f,f as w}from"./chunk-BUDZL4DW.mjs";import{a as m}from"./chunk-E66B27AL.mjs";w();y();var i=["off","assist","strict"],C=class extends T{static{m(this,"TddCommands")}async tdd(s=null,e=process.cwd(),r={}){let t=((s??"").trim().split(/\s+/).filter(Boolean)[0]??"").toLowerCase();return!t||t==="status"||t==="show"?this.showStatus(e,r):i.includes(t)?this.setMode(t,e,r):t==="check"?this.check(e,r):D(`Unknown tdd subcommand "${t}". Use: check, or ${i.join("|")}.`,r)}async showStatus(s,e){let r=await a.readConfig(s).catch(()=>null);if(!r?.projectId)return l("No prjct project here \u2014 run `prjct init` first.",e);let o=M(r),n=(await u(s).catch(()=>null))?.test?.command??null,g=[`Mode: ${o}${o==="off"?" (guidance + ship TDD gate dormant)":""}`,`Test command: ${n??"none detected (add tests to enable the gate)"}`,"Set: prjct tdd off|assist|strict","Check: prjct tdd check \u2014 run the test command now (red/green)"];return e.md?console.log(c("## TDD",`> **Mode**: \`${o}\``,`- Test command: \`${n??"none detected"}\``,g.slice(2).join(`
|
|
9
9
|
`))):d.info(`TDD \u2014 ${g.join(`
|
|
10
10
|
`)}`),{success:!0,mode:o,testCommand:n}}async setMode(s,e,r){let o=await a.readConfig(e).catch(()=>null);if(!o?.projectId)return l("No prjct project here \u2014 run `prjct init` first.",r);o.tdd={mode:s},await a.writeConfig(e,o);let t=s==="off"?"TDD mode off \u2014 test-first guidance and the ship TDD gate are dormant.":s==="assist"?"TDD mode \u2192 assist. Guidance biases test-first (red\u2192green\u2192refactor); `ship` reminds.":"TDD mode \u2192 strict. Test-first expected; `ship` surfaces a hard gate \u2014 run `prjct tdd check` and don't ship on red.";return r.md?console.log(c("## TDD",`> ${t}`)):d.done(t),{success:!0,mode:s}}async check(s,e){let o=(await u(s).catch(()=>null))?.test?.command;if(!o){let t="tdd check: no test command detected for this stack. Add a test script first.";return console.log(e.md?c("## TDD check",`> ${t}`):t),{success:!1,reason:"no_test_command"}}try{await h(o,{cwd:s,maxBuffer:32*1024*1024});let t=`tdd check: GREEN \u2014 \`${o}\` passed.`;return console.log(e.md?c("## TDD check",`> \u2705 ${t}`):t),{success:!0,green:!0,testCommand:o}}catch(t){let n=`tdd check: RED \u2014 \`${o}\` failed. Fix before shipping.`;return e.md?console.log(c("## TDD check",`> \u274C ${n}`,f(t))):(d.fail(n),d.info(f(t))),{success:!1,green:!1,testCommand:o}}}};function M(p){let s=p?.tdd?.mode;if(s&&i.includes(s))return s;let e=process.env.PRJCT_TDD_MODE?.toLowerCase();return e&&i.includes(e)?e:"off"}m(M,"effectiveTddMode");var _={effectiveTddMode:M,TDD_MODES:i};export{C as TddCommands,_ as _internal,M as effectiveTddMode};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{b as a,c as b,d as c,e as d}from"./chunk-
|
|
8
|
+
import{b as a,c as b,d as c,e as d}from"./chunk-ZNQXFWSI.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{d as default,b as getTemplateContent,c as listTemplates,a as resetBundle};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{h as a,i as b,j as c,k as d,l as e}from"./chunk-
|
|
8
|
+
import{h as a,i as b,j as c,k as d,l as e}from"./chunk-TBM7736J.mjs";import"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as conflictModeWithWeakModel,a as effectiveWeakModelMode,c as qualityFloorWithWeakModel,d as weakModelBanner,e as weakModelOneLiner};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{c as a,d as b,e as c,f as d,g as e,h as f}from"./chunk-
|
|
8
|
+
import{c as a,d as b,e as c,f as d,g as e,h as f}from"./chunk-CPHUFXD2.mjs";import"./chunk-2OU2MKNS.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-4DDCWMI6.mjs";import"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{c as extractFilePathsFromEntries,d as formatWorkScopeBlock,f as isUsefulScopePath,b as resolveWorkScope,a as resolveWorkScopeSync,e as toLikelyFileHits};
|