Skip to content

workspace: a chant write command for a box's listing, so hud edits it through chant instead of editing chant.workspace.json #3308

Closed

Description

@lex00

Found while doing #3146.

#3146 puts a box's listing on its box block (box.listing { published, title, line, cover }, ws-077), and chant workspace status --json / graph --json print it with the cover's sha256. That covers reading. hud's gear writes the listing today (hud packages/daemon/src/box/listing.ts, the listing and listing_cover tables), and arugula-salad/hud#729 moves it into the repo. ws-074 says a tool writes only through chant's write contract, and chant has no command that edits a field of the declaration, so hud would have to write chant.workspace.json itself.

Proposal: a narrow write command for the listing, for example chant workspace box listing set <member> [--published true|false] [--title ...] [--line ...] [--cover <file>], that edits only members[i].box.listing in the working tree (keeping the file's formatting and comments for .jsonc), validates against the declaration schema, copies the cover file to a path the command chooses or is told, prints a JSON document under a versioned write contract, and leaves the commit to the caller like the records write commands. Write scope: a change to chant.workspace.json is judged by check --changes as any other path, so a workspace that protects the declaration with writeScope.<class>.protected and except: ["members"] doesn't fit; the command may need its own scope rule or a narrower allowance (by JSON pointer rather than top-level key).

Done when hud's gear can set the listing and cover with one chant call and the amnesia test in #3159 keeps the listing.

Activity

  1. added
    enhancement
    area:workspace
    boundaries
    on Oct 3, 2026
  2. lex00 commented on Oct 3, 2026

    @lex00
    ContributorAuthor

    Design as built on branch ws-3308-listing-write.

    Command: chant workspace box listing set <member> [--from <file|->] [--cover <image> [--cover-path <path>]] [--by <principal>] [--dry-run] [--json]. The fields come as one JSON object on --from (published, title, line, cover, and x- keys). A field left out keeps its value and null takes it out. I left out per-field flags such as --title because JSON on stdin is what every other write-contract command takes, and it avoids quoting problems for a caller that passes user text.

    Editing: only the listing's own properties change, in place. The file keeps its indentation, key order, line endings and, in a .jsonc, its comments and trailing commas. A new listing goes after the box block's last property. The edited text is parsed again and compared with the intended value before anything is written, and the result is validated with the declaration schema (a 61-character title is refused with write-input-invalid). The member must already declare a box block (listing-box-missing otherwise). minReader is not raised, so the write never touches a top-level key.

    Cover: --cover copies a PNG, JPEG or WebP (told by magic bytes, at most 5 MiB) to --cover-path, else to the listing's current cover when the extension fits, else to <member dir>/listing/cover.<ext>. A cover that moves leaves the old file in place and names it in cover.replaced for the caller to remove in the same commit. A cover string field points at a picture already in the workspace.

    Write scope: the declaration and the cover are each judged with judgePath against the declaration and trust policy at base, the same rule check --changes applies to the commit later. So a protected chant.workspace.json refuses the write with write-scope-protected unless its except allows it, and except now also takes JSON Pointers with * tokens: { "path": "chant.workspace.json", "except": ["/members/*/box/listing"] }. That is the narrower allowance this issue asked for, and it also applies in check --changes. An agent session is refused with write-scope-member, since the declaration sits in no member and a session writes only its own. --by goes through the identity rule (principal-unidentified for a bare name under identity.attribution: "identified").

    Output: box-listing-write.schema.json ($id https://intentius.io/chant/schemas/workspace/box-listing-write/v1/box-listing-write.schema.json): member, declaration { path, sha256 }, paths (every file changed, from the repo root), changed, dryRun, previous and listing (as status --json prints them), and cover { path, sha256, bytes, type, replaced }. New closed codes: listing-member-unknown, listing-box-missing, listing-cover-invalid. It never commits.

    Writer conformance: box listing set is a write-contract action. The script sets the app box's listing with a cover the suite writes outside the workspace, the reference writer's facts include the listings status dev --json prints, and the read-back compares them, so the amnesia test keeps the listing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:workspaceboundariesenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions