@isaacriehm/cairn 0.1.0 → 0.1.3
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/.tsbuildinfo +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/backprop/id.d.ts +0 -14
- package/dist/backprop/id.js +0 -40
- package/dist/backprop/id.js.map +0 -1
- package/dist/backprop/index.d.ts +0 -23
- package/dist/backprop/index.js +0 -21
- package/dist/backprop/index.js.map +0 -1
- package/dist/backprop/prompt.d.ts +0 -16
- package/dist/backprop/prompt.js +0 -101
- package/dist/backprop/prompt.js.map +0 -1
- package/dist/backprop/runner.d.ts +0 -18
- package/dist/backprop/runner.js +0 -95
- package/dist/backprop/runner.js.map +0 -1
- package/dist/backprop/schema.d.ts +0 -61
- package/dist/backprop/schema.js +0 -55
- package/dist/backprop/schema.js.map +0 -1
- package/dist/backprop/types.d.ts +0 -101
- package/dist/backprop/types.js +0 -24
- package/dist/backprop/types.js.map +0 -1
- package/dist/backprop/writer.d.ts +0 -27
- package/dist/backprop/writer.js +0 -301
- package/dist/backprop/writer.js.map +0 -1
- package/dist/claude/error.d.ts +0 -33
- package/dist/claude/error.js +0 -58
- package/dist/claude/error.js.map +0 -1
- package/dist/claude/index.d.ts +0 -3
- package/dist/claude/index.js +0 -3
- package/dist/claude/index.js.map +0 -1
- package/dist/claude/runner.d.ts +0 -11
- package/dist/claude/runner.js +0 -132
- package/dist/claude/runner.js.map +0 -1
- package/dist/claude/types.d.ts +0 -52
- package/dist/claude/types.js +0 -14
- package/dist/claude/types.js.map +0 -1
- package/dist/cli/daemon.d.ts +0 -54
- package/dist/cli/daemon.js +0 -351
- package/dist/cli/daemon.js.map +0 -1
- package/dist/cli/install.d.ts +0 -52
- package/dist/cli/install.js +0 -308
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/mirror.d.ts +0 -1
- package/dist/cli/mirror.js +0 -97
- package/dist/cli/mirror.js.map +0 -1
- package/dist/cli/run.d.ts +0 -1
- package/dist/cli/run.js +0 -174
- package/dist/cli/run.js.map +0 -1
- package/dist/cli/task.d.ts +0 -18
- package/dist/cli/task.js +0 -137
- package/dist/cli/task.js.map +0 -1
- package/dist/cli/watch.d.ts +0 -1
- package/dist/cli/watch.js +0 -73
- package/dist/cli/watch.js.map +0 -1
- package/dist/decision-capture/capture.d.ts +0 -57
- package/dist/decision-capture/capture.js +0 -186
- package/dist/decision-capture/capture.js.map +0 -1
- package/dist/decision-capture/extractor.d.ts +0 -20
- package/dist/decision-capture/extractor.js +0 -103
- package/dist/decision-capture/extractor.js.map +0 -1
- package/dist/decision-capture/id.d.ts +0 -14
- package/dist/decision-capture/id.js +0 -44
- package/dist/decision-capture/id.js.map +0 -1
- package/dist/decision-capture/index.d.ts +0 -25
- package/dist/decision-capture/index.js +0 -21
- package/dist/decision-capture/index.js.map +0 -1
- package/dist/decision-capture/prompt.d.ts +0 -15
- package/dist/decision-capture/prompt.js +0 -68
- package/dist/decision-capture/prompt.js.map +0 -1
- package/dist/decision-capture/refinement-prompt.d.ts +0 -25
- package/dist/decision-capture/refinement-prompt.js +0 -146
- package/dist/decision-capture/refinement-prompt.js.map +0 -1
- package/dist/decision-capture/refinement-schema.d.ts +0 -52
- package/dist/decision-capture/refinement-schema.js +0 -61
- package/dist/decision-capture/refinement-schema.js.map +0 -1
- package/dist/decision-capture/refinement.d.ts +0 -60
- package/dist/decision-capture/refinement.js +0 -439
- package/dist/decision-capture/refinement.js.map +0 -1
- package/dist/decision-capture/schema.d.ts +0 -70
- package/dist/decision-capture/schema.js +0 -71
- package/dist/decision-capture/schema.js.map +0 -1
- package/dist/decision-capture/types.d.ts +0 -201
- package/dist/decision-capture/types.js +0 -20
- package/dist/decision-capture/types.js.map +0 -1
- package/dist/decision-capture/writer.d.ts +0 -90
- package/dist/decision-capture/writer.js +0 -267
- package/dist/decision-capture/writer.js.map +0 -1
- package/dist/frontend/discord/acl.d.ts +0 -6
- package/dist/frontend/discord/acl.js +0 -19
- package/dist/frontend/discord/acl.js.map +0 -1
- package/dist/frontend/discord/channels.d.ts +0 -29
- package/dist/frontend/discord/channels.js +0 -58
- package/dist/frontend/discord/channels.js.map +0 -1
- package/dist/frontend/discord/classifier.d.ts +0 -16
- package/dist/frontend/discord/classifier.js +0 -29
- package/dist/frontend/discord/classifier.js.map +0 -1
- package/dist/frontend/discord/index.d.ts +0 -118
- package/dist/frontend/discord/index.js +0 -1104
- package/dist/frontend/discord/index.js.map +0 -1
- package/dist/frontend/discord/slash.d.ts +0 -18
- package/dist/frontend/discord/slash.js +0 -90
- package/dist/frontend/discord/slash.js.map +0 -1
- package/dist/frontend/inbox.d.ts +0 -17
- package/dist/frontend/inbox.js +0 -30
- package/dist/frontend/inbox.js.map +0 -1
- package/dist/frontend/index.d.ts +0 -8
- package/dist/frontend/index.js +0 -6
- package/dist/frontend/index.js.map +0 -1
- package/dist/frontend/stub/index.d.ts +0 -58
- package/dist/frontend/stub/index.js +0 -144
- package/dist/frontend/stub/index.js.map +0 -1
- package/dist/frontend/types.d.ts +0 -247
- package/dist/frontend/types.js +0 -15
- package/dist/frontend/types.js.map +0 -1
- package/dist/gc/apply.d.ts +0 -26
- package/dist/gc/apply.js +0 -48
- package/dist/gc/apply.js.map +0 -1
- package/dist/gc/canary.d.ts +0 -42
- package/dist/gc/canary.js +0 -134
- package/dist/gc/canary.js.map +0 -1
- package/dist/gc/classify.d.ts +0 -25
- package/dist/gc/classify.js +0 -89
- package/dist/gc/classify.js.map +0 -1
- package/dist/gc/doc-gardening.d.ts +0 -29
- package/dist/gc/doc-gardening.js +0 -146
- package/dist/gc/doc-gardening.js.map +0 -1
- package/dist/gc/frontmatter.d.ts +0 -35
- package/dist/gc/frontmatter.js +0 -111
- package/dist/gc/frontmatter.js.map +0 -1
- package/dist/gc/generator-drift.d.ts +0 -28
- package/dist/gc/generator-drift.js +0 -53
- package/dist/gc/generator-drift.js.map +0 -1
- package/dist/gc/index.d.ts +0 -35
- package/dist/gc/index.js +0 -26
- package/dist/gc/index.js.map +0 -1
- package/dist/gc/quality-update.d.ts +0 -23
- package/dist/gc/quality-update.js +0 -69
- package/dist/gc/quality-update.js.map +0 -1
- package/dist/gc/stub-hits.d.ts +0 -31
- package/dist/gc/stub-hits.js +0 -125
- package/dist/gc/stub-hits.js.map +0 -1
- package/dist/gc/sweep.d.ts +0 -56
- package/dist/gc/sweep.js +0 -178
- package/dist/gc/sweep.js.map +0 -1
- package/dist/gc/types.d.ts +0 -129
- package/dist/gc/types.js +0 -26
- package/dist/gc/types.js.map +0 -1
- package/dist/ground/drift.d.ts +0 -8
- package/dist/ground/drift.js +0 -23
- package/dist/ground/drift.js.map +0 -1
- package/dist/ground/frontmatter.d.ts +0 -20
- package/dist/ground/frontmatter.js +0 -49
- package/dist/ground/frontmatter.js.map +0 -1
- package/dist/ground/glob.d.ts +0 -10
- package/dist/ground/glob.js +0 -46
- package/dist/ground/glob.js.map +0 -1
- package/dist/ground/index.d.ts +0 -14
- package/dist/ground/index.js +0 -10
- package/dist/ground/index.js.map +0 -1
- package/dist/ground/ledgers.d.ts +0 -18
- package/dist/ground/ledgers.js +0 -103
- package/dist/ground/ledgers.js.map +0 -1
- package/dist/ground/manifest.d.ts +0 -10
- package/dist/ground/manifest.js +0 -88
- package/dist/ground/manifest.js.map +0 -1
- package/dist/ground/paths.d.ts +0 -20
- package/dist/ground/paths.js +0 -61
- package/dist/ground/paths.js.map +0 -1
- package/dist/ground/quality-grades.d.ts +0 -11
- package/dist/ground/quality-grades.js +0 -98
- package/dist/ground/quality-grades.js.map +0 -1
- package/dist/ground/schemas.d.ts +0 -306
- package/dist/ground/schemas.js +0 -188
- package/dist/ground/schemas.js.map +0 -1
- package/dist/ground/walk.d.ts +0 -7
- package/dist/ground/walk.js +0 -53
- package/dist/ground/walk.js.map +0 -1
- package/dist/init/detect.d.ts +0 -25
- package/dist/init/detect.js +0 -336
- package/dist/init/detect.js.map +0 -1
- package/dist/init/index.d.ts +0 -14
- package/dist/init/index.js +0 -9
- package/dist/init/index.js.map +0 -1
- package/dist/init/init.d.ts +0 -68
- package/dist/init/init.js +0 -673
- package/dist/init/init.js.map +0 -1
- package/dist/init/mapper.d.ts +0 -160
- package/dist/init/mapper.js +0 -248
- package/dist/init/mapper.js.map +0 -1
- package/dist/init/prompts.d.ts +0 -70
- package/dist/init/prompts.js +0 -80
- package/dist/init/prompts.js.map +0 -1
- package/dist/init/secrets.d.ts +0 -18
- package/dist/init/secrets.js +0 -76
- package/dist/init/secrets.js.map +0 -1
- package/dist/init/seed.d.ts +0 -21
- package/dist/init/seed.js +0 -75
- package/dist/init/seed.js.map +0 -1
- package/dist/init/setup-runners.d.ts +0 -17
- package/dist/init/setup-runners.js +0 -70
- package/dist/init/setup-runners.js.map +0 -1
- package/dist/init/types.d.ts +0 -59
- package/dist/init/types.js +0 -10
- package/dist/init/types.js.map +0 -1
- package/dist/init/walker.d.ts +0 -53
- package/dist/init/walker.js +0 -460
- package/dist/init/walker.js.map +0 -1
- package/dist/init/workflow-block.d.ts +0 -34
- package/dist/init/workflow-block.js +0 -110
- package/dist/init/workflow-block.js.map +0 -1
- package/dist/logger.d.ts +0 -3
- package/dist/logger.js +0 -23
- package/dist/logger.js.map +0 -1
- package/dist/mcp/context.d.ts +0 -16
- package/dist/mcp/context.js +0 -8
- package/dist/mcp/context.js.map +0 -1
- package/dist/mcp/errors.d.ts +0 -17
- package/dist/mcp/errors.js +0 -23
- package/dist/mcp/errors.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -10
- package/dist/mcp/index.js +0 -7
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/path-allowlist.d.ts +0 -25
- package/dist/mcp/path-allowlist.js +0 -66
- package/dist/mcp/path-allowlist.js.map +0 -1
- package/dist/mcp/result.d.ts +0 -8
- package/dist/mcp/result.js +0 -18
- package/dist/mcp/result.js.map +0 -1
- package/dist/mcp/schemas.d.ts +0 -153
- package/dist/mcp/schemas.js +0 -135
- package/dist/mcp/schemas.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -11
- package/dist/mcp/server.js +0 -58
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/telemetry.d.ts +0 -15
- package/dist/mcp/telemetry.js +0 -13
- package/dist/mcp/telemetry.js.map +0 -1
- package/dist/mcp/tools/append.d.ts +0 -8
- package/dist/mcp/tools/append.js +0 -33
- package/dist/mcp/tools/append.js.map +0 -1
- package/dist/mcp/tools/archive.d.ts +0 -8
- package/dist/mcp/tools/archive.js +0 -49
- package/dist/mcp/tools/archive.js.map +0 -1
- package/dist/mcp/tools/ask-operator.d.ts +0 -34
- package/dist/mcp/tools/ask-operator.js +0 -93
- package/dist/mcp/tools/ask-operator.js.map +0 -1
- package/dist/mcp/tools/canonical-for-topic.d.ts +0 -6
- package/dist/mcp/tools/canonical-for-topic.js +0 -40
- package/dist/mcp/tools/canonical-for-topic.js.map +0 -1
- package/dist/mcp/tools/decision-get.d.ts +0 -6
- package/dist/mcp/tools/decision-get.js +0 -49
- package/dist/mcp/tools/decision-get.js.map +0 -1
- package/dist/mcp/tools/decisions-for-symbol.d.ts +0 -7
- package/dist/mcp/tools/decisions-for-symbol.js +0 -42
- package/dist/mcp/tools/decisions-for-symbol.js.map +0 -1
- package/dist/mcp/tools/decisions-in-scope.d.ts +0 -7
- package/dist/mcp/tools/decisions-in-scope.js +0 -47
- package/dist/mcp/tools/decisions-in-scope.js.map +0 -1
- package/dist/mcp/tools/drop-task.d.ts +0 -12
- package/dist/mcp/tools/drop-task.js +0 -47
- package/dist/mcp/tools/drop-task.js.map +0 -1
- package/dist/mcp/tools/get-full.d.ts +0 -7
- package/dist/mcp/tools/get-full.js +0 -46
- package/dist/mcp/tools/get-full.js.map +0 -1
- package/dist/mcp/tools/ground-get.d.ts +0 -7
- package/dist/mcp/tools/ground-get.js +0 -80
- package/dist/mcp/tools/ground-get.js.map +0 -1
- package/dist/mcp/tools/index.d.ts +0 -3
- package/dist/mcp/tools/index.js +0 -44
- package/dist/mcp/tools/index.js.map +0 -1
- package/dist/mcp/tools/invariant-get.d.ts +0 -6
- package/dist/mcp/tools/invariant-get.js +0 -49
- package/dist/mcp/tools/invariant-get.js.map +0 -1
- package/dist/mcp/tools/invariants-in-scope.d.ts +0 -7
- package/dist/mcp/tools/invariants-in-scope.js +0 -65
- package/dist/mcp/tools/invariants-in-scope.js.map +0 -1
- package/dist/mcp/tools/query-history.d.ts +0 -9
- package/dist/mcp/tools/query-history.js +0 -33
- package/dist/mcp/tools/query-history.js.map +0 -1
- package/dist/mcp/tools/record-decision.d.ts +0 -14
- package/dist/mcp/tools/record-decision.js +0 -101
- package/dist/mcp/tools/record-decision.js.map +0 -1
- package/dist/mcp/tools/record-run-event.d.ts +0 -10
- package/dist/mcp/tools/record-run-event.js +0 -28
- package/dist/mcp/tools/record-run-event.js.map +0 -1
- package/dist/mcp/tools/search.d.ts +0 -9
- package/dist/mcp/tools/search.js +0 -165
- package/dist/mcp/tools/search.js.map +0 -1
- package/dist/mcp/tools/supersedes-chain.d.ts +0 -6
- package/dist/mcp/tools/supersedes-chain.js +0 -66
- package/dist/mcp/tools/supersedes-chain.js.map +0 -1
- package/dist/mcp/tools/timeline.d.ts +0 -9
- package/dist/mcp/tools/timeline.js +0 -65
- package/dist/mcp/tools/timeline.js.map +0 -1
- package/dist/mcp/tools/types.d.ts +0 -9
- package/dist/mcp/tools/types.js +0 -2
- package/dist/mcp/tools/types.js.map +0 -1
- package/dist/mirror/clone.d.ts +0 -6
- package/dist/mirror/clone.js +0 -48
- package/dist/mirror/clone.js.map +0 -1
- package/dist/mirror/dirty-overlap.d.ts +0 -13
- package/dist/mirror/dirty-overlap.js +0 -77
- package/dist/mirror/dirty-overlap.js.map +0 -1
- package/dist/mirror/index.d.ts +0 -7
- package/dist/mirror/index.js +0 -7
- package/dist/mirror/index.js.map +0 -1
- package/dist/mirror/paths.d.ts +0 -18
- package/dist/mirror/paths.js +0 -45
- package/dist/mirror/paths.js.map +0 -1
- package/dist/mirror/push.d.ts +0 -9
- package/dist/mirror/push.js +0 -27
- package/dist/mirror/push.js.map +0 -1
- package/dist/mirror/state.d.ts +0 -4
- package/dist/mirror/state.js +0 -36
- package/dist/mirror/state.js.map +0 -1
- package/dist/mirror/sync.d.ts +0 -9
- package/dist/mirror/sync.js +0 -33
- package/dist/mirror/sync.js.map +0 -1
- package/dist/mirror/types.d.ts +0 -77
- package/dist/mirror/types.js +0 -2
- package/dist/mirror/types.js.map +0 -1
- package/dist/orchestrator/activity-summarizer.d.ts +0 -33
- package/dist/orchestrator/activity-summarizer.js +0 -120
- package/dist/orchestrator/activity-summarizer.js.map +0 -1
- package/dist/orchestrator/inbox.d.ts +0 -78
- package/dist/orchestrator/inbox.js +0 -115
- package/dist/orchestrator/inbox.js.map +0 -1
- package/dist/orchestrator/index.d.ts +0 -9
- package/dist/orchestrator/index.js +0 -7
- package/dist/orchestrator/index.js.map +0 -1
- package/dist/orchestrator/orchestrator.d.ts +0 -154
- package/dist/orchestrator/orchestrator.js +0 -2437
- package/dist/orchestrator/orchestrator.js.map +0 -1
- package/dist/orchestrator/prompt.d.ts +0 -19
- package/dist/orchestrator/prompt.js +0 -50
- package/dist/orchestrator/prompt.js.map +0 -1
- package/dist/orchestrator/queue.d.ts +0 -21
- package/dist/orchestrator/queue.js +0 -80
- package/dist/orchestrator/queue.js.map +0 -1
- package/dist/orchestrator/run-log.d.ts +0 -53
- package/dist/orchestrator/run-log.js +0 -92
- package/dist/orchestrator/run-log.js.map +0 -1
- package/dist/orchestrator/runner.d.ts +0 -56
- package/dist/orchestrator/runner.js +0 -172
- package/dist/orchestrator/runner.js.map +0 -1
- package/dist/orchestrator/tool-digest.d.ts +0 -35
- package/dist/orchestrator/tool-digest.js +0 -116
- package/dist/orchestrator/tool-digest.js.map +0 -1
- package/dist/orchestrator/types.d.ts +0 -263
- package/dist/orchestrator/types.js +0 -2
- package/dist/orchestrator/types.js.map +0 -1
- package/dist/orchestrator/workspace.d.ts +0 -21
- package/dist/orchestrator/workspace.js +0 -31
- package/dist/orchestrator/workspace.js.map +0 -1
- package/dist/profiles/index.d.ts +0 -3
- package/dist/profiles/index.js +0 -3
- package/dist/profiles/index.js.map +0 -1
- package/dist/profiles/registry.d.ts +0 -5
- package/dist/profiles/registry.js +0 -31
- package/dist/profiles/registry.js.map +0 -1
- package/dist/profiles/types.d.ts +0 -48
- package/dist/profiles/types.js +0 -11
- package/dist/profiles/types.js.map +0 -1
- package/dist/profiles/unknown.d.ts +0 -9
- package/dist/profiles/unknown.js +0 -17
- package/dist/profiles/unknown.js.map +0 -1
- package/dist/reviewer/index.d.ts +0 -6
- package/dist/reviewer/index.js +0 -5
- package/dist/reviewer/index.js.map +0 -1
- package/dist/reviewer/prompt.d.ts +0 -11
- package/dist/reviewer/prompt.js +0 -132
- package/dist/reviewer/prompt.js.map +0 -1
- package/dist/reviewer/remediation.d.ts +0 -15
- package/dist/reviewer/remediation.js +0 -61
- package/dist/reviewer/remediation.js.map +0 -1
- package/dist/reviewer/reviewer.d.ts +0 -9
- package/dist/reviewer/reviewer.js +0 -89
- package/dist/reviewer/reviewer.js.map +0 -1
- package/dist/reviewer/schema.d.ts +0 -45
- package/dist/reviewer/schema.js +0 -43
- package/dist/reviewer/schema.js.map +0 -1
- package/dist/reviewer/types.d.ts +0 -74
- package/dist/reviewer/types.js +0 -14
- package/dist/reviewer/types.js.map +0 -1
- package/dist/sensors/attestation.d.ts +0 -44
- package/dist/sensors/attestation.js +0 -262
- package/dist/sensors/attestation.js.map +0 -1
- package/dist/sensors/catalog.d.ts +0 -41
- package/dist/sensors/catalog.js +0 -123
- package/dist/sensors/catalog.js.map +0 -1
- package/dist/sensors/decisions.d.ts +0 -30
- package/dist/sensors/decisions.js +0 -393
- package/dist/sensors/decisions.js.map +0 -1
- package/dist/sensors/diff.d.ts +0 -27
- package/dist/sensors/diff.js +0 -148
- package/dist/sensors/diff.js.map +0 -1
- package/dist/sensors/index.d.ts +0 -13
- package/dist/sensors/index.js +0 -9
- package/dist/sensors/index.js.map +0 -1
- package/dist/sensors/remediation.d.ts +0 -20
- package/dist/sensors/remediation.js +0 -65
- package/dist/sensors/remediation.js.map +0 -1
- package/dist/sensors/runner.d.ts +0 -44
- package/dist/sensors/runner.js +0 -95
- package/dist/sensors/runner.js.map +0 -1
- package/dist/sensors/structural.d.ts +0 -30
- package/dist/sensors/structural.js +0 -204
- package/dist/sensors/structural.js.map +0 -1
- package/dist/sensors/stub-catalog.d.ts +0 -39
- package/dist/sensors/stub-catalog.js +0 -115
- package/dist/sensors/stub-catalog.js.map +0 -1
- package/dist/sensors/types.d.ts +0 -135
- package/dist/sensors/types.js +0 -14
- package/dist/sensors/types.js.map +0 -1
- package/dist/tier0/classify.d.ts +0 -5
- package/dist/tier0/classify.js +0 -91
- package/dist/tier0/classify.js.map +0 -1
- package/dist/tier0/index.d.ts +0 -3
- package/dist/tier0/index.js +0 -3
- package/dist/tier0/index.js.map +0 -1
- package/dist/tier0/ollama.d.ts +0 -22
- package/dist/tier0/ollama.js +0 -63
- package/dist/tier0/ollama.js.map +0 -1
- package/dist/tier0/types.d.ts +0 -24
- package/dist/tier0/types.js +0 -7
- package/dist/tier0/types.js.map +0 -1
- package/dist/tightener/index.d.ts +0 -4
- package/dist/tightener/index.js +0 -4
- package/dist/tightener/index.js.map +0 -1
- package/dist/tightener/prompt.d.ts +0 -3
- package/dist/tightener/prompt.js +0 -67
- package/dist/tightener/prompt.js.map +0 -1
- package/dist/tightener/schema.d.ts +0 -68
- package/dist/tightener/schema.js +0 -44
- package/dist/tightener/schema.js.map +0 -1
- package/dist/tightener/tighten.d.ts +0 -2
- package/dist/tightener/tighten.js +0 -66
- package/dist/tightener/tighten.js.map +0 -1
- package/dist/tightener/types.d.ts +0 -74
- package/dist/tightener/types.js +0 -6
- package/dist/tightener/types.js.map +0 -1
- package/dist/uat/bundle.d.ts +0 -68
- package/dist/uat/bundle.js +0 -168
- package/dist/uat/bundle.js.map +0 -1
- package/dist/uat/index.d.ts +0 -15
- package/dist/uat/index.js +0 -10
- package/dist/uat/index.js.map +0 -1
- package/dist/uat/persistent.d.ts +0 -64
- package/dist/uat/persistent.js +0 -206
- package/dist/uat/persistent.js.map +0 -1
- package/dist/uat/probes/cli.d.ts +0 -11
- package/dist/uat/probes/cli.js +0 -107
- package/dist/uat/probes/cli.js.map +0 -1
- package/dist/uat/probes/http.d.ts +0 -12
- package/dist/uat/probes/http.js +0 -139
- package/dist/uat/probes/http.js.map +0 -1
- package/dist/uat/probes/index.d.ts +0 -21
- package/dist/uat/probes/index.js +0 -30
- package/dist/uat/probes/index.js.map +0 -1
- package/dist/uat/probes/integration.d.ts +0 -18
- package/dist/uat/probes/integration.js +0 -188
- package/dist/uat/probes/integration.js.map +0 -1
- package/dist/uat/probes/sql/config.d.ts +0 -14
- package/dist/uat/probes/sql/config.js +0 -57
- package/dist/uat/probes/sql/config.js.map +0 -1
- package/dist/uat/probes/sql/index.d.ts +0 -29
- package/dist/uat/probes/sql/index.js +0 -43
- package/dist/uat/probes/sql/index.js.map +0 -1
- package/dist/uat/probes/sql/mysql.d.ts +0 -12
- package/dist/uat/probes/sql/mysql.js +0 -96
- package/dist/uat/probes/sql/mysql.js.map +0 -1
- package/dist/uat/probes/sql/pg.d.ts +0 -20
- package/dist/uat/probes/sql/pg.js +0 -102
- package/dist/uat/probes/sql/pg.js.map +0 -1
- package/dist/uat/probes/sql/sqlite.d.ts +0 -9
- package/dist/uat/probes/sql/sqlite.js +0 -58
- package/dist/uat/probes/sql/sqlite.js.map +0 -1
- package/dist/uat/probes/sql/types.d.ts +0 -46
- package/dist/uat/probes/sql/types.js +0 -10
- package/dist/uat/probes/sql/types.js.map +0 -1
- package/dist/uat/probes/sql.d.ts +0 -9
- package/dist/uat/probes/sql.js +0 -119
- package/dist/uat/probes/sql.js.map +0 -1
- package/dist/uat/probes/ui.d.ts +0 -19
- package/dist/uat/probes/ui.js +0 -244
- package/dist/uat/probes/ui.js.map +0 -1
- package/dist/uat/prompt.d.ts +0 -10
- package/dist/uat/prompt.js +0 -85
- package/dist/uat/prompt.js.map +0 -1
- package/dist/uat/question.d.ts +0 -50
- package/dist/uat/question.js +0 -139
- package/dist/uat/question.js.map +0 -1
- package/dist/uat/rejection.d.ts +0 -58
- package/dist/uat/rejection.js +0 -163
- package/dist/uat/rejection.js.map +0 -1
- package/dist/uat/runner.d.ts +0 -6
- package/dist/uat/runner.js +0 -96
- package/dist/uat/runner.js.map +0 -1
- package/dist/uat/schema.d.ts +0 -322
- package/dist/uat/schema.js +0 -189
- package/dist/uat/schema.js.map +0 -1
- package/dist/uat/types.d.ts +0 -268
- package/dist/uat/types.js +0 -18
- package/dist/uat/types.js.map +0 -1
- package/dist/uat/uat.d.ts +0 -89
- package/dist/uat/uat.js +0 -256
- package/dist/uat/uat.js.map +0 -1
- package/dist/voice/index.d.ts +0 -4
- package/dist/voice/index.js +0 -4
- package/dist/voice/index.js.map +0 -1
- package/dist/voice/model.d.ts +0 -23
- package/dist/voice/model.js +0 -46
- package/dist/voice/model.js.map +0 -1
- package/dist/voice/pipe.d.ts +0 -9
- package/dist/voice/pipe.js +0 -47
- package/dist/voice/pipe.js.map +0 -1
- package/dist/voice/transcribe.d.ts +0 -3
- package/dist/voice/transcribe.js +0 -43
- package/dist/voice/transcribe.js.map +0 -1
- package/dist/voice/types.d.ts +0 -26
- package/dist/voice/types.js +0 -9
- package/dist/voice/types.js.map +0 -1
- package/dist/watch/daemon.d.ts +0 -21
- package/dist/watch/daemon.js +0 -143
- package/dist/watch/daemon.js.map +0 -1
- package/dist/watch/index.d.ts +0 -4
- package/dist/watch/index.js +0 -3
- package/dist/watch/index.js.map +0 -1
- package/dist/watch/regenerate.d.ts +0 -25
- package/dist/watch/regenerate.js +0 -51
- package/dist/watch/regenerate.js.map +0 -1
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decision-assertions sensor.
|
|
3
|
-
*
|
|
4
|
-
* For every accepted decision whose `scope_globs` overlap the diff, evaluate
|
|
5
|
-
* each machine-readable `assertion` against the post-change repository state.
|
|
6
|
-
* Failure quotes the failing assertion id + decision id + the contradicting
|
|
7
|
-
* line.
|
|
8
|
-
*
|
|
9
|
-
* Per L26+L41 — 11 assertion kinds. AST-level precision is v2; this module
|
|
10
|
-
* uses regex-based approximations and surfaces soft findings when it cannot
|
|
11
|
-
* verify with confidence (the reviewer subagent in Phase 10 catches the rest).
|
|
12
|
-
*/
|
|
13
|
-
import { execSync } from "node:child_process";
|
|
14
|
-
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
15
|
-
import { join } from "node:path";
|
|
16
|
-
import { matchAnyGlob } from "../ground/glob.js";
|
|
17
|
-
import { parseFrontmatter } from "../ground/frontmatter.js";
|
|
18
|
-
import { decisionsDir } from "../ground/paths.js";
|
|
19
|
-
import { DecisionFrontmatter, } from "../ground/schemas.js";
|
|
20
|
-
const SENSOR_ID = "decision-assertions";
|
|
21
|
-
/** All decisions accepted at HEAD with parsed frontmatter. */
|
|
22
|
-
export function loadAcceptedDecisions(repoRoot) {
|
|
23
|
-
const dir = decisionsDir(repoRoot);
|
|
24
|
-
if (!existsSync(dir))
|
|
25
|
-
return [];
|
|
26
|
-
let dirents;
|
|
27
|
-
try {
|
|
28
|
-
dirents = readdirSync(dir, { withFileTypes: true, encoding: "utf8" });
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
const out = [];
|
|
34
|
-
for (const d of dirents) {
|
|
35
|
-
if (!d.isFile())
|
|
36
|
-
continue;
|
|
37
|
-
if (!d.name.endsWith(".md"))
|
|
38
|
-
continue;
|
|
39
|
-
if (d.name.startsWith("_"))
|
|
40
|
-
continue;
|
|
41
|
-
const abs = join(dir, d.name);
|
|
42
|
-
const fm = parseFrontmatter(readFileSync(abs, "utf8")).frontmatter;
|
|
43
|
-
const parsed = DecisionFrontmatter.safeParse(fm);
|
|
44
|
-
if (!parsed.success)
|
|
45
|
-
continue;
|
|
46
|
-
if (parsed.data.status !== "accepted")
|
|
47
|
-
continue;
|
|
48
|
-
if (parsed.data.superseded_by)
|
|
49
|
-
continue;
|
|
50
|
-
out.push(parsed.data);
|
|
51
|
-
}
|
|
52
|
-
return out;
|
|
53
|
-
}
|
|
54
|
-
/** Decisions whose scope_globs overlap the diff. */
|
|
55
|
-
export function decisionsInScope(decisions, diff) {
|
|
56
|
-
return decisions.filter((d) => {
|
|
57
|
-
const globs = d.scope_globs ?? [];
|
|
58
|
-
if (globs.length === 0)
|
|
59
|
-
return true; // no scope = applies everywhere
|
|
60
|
-
return diff.some((entry) => matchAnyGlob(entry.path, globs));
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/** Read every tracked file in the mirror once, lazy. */
|
|
64
|
-
class MirrorFileReader {
|
|
65
|
-
mirrorPath;
|
|
66
|
-
cache = new Map();
|
|
67
|
-
constructor(mirrorPath) {
|
|
68
|
-
this.mirrorPath = mirrorPath;
|
|
69
|
-
}
|
|
70
|
-
read(relPath) {
|
|
71
|
-
const cached = this.cache.get(relPath);
|
|
72
|
-
if (cached !== undefined)
|
|
73
|
-
return cached;
|
|
74
|
-
try {
|
|
75
|
-
const text = readFileSync(join(this.mirrorPath, relPath), "utf8");
|
|
76
|
-
this.cache.set(relPath, text);
|
|
77
|
-
return text;
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
this.cache.set(relPath, "");
|
|
81
|
-
return "";
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Walk the mirror once and list every tracked file (not gitignored). This is
|
|
87
|
-
* used by assertion kinds that need to scan beyond the diff (e.g. when the
|
|
88
|
-
* assertion targets a file the agent didn't change).
|
|
89
|
-
*/
|
|
90
|
-
export function listMirrorFiles(mirrorPath) {
|
|
91
|
-
// Use git ls-files synchronously for simplicity. simple-git's async API is
|
|
92
|
-
// available too; we keep this synchronous so assertion evaluation remains
|
|
93
|
-
// a tight loop. Plus untracked-but-not-ignored, since the agent's new
|
|
94
|
-
// files won't be tracked yet at sensor time.
|
|
95
|
-
try {
|
|
96
|
-
const tracked = execSync("git ls-files", {
|
|
97
|
-
cwd: mirrorPath,
|
|
98
|
-
encoding: "utf8",
|
|
99
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
100
|
-
});
|
|
101
|
-
const untracked = execSync("git ls-files --others --exclude-standard", {
|
|
102
|
-
cwd: mirrorPath,
|
|
103
|
-
encoding: "utf8",
|
|
104
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
105
|
-
});
|
|
106
|
-
return [...tracked.split("\n"), ...untracked.split("\n")]
|
|
107
|
-
.map((s) => s.trim())
|
|
108
|
-
.filter((s) => s.length > 0);
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/** Run the decision-assertions sensor. */
|
|
115
|
-
export function runDecisionAssertions(args) {
|
|
116
|
-
const startedAt = Date.now();
|
|
117
|
-
const findings = [];
|
|
118
|
-
const reader = new MirrorFileReader(args.mirrorPath);
|
|
119
|
-
const allFiles = listMirrorFiles(args.mirrorPath);
|
|
120
|
-
for (const decision of args.decisions) {
|
|
121
|
-
const assertions = decision.assertions ?? [];
|
|
122
|
-
for (const a of assertions) {
|
|
123
|
-
const result = evaluateAssertion({
|
|
124
|
-
mirrorPath: args.mirrorPath,
|
|
125
|
-
decision,
|
|
126
|
-
assertion: a,
|
|
127
|
-
diff: args.diff,
|
|
128
|
-
reader,
|
|
129
|
-
allFiles,
|
|
130
|
-
});
|
|
131
|
-
if (result === null)
|
|
132
|
-
continue;
|
|
133
|
-
findings.push(result);
|
|
134
|
-
}
|
|
135
|
-
// human_review_hint at the decision level (not assertion-level).
|
|
136
|
-
if (decision.human_review_hint) {
|
|
137
|
-
findings.push({
|
|
138
|
-
sensor_id: SENSOR_ID,
|
|
139
|
-
decision_id: decision.id,
|
|
140
|
-
message: `human-review hint for ${decision.id}: ${decision.human_review_hint}`,
|
|
141
|
-
severity: "soft",
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const ok = findings.every((f) => f.severity !== "hard");
|
|
146
|
-
return {
|
|
147
|
-
sensor_id: SENSOR_ID,
|
|
148
|
-
ok,
|
|
149
|
-
duration_ms: Date.now() - startedAt,
|
|
150
|
-
findings,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function evaluateAssertion(args) {
|
|
154
|
-
const a = args.assertion;
|
|
155
|
-
const ctx = { decision_id: args.decision.id, assertion_id: a.id };
|
|
156
|
-
switch (a.kind) {
|
|
157
|
-
case "schema_must_contain": {
|
|
158
|
-
const candidates = args.allFiles.filter((p) => /\.(sql|prisma|ts|py|rb)$/i.test(p));
|
|
159
|
-
const tableRe = new RegExp(`\\b${escapeReg(a.table)}\\b`);
|
|
160
|
-
const columnRe = new RegExp(`\\b${escapeReg(a.column)}\\b`);
|
|
161
|
-
for (const path of candidates) {
|
|
162
|
-
const text = args.reader.read(path);
|
|
163
|
-
if (!text || !tableRe.test(text) || !columnRe.test(text))
|
|
164
|
-
continue;
|
|
165
|
-
// Co-locate within ±10 lines.
|
|
166
|
-
const lines = text.split(/\r?\n/);
|
|
167
|
-
for (let i = 0; i < lines.length; i++) {
|
|
168
|
-
if (!tableRe.test(lines[i] ?? ""))
|
|
169
|
-
continue;
|
|
170
|
-
const lo = Math.max(0, i - 10);
|
|
171
|
-
const hi = Math.min(lines.length - 1, i + 10);
|
|
172
|
-
for (let j = lo; j <= hi; j++) {
|
|
173
|
-
if (columnRe.test(lines[j] ?? ""))
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} requires schema column \`${a.table}.${a.column}\` — not found in mirror`, ctx);
|
|
179
|
-
}
|
|
180
|
-
case "text_must_match": {
|
|
181
|
-
const re = safeRegex(a.pattern);
|
|
182
|
-
if (!re)
|
|
183
|
-
return finding("soft", `${ctx.decision_id}/${ctx.assertion_id} pattern unparseable`, ctx);
|
|
184
|
-
const inScope = args.allFiles.filter((p) => matchAnyGlob(p, a.in_globs));
|
|
185
|
-
for (const path of inScope) {
|
|
186
|
-
if (re.test(args.reader.read(path)))
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} text_must_match \`${a.pattern}\` — no file under ${a.in_globs.join(", ")} matches`, ctx);
|
|
190
|
-
}
|
|
191
|
-
case "text_must_not_match": {
|
|
192
|
-
const re = safeRegex(a.pattern);
|
|
193
|
-
if (!re)
|
|
194
|
-
return finding("soft", `${ctx.decision_id}/${ctx.assertion_id} pattern unparseable`, ctx);
|
|
195
|
-
const inScope = args.allFiles.filter((p) => matchAnyGlob(p, a.in_globs));
|
|
196
|
-
for (const path of inScope) {
|
|
197
|
-
const text = args.reader.read(path);
|
|
198
|
-
const m = re.exec(text);
|
|
199
|
-
if (!m)
|
|
200
|
-
continue;
|
|
201
|
-
const line = lineOf(text, m.index);
|
|
202
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} text_must_not_match \`${a.pattern}\` — matched at ${path}:${line}`, { ...ctx, path, line, matched_text: m[0] });
|
|
203
|
-
}
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
case "index_must_exist": {
|
|
207
|
-
const candidates = args.allFiles.filter((p) => /\.(sql|prisma|ts|py|rb)$/i.test(p));
|
|
208
|
-
const colsPattern = a.columns
|
|
209
|
-
.map((c) => `(?=.*\\b${escapeReg(c)}\\b)`)
|
|
210
|
-
.join("");
|
|
211
|
-
const re = new RegExp(`(?:CREATE\\s+(?:UNIQUE\\s+)?INDEX|index\\s*\\(.*\\bon\\s*:?\\s*['"\`]${escapeReg(a.table)}['"\`])[\\s\\S]{0,400}\\b${escapeReg(a.table)}\\b[\\s\\S]{0,400}${colsPattern}`, "i");
|
|
212
|
-
for (const path of candidates) {
|
|
213
|
-
const text = args.reader.read(path);
|
|
214
|
-
if (re.test(text)) {
|
|
215
|
-
if (!a.where)
|
|
216
|
-
return null;
|
|
217
|
-
// If WHERE clause demanded, verify presence in same file.
|
|
218
|
-
if (text.toLowerCase().includes(a.where.toLowerCase()))
|
|
219
|
-
return null;
|
|
220
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} index_must_exist on ${a.table}(${a.columns.join(", ")}) WHERE ${a.where} — partial-index predicate not present in ${path}`, { ...ctx, path });
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} index_must_exist on ${a.table}(${a.columns.join(", ")}) — not found in any schema-like file`, ctx);
|
|
224
|
-
}
|
|
225
|
-
case "ast_pattern": {
|
|
226
|
-
// v1 fallback: regex over in_globs, language ignored beyond filtering.
|
|
227
|
-
const re = safeRegex(a.pattern);
|
|
228
|
-
if (!re)
|
|
229
|
-
return finding("soft", `${ctx.decision_id}/${ctx.assertion_id} pattern unparseable`, ctx);
|
|
230
|
-
const inScope = args.allFiles.filter((p) => matchAnyGlob(p, a.in_globs));
|
|
231
|
-
for (const path of inScope) {
|
|
232
|
-
if (re.test(args.reader.read(path)))
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} ast_pattern (lang=${a.language}) \`${a.pattern}\` — no match under ${a.in_globs.join(", ")}`, ctx);
|
|
236
|
-
}
|
|
237
|
-
case "file_must_not_be_modified": {
|
|
238
|
-
const hit = args.diff.find((d) => d.path === a.path);
|
|
239
|
-
if (!hit)
|
|
240
|
-
return null;
|
|
241
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} file_must_not_be_modified — ${a.path} appears in diff (${hit.status})`, { ...ctx, path: a.path });
|
|
242
|
-
}
|
|
243
|
-
case "query_must_filter_by": {
|
|
244
|
-
// Approximate: search in_globs for table + each column appearing in the
|
|
245
|
-
// same statement-ish window. For ORM=drizzle: `.where(and(...col1...col2...))`.
|
|
246
|
-
const inScope = args.allFiles.filter((p) => matchAnyGlob(p, a.in_globs));
|
|
247
|
-
const tableRef = new RegExp(`\\b${escapeReg(a.table)}\\b`);
|
|
248
|
-
const combinator = a.require_combination === "and" ? /\band\s*\(/i : /\bor\s*\(/i;
|
|
249
|
-
let anyHit = false;
|
|
250
|
-
for (const path of inScope) {
|
|
251
|
-
const text = args.reader.read(path);
|
|
252
|
-
if (!tableRef.test(text))
|
|
253
|
-
continue;
|
|
254
|
-
anyHit = true;
|
|
255
|
-
// Find each `where(` window of 400 chars and check all columns.
|
|
256
|
-
const whereRe = /\.where\s*\(/g;
|
|
257
|
-
let m;
|
|
258
|
-
let allPresent = true;
|
|
259
|
-
let saw = false;
|
|
260
|
-
while ((m = whereRe.exec(text)) !== null) {
|
|
261
|
-
saw = true;
|
|
262
|
-
const win = text.slice(m.index, Math.min(text.length, m.index + 600));
|
|
263
|
-
if (a.require_combination !== undefined && !combinator.test(win)) {
|
|
264
|
-
allPresent = false;
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
for (const col of a.columns) {
|
|
268
|
-
if (!new RegExp(`\\b${escapeReg(col)}\\b`).test(win)) {
|
|
269
|
-
allPresent = false;
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (!allPresent)
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
if (!saw)
|
|
277
|
-
continue;
|
|
278
|
-
if (allPresent)
|
|
279
|
-
return null;
|
|
280
|
-
const line = lineOf(text, (whereRe.exec(text) ?? { index: 0 }).index);
|
|
281
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} query_must_filter_by(${a.table}, [${a.columns.join(", ")}], ${a.require_combination}) — query in ${path}:${line} omits required column(s)`, { ...ctx, path, line });
|
|
282
|
-
}
|
|
283
|
-
if (!anyHit) {
|
|
284
|
-
return finding("soft", `${ctx.decision_id}/${ctx.assertion_id} query_must_filter_by(${a.table}) — no query referencing this table found in scope; nothing to verify`, ctx);
|
|
285
|
-
}
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
case "route_must_have_guard": {
|
|
289
|
-
const inScope = args.allFiles.filter((p) => matchAnyGlob(p, a.in_globs));
|
|
290
|
-
for (const path of inScope) {
|
|
291
|
-
const text = args.reader.read(path);
|
|
292
|
-
for (const required of a.require_on) {
|
|
293
|
-
// Look for the required hook (e.g. method name, decorator) and
|
|
294
|
-
// verify guard appears within 5 preceding lines.
|
|
295
|
-
const lines = text.split(/\r?\n/);
|
|
296
|
-
for (let i = 0; i < lines.length; i++) {
|
|
297
|
-
const line = lines[i] ?? "";
|
|
298
|
-
if (!line.includes(required))
|
|
299
|
-
continue;
|
|
300
|
-
const lo = Math.max(0, i - 8);
|
|
301
|
-
const window = lines.slice(lo, i + 1).join("\n");
|
|
302
|
-
if (window.includes(a.guard))
|
|
303
|
-
continue;
|
|
304
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} route_must_have_guard \`${a.guard}\` — \`${required}\` at ${path}:${i + 1} is not preceded by the guard`, { ...ctx, path, line: i + 1 });
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
case "event_must_emit": {
|
|
311
|
-
const inScope = args.allFiles.filter((p) => matchAnyGlob(p, a.in_globs));
|
|
312
|
-
let any = false;
|
|
313
|
-
for (const path of inScope) {
|
|
314
|
-
const text = args.reader.read(path);
|
|
315
|
-
const callRe = new RegExp(`\\b${escapeReg(a.after_method)}\\s*\\(`);
|
|
316
|
-
if (!callRe.test(text))
|
|
317
|
-
continue;
|
|
318
|
-
any = true;
|
|
319
|
-
const emitRe = new RegExp(`\\.emit\\s*\\(\\s*['"\`]${escapeReg(a.event_key)}['"\`]`);
|
|
320
|
-
if (!emitRe.test(text)) {
|
|
321
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} event_must_emit \`${a.event_key}\` after \`${a.after_method}\` — no .emit() found in ${path}`, { ...ctx, path });
|
|
322
|
-
}
|
|
323
|
-
if (a.payload_must_include && a.payload_must_include.length > 0) {
|
|
324
|
-
for (const field of a.payload_must_include) {
|
|
325
|
-
if (!new RegExp(`\\b${escapeReg(field)}\\b`).test(text)) {
|
|
326
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} event_must_emit payload missing field \`${field}\` in ${path}`, { ...ctx, path });
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
if (!any) {
|
|
332
|
-
return finding("soft", `${ctx.decision_id}/${ctx.assertion_id} event_must_emit — no call to \`${a.after_method}\` found in scope; nothing to verify`, ctx);
|
|
333
|
-
}
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
case "service_method_must_call": {
|
|
337
|
-
const inScope = args.allFiles.filter((p) => matchAnyGlob(p, a.in_globs));
|
|
338
|
-
for (const path of inScope) {
|
|
339
|
-
const text = args.reader.read(path);
|
|
340
|
-
const methodRe = new RegExp(`\\b${escapeReg(a.in_method)}\\s*\\([^)]*\\)\\s*(?::\\s*[^{]+)?\\{([\\s\\S]*?)\\n\\s*\\}`);
|
|
341
|
-
const m = methodRe.exec(text);
|
|
342
|
-
if (!m)
|
|
343
|
-
continue;
|
|
344
|
-
const body = m[1] ?? "";
|
|
345
|
-
const callRe = new RegExp(`\\b${escapeReg(a.must_call)}\\s*\\(`);
|
|
346
|
-
if (callRe.test(body))
|
|
347
|
-
return null;
|
|
348
|
-
const line = lineOf(text, m.index);
|
|
349
|
-
return finding("hard", `${ctx.decision_id}/${ctx.assertion_id} service_method_must_call — method \`${a.in_method}\` at ${path}:${line} does not call \`${a.must_call}\``, { ...ctx, path, line });
|
|
350
|
-
}
|
|
351
|
-
return finding("soft", `${ctx.decision_id}/${ctx.assertion_id} service_method_must_call — method \`${a.in_method}\` not found in scope; nothing to verify`, ctx);
|
|
352
|
-
}
|
|
353
|
-
case "human_review_hint": {
|
|
354
|
-
return finding("soft", `${ctx.decision_id}/${ctx.assertion_id} human-review hint: ${a.description}`, ctx);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
function finding(severity, message, ctx) {
|
|
359
|
-
const f = {
|
|
360
|
-
sensor_id: SENSOR_ID,
|
|
361
|
-
decision_id: ctx.decision_id,
|
|
362
|
-
assertion_id: ctx.assertion_id,
|
|
363
|
-
message,
|
|
364
|
-
severity,
|
|
365
|
-
};
|
|
366
|
-
if (ctx.path !== undefined)
|
|
367
|
-
f.path = ctx.path;
|
|
368
|
-
if (ctx.line !== undefined)
|
|
369
|
-
f.line = ctx.line;
|
|
370
|
-
if (ctx.matched_text !== undefined)
|
|
371
|
-
f.matched_text = ctx.matched_text;
|
|
372
|
-
return f;
|
|
373
|
-
}
|
|
374
|
-
function escapeReg(s) {
|
|
375
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
376
|
-
}
|
|
377
|
-
function safeRegex(p) {
|
|
378
|
-
try {
|
|
379
|
-
return new RegExp(p, "m");
|
|
380
|
-
}
|
|
381
|
-
catch {
|
|
382
|
-
return null;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
function lineOf(text, charIndex) {
|
|
386
|
-
let line = 1;
|
|
387
|
-
for (let i = 0; i < charIndex && i < text.length; i++) {
|
|
388
|
-
if (text.charCodeAt(i) === 10)
|
|
389
|
-
line += 1;
|
|
390
|
-
}
|
|
391
|
-
return line;
|
|
392
|
-
}
|
|
393
|
-
//# sourceMappingURL=decisions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decisions.js","sourceRoot":"","sources":["../../src/sensors/decisions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAe,UAAU,EAAE,WAAW,EAA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tE,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,IAAI,CAAC;QACH,OAAO,IAAI,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,SAAiB;IAC7C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtD,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE;YAAE,IAAI,IAAI,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/sensors/diff.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Diff acquisition — read agent's working-tree changes against the SHA pin.
|
|
3
|
-
*
|
|
4
|
-
* The agent mutates files in the mirror but never commits. So `git diff
|
|
5
|
-
* <sha_pin>` gives tracked-file changes; `git ls-files --others
|
|
6
|
-
* --exclude-standard` gives newly-created files. Both contribute to the
|
|
7
|
-
* sensor input.
|
|
8
|
-
*/
|
|
9
|
-
import type { DiffEntry } from "./types.js";
|
|
10
|
-
/**
|
|
11
|
-
* Compute the diff between the SHA pin and the current working tree (incl.
|
|
12
|
-
* untracked files). The agent does not commit, so working tree is the source.
|
|
13
|
-
*
|
|
14
|
-
* For renames, simple-git surfaces both an `R` entry. We treat it as the new
|
|
15
|
-
* path, with `fromPath` carrying the original.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getDiff(args: {
|
|
18
|
-
mirrorPath: string;
|
|
19
|
-
shaPin: string;
|
|
20
|
-
}): Promise<DiffEntry[]>;
|
|
21
|
-
/** True iff any changed file's path matches any of the supplied globs. */
|
|
22
|
-
export declare function diffHasGlobMatch(diff: DiffEntry[], globs: readonly string[], matcher: (path: string, glob: string) => boolean): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Filter a diff to entries whose path matches any of the supplied globs.
|
|
25
|
-
* Useful for layered sensors that scope to e.g. route_handler_globs.
|
|
26
|
-
*/
|
|
27
|
-
export declare function filterDiffByGlobs(diff: DiffEntry[], globs: readonly string[], matcher: (path: string, glob: string) => boolean): DiffEntry[];
|
package/dist/sensors/diff.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Diff acquisition — read agent's working-tree changes against the SHA pin.
|
|
3
|
-
*
|
|
4
|
-
* The agent mutates files in the mirror but never commits. So `git diff
|
|
5
|
-
* <sha_pin>` gives tracked-file changes; `git ls-files --others
|
|
6
|
-
* --exclude-standard` gives newly-created files. Both contribute to the
|
|
7
|
-
* sensor input.
|
|
8
|
-
*/
|
|
9
|
-
import { readFile } from "node:fs/promises";
|
|
10
|
-
import { join } from "node:path";
|
|
11
|
-
import { simpleGit } from "simple-git";
|
|
12
|
-
function parseNameStatus(out) {
|
|
13
|
-
const result = [];
|
|
14
|
-
for (const raw of out.split("\n")) {
|
|
15
|
-
const line = raw.trim();
|
|
16
|
-
if (line.length === 0)
|
|
17
|
-
continue;
|
|
18
|
-
// Format: A\tpath, M\tpath, D\tpath, R<score>\tfrom\tto
|
|
19
|
-
const parts = line.split(/\t/);
|
|
20
|
-
const head = parts[0] ?? "";
|
|
21
|
-
if (head.startsWith("A"))
|
|
22
|
-
result.push({ status: "A", path: parts[1] ?? "" });
|
|
23
|
-
else if (head.startsWith("M"))
|
|
24
|
-
result.push({ status: "M", path: parts[1] ?? "" });
|
|
25
|
-
else if (head.startsWith("D"))
|
|
26
|
-
result.push({ status: "D", path: parts[1] ?? "" });
|
|
27
|
-
else if (head.startsWith("R")) {
|
|
28
|
-
result.push({
|
|
29
|
-
status: "R",
|
|
30
|
-
path: parts[2] ?? "",
|
|
31
|
-
fromPath: parts[1] ?? "",
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
/** Best-effort read; returns undefined when the file is absent. */
|
|
38
|
-
async function readMaybe(path) {
|
|
39
|
-
try {
|
|
40
|
-
return await readFile(path, "utf8");
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
if (err.code === "ENOENT")
|
|
44
|
-
return undefined;
|
|
45
|
-
throw err;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/** `git show <sha>:<path>` returning undefined if path didn't exist at sha. */
|
|
49
|
-
async function showAtSha(git, sha, path) {
|
|
50
|
-
try {
|
|
51
|
-
return await git.show([`${sha}:${path}`]);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Compute the diff between the SHA pin and the current working tree (incl.
|
|
59
|
-
* untracked files). The agent does not commit, so working tree is the source.
|
|
60
|
-
*
|
|
61
|
-
* For renames, simple-git surfaces both an `R` entry. We treat it as the new
|
|
62
|
-
* path, with `fromPath` carrying the original.
|
|
63
|
-
*/
|
|
64
|
-
export async function getDiff(args) {
|
|
65
|
-
const git = simpleGit({ baseDir: args.mirrorPath });
|
|
66
|
-
// Tracked changes: diff against shaPin, name-status only first.
|
|
67
|
-
const tracked = await git.raw([
|
|
68
|
-
"diff",
|
|
69
|
-
"--name-status",
|
|
70
|
-
"--find-renames",
|
|
71
|
-
args.shaPin,
|
|
72
|
-
]);
|
|
73
|
-
const trackedRows = parseNameStatus(tracked);
|
|
74
|
-
// Untracked: anything new not in `git diff` against the SHA but present now.
|
|
75
|
-
const untrackedRaw = await git.raw([
|
|
76
|
-
"ls-files",
|
|
77
|
-
"--others",
|
|
78
|
-
"--exclude-standard",
|
|
79
|
-
]);
|
|
80
|
-
const untracked = untrackedRaw
|
|
81
|
-
.split("\n")
|
|
82
|
-
.map((s) => s.trim())
|
|
83
|
-
.filter((s) => s.length > 0);
|
|
84
|
-
// De-dupe untracked vs the diff name-status (a file added since shaPin shows
|
|
85
|
-
// up in BOTH `git diff --name-status` (as A) and ls-files (as untracked)
|
|
86
|
-
// until staged — so we treat ls-files as authoritative for new files).
|
|
87
|
-
const trackedNonAdded = trackedRows.filter((r) => r.status !== "A");
|
|
88
|
-
const trackedAddedPaths = new Set(trackedRows.filter((r) => r.status === "A").map((r) => r.path));
|
|
89
|
-
const out = [];
|
|
90
|
-
for (const row of trackedNonAdded) {
|
|
91
|
-
const abs = join(args.mirrorPath, row.path);
|
|
92
|
-
if (row.status === "D") {
|
|
93
|
-
const before = await showAtSha(git, args.shaPin, row.path);
|
|
94
|
-
const entry = { path: row.path, status: "deleted" };
|
|
95
|
-
if (before !== undefined)
|
|
96
|
-
entry.beforeContent = before;
|
|
97
|
-
out.push(entry);
|
|
98
|
-
}
|
|
99
|
-
else if (row.status === "M") {
|
|
100
|
-
const before = await showAtSha(git, args.shaPin, row.path);
|
|
101
|
-
const after = await readMaybe(abs);
|
|
102
|
-
const entry = { path: row.path, status: "modified" };
|
|
103
|
-
if (before !== undefined)
|
|
104
|
-
entry.beforeContent = before;
|
|
105
|
-
if (after !== undefined)
|
|
106
|
-
entry.afterContent = after;
|
|
107
|
-
out.push(entry);
|
|
108
|
-
}
|
|
109
|
-
else if (row.status === "R") {
|
|
110
|
-
const fromPath = row.fromPath ?? "";
|
|
111
|
-
const before = await showAtSha(git, args.shaPin, fromPath);
|
|
112
|
-
const after = await readMaybe(abs);
|
|
113
|
-
const entry = {
|
|
114
|
-
path: row.path,
|
|
115
|
-
status: "renamed",
|
|
116
|
-
fromPath,
|
|
117
|
-
};
|
|
118
|
-
if (before !== undefined)
|
|
119
|
-
entry.beforeContent = before;
|
|
120
|
-
if (after !== undefined)
|
|
121
|
-
entry.afterContent = after;
|
|
122
|
-
out.push(entry);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// New files: union of `git diff` "A" entries and ls-files untracked.
|
|
126
|
-
const newPaths = new Set([...trackedAddedPaths, ...untracked]);
|
|
127
|
-
for (const path of newPaths) {
|
|
128
|
-
const after = await readMaybe(join(args.mirrorPath, path));
|
|
129
|
-
const entry = { path, status: "added" };
|
|
130
|
-
if (after !== undefined)
|
|
131
|
-
entry.afterContent = after;
|
|
132
|
-
out.push(entry);
|
|
133
|
-
}
|
|
134
|
-
out.sort((a, b) => a.path.localeCompare(b.path));
|
|
135
|
-
return out;
|
|
136
|
-
}
|
|
137
|
-
/** True iff any changed file's path matches any of the supplied globs. */
|
|
138
|
-
export function diffHasGlobMatch(diff, globs, matcher) {
|
|
139
|
-
return diff.some((d) => globs.some((g) => matcher(d.path, g)));
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Filter a diff to entries whose path matches any of the supplied globs.
|
|
143
|
-
* Useful for layered sensors that scope to e.g. route_handler_globs.
|
|
144
|
-
*/
|
|
145
|
-
export function filterDiffByGlobs(diff, globs, matcher) {
|
|
146
|
-
return diff.filter((d) => globs.some((g) => matcher(d.path, g)));
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=diff.js.map
|
package/dist/sensors/diff.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/sensors/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AAUvD,SAAS,eAAe,CAAC,GAAW;IAClC,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,KAA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AAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAC9B,IAAiB,EACjB,KAAwB,EACxB,OAAgD;IAEhD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAiB,EACjB,KAAwB,EACxB,OAAgD;IAEhD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/sensors/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type { Attestation, AttestationDelivered, AttestationDeferred, DiffEntry, ProjectGlobs, SensorFinding, SensorInput, SensorLanguage, SensorResult, SensorSweepResult, StubCatalog, StubPattern, } from "./types.js";
|
|
2
|
-
export { getDiff, diffHasGlobMatch, filterDiffByGlobs } from "./diff.js";
|
|
3
|
-
export { loadStubCatalog, parseStubCatalog, loadSensorRegistry } from "./catalog.js";
|
|
4
|
-
export type { SensorRegistry, SensorRegistryEntry } from "./catalog.js";
|
|
5
|
-
export { detectStubMatches, runStubCatalog, detectLanguage } from "./stub-catalog.js";
|
|
6
|
-
export type { StubMatch } from "./stub-catalog.js";
|
|
7
|
-
export { extractAttestation, runAttestationCrossCheck, } from "./attestation.js";
|
|
8
|
-
export { runRouteHandlerNonEmpty, runDtoNoFakeFields, } from "./structural.js";
|
|
9
|
-
export { loadAcceptedDecisions, decisionsInScope, listMirrorFiles, runDecisionAssertions, } from "./decisions.js";
|
|
10
|
-
export { formatRemediation } from "./remediation.js";
|
|
11
|
-
export type { RemediationOptions } from "./remediation.js";
|
|
12
|
-
export { runSensors } from "./runner.js";
|
|
13
|
-
export type { RunSensorsArgs } from "./runner.js";
|
package/dist/sensors/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { getDiff, diffHasGlobMatch, filterDiffByGlobs } from "./diff.js";
|
|
2
|
-
export { loadStubCatalog, parseStubCatalog, loadSensorRegistry } from "./catalog.js";
|
|
3
|
-
export { detectStubMatches, runStubCatalog, detectLanguage } from "./stub-catalog.js";
|
|
4
|
-
export { extractAttestation, runAttestationCrossCheck, } from "./attestation.js";
|
|
5
|
-
export { runRouteHandlerNonEmpty, runDtoNoFakeFields, } from "./structural.js";
|
|
6
|
-
export { loadAcceptedDecisions, decisionsInScope, listMirrorFiles, runDecisionAssertions, } from "./decisions.js";
|
|
7
|
-
export { formatRemediation } from "./remediation.js";
|
|
8
|
-
export { runSensors } from "./runner.js";
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sensors/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|