@datasynx/agentic-ai-cartography 2.6.0 → 2.8.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.
package/dist/cli.js CHANGED
@@ -11,12 +11,12 @@ import {
11
11
  runDrift,
12
12
  runLocalDiscovery,
13
13
  startMcp
14
- } from "./chunk-X3UWUX3G.js";
14
+ } from "./chunk-5D5ZZEZM.js";
15
15
  import {
16
16
  entitiesToYaml,
17
17
  startApi,
18
18
  toBackstageEntities
19
- } from "./chunk-PQ7Q6MI5.js";
19
+ } from "./chunk-TBPGFEMQ.js";
20
20
  import {
21
21
  CartographyDB,
22
22
  buildCartographyToolHandlers,
@@ -28,7 +28,7 @@ import {
28
28
  redactValue,
29
29
  stableStringify,
30
30
  stripSensitive
31
- } from "./chunk-GA4427LB.js";
31
+ } from "./chunk-YVV6NIT2.js";
32
32
  import {
33
33
  ConfigFileSchema,
34
34
  CostEntrySchema,
@@ -4685,7 +4685,7 @@ ${infraSummary.substring(0, 12e3)}`;
4685
4685
  process.exitCode = 1;
4686
4686
  }
4687
4687
  });
4688
- program.command("prune").description("Delete old sessions and their data").option("--older-than <days>", "Delete sessions older than N days", "30").option("--db <path>", "DB path").option("--dry-run", "Show what would be deleted without actually deleting", false).action((opts) => {
4688
+ program.command("prune").description("Delete old sessions and their data").option("--older-than <days>", "Delete sessions older than N days", "30").option("--events-older-than <days>", "Compact the audit trail: delete activity events older than N days (4.7 retention)").option("--db <path>", "DB path").option("--dry-run", "Show what would be deleted without actually deleting", false).action((opts) => {
4689
4689
  const days = parseInt(opts.olderThan, 10);
4690
4690
  if (Number.isNaN(days) || days < 1) {
4691
4691
  process.stderr.write(`Invalid --older-than: "${opts.olderThan}" (must be >= 1)
@@ -4696,6 +4696,26 @@ ${infraSummary.substring(0, 12e3)}`;
4696
4696
  const config = defaultConfig({ ...opts.db ? { dbPath: opts.db } : {} });
4697
4697
  const db = new CartographyDB(config.dbPath);
4698
4698
  const cutoff = new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString();
4699
+ if (opts.eventsOlderThan !== void 0) {
4700
+ const eventDays = parseInt(opts.eventsOlderThan, 10);
4701
+ if (Number.isNaN(eventDays) || eventDays < 1) {
4702
+ process.stderr.write(`Invalid --events-older-than: "${opts.eventsOlderThan}" (must be >= 1)
4703
+ `);
4704
+ process.exitCode = 2;
4705
+ db.close();
4706
+ return;
4707
+ }
4708
+ const eventCutoff = new Date(Date.now() - eventDays * 24 * 60 * 60 * 1e3).toISOString();
4709
+ if (opts.dryRun) {
4710
+ process.stderr.write(`Would compact the audit trail (delete events older than ${eventDays} days).
4711
+ `);
4712
+ } else {
4713
+ const removed = db.pruneEventsOlderThan(eventCutoff);
4714
+ logInfo("Audit events pruned", { removed, olderThanDays: eventDays });
4715
+ process.stderr.write(`Deleted ${removed} audit event(s) older than ${eventDays} days.
4716
+ `);
4717
+ }
4718
+ }
4699
4719
  const sessions = db.getSessions().filter((s) => s.startedAt < cutoff);
4700
4720
  if (sessions.length === 0) {
4701
4721
  process.stderr.write(`No sessions older than ${days} days.
@@ -4966,12 +4986,20 @@ ${infraSummary.substring(0, 12e3)}`;
4966
4986
  db.close();
4967
4987
  }
4968
4988
  });
4969
- program.command("mcp").description("Run the Model Context Protocol server (stdio by default) \u2014 the primary interface for AI agents").option("--http", "Use Streamable HTTP transport instead of stdio", false).option("--port <n>", "HTTP port", "3737").option("--host <h>", "HTTP host", "127.0.0.1").option("--allowed-hosts <list>", "Comma-separated Host allowlist (required for non-loopback --host)").option("--token <secret>", "Bearer token required on HTTP requests (or CARTOGRAPHY_HTTP_TOKEN); mandatory for non-loopback --host").option("--db <path>", "DB path").option("--session <id>", 'Session to serve (id or "latest")', "latest").option("--tenant <id>", "Tenant/organization whose topology to serve (alias: --org; default: local)").option("--org <id>", "Alias for --tenant").option("--no-semantic", "Disable semantic (vector) search").option("--plugins <list>", "Comma-separated scanner plugin package names to load (opt-in; or CARTOGRAPHY_PLUGINS)").option("--server-mode", "Run as a central collector: enable the authenticated POST /ingest write route + org-wide summary (implies --http; opt-in)", false).option("--anon-mode <mode>", "On ingest, reject|strip un-anonymized identifying fragments (server-mode)", "reject").option("--auth-required", "Reject unauthenticated requests even on loopback (RBAC required mode)", false).action(async (opts) => {
4989
+ program.command("mcp").description("Run the Model Context Protocol server (stdio by default) \u2014 the primary interface for AI agents").option("--http", "Use Streamable HTTP transport instead of stdio", false).option("--port <n>", "HTTP port", "3737").option("--host <h>", "HTTP host", "127.0.0.1").option("--allowed-hosts <list>", "Comma-separated Host allowlist (required for non-loopback --host)").option("--token <secret>", "Bearer token required on HTTP requests (or CARTOGRAPHY_HTTP_TOKEN); mandatory for non-loopback --host").option("--db <path>", "DB path").option("--session <id>", 'Session to serve (id or "latest")', "latest").option("--tenant <id>", "Tenant/organization whose topology to serve (alias: --org; default: local)").option("--org <id>", "Alias for --tenant").option("--no-semantic", "Disable semantic (vector) search").option("--plugins <list>", "Comma-separated scanner plugin package names to load (opt-in; or CARTOGRAPHY_PLUGINS)").option("--server-mode", "Run as a central collector: enable the authenticated POST /ingest write route + org-wide summary (implies --http; opt-in)", false).option("--anon-mode <mode>", "On ingest, reject|strip un-anonymized identifying fragments (server-mode)", "reject").option("--auth-required", "Reject unauthenticated requests even on loopback (RBAC required mode)", false).option("--store-backend <kind>", "Central store backend: sqlite (default) | graph (Neo4j/Memgraph, opt-in, 4.3)").option("--graph-url <url>", "Bolt URL for --store-backend graph (or CARTOGRAPHY_GRAPH_URL)").option("--graph-user <user>", "Graph DB user (or CARTOGRAPHY_GRAPH_USER)").option("--graph-password <pw>", "Graph DB password (or CARTOGRAPHY_GRAPH_PASSWORD)").action(async (opts) => {
4970
4990
  try {
4971
4991
  const anonMode = opts.anonMode;
4972
4992
  if (anonMode !== "reject" && anonMode !== "strip") {
4973
4993
  process.stderr.write(`
4974
4994
  error: --anon-mode must be 'reject' or 'strip' (got '${anonMode}')
4995
+ `);
4996
+ process.exitCode = 1;
4997
+ return;
4998
+ }
4999
+ const storeBackend = opts.storeBackend;
5000
+ if (storeBackend !== void 0 && storeBackend !== "sqlite" && storeBackend !== "graph") {
5001
+ process.stderr.write(`
5002
+ error: --store-backend must be 'sqlite' or 'graph' (got '${storeBackend}')
4975
5003
  `);
4976
5004
  process.exitCode = 1;
4977
5005
  return;
@@ -4989,7 +5017,11 @@ error: --anon-mode must be 'reject' or 'strip' (got '${anonMode}')
4989
5017
  plugins: opts.plugins ? String(opts.plugins).split(",").map((p) => p.trim()).filter(Boolean) : void 0,
4990
5018
  serverMode: opts.serverMode === true,
4991
5019
  anonMode,
4992
- authRequired: opts.authRequired === true
5020
+ authRequired: opts.authRequired === true,
5021
+ ...storeBackend ? { storeBackend } : {},
5022
+ ...opts.graphUrl ? { graphUrl: opts.graphUrl } : {},
5023
+ ...opts.graphUser ? { graphUser: opts.graphUser } : {},
5024
+ ...opts.graphPassword ? { graphPassword: opts.graphPassword } : {}
4993
5025
  });
4994
5026
  } catch (err) {
4995
5027
  process.stderr.write(`