@iamdevlinph/codex-kit 1.0.25 → 1.1.1

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
@@ -1,258 +1,162 @@
1
1
  # `@iamdevlinph/codex-kit`
2
2
 
3
- Portable Codex setup for new devices and multiple projects. It provides:
3
+ Portable Codex subagents, automatic task routing, and reusable project guidance.
4
4
 
5
- - three automatically routed roles plus a manual quick implementer
6
- - automatic global role routing
7
- - a reusable, stack-neutral `AGENTS.md` template
8
- - a package-owned `codex-kit-reconcile-agents` skill for semantic reconciliation
9
- - safe commands for global setup, project synchronization, and reconciliation
5
+ - Routes work automatically while keeping small tasks with the root agent.
6
+ - Includes four subagents for exploration, implementation, review, and quick edits.
7
+ - Provides a stack-neutral `AGENTS.md` starting point.
8
+ - Reconciles template updates semantically instead of replacing project guidance.
9
+ - Preserves user-owned configuration and modified managed files.
10
+ - Runs as a dependency-free Node.js CLI.
10
11
 
11
- The package contains no credentials. Global installation configures the Codex
12
- root orchestrator to `gpt-5.6-sol` with low normal reasoning and high Plan-mode
13
- reasoning. Use the separate configuration command to override these defaults.
12
+ ## Quick start
14
13
 
15
- ## Install on a device
14
+ 1. Install the CLI and global Codex assets:
16
15
 
17
- No npm or GitHub login is required. For regular use, install the CLI globally:
16
+ ```sh
17
+ pnpm add --global @iamdevlinph/codex-kit@latest
18
+ codex-kit global install
19
+ ```
18
20
 
19
- ```sh
20
- pnpm add --global @iamdevlinph/codex-kit@latest
21
- codex-kit global install
22
- ```
23
-
24
- Start a new Codex task or restart the client after installation. Codex may ask
25
- you to review and trust the new command hooks once; approve them after confirming
26
- that they run the installed `${CODEX_HOME:-~/.codex}/codex-kit/routing-hook.js`.
27
-
28
- `npm install --global @iamdevlinph/codex-kit@latest` works as an alternative.
29
- For one-off use without a global installation, prefix a command with
30
- `pnpm dlx @iamdevlinph/codex-kit@latest`.
31
-
32
- `global install` copies reusable agents and the
33
- `skills/codex-kit-reconcile-agents` skill to `${CODEX_HOME:-~/.codex}`, maintains
34
- the package routing section in global `AGENTS.md`, and adds package-owned
35
- handlers to `hooks.json` without replacing existing hooks. `global list` shows
36
- the reconciliation skill's ownership status. Install and uninstall preserve
37
- modified or user-owned skill files using the same backup/restore semantics as
38
- other package files.
39
-
40
- The Sol root plans, routes, coordinates, and validates. On every prompt, the
41
- routing hook supplies the current `SUBAGENT_ROUTING.md`; the root classifies the
42
- task and delegates substantive work to the exact matching role. The role's agent
43
- TOML—not the routing policy—selects its model and reasoning effort. To avoid
44
- subagent startup overhead, the root may directly handle planning, conversation,
45
- read-only checks, documentation, bookkeeping, and clear changes spanning up to
46
- roughly three files. Automatic delegation is reserved for broad discovery,
47
- large multi-file implementation or debugging, and high-risk review.
48
-
49
- ## Available subagents
50
-
51
- | Subagent | Routing | Model and effort | Used for |
52
- | --- | --- | --- | --- |
53
- | `code-explorer` | Automatic | `gpt-5.6-terra`, medium | Read-only broad repository discovery, contract tracing, and multi-file searches |
54
- | `implementer` | Automatic | `gpt-5.6-luna`, high | Large behavior changes, non-obvious debugging, migrations, and substantial tests |
55
- | `code-reviewer` | Automatic | `gpt-5.6-sol`, high | Read-only review of security-sensitive, architectural, public-API, concurrency, migration, or difficult-to-validate changes |
56
- | `quick-implementer` | Manual only | `gpt-5.6-luna`, medium | Small, mechanical, well-specified changes limited to one or two files |
21
+ 2. Initialize a project from its root:
57
22
 
58
- The root orchestrator is not a subagent. It owns planning, routing, integration,
59
- and final validation.
23
+ ```sh
24
+ codex-kit project init
25
+ ```
60
26
 
61
- For a substantial task that splits into genuinely independent slices, the root
62
- may run multiple `implementer` instances concurrently. Each receives exclusive
63
- file or module ownership and separate validation scope. Work that shares types,
64
- schemas, configuration, generated artifacts, migrations, lockfiles, or dependency
65
- ordering stays with one implementer or runs sequentially; multiple files alone
66
- do not justify duplicate agents.
67
-
68
- `quick-implementer` remains installed for explicit manual delegation but is not
69
- selected by the default automatic route. The root reuses delegated test evidence
70
- and normally performs only lightweight integration checks.
71
-
72
- `global install` sets these defaults while preserving unrelated settings;
73
- `global configure` can override them:
74
-
75
- ```toml
76
- model = "gpt-5.6-sol"
77
- model_reasoning_effort = "low"
78
- plan_mode_reasoning_effort = "high"
79
- ```
80
-
81
- This balances ordinary orchestration and direct small changes while retaining
82
- high reasoning in Plan Mode. Override either effort independently when needed:
83
-
84
- ```sh
85
- codex-kit global configure \
86
- --reasoning-effort low \
87
- --plan-reasoning-effort high
88
- ```
89
-
90
- Delegation is time-bounded. The root waits once for up to 60 seconds, requests
91
- one progress update, and then enforces a three-minute read/review/manual-quick
92
- deadline or five-minute implementation deadline. Validation commands that make
93
- no progress for two minutes are stopped unless the repository documents a
94
- longer normal runtime. Root and worker never run the same validation
95
- concurrently.
96
-
97
- Before changing these keys, codex-kit creates a timestamped `config.toml`
98
- backup and records their previous values. `global uninstall` restores those
99
- values without replacing unrelated configuration changed afterward.
100
-
101
- Use a different Codex home when needed:
102
-
103
- ```sh
104
- pnpm dlx @iamdevlinph/codex-kit@latest global install \
105
- --codex-home /path/to/.codex
106
- pnpm dlx @iamdevlinph/codex-kit@latest global configure \
107
- --codex-home /path/to/.codex
108
- ```
109
-
110
- Inspect the installed setup:
111
-
112
- ```sh
113
- pnpm dlx @iamdevlinph/codex-kit@latest global list
114
- ```
27
+ Restart Codex after global installation. Codex may ask you to trust the installed
28
+ hook at `${CODEX_HOME:-~/.codex}/codex-kit/routing-hook.js`.
115
29
 
116
- The summary shows the Codex home, orchestrator, normal and Plan-mode reasoning
117
- effort, routing-file and routing-hook status, reconciliation-skill status, and
118
- installed custom agents without dumping unrelated configuration.
30
+ `npm install --global @iamdevlinph/codex-kit@latest` is also supported. For
31
+ one-off use, prefix commands with `pnpm dlx @iamdevlinph/codex-kit@latest`.
119
32
 
120
- Uninstall package-managed global files:
33
+ ## Included subagents
121
34
 
122
- ```sh
123
- pnpm dlx @iamdevlinph/codex-kit@latest global uninstall
124
- ```
35
+ | Subagent | Routing | Model and effort | Purpose |
36
+ | --- | --- | --- | --- |
37
+ | `code-explorer` | Automatic | `gpt-5.6-terra`, medium | Broad read-only discovery and contract tracing |
38
+ | `implementer` | Automatic | `gpt-5.6-luna`, high | Large changes, debugging, migrations, and substantial tests |
39
+ | `code-reviewer` | Automatic | `gpt-5.6-sol`, high | Feature structure and high-risk review |
40
+ | `quick-implementer` | Manual | `gpt-5.6-luna`, medium | Small mechanical changes in one or two files |
125
41
 
126
- Uninstall removes only codex-kit's handlers from `hooks.json` and preserves other
127
- hooks. Modified managed files are preserved unless `--force` is supplied.
42
+ The root orchestrator plans, routes, integrates, and validates. It handles clear
43
+ small changes directly and delegates broader discovery, implementation, or review
44
+ according to the installed `SUBAGENT_ROUTING.md` policy.
128
45
 
129
46
  ## Commands
130
47
 
131
48
  | Action | Command |
132
49
  | --- | --- |
133
- | Show command help | `codex-kit -h` or `codex-kit --help` |
134
- | Print the installed version | `codex-kit -v` or `codex-kit --version` |
135
- | Install global agents and routing | `codex-kit global install` |
136
- | Configure the orchestrator | `codex-kit global configure` |
137
- | Inspect global configuration | `codex-kit global list` |
50
+ | Show help | `codex-kit -h` or `codex-kit --help` |
51
+ | Print version | `codex-kit -v` or `codex-kit --version` |
52
+ | Install or update global assets | `codex-kit global install` |
53
+ | Configure model defaults | `codex-kit global configure` |
54
+ | Inspect global setup | `codex-kit global list` |
138
55
  | Remove package-managed global files | `codex-kit global uninstall` |
139
56
  | Initialize project guidance | `codex-kit project init` |
140
- | Refresh the project template reference | `codex-kit project sync` |
141
- | Check template reconciliation | `codex-kit project status` |
57
+ | Refresh the project template | `codex-kit project sync` |
58
+ | Check reconciliation status | `codex-kit project status` |
142
59
  | Record completed reconciliation | `codex-kit project mark-applied` |
143
60
  | Check for a package update | `codex-kit version check` |
144
61
 
145
- ## Apply to a project
62
+ Use `codex-kit --help` for exhaustive command details.
146
63
 
147
- ### First-time setup
64
+ ## Device setup
148
65
 
149
- For a new blank project, scaffold its initial stack first. Then initialize
150
- codex-kit once from the project root:
66
+ `global install` copies the agents, routing assets, hooks, and
67
+ `codex-kit-reconcile-agents` skill into `${CODEX_HOME:-~/.codex}`. It adds only
68
+ codex-kit's hook handlers and preserves unrelated settings and hooks.
151
69
 
152
- ```sh
153
- cd /path/to/project
154
- pnpm dlx @iamdevlinph/codex-kit@latest project init
70
+ The default root configuration is:
71
+
72
+ ```toml
73
+ model = "gpt-5.6-sol"
74
+ model_reasoning_effort = "low"
75
+ plan_mode_reasoning_effort = "high"
155
76
  ```
156
77
 
157
- `project init` performs the initial template sync, so do not run `project sync`
158
- immediately afterward. It creates or updates:
78
+ Override it explicitly when needed:
159
79
 
160
- - `AGENTS.md`, only when missing; an existing file is preserved
161
- - `TEMPLATE_AGENTS.md`, a local reference copy used for future comparisons
162
- - `.codex-kit-state.json`, reconciliation bookkeeping
80
+ ```sh
81
+ codex-kit global configure \
82
+ --orchestrator gpt-5.6-sol \
83
+ --reasoning-effort low \
84
+ --plan-reasoning-effort high
85
+ ```
163
86
 
164
- If `AGENTS.md` is missing or still contains only the untouched codex-kit
165
- scaffold, the CLI prints a clearly marked initialization prompt. Copy everything
166
- between `BEGIN CODEX INITIALIZATION PROMPT` and
167
- `END CODEX INITIALIZATION PROMPT` into a Codex task opened at the project root.
168
- The prompt asks Codex to verify that the project has enough substantive code,
169
- dependencies, configuration, and scripts to derive reliable guidance. If not,
170
- Codex stops without inventing rules or marking the template applied. Finish
171
- scaffolding the project, rerun `project init`, and send the new CLI prompt.
87
+ `--model` is an alias for `--orchestrator`. Before changing managed values,
88
+ codex-kit creates a timestamped `config.toml` backup and records the previous
89
+ values. `global uninstall` restores them without replacing unrelated later edits.
90
+ Modified managed files are preserved.
172
91
 
173
- When `AGENTS.md` already contains guidance, `project init` preserves it and
174
- prints the reconciliation prompt described below instead.
92
+ Use `codex-kit global list` to inspect model settings, routing and hook status,
93
+ the reconciliation skill, and installed agents. Use `codex-kit global uninstall`
94
+ to remove package-managed global files.
175
95
 
176
- ## Synchronize template updates
96
+ ## Project workflow
177
97
 
178
- After a newer codex-kit template is released, refresh an initialized project:
98
+ Run `codex-kit project init` after the project has enough code, dependencies,
99
+ configuration, and scripts for Codex to derive reliable guidance. It creates:
179
100
 
180
- ```sh
181
- pnpm dlx @iamdevlinph/codex-kit@latest project sync
182
- ```
101
+ - `AGENTS.md` only when missing; existing guidance is preserved;
102
+ - `TEMPLATE_AGENTS.md` as the local template reference;
103
+ - `.codex-kit-state.json` for reconciliation bookkeeping.
183
104
 
184
- `project sync` never edits `AGENTS.md` or project skills. It routes Codex to the
185
- global `codex-kit-reconcile-agents` skill, which inspects project state and
186
- existing skills, merges only applicable reusable changes, preserves local
187
- adaptations and organization, and may create or update a concrete conditional
188
- workflow under `.agents/skills`. Critical safety, authorization, secrets,
189
- database, deployment, and destructive-operation rules remain in `AGENTS.md`;
190
- do not copy the complete template or introduce managed markers. After semantic
191
- reconciliation and validation, record the applied template hash:
105
+ Initialization includes the first template sync. When the CLI prints an
106
+ initialization or reconciliation prompt, copy the complete marked block into a
107
+ Codex task opened at the project root.
192
108
 
193
- The CLI prints a clearly marked reconciliation prompt. Copy everything between
194
- `BEGIN CODEX RECONCILIATION PROMPT` and `END CODEX RECONCILIATION PROMPT` into a
195
- Codex task opened at the project root. That prompt tells Codex to validate and
196
- then run:
109
+ After installing a newer package version, refresh the reference template:
197
110
 
198
111
  ```sh
199
- codex-kit project mark-applied
112
+ codex-kit project sync
200
113
  ```
201
114
 
202
- You normally do not run that command manually.
203
-
204
- `mark-applied` updates only `.codex-kit-state.json`; it does not validate or
205
- modify `AGENTS.md`.
115
+ `project sync` never edits `AGENTS.md` or project skills. The reconciliation skill
116
+ compares the refreshed template with the project's guidance and merges only
117
+ applicable rules while preserving local organization and adaptations. If
118
+ `TEMPLATE_AGENTS.md` was modified locally, sync preserves it for review instead
119
+ of overwriting it.
206
120
 
207
- If `TEMPLATE_AGENTS.md` was modified locally, synchronization preserves it and
208
- asks for review instead of overwriting it. Use `--force` only after intentionally
209
- discarding the local candidate changes.
210
-
211
- ### Synchronize multiple projects
212
-
213
- Install the CLI once and keep a local path list:
121
+ After reconciliation and validation, Codex runs:
214
122
 
215
123
  ```sh
216
- pnpm add --global @iamdevlinph/codex-kit
217
-
218
- while IFS= read -r repo; do
219
- [ -n "$repo" ] && codex-kit project sync --cwd "$repo"
220
- done < ~/.config/codex-kit/projects.txt
124
+ codex-kit project mark-applied
221
125
  ```
222
126
 
223
- Update global agents and routing separately when those assets change:
127
+ `mark-applied` only updates `.codex-kit-state.json`; it does not validate or
128
+ modify `AGENTS.md`. Use `codex-kit project status` to check whether the current
129
+ template still needs reconciliation.
224
130
 
225
- ```sh
226
- pnpm add --global @iamdevlinph/codex-kit@latest
227
- codex-kit global install
228
- ```
131
+ ## Options
132
+
133
+ - `--codex-home PATH` selects a Codex home for global commands instead of
134
+ `CODEX_HOME` or `~/.codex`.
135
+ - `--cwd PATH` selects a project directory for project commands instead of the
136
+ current directory.
137
+ - `--force` lets `global install`, `global configure`, `project init`, or
138
+ `project sync` replace modified files they manage. Use it only when you intend
139
+ to discard those local changes.
229
140
 
230
- ## Check for a new version
141
+ Examples:
231
142
 
232
143
  ```sh
233
- codex-kit version check
144
+ codex-kit global install --codex-home /path/to/.codex
145
+ codex-kit project sync --cwd /path/to/project
234
146
  ```
235
147
 
236
- The command queries the public npm registry only when requested. Normal project
237
- commands do not add network latency or depend on registry availability.
238
-
239
148
  ## Requirements
240
149
 
241
150
  - Node.js 20 or newer
242
151
  - Codex with custom subagent and lifecycle-hook support
243
152
 
244
- The published package has no runtime dependencies and uses only Node.js
245
- standard-library modules.
246
-
247
- ## License
248
-
249
- This repository and the published `@iamdevlinph/codex-kit` package are licensed
250
- under the [ISC License](LICENSE).
153
+ The published package contains no credentials or runtime dependencies. Version
154
+ checks contact the public npm registry only when `codex-kit version check` runs.
251
155
 
252
- ## Security
156
+ ## Security and license
253
157
 
254
158
  See [SECURITY.md](SECURITY.md) for supported versions and private vulnerability
255
- reporting instructions.
159
+ reporting. This repository and package use the [ISC License](LICENSE).
256
160
 
257
161
  ## References
258
162
 
@@ -12,6 +12,39 @@ roughly three files when no broad discovery or architectural decision is needed.
12
12
  When a substantive route below matches, spawn that exact role before performing
13
13
  the role's work. The user does not need to request delegation.
14
14
 
15
+ For user-facing work, the root or assigned worker performs a UI/style preflight
16
+ before editing: inspect the closest same-purpose shipped features (especially
17
+ tables, filters, search, forms, dialogs, and page layouts), identify their
18
+ design-system primitives, tokens, spacing, typography, responsive behavior,
19
+ interactions, states, and accessibility conventions, then reuse applicable
20
+ components and patterns. If no written standard exists but trustworthy repeated
21
+ precedent does, derive concise project-local guidance in `AGENTS.md` for
22
+ always-on conventions and `PLANS.md` for feature-specific decisions or approved
23
+ exceptions. Pause and ask the user whether to keep, update, or override before
24
+ deliberate divergence, changing an established guideline, resolving conflicting
25
+ precedents, or proceeding without a trustworthy analogue. If browser or
26
+ screenshot tooling exists, compare the rendered feature with its analogue;
27
+ otherwise report rendered comparison unavailable.
28
+
29
+ Every new or materially changed feature follows this mandatory workflow:
30
+ UI/style preflight; implement and stabilize; map each responsibility to its final file; extract
31
+ independently understandable concerns; validate the decomposed implementation;
32
+ then hand off to `code-reviewer`. Pages, routes, controllers, commands, and
33
+ entrypoints contain composition and orchestration only. Web page files may keep
34
+ framework exports, metadata, loading, guards, page-level state, minimal layout
35
+ wrappers, and imported child composition, but not child components, substantial
36
+ UI sections, or domain logic. Independently changeable UI concerns (tables,
37
+ filters, forms, dialogs, and sections) receive descriptive feature-local files.
38
+ Hooks, schemas, data access, transformations, and domain logic move out of
39
+ presentation files when independently testable or when they obscure the primary
40
+ responsibility. Avoid generic `utils`, `helpers`, or `components` dumping grounds;
41
+ filenames identify owned behavior. Keep components feature-local by default;
42
+ promote them only when reused across features or explicitly global primitives.
43
+ Tiny private helpers or markup may remain inline only when inseparable from the
44
+ file's single responsibility. Do not broaden unrelated small fixes. Every
45
+ completed feature receives automatic structural review; a framework or tooling
46
+ constraint is the only exception and must be named in the handoff.
47
+
15
48
  Select custom agents by exact name:
16
49
 
17
50
  - Broad repository discovery, contract tracing, or search across many files:
@@ -22,12 +55,14 @@ Select custom agents by exact name:
22
55
  - Independent review of security-sensitive, architectural, public-API,
23
56
  concurrency, migration, or otherwise difficult-to-validate changes:
24
57
  `code-reviewer`
58
+ - Every completed feature, including small features, receives structural review:
59
+ `code-reviewer`
25
60
 
26
61
  For tasks with multiple phases, sequence only the roles that add value. For
27
62
  example, use `code-explorer` before implementation only when broad discovery is
28
- actually needed, and use `code-reviewer` after implementation only when the
29
- change meets its risk threshold. Avoid parallel write-heavy work by default and
30
- never assign overlapping files to multiple agents.
63
+ actually needed. Use `code-reviewer` after every completed feature and for any
64
+ other change meeting its risk threshold. Avoid parallel write-heavy work by
65
+ default and never assign overlapping files to multiple agents.
31
66
 
32
67
  Multiple `implementer` instances may run concurrently only when a substantial
33
68
  task divides into genuinely independent slices. Give each instance exclusive
@@ -104,6 +104,22 @@ conditional procedures into validated project skills.
104
104
  Do not assume tools from other projects.
105
105
  - Keep discovered stack-specific guidance in the project's
106
106
  `# Project-Specific Instructions`, not in this shared template.
107
+ - For user-facing work, perform a UI/style preflight before editing: inspect the
108
+ closest same-purpose shipped features (especially tables, filters, search,
109
+ forms, dialogs, and page layouts) and identify their design-system primitives,
110
+ tokens, spacing, typography, responsive behavior, interactions, states, and
111
+ accessibility conventions. Reuse applicable components and patterns.
112
+ - If no written standard exists but trustworthy repeated precedent does, derive
113
+ concise durable guidance in the project: always-on conventions belong in
114
+ `AGENTS.md`; feature-specific decisions and approved exceptions belong in
115
+ `PLANS.md`. During development, keep new UI aligned with that standard.
116
+ - Pause and ask the user whether to keep, update, or override the standard
117
+ before deliberate visual divergence, changing an established guideline,
118
+ resolving conflicting precedents, or proceeding without a trustworthy
119
+ analogue. Include the evidence and affected pattern in the question.
120
+ - If browser or screenshot tooling exists, compare the rendered feature with
121
+ the analogue across relevant responsive sizes and states. Otherwise, report
122
+ that rendered comparison was unavailable.
107
123
 
108
124
  ## Commands And Verification
109
125
 
@@ -113,6 +129,10 @@ conditional procedures into validated project skills.
113
129
  - For behavior changes and bug fixes, add or update the smallest focused
114
130
  automated tests that meaningfully prevent regression when the repository has
115
131
  an established test setup.
132
+ - Treat existing tests as regression contracts. Preserve their assertions unless
133
+ the requested behavior intentionally changes. When behavior changes, update
134
+ only the affected tests and add coverage for the new contract; never weaken or
135
+ delete tests merely to make the suite pass.
116
136
  - Do not introduce a test framework or create low-value tests solely to satisfy
117
137
  this rule. If automated coverage is impractical, explain why and perform the
118
138
  strongest targeted verification available.
@@ -129,12 +149,26 @@ conditional procedures into validated project skills.
129
149
  code under the feature's existing directory; when a feature contains multiple
130
150
  substantial UI pieces, place them in a `<feature>/components` subdirectory.
131
151
  Keep broadly reused code in the repository's established shared locations.
132
- - Keep route and page files focused on page-level composition, data loading, and
133
- orchestration. Extract substantial self-contained UI sections and complex
134
- page-specific logic into focused files colocated with the feature. Split large
135
- or mixed-responsibility files by cohesive behavior so each file remains easy
136
- to read, navigate, test, and review. Keep small one-use markup or logic inline;
137
- do not create files or components solely to reduce line count.
152
+ - Complete every new or materially changed feature through a semantic pass:
153
+ implement and stabilize it, map each responsibility to its final file, extract
154
+ independently understandable concerns, validate the decomposed implementation,
155
+ then hand it off to `code-reviewer`. Pages, routes, controllers, commands, and
156
+ entrypoints contain composition and orchestration only. Web page files may keep
157
+ framework exports, metadata, loading, guards, page-level state, minimal layout
158
+ wrappers, and imported child composition, but not child components, substantial
159
+ UI sections, or domain logic. Independently changeable UI concerns (tables,
160
+ filters, forms, dialogs, and sections) belong in descriptive feature-local
161
+ component files. Hooks, schemas, data access, transformations, and domain logic
162
+ move out of presentation files when independently testable or when they obscure
163
+ the component's primary responsibility. Avoid generic `utils`, `helpers`, or
164
+ `components` dumping grounds; filenames must identify owned behavior. Keep
165
+ components feature-local by default; promote them to shared/design-system
166
+ locations only when reused across features or explicitly global primitives.
167
+ Tiny private helpers or markup may remain inline only when inseparable from the
168
+ file's single responsibility. Do not broaden an unrelated small fix, but leave
169
+ any new or materially changed feature decomposed. Every completed feature gets
170
+ an automatic `code-reviewer` structure review; exceptions require a concrete
171
+ framework or tooling constraint identified in the handoff.
138
172
  - Use intent-revealing domain names. A reader should understand what a variable
139
173
  contains or what a helper guarantees at the call site without opening its
140
174
  implementation. Avoid vague transformation names such as `normalized`,
@@ -14,7 +14,8 @@ You locate and distill the code relevant to a task so the orchestrator never has
14
14
  1. Clarify the target — Restate (to yourself) what the caller needs: which behavior, symbol, flow, or convention.
15
15
  2. Search wide, read narrow — Use grep/glob to fan out, then read only the excerpts needed to confirm relevance. Prefer reading specific line ranges over whole files.
16
16
  3. Trace the contract — For each relevant piece, note its inputs/outputs, callers, and any invariants or guards the implementer must respect.
17
- 4. ReportReturn the structured report below. Nothing else.
17
+ 4. UI/style preflight For user-facing work, locate the closest same-purpose shipped UI and report its reusable components, design tokens, layout, responsive behavior, interaction/state, and accessibility conventions. Flag conflicting or missing precedents; do not invent a standard.
18
+ 5. Report — Return the structured report below. Nothing else.
18
19
 
19
20
  ## Report format (strict)
20
21
  - Conclusion — one paragraph answering the caller's question directly.
@@ -29,4 +30,5 @@ You locate and distill the code relevant to a task so the orchestrator never has
29
30
  - No raw dumps: never paste whole files or long grep output into your report — that defeats the purpose of delegating exploration.
30
31
  - If you find nothing, say so plainly and list where you looked.
31
32
  - Don't speculate about code you didn't read; mark inferences as inferences.
33
+ - If no trustworthy analogue exists, say so so the root can ask the user whether to establish a new standard.
32
34
  """
@@ -16,6 +16,27 @@ review for correctness, regressions, security, reliability, missing tests, and
16
16
  architecture risks. Report only actionable findings, ordered P0 Critical through
17
17
  P3 Low, with precise file and line references.
18
18
 
19
+ Every completed feature receives this structural review, regardless of file
20
+ length. Enforce responsibility boundaries: return `REQUEST_CHANGES` when the
21
+ final feature diff implements child UI inside a page or route file, mixes
22
+ independently changeable responsibilities in one file, hides substantial logic
23
+ inside presentation or entrypoint files, creates a generic file whose purpose is
24
+ not clear from its name, puts feature-specific behavior in shared components, or
25
+ duplicates genuinely shared behavior. Accept tiny private helpers/markup only
26
+ when inseparable from a file's single responsibility. Allow an exception only
27
+ for a concrete framework or tooling constraint explicitly identified in the
28
+ handoff; otherwise end with `REQUEST_CHANGES` for violations.
29
+
30
+ For user-facing changes, review consistency against the closest same-purpose
31
+ shipped UI and applicable written `AGENTS.md`/`PLANS.md` guidance. Check reuse of
32
+ existing components, tokens, layout, responsive behavior, interactions, states,
33
+ and accessibility conventions. On repository evidence, return
34
+ `REQUEST_CHANGES` for unexplained visual divergence or needless duplication of
35
+ an applicable pattern. Do not demand a style choice unsupported by that
36
+ evidence. Accept a deliberate exception only when the handoff records the
37
+ user's keep/update/override decision; note unavailable rendered comparison
38
+ without treating it as a failure.
39
+
19
40
  ## Rules
20
41
  - Keep it lean: surface the few high-confidence, high-impact findings rather than an exhaustive nitpick list. Rank by severity.
21
42
  - Finish within three minutes. At the deadline, stop and return the findings already supported by the diff.
@@ -11,10 +11,12 @@ You write the actual code, its unit tests, and you run those tests to prove the
11
11
 
12
12
  ## Workflow
13
13
  1. Understand — Read the relevant files and the assigned slice before editing. Don't guess at contracts.
14
- 2. ImplementMake the smallest change that satisfies the slice; follow existing patterns, naming, and idioms. Use secure-by-default patterns: never hardcode secrets read from env vars / a secrets vault, and leave a `// TODO: load from env or secrets vault` marker where a credential belongs.
15
- 3. Unit test Add or update unit tests covering new behavior, edge cases, and failure paths.
16
- 4. ValidateRun the unit tests (and linters/build if quick). Paste the actual result. If tests fail, fix and re-run — never report success on red.
17
- 5. Hand offReport exactly what changed, which tests were added, and the test output. State plainly if anything is unverified.
14
+ 2. UI/style preflight Before editing user-facing code, inspect the closest same-purpose shipped features (especially tables, filters, search, forms, dialogs, and page layouts), then record the applicable components, tokens, layout, responsive behavior, interactions, states, and accessibility conventions. Reuse them. If no written standard exists but trustworthy repeated precedent does, derive concise always-on guidance in `AGENTS.md` and feature-specific decisions or exceptions in `PLANS.md`. Pause and ask the user whether to keep, update, or override before divergence, changing a guideline, resolving conflicts, or proceeding without a trustworthy analogue. Use browser or screenshot tooling for rendered comparison when available; otherwise report unavailable.
15
+ 3. ImplementMake the smallest change that satisfies the slice; follow the discovered UI and code patterns, naming, and idioms. Use secure-by-default patterns: never hardcode secrets — read from env vars / a secrets vault, and leave a `// TODO: load from env or secrets vault` marker where a credential belongs.
16
+ 4. Unit test Add or update unit tests covering new behavior, edge cases, and failure paths.
17
+ 5. Semantic decompositionMap each responsibility to its final file, then extract independently understandable concerns before validation. Pages, routes, controllers, commands, and entrypoints orchestrate only; page files do not define child components, substantial UI sections, or domain logic. Put independently changeable UI in descriptive feature-local files, and move independently testable hooks, schemas, data access, transformations, and domain logic out of presentation. Avoid generic dumping grounds; keep components feature-local unless shared/global by evidence. Tiny inseparable helpers or markup may remain inline. An unrelated small fix need not trigger broad refactoring. Name any concrete framework/tooling exception in the handoff.
18
+ 6. Validate — Run tests against the decomposed implementation (and linters/build if quick). Paste the actual result. If tests fail, fix and re-run — never report success on red.
19
+ 7. Hand off — Send every completed feature to `code-reviewer` for structural and UI consistency review. Report the responsibility map, extracted files, applicable precedent/standard, tests, rendered comparison or its unavailability, and output. State plainly if anything is unverified.
18
20
 
19
21
  ## Rules
20
22
  - No change is done until its tests are green and you've shown the output.
@@ -15,10 +15,12 @@ Proceed only when the requested change is well specified, localized to one or tw
15
15
 
16
16
  ## Workflow
17
17
  1. Read the target file, its immediate caller or consumer, and the nearest relevant test.
18
- 2. Make the smallest in-scope edit. Preserve unrelated user changes.
19
- 3. Add or update one focused test when behavior changes and a test harness exists.
20
- 4. Run the narrowest relevant test, formatter, or config validation.
21
- 5. Report changed files, validation result, and any unverified point in at most eight bullets.
18
+ 2. UI/style preflight — Before editing user-facing code, inspect the closest same-purpose shipped UI and reuse its components, tokens, layout, responsive behavior, interactions, states, and accessibility conventions. If no written standard exists but trustworthy repeated precedent does, record always-on guidance in `AGENTS.md` and feature-specific decisions or exceptions in `PLANS.md`. Pause and ask the user whether to keep, update, or override before divergence, changing a guideline, resolving conflicts, or proceeding without a trustworthy analogue. Use browser or screenshot comparison when available; otherwise report unavailable. Escalate visual-direction work beyond this role's scope to `implementer`.
19
+ 3. Make the smallest in-scope edit. Preserve unrelated user changes.
20
+ 4. Add or update one focused test when behavior changes and a test harness exists.
21
+ 5. Semantic decomposition — Map responsibilities to final files and extract independently understandable concerns before validation. Pages, routes, controllers, commands, and entrypoints orchestrate only; child UI, substantial sections, and domain logic belong in descriptive feature-local files. Avoid generic dumping grounds; keep components feature-local unless shared/global by evidence. Tiny inseparable helpers or markup may remain inline. Name any concrete framework/tooling exception.
22
+ 6. Validate the decomposed implementation with the narrowest relevant test, formatter, or config check.
23
+ 7. Hand off — Route every completed feature to `code-reviewer` for structural and UI consistency review. Report changed files, responsibility map, extracted files, applicable precedent/standard, rendered comparison or its unavailability, validation result, and any unverified point in at most eight bullets.
22
24
 
23
25
  ## Rules
24
26
  - Never broaden scope or refactor adjacent code.
package/bin/codex-kit.js CHANGED
@@ -747,18 +747,17 @@ function markApplied(options) {
747
747
  }
748
748
 
749
749
  // src/version.ts
750
- import { spawnSync } from "node:child_process";
751
- function compareVersions(left, right) {
752
- const parse2 = (value) => {
753
- const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(value);
754
- if (!match) throw new Error(`Invalid package version: ${value}`);
755
- return {
756
- numbers: [Number(match[1]), Number(match[2]), Number(match[3])],
757
- prerelease: match[4] ?? null
758
- };
750
+ function parseVersion(value) {
751
+ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(value);
752
+ if (!match) throw new Error(`Invalid package version: ${value}`);
753
+ return {
754
+ numbers: [Number(match[1]), Number(match[2]), Number(match[3])],
755
+ prerelease: match[4] ?? null
759
756
  };
760
- const a = parse2(left);
761
- const b = parse2(right);
757
+ }
758
+ function compareVersions(left, right) {
759
+ const a = parseVersion(left);
760
+ const b = parseVersion(right);
762
761
  for (const [leftNumber, rightNumber] of [
763
762
  [a.numbers[0], b.numbers[0]],
764
763
  [a.numbers[1], b.numbers[1]],
@@ -772,27 +771,35 @@ function compareVersions(left, right) {
772
771
  a.prerelease.localeCompare(b.prerelease, "en", { numeric: true })
773
772
  );
774
773
  }
775
- function checkVersion() {
776
- let latest = process.env.CODEX_KIT_LATEST_VERSION;
777
- if (!latest) {
778
- const result = spawnSync(
779
- process.platform === "win32" ? "pnpm.cmd" : "pnpm",
780
- ["view", PACKAGE.name, "version", "--json", `--registry=${REGISTRY}`],
781
- { encoding: "utf8", timeout: 15e3 }
774
+ async function fetchLatestVersion() {
775
+ const url = `${REGISTRY}/${encodeURIComponent(PACKAGE.name)}/latest`;
776
+ let response;
777
+ try {
778
+ response = await fetch(url, { signal: AbortSignal.timeout(15e3) });
779
+ } catch (error) {
780
+ throw new Error(
781
+ `Unable to check ${REGISTRY}: ${error instanceof Error ? error.message : String(error)}`
782
782
  );
783
- if (result.error)
784
- throw new Error(`Unable to run pnpm: ${result.error.message}`);
785
- if (result.status !== 0)
786
- throw new Error(
787
- `Unable to check ${REGISTRY}: ${result.stderr.trim() || "pnpm view failed"}`
788
- );
789
- try {
790
- const value = JSON.parse(result.stdout);
791
- latest = Array.isArray(value) && typeof value.at(-1) === "string" ? value.at(-1) : typeof value === "string" ? value : void 0;
792
- } catch {
793
- latest = result.stdout.trim();
794
- }
795
783
  }
784
+ if (!response.ok)
785
+ throw new Error(
786
+ `Unable to check ${REGISTRY}: ${response.status} ${response.statusText}`
787
+ );
788
+ let value;
789
+ try {
790
+ value = await response.json();
791
+ } catch {
792
+ throw new Error("Registry returned no package version.");
793
+ }
794
+ if (!value || typeof value !== "object" || Array.isArray(value) || typeof value.version !== "string")
795
+ throw new Error("Registry returned no package version.");
796
+ const latest = value.version;
797
+ parseVersion(latest);
798
+ return latest;
799
+ }
800
+ async function checkVersion() {
801
+ let latest = process.env.CODEX_KIT_LATEST_VERSION;
802
+ if (!latest) latest = await fetchLatestVersion();
796
803
  if (!latest) throw new Error("Registry returned no package version.");
797
804
  console.log(`Installed: ${PACKAGE.version}`);
798
805
  console.log(`Latest: ${latest}`);
@@ -897,7 +904,7 @@ Examples:
897
904
  codex-kit project sync --cwd /path/to/project --force
898
905
  codex-kit project status --cwd /path/to/project`);
899
906
  }
900
- function main(argv = process.argv.slice(2)) {
907
+ async function main(argv = process.argv.slice(2)) {
901
908
  const options = parse(argv);
902
909
  if (options.positionals.includes("--version") || options.positionals.includes("-v")) {
903
910
  console.log(PACKAGE.version);
@@ -919,14 +926,14 @@ function main(argv = process.argv.slice(2)) {
919
926
  else if (scope === "project" && action === "status") projectStatus(options);
920
927
  else if (scope === "project" && action === "mark-applied")
921
928
  markApplied(options);
922
- else if (scope === "version" && action === "check") checkVersion();
929
+ else if (scope === "version" && action === "check") await checkVersion();
923
930
  else throw new Error(`Unknown command: ${options.positionals.join(" ")}`);
924
931
  }
925
932
 
926
933
  // src/codex-kit.ts
927
934
  if (process.argv[1] && realpathSync(resolve3(process.argv[1])) === realpathSync(fileURLToPath2(import.meta.url))) {
928
935
  try {
929
- main();
936
+ await main();
930
937
  } catch (error) {
931
938
  console.error(
932
939
  `error: ${error instanceof Error ? error.message : String(error)}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamdevlinph/codex-kit",
3
- "version": "1.0.25",
3
+ "version": "1.1.1",
4
4
  "description": "Portable Codex subagents and project AGENTS.md defaults.",
5
5
  "type": "module",
6
6
  "bin": {