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
package/dist/core/compare.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const withoutSource = (item) => JSON.stringify({ ...item, source: undefined });
|
|
1
|
+
/** An item as text, leaving out where it was written. */
|
|
2
|
+
export const withoutSource = (item) => JSON.stringify({ ...item, source: undefined });
|
|
4
3
|
/** Items of both sides, each once: the later side's where both have it. */
|
|
5
4
|
function union(before, after, key) {
|
|
6
5
|
const keys = new Set(after.map(key));
|
|
@@ -28,35 +27,3 @@ export function unionBundle(before, after) {
|
|
|
28
27
|
adrs: union(before.adrs, after.adrs, byId),
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
|
-
/**
|
|
32
|
-
* A View for Compare: laid out over the union of both sides, with every node
|
|
33
|
-
* and edge marked. A node or edge only the later side's View shows is
|
|
34
|
-
* added, one only the earlier side's shows is removed. One both show is
|
|
35
|
-
* changed when its Element changed, or for a collapsed box when anything
|
|
36
|
-
* inside it was added, removed or changed; an edge when its Relationships
|
|
37
|
-
* did. A View that exists at one side only is drawn from that side.
|
|
38
|
-
* Undefined when neither side has the View.
|
|
39
|
-
*/
|
|
40
|
-
export function compareView(before, after, id, options = {}) {
|
|
41
|
-
const view = resolveView(unionBundle(before, after), id, options);
|
|
42
|
-
if (!view)
|
|
43
|
-
return undefined;
|
|
44
|
-
const [b, a] = [resolveView(before, id, options), resolveView(after, id, options)];
|
|
45
|
-
const changed = new Set(diff(before, after).filter((c) => c.kind === "element").map((c) => c.id));
|
|
46
|
-
const model = new ModelIndex(unionBundle(before, after));
|
|
47
|
-
const holdsChange = (nodeId) => [...changed].some((c) => c !== nodeId && model.ancestry(c).includes(nodeId));
|
|
48
|
-
const sides = (list, key) => [b, a].map((v) => new Map((v ? list(v) : []).map((x) => [key(x), x])));
|
|
49
|
-
const [bNodes, aNodes] = sides((v) => v.nodes, (n) => n.id);
|
|
50
|
-
const edgeKey = (e) => `${e.from}\0${e.to}`;
|
|
51
|
-
const [bEdges, aEdges] = sides((v) => v.edges, edgeKey);
|
|
52
|
-
const mark = (inBefore, inAfter, isChanged) => inAfter && !inBefore ? "added" : inBefore && !inAfter ? "removed" : isChanged() ? "changed" : "unchanged";
|
|
53
|
-
for (const node of view.nodes) {
|
|
54
|
-
node.change = mark(bNodes.has(node.id), aNodes.has(node.id), () => changed.has(node.id) || (node.collapsed && holdsChange(node.id)));
|
|
55
|
-
}
|
|
56
|
-
const relationships = (e) => (e?.relationships.map(withoutSource).sort() ?? []).join("\n");
|
|
57
|
-
for (const edge of view.edges) {
|
|
58
|
-
const key = edgeKey(edge);
|
|
59
|
-
edge.change = mark(bEdges.has(key), aEdges.has(key), () => relationships(bEdges.get(key)) !== relationships(aEdges.get(key)));
|
|
60
|
-
}
|
|
61
|
-
return view;
|
|
62
|
-
}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
export { load, findWorkspaceRoot, serializeBundle, type LoadOptions, type LoadResult } from "./load.ts";
|
|
2
2
|
export { nodeFileSystem, type FileSystem, type WritableFileSystem, type DirEntry } from "./fs.ts";
|
|
3
|
-
export { rules, type RuleDefinition } from "./rules.ts";
|
|
3
|
+
export { rules, removed, ruleDocsUrl, withDocs, RULE_DOCS_BASE_URL, type RuleDefinition, type RemovedRule } from "./rules.ts";
|
|
4
4
|
export type { Issue, Severity } from "./model.ts";
|
|
5
5
|
export type { Files } from "./files.ts";
|
|
6
6
|
export { ruleCatalogue } from "./catalogue.ts";
|
|
7
7
|
export { deriveEdges, levelOf, type DerivedEdge, type Level } from "./query.ts";
|
|
8
8
|
export { getDeployments, type DeploymentDetail, type TargetStep } from "./deployments.ts";
|
|
9
9
|
export { search, type SearchMatch, type SearchOptions, type MatchRank } from "./search.ts";
|
|
10
|
-
export {
|
|
11
|
-
export { resolveSaved, type SavedResolution, type BadExpand, type UnresolvedPath } from "./saved-views.ts";
|
|
10
|
+
export { resolveView, listViews, pickedView, compareView, saveAsView, stepViews, dynamicViewsUsing, parseViewId, formatViewId, ownViewId, describeLens, type AnyView, type ViewRef, type ViewSummary, type LensChoice, type ResolveOptions, type ResolvedView, type ViewKind, type ListedKind, type ViewNode, type ViewEdge, type NodeMark, type ImpactSide, type ViewDirection, type CompareMark, type SavedResolution, type BadExpand, type UnresolvedPath, type DynamicResolution, type DynamicProblem, type ResolvedDynamicView, type ResolvedStep, type StepKind, type Screen, type SavedScreen, type SavedViewDefinition, } from "./views/index.ts";
|
|
12
11
|
export { findPaths, type PathsResult, type Path, type Hop, type DirectEdge } from "./paths.ts";
|
|
13
12
|
export { getImpact, type ImpactResult, type ImpactRing, type ImpactedElement, type Direction } from "./impact.ts";
|
|
14
13
|
export { listOwned, type OwnedResult, type OwnedGroup, type OwnedItem, type OwnedKind } from "./ownership.ts";
|
|
15
14
|
export { listAdrs, adrsFor, type ListAdrsOptions, type ListedAdr } from "./adrs.ts";
|
|
16
|
-
export { resolveDynamic, resolveDynamicView, takesPart, stepViews, dynamicViewsUsing, type DynamicResolution, type DynamicProblem, type ResolvedDynamicView, type ResolvedStep, type StepKind } from "./dynamic-views.ts";
|
|
17
15
|
export { diff, countChanges, changedIds, changeKinds, type Change, type ChangeKind, type ChangeType, type ChangeItem, type ChangeCounts } from "./diff.ts";
|
|
18
|
-
export {
|
|
19
|
-
export { compareView, unionBundle, type CompareMark } from "./compare.ts";
|
|
16
|
+
export { unionBundle } from "./compare.ts";
|
|
20
17
|
export { resolveScope, scopeMatcher, filterChanges, type HistoryScope, type ScopeResolution } from "./history-scope.ts";
|
package/dist/core/index.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
export { load, findWorkspaceRoot, serializeBundle } from "./load.js";
|
|
2
2
|
export { nodeFileSystem } from "./fs.js";
|
|
3
|
-
export { rules } from "./rules.js";
|
|
3
|
+
export { rules, removed, ruleDocsUrl, withDocs, RULE_DOCS_BASE_URL } from "./rules.js";
|
|
4
4
|
export { ruleCatalogue } from "./catalogue.js";
|
|
5
5
|
export { deriveEdges, levelOf } from "./query.js";
|
|
6
6
|
export { getDeployments } from "./deployments.js";
|
|
7
7
|
export { search } from "./search.js";
|
|
8
|
-
export {
|
|
9
|
-
export { resolveSaved } from "./saved-views.js";
|
|
8
|
+
export { resolveView, listViews, pickedView, compareView, saveAsView, stepViews, dynamicViewsUsing, parseViewId, formatViewId, ownViewId, describeLens, } from "./views/index.js";
|
|
10
9
|
export { findPaths } from "./paths.js";
|
|
11
10
|
export { getImpact } from "./impact.js";
|
|
12
11
|
export { listOwned } from "./ownership.js";
|
|
13
12
|
export { listAdrs, adrsFor } from "./adrs.js";
|
|
14
|
-
export { resolveDynamic, resolveDynamicView, takesPart, stepViews, dynamicViewsUsing } from "./dynamic-views.js";
|
|
15
13
|
export { diff, countChanges, changedIds, changeKinds } from "./diff.js";
|
|
16
|
-
export {
|
|
17
|
-
export { compareView, unionBundle } from "./compare.js";
|
|
14
|
+
export { unionBundle } from "./compare.js";
|
|
18
15
|
export { resolveScope, scopeMatcher, filterChanges } from "./history-scope.js";
|
package/dist/core/query.d.ts
CHANGED
package/dist/core/rules.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Bundle } from "../schema/bundle.ts";
|
|
2
2
|
import type { Files } from "./files.ts";
|
|
3
3
|
import type { IssueDraft, LoadedWorkspace, Severity } from "./model.ts";
|
|
4
|
+
/** The part of the Model a rule is about, in the order the docs list them. Every rule is in exactly one. */
|
|
5
|
+
export declare const ruleAreas: readonly ["workspace", "elements", "relationships", "deployments", "views", "decisions"];
|
|
6
|
+
export type RuleArea = (typeof ruleAreas)[number];
|
|
4
7
|
/**
|
|
5
8
|
* A check rule. Its examples are small Workspaces (paths relative to the
|
|
6
9
|
* Workspace root): `failing` triggers the rule, `passing` is the same
|
|
@@ -9,8 +12,15 @@ import type { IssueDraft, LoadedWorkspace, Severity } from "./model.ts";
|
|
|
9
12
|
export interface RuleDefinition {
|
|
10
13
|
id: string;
|
|
11
14
|
severity: Severity;
|
|
15
|
+
area: RuleArea;
|
|
16
|
+
/** The release that first shipped the rule, such as `"1.0.0"`. */
|
|
17
|
+
since: `${number}.${number}.${number}`;
|
|
12
18
|
summary: string;
|
|
19
|
+
/** What goes wrong for a reader of the Model without the rule, in one or two sentences. */
|
|
20
|
+
why: string;
|
|
13
21
|
fix: string;
|
|
22
|
+
/** Other rules worth reading with this one, by id. */
|
|
23
|
+
related?: readonly string[];
|
|
14
24
|
example: {
|
|
15
25
|
failing: Files;
|
|
16
26
|
passing: Files;
|
|
@@ -19,3 +29,23 @@ export interface RuleDefinition {
|
|
|
19
29
|
check(workspace: LoadedWorkspace, bundle: Bundle): IssueDraft[];
|
|
20
30
|
}
|
|
21
31
|
export declare const rules: RuleDefinition[];
|
|
32
|
+
/** Base URL of the per-rule pages on the docs site; a rule's page is `<base><rule-id>/`. */
|
|
33
|
+
export declare const RULE_DOCS_BASE_URL = "https://archidocs.dev/docs/reference/rules/";
|
|
34
|
+
/** The docs page for a check rule. The site keeps a page for every rule id, removed ones included. */
|
|
35
|
+
export declare const ruleDocsUrl: (ruleId: string) => string;
|
|
36
|
+
/** An issue with a link to its rule's docs page, as `check --format json` and MCP report it. */
|
|
37
|
+
export declare const withDocs: <T extends {
|
|
38
|
+
rule: string;
|
|
39
|
+
}>(issue: T) => T & {
|
|
40
|
+
docs: string;
|
|
41
|
+
};
|
|
42
|
+
/** A check rule taken out of the registry. The docs site keeps a stub page for it, so links older CLIs print still work. */
|
|
43
|
+
export interface RemovedRule {
|
|
44
|
+
id: string;
|
|
45
|
+
/** The release that removed it, such as `"1.4.0"`. */
|
|
46
|
+
removedIn: string;
|
|
47
|
+
/** What replaced it: another rule id, or a sentence. */
|
|
48
|
+
replacement: string;
|
|
49
|
+
}
|
|
50
|
+
/** Rules removed from the registry, oldest first. An id here never returns to `rules`. */
|
|
51
|
+
export declare const removed: RemovedRule[];
|