archidocs 1.2.0 → 1.3.1
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/README.md +62 -13
- package/dist/cli/commands.d.ts +231 -10
- package/dist/cli/commands.js +134 -9
- package/dist/cli/dev.d.ts +5 -6
- package/dist/cli/dev.js +12 -14
- package/dist/cli/diff-format.d.ts +1 -5
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.js +2 -2
- package/dist/cli/main.js +2 -329
- package/dist/cli/run.d.ts +18 -0
- package/dist/cli/run.js +283 -0
- package/dist/commands/build.d.ts +51 -0
- package/dist/commands/build.js +39 -0
- package/dist/commands/check.d.ts +8 -0
- package/dist/commands/check.js +5 -0
- package/dist/commands/diff.d.ts +29 -0
- package/dist/commands/diff.js +25 -0
- package/dist/commands/export.d.ts +41 -0
- package/dist/commands/export.js +47 -0
- package/dist/commands/history.d.ts +18 -0
- package/dist/commands/history.js +9 -0
- package/dist/commands/index.d.ts +11 -0
- package/dist/commands/index.js +11 -0
- package/dist/core/compare.d.ts +2 -13
- package/dist/core/compare.js +2 -35
- package/dist/core/index.d.ts +3 -6
- package/dist/core/index.js +3 -6
- package/dist/core/load.d.ts +0 -2
- package/dist/core/load.js +5 -6
- package/dist/core/rules.d.ts +10 -0
- package/dist/core/rules.js +186 -7
- package/dist/core/views/compare.d.ts +12 -0
- package/dist/core/views/compare.js +37 -0
- package/dist/core/{deployment-views.d.ts → views/deployment.d.ts} +4 -5
- package/dist/core/{deployment-views.js → views/deployment.js} +5 -7
- package/dist/core/{dynamic-views.d.ts → views/dynamic.d.ts} +1 -3
- package/dist/core/{dynamic-views.js → views/dynamic.js} +4 -8
- package/dist/core/views/generated.d.ts +18 -0
- package/dist/core/views/generated.js +92 -0
- package/dist/core/views/ids.d.ts +36 -0
- package/dist/core/views/ids.js +51 -0
- package/dist/core/views/index.d.ts +13 -0
- package/dist/core/views/index.js +12 -0
- package/dist/core/views/lens.d.ts +27 -0
- package/dist/core/views/lens.js +112 -0
- package/dist/core/views/model.d.ts +21 -0
- package/dist/core/views/model.js +69 -0
- package/dist/core/views/resolve.d.ts +42 -0
- package/dist/core/views/resolve.js +81 -0
- package/dist/core/{save-as-view.d.ts → views/save-as-view.d.ts} +2 -2
- package/dist/core/{save-as-view.js → views/save-as-view.js} +13 -10
- package/dist/core/{saved-views.d.ts → views/saved.d.ts} +4 -18
- package/dist/core/{saved-views.js → views/saved.js} +8 -103
- package/dist/core/views/types.d.ts +91 -0
- package/dist/core/views/types.js +2 -0
- package/dist/core/workspace-files.d.ts +13 -0
- package/dist/core/workspace-files.js +20 -0
- package/dist/git.d.ts +2 -0
- package/dist/git.js +14 -4
- package/dist/history/git.d.ts +0 -10
- package/dist/history/git.js +1 -30
- package/dist/history/index.d.ts +15 -31
- package/dist/history/index.js +47 -43
- package/dist/history/points.d.ts +23 -0
- package/dist/history/points.js +28 -0
- package/dist/history/site.d.ts +30 -0
- package/dist/history/site.js +37 -0
- package/dist/mcp/errors.d.ts +37 -0
- package/dist/mcp/errors.js +35 -0
- package/dist/mcp/history.d.ts +4 -4
- package/dist/mcp/history.js +56 -116
- package/dist/mcp/index.d.ts +2 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/server.d.ts +1 -2
- package/dist/mcp/server.js +30 -29
- package/dist/mcp/site.d.ts +12 -0
- package/dist/mcp/site.js +46 -0
- package/dist/mcp/source.d.ts +14 -7
- package/dist/mcp/source.js +25 -99
- package/dist/render/layout.d.ts +20 -3
- package/dist/render/layout.js +49 -12
- package/dist/render/sequence-svg.d.ts +1 -1
- package/dist/render/sequence.d.ts +1 -1
- package/dist/render/svg.d.ts +1 -1
- package/dist/render/svg.js +4 -4
- package/dist/revisions/find.d.ts +64 -0
- package/dist/revisions/find.js +85 -0
- package/dist/revisions/index.d.ts +57 -0
- package/dist/revisions/index.js +24 -0
- package/dist/revisions/site.d.ts +82 -0
- package/dist/revisions/site.js +157 -0
- package/dist/revisions/text.d.ts +8 -0
- package/dist/revisions/text.js +17 -0
- package/dist/revisions/touching.d.ts +7 -0
- package/dist/revisions/touching.js +7 -0
- package/dist/schema/adr.js +18 -13
- package/dist/schema/workspace.js +226 -130
- package/dist/viewer/assets/index-C0lIIm8V.js +138 -0
- package/dist/viewer/assets/index-YFA-pYjQ.css +1 -0
- package/dist/viewer/assets/{layout.worker-Bg-OaLVN.js → layout.worker-BRHAGJrD.js} +1 -1
- package/dist/viewer/assets/{png-BDKIXtm5.js → png-DMwnpRCt.js} +1 -1
- package/dist/viewer/assets/{svg-Bulv5YWn.js → svg-DN6lMeZo.js} +2 -2
- package/dist/viewer/index.html +2 -2
- package/dist/workspace/index.d.ts +37 -0
- package/dist/workspace/index.js +52 -0
- package/guide/SKILL.md +1 -1
- package/guide/topics/bootstrap.md +1 -1
- package/guide/topics/relationships.md +1 -1
- package/package.json +4 -3
- package/schemas/adr.schema.json +18 -15
- package/schemas/model.schema.json +637 -1144
- package/schemas/project.schema.json +8 -4
- package/schemas/workspace.schema.json +39 -20
- package/dist/core/views.d.ts +0 -126
- package/dist/core/views.js +0 -217
- package/dist/viewer/assets/index-DvKgCpBr.css +0 -1
- package/dist/viewer/assets/index-gucix3xm.js +0 -113
- /package/dist/{history → revisions}/migrate.d.ts +0 -0
- /package/dist/{history → revisions}/migrate.js +0 -0
package/dist/cli/commands.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The CLI's commands and flags, described once. The CLI parses each
|
|
3
3
|
* command's arguments with these flags and prints its usage text from them;
|
|
4
|
-
* the docs site generates its CLI reference from them and
|
|
5
|
-
* `archidocs …` line in a page with
|
|
6
|
-
* module has no side effects and pulls in
|
|
4
|
+
* the docs site generates its CLI reference from them, examples and exit
|
|
5
|
+
* codes included, and checks every `archidocs …` line in a page with
|
|
6
|
+
* `parseCommandLine`. Importing this module has no side effects and pulls in
|
|
7
|
+
* nothing but `node:util`.
|
|
7
8
|
*/
|
|
8
9
|
import { parseArgs } from "node:util";
|
|
10
|
+
/** The CLI's exit codes: 0 no errors, 1 errors found (or any warning with `check --strict`), 2 could not run. */
|
|
11
|
+
export const EXIT = { ok: 0, foundErrors: 1, couldNotRun: 2 };
|
|
12
|
+
/** What a command that needs a Workspace says, exiting 2, when the search for one finds none. */
|
|
13
|
+
export const NO_WORKSPACE = "No workspace.yaml found in this folder, its archidocs/ folder, or any folder above.";
|
|
14
|
+
/** How every command's exit 2 starts: the command line itself was refused. */
|
|
15
|
+
const USAGE_ERROR = "an unknown flag, a flag missing its value";
|
|
9
16
|
export const commands = {
|
|
10
17
|
version: {
|
|
11
18
|
name: "version",
|
|
@@ -15,6 +22,14 @@ export const commands = {
|
|
|
15
22
|
flags: {
|
|
16
23
|
format: { type: "string", value: "text|json", default: "text", description: "Print a line of text, or a JSON object with `version` and `schemaVersion`." },
|
|
17
24
|
},
|
|
25
|
+
examples: [
|
|
26
|
+
{ command: "archidocs version", description: "Print both versions as one line of text." },
|
|
27
|
+
{ command: "archidocs version --format json", description: "Print them as JSON, for a CI cache key that changes when the Bundle schemaVersion does." },
|
|
28
|
+
],
|
|
29
|
+
exitCodes: [
|
|
30
|
+
{ code: EXIT.ok, meaning: "The version was printed." },
|
|
31
|
+
{ code: EXIT.couldNotRun, meaning: `It could not run: ${USAGE_ERROR}, or an unknown format.` },
|
|
32
|
+
],
|
|
18
33
|
},
|
|
19
34
|
init: {
|
|
20
35
|
name: "init",
|
|
@@ -25,6 +40,17 @@ export const commands = {
|
|
|
25
40
|
skill: { type: "boolean", default: false, description: "Install only the agent skill and its pointers, for a code repo that has no Workspace of its own." },
|
|
26
41
|
workspace: { type: "string", value: "<dir>", description: "With `--skill`: the Workspace checkout that the printed MCP command points at." },
|
|
27
42
|
},
|
|
43
|
+
examples: [
|
|
44
|
+
{ command: "archidocs init", description: "Write `archidocs/workspace.yaml` if the repo has no Workspace yet, and install the agent skill." },
|
|
45
|
+
{
|
|
46
|
+
command: "archidocs init --skill --workspace ../architecture/archidocs",
|
|
47
|
+
description: "In a code repo, install only the agent skill, and print the MCP command for the Workspace checked out beside it.",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
exitCodes: [
|
|
51
|
+
{ code: EXIT.ok, meaning: "The Workspace and the agent skill are set up, or already were. Each file written or updated is printed." },
|
|
52
|
+
{ code: EXIT.couldNotRun, meaning: `It could not run: ${USAGE_ERROR}, \`--workspace\` without \`--skill\`, or a file it could not write.` },
|
|
53
|
+
],
|
|
28
54
|
},
|
|
29
55
|
guide: {
|
|
30
56
|
name: "guide",
|
|
@@ -32,16 +58,35 @@ export const commands = {
|
|
|
32
58
|
description: "Print the authoring guide for agents, or one of its task topics.",
|
|
33
59
|
arguments: [{ name: "[topic]", description: "A task topic; with none, the guide and the list of topics." }],
|
|
34
60
|
flags: {},
|
|
61
|
+
examples: [
|
|
62
|
+
{ command: "archidocs guide", description: "Print the guide: the Model in brief, the edit loop and the list of task topics." },
|
|
63
|
+
{ command: "archidocs guide add-service", description: "Print one task topic, here how to add a Service." },
|
|
64
|
+
],
|
|
65
|
+
exitCodes: [
|
|
66
|
+
{ code: EXIT.ok, meaning: "The guide or the topic was printed." },
|
|
67
|
+
{ code: EXIT.couldNotRun, meaning: "It could not run: an unknown topic (the message lists the topics there are), more than one topic, or any flag, since it takes none." },
|
|
68
|
+
],
|
|
35
69
|
},
|
|
36
70
|
check: {
|
|
37
71
|
name: "check",
|
|
38
72
|
synopsis: ["check [--format text|json|github] [--strict]"],
|
|
39
|
-
description: "Validate the Workspace found from the current folder
|
|
73
|
+
description: "Validate the Workspace found from the current folder and print each issue with its file, line and rule.",
|
|
40
74
|
arguments: [],
|
|
41
75
|
flags: {
|
|
42
76
|
format: { type: "string", value: "text|json|github", default: "text", description: "Print issues as text, as JSON, or as GitHub Actions annotations." },
|
|
43
77
|
strict: { type: "boolean", default: false, description: "Exit 1 on warnings too, not only on errors." },
|
|
44
78
|
},
|
|
79
|
+
examples: [
|
|
80
|
+
{ command: "archidocs check", description: "Validate the Workspace and print its issues grouped by file, then a count and a link to each rule's page." },
|
|
81
|
+
{ command: "archidocs check --strict", description: "Fail on warnings as well as errors, for a CI job that keeps the Workspace clean." },
|
|
82
|
+
{ command: "archidocs check --format github", description: "Print each issue as a GitHub Actions annotation, which a pull request shows on the line the issue is about." },
|
|
83
|
+
{ command: "archidocs check --format json", description: "Print the issues and a count of errors and warnings as JSON, for a script." },
|
|
84
|
+
],
|
|
85
|
+
exitCodes: [
|
|
86
|
+
{ code: EXIT.ok, meaning: "No errors. Warnings are printed and still exit 0, unless `--strict` is given." },
|
|
87
|
+
{ code: EXIT.foundErrors, meaning: "The Workspace has at least one error; with `--strict`, at least one error or warning." },
|
|
88
|
+
{ code: EXIT.couldNotRun, meaning: `It could not run: ${USAGE_ERROR}, an unknown format, or no Workspace found.` },
|
|
89
|
+
],
|
|
45
90
|
},
|
|
46
91
|
build: {
|
|
47
92
|
name: "build",
|
|
@@ -55,17 +100,39 @@ export const commands = {
|
|
|
55
100
|
preview: { type: "boolean", default: false, description: "Build a PR preview site holding just the PR head and the base branch's latest Revision, for Compare." },
|
|
56
101
|
base: { type: "string", value: "<branch>", defaultText: "the branch origin/HEAD points at", description: "With `--preview`: the base branch, read from `origin/<branch>` without fetching." },
|
|
57
102
|
},
|
|
103
|
+
examples: [
|
|
104
|
+
{ command: "archidocs build --out site", description: "Write the viewer, the latest Bundle and the past Revisions' Bundles into `site/`, ready for any static host." },
|
|
105
|
+
{ command: "archidocs build --out site --keep 50", description: "Keep Bundles for the latest 50 past Revisions only, and for every tagged one." },
|
|
106
|
+
{ command: "archidocs build --bundle-only --out public", description: "Write only `public/workspace.bundle.json`, for `mcp --bundle` or a script to read." },
|
|
107
|
+
{ command: "archidocs build --preview --base main --out preview", description: "Write a PR preview site that opens on Compare, from `origin/main` to the pull request checked out." },
|
|
108
|
+
],
|
|
109
|
+
exitCodes: [
|
|
110
|
+
{ code: EXIT.ok, meaning: "The site, the Bundle or the preview site was written." },
|
|
111
|
+
{ code: EXIT.foundErrors, meaning: "The Workspace has errors. They are printed as `check` prints them, and nothing is written." },
|
|
112
|
+
{
|
|
113
|
+
code: EXIT.couldNotRun,
|
|
114
|
+
meaning: `It could not run: ${USAGE_ERROR}, flags that don't go together, a \`--keep\` that is not a count or \`all\`, no Workspace found, or with \`--preview\` a Workspace outside git or a base branch that is not in the checkout.`,
|
|
115
|
+
},
|
|
116
|
+
],
|
|
58
117
|
},
|
|
59
118
|
dev: {
|
|
60
119
|
name: "dev",
|
|
61
120
|
synopsis: ["dev [--workspace <dir>] [--port <n>] [--host <host>]"],
|
|
62
|
-
description: "Serve the viewer locally and reload it
|
|
121
|
+
description: "Serve the viewer locally and reload it when a `.yaml` or `.md` file in the Workspace changes.",
|
|
63
122
|
arguments: [],
|
|
64
123
|
flags: {
|
|
65
124
|
workspace: { type: "string", value: "<dir>", defaultText: "the Workspace found from the current folder", description: "Where to look for the Workspace." },
|
|
66
125
|
port: { type: "string", value: "<n>", default: "4321", description: "The port to serve on." },
|
|
67
126
|
host: { type: "string", value: "<host>", default: "127.0.0.1", description: "The address to listen on." },
|
|
68
127
|
},
|
|
128
|
+
examples: [
|
|
129
|
+
{ command: "archidocs dev", description: "Serve the viewer for the Workspace found from the current folder, and print its address." },
|
|
130
|
+
{ command: "archidocs dev --port 4000", description: "Serve on another port, for when the default one is in use." },
|
|
131
|
+
{ command: "archidocs dev --workspace ../architecture", description: "Serve the Workspace found from another folder, such as a checkout of the Workspace repo beside a code repo." },
|
|
132
|
+
{ command: "archidocs dev --host 0.0.0.0", description: "Listen on every network interface, so that other machines can open the viewer." },
|
|
133
|
+
],
|
|
134
|
+
exitCodes: [{ code: EXIT.couldNotRun, meaning: `It could not start: ${USAGE_ERROR}, a \`--port\` that is not a port or is in use, or no Workspace found.` }],
|
|
135
|
+
exitNote: "Once it is serving, `dev` runs until you stop it with Ctrl+C. A Workspace with errors does not stop it: it prints them and keeps serving. The interrupt ends the process, so the exit status is the shell's for an interrupted command (130 in most shells), not a code of its own.",
|
|
69
136
|
},
|
|
70
137
|
export: {
|
|
71
138
|
name: "export",
|
|
@@ -83,27 +150,64 @@ export const commands = {
|
|
|
83
150
|
theme: { type: "string", value: "light|dark", default: "light", description: "The palette: the viewer's light tokens, or its Night shift dark ones." },
|
|
84
151
|
label: { type: "string", value: "<text>", defaultText: "the Workspace, short commit and date", description: "The line under the title, such as `Big Bank · v1.2.0`, in place of the source line." },
|
|
85
152
|
},
|
|
153
|
+
examples: [
|
|
154
|
+
{ command: "archidocs export c2", description: "Write the C2 Generated View, every System and Service, to `c2.svg` in the current folder." },
|
|
155
|
+
{
|
|
156
|
+
command: "archidocs export c2/digital:internet-banking --direction TB --theme dark",
|
|
157
|
+
description: "Write one System's Services, the System named by its Qualified id, laid out top to bottom in the dark palette.",
|
|
158
|
+
},
|
|
159
|
+
{ command: "archidocs export payments:make-a-payment --format png --out make-a-payment.png", description: "Write a Saved View, here a Dynamic View, as a PNG." },
|
|
160
|
+
{ command: "archidocs export --all-saved --out views", description: "Write every Saved View into `views/`, one picture each, named by its id." },
|
|
161
|
+
{ command: 'archidocs export deployment/prod --label "Big Bank · v1.2.0"', description: "Write an Environment's Deployment View with a line of your own under the title, in place of the commit and date." },
|
|
162
|
+
],
|
|
163
|
+
exitCodes: [
|
|
164
|
+
{ code: EXIT.ok, meaning: "Each picture was written, and its path printed." },
|
|
165
|
+
{ code: EXIT.foundErrors, meaning: "The Workspace has errors. They are printed as `check` prints them, and nothing is exported." },
|
|
166
|
+
{
|
|
167
|
+
code: EXIT.couldNotRun,
|
|
168
|
+
meaning: `It could not run: ${USAGE_ERROR}, an unknown format, direction or theme, an unknown View, a View together with \`--all-saved\` or neither of them, \`--all-saved\` without \`--out\`, or no Workspace found.`,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
86
171
|
},
|
|
87
172
|
diff: {
|
|
88
173
|
name: "diff",
|
|
89
174
|
synopsis: ["diff <from> [<to>] [--format text|json|markdown]"],
|
|
90
175
|
description: "Show what changed in the Model between two points in the Workspace's history.",
|
|
91
176
|
arguments: [
|
|
92
|
-
{ name: "<from>", description: "A git ref, or a date, which
|
|
93
|
-
{ name: "[<to>]", description: "A ref or
|
|
177
|
+
{ name: "<from>", description: "A git ref, or a date or time, which names the last Revision at or before it." },
|
|
178
|
+
{ name: "[<to>]", description: "A ref, date or time like `<from>`; with none, the working tree." },
|
|
94
179
|
],
|
|
95
180
|
flags: {
|
|
96
181
|
format: { type: "string", value: "text|json|markdown", default: "text", description: "Print the changes as text, JSON, or Markdown for a PR comment." },
|
|
97
182
|
},
|
|
183
|
+
examples: [
|
|
184
|
+
{ command: "archidocs diff HEAD", description: "Show what your uncommitted edits change, against the last commit." },
|
|
185
|
+
{ command: "archidocs diff origin/main HEAD", description: "Show what a branch changes against the default branch, as a reviewer of its pull request will see it." },
|
|
186
|
+
{ command: "archidocs diff 2026-01-01 2026-06-30", description: "Show the Changes between two dates; each date names the last Revision at or before it." },
|
|
187
|
+
{ command: "archidocs diff origin/main HEAD --format markdown", description: "Write the Changes as Markdown, to post as a pull request comment." },
|
|
188
|
+
],
|
|
189
|
+
exitCodes: [
|
|
190
|
+
{ code: EXIT.ok, meaning: "The Changes were printed. It exits 0 whether or not anything changed, so a script that asks whether the Model changed must read the output, not the exit code." },
|
|
191
|
+
{ code: EXIT.couldNotRun, meaning: `It could not run: ${USAGE_ERROR}, an unknown format, no point or more than two, an unknown ref or date, a date before the first Revision, a sha prefix of several Revisions, no Workspace found, or a Workspace outside git.` },
|
|
192
|
+
],
|
|
98
193
|
},
|
|
99
194
|
"history build": {
|
|
100
195
|
name: "history build",
|
|
101
|
-
synopsis: ["history build [--since <ref|date>]"],
|
|
196
|
+
synopsis: ["history build [--since <ref|date|time>]"],
|
|
102
197
|
description: "Build and cache the Bundle of every past Revision, so later builds and diffs don't have to. Safe to re-run.",
|
|
103
198
|
arguments: [],
|
|
104
199
|
flags: {
|
|
105
|
-
since: { type: "string", value: "<ref|date>", defaultText: "every Revision", description: "Only build Revisions at or after this ref's commit time
|
|
200
|
+
since: { type: "string", value: "<ref|date|time>", defaultText: "every Revision", description: "Only build Revisions at or after this ref's commit time, the start of this date, or this time (UTC unless it gives a zone)." },
|
|
106
201
|
},
|
|
202
|
+
examples: [
|
|
203
|
+
{ command: "archidocs history build", description: "Build and cache the Bundle of every past Revision, so the next `build` or `diff` reads them from the cache." },
|
|
204
|
+
{ command: "archidocs history build --since 2026-01-01", description: "Only build the Revisions from the start of that date on." },
|
|
205
|
+
{ command: "archidocs history build --since v1.0.0", description: "Only build the Revisions at or after a tag's commit." },
|
|
206
|
+
],
|
|
207
|
+
exitCodes: [
|
|
208
|
+
{ code: EXIT.ok, meaning: "Every Revision asked for is in the cache. It prints how many it built and how many were already built." },
|
|
209
|
+
{ code: EXIT.couldNotRun, meaning: `It could not run: ${USAGE_ERROR}, an unknown \`--since\` ref or date, no Workspace found, or a Workspace outside git.` },
|
|
210
|
+
],
|
|
107
211
|
},
|
|
108
212
|
mcp: {
|
|
109
213
|
name: "mcp",
|
|
@@ -119,6 +223,27 @@ export const commands = {
|
|
|
119
223
|
port: { type: "string", value: "<n>", defaultText: "3737", description: "With `--http`: the port to serve on." },
|
|
120
224
|
"allow-writes": { type: "boolean", default: false, description: "With `--http`: allow the write tools, which are off over HTTP by default." },
|
|
121
225
|
},
|
|
226
|
+
examples: [
|
|
227
|
+
{
|
|
228
|
+
command: "archidocs mcp --workspace archidocs",
|
|
229
|
+
description: "Serve a Workspace checkout over stdio, with the read and write tools. This is the command to register with a coding agent, which starts it from the repo root.",
|
|
230
|
+
},
|
|
231
|
+
{ command: "archidocs mcp --bundle https://big-bank.archidocs.dev/workspace.bundle.json", description: "Serve a published Bundle, here the Big Bank demo's, with the read tools only." },
|
|
232
|
+
{
|
|
233
|
+
command: "archidocs mcp --bundle https://architecture.example.com/workspace.bundle.json --viewer-url https://architecture.example.com/",
|
|
234
|
+
description: "Serve your own published Bundle, with links to its viewer in the tool results.",
|
|
235
|
+
},
|
|
236
|
+
{ command: "archidocs mcp --http --port 3737 --workspace archidocs", description: "Serve Streamable HTTP at `/mcp` on a loopback address, with the write tools off." },
|
|
237
|
+
{ command: "archidocs mcp --http --allow-writes --workspace archidocs", description: "Serve over HTTP with the write tools on." },
|
|
238
|
+
],
|
|
239
|
+
exitCodes: [
|
|
240
|
+
{ code: EXIT.ok, meaning: "Over stdio, the client closed the connection." },
|
|
241
|
+
{
|
|
242
|
+
code: EXIT.couldNotRun,
|
|
243
|
+
meaning: `It could not start: ${USAGE_ERROR}, flags that don't go together, a \`--viewer-url\` that is not a URL, a \`--port\` that is not a port or is in use, a \`--host\` that is not a loopback address, or no Workspace found when \`--bundle\` is not given.`,
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
exitNote: "With `--http`, `mcp` runs until you stop it with Ctrl+C. The interrupt ends the process, so the exit status is the shell's for an interrupted command (130 in most shells), not a code of its own. A Bundle that can't be read does not stop the server: each tool call answers `source_unavailable`, and the next call tries again.",
|
|
122
247
|
},
|
|
123
248
|
};
|
|
124
249
|
/** Every command, in the order the usage lists them. */
|
package/dist/cli/dev.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Issue } from "../core/index.ts";
|
|
2
|
+
import { type Checkout } from "../workspace/index.ts";
|
|
2
3
|
export declare const DEFAULT_DEV_PORT = 4321;
|
|
3
4
|
export interface DevOptions {
|
|
4
|
-
/** The Workspace root
|
|
5
|
-
|
|
5
|
+
/** The Workspace to serve. Its root is watched for changes, and its name is how the viewer's exports name the Workspace, as `site.json` does in a built site. */
|
|
6
|
+
checkout: Checkout;
|
|
6
7
|
/** The prebuilt viewer to serve. */
|
|
7
8
|
viewerDir: string;
|
|
8
|
-
/** How the viewer's exports name the Workspace, as `site.json` does in a built site. */
|
|
9
|
-
workspace: string;
|
|
10
9
|
host?: string;
|
|
11
10
|
/** 0 picks a free port. */
|
|
12
11
|
port?: number;
|
|
@@ -28,4 +27,4 @@ export interface DevServer {
|
|
|
28
27
|
* the Workspace on every file change. A Workspace with errors keeps serving
|
|
29
28
|
* its last good Bundle and shows the errors in the page instead.
|
|
30
29
|
*/
|
|
31
|
-
export declare function serveDev({
|
|
30
|
+
export declare function serveDev({ checkout, viewerDir, host, port, onLoad }: DevOptions): Promise<DevServer>;
|
package/dist/cli/dev.js
CHANGED
|
@@ -2,10 +2,9 @@ import { watch } from "node:fs";
|
|
|
2
2
|
import { readFile, stat } from "node:fs/promises";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
import { extname, join, normalize, sep } from "node:path";
|
|
5
|
-
import { load, nodeFileSystem, serializeBundle } from "../core/index.js";
|
|
6
5
|
import { formatText } from "./format.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { isWorkspaceFile } from "../workspace/index.js";
|
|
7
|
+
import { INDEX_PATH, INDEX_VERSION, LATEST_BUNDLE_PATH, serializeBundle, serializeIndex, serializeSiteFile, SITE_FILE_PATH } from "../revisions/index.js";
|
|
9
8
|
export const DEFAULT_DEV_PORT = 4321;
|
|
10
9
|
/** The path the page listens on for reloads; under `__archidocs/` so it can't clash with a site file. */
|
|
11
10
|
const EVENTS = "/__archidocs/events";
|
|
@@ -42,7 +41,7 @@ const CLIENT = `<script>
|
|
|
42
41
|
* the Workspace on every file change. A Workspace with errors keeps serving
|
|
43
42
|
* its last good Bundle and shows the errors in the page instead.
|
|
44
43
|
*/
|
|
45
|
-
export async function serveDev({
|
|
44
|
+
export async function serveDev({ checkout, viewerDir, host = "127.0.0.1", port = DEFAULT_DEV_PORT, onLoad }) {
|
|
46
45
|
let bundleJson;
|
|
47
46
|
let errors;
|
|
48
47
|
const clients = new Set();
|
|
@@ -52,8 +51,7 @@ export async function serveDev({ root, viewerDir, workspace, host = "127.0.0.1",
|
|
|
52
51
|
};
|
|
53
52
|
let first = true;
|
|
54
53
|
const rebuild = async () => {
|
|
55
|
-
const {
|
|
56
|
-
const { bundle, issues } = await load({ fs: nodeFileSystem(), root, commit, builtAt });
|
|
54
|
+
const { bundle, issues } = await checkout.load();
|
|
57
55
|
const failed = issues.filter((i) => i.severity === "error");
|
|
58
56
|
const kept = failed.length > 0 && bundleJson !== undefined;
|
|
59
57
|
onLoad?.({ issues, kept, first });
|
|
@@ -89,8 +87,8 @@ export async function serveDev({ root, viewerDir, workspace, host = "127.0.0.1",
|
|
|
89
87
|
};
|
|
90
88
|
await rebuild();
|
|
91
89
|
const index = (await readFile(join(viewerDir, "index.html"), "utf8")).replace("</body>", `${CLIENT}</body>`);
|
|
92
|
-
const site =
|
|
93
|
-
const noHistory =
|
|
90
|
+
const site = serializeSiteFile(await checkout.name());
|
|
91
|
+
const noHistory = serializeIndex({ schemaVersion: INDEX_VERSION, revisions: [] });
|
|
94
92
|
const server = createServer((req, res) => {
|
|
95
93
|
void (async () => {
|
|
96
94
|
const path = decodeURIComponent(new URL(req.url ?? "/", "http://dev").pathname);
|
|
@@ -109,12 +107,12 @@ export async function serveDev({ root, viewerDir, workspace, host = "127.0.0.1",
|
|
|
109
107
|
}
|
|
110
108
|
if (path === "/" || path === "/index.html")
|
|
111
109
|
return send(index, TYPES[".html"]);
|
|
112
|
-
if (path ===
|
|
110
|
+
if (path === `/${LATEST_BUNDLE_PATH}`)
|
|
113
111
|
return send(bundleJson, TYPES[".json"]);
|
|
114
|
-
if (path ===
|
|
112
|
+
if (path === `/${SITE_FILE_PATH}`)
|
|
115
113
|
return send(site, TYPES[".json"]);
|
|
116
114
|
// Dev mode shows the working tree only; the viewer reads an empty index as no history.
|
|
117
|
-
if (path ===
|
|
115
|
+
if (path === `/${INDEX_PATH}`)
|
|
118
116
|
return send(noHistory, TYPES[".json"]);
|
|
119
117
|
const file = normalize(join(viewerDir, path));
|
|
120
118
|
if (!file.startsWith(normalize(viewerDir + sep)) || !(await stat(file).catch(() => undefined))?.isFile()) {
|
|
@@ -132,9 +130,9 @@ export async function serveDev({ root, viewerDir, workspace, host = "127.0.0.1",
|
|
|
132
130
|
server.once("error", fail);
|
|
133
131
|
server.listen(port, host, () => done());
|
|
134
132
|
});
|
|
135
|
-
const watcher = watch(root, { recursive: true }, (_event, name) => {
|
|
136
|
-
//
|
|
137
|
-
if (name && name
|
|
133
|
+
const watcher = watch(checkout.root, { recursive: true }, (_event, name) => {
|
|
134
|
+
// Only a Workspace file feeds the Bundle. Some platforms give no name, so reload then.
|
|
135
|
+
if (name && !isWorkspaceFile(name))
|
|
138
136
|
return;
|
|
139
137
|
schedule();
|
|
140
138
|
});
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type Change } from "../core/index.ts";
|
|
2
|
+
import type { DiffSide } from "../commands/index.ts";
|
|
2
3
|
export declare const diffFormats: readonly ["text", "json", "markdown"];
|
|
3
4
|
export type DiffFormat = (typeof diffFormats)[number];
|
|
4
|
-
/** One side of a diff: the point as given and the commit it resolved to (null for the working tree). */
|
|
5
|
-
export interface DiffSide {
|
|
6
|
-
point: string;
|
|
7
|
-
commit: string | null;
|
|
8
|
-
}
|
|
9
5
|
export declare function formatDiff(changes: Change[], from: DiffSide, to: DiffSide, format: DiffFormat): string;
|
package/dist/cli/init.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Where
|
|
1
|
+
/** Where coding agents look for skills; the stub goes into each. */
|
|
2
2
|
export declare const SKILL_DIRS: readonly [".agents/skills", ".claude/skills", ".github/skills"];
|
|
3
3
|
export interface InitOptions {
|
|
4
4
|
/** The repo being set up: its git top level, or the current folder outside git. */
|
package/dist/cli/init.js
CHANGED
|
@@ -3,7 +3,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { dirname, join, relative, sep } from "node:path";
|
|
4
4
|
import { findWorkspaceRoot, nodeFileSystem } from "../core/index.js";
|
|
5
5
|
import { SKILL_NAME, skillStub } from "../guide/index.js";
|
|
6
|
-
/** Where
|
|
6
|
+
/** Where coding agents look for skills; the stub goes into each. */
|
|
7
7
|
export const SKILL_DIRS = [".agents/skills", ".claude/skills", ".github/skills"];
|
|
8
8
|
const STARTER_WORKSPACE = `# The Archidocs Workspace root: Teams and Environments are defined here only.
|
|
9
9
|
# Each Project is a folder below this one holding a project.yaml.
|
|
@@ -58,7 +58,7 @@ export async function init({ repoRoot, cwd, skillOnly, workspace }) {
|
|
|
58
58
|
if (await appendOnce(join(repoRoot, "CLAUDE.md"), pointer, hasPointer, { create: false }))
|
|
59
59
|
wrote(join(repoRoot, "CLAUDE.md"), "Updated");
|
|
60
60
|
const mcpPath = workspace ?? where ?? "<path-to-workspace-checkout>";
|
|
61
|
-
out.push("", "Register the Archidocs MCP server with your agent
|
|
61
|
+
out.push("", "Register the Archidocs MCP server with your coding agent, started from the repo root:", "", ` archidocs mcp --workspace ${mcpPath}`, "", ...(workspaceDir === undefined ? ["Point --workspace at a local checkout of the Workspace repo, relative to where the coding agent starts the server."] : []));
|
|
62
62
|
return out;
|
|
63
63
|
}
|
|
64
64
|
/**
|