yarramate 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 (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -0
  3. package/dist/adapter-mapping.d.ts +40 -0
  4. package/dist/adapter-mapping.js +200 -0
  5. package/dist/adapters/graphify-cli.d.ts +3 -0
  6. package/dist/adapters/graphify-cli.js +127 -0
  7. package/dist/adapters/graphify-entry.d.ts +1 -0
  8. package/dist/adapters/graphify-entry.js +1 -0
  9. package/dist/adapters/graphify.d.ts +23 -0
  10. package/dist/adapters/graphify.js +47 -0
  11. package/dist/adapters/likec4-cli.d.ts +3 -0
  12. package/dist/adapters/likec4-cli.js +662 -0
  13. package/dist/adapters/likec4-export.d.ts +25 -0
  14. package/dist/adapters/likec4-export.js +204 -0
  15. package/dist/adapters/likec4-kind-mapping.d.ts +22 -0
  16. package/dist/adapters/likec4-kind-mapping.js +60 -0
  17. package/dist/adapters/likec4-prepare.d.ts +28 -0
  18. package/dist/adapters/likec4-prepare.js +154 -0
  19. package/dist/adapters/likec4-project.d.ts +58 -0
  20. package/dist/adapters/likec4-project.js +176 -0
  21. package/dist/adapters/likec4.d.ts +4 -0
  22. package/dist/adapters/likec4.js +4 -0
  23. package/dist/architecture-state.d.ts +22 -0
  24. package/dist/architecture-state.js +63 -0
  25. package/dist/check-command.d.ts +2 -0
  26. package/dist/check-command.js +232 -0
  27. package/dist/cli-support.d.ts +24 -0
  28. package/dist/cli-support.js +81 -0
  29. package/dist/cli.d.ts +4 -0
  30. package/dist/cli.js +575 -0
  31. package/dist/compiler.d.ts +66 -0
  32. package/dist/compiler.js +940 -0
  33. package/dist/core-contract.d.ts +43 -0
  34. package/dist/core-contract.js +162 -0
  35. package/dist/evidence.d.ts +58 -0
  36. package/dist/evidence.js +161 -0
  37. package/dist/graph.d.ts +2 -0
  38. package/dist/graph.js +37 -0
  39. package/dist/index.d.ts +11 -0
  40. package/dist/index.js +9 -0
  41. package/dist/profile.d.ts +30 -0
  42. package/dist/profile.js +162 -0
  43. package/dist/projection.d.ts +42 -0
  44. package/dist/projection.js +183 -0
  45. package/dist/reconciliation.d.ts +26 -0
  46. package/dist/reconciliation.js +47 -0
  47. package/dist/source-document.d.ts +24 -0
  48. package/dist/source-document.js +80 -0
  49. package/dist/workspace.d.ts +29 -0
  50. package/dist/workspace.js +114 -0
  51. package/docs/CONSUMING-YARRAMATE.md +145 -0
  52. package/package.json +110 -0
  53. package/schema/yarramate-adapter-mapping.schema.json +59 -0
  54. package/schema/yarramate-check-result.schema.json +92 -0
  55. package/schema/yarramate-core-contract.schema.json +132 -0
  56. package/schema/yarramate-diagnostic-result.schema.json +64 -0
  57. package/schema/yarramate-document.schema.json +168 -0
  58. package/schema/yarramate-evidence-report.schema.json +73 -0
  59. package/schema/yarramate-evidence.schema.json +92 -0
  60. package/schema/yarramate-graph-v2.schema.json +170 -0
  61. package/schema/yarramate-likec4-check-result.schema.json +50 -0
  62. package/schema/yarramate-likec4-diagnostic-result.schema.json +69 -0
  63. package/schema/yarramate-likec4-generated-project-v2.schema.json +100 -0
  64. package/schema/yarramate-likec4-generated-project.schema.json +76 -0
  65. package/schema/yarramate-likec4-kind-mapping.schema.json +65 -0
  66. package/schema/yarramate-likec4-project.schema.json +160 -0
  67. package/schema/yarramate-profile.schema.json +113 -0
  68. package/schema/yarramate-projection-result.schema.json +177 -0
  69. package/schema/yarramate-projection.schema.json +126 -0
  70. package/schema/yarramate-reconciliation-report.schema.json +90 -0
  71. package/schema/yarramate-state-comparison.schema.json +61 -0
  72. package/schema/yarramate-workspace.schema.json +55 -0
  73. package/skills/yarramate-architecture/SKILL.md +135 -0
  74. package/skills/yarramate-architecture/agents/openai.yaml +4 -0
  75. package/skills/yarramate-architecture/references/journey-checklists.md +57 -0
  76. package/skills/yarramate-architecture/references/native-authoring.md +167 -0
@@ -0,0 +1,114 @@
1
+ import { globSync, realpathSync, statSync } from 'node:fs';
2
+ import { dirname, isAbsolute, relative, resolve, sep, } from 'node:path';
3
+ import Ajv2020Module from 'ajv/dist/2020.js';
4
+ import { diagnosticOrder, loadSourceDocument, } from './source-document.js';
5
+ import workspaceSchema from '../schema/yarramate-workspace.schema.json' with {
6
+ type: 'json'
7
+ };
8
+ const Ajv2020 = Ajv2020Module.default;
9
+ const validateWorkspace = new Ajv2020({ allErrors: true }).compile(workspaceSchema);
10
+ export function loadWorkspaceManifest(source, cwd) {
11
+ const loaded = loadSourceDocument(source, validateWorkspace, 'Workspace');
12
+ if (!loaded.ok)
13
+ return loaded;
14
+ const { value, yaml, lineCounter } = loaded.document;
15
+ const base = dirname(resolve(cwd, source.path));
16
+ const realBase = realpathSync(base);
17
+ const resolutionDiagnostics = [];
18
+ const categoryByPath = new Map();
19
+ const expand = (field, label, patterns) => [
20
+ ...new Set(patterns.flatMap((pattern, index) => {
21
+ const node = yaml.getIn([field, index], true);
22
+ const offset = typeof node === 'object' &&
23
+ node !== null &&
24
+ 'range' in node &&
25
+ Array.isArray(node.range)
26
+ ? node.range[0]
27
+ : 0;
28
+ const position = lineCounter.linePos(offset);
29
+ const unsafe = isAbsolute(pattern) ||
30
+ /^[A-Za-z]:[\\/]/.test(pattern) ||
31
+ pattern.includes('\\') ||
32
+ pattern.split('/').includes('..');
33
+ if (unsafe) {
34
+ resolutionDiagnostics.push({
35
+ severity: 'error',
36
+ code: 'YM701',
37
+ message: `Workspace ${label} pattern "${pattern}" must be a relative path beneath the manifest directory`,
38
+ path: source.path,
39
+ pointer: `/${field}/${index}`,
40
+ line: position.line,
41
+ column: position.col,
42
+ });
43
+ return [];
44
+ }
45
+ const matches = globSync(pattern, { cwd: base }).filter((path) => statSync(resolve(base, path)).isFile());
46
+ if (matches.length === 0) {
47
+ resolutionDiagnostics.push({
48
+ severity: 'error',
49
+ code: 'YM702',
50
+ message: `Workspace ${label} pattern "${pattern}" matched no files`,
51
+ path: source.path,
52
+ pointer: `/${field}/${index}`,
53
+ line: position.line,
54
+ column: position.col,
55
+ });
56
+ }
57
+ const safeMatches = matches.filter((path) => {
58
+ const realMatch = realpathSync(resolve(base, path));
59
+ const withinBase = realMatch === realBase ||
60
+ realMatch.startsWith(`${realBase}${sep}`);
61
+ if (!withinBase) {
62
+ resolutionDiagnostics.push({
63
+ severity: 'error',
64
+ code: 'YM701',
65
+ message: `Workspace ${label} pattern "${pattern}" resolved outside the manifest directory`,
66
+ path: source.path,
67
+ pointer: `/${field}/${index}`,
68
+ line: position.line,
69
+ column: position.col,
70
+ });
71
+ }
72
+ return withinBase;
73
+ });
74
+ return safeMatches.map((path) => {
75
+ const resolvedPath = relative(cwd, resolve(base, path))
76
+ .split(sep)
77
+ .join('/');
78
+ const physicalPath = realpathSync(resolve(base, path));
79
+ const previousLabel = categoryByPath.get(physicalPath);
80
+ if (previousLabel !== undefined && previousLabel !== label) {
81
+ resolutionDiagnostics.push({
82
+ severity: 'error',
83
+ code: 'YM703',
84
+ message: `Resolved file "${resolvedPath}" is declared as both ${previousLabel} and ${label}`,
85
+ path: source.path,
86
+ pointer: `/${field}/${index}`,
87
+ line: position.line,
88
+ column: position.col,
89
+ });
90
+ }
91
+ else {
92
+ categoryByPath.set(physicalPath, label);
93
+ }
94
+ return resolvedPath;
95
+ });
96
+ })),
97
+ ].sort();
98
+ const workspace = {
99
+ id: value.id,
100
+ documents: expand('documents', 'document', value.documents),
101
+ profiles: expand('profiles', 'profile', value.profiles),
102
+ projections: expand('projections', 'projection', value.projections),
103
+ adapterMappings: expand('adapterMappings', 'adapter mapping', value.adapterMappings),
104
+ evidence: expand('evidence', 'evidence', value.evidence ?? []),
105
+ contracts: expand('contracts', 'Core contract', value.contracts ?? []),
106
+ };
107
+ if (resolutionDiagnostics.length > 0) {
108
+ return {
109
+ ok: false,
110
+ diagnostics: resolutionDiagnostics.sort(diagnosticOrder),
111
+ };
112
+ }
113
+ return { ok: true, manifest: value, workspace };
114
+ }
@@ -0,0 +1,145 @@
1
+ # Consuming YarraMate
2
+
3
+ Native documents in the consuming repository remain canonical. Consumer
4
+ commands are documented as `yarramate ...` because the executable is the
5
+ stable product interface regardless of how it was installed.
6
+
7
+ ## Published quick start
8
+
9
+ Once the package and public repository are published:
10
+
11
+ ```sh
12
+ npm install --global yarramate
13
+ npx skills add yarrasys/yarramate --skill yarramate-architecture
14
+ yarramate init .
15
+ yarramate check .yarramate/workspace.yaml --json
16
+ ```
17
+
18
+ The first command installs the engine executable. The second installs the
19
+ canonical guided methodology for supported agent harnesses. They are separate:
20
+ the skill orchestrates the CLI and does not contain its runtime.
21
+
22
+ Projects that prefer a version-pinned development dependency may instead use:
23
+
24
+ ```sh
25
+ npm install --save-dev yarramate
26
+ npx yarramate init .
27
+ ```
28
+
29
+ Inside package scripts and agent harness commands, the project-local
30
+ executable is resolved as `yarramate`:
31
+
32
+ ```json
33
+ {
34
+ "scripts": {
35
+ "architecture:check": "yarramate check .yarramate/workspace.yaml --json",
36
+ "architecture:reconcile": "yarramate reconcile .yarramate/workspace.yaml"
37
+ }
38
+ }
39
+ ```
40
+
41
+ The remainder of this guide uses the direct executable form.
42
+
43
+ ## Install a local artifact
44
+
45
+ Before the first npm release, validate consumption through a local package
46
+ artifact. From the YarraMate repository:
47
+
48
+ ```sh
49
+ pnpm pack --pack-destination /tmp/yarramate-package
50
+ ```
51
+
52
+ In a consuming project:
53
+
54
+ ```sh
55
+ npm install --save-dev /tmp/yarramate-package/yarramate-0.1.0.tgz
56
+ npx yarramate init .
57
+ npx yarramate check .yarramate/workspace.yaml --json
58
+ ```
59
+
60
+ The package contains the CLI runtime, normative schemas, and the canonical
61
+ `yarramate-architecture` skill. It excludes the YarraMate repository
62
+ self-model, source, tests, and fixtures.
63
+
64
+ ## Install the agent skill
65
+
66
+ After the repository is public, use the agent-skills installer:
67
+
68
+ ```sh
69
+ npx skills add yarrasys/yarramate --skill yarramate-architecture
70
+ ```
71
+
72
+ The installed directory is a deployment of the canonical repository skill,
73
+ not a harness-specific fork. Before publication, packed-artifact testing may
74
+ instead expose the packaged copy through thin local links:
75
+
76
+ ```sh
77
+ mkdir -p .agents/skills .claude/skills
78
+ ln -s ../../node_modules/yarramate/skills/yarramate-architecture \
79
+ .agents/skills/yarramate-architecture
80
+ ln -s ../../node_modules/yarramate/skills/yarramate-architecture \
81
+ .claude/skills/yarramate-architecture
82
+ ```
83
+
84
+ Do not independently edit installed or linked copies. Changes to the
85
+ methodology belong in the canonical repository skill.
86
+
87
+ ## Existing-project discovery
88
+
89
+ Ask the harness to use `$yarramate-architecture` to discover the project.
90
+ The skill will inspect repository evidence, propose native documents, and run:
91
+
92
+ ```sh
93
+ yarramate check .yarramate/workspace.yaml --json
94
+ yarramate evidence \
95
+ .yarramate/evidence/<evidence>.yaml \
96
+ .yarramate/workspace.yaml
97
+ yarramate reconcile .yarramate/workspace.yaml
98
+ yarramate context \
99
+ .yarramate/projections/<projection>.yaml \
100
+ .yarramate/workspace.yaml
101
+ ```
102
+
103
+ Evidence remains distinct from declared intent. A generated proposal becomes
104
+ canonical only through the consuming repository's normal Git review.
105
+
106
+ ## Architecture-first design
107
+
108
+ Ask the harness to use `$yarramate-architecture` to design the solution before
109
+ implementation. The skill records alternatives, target intent, and bounded
110
+ implementation context, then runs:
111
+
112
+ ```sh
113
+ yarramate check .yarramate/workspace.yaml --json
114
+ yarramate context \
115
+ .yarramate/projections/<alternatives>.yaml \
116
+ .yarramate/workspace.yaml
117
+ yarramate context \
118
+ .yarramate/projections/<target>.yaml \
119
+ .yarramate/workspace.yaml
120
+ yarramate compare \
121
+ <baseline-state> <target-state> \
122
+ .yarramate/workspace.yaml
123
+ ```
124
+
125
+ The CLI verifies deterministic correctness. It does not approve the design or
126
+ require a complete model.
127
+
128
+ ## Optional Graphify evidence
129
+
130
+ When Graphify has generated `graphify-out/graph.json`, an explicit subject
131
+ mapping can produce a standard evidence overlay:
132
+
133
+ ```sh
134
+ yarramate-graphify observe \
135
+ graphify-out/graph.json \
136
+ .yarramate/integrations/graphify/subject-mapping.yaml \
137
+ .yarramate/workspace.yaml \
138
+ --id repository-graphify \
139
+ --version 1.0 \
140
+ > .yarramate/evidence/graphify.yaml
141
+ ```
142
+
143
+ Graphify extraction remains a separate installation and operation. The
144
+ adapter observes only explicitly mapped nodes and never promotes them into
145
+ canonical architecture.
package/package.json ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "yarramate",
3
+ "version": "0.1.0",
4
+ "description": "Tool-neutral semantic architecture engine and guided methodology",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/yarrasys/yarramate.git"
9
+ },
10
+ "homepage": "https://github.com/yarrasys/yarramate#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/yarrasys/yarramate/issues"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "keywords": [
18
+ "architecture",
19
+ "architecture-as-code",
20
+ "semantic-graph",
21
+ "cli",
22
+ "likec4"
23
+ ],
24
+ "files": [
25
+ "dist",
26
+ "schema",
27
+ "skills/yarramate-architecture",
28
+ "docs/CONSUMING-YARRAMATE.md"
29
+ ],
30
+ "type": "module",
31
+ "main": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "import": "./dist/index.js"
37
+ },
38
+ "./adapter/likec4": {
39
+ "types": "./dist/adapters/likec4.d.ts",
40
+ "import": "./dist/adapters/likec4.js"
41
+ },
42
+ "./adapter/graphify": {
43
+ "types": "./dist/adapters/graphify-entry.d.ts",
44
+ "import": "./dist/adapters/graphify-entry.js"
45
+ },
46
+ "./schema/document": "./schema/yarramate-document.schema.json",
47
+ "./schema/profile": "./schema/yarramate-profile.schema.json",
48
+ "./schema/projection": "./schema/yarramate-projection.schema.json",
49
+ "./schema/projection-result": "./schema/yarramate-projection-result.schema.json",
50
+ "./schema/adapter-mapping": "./schema/yarramate-adapter-mapping.schema.json",
51
+ "./schema/check-result": "./schema/yarramate-check-result.schema.json",
52
+ "./schema/diagnostic-result": "./schema/yarramate-diagnostic-result.schema.json",
53
+ "./schema/likec4-diagnostic-result": "./schema/yarramate-likec4-diagnostic-result.schema.json",
54
+ "./schema/likec4-generated-project": "./schema/yarramate-likec4-generated-project.schema.json",
55
+ "./schema/likec4-generated-project-v2": "./schema/yarramate-likec4-generated-project-v2.schema.json",
56
+ "./schema/likec4-project": "./schema/yarramate-likec4-project.schema.json",
57
+ "./schema/likec4-kind-mapping": "./schema/yarramate-likec4-kind-mapping.schema.json",
58
+ "./schema/likec4-check-result": "./schema/yarramate-likec4-check-result.schema.json",
59
+ "./schema/state-comparison": "./schema/yarramate-state-comparison.schema.json",
60
+ "./schema/graph-v2": "./schema/yarramate-graph-v2.schema.json",
61
+ "./schema/workspace": "./schema/yarramate-workspace.schema.json",
62
+ "./schema/evidence": "./schema/yarramate-evidence.schema.json",
63
+ "./schema/evidence-report": "./schema/yarramate-evidence-report.schema.json",
64
+ "./schema/reconciliation-report": "./schema/yarramate-reconciliation-report.schema.json",
65
+ "./schema/core-contract": "./schema/yarramate-core-contract.schema.json",
66
+ "./skill/yarramate-architecture": "./skills/yarramate-architecture/SKILL.md"
67
+ },
68
+ "bin": {
69
+ "yarramate": "dist/cli.js",
70
+ "yarramate-likec4": "dist/adapters/likec4-cli.js",
71
+ "yarramate-graphify": "dist/adapters/graphify-cli.js"
72
+ },
73
+ "packageManager": "pnpm@11.7.0",
74
+ "engines": {
75
+ "node": ">=22.0.0"
76
+ },
77
+ "scripts": {
78
+ "build": "tsc -p tsconfig.build.json",
79
+ "prepack": "pnpm build",
80
+ "docs:dev": "pnpm self:export:likec4 && likec4 serve .yarramate-out/likec4",
81
+ "format": "likec4 format .yarramate/integrations/likec4/prototype",
82
+ "self:check": "pnpm build && node dist/cli.js check .yarramate/workspace.yaml",
83
+ "self:check:json": "pnpm build && node dist/cli.js check .yarramate/workspace.yaml --json",
84
+ "self:compile": "pnpm build && node dist/cli.js compile .yarramate/workspace.yaml",
85
+ "self:context": "pnpm build && node dist/cli.js context .yarramate/projections/current-engine.yaml .yarramate/workspace.yaml",
86
+ "self:view": "pnpm build && node dist/cli.js view .yarramate/projections/current-engine.yaml .yarramate/workspace.yaml",
87
+ "self:compare": "pnpm build && node dist/cli.js compare yarramate-evolution#native-foundation yarramate-evolution#state-foundation .yarramate/workspace.yaml",
88
+ "self:compare:contract": "pnpm build && node dist/cli.js compare yarramate-evolution#state-foundation yarramate-evolution#core-contract-foundation .yarramate/workspace.yaml",
89
+ "self:contract": "pnpm build && node dist/cli.js context .yarramate/projections/core-contract-foundation.yaml .yarramate/workspace.yaml",
90
+ "self:evidence": "pnpm build && node dist/cli.js evidence .yarramate/evidence/repository.yaml .yarramate/workspace.yaml",
91
+ "self:reconcile": "pnpm build && node dist/cli.js reconcile .yarramate/workspace.yaml",
92
+ "self:check:likec4": "pnpm build && node dist/adapters/likec4-cli.js check .yarramate/integrations/likec4/project.yaml .yarramate/workspace.yaml",
93
+ "self:check:likec4:json": "pnpm build && node dist/adapters/likec4-cli.js check .yarramate/integrations/likec4/project.yaml --json .yarramate/workspace.yaml",
94
+ "self:export:likec4": "pnpm build && node dist/adapters/likec4-cli.js export-project .yarramate/integrations/likec4/project.yaml .yarramate-out/likec4 .yarramate/workspace.yaml",
95
+ "validate": "pnpm self:export:likec4 && likec4 validate --no-layout .yarramate-out/likec4",
96
+ "verify": "pnpm typecheck && pnpm test && pnpm self:check && pnpm validate",
97
+ "test": "vitest run",
98
+ "typecheck": "tsc --noEmit"
99
+ },
100
+ "dependencies": {
101
+ "ajv": "^8.17.1",
102
+ "yaml": "^2.8.1"
103
+ },
104
+ "devDependencies": {
105
+ "@types/node": "^24.0.0",
106
+ "likec4": "^1.59.2",
107
+ "typescript": "^5.9.0",
108
+ "vitest": "^4.1.10"
109
+ }
110
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yarramate.org/schema/adapter-mapping/v1",
4
+ "title": "YarraMate adapter mapping",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["format", "id", "version", "adapter", "mappings"],
8
+ "properties": {
9
+ "format": {
10
+ "const": "yarramate/adapter-mapping/v1"
11
+ },
12
+ "id": {
13
+ "$ref": "#/$defs/id"
14
+ },
15
+ "version": {
16
+ "type": "string",
17
+ "pattern": "^[0-9]+\\.[0-9]+$"
18
+ },
19
+ "adapter": {
20
+ "$ref": "#/$defs/id"
21
+ },
22
+ "mappings": {
23
+ "type": "array",
24
+ "items": {
25
+ "$ref": "#/$defs/mapping"
26
+ }
27
+ }
28
+ },
29
+ "$defs": {
30
+ "id": {
31
+ "type": "string",
32
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
33
+ },
34
+ "qualifiedSubject": {
35
+ "type": "string",
36
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*#[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
37
+ },
38
+ "nonEmptyText": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ },
42
+ "mapping": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "required": ["native", "external", "type"],
46
+ "properties": {
47
+ "native": {
48
+ "$ref": "#/$defs/qualifiedSubject"
49
+ },
50
+ "external": {
51
+ "$ref": "#/$defs/nonEmptyText"
52
+ },
53
+ "type": {
54
+ "enum": ["concept", "relationship"]
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yarramate.org/schema/check-result/v1",
4
+ "title": "YarraMate check result",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["format", "ok", "diagnostics"],
8
+ "properties": {
9
+ "format": {
10
+ "const": "yarramate/check-result/v1"
11
+ },
12
+ "ok": {
13
+ "type": "boolean"
14
+ },
15
+ "diagnostics": {
16
+ "type": "array",
17
+ "items": {
18
+ "$ref": "#/$defs/diagnostic"
19
+ }
20
+ }
21
+ },
22
+ "allOf": [
23
+ {
24
+ "if": {
25
+ "properties": {
26
+ "ok": {
27
+ "const": true
28
+ }
29
+ },
30
+ "required": ["ok"]
31
+ },
32
+ "then": {
33
+ "properties": {
34
+ "diagnostics": {
35
+ "maxItems": 0
36
+ }
37
+ }
38
+ },
39
+ "else": {
40
+ "properties": {
41
+ "diagnostics": {
42
+ "minItems": 1
43
+ }
44
+ }
45
+ }
46
+ }
47
+ ],
48
+ "$defs": {
49
+ "diagnostic": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": [
53
+ "severity",
54
+ "code",
55
+ "message",
56
+ "path",
57
+ "pointer",
58
+ "line",
59
+ "column"
60
+ ],
61
+ "properties": {
62
+ "severity": {
63
+ "const": "error"
64
+ },
65
+ "code": {
66
+ "type": "string",
67
+ "pattern": "^YM[0-9]{3}$"
68
+ },
69
+ "message": {
70
+ "type": "string",
71
+ "minLength": 1
72
+ },
73
+ "path": {
74
+ "type": "string",
75
+ "minLength": 1
76
+ },
77
+ "pointer": {
78
+ "type": "string",
79
+ "pattern": "^/"
80
+ },
81
+ "line": {
82
+ "type": "integer",
83
+ "minimum": 1
84
+ },
85
+ "column": {
86
+ "type": "integer",
87
+ "minimum": 1
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,132 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://yarramate.org/schema/core-contract/v1",
4
+ "title": "YarraMate Core contract manifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "format",
9
+ "id",
10
+ "version",
11
+ "packageManifest",
12
+ "formats",
13
+ "commands",
14
+ "guarantees",
15
+ "exclusions"
16
+ ],
17
+ "properties": {
18
+ "format": {
19
+ "const": "yarramate/core-contract/v1"
20
+ },
21
+ "id": {
22
+ "$ref": "#/$defs/id"
23
+ },
24
+ "version": {
25
+ "type": "string",
26
+ "pattern": "^[0-9]+\\.[0-9]+$"
27
+ },
28
+ "packageManifest": {
29
+ "$ref": "#/$defs/repositoryPath"
30
+ },
31
+ "formats": {
32
+ "type": "array",
33
+ "minItems": 1,
34
+ "items": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["id", "schema", "packageExport"],
38
+ "properties": {
39
+ "id": {
40
+ "$ref": "#/$defs/formatIdentity"
41
+ },
42
+ "schema": {
43
+ "$ref": "#/$defs/repositoryPath"
44
+ },
45
+ "packageExport": {
46
+ "type": "string",
47
+ "pattern": "^\\./schema/[a-z][a-z0-9-]*$"
48
+ }
49
+ }
50
+ }
51
+ },
52
+ "commands": {
53
+ "type": "array",
54
+ "minItems": 1,
55
+ "items": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["name", "binary"],
59
+ "properties": {
60
+ "name": {
61
+ "enum": [
62
+ "init",
63
+ "add",
64
+ "connect",
65
+ "check",
66
+ "compile",
67
+ "view",
68
+ "context",
69
+ "compare",
70
+ "evidence",
71
+ "reconcile"
72
+ ]
73
+ },
74
+ "binary": {
75
+ "const": "yarramate"
76
+ },
77
+ "machineFormat": {
78
+ "$ref": "#/$defs/formatIdentity"
79
+ }
80
+ }
81
+ }
82
+ },
83
+ "guarantees": {
84
+ "type": "array",
85
+ "minItems": 1,
86
+ "uniqueItems": true,
87
+ "items": {
88
+ "enum": [
89
+ "adapter-independent-core",
90
+ "canonical-graph-serialization",
91
+ "correctness-not-completeness",
92
+ "deterministic-diagnostic-order",
93
+ "git-native-governance",
94
+ "globally-qualified-compiled-identities",
95
+ "no-partial-graph-on-error",
96
+ "portable-projection-selectors",
97
+ "source-located-diagnostics"
98
+ ]
99
+ }
100
+ },
101
+ "exclusions": {
102
+ "type": "array",
103
+ "minItems": 1,
104
+ "uniqueItems": true,
105
+ "items": {
106
+ "enum": [
107
+ "adapter-runtime-dependency",
108
+ "approval-workflow",
109
+ "architectural-completeness",
110
+ "architectural-quality",
111
+ "automatic-discovery",
112
+ "external-language-conformance",
113
+ "state-scoped-claim-values"
114
+ ]
115
+ }
116
+ }
117
+ },
118
+ "$defs": {
119
+ "id": {
120
+ "type": "string",
121
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
122
+ },
123
+ "formatIdentity": {
124
+ "type": "string",
125
+ "pattern": "^yarramate/[a-z][a-z0-9-]*(?:/[a-z0-9]+)?$"
126
+ },
127
+ "repositoryPath": {
128
+ "type": "string",
129
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\).+$"
130
+ }
131
+ }
132
+ }