@bigmistqke/workpad 0.0.0-stage → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +781 -2
- package/bin/workpad.ts +1509 -0
- package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
- package/dist/bin/workpad.js +1190 -0
- package/dist/client/runtime.js +1194 -0
- package/dist/define.js +27 -0
- package/dist/plugins/alert/README.md +18 -0
- package/dist/plugins/alert/index.js +40 -0
- package/dist/plugins/alert/public/style.css +40 -0
- package/dist/plugins/ansi/README.md +36 -0
- package/dist/plugins/ansi/index.js +63 -0
- package/dist/plugins/ansi/public/style.css +28 -0
- package/dist/plugins/badge/README.md +32 -0
- package/dist/plugins/badge/index.js +28 -0
- package/dist/plugins/badge/public/style.css +30 -0
- package/dist/plugins/chat/README.md +81 -0
- package/dist/plugins/chat/index.js +96 -0
- package/dist/plugins/chat/public/client.js +3 -0
- package/dist/plugins/chat/public/style.css +143 -0
- package/dist/plugins/claude/README.md +116 -0
- package/dist/plugins/claude/channel.js +130 -0
- package/dist/plugins/claude/doctor.js +316 -0
- package/dist/plugins/claude/index.js +199 -0
- package/dist/plugins/claude/session.js +68 -0
- package/dist/plugins/code/README.md +54 -0
- package/dist/plugins/code/diff.js +75 -0
- package/dist/plugins/code/index.js +105 -0
- package/dist/plugins/code/public/client.js +1 -0
- package/dist/plugins/code/public/style.css +99 -0
- package/dist/plugins/comments/README.md +30 -0
- package/dist/plugins/comments/index.js +39 -0
- package/dist/plugins/comments/public/client.js +24 -0
- package/dist/plugins/comments/public/style.css +224 -0
- package/dist/plugins/details/README.md +24 -0
- package/dist/plugins/details/index.js +28 -0
- package/dist/plugins/details/public/style.css +7 -0
- package/dist/plugins/draft/README.md +14 -0
- package/dist/plugins/draft/index.js +27 -0
- package/dist/plugins/draft/public/style.css +21 -0
- package/dist/plugins/forge/README.md +22 -0
- package/dist/plugins/forge/index.js +83 -0
- package/dist/plugins/form/README.md +126 -0
- package/dist/plugins/form/index.js +179 -0
- package/dist/plugins/form/public/style.css +172 -0
- package/dist/plugins/grid/README.md +45 -0
- package/dist/plugins/grid/index.js +35 -0
- package/dist/plugins/grid/public/style.css +98 -0
- package/dist/plugins/iframe/README.md +18 -0
- package/dist/plugins/iframe/index.js +49 -0
- package/dist/plugins/iframe/public/style.css +28 -0
- package/dist/plugins/index.js +44 -0
- package/dist/plugins/lightbox/README.md +24 -0
- package/dist/plugins/lightbox/index.js +20 -0
- package/dist/plugins/lightbox/public/client.js +4 -0
- package/dist/plugins/lightbox/public/style.css +66 -0
- package/dist/plugins/mermaid/README.md +21 -0
- package/dist/plugins/mermaid/index.js +42 -0
- package/dist/plugins/mermaid/public/style.css +21 -0
- package/dist/plugins/opencode/README.md +48 -0
- package/dist/plugins/opencode/channel.js +92 -0
- package/dist/plugins/opencode/index.js +64 -0
- package/dist/plugins/opencode/shim.js +150 -0
- package/dist/plugins/quiet/README.md +26 -0
- package/dist/plugins/quiet/index.js +23 -0
- package/dist/plugins/tabs/README.md +44 -0
- package/dist/plugins/tabs/index.js +75 -0
- package/dist/plugins/tabs/public/client.js +1 -0
- package/dist/plugins/tabs/public/style.css +98 -0
- package/dist/plugins/terminal/README.md +63 -0
- package/dist/plugins/terminal/host.js +338 -0
- package/dist/plugins/terminal/index.js +170 -0
- package/dist/plugins/terminal/modes.js +32 -0
- package/dist/plugins/terminal/public/client.js +41 -0
- package/dist/plugins/terminal/public/style.css +511 -0
- package/dist/plugins/terminal/server.js +256 -0
- package/dist/plugins/terminal/sizes.js +58 -0
- package/dist/plugins/timeline/README.md +48 -0
- package/dist/plugins/timeline/index.js +83 -0
- package/dist/plugins/timeline/public/style.css +138 -0
- package/dist/plugins/toc/README.md +40 -0
- package/dist/plugins/toc/index.js +29 -0
- package/dist/plugins/toc/public/client.js +1 -0
- package/dist/plugins/toc/public/style.css +117 -0
- package/dist/plugins/window/README.md +51 -0
- package/dist/plugins/window/index.js +91 -0
- package/dist/solid/index.js +41 -0
- package/dist/src/agents.js +81 -0
- package/dist/src/anchors.js +52 -0
- package/dist/src/api.js +282 -0
- package/dist/src/archive.js +49 -0
- package/dist/src/auth.js +67 -0
- package/dist/src/build.js +159 -0
- package/dist/src/client/page/base.css +1762 -0
- package/dist/src/client/page/main.js +2098 -0
- package/dist/src/config.js +76 -0
- package/dist/src/document.js +93 -0
- package/dist/src/entries.js +264 -0
- package/dist/src/events.js +322 -0
- package/dist/src/files.js +47 -0
- package/dist/src/formstate.js +65 -0
- package/dist/src/help.js +211 -0
- package/dist/src/html.js +34 -0
- package/dist/src/hub.js +341 -0
- package/dist/src/icons.js +6 -0
- package/dist/src/listen.js +132 -0
- package/dist/src/listeners.js +64 -0
- package/dist/src/load.js +81 -0
- package/dist/src/loader.js +179 -0
- package/dist/src/migrate.js +314 -0
- package/dist/src/package.js +52 -0
- package/dist/src/pages/blocks.js +67 -0
- package/dist/src/pages/board.js +59 -0
- package/dist/src/pages/index.js +27 -0
- package/dist/src/pages/markdown.js +863 -0
- package/dist/src/pages/render.js +665 -0
- package/dist/src/pages/window.js +29 -0
- package/dist/src/plugins.js +283 -0
- package/dist/src/public.js +24 -0
- package/dist/src/rename.js +130 -0
- package/dist/src/running.js +146 -0
- package/dist/src/serve.js +188 -0
- package/dist/src/server.js +1105 -0
- package/dist/src/site.js +179 -0
- package/dist/src/state.js +155 -0
- package/dist/src/status.js +323 -0
- package/dist/src/thread.js +68 -0
- package/dist/src/watchdog.js +38 -0
- package/dist/src/ws.js +128 -0
- package/package.json +154 -4
- package/plugins/README.md +304 -0
- package/plugins/alert/README.md +18 -0
- package/plugins/alert/index.ts +50 -0
- package/plugins/alert/public/style.css +40 -0
- package/plugins/ansi/README.md +36 -0
- package/plugins/ansi/index.ts +95 -0
- package/plugins/ansi/public/style.css +28 -0
- package/plugins/badge/README.md +32 -0
- package/plugins/badge/index.ts +36 -0
- package/plugins/badge/public/style.css +30 -0
- package/plugins/chat/README.md +81 -0
- package/plugins/chat/autosize.ts +139 -0
- package/plugins/chat/client.tsx +187 -0
- package/plugins/chat/index.ts +146 -0
- package/plugins/chat/public/style.css +143 -0
- package/plugins/claude/README.md +116 -0
- package/plugins/claude/channel.ts +136 -0
- package/plugins/claude/doctor.ts +274 -0
- package/plugins/claude/index.ts +248 -0
- package/plugins/claude/session.ts +70 -0
- package/plugins/code/README.md +54 -0
- package/plugins/code/client.ts +73 -0
- package/plugins/code/diff.ts +96 -0
- package/plugins/code/index.ts +136 -0
- package/plugins/code/public/style.css +99 -0
- package/plugins/comments/README.md +30 -0
- package/plugins/comments/client.ts +723 -0
- package/plugins/comments/index.ts +48 -0
- package/plugins/comments/public/style.css +224 -0
- package/plugins/details/README.md +24 -0
- package/plugins/details/index.ts +30 -0
- package/plugins/details/public/style.css +7 -0
- package/plugins/draft/README.md +14 -0
- package/plugins/draft/index.ts +23 -0
- package/plugins/draft/public/style.css +21 -0
- package/plugins/forge/README.md +22 -0
- package/plugins/forge/index.ts +84 -0
- package/plugins/form/README.md +126 -0
- package/plugins/form/index.ts +199 -0
- package/plugins/form/public/style.css +172 -0
- package/plugins/grid/README.md +45 -0
- package/plugins/grid/index.ts +41 -0
- package/plugins/grid/public/style.css +98 -0
- package/plugins/iframe/README.md +18 -0
- package/plugins/iframe/index.ts +53 -0
- package/plugins/iframe/public/style.css +28 -0
- package/plugins/index.ts +49 -0
- package/plugins/lightbox/README.md +24 -0
- package/plugins/lightbox/client.ts +109 -0
- package/plugins/lightbox/index.ts +25 -0
- package/plugins/lightbox/public/style.css +66 -0
- package/plugins/mermaid/README.md +21 -0
- package/plugins/mermaid/index.ts +46 -0
- package/plugins/mermaid/public/style.css +21 -0
- package/plugins/opencode/README.md +48 -0
- package/plugins/opencode/channel.ts +112 -0
- package/plugins/opencode/index.ts +91 -0
- package/plugins/opencode/shim.ts +166 -0
- package/plugins/quiet/README.md +26 -0
- package/plugins/quiet/index.ts +28 -0
- package/plugins/tabs/README.md +44 -0
- package/plugins/tabs/client.ts +96 -0
- package/plugins/tabs/index.ts +103 -0
- package/plugins/tabs/public/style.css +98 -0
- package/plugins/terminal/README.md +63 -0
- package/plugins/terminal/client.ts +391 -0
- package/plugins/terminal/host.ts +434 -0
- package/plugins/terminal/index.ts +199 -0
- package/plugins/terminal/modes.ts +30 -0
- package/plugins/terminal/public/style.css +225 -0
- package/plugins/terminal/server.ts +266 -0
- package/plugins/terminal/sizes.ts +72 -0
- package/plugins/timeline/README.md +48 -0
- package/plugins/timeline/index.ts +82 -0
- package/plugins/timeline/public/style.css +138 -0
- package/plugins/toc/README.md +40 -0
- package/plugins/toc/client.ts +236 -0
- package/plugins/toc/index.ts +55 -0
- package/plugins/toc/public/style.css +117 -0
- package/plugins/window/README.md +51 -0
- package/plugins/window/index.ts +92 -0
- package/skills/workpad/SKILL.md +588 -0
- package/solid/index.tsx +80 -0
- package/src/agents.ts +133 -0
- package/src/anchors.ts +85 -0
- package/src/api.ts +444 -0
- package/src/archive.ts +75 -0
- package/src/auth.ts +99 -0
- package/src/build.ts +213 -0
- package/src/client/base.ts +19 -0
- package/src/client/forms.ts +420 -0
- package/src/client/markdown.ts +147 -0
- package/src/client/page/base.css +1762 -0
- package/src/client/page/board.ts +137 -0
- package/src/client/page/elsewhere.ts +153 -0
- package/src/client/page/fresh.ts +343 -0
- package/src/client/page/heading-link.ts +32 -0
- package/src/client/page/live.ts +134 -0
- package/src/client/page/main.ts +398 -0
- package/src/client/page/orphans.ts +64 -0
- package/src/client/page/place.ts +260 -0
- package/src/client/page/sort.ts +49 -0
- package/src/client/page/sticky.ts +58 -0
- package/src/client/page/theme.ts +36 -0
- package/src/client/page/view.ts +9 -0
- package/src/client/page/waiting.ts +278 -0
- package/src/client/page/window.ts +40 -0
- package/src/client/reactive.ts +19 -0
- package/src/client/read.ts +111 -0
- package/src/client/runtime.ts +499 -0
- package/src/client/scroll.ts +90 -0
- package/src/client/toast.ts +99 -0
- package/src/config.ts +111 -0
- package/src/define.ts +997 -0
- package/src/document.ts +191 -0
- package/src/entries.ts +352 -0
- package/src/events.ts +463 -0
- package/src/files.ts +74 -0
- package/src/formstate.ts +72 -0
- package/src/help.ts +238 -0
- package/src/html.ts +44 -0
- package/src/hub.ts +426 -0
- package/src/icons.ts +18 -0
- package/src/listen.ts +171 -0
- package/src/listeners.ts +89 -0
- package/src/load.ts +113 -0
- package/src/loader.ts +227 -0
- package/src/migrate.ts +352 -0
- package/src/package.ts +62 -0
- package/src/pages/blocks.ts +106 -0
- package/src/pages/board.ts +89 -0
- package/src/pages/index.ts +79 -0
- package/src/pages/markdown.ts +976 -0
- package/src/pages/render.ts +748 -0
- package/src/pages/window.ts +69 -0
- package/src/plugins.ts +319 -0
- package/src/public.ts +39 -0
- package/src/rename.ts +147 -0
- package/src/running.ts +171 -0
- package/src/serve.ts +221 -0
- package/src/server.ts +1385 -0
- package/src/site.ts +170 -0
- package/src/state.ts +327 -0
- package/src/status.ts +466 -0
- package/src/thread.ts +98 -0
- package/src/watchdog.ts +53 -0
- package/src/ws.ts +155 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workpad
|
|
3
|
+
description: Show the user a live HTML page written in markdown, and get answers back through forms on it. Use when an explanation, plan, comparison, status overview or set of open questions would read better as a page than as terminal text; when the user has to re-ask about something explained earlier (put it on a page they can keep open); when work is long-running and the user needs an overview of what is pending, running and done; or when you need decisions from the user that you can wait on while they read; or when several agents should work on one board together.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# workpad
|
|
7
|
+
|
|
8
|
+
Pages are markdown files. In a repository set up for workpad they live in
|
|
9
|
+
`.workpad/pages/` and are served by the project's server, at the address
|
|
10
|
+
`workpad show` prints: the project's own, or one server the user runs for
|
|
11
|
+
many projects (their worktrees and job folders), under the project's path. The user keeps them open in a browser; every save
|
|
12
|
+
of the file updates the open page in place, and the blocks that changed are
|
|
13
|
+
marked until the user has seen them. Forms on a page write the user's answers
|
|
14
|
+
to an ndjson log, from where they come to you.
|
|
15
|
+
|
|
16
|
+
The commands below are written as `workpad …`. When that is not on the
|
|
17
|
+
PATH, the project has it installed locally: run them as `npx workpad …`.
|
|
18
|
+
`workpad <command> --help` says what any command takes and does (the
|
|
19
|
+
project's plugins' commands too) and runs nothing; `workpad help` lists
|
|
20
|
+
them all.
|
|
21
|
+
|
|
22
|
+
## Writing a page
|
|
23
|
+
|
|
24
|
+
1. Run `workpad docs` once per session and read it: how pages are written
|
|
25
|
+
in this project, and a line per block under what you'd want it for (ask,
|
|
26
|
+
show, arrange, mark). Then `workpad docs <block>` for each block you
|
|
27
|
+
will use: its syntax, and what its events mean. Do not rely on memory for
|
|
28
|
+
block syntax; the set differs per project. If it says there is no
|
|
29
|
+
project, ask the user before running `workpad init`: it adds a folder
|
|
30
|
+
to their repository.
|
|
31
|
+
2. Run `workpad new <topic>` (subfolders are fine: `task/plan`). It
|
|
32
|
+
creates an empty page with a name no other page has, `<topic>` or else
|
|
33
|
+
`<topic>-2` and so on, and prints its path. That file is yours: other
|
|
34
|
+
agents may be writing pages in the same project, so never write a page you
|
|
35
|
+
did not get from `workpad new`, and never pick a page name yourself.
|
|
36
|
+
3. Write the page into that file.
|
|
37
|
+
4. Run `workpad show <file>`: it starts the project's server if needed and
|
|
38
|
+
prints the URL. Give the user the URL the first time; after that, just
|
|
39
|
+
keep editing the file — the open page follows. When the project is served
|
|
40
|
+
by the user's shared server and that isn't running, `show` says so and
|
|
41
|
+
starts nothing: tell the user, don't try to start it yourself (it is started outside your sandbox). Should a command say it `cannot read` workpad's config, your sandbox lacks a grant for it: tell the user, rather than working around it. A `listen` meanwhile still works: it waits
|
|
42
|
+
for the server, and answers in the log reach it either way.
|
|
43
|
+
5. Run `workpad check <file>` after each round of writing: it lists what
|
|
44
|
+
is wrong as the page renders (a block nobody brings, a form's input
|
|
45
|
+
outside its form because a block inside it is one colon short, a
|
|
46
|
+
diagram that doesn't parse, an attribute a block doesn't read, a link to
|
|
47
|
+
an anchor that isn't there) and exits 1. Fix what it says before telling
|
|
48
|
+
the user the page is ready; the page shows the same above it. After
|
|
49
|
+
workpad is updated to a release that changed the syntax, `workpad
|
|
50
|
+
migrate` lists the pages written the old way and `workpad migrate
|
|
51
|
+
--write` rewrites them; then `workpad check`.
|
|
52
|
+
6. A page that has done its job, once you've acted on its answers:
|
|
53
|
+
`workpad archive <file>`. It leaves the pages and its events leave the
|
|
54
|
+
log, so it doesn't linger in the overview or in `workpad status`, but
|
|
55
|
+
it is kept in `.workpad/archive/` as markdown with what was answered on
|
|
56
|
+
it (each form's answers, the chats, the comments). A throwaway page (a
|
|
57
|
+
check, a demo, nothing answered worth keeping): `workpad destroy
|
|
58
|
+
<file>`, which keeps nothing. Keep pages the user may come back to
|
|
59
|
+
(plans, reviews, decisions); archive or destroy only your own, and ask
|
|
60
|
+
when unsure.
|
|
61
|
+
|
|
62
|
+
Never edit `.workpad/events.ndjson` yourself: an answer arriving while you
|
|
63
|
+
write it is lost, and running listens stumble over it. To change what you wrote
|
|
64
|
+
(a chat message, a reply), use `workpad edit <event id> --data <json>`: it
|
|
65
|
+
merges into the event's data, keeps its id, and the open page shows the new
|
|
66
|
+
version. To clear a page's history and keep the page, `workpad prune
|
|
67
|
+
<file>` (all its events: its questions are open again), with `--type <type>`
|
|
68
|
+
for one kind (`chat:message`) or `--id <event id>` for one. You can edit only
|
|
69
|
+
your own events: what the user sent stays as they sent it.
|
|
70
|
+
|
|
71
|
+
When you take a question off a page for good (you acted on its answer and
|
|
72
|
+
removed the form, or removed a chat block), remove its chat too:
|
|
73
|
+
`workpad chat prune <file> <name>`. Otherwise its messages stay behind,
|
|
74
|
+
in a folded list of chats no longer on the page.
|
|
75
|
+
|
|
76
|
+
Files that already exist in the repository render too: `workpad show
|
|
77
|
+
README.md` (any path in the project) gives a URL that renders that file, and
|
|
78
|
+
relative links in it lead to the other files they name (unless the config
|
|
79
|
+
sets `files: false`, as a project in the home folder does). Link to existing
|
|
80
|
+
documents and code from your pages with relative paths instead of copying
|
|
81
|
+
them.
|
|
82
|
+
|
|
83
|
+
### Show, don't tell
|
|
84
|
+
|
|
85
|
+
Prose is good at what only prose does: a reason, a trade-off, a nuance,
|
|
86
|
+
the thread that ties a page together. It turns into noise when it carries
|
|
87
|
+
what a picture or a structure would show at a glance: an order, a
|
|
88
|
+
relation, a state, a comparison. So notice what a passage is really
|
|
89
|
+
carrying, and take the first form that carries that:
|
|
90
|
+
|
|
91
|
+
1. **How something looks**: an image, a screenshot.
|
|
92
|
+
2. **A change**, where it comes from and where it goes: two pictures,
|
|
93
|
+
before → after.
|
|
94
|
+
3. **A choice between versions**: a picture each, side by side or in
|
|
95
|
+
`tabs`.
|
|
96
|
+
4. **What happens after what**: a sequence diagram, a `timeline`.
|
|
97
|
+
5. **What something can be, and what moves it on**: a state diagram.
|
|
98
|
+
Many problems hide one: "once", "until", "while", "again" are its
|
|
99
|
+
transitions.
|
|
100
|
+
6. **What holds, calls, depends on or flows into what**, a choice
|
|
101
|
+
between paths: a flowchart.
|
|
102
|
+
7. **Several items with the same parts**: a table, a `grid`.
|
|
103
|
+
8. **A reason, a trade-off, a nuance**: prose.
|
|
104
|
+
|
|
105
|
+
Prose is also the glue: it makes the pictures a story. A line before a
|
|
106
|
+
diagram or a table says what to look for in it; a line after says what it
|
|
107
|
+
means, and leads to the next. Without that, a page is a stack of figures.
|
|
108
|
+
|
|
109
|
+
Put depth the first view doesn't need in `:::details`, but only depth:
|
|
110
|
+
a page that is all folds hides as much as one that is all prose.
|
|
111
|
+
|
|
112
|
+
Content of one kind gets one form, the problems included: the names that
|
|
113
|
+
don't fit go in the same table as those that do, with a column that marks
|
|
114
|
+
them.
|
|
115
|
+
|
|
116
|
+
When you rework a page into this shape, keep every fact; change only
|
|
117
|
+
where it sits. And in a message (a chat reply, your summary in the
|
|
118
|
+
terminal), link to the section or form instead of retelling it.
|
|
119
|
+
|
|
120
|
+
### The page is the Now
|
|
121
|
+
|
|
122
|
+
A page shows where things stand, not how they got there. When something
|
|
123
|
+
supersedes part of a page (a chat reply settles a question, a comment
|
|
124
|
+
changes the plan, the user decides in the terminal), rework the page in the
|
|
125
|
+
same turn, before you end it:
|
|
126
|
+
|
|
127
|
+
- **Replace** the text it supersedes. Don't append "Update:" under the old
|
|
128
|
+
version: the reader would have to work out which one holds.
|
|
129
|
+
- **Close the questions it made moot**: say in its chat what settled it,
|
|
130
|
+
then `workpad settle <file> <form>`; or, when it waits on something
|
|
131
|
+
else, `workpad hold <file> <form> "<what it waits for>"`. Take a form
|
|
132
|
+
off the page for good with its chat (`workpad chat prune`).
|
|
133
|
+
- **Re-cut the outline** to the design as it is now: decided things read as
|
|
134
|
+
decisions, open ones as questions, and sections that argue with each
|
|
135
|
+
other become one. A page whose shape is the order of the conversation
|
|
136
|
+
(settled questions on top, the current idea at the bottom) tells the
|
|
137
|
+
reader the wrong thing first.
|
|
138
|
+
- **Fold the path** into one `:::details[How we got here]` at the end: the
|
|
139
|
+
options weighed and why each went, in a few lines, not the transcript.
|
|
140
|
+
|
|
141
|
+
Keep every fact, as above: only where it sits changes. In your reply in the
|
|
142
|
+
chat, link the section you changed instead of retelling it.
|
|
143
|
+
|
|
144
|
+
### Write for a reader who comes back later
|
|
145
|
+
|
|
146
|
+
- Lead with the state of things; put depth in `:::details[…]` blocks so the
|
|
147
|
+
page stays scannable.
|
|
148
|
+
- Update your page rather than starting a new one for the same topic; changed
|
|
149
|
+
blocks are highlighted for the user, unchanged ones stay quiet.
|
|
150
|
+
- Put the things you need from the user in forms, one form per decision, each
|
|
151
|
+
with a distinct name (no colon: those are reserved for event types like
|
|
152
|
+
`chat:message`). A form is markdown with its inputs inline (see the
|
|
153
|
+
form plugin's docs). When the options need explaining, explain them in
|
|
154
|
+
the form, each option with its meaning right under it, not in a section
|
|
155
|
+
above it: the user decides where they read. Keep `:::details` for real
|
|
156
|
+
depth, not for the options.
|
|
157
|
+
- A send is a choice, and only that. Questions and remarks about a form go
|
|
158
|
+
in the chat under it (`chat:message` events, see the chat plugin's docs):
|
|
159
|
+
answer them there, and never read a chat message, or a note sent along
|
|
160
|
+
with a submit, as a choice. Don't add a notes field to a form; its chat is
|
|
161
|
+
for that. When the user may want an answer you didn't list, add an option
|
|
162
|
+
for it, `:radio[Other]{name=… other}`: it has a text box, and sends what
|
|
163
|
+
they typed.
|
|
164
|
+
- Every page ends with a chat, `page`, where the user asks what is about
|
|
165
|
+
none of its questions: answer there as in any chat
|
|
166
|
+
(`--data '{"chat":"page","text":"…"}'`). For talk about one part of a
|
|
167
|
+
page, put a chat there: `:::chat{name=…}`, in its section. It is the same
|
|
168
|
+
chat as under a form, without the question.
|
|
169
|
+
- Your chat messages are small pages: write them as you write a page, with
|
|
170
|
+
any block. When a question comes up in a chat (a choice the reader
|
|
171
|
+
should make, an answer you settled on together), ask it right there, as
|
|
172
|
+
a form in your message: `:::form{name=scope}` in the chat `logger` is the
|
|
173
|
+
question `logger/scope`, listened for and handled like one on the page. A
|
|
174
|
+
form with a single `:button[…]` is a one-press answer. Rework a message
|
|
175
|
+
with `workpad edit <id> --data '{"text":"…"}'`; its form keeps its
|
|
176
|
+
answers while it keeps its name.
|
|
177
|
+
- When a question is settled without its form (a chat reached the answer,
|
|
178
|
+
the design moved past it), settle it, so it doesn't stay "unanswered" for
|
|
179
|
+
good: say in its chat what settled it, then `workpad settle <file>
|
|
180
|
+
<form>`. `workpad settle <file> --all` settles every open question on the
|
|
181
|
+
page. A settled form counts nowhere; if the user answers it after all, it
|
|
182
|
+
is open again.
|
|
183
|
+
- When a question can't be answered yet because it waits on something else
|
|
184
|
+
(another merge request, a decision elsewhere), hold it rather than
|
|
185
|
+
settle it: `workpad hold <file> <form> "waits for !2145"`. The form
|
|
186
|
+
shows held, with the reason; it counts nowhere as waiting for the user
|
|
187
|
+
(status, the page's counter, the turn-end check, the overview), and it
|
|
188
|
+
isn't settled: once what it waits for is there, `workpad release
|
|
189
|
+
<file> <form>` opens it again. An answer the user gives after all ends
|
|
190
|
+
the hold.
|
|
191
|
+
- When a question changes, rework it inside its form and keep the form's
|
|
192
|
+
name. The chat belongs to the form by name: replace or rename the form and
|
|
193
|
+
its chat moves to the end of the page, away from the question.
|
|
194
|
+
- Don't number headings yourself (`### 1. Naming`): the page
|
|
195
|
+
numbers section headings already, so yours would show twice. Refer to a
|
|
196
|
+
section by its name.
|
|
197
|
+
- When you only repeat back what the user answered, or update a status line
|
|
198
|
+
or timestamp, put it in `:::quiet` (if the project's docs list it): changed
|
|
199
|
+
blocks are marked for the user, and an echo of their own answer is not
|
|
200
|
+
news. Anything they need to read (a question back, a different reading of
|
|
201
|
+
their answer, a new explanation) stays outside it.
|
|
202
|
+
|
|
203
|
+
Plain markdown, GFM tables, `<details>` and a raw `<form name="…">` work
|
|
204
|
+
without any block. An unknown `:::name` block still renders its content, so
|
|
205
|
+
a typo never breaks the page.
|
|
206
|
+
|
|
207
|
+
**Items:** a grid, tabs and a timeline take their items (cards, tabs,
|
|
208
|
+
steps) as containers, `:::item[Title]`, the title its label
|
|
209
|
+
(`:::item[Parser :badge[done]]`, a badge ending it sits at its right); an
|
|
210
|
+
item without a label is untitled. Headings and `---` don't start an item:
|
|
211
|
+
inside one they are its content, at any level. A `:::form[Title]` or a
|
|
212
|
+
`:::details[Title]` directly in the block is an item as it is, never wrapped
|
|
213
|
+
in `:::item`. The block takes one colon more than its items:
|
|
214
|
+
|
|
215
|
+
```markdown
|
|
216
|
+
::::grid{cols=2}
|
|
217
|
+
:::item[Parser :badge[done]]
|
|
218
|
+
Rewritten, all tests pass.
|
|
219
|
+
:::
|
|
220
|
+
|
|
221
|
+
:::form[Docs :badge[todo]]{name=docs chat=false}
|
|
222
|
+
Start on them? :button[Start it]
|
|
223
|
+
:::
|
|
224
|
+
::::
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Nesting containers:** the outer fence needs more colons than anything
|
|
228
|
+
inside it, `::::grid` around `:::item`. A `:::` closes the first open
|
|
229
|
+
container whose fence is no longer than its own, so with equal colons the
|
|
230
|
+
inner close ends the outer block too. This also counts lines of colons inside
|
|
231
|
+
a code block within a container: a code example containing `::::` needs a
|
|
232
|
+
container of at least five.
|
|
233
|
+
|
|
234
|
+
## Showing the page beside the conversation
|
|
235
|
+
|
|
236
|
+
Open the page in a browser next to your pane instead of only printing the URL.
|
|
237
|
+
The user then reads the page and talks to you side by side. Do this the first
|
|
238
|
+
time you show a page in a session, or when the user asks to see one. Which
|
|
239
|
+
browser depends on where you run: in workpad's own terminal drawer, the
|
|
240
|
+
page around it; in cmux, its own browser pane; in herdr, terminal-browser.
|
|
241
|
+
|
|
242
|
+
### In workpad's terminal drawer
|
|
243
|
+
|
|
244
|
+
When you run in a tab of the terminal drawer at the bottom of the user's
|
|
245
|
+
workpad pages (`WORKPAD_TERMINAL` is set, or the user says so), the
|
|
246
|
+
browser is right there:
|
|
247
|
+
|
|
248
|
+
```sh
|
|
249
|
+
workpad terminal open <file> # the browser tab the user is in goes to that page; the drawer comes along
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
It works without `WORKPAD_TERMINAL` too (a sandbox may filter it out):
|
|
253
|
+
then it uses the drawer the user used last.
|
|
254
|
+
|
|
255
|
+
It replaces the page the user is looking at, so open a page when they asked
|
|
256
|
+
to see it or when you just wrote it for them, not while they read another.
|
|
257
|
+
|
|
258
|
+
**One browser pane, a tab per page.** The first page opens a browser pane to
|
|
259
|
+
the right of yours; every later page opens as a new tab in that same pane, not
|
|
260
|
+
in another pane or workspace. Later edits to a page show up in its tab by
|
|
261
|
+
themselves, so open each page once.
|
|
262
|
+
|
|
263
|
+
### In cmux
|
|
264
|
+
|
|
265
|
+
When `CMUX_WORKSPACE_ID` is set, you run in cmux, and its browser pane is a
|
|
266
|
+
native web view beside your terminal. The `cmux` command works from a sandbox,
|
|
267
|
+
so run it directly.
|
|
268
|
+
|
|
269
|
+
Find out whether your workspace has a browser pane already:
|
|
270
|
+
|
|
271
|
+
```sh
|
|
272
|
+
cmux tree # this workspace's panes, their surfaces (tabs) with [browser], title and URL
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
- **No browser pane yet:** `cmux browser open <url>` opens one in a split to
|
|
276
|
+
the right, without taking focus. It prints `surface=surface:N pane=pane:M`.
|
|
277
|
+
- **A browser pane already:** add the page as a tab in it, without taking
|
|
278
|
+
focus from the user's terminal:
|
|
279
|
+
|
|
280
|
+
```sh
|
|
281
|
+
cmux new-surface --type browser --pane pane:M --url <url> --focus false
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Not `cmux browser … tab new`: that moves keyboard focus into the browser,
|
|
285
|
+
away from the conversation.
|
|
286
|
+
|
|
287
|
+
- Each tab's title in `cmux tree` is the page's title: one starting with `(!n)`
|
|
288
|
+
has n forms waiting for the user.
|
|
289
|
+
- `cmux browser --surface surface:N eval '…'` (or `snapshot`, `get text`,
|
|
290
|
+
`click <css>`, `screenshot --out <file>`) works in the user's open tab, so
|
|
291
|
+
you can check how a page actually renders instead of asking. `cmux help
|
|
292
|
+
browser` lists the commands.
|
|
293
|
+
|
|
294
|
+
### In herdr
|
|
295
|
+
|
|
296
|
+
When you run inside herdr (`HERDR_ENV=1`, and `HERDR_PANE_ID` names your pane)
|
|
297
|
+
and `terminal-browser` is on the PATH, it is the browser:
|
|
298
|
+
|
|
299
|
+
```sh
|
|
300
|
+
terminal-browser new-tab <url>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
With no browser in your herdr tab yet, this opens one in a split to the right;
|
|
304
|
+
with one, it adds a tab to it. When there are several, it asks for one:
|
|
305
|
+
`terminal-browser ls` lists them with their key, and
|
|
306
|
+
`terminal-browser new-tab --browser <key> <url>` picks it.
|
|
307
|
+
|
|
308
|
+
**From a sandbox.** `terminal-browser` may be blocked inside your sandbox
|
|
309
|
+
("Operation not permitted"). herdr starts panes outside it, so run the command
|
|
310
|
+
in a short-lived pane and read what it printed:
|
|
311
|
+
|
|
312
|
+
```sh
|
|
313
|
+
herdr pane split --current --direction down --cwd "$PWD" # JSON; the new id is result.pane.pane_id
|
|
314
|
+
herdr pane run <id> 'terminal-browser new-tab <url> 2>&1; echo DONE_$((40+2))'
|
|
315
|
+
herdr pane wait-output <id> --match DONE_42 # the marker is computed, so the echoed command doesn't match it
|
|
316
|
+
herdr pane read <id> --source recent-unwrapped --format text
|
|
317
|
+
herdr pane close <id>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
- `terminal-browser ls` shows each browser's tabs and their titles: a title
|
|
321
|
+
starting with `(!n)` has n forms waiting for the user.
|
|
322
|
+
- `terminal-browser action -- snapshot` (or `eval "…"`, `click @e14`) works
|
|
323
|
+
in the user's open browser, so you can check how a page actually renders
|
|
324
|
+
instead of asking. `terminal-browser action --help` has the selectors.
|
|
325
|
+
- `herdr pane read` returns no text for a pane showing the browser itself,
|
|
326
|
+
since it draws with graphics.
|
|
327
|
+
|
|
328
|
+
### Pointing at a place on the page
|
|
329
|
+
|
|
330
|
+
`workpad scroll <file> <where>` scrolls every tab that has the page open
|
|
331
|
+
to an anchor (`form:logger`, see below), a heading (by its text), a form
|
|
332
|
+
(by its name) or any text on it, opens a
|
|
333
|
+
details around it, and lights it up a moment. Use it when you talk about a
|
|
334
|
+
part of a long page ("see the risks section"), or to bring the user to a
|
|
335
|
+
question you just added. It exits 1 when nothing on the page matches, or when
|
|
336
|
+
no tab of the page is connected now: then a tab that is open still scrolls
|
|
337
|
+
there once it is back (a background tab connects again when it is shown);
|
|
338
|
+
else `show` the page first.
|
|
339
|
+
|
|
340
|
+
### Link what you mention
|
|
341
|
+
|
|
342
|
+
When a message or a page mentions another board, a form, a chat or a
|
|
343
|
+
section, make it a link, never just its name: the user should not have to
|
|
344
|
+
go looking for it. Every heading and block a page shows has an anchor:
|
|
345
|
+
|
|
346
|
+
- a heading by its slug, as on GitHub and GitLab: `## Open questions` is
|
|
347
|
+
`#open-questions`. The slug is the heading's own words: a badge or a
|
|
348
|
+
`:when` in it is not, so `## Parser :badge[done]` is `#parser`, and the
|
|
349
|
+
link holds while the badge changes
|
|
350
|
+
- the rest as `#<type>:<name>`: `#form:logger`, `#chat:notes` (and
|
|
351
|
+
`#chat:logger` for the chat under the `logger` form), `#tab:intro`,
|
|
352
|
+
`#details:why-not-mdx`, and one chat message as `#message:<event id>`
|
|
353
|
+
|
|
354
|
+
`workpad anchors <file>` lists what a page has. `workpad url <file>
|
|
355
|
+
<anchor>` prints the link and exits 1 for an anchor the page doesn't have,
|
|
356
|
+
listing those it has. The link starts at the server's root
|
|
357
|
+
(`/rg/jobs/<job>/decisions#form:logger`), so it works however the user opens
|
|
358
|
+
the board: paste it into the message as `[the logger question](…)`.
|
|
359
|
+
`--full` prints the whole URL, for outside a board. Within the same page,
|
|
360
|
+
`[see below](#open-questions)` is enough, and within the same project a
|
|
361
|
+
relative link to the page's file works too (`decisions.md#form:logger`).
|
|
362
|
+
The page opens at the link and shows what hides it: a step that isn't
|
|
363
|
+
showing, a closed details, a form's folded chat.
|
|
364
|
+
|
|
365
|
+
## Getting answers
|
|
366
|
+
|
|
367
|
+
What you are handed is the answer alone. `workpad thread <event id>`
|
|
368
|
+
prints it with its question: the form as written under its heading (the
|
|
369
|
+
chosen options marked), every answer it got, and its chat in order. Use it
|
|
370
|
+
before acting on an answer whose question you no longer have in mind.
|
|
371
|
+
|
|
372
|
+
Each submit of a named form appends one line to the project's
|
|
373
|
+
`.workpad/events.ndjson`:
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{"id":"…","ts":"2026-…","page":"plan","type":"deploy-review","action":"Approve","data":{"notes":"…"}}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**Handle every answer you're given,** however it reached you, with **one**
|
|
380
|
+
of these, once you acted on it:
|
|
381
|
+
|
|
382
|
+
- you have something to say about it: **reply in its chat** (a comment: in
|
|
383
|
+
its thread). The reply handles it; nothing more is needed.
|
|
384
|
+
- you have nothing to say: **`workpad handled <id>`**.
|
|
385
|
+
|
|
386
|
+
Until then it counts as received, not done: you are reminded of it, it is
|
|
387
|
+
handed to you again (marked `"again": true`), and the page shows
|
|
388
|
+
"received" instead of decided. Neither needs the page changed: change it
|
|
389
|
+
only when what you did changes what it says (a plan step done, a
|
|
390
|
+
question taken off).
|
|
391
|
+
|
|
392
|
+
### Who you are, and your pages
|
|
393
|
+
|
|
394
|
+
You are an **agent** of the board, with an id: `--agent <id>`, else
|
|
395
|
+
`WORKPAD_AGENT` in the environment, else the session a plugin for your
|
|
396
|
+
agent program names (Claude Code, opencode). With none of these you are
|
|
397
|
+
unnamed: you can listen, but nothing is kept for you. What you append
|
|
398
|
+
records your id. `workpad agent` says who you are.
|
|
399
|
+
|
|
400
|
+
An id is made to be stable, not read (a session's is a long uuid). So once a
|
|
401
|
+
session, give yourself a name for what you are doing there, short, the way
|
|
402
|
+
a colleague would say it:
|
|
403
|
+
|
|
404
|
+
```sh
|
|
405
|
+
workpad agent name "logger fix"
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
The user sees it in the list of who listens on a page (the green dot in its
|
|
409
|
+
header) and in `workpad status`. Name yourself again when your work
|
|
410
|
+
changes; `workpad agent list` shows who else is on the board.
|
|
411
|
+
|
|
412
|
+
You are **subscribed** to a page you make with `workpad new`, and to one
|
|
413
|
+
you listen on with `workpad listen --page`. A subscription outlasts the
|
|
414
|
+
command: the page is yours to see to (a plugin reminds you of what is left
|
|
415
|
+
on it), and a plugin's channel brings you its answers. When the user hands
|
|
416
|
+
you a page that already exists, listen on it once and it is yours too (with
|
|
417
|
+
a confirmed channel, `workpad listen --channel --page <file>`, which
|
|
418
|
+
exits at once). Never make a copy of it with `workpad new` instead.
|
|
419
|
+
|
|
420
|
+
### Answers come to you
|
|
421
|
+
|
|
422
|
+
A project can have a plugin for your agent program (Claude Code, opencode)
|
|
423
|
+
that brings the answers on your pages into your session by itself, as a
|
|
424
|
+
message. Whether it does, only a round trip can tell. Once a session,
|
|
425
|
+
before you first need answers, run
|
|
426
|
+
|
|
427
|
+
```sh
|
|
428
|
+
workpad agent ping
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
- It says nothing brings answers to this session (exit 1): listen for
|
|
432
|
+
them, below.
|
|
433
|
+
- It pinged this session's channel: a message `workpad: pong` comes to
|
|
434
|
+
you the way answers will. It may only come once your turn has ended (in
|
|
435
|
+
opencode it does), so don't start a `listen` yet: end your turn if you
|
|
436
|
+
have nothing else to do. Run the `workpad agent ping <code>` it names:
|
|
437
|
+
from then on the answers on your pages come to you, received already, and
|
|
438
|
+
no `listen` needs to run for them. Your pages are those you made or
|
|
439
|
+
listened on: to take on others, `workpad listen --channel --page
|
|
440
|
+
<file>`, or `workpad listen --channel` for every page (also those made
|
|
441
|
+
later), as when the user asks you to listen to the boards. It exits at
|
|
442
|
+
once; the channel brings the user's answers waiting there and what
|
|
443
|
+
comes. Other agents' messages from before that someone already received
|
|
444
|
+
are skipped; it says how many, and `workpad listen --wait --page
|
|
445
|
+
<file>` hands them to you when you want to catch up. No pong by your
|
|
446
|
+
next turn: listen for them, below, and in Claude Code tell the user what
|
|
447
|
+
`workpad claude doctor` says is wrong.
|
|
448
|
+
|
|
449
|
+
The answers come as one line each: the page, what the user did, its id:
|
|
450
|
+
`plan: form scope: "Smaller" (id mwv…; …)`. Act on each, handle it, then
|
|
451
|
+
end your turn; the next answers come the same way. The same plugins remind
|
|
452
|
+
you of what is left: when your turn ends with answers you haven't handled,
|
|
453
|
+
a chat waiting for your reply, or a question nobody listens for, it goes
|
|
454
|
+
on once to tell you.
|
|
455
|
+
|
|
456
|
+
### Listening for answers
|
|
457
|
+
|
|
458
|
+
When nothing brings the answers to you (`workpad agent ping` says so, or no
|
|
459
|
+
pong came), listen for them.
|
|
460
|
+
|
|
461
|
+
Pass your page's file path as `--page`, so you only hear about your own
|
|
462
|
+
page (`--page plan` also works, and includes the pages below `plan/`).
|
|
463
|
+
With several pages, give `--page` once for each, in one listen
|
|
464
|
+
(`workpad listen --wait --page a.md --page b.md`): it listens on all of
|
|
465
|
+
them and exits with what came on any. Never watch pages by polling `workpad
|
|
466
|
+
events` in a loop: that reads the log without listening, so the pages tell
|
|
467
|
+
the user that nobody is listening and their answers wait.
|
|
468
|
+
|
|
469
|
+
- `workpad listen --wait --page <file>` prints everything on the page
|
|
470
|
+
you haven't handled yet, one line each, and exits; with nothing there, it
|
|
471
|
+
blocks until the next one comes (`--type <name>` for one form only,
|
|
472
|
+
`--timeout <s>` exits 2). What came before you started listening is there
|
|
473
|
+
too, so you never miss one. Run it in the background and keep working;
|
|
474
|
+
you are notified when it exits.
|
|
475
|
+
- **Run it again** for as long as the page has questions or chats waiting:
|
|
476
|
+
when it exits it lists, on stderr, the answers still to handle (with
|
|
477
|
+
`workpad handled`), the chats waiting for your reply, and the
|
|
478
|
+
questions still unanswered. When nothing is left, stop: nothing keeps
|
|
479
|
+
running. When you add a question later, listen again. Background
|
|
480
|
+
commands have no time limit, unlike a monitor tool, which expires.
|
|
481
|
+
- `workpad listen` without `--wait` never exits: it prints each one as
|
|
482
|
+
it comes. Never run it in the foreground, where it holds your turn for
|
|
483
|
+
good; use it only with something that reports each printed line as it
|
|
484
|
+
comes (a monitor), and restart that when it expires.
|
|
485
|
+
- Without `--page`, `listen` listens on every page; in a project of the
|
|
486
|
+
user's shared server, on every project served with it (all their
|
|
487
|
+
worktrees and job folders), each line saying where it is from: `project`
|
|
488
|
+
(its folder) and `url`; act on it in that folder. Use it only when asked
|
|
489
|
+
to look after the whole board, and with a confirmed channel, take
|
|
490
|
+
`workpad listen --channel` instead.
|
|
491
|
+
- `workpad events --page <file> [--type <name>] [--last 1]` lists what was
|
|
492
|
+
submitted so far, for when you need the history rather than the next
|
|
493
|
+
answer. With `--follow` it then prints each new event as it comes, without
|
|
494
|
+
taking anything. Use these only for something `listen` doesn't do, never
|
|
495
|
+
to watch for answers.
|
|
496
|
+
|
|
497
|
+
The page shows the user what waits for them: every question without an
|
|
498
|
+
answer is outlined as waiting for them, and so is a message from you they
|
|
499
|
+
haven't read (a reply in a comment thread, a chat message). Labels in the
|
|
500
|
+
page's corner ("→ unanswered (n)", "→ unread (n)") go from one to the next,
|
|
501
|
+
and the tab title and the header count them. Whether you listen doesn't
|
|
502
|
+
change that, so answers given while nobody listens wait in the log. So:
|
|
503
|
+
|
|
504
|
+
- An answer goes through three states: not received (nobody has it yet: the
|
|
505
|
+
form waits, ringed grey), received (it was brought to someone, or a
|
|
506
|
+
listen handed it to someone: the form folds into a card showing the
|
|
507
|
+
answer, marked "received", with its chat folded into "💬 n messages";
|
|
508
|
+
your messages there still open it for the user), and handled (someone
|
|
509
|
+
replied in its chat or ran `workpad handled <id>`: the card says
|
|
510
|
+
"decided", and by whom). Listening on a handled form by name (`--type`)
|
|
511
|
+
asks the user again: it is open again.
|
|
512
|
+
- Without a plugin bringing them to you, keep a `listen --wait` going (run
|
|
513
|
+
again after each answer) for as long as you want answers, and only then. Don't poll `workpad events` in a
|
|
514
|
+
loop instead: it marks nothing received, so the user's answers never show
|
|
515
|
+
as received, and the reminders and `workpad status` keep reporting
|
|
516
|
+
them. When an answer arrives while nobody listens, the user is told so.
|
|
517
|
+
- When you need the user to read something before you go on, put a form with
|
|
518
|
+
just a button in it (`:button[Read it]`), and go on once its answer comes. Then
|
|
519
|
+
everything you wait for is a form the page can point to.
|
|
520
|
+
|
|
521
|
+
### Other agents on a board
|
|
522
|
+
|
|
523
|
+
Any number listen on a page, and each hears everything there: the user's
|
|
524
|
+
answers, and other agents' messages, never your own. So agents can work on
|
|
525
|
+
one board together, talking in its chats as the user does. The green dot
|
|
526
|
+
in the page's header lists who listens (click it), and `workpad status`
|
|
527
|
+
names who is subscribed to each page.
|
|
528
|
+
|
|
529
|
+
Anyone listening may act on an answer. Before you do, check it isn't
|
|
530
|
+
handled already (`workpad thread <id>` shows who handled it, the page
|
|
531
|
+
says "decided"); leave one someone else handled, unless you have
|
|
532
|
+
something to add.
|
|
533
|
+
|
|
534
|
+
### Status
|
|
535
|
+
|
|
536
|
+
`workpad status` lists, per page, who is subscribed to it, the questions
|
|
537
|
+
waiting for the user (no answer yet, or a listen asks for a new one), the
|
|
538
|
+
answers nobody received, the answers received and not handled (with
|
|
539
|
+
`workpad handled`), the chats waiting for a reply, and who is listening,
|
|
540
|
+
with the `listen` command that takes them. It covers every page: it is
|
|
541
|
+
your inbox. Run it when you resume work, or when you're unsure what is
|
|
542
|
+
still open.
|
|
543
|
+
|
|
544
|
+
When `listen` hands you answers, it also says (on stderr) what is left on
|
|
545
|
+
the page: answers to handle, chats waiting for your reply, questions still
|
|
546
|
+
unanswered, with the command to listen again: run it once you've acted on
|
|
547
|
+
the answers.
|
|
548
|
+
|
|
549
|
+
The user can also select text on a page and comment on it, or comment on
|
|
550
|
+
lines of a code block: those come to you as `comments:new` events, as
|
|
551
|
+
answers do. `workpad docs` says how to reply (by editing the
|
|
552
|
+
page, or in the thread with `workpad append`).
|
|
553
|
+
|
|
554
|
+
When acting on an answer changes what a page says (a step done, a decision
|
|
555
|
+
made), update the page: the reader keeps it, not the chat.
|
|
556
|
+
|
|
557
|
+
## Putting changes up for review
|
|
558
|
+
|
|
559
|
+
To have the user review code you changed, write the diff into a page, one
|
|
560
|
+
file at a time: each file's diff in a `diff` fence, inside a chat named
|
|
561
|
+
after the file. The fence shows the file's name, where each part starts
|
|
562
|
+
and line numbers, and leaves out the headers only tools read. Its lines are coloured, the user can comment on any of them
|
|
563
|
+
(each comment's `at` says which file and line: `src/a.ts:12`, or
|
|
564
|
+
`src/a.ts (old):9` for a removed line), and the chat under it is for the
|
|
565
|
+
file as a whole. End with a form for the verdict.
|
|
566
|
+
|
|
567
|
+
```sh
|
|
568
|
+
git add -N . # new files show in the diff too
|
|
569
|
+
{ printf '# Review: <what changed>\n\n<why, in a few lines>\n\n'
|
|
570
|
+
git diff HEAD --name-only | while read -r f; do
|
|
571
|
+
printf ':::chat{name="%s"}\n````diff\n' "$f"
|
|
572
|
+
git diff HEAD -- "$f"
|
|
573
|
+
printf '````\n:::\n\n'
|
|
574
|
+
done
|
|
575
|
+
printf ':::form{name=review}\n:button[Approve] :button[Request changes]\n:::\n'
|
|
576
|
+
} > .workpad/pages/review.md
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
Then `workpad listen --wait --page review`: it hands you the line comments
|
|
580
|
+
(`comments:new`), the messages about a file (`chat:message`, with the file
|
|
581
|
+
as `chat`) and the verdict. For a comment or message, change the code or
|
|
582
|
+
reply in its thread; after changing code, write the page again the same
|
|
583
|
+
way, so each diff shows what the file is now (comments whose lines are gone
|
|
584
|
+
stay open, marked as no longer on the page, beside where they were, or
|
|
585
|
+
listed after the page when nothing of there is left; a file's chat stays
|
|
586
|
+
with its name). Add a line of explanation above a file's
|
|
587
|
+
fence where it helps. Use four backticks for the fence, since a diff can
|
|
588
|
+
hold three.
|
package/solid/index.tsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Solid 2 adapter for workpad template clients.
|
|
2
|
+
//
|
|
3
|
+
// // client.tsx
|
|
4
|
+
// import { solid, useWorkpad } from '@bigmistqke/workpad/solid'
|
|
5
|
+
// function Chart(props) { const wp = useWorkpad(); … }
|
|
6
|
+
// export default solid(Chart)
|
|
7
|
+
//
|
|
8
|
+
// The engine only knows mount(element, props, api); this turns a component into one and exposes
|
|
9
|
+
// the api's events and theme as signals through context.
|
|
10
|
+
import { createContext, createSignal, onSettled, useContext, type Component } from 'solid-js'
|
|
11
|
+
import { render } from '@solidjs/web'
|
|
12
|
+
import type { ClientApi, FormStatus, Listener, Mount, Reactive, Theme, WpEvent } from '@bigmistqke/workpad'
|
|
13
|
+
|
|
14
|
+
export interface Workpad {
|
|
15
|
+
/** this page's id */
|
|
16
|
+
page: string
|
|
17
|
+
/** every event recorded for this page. Reactive. */
|
|
18
|
+
events(): WpEvent[]
|
|
19
|
+
/** the latest event of a type, e.g. the last submit of a form. Reactive. */
|
|
20
|
+
last(type: string): WpEvent | undefined
|
|
21
|
+
/** record an event for this page */
|
|
22
|
+
append: ClientApi['append']
|
|
23
|
+
/** the theme in effect. Reactive. */
|
|
24
|
+
theme(): Theme
|
|
25
|
+
/** the agents waiting for answers on this page. Reactive. */
|
|
26
|
+
listeners(): Listener[]
|
|
27
|
+
/** the page's named forms and where each stands. Reactive. */
|
|
28
|
+
forms(): FormStatus[]
|
|
29
|
+
/** the agent's messages the reader hasn't read. Reactive. */
|
|
30
|
+
unread(): WpEvent[]
|
|
31
|
+
/** a message's markdown as HTML, rendered by the server (see Api.markdown) */
|
|
32
|
+
markdown: ClientApi['markdown']
|
|
33
|
+
/** an agent's chat message as a small page, rendered by the server (see Api.message) */
|
|
34
|
+
message: ClientApi['message']
|
|
35
|
+
/** a short note in the page's corner (see Api.toast) */
|
|
36
|
+
toast: ClientApi['toast']
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const WorkpadContext = createContext<Workpad>()
|
|
40
|
+
|
|
41
|
+
/** The page's events, theme, listeners, forms and unread messages, as signals. Use inside a component passed to solid(). */
|
|
42
|
+
export const useWorkpad = (): Workpad => useContext(WorkpadContext)
|
|
43
|
+
|
|
44
|
+
/** Turn a Solid component into a template client: `export default solid(MyComponent)`. */
|
|
45
|
+
export function solid<Props extends object>(Component: Component<Props>): Mount<Props> {
|
|
46
|
+
return (element: HTMLElement, props: Props, api: ClientApi) =>
|
|
47
|
+
render(() => {
|
|
48
|
+
// each of the api's changing values (Reactive) as a signal, set on each change; what .on
|
|
49
|
+
// returns stops it when the component goes
|
|
50
|
+
// (boxed: a T that is a function would read as createSignal's function form)
|
|
51
|
+
const signal = <T,>(value: Reactive<T>) => {
|
|
52
|
+
const [get, set] = createSignal({ v: value() })
|
|
53
|
+
onSettled(() => value.on(next => set({ v: next })))
|
|
54
|
+
return () => get().v
|
|
55
|
+
}
|
|
56
|
+
const events = signal(api.events)
|
|
57
|
+
const theme = signal(api.theme)
|
|
58
|
+
const listeners = signal(api.listeners)
|
|
59
|
+
const forms = signal(api.forms)
|
|
60
|
+
const unread = signal(api.unread)
|
|
61
|
+
const value: Workpad = {
|
|
62
|
+
page: api.page,
|
|
63
|
+
events,
|
|
64
|
+
last: type => events().findLast(e => e.type === type),
|
|
65
|
+
append: api.append,
|
|
66
|
+
theme,
|
|
67
|
+
listeners,
|
|
68
|
+
forms,
|
|
69
|
+
unread,
|
|
70
|
+
markdown: api.markdown,
|
|
71
|
+
message: api.message,
|
|
72
|
+
toast: api.toast,
|
|
73
|
+
}
|
|
74
|
+
return (
|
|
75
|
+
<WorkpadContext value={value}>
|
|
76
|
+
<Component {...props} />
|
|
77
|
+
</WorkpadContext>
|
|
78
|
+
)
|
|
79
|
+
}, element)
|
|
80
|
+
}
|