Skip to content

Commit 5400527

Browse files
committed
fix(cli): default first-run handoff to plain codex
1 parent 10b68bf commit 5400527

7 files changed

Lines changed: 166 additions & 61 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ codex --full-auto
1414

1515
`codex --full-auto` is the recommended default once this wizard is installed: you keep the repo guardrails and hook enforcement, but day-to-day editing and runs stay low-friction. Use plain `codex` instead if you want more manual confirmation.
1616

17-
Bare `npx codex-sdlc-wizard` is the adaptive interactive path. It bootstraps the repo-local guardrails first, then hands off into a live Codex setup session so the unresolved setup questions happen inside Codex instead of inside a shell checklist. `setup --yes` still exists for automation, but it is not the normal human path.
17+
Bare `npx codex-sdlc-wizard` is the adaptive interactive path. It bootstraps the repo-local guardrails first, then hands off into a live plain Codex setup session so the unresolved setup questions happen inside Codex instead of inside a shell checklist. At that first-run handoff prompt, press Enter for plain `codex` or type `full-auto` if you explicitly want `codex --full-auto`. `setup --yes` still exists for automation, but it is not the normal human path.
1818

1919
Generic npm entrypoint examples: `npx codex-sdlc-wizard`, `npx codex-sdlc-wizard check`, and `npx codex-sdlc-wizard update`.
2020

2121
Useful follow-ups after install:
2222

2323
```bash
24-
npx codex-sdlc-wizard@0.7.9 check
25-
npx codex-sdlc-wizard@0.7.9 update
24+
npx codex-sdlc-wizard@0.7.10 check
25+
npx codex-sdlc-wizard@0.7.10 update
2626
```
2727

2828
If you want pinned release examples instead of `@latest`, see [Releases](#releases).
@@ -83,10 +83,10 @@ How to choose:
8383

8484
```bash
8585
# recommended interactive bootstrap path
86-
npx codex-sdlc-wizard@0.7.9 --model-profile maximum
86+
npx codex-sdlc-wizard@0.7.10 --model-profile maximum
8787

8888
# interactive bootstrap with the efficiency-first profile if you already know you want it
89-
npx codex-sdlc-wizard@0.7.9 --model-profile mixed
89+
npx codex-sdlc-wizard@0.7.10 --model-profile mixed
9090

9191
# floating latest release with the same bootstrap recommendation
9292
npx codex-sdlc-wizard@latest --model-profile maximum
@@ -186,7 +186,7 @@ If you are consuming this repo in a real project, prefer a tagged release over `
186186

187187
```bash
188188
# npm / npx pinned to the current release
189-
npx codex-sdlc-wizard@0.7.9
189+
npx codex-sdlc-wizard@0.7.10
190190

191191
# npm / npx floating on the newest published release
192192
npx codex-sdlc-wizard@latest
@@ -196,7 +196,7 @@ npx codex-sdlc-wizard@latest
196196
# so $codex-sdlc-wizard is available inside Codex
197197

198198
# git-based install
199-
git clone --branch v0.7.9 --depth 1 https://github.com/BaseInfinity/codex-sdlc-wizard.git /tmp/codex-sdlc-wizard
199+
git clone --branch v0.7.10 --depth 1 https://github.com/BaseInfinity/codex-sdlc-wizard.git /tmp/codex-sdlc-wizard
200200
```
201201

202202
### Maintainer Release Flow

ROADMAP.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Current State
44

5-
- `codex-sdlc-wizard@0.7.9` and `v0.7.9` are the current release target for the setup/update scope-control stabilization patch
5+
- `codex-sdlc-wizard@0.7.10` and `v0.7.10` are the current release target for the first-run plain-Codex handoff patch
66
- npm trusted publishing is configured and the GitHub release workflow is now proven for real OIDC publish
77
- the repo now ships both a Codex skill package (`SKILL.md`, `agents/openai.yaml`) and the installer/setup adapter (`install.sh`, `setup.sh`)
88
- the npm CLI now defaults to adaptive interactive setup instead of requiring an explicit `setup` subcommand for the main human path
@@ -19,51 +19,52 @@
1919
- setup/update guidance now treats verification as diagnostic for product failures and stops before editing application code or application tests without explicit user consent
2020
- setup/update guidance now tells users to exit and reopen Codex after hook/skill repairs, without rerunning setup/update just for that restart
2121
- install/setup/update now write and repair repo-local `.codex/config.toml` model keys for the selected profile, while preserving unrelated MCP, sandbox, approval, and custom config
22+
- first-run live setup now defaults to plain `codex` after bootstrap and requires an explicit `full-auto` choice to start that setup handoff with `codex --full-auto`
2223
- the repo now ships a consumer bug-report template for install/setup/runtime failures
2324
- the public README now leads with the real `@latest` adaptive setup path and keeps the top section consumer-focused
2425
- benchmark and pilot-rollout ledgers now exist so model/default-use decisions can be measured, not guessed
2526
- release, packaging, npm, skill, setup, adapter, update, and E2E tests are green when the parity merge is complete
2627

2728
## Next Release Cycle
2829

29-
### 0.7.10
30+
### 0.7.11
3031

31-
Purpose: prove the post-`0.7.9` consumer path on real repos and stabilize any reusable wizard bugs without changing the default-use claim early.
32+
Purpose: prove the post-`0.7.10` consumer path on real repos and stabilize any reusable wizard bugs without changing the default-use claim early.
3233

3334
Scope:
34-
- run `0.7.9` on 3-5 pilot repos and log results in `benchmarks/pilot-rollout.csv`
35+
- run `0.7.10` on 3-5 pilot repos and log results in `benchmarks/pilot-rollout.csv`
3536
- cut a stabilization patch only if pilots surface another reusable wizard bug
3637
- keep the default-use recommendation gated on the measurable pilot summary
37-
- keep the separate model experiment running, but do not let it block pilot rollout work
38+
- keep separate model-profile measurement running, but do not let it block pilot rollout work
3839

3940
## Tracker Cleanup
4041

4142
The issue tracker is currently clear.
4243

4344
- open a new issue only when pilot consumption exposes a proven reusable wizard bug
44-
- avoid speculative backlog churn while `0.7.9` is being consumed on real repos
45+
- avoid speculative backlog churn while `0.7.10` is being consumed on real repos
4546

4647
## Remaining Backlog
4748

48-
After `0.7.9`, the main backlog is:
49+
After `0.7.10`, the main backlog is:
4950

5051
- pilot rollout proof for default use on real repos
5152
- any reusable wizard fixes discovered during the pilot set
52-
- model experiment data collection for `mixed` vs `maximum`
53+
- model-profile measurement data collection for `mixed` vs `maximum`
5354
- top-level proof-run parallelization to reduce release-wall-clock time without weakening suite coverage
5455
- later creator-tool research after the active backlog stays under control
5556

5657
## Working Order
5758

58-
1. Prove the default-use gate on 3-5 pilot repos with `0.7.9`
59-
2. Ship `0.7.10` only if pilot rollout surfaces another reusable wizard bug
59+
1. Prove the default-use gate on 3-5 pilot repos with `0.7.10`
60+
2. Ship `0.7.11` only if pilot rollout surfaces another reusable wizard bug
6061
3. Keep creator-tool investigation behind the active backlog
6162

6263
## Default-Use Gate
6364

6465
Before calling this the default Codex SDLC path, prove it on real pilot repos instead of just repo-self-tests.
6566

66-
- run `0.7.9` on 3-5 pilot repos
67+
- run `0.7.10` on 3-5 pilot repos
6768
- require pilot success >= 95% before default use
6869
- allow no more than 1 reusable wizard bug across the pilot set
6970
- track the pilot set in `benchmarks/pilot-rollout.csv`
@@ -75,7 +76,7 @@ After the current backlog is under control, investigate whether Codex's built-in
7576

7677
- evaluate `Skill Creator` as a possible future aid for skill-structure maintenance
7778
- evaluate `Plugin Creator` only as later research, since plugins are not part of the current shipping path
78-
- experiment with `gpt-5.4-mini` for the main working pass while keeping `xhigh` for review or cross-model review, and compare that against simply running the whole slice at `xhigh`
79+
- measure `gpt-5.4-mini` for the main working pass while keeping `xhigh` for review or cross-model review, and compare that against simply running the whole slice at `xhigh`
7980
- if the mixed mode proves out, add an easy toggle between two explicit profiles:
8081
- `mixed`: `gpt-5.4-mini` for the main pass plus `xhigh` review
8182
- `maximum`: `gpt-5.4` / `xhigh` for the whole slice as the "ultimate mode"

SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Use the bundled scripts like this:
1717
1. If the user wants the simplest install, run the bundled `install.sh` from this skill bundle against the current working repo.
1818
2. If the user wants repo-aware setup or regenerated docs, run the bundled `setup.sh --yes` from this skill bundle against the current working repo.
1919
3. Tell the user exactly which path you chose: `install.sh` for baseline enforcement, `setup.sh` for adaptive setup.
20-
4. After installation, tell the user to start a fresh Codex session so hooks and repo docs are loaded cleanly. Recommend `codex --full-auto` as the default start mode once the guardrails are installed, and mention plain `codex` as the manual fallback.
20+
4. After installation, tell the user to start a fresh Codex session so hooks and repo docs are loaded cleanly. Recommend plain `codex` for the first live setup handoff unless the user explicitly chooses `full-auto`; recommend `codex --full-auto` as the default start mode after setup is complete and the guardrails are loaded. Mention plain `codex` as the manual fallback for daily work.
2121
The fresh session should also pick up the repo-scoped `\$sdlc` skill under `.agents/skills`. Repo-scoped skill coverage is still a work in progress; `gdlc` and `rdlc` are planned next.
2222
For setup/update bootstrap work, recommend the `maximum` profile via `--model-profile maximum` as the safer default. For routine work after bootstrap, point users back to the `mixed` profile via `--model-profile mixed` for the better speed / lower latency / lower token path with `xhigh` review.
2323
This repo stays on `maximum`; when maintaining `codex-sdlc-wizard` itself, keep the wizard repo on the stability-first path because the work is unusually meta.

bin/codex-sdlc-wizard.js

Lines changed: 71 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env node
22

33
const { spawnSync } = require("node:child_process");
4+
const fs = require("node:fs");
45
const path = require("node:path");
6+
const readline = require("node:readline/promises");
57

68
const scriptDir = path.resolve(__dirname, "..");
79
const rawArgs = process.argv.slice(2);
@@ -22,7 +24,8 @@ Commands:
2224
update Apply selective updates for missing or drifted managed files
2325
install Advanced escape hatch: run install.sh without adaptive setup
2426
25-
Default behavior: bootstrap the current repo, then hand off into a live Codex setup session.
27+
Default behavior: bootstrap the current repo, then hand off into a live plain Codex setup session.
28+
Type 'full-auto' at the handoff prompt if you want codex --full-auto for first-run setup.
2629
Automation/non-interactive behavior: use setup --yes to stay on the shell path.
2730
Bootstrap/setup recommendation: maximum.
2831
Routine work after bootstrap: mixed.
@@ -140,7 +143,42 @@ function runScript(scriptName, args) {
140143
});
141144
}
142145

143-
function handoffToCodex(modelProfile) {
146+
async function askHandoffMode() {
147+
if (process.env.CODEX_SDLC_HANDOFF_MODE === "full-auto") {
148+
return "full-auto";
149+
}
150+
151+
if (process.env.CODEX_SDLC_HANDOFF_MODE === "plain") {
152+
return "plain";
153+
}
154+
155+
const prompt = [
156+
"",
157+
"First-run Codex handoff defaults to plain codex.",
158+
"Type 'full-auto' to use codex --full-auto instead, or press Enter for plain codex: "
159+
].join("\n");
160+
161+
if (!process.stdin.isTTY) {
162+
process.stdout.write(prompt);
163+
const answer = fs.readFileSync(0, "utf8").split(/\r?\n/, 1)[0].trim().toLowerCase();
164+
process.stdout.write("\n");
165+
return answer === "full-auto" ? "full-auto" : "plain";
166+
}
167+
168+
const rl = readline.createInterface({
169+
input: process.stdin,
170+
output: process.stdout
171+
});
172+
173+
try {
174+
const answer = (await rl.question(prompt)).trim().toLowerCase();
175+
return answer === "full-auto" ? "full-auto" : "plain";
176+
} finally {
177+
rl.close();
178+
}
179+
}
180+
181+
async function handoffToCodex(modelProfile) {
144182
const installArgs = ["--model-profile", modelProfile];
145183
const installResult = runScript("install.sh", installArgs);
146184

@@ -153,10 +191,11 @@ function handoffToCodex(modelProfile) {
153191
process.exit(installResult.status === null ? 1 : installResult.status);
154192
}
155193

156-
process.stdout.write("\nHanding off into Codex for live setup...\n");
194+
const handoffMode = await askHandoffMode();
195+
const modeLabel = handoffMode === "full-auto" ? "codex --full-auto" : "plain codex";
196+
process.stdout.write(`\nHanding off into Codex for live setup using ${modeLabel}...\n`);
157197

158198
const codexArgs = [
159-
"--full-auto",
160199
"-C",
161200
process.cwd(),
162201
"-m",
@@ -166,33 +205,43 @@ function handoffToCodex(modelProfile) {
166205
interactiveSessionPrompt
167206
];
168207

208+
if (handoffMode === "full-auto") {
209+
codexArgs.unshift("--full-auto");
210+
}
211+
169212
const codexResult = spawnCodex(codexArgs, "inherit");
170213

171214
if (codexResult.error) {
172215
process.stderr.write(`${codexResult.error.message}\n`);
173216
process.exit(1);
174217
}
175218

176-
process.exit(codexResult.status === null ? 1 : codexResult.status);
219+
return codexResult.status === null ? 1 : codexResult.status;
177220
}
178221

179-
if (shouldHandoffToCodex()) {
180-
handoffToCodex(getSetupModelProfile(scriptArgs));
181-
}
222+
async function main() {
223+
if (shouldHandoffToCodex()) {
224+
process.exit(await handoffToCodex(getSetupModelProfile(scriptArgs)));
225+
}
182226

183-
const scriptName = command === "setup"
184-
? "setup.sh"
185-
: command === "check"
186-
? "check.sh"
187-
: command === "update"
188-
? "update.sh"
189-
: "install.sh";
190-
const scriptPath = path.join(scriptDir, scriptName);
191-
const result = runScript(scriptName, scriptArgs);
192-
193-
if (result.error) {
194-
process.stderr.write(`${result.error.message}\n`);
195-
process.exit(1);
227+
const scriptName = command === "setup"
228+
? "setup.sh"
229+
: command === "check"
230+
? "check.sh"
231+
: command === "update"
232+
? "update.sh"
233+
: "install.sh";
234+
const result = runScript(scriptName, scriptArgs);
235+
236+
if (result.error) {
237+
process.stderr.write(`${result.error.message}\n`);
238+
process.exit(1);
239+
}
240+
241+
process.exit(result.status === null ? 1 : result.status);
196242
}
197243

198-
process.exit(result.status === null ? 1 : result.status);
244+
main().catch((error) => {
245+
process.stderr.write(`${error.message}\n`);
246+
process.exit(1);
247+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codex-sdlc-wizard",
3-
"version": "0.7.9",
3+
"version": "0.7.10",
44
"description": "Codex SDLC adaptive setup wizard and maintenance CLI for npx distribution",
55
"license": "MIT",
66
"repository": {

tests/test-npm.sh

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,17 @@ test_packed_tarball_scratch_smoke() {
279279
}
280280

281281
test_default_interactive_hands_off_to_codex() {
282-
local ws fakebin fakebin_win codex_home args_file output
282+
local ws fakebin fakebin_win codex_home args_file input_file output
283283
ws=$(mktemp -d "$MKTEMP_DIR/sdlc-npx-target.XXXXXX")
284284
fakebin=$(mktemp -d "$MKTEMP_DIR/sdlc-npx-bin.XXXXXX")
285285
codex_home=$(mktemp -d "$MKTEMP_DIR/sdlc-npx-home.XXXXXX")
286286
args_file="$ws/codex-args.txt"
287+
input_file="$ws/handoff-input.txt"
287288

288289
printf '%s' '{"name":"handoff-smoke","scripts":{"test":"npm test"}}' > "$ws/package.json"
289290
mkdir -p "$ws/tests"
290291
touch "$ws/tests/app.e2e.ts" "$ws/playwright.config.js"
292+
printf '\n' > "$input_file"
291293

292294
cat > "$fakebin/codex.cmd" <<'EOF'
293295
@echo off
@@ -306,29 +308,78 @@ EOF
306308
CODEX_SDLC_DISABLE_REASONING=1 \
307309
FAKE_CODEX_ARGS_FILE="$args_file" \
308310
PATH="$fakebin_win;$PATH" \
309-
node "$REPO_DIR/bin/codex-sdlc-wizard.js" 2>&1
311+
node "$REPO_DIR/bin/codex-sdlc-wizard.js" < "$input_file" 2>&1
310312
) || true
311313

312314
local valid=true
313315
[ -f "$ws/.codex/config.toml" ] || valid=false
314316
[ -f "$ws/.codex/hooks.json" ] || valid=false
315317
[ -f "$ws/.codex-sdlc/model-profile.json" ] || valid=false
316318
[ ! -f "$ws/.codex-sdlc/manifest.json" ] || valid=false
317-
grep -Fq -- '--full-auto' "$args_file" 2>/dev/null || valid=false
319+
grep -Fq -- '--full-auto' "$args_file" 2>/dev/null && valid=false
318320
grep -Fq -- '-C' "$args_file" 2>/dev/null || valid=false
319321
grep -Fq -- '-m' "$args_file" 2>/dev/null || valid=false
320322
grep -Fq 'gpt-5.4' "$args_file" 2>/dev/null || valid=false
321323
grep -Fq 'model_reasoning_effort="xhigh"' "$args_file" 2>/dev/null || valid=false
322324
grep -Fq '$setup-wizard' "$args_file" 2>/dev/null || valid=false
323-
echo "$output" | grep -Fq 'Handing off into Codex for live setup' || valid=false
325+
echo "$output" | grep -Fq 'First-run Codex handoff defaults to plain codex' || valid=false
326+
echo "$output" | grep -Fq 'Handing off into Codex for live setup using plain codex' || valid=false
327+
! echo "$output" | grep -Fq 'Scanning project...' || valid=false
328+
329+
rm -rf "$ws" "$fakebin" "$codex_home"
330+
331+
if [ "$valid" = "true" ]; then
332+
pass "default interactive CLI bootstraps then hands off into plain Codex"
333+
else
334+
fail "default interactive CLI did not hand off into plain Codex correctly"
335+
fi
336+
}
337+
338+
test_full_auto_handoff_choice_is_explicit() {
339+
local ws fakebin fakebin_win codex_home args_file input_file output
340+
ws=$(mktemp -d "$MKTEMP_DIR/sdlc-npx-target.XXXXXX")
341+
fakebin=$(mktemp -d "$MKTEMP_DIR/sdlc-npx-bin.XXXXXX")
342+
codex_home=$(mktemp -d "$MKTEMP_DIR/sdlc-npx-home.XXXXXX")
343+
args_file="$ws/codex-args.txt"
344+
input_file="$ws/handoff-input.txt"
345+
346+
printf '%s' '{"name":"handoff-smoke","scripts":{"test":"npm test"}}' > "$ws/package.json"
347+
mkdir -p "$ws/tests"
348+
touch "$ws/tests/app.e2e.ts" "$ws/playwright.config.js"
349+
printf 'full-auto\n' > "$input_file"
350+
351+
cat > "$fakebin/codex.cmd" <<'EOF'
352+
@echo off
353+
if not "%FAKE_CODEX_ARGS_FILE%"=="" (
354+
>>"%FAKE_CODEX_ARGS_FILE%" echo %*
355+
)
356+
exit /b 0
357+
EOF
358+
359+
fakebin_win=$(cd "$fakebin" && pwd -W 2>/dev/null || printf '%s' "$fakebin")
360+
361+
output=$(
362+
cd "$ws" && \
363+
CODEX_HOME="$codex_home" \
364+
CODEX_SDLC_CODEX_BIN="$fakebin_win\\codex.cmd" \
365+
CODEX_SDLC_DISABLE_REASONING=1 \
366+
FAKE_CODEX_ARGS_FILE="$args_file" \
367+
PATH="$fakebin_win;$PATH" \
368+
node "$REPO_DIR/bin/codex-sdlc-wizard.js" < "$input_file" 2>&1
369+
) || true
370+
371+
local valid=true
372+
grep -Fq -- '--full-auto' "$args_file" 2>/dev/null || valid=false
373+
grep -Fq '$setup-wizard' "$args_file" 2>/dev/null || valid=false
374+
echo "$output" | grep -Fq 'Handing off into Codex for live setup using codex --full-auto' || valid=false
324375
! echo "$output" | grep -Fq 'Scanning project...' || valid=false
325376

326377
rm -rf "$ws" "$fakebin" "$codex_home"
327378

328379
if [ "$valid" = "true" ]; then
329-
pass "default interactive CLI bootstraps then hands off into Codex"
380+
pass "full-auto first-run handoff requires an explicit choice"
330381
else
331-
fail "default interactive CLI did not hand off into Codex correctly"
382+
fail "full-auto first-run handoff was not controlled by the explicit choice"
332383
fi
333384
}
334385

@@ -420,6 +471,7 @@ test_local_npx_installs_into_clean_repo
420471
test_local_npx_setup_honors_model_profile_flag
421472
test_packed_tarball_scratch_smoke
422473
test_default_interactive_hands_off_to_codex
474+
test_full_auto_handoff_choice_is_explicit
423475
test_ci_mode_keeps_shell_setup_path
424476
test_cli_help_documents_bootstrap_profile_policy
425477

0 commit comments

Comments
 (0)