@datasynx/agentic-ai-cartography 0.8.1 → 0.9.1
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 +3 -13
- package/dist/{chunk-VZO6XBKX.js → chunk-WJR63RWY.js} +1 -19
- package/dist/chunk-WJR63RWY.js.map +1 -0
- package/dist/cli.js +17 -168
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -46
- package/dist/index.js +4 -354
- package/dist/index.js.map +1 -1
- package/dist/{types-RHMJ6EGX.js → types-54623ALF.js} +2 -6
- package/package.json +1 -1
- package/dist/chunk-VZO6XBKX.js.map +0 -1
- /package/dist/{types-RHMJ6EGX.js.map → types-54623ALF.js.map} +0 -0
package/README.md
CHANGED
|
@@ -80,9 +80,7 @@ Cartography runs natively on **Linux**, **macOS**, and **Windows** — no WSL re
|
|
|
80
80
|
| **Database Discovery** | PostgreSQL, MySQL, MongoDB, Redis, SQLite file scan. Windows: `Get-Service` for DB engine detection |
|
|
81
81
|
| **Cloud Scanning** | AWS (EC2/RDS/EKS/S3), GCP (Compute/GKE/Cloud Run), Azure (AKS/WebApps), Kubernetes |
|
|
82
82
|
| **Human-in-the-Loop** | Chat with the agent mid-discovery: type `"hubspot windsurf"` to search for specific tools |
|
|
83
|
-
| **
|
|
84
|
-
| **SOP Dashboard** | HTML dashboard with all SOPs, step details, frequency stats |
|
|
85
|
-
| **Export Formats** | Mermaid topology, D3.js interactive graph, Backstage YAML, JSON, SOP Markdown |
|
|
83
|
+
| **Export Formats** | Mermaid topology, D3.js interactive graph, Backstage YAML, JSON |
|
|
86
84
|
| **Safety First** | `PreToolUse` hook blocks all destructive commands — Unix AND PowerShell. 100% read-only |
|
|
87
85
|
|
|
88
86
|
---
|
|
@@ -162,7 +160,7 @@ Discovery pipeline (automatic, in order):
|
|
|
162
160
|
|
|
163
161
|
```
|
|
164
162
|
datasynx-cartography export [session-id] [options]
|
|
165
|
-
--format <fmt...> mermaid, json, yaml, html,
|
|
163
|
+
--format <fmt...> mermaid, json, yaml, html, map (default: all)
|
|
166
164
|
-o, --output <dir> Output directory
|
|
167
165
|
datasynx-cartography show [session-id] Session details + node list
|
|
168
166
|
datasynx-cartography sessions List all sessions
|
|
@@ -182,13 +180,7 @@ datasynx-output/
|
|
|
182
180
|
├── catalog-info.yaml Backstage service catalog
|
|
183
181
|
├── topology.mermaid Infrastructure topology (graph TB)
|
|
184
182
|
├── dependencies.mermaid Service dependencies (graph LR)
|
|
185
|
-
|
|
186
|
-
├── sop-dashboard.html HTML dashboard with all SOPs + frequency stats
|
|
187
|
-
├── sops/
|
|
188
|
-
│ ├── deploy-check.md
|
|
189
|
-
│ └── db-migration.md
|
|
190
|
-
└── workflows/
|
|
191
|
-
└── workflow-001.mermaid
|
|
183
|
+
└── discovery.html Enterprise discovery frontend (Map + Topology)
|
|
192
184
|
```
|
|
193
185
|
|
|
194
186
|
---
|
|
@@ -198,7 +190,6 @@ datasynx-output/
|
|
|
198
190
|
| Mode | Model | Interval | per Hour | per 8h Day |
|
|
199
191
|
|------|-------|----------|----------|------------|
|
|
200
192
|
| Discover | Sonnet | one-shot | $0.15–0.50 | one-shot |
|
|
201
|
-
| SOP generation | Sonnet | one-shot | $0.01–0.03 | one-shot |
|
|
202
193
|
|
|
203
194
|
---
|
|
204
195
|
|
|
@@ -241,7 +232,6 @@ import {
|
|
|
241
232
|
CartographyDB,
|
|
242
233
|
runDiscovery,
|
|
243
234
|
exportAll,
|
|
244
|
-
exportSOPDashboard,
|
|
245
235
|
safetyHook,
|
|
246
236
|
defaultConfig,
|
|
247
237
|
} from '@datasynx/agentic-ai-cartography';
|
|
@@ -47,22 +47,6 @@ var EdgeSchema = z.object({
|
|
|
47
47
|
evidence: z.string(),
|
|
48
48
|
confidence: z.number().min(0).max(1).default(0.5)
|
|
49
49
|
});
|
|
50
|
-
var SOPStepSchema = z.object({
|
|
51
|
-
order: z.number(),
|
|
52
|
-
instruction: z.string(),
|
|
53
|
-
tool: z.string(),
|
|
54
|
-
target: z.string().optional(),
|
|
55
|
-
notes: z.string().optional()
|
|
56
|
-
});
|
|
57
|
-
var SOPSchema = z.object({
|
|
58
|
-
title: z.string(),
|
|
59
|
-
description: z.string(),
|
|
60
|
-
steps: z.array(SOPStepSchema),
|
|
61
|
-
involvedSystems: z.array(z.string()),
|
|
62
|
-
estimatedDuration: z.string(),
|
|
63
|
-
frequency: z.string(),
|
|
64
|
-
confidence: z.number().min(0).max(1)
|
|
65
|
-
});
|
|
66
50
|
var DataAssetSchema = z.object({
|
|
67
51
|
id: z.string(),
|
|
68
52
|
name: z.string(),
|
|
@@ -139,8 +123,6 @@ export {
|
|
|
139
123
|
EDGE_RELATIONSHIPS,
|
|
140
124
|
NodeSchema,
|
|
141
125
|
EdgeSchema,
|
|
142
|
-
SOPStepSchema,
|
|
143
|
-
SOPSchema,
|
|
144
126
|
DataAssetSchema,
|
|
145
127
|
ClusterSchema,
|
|
146
128
|
ConnectionSchema,
|
|
@@ -148,4 +130,4 @@ export {
|
|
|
148
130
|
DOMAIN_PALETTE,
|
|
149
131
|
defaultConfig
|
|
150
132
|
};
|
|
151
|
-
//# sourceMappingURL=chunk-
|
|
133
|
+
//# sourceMappingURL=chunk-WJR63RWY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import { z } from 'zod';\n\n// ── Enums ────────────────────────────────\n\nexport const NODE_TYPES = [\n 'host', 'database_server', 'database', 'table',\n 'web_service', 'api_endpoint', 'cache_server',\n 'message_broker', 'queue', 'topic',\n 'container', 'pod', 'k8s_cluster',\n 'config_file', 'saas_tool', 'unknown',\n] as const;\nexport type NodeType = typeof NODE_TYPES[number];\n\nexport const EDGE_RELATIONSHIPS = [\n 'connects_to', 'reads_from', 'writes_to',\n 'calls', 'contains', 'depends_on',\n] as const;\nexport type EdgeRelationship = typeof EDGE_RELATIONSHIPS[number];\n\n// ── Zod Schemas ──────────────────────────\n\nexport const NodeSchema = z.object({\n id: z.string().describe('Format: \"{type}:{host}:{port}\" oder \"{type}:{name}\"'),\n type: z.enum(NODE_TYPES),\n name: z.string(),\n discoveredVia: z.string(),\n confidence: z.number().min(0).max(1).default(0.5),\n metadata: z.record(z.string(), z.unknown()).default({}),\n tags: z.array(z.string()).default([]),\n domain: z.string().optional().describe('Business domain, e.g. \"Marketing\", \"Finance\"'),\n subDomain: z.string().optional().describe('Sub-domain, e.g. \"Forecast client orders\"'),\n qualityScore: z.number().min(0).max(100).optional().describe('Data quality score 0–100'),\n});\nexport type DiscoveryNode = z.infer<typeof NodeSchema>;\n\nexport const EdgeSchema = z.object({\n sourceId: z.string(),\n targetId: z.string(),\n relationship: z.enum(EDGE_RELATIONSHIPS),\n evidence: z.string(),\n confidence: z.number().min(0).max(1).default(0.5),\n});\nexport type DiscoveryEdge = z.infer<typeof EdgeSchema>;\n\n// ── Cartography Map Types ────────────────\n\nexport const DataAssetSchema = z.object({\n id: z.string(),\n name: z.string(),\n domain: z.string(),\n subDomain: z.string().optional(),\n qualityScore: z.number().min(0).max(100).optional(),\n metadata: z.record(z.string(), z.unknown()).default({}),\n position: z.object({ q: z.number(), r: z.number() }),\n});\nexport type DataAsset = z.infer<typeof DataAssetSchema>;\n\nexport const ClusterSchema = z.object({\n id: z.string(),\n label: z.string(),\n domain: z.string(),\n color: z.string(),\n assetIds: z.array(z.string()),\n centroid: z.object({ x: z.number(), y: z.number() }),\n});\nexport type Cluster = z.infer<typeof ClusterSchema>;\n\nexport const ConnectionSchema = z.object({\n id: z.string(),\n sourceAssetId: z.string(),\n targetAssetId: z.string(),\n type: z.string().optional(),\n});\nexport type Connection = z.infer<typeof ConnectionSchema>;\n\nexport interface CartographyMapData {\n assets: DataAsset[];\n clusters: Cluster[];\n connections: Connection[];\n meta: { exportedAt: string; theme: 'light' | 'dark' };\n}\n\n/** Navy → medium blue → periwinkle → teal/cyan palette */\nexport const DOMAIN_COLORS: Record<string, string> = {\n 'Quality Control': '#1a2744',\n 'Supply Chain': '#1e3a6e',\n 'Marketing': '#6a7fb5',\n 'Finance': '#3a8a8a',\n 'HR': '#2a5a9a',\n 'Logistics': '#0e7490',\n 'Sales': '#1d4ed8',\n 'Engineering': '#4338ca',\n 'Operations': '#0891b2',\n 'Data Layer': '#1e3352',\n 'Web / API': '#1a3a1a',\n 'Messaging': '#2a1a3a',\n 'Infrastructure': '#0f2a40',\n 'Other': '#374151',\n};\n\n/** Ordered palette for dynamic domain assignment */\nexport const DOMAIN_PALETTE = [\n '#1a2e5a', '#1e3a8a', '#1d4ed8', '#2563eb', '#3b82f6',\n '#6366f1', '#818cf8', '#7c9fc3', '#0e7490', '#0891b2',\n '#06b6d4', '#22d3ee', '#0d9488', '#14b8a6', '#2dd4bf', '#5eead4',\n] as const;\n\n// ── DB Row Types ─────────────────────────\n\nexport interface NodeRow extends DiscoveryNode {\n sessionId: string;\n discoveredAt: string;\n depth: number;\n pathId?: string;\n}\n\nexport interface EdgeRow extends DiscoveryEdge {\n id: string;\n sessionId: string;\n discoveredAt: string;\n pathId?: string;\n}\n\nexport interface SessionRow {\n id: string;\n mode: 'discover';\n startedAt: string;\n completedAt?: string;\n config: string;\n}\n\n// ── Config ───────────────────────────────\n\nexport interface CartographyConfig {\n maxDepth: number;\n maxTurns: number;\n entryPoints: string[];\n agentModel: string;\n organization?: string;\n outputDir: string;\n dbPath: string;\n verbose: boolean;\n}\n\nexport function defaultConfig(overrides: Partial<CartographyConfig> = {}): CartographyConfig {\n const home = process.env.HOME ?? process.env.USERPROFILE ?? '/tmp';\n return {\n maxDepth: 8,\n maxTurns: 50,\n entryPoints: ['localhost'],\n agentModel: 'claude-sonnet-4-5-20250929',\n outputDir: './cartography-output',\n dbPath: `${home}/.cartography/cartography.db`,\n verbose: false,\n ...overrides,\n };\n}\n"],"mappings":";;;AAAA,SAAS,SAAS;AAIX,IAAM,aAAa;AAAA,EACxB;AAAA,EAAQ;AAAA,EAAmB;AAAA,EAAY;AAAA,EACvC;AAAA,E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EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAC5C;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AACzD;AAuCO,SAAS,cAAc,YAAwC,CAAC,GAAsB;AAC3F,QAAM,OAAO,QAAQ,IAAI,QAAQ,QAAQ,IAAI,eAAe;AAC5D,SAAO;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,IACV,aAAa,CAAC,WAAW;AAAA,IACzB,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ,GAAG,IAAI;AAAA,IACf,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AACF;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -4,9 +4,8 @@ import {
|
|
|
4
4
|
DOMAIN_PALETTE,
|
|
5
5
|
EDGE_RELATIONSHIPS,
|
|
6
6
|
NODE_TYPES,
|
|
7
|
-
SOPStepSchema,
|
|
8
7
|
defaultConfig
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WJR63RWY.js";
|
|
10
9
|
import {
|
|
11
10
|
HOME,
|
|
12
11
|
IS_LINUX,
|
|
@@ -140,8 +139,7 @@ CREATE TABLE IF NOT EXISTS tasks (
|
|
|
140
139
|
completed_at TEXT,
|
|
141
140
|
steps TEXT NOT NULL DEFAULT '[]',
|
|
142
141
|
involved_services TEXT NOT NULL DEFAULT '[]',
|
|
143
|
-
status TEXT DEFAULT 'active' CHECK (status IN ('active','completed','cancelled'))
|
|
144
|
-
is_sop_candidate INTEGER DEFAULT 0
|
|
142
|
+
status TEXT DEFAULT 'active' CHECK (status IN ('active','completed','cancelled'))
|
|
145
143
|
);
|
|
146
144
|
|
|
147
145
|
CREATE TABLE IF NOT EXISTS workflows (
|
|
@@ -157,19 +155,6 @@ CREATE TABLE IF NOT EXISTS workflows (
|
|
|
157
155
|
involved_services TEXT NOT NULL DEFAULT '[]'
|
|
158
156
|
);
|
|
159
157
|
|
|
160
|
-
CREATE TABLE IF NOT EXISTS sops (
|
|
161
|
-
id TEXT PRIMARY KEY,
|
|
162
|
-
workflow_id TEXT NOT NULL,
|
|
163
|
-
title TEXT NOT NULL,
|
|
164
|
-
description TEXT NOT NULL,
|
|
165
|
-
steps TEXT NOT NULL,
|
|
166
|
-
involved_systems TEXT NOT NULL DEFAULT '[]',
|
|
167
|
-
estimated_duration TEXT,
|
|
168
|
-
frequency TEXT,
|
|
169
|
-
generated_at TEXT NOT NULL,
|
|
170
|
-
confidence REAL DEFAULT 0.5
|
|
171
|
-
);
|
|
172
|
-
|
|
173
158
|
CREATE TABLE IF NOT EXISTS node_approvals (
|
|
174
159
|
pattern TEXT PRIMARY KEY,
|
|
175
160
|
action TEXT NOT NULL CHECK (action IN ('save','ignore','auto')),
|
|
@@ -411,8 +396,7 @@ var CartographyDB = class {
|
|
|
411
396
|
completedAt: r["completed_at"],
|
|
412
397
|
steps: r["steps"],
|
|
413
398
|
involvedServices: r["involved_services"],
|
|
414
|
-
status: r["status"]
|
|
415
|
-
isSOPCandidate: Boolean(r["is_sop_candidate"])
|
|
399
|
+
status: r["status"]
|
|
416
400
|
};
|
|
417
401
|
}
|
|
418
402
|
// ── Workflows ───────────────────────────
|
|
@@ -451,63 +435,6 @@ var CartographyDB = class {
|
|
|
451
435
|
involvedServices: r["involved_services"]
|
|
452
436
|
}));
|
|
453
437
|
}
|
|
454
|
-
// ── SOPs ────────────────────────────────
|
|
455
|
-
insertSOP(sop) {
|
|
456
|
-
const id = crypto.randomUUID();
|
|
457
|
-
this.db.prepare(`
|
|
458
|
-
INSERT INTO sops
|
|
459
|
-
(id, workflow_id, title, description, steps, involved_systems,
|
|
460
|
-
estimated_duration, frequency, generated_at, confidence)
|
|
461
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
462
|
-
`).run(
|
|
463
|
-
id,
|
|
464
|
-
sop.workflowId,
|
|
465
|
-
sop.title,
|
|
466
|
-
sop.description,
|
|
467
|
-
JSON.stringify(sop.steps),
|
|
468
|
-
JSON.stringify(sop.involvedSystems),
|
|
469
|
-
sop.estimatedDuration,
|
|
470
|
-
sop.frequency,
|
|
471
|
-
(/* @__PURE__ */ new Date()).toISOString(),
|
|
472
|
-
sop.confidence
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
getSOPs(sessionId) {
|
|
476
|
-
const rows = this.db.prepare(`
|
|
477
|
-
SELECT s.* FROM sops s
|
|
478
|
-
JOIN workflows w ON s.workflow_id = w.id
|
|
479
|
-
WHERE w.session_id = ?
|
|
480
|
-
`).all(sessionId);
|
|
481
|
-
return rows.map((r) => ({
|
|
482
|
-
id: r["id"],
|
|
483
|
-
workflowId: r["workflow_id"],
|
|
484
|
-
title: r["title"],
|
|
485
|
-
description: r["description"],
|
|
486
|
-
steps: JSON.parse(r["steps"]),
|
|
487
|
-
involvedSystems: JSON.parse(r["involved_systems"]),
|
|
488
|
-
estimatedDuration: r["estimated_duration"],
|
|
489
|
-
frequency: r["frequency"],
|
|
490
|
-
confidence: r["confidence"]
|
|
491
|
-
}));
|
|
492
|
-
}
|
|
493
|
-
markTaskAsSOPCandidate(taskId) {
|
|
494
|
-
this.db.prepare("UPDATE tasks SET is_sop_candidate = 1 WHERE id = ?").run(taskId);
|
|
495
|
-
}
|
|
496
|
-
getAllSOPs() {
|
|
497
|
-
const rows = this.db.prepare("SELECT * FROM sops ORDER BY generated_at DESC").all();
|
|
498
|
-
return rows.map((r) => ({
|
|
499
|
-
id: r["id"],
|
|
500
|
-
workflowId: r["workflow_id"],
|
|
501
|
-
title: r["title"],
|
|
502
|
-
description: r["description"],
|
|
503
|
-
steps: JSON.parse(r["steps"]),
|
|
504
|
-
involvedSystems: JSON.parse(r["involved_systems"]),
|
|
505
|
-
estimatedDuration: r["estimated_duration"],
|
|
506
|
-
frequency: r["frequency"],
|
|
507
|
-
confidence: r["confidence"],
|
|
508
|
-
generatedAt: r["generated_at"]
|
|
509
|
-
}));
|
|
510
|
-
}
|
|
511
438
|
// ── Connections (user-created hex map links) ─────────────────────────────
|
|
512
439
|
upsertConnection(sessionId, conn) {
|
|
513
440
|
const existing = this.db.prepare(
|
|
@@ -1033,28 +960,6 @@ ${runAz(c)}`).join("\n\n");
|
|
|
1033
960
|
const out = Object.entries(results).map(([k, v]) => `=== ${k} ===
|
|
1034
961
|
${v}`).join("\n\n");
|
|
1035
962
|
return { content: [{ type: "text", text: out }] };
|
|
1036
|
-
}),
|
|
1037
|
-
tool("save_sop", "Save a Standard Operating Procedure", {
|
|
1038
|
-
workflowId: z.string(),
|
|
1039
|
-
title: z.string(),
|
|
1040
|
-
description: z.string(),
|
|
1041
|
-
steps: z.array(SOPStepSchema),
|
|
1042
|
-
involvedSystems: z.array(z.string()),
|
|
1043
|
-
estimatedDuration: z.string(),
|
|
1044
|
-
frequency: z.string(),
|
|
1045
|
-
confidence: z.number().min(0).max(1)
|
|
1046
|
-
}, async (args) => {
|
|
1047
|
-
db.insertSOP({
|
|
1048
|
-
workflowId: args["workflowId"],
|
|
1049
|
-
title: args["title"],
|
|
1050
|
-
description: args["description"],
|
|
1051
|
-
steps: args["steps"],
|
|
1052
|
-
involvedSystems: args["involvedSystems"],
|
|
1053
|
-
estimatedDuration: args["estimatedDuration"],
|
|
1054
|
-
frequency: args["frequency"],
|
|
1055
|
-
confidence: args["confidence"]
|
|
1056
|
-
});
|
|
1057
|
-
return { content: [{ type: "text", text: `\u2713 SOP: ${args["title"]}` }] };
|
|
1058
963
|
})
|
|
1059
964
|
];
|
|
1060
965
|
return createSdkMcpServer({
|
|
@@ -1634,18 +1539,6 @@ function generateDependencyMermaid(nodes, edges) {
|
|
|
1634
1539
|
}
|
|
1635
1540
|
return lines.join("\n");
|
|
1636
1541
|
}
|
|
1637
|
-
function generateWorkflowMermaid(sop) {
|
|
1638
|
-
const lines = ["flowchart TD"];
|
|
1639
|
-
for (const step of sop.steps) {
|
|
1640
|
-
const nodeId = `S${step.order}`;
|
|
1641
|
-
const label = `${step.order}. ${step.instruction.substring(0, 60)}`;
|
|
1642
|
-
lines.push(` ${nodeId}["${label}"]`);
|
|
1643
|
-
if (step.order > 1) {
|
|
1644
|
-
lines.push(` S${step.order - 1} --> ${nodeId}`);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
return lines.join("\n");
|
|
1648
|
-
}
|
|
1649
1542
|
function exportBackstageYAML(nodes, edges, org) {
|
|
1650
1543
|
const owner = org ?? "unknown";
|
|
1651
1544
|
const docs = [];
|
|
@@ -1677,7 +1570,6 @@ function exportJSON(db, sessionId) {
|
|
|
1677
1570
|
const edges = db.getEdges(sessionId);
|
|
1678
1571
|
const events = db.getEvents(sessionId);
|
|
1679
1572
|
const tasks = db.getTasks(sessionId);
|
|
1680
|
-
const sops = db.getSOPs(sessionId);
|
|
1681
1573
|
const stats = db.getStats(sessionId);
|
|
1682
1574
|
return JSON.stringify({
|
|
1683
1575
|
sessionId,
|
|
@@ -1686,31 +1578,9 @@ function exportJSON(db, sessionId) {
|
|
|
1686
1578
|
nodes,
|
|
1687
1579
|
edges,
|
|
1688
1580
|
events,
|
|
1689
|
-
tasks
|
|
1690
|
-
sops
|
|
1581
|
+
tasks
|
|
1691
1582
|
}, null, 2);
|
|
1692
1583
|
}
|
|
1693
|
-
function exportSOPMarkdown(sop) {
|
|
1694
|
-
const lines = [
|
|
1695
|
-
`# ${sop.title}`,
|
|
1696
|
-
"",
|
|
1697
|
-
`**Description:** ${sop.description}`,
|
|
1698
|
-
`**Systems:** ${sop.involvedSystems.join(", ")}`,
|
|
1699
|
-
`**Duration:** ${sop.estimatedDuration}`,
|
|
1700
|
-
`**Frequency:** ${sop.frequency}`,
|
|
1701
|
-
`**Confidence:** ${sop.confidence.toFixed(2)}`,
|
|
1702
|
-
"",
|
|
1703
|
-
"## Steps",
|
|
1704
|
-
""
|
|
1705
|
-
];
|
|
1706
|
-
for (const step of sop.steps) {
|
|
1707
|
-
lines.push(`${step.order}. **${step.tool}**${step.target ? ` \u2192 \`${step.target}\`` : ""}`);
|
|
1708
|
-
lines.push(` ${step.instruction}`);
|
|
1709
|
-
if (step.notes) lines.push(` _${step.notes}_`);
|
|
1710
|
-
lines.push("");
|
|
1711
|
-
}
|
|
1712
|
-
return lines.join("\n");
|
|
1713
|
-
}
|
|
1714
1584
|
function exportDiscoveryApp(nodes, edges, options) {
|
|
1715
1585
|
const theme = options?.theme ?? "dark";
|
|
1716
1586
|
const graphData = JSON.stringify({
|
|
@@ -2828,10 +2698,8 @@ function exportJGF(nodes, edges) {
|
|
|
2828
2698
|
};
|
|
2829
2699
|
return JSON.stringify(jgf, null, 2);
|
|
2830
2700
|
}
|
|
2831
|
-
function exportAll(db, sessionId, outputDir, formats = ["mermaid", "json", "yaml", "html", "map", "discovery"
|
|
2701
|
+
function exportAll(db, sessionId, outputDir, formats = ["mermaid", "json", "yaml", "html", "map", "discovery"]) {
|
|
2832
2702
|
mkdirSync2(outputDir, { recursive: true });
|
|
2833
|
-
mkdirSync2(join2(outputDir, "sops"), { recursive: true });
|
|
2834
|
-
mkdirSync2(join2(outputDir, "workflows"), { recursive: true });
|
|
2835
2703
|
const nodes = db.getNodes(sessionId);
|
|
2836
2704
|
const edges = db.getEdges(sessionId);
|
|
2837
2705
|
const jgfPath = join2(outputDir, "cartography-graph.jgf.json");
|
|
@@ -2849,15 +2717,6 @@ function exportAll(db, sessionId, outputDir, formats = ["mermaid", "json", "yaml
|
|
|
2849
2717
|
if (formats.includes("html") || formats.includes("map") || formats.includes("discovery")) {
|
|
2850
2718
|
writeFileSync(join2(outputDir, "discovery.html"), exportDiscoveryApp(nodes, edges));
|
|
2851
2719
|
}
|
|
2852
|
-
if (formats.includes("sops")) {
|
|
2853
|
-
const sops = db.getSOPs(sessionId);
|
|
2854
|
-
for (const sop of sops) {
|
|
2855
|
-
const filename = sop.title.toLowerCase().replace(/[^a-z0-9]+/g, "-") + ".md";
|
|
2856
|
-
writeFileSync(join2(outputDir, "sops", filename), exportSOPMarkdown(sop));
|
|
2857
|
-
const wfFilename = `workflow-${sop.workflowId.substring(0, 8)}.mermaid`;
|
|
2858
|
-
writeFileSync(join2(outputDir, "workflows", wfFilename), generateWorkflowMermaid(sop));
|
|
2859
|
-
}
|
|
2860
|
-
}
|
|
2861
2720
|
}
|
|
2862
2721
|
|
|
2863
2722
|
// src/cli.ts
|
|
@@ -3142,7 +3001,7 @@ function main() {
|
|
|
3142
3001
|
}
|
|
3143
3002
|
db.close();
|
|
3144
3003
|
});
|
|
3145
|
-
program.command("export [session-id]").description("Generate all output files").option("-o, --output <dir>", "Output directory", "./datasynx-output").option("--format <fmt...>", "Formats: mermaid,json,yaml,html,map
|
|
3004
|
+
program.command("export [session-id]").description("Generate all output files").option("-o, --output <dir>", "Output directory", "./datasynx-output").option("--format <fmt...>", "Formats: mermaid,json,yaml,html,map").action((sessionId, opts) => {
|
|
3146
3005
|
const config = defaultConfig({ outputDir: opts.output });
|
|
3147
3006
|
const db = new CartographyDB(config.dbPath);
|
|
3148
3007
|
const session = sessionId ? db.getSession(sessionId) : db.getLatestSession();
|
|
@@ -3152,7 +3011,7 @@ function main() {
|
|
|
3152
3011
|
process.exitCode = 1;
|
|
3153
3012
|
return;
|
|
3154
3013
|
}
|
|
3155
|
-
const formats = opts.format ?? ["mermaid", "json", "yaml", "html", "map"
|
|
3014
|
+
const formats = opts.format ?? ["mermaid", "json", "yaml", "html", "map"];
|
|
3156
3015
|
exportAll(db, session.id, opts.output, formats);
|
|
3157
3016
|
process.stderr.write(`\u2713 Exported to: ${opts.output}
|
|
3158
3017
|
`);
|
|
@@ -3220,7 +3079,7 @@ Session: ${session.id}
|
|
|
3220
3079
|
}
|
|
3221
3080
|
db.close();
|
|
3222
3081
|
});
|
|
3223
|
-
program.command("overview").description("Overview of all cartography sessions
|
|
3082
|
+
program.command("overview").description("Overview of all cartography sessions").option("--db <path>", "DB-Pfad").action((opts) => {
|
|
3224
3083
|
const config = defaultConfig();
|
|
3225
3084
|
const db = new CartographyDB(opts.db ?? config.dbPath);
|
|
3226
3085
|
const sessions = db.getSessions();
|
|
@@ -3237,27 +3096,25 @@ Session: ${session.id}
|
|
|
3237
3096
|
db.close();
|
|
3238
3097
|
return;
|
|
3239
3098
|
}
|
|
3240
|
-
let totalNodes = 0, totalEdges = 0
|
|
3099
|
+
let totalNodes = 0, totalEdges = 0;
|
|
3241
3100
|
for (const s of sessions) {
|
|
3242
3101
|
const st = db.getStats(s.id);
|
|
3243
3102
|
totalNodes += st.nodes;
|
|
3244
3103
|
totalEdges += st.edges;
|
|
3245
|
-
totalSops += db.getSOPs(s.id).length;
|
|
3246
3104
|
}
|
|
3247
3105
|
w(` ${b(String(sessions.length))} Sessions \xB7 ${b(String(totalNodes))} Nodes \xB7 `);
|
|
3248
|
-
w(`${b(String(totalEdges))} Edges
|
|
3106
|
+
w(`${b(String(totalEdges))} Edges
|
|
3249
3107
|
|
|
3250
3108
|
`);
|
|
3251
3109
|
for (const session of sessions) {
|
|
3252
3110
|
const stats = db.getStats(session.id);
|
|
3253
3111
|
const nodes = db.getNodes(session.id);
|
|
3254
|
-
const sops = db.getSOPs(session.id);
|
|
3255
3112
|
const status = session.completedAt ? green("\u2713") : yellow("\u25CF");
|
|
3256
3113
|
const age = session.startedAt.substring(0, 16).replace("T", " ");
|
|
3257
3114
|
const sid = cyan(session.id.substring(0, 8));
|
|
3258
3115
|
w(` ${status} ${sid} ${b("[" + session.mode + "]")} ${d(age)}
|
|
3259
3116
|
`);
|
|
3260
|
-
w(` ${d("Nodes: " + stats.nodes + " Edges: " + stats.edges
|
|
3117
|
+
w(` ${d("Nodes: " + stats.nodes + " Edges: " + stats.edges)}
|
|
3261
3118
|
`);
|
|
3262
3119
|
const byType = /* @__PURE__ */ new Map();
|
|
3263
3120
|
for (const n of nodes) byType.set(n.type, (byType.get(n.type) ?? 0) + 1);
|
|
@@ -3268,12 +3125,6 @@ Session: ${session.id}
|
|
|
3268
3125
|
}
|
|
3269
3126
|
const topNodes = nodes.slice(0, 5).map((n) => n.id).join(", ");
|
|
3270
3127
|
if (topNodes) w(` ${d("Nodes: " + topNodes + (nodes.length > 5 ? " \u2026" : ""))}
|
|
3271
|
-
`);
|
|
3272
|
-
for (const sop of sops.slice(0, 3)) {
|
|
3273
|
-
w(` ${green("\u25BA")} ${sop.title} ${d("(" + sop.estimatedDuration + ")")}
|
|
3274
|
-
`);
|
|
3275
|
-
}
|
|
3276
|
-
if (sops.length > 3) w(` ${d("\u2026 +" + (sops.length - 3) + " more SOPs")}
|
|
3277
3128
|
`);
|
|
3278
3129
|
w("\n");
|
|
3279
3130
|
}
|
|
@@ -3291,14 +3142,13 @@ Session: ${session.id}
|
|
|
3291
3142
|
}
|
|
3292
3143
|
const nodes = db.getNodes(session.id);
|
|
3293
3144
|
const edges = db.getEdges(session.id);
|
|
3294
|
-
const sops = db.getSOPs(session.id);
|
|
3295
3145
|
const w = (s) => process.stdout.write(s);
|
|
3296
3146
|
w("\n");
|
|
3297
3147
|
w(dim(` \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
3298
3148
|
`));
|
|
3299
3149
|
w(` ${bold("CARTOGRAPHY CHAT")} ${dim("Session " + session.id.substring(0, 8))}
|
|
3300
3150
|
`);
|
|
3301
|
-
w(` ${dim(String(nodes.length) + " Nodes \xB7 " + edges.length + " Edges
|
|
3151
|
+
w(` ${dim(String(nodes.length) + " Nodes \xB7 " + edges.length + " Edges")}
|
|
3302
3152
|
`);
|
|
3303
3153
|
w(dim(` \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
3304
3154
|
`));
|
|
@@ -3314,15 +3164,14 @@ Session: ${session.id}
|
|
|
3314
3164
|
metadata: n.metadata,
|
|
3315
3165
|
tags: n.tags
|
|
3316
3166
|
})),
|
|
3317
|
-
edges: edges.map((e) => ({ from: e.sourceId, to: e.targetId, rel: e.relationship, conf: e.confidence }))
|
|
3318
|
-
sops: sops.map((s) => ({ title: s.title, description: s.description, steps: s.steps.length, duration: s.estimatedDuration }))
|
|
3167
|
+
edges: edges.map((e) => ({ from: e.sourceId, to: e.targetId, rel: e.relationship, conf: e.confidence }))
|
|
3319
3168
|
});
|
|
3320
3169
|
const systemPrompt = `You are an infrastructure analyst for Cartography.
|
|
3321
3170
|
You have access to the fully mapped infrastructure of this session.
|
|
3322
3171
|
Answer questions precisely and helpfully. Use the data concretely.
|
|
3323
|
-
You can
|
|
3172
|
+
You can analyze dependencies, identify risks, suggest optimizations.
|
|
3324
3173
|
|
|
3325
|
-
INFRASTRUCTURE SNAPSHOT (${nodes.length} nodes, ${edges.length} edges
|
|
3174
|
+
INFRASTRUCTURE SNAPSHOT (${nodes.length} nodes, ${edges.length} edges):
|
|
3326
3175
|
${infraSummary.substring(0, 12e3)}`;
|
|
3327
3176
|
const history = [];
|
|
3328
3177
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -3433,7 +3282,7 @@ ${infraSummary.substring(0, 12e3)}`;
|
|
|
3433
3282
|
out("\n");
|
|
3434
3283
|
out(` ${green("datasynx-cartography export [session-id]")}
|
|
3435
3284
|
`);
|
|
3436
|
-
out(dim(" --format <fmt...> mermaid, json, yaml, html,
|
|
3285
|
+
out(dim(" --format <fmt...> mermaid, json, yaml, html, map (default: all)\n"));
|
|
3437
3286
|
out(dim(" -o, --output <dir> Output directory\n"));
|
|
3438
3287
|
out("\n");
|
|
3439
3288
|
out(` ${green("datasynx-cartography show [session-id]")} ${dim("Session details + node list")}
|
|
@@ -3581,7 +3430,7 @@ ${infraSummary.substring(0, 12e3)}`;
|
|
|
3581
3430
|
`);
|
|
3582
3431
|
return;
|
|
3583
3432
|
}
|
|
3584
|
-
const { NODE_TYPES: NODE_TYPES2 } = await import("./types-
|
|
3433
|
+
const { NODE_TYPES: NODE_TYPES2 } = await import("./types-54623ALF.js");
|
|
3585
3434
|
if (!process.stdin.isTTY) {
|
|
3586
3435
|
w(red("\n \u2717 Interactive mode requires a terminal (use --file for non-interactive)\n\n"));
|
|
3587
3436
|
process.exitCode = 1;
|