@rig-c/create 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +169 -2
- package/docs/CHECKS.md +1682 -0
- package/docs/COLLECTIONS.md +337 -0
- package/docs/CRAFT.md +277 -0
- package/docs/INTERVIEW.md +886 -0
- package/docs/LESSONS.md +172 -0
- package/docs/PROJECT.md +2657 -0
- package/docs/SOURCE.md +225 -0
- package/package.json +44 -4
- package/src/agent-bounce.ts +27 -0
- package/src/agent-guide.ts +237 -0
- package/src/amend.ts +193 -0
- package/src/applied-review.ts +104 -0
- package/src/ask-coverage.ts +69 -0
- package/src/assemble-answers.ts +53 -0
- package/src/cg-gates.ts +211 -0
- package/src/check-reads.ts +106 -0
- package/src/check.ts +1059 -0
- package/src/checkpoint-evidence-writer.ts +125 -0
- package/src/checkpoint-evidence.ts +152 -0
- package/src/choice-writers.ts +271 -0
- package/src/choices.ts +378 -0
- package/src/cli.ts +371 -0
- package/src/collection-answer.ts +136 -0
- package/src/collection-binding-reader.ts +496 -0
- package/src/collection-binding.ts +478 -0
- package/src/collection.ts +348 -0
- package/src/config-inputs.ts +155 -0
- package/src/config-lost.ts +135 -0
- package/src/correction-writers.ts +207 -0
- package/src/corrections.ts +685 -0
- package/src/diff-classes.ts +219 -0
- package/src/diff-map.ts +248 -0
- package/src/direction-citation.ts +13 -0
- package/src/direction-writers.ts +119 -0
- package/src/direction.ts +266 -0
- package/src/drafts.ts +363 -0
- package/src/feedback.ts +744 -0
- package/src/figure-mask.ts +143 -0
- package/src/fix-ledger.ts +355 -0
- package/src/init.ts +265 -0
- package/src/inputs.ts +160 -0
- package/src/intake.ts +158 -0
- package/src/interview.ts +53 -0
- package/src/invariants.ts +132 -0
- package/src/job-acts.ts +80 -0
- package/src/job-advance.ts +65 -0
- package/src/job-close.ts +226 -0
- package/src/job-host.ts +529 -0
- package/src/job-outbox.ts +383 -0
- package/src/job-publication.ts +701 -0
- package/src/job-runtime.ts +99 -0
- package/src/job-writer.ts +123 -0
- package/src/meshes-bust.ts +63 -0
- package/src/next.ts +1506 -0
- package/src/overrides.ts +42 -0
- package/src/package-upgrades.ts +32 -0
- package/src/packages-upgrade-check.ts +6 -0
- package/src/packages-upgrade.ts +168 -0
- package/src/parts-act.ts +96 -0
- package/src/parts-check.ts +242 -0
- package/src/parts-review.ts +196 -0
- package/src/parts-sections.ts +98 -0
- package/src/parts-verdict-record.ts +265 -0
- package/src/parts-verdict.ts +33 -0
- package/src/pause.ts +118 -0
- package/src/pins-check.ts +619 -0
- package/src/pins.ts +17 -0
- package/src/plan-bar-amendments.ts +54 -0
- package/src/plan-history.ts +147 -0
- package/src/plan-writers.ts +202 -0
- package/src/plate-receipt.ts +110 -0
- package/src/pre-interview.ts +302 -0
- package/src/prepared-inputs.ts +113 -0
- package/src/progress-writers.ts +181 -0
- package/src/provenance.ts +301 -0
- package/src/record-direction-target.ts +26 -0
- package/src/record-input.ts +18 -0
- package/src/refusal-baseline.ts +55 -0
- package/src/refusal.ts +30 -0
- package/src/reopen-lapses.ts +80 -0
- package/src/reopen.ts +144 -0
- package/src/republish.ts +93 -0
- package/src/restart.ts +141 -0
- package/src/review-act-runtime.ts +16 -0
- package/src/review-act.ts +592 -0
- package/src/review-package.ts +524 -0
- package/src/review-read.ts +238 -0
- package/src/review.ts +432 -0
- package/src/rig-version-date.ts +22 -0
- package/src/rig-version.ts +1047 -0
- package/src/run-record.ts +232 -0
- package/src/scene-authority.ts +410 -0
- package/src/scene-writers.ts +144 -0
- package/src/scene.ts +284 -0
- package/src/setup-painting.ts +46 -0
- package/src/signable.ts +65 -0
- package/src/signoff-answers.ts +76 -0
- package/src/signoff-checkpoint-act.ts +95 -0
- package/src/signoff-target.ts +127 -0
- package/src/signoff.ts +331 -0
- package/src/split-captions.ts +154 -0
- package/src/stage-progress.ts +379 -0
- package/src/stages.ts +148 -0
- package/src/step-hash.ts +19 -0
- package/src/structure-snapshot.ts +109 -0
- package/src/structure.ts +166 -0
- package/src/templates.ts +16 -0
- package/src/waypoints.ts +163 -0
- package/templates/agent-guide.md +108 -0
- package/templates/collection-agent-guide.md +72 -0
- package/templates/collection.json +252 -0
- package/templates/example-chain/AGENTS.md +134 -0
- package/templates/example-chain/CLAUDE.md +3 -0
- package/templates/example-chain/README.md +13 -0
- package/templates/example-chain/chain.json +2869 -0
- package/templates/example-chain/checkpoints/0a-interview-options/AGENTS.md +134 -0
- package/templates/example-chain/checkpoints/0a-interview-options/CLAUDE.md +3 -0
- package/templates/example-chain/checkpoints/0a-interview-options/evidence/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/0a-interview-options/evidence/approval.txt +1 -0
- package/templates/example-chain/checkpoints/0a-interview-options/evidence/interview/rig_type.json +59 -0
- package/templates/example-chain/checkpoints/0a-interview-options/evidence/split-config.json +1 -0
- package/templates/example-chain/checkpoints/0a-interview-options/inputs/painting.png +0 -0
- package/templates/example-chain/checkpoints/0a-interview-options/inputs/references/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/0a-interview-options/package.json +9 -0
- package/templates/example-chain/checkpoints/0a-interview-options/project.json +295 -0
- package/templates/example-chain/checkpoints/0a-interview-options.json +127 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/AGENTS.md +134 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/CLAUDE.md +3 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/evidence/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/evidence/approval.txt +1 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/evidence/interview/assemble.json +309 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/evidence/interview/reference.json +59 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/evidence/interview/rig_type.json +59 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/evidence/interview/seethrough.json +186 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/evidence/split-config.json +1 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/inputs/painting.png +0 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/inputs/references/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/package.json +9 -0
- package/templates/example-chain/checkpoints/0b-plan-pending/project.json +685 -0
- package/templates/example-chain/checkpoints/0b-plan-pending.json +81 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/AGENTS.md +134 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/CLAUDE.md +3 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/approval.txt +1 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/interview/assemble.json +309 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/interview/reference.json +59 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/interview/rig_type.json +59 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/interview/seethrough.json +186 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/parts-check.json +127 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/evidence/split-config.json +1 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/inputs/painting.png +0 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/inputs/references/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/package.json +9 -0
- package/templates/example-chain/checkpoints/1-parts-verdict/project.json +955 -0
- package/templates/example-chain/checkpoints/1-parts-verdict.json +204 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/AGENTS.md +134 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/CLAUDE.md +3 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/approval.txt +1 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/diff-components.json +34 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/interview/assemble.json +309 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/interview/bones.json +190 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/interview/reference.json +59 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/interview/rig_type.json +59 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/interview/seethrough.json +186 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/parts-check.json +127 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/parts-review.json +88 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/review-reads/a12dea02d32508acc99386f894af76a14f1c85f45f804db2aa6b4dea5297973f.json +59 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/split-config.json +1 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/evidence/structure.json +30 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/inputs/painting.png +0 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/inputs/references/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/package.json +9 -0
- package/templates/example-chain/checkpoints/2-rigging-answers/project.json +1198 -0
- package/templates/example-chain/checkpoints/2-rigging-answers.json +254 -0
- package/templates/example-chain/checkpoints/3-rig-review/AGENTS.md +134 -0
- package/templates/example-chain/checkpoints/3-rig-review/CLAUDE.md +3 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/approval.txt +1 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/diff-components.json +34 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/assemble.json +309 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/bones.json +190 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/constraints.json +272 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/meshes.json +190 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/motion.json +272 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/reference.json +59 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/rig_type.json +59 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/interview/seethrough.json +186 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/parts-check.json +127 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/parts-review.json +88 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/review-reads/a12dea02d32508acc99386f894af76a14f1c85f45f804db2aa6b4dea5297973f.json +59 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/setup.png +0 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/split-config.json +1 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/structure.json +30 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/v1/config.json +88 -0
- package/templates/example-chain/checkpoints/3-rig-review/evidence/v1/interview-requirements.json +8 -0
- package/templates/example-chain/checkpoints/3-rig-review/inputs/painting.png +0 -0
- package/templates/example-chain/checkpoints/3-rig-review/inputs/references/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/3-rig-review/package.json +9 -0
- package/templates/example-chain/checkpoints/3-rig-review/project.json +1909 -0
- package/templates/example-chain/checkpoints/3-rig-review.json +424 -0
- package/templates/example-chain/checkpoints/4-direction-post/AGENTS.md +134 -0
- package/templates/example-chain/checkpoints/4-direction-post/CLAUDE.md +3 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/approval.txt +1 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/diff-components.json +34 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/assemble.json +309 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/bones.json +190 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/camera_depth.json +102 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/constraints.json +272 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/meshes.json +190 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/motion.json +272 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/post_composition.json +122 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/post_timing.json +102 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/reference.json +59 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/rig_type.json +59 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/interview/seethrough.json +186 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/parts-check.json +127 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/parts-review.json +88 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/review-reads/a12dea02d32508acc99386f894af76a14f1c85f45f804db2aa6b4dea5297973f.json +59 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/setup.png +0 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/split-config.json +1 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/structure.json +30 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/v1/config.json +88 -0
- package/templates/example-chain/checkpoints/4-direction-post/evidence/v1/interview-requirements.json +8 -0
- package/templates/example-chain/checkpoints/4-direction-post/inputs/painting.png +0 -0
- package/templates/example-chain/checkpoints/4-direction-post/inputs/references/.gitkeep +0 -0
- package/templates/example-chain/checkpoints/4-direction-post/package.json +9 -0
- package/templates/example-chain/checkpoints/4-direction-post/project.json +2302 -0
- package/templates/example-chain/checkpoints/4-direction-post.json +456 -0
- package/templates/example-chain/evidence/.gitkeep +0 -0
- package/templates/example-chain/evidence/approval.txt +1 -0
- package/templates/example-chain/evidence/captions.json +101 -0
- package/templates/example-chain/evidence/diff-components.json +34 -0
- package/templates/example-chain/evidence/direction/v2.json +74 -0
- package/templates/example-chain/evidence/direction-input.json +74 -0
- package/templates/example-chain/evidence/interview/assemble.json +309 -0
- package/templates/example-chain/evidence/interview/bones.json +190 -0
- package/templates/example-chain/evidence/interview/camera_depth.json +102 -0
- package/templates/example-chain/evidence/interview/constraints.json +272 -0
- package/templates/example-chain/evidence/interview/meshes.json +190 -0
- package/templates/example-chain/evidence/interview/motion.json +272 -0
- package/templates/example-chain/evidence/interview/post_composition.json +122 -0
- package/templates/example-chain/evidence/interview/post_timing.json +102 -0
- package/templates/example-chain/evidence/interview/reference.json +59 -0
- package/templates/example-chain/evidence/interview/rig_type.json +59 -0
- package/templates/example-chain/evidence/interview/seethrough.json +186 -0
- package/templates/example-chain/evidence/parts-check.json +127 -0
- package/templates/example-chain/evidence/parts-review.json +88 -0
- package/templates/example-chain/evidence/review-reads/a12dea02d32508acc99386f894af76a14f1c85f45f804db2aa6b4dea5297973f.json +59 -0
- package/templates/example-chain/evidence/scene/s1.json +65 -0
- package/templates/example-chain/evidence/scene-citations.json +9 -0
- package/templates/example-chain/evidence/setup.png +0 -0
- package/templates/example-chain/evidence/split-config.json +1 -0
- package/templates/example-chain/evidence/structure.json +30 -0
- package/templates/example-chain/evidence/v1/config.json +88 -0
- package/templates/example-chain/evidence/v1/interview-requirements.json +8 -0
- package/templates/example-chain/inputs/background.png +0 -0
- package/templates/example-chain/inputs/painting.png +0 -0
- package/templates/example-chain/inputs/references/.gitkeep +0 -0
- package/templates/example-chain/package.json +9 -0
- package/templates/example-chain/project.json +2593 -0
- package/templates/example-diff/diff-components.json +71 -0
- package/templates/example-diff/recomposite_rig.png +0 -0
- package/templates/example-direction/approval.txt +1 -0
- package/templates/example-direction/derived/review/v1/out/check/build/rectangle.png +0 -0
- package/templates/example-direction/derived/review/v1/out/check/build/run.json +40 -0
- package/templates/example-direction/derived/review/v1/out/check/build/skeleton.atlas +8 -0
- package/templates/example-direction/derived/review/v1/out/check/build/skeleton.json +73 -0
- package/templates/example-direction/derived/review/v1/out/check/build/skeleton.model.json +195 -0
- package/templates/example-direction/evidence/direction/v2.json +69 -0
- package/templates/example-direction/evidence/direction/v3.json +59 -0
- package/templates/example-direction/evidence/images/rectangle.png +0 -0
- package/templates/example-direction/evidence/input.json +69 -0
- package/templates/example-direction/evidence/motion.json +33 -0
- package/templates/example-direction/evidence/patch.json +23 -0
- package/templates/example-direction/evidence/rig-config.json +55 -0
- package/templates/example-direction/evidence/still.png +0 -0
- package/templates/example-direction/project.json +372 -0
- package/templates/example-direction/reasoning.txt +1 -0
- package/templates/example-direction/words.txt +1 -0
- package/templates/example-draft/README.md +28 -0
- package/templates/example-draft/config.json +71 -0
- package/templates/example-draft/derived/drafts/lantern/config.json +71 -0
- package/templates/example-draft/derived/drafts/lantern/input/painting_in_rig.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/input/parts/background.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/input/parts/eye_l.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/input/parts/eye_r.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/input/parts/face.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/input/parts/lantern.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/input/parts/torso.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/input/parts.json +188 -0
- package/templates/example-draft/derived/drafts/lantern/input/recomposite_rig.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/interview-requirements.json +8 -0
- package/templates/example-draft/derived/drafts/lantern/out/check/build/run.json +40 -0
- package/templates/example-draft/derived/drafts/lantern/out/check/build/skeleton.atlas +28 -0
- package/templates/example-draft/derived/drafts/lantern/out/check/build/skeleton.json +193 -0
- package/templates/example-draft/derived/drafts/lantern/out/check/build/skeleton.model.json +483 -0
- package/templates/example-draft/derived/drafts/lantern/out/check/build/skeleton.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/out/images/background.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/out/images/eye_l.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/out/images/eye_r.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/out/images/face.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/out/images/lantern.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/out/images/torso.png +0 -0
- package/templates/example-draft/derived/drafts/lantern/out/mesh_report.json +1 -0
- package/templates/example-draft/derived/drafts/lantern/out/motion.json +137 -0
- package/templates/example-draft/derived/drafts/lantern/out/rig.json +102 -0
- package/templates/example-draft/derived/drafts/lantern/out/run.json +52 -0
- package/templates/example-draft/derived/parts/rig/painting_in_rig.png +0 -0
- package/templates/example-draft/derived/parts/rig/parts/background.png +0 -0
- package/templates/example-draft/derived/parts/rig/parts/eye_l.png +0 -0
- package/templates/example-draft/derived/parts/rig/parts/eye_r.png +0 -0
- package/templates/example-draft/derived/parts/rig/parts/face.png +0 -0
- package/templates/example-draft/derived/parts/rig/parts/lantern.png +0 -0
- package/templates/example-draft/derived/parts/rig/parts/torso.png +0 -0
- package/templates/example-draft/derived/parts/rig/parts.json +188 -0
- package/templates/example-draft/derived/parts/rig/recomposite_rig.png +0 -0
- package/templates/example-draft/derived/review/v1/config.json +71 -0
- package/templates/example-draft/derived/review/v1/interview-requirements.json +8 -0
- package/templates/example-draft/derived/review/v1/out/check/build/run.json +40 -0
- package/templates/example-draft/derived/review/v1/out/check/build/skeleton.atlas +28 -0
- package/templates/example-draft/derived/review/v1/out/check/build/skeleton.json +193 -0
- package/templates/example-draft/derived/review/v1/out/check/build/skeleton.model.json +483 -0
- package/templates/example-draft/derived/review/v1/out/check/build/skeleton.png +0 -0
- package/templates/example-draft/derived/review/v1/out/parts/background.png +0 -0
- package/templates/example-draft/derived/review/v1/out/parts/eye_l.png +0 -0
- package/templates/example-draft/derived/review/v1/out/parts/eye_r.png +0 -0
- package/templates/example-draft/derived/review/v1/out/parts/face.png +0 -0
- package/templates/example-draft/derived/review/v1/out/parts/lantern.png +0 -0
- package/templates/example-draft/derived/review/v1/out/parts/torso.png +0 -0
- package/templates/example-draft/derived/review/v1/out/parts.json +188 -0
- package/templates/example-draft/derived/review/v1/out/rig/images/background.png +0 -0
- package/templates/example-draft/derived/review/v1/out/rig/images/eye_l.png +0 -0
- package/templates/example-draft/derived/review/v1/out/rig/images/eye_r.png +0 -0
- package/templates/example-draft/derived/review/v1/out/rig/images/face.png +0 -0
- package/templates/example-draft/derived/review/v1/out/rig/images/lantern.png +0 -0
- package/templates/example-draft/derived/review/v1/out/rig/images/torso.png +0 -0
- package/templates/example-draft/derived/review/v1/out/rig/mesh_report.json +1 -0
- package/templates/example-draft/derived/review/v1/out/rig/motion.json +137 -0
- package/templates/example-draft/derived/review/v1/out/rig/rig.json +102 -0
- package/templates/example-draft/derived/review/v1/out/rig/run.json +52 -0
- package/templates/example-draft/derived/review/v2/config.json +71 -0
- package/templates/example-draft/derived/review/v2/interview-requirements.json +8 -0
- package/templates/example-draft/derived/review/v2/out/check/build/run.json +40 -0
- package/templates/example-draft/derived/review/v2/out/check/build/skeleton.atlas +28 -0
- package/templates/example-draft/derived/review/v2/out/check/build/skeleton.json +193 -0
- package/templates/example-draft/derived/review/v2/out/check/build/skeleton.model.json +483 -0
- package/templates/example-draft/derived/review/v2/out/check/build/skeleton.png +0 -0
- package/templates/example-draft/derived/review/v2/out/parts/background.png +0 -0
- package/templates/example-draft/derived/review/v2/out/parts/eye_l.png +0 -0
- package/templates/example-draft/derived/review/v2/out/parts/eye_r.png +0 -0
- package/templates/example-draft/derived/review/v2/out/parts/face.png +0 -0
- package/templates/example-draft/derived/review/v2/out/parts/lantern.png +0 -0
- package/templates/example-draft/derived/review/v2/out/parts/torso.png +0 -0
- package/templates/example-draft/derived/review/v2/out/parts.json +188 -0
- package/templates/example-draft/derived/review/v2/out/rig/images/background.png +0 -0
- package/templates/example-draft/derived/review/v2/out/rig/images/eye_l.png +0 -0
- package/templates/example-draft/derived/review/v2/out/rig/images/eye_r.png +0 -0
- package/templates/example-draft/derived/review/v2/out/rig/images/face.png +0 -0
- package/templates/example-draft/derived/review/v2/out/rig/images/lantern.png +0 -0
- package/templates/example-draft/derived/review/v2/out/rig/images/torso.png +0 -0
- package/templates/example-draft/derived/review/v2/out/rig/mesh_report.json +1 -0
- package/templates/example-draft/derived/review/v2/out/rig/motion.json +137 -0
- package/templates/example-draft/derived/review/v2/out/rig/rig.json +102 -0
- package/templates/example-draft/derived/review/v2/out/rig/run.json +52 -0
- package/templates/example-draft/evidence/diff-components.json +71 -0
- package/templates/example-draft/evidence/direction/v4.json +64 -0
- package/templates/example-draft/evidence/direction-input-v4.json +64 -0
- package/templates/example-draft/evidence/fix-ledger/lantern.json +17 -0
- package/templates/example-draft/evidence/parts-check.json +127 -0
- package/templates/example-draft/evidence/parts-review.json +88 -0
- package/templates/example-draft/evidence/review-reads/4ed0507381809746443021554e012032be5b5f8417da0f2e525e9b6df16e9f05.json +59 -0
- package/templates/example-draft/evidence/scene/s1.json +65 -0
- package/templates/example-draft/evidence/scene-background.png +0 -0
- package/templates/example-draft/evidence/scene-citations.json +9 -0
- package/templates/example-draft/evidence/structure-decisions.json +9 -0
- package/templates/example-draft/evidence/v1/interview-config.json +71 -0
- package/templates/example-draft/evidence/v1/interview-requirements.json +8 -0
- package/templates/example-draft/evidence/v1/review-config.json +71 -0
- package/templates/example-draft/evidence/v2/interview-config.json +71 -0
- package/templates/example-draft/evidence/v2/interview-requirements.json +8 -0
- package/templates/example-draft/evidence/v2/review-config.json +71 -0
- package/templates/example-draft/input/painting_in_rig.png +0 -0
- package/templates/example-draft/input/parts/background.png +0 -0
- package/templates/example-draft/input/parts/eye_l.png +0 -0
- package/templates/example-draft/input/parts/eye_r.png +0 -0
- package/templates/example-draft/input/parts/face.png +0 -0
- package/templates/example-draft/input/parts/lantern.png +0 -0
- package/templates/example-draft/input/parts/torso.png +0 -0
- package/templates/example-draft/input/parts.json +188 -0
- package/templates/example-draft/input/recomposite_rig.png +0 -0
- package/templates/example-draft/inputs/painting.png +0 -0
- package/templates/example-draft/interview-requirements.json +8 -0
- package/templates/example-draft/out/check/build/run.json +40 -0
- package/templates/example-draft/out/check/build/skeleton.atlas +28 -0
- package/templates/example-draft/out/check/build/skeleton.json +193 -0
- package/templates/example-draft/out/check/build/skeleton.model.json +483 -0
- package/templates/example-draft/out/check/build/skeleton.png +0 -0
- package/templates/example-draft/out/images/background.png +0 -0
- package/templates/example-draft/out/images/eye_l.png +0 -0
- package/templates/example-draft/out/images/eye_r.png +0 -0
- package/templates/example-draft/out/images/face.png +0 -0
- package/templates/example-draft/out/images/lantern.png +0 -0
- package/templates/example-draft/out/images/torso.png +0 -0
- package/templates/example-draft/out/mesh_report.json +1 -0
- package/templates/example-draft/out/motion.json +137 -0
- package/templates/example-draft/out/rig.json +102 -0
- package/templates/example-draft/out/run.json +52 -0
- package/templates/example-draft/outputs/v1/out/check/build/run.json +40 -0
- package/templates/example-draft/outputs/v1/out/check/build/skeleton.atlas +28 -0
- package/templates/example-draft/outputs/v1/out/check/build/skeleton.json +193 -0
- package/templates/example-draft/outputs/v1/out/check/build/skeleton.model.json +483 -0
- package/templates/example-draft/outputs/v1/out/check/build/skeleton.png +0 -0
- package/templates/example-draft/outputs/v1/out/painting_in_rig.png +0 -0
- package/templates/example-draft/outputs/v1/out/parts/background.png +0 -0
- package/templates/example-draft/outputs/v1/out/parts/eye_l.png +0 -0
- package/templates/example-draft/outputs/v1/out/parts/eye_r.png +0 -0
- package/templates/example-draft/outputs/v1/out/parts/face.png +0 -0
- package/templates/example-draft/outputs/v1/out/parts/lantern.png +0 -0
- package/templates/example-draft/outputs/v1/out/parts/torso.png +0 -0
- package/templates/example-draft/outputs/v1/out/parts.json +188 -0
- package/templates/example-draft/outputs/v1/out/rig/images/background.png +0 -0
- package/templates/example-draft/outputs/v1/out/rig/images/eye_l.png +0 -0
- package/templates/example-draft/outputs/v1/out/rig/images/eye_r.png +0 -0
- package/templates/example-draft/outputs/v1/out/rig/images/face.png +0 -0
- package/templates/example-draft/outputs/v1/out/rig/images/lantern.png +0 -0
- package/templates/example-draft/outputs/v1/out/rig/images/torso.png +0 -0
- package/templates/example-draft/outputs/v1/out/rig/mesh_report.json +1 -0
- package/templates/example-draft/outputs/v1/out/rig/motion.json +137 -0
- package/templates/example-draft/outputs/v1/out/rig/rig.json +102 -0
- package/templates/example-draft/outputs/v1/out/rig/run.json +52 -0
- package/templates/example-draft/outputs/v2/out/check/build/run.json +40 -0
- package/templates/example-draft/outputs/v2/out/check/build/skeleton.atlas +28 -0
- package/templates/example-draft/outputs/v2/out/check/build/skeleton.json +193 -0
- package/templates/example-draft/outputs/v2/out/check/build/skeleton.model.json +483 -0
- package/templates/example-draft/outputs/v2/out/check/build/skeleton.png +0 -0
- package/templates/example-draft/outputs/v2/out/painting_in_rig.png +0 -0
- package/templates/example-draft/outputs/v2/out/parts/background.png +0 -0
- package/templates/example-draft/outputs/v2/out/parts/eye_l.png +0 -0
- package/templates/example-draft/outputs/v2/out/parts/eye_r.png +0 -0
- package/templates/example-draft/outputs/v2/out/parts/face.png +0 -0
- package/templates/example-draft/outputs/v2/out/parts/lantern.png +0 -0
- package/templates/example-draft/outputs/v2/out/parts/torso.png +0 -0
- package/templates/example-draft/outputs/v2/out/parts.json +188 -0
- package/templates/example-draft/outputs/v2/out/rig/images/background.png +0 -0
- package/templates/example-draft/outputs/v2/out/rig/images/eye_l.png +0 -0
- package/templates/example-draft/outputs/v2/out/rig/images/eye_r.png +0 -0
- package/templates/example-draft/outputs/v2/out/rig/images/face.png +0 -0
- package/templates/example-draft/outputs/v2/out/rig/images/lantern.png +0 -0
- package/templates/example-draft/outputs/v2/out/rig/images/torso.png +0 -0
- package/templates/example-draft/outputs/v2/out/rig/mesh_report.json +1 -0
- package/templates/example-draft/outputs/v2/out/rig/motion.json +137 -0
- package/templates/example-draft/outputs/v2/out/rig/rig.json +102 -0
- package/templates/example-draft/outputs/v2/out/rig/run.json +52 -0
- package/templates/example-interview-choice.json +1068 -0
- package/templates/example-interview-options/constraint.json +376 -0
- package/templates/example-interview-options/example-assemble.json +376 -0
- package/templates/example-interview-options/example-bones.json +190 -0
- package/templates/example-interview-options/example-camera-depth.json +99 -0
- package/templates/example-interview-options/example-constraints.json +272 -0
- package/templates/example-interview-options/example-meshes.json +190 -0
- package/templates/example-interview-options/example-motion.json +272 -0
- package/templates/example-interview-options/example-picks.json +15 -0
- package/templates/example-interview-options/example-post-composition.json +110 -0
- package/templates/example-interview-options/example-post-timing.json +105 -0
- package/templates/example-interview-options/example-reference.json +63 -0
- package/templates/example-interview-options/example-rig-type.json +63 -0
- package/templates/example-interview-options/example-seethrough.json +190 -0
- package/templates/example-interview-options/fullscreen.json +63 -0
- package/templates/example-interview-options/other-explicit.json +63 -0
- package/templates/example-interview-options/other-pending.json +63 -0
- package/templates/example-interview-options/other-picks.json +16 -0
- package/templates/example-interview.md +213 -0
- package/templates/example-invariants/invariants.json +1339 -0
- package/templates/example-prepared/prepared.svg +1 -0
- package/templates/example-prepared/source.svg +1 -0
- package/templates/example-project.json +4259 -0
- package/templates/example-remesh/AGENTS.md +134 -0
- package/templates/example-remesh/CLAUDE.md +3 -0
- package/templates/example-remesh/evidence/.gitkeep +0 -0
- package/templates/example-remesh/evidence/approval.txt +1 -0
- package/templates/example-remesh/evidence/captions.json +101 -0
- package/templates/example-remesh/evidence/diff-components.json +34 -0
- package/templates/example-remesh/evidence/direction/v4.json +74 -0
- package/templates/example-remesh/evidence/direction/v5.json +74 -0
- package/templates/example-remesh/evidence/direction-input-v4.json +74 -0
- package/templates/example-remesh/evidence/direction-input-v5.json +74 -0
- package/templates/example-remesh/evidence/interview/assemble.json +309 -0
- package/templates/example-remesh/evidence/interview/bones.json +190 -0
- package/templates/example-remesh/evidence/interview/camera_depth.json +103 -0
- package/templates/example-remesh/evidence/interview/constraints.json +272 -0
- package/templates/example-remesh/evidence/interview/meshes.json +190 -0
- package/templates/example-remesh/evidence/interview/motion.json +272 -0
- package/templates/example-remesh/evidence/interview/post_composition.json +123 -0
- package/templates/example-remesh/evidence/interview/post_timing.json +103 -0
- package/templates/example-remesh/evidence/interview/reference.json +59 -0
- package/templates/example-remesh/evidence/interview/rig_type.json +59 -0
- package/templates/example-remesh/evidence/interview/seethrough.json +186 -0
- package/templates/example-remesh/evidence/parts-check.json +127 -0
- package/templates/example-remesh/evidence/parts-review.json +88 -0
- package/templates/example-remesh/evidence/reopen.txt +1 -0
- package/templates/example-remesh/evidence/review-reads/6a17db694db96f1b6049a61a017e0c8e66757b982b8851e0187e561cfcf9af68.json +59 -0
- package/templates/example-remesh/evidence/scene/s1.json +69 -0
- package/templates/example-remesh/evidence/scene-citations.json +9 -0
- package/templates/example-remesh/evidence/setup.png +0 -0
- package/templates/example-remesh/evidence/split-config.json +1 -0
- package/templates/example-remesh/evidence/structure.json +30 -0
- package/templates/example-remesh/evidence/v1/registration/at-source.json +44 -0
- package/templates/example-remesh/evidence/v1/registration/citations.json +68 -0
- package/templates/example-remesh/evidence/v1/registration/compile-report.json +368 -0
- package/templates/example-remesh/evidence/v1/registration/config-source.json +88 -0
- package/templates/example-remesh/evidence/v1/registration/config.json +88 -0
- package/templates/example-remesh/evidence/v1/registration/interview-requirements.json +8 -0
- package/templates/example-remesh/evidence/v1/registration/package-lock.json +11 -0
- package/templates/example-remesh/evidence/v1/registration/path-adapter.json +1 -0
- package/templates/example-remesh/evidence/v1/registration/rigc-run-1.json +44 -0
- package/templates/example-remesh/evidence/v2/registration/at-source.json +44 -0
- package/templates/example-remesh/evidence/v2/registration/citations.json +68 -0
- package/templates/example-remesh/evidence/v2/registration/compile-report.json +368 -0
- package/templates/example-remesh/evidence/v2/registration/config-source.json +88 -0
- package/templates/example-remesh/evidence/v2/registration/config.json +88 -0
- package/templates/example-remesh/evidence/v2/registration/interview-requirements.json +8 -0
- package/templates/example-remesh/evidence/v2/registration/package-lock.json +11 -0
- package/templates/example-remesh/evidence/v2/registration/path-adapter.json +1 -0
- package/templates/example-remesh/evidence/v2/registration/rigc-run-1.json +44 -0
- package/templates/example-remesh/evidence/v3/registration/at-source.json +44 -0
- package/templates/example-remesh/evidence/v3/registration/citations.json +68 -0
- package/templates/example-remesh/evidence/v3/registration/compile-report.json +368 -0
- package/templates/example-remesh/evidence/v3/registration/config-source.json +88 -0
- package/templates/example-remesh/evidence/v3/registration/config.json +88 -0
- package/templates/example-remesh/evidence/v3/registration/interview-requirements.json +8 -0
- package/templates/example-remesh/evidence/v3/registration/package-lock.json +11 -0
- package/templates/example-remesh/evidence/v3/registration/path-adapter.json +1 -0
- package/templates/example-remesh/evidence/v3/registration/rigc-run-1.json +44 -0
- package/templates/example-remesh/inputs/background.png +0 -0
- package/templates/example-remesh/inputs/painting.png +0 -0
- package/templates/example-remesh/inputs/references/.gitkeep +0 -0
- package/templates/example-remesh/package.json +9 -0
- package/templates/example-remesh/project.json +3916 -0
- package/templates/example-reopened/project.json +4568 -0
- package/templates/example-review/config.json +1 -0
- package/templates/example-review/out/check/build/skeleton.model.json +1 -0
- package/templates/example-review/out/parts/piece.svg +1 -0
- package/templates/example-review/out/parts.json +1 -0
- package/templates/example-review/out/rig/mesh_report.json +1 -0
- package/templates/example-review/out/rig/motion.json +1 -0
- package/templates/example-review/out/rig/rig.json +1 -0
- package/templates/example-split/captions.json +357 -0
- package/templates/example-split/config.json +215 -0
- package/templates/legacy-example-project.json +1071 -0
- package/templates/project.json +199 -0
- package/templates/shared/conventions.json +23 -0
package/src/cli.ts
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { packagesCommand } from './packages-upgrade.ts';
|
|
3
|
+
import { republishCommand } from './republish.ts';
|
|
4
|
+
import { DIFF_CLASSES_HELP, diffClassesCommand } from './diff-classes.ts';
|
|
5
|
+
import { CHECKPOINT_EVIDENCE_HELP, checkpointEvidenceCommand, checkpointTableCommand } from './checkpoint-evidence-writer.ts';
|
|
6
|
+
import { partsReviewCommand } from './parts-review.ts';
|
|
7
|
+
import { INTAKE_HELP, intakeCommand, intakeReportCommand } from './intake.ts';
|
|
8
|
+
import { DIRECTION_HELP, directionCommand } from './direction-writers.ts';
|
|
9
|
+
import { SCENE_HELP, sceneCommand } from './scene-writers.ts';
|
|
10
|
+
import { readFileSync } from 'node:fs';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
|
|
13
|
+
import { CHOICE_HELP, interviewOptionsCommand, interviewAnswerCommand, interviewDecisionCommand } from './choice-writers.ts';
|
|
14
|
+
import { CORRECTION_HELP, correctionCommand } from './correction-writers.ts';
|
|
15
|
+
import { DRAFT_RIG_HELP, draftRigCommand } from './drafts.ts';
|
|
16
|
+
import { LEDGER_HELP, ledgerCommand } from './fix-ledger.ts';
|
|
17
|
+
import { RESTART_HELP, restartCommand } from './restart.ts';
|
|
18
|
+
import { STRUCTURE_SNAPSHOT_HELP, structureSnapshotCommand } from './structure-snapshot.ts';
|
|
19
|
+
import { collectionInitCommand } from './collection.ts';
|
|
20
|
+
import { COLLECTION_BINDING_HELP, collectionBindingCommand } from './collection-binding.ts';
|
|
21
|
+
import { describeInit, initProject } from './init.ts';
|
|
22
|
+
import { INTERVIEW_HELP, interviewCommand, type CommandResult } from './interview.ts';
|
|
23
|
+
import { COLLECTION_HELP, collectionCommand } from './pins-check.ts';
|
|
24
|
+
import { Refusal, formatRefusal, refuse, USAGE_EXIT } from './refusal.ts';
|
|
25
|
+
import { REVIEW_HELP, reviewCommand } from './feedback.ts';
|
|
26
|
+
import { PROGRESS_HELP, advanceCommand, stepStatusCommand } from './progress-writers.ts';
|
|
27
|
+
import { REOPEN_HELP, reopenCommand } from './reopen.ts';
|
|
28
|
+
import { PAUSE_HELP, pauseCommand, resumeCommand } from './pause.ts';
|
|
29
|
+
import { AMEND_HELP, amendCommand } from './amend.ts';
|
|
30
|
+
import { SIGNOFF_HELP, signoffCommand } from './signoff.ts';
|
|
31
|
+
import { PLAN_HELP, planCommand } from './plan-writers.ts';
|
|
32
|
+
import { HANDOFF_HELP, handoffCommand } from './review.ts';
|
|
33
|
+
import { REVIEW_PACKAGE_HELP, reviewPackageCommand } from './review-package.ts';
|
|
34
|
+
import { RIG_VERSION_HELP, rigVersionCommand } from './rig-version.ts';
|
|
35
|
+
import { DERIVED_HELP, derivedCommand } from './prepared-inputs.ts';
|
|
36
|
+
import { SPLIT_CAPTIONS_HELP, splitCaptionsCommand } from './split-captions.ts';
|
|
37
|
+
import { VERSION_HELP, versionCommand } from './config-lost.ts';
|
|
38
|
+
import { jobRuntimeCommand, takePublishedLines } from './job-writer.ts';
|
|
39
|
+
import { NEXT_HELP, nextCommand } from './next.ts';
|
|
40
|
+
|
|
41
|
+
// Input registration is kept in its own CLI block.
|
|
42
|
+
import { INPUT_HELP, inputCommand } from './inputs.ts';
|
|
43
|
+
|
|
44
|
+
const INPUT_CLI = ` rig-create input add <path> [<dir>] --origin <words>
|
|
45
|
+
register immutable raw source bytes
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const HELP = `rig-create — create and run a rig project
|
|
49
|
+
|
|
50
|
+
Usage:
|
|
51
|
+
rig-create republish <rig> [<dir>] --reason <words>
|
|
52
|
+
rig-create job open [<dir>] --reviewer <id> --role owner|delegate [--draft <id> | --rig <n> | --question <question> | --plan]
|
|
53
|
+
rig-create job acts [<dir>] [--json] list finalized acts and their ingest commands
|
|
54
|
+
rig-create job reconcile|close [<dir>]
|
|
55
|
+
${INPUT_CLI} rig-create init <dir> [--no-install] create a project folder, its repository and pinned packages
|
|
56
|
+
rig-create init <dir> --painting <file> --origin <words> [--projects-root <dir>] [--same-artwork-reason <file>]
|
|
57
|
+
also register the painting; refuse a second project for one artwork
|
|
58
|
+
rig-create restart [<dir>] --by <human> --reason-file <file>
|
|
59
|
+
restart the record at v1, keeping inputs and the fix ledger
|
|
60
|
+
rig-create ledger add|retire <id> [<dir>] --by <who> …
|
|
61
|
+
record or retire an owner fix every version inherits
|
|
62
|
+
rig-create init --collection <dir> [--no-install] create a collection folder, its repository and pinned packages
|
|
63
|
+
rig-create init --member <collection dir> <name> create members/<name>/ in a collection, inheriting its answers
|
|
64
|
+
rig-create collection answer|pin|--check [<dir>] pin member builds (--member name=version); refuse stale pins
|
|
65
|
+
rig-create collection-binding [<member dir>] [--out <path>]
|
|
66
|
+
write and bind the member's collection interview snapshot
|
|
67
|
+
rig-create scene write --rig <R> --background <path> --citations-file <file> [<dir>]
|
|
68
|
+
rig-create derived add [<dir>] --source <file> --file <file> --operation <text>
|
|
69
|
+
record external preparation and both file hashes
|
|
70
|
+
rig-create interview --check [<project dir>] [--json]
|
|
71
|
+
refuse by name every hole the interview and plan still have
|
|
72
|
+
rig-create next [<project dir>] [--json] derive the next moves and whose they are from project.json
|
|
73
|
+
rig-create handoff [<project dir>] [--rig <n>] [--json]
|
|
74
|
+
name the accepted rig version post work runs on, or refuse
|
|
75
|
+
rig-create review <version> --verdict <v> --by <who> --review <r> --verbatim <s> --source <s> [--item <id>[:<answer_was>]]... [<project dir>]
|
|
76
|
+
record what a person said about a shown version, word for word
|
|
77
|
+
rig-create diff-classes [<dir>] --diff-report <path> [--triage-file <file> | --component '<id>=<status>:<why>'] [--by agent]
|
|
78
|
+
read measured component classes or record agent classification
|
|
79
|
+
rig-create signoff <stage> --from-review <actId> [<project dir>]
|
|
80
|
+
rig-create signoff <stage> --by <who> [--steps <id,id,...>] [--verbatim-file <file>] [<project dir>]
|
|
81
|
+
record a signature without moving the stage
|
|
82
|
+
rig-create plan add|revise|remove <id> --by <drafter> [<project dir>]
|
|
83
|
+
draft steps and retain replaced definitions
|
|
84
|
+
rig-create advance <stage> [<project dir>]
|
|
85
|
+
move to the next stage authorized by a live signoff
|
|
86
|
+
rig-create step-status <step> <status> --by <who> [<project dir>] [--note-file <path>]
|
|
87
|
+
record an audited forward step status
|
|
88
|
+
rig-create reopen <stage> --by <who> [--verbatim-file <file>] [--source <text>] [<project dir>]
|
|
89
|
+
record a human backward move without deleting history
|
|
90
|
+
rig-create pause --by <who> [--verbatim-file <file>] [<project dir>]
|
|
91
|
+
stop work on a paused sign-off and record the stage it left
|
|
92
|
+
rig-create resume <stage> --by <who> [--verbatim-file <file>] [<project dir>]
|
|
93
|
+
return a paused project to the stage it was paused from
|
|
94
|
+
rig-create amend <stage> --kind <kind> --target <id> --change <file> --by <who> [<project dir>]
|
|
95
|
+
record a forward amendment and name lapsed approvals
|
|
96
|
+
rig-create draft-rig <id> [<dir>] --config <path> --from <dir> [--parts <dir>]
|
|
97
|
+
record labelled draft artifacts without building or promoting
|
|
98
|
+
rig-create parts-review [<dir>] --from-review <actId> [--json]
|
|
99
|
+
retain the semantic parts verdict as an independent write
|
|
100
|
+
rig-create structure-snapshot [<dir>] --draft <id> --out <path>
|
|
101
|
+
write the parts-review structure snapshot from the approved draft
|
|
102
|
+
rig-create review-package <n> [<dir>] --config <path> --from <build out dir>
|
|
103
|
+
copy producer inputs and record the review open command
|
|
104
|
+
rig-create rig-version <n> [<dir>] --parts <dir> --rig <dir> --build <dir> --idle <dir> …
|
|
105
|
+
register frozen producer output with declared source bindings
|
|
106
|
+
rig-create split-captions [<project dir|project.json>] [--config <file>]
|
|
107
|
+
generate caption data from the config and split.parts
|
|
108
|
+
rig-create version config-lost <n> --note <text> --source <text> [<dir>]
|
|
109
|
+
record a pre-interview version's lost build config
|
|
110
|
+
rig-create version outputs-lost <n> --note <text> --source <text> [<dir>]
|
|
111
|
+
record a pre-interview version's lost frozen outputs
|
|
112
|
+
rig-create packages upgrade [<dir>] --by <operator> update release pins with checked history
|
|
113
|
+
rig-create --help show this help
|
|
114
|
+
rig-create --version show the version
|
|
115
|
+
|
|
116
|
+
init:
|
|
117
|
+
<dir> an empty or missing folder; a non-empty one is refused
|
|
118
|
+
--no-install do not run bun install (offline, tests); run it yourself afterwards
|
|
119
|
+
--painting <file> --origin <words>
|
|
120
|
+
copy the painting into inputs/, register it and declare project.painting; refused (INIT_ARTWORK_EXISTS) when a
|
|
121
|
+
project directly under --projects-root (default: the parent folder) binds the same sha256
|
|
122
|
+
--same-artwork-reason <file>
|
|
123
|
+
record why this artwork needs a second project (a different rig kind)
|
|
124
|
+
|
|
125
|
+
${RESTART_HELP}
|
|
126
|
+
|
|
127
|
+
${LEDGER_HELP}
|
|
128
|
+
|
|
129
|
+
${INPUT_HELP}
|
|
130
|
+
|
|
131
|
+
${INTERVIEW_HELP}
|
|
132
|
+
|
|
133
|
+
${NEXT_HELP}
|
|
134
|
+
|
|
135
|
+
${CHOICE_HELP}
|
|
136
|
+
|
|
137
|
+
${INTAKE_HELP}
|
|
138
|
+
|
|
139
|
+
${HANDOFF_HELP}
|
|
140
|
+
${COLLECTION_HELP}
|
|
141
|
+
|
|
142
|
+
${COLLECTION_BINDING_HELP}
|
|
143
|
+
|
|
144
|
+
${REVIEW_HELP}
|
|
145
|
+
|
|
146
|
+
${SIGNOFF_HELP}
|
|
147
|
+
|
|
148
|
+
${DIFF_CLASSES_HELP}
|
|
149
|
+
|
|
150
|
+
${PLAN_HELP}
|
|
151
|
+
|
|
152
|
+
${CHECKPOINT_EVIDENCE_HELP}
|
|
153
|
+
|
|
154
|
+
${PROGRESS_HELP}
|
|
155
|
+
|
|
156
|
+
${REOPEN_HELP}
|
|
157
|
+
|
|
158
|
+
${PAUSE_HELP}
|
|
159
|
+
|
|
160
|
+
${AMEND_HELP}
|
|
161
|
+
|
|
162
|
+
${DRAFT_RIG_HELP}
|
|
163
|
+
|
|
164
|
+
${STRUCTURE_SNAPSHOT_HELP}
|
|
165
|
+
|
|
166
|
+
${CORRECTION_HELP}
|
|
167
|
+
|
|
168
|
+
${SCENE_HELP}
|
|
169
|
+
|
|
170
|
+
${DIRECTION_HELP}
|
|
171
|
+
|
|
172
|
+
${DERIVED_HELP}
|
|
173
|
+
|
|
174
|
+
${REVIEW_PACKAGE_HELP}
|
|
175
|
+
|
|
176
|
+
${RIG_VERSION_HELP}
|
|
177
|
+
|
|
178
|
+
${SPLIT_CAPTIONS_HELP}
|
|
179
|
+
|
|
180
|
+
${VERSION_HELP}
|
|
181
|
+
`;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A command prints what it returns; a string exits 0, a CommandResult chooses its exit code (a report with refusals exits 1).
|
|
185
|
+
* `now` is the instant the command runs at, which every written date and every "not in the future" check uses.
|
|
186
|
+
*/
|
|
187
|
+
type Command = (args: string[], now: number) => string | CommandResult;
|
|
188
|
+
|
|
189
|
+
function version(): string {
|
|
190
|
+
const pkg: unknown = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf8'));
|
|
191
|
+
if (pkg !== null && typeof pkg === 'object' && 'version' in pkg && typeof pkg.version === 'string') {
|
|
192
|
+
return pkg.version;
|
|
193
|
+
}
|
|
194
|
+
return 'unknown';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function initCommand(args: string[], now: number): string {
|
|
198
|
+
if (args.includes('--collection') || args.includes('--member')) {
|
|
199
|
+
const made = collectionInitCommand(args, now);
|
|
200
|
+
if (made.installError !== null) {
|
|
201
|
+
process.stdout.write(`${made.stdout}\n`);
|
|
202
|
+
refuse('INIT_INSTALL_FAILED', `bun install failed in ${made.dir}; the collection and its first commit are in place. Run bun install there, then commit bun.lock.\n${made.installError}`);
|
|
203
|
+
}
|
|
204
|
+
return made.stdout;
|
|
205
|
+
}
|
|
206
|
+
let install = true;
|
|
207
|
+
const positional: string[] = [];
|
|
208
|
+
const artwork: Record<string, string> = {};
|
|
209
|
+
for (let i = 0; i < args.length; i++) {
|
|
210
|
+
const arg = args[i]!;
|
|
211
|
+
if (arg === '--no-install') install = false;
|
|
212
|
+
else if (['--painting', '--origin', '--projects-root', '--same-artwork-reason'].includes(arg)) {
|
|
213
|
+
const value = args[++i];
|
|
214
|
+
if (value === undefined || value.startsWith('--') || value.trim() === '' || artwork[arg] !== undefined) refuse('INIT_ARTWORK_USAGE', `init: ${arg} needs one value`, USAGE_EXIT);
|
|
215
|
+
artwork[arg] = value;
|
|
216
|
+
} else if (arg.startsWith('-')) refuse('UNKNOWN_OPTION', `init does not take ${arg}`, USAGE_EXIT);
|
|
217
|
+
else positional.push(arg);
|
|
218
|
+
}
|
|
219
|
+
if (Object.keys(artwork).length > 0 && (artwork['--painting'] === undefined || artwork['--origin'] === undefined)) {
|
|
220
|
+
refuse('INIT_ARTWORK_USAGE', 'init: --origin, --projects-root and --same-artwork-reason go with --painting <file> --origin <words>', USAGE_EXIT);
|
|
221
|
+
}
|
|
222
|
+
if (positional.length === 0) refuse('INIT_DIR_MISSING', 'init needs a folder: rig-create init <dir>', USAGE_EXIT);
|
|
223
|
+
if (positional.length > 1) {
|
|
224
|
+
refuse('INIT_TOO_MANY_ARGUMENTS', `init takes one folder, got ${positional.join(' ')}`, USAGE_EXIT);
|
|
225
|
+
}
|
|
226
|
+
const painting = artwork['--painting'] === undefined ? undefined : {
|
|
227
|
+
file: artwork['--painting'], origin: artwork['--origin']!, projectsRoot: artwork['--projects-root'], sameArtworkReason: artwork['--same-artwork-reason'],
|
|
228
|
+
};
|
|
229
|
+
const result = initProject(positional[0] as string, { install, now, ...(painting === undefined ? {} : { painting }) });
|
|
230
|
+
if (result.installError !== null) {
|
|
231
|
+
process.stdout.write(`${describeInit(result)}\n`);
|
|
232
|
+
refuse(
|
|
233
|
+
'INIT_INSTALL_FAILED',
|
|
234
|
+
`bun install failed in ${result.dir}; the project and its first commit are in place. Run bun install there, then commit bun.lock.\n${result.installError}`,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
return describeInit(result);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Subcommands by name. */
|
|
241
|
+
const COMMANDS: Record<string, Command> = {
|
|
242
|
+
packages: packagesCommand,
|
|
243
|
+
republish: republishCommand,
|
|
244
|
+
input: inputCommand,
|
|
245
|
+
init: initCommand,
|
|
246
|
+
intake: intakeCommand,
|
|
247
|
+
'intake-report': intakeReportCommand,
|
|
248
|
+
interview: interviewCommand,
|
|
249
|
+
next: nextCommand,
|
|
250
|
+
'interview-options': interviewOptionsCommand,
|
|
251
|
+
'interview-answer': interviewAnswerCommand,
|
|
252
|
+
'interview-decision': interviewDecisionCommand,
|
|
253
|
+
handoff: handoffCommand,
|
|
254
|
+
'review-package': reviewPackageCommand,
|
|
255
|
+
'rig-version': rigVersionCommand,
|
|
256
|
+
collection: collectionCommand,
|
|
257
|
+
'collection-binding': collectionBindingCommand,
|
|
258
|
+
review: reviewCommand,
|
|
259
|
+
signoff: signoffCommand,
|
|
260
|
+
'diff-classes': diffClassesCommand,
|
|
261
|
+
plan: planCommand,
|
|
262
|
+
'checkpoint-evidence': checkpointEvidenceCommand,
|
|
263
|
+
'checkpoint-table': checkpointTableCommand,
|
|
264
|
+
reopen: reopenCommand,
|
|
265
|
+
pause: pauseCommand,
|
|
266
|
+
resume: resumeCommand,
|
|
267
|
+
advance: advanceCommand,
|
|
268
|
+
'step-status': stepStatusCommand,
|
|
269
|
+
amend: amendCommand,
|
|
270
|
+
'draft-rig': draftRigCommand,
|
|
271
|
+
ledger: ledgerCommand,
|
|
272
|
+
restart: restartCommand,
|
|
273
|
+
'parts-review': partsReviewCommand,
|
|
274
|
+
'structure-snapshot': structureSnapshotCommand,
|
|
275
|
+
correction: correctionCommand,
|
|
276
|
+
scene: sceneCommand,
|
|
277
|
+
direction: directionCommand,
|
|
278
|
+
|
|
279
|
+
derived: derivedCommand,
|
|
280
|
+
'split-captions': splitCaptionsCommand,
|
|
281
|
+
version: versionCommand,
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Run one command at `now` (ms since the epoch). The process entry below is the
|
|
286
|
+
* only place create reads the wall clock; tests and scripts pass a fixed instant
|
|
287
|
+
* (README.md "The clock").
|
|
288
|
+
*/
|
|
289
|
+
export function main(argv: string[], now: number): number {
|
|
290
|
+
const [first, ...rest] = argv;
|
|
291
|
+
try {
|
|
292
|
+
if (first === 'job') {
|
|
293
|
+
const [action, ...args] = rest;
|
|
294
|
+
if (!['open', 'acts', 'reconcile', 'close'].includes(action ?? '')) refuse('JOB_BINDING_INVALID', 'project.json: use job open|acts|reconcile|close', USAGE_EXIT);
|
|
295
|
+
const positional: string[] = [];
|
|
296
|
+
const options: Record<string, string> = {};
|
|
297
|
+
for (let index = 0; index < args.length; index++) {
|
|
298
|
+
const arg = args[index]!;
|
|
299
|
+
if (action === 'open' && ['--reviewer', '--role', '--draft', '--rig', '--question'].includes(arg)) {
|
|
300
|
+
const value = args[++index];
|
|
301
|
+
if (!value || value.startsWith('-') || options[arg]) refuse('JOB_BINDING_INVALID', 'project.json: job open requires one value for each reviewer option', USAGE_EXIT);
|
|
302
|
+
options[arg] = value;
|
|
303
|
+
} else if (action === 'open' && arg === '--plan' && !options[arg]) options[arg] = 'true';
|
|
304
|
+
else if (action === 'acts' && arg === '--json' && !options[arg]) options[arg] = 'true';
|
|
305
|
+
else if (arg.startsWith('-')) refuse('JOB_BINDING_INVALID', 'project.json: unsupported job option; see help', USAGE_EXIT);
|
|
306
|
+
else positional.push(arg);
|
|
307
|
+
}
|
|
308
|
+
if (positional.length > 1 || action === 'open' && (!options['--reviewer'] || !['owner', 'delegate'].includes(options['--role'] ?? ''))) {
|
|
309
|
+
refuse('JOB_BINDING_INVALID', 'project.json: job open needs --reviewer <id> --role owner|delegate and one optional directory', USAGE_EXIT);
|
|
310
|
+
}
|
|
311
|
+
if (['--draft', '--rig', '--question', '--plan'].filter(flag => options[flag] !== undefined).length > 1) {
|
|
312
|
+
refuse('JOB_BINDING_INVALID', 'project.json: job open takes one of --draft, --rig, --question or --plan; choose one recorded result', USAGE_EXIT);
|
|
313
|
+
}
|
|
314
|
+
const stdin = Buffer.from(JSON.stringify({ root: positional[0] ?? process.cwd(), reviewer: options['--reviewer'], role: options['--role'], draft: options['--draft'], rig: options['--rig'], question: options['--question'], plan: options['--plan'] === 'true', json: options['--json'] === 'true', now }));
|
|
315
|
+
const runtime = join(import.meta.dir, 'job-runtime.ts');
|
|
316
|
+
if (action === 'open') {
|
|
317
|
+
const child = Bun.spawn(jobRuntimeCommand(action, runtime), {
|
|
318
|
+
stdin, stdout: 'inherit', stderr: 'inherit',
|
|
319
|
+
});
|
|
320
|
+
const forward = (signal: 'SIGINT' | 'SIGTERM') => {
|
|
321
|
+
if (child.exitCode === null && child.signalCode === null) child.kill(signal);
|
|
322
|
+
};
|
|
323
|
+
const onSigint = () => forward('SIGINT');
|
|
324
|
+
const onSigterm = () => forward('SIGTERM');
|
|
325
|
+
process.on('SIGINT', onSigint);
|
|
326
|
+
process.on('SIGTERM', onSigterm);
|
|
327
|
+
void child.exited.then(code => {
|
|
328
|
+
process.off('SIGINT', onSigint);
|
|
329
|
+
process.off('SIGTERM', onSigterm);
|
|
330
|
+
process.exitCode = code;
|
|
331
|
+
});
|
|
332
|
+
return 0;
|
|
333
|
+
}
|
|
334
|
+
const child = Bun.spawnSync(jobRuntimeCommand(action!, runtime), {
|
|
335
|
+
stdin, stdout: 'inherit', stderr: 'inherit',
|
|
336
|
+
});
|
|
337
|
+
return child.exitCode;
|
|
338
|
+
}
|
|
339
|
+
if (first === undefined || first === '--help' || first === '-h' || first === 'help') {
|
|
340
|
+
process.stdout.write(HELP);
|
|
341
|
+
return 0;
|
|
342
|
+
}
|
|
343
|
+
if (first === '--version' || first === '-v') {
|
|
344
|
+
process.stdout.write(`${version()}\n`);
|
|
345
|
+
return 0;
|
|
346
|
+
}
|
|
347
|
+
const command = COMMANDS[first];
|
|
348
|
+
if (command === undefined) {
|
|
349
|
+
refuse('UNKNOWN_COMMAND', `no command named ${first} (see rig-create --help)`, USAGE_EXIT);
|
|
350
|
+
}
|
|
351
|
+
takePublishedLines();
|
|
352
|
+
const result = command(rest, now);
|
|
353
|
+
const jobLines = takePublishedLines();
|
|
354
|
+
const text = typeof result === 'string' ? result : result.stdout;
|
|
355
|
+
const output = !rest.includes('--json') && jobLines.length ? `${text}\n${jobLines.join('\n')}` : text;
|
|
356
|
+
process.stdout.write(`${output}\n`);
|
|
357
|
+
return typeof result === 'string' ? 0 : result.exit;
|
|
358
|
+
} catch (error) {
|
|
359
|
+
const jobLines = takePublishedLines();
|
|
360
|
+
if (error instanceof Refusal) {
|
|
361
|
+
if (!rest.includes('--json') && jobLines.length) process.stdout.write(`${jobLines.join('\n')}\n`);
|
|
362
|
+
process.stderr.write(`${formatRefusal(error)}\n`);
|
|
363
|
+
return error.exitCode;
|
|
364
|
+
}
|
|
365
|
+
throw error;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (import.meta.main) {
|
|
370
|
+
process.exitCode = main(process.argv.slice(2), Date.now());
|
|
371
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/** Collection question writes preserve all bytes outside the answer and history values. */
|
|
2
|
+
import { readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
|
+
import { asArray, isObject, COLLECTION_SCHEMA, type Finding } from './check.ts';
|
|
5
|
+
import { COLLECTION_STAGE_VALUES } from './collection.ts';
|
|
6
|
+
import { checkCollectionRecord } from './pins-check.ts';
|
|
7
|
+
import type { CommandResult } from './interview.ts';
|
|
8
|
+
import { refuse, USAGE_EXIT } from './refusal.ts';
|
|
9
|
+
import type { Json, JsonObject } from './templates.ts';
|
|
10
|
+
|
|
11
|
+
/** Locate JSON value spans by structural path, retaining whitespace and unrelated spellings. */
|
|
12
|
+
function valueSpans(bytes: string): Map<string, [number, number]> {
|
|
13
|
+
const tokens = [...bytes.matchAll(/"(?:\\.|[^"\\])*"|[{}\[\],:]|[^\s{}\[\],:]+/g)];
|
|
14
|
+
const spans = new Map<string, [number, number]>();
|
|
15
|
+
let cursor = 0;
|
|
16
|
+
function value(path: (string | number)[]): void {
|
|
17
|
+
const start = cursor;
|
|
18
|
+
const token = tokens[cursor++]![0];
|
|
19
|
+
if (token === '{') {
|
|
20
|
+
while (tokens[cursor]![0] !== '}') {
|
|
21
|
+
const key = JSON.parse(tokens[cursor++]![0]) as string;
|
|
22
|
+
cursor++; // colon
|
|
23
|
+
value([...path, key]);
|
|
24
|
+
if (tokens[cursor]![0] === ',') cursor++;
|
|
25
|
+
}
|
|
26
|
+
cursor++;
|
|
27
|
+
} else if (token === '[') {
|
|
28
|
+
let index = 0;
|
|
29
|
+
while (tokens[cursor]![0] !== ']') {
|
|
30
|
+
value([...path, index++]);
|
|
31
|
+
if (tokens[cursor]![0] === ',') cursor++;
|
|
32
|
+
}
|
|
33
|
+
cursor++;
|
|
34
|
+
}
|
|
35
|
+
const first = tokens[start]!;
|
|
36
|
+
const last = tokens[cursor - 1]!;
|
|
37
|
+
spans.set(JSON.stringify(path), [first.index!, last.index! + last[0].length]);
|
|
38
|
+
}
|
|
39
|
+
value([]);
|
|
40
|
+
return spans;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function collectionAnswerCommand(args: string[], now: number): CommandResult {
|
|
44
|
+
const positional: string[] = [];
|
|
45
|
+
const flags: Record<string, string> = {};
|
|
46
|
+
const allowed = ['--by', '--value-file', '--defer-until', '--reason-file'];
|
|
47
|
+
for (let i = 0; i < args.length; i++) {
|
|
48
|
+
const arg = args[i]!;
|
|
49
|
+
if (!arg.startsWith('-')) positional.push(arg);
|
|
50
|
+
else {
|
|
51
|
+
const next = args[++i];
|
|
52
|
+
if (!allowed.includes(arg) || flags[arg] !== undefined || !next || next.startsWith('--')) {
|
|
53
|
+
refuse('COLLECTION_USAGE', 'collection answer: supply a question, --by and exactly one of --value-file or --defer-until with --reason-file', USAGE_EXIT);
|
|
54
|
+
}
|
|
55
|
+
flags[arg] = next;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (positional.length < 1 || positional.length > 2 || !flags['--by']?.trim()
|
|
59
|
+
|| Boolean(flags['--value-file']) === Boolean(flags['--defer-until'])
|
|
60
|
+
|| Boolean(flags['--defer-until']) !== Boolean(flags['--reason-file'])) {
|
|
61
|
+
refuse('COLLECTION_USAGE', 'collection answer: supply a question, --by and exactly one of --value-file or --defer-until with --reason-file', USAGE_EXIT);
|
|
62
|
+
}
|
|
63
|
+
const dir = resolve(positional[1] ?? process.cwd());
|
|
64
|
+
const file = join(dir, 'collection.json');
|
|
65
|
+
let bytes: string;
|
|
66
|
+
let original: JsonObject;
|
|
67
|
+
try {
|
|
68
|
+
bytes = readFileSync(file, 'utf8');
|
|
69
|
+
const parsed: Json = JSON.parse(bytes);
|
|
70
|
+
if (!isObject(parsed)) throw Error('expected an object');
|
|
71
|
+
original = parsed;
|
|
72
|
+
} catch {
|
|
73
|
+
refuse('COLLECTION_JSON_INVALID', `${file}: cannot read a JSON object; restore collection.json before recording an answer`);
|
|
74
|
+
}
|
|
75
|
+
if (original.schema !== COLLECTION_SCHEMA) refuse('SCHEMA_UNKNOWN', `collection.json: expected ${COLLECTION_SCHEMA}; restore the collection record`);
|
|
76
|
+
const stage = original.stage;
|
|
77
|
+
if (typeof stage !== 'string' || !COLLECTION_STAGE_VALUES.includes(stage)) refuse('STAGE_UNKNOWN', 'collection.json stage: restore a known collection stage before recording an answer');
|
|
78
|
+
const candidate = structuredClone(original);
|
|
79
|
+
const interview = isObject(candidate.interview) ? candidate.interview : {};
|
|
80
|
+
const questions = asArray(interview.questions);
|
|
81
|
+
const index = questions.findIndex(q => isObject(q) && q.id === positional[0] && q.scope === 'collection');
|
|
82
|
+
const question = questions[index];
|
|
83
|
+
if (!isObject(question) || !('answer' in question)) refuse('ANSWER_MALFORMED', `interview.questions[${positional[0]}].answer: choose an existing collection-scope question in collection.json`);
|
|
84
|
+
const path = `interview.questions[${positional[0]}].answer`;
|
|
85
|
+
const at = new Date(now).toISOString();
|
|
86
|
+
let answer: Json;
|
|
87
|
+
try {
|
|
88
|
+
answer = flags['--value-file']
|
|
89
|
+
? JSON.parse(readFileSync(resolve(dir, flags['--value-file']), 'utf8')) as Json
|
|
90
|
+
: { deferred: { by: flags['--by']!, at, reason: readFileSync(resolve(dir, flags['--reason-file']!), 'utf8'), until_stage: flags['--defer-until']! } };
|
|
91
|
+
} catch {
|
|
92
|
+
refuse('ANSWER_MALFORMED', `${path}: cannot read the answer JSON or reason file; supply a readable file`);
|
|
93
|
+
}
|
|
94
|
+
if (flags['--value-file']) {
|
|
95
|
+
if (!isObject(answer) || 'deferred' in answer || answer.basis === 'inherited') refuse('ANSWER_MALFORMED', `${path}: --value-file needs an ordinary answer object; use --defer-until for a deferral`);
|
|
96
|
+
answer = { ...answer, by: flags['--by']!, at };
|
|
97
|
+
}
|
|
98
|
+
const before: Finding[] = [];
|
|
99
|
+
const effective = checkCollectionRecord(original, stage, before);
|
|
100
|
+
question.answer = answer;
|
|
101
|
+
if (Array.isArray(question.history)) {
|
|
102
|
+
const priorInterview = original.interview as JsonObject;
|
|
103
|
+
const prior = (priorInterview.questions as JsonObject[])[index]!.answer;
|
|
104
|
+
if (prior !== null && prior !== undefined) question.history.push(prior);
|
|
105
|
+
}
|
|
106
|
+
const after: Finding[] = [];
|
|
107
|
+
checkCollectionRecord(candidate, stage, after);
|
|
108
|
+
if (flags['--defer-until'] && COLLECTION_STAGE_VALUES.includes(flags['--defer-until'])
|
|
109
|
+
&& COLLECTION_STAGE_VALUES.indexOf(flags['--defer-until']) <= COLLECTION_STAGE_VALUES.indexOf(effective)) {
|
|
110
|
+
refuse('ANSWER_MALFORMED', `${path}: until_stage must be later than ${effective}; choose a later lifecycle stage`);
|
|
111
|
+
}
|
|
112
|
+
const counts = new Map<string, number>();
|
|
113
|
+
for (const finding of before) {
|
|
114
|
+
const key = `${finding.code}:${finding.path}`;
|
|
115
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
116
|
+
}
|
|
117
|
+
for (const finding of after) {
|
|
118
|
+
const key = `${finding.code}:${finding.path}`;
|
|
119
|
+
const count = counts.get(key) ?? 0;
|
|
120
|
+
if (finding.path === path || count === 0) refuse(finding.code, finding.message);
|
|
121
|
+
counts.set(key, count - 1);
|
|
122
|
+
}
|
|
123
|
+
const spans = valueSpans(bytes);
|
|
124
|
+
const edits = ['answer', ...(Array.isArray(question.history) ? ['history'] : [])].map(field => {
|
|
125
|
+
const span = spans.get(JSON.stringify(['interview', 'questions', index, field]));
|
|
126
|
+
if (!span) refuse('ANSWER_MALFORMED', `${path}: missing ${field} value; restore the collection question`);
|
|
127
|
+
return { start: span[0], end: span[1], text: JSON.stringify(question[field]) };
|
|
128
|
+
});
|
|
129
|
+
let output = bytes;
|
|
130
|
+
for (const edit of edits.sort((a, b) => b.start - a.start)) output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);
|
|
131
|
+
if (readFileSync(file, 'utf8') !== bytes) refuse('ANSWER_MALFORMED', `${path}: collection.json changed while recording; reread it and retry`);
|
|
132
|
+
const temporary = join(dir, `.collection-answer-${crypto.randomUUID()}.tmp`);
|
|
133
|
+
writeFileSync(temporary, output, { flag: 'wx' });
|
|
134
|
+
renameSync(temporary, file);
|
|
135
|
+
return { stdout: `collection answer: recorded ${path}; collection.json is written, not committed.`, exit: 0 };
|
|
136
|
+
}
|