@autonomos/cli 0.7.1 ā 0.8.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/README.md +29 -0
- package/dist/index.mjs +49 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -48,9 +48,38 @@ content. Drift is reported with the affected paths and can be repaired with
|
|
|
48
48
|
`autonomos update`; artifacts from other protocol versions are reported as
|
|
49
49
|
unverifiable rather than incorrectly judged against the current release.
|
|
50
50
|
|
|
51
|
+
It also reports context-budget findings: closed records left in `TASKS.md` or
|
|
52
|
+
`ISSUES.md`, oversized registries, task entries, `AGENT.md` files and worklogs, and
|
|
53
|
+
an outdated artifact format. They are advisory; `--strict` exits non-zero.
|
|
54
|
+
|
|
51
55
|
```bash
|
|
52
56
|
autonomos status
|
|
53
57
|
autonomos status --history
|
|
58
|
+
autonomos status --strict
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `close`
|
|
62
|
+
|
|
63
|
+
Move finished records out of current context into `.autonomos/archive/closed/`.
|
|
64
|
+
A task must be `[x]` (a `Completed:` date is added when missing) unless
|
|
65
|
+
`--abandoned "<reason>"` is given; an issue must be resolved, declined, closed or
|
|
66
|
+
superseded. Entries move intact and their relative links are repaired.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
autonomos close PROTO-15 ISSUE-05
|
|
70
|
+
autonomos close SPIKE-02 --abandoned "superseded by PROTO-15"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### `migrate`
|
|
74
|
+
|
|
75
|
+
Upgrade project records to the current artifact format, content-preserving and
|
|
76
|
+
idempotent. Format 1 ā 2 moves closed records to `archive/closed/`, quarantines
|
|
77
|
+
existing worklogs in `archive/worklogs-format-1/`, repairs Markdown references and
|
|
78
|
+
records `artifactFormat`. Run `--dry-run` first on a clean working tree.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
autonomos migrate --dry-run
|
|
82
|
+
autonomos migrate
|
|
54
83
|
```
|
|
55
84
|
|
|
56
85
|
### `agents`
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as e}from"commander";import t from"picocolors";import{AGENT_FILE as n,
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`),
|
|
6
|
-
`),
|
|
7
|
-
`)
|
|
2
|
+
import{Command as e}from"commander";import t from"picocolors";import{AGENT_FILE as n,ARCHIVE_DIR as r,ARCHIVE_INDEX_FILE as i,ARTIFACT_FORMAT as a,AUTONOMOS_DIR as o,CLOSED_DIR as s,ISSUES_FILE as c,LEGACY_WORKLOGS_DIR as l,MANIFEST_FILE as u,PROTOCOL_FILE as d,PROTOCOL_TEMPLATE as f,PROTOCOL_VERSION as p,TASKS_FILE as m,TASKS_TEMPLATE as h,WORKLOGS_DIR as g,appendToClosedRegistry as _,checkContextBudgets as v,createManifest as y,dedentEntry as b,displayRelative as x,extractIssues as S,extractTasks as C,findAncestorAgents as w,findProjectRoot as T,generateAgentTemplate as ee,generateManifestContent as E,isClosedIssueStatus as D,isSamePath as O,listHarnesses as k,manifestArtifactFormat as A,parseIssueEntries as te,parseManifest as j,parseTaskEntries as ne,prefixMapper as re,readTaskRegistry as ie,relocateLinks as M,relocateRootMentions as ae,resolveTargets as N,stampAbandoned as oe,stampCompleted as se}from"@autonomos/core";import{existsSync as P,lstatSync as ce,mkdirSync as F,readFileSync as I,readdirSync as L,renameSync as le,rmSync as ue,rmdirSync as de,statSync as R,unlinkSync as fe,writeFileSync as z}from"node:fs";import{basename as pe,dirname as B,join as V,relative as H,resolve as U,sep as me}from"node:path";import{checkbox as he,confirm as ge}from"@inquirer/prompts";import{fileURLToPath as _e}from"node:url";function ve(e,t,r=0){let i=[],a=V(e,n);P(a)&&i.push({path:a,relativePath:H(t,a)||n,depth:r});try{let n=L(e);for(let a of n){if(a.startsWith(`.`)||a===`node_modules`||a===`dist`||a===`build`)continue;let n=V(e,a);try{R(n).isDirectory()&&i.push(...ve(n,t,r+1))}catch{}}}catch{}return i}function ye(e,t){if(e.length===0)return` (no AGENT.md files found)`;let r=pe(t),i={name:r,isAgent:!1,children:{}};for(let t of e){let e=t.relativePath.split(`/`),r=i;for(let t of e){let e=t===n,i=r.children[t];i||(i={name:t,isAgent:e,children:{}},r.children[t]=i),r=i}}let a=[];a.push(`š ${r}/`);function o(e,t=``,n=!0){let r=Object.values(e.children);r.sort((e,t)=>!e.isAgent&&t.isAgent?-1:e.isAgent&&!t.isAgent?1:e.name.localeCompare(t.name)),r.forEach((e,n)=>{let i=n===r.length-1,s=i?`āāā `:`āāā `,c=e.isAgent?`š`:`š`,l=e.isAgent?e.name:`${e.name}/`;a.push(`${t}${s}${c} ${l}`),e.isAgent||o(e,t+(i?` `:`ā `),i)})}return o(i),a.join(`
|
|
3
|
+
`)}function be(e){return e.length===0?` (no AGENT.md files found in the ancestor chain)`:e.map((t,n)=>` ${(n+1).toString().padStart(e.length.toString().length,` `)}. ${t.relativeDir===`.`?`./AGENT.md`:`${t.relativeDir}/AGENT.md`}`).join(`
|
|
4
|
+
`)}function xe(e={}){let t=e.cwd??process.cwd();if(e.target){let n=T(t)??t,r;try{r=w(U(t,e.target),n)}catch(e){return{success:!1,message:`Failed to look up ancestors: ${e instanceof Error?e.message:String(e)}`,mode:`ancestors`}}let i=be(r);return{success:!0,message:`Found ${r.length} ancestor AGENT.md file(s) for "${e.target}" (root ā target):\n${i}`,count:r.length,ancestors:r,mode:`ancestors`}}let n;if(e.all){let e=T(t);if(!e)return{success:!1,message:`Could not find project root (.autonomos or .git directory).`,mode:`tree`};n=e}else n=t;let r=ve(n,n);if(r.length===0)return{success:!0,message:`No AGENT.md files found.`,count:0,mode:`tree`};let i=ye(r,n);return{success:!0,message:`Found ${r.length} AGENT.md file(s)`,tree:i,count:r.length,mode:`tree`}}var W=`0.8.0`;const G=[`protocol-session.md`,`protocol-task.md`,`protocol-crystallize.md`,`protocol-issue.md`,`protocol-adopt.md`,`protocol-reconcile.md`,`protocol-design.md`];function Se(e=import.meta.url){let t=_e(e);return[U(t,`..`,`..`,`..`,`core`,`src`,`workflows`),U(t,`..`,`..`,`..`,`core`,`dist`,`workflows`),U(t,`..`,`..`,`..`,`..`,`core`,`dist`,`workflows`)]}function K(){let e=Se();for(let t of e)if(P(t))return t;throw Error(`Could not locate the workflows directory inside @autonomos/core`)}function q(e,t){return e.replace(/^protocol-/,``).replace(/\.[^.]+$/,``)+t}function J(e,t=G){return t.map(t=>{if(e.kind===`skill`){let n=V(t.replace(/\.[^.]+$/,``),`SKILL.md`);return{sourceFilename:t,relativeTargetFilePath:n,destinationPath:V(e.path,n)}}let n=q(t,e.fileExtension);return{sourceFilename:t,relativeTargetFilePath:n,destinationPath:V(e.path,n)}})}function Ce(e,t){if(t!==p)return{state:`unverifiable`,driftedFiles:[]};let n=[];we(V(e,o,d),f,e,n);let r=K(),i=N(k().map(({id:e})=>e),e),a=V(e,`.agent`,`workflows`);P(a)&&i.push({path:a,fileExtension:`.md`,kind:`flat`,usedBy:[`antigravity-legacy`]});for(let t of i){let i=J(t,G).map(e=>({source:I(V(r,e.sourceFilename),`utf-8`),destination:e.destinationPath}));if(i.some(({destination:e})=>P(e)))for(let t of i)we(t.destination,t.source,e,n)}return{state:n.length===0?`valid`:`drifted`,driftedFiles:n}}function we(e,t,n,r){(!P(e)||I(e,`utf-8`)!==t)&&r.push(H(n,e))}const Te=W;async function Ee(){return he({message:`Which AI harnesses do you want to install the protocol for? (space to toggle, enter to confirm)`,choices:k().map(({id:e,harness:t})=>({name:t.name,value:e,checked:t.preferred}))})}async function De(e,t){let n=[],r=T(e);if(!r)return P(V(e,`.git`))||n.push("No Git repository detected. Consider running `git init` first."),{installDir:e,warnings:n};if(O(r,e))return{installDir:e,warnings:n};let i=x(e,r);return t.force||process.env.AUTONOMOS_FORCE===`1`?(n.push(`Detected project root at ${x(r,e)} (AUTONOMOS_FORCE=1); installing there instead of "${i}".`),{installDir:r,warnings:n}):t.isInteractive&&!t.noPrompt?await ge({message:`You're inside a project rooted at ${r}.\nThe protocol should be installed at the project root, not in "${i}".\nInstall at the project root instead?`,default:!0})?(n.push(`Detected project root above "${i}"; installing at ${r}.`),{installDir:r,warnings:n}):{installDir:e,warnings:n,abort:{message:`Aborted: refusing to install Autonomos inside a subdirectory. Run the command from ${r} (or pass --force / set AUTONOMOS_FORCE=1).`}}:{installDir:e,warnings:n,abort:{message:`Cannot initialize Autonomos from a subdirectory.\n Current directory : ${e}\n Detected root : ${r}\nRe-run from the project root, or pass --force (or set AUTONOMOS_FORCE=1) to install here anyway.`}}}async function Oe(e={}){let t=e.cwd??process.cwd(),r=e.dryRun??!1,i=e.interactiveOverride??(process.stdin.isTTY===!0&&!e.dryRun),a=await De(t,{force:e.force??!1,noPrompt:e.noPrompt??!1,isInteractive:i});if(a.abort)return{success:!1,message:a.abort.message,created:[],warnings:a.warnings,dryRun:r};let s=a.installDir,c=[...a.warnings],l=[],_=[],v=V(s,`package.json`),b=P(v)&&R(v).isFile(),x=V(s,o),S=P(x),C;if(C=e.all?k().map(({id:e})=>e):e.harnesses&&e.harnesses.length>0?e.harnesses:e.noPrompt||e.dryRun?[]:await Ee(),S&&C.length===0)return{success:!1,message:`Project already initialized with Protocol v${p}. Use \`autonomos update\` to update, or specify harnesses with --harness to install workflow files.`,created:[],warnings:[],dryRun:r};let w=N(C,s);if(r){S?(l.push(`${o}/${u} (update)`),l.push(`${o}/${d} (update)`)):(l.push(o),l.push(`${o}/${g}`),l.push(`${o}/${u}`),l.push(`${o}/${d}`),l.push(`${o}/${m}`)),P(V(s,n))?c.push(`${n} already exists, would skip.`):l.push(n);for(let e of w)for(let t of J(e,G))_.push(t.destinationPath);return{success:!0,message:`Would ${S?`update workflows in`:`initialize`} project with Agent Protocol v${p}${C.length?` (harnesses: ${C.join(`, `)})`:``}`,created:l,warnings:c,dryRun:!0,harnessFiles:_}}P(x)||(F(x,{recursive:!0}),l.push(o));let T=V(x,g);P(T)||(F(T,{recursive:!0}),l.push(`${o}/${g}`));let D=y(Te);z(V(x,u),E(D)),l.push(`${o}/${u}`),z(V(x,d),f),l.push(`${o}/${d}`);let O=V(x,m);P(O)?c.push(`${m} already exists, skipping.`):(z(O,h),l.push(`${o}/${m}`));let A=V(s,n);if(P(A)?c.push(`${n} already exists, skipping.`):(z(A,ee(s.split(`/`).pop()??`Project`)),l.push(n)),b)try{let t=I(v,`utf-8`),n=JSON.parse(t),r=!!n.scripts?.autonomos,i=n.devDependencies?.[`@autonomos/cli`],a=`^${Te}`;n.scripts||={},e.noInstall||e.dryRun?(n.scripts.autonomos=`npx --yes @autonomos/cli`,z(v,JSON.stringify(n,null,4)+`
|
|
5
|
+
`),l.push(`package.json (scripts.autonomos via npx)`),r||c.push('Added "autonomos" npm script using npx (--no-install mode). Run `npm install` when ready.')):(n.scripts.autonomos=`autonomos`,n.devDependencies||={},n.devDependencies[`@autonomos/cli`]=a,z(v,JSON.stringify(n,null,4)+`
|
|
6
|
+
`),l.push(`package.json (scripts.autonomos + devDependencies.@autonomos/cli)`),!r&&!i?c.push('Added "autonomos" npm script and @autonomos/cli devDependency. Run `npm install` to install.'):i&&i!==a?c.push(`Bumped @autonomos/cli devDependency: ${i} ā ${a}. Run \`npm install\` to apply.`):!r&&i&&c.push(`Added "autonomos" npm script (devDependency was already set).`))}catch{c.push(`Could not update package.json (invalid JSON or read error).`)}let te=K();for(let e of w)for(let t of J(e,G)){F(B(t.destinationPath),{recursive:!0});let e=I(V(te,t.sourceFilename),`utf-8`);z(t.destinationPath,e),_.push(t.destinationPath)}return{success:!0,message:`Project initialized with Agent Protocol v${p}${C.length>0?` for harnesses: ${C.join(`, `)}`:` (no harness workflows installed)`}`,created:l,warnings:c,dryRun:!1,harnessFiles:_}}function ke(e){let t=T(e)??e,n=V(t,o),a=V(n,r),d=V(a,s);return{root:t,autonomos:n,manifest:V(n,u),tasks:V(n,m),issues:V(n,c),closedDir:d,closedTasks:V(d,m),closedIssues:V(d,c),worklogs:V(n,g),legacyWorklogs:V(a,l),archiveIndex:V(a,i)}}function Ae(){return new Date().toISOString().slice(0,10)}function Y(e){return P(e)?I(e,`utf8`):void 0}function je(e){if(!P(e.manifest))return"Project not initialized. Run `autonomos init` first.";try{return j(I(e.manifest,`utf8`))}catch{return`Could not read manifest.json`}}var Me=class{writes=new Map;renames=[];deletes=new Set;read(e){return this.writes.get(e)??(this.deletes.has(e)?void 0:Y(e))}write(e,t){Y(e)===t&&!this.writes.has(e)||this.writes.set(e,t)}apply(){for(let{from:e,to:t}of this.renames)F(B(t),{recursive:!0}),le(e,t);for(let[e,t]of this.writes)F(B(e),{recursive:!0}),z(e,t);for(let e of this.deletes)P(e)&&fe(e)}};function Ne(e,t,n,r,i={}){let a={tasks:[],issues:[]},o=e=>M(e,t.autonomos,t.closedDir,i.mapPath),s=e.read(t.tasks);if(s!==void 0){let{remaining:r,moved:c}=C(s,e=>n(e.id,e.status));if(c.length){e.write(t.tasks,r);let n=e.read(t.closedTasks),s=new Map;for(let e of c){a.tasks.push(e.id);let t=b(e.text);i.transformTask&&(t=i.transformTask(t,e.status));let n=i.groupByHeading?o(`${[`From TASKS.md`,...e.headings].join(` āŗ `)} (moved ${i.groupByHeading})`):``;s.set(n,[...s.get(n)??[],o(t)])}for(let[e,t]of s)n=_(n,`tasks`,t,e||void 0);e.write(t.closedTasks,n??``)}}let c=e.read(t.issues);if(c!==void 0){let{remaining:n,moved:s}=S(c,e=>r(e.id,e.status));if(s.length){e.write(t.issues,n);let r=i.groupByHeading?`From ISSUES.md (moved ${i.groupByHeading})`:void 0;e.write(t.closedIssues,_(e.read(t.closedIssues),`issues`,s.map(e=>o(e.text)),r)),a.issues.push(...s.map(e=>e.id))}}return a}function Pe(e){let t=ke(e.cwd??process.cwd()),n=e=>({success:!1,message:e,closedTasks:[],closedIssues:[]}),r=je(t);if(typeof r==`string`)return n(r);let i=[...new Set(e.ids.map(e=>e.trim()).filter(Boolean))];if(!i.length)return n(`Provide at least one task or issue ID.`);let a=e.date??Ae(),o=ne(Y(t.tasks)??``),s=te(Y(t.issues)??``),c=[];for(let n of i){let r=o.find(e=>e.id===n),i=s.find(e=>e.id===n);if(!r&&!i){let e=`${Y(t.closedTasks)??``}\n${Y(t.closedIssues)??``}`;c.push(e.includes(`[${n}]`)?`${n} is already closed.`:`${n} is not in the current TASKS.md or ISSUES.md.`);continue}r&&r.status!==`x`&&!e.abandoned&&c.push(`${n} is not marked [x]; complete it first or pass --abandoned "<reason>".`),r&&o.some(e=>e.start>r.start&&e.start<r.end&&e.status!==`x`)&&c.push(`${n} has open nested tasks; close or move them first.`),!r&&i&&!D(i.status)&&c.push(`${n} has status "${i.status||`unknown`}"; set it to resolved or declined first.`)}if(c.length)return n(c.join(`
|
|
7
|
+
`));let l=new Me,u=new Set(i),d=Ne(l,t,e=>u.has(e),e=>u.has(e)&&!o.some(t=>t.id===e),{transformTask:(t,n)=>n===`x`?se(t,a):oe(t,a,e.abandoned??`abandoned`)});e.dryRun||l.apply();let f=[...d.tasks,...d.issues];return{success:!0,message:`${e.dryRun?`Would close`:`Closed`} ${f.join(`, `)} ā ${H(t.root,t.closedDir)}/`,closedTasks:d.tasks,closedIssues:d.issues}}const Fe=new Set([`node_modules`,`dist`,`build`,`coverage`]);function Ie(e){let t=[],n=e=>{for(let r of L(e,{withFileTypes:!0})){let i=V(e,r.name);r.isDirectory()?n(i):r.isFile()&&t.push(i)}};return P(e)&&n(e),t}function Le(e){let t=[],n=e=>{let r;try{r=L(e,{withFileTypes:!0})}catch{return}for(let i of r){let r=V(e,i.name);if(i.isDirectory()){if(Fe.has(i.name)||i.name.startsWith(`.`)&&i.name!==o)continue;n(r)}else i.isFile()&&/\.mdx?$/.test(i.name)&&t.push(r)}};return n(e),t}function X(e){for(let t of L(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let n=V(e,t.name);X(n),L(n).length===0&&de(n)}}function Z(e){return e.split(me).join(`/`)}function Re(e={}){let t=ke(e.cwd??process.cwd()),n={closedTasks:[],closedIssues:[],movedWorklogs:0,rewrittenFiles:[],findings:[]},r=je(t);if(typeof r==`string`)return{success:!1,message:r,...n};if(ce(t.autonomos).isSymbolicLink())return{success:!1,message:`Refusing to migrate a symbolic .autonomos directory.`,...n};let i=A(r),o=e.date??Ae(),c=new Me,u=Buffer.byteLength(Y(t.tasks)??``),d=Buffer.byteLength(Y(t.issues)??``),f=i<a?Ie(t.worklogs).filter(e=>!e.endsWith(`${me}.gitkeep`)):[],p=f.filter(e=>P(V(t.legacyWorklogs,H(t.worklogs,e))));if(p.length)return{success:!1,message:`Cannot move worklogs; already present in ${H(t.root,t.legacyWorklogs)}: ${p.map(e=>H(t.worklogs,e)).join(`, `)}`,...n};let m=f.length?re(t.worklogs,t.legacyWorklogs):e=>e,h=new Set(f.map(e=>Z(H(t.worklogs,e)))),g=Z(H(t.root,t.worklogs)),_=Z(H(t.root,t.legacyWorklogs));for(let e of f){let t=m(e);/\.mdx?$/.test(e)?(c.write(t,M(I(e,`utf8`),B(e),B(t),m)),c.deletes.add(e)):c.renames.push({from:e,to:t})}let y=Ne(c,t,(e,t)=>t===`x`,(e,t)=>D(t),{mapPath:m,groupByHeading:o}),b=[...c.writes.keys()],x=new Set([...Le(t.root).filter(e=>!c.deletes.has(e)),...b.filter(e=>/\.mdx?$/.test(e))]);for(let e of x){let t=c.read(e);if(t===void 0)continue;let n=f.length?M(t,B(e),B(e),m):t;h.size&&(n=ae(n,g,_,h)),n!==t&&c.write(e,n)}let S=[...c.writes.keys()].filter(e=>P(e)&&!f.includes(e)).map(e=>H(t.root,e)).sort(),C=[];if((y.tasks.length||y.issues.length||P(t.closedDir))&&C.push(`- \`${s}/\` ā closed tasks and issues, appended when work closes (artifact format 2). Search by ID.`),f.length&&C.push(`- \`${l}/\` ā ${f.length} files written before artifact format 2, moved on ${o}. Historical evidence only; not a model for new worklogs.`),C.length){let e=c.read(t.archiveIndex)??`# Archive index
|
|
8
|
+
|
|
9
|
+
> Project history, searched by topic or ID only when a question requires it. Not startup context.
|
|
10
|
+
`,n=C.filter(t=>!e.includes(t.slice(0,t.indexOf(`ā`))));n.length&&(e=e.replace(/\s*$/,`
|
|
11
|
+
`)+`
|
|
12
|
+
`+n.join(`
|
|
13
|
+
`)+`
|
|
14
|
+
`,c.write(t.archiveIndex,e))}i<a&&c.write(t.manifest,E({...r,artifactFormat:a,lastUpdated:new Date().toISOString()})),e.dryRun||(c.apply(),f.length&&(X(t.worklogs),L(t.worklogs).length===0&&z(V(t.worklogs,`.gitkeep`),``)));let w=Buffer.byteLength(c.read(t.tasks)??``),T=Buffer.byteLength(c.read(t.issues)??``),ee=e.dryRun?[]:v(t.root,{artifactFormat:a}).filter(e=>e.code!==`format-outdated`);return{success:!0,message:c.writes.size+c.renames.length+c.deletes.size>0?`${e.dryRun?`Would migrate`:`Migrated`} records from format ${i} to ${a}.`:`Already at artifact format ${a}; nothing to move.`,fromFormat:i,toFormat:a,closedTasks:y.tasks,closedIssues:y.issues,movedWorklogs:f.length,rewrittenFiles:S,bytes:{tasks:[u,w],issues:[d,T]},findings:ee}}function ze(e={}){let t=e.cwd??process.cwd(),n=V(t,o),r=V(n,u);if(P(n)&&!ce(n).isDirectory())return{success:!1,message:`Expected a regular .autonomos directory; symbolic links are not followed.`,initialized:!1};if(!P(r))return{success:!1,message:"Project not initialized. Run `autonomos init` first.",initialized:!1};let i;try{i=j(I(r,`utf-8`))}catch{return{success:!1,message:`Could not read manifest.json`,initialized:!0}}let a,s=ie(t,{history:e.history}),c=e=>({total:e.length,todo:e.filter(e=>e.status===`TODO`).length,inProgress:e.filter(e=>e.status===`IN_PROGRESS`).length,done:e.filter(e=>e.status===`DONE`).length,blocked:e.filter(e=>e.status===`BLOCKED`).length});P(V(n,m))&&(a=c(s.current));let l=Ce(t,i.protocolVersion);return{success:!0,message:`Project status retrieved`,protocolVersion:i.protocolVersion,cliVersion:i.cliVersion,initialized:!0,taskSummary:a,...e.history?{archivedTaskSummary:c(s.archived),historyComplete:s.complete}:{},duplicateTaskIds:s.duplicateIds,warnings:s.warnings,artifactIntegrity:l.state,driftedArtifacts:l.driftedFiles,artifactFormat:A(i),budgetFindings:v(t,{artifactFormat:A(i)})}}const Q=W;function Be(e,t){let n=e=>{let[t=``,n]=e.split(`-`,2);return{parts:t.split(`.`).map(Number),prerelease:n}},r=n(e),i=n(t);for(let e=0;e<3;e++){let t=r.parts[e]??0,n=i.parts[e]??0;if(t<n)return-1;if(t>n)return 1}return r.prerelease===i.prerelease?0:r.prerelease===void 0?1:i.prerelease===void 0?-1:r.prerelease.localeCompare(i.prerelease)}function Ve(e){let t=V(e,`package.json`);if(!P(t))return null;let n;try{n=JSON.parse(I(t,`utf-8`))}catch{return null}let r=`^${Q}`,i=n.devDependencies?.[`@autonomos/cli`];if(i===r)return null;n.devDependencies||={},n.devDependencies[`@autonomos/cli`]=r;try{z(t,JSON.stringify(n,null,4)+`
|
|
15
|
+
`)}catch{return null}return i?`Bumped @autonomos/cli devDependency: ${i} ā ${r}.`:`Added @autonomos/cli devDependency: ${r}.`}function He(e,t,n){if(t.length===0)return[];let r=N(t,e),i=[];for(let e of r)for(let t of J(e,G)){F(B(t.destinationPath),{recursive:!0});let e=I(V(n,t.sourceFilename),`utf-8`);z(t.destinationPath,e),i.push(t.destinationPath)}return i}function Ue(e,t){let n=[],r=V(e,`.agents`,`skills`);if(P(r)){let e=!1;for(let t of G){let n=V(r,q(t,`.md`));if(P(n))try{ue(n,{force:!0}),e=!0}catch{}}if(e){let e={path:r,fileExtension:`.md`,kind:`skill`};for(let n of J(e,G)){F(B(n.destinationPath),{recursive:!0});let e=I(V(t,n.sourceFilename),`utf-8`);z(n.destinationPath,e)}n.push(r)}}let i=V(e,`.agent`,`workflows`);if(P(i)){let r=V(e,`.agents`,`workflows`);F(r,{recursive:!0});let a=!1;for(let e of G){let n=q(e,`.md`),o=I(V(t,e),`utf-8`),s=V(r,n);(!P(s)||I(s,`utf-8`)!==o)&&(z(s,o),a=!0);let c=V(i,n);(!P(c)||I(c,`utf-8`)!==o)&&(z(c,o),a=!0)}a&&(n.includes(r)||n.push(r),n.includes(i)||n.push(i))}let a=V(e,`.claude`,`skills`);if(P(a))for(let e of G){let t=V(a,q(e,`.md`));if(P(t))try{ue(t,{force:!0})}catch{}}let o=N(k().map(({id:e})=>e),e);for(let e of o){if(!P(e.path))continue;let r=J(e,G).map(e=>({source:I(V(t,e.sourceFilename),`utf-8`),dest:e.destinationPath}));if(!r.some(({dest:e})=>P(e)))continue;let i=!1;for(let{source:e,dest:t}of r)(!P(t)||I(t,`utf-8`)!==e)&&(F(B(t),{recursive:!0}),z(t,e),i=!0);i&&!n.includes(e.path)&&n.push(e.path)}return n}function We(e={}){let t=e.cwd??process.cwd(),n=T(t)??t,r=V(n,o),i=V(r,u);if(!P(i))return{success:!1,message:"Project not initialized. Run `autonomos init` first."};let s=j(I(i,`utf-8`)),c=s.protocolVersion,l;try{l=(e.resolveWorkflowsDir??K)()}catch(e){return{success:!1,message:`Cannot update protocol artifacts: ${e instanceof Error?e.message:String(e)}`,previousVersion:c,newVersion:p}}let m=Ve(n),h=Be(c,p);if(h===0){let t=[];try{t=Ue(n,l)}catch(e){console.warn(`Warning: Could not update harness workflows: ${e instanceof Error?e.message:String(e)}`)}let r=He(n,e.all?k().map(({id:e})=>e):e.harnesses??[],l);return(s.cliVersion!==Q||t.length>0||r.length>0)&&z(i,E({...s,cliVersion:Q,lastUpdated:new Date().toISOString()})),{success:!0,message:`Already up to date (Protocol v${p}).${t.length>0?` Refreshed workflows in ${t.join(`, `)}.`:``}${r.length>0?` Installed: ${r.join(`, `)}.`:``}${m?` ${m}`:``}`,previousVersion:c,newVersion:p,touchedHarnesses:[...t,...r]}}if(h>0)return{success:!1,message:`This project uses Protocol v${c}, but your CLI only knows v${p}. Update your CLI with \`npm i -g @autonomos/cli\`.`,previousVersion:c,newVersion:p,cliOutdated:!0};z(V(r,d),f),z(i,E({...s,protocolVersion:p,cliVersion:Q,lastUpdated:new Date().toISOString()}));let g=[];try{g.push(...Ue(n,l))}catch(e){console.warn(`Warning: Could not update harness workflows: ${e instanceof Error?e.message:String(e)}`)}let _=He(n,e.all?k().map(({id:e})=>e):e.harnesses??[],l);return{success:!0,message:`Protocol updated: v${c} ā v${p}${g.length>0?` (updated workflows in ${g.join(`, `)})`:``}${_.length>0?` (installed: ${_.join(`, `)})`:``}${m?` ${m}`:``}${A(s)<a?` Project records still use artifact format ${A(s)}: run \`autonomos migrate --dry-run\`, then \`autonomos migrate\`, then \`/reconcile\` on the reported findings.`:``}`,previousVersion:c,newVersion:p,touchedHarnesses:[...g,..._]}}const Ge=W,$=new e;$.name(`autonomos`).description(t.cyan(`CLI for the Autonomos Agent Protocol
|
|
8
16
|
|
|
9
17
|
The Agent Protocol is a specification for AI agents to interact with codebases
|
|
10
18
|
in a structured, consistent way. It defines how agents should read context,
|
|
11
19
|
execute tasks, and persist knowledge.`)+`
|
|
12
20
|
|
|
13
|
-
Documentation: ${t.underline(`https://github.com/saoudi-h/autonomos`)}`).version(`${t.bold(`CLI:`)} ${t.green(
|
|
21
|
+
Documentation: ${t.underline(`https://github.com/saoudi-h/autonomos`)}`).version(`${t.bold(`CLI:`)} ${t.green(Ge)}\n${t.bold(`Protocol:`)} ${t.green(p)}`,`-v, --version`,`Show version information`).helpOption(`-h, --help`,`Show help information`).addHelpText(`after`,`
|
|
14
22
|
${t.bold(`Examples:`)}
|
|
15
23
|
$ ${t.cyan(`autonomos init`)} Initialize the Agent Protocol in current directory
|
|
16
24
|
$ ${t.cyan(`autonomos update`)} Update Protocol to the latest version
|
|
17
25
|
$ ${t.cyan(`autonomos status`)} Show project status and task summary
|
|
18
26
|
$ ${t.cyan(`autonomos agents`)} List all AGENT.md files in the project
|
|
27
|
+
$ ${t.cyan(`autonomos close <ID>`)} Move a finished task or issue out of current context
|
|
28
|
+
$ ${t.cyan(`autonomos migrate`)} Upgrade project records to the current artifact format
|
|
19
29
|
|
|
20
30
|
Project knowledge workflows installed for supported harnesses include
|
|
21
31
|
${t.cyan(`/issue`)} (triage), ${t.cyan(`/adopt`)} (reviewable migration),
|
|
@@ -61,7 +71,7 @@ ${t.bold(`Project root detection:`)}
|
|
|
61
71
|
git/Autonomos project. Run it from the project root, or pass
|
|
62
72
|
${t.cyan(`--force`)} (or set ${t.cyan(`AUTONOMOS_FORCE=1`)}) to install
|
|
63
73
|
in ${t.cyan(`cwd`)} anyway. In a TTY, you'll be asked to confirm.
|
|
64
|
-
`).option(`-n, --dry-run`,`Preview what would be created without writing files`).option(`--harness <name...>`,`Install workflows for the specified harness id(s); skip the prompt`).option(`--all`,`Install workflows for all known harnesses; skip the prompt`).option(`--no-prompt`,`Skip the interactive harness prompt (use with --harness or --all)`).option(`--no-install`,`Skip installing @autonomos/cli as devDependency; use npx instead`).option(`-f, --force`,`Install in cwd even if a parent project root is detected (also via AUTONOMOS_FORCE=1)`).action(async e=>{try{let n=await
|
|
74
|
+
`).option(`-n, --dry-run`,`Preview what would be created without writing files`).option(`--harness <name...>`,`Install workflows for the specified harness id(s); skip the prompt`).option(`--all`,`Install workflows for all known harnesses; skip the prompt`).option(`--no-prompt`,`Skip the interactive harness prompt (use with --harness or --all)`).option(`--no-install`,`Skip installing @autonomos/cli as devDependency; use npx instead`).option(`-f, --force`,`Install in cwd even if a parent project root is detected (also via AUTONOMOS_FORCE=1)`).action(async e=>{try{let n=await Oe({dryRun:e.dryRun,harnesses:e.harness,all:e.all,noPrompt:e.prompt===!1,noInstall:e.install===!1,force:e.force});n.success||(console.error(t.red(`\nā ${n.message}`)),process.exit(1)),n.dryRun?console.log(t.cyan(`\nš ${n.message} (dry-run)`)):console.log(t.green(`\nā
${n.message}`)),n.created.length>0&&(console.log(`\n${t.bold(n.dryRun?`Would create:`:`Created:`)}`),n.created.forEach(e=>console.log(` ${t.blue(`š`)} ${t.white(e)}`))),n.harnessFiles&&n.harnessFiles.length>0&&(console.log(`\n${t.bold(`Harness workflow files:`)}`),n.harnessFiles.forEach(e=>console.log(` ${t.cyan(`āļø `)} ${t.white(e)}`))),n.warnings.length>0&&(console.log(t.yellow(`
|
|
65
75
|
Warnings:`)),n.warnings.forEach(e=>console.log(` ${t.yellow(`ā ļø`)} ${e}`)))}catch(e){let n=e instanceof Error?e.message:String(e);console.error(t.red(`\nā ${n}`)),process.exit(1)}}),$.command(`update`).description(`Update the Protocol to the latest version`).addHelpText(`after`,`
|
|
66
76
|
This command updates the managed protocol artifacts embedded in the CLI.
|
|
67
77
|
Your ${t.white(`AGENT.md`)}, ${t.white(`TASKS.md`)}, ${t.white(`ISSUES.md`)},
|
|
@@ -87,12 +97,15 @@ ${t.bold(`Examples:`)}
|
|
|
87
97
|
$ ${t.cyan(`autonomos update --harness opencode`)}
|
|
88
98
|
$ ${t.cyan(`autonomos update --harness opencode --harness kilocode`)}
|
|
89
99
|
$ ${t.cyan(`autonomos update --all`)}
|
|
90
|
-
`).option(`--harness <name...>`,`Install workflow files for the specified harness id(s) in addition to refreshing existing ones`).option(`--all`,`Install workflow files for every known harness in addition to refreshing existing ones`).action(e=>{let n=
|
|
100
|
+
`).option(`--harness <name...>`,`Install workflow files for the specified harness id(s) in addition to refreshing existing ones`).option(`--all`,`Install workflow files for every known harness in addition to refreshing existing ones`).action(e=>{let n=We({harnesses:e.harness,all:e.all});n.success||(n.cliOutdated?console.error(t.yellow(`\nā ļø ${n.message}`)):console.error(t.red(`\nā ${n.message}`)),process.exit(1)),console.log(t.green(`\nā
${n.message}`))}),$.command(`status`).description(`Show project status and task summary`).addHelpText(`after`,`
|
|
91
101
|
Displays information about the current project:
|
|
92
102
|
- Protocol version
|
|
93
103
|
- Protocol artifact integrity for the installed version
|
|
94
104
|
- CLI version used for initialization
|
|
95
105
|
- Current task registry summary (todo, in-progress, done, blocked)
|
|
106
|
+
- Context budgets: closed records left in current registries, oversized
|
|
107
|
+
TASKS.md/ISSUES.md/AGENT.md/task entries/worklogs, outdated artifact format.
|
|
108
|
+
Advisory unless --strict.
|
|
96
109
|
- With --history: separate archived counts and task ID collisions
|
|
97
110
|
Only archive/**/TASKS.md registries are counted; history is not read by default.
|
|
98
111
|
Archived does not imply completed. Read diagnostics and partial counts are explicit.
|
|
@@ -100,7 +113,31 @@ Displays information about the current project:
|
|
|
100
113
|
${t.bold(`Examples:`)}
|
|
101
114
|
$ ${t.cyan(`autonomos status`)}
|
|
102
115
|
$ ${t.cyan(`autonomos status --history`)}
|
|
103
|
-
|
|
116
|
+
$ ${t.cyan(`autonomos status --strict`)}
|
|
117
|
+
`).option(`--history`,`Include archived task registries and check reserved task IDs`).option(`--strict`,`Exit non-zero when context-budget findings exist`).action(e=>{let n=ze({history:e.history});if(n.success||(console.error(t.red(`\nā ${n.message}`)),process.exit(1)),console.log(`\n${t.bold(`š¦ Protocol`)} ${t.green(`v${n.protocolVersion}`)} ${t.dim(`(CLI v${n.cliVersion})`)}`),n.artifactIntegrity===`valid`)console.log(` ${t.green(`ā Artifacts match the published protocol version`)}`);else if(n.artifactIntegrity===`drifted`){console.log(` ${t.red(`ā Protocol artifact drift detected`)}`);for(let e of n.driftedArtifacts??[])console.log(` ${t.red(`ā¢`)} ${e}`);console.log(` ${t.dim("Run `autonomos update` to restore canonical artifacts.")}`)}else console.log(` ${t.yellow(`! Artifact integrity is unverifiable with this CLI version`)}`);if(n.taskSummary){let e=n.taskSummary;console.log(`\n${t.bold(`š Current tasks:`)} ${t.cyan(e.total)} total`),console.log(` ${t.white(`⬠Todo:`)} ${t.white(e.todo)}`),console.log(` ${t.blue(`š In Progress:`)} ${t.blue(e.inProgress)}`),console.log(` ${t.green(`ā
Done:`)} ${t.green(e.done)}`),e.blocked>0&&console.log(` ${t.red(`š« Blocked:`)} ${t.red(e.blocked)}`)}if(n.archivedTaskSummary){let e=n.archivedTaskSummary;console.log(`\n${t.bold(`Historical task records:`)} ${e.total}${n.historyComplete?``:` (incomplete scan)`}`),console.log(` Todo: ${e.todo}; in progress: ${e.inProgress}; done: ${e.done}; blocked: ${e.blocked}`),console.log(t.dim(` Historical status is not current work; archived does not mean completed.`))}let r=n.budgetFindings??[];console.log(`\n${t.bold(`š Context budgets:`)} ${r.length?t.yellow(`${r.length} finding(s)`):t.green(`within budget`)} ${t.dim(`(artifact format ${n.artifactFormat})`)}`);for(let e of r)if(console.log(` ${t.yellow(`ā¢`)} ${t.white(e.path)}: ${e.message}`),e.items?.length){let n=e.items.slice(0,5).join(`, `),r=e.items.length>5?`, +${e.items.length-5} more`:``;console.log(` ${t.dim(n+r)}`)}r.length&&e.strict&&(process.exitCode=1);for(let e of n.warnings??[])console.warn(t.yellow(`! ${e}`));n.duplicateTaskIds?.length&&console.warn(t.yellow(`! Duplicate task IDs: ${n.duplicateTaskIds.join(`, `)}`)),(n.warnings?.length||n.duplicateTaskIds?.length)&&(process.exitCode=1)}),$.command(`close`).description(`Move finished tasks or issues from current registries to .autonomos/archive/closed/`).argument(`<ids...>`,`Task or issue IDs`).option(`--date <YYYY-MM-DD>`,`Completion date to record (default: today)`).option(`--abandoned <reason>`,`Close unfinished tasks as abandoned, recording the reason`).option(`-n, --dry-run`,`Report what would move without writing`).addHelpText(`after`,`
|
|
118
|
+
A task must be marked [x] (a \`Completed:\` date is added when missing) unless
|
|
119
|
+
--abandoned is given. An issue must be resolved, declined, closed or superseded.
|
|
120
|
+
Entries are moved intact; relative links are repaired for the new location.
|
|
121
|
+
|
|
122
|
+
${t.bold(`Examples:`)}
|
|
123
|
+
$ ${t.cyan(`autonomos close PROTO-15`)}
|
|
124
|
+
$ ${t.cyan(`autonomos close PROTO-15 ISSUE-05`)}
|
|
125
|
+
$ ${t.cyan(`autonomos close SPIKE-02 --abandoned "superseded by PROTO-15"`)}
|
|
126
|
+
`).action((e,n)=>{let r=Pe({ids:e,...n});r.success||(console.error(t.red(`\nā ${r.message}`)),process.exit(1)),console.log(t.green(`ā
${r.message}`))}),$.command(`migrate`).description(`Upgrade project records to the current artifact format`).option(`-n, --dry-run`,`Report the plan without writing`).addHelpText(`after`,`
|
|
127
|
+
Mechanical, content-preserving upgrade (format 1 ā 2):
|
|
128
|
+
- completed tasks and closed issues move to .autonomos/archive/closed/
|
|
129
|
+
- existing worklogs move to .autonomos/archive/worklogs-format-1/ so they
|
|
130
|
+
stop serving as examples for new worklogs
|
|
131
|
+
- Markdown references to moved files are repaired across the project
|
|
132
|
+
- the archive index and manifest record the change
|
|
133
|
+
Nothing is deleted or rewritten. Commit first; review the diff afterwards.
|
|
134
|
+
Remaining findings (AGENT.md size, long open tasks) are semantic work for /reconcile.
|
|
135
|
+
|
|
136
|
+
${t.bold(`Examples:`)}
|
|
137
|
+
$ ${t.cyan(`autonomos migrate --dry-run`)}
|
|
138
|
+
$ ${t.cyan(`autonomos migrate`)}
|
|
139
|
+
`).action(e=>{let n=Re({dryRun:e.dryRun});n.success||(console.error(t.red(`\nā ${n.message}`)),process.exit(1)),console.log(t.green(`\nā
${n.message}`));let r=e=>`${(e/1e3).toFixed(1)} KB`;if(n.bytes&&(console.log(` TASKS.md: ${r(n.bytes.tasks[0])} ā ${r(n.bytes.tasks[1])} (${n.closedTasks.length} closed tasks moved)`),console.log(` ISSUES.md: ${r(n.bytes.issues[0])} ā ${r(n.bytes.issues[1])} (${n.closedIssues.length} closed issues moved)`)),console.log(` Worklogs quarantined: ${n.movedWorklogs}`),console.log(` Files with repaired references: ${n.rewrittenFiles.length}`),n.findings.length){console.log(t.bold(`
|
|
140
|
+
Remaining work for /reconcile:`));for(let e of n.findings)console.log(` ${t.yellow(`ā¢`)} ${e.path}: ${e.message}`)}}),$.command(`agents`).description(`List all AGENT.md files in the project, or the ancestor chain for a path`).argument(`[path]`,`Optional file or folder. When provided, return the ordered list of ancestor AGENT.md files (root -> target) instead of the full tree.`).option(`-a, --all`,`In tree mode: search from project root instead of current directory`).addHelpText(`after`,`
|
|
104
141
|
This command has two modes:
|
|
105
142
|
|
|
106
143
|
${t.bold(`Tree mode`)} (default, or with ${t.cyan(`--all`)}):
|
|
@@ -118,9 +155,9 @@ ${t.bold(`Examples:`)}
|
|
|
118
155
|
$ ${t.cyan(`autonomos agents --all`)} # Tree, from project root
|
|
119
156
|
$ ${t.cyan(`autonomos agents apps/web`)} # Ancestors for apps/web
|
|
120
157
|
$ ${t.cyan(`autonomos agents apps/web/components/ui/button.tsx`)} # Ancestors for a file
|
|
121
|
-
`).action((e,n)=>{let r=
|
|
158
|
+
`).action((e,n)=>{let r=xe({all:n.all,target:e});r.success||(console.error(t.red(`
|
|
122
159
|
ā ${r.message}`)),process.exit(1)),r.mode===`ancestors`?console.log(t.cyan(`
|
|
123
160
|
š ${r.message}`)):(console.log(`
|
|
124
161
|
`+(r.tree??r.message)),console.log(t.dim(`
|
|
125
|
-
${r.message}`)))}),$.command(`version`).description(`Show the current Protocol version`).action(()=>{console.log(`${t.bold(`Agent Protocol`)} ${t.green(`v${
|
|
162
|
+
${r.message}`)))}),$.command(`version`).description(`Show the current Protocol version`).action(()=>{console.log(`${t.bold(`Agent Protocol`)} ${t.green(`v${p}`)} ${t.dim(`(CLI v${Ge})`)}`)}),$.parse();export{};
|
|
126
163
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["CLI_VERSION","packageJson.version","CLI_VERSION","packageJson.version","packageJson.version"],"sources":["../src/commands/agents.ts","../package.json","../src/protocol-artifacts.ts","../src/commands/init.ts","../src/commands/status.ts","../src/commands/update.ts","../src/index.ts"],"sourcesContent":["import { existsSync, readdirSync, statSync } from 'node:fs'\nimport { basename, join, relative, resolve } from 'node:path'\n\nimport {\n AGENT_FILE,\n findAncestorAgents,\n findProjectRoot,\n type AncestorAgent,\n} from '@autonomos/core'\n\ninterface AgentsOptions {\n cwd?: string\n /**\n * When true, search from the project root (discovered by walking up to\n * .autonomos or .git) instead of the current directory.\n */\n all?: boolean\n /**\n * Optional target path (file or directory). When provided, the command\n * switches to \"ancestor lookup\" mode and prints the ordered list of\n * AGENT.md files on the path from the target up to the project root.\n * Existing ancestors only; gaps are silently skipped.\n */\n target?: string\n}\n\ninterface AgentEntry {\n path: string\n relativePath: string\n depth: number\n}\n\n/**\n * Recursively find all AGENT.md files in a directory\n */\nfunction findAgentFiles(dir: string, baseDir: string, depth = 0): AgentEntry[] {\n const entries: AgentEntry[] = []\n\n // Check if AGENT.md exists in current directory\n const agentPath = join(dir, AGENT_FILE)\n if (existsSync(agentPath)) {\n entries.push({\n path: agentPath,\n relativePath: relative(baseDir, agentPath) || AGENT_FILE,\n depth,\n })\n }\n\n // Scan subdirectories\n try {\n const items = readdirSync(dir)\n for (const item of items) {\n // Skip hidden directories and node_modules\n if (\n item.startsWith('.') ||\n item === 'node_modules' ||\n item === 'dist' ||\n item === 'build'\n ) {\n continue\n }\n\n const itemPath = join(dir, item)\n try {\n if (statSync(itemPath).isDirectory()) {\n entries.push(...findAgentFiles(itemPath, baseDir, depth + 1))\n }\n } catch {\n // Skip inaccessible directories\n }\n }\n } catch {\n // Skip inaccessible directories\n }\n\n return entries\n}\n\ninterface TreeNode {\n name: string\n isAgent: boolean\n children: Record<string, TreeNode>\n}\n\n/**\n * Format agent entries as a true tree structure\n */\nfunction formatAsTree(entries: AgentEntry[], baseDir: string): string {\n if (entries.length === 0) {\n return ' (no AGENT.md files found)'\n }\n\n const rootName = basename(baseDir)\n const tree: TreeNode = { name: rootName, isAgent: false, children: {} }\n\n // Build the tree\n for (const entry of entries) {\n const parts = entry.relativePath.split('/')\n let current = tree\n\n for (const part of parts) {\n const isAgent = part === AGENT_FILE\n\n let child = current.children[part]\n if (!child) {\n child = {\n name: part,\n isAgent,\n children: {},\n }\n current.children[part] = child\n }\n current = child\n }\n }\n\n const lines: string[] = []\n lines.push(`š ${rootName}/`)\n\n function render(node: TreeNode, prefix = '', _isLast = true): void {\n const children = Object.values(node.children)\n children.sort((a, b) => {\n // Folders first\n if (!a.isAgent && b.isAgent) return -1\n if (a.isAgent && !b.isAgent) return 1\n return a.name.localeCompare(b.name)\n })\n\n children.forEach((child, index) => {\n const childIsLast = index === children.length - 1\n const branch = childIsLast ? 'āāā ' : 'āāā '\n const icon = child.isAgent ? 'š' : 'š'\n const name = child.isAgent ? child.name : `${child.name}/`\n\n lines.push(`${prefix}${branch}${icon} ${name}`)\n\n if (!child.isAgent) {\n const nextPrefix = prefix + (childIsLast ? ' ' : 'ā ')\n render(child, nextPrefix, childIsLast)\n }\n })\n }\n\n render(tree)\n return lines.join('\\n')\n}\n\n/**\n * Format the ancestor-lookup result as a numbered, root-first list.\n */\nfunction formatAncestors(ancestors: AncestorAgent[]): string {\n if (ancestors.length === 0) {\n return ' (no AGENT.md files found in the ancestor chain)'\n }\n const lines = ancestors.map((a, i) => {\n const idx = (i + 1).toString().padStart(ancestors.length.toString().length, ' ')\n return ` ${idx}. ${a.relativeDir === '.' ? './AGENT.md' : `${a.relativeDir}/AGENT.md`}`\n })\n return lines.join('\\n')\n}\n\ninterface AgentsResult {\n success: boolean\n message: string\n tree?: string\n count?: number\n /**\n * When in ancestor-lookup mode, the list of ancestor AGENT.md files\n * (root-first order). Each entry has `dir`, `path`, `relativeDir`.\n */\n ancestors?: AncestorAgent[]\n /** The mode that was used. Useful for the caller to format output. */\n mode: 'tree' | 'ancestors'\n}\n\n/**\n * List AGENT.md files in the project.\n *\n * Two modes:\n *\n * 1. **Tree mode** (default, or with `--all`): list all AGENT.md files\n * in a tree structure. Used at session start to get the full fractal\n * picture of the project.\n *\n * 2. **Ancestors mode** (with a positional `<path>` argument): return\n * the ordered list of AGENT.md files on the path from the target\n * up to the project root. Root-first, with non-existent ancestors\n * silently skipped. Used at task start to get the precise fractal\n * context for the file or folder being worked on.\n */\nexport function agents(options: AgentsOptions = {}): AgentsResult {\n const cwd = options.cwd ?? process.cwd()\n\n // --- Ancestors mode (positional <path> arg) ---\n if (options.target) {\n const projectRoot = findProjectRoot(cwd) ?? cwd\n let ancestors: AncestorAgent[]\n try {\n ancestors = findAncestorAgents(resolve(cwd, options.target), projectRoot)\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n return {\n success: false,\n message: `Failed to look up ancestors: ${message}`,\n mode: 'ancestors',\n }\n }\n const list = formatAncestors(ancestors)\n return {\n success: true,\n message: `Found ${ancestors.length} ancestor AGENT.md file(s) for \"${options.target}\" (root ā target):\\n${list}`,\n count: ancestors.length,\n ancestors,\n mode: 'ancestors',\n }\n }\n\n // --- Tree mode (default) ---\n let searchBase: string\n if (options.all) {\n const projectRoot = findProjectRoot(cwd)\n if (!projectRoot) {\n return {\n success: false,\n message: 'Could not find project root (.autonomos or .git directory).',\n mode: 'tree',\n }\n }\n searchBase = projectRoot\n } else {\n searchBase = cwd\n }\n\n const entries = findAgentFiles(searchBase, searchBase)\n\n if (entries.length === 0) {\n return {\n success: true,\n message: 'No AGENT.md files found.',\n count: 0,\n mode: 'tree',\n }\n }\n\n const tree = formatAsTree(entries, searchBase)\n return {\n success: true,\n message: `Found ${entries.length} AGENT.md file(s)`,\n tree,\n count: entries.length,\n mode: 'tree',\n }\n}\n","","import { existsSync, readFileSync } from 'node:fs'\nimport { join, relative, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport {\n AUTONOMOS_DIR,\n listHarnesses,\n PROTOCOL_FILE,\n PROTOCOL_TEMPLATE,\n PROTOCOL_VERSION,\n resolveTargets,\n} from '@autonomos/core'\n\nexport const WORKFLOW_FILES = [\n 'protocol-session.md',\n 'protocol-task.md',\n 'protocol-crystallize.md',\n 'protocol-issue.md',\n 'protocol-adopt.md',\n 'protocol-reconcile.md',\n 'protocol-design.md',\n] as const\n\nexport type ArtifactIntegrity = 'valid' | 'drifted' | 'unverifiable'\n\nexport interface ArtifactIntegrityResult {\n state: ArtifactIntegrity\n driftedFiles: string[]\n}\n\nexport function getWorkflowDirCandidates(moduleUrl: string = import.meta.url): string[] {\n const here = fileURLToPath(moduleUrl)\n return [\n resolve(here, '..', '..', '..', 'core', 'src', 'workflows'),\n resolve(here, '..', '..', '..', 'core', 'dist', 'workflows'),\n resolve(here, '..', '..', '..', '..', 'core', 'dist', 'workflows'),\n ]\n}\n\nexport function getWorkflowsDir(): string {\n const candidates = getWorkflowDirCandidates()\n for (const candidate of candidates) {\n if (existsSync(candidate)) return candidate\n }\n throw new Error('Could not locate the workflows directory inside @autonomos/core')\n}\n\nexport interface TargetArtifactFile {\n sourceFilename: string\n relativeTargetFilePath: string\n destinationPath: string\n}\n\nexport function buildTargetFilename(sourceFile: string, targetExtension: string): string {\n const withoutPrefix = sourceFile.replace(/^protocol-/, '')\n const withoutExt = withoutPrefix.replace(/\\.[^.]+$/, '')\n return withoutExt + targetExtension\n}\n\nexport function getTargetArtifactFiles(\n target: { path: string; fileExtension: string; kind?: 'flat' | 'skill' },\n workflowFiles: readonly string[] = WORKFLOW_FILES\n): TargetArtifactFile[] {\n return workflowFiles.map(sourceFile => {\n if (target.kind === 'skill') {\n const skillName = sourceFile.replace(/\\.[^.]+$/, '')\n const relPath = join(skillName, 'SKILL.md')\n return {\n sourceFilename: sourceFile,\n relativeTargetFilePath: relPath,\n destinationPath: join(target.path, relPath),\n }\n }\n const flatFilename = buildTargetFilename(sourceFile, target.fileExtension)\n return {\n sourceFilename: sourceFile,\n relativeTargetFilePath: flatFilename,\n destinationPath: join(target.path, flatFilename),\n }\n })\n}\n\nexport function verifyProtocolArtifacts(\n cwd: string,\n declaredVersion: string\n): ArtifactIntegrityResult {\n if (declaredVersion !== PROTOCOL_VERSION) {\n return { state: 'unverifiable', driftedFiles: [] }\n }\n\n const driftedFiles: string[] = []\n const protocolPath = join(cwd, AUTONOMOS_DIR, PROTOCOL_FILE)\n compareFile(protocolPath, PROTOCOL_TEMPLATE, cwd, driftedFiles)\n\n const workflowsDir = getWorkflowsDir()\n const targets = resolveTargets(\n listHarnesses().map(({ id }) => id),\n cwd\n )\n\n const legacyAgentWorkflows = join(cwd, '.agent', 'workflows')\n if (existsSync(legacyAgentWorkflows)) {\n targets.push({\n path: legacyAgentWorkflows,\n fileExtension: '.md',\n kind: 'flat',\n usedBy: ['antigravity-legacy'],\n })\n }\n\n for (const target of targets) {\n const expected = getTargetArtifactFiles(target, WORKFLOW_FILES).map(file => ({\n source: readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8'),\n destination: file.destinationPath,\n }))\n if (!expected.some(({ destination }) => existsSync(destination))) continue\n for (const file of expected) {\n compareFile(file.destination, file.source, cwd, driftedFiles)\n }\n }\n\n return {\n state: driftedFiles.length === 0 ? 'valid' : 'drifted',\n driftedFiles,\n }\n}\n\nfunction compareFile(path: string, expected: string, cwd: string, driftedFiles: string[]): void {\n if (!existsSync(path) || readFileSync(path, 'utf-8') !== expected) {\n driftedFiles.push(relative(cwd, path))\n }\n}\n","import { checkbox, confirm } from '@inquirer/prompts'\nimport { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\nimport {\n AGENT_FILE,\n AUTONOMOS_DIR,\n createManifest,\n displayRelative,\n findProjectRoot,\n generateAgentTemplate,\n generateManifestContent,\n isSamePath,\n listHarnesses,\n MANIFEST_FILE,\n PROTOCOL_FILE,\n PROTOCOL_TEMPLATE,\n PROTOCOL_VERSION,\n resolveTargets,\n TASKS_FILE,\n TASKS_TEMPLATE,\n WORKLOGS_DIR,\n} from '@autonomos/core'\n\n// Synchronize with the package.json version at build time. The bundler\n// inlines this JSON, so the resolved value is always current.\n// (package.json import ā inlined by the bundler)\nimport packageJson from '../../package.json' with { type: 'json' }\nimport { getTargetArtifactFiles, getWorkflowsDir, WORKFLOW_FILES } from '../protocol-artifacts'\nconst CLI_VERSION: string = packageJson.version\n\ninterface InitOptions {\n cwd?: string\n dryRun?: boolean\n /** Specific harness ids to install for. */\n harnesses?: string[]\n /** Install for all known harnesses (overrides `harnesses`). */\n all?: boolean\n /** Skip the interactive prompt even when no harnesses are specified. */\n noPrompt?: boolean\n /** When true, skip installing @autonomos/cli devDependency.\n * The npm script will use npx instead. */\n noInstall?: boolean\n /**\n * When true, ignore the \"you're inside a bigger project\" check and\n * initialize the protocol in `cwd` no matter what. Mirrors the\n * `AUTONOMOS_FORCE=1` env var, which is more convenient in scripts.\n */\n force?: boolean\n /**\n * When set, treat stdin as a TTY (true) or non-TTY (false) regardless\n * of the real value. Tests use this to opt in/out of the project-root\n * confirmation prompt without mutating the real TTY state.\n */\n interactiveOverride?: boolean\n}\n\nexport interface ResolveInstallResult {\n installDir: string\n warnings: string[]\n abort?: { message: string }\n}\n\ninterface ResolveInstallOptions {\n force: boolean\n noPrompt: boolean\n isInteractive: boolean\n}\n\ninterface InitResult {\n success: boolean\n message: string\n created: string[]\n warnings: string[]\n dryRun?: boolean\n harnessFiles?: string[]\n}\n\n/**\n * Prompt the user interactively for which harnesses to install for.\n * Returns the selected harness ids. An empty array means the user chose\n * to skip harness installation entirely.\n */\nasync function promptForHarnesses(): Promise<string[]> {\n const harnesses = listHarnesses()\n return checkbox({\n message:\n 'Which AI harnesses do you want to install the protocol for? (space to toggle, enter to confirm)',\n choices: harnesses.map(({ id, harness }) => ({\n name: harness.name,\n value: id,\n checked: harness.preferred,\n })),\n })\n}\n\n/**\n * Resolve which directory the protocol should be installed into.\n *\n * The protocol expects to live at the root of the user's project (where\n * `.git` / `.autonomos` already exists, or where one would be created).\n * When `init` is invoked from a subdirectory of such a project, we must\n * either:\n *\n * - point the user at the actual root and refuse to install, or\n * - install at the detected root on their behalf.\n *\n * We pick the first option by default, because silently installing\n * elsewhere is the bug that motivated this helper. The user can opt\n * into the second behavior with `--force` or `AUTONOMOS_FORCE=1`.\n *\n * Returns the directory to install in. When the caller passes `--force`\n * (or the env var is set), and a different project root is detected, we\n * install at that root instead. In interactive mode we also confirm the\n * detour with the user.\n */\nexport async function resolveInstallDir(\n requestedCwd: string,\n options: ResolveInstallOptions\n): Promise<ResolveInstallResult> {\n const warnings: string[] = []\n const detectedRoot = findProjectRoot(requestedCwd)\n\n // No project root found above us: nothing to bubble up to. Either\n // we're in a fresh directory (warn about no git) or we're literally\n // at the root of a project that uses neither marker. Either way we\n // install in place.\n if (!detectedRoot) {\n if (!existsSync(join(requestedCwd, '.git'))) {\n warnings.push('No Git repository detected. Consider running `git init` first.')\n }\n return { installDir: requestedCwd, warnings }\n }\n\n // The project root is exactly where we are: ideal case, no detour.\n if (isSamePath(detectedRoot, requestedCwd)) {\n return { installDir: requestedCwd, warnings }\n }\n\n // The project root is somewhere above us. Decide what to do.\n const relCwd = displayRelative(requestedCwd, detectedRoot)\n const force = options.force || process.env.AUTONOMOS_FORCE === '1'\n\n if (force) {\n warnings.push(\n `Detected project root at ${displayRelative(detectedRoot, requestedCwd)} ` +\n `(AUTONOMOS_FORCE=1); installing there instead of \"${relCwd}\".`\n )\n return { installDir: detectedRoot, warnings }\n }\n\n if (options.isInteractive && !options.noPrompt) {\n const proceed = await confirm({\n message:\n `You're inside a project rooted at ${detectedRoot}.\\n` +\n `The protocol should be installed at the project root, not in \"${relCwd}\".\\n` +\n `Install at the project root instead?`,\n default: true,\n })\n if (proceed) {\n warnings.push(`Detected project root above \"${relCwd}\"; installing at ${detectedRoot}.`)\n return { installDir: detectedRoot, warnings }\n }\n return {\n installDir: requestedCwd,\n warnings,\n abort: {\n message:\n `Aborted: refusing to install Autonomos inside a subdirectory. ` +\n `Run the command from ${detectedRoot} (or pass --force / set AUTONOMOS_FORCE=1).`,\n },\n }\n }\n\n return {\n installDir: requestedCwd,\n warnings,\n abort: {\n message:\n `Cannot initialize Autonomos from a subdirectory.\\n` +\n ` Current directory : ${requestedCwd}\\n` +\n ` Detected root : ${detectedRoot}\\n` +\n `Re-run from the project root, or pass --force (or set AUTONOMOS_FORCE=1) to install here anyway.`,\n },\n }\n}\n\n/**\n * Initialize the Autonomos Agent Protocol in a directory.\n */\nexport async function init(options: InitOptions = {}): Promise<InitResult> {\n const requestedCwd = options.cwd ?? process.cwd()\n const dryRun = options.dryRun ?? false\n\n // Resolve the install target. We do this before any other check so a\n // bad install location fails fast with a clear message.\n const isInteractive =\n options.interactiveOverride ?? (process.stdin.isTTY === true && !options.dryRun)\n const resolution = await resolveInstallDir(requestedCwd, {\n force: options.force ?? false,\n noPrompt: options.noPrompt ?? false,\n isInteractive,\n })\n if (resolution.abort) {\n return {\n success: false,\n message: resolution.abort.message,\n created: [],\n warnings: resolution.warnings,\n dryRun,\n }\n }\n const cwd = resolution.installDir\n const warnings: string[] = [...resolution.warnings]\n\n const created: string[] = []\n const harnessFiles: string[] = []\n\n // Detect package.json for npm script registration\n const packageJsonPath = join(cwd, 'package.json')\n const hasPackageJson = existsSync(packageJsonPath) && statSync(packageJsonPath).isFile()\n\n // Check if already initialized\n const autonomosDir = join(cwd, AUTONOMOS_DIR)\n const isInitialized = existsSync(autonomosDir)\n\n // Resolve which harnesses to install for\n let selectedHarnesses: string[]\n if (options.all) {\n selectedHarnesses = listHarnesses().map(({ id }) => id)\n } else if (options.harnesses && options.harnesses.length > 0) {\n selectedHarnesses = options.harnesses\n } else if (options.noPrompt || options.dryRun) {\n selectedHarnesses = []\n } else {\n selectedHarnesses = await promptForHarnesses()\n }\n\n if (isInitialized && selectedHarnesses.length === 0) {\n return {\n success: false,\n message: `Project already initialized with Protocol v${PROTOCOL_VERSION}. Use \\`autonomos update\\` to update, or specify harnesses with --harness to install workflow files.`,\n created: [],\n warnings: [],\n dryRun,\n }\n }\n\n // Compute the unique target directories\n const targets = resolveTargets(selectedHarnesses, cwd)\n\n // In dry-run mode, just collect what would be created\n if (dryRun) {\n if (!isInitialized) {\n created.push(AUTONOMOS_DIR)\n created.push(`${AUTONOMOS_DIR}/${WORKLOGS_DIR}`)\n created.push(`${AUTONOMOS_DIR}/${MANIFEST_FILE}`)\n created.push(`${AUTONOMOS_DIR}/${PROTOCOL_FILE}`)\n created.push(`${AUTONOMOS_DIR}/${TASKS_FILE}`)\n } else {\n created.push(`${AUTONOMOS_DIR}/${MANIFEST_FILE} (update)`)\n created.push(`${AUTONOMOS_DIR}/${PROTOCOL_FILE} (update)`)\n }\n\n const agentPath = join(cwd, AGENT_FILE)\n if (!existsSync(agentPath)) {\n created.push(AGENT_FILE)\n } else {\n warnings.push(`${AGENT_FILE} already exists, would skip.`)\n }\n\n for (const target of targets) {\n for (const file of getTargetArtifactFiles(target, WORKFLOW_FILES)) {\n harnessFiles.push(file.destinationPath)\n }\n }\n\n return {\n success: true,\n message: `Would ${isInitialized ? 'update workflows in' : 'initialize'} project with Agent Protocol v${PROTOCOL_VERSION}${selectedHarnesses.length ? ` (harnesses: ${selectedHarnesses.join(', ')})` : ''}`,\n created,\n warnings,\n dryRun: true,\n harnessFiles,\n }\n }\n\n // Create .autonomos directory\n if (!existsSync(autonomosDir)) {\n mkdirSync(autonomosDir, { recursive: true })\n created.push(AUTONOMOS_DIR)\n }\n\n // Create worklogs directory\n const worklogsDir = join(autonomosDir, WORKLOGS_DIR)\n if (!existsSync(worklogsDir)) {\n mkdirSync(worklogsDir, { recursive: true })\n created.push(`${AUTONOMOS_DIR}/${WORKLOGS_DIR}`)\n }\n\n // Create manifest.json\n const manifest = createManifest(CLI_VERSION)\n const manifestPath = join(autonomosDir, MANIFEST_FILE)\n writeFileSync(manifestPath, generateManifestContent(manifest))\n created.push(`${AUTONOMOS_DIR}/${MANIFEST_FILE}`)\n\n // Create PROTOCOL.md\n const protocolPath = join(autonomosDir, PROTOCOL_FILE)\n writeFileSync(protocolPath, PROTOCOL_TEMPLATE)\n created.push(`${AUTONOMOS_DIR}/${PROTOCOL_FILE}`)\n\n // Create TASKS.md (only if it doesn't exist)\n const tasksPath = join(autonomosDir, TASKS_FILE)\n if (!existsSync(tasksPath)) {\n writeFileSync(tasksPath, TASKS_TEMPLATE)\n created.push(`${AUTONOMOS_DIR}/${TASKS_FILE}`)\n } else {\n warnings.push(`${TASKS_FILE} already exists, skipping.`)\n }\n\n // Create AGENT.md at root (only if it doesn't exist)\n const agentPath = join(cwd, AGENT_FILE)\n if (!existsSync(agentPath)) {\n const projectName = cwd.split('/').pop() ?? 'Project'\n writeFileSync(agentPath, generateAgentTemplate(projectName))\n created.push(AGENT_FILE)\n } else {\n warnings.push(`${AGENT_FILE} already exists, skipping.`)\n }\n\n // Register npm script \"autonomos\" if package.json exists\n if (hasPackageJson) {\n try {\n const pkgRaw = readFileSync(packageJsonPath, 'utf-8')\n const pkg = JSON.parse(pkgRaw)\n const hadScript = !!pkg.scripts?.['autonomos']\n const previousDevDep = pkg.devDependencies?.['@autonomos/cli']\n const newDevDep = `^${CLI_VERSION}`\n\n if (!pkg.scripts) pkg.scripts = {}\n\n if (options.noInstall || options.dryRun) {\n // Mode B: npx only, no devDependency\n pkg.scripts['autonomos'] = 'npx --yes @autonomos/cli'\n writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 4) + '\\n')\n created.push('package.json (scripts.autonomos via npx)')\n if (!hadScript) {\n warnings.push(\n 'Added \"autonomos\" npm script using npx (--no-install mode). Run `npm install` when ready.'\n )\n }\n } else {\n // Mode A (default): install as devDependency\n pkg.scripts['autonomos'] = 'autonomos'\n\n if (!pkg.devDependencies) pkg.devDependencies = {}\n pkg.devDependencies['@autonomos/cli'] = newDevDep\n\n writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 4) + '\\n')\n created.push('package.json (scripts.autonomos + devDependencies.@autonomos/cli)')\n\n // Three distinct situations to communicate:\n // 1. fresh install: nothing existed before\n // 2. devDep was already there but pinned to a stale\n // version (typical of older CLI builds that wrote\n // ^0.2.0, which doesn't exist on the registry)\n // 3. devDep was already there at the current version\n // and only the script needed adding\n if (!hadScript && !previousDevDep) {\n warnings.push(\n 'Added \"autonomos\" npm script and @autonomos/cli devDependency. Run `npm install` to install.'\n )\n } else if (previousDevDep && previousDevDep !== newDevDep) {\n // Covers both \"old script + stale devDep\" and\n // \"no script + stale devDep\" cases. Refreshing the\n // devDep is what unblocks `pnpm i` when the pinned\n // version isn't on the registry.\n warnings.push(\n `Bumped @autonomos/cli devDependency: ${previousDevDep} ā ${newDevDep}. Run \\`npm install\\` to apply.`\n )\n } else if (!hadScript && previousDevDep) {\n warnings.push('Added \"autonomos\" npm script (devDependency was already set).')\n }\n }\n } catch {\n warnings.push('Could not update package.json (invalid JSON or read error).')\n }\n }\n\n // Install workflow files for each selected harness\n const workflowsDir = getWorkflowsDir()\n for (const target of targets) {\n for (const file of getTargetArtifactFiles(target, WORKFLOW_FILES)) {\n mkdirSync(dirname(file.destinationPath), { recursive: true })\n const source = readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8')\n writeFileSync(file.destinationPath, source)\n harnessFiles.push(file.destinationPath)\n }\n }\n\n const harnessMsg =\n selectedHarnesses.length > 0\n ? ` for harnesses: ${selectedHarnesses.join(', ')}`\n : ' (no harness workflows installed)'\n\n return {\n success: true,\n message: `Project initialized with Agent Protocol v${PROTOCOL_VERSION}${harnessMsg}`,\n created,\n warnings,\n dryRun: false,\n harnessFiles,\n }\n}\n","import { existsSync, lstatSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\nimport {\n AUTONOMOS_DIR,\n MANIFEST_FILE,\n parseManifest,\n readTaskRegistry,\n TASKS_FILE,\n type Manifest,\n type TaskReference,\n} from '@autonomos/core'\nimport { verifyProtocolArtifacts, type ArtifactIntegrity } from '../protocol-artifacts'\n\ninterface StatusOptions {\n cwd?: string\n history?: boolean\n}\n\ninterface TaskSummary {\n total: number\n todo: number\n inProgress: number\n done: number\n blocked: number\n}\n\nexport interface StatusResult {\n success: boolean\n message: string\n protocolVersion?: string\n cliVersion?: string\n initialized: boolean\n taskSummary?: TaskSummary\n archivedTaskSummary?: TaskSummary\n historyComplete?: boolean\n duplicateTaskIds?: string[]\n warnings?: string[]\n artifactIntegrity?: ArtifactIntegrity\n driftedArtifacts?: string[]\n}\n\n/**\n * Get project status and task summary\n */\nexport function status(options: StatusOptions = {}): StatusResult {\n const cwd = options.cwd ?? process.cwd()\n\n // Check if initialized\n const autonomosDir = join(cwd, AUTONOMOS_DIR)\n const manifestPath = join(autonomosDir, MANIFEST_FILE)\n\n if (existsSync(autonomosDir) && !lstatSync(autonomosDir).isDirectory()) {\n return {\n success: false,\n message: 'Expected a regular .autonomos directory; symbolic links are not followed.',\n initialized: false,\n }\n }\n\n if (!existsSync(manifestPath)) {\n return {\n success: false,\n message: 'Project not initialized. Run `autonomos init` first.',\n initialized: false,\n }\n }\n\n // Read manifest\n let manifest: Manifest\n try {\n const manifestContent = readFileSync(manifestPath, 'utf-8')\n manifest = parseManifest(manifestContent)\n } catch {\n return {\n success: false,\n message: 'Could not read manifest.json',\n initialized: true,\n }\n }\n\n // History stays opt-in: ordinary bootstrap must not traverse archives.\n let taskSummary: TaskSummary | undefined\n const registry = readTaskRegistry(cwd, { history: options.history })\n const summarize = (tasks: TaskReference[]): TaskSummary => ({\n total: tasks.length,\n todo: tasks.filter(t => t.status === 'TODO').length,\n inProgress: tasks.filter(t => t.status === 'IN_PROGRESS').length,\n done: tasks.filter(t => t.status === 'DONE').length,\n blocked: tasks.filter(t => t.status === 'BLOCKED').length,\n })\n if (existsSync(join(autonomosDir, TASKS_FILE))) {\n taskSummary = summarize(registry.current)\n }\n\n const integrity = verifyProtocolArtifacts(cwd, manifest.protocolVersion)\n\n return {\n success: true,\n message: 'Project status retrieved',\n protocolVersion: manifest.protocolVersion,\n cliVersion: manifest.cliVersion,\n initialized: true,\n taskSummary,\n ...(options.history\n ? {\n archivedTaskSummary: summarize(registry.archived),\n historyComplete: registry.complete,\n }\n : {}),\n duplicateTaskIds: registry.duplicateIds,\n warnings: registry.warnings,\n artifactIntegrity: integrity.state,\n driftedArtifacts: integrity.driftedFiles,\n }\n}\n","import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\nimport {\n AUTONOMOS_DIR,\n findProjectRoot,\n generateManifestContent,\n listHarnesses,\n MANIFEST_FILE,\n parseManifest,\n PROTOCOL_FILE,\n PROTOCOL_TEMPLATE,\n PROTOCOL_VERSION,\n resolveTargets,\n type Manifest,\n} from '@autonomos/core'\n\nimport packageJson from '../../package.json' with { type: 'json' }\nimport {\n buildTargetFilename,\n getTargetArtifactFiles,\n getWorkflowsDir,\n WORKFLOW_FILES,\n} from '../protocol-artifacts'\nconst CLI_VERSION: string = packageJson.version\n\ninterface UpdateOptions {\n cwd?: string\n /**\n * When provided, install the workflow files for these harness ids in\n * addition to refreshing existing ones. Lets users add a new AI\n * harness (e.g. opencode) to a project that was already initialized\n * with the protocol, without re-running `init`.\n */\n harnesses?: string[]\n /** Convenience flag equivalent to `harnesses: listHarnesses().map(id)`. */\n all?: boolean\n /** Test seam for packaged workflow resolution. */\n resolveWorkflowsDir?: () => string\n}\n\ninterface UpdateResult {\n success: boolean\n message: string\n previousVersion?: string\n newVersion?: string\n cliOutdated?: boolean\n /** Harnesses that had workflow files installed (or refreshed) by this run. */\n touchedHarnesses?: string[]\n}\n\n/**\n * Compare two SemVer versions\n * Returns: -1 if a < b, 0 if a === b, 1 if a > b\n */\nfunction compareVersions(a: string, b: string): number {\n const parse = (version: string) => {\n const [numeric = '', prerelease] = version.split('-', 2)\n return { parts: numeric.split('.').map(Number), prerelease }\n }\n const aVersion = parse(a)\n const bVersion = parse(b)\n\n for (let i = 0; i < 3; i++) {\n const aNum = aVersion.parts[i] ?? 0\n const bNum = bVersion.parts[i] ?? 0\n if (aNum < bNum) return -1\n if (aNum > bNum) return 1\n }\n\n if (aVersion.prerelease === bVersion.prerelease) return 0\n if (aVersion.prerelease === undefined) return 1\n if (bVersion.prerelease === undefined) return -1\n\n return aVersion.prerelease.localeCompare(bVersion.prerelease)\n}\n\n/**\n * Bump the `@autonomos/cli` devDependency in the project's package.json\n * to the current CLI version, when one is present. Older init runs\n * (including the previously published 0.2.0) pinned a version that is\n * not on the registry, which broke `pnpm i`. Doing the bump here means\n * users can recover with a single `autonomos update` instead of editing\n * package.json by hand.\n *\n * Returns a human-readable note when something changed, or null when\n * nothing needed to be done.\n */\nfunction refreshDevDependency(cwd: string): string | null {\n const packageJsonPath = join(cwd, 'package.json')\n if (!existsSync(packageJsonPath)) return null\n\n let pkg: any\n try {\n pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'))\n } catch {\n return null\n }\n\n const newSpec = `^${CLI_VERSION}`\n const previous = pkg.devDependencies?.['@autonomos/cli']\n if (previous === newSpec) return null\n\n if (!pkg.devDependencies) pkg.devDependencies = {}\n pkg.devDependencies['@autonomos/cli'] = newSpec\n\n try {\n writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 4) + '\\n')\n } catch {\n return null\n }\n\n return previous\n ? `Bumped @autonomos/cli devDependency: ${previous} ā ${newSpec}.`\n : `Added @autonomos/cli devDependency: ${newSpec}.`\n}\n\nfunction writeHarnessWorkflows(cwd: string, harnessIds: string[], workflowsDir: string): string[] {\n if (harnessIds.length === 0) return []\n const targets = resolveTargets(harnessIds, cwd)\n const written: string[] = []\n for (const target of targets) {\n for (const file of getTargetArtifactFiles(target, WORKFLOW_FILES)) {\n mkdirSync(dirname(file.destinationPath), { recursive: true })\n const source = readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8')\n writeFileSync(file.destinationPath, source)\n written.push(file.destinationPath)\n }\n }\n return written\n}\n\n/**\n * Refresh workflows for harnesses already installed in the project.\n * Automatically migrates legacy layouts to conform to modern harness requirements:\n * - Migrates legacy flat files in .agents/skills/ to standard skill bundles (.agents/skills/protocol-[name]/SKILL.md)\n * - Migrates legacy .agent/workflows/ to .agents/workflows/\n * - Cleans legacy flat files from .claude/skills/\n */\nfunction refreshInstalledHarnessWorkflows(cwd: string, workflowsDir: string): string[] {\n const updatedTargets: string[] = []\n\n // 1. Migration of legacy flat files in .agents/skills\n const agentsSkillsDir = join(cwd, '.agents', 'skills')\n if (existsSync(agentsSkillsDir)) {\n let removedFlat = false\n for (const workflowFile of WORKFLOW_FILES) {\n const flatFile = join(agentsSkillsDir, buildTargetFilename(workflowFile, '.md'))\n if (existsSync(flatFile)) {\n try {\n rmSync(flatFile, { force: true })\n removedFlat = true\n } catch {\n // Ignore removal failures\n }\n }\n }\n if (removedFlat) {\n // Install skill bundles in .agents/skills\n const skillTarget = {\n path: agentsSkillsDir,\n fileExtension: '.md',\n kind: 'skill' as const,\n }\n for (const file of getTargetArtifactFiles(skillTarget, WORKFLOW_FILES)) {\n mkdirSync(dirname(file.destinationPath), { recursive: true })\n const source = readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8')\n writeFileSync(file.destinationPath, source)\n }\n updatedTargets.push(agentsSkillsDir)\n }\n }\n\n // 2. Migration of legacy .agent/workflows (singular) to .agents/workflows\n const legacyAgentWorkflowsDir = join(cwd, '.agent', 'workflows')\n if (existsSync(legacyAgentWorkflowsDir)) {\n const modernWorkflowsDir = join(cwd, '.agents', 'workflows')\n mkdirSync(modernWorkflowsDir, { recursive: true })\n let changedLegacy = false\n for (const workflowFile of WORKFLOW_FILES) {\n const flatName = buildTargetFilename(workflowFile, '.md')\n const source = readFileSync(join(workflowsDir, workflowFile), 'utf-8')\n const modernDest = join(modernWorkflowsDir, flatName)\n if (!existsSync(modernDest) || readFileSync(modernDest, 'utf-8') !== source) {\n writeFileSync(modernDest, source)\n changedLegacy = true\n }\n const legacyDest = join(legacyAgentWorkflowsDir, flatName)\n if (!existsSync(legacyDest) || readFileSync(legacyDest, 'utf-8') !== source) {\n writeFileSync(legacyDest, source)\n changedLegacy = true\n }\n }\n if (changedLegacy) {\n if (!updatedTargets.includes(modernWorkflowsDir)) {\n updatedTargets.push(modernWorkflowsDir)\n }\n if (!updatedTargets.includes(legacyAgentWorkflowsDir)) {\n updatedTargets.push(legacyAgentWorkflowsDir)\n }\n }\n }\n\n // 3. Migration of legacy flat files in .claude/skills\n const claudeSkillsDir = join(cwd, '.claude', 'skills')\n if (existsSync(claudeSkillsDir)) {\n for (const workflowFile of WORKFLOW_FILES) {\n const flatFile = join(claudeSkillsDir, buildTargetFilename(workflowFile, '.md'))\n if (existsSync(flatFile)) {\n try {\n rmSync(flatFile, { force: true })\n } catch {\n // Ignore removal failures\n }\n }\n }\n }\n\n // 4. Standard refresh across all targets resolved from configured platforms\n const targets = resolveTargets(\n listHarnesses().map(({ id }) => id),\n cwd\n )\n\n for (const target of targets) {\n if (!existsSync(target.path)) continue\n\n const files = getTargetArtifactFiles(target, WORKFLOW_FILES).map(file => ({\n source: readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8'),\n dest: file.destinationPath,\n }))\n if (!files.some(({ dest }) => existsSync(dest))) continue\n\n let changed = false\n for (const { source, dest } of files) {\n if (!existsSync(dest) || readFileSync(dest, 'utf-8') !== source) {\n mkdirSync(dirname(dest), { recursive: true })\n writeFileSync(dest, source)\n changed = true\n }\n }\n if (changed && !updatedTargets.includes(target.path)) {\n updatedTargets.push(target.path)\n }\n }\n\n return updatedTargets\n}\n\n/**\n * Update the Protocol to the latest version\n */\nexport function update(options: UpdateOptions = {}): UpdateResult {\n const requestedCwd = options.cwd ?? process.cwd()\n\n // Bubble up to the project root if the user ran us from a subdir.\n // Unlike `init` we don't refuse here: there's nothing destructive\n // about a refresh, and the only way to find the manifest is to look\n // for it where it lives.\n const cwd = findProjectRoot(requestedCwd) ?? requestedCwd\n\n // Check if initialized\n const autonomosDir = join(cwd, AUTONOMOS_DIR)\n const manifestPath = join(autonomosDir, MANIFEST_FILE)\n\n if (!existsSync(manifestPath)) {\n return {\n success: false,\n message: 'Project not initialized. Run `autonomos init` first.',\n }\n }\n\n // Read current manifest\n const manifestContent = readFileSync(manifestPath, 'utf-8')\n const manifest: Manifest = parseManifest(manifestContent)\n const currentVersion = manifest.protocolVersion\n\n // Resolve every packaged input before mutating project-owned files. A broken\n // CLI installation must fail without leaving a partially updated protocol.\n let workflowsDir: string\n try {\n workflowsDir = (options.resolveWorkflowsDir ?? getWorkflowsDir)()\n } catch (error) {\n return {\n success: false,\n message: `Cannot update protocol artifacts: ${error instanceof Error ? error.message : String(error)}`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n }\n }\n\n // Refresh devDependency. We do this even when the protocol version\n // is already up to date, because the user may have run `update`\n // precisely to repair a pinned-but-unresolvable version.\n const devDepNote = refreshDevDependency(cwd)\n\n // Compare versions\n const comparison = compareVersions(currentVersion, PROTOCOL_VERSION)\n\n if (comparison === 0) {\n // Workflows are executable artifacts, so refresh installed harnesses\n // even when the protocol specification itself is already current.\n let updatedTargets: string[] = []\n try {\n updatedTargets = refreshInstalledHarnessWorkflows(cwd, workflowsDir)\n } catch (err) {\n console.warn(\n `Warning: Could not update harness workflows: ${err instanceof Error ? err.message : String(err)}`\n )\n }\n\n // Still install any newly requested harnesses even when the protocol\n // is current. This is the path used to add a new harness.\n const requestedHarnesses = options.all\n ? listHarnesses().map(({ id }) => id)\n : (options.harnesses ?? [])\n const newlyInstalled = writeHarnessWorkflows(cwd, requestedHarnesses, workflowsDir)\n\n if (\n manifest.cliVersion !== CLI_VERSION ||\n updatedTargets.length > 0 ||\n newlyInstalled.length > 0\n ) {\n writeFileSync(\n manifestPath,\n generateManifestContent({\n ...manifest,\n cliVersion: CLI_VERSION,\n lastUpdated: new Date().toISOString(),\n })\n )\n }\n\n const workflowMsg =\n updatedTargets.length > 0 ? ` Refreshed workflows in ${updatedTargets.join(', ')}.` : ''\n const installedMsg =\n newlyInstalled.length > 0 ? ` Installed: ${newlyInstalled.join(', ')}.` : ''\n const devDepMsg = devDepNote ? ` ${devDepNote}` : ''\n return {\n success: true,\n message: `Already up to date (Protocol v${PROTOCOL_VERSION}).${workflowMsg}${installedMsg}${devDepMsg}`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n touchedHarnesses: [...updatedTargets, ...newlyInstalled],\n }\n }\n\n if (comparison > 0) {\n // Project uses a newer version than CLI knows\n return {\n success: false,\n message: `This project uses Protocol v${currentVersion}, but your CLI only knows v${PROTOCOL_VERSION}. Update your CLI with \\`npm i -g @autonomos/cli\\`.`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n cliOutdated: true,\n }\n }\n\n // Update Protocol (comparison < 0)\n const protocolPath = join(autonomosDir, PROTOCOL_FILE)\n writeFileSync(protocolPath, PROTOCOL_TEMPLATE)\n\n // Update manifest\n const updatedManifest: Manifest = {\n ...manifest,\n protocolVersion: PROTOCOL_VERSION,\n cliVersion: CLI_VERSION,\n lastUpdated: new Date().toISOString(),\n }\n writeFileSync(manifestPath, generateManifestContent(updatedManifest))\n\n // Update workflow files in active harnesses\n const updatedTargets: string[] = []\n try {\n updatedTargets.push(...refreshInstalledHarnessWorkflows(cwd, workflowsDir))\n } catch (err) {\n // Log warning but don't fail the update\n console.warn(\n `Warning: Could not update harness workflows: ${err instanceof Error ? err.message : String(err)}`\n )\n }\n\n // Also install any harnesses the user explicitly asked for. This\n // covers the \"I'm on a newer protocol but want to add a new harness\"\n // case as well as the more common \"my init never installed opencode\".\n const requestedHarnesses = options.all\n ? listHarnesses().map(({ id }) => id)\n : (options.harnesses ?? [])\n const newlyInstalled = writeHarnessWorkflows(cwd, requestedHarnesses, workflowsDir)\n\n const harnessInfo =\n updatedTargets.length > 0 ? ` (updated workflows in ${updatedTargets.join(', ')})` : ''\n const installedInfo =\n newlyInstalled.length > 0 ? ` (installed: ${newlyInstalled.join(', ')})` : ''\n const devDepInfo = devDepNote ? ` ${devDepNote}` : ''\n\n return {\n success: true,\n message: `Protocol updated: v${currentVersion} ā v${PROTOCOL_VERSION}${harnessInfo}${installedInfo}${devDepInfo}`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n touchedHarnesses: [...updatedTargets, ...newlyInstalled],\n }\n}\n","#!/usr/bin/env node\nimport { Command } from 'commander'\nimport pc from 'picocolors'\n\nimport { PROTOCOL_VERSION } from '@autonomos/core'\nimport { agents } from './commands/agents'\nimport { init } from './commands/init'\nimport { status } from './commands/status'\nimport { update } from './commands/update'\n\n// Synchronize with the package.json version at build time. The bundler\n// inlines this JSON, so the resolved value is always current.\n// (package.json import ā inlined by the bundler)\nimport packageJson from '../package.json' with { type: 'json' }\nconst CLI_VERSION: string = packageJson.version\n\nconst program = new Command()\n\nprogram\n .name('autonomos')\n .description(\n pc.cyan(`CLI for the Autonomos Agent Protocol\n\nThe Agent Protocol is a specification for AI agents to interact with codebases\nin a structured, consistent way. It defines how agents should read context,\nexecute tasks, and persist knowledge.`) +\n `\n\nDocumentation: ${pc.underline('https://github.com/saoudi-h/autonomos')}`\n )\n .version(\n `${pc.bold('CLI:')} ${pc.green(CLI_VERSION)}\\n${pc.bold('Protocol:')} ${pc.green(PROTOCOL_VERSION)}`,\n '-v, --version',\n 'Show version information'\n )\n .helpOption('-h, --help', 'Show help information')\n .addHelpText(\n 'after',\n `\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos init')} Initialize the Agent Protocol in current directory\n $ ${pc.cyan('autonomos update')} Update Protocol to the latest version\n $ ${pc.cyan('autonomos status')} Show project status and task summary\n $ ${pc.cyan('autonomos agents')} List all AGENT.md files in the project\n\nProject knowledge workflows installed for supported harnesses include\n${pc.cyan('/issue')} (triage), ${pc.cyan('/adopt')} (reviewable migration),\n${pc.cyan('/reconcile')} (drift repair and archival), ${pc.cyan('/design')} (project-specific\ndirection), and ${pc.cyan('/crystallize')} (close-out).\n\n${pc.bold('More info:')}\n Run '${pc.cyan('autonomos <command> --help')}' for detailed information about a command.\n`\n )\n\nprogram\n .command('init')\n .description('Initialize the Agent Protocol in the current directory')\n .addHelpText(\n 'after',\n `\nThis command creates the following structure:\n ${pc.blue('.autonomos/')}\n āāā ${pc.white('manifest.json')} # Protocol metadata and version\n āāā ${pc.white('PROTOCOL.md')} # Immutable protocol specification\n āāā ${pc.white('TASKS.md')} # Task registry\n āāā ${pc.blue('worklogs/')} # Session logs directory\n ${pc.white('AGENT.md')} # Project context file (at root)\n\nAdditionally, when one or more harnesses are selected, the protocol workflow\nfiles (session / task / issue / adopt / reconcile / design / crystallize) are installed at the harness-specific\ntarget directory, e.g. .clinerules/workflows/ for Cline, .claude/skills/ for\nClaude Code, .agents/skills/ for the cross-tool standard (Cursor, Codex, etc.).\nOptional project-owned archives, specs and decisions directories are created only when the\nproject first adopts them; \\`DESIGN.md\\` is never created automatically, and init\nnever creates empty directories for project-owned records.\n\n${pc.bold('Harness selection:')}\n (default) Interactive multi-select prompt at the start of init.\n --harness Skip the prompt and install only for the given harness id(s).\n May be repeated, e.g. --harness cline --harness claude-code.\n --all Skip the prompt and install for all known harnesses.\n --no-prompt Same as not specifying a TTY; useful in CI/scripted contexts.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos init')}\n $ ${pc.cyan('autonomos init --harness cline')}\n $ ${pc.cyan('autonomos init --harness cline --harness claude-code')}\n $ ${pc.cyan('autonomos init --all')}\n $ ${pc.cyan('autonomos init --dry-run')}\n $ ${pc.cyan('cd my-project && autonomos init')}\n\n${pc.bold('Project root detection:')}\n By default, ${pc.cyan('init')} refuses to run from a subdirectory of a\n git/Autonomos project. Run it from the project root, or pass\n ${pc.cyan('--force')} (or set ${pc.cyan('AUTONOMOS_FORCE=1')}) to install\n in ${pc.cyan('cwd')} anyway. In a TTY, you'll be asked to confirm.\n`\n )\n .option('-n, --dry-run', 'Preview what would be created without writing files')\n .option(\n '--harness <name...>',\n 'Install workflows for the specified harness id(s); skip the prompt'\n )\n .option('--all', 'Install workflows for all known harnesses; skip the prompt')\n .option('--no-prompt', 'Skip the interactive harness prompt (use with --harness or --all)')\n .option('--no-install', 'Skip installing @autonomos/cli as devDependency; use npx instead')\n .option(\n '-f, --force',\n 'Install in cwd even if a parent project root is detected (also via AUTONOMOS_FORCE=1)'\n )\n .action(\n async (opts: {\n dryRun?: boolean\n harness?: string[]\n all?: boolean\n prompt?: boolean\n install?: boolean\n force?: boolean\n }) => {\n try {\n const result = await init({\n dryRun: opts.dryRun,\n harnesses: opts.harness,\n all: opts.all,\n noPrompt: opts.prompt === false,\n noInstall: opts.install === false,\n force: opts.force,\n })\n\n if (!result.success) {\n console.error(pc.red(`\\nā ${result.message}`))\n process.exit(1)\n }\n\n if (result.dryRun) {\n console.log(pc.cyan(`\\nš ${result.message} (dry-run)`))\n } else {\n console.log(pc.green(`\\nā
${result.message}`))\n }\n\n if (result.created.length > 0) {\n console.log(`\\n${pc.bold(result.dryRun ? 'Would create:' : 'Created:')}`)\n result.created.forEach(file =>\n console.log(` ${pc.blue('š')} ${pc.white(file)}`)\n )\n }\n\n if (result.harnessFiles && result.harnessFiles.length > 0) {\n console.log(`\\n${pc.bold('Harness workflow files:')}`)\n result.harnessFiles.forEach(file =>\n console.log(` ${pc.cyan('āļø ')} ${pc.white(file)}`)\n )\n }\n\n if (result.warnings.length > 0) {\n console.log(pc.yellow('\\nWarnings:'))\n result.warnings.forEach(warn => console.log(` ${pc.yellow('ā ļø')} ${warn}`))\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n console.error(pc.red(`\\nā ${message}`))\n process.exit(1)\n }\n }\n )\n\nprogram\n .command('update')\n .description('Update the Protocol to the latest version')\n .addHelpText(\n 'after',\n `\nThis command updates the managed protocol artifacts embedded in the CLI.\nYour ${pc.white('AGENT.md')}, ${pc.white('TASKS.md')}, ${pc.white('ISSUES.md')},\nworklogs, archives, specifications, decisions, and user documentation are preserved.\nInstalling an update never archives project records automatically.\n\nIt also:\n - Refreshes the @autonomos/cli devDependency in your package.json to the\n current CLI version (useful when an older init pinned an unresolvable\n version such as ^0.2.0).\n - When ${pc.white('--harness')} or ${pc.white('--all')} is passed, installs\n the workflow files for the given harness(es). This is the recommended\n way to add a new AI harness to an already-initialized project.\n\n${pc.bold('Version comparison:')}\n - If your project has an older version: Updates to the new version\n - If your project has a newer version: Warns you to update the CLI\n - If versions match: No action needed (but the devDependency is still\n refreshed and any newly requested harnesses are still installed)\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos update')}\n $ ${pc.cyan('autonomos update --harness opencode')}\n $ ${pc.cyan('autonomos update --harness opencode --harness kilocode')}\n $ ${pc.cyan('autonomos update --all')}\n`\n )\n .option(\n '--harness <name...>',\n 'Install workflow files for the specified harness id(s) in addition to refreshing existing ones'\n )\n .option(\n '--all',\n 'Install workflow files for every known harness in addition to refreshing existing ones'\n )\n .action((opts: { harness?: string[]; all?: boolean }) => {\n const result = update({ harnesses: opts.harness, all: opts.all })\n\n if (!result.success) {\n if (result.cliOutdated) {\n console.error(pc.yellow(`\\nā ļø ${result.message}`))\n } else {\n console.error(pc.red(`\\nā ${result.message}`))\n }\n process.exit(1)\n }\n\n console.log(pc.green(`\\nā
${result.message}`))\n })\n\nprogram\n .command('status')\n .description('Show project status and task summary')\n .addHelpText(\n 'after',\n `\nDisplays information about the current project:\n - Protocol version\n - Protocol artifact integrity for the installed version\n - CLI version used for initialization\n - Current task registry summary (todo, in-progress, done, blocked)\n - With --history: separate archived counts and task ID collisions\n Only archive/**/TASKS.md registries are counted; history is not read by default.\n Archived does not imply completed. Read diagnostics and partial counts are explicit.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos status')}\n $ ${pc.cyan('autonomos status --history')}\n`\n )\n .option('--history', 'Include archived task registries and check reserved task IDs')\n .action((opts: { history?: boolean }) => {\n const result = status({ history: opts.history })\n\n if (!result.success) {\n console.error(pc.red(`\\nā ${result.message}`))\n process.exit(1)\n }\n\n console.log(\n `\\n${pc.bold('š¦ Protocol')} ${pc.green(`v${result.protocolVersion}`)} ${pc.dim(`(CLI v${result.cliVersion})`)}`\n )\n\n if (result.artifactIntegrity === 'valid') {\n console.log(` ${pc.green('ā Artifacts match the published protocol version')}`)\n } else if (result.artifactIntegrity === 'drifted') {\n console.log(` ${pc.red('ā Protocol artifact drift detected')}`)\n for (const file of result.driftedArtifacts ?? []) {\n console.log(` ${pc.red('ā¢')} ${file}`)\n }\n console.log(` ${pc.dim('Run `autonomos update` to restore canonical artifacts.')}`)\n } else {\n console.log(\n ` ${pc.yellow('! Artifact integrity is unverifiable with this CLI version')}`\n )\n }\n\n if (result.taskSummary) {\n const s = result.taskSummary\n console.log(`\\n${pc.bold('š Current tasks:')} ${pc.cyan(s.total)} total`)\n console.log(` ${pc.white('⬠Todo:')} ${pc.white(s.todo)}`)\n console.log(` ${pc.blue('š In Progress:')} ${pc.blue(s.inProgress)}`)\n console.log(` ${pc.green('ā
Done:')} ${pc.green(s.done)}`)\n if (s.blocked > 0) {\n console.log(` ${pc.red('š« Blocked:')} ${pc.red(s.blocked)}`)\n }\n }\n if (result.archivedTaskSummary) {\n const s = result.archivedTaskSummary\n console.log(\n `\\n${pc.bold('Historical task records:')} ${s.total}${result.historyComplete ? '' : ' (incomplete scan)'}`\n )\n console.log(\n ` Todo: ${s.todo}; in progress: ${s.inProgress}; done: ${s.done}; blocked: ${s.blocked}`\n )\n console.log(\n pc.dim(\n ' Historical status is not current work; archived does not mean completed.'\n )\n )\n }\n for (const warning of result.warnings ?? []) console.warn(pc.yellow(`! ${warning}`))\n if (result.duplicateTaskIds?.length) {\n console.warn(pc.yellow(`! Duplicate task IDs: ${result.duplicateTaskIds.join(', ')}`))\n }\n if (result.warnings?.length || result.duplicateTaskIds?.length) process.exitCode = 1\n })\n\nprogram\n .command('agents')\n .description('List all AGENT.md files in the project, or the ancestor chain for a path')\n .argument(\n '[path]',\n 'Optional file or folder. When provided, return the ordered list of ancestor AGENT.md files (root -> target) instead of the full tree.'\n )\n .option('-a, --all', 'In tree mode: search from project root instead of current directory')\n .addHelpText(\n 'after',\n `\nThis command has two modes:\n\n${pc.bold('Tree mode')} (default, or with ${pc.cyan('--all')}):\n Discover and display all ${pc.white('AGENT.md')} files in a tree structure.\n Used at session start to get the broader fractal picture of the project.\n\n${pc.bold('Ancestors mode')} (with a positional ${pc.cyan('<path>')} argument):\n Return the ordered list of ${pc.white('AGENT.md')} files on the path from the\n target up to the project root. Root-first; non-existent ancestors are\n silently skipped. Used at task start to get the precise fractal context\n for the file or folder being worked on.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos agents')} # Tree, from current dir\n $ ${pc.cyan('autonomos agents --all')} # Tree, from project root\n $ ${pc.cyan('autonomos agents apps/web')} # Ancestors for apps/web\n $ ${pc.cyan('autonomos agents apps/web/components/ui/button.tsx')} # Ancestors for a file\n`\n )\n .action((path: string | undefined, opts: { all?: boolean }) => {\n const result = agents({ all: opts.all, target: path })\n\n if (!result.success) {\n console.error(\n pc.red(`\nā ${result.message}`)\n )\n process.exit(1)\n }\n\n if (result.mode === 'ancestors') {\n console.log(\n pc.cyan(`\nš ${result.message}`)\n )\n } else {\n console.log('\\n' + (result.tree ?? result.message))\n console.log(\n pc.dim(`\n${result.message}`)\n )\n }\n })\n\nprogram\n .command('version')\n .description('Show the current Protocol version')\n .action(() => {\n console.log(\n `${pc.bold('Agent Protocol')} ${pc.green(`v${PROTOCOL_VERSION}`)} ${pc.dim(`(CLI v${CLI_VERSION})`)}`\n )\n })\n\nprogram.parse()\n"],"mappings":";k0BAmCA,SAAS,EAAe,EAAa,EAAiB,EAAQ,EAAiB,CAC3E,IAAM,EAAwB,CAAC,EAGzB,EAAY,EAAK,EAAK,CAAU,EAClC,EAAW,CAAS,GACpB,EAAQ,KAAK,CACT,KAAM,EACN,aAAc,EAAS,EAAS,CAAS,GAAK,EAC9C,OACJ,CAAC,EAIL,GAAI,CACA,IAAM,EAAQ,EAAY,CAAG,EAC7B,IAAK,IAAM,KAAQ,EAAO,CAEtB,GACI,EAAK,WAAW,GAAG,GACnB,IAAS,gBACT,IAAS,QACT,IAAS,QAET,SAGJ,IAAM,EAAW,EAAK,EAAK,CAAI,EAC/B,GAAI,CACI,EAAS,CAAQ,CAAC,CAAC,YAAY,GAC/B,EAAQ,KAAK,GAAG,EAAe,EAAU,EAAS,EAAQ,CAAC,CAAC,CAEpE,MAAQ,CAER,CACJ,CACJ,MAAQ,CAER,CAEA,OAAO,CACX,CAWA,SAAS,EAAa,EAAuB,EAAyB,CAClE,GAAI,EAAQ,SAAW,EACnB,MAAO,8BAGX,IAAM,EAAW,EAAS,CAAO,EAC3B,EAAiB,CAAE,KAAM,EAAU,QAAS,GAAO,SAAU,CAAC,CAAE,EAGtE,IAAK,IAAM,KAAS,EAAS,CACzB,IAAM,EAAQ,EAAM,aAAa,MAAM,GAAG,EACtC,EAAU,EAEd,IAAK,IAAM,KAAQ,EAAO,CACtB,IAAM,EAAU,IA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,CAAC,CACA,QAAQ,EAA0B,IAA4B,CAC3D,IAAM,EAAS,EAAO,CAAE,IAAK,EAAK,IAAK,OAAQ,CAAK,CAAC,EAEhD,EAAO,UACR,QAAQ,MACJ,EAAG,IAAI;IACnB,EAAO,SAAS,CACR,EACA,QAAQ,KAAK,CAAC,GAGd,EAAO,OAAS,YAChB,QAAQ,IACJ,EAAG,KAAK;KACnB,EAAO,SAAS,CACT,GAEA,QAAQ,IAAI;GAAQ,EAAO,MAAQ,EAAO,QAAQ,EAClD,QAAQ,IACJ,EAAG,IAAI;EACrB,EAAO,SAAS,CACN,EAER,CAAC,EAEL,EACK,QAAQ,SAAS,CAAC,CAClB,YAAY,mCAAmC,CAAC,CAChD,WAAa,CACV,QAAQ,IACJ,GAAG,EAAG,KAAK,gBAAgB,EAAE,GAAG,EAAG,MAAM,IAAI,GAAkB,EAAE,GAAG,EAAG,IAAI,SAAS,EAAY,EAAE,GACtG,CACJ,CAAC,EAEL,EAAQ,MAAM"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["CLI_VERSION","packageJson.version","CLI_VERSION","packageJson.version","packageJson.version"],"sources":["../src/commands/agents.ts","../package.json","../src/protocol-artifacts.ts","../src/commands/init.ts","../src/commands/records.ts","../src/commands/status.ts","../src/commands/update.ts","../src/index.ts"],"sourcesContent":["import { existsSync, readdirSync, statSync } from 'node:fs'\nimport { basename, join, relative, resolve } from 'node:path'\n\nimport {\n AGENT_FILE,\n findAncestorAgents,\n findProjectRoot,\n type AncestorAgent,\n} from '@autonomos/core'\n\ninterface AgentsOptions {\n cwd?: string\n /**\n * When true, search from the project root (discovered by walking up to\n * .autonomos or .git) instead of the current directory.\n */\n all?: boolean\n /**\n * Optional target path (file or directory). When provided, the command\n * switches to \"ancestor lookup\" mode and prints the ordered list of\n * AGENT.md files on the path from the target up to the project root.\n * Existing ancestors only; gaps are silently skipped.\n */\n target?: string\n}\n\ninterface AgentEntry {\n path: string\n relativePath: string\n depth: number\n}\n\n/**\n * Recursively find all AGENT.md files in a directory\n */\nfunction findAgentFiles(dir: string, baseDir: string, depth = 0): AgentEntry[] {\n const entries: AgentEntry[] = []\n\n // Check if AGENT.md exists in current directory\n const agentPath = join(dir, AGENT_FILE)\n if (existsSync(agentPath)) {\n entries.push({\n path: agentPath,\n relativePath: relative(baseDir, agentPath) || AGENT_FILE,\n depth,\n })\n }\n\n // Scan subdirectories\n try {\n const items = readdirSync(dir)\n for (const item of items) {\n // Skip hidden directories and node_modules\n if (\n item.startsWith('.') ||\n item === 'node_modules' ||\n item === 'dist' ||\n item === 'build'\n ) {\n continue\n }\n\n const itemPath = join(dir, item)\n try {\n if (statSync(itemPath).isDirectory()) {\n entries.push(...findAgentFiles(itemPath, baseDir, depth + 1))\n }\n } catch {\n // Skip inaccessible directories\n }\n }\n } catch {\n // Skip inaccessible directories\n }\n\n return entries\n}\n\ninterface TreeNode {\n name: string\n isAgent: boolean\n children: Record<string, TreeNode>\n}\n\n/**\n * Format agent entries as a true tree structure\n */\nfunction formatAsTree(entries: AgentEntry[], baseDir: string): string {\n if (entries.length === 0) {\n return ' (no AGENT.md files found)'\n }\n\n const rootName = basename(baseDir)\n const tree: TreeNode = { name: rootName, isAgent: false, children: {} }\n\n // Build the tree\n for (const entry of entries) {\n const parts = entry.relativePath.split('/')\n let current = tree\n\n for (const part of parts) {\n const isAgent = part === AGENT_FILE\n\n let child = current.children[part]\n if (!child) {\n child = {\n name: part,\n isAgent,\n children: {},\n }\n current.children[part] = child\n }\n current = child\n }\n }\n\n const lines: string[] = []\n lines.push(`š ${rootName}/`)\n\n function render(node: TreeNode, prefix = '', _isLast = true): void {\n const children = Object.values(node.children)\n children.sort((a, b) => {\n // Folders first\n if (!a.isAgent && b.isAgent) return -1\n if (a.isAgent && !b.isAgent) return 1\n return a.name.localeCompare(b.name)\n })\n\n children.forEach((child, index) => {\n const childIsLast = index === children.length - 1\n const branch = childIsLast ? 'āāā ' : 'āāā '\n const icon = child.isAgent ? 'š' : 'š'\n const name = child.isAgent ? child.name : `${child.name}/`\n\n lines.push(`${prefix}${branch}${icon} ${name}`)\n\n if (!child.isAgent) {\n const nextPrefix = prefix + (childIsLast ? ' ' : 'ā ')\n render(child, nextPrefix, childIsLast)\n }\n })\n }\n\n render(tree)\n return lines.join('\\n')\n}\n\n/**\n * Format the ancestor-lookup result as a numbered, root-first list.\n */\nfunction formatAncestors(ancestors: AncestorAgent[]): string {\n if (ancestors.length === 0) {\n return ' (no AGENT.md files found in the ancestor chain)'\n }\n const lines = ancestors.map((a, i) => {\n const idx = (i + 1).toString().padStart(ancestors.length.toString().length, ' ')\n return ` ${idx}. ${a.relativeDir === '.' ? './AGENT.md' : `${a.relativeDir}/AGENT.md`}`\n })\n return lines.join('\\n')\n}\n\ninterface AgentsResult {\n success: boolean\n message: string\n tree?: string\n count?: number\n /**\n * When in ancestor-lookup mode, the list of ancestor AGENT.md files\n * (root-first order). Each entry has `dir`, `path`, `relativeDir`.\n */\n ancestors?: AncestorAgent[]\n /** The mode that was used. Useful for the caller to format output. */\n mode: 'tree' | 'ancestors'\n}\n\n/**\n * List AGENT.md files in the project.\n *\n * Two modes:\n *\n * 1. **Tree mode** (default, or with `--all`): list all AGENT.md files\n * in a tree structure. Used at session start to get the full fractal\n * picture of the project.\n *\n * 2. **Ancestors mode** (with a positional `<path>` argument): return\n * the ordered list of AGENT.md files on the path from the target\n * up to the project root. Root-first, with non-existent ancestors\n * silently skipped. Used at task start to get the precise fractal\n * context for the file or folder being worked on.\n */\nexport function agents(options: AgentsOptions = {}): AgentsResult {\n const cwd = options.cwd ?? process.cwd()\n\n // --- Ancestors mode (positional <path> arg) ---\n if (options.target) {\n const projectRoot = findProjectRoot(cwd) ?? cwd\n let ancestors: AncestorAgent[]\n try {\n ancestors = findAncestorAgents(resolve(cwd, options.target), projectRoot)\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n return {\n success: false,\n message: `Failed to look up ancestors: ${message}`,\n mode: 'ancestors',\n }\n }\n const list = formatAncestors(ancestors)\n return {\n success: true,\n message: `Found ${ancestors.length} ancestor AGENT.md file(s) for \"${options.target}\" (root ā target):\\n${list}`,\n count: ancestors.length,\n ancestors,\n mode: 'ancestors',\n }\n }\n\n // --- Tree mode (default) ---\n let searchBase: string\n if (options.all) {\n const projectRoot = findProjectRoot(cwd)\n if (!projectRoot) {\n return {\n success: false,\n message: 'Could not find project root (.autonomos or .git directory).',\n mode: 'tree',\n }\n }\n searchBase = projectRoot\n } else {\n searchBase = cwd\n }\n\n const entries = findAgentFiles(searchBase, searchBase)\n\n if (entries.length === 0) {\n return {\n success: true,\n message: 'No AGENT.md files found.',\n count: 0,\n mode: 'tree',\n }\n }\n\n const tree = formatAsTree(entries, searchBase)\n return {\n success: true,\n message: `Found ${entries.length} AGENT.md file(s)`,\n tree,\n count: entries.length,\n mode: 'tree',\n }\n}\n","","import { existsSync, readFileSync } from 'node:fs'\nimport { join, relative, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport {\n AUTONOMOS_DIR,\n listHarnesses,\n PROTOCOL_FILE,\n PROTOCOL_TEMPLATE,\n PROTOCOL_VERSION,\n resolveTargets,\n} from '@autonomos/core'\n\nexport const WORKFLOW_FILES = [\n 'protocol-session.md',\n 'protocol-task.md',\n 'protocol-crystallize.md',\n 'protocol-issue.md',\n 'protocol-adopt.md',\n 'protocol-reconcile.md',\n 'protocol-design.md',\n] as const\n\nexport type ArtifactIntegrity = 'valid' | 'drifted' | 'unverifiable'\n\nexport interface ArtifactIntegrityResult {\n state: ArtifactIntegrity\n driftedFiles: string[]\n}\n\nexport function getWorkflowDirCandidates(moduleUrl: string = import.meta.url): string[] {\n const here = fileURLToPath(moduleUrl)\n return [\n resolve(here, '..', '..', '..', 'core', 'src', 'workflows'),\n resolve(here, '..', '..', '..', 'core', 'dist', 'workflows'),\n resolve(here, '..', '..', '..', '..', 'core', 'dist', 'workflows'),\n ]\n}\n\nexport function getWorkflowsDir(): string {\n const candidates = getWorkflowDirCandidates()\n for (const candidate of candidates) {\n if (existsSync(candidate)) return candidate\n }\n throw new Error('Could not locate the workflows directory inside @autonomos/core')\n}\n\nexport interface TargetArtifactFile {\n sourceFilename: string\n relativeTargetFilePath: string\n destinationPath: string\n}\n\nexport function buildTargetFilename(sourceFile: string, targetExtension: string): string {\n const withoutPrefix = sourceFile.replace(/^protocol-/, '')\n const withoutExt = withoutPrefix.replace(/\\.[^.]+$/, '')\n return withoutExt + targetExtension\n}\n\nexport function getTargetArtifactFiles(\n target: { path: string; fileExtension: string; kind?: 'flat' | 'skill' },\n workflowFiles: readonly string[] = WORKFLOW_FILES\n): TargetArtifactFile[] {\n return workflowFiles.map(sourceFile => {\n if (target.kind === 'skill') {\n const skillName = sourceFile.replace(/\\.[^.]+$/, '')\n const relPath = join(skillName, 'SKILL.md')\n return {\n sourceFilename: sourceFile,\n relativeTargetFilePath: relPath,\n destinationPath: join(target.path, relPath),\n }\n }\n const flatFilename = buildTargetFilename(sourceFile, target.fileExtension)\n return {\n sourceFilename: sourceFile,\n relativeTargetFilePath: flatFilename,\n destinationPath: join(target.path, flatFilename),\n }\n })\n}\n\nexport function verifyProtocolArtifacts(\n cwd: string,\n declaredVersion: string\n): ArtifactIntegrityResult {\n if (declaredVersion !== PROTOCOL_VERSION) {\n return { state: 'unverifiable', driftedFiles: [] }\n }\n\n const driftedFiles: string[] = []\n const protocolPath = join(cwd, AUTONOMOS_DIR, PROTOCOL_FILE)\n compareFile(protocolPath, PROTOCOL_TEMPLATE, cwd, driftedFiles)\n\n const workflowsDir = getWorkflowsDir()\n const targets = resolveTargets(\n listHarnesses().map(({ id }) => id),\n cwd\n )\n\n const legacyAgentWorkflows = join(cwd, '.agent', 'workflows')\n if (existsSync(legacyAgentWorkflows)) {\n targets.push({\n path: legacyAgentWorkflows,\n fileExtension: '.md',\n kind: 'flat',\n usedBy: ['antigravity-legacy'],\n })\n }\n\n for (const target of targets) {\n const expected = getTargetArtifactFiles(target, WORKFLOW_FILES).map(file => ({\n source: readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8'),\n destination: file.destinationPath,\n }))\n if (!expected.some(({ destination }) => existsSync(destination))) continue\n for (const file of expected) {\n compareFile(file.destination, file.source, cwd, driftedFiles)\n }\n }\n\n return {\n state: driftedFiles.length === 0 ? 'valid' : 'drifted',\n driftedFiles,\n }\n}\n\nfunction compareFile(path: string, expected: string, cwd: string, driftedFiles: string[]): void {\n if (!existsSync(path) || readFileSync(path, 'utf-8') !== expected) {\n driftedFiles.push(relative(cwd, path))\n }\n}\n","import { checkbox, confirm } from '@inquirer/prompts'\nimport { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\nimport {\n AGENT_FILE,\n AUTONOMOS_DIR,\n createManifest,\n displayRelative,\n findProjectRoot,\n generateAgentTemplate,\n generateManifestContent,\n isSamePath,\n listHarnesses,\n MANIFEST_FILE,\n PROTOCOL_FILE,\n PROTOCOL_TEMPLATE,\n PROTOCOL_VERSION,\n resolveTargets,\n TASKS_FILE,\n TASKS_TEMPLATE,\n WORKLOGS_DIR,\n} from '@autonomos/core'\n\n// Synchronize with the package.json version at build time. The bundler\n// inlines this JSON, so the resolved value is always current.\n// (package.json import ā inlined by the bundler)\nimport packageJson from '../../package.json' with { type: 'json' }\nimport { getTargetArtifactFiles, getWorkflowsDir, WORKFLOW_FILES } from '../protocol-artifacts'\nconst CLI_VERSION: string = packageJson.version\n\ninterface InitOptions {\n cwd?: string\n dryRun?: boolean\n /** Specific harness ids to install for. */\n harnesses?: string[]\n /** Install for all known harnesses (overrides `harnesses`). */\n all?: boolean\n /** Skip the interactive prompt even when no harnesses are specified. */\n noPrompt?: boolean\n /** When true, skip installing @autonomos/cli devDependency.\n * The npm script will use npx instead. */\n noInstall?: boolean\n /**\n * When true, ignore the \"you're inside a bigger project\" check and\n * initialize the protocol in `cwd` no matter what. Mirrors the\n * `AUTONOMOS_FORCE=1` env var, which is more convenient in scripts.\n */\n force?: boolean\n /**\n * When set, treat stdin as a TTY (true) or non-TTY (false) regardless\n * of the real value. Tests use this to opt in/out of the project-root\n * confirmation prompt without mutating the real TTY state.\n */\n interactiveOverride?: boolean\n}\n\nexport interface ResolveInstallResult {\n installDir: string\n warnings: string[]\n abort?: { message: string }\n}\n\ninterface ResolveInstallOptions {\n force: boolean\n noPrompt: boolean\n isInteractive: boolean\n}\n\ninterface InitResult {\n success: boolean\n message: string\n created: string[]\n warnings: string[]\n dryRun?: boolean\n harnessFiles?: string[]\n}\n\n/**\n * Prompt the user interactively for which harnesses to install for.\n * Returns the selected harness ids. An empty array means the user chose\n * to skip harness installation entirely.\n */\nasync function promptForHarnesses(): Promise<string[]> {\n const harnesses = listHarnesses()\n return checkbox({\n message:\n 'Which AI harnesses do you want to install the protocol for? (space to toggle, enter to confirm)',\n choices: harnesses.map(({ id, harness }) => ({\n name: harness.name,\n value: id,\n checked: harness.preferred,\n })),\n })\n}\n\n/**\n * Resolve which directory the protocol should be installed into.\n *\n * The protocol expects to live at the root of the user's project (where\n * `.git` / `.autonomos` already exists, or where one would be created).\n * When `init` is invoked from a subdirectory of such a project, we must\n * either:\n *\n * - point the user at the actual root and refuse to install, or\n * - install at the detected root on their behalf.\n *\n * We pick the first option by default, because silently installing\n * elsewhere is the bug that motivated this helper. The user can opt\n * into the second behavior with `--force` or `AUTONOMOS_FORCE=1`.\n *\n * Returns the directory to install in. When the caller passes `--force`\n * (or the env var is set), and a different project root is detected, we\n * install at that root instead. In interactive mode we also confirm the\n * detour with the user.\n */\nexport async function resolveInstallDir(\n requestedCwd: string,\n options: ResolveInstallOptions\n): Promise<ResolveInstallResult> {\n const warnings: string[] = []\n const detectedRoot = findProjectRoot(requestedCwd)\n\n // No project root found above us: nothing to bubble up to. Either\n // we're in a fresh directory (warn about no git) or we're literally\n // at the root of a project that uses neither marker. Either way we\n // install in place.\n if (!detectedRoot) {\n if (!existsSync(join(requestedCwd, '.git'))) {\n warnings.push('No Git repository detected. Consider running `git init` first.')\n }\n return { installDir: requestedCwd, warnings }\n }\n\n // The project root is exactly where we are: ideal case, no detour.\n if (isSamePath(detectedRoot, requestedCwd)) {\n return { installDir: requestedCwd, warnings }\n }\n\n // The project root is somewhere above us. Decide what to do.\n const relCwd = displayRelative(requestedCwd, detectedRoot)\n const force = options.force || process.env.AUTONOMOS_FORCE === '1'\n\n if (force) {\n warnings.push(\n `Detected project root at ${displayRelative(detectedRoot, requestedCwd)} ` +\n `(AUTONOMOS_FORCE=1); installing there instead of \"${relCwd}\".`\n )\n return { installDir: detectedRoot, warnings }\n }\n\n if (options.isInteractive && !options.noPrompt) {\n const proceed = await confirm({\n message:\n `You're inside a project rooted at ${detectedRoot}.\\n` +\n `The protocol should be installed at the project root, not in \"${relCwd}\".\\n` +\n `Install at the project root instead?`,\n default: true,\n })\n if (proceed) {\n warnings.push(`Detected project root above \"${relCwd}\"; installing at ${detectedRoot}.`)\n return { installDir: detectedRoot, warnings }\n }\n return {\n installDir: requestedCwd,\n warnings,\n abort: {\n message:\n `Aborted: refusing to install Autonomos inside a subdirectory. ` +\n `Run the command from ${detectedRoot} (or pass --force / set AUTONOMOS_FORCE=1).`,\n },\n }\n }\n\n return {\n installDir: requestedCwd,\n warnings,\n abort: {\n message:\n `Cannot initialize Autonomos from a subdirectory.\\n` +\n ` Current directory : ${requestedCwd}\\n` +\n ` Detected root : ${detectedRoot}\\n` +\n `Re-run from the project root, or pass --force (or set AUTONOMOS_FORCE=1) to install here anyway.`,\n },\n }\n}\n\n/**\n * Initialize the Autonomos Agent Protocol in a directory.\n */\nexport async function init(options: InitOptions = {}): Promise<InitResult> {\n const requestedCwd = options.cwd ?? process.cwd()\n const dryRun = options.dryRun ?? false\n\n // Resolve the install target. We do this before any other check so a\n // bad install location fails fast with a clear message.\n const isInteractive =\n options.interactiveOverride ?? (process.stdin.isTTY === true && !options.dryRun)\n const resolution = await resolveInstallDir(requestedCwd, {\n force: options.force ?? false,\n noPrompt: options.noPrompt ?? false,\n isInteractive,\n })\n if (resolution.abort) {\n return {\n success: false,\n message: resolution.abort.message,\n created: [],\n warnings: resolution.warnings,\n dryRun,\n }\n }\n const cwd = resolution.installDir\n const warnings: string[] = [...resolution.warnings]\n\n const created: string[] = []\n const harnessFiles: string[] = []\n\n // Detect package.json for npm script registration\n const packageJsonPath = join(cwd, 'package.json')\n const hasPackageJson = existsSync(packageJsonPath) && statSync(packageJsonPath).isFile()\n\n // Check if already initialized\n const autonomosDir = join(cwd, AUTONOMOS_DIR)\n const isInitialized = existsSync(autonomosDir)\n\n // Resolve which harnesses to install for\n let selectedHarnesses: string[]\n if (options.all) {\n selectedHarnesses = listHarnesses().map(({ id }) => id)\n } else if (options.harnesses && options.harnesses.length > 0) {\n selectedHarnesses = options.harnesses\n } else if (options.noPrompt || options.dryRun) {\n selectedHarnesses = []\n } else {\n selectedHarnesses = await promptForHarnesses()\n }\n\n if (isInitialized && selectedHarnesses.length === 0) {\n return {\n success: false,\n message: `Project already initialized with Protocol v${PROTOCOL_VERSION}. Use \\`autonomos update\\` to update, or specify harnesses with --harness to install workflow files.`,\n created: [],\n warnings: [],\n dryRun,\n }\n }\n\n // Compute the unique target directories\n const targets = resolveTargets(selectedHarnesses, cwd)\n\n // In dry-run mode, just collect what would be created\n if (dryRun) {\n if (!isInitialized) {\n created.push(AUTONOMOS_DIR)\n created.push(`${AUTONOMOS_DIR}/${WORKLOGS_DIR}`)\n created.push(`${AUTONOMOS_DIR}/${MANIFEST_FILE}`)\n created.push(`${AUTONOMOS_DIR}/${PROTOCOL_FILE}`)\n created.push(`${AUTONOMOS_DIR}/${TASKS_FILE}`)\n } else {\n created.push(`${AUTONOMOS_DIR}/${MANIFEST_FILE} (update)`)\n created.push(`${AUTONOMOS_DIR}/${PROTOCOL_FILE} (update)`)\n }\n\n const agentPath = join(cwd, AGENT_FILE)\n if (!existsSync(agentPath)) {\n created.push(AGENT_FILE)\n } else {\n warnings.push(`${AGENT_FILE} already exists, would skip.`)\n }\n\n for (const target of targets) {\n for (const file of getTargetArtifactFiles(target, WORKFLOW_FILES)) {\n harnessFiles.push(file.destinationPath)\n }\n }\n\n return {\n success: true,\n message: `Would ${isInitialized ? 'update workflows in' : 'initialize'} project with Agent Protocol v${PROTOCOL_VERSION}${selectedHarnesses.length ? ` (harnesses: ${selectedHarnesses.join(', ')})` : ''}`,\n created,\n warnings,\n dryRun: true,\n harnessFiles,\n }\n }\n\n // Create .autonomos directory\n if (!existsSync(autonomosDir)) {\n mkdirSync(autonomosDir, { recursive: true })\n created.push(AUTONOMOS_DIR)\n }\n\n // Create worklogs directory\n const worklogsDir = join(autonomosDir, WORKLOGS_DIR)\n if (!existsSync(worklogsDir)) {\n mkdirSync(worklogsDir, { recursive: true })\n created.push(`${AUTONOMOS_DIR}/${WORKLOGS_DIR}`)\n }\n\n // Create manifest.json\n const manifest = createManifest(CLI_VERSION)\n const manifestPath = join(autonomosDir, MANIFEST_FILE)\n writeFileSync(manifestPath, generateManifestContent(manifest))\n created.push(`${AUTONOMOS_DIR}/${MANIFEST_FILE}`)\n\n // Create PROTOCOL.md\n const protocolPath = join(autonomosDir, PROTOCOL_FILE)\n writeFileSync(protocolPath, PROTOCOL_TEMPLATE)\n created.push(`${AUTONOMOS_DIR}/${PROTOCOL_FILE}`)\n\n // Create TASKS.md (only if it doesn't exist)\n const tasksPath = join(autonomosDir, TASKS_FILE)\n if (!existsSync(tasksPath)) {\n writeFileSync(tasksPath, TASKS_TEMPLATE)\n created.push(`${AUTONOMOS_DIR}/${TASKS_FILE}`)\n } else {\n warnings.push(`${TASKS_FILE} already exists, skipping.`)\n }\n\n // Create AGENT.md at root (only if it doesn't exist)\n const agentPath = join(cwd, AGENT_FILE)\n if (!existsSync(agentPath)) {\n const projectName = cwd.split('/').pop() ?? 'Project'\n writeFileSync(agentPath, generateAgentTemplate(projectName))\n created.push(AGENT_FILE)\n } else {\n warnings.push(`${AGENT_FILE} already exists, skipping.`)\n }\n\n // Register npm script \"autonomos\" if package.json exists\n if (hasPackageJson) {\n try {\n const pkgRaw = readFileSync(packageJsonPath, 'utf-8')\n const pkg = JSON.parse(pkgRaw)\n const hadScript = !!pkg.scripts?.['autonomos']\n const previousDevDep = pkg.devDependencies?.['@autonomos/cli']\n const newDevDep = `^${CLI_VERSION}`\n\n if (!pkg.scripts) pkg.scripts = {}\n\n if (options.noInstall || options.dryRun) {\n // Mode B: npx only, no devDependency\n pkg.scripts['autonomos'] = 'npx --yes @autonomos/cli'\n writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 4) + '\\n')\n created.push('package.json (scripts.autonomos via npx)')\n if (!hadScript) {\n warnings.push(\n 'Added \"autonomos\" npm script using npx (--no-install mode). Run `npm install` when ready.'\n )\n }\n } else {\n // Mode A (default): install as devDependency\n pkg.scripts['autonomos'] = 'autonomos'\n\n if (!pkg.devDependencies) pkg.devDependencies = {}\n pkg.devDependencies['@autonomos/cli'] = newDevDep\n\n writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 4) + '\\n')\n created.push('package.json (scripts.autonomos + devDependencies.@autonomos/cli)')\n\n // Three distinct situations to communicate:\n // 1. fresh install: nothing existed before\n // 2. devDep was already there but pinned to a stale\n // version (typical of older CLI builds that wrote\n // ^0.2.0, which doesn't exist on the registry)\n // 3. devDep was already there at the current version\n // and only the script needed adding\n if (!hadScript && !previousDevDep) {\n warnings.push(\n 'Added \"autonomos\" npm script and @autonomos/cli devDependency. Run `npm install` to install.'\n )\n } else if (previousDevDep && previousDevDep !== newDevDep) {\n // Covers both \"old script + stale devDep\" and\n // \"no script + stale devDep\" cases. Refreshing the\n // devDep is what unblocks `pnpm i` when the pinned\n // version isn't on the registry.\n warnings.push(\n `Bumped @autonomos/cli devDependency: ${previousDevDep} ā ${newDevDep}. Run \\`npm install\\` to apply.`\n )\n } else if (!hadScript && previousDevDep) {\n warnings.push('Added \"autonomos\" npm script (devDependency was already set).')\n }\n }\n } catch {\n warnings.push('Could not update package.json (invalid JSON or read error).')\n }\n }\n\n // Install workflow files for each selected harness\n const workflowsDir = getWorkflowsDir()\n for (const target of targets) {\n for (const file of getTargetArtifactFiles(target, WORKFLOW_FILES)) {\n mkdirSync(dirname(file.destinationPath), { recursive: true })\n const source = readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8')\n writeFileSync(file.destinationPath, source)\n harnessFiles.push(file.destinationPath)\n }\n }\n\n const harnessMsg =\n selectedHarnesses.length > 0\n ? ` for harnesses: ${selectedHarnesses.join(', ')}`\n : ' (no harness workflows installed)'\n\n return {\n success: true,\n message: `Project initialized with Agent Protocol v${PROTOCOL_VERSION}${harnessMsg}`,\n created,\n warnings,\n dryRun: false,\n harnessFiles,\n }\n}\n","import {\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n renameSync,\n rmdirSync,\n unlinkSync,\n writeFileSync,\n} from 'node:fs'\nimport { dirname, join, relative, sep } from 'node:path'\n\nimport {\n appendToClosedRegistry,\n ARCHIVE_DIR,\n ARCHIVE_INDEX_FILE,\n ARTIFACT_FORMAT,\n AUTONOMOS_DIR,\n checkContextBudgets,\n CLOSED_DIR,\n dedentEntry,\n extractIssues,\n extractTasks,\n findProjectRoot,\n generateManifestContent,\n isClosedIssueStatus,\n ISSUES_FILE,\n LEGACY_WORKLOGS_DIR,\n MANIFEST_FILE,\n manifestArtifactFormat,\n parseIssueEntries,\n parseManifest,\n parseTaskEntries,\n prefixMapper,\n relocateLinks,\n relocateRootMentions,\n stampAbandoned,\n stampCompleted,\n TASKS_FILE,\n WORKLOGS_DIR,\n type BudgetFinding,\n type Manifest,\n type PathMapper,\n} from '@autonomos/core'\n\ninterface Paths {\n root: string\n autonomos: string\n manifest: string\n tasks: string\n issues: string\n closedDir: string\n closedTasks: string\n closedIssues: string\n worklogs: string\n legacyWorklogs: string\n archiveIndex: string\n}\n\nfunction resolvePaths(cwd: string): Paths {\n const root = findProjectRoot(cwd) ?? cwd\n const autonomos = join(root, AUTONOMOS_DIR)\n const archive = join(autonomos, ARCHIVE_DIR)\n const closedDir = join(archive, CLOSED_DIR)\n return {\n root,\n autonomos,\n manifest: join(autonomos, MANIFEST_FILE),\n tasks: join(autonomos, TASKS_FILE),\n issues: join(autonomos, ISSUES_FILE),\n closedDir,\n closedTasks: join(closedDir, TASKS_FILE),\n closedIssues: join(closedDir, ISSUES_FILE),\n worklogs: join(autonomos, WORKLOGS_DIR),\n legacyWorklogs: join(archive, LEGACY_WORKLOGS_DIR),\n archiveIndex: join(archive, ARCHIVE_INDEX_FILE),\n }\n}\n\nfunction today(): string {\n return new Date().toISOString().slice(0, 10)\n}\n\nfunction readOptional(path: string): string | undefined {\n return existsSync(path) ? readFileSync(path, 'utf8') : undefined\n}\n\nfunction readManifest(paths: Paths): Manifest | string {\n if (!existsSync(paths.manifest)) return 'Project not initialized. Run `autonomos init` first.'\n try {\n return parseManifest(readFileSync(paths.manifest, 'utf8'))\n } catch {\n return 'Could not read manifest.json'\n }\n}\n\n/** Pending writes; `read` sees planned content before it reaches the disk. */\nclass Plan {\n readonly writes = new Map<string, string>()\n readonly renames: { from: string; to: string }[] = []\n readonly deletes = new Set<string>()\n\n read(path: string): string | undefined {\n return this.writes.get(path) ?? (this.deletes.has(path) ? undefined : readOptional(path))\n }\n\n write(path: string, content: string): void {\n if (readOptional(path) === content && !this.writes.has(path)) return\n this.writes.set(path, content)\n }\n\n apply(): void {\n for (const { from, to } of this.renames) {\n mkdirSync(dirname(to), { recursive: true })\n renameSync(from, to)\n }\n for (const [path, content] of this.writes) {\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, content)\n }\n for (const path of this.deletes) if (existsSync(path)) unlinkSync(path)\n }\n}\n\ninterface ClosedRecords {\n tasks: string[]\n issues: string[]\n}\n\n/**\n * Move selected task/issue entries into the closed registries.\n * `transformTask` may stamp dates; link targets are repaired for the new location.\n */\nfunction planClose(\n plan: Plan,\n paths: Paths,\n selectTask: (id: string, status: string) => boolean,\n selectIssue: (id: string, status: string) => boolean,\n options: {\n mapPath?: PathMapper\n transformTask?: (text: string, status: string) => string\n groupByHeading?: string\n } = {}\n): ClosedRecords {\n const closed: ClosedRecords = { tasks: [], issues: [] }\n const relocate = (text: string): string =>\n relocateLinks(text, paths.autonomos, paths.closedDir, options.mapPath)\n\n const tasks = plan.read(paths.tasks)\n if (tasks !== undefined) {\n const { remaining, moved } = extractTasks(tasks, e => selectTask(e.id, e.status))\n if (moved.length) {\n plan.write(paths.tasks, remaining)\n let registry = plan.read(paths.closedTasks)\n const groups = new Map<string, string[]>()\n for (const entry of moved) {\n closed.tasks.push(entry.id)\n let text = dedentEntry(entry.text)\n if (options.transformTask) text = options.transformTask(text, entry.status)\n const key = options.groupByHeading\n ? relocate(\n `${['From TASKS.md', ...entry.headings].join(' āŗ ')} (moved ${options.groupByHeading})`\n )\n : ''\n groups.set(key, [...(groups.get(key) ?? []), relocate(text)])\n }\n for (const [heading, entries] of groups)\n registry = appendToClosedRegistry(registry, 'tasks', entries, heading || undefined)\n plan.write(paths.closedTasks, registry ?? '')\n }\n }\n\n const issues = plan.read(paths.issues)\n if (issues !== undefined) {\n const { remaining, moved } = extractIssues(issues, e => selectIssue(e.id, e.status))\n if (moved.length) {\n plan.write(paths.issues, remaining)\n const heading = options.groupByHeading\n ? `From ISSUES.md (moved ${options.groupByHeading})`\n : undefined\n plan.write(\n paths.closedIssues,\n appendToClosedRegistry(\n plan.read(paths.closedIssues),\n 'issues',\n moved.map(e => relocate(e.text)),\n heading\n )\n )\n closed.issues.push(...moved.map(e => e.id))\n }\n }\n return closed\n}\n\n// ---------------------------------------------------------------------------\n// close\n// ---------------------------------------------------------------------------\n\nexport interface CloseOptions {\n cwd?: string\n ids: string[]\n date?: string\n /** Close unfinished tasks as abandoned with this reason. */\n abandoned?: string\n dryRun?: boolean\n}\n\nexport interface CloseResult {\n success: boolean\n message: string\n closedTasks: string[]\n closedIssues: string[]\n}\n\nexport function close(options: CloseOptions): CloseResult {\n const paths = resolvePaths(options.cwd ?? process.cwd())\n const fail = (message: string): CloseResult => ({\n success: false,\n message,\n closedTasks: [],\n closedIssues: [],\n })\n const manifest = readManifest(paths)\n if (typeof manifest === 'string') return fail(manifest)\n const ids = [...new Set(options.ids.map(id => id.trim()).filter(Boolean))]\n if (!ids.length) return fail('Provide at least one task or issue ID.')\n const date = options.date ?? today()\n\n const tasks = parseTaskEntries(readOptional(paths.tasks) ?? '')\n const issues = parseIssueEntries(readOptional(paths.issues) ?? '')\n const problems: string[] = []\n for (const id of ids) {\n const task = tasks.find(t => t.id === id)\n const issue = issues.find(i => i.id === id)\n if (!task && !issue) {\n const history = `${readOptional(paths.closedTasks) ?? ''}\\n${readOptional(paths.closedIssues) ?? ''}`\n problems.push(\n history.includes(`[${id}]`)\n ? `${id} is already closed.`\n : `${id} is not in the current TASKS.md or ISSUES.md.`\n )\n continue\n }\n if (task && task.status !== 'x' && !options.abandoned)\n problems.push(\n `${id} is not marked [x]; complete it first or pass --abandoned \"<reason>\".`\n )\n if (task && tasks.some(t => t.start > task.start && t.start < task.end && t.status !== 'x'))\n problems.push(`${id} has open nested tasks; close or move them first.`)\n if (!task && issue && !isClosedIssueStatus(issue.status))\n problems.push(\n `${id} has status \"${issue.status || 'unknown'}\"; set it to resolved or declined first.`\n )\n }\n if (problems.length) return fail(problems.join('\\n'))\n\n const plan = new Plan()\n const wanted = new Set(ids)\n const closed = planClose(\n plan,\n paths,\n id => wanted.has(id),\n id => wanted.has(id) && !tasks.some(t => t.id === id),\n {\n transformTask: (text, status) =>\n status === 'x'\n ? stampCompleted(text, date)\n : stampAbandoned(text, date, options.abandoned ?? 'abandoned'),\n }\n )\n if (!options.dryRun) plan.apply()\n const all = [...closed.tasks, ...closed.issues]\n return {\n success: true,\n message: `${options.dryRun ? 'Would close' : 'Closed'} ${all.join(', ')} ā ${relative(paths.root, paths.closedDir)}/`,\n closedTasks: closed.tasks,\n closedIssues: closed.issues,\n }\n}\n\n// ---------------------------------------------------------------------------\n// migrate\n// ---------------------------------------------------------------------------\n\nexport interface MigrateOptions {\n cwd?: string\n dryRun?: boolean\n date?: string\n}\n\nexport interface MigrateResult {\n success: boolean\n message: string\n fromFormat?: number\n toFormat?: number\n closedTasks: string[]\n closedIssues: string[]\n movedWorklogs: number\n rewrittenFiles: string[]\n bytes?: { tasks: [number, number]; issues: [number, number] }\n /** Remaining semantic work for `/reconcile`. */\n findings: BudgetFinding[]\n}\n\nconst SKIPPED = new Set(['node_modules', 'dist', 'build', 'coverage'])\n\nfunction listFiles(dir: string): string[] {\n const files: string[] = []\n const walk = (current: string): void => {\n for (const entry of readdirSync(current, { withFileTypes: true })) {\n const path = join(current, entry.name)\n if (entry.isDirectory()) walk(path)\n else if (entry.isFile()) files.push(path)\n }\n }\n if (existsSync(dir)) walk(dir)\n return files\n}\n\nfunction listMarkdown(root: string): string[] {\n const files: string[] = []\n const walk = (dir: string): void => {\n let entries\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return\n }\n for (const entry of entries) {\n const path = join(dir, entry.name)\n if (entry.isDirectory()) {\n if (SKIPPED.has(entry.name)) continue\n if (entry.name.startsWith('.') && entry.name !== AUTONOMOS_DIR) continue\n walk(path)\n } else if (entry.isFile() && /\\.mdx?$/.test(entry.name)) files.push(path)\n }\n }\n walk(root)\n return files\n}\n\n/** Remove empty directories below `dir`, keeping `dir` itself. */\nfunction removeEmptyDirectories(dir: string): void {\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue\n const child = join(dir, entry.name)\n removeEmptyDirectories(child)\n if (readdirSync(child).length === 0) rmdirSync(child)\n }\n}\n\nfunction toPosix(path: string): string {\n return path.split(sep).join('/')\n}\n\nconst INDEX_HEADER = `# Archive index\n\n> Project history, searched by topic or ID only when a question requires it. Not startup context.\n`\n\nexport function migrate(options: MigrateOptions = {}): MigrateResult {\n const paths = resolvePaths(options.cwd ?? process.cwd())\n const empty = {\n closedTasks: [],\n closedIssues: [],\n movedWorklogs: 0,\n rewrittenFiles: [],\n findings: [],\n }\n const manifest = readManifest(paths)\n if (typeof manifest === 'string') return { success: false, message: manifest, ...empty }\n if (lstatSync(paths.autonomos).isSymbolicLink())\n return {\n success: false,\n message: 'Refusing to migrate a symbolic .autonomos directory.',\n ...empty,\n }\n\n const fromFormat = manifestArtifactFormat(manifest)\n const date = options.date ?? today()\n const plan = new Plan()\n const tasksBefore = Buffer.byteLength(readOptional(paths.tasks) ?? '')\n const issuesBefore = Buffer.byteLength(readOptional(paths.issues) ?? '')\n\n // 1. Quarantine legacy worklogs so they stop serving as examples.\n const legacy =\n fromFormat < ARTIFACT_FORMAT\n ? listFiles(paths.worklogs).filter(path => !path.endsWith(`${sep}.gitkeep`))\n : []\n const conflicts = legacy.filter(path =>\n existsSync(join(paths.legacyWorklogs, relative(paths.worklogs, path)))\n )\n if (conflicts.length)\n return {\n success: false,\n message: `Cannot move worklogs; already present in ${relative(paths.root, paths.legacyWorklogs)}: ${conflicts.map(p => relative(paths.worklogs, p)).join(', ')}`,\n ...empty,\n }\n const mapPath = legacy.length\n ? prefixMapper(paths.worklogs, paths.legacyWorklogs)\n : (p: string) => p\n const movedNames = new Set(legacy.map(path => toPosix(relative(paths.worklogs, path))))\n const fromPrefix = toPosix(relative(paths.root, paths.worklogs))\n const toPrefix = toPosix(relative(paths.root, paths.legacyWorklogs))\n for (const path of legacy) {\n const target = mapPath(path)\n if (/\\.mdx?$/.test(path)) {\n plan.write(\n target,\n relocateLinks(readFileSync(path, 'utf8'), dirname(path), dirname(target), mapPath)\n )\n plan.deletes.add(path)\n } else plan.renames.push({ from: path, to: target })\n }\n\n // 2. Close completed tasks and closed issues (no invented completion dates).\n const closed = planClose(\n plan,\n paths,\n (_id, status) => status === 'x',\n (_id, status) => isClosedIssueStatus(status),\n { mapPath, groupByHeading: date }\n )\n\n // 3. Repair references to moved worklogs across project Markdown.\n const planned = [...plan.writes.keys()]\n const candidates = new Set([\n ...listMarkdown(paths.root).filter(p => !plan.deletes.has(p)),\n ...planned.filter(p => /\\.mdx?$/.test(p)),\n ])\n for (const path of candidates) {\n const current = plan.read(path)\n if (current === undefined) continue\n let next = legacy.length\n ? relocateLinks(current, dirname(path), dirname(path), mapPath)\n : current\n if (movedNames.size) next = relocateRootMentions(next, fromPrefix, toPrefix, movedNames)\n if (next !== current) plan.write(path, next)\n }\n const rewrittenFiles = [...plan.writes.keys()]\n .filter(path => existsSync(path) && !legacy.includes(path))\n .map(path => relative(paths.root, path))\n .sort()\n\n // 4. Index the batches.\n const indexLines: string[] = []\n if (closed.tasks.length || closed.issues.length || existsSync(paths.closedDir))\n indexLines.push(\n `- \\`${CLOSED_DIR}/\\` ā closed tasks and issues, appended when work closes (artifact format 2). Search by ID.`\n )\n if (legacy.length)\n indexLines.push(\n `- \\`${LEGACY_WORKLOGS_DIR}/\\` ā ${legacy.length} files written before artifact format 2, moved on ${date}. Historical evidence only; not a model for new worklogs.`\n )\n if (indexLines.length) {\n let index = plan.read(paths.archiveIndex) ?? INDEX_HEADER\n const missing = indexLines.filter(line => !index.includes(line.slice(0, line.indexOf('ā'))))\n if (missing.length) {\n index = index.replace(/\\s*$/, '\\n') + '\\n' + missing.join('\\n') + '\\n'\n plan.write(paths.archiveIndex, index)\n }\n }\n\n // 5. Record the format.\n if (fromFormat < ARTIFACT_FORMAT) {\n plan.write(\n paths.manifest,\n generateManifestContent({\n ...manifest,\n artifactFormat: ARTIFACT_FORMAT,\n lastUpdated: new Date().toISOString(),\n })\n )\n }\n\n if (!options.dryRun) {\n plan.apply()\n if (legacy.length) {\n removeEmptyDirectories(paths.worklogs)\n // Keep the emptied directory under version control for new worklogs.\n if (readdirSync(paths.worklogs).length === 0)\n writeFileSync(join(paths.worklogs, '.gitkeep'), '')\n }\n }\n const tasksAfter = Buffer.byteLength(plan.read(paths.tasks) ?? '')\n const issuesAfter = Buffer.byteLength(plan.read(paths.issues) ?? '')\n const findings = options.dryRun\n ? []\n : checkContextBudgets(paths.root, { artifactFormat: ARTIFACT_FORMAT }).filter(\n f => f.code !== 'format-outdated'\n )\n const changed = plan.writes.size + plan.renames.length + plan.deletes.size > 0\n return {\n success: true,\n message: changed\n ? `${options.dryRun ? 'Would migrate' : 'Migrated'} records from format ${fromFormat} to ${ARTIFACT_FORMAT}.`\n : `Already at artifact format ${ARTIFACT_FORMAT}; nothing to move.`,\n fromFormat,\n toFormat: ARTIFACT_FORMAT,\n closedTasks: closed.tasks,\n closedIssues: closed.issues,\n movedWorklogs: legacy.length,\n rewrittenFiles,\n bytes: { tasks: [tasksBefore, tasksAfter], issues: [issuesBefore, issuesAfter] },\n findings,\n }\n}\n","import { existsSync, lstatSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\nimport {\n AUTONOMOS_DIR,\n checkContextBudgets,\n MANIFEST_FILE,\n manifestArtifactFormat,\n parseManifest,\n readTaskRegistry,\n TASKS_FILE,\n type BudgetFinding,\n type Manifest,\n type TaskReference,\n} from '@autonomos/core'\nimport { verifyProtocolArtifacts, type ArtifactIntegrity } from '../protocol-artifacts'\n\ninterface StatusOptions {\n cwd?: string\n history?: boolean\n}\n\ninterface TaskSummary {\n total: number\n todo: number\n inProgress: number\n done: number\n blocked: number\n}\n\nexport interface StatusResult {\n success: boolean\n message: string\n protocolVersion?: string\n cliVersion?: string\n initialized: boolean\n taskSummary?: TaskSummary\n archivedTaskSummary?: TaskSummary\n historyComplete?: boolean\n duplicateTaskIds?: string[]\n warnings?: string[]\n artifactIntegrity?: ArtifactIntegrity\n driftedArtifacts?: string[]\n artifactFormat?: number\n /** Advisory context-budget findings (artifact format 2). */\n budgetFindings?: BudgetFinding[]\n}\n\n/**\n * Get project status and task summary\n */\nexport function status(options: StatusOptions = {}): StatusResult {\n const cwd = options.cwd ?? process.cwd()\n\n // Check if initialized\n const autonomosDir = join(cwd, AUTONOMOS_DIR)\n const manifestPath = join(autonomosDir, MANIFEST_FILE)\n\n if (existsSync(autonomosDir) && !lstatSync(autonomosDir).isDirectory()) {\n return {\n success: false,\n message: 'Expected a regular .autonomos directory; symbolic links are not followed.',\n initialized: false,\n }\n }\n\n if (!existsSync(manifestPath)) {\n return {\n success: false,\n message: 'Project not initialized. Run `autonomos init` first.',\n initialized: false,\n }\n }\n\n // Read manifest\n let manifest: Manifest\n try {\n const manifestContent = readFileSync(manifestPath, 'utf-8')\n manifest = parseManifest(manifestContent)\n } catch {\n return {\n success: false,\n message: 'Could not read manifest.json',\n initialized: true,\n }\n }\n\n // History stays opt-in: ordinary bootstrap must not traverse archives.\n let taskSummary: TaskSummary | undefined\n const registry = readTaskRegistry(cwd, { history: options.history })\n const summarize = (tasks: TaskReference[]): TaskSummary => ({\n total: tasks.length,\n todo: tasks.filter(t => t.status === 'TODO').length,\n inProgress: tasks.filter(t => t.status === 'IN_PROGRESS').length,\n done: tasks.filter(t => t.status === 'DONE').length,\n blocked: tasks.filter(t => t.status === 'BLOCKED').length,\n })\n if (existsSync(join(autonomosDir, TASKS_FILE))) {\n taskSummary = summarize(registry.current)\n }\n\n const integrity = verifyProtocolArtifacts(cwd, manifest.protocolVersion)\n\n return {\n success: true,\n message: 'Project status retrieved',\n protocolVersion: manifest.protocolVersion,\n cliVersion: manifest.cliVersion,\n initialized: true,\n taskSummary,\n ...(options.history\n ? {\n archivedTaskSummary: summarize(registry.archived),\n historyComplete: registry.complete,\n }\n : {}),\n duplicateTaskIds: registry.duplicateIds,\n warnings: registry.warnings,\n artifactIntegrity: integrity.state,\n driftedArtifacts: integrity.driftedFiles,\n artifactFormat: manifestArtifactFormat(manifest),\n budgetFindings: checkContextBudgets(cwd, {\n artifactFormat: manifestArtifactFormat(manifest),\n }),\n }\n}\n","import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\nimport {\n ARTIFACT_FORMAT,\n AUTONOMOS_DIR,\n findProjectRoot,\n generateManifestContent,\n listHarnesses,\n MANIFEST_FILE,\n manifestArtifactFormat,\n parseManifest,\n PROTOCOL_FILE,\n PROTOCOL_TEMPLATE,\n PROTOCOL_VERSION,\n resolveTargets,\n type Manifest,\n} from '@autonomos/core'\n\nimport packageJson from '../../package.json' with { type: 'json' }\nimport {\n buildTargetFilename,\n getTargetArtifactFiles,\n getWorkflowsDir,\n WORKFLOW_FILES,\n} from '../protocol-artifacts'\nconst CLI_VERSION: string = packageJson.version\n\ninterface UpdateOptions {\n cwd?: string\n /**\n * When provided, install the workflow files for these harness ids in\n * addition to refreshing existing ones. Lets users add a new AI\n * harness (e.g. opencode) to a project that was already initialized\n * with the protocol, without re-running `init`.\n */\n harnesses?: string[]\n /** Convenience flag equivalent to `harnesses: listHarnesses().map(id)`. */\n all?: boolean\n /** Test seam for packaged workflow resolution. */\n resolveWorkflowsDir?: () => string\n}\n\ninterface UpdateResult {\n success: boolean\n message: string\n previousVersion?: string\n newVersion?: string\n cliOutdated?: boolean\n /** Harnesses that had workflow files installed (or refreshed) by this run. */\n touchedHarnesses?: string[]\n}\n\n/**\n * Compare two SemVer versions\n * Returns: -1 if a < b, 0 if a === b, 1 if a > b\n */\nfunction compareVersions(a: string, b: string): number {\n const parse = (version: string) => {\n const [numeric = '', prerelease] = version.split('-', 2)\n return { parts: numeric.split('.').map(Number), prerelease }\n }\n const aVersion = parse(a)\n const bVersion = parse(b)\n\n for (let i = 0; i < 3; i++) {\n const aNum = aVersion.parts[i] ?? 0\n const bNum = bVersion.parts[i] ?? 0\n if (aNum < bNum) return -1\n if (aNum > bNum) return 1\n }\n\n if (aVersion.prerelease === bVersion.prerelease) return 0\n if (aVersion.prerelease === undefined) return 1\n if (bVersion.prerelease === undefined) return -1\n\n return aVersion.prerelease.localeCompare(bVersion.prerelease)\n}\n\n/**\n * Bump the `@autonomos/cli` devDependency in the project's package.json\n * to the current CLI version, when one is present. Older init runs\n * (including the previously published 0.2.0) pinned a version that is\n * not on the registry, which broke `pnpm i`. Doing the bump here means\n * users can recover with a single `autonomos update` instead of editing\n * package.json by hand.\n *\n * Returns a human-readable note when something changed, or null when\n * nothing needed to be done.\n */\nfunction refreshDevDependency(cwd: string): string | null {\n const packageJsonPath = join(cwd, 'package.json')\n if (!existsSync(packageJsonPath)) return null\n\n let pkg: any\n try {\n pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'))\n } catch {\n return null\n }\n\n const newSpec = `^${CLI_VERSION}`\n const previous = pkg.devDependencies?.['@autonomos/cli']\n if (previous === newSpec) return null\n\n if (!pkg.devDependencies) pkg.devDependencies = {}\n pkg.devDependencies['@autonomos/cli'] = newSpec\n\n try {\n writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 4) + '\\n')\n } catch {\n return null\n }\n\n return previous\n ? `Bumped @autonomos/cli devDependency: ${previous} ā ${newSpec}.`\n : `Added @autonomos/cli devDependency: ${newSpec}.`\n}\n\nfunction writeHarnessWorkflows(cwd: string, harnessIds: string[], workflowsDir: string): string[] {\n if (harnessIds.length === 0) return []\n const targets = resolveTargets(harnessIds, cwd)\n const written: string[] = []\n for (const target of targets) {\n for (const file of getTargetArtifactFiles(target, WORKFLOW_FILES)) {\n mkdirSync(dirname(file.destinationPath), { recursive: true })\n const source = readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8')\n writeFileSync(file.destinationPath, source)\n written.push(file.destinationPath)\n }\n }\n return written\n}\n\n/**\n * Refresh workflows for harnesses already installed in the project.\n * Automatically migrates legacy layouts to conform to modern harness requirements:\n * - Migrates legacy flat files in .agents/skills/ to standard skill bundles (.agents/skills/protocol-[name]/SKILL.md)\n * - Migrates legacy .agent/workflows/ to .agents/workflows/\n * - Cleans legacy flat files from .claude/skills/\n */\nfunction refreshInstalledHarnessWorkflows(cwd: string, workflowsDir: string): string[] {\n const updatedTargets: string[] = []\n\n // 1. Migration of legacy flat files in .agents/skills\n const agentsSkillsDir = join(cwd, '.agents', 'skills')\n if (existsSync(agentsSkillsDir)) {\n let removedFlat = false\n for (const workflowFile of WORKFLOW_FILES) {\n const flatFile = join(agentsSkillsDir, buildTargetFilename(workflowFile, '.md'))\n if (existsSync(flatFile)) {\n try {\n rmSync(flatFile, { force: true })\n removedFlat = true\n } catch {\n // Ignore removal failures\n }\n }\n }\n if (removedFlat) {\n // Install skill bundles in .agents/skills\n const skillTarget = {\n path: agentsSkillsDir,\n fileExtension: '.md',\n kind: 'skill' as const,\n }\n for (const file of getTargetArtifactFiles(skillTarget, WORKFLOW_FILES)) {\n mkdirSync(dirname(file.destinationPath), { recursive: true })\n const source = readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8')\n writeFileSync(file.destinationPath, source)\n }\n updatedTargets.push(agentsSkillsDir)\n }\n }\n\n // 2. Migration of legacy .agent/workflows (singular) to .agents/workflows\n const legacyAgentWorkflowsDir = join(cwd, '.agent', 'workflows')\n if (existsSync(legacyAgentWorkflowsDir)) {\n const modernWorkflowsDir = join(cwd, '.agents', 'workflows')\n mkdirSync(modernWorkflowsDir, { recursive: true })\n let changedLegacy = false\n for (const workflowFile of WORKFLOW_FILES) {\n const flatName = buildTargetFilename(workflowFile, '.md')\n const source = readFileSync(join(workflowsDir, workflowFile), 'utf-8')\n const modernDest = join(modernWorkflowsDir, flatName)\n if (!existsSync(modernDest) || readFileSync(modernDest, 'utf-8') !== source) {\n writeFileSync(modernDest, source)\n changedLegacy = true\n }\n const legacyDest = join(legacyAgentWorkflowsDir, flatName)\n if (!existsSync(legacyDest) || readFileSync(legacyDest, 'utf-8') !== source) {\n writeFileSync(legacyDest, source)\n changedLegacy = true\n }\n }\n if (changedLegacy) {\n if (!updatedTargets.includes(modernWorkflowsDir)) {\n updatedTargets.push(modernWorkflowsDir)\n }\n if (!updatedTargets.includes(legacyAgentWorkflowsDir)) {\n updatedTargets.push(legacyAgentWorkflowsDir)\n }\n }\n }\n\n // 3. Migration of legacy flat files in .claude/skills\n const claudeSkillsDir = join(cwd, '.claude', 'skills')\n if (existsSync(claudeSkillsDir)) {\n for (const workflowFile of WORKFLOW_FILES) {\n const flatFile = join(claudeSkillsDir, buildTargetFilename(workflowFile, '.md'))\n if (existsSync(flatFile)) {\n try {\n rmSync(flatFile, { force: true })\n } catch {\n // Ignore removal failures\n }\n }\n }\n }\n\n // 4. Standard refresh across all targets resolved from configured platforms\n const targets = resolveTargets(\n listHarnesses().map(({ id }) => id),\n cwd\n )\n\n for (const target of targets) {\n if (!existsSync(target.path)) continue\n\n const files = getTargetArtifactFiles(target, WORKFLOW_FILES).map(file => ({\n source: readFileSync(join(workflowsDir, file.sourceFilename), 'utf-8'),\n dest: file.destinationPath,\n }))\n if (!files.some(({ dest }) => existsSync(dest))) continue\n\n let changed = false\n for (const { source, dest } of files) {\n if (!existsSync(dest) || readFileSync(dest, 'utf-8') !== source) {\n mkdirSync(dirname(dest), { recursive: true })\n writeFileSync(dest, source)\n changed = true\n }\n }\n if (changed && !updatedTargets.includes(target.path)) {\n updatedTargets.push(target.path)\n }\n }\n\n return updatedTargets\n}\n\n/**\n * Update the Protocol to the latest version\n */\nexport function update(options: UpdateOptions = {}): UpdateResult {\n const requestedCwd = options.cwd ?? process.cwd()\n\n // Bubble up to the project root if the user ran us from a subdir.\n // Unlike `init` we don't refuse here: there's nothing destructive\n // about a refresh, and the only way to find the manifest is to look\n // for it where it lives.\n const cwd = findProjectRoot(requestedCwd) ?? requestedCwd\n\n // Check if initialized\n const autonomosDir = join(cwd, AUTONOMOS_DIR)\n const manifestPath = join(autonomosDir, MANIFEST_FILE)\n\n if (!existsSync(manifestPath)) {\n return {\n success: false,\n message: 'Project not initialized. Run `autonomos init` first.',\n }\n }\n\n // Read current manifest\n const manifestContent = readFileSync(manifestPath, 'utf-8')\n const manifest: Manifest = parseManifest(manifestContent)\n const currentVersion = manifest.protocolVersion\n\n // Resolve every packaged input before mutating project-owned files. A broken\n // CLI installation must fail without leaving a partially updated protocol.\n let workflowsDir: string\n try {\n workflowsDir = (options.resolveWorkflowsDir ?? getWorkflowsDir)()\n } catch (error) {\n return {\n success: false,\n message: `Cannot update protocol artifacts: ${error instanceof Error ? error.message : String(error)}`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n }\n }\n\n // Refresh devDependency. We do this even when the protocol version\n // is already up to date, because the user may have run `update`\n // precisely to repair a pinned-but-unresolvable version.\n const devDepNote = refreshDevDependency(cwd)\n\n // Compare versions\n const comparison = compareVersions(currentVersion, PROTOCOL_VERSION)\n\n if (comparison === 0) {\n // Workflows are executable artifacts, so refresh installed harnesses\n // even when the protocol specification itself is already current.\n let updatedTargets: string[] = []\n try {\n updatedTargets = refreshInstalledHarnessWorkflows(cwd, workflowsDir)\n } catch (err) {\n console.warn(\n `Warning: Could not update harness workflows: ${err instanceof Error ? err.message : String(err)}`\n )\n }\n\n // Still install any newly requested harnesses even when the protocol\n // is current. This is the path used to add a new harness.\n const requestedHarnesses = options.all\n ? listHarnesses().map(({ id }) => id)\n : (options.harnesses ?? [])\n const newlyInstalled = writeHarnessWorkflows(cwd, requestedHarnesses, workflowsDir)\n\n if (\n manifest.cliVersion !== CLI_VERSION ||\n updatedTargets.length > 0 ||\n newlyInstalled.length > 0\n ) {\n writeFileSync(\n manifestPath,\n generateManifestContent({\n ...manifest,\n cliVersion: CLI_VERSION,\n lastUpdated: new Date().toISOString(),\n })\n )\n }\n\n const workflowMsg =\n updatedTargets.length > 0 ? ` Refreshed workflows in ${updatedTargets.join(', ')}.` : ''\n const installedMsg =\n newlyInstalled.length > 0 ? ` Installed: ${newlyInstalled.join(', ')}.` : ''\n const devDepMsg = devDepNote ? ` ${devDepNote}` : ''\n return {\n success: true,\n message: `Already up to date (Protocol v${PROTOCOL_VERSION}).${workflowMsg}${installedMsg}${devDepMsg}`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n touchedHarnesses: [...updatedTargets, ...newlyInstalled],\n }\n }\n\n if (comparison > 0) {\n // Project uses a newer version than CLI knows\n return {\n success: false,\n message: `This project uses Protocol v${currentVersion}, but your CLI only knows v${PROTOCOL_VERSION}. Update your CLI with \\`npm i -g @autonomos/cli\\`.`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n cliOutdated: true,\n }\n }\n\n // Update Protocol (comparison < 0)\n const protocolPath = join(autonomosDir, PROTOCOL_FILE)\n writeFileSync(protocolPath, PROTOCOL_TEMPLATE)\n\n // Update manifest\n const updatedManifest: Manifest = {\n ...manifest,\n protocolVersion: PROTOCOL_VERSION,\n cliVersion: CLI_VERSION,\n lastUpdated: new Date().toISOString(),\n }\n writeFileSync(manifestPath, generateManifestContent(updatedManifest))\n\n // Update workflow files in active harnesses\n const updatedTargets: string[] = []\n try {\n updatedTargets.push(...refreshInstalledHarnessWorkflows(cwd, workflowsDir))\n } catch (err) {\n // Log warning but don't fail the update\n console.warn(\n `Warning: Could not update harness workflows: ${err instanceof Error ? err.message : String(err)}`\n )\n }\n\n // Also install any harnesses the user explicitly asked for. This\n // covers the \"I'm on a newer protocol but want to add a new harness\"\n // case as well as the more common \"my init never installed opencode\".\n const requestedHarnesses = options.all\n ? listHarnesses().map(({ id }) => id)\n : (options.harnesses ?? [])\n const newlyInstalled = writeHarnessWorkflows(cwd, requestedHarnesses, workflowsDir)\n\n const harnessInfo =\n updatedTargets.length > 0 ? ` (updated workflows in ${updatedTargets.join(', ')})` : ''\n const installedInfo =\n newlyInstalled.length > 0 ? ` (installed: ${newlyInstalled.join(', ')})` : ''\n const devDepInfo = devDepNote ? ` ${devDepNote}` : ''\n const formatInfo =\n manifestArtifactFormat(manifest) < ARTIFACT_FORMAT\n ? ` Project records still use artifact format ${manifestArtifactFormat(manifest)}: run \\`autonomos migrate --dry-run\\`, then \\`autonomos migrate\\`, then \\`/reconcile\\` on the reported findings.`\n : ''\n\n return {\n success: true,\n message: `Protocol updated: v${currentVersion} ā v${PROTOCOL_VERSION}${harnessInfo}${installedInfo}${devDepInfo}${formatInfo}`,\n previousVersion: currentVersion,\n newVersion: PROTOCOL_VERSION,\n touchedHarnesses: [...updatedTargets, ...newlyInstalled],\n }\n}\n","#!/usr/bin/env node\nimport { Command } from 'commander'\nimport pc from 'picocolors'\n\nimport { PROTOCOL_VERSION } from '@autonomos/core'\nimport { agents } from './commands/agents'\nimport { init } from './commands/init'\nimport { close, migrate } from './commands/records'\nimport { status } from './commands/status'\nimport { update } from './commands/update'\n\n// Synchronize with the package.json version at build time. The bundler\n// inlines this JSON, so the resolved value is always current.\n// (package.json import ā inlined by the bundler)\nimport packageJson from '../package.json' with { type: 'json' }\nconst CLI_VERSION: string = packageJson.version\n\nconst program = new Command()\n\nprogram\n .name('autonomos')\n .description(\n pc.cyan(`CLI for the Autonomos Agent Protocol\n\nThe Agent Protocol is a specification for AI agents to interact with codebases\nin a structured, consistent way. It defines how agents should read context,\nexecute tasks, and persist knowledge.`) +\n `\n\nDocumentation: ${pc.underline('https://github.com/saoudi-h/autonomos')}`\n )\n .version(\n `${pc.bold('CLI:')} ${pc.green(CLI_VERSION)}\\n${pc.bold('Protocol:')} ${pc.green(PROTOCOL_VERSION)}`,\n '-v, --version',\n 'Show version information'\n )\n .helpOption('-h, --help', 'Show help information')\n .addHelpText(\n 'after',\n `\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos init')} Initialize the Agent Protocol in current directory\n $ ${pc.cyan('autonomos update')} Update Protocol to the latest version\n $ ${pc.cyan('autonomos status')} Show project status and task summary\n $ ${pc.cyan('autonomos agents')} List all AGENT.md files in the project\n $ ${pc.cyan('autonomos close <ID>')} Move a finished task or issue out of current context\n $ ${pc.cyan('autonomos migrate')} Upgrade project records to the current artifact format\n\nProject knowledge workflows installed for supported harnesses include\n${pc.cyan('/issue')} (triage), ${pc.cyan('/adopt')} (reviewable migration),\n${pc.cyan('/reconcile')} (drift repair and archival), ${pc.cyan('/design')} (project-specific\ndirection), and ${pc.cyan('/crystallize')} (close-out).\n\n${pc.bold('More info:')}\n Run '${pc.cyan('autonomos <command> --help')}' for detailed information about a command.\n`\n )\n\nprogram\n .command('init')\n .description('Initialize the Agent Protocol in the current directory')\n .addHelpText(\n 'after',\n `\nThis command creates the following structure:\n ${pc.blue('.autonomos/')}\n āāā ${pc.white('manifest.json')} # Protocol metadata and version\n āāā ${pc.white('PROTOCOL.md')} # Immutable protocol specification\n āāā ${pc.white('TASKS.md')} # Task registry\n āāā ${pc.blue('worklogs/')} # Session logs directory\n ${pc.white('AGENT.md')} # Project context file (at root)\n\nAdditionally, when one or more harnesses are selected, the protocol workflow\nfiles (session / task / issue / adopt / reconcile / design / crystallize) are installed at the harness-specific\ntarget directory, e.g. .clinerules/workflows/ for Cline, .claude/skills/ for\nClaude Code, .agents/skills/ for the cross-tool standard (Cursor, Codex, etc.).\nOptional project-owned archives, specs and decisions directories are created only when the\nproject first adopts them; \\`DESIGN.md\\` is never created automatically, and init\nnever creates empty directories for project-owned records.\n\n${pc.bold('Harness selection:')}\n (default) Interactive multi-select prompt at the start of init.\n --harness Skip the prompt and install only for the given harness id(s).\n May be repeated, e.g. --harness cline --harness claude-code.\n --all Skip the prompt and install for all known harnesses.\n --no-prompt Same as not specifying a TTY; useful in CI/scripted contexts.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos init')}\n $ ${pc.cyan('autonomos init --harness cline')}\n $ ${pc.cyan('autonomos init --harness cline --harness claude-code')}\n $ ${pc.cyan('autonomos init --all')}\n $ ${pc.cyan('autonomos init --dry-run')}\n $ ${pc.cyan('cd my-project && autonomos init')}\n\n${pc.bold('Project root detection:')}\n By default, ${pc.cyan('init')} refuses to run from a subdirectory of a\n git/Autonomos project. Run it from the project root, or pass\n ${pc.cyan('--force')} (or set ${pc.cyan('AUTONOMOS_FORCE=1')}) to install\n in ${pc.cyan('cwd')} anyway. In a TTY, you'll be asked to confirm.\n`\n )\n .option('-n, --dry-run', 'Preview what would be created without writing files')\n .option(\n '--harness <name...>',\n 'Install workflows for the specified harness id(s); skip the prompt'\n )\n .option('--all', 'Install workflows for all known harnesses; skip the prompt')\n .option('--no-prompt', 'Skip the interactive harness prompt (use with --harness or --all)')\n .option('--no-install', 'Skip installing @autonomos/cli as devDependency; use npx instead')\n .option(\n '-f, --force',\n 'Install in cwd even if a parent project root is detected (also via AUTONOMOS_FORCE=1)'\n )\n .action(\n async (opts: {\n dryRun?: boolean\n harness?: string[]\n all?: boolean\n prompt?: boolean\n install?: boolean\n force?: boolean\n }) => {\n try {\n const result = await init({\n dryRun: opts.dryRun,\n harnesses: opts.harness,\n all: opts.all,\n noPrompt: opts.prompt === false,\n noInstall: opts.install === false,\n force: opts.force,\n })\n\n if (!result.success) {\n console.error(pc.red(`\\nā ${result.message}`))\n process.exit(1)\n }\n\n if (result.dryRun) {\n console.log(pc.cyan(`\\nš ${result.message} (dry-run)`))\n } else {\n console.log(pc.green(`\\nā
${result.message}`))\n }\n\n if (result.created.length > 0) {\n console.log(`\\n${pc.bold(result.dryRun ? 'Would create:' : 'Created:')}`)\n result.created.forEach(file =>\n console.log(` ${pc.blue('š')} ${pc.white(file)}`)\n )\n }\n\n if (result.harnessFiles && result.harnessFiles.length > 0) {\n console.log(`\\n${pc.bold('Harness workflow files:')}`)\n result.harnessFiles.forEach(file =>\n console.log(` ${pc.cyan('āļø ')} ${pc.white(file)}`)\n )\n }\n\n if (result.warnings.length > 0) {\n console.log(pc.yellow('\\nWarnings:'))\n result.warnings.forEach(warn => console.log(` ${pc.yellow('ā ļø')} ${warn}`))\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n console.error(pc.red(`\\nā ${message}`))\n process.exit(1)\n }\n }\n )\n\nprogram\n .command('update')\n .description('Update the Protocol to the latest version')\n .addHelpText(\n 'after',\n `\nThis command updates the managed protocol artifacts embedded in the CLI.\nYour ${pc.white('AGENT.md')}, ${pc.white('TASKS.md')}, ${pc.white('ISSUES.md')},\nworklogs, archives, specifications, decisions, and user documentation are preserved.\nInstalling an update never archives project records automatically.\n\nIt also:\n - Refreshes the @autonomos/cli devDependency in your package.json to the\n current CLI version (useful when an older init pinned an unresolvable\n version such as ^0.2.0).\n - When ${pc.white('--harness')} or ${pc.white('--all')} is passed, installs\n the workflow files for the given harness(es). This is the recommended\n way to add a new AI harness to an already-initialized project.\n\n${pc.bold('Version comparison:')}\n - If your project has an older version: Updates to the new version\n - If your project has a newer version: Warns you to update the CLI\n - If versions match: No action needed (but the devDependency is still\n refreshed and any newly requested harnesses are still installed)\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos update')}\n $ ${pc.cyan('autonomos update --harness opencode')}\n $ ${pc.cyan('autonomos update --harness opencode --harness kilocode')}\n $ ${pc.cyan('autonomos update --all')}\n`\n )\n .option(\n '--harness <name...>',\n 'Install workflow files for the specified harness id(s) in addition to refreshing existing ones'\n )\n .option(\n '--all',\n 'Install workflow files for every known harness in addition to refreshing existing ones'\n )\n .action((opts: { harness?: string[]; all?: boolean }) => {\n const result = update({ harnesses: opts.harness, all: opts.all })\n\n if (!result.success) {\n if (result.cliOutdated) {\n console.error(pc.yellow(`\\nā ļø ${result.message}`))\n } else {\n console.error(pc.red(`\\nā ${result.message}`))\n }\n process.exit(1)\n }\n\n console.log(pc.green(`\\nā
${result.message}`))\n })\n\nprogram\n .command('status')\n .description('Show project status and task summary')\n .addHelpText(\n 'after',\n `\nDisplays information about the current project:\n - Protocol version\n - Protocol artifact integrity for the installed version\n - CLI version used for initialization\n - Current task registry summary (todo, in-progress, done, blocked)\n - Context budgets: closed records left in current registries, oversized\n TASKS.md/ISSUES.md/AGENT.md/task entries/worklogs, outdated artifact format.\n Advisory unless --strict.\n - With --history: separate archived counts and task ID collisions\n Only archive/**/TASKS.md registries are counted; history is not read by default.\n Archived does not imply completed. Read diagnostics and partial counts are explicit.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos status')}\n $ ${pc.cyan('autonomos status --history')}\n $ ${pc.cyan('autonomos status --strict')}\n`\n )\n .option('--history', 'Include archived task registries and check reserved task IDs')\n .option('--strict', 'Exit non-zero when context-budget findings exist')\n .action((opts: { history?: boolean; strict?: boolean }) => {\n const result = status({ history: opts.history })\n\n if (!result.success) {\n console.error(pc.red(`\\nā ${result.message}`))\n process.exit(1)\n }\n\n console.log(\n `\\n${pc.bold('š¦ Protocol')} ${pc.green(`v${result.protocolVersion}`)} ${pc.dim(`(CLI v${result.cliVersion})`)}`\n )\n\n if (result.artifactIntegrity === 'valid') {\n console.log(` ${pc.green('ā Artifacts match the published protocol version')}`)\n } else if (result.artifactIntegrity === 'drifted') {\n console.log(` ${pc.red('ā Protocol artifact drift detected')}`)\n for (const file of result.driftedArtifacts ?? []) {\n console.log(` ${pc.red('ā¢')} ${file}`)\n }\n console.log(` ${pc.dim('Run `autonomos update` to restore canonical artifacts.')}`)\n } else {\n console.log(\n ` ${pc.yellow('! Artifact integrity is unverifiable with this CLI version')}`\n )\n }\n\n if (result.taskSummary) {\n const s = result.taskSummary\n console.log(`\\n${pc.bold('š Current tasks:')} ${pc.cyan(s.total)} total`)\n console.log(` ${pc.white('⬠Todo:')} ${pc.white(s.todo)}`)\n console.log(` ${pc.blue('š In Progress:')} ${pc.blue(s.inProgress)}`)\n console.log(` ${pc.green('ā
Done:')} ${pc.green(s.done)}`)\n if (s.blocked > 0) {\n console.log(` ${pc.red('š« Blocked:')} ${pc.red(s.blocked)}`)\n }\n }\n if (result.archivedTaskSummary) {\n const s = result.archivedTaskSummary\n console.log(\n `\\n${pc.bold('Historical task records:')} ${s.total}${result.historyComplete ? '' : ' (incomplete scan)'}`\n )\n console.log(\n ` Todo: ${s.todo}; in progress: ${s.inProgress}; done: ${s.done}; blocked: ${s.blocked}`\n )\n console.log(\n pc.dim(\n ' Historical status is not current work; archived does not mean completed.'\n )\n )\n }\n const findings = result.budgetFindings ?? []\n console.log(\n `\\n${pc.bold('š Context budgets:')} ${findings.length ? pc.yellow(`${findings.length} finding(s)`) : pc.green('within budget')} ${pc.dim(`(artifact format ${result.artifactFormat})`)}`\n )\n for (const finding of findings) {\n console.log(` ${pc.yellow('ā¢')} ${pc.white(finding.path)}: ${finding.message}`)\n if (finding.items?.length) {\n const shown = finding.items.slice(0, 5).join(', ')\n const more = finding.items.length > 5 ? `, +${finding.items.length - 5} more` : ''\n console.log(` ${pc.dim(shown + more)}`)\n }\n }\n if (findings.length && opts.strict) process.exitCode = 1\n for (const warning of result.warnings ?? []) console.warn(pc.yellow(`! ${warning}`))\n if (result.duplicateTaskIds?.length) {\n console.warn(pc.yellow(`! Duplicate task IDs: ${result.duplicateTaskIds.join(', ')}`))\n }\n if (result.warnings?.length || result.duplicateTaskIds?.length) process.exitCode = 1\n })\n\nprogram\n .command('close')\n .description(\n 'Move finished tasks or issues from current registries to .autonomos/archive/closed/'\n )\n .argument('<ids...>', 'Task or issue IDs')\n .option('--date <YYYY-MM-DD>', 'Completion date to record (default: today)')\n .option('--abandoned <reason>', 'Close unfinished tasks as abandoned, recording the reason')\n .option('-n, --dry-run', 'Report what would move without writing')\n .addHelpText(\n 'after',\n `\nA task must be marked [x] (a \\`Completed:\\` date is added when missing) unless\n--abandoned is given. An issue must be resolved, declined, closed or superseded.\nEntries are moved intact; relative links are repaired for the new location.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos close PROTO-15')}\n $ ${pc.cyan('autonomos close PROTO-15 ISSUE-05')}\n $ ${pc.cyan('autonomos close SPIKE-02 --abandoned \"superseded by PROTO-15\"')}\n`\n )\n .action((ids: string[], opts: { date?: string; abandoned?: string; dryRun?: boolean }) => {\n const result = close({ ids, ...opts })\n if (!result.success) {\n console.error(pc.red(`\\nā ${result.message}`))\n process.exit(1)\n }\n console.log(pc.green(`ā
${result.message}`))\n })\n\nprogram\n .command('migrate')\n .description('Upgrade project records to the current artifact format')\n .option('-n, --dry-run', 'Report the plan without writing')\n .addHelpText(\n 'after',\n `\nMechanical, content-preserving upgrade (format 1 ā 2):\n - completed tasks and closed issues move to .autonomos/archive/closed/\n - existing worklogs move to .autonomos/archive/worklogs-format-1/ so they\n stop serving as examples for new worklogs\n - Markdown references to moved files are repaired across the project\n - the archive index and manifest record the change\nNothing is deleted or rewritten. Commit first; review the diff afterwards.\nRemaining findings (AGENT.md size, long open tasks) are semantic work for /reconcile.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos migrate --dry-run')}\n $ ${pc.cyan('autonomos migrate')}\n`\n )\n .action((opts: { dryRun?: boolean }) => {\n const result = migrate({ dryRun: opts.dryRun })\n if (!result.success) {\n console.error(pc.red(`\\nā ${result.message}`))\n process.exit(1)\n }\n console.log(pc.green(`\\nā
${result.message}`))\n const kb = (n: number): string => `${(n / 1000).toFixed(1)} KB`\n if (result.bytes) {\n console.log(\n ` TASKS.md: ${kb(result.bytes.tasks[0])} ā ${kb(result.bytes.tasks[1])} (${result.closedTasks.length} closed tasks moved)`\n )\n console.log(\n ` ISSUES.md: ${kb(result.bytes.issues[0])} ā ${kb(result.bytes.issues[1])} (${result.closedIssues.length} closed issues moved)`\n )\n }\n console.log(` Worklogs quarantined: ${result.movedWorklogs}`)\n console.log(` Files with repaired references: ${result.rewrittenFiles.length}`)\n if (result.findings.length) {\n console.log(pc.bold('\\nRemaining work for /reconcile:'))\n for (const finding of result.findings)\n console.log(` ${pc.yellow('ā¢')} ${finding.path}: ${finding.message}`)\n }\n })\n\nprogram\n .command('agents')\n .description('List all AGENT.md files in the project, or the ancestor chain for a path')\n .argument(\n '[path]',\n 'Optional file or folder. When provided, return the ordered list of ancestor AGENT.md files (root -> target) instead of the full tree.'\n )\n .option('-a, --all', 'In tree mode: search from project root instead of current directory')\n .addHelpText(\n 'after',\n `\nThis command has two modes:\n\n${pc.bold('Tree mode')} (default, or with ${pc.cyan('--all')}):\n Discover and display all ${pc.white('AGENT.md')} files in a tree structure.\n Used at session start to get the broader fractal picture of the project.\n\n${pc.bold('Ancestors mode')} (with a positional ${pc.cyan('<path>')} argument):\n Return the ordered list of ${pc.white('AGENT.md')} files on the path from the\n target up to the project root. Root-first; non-existent ancestors are\n silently skipped. Used at task start to get the precise fractal context\n for the file or folder being worked on.\n\n${pc.bold('Examples:')}\n $ ${pc.cyan('autonomos agents')} # Tree, from current dir\n $ ${pc.cyan('autonomos agents --all')} # Tree, from project root\n $ ${pc.cyan('autonomos agents apps/web')} # Ancestors for apps/web\n $ ${pc.cyan('autonomos agents apps/web/components/ui/button.tsx')} # Ancestors for a file\n`\n )\n .action((path: string | undefined, opts: { all?: boolean }) => {\n const result = agents({ all: opts.all, target: path })\n\n if (!result.success) {\n console.error(\n pc.red(`\nā ${result.message}`)\n )\n process.exit(1)\n }\n\n if (result.mode === 'ancestors') {\n console.log(\n pc.cyan(`\nš ${result.message}`)\n )\n } else {\n console.log('\\n' + (result.tree ?? result.message))\n console.log(\n pc.dim(`\n${result.message}`)\n )\n }\n })\n\nprogram\n .command('version')\n .description('Show the current Protocol version')\n .action(() => {\n console.log(\n `${pc.bold('Agent Protocol')} ${pc.green(`v${PROTOCOL_VERSION}`)} ${pc.dim(`(CLI v${CLI_VERSION})`)}`\n )\n })\n\nprogram.parse()\n"],"mappings":";wzCAmCA,SAAS,GAAe,EAAa,EAAiB,EAAQ,EAAiB,CAC3E,IAAM,EAAwB,CAAC,EAGzB,EAAY,EAAK,EAAK,CAAU,EAClC,EAAW,CAAS,GACpB,EAAQ,KAAK,CACT,KAAM,EACN,aAAc,EAAS,EAAS,CAAS,GAAK,EAC9C,OACJ,CAAC,EAIL,GAAI,CACA,IAAM,EAAQ,EAAY,CAAG,EAC7B,IAAK,IAAM,KAAQ,EAAO,CAEtB,GACI,EAAK,WAAW,GAAG,GACnB,IAAS,gBACT,IAAS,QACT,IAAS,QAET,SAGJ,IAAM,EAAW,EAAK,EAAK,CAAI,EAC/B,GAAI,CACI,EAAS,CAAQ,CAAC,CAAC,YAAY,GAC/B,EAAQ,KAAK,GAAG,GAAe,EAAU,EAAS,EAAQ,CAAC,CAAC,CAEpE,MAAQ,CAER,CACJ,CACJ,MAAQ,CAER,CAEA,OAAO,CACX,CAWA,SAAS,GAAa,EAAuB,EAAyB,CAClE,GAAI,EAAQ,SAAW,EACnB,MAAO,8BAGX,IAAM,EAAW,GAAS,CAAO,EAC3B,EAAiB,CAAE,KAAM,EAAU,QAAS,GAAO,SAAU,CAAC,CAAE,EAGtE,IAAK,IAAM,KAAS,EAAS,CACzB,IAAM,EAAQ,EAAM,aAAa,MAAM,GAAG,EACtC,EAAU,EAEd,IAAK,IAAM,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G,KAAK,OAAO,EAAE;6BAChC,EAAG,MAAM,UAAU,EAAE;;;EAGhD,EAAG,KAAK,gBAAgB,EAAE,sBAAsB,EAAG,KAAK,QAAQ,EAAE;+BACrC,EAAG,MAAM,UAAU,EAAE;;;;;EAKlD,EAAG,KAAK,WAAW,EAAE;MACjB,EAAG,KAAK,kBAAkB,EAAE;MAC5B,EAAG,KAAK,wBAAwB,EAAE;MAClC,EAAG,KAAK,2BAA2B,EAAE;MACrC,EAAG,KAAK,oDAAoD,EAAE;CAEhE,CAAC,CACA,QAAQ,EAA0B,IAA4B,CAC3D,IAAM,EAAS,GAAO,CAAE,IAAK,EAAK,IAAK,OAAQ,CAAK,CAAC,EAEhD,EAAO,UACR,QAAQ,MACJ,EAAG,IAAI;IACnB,EAAO,SAAS,CACR,EACA,QAAQ,KAAK,CAAC,GAGd,EAAO,OAAS,YAChB,QAAQ,IACJ,EAAG,KAAK;KACnB,EAAO,SAAS,CACT,GAEA,QAAQ,IAAI;GAAQ,EAAO,MAAQ,EAAO,QAAQ,EAClD,QAAQ,IACJ,EAAG,IAAI;EACrB,EAAO,SAAS,CACN,EAER,CAAC,EAEL,EACK,QAAQ,SAAS,CAAC,CAClB,YAAY,mCAAmC,CAAC,CAChD,WAAa,CACV,QAAQ,IACJ,GAAG,EAAG,KAAK,gBAAgB,EAAE,GAAG,EAAG,MAAM,IAAI,GAAkB,EAAE,GAAG,EAAG,IAAI,SAAS,GAAY,EAAE,GACtG,CACJ,CAAC,EAEL,EAAQ,MAAM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomos/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "CLI tool for the Autonomos Agent Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"commander": "^14.0.2",
|
|
39
39
|
"picocolors": "1.1.1",
|
|
40
40
|
"@inquirer/prompts": "^7.0.0",
|
|
41
|
-
"@autonomos/core": "0.
|
|
41
|
+
"@autonomos/core": "0.8.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@tala-tools/eslint": "0.1.3",
|