archidocs 1.0.0 → 1.3.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 +231 -0
- package/dist/cli/commands.d.ts +543 -0
- package/dist/cli/commands.js +299 -0
- package/dist/cli/format.d.ts +2 -2
- package/dist/cli/format.js +9 -5
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.js +2 -2
- package/dist/cli/main.js +27 -73
- 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/query.d.ts +1 -1
- package/dist/core/rules.d.ts +30 -0
- package/dist/core/rules.js +194 -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/mcp/errors.d.ts +37 -0
- package/dist/mcp/errors.js +35 -0
- 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 +15 -13
- package/dist/mcp/writes.js +2 -1
- package/dist/render/font.d.ts +14 -8
- package/dist/render/font.js +11 -10
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.js +1 -0
- package/dist/render/layout.d.ts +20 -3
- package/dist/render/layout.js +49 -12
- package/dist/render/png.d.ts +1 -1
- package/dist/render/png.js +5 -5
- package/dist/render/sequence-svg.d.ts +8 -3
- package/dist/render/sequence-svg.js +32 -32
- package/dist/render/sequence.d.ts +1 -1
- package/dist/render/sequence.js +1 -1
- package/dist/render/svg.d.ts +19 -6
- package/dist/render/svg.js +148 -85
- package/dist/render/text.d.ts +6 -4
- package/dist/render/text.js +11 -9
- package/dist/render/tokens.d.ts +53 -0
- package/dist/render/tokens.js +71 -0
- package/dist/schema/adr.js +18 -13
- package/dist/schema/workspace.js +226 -130
- package/dist/viewer/assets/index-BXa5R96a.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-D1zzLB1s.js → png-CAaXWR-k.js} +1 -1
- package/dist/viewer/assets/svg-BPVHfD36.js +2 -0
- package/dist/viewer/index.html +2 -2
- package/guide/SKILL.md +1 -1
- package/guide/topics/bootstrap.md +1 -1
- package/guide/topics/relationships.md +1 -1
- package/package.json +20 -4
- 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-BwUCSYuf.js +0 -113
- package/dist/viewer/assets/index-DvKgCpBr.css +0 -1
- package/dist/viewer/assets/svg-Cw4FMsm3.js +0 -2
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's commands and flags, described once. The CLI parses each
|
|
3
|
+
* command's arguments with these flags and prints its usage text from them;
|
|
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`.
|
|
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 declare const EXIT: {
|
|
12
|
+
readonly ok: 0;
|
|
13
|
+
readonly foundErrors: 1;
|
|
14
|
+
readonly couldNotRun: 2;
|
|
15
|
+
};
|
|
16
|
+
/** What a command that needs a Workspace says, exiting 2, when the search for one finds none. */
|
|
17
|
+
export declare const NO_WORKSPACE = "No workspace.yaml found in this folder, its archidocs/ folder, or any folder above.";
|
|
18
|
+
/** One flag. Its key in `flags` is its name, without the leading `--`. */
|
|
19
|
+
export interface FlagDefinition {
|
|
20
|
+
readonly type: "string" | "boolean";
|
|
21
|
+
/** What a string flag takes, as the usage shows it: `<dir>` or `text|json`. */
|
|
22
|
+
readonly value?: string;
|
|
23
|
+
/** The value the parser fills in when the flag is absent. */
|
|
24
|
+
readonly default?: string | boolean;
|
|
25
|
+
/** The default in words, for a flag whose default the command works out itself. */
|
|
26
|
+
readonly defaultText?: string;
|
|
27
|
+
readonly description: string;
|
|
28
|
+
}
|
|
29
|
+
/** A positional argument, as the synopsis writes it: `<view-id>` or `[topic]`. */
|
|
30
|
+
export interface ArgumentDefinition {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly description: string;
|
|
33
|
+
}
|
|
34
|
+
/** One real command line for the reference, checked like any other with `parseCommandLine`. */
|
|
35
|
+
export interface ExampleDefinition {
|
|
36
|
+
/** The whole line as typed, starting with `archidocs`. */
|
|
37
|
+
readonly command: string;
|
|
38
|
+
/** One line on what it does. */
|
|
39
|
+
readonly description: string;
|
|
40
|
+
}
|
|
41
|
+
/** One exit code a command can end with. */
|
|
42
|
+
export interface ExitCodeDefinition {
|
|
43
|
+
readonly code: (typeof EXIT)[keyof typeof EXIT];
|
|
44
|
+
/** When the command ends with it. */
|
|
45
|
+
readonly meaning: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CommandDefinition {
|
|
48
|
+
/** The words after `archidocs`: `check`, or `history build` for a subcommand. */
|
|
49
|
+
readonly name: string;
|
|
50
|
+
/** Each way to call it, after `archidocs `. */
|
|
51
|
+
readonly synopsis: readonly string[];
|
|
52
|
+
/** One line on what it does. */
|
|
53
|
+
readonly description: string;
|
|
54
|
+
readonly arguments: readonly ArgumentDefinition[];
|
|
55
|
+
readonly flags: Readonly<Record<string, FlagDefinition>>;
|
|
56
|
+
/** At least one, the plainest first. */
|
|
57
|
+
readonly examples: readonly [ExampleDefinition, ...ExampleDefinition[]];
|
|
58
|
+
/** Every exit code the command itself ends with, lowest first. */
|
|
59
|
+
readonly exitCodes: readonly [ExitCodeDefinition, ...ExitCodeDefinition[]];
|
|
60
|
+
/** For a command that serves until it is stopped: how it ends, when no exit code is its own. */
|
|
61
|
+
readonly exitNote?: string;
|
|
62
|
+
}
|
|
63
|
+
export declare const commands: {
|
|
64
|
+
readonly version: {
|
|
65
|
+
readonly name: "version";
|
|
66
|
+
readonly synopsis: readonly ["version [--format text|json]"];
|
|
67
|
+
readonly description: "Print the CLI's version and the Bundle schemaVersion it writes.";
|
|
68
|
+
readonly arguments: readonly [];
|
|
69
|
+
readonly flags: {
|
|
70
|
+
readonly format: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly value: "text|json";
|
|
73
|
+
readonly default: "text";
|
|
74
|
+
readonly description: "Print a line of text, or a JSON object with `version` and `schemaVersion`.";
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly examples: readonly [{
|
|
78
|
+
readonly command: "archidocs version";
|
|
79
|
+
readonly description: "Print both versions as one line of text.";
|
|
80
|
+
}, {
|
|
81
|
+
readonly command: "archidocs version --format json";
|
|
82
|
+
readonly description: "Print them as JSON, for a CI cache key that changes when the Bundle schemaVersion does.";
|
|
83
|
+
}];
|
|
84
|
+
readonly exitCodes: readonly [{
|
|
85
|
+
readonly code: 0;
|
|
86
|
+
readonly meaning: "The version was printed.";
|
|
87
|
+
}, {
|
|
88
|
+
readonly code: 2;
|
|
89
|
+
readonly meaning: "It could not run: an unknown flag, a flag missing its value, or an unknown format.";
|
|
90
|
+
}];
|
|
91
|
+
};
|
|
92
|
+
readonly init: {
|
|
93
|
+
readonly name: "init";
|
|
94
|
+
readonly synopsis: readonly ["init [--skill [--workspace <dir>]]"];
|
|
95
|
+
readonly description: "Set up a Workspace in this repo and install the agent skill, or with `--skill` install only the skill in a code repo. Safe to re-run.";
|
|
96
|
+
readonly arguments: readonly [];
|
|
97
|
+
readonly flags: {
|
|
98
|
+
readonly skill: {
|
|
99
|
+
readonly type: "boolean";
|
|
100
|
+
readonly default: false;
|
|
101
|
+
readonly description: "Install only the agent skill and its pointers, for a code repo that has no Workspace of its own.";
|
|
102
|
+
};
|
|
103
|
+
readonly workspace: {
|
|
104
|
+
readonly type: "string";
|
|
105
|
+
readonly value: "<dir>";
|
|
106
|
+
readonly description: "With `--skill`: the Workspace checkout that the printed MCP command points at.";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
readonly examples: readonly [{
|
|
110
|
+
readonly command: "archidocs init";
|
|
111
|
+
readonly description: "Write `archidocs/workspace.yaml` if the repo has no Workspace yet, and install the agent skill.";
|
|
112
|
+
}, {
|
|
113
|
+
readonly command: "archidocs init --skill --workspace ../architecture/archidocs";
|
|
114
|
+
readonly description: "In a code repo, install only the agent skill, and print the MCP command for the Workspace checked out beside it.";
|
|
115
|
+
}];
|
|
116
|
+
readonly exitCodes: readonly [{
|
|
117
|
+
readonly code: 0;
|
|
118
|
+
readonly meaning: "The Workspace and the agent skill are set up, or already were. Each file written or updated is printed.";
|
|
119
|
+
}, {
|
|
120
|
+
readonly code: 2;
|
|
121
|
+
readonly meaning: "It could not run: an unknown flag, a flag missing its value, `--workspace` without `--skill`, or a file it could not write.";
|
|
122
|
+
}];
|
|
123
|
+
};
|
|
124
|
+
readonly guide: {
|
|
125
|
+
readonly name: "guide";
|
|
126
|
+
readonly synopsis: readonly ["guide [topic]"];
|
|
127
|
+
readonly description: "Print the authoring guide for agents, or one of its task topics.";
|
|
128
|
+
readonly arguments: readonly [{
|
|
129
|
+
readonly name: "[topic]";
|
|
130
|
+
readonly description: "A task topic; with none, the guide and the list of topics.";
|
|
131
|
+
}];
|
|
132
|
+
readonly flags: {};
|
|
133
|
+
readonly examples: readonly [{
|
|
134
|
+
readonly command: "archidocs guide";
|
|
135
|
+
readonly description: "Print the guide: the Model in brief, the edit loop and the list of task topics.";
|
|
136
|
+
}, {
|
|
137
|
+
readonly command: "archidocs guide add-service";
|
|
138
|
+
readonly description: "Print one task topic, here how to add a Service.";
|
|
139
|
+
}];
|
|
140
|
+
readonly exitCodes: readonly [{
|
|
141
|
+
readonly code: 0;
|
|
142
|
+
readonly meaning: "The guide or the topic was printed.";
|
|
143
|
+
}, {
|
|
144
|
+
readonly code: 2;
|
|
145
|
+
readonly 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.";
|
|
146
|
+
}];
|
|
147
|
+
};
|
|
148
|
+
readonly check: {
|
|
149
|
+
readonly name: "check";
|
|
150
|
+
readonly synopsis: readonly ["check [--format text|json|github] [--strict]"];
|
|
151
|
+
readonly description: "Validate the Workspace found from the current folder and print each issue with its file, line and rule.";
|
|
152
|
+
readonly arguments: readonly [];
|
|
153
|
+
readonly flags: {
|
|
154
|
+
readonly format: {
|
|
155
|
+
readonly type: "string";
|
|
156
|
+
readonly value: "text|json|github";
|
|
157
|
+
readonly default: "text";
|
|
158
|
+
readonly description: "Print issues as text, as JSON, or as GitHub Actions annotations.";
|
|
159
|
+
};
|
|
160
|
+
readonly strict: {
|
|
161
|
+
readonly type: "boolean";
|
|
162
|
+
readonly default: false;
|
|
163
|
+
readonly description: "Exit 1 on warnings too, not only on errors.";
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
readonly examples: readonly [{
|
|
167
|
+
readonly command: "archidocs check";
|
|
168
|
+
readonly description: "Validate the Workspace and print its issues grouped by file, then a count and a link to each rule's page.";
|
|
169
|
+
}, {
|
|
170
|
+
readonly command: "archidocs check --strict";
|
|
171
|
+
readonly description: "Fail on warnings as well as errors, for a CI job that keeps the Workspace clean.";
|
|
172
|
+
}, {
|
|
173
|
+
readonly command: "archidocs check --format github";
|
|
174
|
+
readonly description: "Print each issue as a GitHub Actions annotation, which a pull request shows on the line the issue is about.";
|
|
175
|
+
}, {
|
|
176
|
+
readonly command: "archidocs check --format json";
|
|
177
|
+
readonly description: "Print the issues and a count of errors and warnings as JSON, for a script.";
|
|
178
|
+
}];
|
|
179
|
+
readonly exitCodes: readonly [{
|
|
180
|
+
readonly code: 0;
|
|
181
|
+
readonly meaning: "No errors. Warnings are printed and still exit 0, unless `--strict` is given.";
|
|
182
|
+
}, {
|
|
183
|
+
readonly code: 1;
|
|
184
|
+
readonly meaning: "The Workspace has at least one error; with `--strict`, at least one error or warning.";
|
|
185
|
+
}, {
|
|
186
|
+
readonly code: 2;
|
|
187
|
+
readonly meaning: "It could not run: an unknown flag, a flag missing its value, an unknown format, or no Workspace found.";
|
|
188
|
+
}];
|
|
189
|
+
};
|
|
190
|
+
readonly build: {
|
|
191
|
+
readonly name: "build";
|
|
192
|
+
readonly synopsis: readonly ["build [--out <dir>] [--bundle-only] [--keep <n|all>]", "build --preview [--base <branch>] [--out <dir>]"];
|
|
193
|
+
readonly description: "Write the static viewer site with the Workspace's Bundle and past Revisions, or a PR preview site.";
|
|
194
|
+
readonly arguments: readonly [];
|
|
195
|
+
readonly flags: {
|
|
196
|
+
readonly out: {
|
|
197
|
+
readonly type: "string";
|
|
198
|
+
readonly value: "<dir>";
|
|
199
|
+
readonly default: "dist";
|
|
200
|
+
readonly description: "The folder to write the site, or the Bundle, into.";
|
|
201
|
+
};
|
|
202
|
+
readonly "bundle-only": {
|
|
203
|
+
readonly type: "boolean";
|
|
204
|
+
readonly default: false;
|
|
205
|
+
readonly description: "Write only `workspace.bundle.json`, without the viewer or past Revisions.";
|
|
206
|
+
};
|
|
207
|
+
readonly keep: {
|
|
208
|
+
readonly type: "string";
|
|
209
|
+
readonly value: "<n|all>";
|
|
210
|
+
readonly defaultText: "200";
|
|
211
|
+
readonly description: "How many of the latest past Revisions the site keeps Bundles for, or `all`; tagged Revisions are always kept.";
|
|
212
|
+
};
|
|
213
|
+
readonly preview: {
|
|
214
|
+
readonly type: "boolean";
|
|
215
|
+
readonly default: false;
|
|
216
|
+
readonly description: "Build a PR preview site holding just the PR head and the base branch's latest Revision, for Compare.";
|
|
217
|
+
};
|
|
218
|
+
readonly base: {
|
|
219
|
+
readonly type: "string";
|
|
220
|
+
readonly value: "<branch>";
|
|
221
|
+
readonly defaultText: "the branch origin/HEAD points at";
|
|
222
|
+
readonly description: "With `--preview`: the base branch, read from `origin/<branch>` without fetching.";
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
readonly examples: readonly [{
|
|
226
|
+
readonly command: "archidocs build --out site";
|
|
227
|
+
readonly description: "Write the viewer, the latest Bundle and the past Revisions' Bundles into `site/`, ready for any static host.";
|
|
228
|
+
}, {
|
|
229
|
+
readonly command: "archidocs build --out site --keep 50";
|
|
230
|
+
readonly description: "Keep Bundles for the latest 50 past Revisions only, and for every tagged one.";
|
|
231
|
+
}, {
|
|
232
|
+
readonly command: "archidocs build --bundle-only --out public";
|
|
233
|
+
readonly description: "Write only `public/workspace.bundle.json`, for `mcp --bundle` or a script to read.";
|
|
234
|
+
}, {
|
|
235
|
+
readonly command: "archidocs build --preview --base main --out preview";
|
|
236
|
+
readonly description: "Write a PR preview site that opens on Compare, from `origin/main` to the pull request checked out.";
|
|
237
|
+
}];
|
|
238
|
+
readonly exitCodes: readonly [{
|
|
239
|
+
readonly code: 0;
|
|
240
|
+
readonly meaning: "The site, the Bundle or the preview site was written.";
|
|
241
|
+
}, {
|
|
242
|
+
readonly code: 1;
|
|
243
|
+
readonly meaning: "The Workspace has errors. They are printed as `check` prints them, and nothing is written.";
|
|
244
|
+
}, {
|
|
245
|
+
readonly code: 2;
|
|
246
|
+
readonly meaning: "It could not run: an unknown flag, a flag missing its value, 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.";
|
|
247
|
+
}];
|
|
248
|
+
};
|
|
249
|
+
readonly dev: {
|
|
250
|
+
readonly name: "dev";
|
|
251
|
+
readonly synopsis: readonly ["dev [--workspace <dir>] [--port <n>] [--host <host>]"];
|
|
252
|
+
readonly description: "Serve the viewer locally and reload it as you edit the Workspace.";
|
|
253
|
+
readonly arguments: readonly [];
|
|
254
|
+
readonly flags: {
|
|
255
|
+
readonly workspace: {
|
|
256
|
+
readonly type: "string";
|
|
257
|
+
readonly value: "<dir>";
|
|
258
|
+
readonly defaultText: "the Workspace found from the current folder";
|
|
259
|
+
readonly description: "Where to look for the Workspace.";
|
|
260
|
+
};
|
|
261
|
+
readonly port: {
|
|
262
|
+
readonly type: "string";
|
|
263
|
+
readonly value: "<n>";
|
|
264
|
+
readonly default: "4321";
|
|
265
|
+
readonly description: "The port to serve on.";
|
|
266
|
+
};
|
|
267
|
+
readonly host: {
|
|
268
|
+
readonly type: "string";
|
|
269
|
+
readonly value: "<host>";
|
|
270
|
+
readonly default: "127.0.0.1";
|
|
271
|
+
readonly description: "The address to listen on.";
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
readonly examples: readonly [{
|
|
275
|
+
readonly command: "archidocs dev";
|
|
276
|
+
readonly description: "Serve the viewer for the Workspace found from the current folder, and print its address.";
|
|
277
|
+
}, {
|
|
278
|
+
readonly command: "archidocs dev --port 4000";
|
|
279
|
+
readonly description: "Serve on another port, for when the default one is in use.";
|
|
280
|
+
}, {
|
|
281
|
+
readonly command: "archidocs dev --workspace ../architecture";
|
|
282
|
+
readonly description: "Serve the Workspace found from another folder, such as a checkout of the Workspace repo beside a code repo.";
|
|
283
|
+
}, {
|
|
284
|
+
readonly command: "archidocs dev --host 0.0.0.0";
|
|
285
|
+
readonly description: "Listen on every network interface, so that other machines can open the viewer.";
|
|
286
|
+
}];
|
|
287
|
+
readonly exitCodes: readonly [{
|
|
288
|
+
readonly code: 2;
|
|
289
|
+
readonly meaning: "It could not start: an unknown flag, a flag missing its value, a `--port` that is not a port or is in use, or no Workspace found.";
|
|
290
|
+
}];
|
|
291
|
+
readonly 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.";
|
|
292
|
+
};
|
|
293
|
+
readonly export: {
|
|
294
|
+
readonly name: "export";
|
|
295
|
+
readonly synopsis: readonly ["export <view-id> [--format svg|png] [--out <file>] [--direction TB|BT|LR|RL] [--theme light|dark] [--label <text>]", "export --all-saved --out <dir> [--format svg|png] [--direction TB|BT|LR|RL] [--theme light|dark] [--label <text>]"];
|
|
296
|
+
readonly description: "Render a View, or every Saved View, to an SVG or PNG picture.";
|
|
297
|
+
readonly arguments: readonly [{
|
|
298
|
+
readonly name: "<view-id>";
|
|
299
|
+
readonly description: "The View: c1, c2, c2/<system>, c3/<service>, deployment/<environment>, or a Saved View as project:view-id.";
|
|
300
|
+
}];
|
|
301
|
+
readonly flags: {
|
|
302
|
+
readonly format: {
|
|
303
|
+
readonly type: "string";
|
|
304
|
+
readonly value: "svg|png";
|
|
305
|
+
readonly default: "svg";
|
|
306
|
+
readonly description: "The picture format.";
|
|
307
|
+
};
|
|
308
|
+
readonly out: {
|
|
309
|
+
readonly type: "string";
|
|
310
|
+
readonly value: "<file>";
|
|
311
|
+
readonly defaultText: "<view-id>.<format> in the current folder";
|
|
312
|
+
readonly description: "The file to write; with `--all-saved`, the folder to write each picture into.";
|
|
313
|
+
};
|
|
314
|
+
readonly direction: {
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
readonly value: "TB|BT|LR|RL";
|
|
317
|
+
readonly defaultText: "a Saved View's own direction, else LR";
|
|
318
|
+
readonly description: "The layout direction: top to bottom, bottom to top, left to right or right to left. Dynamic Views ignore it.";
|
|
319
|
+
};
|
|
320
|
+
readonly "all-saved": {
|
|
321
|
+
readonly type: "boolean";
|
|
322
|
+
readonly default: false;
|
|
323
|
+
readonly description: "Render every Saved View into the `--out` folder, one picture each.";
|
|
324
|
+
};
|
|
325
|
+
readonly theme: {
|
|
326
|
+
readonly type: "string";
|
|
327
|
+
readonly value: "light|dark";
|
|
328
|
+
readonly default: "light";
|
|
329
|
+
readonly description: "The palette: the viewer's light tokens, or its Night shift dark ones.";
|
|
330
|
+
};
|
|
331
|
+
readonly label: {
|
|
332
|
+
readonly type: "string";
|
|
333
|
+
readonly value: "<text>";
|
|
334
|
+
readonly defaultText: "the Workspace, short commit and date";
|
|
335
|
+
readonly description: "The line under the title, such as `Big Bank · v1.2.0`, in place of the source line.";
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
readonly examples: readonly [{
|
|
339
|
+
readonly command: "archidocs export c2";
|
|
340
|
+
readonly description: "Write the C2 Generated View, every System and Service, to `c2.svg` in the current folder.";
|
|
341
|
+
}, {
|
|
342
|
+
readonly command: "archidocs export c2/digital:internet-banking --direction TB --theme dark";
|
|
343
|
+
readonly description: "Write one System's Services, the System named by its Qualified id, laid out top to bottom in the dark palette.";
|
|
344
|
+
}, {
|
|
345
|
+
readonly command: "archidocs export payments:make-a-payment --format png --out make-a-payment.png";
|
|
346
|
+
readonly description: "Write a Saved View, here a Dynamic View, as a PNG.";
|
|
347
|
+
}, {
|
|
348
|
+
readonly command: "archidocs export --all-saved --out views";
|
|
349
|
+
readonly description: "Write every Saved View into `views/`, one picture each, named by its id.";
|
|
350
|
+
}, {
|
|
351
|
+
readonly command: "archidocs export deployment/prod --label \"Big Bank · v1.2.0\"";
|
|
352
|
+
readonly description: "Write an Environment's Deployment View with a line of your own under the title, in place of the commit and date.";
|
|
353
|
+
}];
|
|
354
|
+
readonly exitCodes: readonly [{
|
|
355
|
+
readonly code: 0;
|
|
356
|
+
readonly meaning: "Each picture was written, and its path printed.";
|
|
357
|
+
}, {
|
|
358
|
+
readonly code: 1;
|
|
359
|
+
readonly meaning: "The Workspace has errors. They are printed as `check` prints them, and nothing is exported.";
|
|
360
|
+
}, {
|
|
361
|
+
readonly code: 2;
|
|
362
|
+
readonly meaning: "It could not run: an unknown flag, a flag missing its value, 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.";
|
|
363
|
+
}];
|
|
364
|
+
};
|
|
365
|
+
readonly diff: {
|
|
366
|
+
readonly name: "diff";
|
|
367
|
+
readonly synopsis: readonly ["diff <from> [<to>] [--format text|json|markdown]"];
|
|
368
|
+
readonly description: "Show what changed in the Model between two points in the Workspace's history.";
|
|
369
|
+
readonly arguments: readonly [{
|
|
370
|
+
readonly name: "<from>";
|
|
371
|
+
readonly description: "A git ref, or a date, which means the last default-branch commit at or before it.";
|
|
372
|
+
}, {
|
|
373
|
+
readonly name: "[<to>]";
|
|
374
|
+
readonly description: "A ref or date like `<from>`; with none, the working tree.";
|
|
375
|
+
}];
|
|
376
|
+
readonly flags: {
|
|
377
|
+
readonly format: {
|
|
378
|
+
readonly type: "string";
|
|
379
|
+
readonly value: "text|json|markdown";
|
|
380
|
+
readonly default: "text";
|
|
381
|
+
readonly description: "Print the changes as text, JSON, or Markdown for a PR comment.";
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
readonly examples: readonly [{
|
|
385
|
+
readonly command: "archidocs diff HEAD";
|
|
386
|
+
readonly description: "Show what your uncommitted edits change, against the last commit.";
|
|
387
|
+
}, {
|
|
388
|
+
readonly command: "archidocs diff origin/main HEAD";
|
|
389
|
+
readonly description: "Show what a branch changes against the default branch, as a reviewer of its pull request will see it.";
|
|
390
|
+
}, {
|
|
391
|
+
readonly command: "archidocs diff 2026-01-01 2026-06-30";
|
|
392
|
+
readonly description: "Show the Changes between two dates; each date means the last default-branch commit at or before it.";
|
|
393
|
+
}, {
|
|
394
|
+
readonly command: "archidocs diff origin/main HEAD --format markdown";
|
|
395
|
+
readonly description: "Write the Changes as Markdown, to post as a pull request comment.";
|
|
396
|
+
}];
|
|
397
|
+
readonly exitCodes: readonly [{
|
|
398
|
+
readonly code: 0;
|
|
399
|
+
readonly 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.";
|
|
400
|
+
}, {
|
|
401
|
+
readonly code: 2;
|
|
402
|
+
readonly meaning: "It could not run: an unknown flag, a flag missing its value, an unknown format, no point or more than two, an unknown ref or date, no Workspace found, or a Workspace outside git.";
|
|
403
|
+
}];
|
|
404
|
+
};
|
|
405
|
+
readonly "history build": {
|
|
406
|
+
readonly name: "history build";
|
|
407
|
+
readonly synopsis: readonly ["history build [--since <ref|date>]"];
|
|
408
|
+
readonly description: "Build and cache the Bundle of every past Revision, so later builds and diffs don't have to. Safe to re-run.";
|
|
409
|
+
readonly arguments: readonly [];
|
|
410
|
+
readonly flags: {
|
|
411
|
+
readonly since: {
|
|
412
|
+
readonly type: "string";
|
|
413
|
+
readonly value: "<ref|date>";
|
|
414
|
+
readonly defaultText: "every Revision";
|
|
415
|
+
readonly description: "Only build Revisions at or after this ref's commit time or the start of this date.";
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
readonly examples: readonly [{
|
|
419
|
+
readonly command: "archidocs history build";
|
|
420
|
+
readonly description: "Build and cache the Bundle of every past Revision, so the next `build` or `diff` reads them from the cache.";
|
|
421
|
+
}, {
|
|
422
|
+
readonly command: "archidocs history build --since 2026-01-01";
|
|
423
|
+
readonly description: "Only build the Revisions from the start of that date on.";
|
|
424
|
+
}, {
|
|
425
|
+
readonly command: "archidocs history build --since v1.0.0";
|
|
426
|
+
readonly description: "Only build the Revisions at or after a tag's commit.";
|
|
427
|
+
}];
|
|
428
|
+
readonly exitCodes: readonly [{
|
|
429
|
+
readonly code: 0;
|
|
430
|
+
readonly meaning: "Every Revision asked for is in the cache. It prints how many it built and how many were already built.";
|
|
431
|
+
}, {
|
|
432
|
+
readonly code: 2;
|
|
433
|
+
readonly meaning: "It could not run: an unknown flag, a flag missing its value, an unknown `--since` ref or date, no Workspace found, or a Workspace outside git.";
|
|
434
|
+
}];
|
|
435
|
+
};
|
|
436
|
+
readonly mcp: {
|
|
437
|
+
readonly name: "mcp";
|
|
438
|
+
readonly synopsis: readonly ["mcp [--workspace <dir> | --bundle <url|path>] [--viewer-url <url>]", "mcp --http [--host <loopback>] [--port <n>] [--allow-writes] [--workspace <dir> | --bundle <url|path>] [--viewer-url <url>]"];
|
|
439
|
+
readonly description: "Serve the Model to AI agents over MCP, from a Workspace checkout or a published Bundle, on stdio or local HTTP.";
|
|
440
|
+
readonly arguments: readonly [];
|
|
441
|
+
readonly flags: {
|
|
442
|
+
readonly workspace: {
|
|
443
|
+
readonly type: "string";
|
|
444
|
+
readonly value: "<dir>";
|
|
445
|
+
readonly defaultText: "the Workspace found from the current folder";
|
|
446
|
+
readonly description: "Serve this Workspace checkout; its write tools edit the YAML in place.";
|
|
447
|
+
};
|
|
448
|
+
readonly bundle: {
|
|
449
|
+
readonly type: "string";
|
|
450
|
+
readonly value: "<url|path>";
|
|
451
|
+
readonly description: "Serve a published Bundle, read-only, instead of a checkout.";
|
|
452
|
+
};
|
|
453
|
+
readonly "viewer-url": {
|
|
454
|
+
readonly type: "string";
|
|
455
|
+
readonly value: "<url>";
|
|
456
|
+
readonly description: "The published viewer's base URL; tool results then link to it.";
|
|
457
|
+
};
|
|
458
|
+
readonly http: {
|
|
459
|
+
readonly type: "boolean";
|
|
460
|
+
readonly default: false;
|
|
461
|
+
readonly description: "Serve Streamable HTTP at `/mcp` instead of stdio.";
|
|
462
|
+
};
|
|
463
|
+
readonly host: {
|
|
464
|
+
readonly type: "string";
|
|
465
|
+
readonly value: "<loopback>";
|
|
466
|
+
readonly defaultText: "127.0.0.1";
|
|
467
|
+
readonly description: "With `--http`: the loopback address to listen on, `127.0.0.1`, `localhost` or `::1`.";
|
|
468
|
+
};
|
|
469
|
+
readonly port: {
|
|
470
|
+
readonly type: "string";
|
|
471
|
+
readonly value: "<n>";
|
|
472
|
+
readonly defaultText: "3737";
|
|
473
|
+
readonly description: "With `--http`: the port to serve on.";
|
|
474
|
+
};
|
|
475
|
+
readonly "allow-writes": {
|
|
476
|
+
readonly type: "boolean";
|
|
477
|
+
readonly default: false;
|
|
478
|
+
readonly description: "With `--http`: allow the write tools, which are off over HTTP by default.";
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
readonly examples: readonly [{
|
|
482
|
+
readonly command: "archidocs mcp --workspace archidocs";
|
|
483
|
+
readonly 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.";
|
|
484
|
+
}, {
|
|
485
|
+
readonly command: "archidocs mcp --bundle https://big-bank.archidocs.dev/workspace.bundle.json";
|
|
486
|
+
readonly description: "Serve a published Bundle, here the Big Bank demo's, with the read tools only.";
|
|
487
|
+
}, {
|
|
488
|
+
readonly command: "archidocs mcp --bundle https://architecture.example.com/workspace.bundle.json --viewer-url https://architecture.example.com/";
|
|
489
|
+
readonly description: "Serve your own published Bundle, with links to its viewer in the tool results.";
|
|
490
|
+
}, {
|
|
491
|
+
readonly command: "archidocs mcp --http --port 3737 --workspace archidocs";
|
|
492
|
+
readonly description: "Serve Streamable HTTP at `/mcp` on a loopback address, with the write tools off.";
|
|
493
|
+
}, {
|
|
494
|
+
readonly command: "archidocs mcp --http --allow-writes --workspace archidocs";
|
|
495
|
+
readonly description: "Serve over HTTP with the write tools on.";
|
|
496
|
+
}];
|
|
497
|
+
readonly exitCodes: readonly [{
|
|
498
|
+
readonly code: 0;
|
|
499
|
+
readonly meaning: "Over stdio, the client closed the connection.";
|
|
500
|
+
}, {
|
|
501
|
+
readonly code: 2;
|
|
502
|
+
readonly meaning: "It could not start: an unknown flag, a flag missing its value, 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.";
|
|
503
|
+
}];
|
|
504
|
+
readonly 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.";
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
export type CommandName = keyof typeof commands;
|
|
508
|
+
/** Every command, in the order the usage lists them. */
|
|
509
|
+
export declare const commandList: readonly CommandDefinition[];
|
|
510
|
+
/** The usage text the CLI prints after a usage error. */
|
|
511
|
+
export declare function usageText(): string;
|
|
512
|
+
/**
|
|
513
|
+
* Parses a command's arguments (the words after its name) with its flags,
|
|
514
|
+
* strictly: an unknown flag or a missing value throws `ERR_PARSE_ARGS_*`.
|
|
515
|
+
*/
|
|
516
|
+
export declare function parseCommand<N extends CommandName>(name: N, args: string[]): ParsedCommand<N>;
|
|
517
|
+
/** `parseArgs`'s typed result for a command: its flags' values and its positionals. */
|
|
518
|
+
type ParsedCommand<N extends CommandName> = ReturnType<typeof parseArgs<{
|
|
519
|
+
args: string[];
|
|
520
|
+
options: (typeof commands)[N]["flags"];
|
|
521
|
+
allowPositionals: true;
|
|
522
|
+
strict: true;
|
|
523
|
+
}>>;
|
|
524
|
+
/** The command a command line names, and the arguments after its name. */
|
|
525
|
+
export declare function findCommand(argv: readonly string[]): {
|
|
526
|
+
command: CommandDefinition;
|
|
527
|
+
args: string[];
|
|
528
|
+
} | undefined;
|
|
529
|
+
export type ParsedCommandLine = {
|
|
530
|
+
ok: true;
|
|
531
|
+
command: string;
|
|
532
|
+
} | {
|
|
533
|
+
ok: false;
|
|
534
|
+
message: string;
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* Checks a command line (the words after `archidocs`) against the
|
|
538
|
+
* definitions without running anything: an unknown command, an unknown
|
|
539
|
+
* flag, a flag missing its value or a stray argument is reported. What
|
|
540
|
+
* a value means, and which flags go together, are left to the command.
|
|
541
|
+
*/
|
|
542
|
+
export declare function parseCommandLine(argv: readonly string[]): ParsedCommandLine;
|
|
543
|
+
export {};
|