wabachi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -0
  3. package/dist/architecture/canon/authority.d.ts +35 -0
  4. package/dist/architecture/canon/authority.js +76 -0
  5. package/dist/architecture/canon/authority.js.map +1 -0
  6. package/dist/architecture/canon/boundaries.d.ts +31 -0
  7. package/dist/architecture/canon/boundaries.js +73 -0
  8. package/dist/architecture/canon/boundaries.js.map +1 -0
  9. package/dist/architecture/canon/codec.d.ts +10 -0
  10. package/dist/architecture/canon/codec.js +516 -0
  11. package/dist/architecture/canon/codec.js.map +1 -0
  12. package/dist/architecture/canon/constraints.d.ts +60 -0
  13. package/dist/architecture/canon/constraints.js +116 -0
  14. package/dist/architecture/canon/constraints.js.map +1 -0
  15. package/dist/architecture/canon/decisions.d.ts +62 -0
  16. package/dist/architecture/canon/decisions.js +192 -0
  17. package/dist/architecture/canon/decisions.js.map +1 -0
  18. package/dist/architecture/canon/deployment.d.ts +89 -0
  19. package/dist/architecture/canon/deployment.js +156 -0
  20. package/dist/architecture/canon/deployment.js.map +1 -0
  21. package/dist/architecture/canon/document.d.ts +60 -0
  22. package/dist/architecture/canon/document.js +106 -0
  23. package/dist/architecture/canon/document.js.map +1 -0
  24. package/dist/architecture/canon/elements.d.ts +21 -0
  25. package/dist/architecture/canon/elements.js +87 -0
  26. package/dist/architecture/canon/elements.js.map +1 -0
  27. package/dist/architecture/canon/flows.d.ts +37 -0
  28. package/dist/architecture/canon/flows.js +82 -0
  29. package/dist/architecture/canon/flows.js.map +1 -0
  30. package/dist/architecture/canon/identity.d.ts +45 -0
  31. package/dist/architecture/canon/identity.js +83 -0
  32. package/dist/architecture/canon/identity.js.map +1 -0
  33. package/dist/architecture/canon/relationships.d.ts +48 -0
  34. package/dist/architecture/canon/relationships.js +181 -0
  35. package/dist/architecture/canon/relationships.js.map +1 -0
  36. package/dist/architecture/canon/repository-mappings.d.ts +51 -0
  37. package/dist/architecture/canon/repository-mappings.js +134 -0
  38. package/dist/architecture/canon/repository-mappings.js.map +1 -0
  39. package/dist/architecture/canon/responsibilities.d.ts +40 -0
  40. package/dist/architecture/canon/responsibilities.js +89 -0
  41. package/dist/architecture/canon/responsibilities.js.map +1 -0
  42. package/dist/architecture/canon/validate.d.ts +14 -0
  43. package/dist/architecture/canon/validate.js +389 -0
  44. package/dist/architecture/canon/validate.js.map +1 -0
  45. package/dist/architecture/canon/views.d.ts +101 -0
  46. package/dist/architecture/canon/views.js +182 -0
  47. package/dist/architecture/canon/views.js.map +1 -0
  48. package/dist/architecture/cli.d.ts +2 -0
  49. package/dist/architecture/cli.js +158 -0
  50. package/dist/architecture/cli.js.map +1 -0
  51. package/dist/architecture/documentation/html.d.ts +3 -0
  52. package/dist/architecture/documentation/html.js +143 -0
  53. package/dist/architecture/documentation/html.js.map +1 -0
  54. package/dist/architecture/documentation/model.d.ts +46 -0
  55. package/dist/architecture/documentation/model.js +13 -0
  56. package/dist/architecture/documentation/model.js.map +1 -0
  57. package/dist/architecture/documentation/project.d.ts +4 -0
  58. package/dist/architecture/documentation/project.js +166 -0
  59. package/dist/architecture/documentation/project.js.map +1 -0
  60. package/dist/architecture/documentation/site.d.ts +43 -0
  61. package/dist/architecture/documentation/site.js +147 -0
  62. package/dist/architecture/documentation/site.js.map +1 -0
  63. package/dist/architecture/projection/structurizr-export.d.ts +65 -0
  64. package/dist/architecture/projection/structurizr-export.js +136 -0
  65. package/dist/architecture/projection/structurizr-export.js.map +1 -0
  66. package/dist/architecture/projection/structurizr.d.ts +34 -0
  67. package/dist/architecture/projection/structurizr.js +667 -0
  68. package/dist/architecture/projection/structurizr.js.map +1 -0
  69. package/dist/cli.d.ts +1 -0
  70. package/dist/cli.js +143 -0
  71. package/dist/cli.js.map +1 -0
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.js +6 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/runtime/correlation.d.ts +143 -0
  76. package/dist/runtime/correlation.js +919 -0
  77. package/dist/runtime/correlation.js.map +1 -0
  78. package/dist/runtime/facts.d.ts +138 -0
  79. package/dist/runtime/facts.js +614 -0
  80. package/dist/runtime/facts.js.map +1 -0
  81. package/dist/runtime/fixtureProvider.d.ts +10 -0
  82. package/dist/runtime/fixtureProvider.js +30 -0
  83. package/dist/runtime/fixtureProvider.js.map +1 -0
  84. package/dist/runtime/graftProvider.d.ts +8 -0
  85. package/dist/runtime/graftProvider.js +107 -0
  86. package/dist/runtime/graftProvider.js.map +1 -0
  87. package/dist/runtime/graftWiring.d.ts +30 -0
  88. package/dist/runtime/graftWiring.js +3 -0
  89. package/dist/runtime/graftWiring.js.map +1 -0
  90. package/dist/runtime/manifest.d.ts +17 -0
  91. package/dist/runtime/manifest.js +39 -0
  92. package/dist/runtime/manifest.js.map +1 -0
  93. package/dist/runtime/matrix.d.ts +337 -0
  94. package/dist/runtime/matrix.js +1485 -0
  95. package/dist/runtime/matrix.js.map +1 -0
  96. package/dist/runtime/observation.d.ts +36 -0
  97. package/dist/runtime/observation.js +3 -0
  98. package/dist/runtime/observation.js.map +1 -0
  99. package/dist/runtime/provider.d.ts +34 -0
  100. package/dist/runtime/provider.js +2 -0
  101. package/dist/runtime/provider.js.map +1 -0
  102. package/dist/runtime/repository.d.ts +20 -0
  103. package/dist/runtime/repository.js +55 -0
  104. package/dist/runtime/repository.js.map +1 -0
  105. package/dist/runtime/run.d.ts +21 -0
  106. package/dist/runtime/run.js +80 -0
  107. package/dist/runtime/run.js.map +1 -0
  108. package/dist/runtime/scipProvider.d.ts +11 -0
  109. package/dist/runtime/scipProvider.js +126 -0
  110. package/dist/runtime/scipProvider.js.map +1 -0
  111. package/dist/runtime/typescriptProvider.d.ts +10 -0
  112. package/dist/runtime/typescriptProvider.js +289 -0
  113. package/dist/runtime/typescriptProvider.js.map +1 -0
  114. package/dist/runtime/workflow.d.ts +30 -0
  115. package/dist/runtime/workflow.js +153 -0
  116. package/dist/runtime/workflow.js.map +1 -0
  117. package/package.json +72 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) YEAR OWNER_NAME
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ <p align="center">
2
+ <a href="https://github.com/yohn-jp/wabachi/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/yohn-jp/wabachi/actions/workflows/ci.yml/badge.svg"></a>
3
+ <a href="https://www.npmjs.com/package/wabachi"><img alt="npm" src="https://img.shields.io/npm/v/wabachi"></a>
4
+ <a href="https://www.npmjs.com/package/wabachi"><img alt="Node" src="https://img.shields.io/node/v/wabachi"></a>
5
+ <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/wabachi"></a>
6
+ </p>
7
+
8
+ # Wabachi
9
+
10
+ **Repository analysis and Architecture Canon tooling**
11
+
12
+ Wabachi provides deterministic repository-analysis workflows for codebase understanding. It can resolve a repository and revision, execute registered analysis providers, generate auditable provider matrices, and validate or render an explicit Architecture Canon.
13
+
14
+ ## Quick start
15
+
16
+ Requires Node.js 22.13 or newer.
17
+
18
+ ```bash
19
+ npm install --global wabachi
20
+
21
+ wabachi --version
22
+ wabachi --help
23
+ ```
24
+
25
+ For an ephemeral invocation:
26
+
27
+ ```bash
28
+ npx --yes wabachi --help
29
+ ```
30
+
31
+ ## Commands
32
+
33
+ Run the registered repository-analysis providers:
34
+
35
+ ```bash
36
+ wabachi run <repository> [--revision <ref>] [--out <dir>]
37
+ ```
38
+
39
+ Run the provider matrix and retain its auditable artifacts:
40
+
41
+ ```bash
42
+ wabachi matrix <repository> --revision <sha> --out <dir>
43
+ ```
44
+
45
+ Validate an Architecture Canon document:
46
+
47
+ ```bash
48
+ wabachi architecture validate <file>
49
+ ```
50
+
51
+ Render an Architecture Canon site:
52
+
53
+ ```bash
54
+ wabachi architecture render <file> --out <dir>
55
+ ```
56
+
57
+ Use `wabachi --help` for the installed command surface.
58
+
59
+ ## Analysis model
60
+
61
+ Wabachi keeps repository facts and architecture declarations explicit. Repository analysis is performed by registered providers, while Architecture Canon input is supplied as an explicit document and validated before rendering.
62
+
63
+ The matrix workflow emits retained artifacts so provider output, correlations, and reports can be inspected rather than treated as opaque agent context.
64
+
65
+ ## Development
66
+
67
+ ```bash
68
+ pnpm install --frozen-lockfile
69
+ pnpm run verify
70
+ ```
71
+
72
+ `pnpm run verify` is the repository's authoritative local verification entry point. `pnpm run test:package` builds, packs, installs, and executes the npm package in an isolated smoke-test environment.
73
+
74
+ ## Security
75
+
76
+ Report vulnerabilities privately as described in [SECURITY.md](./SECURITY.md).
77
+
78
+ ## Contributing
79
+
80
+ See [CONTRIBUTING.md](./CONTRIBUTING.md).
81
+
82
+ ## License
83
+
84
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,35 @@
1
+ import { type ObjectId } from "./identity.js";
2
+ /** A declaration of the canonical decision or truth owner for a concern. */
3
+ export interface AuthorityFact {
4
+ readonly kind: "authority";
5
+ readonly concern: ObjectId;
6
+ readonly owner: ObjectId;
7
+ }
8
+ /** A declaration of the resource, contract, or lifecycle owner for a resource. */
9
+ export interface OwnershipFact {
10
+ readonly kind: "ownership";
11
+ readonly resource: ObjectId;
12
+ readonly owner: ObjectId;
13
+ }
14
+ export type AuthorityOwnershipFact = AuthorityFact | OwnershipFact;
15
+ export interface AuthorityFactInput {
16
+ readonly concern: string;
17
+ readonly owner: string;
18
+ }
19
+ export interface OwnershipFactInput {
20
+ readonly resource: string;
21
+ readonly owner: string;
22
+ }
23
+ export interface AuthorityOwnershipFactsInput {
24
+ readonly authority?: readonly AuthorityFactInput[];
25
+ readonly ownership?: readonly OwnershipFactInput[];
26
+ }
27
+ export interface AuthorityOwnershipFacts {
28
+ readonly authority: readonly AuthorityFact[];
29
+ readonly ownership: readonly OwnershipFact[];
30
+ }
31
+ export declare function createAuthorityFact(input: AuthorityFactInput): AuthorityFact;
32
+ export declare function createOwnershipFact(input: OwnershipFactInput): OwnershipFact;
33
+ export declare function createAuthorityFacts(inputs: readonly AuthorityFactInput[]): readonly AuthorityFact[];
34
+ export declare function createOwnershipFacts(inputs: readonly OwnershipFactInput[]): readonly OwnershipFact[];
35
+ export declare function createAuthorityOwnershipFacts(input: AuthorityOwnershipFactsInput): AuthorityOwnershipFacts;
@@ -0,0 +1,76 @@
1
+ import { createObjectId } from "./identity.js";
2
+ function asRecord(input, label) {
3
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
4
+ throw new TypeError(`${label} must be an object`);
5
+ }
6
+ return input;
7
+ }
8
+ function readObjectId(record, field, label) {
9
+ const value = record[field];
10
+ if (typeof value !== "string") {
11
+ throw new TypeError(`${label} ${field} must be a string`);
12
+ }
13
+ return createObjectId(value);
14
+ }
15
+ export function createAuthorityFact(input) {
16
+ const record = asRecord(input, "authority fact");
17
+ return Object.freeze({
18
+ kind: "authority",
19
+ concern: readObjectId(record, "concern", "authority fact"),
20
+ owner: readObjectId(record, "owner", "authority fact"),
21
+ });
22
+ }
23
+ export function createOwnershipFact(input) {
24
+ const record = asRecord(input, "ownership fact");
25
+ return Object.freeze({
26
+ kind: "ownership",
27
+ resource: readObjectId(record, "resource", "ownership fact"),
28
+ owner: readObjectId(record, "owner", "ownership fact"),
29
+ });
30
+ }
31
+ function compareIds(left, right) {
32
+ if (left < right)
33
+ return -1;
34
+ if (left > right)
35
+ return 1;
36
+ return 0;
37
+ }
38
+ export function createAuthorityFacts(inputs) {
39
+ if (!Array.isArray(inputs)) {
40
+ throw new TypeError("authority facts must be an array");
41
+ }
42
+ const facts = inputs.map(createAuthorityFact);
43
+ const seen = new Set();
44
+ for (const fact of facts) {
45
+ const key = `${fact.concern}\u0000${fact.owner}`;
46
+ if (seen.has(key)) {
47
+ throw new Error(`duplicate authority fact: ${fact.concern} -> ${fact.owner}`);
48
+ }
49
+ seen.add(key);
50
+ }
51
+ facts.sort((left, right) => compareIds(left.concern, right.concern) || compareIds(left.owner, right.owner));
52
+ return Object.freeze(facts);
53
+ }
54
+ export function createOwnershipFacts(inputs) {
55
+ if (!Array.isArray(inputs)) {
56
+ throw new TypeError("ownership facts must be an array");
57
+ }
58
+ const facts = inputs.map(createOwnershipFact);
59
+ const seen = new Set();
60
+ for (const fact of facts) {
61
+ const key = `${fact.resource}\u0000${fact.owner}`;
62
+ if (seen.has(key)) {
63
+ throw new Error(`duplicate ownership fact: ${fact.resource} -> ${fact.owner}`);
64
+ }
65
+ seen.add(key);
66
+ }
67
+ facts.sort((left, right) => compareIds(left.resource, right.resource) || compareIds(left.owner, right.owner));
68
+ return Object.freeze(facts);
69
+ }
70
+ export function createAuthorityOwnershipFacts(input) {
71
+ const record = asRecord(input, "authority/ownership facts");
72
+ const authority = createAuthorityFacts((record.authority ?? []));
73
+ const ownership = createOwnershipFacts((record.ownership ?? []));
74
+ return Object.freeze({ authority, ownership });
75
+ }
76
+ //# sourceMappingURL=authority.js.map
@@ -0,0 +1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CAAC,SAAS,IAAI,EAAE,CAAkC,CAAC,CAAC;IAElG,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,31 @@
1
+ declare const boundaryIdBrand: unique symbol;
2
+ declare const canonMemberIdBrand: unique symbol;
3
+ export type BoundaryId = string & {
4
+ readonly [boundaryIdBrand]: never;
5
+ };
6
+ export type CanonMemberId = string & {
7
+ readonly [canonMemberIdBrand]: never;
8
+ };
9
+ export declare const BOUNDARY_KINDS: readonly ["semantic", "trust", "ownership"];
10
+ export type BoundaryKind = (typeof BOUNDARY_KINDS)[number];
11
+ export interface BoundaryInput {
12
+ readonly id: string;
13
+ readonly kind: BoundaryKind;
14
+ readonly memberIds: readonly string[];
15
+ }
16
+ export interface Boundary {
17
+ readonly id: BoundaryId;
18
+ readonly kind: BoundaryKind;
19
+ readonly memberIds: readonly CanonMemberId[];
20
+ }
21
+ /**
22
+ * Creates a declarative boundary record. Member IDs are retained as references;
23
+ * this module does not resolve or synthesize the referenced Canon records.
24
+ */
25
+ export declare function createBoundary(input: BoundaryInput): Boundary;
26
+ /**
27
+ * Creates a deterministic collection of boundaries and rejects duplicate
28
+ * boundary identities rather than silently selecting one definition.
29
+ */
30
+ export declare function createBoundaries(inputs: readonly BoundaryInput[]): readonly Boundary[];
31
+ export {};
@@ -0,0 +1,73 @@
1
+ import { normalizeIdentityId } from "./identity.js";
2
+ export const BOUNDARY_KINDS = ["semantic", "trust", "ownership"];
3
+ function normalizeBoundaryId(value) {
4
+ return normalizeIdentityId(value);
5
+ }
6
+ function normalizeMemberId(value) {
7
+ return normalizeIdentityId(value);
8
+ }
9
+ function isBoundaryKind(value) {
10
+ return typeof value === "string" && BOUNDARY_KINDS.includes(value);
11
+ }
12
+ function compareStrings(left, right) {
13
+ if (left < right)
14
+ return -1;
15
+ if (left > right)
16
+ return 1;
17
+ return 0;
18
+ }
19
+ function assertBoundaryInput(input) {
20
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
21
+ throw new TypeError("boundary must be an object");
22
+ }
23
+ const candidate = input;
24
+ normalizeBoundaryId(candidate.id);
25
+ if (!isBoundaryKind(candidate.kind)) {
26
+ throw new TypeError("boundary kind is malformed");
27
+ }
28
+ if (!Array.isArray(candidate.memberIds)) {
29
+ throw new TypeError("boundary memberIds must be an array");
30
+ }
31
+ }
32
+ /**
33
+ * Creates a declarative boundary record. Member IDs are retained as references;
34
+ * this module does not resolve or synthesize the referenced Canon records.
35
+ */
36
+ export function createBoundary(input) {
37
+ assertBoundaryInput(input);
38
+ const id = normalizeBoundaryId(input.id);
39
+ const memberIds = input.memberIds.map((memberId) => normalizeMemberId(memberId));
40
+ const seenMemberIds = new Set();
41
+ for (const memberId of memberIds) {
42
+ if (seenMemberIds.has(memberId)) {
43
+ throw new Error(`duplicate boundary member id: ${memberId}`);
44
+ }
45
+ seenMemberIds.add(memberId);
46
+ }
47
+ memberIds.sort(compareStrings);
48
+ return Object.freeze({
49
+ id,
50
+ kind: input.kind,
51
+ memberIds: Object.freeze(memberIds),
52
+ });
53
+ }
54
+ /**
55
+ * Creates a deterministic collection of boundaries and rejects duplicate
56
+ * boundary identities rather than silently selecting one definition.
57
+ */
58
+ export function createBoundaries(inputs) {
59
+ if (!Array.isArray(inputs)) {
60
+ throw new TypeError("boundaries must be an array");
61
+ }
62
+ const boundaries = inputs.map((input) => createBoundary(input));
63
+ const seenBoundaryIds = new Set();
64
+ for (const boundary of boundaries) {
65
+ if (seenBoundaryIds.has(boundary.id)) {
66
+ throw new Error(`duplicate boundary id: ${boundary.id}`);
67
+ }
68
+ seenBoundaryIds.add(boundary.id);
69
+ }
70
+ boundaries.sort((left, right) => compareStrings(left.id, right.id));
71
+ return Object.freeze(boundaries);
72
+ }
73
+ //# sourceMappingURL=boundaries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundaries.js","sourceRoot":"","sources":["../../../src/architecture/canon/boundaries.ts"],"names":[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AAC,EAAE,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type ArchitectureDocumentV1 } from "./document.js";
2
+ /** Decode a strict canonical JSON-compatible Architecture Canon v1 value. */
3
+ export declare function decodeArchitectureDocument(value: unknown): ArchitectureDocumentV1;
4
+ /** Serialize a validated Architecture Canon v1 document deterministically. */
5
+ export declare function serializeCanonicalArchitectureDocument(document: ArchitectureDocumentV1): string;
6
+ /** Parse canonical JSON text and decode it through the same strict boundary. */
7
+ export declare function parseCanonicalArchitectureDocument(source: string): ArchitectureDocumentV1;
8
+ export declare const encodeCanonicalJson: typeof serializeCanonicalArchitectureDocument;
9
+ export declare const serializeCanonicalJson: typeof serializeCanonicalArchitectureDocument;
10
+ export declare const decodeCanonicalJson: typeof parseCanonicalArchitectureDocument;