Repository navigation
Write actions: craftar mcp --allow-writes and the shared writers (spec 40 A+B) - #74
Merged
Merged
Conversation
…s print, and mcp's tools/list Spec 40 §12.1: captured before the writing half of applyAndReport and recipeCommand moves into the core, so the lift is proved byte for byte.
…--allow-writes Spec 40 §5.2, §7.1: writeConsent is a top-level list of registry.json, so register() keeps it; forget and prune drop it with the workspace, and an empty list is omitted.
…riters of spec 40 Part A: the writing half of applyAndReport and recipeCommand as functions that return data, for the CLI and craftar mcp --allow-writes; forgeLine and nextSyncLine move into src/core/report.ts. refactor(cli): print sync and the recipe commands from the core outcomes Spec 40 §4.2: test/write-pins.test.ts passes unchanged.
A thrown error is printed through errorText, as before the lift; forgeLine keeps its doc comment.
Spec 40 §5.2: the consent is typed by a person in a terminal and names the Forge, ref and profile it allows; revoking needs no terminal.
An answer of n, no or anything else non-empty recorded it; the question is now confirmWrites, Enter and an ended input are no, anything but yes or no is asked again.
…ove_recipe Spec 40 Part B: each writing call checks the pin, then this workspace's consent for the pinned Forge, ref and profile; sync skips and lists every hand edit; the protocol module still imports no writer.
- consent() returns codes (ok|registry-off|unreadable|none|{stale}); callWrite converts to messages
- isRemote(forge) replaces classifyForge(root, merged)
- editRecipes() merges addRecipe and removeRecipe
- sync uses mode: 'sync'
- recipe tools receive fetch param and include cachedCopyLine in warnings
- static import for allowWrites in test/mcp-cli.test.ts
- new test 15: remote Forge warnings in add_recipe
Mutations verified:
- (b) drop cached line → test 15 fails
- (c) map 'none' to 'ok' → tests 2 and 12 fail
…e upgrade note Spec 40 Parts A and B: the Commands rows, the section on letting the AI coder write, the roadmap and the to-0.35.0 block.
The writers import the protocol's Pin as a type; the remote check before sync already decided fetch.
…e new Phase 1 line The README of the previous commit broke two assertions of test/ui-readme.test.ts.
…ing prints or records it
… from the AI coder
…lock, consent entries keep unknown keys
…ine body is caught
…file, one home in the writers
On Windows realpath and path.resolve spell a temp directory differently; the no-craftar.yaml refusal prints path.resolve, as craftar mcp's launch refusal does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
craftar@0.35.0to npm after approval in thenpmenvironment.src/core/write-actions.ts):syncWorkspace,editRecipesandstatusDigest. The writing half ofapplyAndReportand of the recipe commands now lives in the core and returns data; the CLI prints from it. Pins captured before the move (test/write-pins.test.ts, plustools/list/initializeintest/pins/) pass unchanged after it.forgeLineandnextSyncLinemove tosrc/core/report.ts.craftar mcp --allow-writes: three more tools,sync,add_recipeandremove_recipe. Each call checks, in order, the pin, then a per-workspace consent, then the Forge (a remote Forge needs--fetchforsync), then runs the writer.syncpasses neitheroverwriteDriftnoroverwritePaths: everydrift,orphan-driftandcollisionis skipped and listed.test/mcp-imports.test.tsis unchanged.craftar mcp allow-writesrecords it as a top-levelwriteConsententry inregistry.json(stillschema: 1), andcraftar mcp revoke-writesremoves it.allow-writesruns only in a terminal, asks with a[no]default (onlyy/yesrecords), and refuses aforge:orref:that holds credentials.forge,refandprofileit was given for.workspaces forgetandprunedrop it with the workspace.Test plan
npm run typecheck— cleannpm test(--exclude test/ci.test.ts --maxWorkers=6) — 146 files passed, 1 skipped; 3486 tests passed, 11 skipped, before review. After the review rounds the builder's run gave 3491 passed. Oracle skipped (no fixture on this machine).status(),apply()or lock code changed.sync.tsonly gains afetchHintvalue for the MCP fetch-failure tail; the CLI's message is unchanged.allow-writes,n,no, Enter and ended input refuse,maybere-asks,y/yesrecord, and typed-ahead input is discarded. From a non-TTY shell it is refused. Also checked:revoke-writestwice, and asynccall over stdio with--allow-writes.node-cli-reviewer: three rounds, the last clean (no blocker, no should-fix).--allow-writesin Claude Code and in Kiro, and how each presents adestructiveHinttool.