@agent-workshop/adoc-core 0.1.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.
Files changed (64) hide show
  1. package/LICENSE +5 -0
  2. package/THIRD_PARTY_NOTICES.md +49 -0
  3. package/dist/claim.d.ts +17 -0
  4. package/dist/claim.js +35 -0
  5. package/dist/claim.js.map +1 -0
  6. package/dist/client.d.ts +14 -0
  7. package/dist/client.js +49 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/config.d.ts +39 -0
  10. package/dist/config.js +110 -0
  11. package/dist/config.js.map +1 -0
  12. package/dist/errors.d.ts +6 -0
  13. package/dist/errors.js +13 -0
  14. package/dist/errors.js.map +1 -0
  15. package/dist/fetch.d.ts +19 -0
  16. package/dist/fetch.js +106 -0
  17. package/dist/fetch.js.map +1 -0
  18. package/dist/git.d.ts +1 -0
  19. package/dist/git.js +13 -0
  20. package/dist/git.js.map +1 -0
  21. package/dist/herdr.d.ts +44 -0
  22. package/dist/herdr.js +134 -0
  23. package/dist/herdr.js.map +1 -0
  24. package/dist/home.d.ts +12 -0
  25. package/dist/home.js +43 -0
  26. package/dist/home.js.map +1 -0
  27. package/dist/index.d.ts +18 -0
  28. package/dist/index.js +19 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/messages.d.ts +76 -0
  31. package/dist/messages.js +119 -0
  32. package/dist/messages.js.map +1 -0
  33. package/dist/names.d.ts +14 -0
  34. package/dist/names.js +19 -0
  35. package/dist/names.js.map +1 -0
  36. package/dist/plugins.d.ts +43 -0
  37. package/dist/plugins.js +157 -0
  38. package/dist/plugins.js.map +1 -0
  39. package/dist/registry.d.ts +11 -0
  40. package/dist/registry.js +39 -0
  41. package/dist/registry.js.map +1 -0
  42. package/dist/report.d.ts +3 -0
  43. package/dist/report.js +9 -0
  44. package/dist/report.js.map +1 -0
  45. package/dist/scan.d.ts +35 -0
  46. package/dist/scan.js +163 -0
  47. package/dist/scan.js.map +1 -0
  48. package/dist/server.d.ts +80 -0
  49. package/dist/server.js +576 -0
  50. package/dist/server.js.map +1 -0
  51. package/dist/skills.d.ts +46 -0
  52. package/dist/skills.js +131 -0
  53. package/dist/skills.js.map +1 -0
  54. package/dist/terminal.d.ts +28 -0
  55. package/dist/terminal.js +110 -0
  56. package/dist/terminal.js.map +1 -0
  57. package/dist/transports.d.ts +21 -0
  58. package/dist/transports.js +69 -0
  59. package/dist/transports.js.map +1 -0
  60. package/dist/workspace.d.ts +182 -0
  61. package/dist/workspace.js +392 -0
  62. package/dist/workspace.js.map +1 -0
  63. package/package.json +54 -0
  64. package/skill/SKILL.md +219 -0
package/skill/SKILL.md ADDED
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: adoc
3
+ description: "Explains adoc, where a user and an agent work together on plugin-defined documents, and how its assigned agent works: claim, receive messages, edit documents, check, commit. Use when a project has an .adoc folder, when an adoc message arrives, or when setting up adoc for a project."
4
+ ---
5
+
6
+ # adoc
7
+
8
+ ## Overview
9
+
10
+ adoc is a place where a user and an agent work on documents together. The user uses the adoc web UI in a browser; the agent uses the `adoc` command line or its MCP tool. Both connect to the **adoc server** of the workspace and talk through the documents: the user reads the rendered documents, comments on them, edits them or presses their buttons, and those reach the agent as **messages**; the agent edits the files. Some changes reach the agent only as uncommitted changes: an edit whose draft the user has not sent yet, or an action that sends no message.
11
+
12
+ - The adoc server watches the documents for changes, renders each document for the web UI through its plugin (the plugin summarizes and renders it; adoc draws only the header around it), runs the plugin's actions, holds the user's messages and delivers them to the agent.
13
+ - What a document is and how it looks comes from **plugins**: adoc itself knows no document kind.
14
+ - adoc never starts an agent. Run the agent in a herdr pane (recommended): adoc then pushes every message straight into that pane, and the web UI shows its terminal. Without herdr, the agent takes its messages with `adoc message wait`.
15
+ - A workspace is usually a git repository, so that the agent can commit every change; adoc also works without git and then warns in `adoc check`.
16
+
17
+ ## Plugins and documents
18
+
19
+ - Each plugin defines one kind of document, under a **plugin key** in uppercase letters: `TODO`, `TASK`, `KANBAN`, `NOTE`, `SKETCH`, …
20
+ - A plugin has any number of documents. A document is one file or one folder under the watch paths (usually `docs/`); the plugin decides which, and the file's extension. Its name without the extension is its **document key**, `<PLUGIN KEY>-<local id>`: the file `TASK-260930-order-paging.md` has the key `TASK-260930-order-paging`, the folder `BUG-42/` the key `BUG-42`.
21
+ - Create a new document in the first watch path, in a folder named after the plugin key in lowercase plural: `docs/tasks/TASK-260930-order-paging.md`, `docs/sketches/SKETCH-261002-login.excalidraw`.
22
+ - The local id uses lowercase letters, digits, `-`, `_` and `.`, in English words. Each plugin's skill recommends a form: today's date as yymmdd and a title (`260930-order-paging`), or a topic (`gui`). A key is never reused.
23
+ - A document inside a folder named `_archive` is archived: it keeps its key and references to it work, but lists and searches leave it out. To archive one, move it with `git mv` (a plain `mv` without git) into an `_archive` folder next to it (`docs/tasks/_archive/TASK-x.md`), together with its companion files; to restore it, move it back.
24
+ - `[[KEY]]` or `[[KEY#anchor]]` in Markdown content refers to another document.
25
+
26
+ ## Installing plugins
27
+
28
+ A plugin is a folder:
29
+
30
+ ```
31
+ <plugin>/
32
+ index.ts # export default definePlugin({ … }): description, layout, summarize, render, actions
33
+ skill/
34
+ SKILL.md # the plugin's agent skill; `adoc skill install` copies only this folder
35
+ package.json # optional: npm packages it imports, and the plugin-kit range it needs
36
+ client/ # optional: browser code, index.js (+ index.css), for custom elements
37
+ ```
38
+
39
+ Installing a plugin and using it are two steps. **Use** it by declaring it in `.adoc/adoc.yaml` under `plugins`, as `KEY: <source>`:
40
+
41
+ - `npm:<package>`, such as `npm:@agent-workshop/adoc-plugin-todo`: found from the folder of the config file upwards (`.adoc/node_modules`, `<project>/node_modules`), then in adoc's own installation. **Install** it with npm; a version installed in the project comes before the one that came with adoc.
42
+ - `github:<owner>/<repo>/<folder>#<ref>`: **install** it with `adoc plugin install`, which fetches it into `.adoc/plugins/<key in lowercase>/` and records the commit in `.adoc/plugins/plugins-lock.json`; `adoc plugin update` fetches it again. Never edit a fetched folder: copy it to another folder and declare that path.
43
+ - a path starting with `./`, `../` or `/`, taken from the folder of the config file: `./plugins/x` is `.adoc/plugins/x`, the place for a plugin of this project.
44
+ - `off` leaves out a plugin that the user config declares.
45
+
46
+ `adoc plugin list` shows each plugin with its source and document count, or its load error. A running server reloads a plugin from a folder outside `node_modules` when a file at the top of its folder changes (details in `adoc-plugin-authoring`); after an npm update, `adoc plugin update` or a change to the config, restart the server (a restart loses held messages, see "Start: claim"). Then install or update its skill with `adoc skill install` or `adoc skill update` (below). Writing a plugin is explained by the skill `adoc-plugin-authoring`.
47
+
48
+ ## Configuration
49
+
50
+ `.adoc/adoc.yaml`, created by `adoc init`, is laid over the user config `~/.config/adoc/adoc.yaml` (same format): each plugin key and each other setting of the project replaces the user's. **Every relative path is taken from the folder of the file that holds it.** A complete example:
51
+
52
+ ```yaml
53
+ plugins: # plugin key (uppercase letters; documents are named NOTE-<local id>): source
54
+ NOTE: npm:@agent-workshop/adoc-plugin-note
55
+ TASK: ./plugins/task # .adoc/plugins/task
56
+ MIND: github:someone/adoc-plugins/mindmap#v1.0
57
+ BUG: off # declared in the user config, not wanted here
58
+ watch: # folders that hold documents
59
+ - ../docs
60
+ agent:
61
+ name: dev # shown in the web UI
62
+ transport:
63
+ kind: herdr # herdr: push into the pane of `adoc agent claim`; wait: the agent runs `adoc message wait`
64
+ server:
65
+ host: 127.0.0.1
66
+ port: 7700
67
+ ui:
68
+ tabs: [NOTE, TASK, MIND] # tab order; plugins not listed follow in declaration order
69
+ theme: dark # default colours of the web UI: dark | light | system; each browser may choose another
70
+ ```
71
+
72
+ Only `plugins` is needed in practice, and `agent.transport` outside herdr; the table gives the defaults:
73
+
74
+ | key | meaning |
75
+ |---|---|
76
+ | `plugins` | map from plugin key to source, or `off` |
77
+ | `watch` | folders that hold documents, default the workspace's `docs` (`../docs` from `.adoc/`) |
78
+ | `agent.name` | the agent's name, shown in the web UI, default `agent` |
79
+ | `agent.transport.kind` | `herdr` (default: push messages into the claimed pane) or `wait` (the agent runs `adoc message wait`) |
80
+ | `server.host`, `server.port` | where the server listens, default `127.0.0.1:7700`; `0.0.0.0` for the internal network, no authentication |
81
+ | `ui.tabs` | the order of the plugin tabs, default the declaration order |
82
+ | `ui.theme` | default colours of the web UI: `dark` (default), `light` or `system` |
83
+
84
+ A plugin the team shares belongs in the project config; a plugin only in your user config shows its documents to you alone (others see an unknown plugin key).
85
+
86
+ ## Project scope and user scope
87
+
88
+ A workspace (project scope):
89
+
90
+ ```
91
+ <project-dir>/
92
+ .adoc/ # the user decides whether it is committed
93
+ adoc.yaml # the configuration (above)
94
+ .gitignore # keeps claim.yaml out of git
95
+ claim.yaml # the assigned agent's herdr pane, written by `adoc agent claim`; this machine only
96
+ plugins/<name>/ # plugins of this project, declared as `./plugins/<name>`; fetched GitHub sources
97
+ plugins/plugins-lock.json # the commits of the fetched GitHub sources
98
+ .agents/skills/ # project-scope skills, the copies written by `adoc skill install`
99
+ .claude/skills/ # links to them for Claude Code (one folder per detected agent)
100
+ skills-lock.json # written by the skills CLI; the user decides whether it is committed
101
+ docs/ # a watch path: the documents
102
+ tasks/_archive/ # archived documents, in `_archive` folders at any depth
103
+ ```
104
+
105
+ The user (user scope):
106
+
107
+ ```
108
+ ~/.config/adoc/adoc.yaml # the user config, laid under every workspace's ($XDG_CONFIG_HOME/adoc)
109
+ ~/.config/adoc/plugins/<name>/ # the user's plugins, declared there as `./plugins/<name>`
110
+ ~/.config/adoc/node_modules/ # npm plugins for every workspace: `npm i --prefix ~/.config/adoc <package>`
111
+ ~/.agents/skills/<name>/ # user-scope skills: adoc, adoc-plugin-authoring, plugins outside any workspace
112
+ ~/.claude/skills/<name> # links to them for Claude Code (one folder per detected agent)
113
+ $XDG_RUNTIME_DIR/adoc/<hash>.json # a record of each running adoc server (pid, url, workspace), named by a hash of the workspace path; the temp folder without $XDG_RUNTIME_DIR
114
+ ```
115
+
116
+ - **Project scope:** a plugin whose folder is inside the workspace (`.adoc/plugins/`, the project's `node_modules`); its skill installs into the workspace (`.agents/skills/`, `.claude/skills/`, …).
117
+ - **User scope:** a plugin whose folder is outside the workspace (`~/.config/adoc/`, adoc's own installation); its skill, and adoc's own skills `adoc` and `adoc-plugin-authoring`, install into the home (`~/.agents/skills/`, …).
118
+ - `adoc skill install` installs every skill in its scope through the Vercel `skills` CLI (`npx skills add`), for the agents it detects; `adoc skill update` refreshes them after an update. Every adoc command warns while a skill is missing or its installed copy differs from the one of the running adoc.
119
+
120
+ ## Using a plugin
121
+
122
+ How a plugin is meant to be used, what its files look like, what an anchor means and what to do for each of its actions is written in its skill. **Always read the skill of a plugin before you touch its documents:** `adoc skill list`, then `adoc skill view adoc-<plugin key in lowercase>`, such as `adoc skill view adoc-task`. The user sees the same text in the web UI (`SKILL.md` beside the plugin key).
123
+
124
+ ## For the agent
125
+
126
+ ### Setting up a new project
127
+
128
+ adoc comes with five plugins: NOTE (shared notes), TODO (task lists), TASK (work orders), KANBAN (a board) and SKETCH (drawings). `adoc init` declares them as `npm:@agent-workshop/adoc-plugin-<name>`.
129
+
130
+ 1. **Talk first.** Before any work, take time with the user to decide how this project will use them: which documents to keep, what goes where, how detailed.
131
+ 2. **Agree on the way of working, and record it** in the project's agent instructions file (`AGENTS.md`; `CLAUDE.md` when the project has only that): whether the project commits, whether you do the work yourself or hand it to a subagent or a herdr development agent, and the procedure. A sample procedure:
132
+ - Use a **NOTE** to discuss ideas with the user or to help them understand something. Draw state and sequence diagrams with Mermaid (```` ```mermaid ````) wherever they help.
133
+ - When the user agrees on a good idea from a NOTE, put it on a **TODO** list and do it; when it is complex, design it enough and turn it into a **TASK** that lists the NOTE in `notes:`, and point the item to it (see the TODO skill).
134
+ - Start the work only when the documents it depends on are agreed and, if the project commits, committed.
135
+ - The work may go to a subagent or a herdr development agent.
136
+ - When a task is finished, it goes to the user's review (see the TASK skill).
137
+ 3. **Change the procedure with the user as you go**, and keep `AGENTS.md` up to date.
138
+ 4. **Make plugins fit the work.** A plugin is easy to write, so change one or write a new one whenever the documents should look or behave differently (skill `adoc-plugin-authoring`).
139
+
140
+ ### Commands
141
+
142
+ | command | what it does |
143
+ |---|---|
144
+ | `adoc agent claim` / `adoc agent show` | make your herdr pane the assigned agent / show who is |
145
+ | `adoc message wait [--timeout <seconds>]` | block until messages arrive (without `--timeout`, for ever), print them all, and forget them |
146
+ | `adoc message list` | show held messages without taking them |
147
+ | `adoc document list [--plugin KEY] [--archived]` | documents, the most recently changed first, without archived ones (`--archived`: only those) |
148
+ | `adoc document search <text> [--plugin KEY] [--archived]` | lines of documents that contain the text |
149
+ | `adoc check` | every warning and error of the documents and plugins; exits 1 on errors |
150
+ | `adoc ui open <KEY>[#anchor]` / `adoc ui list` | show a document in the user's browser tab / list the tabs |
151
+ | `adoc skill list` / `adoc skill view <name>` | the agent skills / one of them |
152
+ | `adoc skill install` / `update` / `uninstall` | manage the installed skills (command line only; through MCP, ask the user to run them) |
153
+ | `adoc plugin list` | the declared plugins, in tab order |
154
+ | `adoc plugin install` / `adoc plugin update [KEY…]` | fetch the GitHub plugin sources not fetched yet / again (command line only) |
155
+ | `adoc server run` / `adoc mcp run` / `adoc init` | run the server / serve the MCP tool / create a workspace (command line only) |
156
+
157
+ Every command takes `--output text|markdown|json|yaml` and answers `--help`; the workspace is the parent of the nearest `.adoc` folder upwards, or of the `.adoc` folder named by `--home <path>` (command line only) or `ADOC_HOME`. `adoc message` and `adoc ui` need the running server of the workspace; the user usually starts it with `adoc server run`. The other commands read the workspace directly. Through MCP, call the tool `adoc` with the command line without `adoc`, such as `{ "cmd": "document list --plugin TASK" }`.
158
+
159
+ ### Workflow of the assigned agent
160
+
161
+ #### Start: claim
162
+
163
+ - **In herdr (recommended):** run `adoc agent claim` once at the start of your session. Your pane becomes the assigned agent: the user's messages are pushed into it as prompts, and the web UI shows your terminal. Claiming from another pane takes the role over.
164
+ - **Outside herdr:** set `agent.transport.kind: wait` in `.adoc/adoc.yaml`, and take the held messages with `adoc message wait`.
165
+
166
+ The server holds every message until it is delivered or the server stops: a pushed message is no longer held, and messages that arrived before anyone claimed are pushed when you claim. Held messages live in the server's memory, so a server restart loses them: take them with `adoc message wait` before you restart it.
167
+
168
+ Then read the skills of the plugins you will work with (see "Using a plugin").
169
+
170
+ #### The loop
171
+
172
+ 1. Receive messages: pushed into your pane (herdr), or with `adoc message wait`.
173
+ 2. For each message, read the documents it targets (the main target and the target of each attached comment) and do what it asks.
174
+ 3. Run `adoc check`; fix every error, and every warning about a document you changed.
175
+ 4. Commit, unless the project does not (see "Committing").
176
+ 5. When you created or substantially changed a document the user should see, open it for them: `adoc ui open <KEY>`.
177
+ 6. Go back to 1.
178
+
179
+ #### Message format
180
+
181
+ ```
182
+ [adoc message 17] comment · TASK-260930-order-paging
183
+ Then split the method into two tasks.
184
+ --
185
+ comments:
186
+ - target: TASK-260930-order-paging#method
187
+ source: docs/tasks/TASK-260930-order-paging.md:16
188
+ quote: infinite scroll
189
+ text: Use page numbers instead of infinite scroll.
190
+
191
+ [adoc message 18] action · TODO-gui#3
192
+ user request: do item TODO-gui#3: Refactor PaymentRepo
193
+ --
194
+ action: toggle
195
+ value: "3"
196
+ applied: false
197
+ ```
198
+
199
+ - The header names the main target, and the text after it is what the user typed (for an action, what the plugin reports). After `--` come the attached `comments`: the draft comments the user collected and sent with the message, each with its own target; handle all of them, in order. A message of attached comments only has no target and no text.
200
+ - A target is `workspace`, a plugin key (about the plugin, such as "create a new one"), a document key, a document key with an anchor (the plugin's skill says what an anchor means), or `skill <name>` (about an agent skill: change the `SKILL.md` in the skill's `directory` that `adoc skill list --output json` shows, then run `adoc skill update`, or through MCP ask the user to run it).
201
+ - `source` is the file and line the user pointed at; `quote` is the exact text they selected. If the file changed since, find the place by the quote or the text around it; if you cannot find it, ask (see "Talking to the user").
202
+ - A comment may carry a diff that starts with `I edited <file>:`: the user already changed the file in the web UI. Read the diff, keep the change, and do what the rest of the message asks.
203
+ - An `action` message with `applied: false` is a request: make the change yourself. With `applied: true` the plugin already wrote the change: do not redo it, commit it (see "Committing"), and do more only when the text or the plugin's skill asks for it. Every document has the common actions `archive` and `unarchive` (the archive button of its header): they ask you to archive or restore it (see "Plugins and documents"). A plugin's skill lists only its own actions. Some actions send no message at all, such as a sketch's `save`; their skill says how the change reaches you.
204
+
205
+ #### Rules
206
+
207
+ - Find documents with `adoc document list` and `adoc document search`, not with `ls` or `grep`: they leave archived documents out and keep your context small.
208
+ - Always read the current file before editing it: the user or a plugin action may have changed it.
209
+
210
+ #### Committing
211
+
212
+ - adoc never commits. Unless the project's agent instructions say not to commit, or the workspace is not a git repository, you do, with `git add` and `git commit`, naming the document keys in the message, such as `TODO-gui: detail item 3`.
213
+ - Commit each piece of work when it is done: a message once its attached comments are handled, or a step you take yourself, such as writing a note or starting a TASK.
214
+ - Stage by path, and only these: the files you changed, and the uncommitted changes to documents made by the user or by plugin actions (such as a sketch's PNG). Stage nothing else, such as a `.adoc/adoc.yaml` you did not change.
215
+
216
+ #### Talking to the user
217
+
218
+ - Answer the user in your conversation: in herdr, the web UI shows your terminal; with the `wait` transport, the user reads your terminal where they started you. Answer a comment that asks a question there, and say there why you decline what a message asks, leaving the document as it is.
219
+ - When you need an answer about a place in a Markdown document, write the question there, next to the place, as a blockquote starting with `> Question:`, and remove it once answered. A plugin's skill says when its view does not show such a line, or names a better place, such as a NOTE's **Open questions**; otherwise ask in your conversation.