archgraph-argo 0.10.19 → 0.10.21
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.
|
@@ -35,20 +35,22 @@ function requireNeo4jDriver() {
|
|
|
35
35
|
return neo4jDriverModule;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function getRepoRoot() {
|
|
39
|
-
return
|
|
38
|
+
function getRepoRoot(workspaceRoot) {
|
|
39
|
+
return workspaceRoot && typeof workspaceRoot === 'string' && workspaceRoot.trim() !== ''
|
|
40
|
+
? path.resolve(workspaceRoot)
|
|
41
|
+
: getWorkspaceRoot();
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
function resolveArchitecturePath(architecturePath = DEFAULT_GRAPH_PATH) {
|
|
43
|
-
return path.join(getRepoRoot(), architecturePath);
|
|
44
|
+
function resolveArchitecturePath(architecturePath = DEFAULT_GRAPH_PATH, workspaceRoot) {
|
|
45
|
+
return path.join(getRepoRoot(workspaceRoot), architecturePath);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
function resolveSyncStatePath() {
|
|
47
|
-
return path.join(getRepoRoot(), SYNC_STATE_RELATIVE_PATH);
|
|
48
|
+
function resolveSyncStatePath(workspaceRoot) {
|
|
49
|
+
return path.join(getRepoRoot(workspaceRoot), SYNC_STATE_RELATIVE_PATH);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
function getDefaultNeo4jDatabaseName() {
|
|
51
|
-
const repoName = path.basename(getRepoRoot());
|
|
52
|
+
function getDefaultNeo4jDatabaseName(workspaceRoot) {
|
|
53
|
+
const repoName = path.basename(getRepoRoot(workspaceRoot));
|
|
52
54
|
const normalized = String(repoName)
|
|
53
55
|
.toLowerCase()
|
|
54
56
|
.replace(/[^a-z0-9.-]+/g, '-')
|
|
@@ -86,7 +88,7 @@ function getNeo4jConfig(overrides = {}) {
|
|
|
86
88
|
uri: external.neo4jUri,
|
|
87
89
|
username: external.neo4jUsername,
|
|
88
90
|
password: external.neo4jPassword,
|
|
89
|
-
database: overrides.database || process.env.ARGO_NEO4J_DATABASE || getDefaultNeo4jDatabaseName(),
|
|
91
|
+
database: overrides.database || process.env.ARGO_NEO4J_DATABASE || getDefaultNeo4jDatabaseName(overrides.workspaceRoot),
|
|
90
92
|
};
|
|
91
93
|
}
|
|
92
94
|
|
|
@@ -133,8 +135,8 @@ function createDriver(config = {}) {
|
|
|
133
135
|
);
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
function readArchitectureDocument(architecturePath = DEFAULT_GRAPH_PATH) {
|
|
137
|
-
const absolutePath = resolveArchitecturePath(architecturePath);
|
|
138
|
+
function readArchitectureDocument(architecturePath = DEFAULT_GRAPH_PATH, workspaceRoot) {
|
|
139
|
+
const absolutePath = resolveArchitecturePath(architecturePath, workspaceRoot);
|
|
138
140
|
if (!fs.existsSync(absolutePath)) {
|
|
139
141
|
throw new Error(`System architecture file is missing at ${architecturePath}`);
|
|
140
142
|
}
|
|
@@ -146,8 +148,8 @@ function readArchitectureDocument(architecturePath = DEFAULT_GRAPH_PATH) {
|
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
function digestCanonicalArchitecture(architecturePath = DEFAULT_GRAPH_PATH) {
|
|
150
|
-
const absolutePath = resolveArchitecturePath(architecturePath);
|
|
151
|
+
function digestCanonicalArchitecture(architecturePath = DEFAULT_GRAPH_PATH, workspaceRoot) {
|
|
152
|
+
const absolutePath = resolveArchitecturePath(architecturePath, workspaceRoot);
|
|
151
153
|
try {
|
|
152
154
|
return crypto.createHash('sha256').update(fs.readFileSync(absolutePath)).digest('hex');
|
|
153
155
|
} catch {
|
|
@@ -188,8 +190,8 @@ function createEmptySyncState() {
|
|
|
188
190
|
};
|
|
189
191
|
}
|
|
190
192
|
|
|
191
|
-
function readNeo4jSyncState() {
|
|
192
|
-
const statePath = resolveSyncStatePath();
|
|
193
|
+
function readNeo4jSyncState(workspaceRoot) {
|
|
194
|
+
const statePath = resolveSyncStatePath(workspaceRoot);
|
|
193
195
|
if (!fs.existsSync(statePath)) {
|
|
194
196
|
return createEmptySyncState();
|
|
195
197
|
}
|
|
@@ -205,15 +207,15 @@ function readNeo4jSyncState() {
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
|
|
208
|
-
function writeNeo4jSyncState(state) {
|
|
209
|
-
const statePath = resolveSyncStatePath();
|
|
210
|
+
function writeNeo4jSyncState(state, workspaceRoot) {
|
|
211
|
+
const statePath = resolveSyncStatePath(workspaceRoot);
|
|
210
212
|
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
|
211
213
|
fs.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}\n`, 'utf8');
|
|
212
214
|
}
|
|
213
215
|
|
|
214
|
-
function getNeo4jGraphSyncState(architecturePath = DEFAULT_GRAPH_PATH) {
|
|
216
|
+
function getNeo4jGraphSyncState(architecturePath = DEFAULT_GRAPH_PATH, workspaceRoot) {
|
|
215
217
|
const graphKey = buildGraphKey(architecturePath);
|
|
216
|
-
const state = readNeo4jSyncState();
|
|
218
|
+
const state = readNeo4jSyncState(workspaceRoot);
|
|
217
219
|
return {
|
|
218
220
|
graphKey,
|
|
219
221
|
dirty: false,
|
|
@@ -221,30 +223,30 @@ function getNeo4jGraphSyncState(architecturePath = DEFAULT_GRAPH_PATH) {
|
|
|
221
223
|
};
|
|
222
224
|
}
|
|
223
225
|
|
|
224
|
-
function updateNeo4jGraphSyncState(architecturePath, patch) {
|
|
226
|
+
function updateNeo4jGraphSyncState(architecturePath, patch, workspaceRoot) {
|
|
225
227
|
const graphKey = buildGraphKey(architecturePath);
|
|
226
|
-
const state = readNeo4jSyncState();
|
|
228
|
+
const state = readNeo4jSyncState(workspaceRoot);
|
|
227
229
|
state.graphs[graphKey] = {
|
|
228
230
|
graphKey,
|
|
229
231
|
dirty: false,
|
|
230
232
|
...(state.graphs[graphKey] || {}),
|
|
231
233
|
...patch,
|
|
232
234
|
};
|
|
233
|
-
writeNeo4jSyncState(state);
|
|
235
|
+
writeNeo4jSyncState(state, workspaceRoot);
|
|
234
236
|
return state.graphs[graphKey];
|
|
235
237
|
}
|
|
236
238
|
|
|
237
|
-
function markNeo4jSyncDirty(architecturePath, error) {
|
|
239
|
+
function markNeo4jSyncDirty(architecturePath, error, workspaceRoot) {
|
|
238
240
|
return updateNeo4jGraphSyncState(architecturePath, {
|
|
239
241
|
dirty: true,
|
|
240
242
|
lastError: String(error && error.message ? error.message : error),
|
|
241
243
|
lastFailureAt: new Date().toISOString(),
|
|
242
|
-
});
|
|
244
|
+
}, workspaceRoot);
|
|
243
245
|
}
|
|
244
246
|
|
|
245
|
-
function markNeo4jSyncClean(architecturePath, verification) {
|
|
246
|
-
const current = getNeo4jGraphSyncState(architecturePath);
|
|
247
|
-
const canonicalDigest = digestCanonicalArchitecture(architecturePath);
|
|
247
|
+
function markNeo4jSyncClean(architecturePath, verification, workspaceRoot) {
|
|
248
|
+
const current = getNeo4jGraphSyncState(architecturePath, workspaceRoot);
|
|
249
|
+
const canonicalDigest = digestCanonicalArchitecture(architecturePath, workspaceRoot);
|
|
248
250
|
return updateNeo4jGraphSyncState(architecturePath, {
|
|
249
251
|
dirty: false,
|
|
250
252
|
lastError: undefined,
|
|
@@ -252,7 +254,7 @@ function markNeo4jSyncClean(architecturePath, verification) {
|
|
|
252
254
|
lastSuccessAt: new Date().toISOString(),
|
|
253
255
|
lastVerifiedCounts: verification ? verification.actual : current.lastVerifiedCounts,
|
|
254
256
|
canonicalDigest,
|
|
255
|
-
});
|
|
257
|
+
}, workspaceRoot);
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
function isCanonicalArchitecturePath(architecturePath = DEFAULT_GRAPH_PATH) {
|
|
@@ -544,8 +546,9 @@ async function writeSubdiagramLinks(tx, graphKey, elements) {
|
|
|
544
546
|
|
|
545
547
|
async function syncArchitectureToNeo4j(options = {}) {
|
|
546
548
|
const architecturePath = options.architecturePath || DEFAULT_GRAPH_PATH;
|
|
549
|
+
const workspaceRoot = options.workspaceRoot;
|
|
547
550
|
const graphKey = buildGraphKey(architecturePath);
|
|
548
|
-
const document = options.document || readArchitectureDocument(architecturePath);
|
|
551
|
+
const document = options.document || readArchitectureDocument(architecturePath, workspaceRoot);
|
|
549
552
|
const config = getNeo4jConfig(options);
|
|
550
553
|
const driver = options.driver || createDriver(config);
|
|
551
554
|
const ownDriver = !options.driver;
|
|
@@ -583,7 +586,7 @@ async function syncArchitectureToNeo4j(options = {}) {
|
|
|
583
586
|
}
|
|
584
587
|
|
|
585
588
|
if (isCanonicalArchitecturePath(architecturePath)) {
|
|
586
|
-
markNeo4jSyncClean(architecturePath, verification);
|
|
589
|
+
markNeo4jSyncClean(architecturePath, verification, workspaceRoot);
|
|
587
590
|
}
|
|
588
591
|
|
|
589
592
|
return {
|
|
@@ -598,7 +601,7 @@ async function syncArchitectureToNeo4j(options = {}) {
|
|
|
598
601
|
};
|
|
599
602
|
} catch (error) {
|
|
600
603
|
if (isCanonicalArchitecturePath(architecturePath)) {
|
|
601
|
-
markNeo4jSyncDirty(architecturePath, error);
|
|
604
|
+
markNeo4jSyncDirty(architecturePath, error, workspaceRoot);
|
|
602
605
|
}
|
|
603
606
|
throw error;
|
|
604
607
|
} finally {
|
|
@@ -610,6 +613,7 @@ async function syncArchitectureToNeo4j(options = {}) {
|
|
|
610
613
|
|
|
611
614
|
async function recoverNeo4jSyncIfNeeded(options = {}) {
|
|
612
615
|
const architecturePath = options.architecturePath || DEFAULT_GRAPH_PATH;
|
|
616
|
+
const workspaceRoot = options.workspaceRoot;
|
|
613
617
|
if (!isCanonicalArchitecturePath(architecturePath)) {
|
|
614
618
|
return {
|
|
615
619
|
attempted: false,
|
|
@@ -618,8 +622,8 @@ async function recoverNeo4jSyncIfNeeded(options = {}) {
|
|
|
618
622
|
};
|
|
619
623
|
}
|
|
620
624
|
|
|
621
|
-
const syncState = getNeo4jGraphSyncState(architecturePath);
|
|
622
|
-
const stale = isNeo4jGraphSyncStale(syncState, digestCanonicalArchitecture(architecturePath));
|
|
625
|
+
const syncState = getNeo4jGraphSyncState(architecturePath, workspaceRoot);
|
|
626
|
+
const stale = isNeo4jGraphSyncStale(syncState, digestCanonicalArchitecture(architecturePath, workspaceRoot));
|
|
623
627
|
if (!syncState.dirty && !stale) {
|
|
624
628
|
return {
|
|
625
629
|
attempted: false,
|
|
@@ -658,8 +662,9 @@ async function recoverNeo4jSyncIfNeeded(options = {}) {
|
|
|
658
662
|
|
|
659
663
|
async function verifyArchitectureSync(options = {}) {
|
|
660
664
|
const architecturePath = options.architecturePath || DEFAULT_GRAPH_PATH;
|
|
665
|
+
const workspaceRoot = options.workspaceRoot;
|
|
661
666
|
const graphKey = buildGraphKey(architecturePath);
|
|
662
|
-
const document = options.document || readArchitectureDocument(architecturePath);
|
|
667
|
+
const document = options.document || readArchitectureDocument(architecturePath, workspaceRoot);
|
|
663
668
|
const config = getNeo4jConfig(options);
|
|
664
669
|
const driver = options.driver || createDriver(config);
|
|
665
670
|
const ownDriver = !options.driver;
|
|
@@ -1005,13 +1010,23 @@ async function runNeo4jCypherQuery(options = {}) {
|
|
|
1005
1010
|
});
|
|
1006
1011
|
|
|
1007
1012
|
const summary = result.summary;
|
|
1013
|
+
const queriedDatabase = summary && summary.database ? summary.database.name : null;
|
|
1014
|
+
if (queriedDatabase && queriedDatabase !== config.database) {
|
|
1015
|
+
const error = new Error(`Neo4j query ran against database '${queriedDatabase}', but this repository expects '${config.database}'`);
|
|
1016
|
+
error.category = 'NEO4J_DATABASE_MISMATCH';
|
|
1017
|
+
error.queriedDatabase = queriedDatabase;
|
|
1018
|
+
error.expectedDatabase = config.database;
|
|
1019
|
+
throw error;
|
|
1020
|
+
}
|
|
1021
|
+
const database = queriedDatabase || config.database;
|
|
1008
1022
|
return {
|
|
1009
1023
|
architecturePath,
|
|
1010
1024
|
graphKey,
|
|
1025
|
+
database,
|
|
1011
1026
|
records,
|
|
1012
1027
|
summary: {
|
|
1013
1028
|
queryType: summary ? summary.queryType : null,
|
|
1014
|
-
database
|
|
1029
|
+
database,
|
|
1015
1030
|
containsUpdates: summary && summary.counters && typeof summary.counters.containsUpdates === 'function'
|
|
1016
1031
|
? summary.counters.containsUpdates()
|
|
1017
1032
|
: null,
|
|
@@ -498,6 +498,7 @@ async function syncCanonicalStructuralProjection(request) {
|
|
|
498
498
|
return syncArchitectureToNeo4j({
|
|
499
499
|
architecturePath: context.graphPath.relativePath,
|
|
500
500
|
document: context.document,
|
|
501
|
+
workspaceRoot: context.workspaceRoot,
|
|
501
502
|
});
|
|
502
503
|
}
|
|
503
504
|
|
|
@@ -556,6 +557,7 @@ async function loadContext(args = {}) {
|
|
|
556
557
|
context.neo4jSyncRecovery = await recoverNeo4jSyncIfNeeded({
|
|
557
558
|
architecturePath: graphPath.relativePath,
|
|
558
559
|
document: context.document,
|
|
560
|
+
workspaceRoot: context.workspaceRoot,
|
|
559
561
|
});
|
|
560
562
|
return context;
|
|
561
563
|
}
|
|
@@ -1536,6 +1538,7 @@ async function buildMutationResult(context, mutations, write) {
|
|
|
1536
1538
|
const syncResult = await syncArchitectureToNeo4j({
|
|
1537
1539
|
architecturePath: context.graphPath.relativePath,
|
|
1538
1540
|
document: mutationResult.document,
|
|
1541
|
+
workspaceRoot: context.workspaceRoot,
|
|
1539
1542
|
});
|
|
1540
1543
|
result.neo4jSync = {
|
|
1541
1544
|
status: 'passed',
|
|
@@ -2179,20 +2182,23 @@ async function callTool(name, args = {}, dependencies = undefined) {
|
|
|
2179
2182
|
|
|
2180
2183
|
async function queryNeo4jGraphTool(args = {}) {
|
|
2181
2184
|
const architecturePath = args.architecturePath || DEFAULT_GRAPH_PATH;
|
|
2185
|
+
const workspaceRoot = resolveWorkspaceRoot(args);
|
|
2182
2186
|
|
|
2183
2187
|
if (args.schema === true) {
|
|
2184
|
-
return queryNeo4jGraphSchemaResult(architecturePath);
|
|
2188
|
+
return queryNeo4jGraphSchemaResult(architecturePath, workspaceRoot);
|
|
2185
2189
|
}
|
|
2186
2190
|
|
|
2187
2191
|
try {
|
|
2188
2192
|
const result = await runNeo4jCypherQuery({
|
|
2189
2193
|
architecturePath,
|
|
2190
2194
|
cypher: args.cypher,
|
|
2195
|
+
workspaceRoot,
|
|
2191
2196
|
});
|
|
2192
2197
|
return toolResult({
|
|
2193
2198
|
status: 'passed',
|
|
2194
2199
|
architecturePath: result.architecturePath,
|
|
2195
2200
|
graphKey: result.graphKey,
|
|
2201
|
+
database: result.database,
|
|
2196
2202
|
records: result.records,
|
|
2197
2203
|
summary: result.summary,
|
|
2198
2204
|
});
|
|
@@ -2204,17 +2210,19 @@ async function queryNeo4jGraphTool(args = {}) {
|
|
|
2204
2210
|
architecturePath,
|
|
2205
2211
|
graphKey: buildGraphKey(architecturePath),
|
|
2206
2212
|
...(error && error.clause ? { clause: error.clause } : {}),
|
|
2213
|
+
...(error && error.queriedDatabase ? { queriedDatabase: error.queriedDatabase } : {}),
|
|
2214
|
+
...(error && error.expectedDatabase ? { expectedDatabase: error.expectedDatabase } : {}),
|
|
2207
2215
|
},
|
|
2208
2216
|
));
|
|
2209
2217
|
}
|
|
2210
2218
|
}
|
|
2211
2219
|
|
|
2212
|
-
function queryNeo4jGraphSchemaResult(architecturePath) {
|
|
2220
|
+
function queryNeo4jGraphSchemaResult(architecturePath, workspaceRoot) {
|
|
2213
2221
|
const schema = buildNeo4jGraphSchema(architecturePath);
|
|
2214
2222
|
let typeEnums = {};
|
|
2215
2223
|
try {
|
|
2216
|
-
const
|
|
2217
|
-
const schemaPath = resolveSchemaPath(
|
|
2224
|
+
const resolvedRoot = workspaceRoot || resolveWorkspaceRoot({ architecturePath });
|
|
2225
|
+
const schemaPath = resolveSchemaPath(resolvedRoot);
|
|
2218
2226
|
const jsonSchema = readJson(schemaPath.absolutePath, schemaPath.relativePath);
|
|
2219
2227
|
typeEnums = {
|
|
2220
2228
|
archimateElementTypes: (jsonSchema.$defs.archimateElementType || {}).enum || [],
|
package/install-argo.ps1
CHANGED
|
@@ -726,7 +726,7 @@ if ($SkipDsh) {
|
|
|
726
726
|
Write-DshManagedBlock -Path $patchPath -Block $block -MarkerStart '# BEGIN ArchGraph ARGO deployment' -MarkerEnd '# END ArchGraph ARGO deployment'
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
-
Write-Host "[19/19] argo\
|
|
729
|
+
Write-Host "[19/19] argo\agents10 -> $DshHome\.agent-presets\<id> (DeepSeek Harness agent presets)"
|
|
730
730
|
New-DshAgentPresets -DshHome $DshHome -AgentsSrc (Join-Path $argoDir 'agents')
|
|
731
731
|
|
|
732
732
|
Write-Host ' Restart `dsh web` to activate the MCP bridge and the wakeup plugin;'
|
package/package.json
CHANGED