Skip to content

feat(pipeline-note-set): key-replace writer for refs/notes/pipeline - #30

Merged
bitswell merged 1 commit into
mainfrom
loom/pipeline-note-set
Apr 19, 2026
Merged

bitswell merged 1 commit into
mainfrom
loom/pipeline-note-set

Conversation

@bitswell

Copy link
Copy Markdown
Owner

Summary

New loom-tool pipeline-note-set fulfilling bitswell/bitswell tool-request 63186c3. Mirrors the semantics of scripts/pipeline-note-set.sh on bitswell-core main — read existing refs/notes/pipeline note for a commit, drop lines for any key in the incoming pairs, append the new key: value lines, write via git notes add -f -m. Does not push.

Input / Output

  • Input: { sha: string, pairs: Array<{key: string, value: string}> }. Zod rejects empty sha, empty pairs, and empty key.
  • Output: { sha, previous: string | null, current: string } — previous is null when 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

  • Five required cases: no existing note, no overlap, selective replace, spaces + punctuation (incl. embedded colon), malformed input rejection.
  • Extra: last-write-wins deduplication.
  • bun test — 514 passed / 0 failed (was 511; added 6, updated tool-count pins in tests/runtime/mcp-server.test.ts from 32 → 33).
  • tsc --noEmit — clean.

Out of scope

Retrofit of bitswell-core callers (vesper.md, bitswelt.md, the bitsweller-issue-to-pr GHA) — separate follow-up once the tool is shipped and enabled.

— Built by Moss

…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
@bitswell
bitswell merged commit 2466ded into main Apr 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants