archgraph-argo-beta 0.27.0-beta.0 → 0.27.0-beta.10
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/README.md +17 -0
- package/argo/.env.example +1 -1
- package/argo/rules/archgraph.instructions.md +1 -1
- package/argo/schema/{argob.config.json → schema-bundle.config.json} +4 -2
- package/argo/schema/{argob-rules.json → schema-bundle.rules.json} +1 -1
- package/argo/scripts/argo-mcp-server.js +13 -5
- package/argo/scripts/ensureArgoHarnessEnvironment.js +1 -1
- package/argo/scripts/graph-semantics.js +100 -3
- package/argo/scripts/runArchitectureTests.js +3 -3
- package/argo/scripts/{argob-schema.js → schema-bundle.js} +386 -28
- package/argo/scripts/systemarchitecture-mcp-server.js +254 -10
- package/argo/scripts/validateSystemArchitecture.js +3 -1
- package/argo/scripts/validator-mcp-server.js +1 -1
- package/argo/skills/argo-init/SKILL.md +2 -2
- package/cordis.patch.yml +9 -0
- package/dsh-argo-workspace/index.js +100 -30
- package/install-argo.ps1 +27 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,23 @@ After installing, open your project and start a coding agent. It will:
|
|
|
88
88
|
|
|
89
89
|
The intent architecture graph — modelled in **ArchiMate 3.2** — is the single source of truth.
|
|
90
90
|
|
|
91
|
+
## The federation model
|
|
92
|
+
|
|
93
|
+
ArchGraph is a **federated intent graph**, not one big distributed graph. Every project owns a
|
|
94
|
+
complete, **sovereign** canonical graph (`design/KG/SystemArchitecture.json`) and stays the single
|
|
95
|
+
source of truth for its own model — nothing is split, sharded, or merged into a central super-graph.
|
|
96
|
+
|
|
97
|
+
Projects **co-build** by federation: a member **self-registers** with the federation center, others
|
|
98
|
+
**discover** it, reads are **explicitly authorized and denied by default**, and a cross-project read
|
|
99
|
+
returns a **reference, not a copy**. The center holds only federation metadata — membership,
|
|
100
|
+
capabilities, interfaces, grants — plus a read-only mirror: it is a **registry + broker**, never the
|
|
101
|
+
content.
|
|
102
|
+
|
|
103
|
+
The pattern is **Registry–Broker Federation over sovereign knowledge graphs**: self-registration +
|
|
104
|
+
discovery + capability-based authorization + reference-not-copy, mediated by a broker. It is
|
|
105
|
+
*federated*, not "distributed" — a distributed model would mean one logical graph partitioned across
|
|
106
|
+
nodes, which is exactly what this design avoids.
|
|
107
|
+
|
|
91
108
|
## Community
|
|
92
109
|
|
|
93
110
|
ArchGraph runs on open co-building. Join the community hub to share, browse and reuse **architecture
|
package/argo/.env.example
CHANGED
|
@@ -142,7 +142,7 @@ ARGO_W31_LIVE_MUTATION_VECTOR_E2E=
|
|
|
142
142
|
# Pin the workspace/repository root the MCP server serves.
|
|
143
143
|
# ARGO_REPO_ROOT=
|
|
144
144
|
# Explicit schema-bundle directory (highest precedence): overrides both the
|
|
145
|
-
# repository's own <workspace>/.argo/schema bundle and the default
|
|
145
|
+
# repository's own <workspace>/.argo/schema bundle and the default ArchiMate 3.2
|
|
146
146
|
# bundle. Must contain SystemArchitecture.schema.json.
|
|
147
147
|
# ARGO_SCHEMA_DIR=
|
|
148
148
|
# Actor element type the wakeup gate looks up when a workspace schema renames
|
|
@@ -30,7 +30,7 @@ Non-negotiable red lines (MUST). Never skip, simplify, or silently violate them;
|
|
|
30
30
|
|
|
31
31
|
<Ontology>
|
|
32
32
|
Resolve the workspace modeling language before acting; do not assume ArchiMate. `queryNeo4jGraph` with `{schema:true}` returns `schemaKind`, `schemaLanguage`, the element/relationship type enums, `actorElementType`, `bundleValidation` and `guidePath`.
|
|
33
|
-
1. `schemaKind` `default`: the built-in
|
|
33
|
+
1. `schemaKind` `default`: the built-in ArchiMate 3.2 modeling language (with ARGO extensions). Reference files under ~/.argo: structure `~/.argo/schema/SystemArchitecture.schema.json`; types `~/.argo/schema/archimate3.2.md`.
|
|
34
34
|
2. `schemaKind` `workspace`/`override`: the repository's own schema bundle. Its element/relationship types, endpoint rules, root-view name, per-view element limit and guide govern every read and write — never assume ArchiMate types here.
|
|
35
35
|
3. `actorElementType` is the element type whose members are Actors (default `Business Actor`; `null` = no actor concept → skip Actor identification). Host override: ARGO_ACTOR_ELEMENT_TYPE.
|
|
36
36
|
4. If `bundleValidation.status` is `failed`, the workspace schema is misconfigured: report it to the human partner and do not write until it is fixed.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "
|
|
4
|
-
"description": "Descriptor for the default ARGO schema bundle (ArchiMate 3.2 + ARGO extensions). A repository may override this bundle by placing its own SystemArchitecture.schema.json (plus an optional
|
|
3
|
+
"title": "ArchiMate 3.2 default schema bundle descriptor",
|
|
4
|
+
"description": "Descriptor for the default ARGO schema bundle (ArchiMate 3.2 + ARGO extensions). A repository may override this bundle by placing its own SystemArchitecture.schema.json (plus an optional schema-bundle.config.json / schema-bundle.rules.json) under <workspace>/.argo/schema.",
|
|
5
|
+
"id": "default",
|
|
6
|
+
"aliases": ["archimate3.2", "archimate", "base"],
|
|
5
7
|
"language": "ArchiMate 3.2",
|
|
6
8
|
"elementTypeEnumKey": "archimateElementType",
|
|
7
9
|
"relationshipTypeEnumKey": "archimateRelationshipType",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dialect": "archimate-class-matrix",
|
|
3
|
-
"description": "Default
|
|
3
|
+
"description": "Default ArchiMate 3.2 rule data extracted from argo/scripts/archimate32-rules.js. Makes the default schema bundle data-driven so it can be replaced file-for-file like any custom bundle.",
|
|
4
4
|
"elementTypeMetadata": {
|
|
5
5
|
"Resource": {
|
|
6
6
|
"layer": "Strategy",
|
|
@@ -14,7 +14,7 @@ const {
|
|
|
14
14
|
} = require('./repositoryArgoEnvironment.js');
|
|
15
15
|
const {
|
|
16
16
|
loadSchemaBundleAndOntology,
|
|
17
|
-
} = require('./
|
|
17
|
+
} = require('./schema-bundle.js');
|
|
18
18
|
const {
|
|
19
19
|
externalQueryRequested,
|
|
20
20
|
queryExternalRead,
|
|
@@ -420,6 +420,13 @@ async function callTool(name, args = {}, progressToken = null, dependencies = un
|
|
|
420
420
|
tool: name,
|
|
421
421
|
args,
|
|
422
422
|
});
|
|
423
|
+
// getSystemArchitecture declares an outputSchema, so its result MUST carry
|
|
424
|
+
// matching structuredContent even on the cross-project path (which bypasses
|
|
425
|
+
// the systemarchitecture module's own toolResult). A missing
|
|
426
|
+
// structuredContent makes the MCP client reject the call with -32600.
|
|
427
|
+
if (name === 'getSystemArchitecture') {
|
|
428
|
+
return toolResult(result, systemArchitectureMcp.buildGetSystemArchitectureStructuredContent(result));
|
|
429
|
+
}
|
|
423
430
|
return toolResult(result);
|
|
424
431
|
}
|
|
425
432
|
if (name === 'initializeWorkspace') {
|
|
@@ -438,7 +445,7 @@ async function callTool(name, args = {}, progressToken = null, dependencies = un
|
|
|
438
445
|
return toolResult({
|
|
439
446
|
status: report.status,
|
|
440
447
|
workspaceRoot: workspace.workspaceRoot,
|
|
441
|
-
// The resolved modeling language for this workspace (default
|
|
448
|
+
// The resolved modeling language for this workspace (default ArchiMate 3.2 vs
|
|
442
449
|
// the repository's own .argo/schema bundle) so init names the active schema.
|
|
443
450
|
schema: workspace.schema,
|
|
444
451
|
schemaBundle: report.schemaBundle,
|
|
@@ -535,7 +542,7 @@ async function initializeWorkspace(workspaceRoot) {
|
|
|
535
542
|
const graphTargetPath = path.join(workspaceRoot, ...WORKSPACE_GRAPH_PATH_SEGMENTS);
|
|
536
543
|
const graphRelativePath = normalizeRelativePath(path.relative(workspaceRoot, graphTargetPath));
|
|
537
544
|
if (!fs.existsSync(graphTargetPath)) {
|
|
538
|
-
// Only the built-in
|
|
545
|
+
// Only the built-in ArchiMate 3.2 default schema auto-provides a graph (the
|
|
539
546
|
// packaged default). For any custom / replaced schema the graph is the user's
|
|
540
547
|
// own: never copy the packaged (mismatched) graph — fail closed if missing.
|
|
541
548
|
let ontology = null;
|
|
@@ -590,7 +597,7 @@ async function initializeWorkspace(workspaceRoot) {
|
|
|
590
597
|
} catch (error) {
|
|
591
598
|
qeaFullProjection = { status: 'failed', error: String(error && error.message ? error.message : error) };
|
|
592
599
|
}
|
|
593
|
-
// Report which schema this workspace resolves to (default
|
|
600
|
+
// Report which schema this workspace resolves to (default ArchiMate 3.2 vs a
|
|
594
601
|
// repository's own .argo/schema bundle) so the caller/human can see the active
|
|
595
602
|
// modeling language right after init.
|
|
596
603
|
let schema;
|
|
@@ -678,7 +685,7 @@ function normalizeRelativePath(value) {
|
|
|
678
685
|
return String(value).replace(/\\/g, '/');
|
|
679
686
|
}
|
|
680
687
|
|
|
681
|
-
function toolResult(payload) {
|
|
688
|
+
function toolResult(payload, structuredContent = undefined) {
|
|
682
689
|
return {
|
|
683
690
|
content: [
|
|
684
691
|
{
|
|
@@ -686,6 +693,7 @@ function toolResult(payload) {
|
|
|
686
693
|
text: JSON.stringify(payload, null, 2),
|
|
687
694
|
},
|
|
688
695
|
],
|
|
696
|
+
...(structuredContent === undefined ? {} : { structuredContent }),
|
|
689
697
|
isError: payload.status === 'failed',
|
|
690
698
|
};
|
|
691
699
|
}
|
|
@@ -57,7 +57,7 @@ async function runHarnessReport({ checkOnly, workspaceRoot, includeBootstrap })
|
|
|
57
57
|
try {
|
|
58
58
|
report.harnessEnvironment = loadRepositoryArgoEnvironment(workspaceRoot);
|
|
59
59
|
try {
|
|
60
|
-
const { bundle, ontology } = require('./
|
|
60
|
+
const { bundle, ontology } = require('./schema-bundle.js').loadSchemaBundleAndOntology(workspaceRoot);
|
|
61
61
|
report.schemaBundle = {
|
|
62
62
|
kind: bundle.kind,
|
|
63
63
|
language: ontology.language,
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// view element limit) is supplied by an *ontology* so a repository that ships
|
|
9
9
|
// its own schema under .argo/schema is validated against its own language.
|
|
10
10
|
//
|
|
11
|
-
// The ontology argument is optional: when omitted, the default
|
|
11
|
+
// The ontology argument is optional: when omitted, the default ArchiMate 3.2
|
|
12
12
|
// (ArchiMate 3.2 + ARGO) ontology is used, preserving historical behaviour.
|
|
13
13
|
|
|
14
|
-
const { loadSchemaBundleAndOntology } = require('./
|
|
14
|
+
const { loadSchemaBundleAndOntology } = require('./schema-bundle.js');
|
|
15
15
|
|
|
16
16
|
let defaultOntology = null;
|
|
17
17
|
|
|
@@ -30,7 +30,7 @@ function resolveOntology(ontology) {
|
|
|
30
30
|
*
|
|
31
31
|
* @param {object} document - parsed SystemArchitecture JSON
|
|
32
32
|
* @param {string[]} errors - error accumulator
|
|
33
|
-
* @param {object} [ontology] - resolved modeling language (defaults to
|
|
33
|
+
* @param {object} [ontology] - resolved modeling language (defaults to ArchiMate 3.2)
|
|
34
34
|
*/
|
|
35
35
|
function validateGraphSemantics(document, errors, ontology) {
|
|
36
36
|
if (!document || typeof document !== 'object') {
|
|
@@ -259,8 +259,105 @@ function validateViewElementLimits(document, errors, options = {}) {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
// Per-element-type attribute contract (issue #3): required attributes, a
|
|
263
|
+
// controlled vocabulary per attribute (enumByAttr) and uniqueness per attribute.
|
|
264
|
+
// Supplied by the active schema bundle's `attributesByElementType`; absent => no-op
|
|
265
|
+
// (fully backward compatible).
|
|
266
|
+
function attributeEntriesByName(element) {
|
|
267
|
+
const map = new Map();
|
|
268
|
+
const entries = Array.isArray(element && element.attributes) ? element.attributes : [];
|
|
269
|
+
for (const entry of entries) {
|
|
270
|
+
if (!entry || typeof entry !== 'object' || typeof entry.name !== 'string' || entry.name === '') {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
if (!map.has(entry.name)) {
|
|
274
|
+
map.set(entry.name, []);
|
|
275
|
+
}
|
|
276
|
+
map.get(entry.name).push(entry);
|
|
277
|
+
}
|
|
278
|
+
return map;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function attributeValueOf(entry) {
|
|
282
|
+
if (entry.value !== undefined && entry.value !== null) {
|
|
283
|
+
return entry.value;
|
|
284
|
+
}
|
|
285
|
+
if (entry.content !== undefined && entry.content !== null) {
|
|
286
|
+
return entry.content;
|
|
287
|
+
}
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function validateAttributeContracts(document, errors, ontology) {
|
|
292
|
+
const language = resolveOntology(ontology);
|
|
293
|
+
const contracts = language.attributesByElementType;
|
|
294
|
+
if (!contracts || typeof contracts !== 'object') {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const uniqueTrackers = new Map();
|
|
298
|
+
for (const type of Object.keys(contracts)) {
|
|
299
|
+
uniqueTrackers.set(type, new Map());
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
for (const element of document.elements || []) {
|
|
303
|
+
if (!element || typeof element !== 'object') {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
const contract = contracts[element.type];
|
|
307
|
+
if (!contract || typeof contract !== 'object') {
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
const byName = attributeEntriesByName(element);
|
|
311
|
+
|
|
312
|
+
for (const name of Array.isArray(contract.required) ? contract.required : []) {
|
|
313
|
+
const entries = byName.get(name);
|
|
314
|
+
const present = Array.isArray(entries) && entries.some((entry) => {
|
|
315
|
+
const value = attributeValueOf(entry);
|
|
316
|
+
return value !== undefined && value !== '';
|
|
317
|
+
});
|
|
318
|
+
if (!present) {
|
|
319
|
+
errors.push(`element '${element.id}' (type '${element.type}') is missing required attribute '${name}'`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const enumByAttr = contract.enumByAttr && typeof contract.enumByAttr === 'object' ? contract.enumByAttr : {};
|
|
324
|
+
for (const [attr, allowed] of Object.entries(enumByAttr)) {
|
|
325
|
+
if (!Array.isArray(allowed)) {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
for (const entry of byName.get(attr) || []) {
|
|
329
|
+
const value = attributeValueOf(entry);
|
|
330
|
+
if (value === undefined) {
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
const matches = allowed.some((option) => option === value || JSON.stringify(option) === JSON.stringify(value));
|
|
334
|
+
if (!matches) {
|
|
335
|
+
errors.push(`element '${element.id}' (type '${element.type}') attribute '${attr}' value ${JSON.stringify(value)} is not one of: ${allowed.map((option) => JSON.stringify(option)).join(', ')}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
for (const attr of Array.isArray(contract.unique) ? contract.unique : []) {
|
|
341
|
+
const tracker = uniqueTrackers.get(element.type);
|
|
342
|
+
for (const entry of byName.get(attr) || []) {
|
|
343
|
+
const value = attributeValueOf(entry);
|
|
344
|
+
if (value === undefined) {
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
const key = JSON.stringify(value);
|
|
348
|
+
if (tracker.has(key) && tracker.get(key) !== element.id) {
|
|
349
|
+
errors.push(`element '${element.id}' (type '${element.type}') attribute '${attr}' value ${key} duplicates element '${tracker.get(key)}'`);
|
|
350
|
+
} else if (!tracker.has(key)) {
|
|
351
|
+
tracker.set(key, element.id);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
262
358
|
module.exports = {
|
|
263
359
|
validateGraphSemantics,
|
|
264
360
|
validateArchiMateEndpointMatrix,
|
|
265
361
|
validateViewElementLimits,
|
|
362
|
+
validateAttributeContracts,
|
|
266
363
|
};
|
|
@@ -423,13 +423,13 @@ async function writeArchitectureGraph(graphPath, graph) {
|
|
|
423
423
|
* Dependency direction for delivery:
|
|
424
424
|
* For element X, its upstream dependencies = elements X needs to be delivered first.
|
|
425
425
|
* The mapping comes from the ACTIVE schema bundle's `deliveryDependencies`
|
|
426
|
-
* (
|
|
427
|
-
* declare its own relationship types (e.g. "Depends On"). The default
|
|
426
|
+
* (schema-bundle.config.json), not hardcoded ArchiMate names, so a custom schema can
|
|
427
|
+
* declare its own relationship types (e.g. "Depends On"). The default ArchiMate 3.2
|
|
428
428
|
* bundle declares the ArchiMate mapping.
|
|
429
429
|
*/
|
|
430
430
|
const DELIVERY_DEPENDENCIES = (() => {
|
|
431
431
|
try {
|
|
432
|
-
const { loadSchemaBundleAndOntology } = require('./
|
|
432
|
+
const { loadSchemaBundleAndOntology } = require('./schema-bundle.js');
|
|
433
433
|
return loadSchemaBundleAndOntology(repoRoot).ontology.deliveryDependencies;
|
|
434
434
|
} catch {
|
|
435
435
|
return { sourceDependsOnTarget: [], targetDependsOnSource: [] };
|