archidocs 0.0.0-stage → 1.2.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 +181 -2
- package/dist/cli/commands.d.ts +322 -0
- package/dist/cli/commands.js +174 -0
- package/dist/cli/dev.d.ts +31 -0
- package/dist/cli/dev.js +156 -0
- package/dist/cli/diff-format.d.ts +9 -0
- package/dist/cli/diff-format.js +50 -0
- package/dist/cli/format.d.ts +15 -0
- package/dist/cli/format.js +64 -0
- package/dist/cli/init.d.ts +17 -0
- package/dist/cli/init.js +82 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +330 -0
- package/dist/core/adr.d.ts +28 -0
- package/dist/core/adr.js +88 -0
- package/dist/core/adrs.d.ts +20 -0
- package/dist/core/adrs.js +86 -0
- package/dist/core/catalogue.d.ts +7 -0
- package/dist/core/catalogue.js +35 -0
- package/dist/core/compare.d.ts +21 -0
- package/dist/core/compare.js +62 -0
- package/dist/core/deployment-views.d.ts +28 -0
- package/dist/core/deployment-views.js +108 -0
- package/dist/core/deployments.d.ts +18 -0
- package/dist/core/deployments.js +21 -0
- package/dist/core/diff.d.ts +44 -0
- package/dist/core/diff.js +138 -0
- package/dist/core/dynamic-views.d.ts +73 -0
- package/dist/core/dynamic-views.js +162 -0
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +1 -0
- package/dist/core/fs.d.ts +19 -0
- package/dist/core/fs.js +21 -0
- package/dist/core/history-scope.d.ts +40 -0
- package/dist/core/history-scope.js +63 -0
- package/dist/core/impact.d.ts +34 -0
- package/dist/core/impact.js +62 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +18 -0
- package/dist/core/load.d.ts +32 -0
- package/dist/core/load.js +465 -0
- package/dist/core/model.d.ts +150 -0
- package/dist/core/model.js +1 -0
- package/dist/core/ownership.d.ts +34 -0
- package/dist/core/ownership.js +65 -0
- package/dist/core/paths.d.ts +47 -0
- package/dist/core/paths.js +115 -0
- package/dist/core/query.d.ts +51 -0
- package/dist/core/query.js +77 -0
- package/dist/core/refs.d.ts +31 -0
- package/dist/core/refs.js +50 -0
- package/dist/core/rules.d.ts +41 -0
- package/dist/core/rules.js +1033 -0
- package/dist/core/save-as-view.d.ts +45 -0
- package/dist/core/save-as-view.js +114 -0
- package/dist/core/saved-views.d.ts +48 -0
- package/dist/core/saved-views.js +243 -0
- package/dist/core/schema-check.d.ts +13 -0
- package/dist/core/schema-check.js +79 -0
- package/dist/core/search.d.ts +27 -0
- package/dist/core/search.js +63 -0
- package/dist/core/suggest.d.ts +3 -0
- package/dist/core/suggest.js +30 -0
- package/dist/core/views.d.ts +126 -0
- package/dist/core/views.js +217 -0
- package/dist/core/yaml.d.ts +16 -0
- package/dist/core/yaml.js +52 -0
- package/dist/git.d.ts +7 -0
- package/dist/git.js +23 -0
- package/dist/guide/index.d.ts +53 -0
- package/dist/guide/index.js +57 -0
- package/dist/history/git.d.ts +39 -0
- package/dist/history/git.js +126 -0
- package/dist/history/index.d.ts +118 -0
- package/dist/history/index.js +223 -0
- package/dist/history/migrate.d.ts +16 -0
- package/dist/history/migrate.js +30 -0
- package/dist/mcp/history.d.ts +36 -0
- package/dist/mcp/history.js +175 -0
- package/dist/mcp/http.d.ts +23 -0
- package/dist/mcp/http.js +85 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/server.d.ts +54 -0
- package/dist/mcp/server.js +824 -0
- package/dist/mcp/source.d.ts +50 -0
- package/dist/mcp/source.js +132 -0
- package/dist/mcp/writes.d.ts +10 -0
- package/dist/mcp/writes.js +267 -0
- package/dist/render/font.d.ts +14 -0
- package/dist/render/font.js +11 -0
- package/dist/render/index.d.ts +8 -0
- package/dist/render/index.js +8 -0
- package/dist/render/layout.d.ts +53 -0
- package/dist/render/layout.js +199 -0
- package/dist/render/node.d.ts +3 -0
- package/dist/render/node.js +8 -0
- package/dist/render/png.d.ts +11 -0
- package/dist/render/png.js +29 -0
- package/dist/render/sequence-svg.d.ts +33 -0
- package/dist/render/sequence-svg.js +98 -0
- package/dist/render/sequence.d.ts +103 -0
- package/dist/render/sequence.js +142 -0
- package/dist/render/svg.d.ts +36 -0
- package/dist/render/svg.js +222 -0
- package/dist/render/teams.d.ts +12 -0
- package/dist/render/teams.js +31 -0
- package/dist/render/text.d.ts +15 -0
- package/dist/render/text.js +29 -0
- package/dist/render/tokens.d.ts +53 -0
- package/dist/render/tokens.js +71 -0
- package/dist/schema/adr.d.ts +36 -0
- package/dist/schema/adr.js +27 -0
- package/dist/schema/bundle.d.ts +726 -0
- package/dist/schema/bundle.js +171 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +4 -0
- package/dist/schema/json-schema.d.ts +8 -0
- package/dist/schema/json-schema.js +19 -0
- package/dist/schema/workspace.d.ts +1066 -0
- package/dist/schema/workspace.js +271 -0
- package/dist/viewer/assets/index-DvKgCpBr.css +1 -0
- package/dist/viewer/assets/index-gucix3xm.js +113 -0
- package/dist/viewer/assets/index_bg-Blvrv-U2.wasm +0 -0
- package/dist/viewer/assets/index_bg-D3t31u3-.js +1 -0
- package/dist/viewer/assets/layout.worker-Bg-OaLVN.js +26 -0
- package/dist/viewer/assets/overpass-latin-QyaMbcmi.woff2 +0 -0
- package/dist/viewer/assets/overpass-latin-ext-DSRhPfzW.woff2 +0 -0
- package/dist/viewer/assets/overpass-mono-latin-BTquVRaO.woff2 +0 -0
- package/dist/viewer/assets/overpass-mono-latin-ext-D47EiU4_.woff2 +0 -0
- package/dist/viewer/assets/png-BDKIXtm5.js +1 -0
- package/dist/viewer/assets/svg-Bulv5YWn.js +2 -0
- package/dist/viewer/favicon.svg +1 -0
- package/dist/viewer/index.html +53 -0
- package/dist/writer/adrs.d.ts +21 -0
- package/dist/writer/adrs.js +72 -0
- package/dist/writer/deployments.d.ts +51 -0
- package/dist/writer/deployments.js +145 -0
- package/dist/writer/diff.d.ts +6 -0
- package/dist/writer/diff.js +77 -0
- package/dist/writer/document.d.ts +25 -0
- package/dist/writer/document.js +79 -0
- package/dist/writer/edit.d.ts +78 -0
- package/dist/writer/edit.js +63 -0
- package/dist/writer/index.d.ts +67 -0
- package/dist/writer/index.js +310 -0
- package/dist/writer/overlay.d.ts +7 -0
- package/dist/writer/overlay.js +26 -0
- package/dist/writer/views.d.ts +29 -0
- package/dist/writer/views.js +78 -0
- package/dist/writer/workspace.d.ts +25 -0
- package/dist/writer/workspace.js +56 -0
- package/guide/SKILL.md +36 -0
- package/guide/topics/add-service.md +30 -0
- package/guide/topics/bootstrap.md +28 -0
- package/guide/topics/change.md +32 -0
- package/guide/topics/deployments.md +36 -0
- package/guide/topics/dynamic-view.md +39 -0
- package/guide/topics/propose-adr.md +12 -0
- package/guide/topics/relationships.md +39 -0
- package/guide/topics/saved-view.md +36 -0
- package/package.json +75 -4
- package/schemas/adr.schema.json +82 -0
- package/schemas/model.schema.json +1381 -0
- package/schemas/project.schema.json +24 -0
- package/schemas/workspace.schema.json +72 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AdrStatus } from "./adr.js";
|
|
3
|
+
export const SCHEMA_VERSION = 1;
|
|
4
|
+
const Source = z.object({ file: z.string(), line: z.number().int() });
|
|
5
|
+
const Link = z.object({ label: z.string(), url: z.string() });
|
|
6
|
+
const elementFields = {
|
|
7
|
+
id: z.string(),
|
|
8
|
+
parent: z.string().nullable(),
|
|
9
|
+
name: z.string(),
|
|
10
|
+
description: z.string().nullable(),
|
|
11
|
+
owner: z.string(),
|
|
12
|
+
tags: z.array(z.string()),
|
|
13
|
+
links: z.array(Link),
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* One Element: qualified id, kind, parent (qualified id or null), the
|
|
17
|
+
* effective Owner, then the kind's own fields. Keys are in this fixed order.
|
|
18
|
+
*/
|
|
19
|
+
const element = (kind, fields) => {
|
|
20
|
+
const { id, ...rest } = elementFields;
|
|
21
|
+
return z.object({ id, kind: z.literal(kind), ...rest, ...fields, source: Source });
|
|
22
|
+
};
|
|
23
|
+
export const BundleElement = z.discriminatedUnion("kind", [
|
|
24
|
+
element("person", {}),
|
|
25
|
+
element("system", { external: z.boolean() }),
|
|
26
|
+
element("service", { type: z.enum(["app", "datastore", "broker"]), technology: z.string().nullable(), external: z.boolean() }),
|
|
27
|
+
element("component", { technology: z.string().nullable() }),
|
|
28
|
+
]);
|
|
29
|
+
/** A Deployment Target: qualified id, parent Target (qualified id or null) and its effective Owner. */
|
|
30
|
+
export const BundleTarget = z.object({
|
|
31
|
+
id: z.string(),
|
|
32
|
+
parent: z.string().nullable(),
|
|
33
|
+
name: z.string(),
|
|
34
|
+
kind: z.string(),
|
|
35
|
+
description: z.string().nullable(),
|
|
36
|
+
owner: z.string(),
|
|
37
|
+
tags: z.array(z.string()),
|
|
38
|
+
links: z.array(Link),
|
|
39
|
+
source: Source,
|
|
40
|
+
});
|
|
41
|
+
/** A Deployment, identified by its (service, environment, target) triple; its Owner is its Service's. */
|
|
42
|
+
export const BundleDeployment = z.object({
|
|
43
|
+
service: z.string(),
|
|
44
|
+
environment: z.string(),
|
|
45
|
+
target: z.string(),
|
|
46
|
+
url: z.string().nullable(),
|
|
47
|
+
endpoints: z.array(z.object({ name: z.string(), url: z.string() })),
|
|
48
|
+
owner: z.string(),
|
|
49
|
+
source: Source,
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* One declared Relationship, consumer (`from`) → provider (`to`), all ids
|
|
53
|
+
* qualified. `id` is the author's optional id, qualified with the consumer's
|
|
54
|
+
* Project. Derived edges are never stored.
|
|
55
|
+
*/
|
|
56
|
+
export const BundleRelationship = z.object({
|
|
57
|
+
id: z.string().nullable(),
|
|
58
|
+
from: z.string(),
|
|
59
|
+
to: z.string(),
|
|
60
|
+
description: z.string().nullable(),
|
|
61
|
+
technology: z.string().nullable(),
|
|
62
|
+
interaction: z.enum(["sync", "async"]),
|
|
63
|
+
via: z.string().nullable(),
|
|
64
|
+
channel: z.string().nullable(),
|
|
65
|
+
tags: z.array(z.string()),
|
|
66
|
+
source: Source,
|
|
67
|
+
});
|
|
68
|
+
const BundleRef = z.string();
|
|
69
|
+
const Hops = z.union([z.number(), z.literal("all")]);
|
|
70
|
+
const Paths = z.union([z.literal("shortest"), z.number()]);
|
|
71
|
+
const PathSelector = z.object({ from: BundleRef, to: BundleRef, paths: Paths.optional() });
|
|
72
|
+
/** A selector with its Element ids qualified; a bare id is the Element itself. */
|
|
73
|
+
export const BundleSelector = z.union([
|
|
74
|
+
BundleRef,
|
|
75
|
+
z.object({ element: BundleRef, with: z.enum(["children", "descendants"]).optional(), upstream: Hops.optional(), downstream: Hops.optional() }),
|
|
76
|
+
z.object({ team: z.string() }),
|
|
77
|
+
z.object({ tag: z.string() }),
|
|
78
|
+
PathSelector,
|
|
79
|
+
]);
|
|
80
|
+
export const BundleLens = z.union([
|
|
81
|
+
z.object({ impact: BundleRef, direction: z.enum(["upstream", "downstream", "both"]) }),
|
|
82
|
+
z.object({ team: z.string() }),
|
|
83
|
+
z.object({ path: PathSelector }),
|
|
84
|
+
]);
|
|
85
|
+
/**
|
|
86
|
+
* A Saved structural or Deployment View's definition, every id qualified; not
|
|
87
|
+
* its resolved nodes. `include` is null when absent (every Element).
|
|
88
|
+
*/
|
|
89
|
+
export const BundleStructuralView = z.object({
|
|
90
|
+
id: z.string(),
|
|
91
|
+
project: z.string(),
|
|
92
|
+
kind: z.literal("structural"),
|
|
93
|
+
title: z.string(),
|
|
94
|
+
description: z.string().nullable(),
|
|
95
|
+
tags: z.array(z.string()),
|
|
96
|
+
level: z.enum(["c1", "c2", "c3", "deployment"]),
|
|
97
|
+
include: z.array(BundleSelector).nullable(),
|
|
98
|
+
exclude: z.array(BundleSelector),
|
|
99
|
+
expand: z.array(z.string()),
|
|
100
|
+
collapse: z.array(z.string()),
|
|
101
|
+
direction: z.enum(["TB", "BT", "LR", "RL"]).nullable(),
|
|
102
|
+
lens: BundleLens.nullable(),
|
|
103
|
+
environment: z.string().nullable(),
|
|
104
|
+
targets: z.array(z.string()),
|
|
105
|
+
source: Source,
|
|
106
|
+
});
|
|
107
|
+
/** One Step as written, ids qualified; `relationship` is null when the author names none. */
|
|
108
|
+
export const BundleStep = z.object({
|
|
109
|
+
from: z.string(),
|
|
110
|
+
to: z.string(),
|
|
111
|
+
relationship: z.string().nullable(),
|
|
112
|
+
description: z.string().nullable(),
|
|
113
|
+
note: z.string().nullable(),
|
|
114
|
+
return: z.boolean(),
|
|
115
|
+
});
|
|
116
|
+
/** A Saved Dynamic View's definition, every id qualified; not its resolved Steps. `participants` is null when absent. */
|
|
117
|
+
export const BundleDynamicView = z.object({
|
|
118
|
+
id: z.string(),
|
|
119
|
+
project: z.string(),
|
|
120
|
+
kind: z.literal("dynamic"),
|
|
121
|
+
title: z.string(),
|
|
122
|
+
description: z.string().nullable(),
|
|
123
|
+
tags: z.array(z.string()),
|
|
124
|
+
participants: z.array(z.string()).nullable(),
|
|
125
|
+
steps: z.array(BundleStep),
|
|
126
|
+
source: Source,
|
|
127
|
+
});
|
|
128
|
+
/** A Saved View's definition: structural (including Deployment Views) or dynamic. */
|
|
129
|
+
export const BundleView = z.discriminatedUnion("kind", [BundleStructuralView, BundleDynamicView]);
|
|
130
|
+
/**
|
|
131
|
+
* One ADR: qualified id (`project:NNNN`), its title (the first `# ` heading),
|
|
132
|
+
* the status as written and the effective one (`superseded` once an accepted
|
|
133
|
+
* ADR supersedes it), qualified links, the `supersededBy` derived from
|
|
134
|
+
* accepted ADRs, and the full markdown body after the frontmatter.
|
|
135
|
+
*/
|
|
136
|
+
export const BundleAdr = z.object({
|
|
137
|
+
id: z.string(),
|
|
138
|
+
project: z.string(),
|
|
139
|
+
title: z.string(),
|
|
140
|
+
status: AdrStatus,
|
|
141
|
+
effectiveStatus: AdrStatus,
|
|
142
|
+
date: z.string(),
|
|
143
|
+
elements: z.array(z.string()),
|
|
144
|
+
views: z.array(z.string()),
|
|
145
|
+
supersedes: z.array(z.string()),
|
|
146
|
+
supersededBy: z.array(z.string()),
|
|
147
|
+
decisionMakers: z.array(z.string()),
|
|
148
|
+
consulted: z.array(z.string()),
|
|
149
|
+
informed: z.array(z.string()),
|
|
150
|
+
tags: z.array(z.string()),
|
|
151
|
+
body: z.string(),
|
|
152
|
+
source: Source,
|
|
153
|
+
});
|
|
154
|
+
/**
|
|
155
|
+
* The Workspace Bundle. Parsing through this schema also fixes key order,
|
|
156
|
+
* since zod emits object keys in shape order.
|
|
157
|
+
*/
|
|
158
|
+
export const Bundle = z.object({
|
|
159
|
+
schemaVersion: z.literal(SCHEMA_VERSION),
|
|
160
|
+
commit: z.string().nullable(),
|
|
161
|
+
builtAt: z.string().nullable(),
|
|
162
|
+
teams: z.array(z.object({ id: z.string(), name: z.string(), description: z.string().nullable(), links: z.array(Link), source: Source })),
|
|
163
|
+
environments: z.array(z.object({ id: z.string(), name: z.string(), description: z.string().nullable(), source: Source })),
|
|
164
|
+
projects: z.array(z.object({ id: z.string(), name: z.string(), owner: z.string(), folder: z.string(), source: Source })),
|
|
165
|
+
elements: z.array(BundleElement),
|
|
166
|
+
relationships: z.array(BundleRelationship),
|
|
167
|
+
targets: z.array(BundleTarget),
|
|
168
|
+
deployments: z.array(BundleDeployment),
|
|
169
|
+
views: z.array(BundleView),
|
|
170
|
+
adrs: z.array(BundleAdr),
|
|
171
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schemas for authoring, generated from the zod types so editors and
|
|
3
|
+
* `archidocs check` share one source. Point the `yaml-language-server`
|
|
4
|
+
* `$schema` comment at the one matching the file.
|
|
5
|
+
*/
|
|
6
|
+
export declare function jsonSchemas(): Record<"workspace" | "project" | "model" | "adr", object>;
|
|
7
|
+
/** A schema as written to `schemas/<name>.schema.json`. */
|
|
8
|
+
export declare const serializeJsonSchema: (schema: object) => string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AdrFrontmatter } from "./adr.js";
|
|
3
|
+
import { ModelFile, ProjectFile, WorkspaceFile } from "./workspace.js";
|
|
4
|
+
/**
|
|
5
|
+
* JSON Schemas for authoring, generated from the zod types so editors and
|
|
6
|
+
* `archidocs check` share one source. Point the `yaml-language-server`
|
|
7
|
+
* `$schema` comment at the one matching the file.
|
|
8
|
+
*/
|
|
9
|
+
export function jsonSchemas() {
|
|
10
|
+
const of = (title, schema) => ({ title, ...z.toJSONSchema(schema, { target: "draft-2020-12", io: "input" }) });
|
|
11
|
+
return {
|
|
12
|
+
workspace: of("Archidocs workspace.yaml", WorkspaceFile),
|
|
13
|
+
project: of("Archidocs project.yaml", ProjectFile),
|
|
14
|
+
model: of("Archidocs model file (any other *.yaml in a Project)", ModelFile),
|
|
15
|
+
adr: of("Archidocs ADR frontmatter (<project>/adr/NNNN-slug.md)", AdrFrontmatter),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** A schema as written to `schemas/<name>.schema.json`. */
|
|
19
|
+
export const serializeJsonSchema = (schema) => JSON.stringify(schema, null, 2) + "\n";
|