@iamdevlinph/codex-kit 1.0.13 → 1.0.15

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 CHANGED
@@ -143,47 +143,41 @@ hooks. Modified managed files are preserved unless `--force` is supplied.
143
143
 
144
144
  ## Apply to a project
145
145
 
146
- For a project without `AGENTS.md`:
146
+ ### First-time setup
147
+
148
+ For a new blank project, scaffold its initial stack first. Then initialize
149
+ codex-kit once from the project root:
147
150
 
148
151
  ```sh
149
152
  cd /path/to/project
150
153
  pnpm dlx @iamdevlinph/codex-kit@latest project init
151
154
  ```
152
155
 
153
- This creates:
156
+ `project init` performs the initial template sync, so do not run `project sync`
157
+ immediately afterward. It creates or updates:
154
158
 
155
- - `AGENTS.md`, containing a project-specific section ready for reconciliation
159
+ - `AGENTS.md`, only when missing; an existing file is preserved
156
160
  - `TEMPLATE_AGENTS.md`, a local reference copy used for future comparisons
157
161
  - `.codex-kit-state.json`, reconciliation bookkeeping
158
162
 
159
- Add repository commands, paths, architecture, integrations, and exceptions to
160
- the project-specific section of `AGENTS.md`.
161
-
162
- ### Generate project-specific guidance
163
+ If `AGENTS.md` is missing or still contains only the untouched codex-kit
164
+ scaffold, the CLI prints a clearly marked initialization prompt. Copy everything
165
+ between `BEGIN CODEX INITIALIZATION PROMPT` and
166
+ `END CODEX INITIALIZATION PROMPT` into a Codex task opened at the project root.
167
+ The prompt asks Codex to verify that the project has enough substantive code,
168
+ dependencies, configuration, and scripts to derive reliable guidance. If not,
169
+ Codex stops without inventing rules or marking the template applied. Finish
170
+ scaffolding the project, rerun `project init`, and send the new CLI prompt.
163
171
 
164
- For an existing project, use this prompt after initialization. For a new
165
- project, scaffold the initial stack first.
166
-
167
- ```txt
168
- Explore this repository before changing code. Identify its languages,
169
- frameworks, package manager, scripts, directory structure, styling and component
170
- systems, form and validation libraries, data-access patterns, testing tools, and
171
- generated files.
172
-
173
- Update only the project-specific section of AGENTS.md with concise guidelines
174
- derived from the repository's actual dependencies, configuration, scripts, and
175
- established code patterns. Include exact verification commands. Preserve the
176
- managed shared-template block, avoid speculative preferences, and do not add
177
- rules for tools the repository does not use.
178
- ```
172
+ When `AGENTS.md` already contains guidance, `project init` preserves it and
173
+ prints the reconciliation prompt described below instead.
179
174
 
180
175
  ## Synchronize template updates
181
176
 
182
- Refresh a project's local template reference:
177
+ After a newer codex-kit template is released, refresh an initialized project:
183
178
 
184
179
  ```sh
185
180
  pnpm dlx @iamdevlinph/codex-kit@latest project sync
186
- codex-kit project status
187
181
  ```
188
182
 
189
183
  `project sync` never edits `AGENTS.md` or project skills. It routes Codex to the
@@ -195,10 +189,17 @@ database, deployment, and destructive-operation rules remain in `AGENTS.md`;
195
189
  do not copy the complete template or introduce managed markers. After semantic
196
190
  reconciliation and validation, record the applied template hash:
197
191
 
192
+ The CLI prints a clearly marked reconciliation prompt. Copy everything between
193
+ `BEGIN CODEX RECONCILIATION PROMPT` and `END CODEX RECONCILIATION PROMPT` into a
194
+ Codex task opened at the project root. That prompt tells Codex to validate and
195
+ then run:
196
+
198
197
  ```sh
199
198
  codex-kit project mark-applied
200
199
  ```
201
200
 
201
+ You normally do not run that command manually.
202
+
202
203
  `mark-applied` updates only `.codex-kit-state.json`; it does not validate or
203
204
  modify `AGENTS.md`.
204
205
 
@@ -123,6 +123,11 @@ conditional procedures into validated project skills.
123
123
 
124
124
  - Follow the repository's organization and naming. Prefer focused files and
125
125
  split mixed responsibilities when readability improves.
126
+ - Use intent-revealing domain names. A reader should understand what a variable
127
+ contains or what a helper guarantees at the call site without opening its
128
+ implementation. Avoid vague transformation names such as `normalized`,
129
+ `processed`, `result`, or `data` when a value- or behavior-specific name is
130
+ available.
126
131
  - Do not reorganize feature directories, shared modules, routes, server
127
132
  boundaries, schemas, or state patterns unless requested and approved.
128
133
 
@@ -8,9 +8,10 @@ description: Reconcile a refreshed TEMPLATE_AGENTS.md with a project's AGENTS.md
8
8
  ## Procedure
9
9
 
10
10
  1. Inspect `AGENTS.md`, `TEMPLATE_AGENTS.md`, `.codex-kit-state.json`, the
11
- project's existing `.agents/skills`, and `codex-kit project status`. If a
12
- codex-kit template backup exists, compare it with the refreshed template to
13
- isolate the actual template change.
11
+ project's existing `.agents/skills`, and `codex-kit project status`. Record
12
+ the initial status before making changes. If a codex-kit template backup
13
+ exists, compare it with the refreshed template to isolate the actual template
14
+ change.
14
15
  2. Preserve the existing `AGENTS.md` organization and all project-specific
15
16
  adaptations. Merge only reusable template guidance that applies to this
16
17
  repository; report conflicts between local and template rules, and do not
@@ -25,8 +26,14 @@ description: Reconcile a refreshed TEMPLATE_AGENTS.md with a project's AGENTS.md
25
26
  unintended template edits. Validate every created or modified project skill
26
27
  with an available skill validator and run the repository's documented checks.
27
28
  Do not mark the template applied until reconciliation and validation succeed.
28
- 6. Run `codex-kit project mark-applied` only after successful reconciliation and
29
- validation, then confirm `codex-kit project status` is up to date.
29
+ 6. Never run `codex-kit project sync` on the user's behalf or recommend it for
30
+ an unreleased local template edit. The user should run `project sync` only
31
+ after updating codex-kit to a released version containing the template
32
+ change. Run `codex-kit project mark-applied` only when the task follows a
33
+ user-run `project init` or eligible `project sync`, the initial status
34
+ recorded in step 1 was `reconciliation required`, and reconciliation and
35
+ validation succeeded. Otherwise leave project state unchanged and report the
36
+ remaining release, codex-kit update, user-run sync, and reconciliation steps.
30
37
  7. Summarize added, updated, skipped, adapted, and skill-moved guidance, with
31
38
  reasons. Identify genuinely reusable, generalized changes that should be
32
39
  promoted to codex-kit's canonical template and report the target section and
package/bin/codex-kit.js CHANGED
@@ -1,35 +1,61 @@
1
1
  #!/usr/bin/env node
2
- import{realpathSync as $e}from"node:fs";import{resolve as io}from"node:path";import{fileURLToPath as ao}from"node:url";import{copyFileSync as Ve,existsSync as m,mkdirSync as We,readdirSync as j,rmSync as T,statSync as ge}from"node:fs";import{join as d}from"node:path";import{createHash as Te}from"node:crypto";import{copyFileSync as Oe,existsSync as H,mkdirSync as _e,readFileSync as Q,renameSync as Ce,writeFileSync as je}from"node:fs";import{dirname as Le}from"node:path";var k=o=>typeof o=="object"&&o!==null,S=o=>Te("sha256").update(o).digest("hex"),b=o=>Q(o),g=o=>Q(o,"utf8");function E(o){if(!H(o))return null;let e=()=>new Date().toISOString().replace(/[-:TZ.]/g,""),t=`${o}.codex-kit.bak-${e()}`,n=1;for(;H(t);)t=`${o}.codex-kit.bak-${e()}-${n++}`;return Oe(o,t),console.log(`backup: ${t}`),t}function u(o,e){_e(Le(o),{recursive:!0});let t=`${o}.codex-kit.tmp-${process.pid}`;je(t,e),Ce(t,o)}function K(o){if(!H(o))return{};try{let e=JSON.parse(g(o));if(k(e))return e}catch{}throw new Error(`${o} must contain a JSON object; fix or move it before installing.`)}import{readFileSync as Ne}from"node:fs";import{dirname as Ge,join as $,resolve as Re}from"node:path";import{fileURLToPath as Ie}from"node:url";var M=Re(Ge(Ie(import.meta.url)),".."),N=$(M,"assets"),F=$(N,"agents"),ee=$(N,"skills"),h="codex-kit-reconcile-agents",oe=$(ee,h,"SKILL.md"),te=$(ee,h,"agents","openai.yaml"),U=$(N,"SUBAGENT_ROUTING.md"),ne=$(M,"bin","routing-hook.js"),D=$(N,"TEMPLATE_AGENTS.md"),p=JSON.parse(Ne($(M,"package.json"),"utf8")),J=p.publishConfig?.registry??"https://registry.npmjs.org";import{existsSync as ie,rmSync as Ke}from"node:fs";import{join as Me}from"node:path";import{copyFileSync as Pe,existsSync as G,rmSync as He}from"node:fs";import{join as re}from"node:path";var _=".codex-kit-state.json";function O(o){let e=re(o,_);if(!G(e))return{version:p.version,files:{}};try{let t=JSON.parse(g(e));return k(t)&&k(t.files)?t:{version:p.version,files:{}}}catch{throw new Error(`${e} is not valid JSON; move it aside before reinstalling.`)}}function R(o,e){u(re(o,_),`${JSON.stringify(e,null,2)}
3
- `)}function B(o,e,t,n,r){let i=b(o),s=S(i),a=n.files[t];if(!G(e))return u(e,i),console.log(`installed: ${e}`),{target:e,hash:s,ownership:"created",backup:null};let c=S(b(e));if(c===s)return console.log(`unchanged: ${e}`),a??{target:e,hash:s,ownership:"preexisting",backup:null};let f=a&&a.target===e&&a.ownership!=="preexisting"&&a.hash===c;if(!f&&!r)return console.warn(`preserved modified or pre-existing file: ${e} (use --force to replace)`),a??null;let l=E(e);return u(e,i),console.log(`updated: ${e}`),{target:e,hash:s,ownership:f?a.ownership:"replaced",backup:f?a.backup:l}}function se(o){let{target:e}=o;!G(e)||S(b(e))!==o.hash?console.warn(`preserved modified or missing file: ${e}`):o.ownership==="created"?(He(e),console.log(`removed: ${e}`)):o.ownership==="replaced"&&o.backup&&G(o.backup)?(Pe(o.backup,e),console.log(`restored: ${e}`)):console.log(`preserved pre-existing file: ${e}`)}function I(o){let e=new Map,t=!1;for(let n of o.split(`
4
- `)){if(/^\s*\[/.test(n)){t=!0;continue}if(t)continue;let r=/^(\s*)(model|model_reasoning_effort|plan_mode_reasoning_effort)\s*=\s*(.*?)\s*$/.exec(n),i=r?.[2],s=r?.[3];i&&s!==void 0&&!e.has(i)&&e.set(i,{value:s,line:n})}return e}var C=o=>JSON.stringify(o);function Fe(o,e){let t=o.split(`
5
- `),n=new Set,r=t.findIndex(s=>/^\s*\[/.test(s));r<0&&(r=t.length);for(let s=0;s<r;s++){let a=/^(\s*)(model|model_reasoning_effort|plan_mode_reasoning_effort)\s*=\s*(.*?)\s*$/.exec(t[s]??""),c=a?.[2];!a||!c||n.has(c)||(t[s]=`${a[1]}${c} = ${C(e[c])}`,n.add(c))}let i=Object.keys(e).filter(s=>!n.has(s)).map(s=>`${s} = ${C(e[s])}`);return i.length&&t.splice(0,0,...i,""),t.join(`
2
+ import{realpathSync as $e}from"node:fs";import{resolve as lo}from"node:path";import{fileURLToPath as co}from"node:url";import{copyFileSync as Ve,existsSync as m,mkdirSync as Xe,readdirSync as N,rmSync as A,statSync as ge}from"node:fs";import{join as f}from"node:path";import{createHash as Oe}from"node:crypto";import{copyFileSync as Ce,existsSync as H,mkdirSync as _e,readFileSync as Q,renameSync as Ne,writeFileSync as Ie}from"node:fs";import{dirname as Le}from"node:path";var k=o=>typeof o=="object"&&o!==null,E=o=>Oe("sha256").update(o).digest("hex"),y=o=>Q(o),g=o=>Q(o,"utf8");function S(o){if(!H(o))return null;let e=()=>new Date().toISOString().replace(/[-:TZ.]/g,""),t=`${o}.codex-kit.bak-${e()}`,n=1;for(;H(t);)t=`${o}.codex-kit.bak-${e()}-${n++}`;return Ce(o,t),console.log(`backup: ${t}`),t}function u(o,e){_e(Le(o),{recursive:!0});let t=`${o}.codex-kit.tmp-${process.pid}`;Ie(t,e),Ne(t,o)}function K(o){if(!H(o))return{};try{let e=JSON.parse(g(o));if(k(e))return e}catch{}throw new Error(`${o} must contain a JSON object; fix or move it before installing.`)}import{readFileSync as je}from"node:fs";import{dirname as Ge,join as w,resolve as Re}from"node:path";import{fileURLToPath as Pe}from"node:url";var M=Re(Ge(Pe(import.meta.url)),".."),L=w(M,"assets"),D=w(L,"agents"),ee=w(L,"skills"),h="codex-kit-reconcile-agents",oe=w(ee,h,"SKILL.md"),te=w(ee,h,"agents","openai.yaml"),F=w(L,"SUBAGENT_ROUTING.md"),ne=w(M,"bin","routing-hook.js"),U=w(L,"TEMPLATE_AGENTS.md"),p=JSON.parse(je(w(M,"package.json"),"utf8")),J=p.publishConfig?.registry??"https://registry.npmjs.org";import{existsSync as ie,rmSync as Me}from"node:fs";import{join as De}from"node:path";import{copyFileSync as He,existsSync as j,rmSync as Ke}from"node:fs";import{join as re}from"node:path";var C=".codex-kit-state.json";function O(o){let e=re(o,C);if(!j(e))return{version:p.version,files:{}};try{let t=JSON.parse(g(e));return k(t)&&k(t.files)?t:{version:p.version,files:{}}}catch{throw new Error(`${e} is not valid JSON; move it aside before reinstalling.`)}}function G(o,e){u(re(o,C),`${JSON.stringify(e,null,2)}
3
+ `)}function B(o,e,t,n,r){let i=y(o),s=E(i),a=n.files[t];if(!j(e))return u(e,i),console.log(`installed: ${e}`),{target:e,hash:s,ownership:"created",backup:null};let c=E(y(e));if(c===s)return console.log(`unchanged: ${e}`),a??{target:e,hash:s,ownership:"preexisting",backup:null};let d=a&&a.target===e&&a.ownership!=="preexisting"&&a.hash===c;if(!d&&!r)return console.warn(`preserved modified or pre-existing file: ${e} (use --force to replace)`),a??null;let l=S(e);return u(e,i),console.log(`updated: ${e}`),{target:e,hash:s,ownership:d?a.ownership:"replaced",backup:d?a.backup:l}}function se(o){let{target:e}=o;!j(e)||E(y(e))!==o.hash?console.warn(`preserved modified or missing file: ${e}`):o.ownership==="created"?(Ke(e),console.log(`removed: ${e}`)):o.ownership==="replaced"&&o.backup&&j(o.backup)?(He(o.backup,e),console.log(`restored: ${e}`)):console.log(`preserved pre-existing file: ${e}`)}function R(o){let e=new Map,t=!1;for(let n of o.split(`
4
+ `)){if(/^\s*\[/.test(n)){t=!0;continue}if(t)continue;let r=/^(\s*)(model|model_reasoning_effort|plan_mode_reasoning_effort)\s*=\s*(.*?)\s*$/.exec(n),i=r?.[2],s=r?.[3];i&&s!==void 0&&!e.has(i)&&e.set(i,{value:s,line:n})}return e}var _=o=>JSON.stringify(o);function Fe(o,e){let t=o.split(`
5
+ `),n=new Set,r=t.findIndex(s=>/^\s*\[/.test(s));r<0&&(r=t.length);for(let s=0;s<r;s++){let a=/^(\s*)(model|model_reasoning_effort|plan_mode_reasoning_effort)\s*=\s*(.*?)\s*$/.exec(t[s]??""),c=a?.[2];!a||!c||n.has(c)||(t[s]=`${a[1]}${c} = ${_(e[c])}`,n.add(c))}let i=Object.keys(e).filter(s=>!n.has(s)).map(s=>`${s} = ${_(e[s])}`);return i.length&&t.splice(0,0,...i,""),t.join(`
6
6
  `)}function Ue(o,e){let t=o.split(`
7
- `),n=t.findIndex(i=>/^\s*\[/.test(i));n<0&&(n=t.length);let r=new Set;for(let i=0;i<n;i++){let s=/^(\s*)(model|model_reasoning_effort|plan_mode_reasoning_effort)\s*=\s*(.*?)\s*$/.exec(t[i]??""),a=s?.[2];if(!s||!a||r.has(a)||s[3]!==C(e.desired[a]))continue;let c=e.previous[a];c?.present?t[i]=`${s[1]}${a} = ${c.value}`:(t.splice(i,1),i--,n--),r.add(a)}return Object.values(e.previous).some(i=>i&&!i.present)&&t[0]===""&&t.shift(),t.join(`
8
- `)}function V(o){let e=o.codexHome,t=Me(e,"config.toml"),n={model:o.orchestrator,model_reasoning_effort:o.reasoningEffort,plan_mode_reasoning_effort:o.planReasoningEffort},r=O(e),i=ie(t)?g(t):"",s=I(i);if(r.config?.target===t&&Object.entries(r.config.desired).some(([l,x])=>s.get(l)?.value!==C(x))&&!o.force){console.warn(`preserved modified config: ${t} (use --force to replace)`);return}let a=Fe(i,n);a!==i?(E(t),u(t,a),console.log(`configured orchestrator: ${t}`)):console.log(`unchanged: ${t}`);let c=r.config?.previous??{};for(let f of Object.keys(n)){if(f in c)continue;let l=s.get(f);c[f]=l?{present:!0,value:l.value}:{present:!1}}r.version=p.version,r.config={target:t,desired:n,previous:c},R(e,r),console.log(`Orchestrator: ${n.model}`),console.log(`Reasoning effort: ${n.model_reasoning_effort}`),console.log(`Plan mode reasoning effort: ${n.plan_mode_reasoning_effort}`)}function ae(o){if(!ie(o.target)){console.warn(`preserved missing config: ${o.target}`);return}let e=g(o.target),t=I(e);if(Object.entries(o.desired).some(([i,s])=>t.get(i)?.value!==C(s))){console.warn(`preserved modified config: ${o.target}`);return}let r=Ue(e,o);r!==e&&(E(o.target),r.trim()?u(o.target,r):Ke(o.target),console.log(`restored config: ${o.target}`))}import{existsSync as W,rmSync as De}from"node:fs";import{join as le}from"node:path";var Je=o=>`'${o.replaceAll("'",`'"'"'`)}'`,Be=o=>({command:`/usr/bin/env node ${Je(o)}`,commandWindows:`node ${JSON.stringify(o)}`});function ce(o,e){let t=o.hooks;if(k(t))for(let[n,r]of Object.entries(t)){if(!Array.isArray(r))continue;let i=r.flatMap(s=>{if(!k(s)||!Array.isArray(s.hooks))return[s];let a=s.hooks.filter(c=>!k(c)||c.command!==e.command&&c.commandWindows!==e.commandWindows);return a.length?[{...s,hooks:a}]:[]});i.length?t[n]=i:delete t[n]}}function fe(o,e){let t=le(o,"hooks.json"),n=Be(le(o,"codex-kit","routing-hook.js")),r=e?.created??!W(t),i=K(t);e&&ce(i,e);let s=k(i.hooks)?i.hooks:{};i.hooks=s;let a={type:"command",...n,timeout:5};s.UserPromptSubmit=[...Array.isArray(s.UserPromptSubmit)?s.UserPromptSubmit:[],{hooks:[{...a,statusMessage:"Loading subagent routing"}]}],s.SubagentStart=[...Array.isArray(s.SubagentStart)?s.SubagentStart:[],{hooks:[{...a,statusMessage:"Briefing delegated worker"}]}];let c=`${JSON.stringify(i,null,2)}
9
- `,f=W(t)?g(t):"";return c!==f&&(E(t),u(t,c),console.log(`updated: ${t}`)),{target:t,...n,created:r}}function de(o){if(!W(o.target)){console.warn(`preserved missing hooks file: ${o.target}`);return}let e=K(o.target);ce(e,o),k(e.hooks)&&!Object.keys(e.hooks).length&&delete e.hooks,E(o.target),o.created&&!Object.keys(e).length?De(o.target):u(o.target,`${JSON.stringify(e,null,2)}
10
- `),console.log(`removed managed routing hooks from: ${o.target}`)}var z="<!-- BEGIN codex-kit:subagent-routing -->",pe="<!-- END codex-kit:subagent-routing -->",ze=(o,e,t)=>`${e}
7
+ `),n=t.findIndex(i=>/^\s*\[/.test(i));n<0&&(n=t.length);let r=new Set;for(let i=0;i<n;i++){let s=/^(\s*)(model|model_reasoning_effort|plan_mode_reasoning_effort)\s*=\s*(.*?)\s*$/.exec(t[i]??""),a=s?.[2];if(!s||!a||r.has(a)||s[3]!==_(e.desired[a]))continue;let c=e.previous[a];c?.present?t[i]=`${s[1]}${a} = ${c.value}`:(t.splice(i,1),i--,n--),r.add(a)}return Object.values(e.previous).some(i=>i&&!i.present)&&t[0]===""&&t.shift(),t.join(`
8
+ `)}function z(o){let e=o.codexHome,t=De(e,"config.toml"),n={model:o.orchestrator,model_reasoning_effort:o.reasoningEffort,plan_mode_reasoning_effort:o.planReasoningEffort},r=O(e),i=ie(t)?g(t):"",s=R(i);if(r.config?.target===t&&Object.entries(r.config.desired).some(([l,v])=>s.get(l)?.value!==_(v))&&!o.force){console.warn(`preserved modified config: ${t} (use --force to replace)`);return}let a=Fe(i,n);a!==i?(S(t),u(t,a),console.log(`configured orchestrator: ${t}`)):console.log(`unchanged: ${t}`);let c=r.config?.previous??{};for(let d of Object.keys(n)){if(d in c)continue;let l=s.get(d);c[d]=l?{present:!0,value:l.value}:{present:!1}}r.version=p.version,r.config={target:t,desired:n,previous:c},G(e,r),console.log(`Orchestrator: ${n.model}`),console.log(`Reasoning effort: ${n.model_reasoning_effort}`),console.log(`Plan mode reasoning effort: ${n.plan_mode_reasoning_effort}`)}function ae(o){if(!ie(o.target)){console.warn(`preserved missing config: ${o.target}`);return}let e=g(o.target),t=R(e);if(Object.entries(o.desired).some(([i,s])=>t.get(i)?.value!==_(s))){console.warn(`preserved modified config: ${o.target}`);return}let r=Ue(e,o);r!==e&&(S(o.target),r.trim()?u(o.target,r):Me(o.target),console.log(`restored config: ${o.target}`))}import{existsSync as V,rmSync as Je}from"node:fs";import{join as le}from"node:path";var Be=o=>`'${o.replaceAll("'",`'"'"'`)}'`,ze=o=>({command:`/usr/bin/env node ${Be(o)}`,commandWindows:`node ${JSON.stringify(o)}`});function ce(o,e){let t=o.hooks;if(k(t))for(let[n,r]of Object.entries(t)){if(!Array.isArray(r))continue;let i=r.flatMap(s=>{if(!k(s)||!Array.isArray(s.hooks))return[s];let a=s.hooks.filter(c=>!k(c)||c.command!==e.command&&c.commandWindows!==e.commandWindows);return a.length?[{...s,hooks:a}]:[]});i.length?t[n]=i:delete t[n]}}function de(o,e){let t=le(o,"hooks.json"),n=ze(le(o,"codex-kit","routing-hook.js")),r=e?.created??!V(t),i=K(t);e&&ce(i,e);let s=k(i.hooks)?i.hooks:{};i.hooks=s;let a={type:"command",...n,timeout:5};s.UserPromptSubmit=[...Array.isArray(s.UserPromptSubmit)?s.UserPromptSubmit:[],{hooks:[{...a,statusMessage:"Loading subagent routing"}]}],s.SubagentStart=[...Array.isArray(s.SubagentStart)?s.SubagentStart:[],{hooks:[{...a,statusMessage:"Briefing delegated worker"}]}];let c=`${JSON.stringify(i,null,2)}
9
+ `,d=V(t)?g(t):"";return c!==d&&(S(t),u(t,c),console.log(`updated: ${t}`)),{target:t,...n,created:r}}function fe(o){if(!V(o.target)){console.warn(`preserved missing hooks file: ${o.target}`);return}let e=K(o.target);ce(e,o),k(e.hooks)&&!Object.keys(e.hooks).length&&delete e.hooks,S(o.target),o.created&&!Object.keys(e).length?Je(o.target):u(o.target,`${JSON.stringify(e,null,2)}
10
+ `),console.log(`removed managed routing hooks from: ${o.target}`)}var X="<!-- BEGIN codex-kit:subagent-routing -->",pe="<!-- END codex-kit:subagent-routing -->",We=(o,e,t)=>`${e}
11
11
  ${o.trimEnd()}
12
- ${t}`;function qe(o,e,t,n){let r=o.indexOf(t),i=o.indexOf(n);if(r>=0!=i>=0||r>=0&&i<r)throw new Error(`Malformed managed block: expected both ${t} and ${n}.`);let s=ze(e,t,n);return r>=0?`${o.slice(0,r)}${s}${o.slice(i+n.length)}`:`${o.trimEnd()}${o.trim()?`
12
+ ${t}`;function qe(o,e,t,n){let r=o.indexOf(t),i=o.indexOf(n);if(r>=0!=i>=0||r>=0&&i<r)throw new Error(`Malformed managed block: expected both ${t} and ${n}.`);let s=We(e,t,n);return r>=0?`${o.slice(0,r)}${s}${o.slice(i+n.length)}`:`${o.trimEnd()}${o.trim()?`
13
13
 
14
14
  `:""}${s}
15
- `}function Xe(o,e,t){let n=o.indexOf(e),r=o.indexOf(t);if(n<0&&r<0)return o;if(n<0||r<n)throw new Error("Malformed managed block in AGENTS.md.");let i=o.slice(0,n).trimEnd(),s=o.slice(r+t.length).trimStart();return`${i}${i&&s?`
15
+ `}function Ze(o,e,t){let n=o.indexOf(e),r=o.indexOf(t);if(n<0&&r<0)return o;if(n<0||r<n)throw new Error("Malformed managed block in AGENTS.md.");let i=o.slice(0,n).trimEnd(),s=o.slice(r+t.length).trimStart();return`${i}${i&&s?`
16
16
 
17
17
  `:""}${s}${i||s?`
18
- `:""}`}function me(o){let e=o.codexHome;We(e,{recursive:!0});let t=O(e),n={version:p.version,files:{},globalAgents:null,hooks:null,config:t.config??null};for(let f of j(F).filter(l=>l.endsWith(".toml")).sort()){let l=`agents/${f}`,x=B(d(F,f),d(e,"agents",f),l,t,o.force);x&&(n.files[l]=x)}let r=[[U,d(e,"SUBAGENT_ROUTING.md"),"routing"],[oe,d(e,"skills",h,"SKILL.md"),`skills/${h}/SKILL.md`],[te,d(e,"skills",h,"agents","openai.yaml"),`skills/${h}/agents/openai.yaml`],[ne,d(e,"codex-kit","routing-hook.js"),"routing-hook"]];for(let[f,l,x]of r){let L=B(f,l,x,t,o.force);L&&(n.files[x]=L)}for(let[f,l]of Object.entries(t.files))f in n.files||(!m(l.target)||S(b(l.target))!==l.hash?(console.warn(`preserved stale modified or missing file: ${l.target}`),n.files[f]=l):l.ownership==="created"?(T(l.target),console.log(`removed stale: ${l.target}`)):l.ownership==="replaced"&&l.backup&&m(l.backup)&&(Ve(l.backup,l.target),console.log(`restored stale: ${l.target}`)));let i=d(e,"AGENTS.md"),s=m(i)?g(i):"",a=qe(s,g(U),z,pe);a!==s&&(E(i),u(i,a),console.log(`updated: ${i}`)),n.globalAgents={target:i},n.hooks=fe(e,t.hooks),R(e,n);let c=d(e,"agents","commit-pusher.toml");m(c)&&console.warn(`warning: existing unmanaged commit-pusher remains at ${c}`),console.log(`Codex kit ${p.version} installed under ${e}`)}function ue(o){let e=o.codexHome,t=d(e,"config.toml"),n=d(e,"AGENTS.md"),r=O(e),i=m(t)?I(g(t)):new Map,s=y=>{let v=i.get(y)?.value;if(!v)return"not set";try{return String(JSON.parse(v))}catch{return v}};console.log(`Codex home: ${e}`),console.log(`Config: ${t}${m(t)?"":" (missing)"}`),console.log(`Orchestrator: ${s("model")}`),console.log(`Reasoning effort: ${s("model_reasoning_effort")}`),console.log(`Plan mode reasoning effort: ${s("plan_mode_reasoning_effort")}`),console.log(`Kit state: ${m(d(e,_))?r.version:"not installed"}`),console.log(`Global routing: ${m(n)&&g(n).includes(z)?"installed":"not installed"}`),console.log(`Routing file: ${m(d(e,"SUBAGENT_ROUTING.md"))?d(e,"SUBAGENT_ROUTING.md"):"missing"}`);let a=r.hooks;console.log(`Routing hook: ${a&&m(a.target)&&g(a.target).includes(a.command)?"installed":"not installed"}`);let c=[[d(e,"skills",h,"SKILL.md"),r.files[`skills/${h}/SKILL.md`]],[d(e,"skills",h,"agents","openai.yaml"),r.files[`skills/${h}/agents/openai.yaml`]]],f=c.every(([y,v])=>m(y)&&v&&S(b(y))===v.hash)?"installed":c.some(([y])=>m(y))?"modified or incomplete":"missing";console.log(`Reconciliation skill: ${f}`),console.log("Custom agents:");let l=d(e,"agents"),x=m(l)?j(l).filter(y=>y.endsWith(".toml")).sort():[];if(!x.length){console.log(" (none)");return}let L=new Set(Object.values(r.files).map(y=>y.target));for(let y of x){let v=d(l,y),we=g(v),P=Ae=>new RegExp(`^${Ae}\\s*=\\s*"([^"]*)"`,"m").exec(we)?.[1]??"not set";console.log(` ${P("name")} \u2014 ${P("model")}, ${P("model_reasoning_effort")} (${L.has(v)?"managed":"unmanaged"})`)}}function he(o){let e=o.codexHome,t=d(e,_);if(!m(t)){console.log(`No installer state at ${t}; nothing removed.`);return}let n=O(e);for(let f of Object.values(n.files))se(f);let r=n.globalAgents?.target??d(e,"AGENTS.md");if(m(r)){let f=g(r),l=Xe(f,z,pe);l!==f&&(E(r),l?u(r,l):T(r),console.log(`removed managed routing from: ${r}`))}n.config&&ae(n.config),n.hooks&&de(n.hooks);let i=d(e,"skills",h),s=d(i,"agents");m(s)&&ge(s).isDirectory()&&!j(s).length&&T(s,{recursive:!0}),m(i)&&ge(i).isDirectory()&&!j(i).length&&T(i,{recursive:!0});let a=d(e,"codex-kit","allowances");m(a)&&T(a,{recursive:!0,force:!0});let c=d(e,"codex-kit");m(c)&&!j(c).length&&T(c,{recursive:!0}),T(t),console.log(`Codex kit uninstalled from ${e}`)}import{existsSync as w,statSync as Ye}from"node:fs";import{join as A}from"node:path";var ke=".codex-kit-state.json",Ze="<!-- BEGIN codex-kit:shared-template -->",Qe="<!-- END codex-kit:shared-template -->";function q(o){let e=A(o,ke);if(!w(e))return{version:1,template:{}};try{let t=JSON.parse(g(e));return k(t)&&k(t.template)?t:{version:1,template:{}}}catch{throw new Error(`${e} is not valid JSON; move it aside before syncing.`)}}var Se=(o,e)=>u(A(o,ke),`${JSON.stringify(e,null,2)}
19
- `),X=o=>{if(!w(o)||!Ye(o).isDirectory())throw new Error(`Not a directory: ${o}`)};function eo(){return`Template reference updated. Use the global $${h} skill to reconcile it semantically.
18
+ `:""}`}function me(o){let e=o.codexHome;Xe(e,{recursive:!0});let t=O(e),n={version:p.version,files:{},globalAgents:null,hooks:null,config:t.config??null};for(let d of N(D).filter(l=>l.endsWith(".toml")).sort()){let l=`agents/${d}`,v=B(f(D,d),f(e,"agents",d),l,t,o.force);v&&(n.files[l]=v)}let r=[[F,f(e,"SUBAGENT_ROUTING.md"),"routing"],[oe,f(e,"skills",h,"SKILL.md"),`skills/${h}/SKILL.md`],[te,f(e,"skills",h,"agents","openai.yaml"),`skills/${h}/agents/openai.yaml`],[ne,f(e,"codex-kit","routing-hook.js"),"routing-hook"]];for(let[d,l,v]of r){let I=B(d,l,v,t,o.force);I&&(n.files[v]=I)}for(let[d,l]of Object.entries(t.files))d in n.files||(!m(l.target)||E(y(l.target))!==l.hash?(console.warn(`preserved stale modified or missing file: ${l.target}`),n.files[d]=l):l.ownership==="created"?(A(l.target),console.log(`removed stale: ${l.target}`)):l.ownership==="replaced"&&l.backup&&m(l.backup)&&(Ve(l.backup,l.target),console.log(`restored stale: ${l.target}`)));let i=f(e,"AGENTS.md"),s=m(i)?g(i):"",a=qe(s,g(F),X,pe);a!==s&&(S(i),u(i,a),console.log(`updated: ${i}`)),n.globalAgents={target:i},n.hooks=de(e,t.hooks),G(e,n);let c=f(e,"agents","commit-pusher.toml");m(c)&&console.warn(`warning: existing unmanaged commit-pusher remains at ${c}`),console.log(`Codex kit ${p.version} installed under ${e}`)}function ue(o){let e=o.codexHome,t=f(e,"config.toml"),n=f(e,"AGENTS.md"),r=O(e),i=m(t)?R(g(t)):new Map,s=b=>{let x=i.get(b)?.value;if(!x)return"not set";try{return String(JSON.parse(x))}catch{return x}};console.log(`Codex home: ${e}`),console.log(`Config: ${t}${m(t)?"":" (missing)"}`),console.log(`Orchestrator: ${s("model")}`),console.log(`Reasoning effort: ${s("model_reasoning_effort")}`),console.log(`Plan mode reasoning effort: ${s("plan_mode_reasoning_effort")}`),console.log(`Kit state: ${m(f(e,C))?r.version:"not installed"}`),console.log(`Global routing: ${m(n)&&g(n).includes(X)?"installed":"not installed"}`),console.log(`Routing file: ${m(f(e,"SUBAGENT_ROUTING.md"))?f(e,"SUBAGENT_ROUTING.md"):"missing"}`);let a=r.hooks;console.log(`Routing hook: ${a&&m(a.target)&&g(a.target).includes(a.command)?"installed":"not installed"}`);let c=[[f(e,"skills",h,"SKILL.md"),r.files[`skills/${h}/SKILL.md`]],[f(e,"skills",h,"agents","openai.yaml"),r.files[`skills/${h}/agents/openai.yaml`]]],d=c.every(([b,x])=>m(b)&&x&&E(y(b))===x.hash)?"installed":c.some(([b])=>m(b))?"modified or incomplete":"missing";console.log(`Reconciliation skill: ${d}`),console.log("Custom agents:");let l=f(e,"agents"),v=m(l)?N(l).filter(b=>b.endsWith(".toml")).sort():[];if(!v.length){console.log(" (none)");return}let I=new Set(Object.values(r.files).map(b=>b.target));for(let b of v){let x=f(l,b),Te=g(x),P=Ae=>new RegExp(`^${Ae}\\s*=\\s*"([^"]*)"`,"m").exec(Te)?.[1]??"not set";console.log(` ${P("name")} \u2014 ${P("model")}, ${P("model_reasoning_effort")} (${I.has(x)?"managed":"unmanaged"})`)}}function he(o){let e=o.codexHome,t=f(e,C);if(!m(t)){console.log(`No installer state at ${t}; nothing removed.`);return}let n=O(e);for(let d of Object.values(n.files))se(d);let r=n.globalAgents?.target??f(e,"AGENTS.md");if(m(r)){let d=g(r),l=Ze(d,X,pe);l!==d&&(S(r),l?u(r,l):A(r),console.log(`removed managed routing from: ${r}`))}n.config&&ae(n.config),n.hooks&&fe(n.hooks);let i=f(e,"skills",h),s=f(i,"agents");m(s)&&ge(s).isDirectory()&&!N(s).length&&A(s,{recursive:!0}),m(i)&&ge(i).isDirectory()&&!N(i).length&&A(i,{recursive:!0});let a=f(e,"codex-kit","allowances");m(a)&&A(a,{recursive:!0,force:!0});let c=f(e,"codex-kit");m(c)&&!N(c).length&&A(c,{recursive:!0}),A(t),console.log(`Codex kit uninstalled from ${e}`)}import{existsSync as $,statSync as Ye}from"node:fs";import{join as T}from"node:path";var Ee=".codex-kit-state.json",Qe="<!-- BEGIN codex-kit:shared-template -->",eo="<!-- END codex-kit:shared-template -->",ke=`# Project-Specific Instructions
19
+
20
+ <!-- Add repository-specific commands, architecture, and exceptions here. -->
21
+ `;function W(o){let e=T(o,Ee);if(!$(e))return{version:1,template:{}};try{let t=JSON.parse(g(e));return k(t)&&k(t.template)?t:{version:1,template:{}}}catch{throw new Error(`${e} is not valid JSON; move it aside before syncing.`)}}var Se=(o,e)=>u(T(o,Ee),`${JSON.stringify(e,null,2)}
22
+ `),q=o=>{if(!$(o)||!Ye(o).isDirectory())throw new Error(`Not a directory: ${o}`)};function oo(){return`Project guidance needs initialization. Copy everything between the markers into Codex.
23
+
24
+ ===== BEGIN CODEX INITIALIZATION PROMPT =====
25
+ Explore this repository before changing code. First determine whether it has a
26
+ substantially scaffolded implementation with enough dependency, configuration,
27
+ script, and source evidence to derive reliable project guidance.
28
+
29
+ If evidence is insufficient, do not add speculative rules or mark the template
30
+ applied. Report what still needs to be scaffolded, then stop.
31
+
32
+ If evidence is sufficient, identify the stack, package manager, scripts,
33
+ structure, established patterns, testing tools, and generated files. Add concise
34
+ project-specific guidance to AGENTS.md based only on repository evidence,
35
+ including exact verification commands. Then use the global
36
+ $${h} skill to merge applicable reusable guidance from
37
+ TEMPLATE_AGENTS.md while preserving AGENTS.md organization and local rules.
38
+ Validate the final instruction changes, mark the template applied only after
39
+ validation succeeds, and confirm codex-kit project status is up to date.
40
+ ===== END CODEX INITIALIZATION PROMPT =====`}function to(){return`Template reference updated. Copy everything between the markers into Codex.
41
+
42
+ ===== BEGIN CODEX RECONCILIATION PROMPT =====
43
+ Use the global $${h} skill to reconcile the existing AGENTS.md
44
+ with the refreshed TEMPLATE_AGENTS.md.
20
45
 
21
46
  Inspect TEMPLATE_AGENTS.md, AGENTS.md, .codex-kit-state.json, existing
22
47
  .agents/skills, and codex-kit project status. Preserve local adaptations and
23
48
  AGENTS.md organization; merge only applicable reusable guidance. Keep critical
24
49
  always-on safety and authorization rules in AGENTS.md, extract only concrete
25
50
  conditional procedures into validated skills, and do not copy the complete
26
- template or introduce managed markers. Mark applied only after reconciliation
27
- and validation, then report any template-worthy generalized promotion.`}function Ee(o){let{cwd:e}=o;X(e);let t=A(e,"AGENTS.md"),n=A(e,"TEMPLATE_AGENTS.md"),r=Buffer.from(g(D)),i=S(r),s=q(e);if(w(n)){let a=S(b(n));if(a!==i&&(!s.template.availableHash||a!==s.template.availableHash)&&!o.force){console.warn(`preserved locally modified template: ${n} (use --force to replace)`),console.log(`The installed kit has template ${p.version}; review the local change before syncing.`);return}a===i?console.log(`unchanged: ${n}`):(E(n),u(n,r),console.log(`refreshed template reference: ${n}`))}else u(n,r),console.log(`created template reference: ${n}`);if(s.version=1,s.template={...s.template,availableHash:i,availableVersion:p.version},Se(e,s),!w(t))u(t,`# Project-Specific Instructions
51
+ template or introduce managed markers.
28
52
 
29
- <!-- Add repository-specific commands, architecture, and exceptions here. -->
30
- `),console.log(`created project instructions file: ${t}`);else{let a=g(t);(a.includes(Ze)||a.includes(Qe))&&(console.warn(`preserved legacy managed template in: ${t}`),console.warn("Ask Codex to migrate it to semantic template reconciliation before applying updates."))}console.log(eo())}function ye(o){let{cwd:e}=o;X(e);let t=A(e,"TEMPLATE_AGENTS.md"),n=q(e),r=n.template.availableHash??null,i=w(t)?S(b(t)):null;if(console.log(`Project: ${e}`),!i){console.log("Status: not initialized (run codex-kit project sync)");return}if(!w(A(e,"AGENTS.md"))){console.log("Status: AGENTS.md missing (reconcile the template first)");return}if(console.log(`Available: ${n.template.availableVersion??"unknown"} (${r??"untracked"})`),console.log(`Applied: ${n.template.appliedHash??"never"}`),S(b(D))!==r){console.log("Status: kit template update available; run project sync");return}if(i!==r){console.log("Status: local template changed; review it before syncing");return}if(n.template.appliedHash!==i){console.log("Status: reconciliation required");return}console.log("Status: up to date")}function be(o){let{cwd:e}=o;X(e);let t=A(e,"TEMPLATE_AGENTS.md"),n=A(e,"AGENTS.md");if(!w(t))throw new Error(`Missing ${t}; run project sync first.`);if(!w(n))throw new Error(`Missing ${n}; reconcile the template into AGENTS.md first.`);let r=q(e);r.version=1,r.template={...r.template,appliedHash:S(b(t)),appliedAt:new Date().toISOString()},Se(e,r),console.log(`recorded template reconciliation: ${t}`)}import{spawnSync as oo}from"node:child_process";function to(o,e){let t=i=>{let s=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(i);if(!s)throw new Error(`Invalid package version: ${i}`);return{numbers:[Number(s[1]),Number(s[2]),Number(s[3])],prerelease:s[4]??null}},n=t(o),r=t(e);for(let[i,s]of[[n.numbers[0],r.numbers[0]],[n.numbers[1],r.numbers[1]],[n.numbers[2],r.numbers[2]]])if(i!==s)return Math.sign(i-s);return n.prerelease===r.prerelease?0:n.prerelease?r.prerelease?Math.sign(n.prerelease.localeCompare(r.prerelease,"en",{numeric:!0})):-1:1}function xe(){let o=process.env.CODEX_KIT_LATEST_VERSION;if(!o){let t=oo(process.platform==="win32"?"pnpm.cmd":"pnpm",["view",p.name,"version","--json",`--registry=${J}`],{encoding:"utf8",timeout:15e3});if(t.error)throw new Error(`Unable to run pnpm: ${t.error.message}`);if(t.status!==0)throw new Error(`Unable to check ${J}: ${t.stderr.trim()||"pnpm view failed"}`);try{let n=JSON.parse(t.stdout);o=Array.isArray(n)&&typeof n.at(-1)=="string"?n.at(-1):typeof n=="string"?n:void 0}catch{o=t.stdout.trim()}}if(!o)throw new Error("Registry returned no package version.");console.log(`Installed: ${p.version}`),console.log(`Latest: ${o}`);let e=to(p.version,o);if(e===0){console.log("codex-kit is up to date.");return}if(e>0){console.log("This local build is newer than the published package.");return}console.log(`Update available. Run:
53
+ Validate the final instruction changes. Mark applied only after reconciliation
54
+ and validation succeed, confirm codex-kit project status is up to date, then
55
+ report any template-worthy generalized promotion.
56
+ ===== END CODEX RECONCILIATION PROMPT =====`}function be(o){let{cwd:e}=o;q(e);let t=T(e,"AGENTS.md"),n=T(e,"TEMPLATE_AGENTS.md"),r=Buffer.from(g(U)),i=E(r),s=W(e);if($(n)){let d=E(y(n));if(d!==i&&(!s.template.availableHash||d!==s.template.availableHash)&&!o.force){console.warn(`preserved locally modified template: ${n} (use --force to replace)`),console.log(`The installed kit has template ${p.version}; review the local change before syncing.`);return}d===i?console.log(`unchanged: ${n}`):(S(n),u(n,r),console.log(`refreshed template reference: ${n}`))}else u(n,r),console.log(`created template reference: ${n}`);if(s.version=1,s.template={...s.template,availableHash:i,availableVersion:p.version},Se(e,s),!$(t))u(t,ke),console.log(`created project instructions file: ${t}`);else{let d=g(t);(d.includes(Qe)||d.includes(eo))&&(console.warn(`preserved legacy managed template in: ${t}`),console.warn("Ask Codex to migrate it to semantic template reconciliation before applying updates."))}let c=g(t).trim()===ke.trim();console.log(c?oo():to())}function ye(o){let{cwd:e}=o;q(e);let t=T(e,"TEMPLATE_AGENTS.md"),n=W(e),r=n.template.availableHash??null,i=$(t)?E(y(t)):null;if(console.log(`Project: ${e}`),!i){console.log("Status: not initialized (run codex-kit project sync)");return}if(!$(T(e,"AGENTS.md"))){console.log("Status: AGENTS.md missing (reconcile the template first)");return}if(console.log(`Available: ${n.template.availableVersion??"unknown"} (${r??"untracked"})`),console.log(`Applied: ${n.template.appliedHash??"never"}`),E(y(U))!==r){console.log("Status: kit template update available; run project sync");return}if(i!==r){console.log("Status: local template changed; review it before syncing");return}if(n.template.appliedHash!==i){console.log("Status: reconciliation required");return}console.log("Status: up to date")}function ve(o){let{cwd:e}=o;q(e);let t=T(e,"TEMPLATE_AGENTS.md"),n=T(e,"AGENTS.md");if(!$(t))throw new Error(`Missing ${t}; run project sync first.`);if(!$(n))throw new Error(`Missing ${n}; reconcile the template into AGENTS.md first.`);let r=W(e);r.version=1,r.template={...r.template,appliedHash:E(y(t)),appliedAt:new Date().toISOString()},Se(e,r),console.log(`recorded template reconciliation: ${t}`)}import{spawnSync as no}from"node:child_process";function ro(o,e){let t=i=>{let s=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(i);if(!s)throw new Error(`Invalid package version: ${i}`);return{numbers:[Number(s[1]),Number(s[2]),Number(s[3])],prerelease:s[4]??null}},n=t(o),r=t(e);for(let[i,s]of[[n.numbers[0],r.numbers[0]],[n.numbers[1],r.numbers[1]],[n.numbers[2],r.numbers[2]]])if(i!==s)return Math.sign(i-s);return n.prerelease===r.prerelease?0:n.prerelease?r.prerelease?Math.sign(n.prerelease.localeCompare(r.prerelease,"en",{numeric:!0})):-1:1}function xe(){let o=process.env.CODEX_KIT_LATEST_VERSION;if(!o){let t=no(process.platform==="win32"?"pnpm.cmd":"pnpm",["view",p.name,"version","--json",`--registry=${J}`],{encoding:"utf8",timeout:15e3});if(t.error)throw new Error(`Unable to run pnpm: ${t.error.message}`);if(t.status!==0)throw new Error(`Unable to check ${J}: ${t.stderr.trim()||"pnpm view failed"}`);try{let n=JSON.parse(t.stdout);o=Array.isArray(n)&&typeof n.at(-1)=="string"?n.at(-1):typeof n=="string"?n:void 0}catch{o=t.stdout.trim()}}if(!o)throw new Error("Registry returned no package version.");console.log(`Installed: ${p.version}`),console.log(`Latest: ${o}`);let e=ro(p.version,o);if(e===0){console.log("codex-kit is up to date.");return}if(e>0){console.log("This local build is newer than the published package.");return}console.log(`Update available. Run:
31
57
  pnpm add --global ${p.name}@latest
32
- codex-kit global install`)}import{homedir as no}from"node:os";import{join as ro,resolve as Y}from"node:path";function ve(o){let e={cwd:process.cwd(),codexHome:Y(process.env.CODEX_HOME||ro(no(),".codex")),orchestrator:"gpt-5.6-sol",reasoningEffort:"low",planReasoningEffort:"high",force:!1,positionals:[]};for(let t=0;t<o.length;t++){let n=o[t];if(n!==void 0)if(n==="--force")e.force=!0;else if(n==="--cwd"||n==="--codex-home"){let r=o[++t];if(!r)throw new Error(`${n} requires a path.`);n==="--cwd"?e.cwd=Y(r):e.codexHome=Y(r)}else if(n==="--orchestrator"||n==="--model"){let r=o[++t];if(!r)throw new Error(`${n} requires a model.`);e.orchestrator=r}else if(n==="--reasoning-effort"||n==="--plan-reasoning-effort"){let r=o[++t];if(!r)throw new Error(`${n} requires a value.`);n==="--reasoning-effort"?e.reasoningEffort=r:e.planReasoningEffort=r}else e.positionals.push(n)}return e}function so(){console.log(`codex-kit ${p.version}
58
+ codex-kit global install`)}import{homedir as so}from"node:os";import{join as io,resolve as Z}from"node:path";function we(o){let e={cwd:process.cwd(),codexHome:Z(process.env.CODEX_HOME||io(so(),".codex")),orchestrator:"gpt-5.6-sol",reasoningEffort:"low",planReasoningEffort:"high",force:!1,positionals:[]};for(let t=0;t<o.length;t++){let n=o[t];if(n!==void 0)if(n==="--force")e.force=!0;else if(n==="--cwd"||n==="--codex-home"){let r=o[++t];if(!r)throw new Error(`${n} requires a path.`);n==="--cwd"?e.cwd=Z(r):e.codexHome=Z(r)}else if(n==="--orchestrator"||n==="--model"){let r=o[++t];if(!r)throw new Error(`${n} requires a model.`);e.orchestrator=r}else if(n==="--reasoning-effort"||n==="--plan-reasoning-effort"){let r=o[++t];if(!r)throw new Error(`${n} requires a value.`);n==="--reasoning-effort"?e.reasoningEffort=r:e.planReasoningEffort=r}else e.positionals.push(n)}return e}function ao(){console.log(`codex-kit ${p.version}
33
59
 
34
60
  Usage:
35
61
  codex-kit <command> [options]
@@ -74,4 +100,4 @@ Examples:
74
100
  codex-kit global install --force
75
101
  codex-kit global configure --reasoning-effort low --plan-reasoning-effort high
76
102
  codex-kit project sync --cwd /path/to/project --force
77
- codex-kit project status --cwd /path/to/project`)}function Z(o=process.argv.slice(2)){let e=ve(o);if(e.positionals.includes("--version")){console.log(p.version);return}if(!e.positionals.length||e.positionals.includes("--help")){so();return}let[t,n]=e.positionals;if(t==="global"&&n==="install")me(e);else if(t==="global"&&n==="configure")V(e);else if(t==="global"&&n==="list")ue(e);else if(t==="global"&&n==="uninstall")he(e);else if(t==="project"&&(n==="init"||n==="sync"))Ee(e);else if(t==="project"&&n==="status")ye(e);else if(t==="project"&&n==="mark-applied")be(e);else if(t==="version"&&n==="check")xe();else throw new Error(`Unknown command: ${e.positionals.join(" ")}`)}if(process.argv[1]&&$e(io(process.argv[1]))===$e(ao(import.meta.url)))try{Z()}catch(o){console.error(`error: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1}export{Z as main};
103
+ codex-kit project status --cwd /path/to/project`)}function Y(o=process.argv.slice(2)){let e=we(o);if(e.positionals.includes("--version")){console.log(p.version);return}if(!e.positionals.length||e.positionals.includes("--help")){ao();return}let[t,n]=e.positionals;if(t==="global"&&n==="install")me(e);else if(t==="global"&&n==="configure")z(e);else if(t==="global"&&n==="list")ue(e);else if(t==="global"&&n==="uninstall")he(e);else if(t==="project"&&(n==="init"||n==="sync"))be(e);else if(t==="project"&&n==="status")ye(e);else if(t==="project"&&n==="mark-applied")ve(e);else if(t==="version"&&n==="check")xe();else throw new Error(`Unknown command: ${e.positionals.join(" ")}`)}if(process.argv[1]&&$e(lo(process.argv[1]))===$e(co(import.meta.url)))try{Y()}catch(o){console.error(`error: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1}export{Y as main};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamdevlinph/codex-kit",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Portable Codex subagents and project AGENTS.md defaults.",
5
5
  "type": "module",
6
6
  "bin": {