@datasynx/agentic-ai-cartography 2.10.0 → 2.11.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/index.d.cts CHANGED
@@ -2150,6 +2150,11 @@ interface ScanContext {
2150
2150
  scanEstablishedConnections?: () => string;
2151
2151
  /** Injectable seam: cross-platform file search (3.2). Defaults to `findFiles`. */
2152
2152
  findFiles?: (dirs: string[], patterns: string[], maxDepth: number, limit: number) => string;
2153
+ /**
2154
+ * Injectable seam: read a local file's UTF-8 contents, '' on any error (5.3). Reads via
2155
+ * `node:fs` (NOT the shell) so an operator-supplied path can never inject a command.
2156
+ */
2157
+ readFile?: (path: string) => string;
2153
2158
  /** Injectable seam: browser-bookmark host source. Defaults to `scanAllBookmarks`. */
2154
2159
  scanBookmarks?: () => Promise<BookmarkHost[]>;
2155
2160
  }
@@ -2801,6 +2806,33 @@ declare function parseConnectionString(name: string, url: string): {
2801
2806
  } | null;
2802
2807
  declare const serviceConfigScanner: Scanner;
2803
2808
 
2809
+ /**
2810
+ * Terraform-state importer (5.3) — a first-class deterministic `Scanner`.
2811
+ *
2812
+ * Ingests Terraform state JSON (a local `*.tfstate`, or the output of
2813
+ * `terraform state pull` piped to a file) and emits authoritative `nodes`/`edges` into
2814
+ * the existing discovery pipeline. This bridges *declared intent* (IaC) with *observed
2815
+ * reality* (the live scanners): a resource declared in Terraform and a node observed on
2816
+ * the machine reconcile to one record under `runLocalDiscovery`'s highest-confidence
2817
+ * dedup, and the importer's `depends_on` edges are subject to the same endpoint-existence
2818
+ * gate. Registered in `defaultRegistry()`, so it surfaces through both the CLI discovery
2819
+ * command and the MCP `run_discovery` tool with zero extra wiring.
2820
+ *
2821
+ * Read-only: it only `cat`s a state file (allowlisted). Attribute values are
2822
+ * credential-redacted before storage; only a small identity subset is kept.
2823
+ */
2824
+
2825
+ /** Map a Terraform resource type (e.g. `aws_db_instance`) to a Cartograph node type. */
2826
+ declare function terraformTypeToNode(tfType: string): NodeType;
2827
+ /**
2828
+ * Parse Terraform state JSON into nodes/edges. Pure + deterministic. A managed resource
2829
+ * becomes a node keyed `{type}:terraform:{addr}`; its `dependencies[]` become `depends_on`
2830
+ * edges to other managed resources in the same state. Malformed JSON → empty result
2831
+ * (graceful degradation, never throws).
2832
+ */
2833
+ declare function parseTerraformState(json: string): ScanResult;
2834
+ declare const terraformScanner: Scanner;
2835
+
2804
2836
  /**
2805
2837
  * Confidence rubric for inferred dependency edges (3.2).
2806
2838
  *
@@ -4379,4 +4411,4 @@ declare function logInfo(message: string, context?: Record<string, unknown>): vo
4379
4411
  declare function logWarn(message: string, context?: Record<string, unknown>): void;
4380
4412
  declare function logError(message: string, context?: Record<string, unknown>): void;
4381
4413
 
4382
- export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, CORRELATION_CONFIDENCE, COST_PERIODS, type CanonicalNode, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CorrelatedTopology, type CorrelationEdge, type CorrelationSignal, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeSignals, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, correlateTopology, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, extractSignals, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
4414
+ export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, CORRELATION_CONFIDENCE, COST_PERIODS, type CanonicalNode, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CorrelatedTopology, type CorrelationEdge, type CorrelationSignal, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeSignals, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, correlateTopology, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, extractSignals, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, parseTerraformState, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, terraformScanner, terraformTypeToNode, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -2150,6 +2150,11 @@ interface ScanContext {
2150
2150
  scanEstablishedConnections?: () => string;
2151
2151
  /** Injectable seam: cross-platform file search (3.2). Defaults to `findFiles`. */
2152
2152
  findFiles?: (dirs: string[], patterns: string[], maxDepth: number, limit: number) => string;
2153
+ /**
2154
+ * Injectable seam: read a local file's UTF-8 contents, '' on any error (5.3). Reads via
2155
+ * `node:fs` (NOT the shell) so an operator-supplied path can never inject a command.
2156
+ */
2157
+ readFile?: (path: string) => string;
2153
2158
  /** Injectable seam: browser-bookmark host source. Defaults to `scanAllBookmarks`. */
2154
2159
  scanBookmarks?: () => Promise<BookmarkHost[]>;
2155
2160
  }
@@ -2801,6 +2806,33 @@ declare function parseConnectionString(name: string, url: string): {
2801
2806
  } | null;
2802
2807
  declare const serviceConfigScanner: Scanner;
2803
2808
 
2809
+ /**
2810
+ * Terraform-state importer (5.3) — a first-class deterministic `Scanner`.
2811
+ *
2812
+ * Ingests Terraform state JSON (a local `*.tfstate`, or the output of
2813
+ * `terraform state pull` piped to a file) and emits authoritative `nodes`/`edges` into
2814
+ * the existing discovery pipeline. This bridges *declared intent* (IaC) with *observed
2815
+ * reality* (the live scanners): a resource declared in Terraform and a node observed on
2816
+ * the machine reconcile to one record under `runLocalDiscovery`'s highest-confidence
2817
+ * dedup, and the importer's `depends_on` edges are subject to the same endpoint-existence
2818
+ * gate. Registered in `defaultRegistry()`, so it surfaces through both the CLI discovery
2819
+ * command and the MCP `run_discovery` tool with zero extra wiring.
2820
+ *
2821
+ * Read-only: it only `cat`s a state file (allowlisted). Attribute values are
2822
+ * credential-redacted before storage; only a small identity subset is kept.
2823
+ */
2824
+
2825
+ /** Map a Terraform resource type (e.g. `aws_db_instance`) to a Cartograph node type. */
2826
+ declare function terraformTypeToNode(tfType: string): NodeType;
2827
+ /**
2828
+ * Parse Terraform state JSON into nodes/edges. Pure + deterministic. A managed resource
2829
+ * becomes a node keyed `{type}:terraform:{addr}`; its `dependencies[]` become `depends_on`
2830
+ * edges to other managed resources in the same state. Malformed JSON → empty result
2831
+ * (graceful degradation, never throws).
2832
+ */
2833
+ declare function parseTerraformState(json: string): ScanResult;
2834
+ declare const terraformScanner: Scanner;
2835
+
2804
2836
  /**
2805
2837
  * Confidence rubric for inferred dependency edges (3.2).
2806
2838
  *
@@ -4379,4 +4411,4 @@ declare function logInfo(message: string, context?: Record<string, unknown>): vo
4379
4411
  declare function logWarn(message: string, context?: Record<string, unknown>): void;
4380
4412
  declare function logError(message: string, context?: Record<string, unknown>): void;
4381
4413
 
4382
- export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, CORRELATION_CONFIDENCE, COST_PERIODS, type CanonicalNode, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CorrelatedTopology, type CorrelationEdge, type CorrelationSignal, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeSignals, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, correlateTopology, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, extractSignals, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
4414
+ export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, CORRELATION_CONFIDENCE, COST_PERIODS, type CanonicalNode, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CorrelatedTopology, type CorrelationEdge, type CorrelationSignal, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeSignals, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, correlateTopology, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, extractSignals, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, parseTerraformState, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, terraformScanner, terraformTypeToNode, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
package/dist/index.js CHANGED
@@ -5979,7 +5979,7 @@ function correlateTopology(nodes, _edges = []) {
5979
5979
 
5980
5980
  // src/mcp/server.ts
5981
5981
  var SERVER_NAME = "cartography";
5982
- var SERVER_VERSION = "2.10.0";
5982
+ var SERVER_VERSION = "2.11.0";
5983
5983
  var SERVICE_TYPES = NODE_TYPE_GROUPS.web;
5984
5984
  var DATA_TYPES = NODE_TYPE_GROUPS.data;
5985
5985
  var lexicalSearch = async (db, sessionId, query, opts) => db.searchNodes(sessionId, query, { types: opts.types, limit: opts.limit }).map((node) => ({ node }));
@@ -7389,9 +7389,132 @@ var serviceConfigScanner = {
7389
7389
  }
7390
7390
  };
7391
7391
 
7392
+ // src/scanners/terraform.ts
7393
+ import { readFileSync as readFileSync4 } from "fs";
7394
+ var TYPE_RULES = [
7395
+ [/(db_instance|_rds|sql_database|sql_instance|database_instance|cosmosdb|dynamodb|spanner|bigtable|documentdb|redshift)/, "database_server"],
7396
+ [/(elasticache|_redis|memcached|memorystore)/, "cache_server"],
7397
+ [/(s3_bucket|storage_bucket|gcs_bucket|storage_account|_blob)/, "database"],
7398
+ [/(_sqs|_queue|servicebus_queue)/, "queue"],
7399
+ [/(_sns|_topic|pubsub_topic|servicebus_topic)/, "topic"],
7400
+ [/(kafka|_msk|event_hub|kinesis)/, "message_broker"],
7401
+ [/(_eks|_gke|_aks|kubernetes_cluster|container_cluster)/, "k8s_cluster"],
7402
+ [/(ecs_|_container|fargate)/, "container"],
7403
+ [/(lambda|cloud_function|cloudfunctions|function_app|cloud_run)/, "web_service"],
7404
+ [/(_lb$|load_balancer|_alb|_elb|application_gateway)/, "web_service"],
7405
+ [/(api_gateway|apigateway)/, "api_endpoint"],
7406
+ [/(_instance|virtual_machine|_vm$|compute_instance)/, "host"]
7407
+ ];
7408
+ function terraformTypeToNode(tfType) {
7409
+ const t = tfType.toLowerCase();
7410
+ for (const [re, nt] of TYPE_RULES) if (re.test(t)) return nt;
7411
+ return "unknown";
7412
+ }
7413
+ var IDENTITY_ATTRS = ["id", "arn", "region", "location", "instance_type", "engine", "machine_type"];
7414
+ var OWNER_TAGS = ["Owner", "owner", "Team", "team"];
7415
+ var SAFE_TAG_KEYS = /* @__PURE__ */ new Set(["Name", "name", "Owner", "owner", "Team", "team", "Env", "env", "Environment", "environment", "Service", "service", "Component", "component", "App", "app", "Project", "project", "Tier", "tier", "Role", "role"]);
7416
+ var SECRET_KEY = /pass|secret|token|key|pwd|cred|private/i;
7417
+ function attrTags(tags) {
7418
+ if (!tags || typeof tags !== "object") return [];
7419
+ return Object.entries(tags).filter(([k]) => SAFE_TAG_KEYS.has(k) && !SECRET_KEY.test(k)).map(([k, v]) => `${k}:${redactSecrets(String(v))}`);
7420
+ }
7421
+ function parseTerraformState(json2) {
7422
+ let state;
7423
+ try {
7424
+ state = JSON.parse(json2);
7425
+ } catch {
7426
+ return { nodes: [], edges: [] };
7427
+ }
7428
+ const resources = Array.isArray(state?.resources) ? state.resources : [];
7429
+ const nodes = [];
7430
+ const edges = [];
7431
+ const addrToId = /* @__PURE__ */ new Map();
7432
+ for (const raw of resources) {
7433
+ const r = raw;
7434
+ if (r.mode && r.mode !== "managed") continue;
7435
+ if (typeof r.type !== "string" || typeof r.name !== "string") continue;
7436
+ const address = `${r.type}.${r.name}`;
7437
+ const nt = terraformTypeToNode(r.type);
7438
+ const id = `${nt}:terraform:${address}`;
7439
+ if (addrToId.has(address)) continue;
7440
+ addrToId.set(address, id);
7441
+ const inst = Array.isArray(r.instances) ? r.instances[0] : void 0;
7442
+ const attrs = inst?.attributes ?? {};
7443
+ const identity = { source: "terraform", tfType: r.type };
7444
+ for (const k of IDENTITY_ATTRS) if (attrs[k] !== void 0) identity[k] = attrs[k];
7445
+ const owner = OWNER_TAGS.map((k) => attrs.tags?.[k]).find((v) => typeof v === "string");
7446
+ nodes.push({
7447
+ id,
7448
+ type: nt,
7449
+ name: address,
7450
+ discoveredVia: "terraform-state",
7451
+ confidence: 0.9,
7452
+ // IaC is authoritative declared intent.
7453
+ metadata: redactValue(identity),
7454
+ tags: attrTags(attrs.tags),
7455
+ ...owner ? { owner } : {}
7456
+ });
7457
+ }
7458
+ for (const raw of resources) {
7459
+ const r = raw;
7460
+ if (r.mode && r.mode !== "managed") continue;
7461
+ if (typeof r.type !== "string" || typeof r.name !== "string") continue;
7462
+ const srcId = addrToId.get(`${r.type}.${r.name}`);
7463
+ if (!srcId) continue;
7464
+ const inst = Array.isArray(r.instances) ? r.instances[0] : void 0;
7465
+ const deps = Array.isArray(inst?.dependencies) ? inst.dependencies : [];
7466
+ for (const dep of deps) {
7467
+ if (typeof dep !== "string") continue;
7468
+ const tgtId = addrToId.get(dep) ?? addrToId.get(dep.split("[")[0]);
7469
+ if (!tgtId || tgtId === srcId) continue;
7470
+ edges.push({ sourceId: srcId, targetId: tgtId, relationship: "depends_on", evidence: evidenceLine("config-declared", `terraform depends_on ${dep}`), confidence: 0.85 });
7471
+ }
7472
+ }
7473
+ return { nodes, edges };
7474
+ }
7475
+ function stateDirs() {
7476
+ return [".", "./terraform", "./infra", "./infrastructure", "./deploy", "./terraform/environments"];
7477
+ }
7478
+ function hintPath(hint) {
7479
+ if (!hint) return void 0;
7480
+ const m = /(?:^|[\s,])tfstate=([^\s,]+)/.exec(hint);
7481
+ return m ? m[1] : void 0;
7482
+ }
7483
+ function resolveStatePath(ctx) {
7484
+ const explicit = hintPath(ctx.hint);
7485
+ if (explicit) return explicit;
7486
+ const found = (ctx.findFiles ?? findFiles)(stateDirs(), ["*.tfstate"], 4, 20).split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
7487
+ return found[0];
7488
+ }
7489
+ function readStateFile(path) {
7490
+ try {
7491
+ return readFileSync4(path, "utf8");
7492
+ } catch {
7493
+ return "";
7494
+ }
7495
+ }
7496
+ var terraformScanner = {
7497
+ id: "terraform-state",
7498
+ title: "Terraform state (IaC)",
7499
+ platforms: "all",
7500
+ // No shell commands — the state file is read directly via node:fs, so an
7501
+ // operator-supplied path can never inject a command (no `cat "${path}"` interpolation).
7502
+ detect(ctx) {
7503
+ return resolveStatePath(ctx) !== void 0;
7504
+ },
7505
+ async scan(ctx) {
7506
+ const path = resolveStatePath(ctx);
7507
+ if (!path) return { nodes: [], edges: [] };
7508
+ const json2 = (ctx.readFile ?? readStateFile)(path);
7509
+ if (!json2) return { nodes: [], edges: [] };
7510
+ const result = parseTerraformState(json2);
7511
+ return { ...result, report: `terraform-state: ${result.nodes.length} resources, ${result.edges.length} dependencies from ${path}` };
7512
+ }
7513
+ };
7514
+
7392
7515
  // src/scanners/registry.ts
7393
7516
  function defaultRegistry() {
7394
- return new ScannerRegistry().register(bookmarksScanner).register(installedAppsScanner).register(portsScanner).register(cloudAwsScanner).register(cloudGcpScanner).register(cloudAzureScanner).register(k8sScanner).register(databasesScanner).register(connectionsScanner).register(serviceConfigScanner);
7517
+ return new ScannerRegistry().register(bookmarksScanner).register(installedAppsScanner).register(portsScanner).register(cloudAwsScanner).register(cloudGcpScanner).register(cloudAzureScanner).register(k8sScanner).register(databasesScanner).register(connectionsScanner).register(serviceConfigScanner).register(terraformScanner);
7395
7518
  }
7396
7519
 
7397
7520
  // src/scanners/loader.ts
@@ -8759,13 +8882,13 @@ var AuthConfigSchema = z9.object({
8759
8882
  });
8760
8883
 
8761
8884
  // src/api/start.ts
8762
- import { readFileSync as readFileSync4 } from "fs";
8885
+ import { readFileSync as readFileSync5 } from "fs";
8763
8886
  import { dirname as dirname3, resolve } from "path";
8764
8887
  import { fileURLToPath } from "url";
8765
8888
  function readVersion() {
8766
8889
  try {
8767
8890
  const dir = import.meta.dirname ?? dirname3(fileURLToPath(import.meta.url));
8768
- return JSON.parse(readFileSync4(resolve(dir, "..", "package.json"), "utf-8")).version ?? "0.0.0";
8891
+ return JSON.parse(readFileSync5(resolve(dir, "..", "package.json"), "utf-8")).version ?? "0.0.0";
8769
8892
  } catch {
8770
8893
  return "0.0.0";
8771
8894
  }
@@ -8896,7 +9019,7 @@ function defaultServerEntry(opts = {}) {
8896
9019
  }
8897
9020
 
8898
9021
  // src/installer/install.ts
8899
- import { mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync3, existsSync as existsSync4 } from "fs";
9022
+ import { mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync3, existsSync as existsSync4 } from "fs";
8900
9023
  import { dirname as dirname4 } from "path";
8901
9024
  import { homedir as homedir3 } from "os";
8902
9025
  function currentOs() {
@@ -8913,7 +9036,7 @@ function planInstall(spec, ctx, opts) {
8913
9036
  throw new Error(`${spec.label} does not support the "${ctx.scope}" scope.`);
8914
9037
  }
8915
9038
  const fileExists = existsSync4(path);
8916
- const before = fileExists ? readFileSync5(path, "utf8") : "";
9039
+ const before = fileExists ? readFileSync6(path, "utf8") : "";
8917
9040
  const existing = parseConfig(before, spec.format);
8918
9041
  const merged = spec.apply(existing, opts.serverName ?? DEFAULT_SERVER_NAME, opts.entry);
8919
9042
  const after = serializeConfig(merged, spec.format);
@@ -9779,7 +9902,7 @@ Use ask_user when you need context from the user.`;
9779
9902
  }
9780
9903
 
9781
9904
  // src/cost.ts
9782
- import { readFileSync as readFileSync6 } from "fs";
9905
+ import { readFileSync as readFileSync7 } from "fs";
9783
9906
  import { resolve as resolve2 } from "path";
9784
9907
  function splitCsvLine(line) {
9785
9908
  const out = [];
@@ -9858,7 +9981,7 @@ var CsvCostSource = class {
9858
9981
  }
9859
9982
  id;
9860
9983
  async fetch() {
9861
- const text = readFileSync6(resolve2(this.opts.filePath), "utf-8");
9984
+ const text = readFileSync7(resolve2(this.opts.filePath), "utf-8");
9862
9985
  const records = parseCostCsv(text);
9863
9986
  const match = this.opts.match ?? "nodeId";
9864
9987
  const out = /* @__PURE__ */ new Map();
@@ -11623,7 +11746,7 @@ function formatComplianceText(report) {
11623
11746
  }
11624
11747
 
11625
11748
  // src/config.ts
11626
- import { readFileSync as readFileSync7 } from "fs";
11749
+ import { readFileSync as readFileSync8 } from "fs";
11627
11750
  var ConfigError = class extends Error {
11628
11751
  constructor(message) {
11629
11752
  super(message);
@@ -11648,7 +11771,7 @@ function loadConfig(path) {
11648
11771
  function readConfigFile(path) {
11649
11772
  let raw;
11650
11773
  try {
11651
- raw = readFileSync7(path, "utf-8");
11774
+ raw = readFileSync8(path, "utf-8");
11652
11775
  } catch (err) {
11653
11776
  throw new ConfigError(
11654
11777
  `Cannot read config file ${path}: ${err instanceof Error ? err.message : String(err)}`
@@ -12006,14 +12129,14 @@ function runSyncClassify(db, sessionId, config, opts = {}) {
12006
12129
 
12007
12130
  // src/preflight.ts
12008
12131
  import { execSync as execSync2 } from "child_process";
12009
- import { existsSync as existsSync5, readFileSync as readFileSync8 } from "fs";
12132
+ import { existsSync as existsSync5, readFileSync as readFileSync9 } from "fs";
12010
12133
  import { join as join6 } from "path";
12011
12134
  function isOAuthLoggedIn() {
12012
12135
  const home = process.env.HOME ?? process.env.USERPROFILE ?? "/tmp";
12013
12136
  const credFile = join6(home, ".claude", ".credentials.json");
12014
12137
  if (!existsSync5(credFile)) return false;
12015
12138
  try {
12016
- const creds = JSON.parse(readFileSync8(credFile, "utf8"));
12139
+ const creds = JSON.parse(readFileSync9(credFile, "utf8"));
12017
12140
  const oauth = creds["claudeAiOauth"];
12018
12141
  return typeof oauth?.["accessToken"] === "string" && oauth["accessToken"].length > 0;
12019
12142
  } catch {
@@ -12272,6 +12395,7 @@ export {
12272
12395
  parseNginxUpstreams,
12273
12396
  parseNlQuery,
12274
12397
  parseScanHint,
12398
+ parseTerraformState,
12275
12399
  pixelToHex,
12276
12400
  planInstall,
12277
12401
  portsScanner,
@@ -12321,6 +12445,8 @@ export {
12321
12445
  stableStringify,
12322
12446
  startApi,
12323
12447
  stripSensitive,
12448
+ terraformScanner,
12449
+ terraformTypeToNode,
12324
12450
  timingSafeEqual,
12325
12451
  toBackstageEntities,
12326
12452
  validateScanner,