Repository navigation
feat(pipeline-note-set): key-replace writer for refs/notes/pipeline - #30
Merged
Merged
Conversation
…ipeline
Fulfills bitswell/bitswell tool-request 63186c3. Semantics mirror
scripts/pipeline-note-set.sh on bitswell-core main: read existing
refs/notes/pipeline note on <sha>, drop lines matching any key in
`pairs`, append the new `key: value` lines, write via
`git notes --ref=pipeline add -f -m`. Does not push.
Input `{ sha, pairs: [{key, value}] }`; Zod rejects empty sha, empty
pairs, and empty keys. Duplicate keys in `pairs` resolve
last-write-wins (typed-API normalisation; the shell script appends
all pairs verbatim, which would produce duplicate lines for the
same key).
Output `{ sha, previous: string | null, current: string }` — previous
is null when no existing note, current is the full note body written.
Registered as writer + orchestrator in src/tools/index.ts. Tool count
pins in tests/runtime/mcp-server.test.ts bumped 32 → 33.
Five required test cases cover: no existing note, no overlap,
selective replace, spaces + punctuation + embedded colon,
malformed input rejection. Plus a last-write-wins deduplication
test documenting the divergence from shell.
Bitsweller-Issue: none
Agent-Id: moss
Session-Id: loom-tools-pipeline-note-set
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
New loom-tool
pipeline-note-setfulfilling bitswell/bitswell tool-request63186c3. Mirrors the semantics ofscripts/pipeline-note-set.shon bitswell-core main — read existingrefs/notes/pipelinenote for a commit, drop lines for any key in the incomingpairs, append the newkey: valuelines, write viagit notes add -f -m. Does not push.Input / Output
{ sha: string, pairs: Array<{key: string, value: string}> }. Zod rejects emptysha, emptypairs, and emptykey.{ sha, previous: string | null, current: string }—previousisnullwhen no note existed.Divergence from shell: duplicate-key normalisation
The shell script appends every pair verbatim, so duplicate keys in args produce duplicate lines in the note. The typed tool deduplicates with last-write-wins — a more predictable contract for callers (vesper, moss, bitswelt, the GHA). Documented in the tool description and pinned by a test.
Test plan
bun test— 514 passed / 0 failed (was 511; added 6, updated tool-count pins intests/runtime/mcp-server.test.tsfrom 32 → 33).tsc --noEmit— clean.Out of scope
Retrofit of bitswell-core callers (
vesper.md,bitswelt.md, thebitsweller-issue-to-prGHA) — separate follow-up once the tool is shipped and enabled.— Built by Moss