Add prose write run option#90
Conversation
I prefer This feels like a big architectural leap/decision:
The problem with this is that now My expectation would be that I think one of the tenets we should specify somewhere (if not) that has been an internal guide for me is that Open to more discussion/pushback if I'm missing something here. But if we had CLI-level logic, I'd want a sharper delineation, rather than burying it in a single command option (which looks like all the other options). |
|
Update after another implementation/audit pass:
|
|
Applied the low-risk polish from the surrogate review in
Focused tests, typecheck, build, and |
Summary
prose write --out <path>so shell users can ask the authoring path to write generated source into an explicit repository-relative target.--applyfor write-only authoring and--runfor write-then-run authoring.prose write "..."unchanged: source-package-only, no filesystem writes.--runas a host-adapter macro: the CLI invokes authoring with apply permission, then starts an ordinaryprose run <generated-root>only if authoring succeeds.std/ops/prose-authornon-operational for follow-up execution throughpost_apply_action: host-will-run-root; it must not run, simulate, publish receipts, or perform optional memory/giving-back side effects.workspace-writewhen no sandbox mode is configured, while preserving explicit caller sandbox settings.Use Case / Run Evidence
The motivating workflow was:
prose write "a vulnerability detection system that uses lessons from https://blog.cloudflare.com/cyber-frontier-models/"That produced a useful source package in terminal output, but the user then had to copy/paste it into files before running it. The desired shell workflow is:
prose write --out src/vulnerability-detection --run "a vulnerability detection system that uses lessons from https://blog.cloudflare.com/cyber-frontier-models/"The branch was tested against that exact example in tmux with the real Codex harness. The live proof wrote the requested package under
src/vulnerability-detectionin scratch, using the repo copy ofskills/open-proseand a process-local Node 22 path.Important result: the live proof is not yet a green end-to-end demo. The authoring phase recovered from intermediate validation-command failures and wrote valid files, but the Codex harness still exited nonzero (
exit=2), so the host-adapter follow-upprose run <generated-root>did not start. Earlier attempts also exposed local-environment issues: the ambient Bunnodeshim and the globally installedopen-proseskill (0.13.1) can change the live proof behavior. Those artifacts are intentionally uncommitted.Design Boundary
The split is:
std/ops/prose-author: owns the authoring contract, lint/repair loop, and filesystem-write permission semantics.prose run/ VM semantics own execution of the generated root.prose write --runis not pushed intoprose-author. The CLI is one host adapter that supports the macro by forwarding two top-level operations. Hosts that cannot do that must rejectprose write --runbefore authoring and must not pass the macro intoprose-author.The chaining/pattern material reinforces this boundary: runtime chaining belongs to VM/Forme/ProseScript execution, not source authoring. That points the future
--test-iterationswork toward a bounded host macro as well: write/apply, ordinaryprose test, repair authoring pass, repeat.Review Follow-ups
Addressed from independent review and design discussion:
.prose.mdoutput targets likesrc/foo.txtinstead of silently treating them as folders.--outpath checks are CLI validation plus an authoring-contract boundary, not a hard filesystem sandbox.--runimplies apply permission.run_after_write: host-managedprompt semantics with non-operationalpost_apply_action: host-will-run-root.Examples
Package-only, unchanged:
prose write "draft a release readiness responsibility"Write files but do not run:
prose write --out src/release-readiness --apply "draft a release readiness responsibility"Write files and immediately run the generated root:
prose write --out src/release-readiness --run "draft a release readiness responsibility"Testing
Passed locally on
757379a:pnpm --filter @openprose/prose-cli test -- tests/prose/prose-author-contract.test.ts tests/skills/open-prose.test.ts tests/prose/command-model.test.ts tests/cli/cli.test.ts pnpm --filter @openprose/prose-cli build pnpm --filter @openprose/prose-cli typecheck git diff --checkSafe-push security review approved the branch diff and pushed
feature/prose-write-run.GitHub Actions are green on commit
757379a: Node 20/22 checks, release tarball smoke, npm package smoke, CodeQL, dependency audit, plugin manifest validation, codex/claude SDK smoke, and the OpenProse smoke matrix all pass.Known issue observed during broader local preflight:
pnpm --filter @openprose/prose-cli testfailed locally in
tests/prose/crash-window-replay.test.tswith a timeout. The branch does not modify that test or the serve/crash-window replay path; this remains a disclosed residual outside this feature.Residual Risk / Follow-ups
--test-iterationsbranch has started in.scratch/worktrees/prose-write-test-iterations-v2and should reuse this host-adapter boundary.