Skip to content

feat(tugasna): sawala tugasna canvas — project documents as markdown (TUG-176 M9) - #103

Merged
sutisnamulyana merged 1 commit into
mainfrom
tugasna-canvas-cli
Aug 7, 2026
Merged

feat(tugasna): sawala tugasna canvas — project documents as markdown (TUG-176 M9)#103
sutisnamulyana merged 1 commit into
mainfrom
tugasna-canvas-cli

Conversation

@sutisnamulyana

Copy link
Copy Markdown
Member

Completes the loop the canvas storage format was chosen for.

Plan: sawala-cloud/docs/plan/tugasna/PLAN-tugasna-canvas.md · Tracks TUG-176. Backend: core#486 (merged + deployed). Dashboard: ui#554, ui#555.

The point of it

A canvas is a long-form markdown document belonging to a project, not a task. Storing it as markdown only pays off if you can get it out and back:

sawala tugasna canvas pull <canvasId> -o spec.md
# edit with anything — an editor, a script, a coding agent
sawala tugasna canvas push <canvasId> -f spec.md

That makes a canvas a machine-readable specification attached to a work item — point an agent at a ticket's document and it can implement against the acceptance criteria the ticket is actually judged on.

Two things done deliberately

pull / push take raw text, not JSON. They're the only commands in tugasna.ts that don't go through resolveInputPayload (which parses JSON). pull writes only the document to stdout and puts id/revision/title on stderr, so canvas pull <id> > spec.md yields a clean file.

push is guarded by default. It reads the current revision and sends it as expectedRevision, so an unattended push is refused rather than silently clobbering a concurrent edit. --force skips both the read and the guard — one round trip, and you mean it.

The full surface

list (tri-state --folder: omit = whole project, root = unfiled, id = that folder), create, get, pull, push, move, link, unlink, links, history, restore, delete, plus a folder sub-group (create, rename, move, delete) over the three-level tree.

Two prompts carry the distinction the whole design rests on:

  • unlink — "The document stays in the project."
  • delete — reports how many references will be removed with it, read from links first.

Verification

  • 165/165 tests green, 12 new (tugasna 22 → 34). Covers: pull writing to a file while keeping stdout clean, push reading and sending the current revision, push --force omitting it and skipping the extra round trip, --dry-run issuing no write, unlink refusing without --yes on a non-TTY, and folder nesting.
  • tsc --noEmit clean, lint clean.
  • Skill docs updated: SKILL.md plus a new references/canvas.md covering the pull/edit/push loop, many-to-many referencing, history semantics and folders.
  • Changeset included — without one this merges but never publishes.

Not verified

No command has been run against the live API from this branch. The endpoints are deployed and exercised by the dashboard, but the CLI paths themselves are covered by mocked-fetch tests only. Worth one real pull → edit → push after publish.

…(TUG-176, M9)

Completes the loop the storage format was chosen for: a canvas can be pulled to
a .md file, edited with ordinary tools or read by a coding agent as a
specification, and pushed back.

    sawala tugasna canvas pull <canvasId> -o spec.md
    sawala tugasna canvas push <canvasId> -f spec.md

`pull` and `push` are the only commands in this file whose payload is RAW TEXT
rather than JSON — deliberately not resolveInputPayload, which parses JSON.
`pull` writes only the document to stdout and puts id/revision/title on stderr,
so `canvas pull <id> > spec.md` is safe in a pipeline.

`push` reads the current revision first and sends it as expectedRevision, so an
unattended push is still guarded against a concurrent edit rather than silently
clobbering it. `--force` skips both the read and the guard.

Also: list (tri-state --folder), create, get, move, link, unlink, links,
history, restore, delete, and a folder sub-group over the three-level tree.

Two prompts carry the distinction the whole design rests on: `unlink` says the
document stays in the project, and `delete` reports how many references will be
removed with it.

12 new tests (165/165 suite green), skill docs updated with a references/canvas.md
covering the pull/edit/push loop, and a changeset — without one this ships
nothing.
@sutisnamulyana
sutisnamulyana merged commit 6edcfae into main Aug 7, 2026
1 check passed
@sutisnamulyana
sutisnamulyana deleted the tugasna-canvas-cli branch August 7, 2026 09:33
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.

1 participant