@deftai/directive-core 0.55.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/architecture/sor-preflight.d.ts +66 -0
- package/dist/architecture/sor-preflight.js +903 -0
- package/dist/branch/evaluate.d.ts +23 -0
- package/dist/branch/evaluate.js +136 -0
- package/dist/branch/git.d.ts +15 -0
- package/dist/branch/git.js +42 -0
- package/dist/branch/index.d.ts +3 -0
- package/dist/branch/index.js +3 -0
- package/dist/cache/cli.d.ts +3 -0
- package/dist/cache/cli.js +8 -0
- package/dist/cache/constants.d.ts +12 -0
- package/dist/cache/constants.js +14 -0
- package/dist/cache/errors.d.ts +34 -0
- package/dist/cache/errors.js +52 -0
- package/dist/cache/fetch.d.ts +101 -0
- package/dist/cache/fetch.js +413 -0
- package/dist/cache/index.d.ts +14 -0
- package/dist/cache/index.js +14 -0
- package/dist/cache/io.d.ts +15 -0
- package/dist/cache/io.js +53 -0
- package/dist/cache/json.d.ts +11 -0
- package/dist/cache/json.js +32 -0
- package/dist/cache/main.d.ts +3 -0
- package/dist/cache/main.js +319 -0
- package/dist/cache/operations.d.ts +34 -0
- package/dist/cache/operations.js +348 -0
- package/dist/cache/paths.d.ts +7 -0
- package/dist/cache/paths.js +27 -0
- package/dist/cache/quota.d.ts +56 -0
- package/dist/cache/quota.js +191 -0
- package/dist/cache/scanner.d.ts +28 -0
- package/dist/cache/scanner.js +362 -0
- package/dist/cache/test-helpers.d.ts +10 -0
- package/dist/cache/test-helpers.js +17 -0
- package/dist/cache/time.d.ts +9 -0
- package/dist/cache/time.js +20 -0
- package/dist/cache/types.d.ts +50 -0
- package/dist/cache/types.js +2 -0
- package/dist/cache/validate.d.ts +3 -0
- package/dist/cache/validate.js +118 -0
- package/dist/capacity/backfill.d.ts +52 -0
- package/dist/capacity/backfill.js +429 -0
- package/dist/capacity/index.d.ts +3 -0
- package/dist/capacity/index.js +3 -0
- package/dist/capacity/show.d.ts +73 -0
- package/dist/capacity/show.js +387 -0
- package/dist/check/index.d.ts +3 -0
- package/dist/check/index.js +2 -0
- package/dist/check/orchestrator.d.ts +51 -0
- package/dist/check/orchestrator.js +71 -0
- package/dist/codebase/constants.d.ts +2 -0
- package/dist/codebase/constants.js +2 -0
- package/dist/codebase/default-extractor.d.ts +28 -0
- package/dist/codebase/default-extractor.js +713 -0
- package/dist/codebase/index.d.ts +8 -0
- package/dist/codebase/index.js +8 -0
- package/dist/codebase/json.d.ts +14 -0
- package/dist/codebase/json.js +45 -0
- package/dist/codebase/map-fresh.d.ts +11 -0
- package/dist/codebase/map-fresh.js +125 -0
- package/dist/codebase/map.d.ts +19 -0
- package/dist/codebase/map.js +345 -0
- package/dist/codebase/projection-registry.d.ts +25 -0
- package/dist/codebase/projection-registry.js +93 -0
- package/dist/codebase/provider.d.ts +30 -0
- package/dist/codebase/provider.js +696 -0
- package/dist/content-contracts/skills/greptile-detector.d.ts +56 -0
- package/dist/content-contracts/skills/greptile-detector.js +368 -0
- package/dist/content-contracts/skills/helpers.d.ts +24 -0
- package/dist/content-contracts/skills/helpers.js +73 -0
- package/dist/content-contracts/skills/skill-frontmatter.d.ts +7 -0
- package/dist/content-contracts/skills/skill-frontmatter.js +65 -0
- package/dist/content-contracts/standards/_helpers.d.ts +49 -0
- package/dist/content-contracts/standards/_helpers.js +227 -0
- package/dist/content-contracts/standards/_shapes.d.ts +12 -0
- package/dist/content-contracts/standards/_shapes.js +45 -0
- package/dist/content-contracts/standards/_taskfile-helpers.d.ts +12 -0
- package/dist/content-contracts/standards/_taskfile-helpers.js +61 -0
- package/dist/content-root.d.ts +47 -0
- package/dist/content-root.js +89 -0
- package/dist/doctor/agents-md.d.ts +14 -0
- package/dist/doctor/agents-md.js +263 -0
- package/dist/doctor/checks.d.ts +16 -0
- package/dist/doctor/checks.js +351 -0
- package/dist/doctor/cli.d.ts +2 -0
- package/dist/doctor/cli.js +7 -0
- package/dist/doctor/constants.d.ts +15 -0
- package/dist/doctor/constants.js +40 -0
- package/dist/doctor/doctor-state.d.ts +16 -0
- package/dist/doctor/doctor-state.js +117 -0
- package/dist/doctor/flags.d.ts +5 -0
- package/dist/doctor/flags.js +63 -0
- package/dist/doctor/index.d.ts +14 -0
- package/dist/doctor/index.js +14 -0
- package/dist/doctor/json.d.ts +3 -0
- package/dist/doctor/json.js +21 -0
- package/dist/doctor/main.d.ts +3 -0
- package/dist/doctor/main.js +387 -0
- package/dist/doctor/manifest.d.ts +11 -0
- package/dist/doctor/manifest.js +114 -0
- package/dist/doctor/output.d.ts +19 -0
- package/dist/doctor/output.js +49 -0
- package/dist/doctor/paths.d.ts +16 -0
- package/dist/doctor/paths.js +106 -0
- package/dist/doctor/payload-staleness.d.ts +13 -0
- package/dist/doctor/payload-staleness.js +165 -0
- package/dist/doctor/taskfile.d.ts +6 -0
- package/dist/doctor/taskfile.js +65 -0
- package/dist/doctor/types.d.ts +76 -0
- package/dist/doctor/types.js +4 -0
- package/dist/doctor/which.d.ts +3 -0
- package/dist/doctor/which.js +17 -0
- package/dist/encoding/evaluate.d.ts +19 -0
- package/dist/encoding/evaluate.js +155 -0
- package/dist/encoding/git.d.ts +11 -0
- package/dist/encoding/git.js +36 -0
- package/dist/encoding/index.d.ts +6 -0
- package/dist/encoding/index.js +6 -0
- package/dist/encoding/patterns.d.ts +29 -0
- package/dist/encoding/patterns.js +109 -0
- package/dist/encoding/scan.d.ts +24 -0
- package/dist/encoding/scan.js +182 -0
- package/dist/encoding/text.d.ts +21 -0
- package/dist/encoding/text.js +111 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +55 -0
- package/dist/intake/candidates-log.d.ts +20 -0
- package/dist/intake/candidates-log.js +224 -0
- package/dist/intake/github-auth-modes-cli.d.ts +3 -0
- package/dist/intake/github-auth-modes-cli.js +23 -0
- package/dist/intake/github-auth-modes.d.ts +54 -0
- package/dist/intake/github-auth-modes.js +275 -0
- package/dist/intake/github-body-cli.d.ts +3 -0
- package/dist/intake/github-body-cli.js +30 -0
- package/dist/intake/github-body.d.ts +48 -0
- package/dist/intake/github-body.js +151 -0
- package/dist/intake/index.d.ts +15 -0
- package/dist/intake/index.js +15 -0
- package/dist/intake/issue-emit-cli.d.ts +3 -0
- package/dist/intake/issue-emit-cli.js +34 -0
- package/dist/intake/issue-emit.d.ts +63 -0
- package/dist/intake/issue-emit.js +351 -0
- package/dist/intake/issue-ingest-cli.d.ts +3 -0
- package/dist/intake/issue-ingest-cli.js +33 -0
- package/dist/intake/issue-ingest.d.ts +53 -0
- package/dist/intake/issue-ingest.js +477 -0
- package/dist/intake/markdown-scanners.d.ts +23 -0
- package/dist/intake/markdown-scanners.js +247 -0
- package/dist/intake/parity-scenarios.d.ts +22 -0
- package/dist/intake/parity-scenarios.js +32 -0
- package/dist/intake/platform-capabilities.d.ts +11 -0
- package/dist/intake/platform-capabilities.js +34 -0
- package/dist/intake/reconcile-issues-cli.d.ts +3 -0
- package/dist/intake/reconcile-issues-cli.js +31 -0
- package/dist/intake/reconcile-issues.d.ts +60 -0
- package/dist/intake/reconcile-issues.js +756 -0
- package/dist/integration-e2e/bootstrap-cache-module.d.ts +5 -0
- package/dist/integration-e2e/bootstrap-cache-module.js +21 -0
- package/dist/integration-e2e/helpers.d.ts +28 -0
- package/dist/integration-e2e/helpers.js +157 -0
- package/dist/lifecycle/event-detect.d.ts +32 -0
- package/dist/lifecycle/event-detect.js +172 -0
- package/dist/lifecycle/events.d.ts +45 -0
- package/dist/lifecycle/events.js +340 -0
- package/dist/lifecycle/index.d.ts +4 -0
- package/dist/lifecycle/index.js +4 -0
- package/dist/lifecycle/lifecycle-hygiene.d.ts +59 -0
- package/dist/lifecycle/lifecycle-hygiene.js +388 -0
- package/dist/orchestration/index.d.ts +7 -0
- package/dist/orchestration/index.js +7 -0
- package/dist/orchestration/judgment-policy.d.ts +23 -0
- package/dist/orchestration/judgment-policy.js +228 -0
- package/dist/orchestration/pathspec.d.ts +11 -0
- package/dist/orchestration/pathspec.js +95 -0
- package/dist/orchestration/probe-session.d.ts +74 -0
- package/dist/orchestration/probe-session.js +478 -0
- package/dist/orchestration/subagent-monitor.d.ts +64 -0
- package/dist/orchestration/subagent-monitor.js +405 -0
- package/dist/orchestration/verify-investigation.d.ts +27 -0
- package/dist/orchestration/verify-investigation.js +314 -0
- package/dist/orchestration/verify-judgment-gates.d.ts +66 -0
- package/dist/orchestration/verify-judgment-gates.js +710 -0
- package/dist/packs/index.d.ts +4 -0
- package/dist/packs/index.js +4 -0
- package/dist/packs/pack-render.d.ts +31 -0
- package/dist/packs/pack-render.js +357 -0
- package/dist/packs/packs-slice.d.ts +58 -0
- package/dist/packs/packs-slice.js +649 -0
- package/dist/packs/quarantine-ext.d.ts +7 -0
- package/dist/packs/quarantine-ext.js +164 -0
- package/dist/platform/agents-md.d.ts +31 -0
- package/dist/platform/agents-md.js +320 -0
- package/dist/platform/changelog-cli.d.ts +3 -0
- package/dist/platform/changelog-cli.js +64 -0
- package/dist/platform/constants.d.ts +20 -0
- package/dist/platform/constants.js +27 -0
- package/dist/platform/index.d.ts +9 -0
- package/dist/platform/index.js +9 -0
- package/dist/platform/ip-risk.d.ts +10 -0
- package/dist/platform/ip-risk.js +235 -0
- package/dist/platform/linear-scan.d.ts +36 -0
- package/dist/platform/linear-scan.js +174 -0
- package/dist/platform/platform-capabilities.d.ts +45 -0
- package/dist/platform/platform-capabilities.js +190 -0
- package/dist/platform/resolve-changelog-unreleased.d.ts +24 -0
- package/dist/platform/resolve-changelog-unreleased.js +364 -0
- package/dist/platform/resolve-version.d.ts +22 -0
- package/dist/platform/resolve-version.js +303 -0
- package/dist/platform/slug-normalize.d.ts +9 -0
- package/dist/platform/slug-normalize.js +110 -0
- package/dist/policy/autonomy.d.ts +43 -0
- package/dist/policy/autonomy.js +220 -0
- package/dist/policy/capacity.d.ts +45 -0
- package/dist/policy/capacity.js +251 -0
- package/dist/policy/decisions.d.ts +26 -0
- package/dist/policy/decisions.js +114 -0
- package/dist/policy/disclosure.d.ts +4 -0
- package/dist/policy/disclosure.js +19 -0
- package/dist/policy/index.d.ts +43 -0
- package/dist/policy/index.js +298 -0
- package/dist/policy/resolve.d.ts +38 -0
- package/dist/policy/resolve.js +228 -0
- package/dist/policy/wip.d.ts +15 -0
- package/dist/policy/wip.js +81 -0
- package/dist/pr-closing-keywords/constants.d.ts +6 -0
- package/dist/pr-closing-keywords/constants.js +6 -0
- package/dist/pr-closing-keywords/detect.d.ts +5 -0
- package/dist/pr-closing-keywords/detect.js +113 -0
- package/dist/pr-closing-keywords/gh.d.ts +6 -0
- package/dist/pr-closing-keywords/gh.js +129 -0
- package/dist/pr-closing-keywords/index.d.ts +7 -0
- package/dist/pr-closing-keywords/index.js +6 -0
- package/dist/pr-closing-keywords/io.d.ts +3 -0
- package/dist/pr-closing-keywords/io.js +22 -0
- package/dist/pr-closing-keywords/main.d.ts +9 -0
- package/dist/pr-closing-keywords/main.js +246 -0
- package/dist/pr-closing-keywords/types.d.ts +23 -0
- package/dist/pr-closing-keywords/types.js +2 -0
- package/dist/pr-merge-readiness/compute.d.ts +7 -0
- package/dist/pr-merge-readiness/compute.js +210 -0
- package/dist/pr-merge-readiness/constants.d.ts +20 -0
- package/dist/pr-merge-readiness/constants.js +32 -0
- package/dist/pr-merge-readiness/evaluate.d.ts +5 -0
- package/dist/pr-merge-readiness/evaluate.js +48 -0
- package/dist/pr-merge-readiness/gh.d.ts +22 -0
- package/dist/pr-merge-readiness/gh.js +281 -0
- package/dist/pr-merge-readiness/index.d.ts +9 -0
- package/dist/pr-merge-readiness/index.js +8 -0
- package/dist/pr-merge-readiness/main.d.ts +14 -0
- package/dist/pr-merge-readiness/main.js +67 -0
- package/dist/pr-merge-readiness/output.d.ts +7 -0
- package/dist/pr-merge-readiness/output.js +98 -0
- package/dist/pr-merge-readiness/parse.d.ts +6 -0
- package/dist/pr-merge-readiness/parse.js +83 -0
- package/dist/pr-merge-readiness/types.d.ts +29 -0
- package/dist/pr-merge-readiness/types.js +2 -0
- package/dist/pr-monitor/cadence.d.ts +3 -0
- package/dist/pr-monitor/cadence.js +12 -0
- package/dist/pr-monitor/constants.d.ts +8 -0
- package/dist/pr-monitor/constants.js +12 -0
- package/dist/pr-monitor/index.d.ts +7 -0
- package/dist/pr-monitor/index.js +6 -0
- package/dist/pr-monitor/main.d.ts +17 -0
- package/dist/pr-monitor/main.js +169 -0
- package/dist/pr-monitor/monitor.d.ts +9 -0
- package/dist/pr-monitor/monitor.js +106 -0
- package/dist/pr-monitor/readiness.d.ts +6 -0
- package/dist/pr-monitor/readiness.js +64 -0
- package/dist/pr-monitor/types.d.ts +30 -0
- package/dist/pr-monitor/types.js +2 -0
- package/dist/pr-protected-issues/constants.d.ts +7 -0
- package/dist/pr-protected-issues/constants.js +7 -0
- package/dist/pr-protected-issues/gh.d.ts +9 -0
- package/dist/pr-protected-issues/gh.js +96 -0
- package/dist/pr-protected-issues/index.d.ts +6 -0
- package/dist/pr-protected-issues/index.js +5 -0
- package/dist/pr-protected-issues/main.d.ts +14 -0
- package/dist/pr-protected-issues/main.js +128 -0
- package/dist/pr-protected-issues/parse.d.ts +6 -0
- package/dist/pr-protected-issues/parse.js +21 -0
- package/dist/pr-protected-issues/types.d.ts +8 -0
- package/dist/pr-protected-issues/types.js +2 -0
- package/dist/pr-wait-mergeable/cascade.d.ts +12 -0
- package/dist/pr-wait-mergeable/cascade.js +107 -0
- package/dist/pr-wait-mergeable/classify.d.ts +5 -0
- package/dist/pr-wait-mergeable/classify.js +47 -0
- package/dist/pr-wait-mergeable/constants.d.ts +5 -0
- package/dist/pr-wait-mergeable/constants.js +5 -0
- package/dist/pr-wait-mergeable/index.d.ts +8 -0
- package/dist/pr-wait-mergeable/index.js +7 -0
- package/dist/pr-wait-mergeable/main.d.ts +18 -0
- package/dist/pr-wait-mergeable/main.js +213 -0
- package/dist/pr-wait-mergeable/result.d.ts +9 -0
- package/dist/pr-wait-mergeable/result.js +38 -0
- package/dist/pr-wait-mergeable/types.d.ts +16 -0
- package/dist/pr-wait-mergeable/types.js +2 -0
- package/dist/pr-wait-mergeable/wrappers.d.ts +26 -0
- package/dist/pr-wait-mergeable/wrappers.js +103 -0
- package/dist/preflight/evaluate.d.ts +22 -0
- package/dist/preflight/evaluate.js +137 -0
- package/dist/preflight/index.d.ts +3 -0
- package/dist/preflight/index.js +2 -0
- package/dist/preflight-cache/evaluate.d.ts +40 -0
- package/dist/preflight-cache/evaluate.js +481 -0
- package/dist/preflight-cache/index.d.ts +3 -0
- package/dist/preflight-cache/index.js +2 -0
- package/dist/preflight-gh/classifier.d.ts +56 -0
- package/dist/preflight-gh/classifier.js +415 -0
- package/dist/preflight-gh/index.d.ts +3 -0
- package/dist/preflight-gh/index.js +2 -0
- package/dist/release/changelog.d.ts +9 -0
- package/dist/release/changelog.js +105 -0
- package/dist/release/cli.d.ts +2 -0
- package/dist/release/cli.js +7 -0
- package/dist/release/constants.d.ts +22 -0
- package/dist/release/constants.js +85 -0
- package/dist/release/flags.d.ts +4 -0
- package/dist/release/flags.js +131 -0
- package/dist/release/gh.d.ts +16 -0
- package/dist/release/gh.js +210 -0
- package/dist/release/git.d.ts +11 -0
- package/dist/release/git.js +84 -0
- package/dist/release/index.d.ts +14 -0
- package/dist/release/index.js +15 -0
- package/dist/release/main.d.ts +3 -0
- package/dist/release/main.js +47 -0
- package/dist/release/paths.d.ts +6 -0
- package/dist/release/paths.js +39 -0
- package/dist/release/pipeline.d.ts +6 -0
- package/dist/release/pipeline.js +314 -0
- package/dist/release/pyproject-sync.d.ts +6 -0
- package/dist/release/pyproject-sync.js +52 -0
- package/dist/release/pyproject.d.ts +3 -0
- package/dist/release/pyproject.js +33 -0
- package/dist/release/python-bridge.d.ts +7 -0
- package/dist/release/python-bridge.js +144 -0
- package/dist/release/spawn.d.ts +8 -0
- package/dist/release/spawn.js +44 -0
- package/dist/release/types.d.ts +58 -0
- package/dist/release/types.js +2 -0
- package/dist/release/version.d.ts +11 -0
- package/dist/release/version.js +74 -0
- package/dist/release-e2e/constants.d.ts +22 -0
- package/dist/release-e2e/constants.js +43 -0
- package/dist/release-e2e/entrypoint-worker-thread.d.ts +2 -0
- package/dist/release-e2e/entrypoint-worker-thread.js +22 -0
- package/dist/release-e2e/entrypoint-worker.d.ts +13 -0
- package/dist/release-e2e/entrypoint-worker.js +50 -0
- package/dist/release-e2e/entrypoint.d.ts +40 -0
- package/dist/release-e2e/entrypoint.js +257 -0
- package/dist/release-e2e/flags.d.ts +5 -0
- package/dist/release-e2e/flags.js +80 -0
- package/dist/release-e2e/gh-ops.d.ts +5 -0
- package/dist/release-e2e/gh-ops.js +72 -0
- package/dist/release-e2e/git-ops.d.ts +6 -0
- package/dist/release-e2e/git-ops.js +47 -0
- package/dist/release-e2e/index.d.ts +10 -0
- package/dist/release-e2e/index.js +10 -0
- package/dist/release-e2e/main.d.ts +4 -0
- package/dist/release-e2e/main.js +78 -0
- package/dist/release-e2e/npm-ops.d.ts +29 -0
- package/dist/release-e2e/npm-ops.js +149 -0
- package/dist/release-e2e/rehearsal.d.ts +3 -0
- package/dist/release-e2e/rehearsal.js +51 -0
- package/dist/release-e2e/rollback-bridge.d.ts +3 -0
- package/dist/release-e2e/rollback-bridge.js +20 -0
- package/dist/release-e2e/types.d.ts +40 -0
- package/dist/release-e2e/types.js +2 -0
- package/dist/release-publish/cli.d.ts +2 -0
- package/dist/release-publish/cli.js +7 -0
- package/dist/release-publish/constants.d.ts +4 -0
- package/dist/release-publish/constants.js +24 -0
- package/dist/release-publish/flags.d.ts +5 -0
- package/dist/release-publish/flags.js +67 -0
- package/dist/release-publish/gh-api.d.ts +6 -0
- package/dist/release-publish/gh-api.js +102 -0
- package/dist/release-publish/index.d.ts +7 -0
- package/dist/release-publish/index.js +8 -0
- package/dist/release-publish/main.d.ts +3 -0
- package/dist/release-publish/main.js +38 -0
- package/dist/release-publish/pipeline.d.ts +4 -0
- package/dist/release-publish/pipeline.js +46 -0
- package/dist/release-publish/types.d.ts +25 -0
- package/dist/release-publish/types.js +2 -0
- package/dist/release-rollback/constants.d.ts +18 -0
- package/dist/release-rollback/constants.js +55 -0
- package/dist/release-rollback/flags.d.ts +4 -0
- package/dist/release-rollback/flags.js +136 -0
- package/dist/release-rollback/gh.d.ts +5 -0
- package/dist/release-rollback/gh.js +71 -0
- package/dist/release-rollback/git.d.ts +9 -0
- package/dist/release-rollback/git.js +87 -0
- package/dist/release-rollback/guard.d.ts +12 -0
- package/dist/release-rollback/guard.js +97 -0
- package/dist/release-rollback/index.d.ts +9 -0
- package/dist/release-rollback/index.js +10 -0
- package/dist/release-rollback/main.d.ts +3 -0
- package/dist/release-rollback/main.js +51 -0
- package/dist/release-rollback/pipeline.d.ts +7 -0
- package/dist/release-rollback/pipeline.js +221 -0
- package/dist/release-rollback/types.d.ts +41 -0
- package/dist/release-rollback/types.js +2 -0
- package/dist/render/constants.d.ts +16 -0
- package/dist/render/constants.js +78 -0
- package/dist/render/framework-commands.d.ts +41 -0
- package/dist/render/framework-commands.js +416 -0
- package/dist/render/index.d.ts +15 -0
- package/dist/render/index.js +15 -0
- package/dist/render/prd-render.d.ts +14 -0
- package/dist/render/prd-render.js +79 -0
- package/dist/render/project-render.d.ts +20 -0
- package/dist/render/project-render.js +169 -0
- package/dist/render/roadmap-render.d.ts +8 -0
- package/dist/render/roadmap-render.js +387 -0
- package/dist/render/spec-render.d.ts +13 -0
- package/dist/render/spec-render.js +362 -0
- package/dist/render/spec-validate.d.ts +6 -0
- package/dist/render/spec-validate.js +157 -0
- package/dist/render/text-utils.d.ts +8 -0
- package/dist/render/text-utils.js +72 -0
- package/dist/scm/argv.d.ts +7 -0
- package/dist/scm/argv.js +54 -0
- package/dist/scm/binary.d.ts +11 -0
- package/dist/scm/binary.js +35 -0
- package/dist/scm/build-command.d.ts +11 -0
- package/dist/scm/build-command.js +23 -0
- package/dist/scm/call.d.ts +25 -0
- package/dist/scm/call.js +38 -0
- package/dist/scm/cli.d.ts +3 -0
- package/dist/scm/cli.js +7 -0
- package/dist/scm/constants.d.ts +11 -0
- package/dist/scm/constants.js +11 -0
- package/dist/scm/errors.d.ts +5 -0
- package/dist/scm/errors.js +8 -0
- package/dist/scm/gh-rest.d.ts +74 -0
- package/dist/scm/gh-rest.js +326 -0
- package/dist/scm/index.d.ts +11 -0
- package/dist/scm/index.js +11 -0
- package/dist/scm/main.d.ts +12 -0
- package/dist/scm/main.js +65 -0
- package/dist/scm/py-format.d.ts +9 -0
- package/dist/scm/py-format.js +31 -0
- package/dist/scm/rest-dispatch.d.ts +14 -0
- package/dist/scm/rest-dispatch.js +175 -0
- package/dist/scope/audit-log.d.ts +14 -0
- package/dist/scope/audit-log.js +186 -0
- package/dist/scope/capacity-stamp.d.ts +3 -0
- package/dist/scope/capacity-stamp.js +45 -0
- package/dist/scope/cli.d.ts +4 -0
- package/dist/scope/cli.js +11 -0
- package/dist/scope/constants.d.ts +19 -0
- package/dist/scope/constants.js +44 -0
- package/dist/scope/decompose.d.ts +42 -0
- package/dist/scope/decompose.js +1016 -0
- package/dist/scope/decomposed-refs.d.ts +6 -0
- package/dist/scope/decomposed-refs.js +173 -0
- package/dist/scope/demote.d.ts +24 -0
- package/dist/scope/demote.js +209 -0
- package/dist/scope/index.d.ts +12 -0
- package/dist/scope/index.js +12 -0
- package/dist/scope/main.d.ts +30 -0
- package/dist/scope/main.js +365 -0
- package/dist/scope/project-context.d.ts +6 -0
- package/dist/scope/project-context.js +55 -0
- package/dist/scope/project-definition-sync.d.ts +3 -0
- package/dist/scope/project-definition-sync.js +157 -0
- package/dist/scope/transition.d.ts +10 -0
- package/dist/scope/transition.js +133 -0
- package/dist/scope/undo.d.ts +25 -0
- package/dist/scope/undo.js +334 -0
- package/dist/scope/vbrief-json.d.ts +4 -0
- package/dist/scope/vbrief-json.js +8 -0
- package/dist/scope/vbrief-ref.d.ts +11 -0
- package/dist/scope/vbrief-ref.js +100 -0
- package/dist/scope/wip-cap-check.d.ts +11 -0
- package/dist/scope/wip-cap-check.js +23 -0
- package/dist/session/git.d.ts +14 -0
- package/dist/session/git.js +49 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.js +9 -0
- package/dist/session/json.d.ts +7 -0
- package/dist/session/json.js +29 -0
- package/dist/session/resume-conditions.d.ts +56 -0
- package/dist/session/resume-conditions.js +486 -0
- package/dist/session/ritual-entrypoint.d.ts +20 -0
- package/dist/session/ritual-entrypoint.js +86 -0
- package/dist/session/ritual-sentinel.d.ts +58 -0
- package/dist/session/ritual-sentinel.js +338 -0
- package/dist/session/session-start-hook.d.ts +14 -0
- package/dist/session/session-start-hook.js +53 -0
- package/dist/session/session-start.d.ts +41 -0
- package/dist/session/session-start.js +290 -0
- package/dist/session/staleness.d.ts +8 -0
- package/dist/session/staleness.js +91 -0
- package/dist/session/time.d.ts +5 -0
- package/dist/session/time.js +19 -0
- package/dist/session/verify-session-ritual.d.ts +29 -0
- package/dist/session/verify-session-ritual.js +222 -0
- package/dist/slice/cli.d.ts +21 -0
- package/dist/slice/cli.js +248 -0
- package/dist/slice/constants.d.ts +18 -0
- package/dist/slice/constants.js +30 -0
- package/dist/slice/errors.d.ts +9 -0
- package/dist/slice/errors.js +15 -0
- package/dist/slice/existing.d.ts +53 -0
- package/dist/slice/existing.js +344 -0
- package/dist/slice/index.d.ts +10 -0
- package/dist/slice/index.js +10 -0
- package/dist/slice/json.d.ts +7 -0
- package/dist/slice/json.js +25 -0
- package/dist/slice/lock.d.ts +9 -0
- package/dist/slice/lock.js +59 -0
- package/dist/slice/project-context.d.ts +15 -0
- package/dist/slice/project-context.js +87 -0
- package/dist/slice/record.d.ts +50 -0
- package/dist/slice/record.js +139 -0
- package/dist/slice/validate.d.ts +3 -0
- package/dist/slice/validate.js +86 -0
- package/dist/story-ready/allocation.d.ts +14 -0
- package/dist/story-ready/allocation.js +61 -0
- package/dist/story-ready/evaluate.d.ts +23 -0
- package/dist/story-ready/evaluate.js +161 -0
- package/dist/story-ready/git.d.ts +6 -0
- package/dist/story-ready/git.js +26 -0
- package/dist/story-ready/index.d.ts +4 -0
- package/dist/story-ready/index.js +4 -0
- package/dist/subprocess/max-buffer.d.ts +18 -0
- package/dist/subprocess/max-buffer.js +18 -0
- package/dist/swarm/complete-cohort-cli.d.ts +3 -0
- package/dist/swarm/complete-cohort-cli.js +42 -0
- package/dist/swarm/complete-cohort.d.ts +34 -0
- package/dist/swarm/complete-cohort.js +407 -0
- package/dist/swarm/constants.d.ts +18 -0
- package/dist/swarm/constants.js +24 -0
- package/dist/swarm/index.d.ts +18 -0
- package/dist/swarm/index.js +18 -0
- package/dist/swarm/launch-cli.d.ts +5 -0
- package/dist/swarm/launch-cli.js +111 -0
- package/dist/swarm/launch.d.ts +78 -0
- package/dist/swarm/launch.js +587 -0
- package/dist/swarm/readiness-cli.d.ts +3 -0
- package/dist/swarm/readiness-cli.js +25 -0
- package/dist/swarm/readiness.d.ts +24 -0
- package/dist/swarm/readiness.js +606 -0
- package/dist/swarm/routing-set-cli.d.ts +3 -0
- package/dist/swarm/routing-set-cli.js +82 -0
- package/dist/swarm/routing-verify-cli.d.ts +3 -0
- package/dist/swarm/routing-verify-cli.js +51 -0
- package/dist/swarm/routing-verify.d.ts +20 -0
- package/dist/swarm/routing-verify.js +104 -0
- package/dist/swarm/routing.d.ts +57 -0
- package/dist/swarm/routing.js +173 -0
- package/dist/swarm/subagent-backend.d.ts +22 -0
- package/dist/swarm/subagent-backend.js +162 -0
- package/dist/swarm/subprocess.d.ts +10 -0
- package/dist/swarm/subprocess.js +34 -0
- package/dist/swarm/verify-review-clean-cli.d.ts +3 -0
- package/dist/swarm/verify-review-clean-cli.js +38 -0
- package/dist/swarm/verify-review-clean.d.ts +40 -0
- package/dist/swarm/verify-review-clean.js +240 -0
- package/dist/swarm/worktrees-cli.d.ts +9 -0
- package/dist/swarm/worktrees-cli.js +57 -0
- package/dist/swarm/worktrees.d.ts +39 -0
- package/dist/swarm/worktrees.js +178 -0
- package/dist/text/redos-safe.d.ts +29 -0
- package/dist/text/redos-safe.js +338 -0
- package/dist/triage/actions/candidates-log.d.ts +8 -0
- package/dist/triage/actions/candidates-log.js +195 -0
- package/dist/triage/actions/errors.d.ts +17 -0
- package/dist/triage/actions/errors.js +29 -0
- package/dist/triage/actions/index.d.ts +19 -0
- package/dist/triage/actions/index.js +305 -0
- package/dist/triage/actions/resume-on.d.ts +3 -0
- package/dist/triage/actions/resume-on.js +65 -0
- package/dist/triage/actions/types.d.ts +57 -0
- package/dist/triage/actions/types.js +2 -0
- package/dist/triage/bootstrap/gitignore.d.ts +16 -0
- package/dist/triage/bootstrap/gitignore.js +414 -0
- package/dist/triage/bootstrap/index.d.ts +44 -0
- package/dist/triage/bootstrap/index.js +572 -0
- package/dist/triage/bootstrap/types.d.ts +60 -0
- package/dist/triage/bootstrap/types.js +2 -0
- package/dist/triage/bulk/index.d.ts +99 -0
- package/dist/triage/bulk/index.js +454 -0
- package/dist/triage/classify/index.d.ts +88 -0
- package/dist/triage/classify/index.js +738 -0
- package/dist/triage/help/index.d.ts +25 -0
- package/dist/triage/help/index.js +212 -0
- package/dist/triage/help/registry-data.d.ts +555 -0
- package/dist/triage/help/registry-data.js +841 -0
- package/dist/triage/index.d.ts +23 -0
- package/dist/triage/index.js +23 -0
- package/dist/triage/queue/audit.d.ts +12 -0
- package/dist/triage/queue/audit.js +47 -0
- package/dist/triage/queue/build-queue.d.ts +9 -0
- package/dist/triage/queue/build-queue.js +133 -0
- package/dist/triage/queue/cache.d.ts +20 -0
- package/dist/triage/queue/cache.js +169 -0
- package/dist/triage/queue/constants.d.ts +22 -0
- package/dist/triage/queue/constants.js +28 -0
- package/dist/triage/queue/derive-group.d.ts +7 -0
- package/dist/triage/queue/derive-group.js +20 -0
- package/dist/triage/queue/index.d.ts +12 -0
- package/dist/triage/queue/index.js +12 -0
- package/dist/triage/queue/project.d.ts +6 -0
- package/dist/triage/queue/project.js +18 -0
- package/dist/triage/queue/ranking-labels.d.ts +10 -0
- package/dist/triage/queue/ranking-labels.js +54 -0
- package/dist/triage/queue/render.d.ts +9 -0
- package/dist/triage/queue/render.js +35 -0
- package/dist/triage/queue/repo.d.ts +5 -0
- package/dist/triage/queue/repo.js +36 -0
- package/dist/triage/queue/scope-walk.d.ts +13 -0
- package/dist/triage/queue/scope-walk.js +170 -0
- package/dist/triage/queue/selection.d.ts +28 -0
- package/dist/triage/queue/selection.js +109 -0
- package/dist/triage/queue/types.d.ts +58 -0
- package/dist/triage/queue/types.js +2 -0
- package/dist/triage/reconcile/audit.d.ts +4 -0
- package/dist/triage/reconcile/audit.js +62 -0
- package/dist/triage/reconcile/index.d.ts +5 -0
- package/dist/triage/reconcile/index.js +5 -0
- package/dist/triage/reconcile/parse-uri.d.ts +4 -0
- package/dist/triage/reconcile/parse-uri.js +43 -0
- package/dist/triage/reconcile/reconcile.d.ts +17 -0
- package/dist/triage/reconcile/reconcile.js +163 -0
- package/dist/triage/reconcile/types.d.ts +23 -0
- package/dist/triage/reconcile/types.js +70 -0
- package/dist/triage/refresh/drift.d.ts +15 -0
- package/dist/triage/refresh/drift.js +72 -0
- package/dist/triage/refresh/extract.d.ts +3 -0
- package/dist/triage/refresh/extract.js +43 -0
- package/dist/triage/refresh/index.d.ts +5 -0
- package/dist/triage/refresh/index.js +5 -0
- package/dist/triage/refresh/refresh.d.ts +16 -0
- package/dist/triage/refresh/refresh.js +95 -0
- package/dist/triage/refresh/types.d.ts +18 -0
- package/dist/triage/refresh/types.js +7 -0
- package/dist/triage/scope/cli.d.ts +23 -0
- package/dist/triage/scope/cli.js +257 -0
- package/dist/triage/scope/constants.d.ts +16 -0
- package/dist/triage/scope/constants.js +25 -0
- package/dist/triage/scope/coverage.d.ts +24 -0
- package/dist/triage/scope/coverage.js +96 -0
- package/dist/triage/scope/duration.d.ts +6 -0
- package/dist/triage/scope/duration.js +44 -0
- package/dist/triage/scope/evaluate.d.ts +18 -0
- package/dist/triage/scope/evaluate.js +161 -0
- package/dist/triage/scope/index.d.ts +14 -0
- package/dist/triage/scope/index.js +14 -0
- package/dist/triage/scope/milestone.d.ts +13 -0
- package/dist/triage/scope/milestone.js +178 -0
- package/dist/triage/scope/mutations-core.d.ts +24 -0
- package/dist/triage/scope/mutations-core.js +216 -0
- package/dist/triage/scope/mutations.d.ts +21 -0
- package/dist/triage/scope/mutations.js +203 -0
- package/dist/triage/scope/normalize.d.ts +5 -0
- package/dist/triage/scope/normalize.js +45 -0
- package/dist/triage/scope/python-repr.d.ts +7 -0
- package/dist/triage/scope/python-repr.js +25 -0
- package/dist/triage/scope/renderers.d.ts +9 -0
- package/dist/triage/scope/renderers.js +177 -0
- package/dist/triage/scope/resolve.d.ts +15 -0
- package/dist/triage/scope/resolve.js +122 -0
- package/dist/triage/scope/time.d.ts +6 -0
- package/dist/triage/scope/time.js +18 -0
- package/dist/triage/scope/validate.d.ts +11 -0
- package/dist/triage/scope/validate.js +272 -0
- package/dist/triage/scope-drift/add-ignore.d.ts +10 -0
- package/dist/triage/scope-drift/add-ignore.js +78 -0
- package/dist/triage/scope-drift/cache-walker.d.ts +8 -0
- package/dist/triage/scope-drift/cache-walker.js +103 -0
- package/dist/triage/scope-drift/compute.d.ts +9 -0
- package/dist/triage/scope-drift/compute.js +92 -0
- package/dist/triage/scope-drift/index.d.ts +6 -0
- package/dist/triage/scope-drift/index.js +6 -0
- package/dist/triage/scope-drift/render.d.ts +4 -0
- package/dist/triage/scope-drift/render.js +45 -0
- package/dist/triage/scope-drift/scope-rules.d.ts +16 -0
- package/dist/triage/scope-drift/scope-rules.js +149 -0
- package/dist/triage/scope-drift/types.d.ts +13 -0
- package/dist/triage/scope-drift/types.js +8 -0
- package/dist/triage/smoketest/index.d.ts +81 -0
- package/dist/triage/smoketest/index.js +335 -0
- package/dist/triage/subscribe/index.d.ts +38 -0
- package/dist/triage/subscribe/index.js +303 -0
- package/dist/triage/summary/index.d.ts +70 -0
- package/dist/triage/summary/index.js +431 -0
- package/dist/triage/summary/reconcilable.d.ts +12 -0
- package/dist/triage/summary/reconcilable.js +150 -0
- package/dist/triage/summary/scope-drift.d.ts +5 -0
- package/dist/triage/summary/scope-drift.js +219 -0
- package/dist/triage/welcome/constants.d.ts +24 -0
- package/dist/triage/welcome/constants.js +34 -0
- package/dist/triage/welcome/default-mode.d.ts +21 -0
- package/dist/triage/welcome/default-mode.js +48 -0
- package/dist/triage/welcome/index.d.ts +6 -0
- package/dist/triage/welcome/index.js +6 -0
- package/dist/triage/welcome/prior-state.d.ts +17 -0
- package/dist/triage/welcome/prior-state.js +170 -0
- package/dist/triage/welcome/summary.d.ts +23 -0
- package/dist/triage/welcome/summary.js +303 -0
- package/dist/triage/welcome/writers.d.ts +17 -0
- package/dist/triage/welcome/writers.js +157 -0
- package/dist/ts-check-lane/index.d.ts +3 -0
- package/dist/ts-check-lane/index.js +2 -0
- package/dist/ts-check-lane/run-lane.d.ts +53 -0
- package/dist/ts-check-lane/run-lane.js +98 -0
- package/dist/validate-content/capacity-policy.d.ts +82 -0
- package/dist/validate-content/capacity-policy.js +399 -0
- package/dist/validate-content/capacity-show.d.ts +60 -0
- package/dist/validate-content/capacity-show.js +336 -0
- package/dist/validate-content/filename.d.ts +3 -0
- package/dist/validate-content/filename.js +54 -0
- package/dist/validate-content/index.d.ts +9 -0
- package/dist/validate-content/index.js +9 -0
- package/dist/validate-content/link-parser.d.ts +5 -0
- package/dist/validate-content/link-parser.js +42 -0
- package/dist/validate-content/types.d.ts +8 -0
- package/dist/validate-content/types.js +2 -0
- package/dist/validate-content/validate-links.d.ts +17 -0
- package/dist/validate-content/validate-links.js +114 -0
- package/dist/validate-content/validate-strategy-output.d.ts +11 -0
- package/dist/validate-content/validate-strategy-output.js +120 -0
- package/dist/validate-content/verify-capacity.d.ts +14 -0
- package/dist/validate-content/verify-capacity.js +96 -0
- package/dist/vbrief-activate/activate.d.ts +13 -0
- package/dist/vbrief-activate/activate.js +184 -0
- package/dist/vbrief-activate/constants.d.ts +9 -0
- package/dist/vbrief-activate/constants.js +11 -0
- package/dist/vbrief-activate/index.d.ts +6 -0
- package/dist/vbrief-activate/index.js +4 -0
- package/dist/vbrief-activate/main.d.ts +14 -0
- package/dist/vbrief-activate/main.js +33 -0
- package/dist/vbrief-build/build.d.ts +13 -0
- package/dist/vbrief-build/build.js +123 -0
- package/dist/vbrief-build/constants.d.ts +13 -0
- package/dist/vbrief-build/constants.js +34 -0
- package/dist/vbrief-build/index.d.ts +12 -0
- package/dist/vbrief-build/index.js +11 -0
- package/dist/vbrief-build/json.d.ts +3 -0
- package/dist/vbrief-build/json.js +5 -0
- package/dist/vbrief-build/main.d.ts +5 -0
- package/dist/vbrief-build/main.js +65 -0
- package/dist/vbrief-build/parity-scenarios.d.ts +19 -0
- package/dist/vbrief-build/parity-scenarios.js +321 -0
- package/dist/vbrief-build/project-definition-io.d.ts +13 -0
- package/dist/vbrief-build/project-definition-io.js +117 -0
- package/dist/vbrief-build/routing.d.ts +13 -0
- package/dist/vbrief-build/routing.js +110 -0
- package/dist/vbrief-build/sources.d.ts +16 -0
- package/dist/vbrief-build/sources.js +294 -0
- package/dist/vbrief-build/speckit.d.ts +23 -0
- package/dist/vbrief-build/speckit.js +212 -0
- package/dist/vbrief-build/types.d.ts +18 -0
- package/dist/vbrief-build/types.js +7 -0
- package/dist/vbrief-reconcile/graph.d.ts +11 -0
- package/dist/vbrief-reconcile/graph.js +171 -0
- package/dist/vbrief-reconcile/index.d.ts +10 -0
- package/dist/vbrief-reconcile/index.js +9 -0
- package/dist/vbrief-reconcile/labels.d.ts +22 -0
- package/dist/vbrief-reconcile/labels.js +252 -0
- package/dist/vbrief-reconcile/main.d.ts +18 -0
- package/dist/vbrief-reconcile/main.js +149 -0
- package/dist/vbrief-reconcile/parity-scenarios.d.ts +16 -0
- package/dist/vbrief-reconcile/parity-scenarios.js +385 -0
- package/dist/vbrief-reconcile/py-repr.d.ts +3 -0
- package/dist/vbrief-reconcile/py-repr.js +5 -0
- package/dist/vbrief-reconcile/reconciliation.d.ts +20 -0
- package/dist/vbrief-reconcile/reconciliation.js +542 -0
- package/dist/vbrief-reconcile/swarm-deps.d.ts +8 -0
- package/dist/vbrief-reconcile/swarm-deps.js +142 -0
- package/dist/vbrief-reconcile/types.d.ts +128 -0
- package/dist/vbrief-reconcile/types.js +2 -0
- package/dist/vbrief-reconcile/umbrellas.d.ts +48 -0
- package/dist/vbrief-reconcile/umbrellas.js +462 -0
- package/dist/vbrief-validate/conformance.d.ts +26 -0
- package/dist/vbrief-validate/conformance.js +273 -0
- package/dist/vbrief-validate/constants.d.ts +13 -0
- package/dist/vbrief-validate/constants.js +36 -0
- package/dist/vbrief-validate/decomposition.d.ts +3 -0
- package/dist/vbrief-validate/decomposition.js +38 -0
- package/dist/vbrief-validate/epic-links.d.ts +4 -0
- package/dist/vbrief-validate/epic-links.js +152 -0
- package/dist/vbrief-validate/filename.d.ts +5 -0
- package/dist/vbrief-validate/filename.js +62 -0
- package/dist/vbrief-validate/folder-status.d.ts +4 -0
- package/dist/vbrief-validate/folder-status.js +30 -0
- package/dist/vbrief-validate/index.d.ts +14 -0
- package/dist/vbrief-validate/index.js +11 -0
- package/dist/vbrief-validate/main.d.ts +17 -0
- package/dist/vbrief-validate/main.js +127 -0
- package/dist/vbrief-validate/origin.d.ts +4 -0
- package/dist/vbrief-validate/origin.js +76 -0
- package/dist/vbrief-validate/paths.d.ts +11 -0
- package/dist/vbrief-validate/paths.js +83 -0
- package/dist/vbrief-validate/placeholders.d.ts +3 -0
- package/dist/vbrief-validate/placeholders.js +33 -0
- package/dist/vbrief-validate/plan-hooks.d.ts +9 -0
- package/dist/vbrief-validate/plan-hooks.js +145 -0
- package/dist/vbrief-validate/precutover.d.ts +7 -0
- package/dist/vbrief-validate/precutover.js +30 -0
- package/dist/vbrief-validate/project-definition.d.ts +4 -0
- package/dist/vbrief-validate/project-definition.js +166 -0
- package/dist/vbrief-validate/schema.d.ts +8 -0
- package/dist/vbrief-validate/schema.js +150 -0
- package/dist/vbrief-validate/staleness.d.ts +3 -0
- package/dist/vbrief-validate/staleness.js +106 -0
- package/dist/vbrief-validate/validate-all.d.ts +17 -0
- package/dist/vbrief-validate/validate-all.js +119 -0
- package/dist/vbrief-validation/fidelity.d.ts +22 -0
- package/dist/vbrief-validation/fidelity.js +508 -0
- package/dist/vbrief-validation/index.d.ts +11 -0
- package/dist/vbrief-validation/index.js +8 -0
- package/dist/vbrief-validation/legacy-sections.d.ts +13 -0
- package/dist/vbrief-validation/legacy-sections.js +124 -0
- package/dist/vbrief-validation/main.d.ts +5 -0
- package/dist/vbrief-validation/main.js +65 -0
- package/dist/vbrief-validation/normalize.d.ts +22 -0
- package/dist/vbrief-validation/normalize.js +126 -0
- package/dist/vbrief-validation/parity-scenarios.d.ts +14 -0
- package/dist/vbrief-validation/parity-scenarios.js +523 -0
- package/dist/vbrief-validation/safety.d.ts +38 -0
- package/dist/vbrief-validation/safety.js +422 -0
- package/dist/vbrief-validation/story-quality.d.ts +29 -0
- package/dist/vbrief-validation/story-quality.js +452 -0
- package/dist/vbrief-validation/types.d.ts +58 -0
- package/dist/vbrief-validation/types.js +2 -0
- package/dist/vbrief-validation/validation.d.ts +15 -0
- package/dist/vbrief-validation/validation.js +123 -0
- package/dist/verify-env/index.d.ts +6 -0
- package/dist/verify-env/index.js +6 -0
- package/dist/verify-env/node-runtime.d.ts +6 -0
- package/dist/verify-env/node-runtime.js +11 -0
- package/dist/verify-env/toolchain-check.d.ts +28 -0
- package/dist/verify-env/toolchain-check.js +68 -0
- package/dist/verify-env/verify-hooks-installed.d.ts +21 -0
- package/dist/verify-env/verify-hooks-installed.js +162 -0
- package/dist/verify-env/verify-no-task-runtime.d.ts +20 -0
- package/dist/verify-env/verify-no-task-runtime.js +383 -0
- package/dist/verify-env/verify-tools.d.ts +59 -0
- package/dist/verify-env/verify-tools.js +354 -0
- package/dist/verify-source/code-structure-validate.d.ts +48 -0
- package/dist/verify-source/code-structure-validate.js +678 -0
- package/dist/verify-source/content-manifest.d.ts +102 -0
- package/dist/verify-source/content-manifest.js +282 -0
- package/dist/verify-source/index.d.ts +7 -0
- package/dist/verify-source/index.js +7 -0
- package/dist/verify-source/python-call-scan.d.ts +14 -0
- package/dist/verify-source/python-call-scan.js +137 -0
- package/dist/verify-source/rule-ownership-lint.d.ts +33 -0
- package/dist/verify-source/rule-ownership-lint.js +179 -0
- package/dist/verify-source/scm-boundary.d.ts +26 -0
- package/dist/verify-source/scm-boundary.js +170 -0
- package/dist/verify-source/verify-stubs.d.ts +19 -0
- package/dist/verify-source/verify-stubs.js +185 -0
- package/dist/wip-cap/evaluate.d.ts +17 -0
- package/dist/wip-cap/evaluate.js +62 -0
- package/dist/wip-cap/index.d.ts +2 -0
- package/dist/wip-cap/index.js +2 -0
- package/package.json +206 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { ALLOWED_SOURCES, DEFAULT_BATCH_SIZE, DEFAULT_DELAY_MS, DEFAULT_PRUNE_OLDER_THAN_DAYS, } from "./constants.js";
|
|
4
|
+
import { CacheCapBreachedError, CacheError, CacheFetchError, CacheNotFoundError, CacheValidationError, } from "./errors.js";
|
|
5
|
+
import { cacheFetchAll, cacheRefreshClosed } from "./fetch.js";
|
|
6
|
+
import { pythonBool, pythonJsonPretty } from "./json.js";
|
|
7
|
+
import { cacheGet, cacheInvalidate, cachePrune, cachePruneToCap, cachePut } from "./operations.js";
|
|
8
|
+
import { resolveCaps } from "./quota.js";
|
|
9
|
+
function normaliseLabelFilter(raw) {
|
|
10
|
+
if (!raw || raw.length === 0)
|
|
11
|
+
return [];
|
|
12
|
+
return raw.flatMap((value) => value
|
|
13
|
+
.split(",")
|
|
14
|
+
.map((item) => item.trim())
|
|
15
|
+
.filter((item) => item.length > 0));
|
|
16
|
+
}
|
|
17
|
+
function usage() {
|
|
18
|
+
process.stderr.write("usage: cache [-h] {put,get,invalidate,fetch-all,prune} ...\n");
|
|
19
|
+
}
|
|
20
|
+
function cmdPut(args) {
|
|
21
|
+
let source = "";
|
|
22
|
+
let key = "";
|
|
23
|
+
let rawFile;
|
|
24
|
+
let ttlSeconds;
|
|
25
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
26
|
+
const arg = args[i];
|
|
27
|
+
if (arg === "--raw-file") {
|
|
28
|
+
rawFile = args[i + 1];
|
|
29
|
+
i += 1;
|
|
30
|
+
}
|
|
31
|
+
else if (arg === "--ttl-seconds") {
|
|
32
|
+
ttlSeconds = Number.parseInt(args[i + 1] ?? "", 10);
|
|
33
|
+
i += 1;
|
|
34
|
+
}
|
|
35
|
+
else if (!source) {
|
|
36
|
+
source = arg ?? "";
|
|
37
|
+
}
|
|
38
|
+
else if (!key) {
|
|
39
|
+
key = arg ?? "";
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new CacheError(`unexpected argument: ${arg}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!source || !key || !rawFile) {
|
|
46
|
+
process.stderr.write("usage: cache put [-h] --raw-file RAW_FILE [--ttl-seconds TTL_SECONDS] {github-issue} key\n");
|
|
47
|
+
process.stderr.write("cache put: error: the following arguments are required: source, key, --raw-file\n");
|
|
48
|
+
return 2;
|
|
49
|
+
}
|
|
50
|
+
if (!ALLOWED_SOURCES.includes(source)) {
|
|
51
|
+
process.stderr.write(`cache put: error: invalid source '${source}'\n`);
|
|
52
|
+
return 2;
|
|
53
|
+
}
|
|
54
|
+
const rawPath = resolve(rawFile);
|
|
55
|
+
if (!existsSync(rawPath)) {
|
|
56
|
+
throw new CacheError(`--raw-file not found: ${rawPath}`);
|
|
57
|
+
}
|
|
58
|
+
let raw;
|
|
59
|
+
try {
|
|
60
|
+
raw = JSON.parse(readFileSync(rawPath, "utf8"));
|
|
61
|
+
}
|
|
62
|
+
catch (exc) {
|
|
63
|
+
const msg = exc instanceof Error ? exc.message : String(exc);
|
|
64
|
+
throw new CacheError(`--raw-file is not valid JSON: ${msg}`);
|
|
65
|
+
}
|
|
66
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
67
|
+
throw new CacheError(`--raw-file must be a JSON object (got ${Array.isArray(raw) ? "array" : typeof raw})`);
|
|
68
|
+
}
|
|
69
|
+
const result = cachePut(source, key, raw, { ttlSeconds });
|
|
70
|
+
const flagCats = result.scanResult.flags.map((f) => `'${f.category}'`).join(", ");
|
|
71
|
+
process.stdout.write(`cache:put source=${result.source} key=${result.key} scan_passed=${pythonBool(result.scanResult.passed)} flags=[${flagCats}] content_written=${pythonBool(result.contentWritten)} dir=${result.entryDir}\n`);
|
|
72
|
+
return result.scanResult.passed ? 0 : 2;
|
|
73
|
+
}
|
|
74
|
+
function cmdGet(args) {
|
|
75
|
+
let source = "";
|
|
76
|
+
let key = "";
|
|
77
|
+
let allowStale = true;
|
|
78
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
79
|
+
const arg = args[i];
|
|
80
|
+
if (arg === "--allow-stale") {
|
|
81
|
+
allowStale = true;
|
|
82
|
+
}
|
|
83
|
+
else if (arg === "--no-stale") {
|
|
84
|
+
allowStale = false;
|
|
85
|
+
}
|
|
86
|
+
else if (!source) {
|
|
87
|
+
source = arg ?? "";
|
|
88
|
+
}
|
|
89
|
+
else if (!key) {
|
|
90
|
+
key = arg ?? "";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!source || !key) {
|
|
94
|
+
process.stderr.write("usage: cache get [-h] {github-issue} key [--allow-stale | --no-stale]\n");
|
|
95
|
+
return 2;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const result = cacheGet(source, key, { allowStale });
|
|
99
|
+
const payload = {
|
|
100
|
+
source: result.source,
|
|
101
|
+
key: result.key,
|
|
102
|
+
entry_dir: result.entryDir,
|
|
103
|
+
content_path: result.contentPath,
|
|
104
|
+
stale: result.stale,
|
|
105
|
+
meta: result.meta,
|
|
106
|
+
};
|
|
107
|
+
process.stdout.write(`${pythonJsonPretty(payload)}\n`);
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
if (err instanceof CacheNotFoundError) {
|
|
112
|
+
process.stderr.write(`cache:get miss: ${JSON.stringify(err.message)}\n`);
|
|
113
|
+
return 1;
|
|
114
|
+
}
|
|
115
|
+
throw err;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function cmdInvalidate(args) {
|
|
119
|
+
let source = "";
|
|
120
|
+
let key = "";
|
|
121
|
+
let reason;
|
|
122
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
123
|
+
const arg = args[i];
|
|
124
|
+
if (arg === "--reason") {
|
|
125
|
+
reason = args[i + 1];
|
|
126
|
+
i += 1;
|
|
127
|
+
}
|
|
128
|
+
else if (!source) {
|
|
129
|
+
source = arg ?? "";
|
|
130
|
+
}
|
|
131
|
+
else if (!key) {
|
|
132
|
+
key = arg ?? "";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (!source || !key) {
|
|
136
|
+
process.stderr.write("usage: cache invalidate [-h] {github-issue} key [--reason TEXT]\n");
|
|
137
|
+
return 2;
|
|
138
|
+
}
|
|
139
|
+
const existed = cacheInvalidate(source, key, { reason });
|
|
140
|
+
process.stdout.write(`cache:invalidate source=${source} key=${key} existed=${pythonBool(existed)}\n`);
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
function cmdFetchAll(args) {
|
|
144
|
+
let source = "";
|
|
145
|
+
let repo = "";
|
|
146
|
+
let batchSize = DEFAULT_BATCH_SIZE;
|
|
147
|
+
let delayMs = DEFAULT_DELAY_MS;
|
|
148
|
+
let ttlSeconds;
|
|
149
|
+
let state = "open";
|
|
150
|
+
let limit = 1000;
|
|
151
|
+
const labels = [];
|
|
152
|
+
let author;
|
|
153
|
+
let refreshClosed = false;
|
|
154
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
155
|
+
const arg = args[i];
|
|
156
|
+
if (arg === "--source") {
|
|
157
|
+
source = args[i + 1] ?? "";
|
|
158
|
+
i += 1;
|
|
159
|
+
}
|
|
160
|
+
else if (arg === "--repo") {
|
|
161
|
+
repo = args[i + 1] ?? "";
|
|
162
|
+
i += 1;
|
|
163
|
+
}
|
|
164
|
+
else if (arg === "--batch-size") {
|
|
165
|
+
batchSize = Number.parseInt(args[i + 1] ?? "", 10);
|
|
166
|
+
i += 1;
|
|
167
|
+
}
|
|
168
|
+
else if (arg === "--delay-ms") {
|
|
169
|
+
delayMs = Number.parseInt(args[i + 1] ?? "", 10);
|
|
170
|
+
i += 1;
|
|
171
|
+
}
|
|
172
|
+
else if (arg === "--ttl-seconds") {
|
|
173
|
+
ttlSeconds = Number.parseInt(args[i + 1] ?? "", 10);
|
|
174
|
+
i += 1;
|
|
175
|
+
}
|
|
176
|
+
else if (arg === "--state") {
|
|
177
|
+
state = args[i + 1] ?? "open";
|
|
178
|
+
i += 1;
|
|
179
|
+
}
|
|
180
|
+
else if (arg === "--limit") {
|
|
181
|
+
limit = Number.parseInt(args[i + 1] ?? "", 10);
|
|
182
|
+
i += 1;
|
|
183
|
+
}
|
|
184
|
+
else if (arg === "--label") {
|
|
185
|
+
labels.push(args[i + 1] ?? "");
|
|
186
|
+
i += 1;
|
|
187
|
+
}
|
|
188
|
+
else if (arg === "--author") {
|
|
189
|
+
author = args[i + 1];
|
|
190
|
+
i += 1;
|
|
191
|
+
}
|
|
192
|
+
else if (arg === "--refresh-closed") {
|
|
193
|
+
refreshClosed = true;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (!source || !repo) {
|
|
197
|
+
process.stderr.write("usage: cache fetch-all --source SOURCE --repo OWNER/NAME [options]\n");
|
|
198
|
+
return 2;
|
|
199
|
+
}
|
|
200
|
+
const report = cacheFetchAll({
|
|
201
|
+
source,
|
|
202
|
+
repo,
|
|
203
|
+
batchSize,
|
|
204
|
+
delayMs,
|
|
205
|
+
ttlSeconds,
|
|
206
|
+
state,
|
|
207
|
+
limit,
|
|
208
|
+
labels: normaliseLabelFilter(labels),
|
|
209
|
+
author: author ?? null,
|
|
210
|
+
});
|
|
211
|
+
process.stdout.write(`${report.toJson()}\n`);
|
|
212
|
+
let rc = report.issuesFailed === 0 ? 0 : 1;
|
|
213
|
+
if (refreshClosed) {
|
|
214
|
+
const refresh = cacheRefreshClosed({
|
|
215
|
+
source,
|
|
216
|
+
repo,
|
|
217
|
+
ttlSeconds,
|
|
218
|
+
delayMs,
|
|
219
|
+
limit,
|
|
220
|
+
});
|
|
221
|
+
process.stdout.write(`${refresh.toJson()}\n`);
|
|
222
|
+
if (refresh.refreshFailed)
|
|
223
|
+
rc = 1;
|
|
224
|
+
}
|
|
225
|
+
return rc;
|
|
226
|
+
}
|
|
227
|
+
function cmdPrune(args) {
|
|
228
|
+
let olderThanDays = DEFAULT_PRUNE_OLDER_THAN_DAYS;
|
|
229
|
+
let source;
|
|
230
|
+
let dryRun = false;
|
|
231
|
+
let toCap = false;
|
|
232
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
233
|
+
const arg = args[i];
|
|
234
|
+
if (arg === "--older-than-days") {
|
|
235
|
+
olderThanDays = Number.parseInt(args[i + 1] ?? "", 10);
|
|
236
|
+
i += 1;
|
|
237
|
+
}
|
|
238
|
+
else if (arg === "--source") {
|
|
239
|
+
source = args[i + 1];
|
|
240
|
+
i += 1;
|
|
241
|
+
}
|
|
242
|
+
else if (arg === "--dry-run") {
|
|
243
|
+
dryRun = true;
|
|
244
|
+
}
|
|
245
|
+
else if (arg === "--to-cap") {
|
|
246
|
+
toCap = true;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (toCap) {
|
|
250
|
+
const evicted = cachePruneToCap({ dryRun });
|
|
251
|
+
const caps = resolveCaps();
|
|
252
|
+
const payload = {
|
|
253
|
+
mode: "to-cap",
|
|
254
|
+
max_bytes: caps.maxBytes,
|
|
255
|
+
max_entries: caps.maxEntries,
|
|
256
|
+
dry_run: dryRun,
|
|
257
|
+
evicted_count: evicted.length,
|
|
258
|
+
evicted_keys: evicted.map((e) => `${e.source}/${e.key}`),
|
|
259
|
+
freed_bytes: evicted.reduce((sum, e) => sum + e.sizeBytes, 0),
|
|
260
|
+
};
|
|
261
|
+
process.stdout.write(`${pythonJsonPretty(payload)}\n`);
|
|
262
|
+
return 0;
|
|
263
|
+
}
|
|
264
|
+
const removed = cachePrune({ olderThanDays, source, dryRun });
|
|
265
|
+
const payload = {
|
|
266
|
+
older_than_days: olderThanDays,
|
|
267
|
+
source: source ?? "all",
|
|
268
|
+
dry_run: dryRun,
|
|
269
|
+
removed_count: removed.length,
|
|
270
|
+
removed_paths: removed,
|
|
271
|
+
};
|
|
272
|
+
process.stdout.write(`${pythonJsonPretty(payload)}\n`);
|
|
273
|
+
return 0;
|
|
274
|
+
}
|
|
275
|
+
/** CLI entry point (mirrors `scripts/cache.py::main`). */
|
|
276
|
+
export function main(argv) {
|
|
277
|
+
if (argv.length === 0) {
|
|
278
|
+
usage();
|
|
279
|
+
process.stderr.write("cache: error: the following arguments are required: cmd\n");
|
|
280
|
+
return 2;
|
|
281
|
+
}
|
|
282
|
+
const cmd = argv[0];
|
|
283
|
+
const rest = argv.slice(1);
|
|
284
|
+
try {
|
|
285
|
+
switch (cmd) {
|
|
286
|
+
case "put":
|
|
287
|
+
return cmdPut(rest);
|
|
288
|
+
case "get":
|
|
289
|
+
return cmdGet(rest);
|
|
290
|
+
case "invalidate":
|
|
291
|
+
return cmdInvalidate(rest);
|
|
292
|
+
case "fetch-all":
|
|
293
|
+
return cmdFetchAll(rest);
|
|
294
|
+
case "prune":
|
|
295
|
+
return cmdPrune(rest);
|
|
296
|
+
default:
|
|
297
|
+
usage();
|
|
298
|
+
process.stderr.write(`cache: error: argument cmd: invalid choice: '${cmd}'\n`);
|
|
299
|
+
return 2;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch (err) {
|
|
303
|
+
if (err instanceof CacheCapBreachedError) {
|
|
304
|
+
process.stderr.write(`cache: cap breached: ${err.message}\n`);
|
|
305
|
+
return 3;
|
|
306
|
+
}
|
|
307
|
+
if (err instanceof CacheError || err instanceof CacheFetchError) {
|
|
308
|
+
process.stderr.write(`cache: error: ${err.message}\n`);
|
|
309
|
+
return 1;
|
|
310
|
+
}
|
|
311
|
+
if (err instanceof CacheValidationError) {
|
|
312
|
+
process.stderr.write(`cache: schema error: ${err.message}\n`);
|
|
313
|
+
return 2;
|
|
314
|
+
}
|
|
315
|
+
/* v8 ignore next -- unexpected internal errors propagate */
|
|
316
|
+
throw err;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type CacheCaps, type EntryUsage } from "./quota.js";
|
|
2
|
+
import { SCANNER_VERSION } from "./scanner.js";
|
|
3
|
+
import { type Clock } from "./time.js";
|
|
4
|
+
import type { CacheGetOptions, CachePutOptions, GetResult, PutResult } from "./types.js";
|
|
5
|
+
/** Write a cache entry (mirrors `cache.cache_put`). */
|
|
6
|
+
export declare function cachePut(source: string, key: string, raw: Record<string, unknown>, options?: CachePutOptions): PutResult;
|
|
7
|
+
/** Read a cache entry (mirrors `cache.cache_get`). */
|
|
8
|
+
export declare function cacheGet(source: string, key: string, options?: CacheGetOptions): GetResult;
|
|
9
|
+
/** Delete entry + audit (mirrors `cache.cache_invalidate`). */
|
|
10
|
+
export declare function cacheInvalidate(source: string, key: string, options?: {
|
|
11
|
+
reason?: string | null;
|
|
12
|
+
cacheRoot?: string;
|
|
13
|
+
clock?: Clock;
|
|
14
|
+
}): boolean;
|
|
15
|
+
/** Remove entries past TTL threshold (mirrors `cache.cache_prune`). */
|
|
16
|
+
export declare function cachePrune(options?: {
|
|
17
|
+
olderThanDays?: number;
|
|
18
|
+
source?: string | null;
|
|
19
|
+
dryRun?: boolean;
|
|
20
|
+
cacheRoot?: string;
|
|
21
|
+
clock?: Clock;
|
|
22
|
+
}): string[];
|
|
23
|
+
/** LRU-evict until under caps (mirrors `cache.cache_prune_to_cap`). */
|
|
24
|
+
export declare function cachePruneToCap(options?: {
|
|
25
|
+
cacheRoot?: string;
|
|
26
|
+
caps?: CacheCaps | null;
|
|
27
|
+
dryRun?: boolean;
|
|
28
|
+
clock?: Clock;
|
|
29
|
+
}): EntryUsage[];
|
|
30
|
+
export declare function isFresh(metaPath: string, clock?: Clock): boolean;
|
|
31
|
+
/** Validate repo slug for fetch-all. */
|
|
32
|
+
export declare function validateRepo(repo: string): void;
|
|
33
|
+
export { SCANNER_VERSION };
|
|
34
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, unlinkSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { ALLOWED_SOURCES, REPO_RE, SOURCE_TTL_SECONDS } from "./constants.js";
|
|
4
|
+
import { CacheCapBreachedError, CacheError, CacheNotFoundError, CacheValidationError, } from "./errors.js";
|
|
5
|
+
import { appendAudit, atomicWriteText, fileSize, removeEntryDir, touchMtime } from "./io.js";
|
|
6
|
+
import { pythonJsonDump } from "./json.js";
|
|
7
|
+
import { entryDir, validateKey } from "./paths.js";
|
|
8
|
+
import { enforceCaps, predictEvictionSet, resolveCaps, } from "./quota.js";
|
|
9
|
+
import { flagsForMeta, SCANNER_VERSION, scan } from "./scanner.js";
|
|
10
|
+
import { addSeconds, parseIso, systemClock, utcIso } from "./time.js";
|
|
11
|
+
import { validateMeta } from "./validate.js";
|
|
12
|
+
function renderContent(source, raw) {
|
|
13
|
+
if (source === "github-issue") {
|
|
14
|
+
const number = raw.number;
|
|
15
|
+
const title = raw.title ?? "";
|
|
16
|
+
const body = raw.body ?? "";
|
|
17
|
+
if (typeof number !== "number") {
|
|
18
|
+
throw new CacheError(`invalid github-issue raw payload: 'number' must be int (got ${typeof number})`);
|
|
19
|
+
}
|
|
20
|
+
return `# #${number}: ${title}\n\n${body}`;
|
|
21
|
+
}
|
|
22
|
+
throw new CacheError(`unknown source '${source}': v1 supports ${JSON.stringify([...ALLOWED_SOURCES].sort())}`);
|
|
23
|
+
}
|
|
24
|
+
function buildMeta(options) {
|
|
25
|
+
return {
|
|
26
|
+
source: options.source,
|
|
27
|
+
key: options.key,
|
|
28
|
+
fetched_at: utcIso(options.clock, options.fetchedAt),
|
|
29
|
+
ttl_seconds: options.ttlSeconds,
|
|
30
|
+
expires_at: utcIso(options.clock, options.expiresAt),
|
|
31
|
+
scan_result: {
|
|
32
|
+
passed: options.scanResult.passed,
|
|
33
|
+
scanned_at: options.scanResult.scanned_at,
|
|
34
|
+
scanner_version: options.scanResult.scanner_version,
|
|
35
|
+
flags: flagsForMeta(options.scanResult.flags),
|
|
36
|
+
},
|
|
37
|
+
size_bytes: options.sizeBytes,
|
|
38
|
+
stale: false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function existingEntrySize(edir) {
|
|
42
|
+
const metaPath = join(edir, "meta.json");
|
|
43
|
+
if (!existsSync(metaPath))
|
|
44
|
+
return null;
|
|
45
|
+
try {
|
|
46
|
+
const meta = JSON.parse(readFileSync(metaPath, "utf8"));
|
|
47
|
+
const size = meta.size_bytes;
|
|
48
|
+
if (typeof size === "number" && size >= 0)
|
|
49
|
+
return size;
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function makeEvictAuditCallback(cacheRoot, trigger, clock) {
|
|
57
|
+
return (victim, reason) => {
|
|
58
|
+
const lastAccessedIso = victim.lastAccessed > 0 ? utcIso(clock, new Date(victim.lastAccessed * 1000)) : "unknown";
|
|
59
|
+
appendAudit({
|
|
60
|
+
event: "cache:evict",
|
|
61
|
+
source: victim.source,
|
|
62
|
+
key: victim.key,
|
|
63
|
+
timestamp: utcIso(clock),
|
|
64
|
+
reason,
|
|
65
|
+
trigger,
|
|
66
|
+
freed_bytes: victim.sizeBytes,
|
|
67
|
+
last_accessed_at: lastAccessedIso,
|
|
68
|
+
}, cacheRoot);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Write a cache entry (mirrors `cache.cache_put`). */
|
|
72
|
+
export function cachePut(source, key, raw, options = {}) {
|
|
73
|
+
const clock = options.clock ?? systemClock;
|
|
74
|
+
validateKey(source, key);
|
|
75
|
+
const fetched = options.fetchedAt ?? clock.now();
|
|
76
|
+
const ttl = options.ttlSeconds !== undefined && options.ttlSeconds !== null
|
|
77
|
+
? options.ttlSeconds
|
|
78
|
+
: SOURCE_TTL_SECONDS[source];
|
|
79
|
+
if (typeof ttl !== "number" || ttl < 0 || !Number.isInteger(ttl)) {
|
|
80
|
+
throw new CacheError(`ttl_seconds must be a non-negative int (got ${JSON.stringify(ttl)})`);
|
|
81
|
+
}
|
|
82
|
+
const expires = addSeconds(fetched, ttl);
|
|
83
|
+
const cacheRoot = options.cacheRoot ?? ".deft-cache";
|
|
84
|
+
const edir = entryDir(source, key, cacheRoot);
|
|
85
|
+
const rawText = pythonJsonDump(raw);
|
|
86
|
+
const rawSize = Buffer.byteLength(rawText, "utf8");
|
|
87
|
+
const existingSize = existingEntrySize(edir);
|
|
88
|
+
const isNewEntry = existingSize === null;
|
|
89
|
+
const incomingDelta = isNewEntry ? rawSize : rawSize - existingSize;
|
|
90
|
+
const incomingEntries = isNewEntry ? 1 : 0;
|
|
91
|
+
const enforceResult = enforceCaps(cacheRoot, {
|
|
92
|
+
caps: options.caps ?? null,
|
|
93
|
+
incomingBytes: incomingDelta,
|
|
94
|
+
incomingEntries,
|
|
95
|
+
protectKeys: [[source, key]],
|
|
96
|
+
onEvict: (victim, reason) => {
|
|
97
|
+
makeEvictAuditCallback(cacheRoot, "cache:put", clock)(victim, reason);
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
if (enforceResult.wouldBreach) {
|
|
101
|
+
const resolved = options.caps ?? resolveCaps();
|
|
102
|
+
const reasonParts = [];
|
|
103
|
+
if (resolved.maxBytes > 0 &&
|
|
104
|
+
enforceResult.finalUsage.totalBytes + incomingDelta > resolved.maxBytes) {
|
|
105
|
+
reasonParts.push("size_cap");
|
|
106
|
+
}
|
|
107
|
+
if (resolved.maxEntries > 0 &&
|
|
108
|
+
enforceResult.finalUsage.totalEntries + incomingEntries > resolved.maxEntries) {
|
|
109
|
+
reasonParts.push("entry_cap");
|
|
110
|
+
}
|
|
111
|
+
throw new CacheCapBreachedError({
|
|
112
|
+
reason: reasonParts.join("+") || "unknown",
|
|
113
|
+
maxBytes: resolved.maxBytes,
|
|
114
|
+
maxEntries: resolved.maxEntries,
|
|
115
|
+
currentBytes: enforceResult.finalUsage.totalBytes,
|
|
116
|
+
currentEntries: enforceResult.finalUsage.totalEntries,
|
|
117
|
+
incomingBytes: incomingDelta,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
atomicWriteText(join(edir, "raw.json"), rawText);
|
|
121
|
+
const authoritativeSize = fileSize(join(edir, "raw.json"));
|
|
122
|
+
const rendered = renderContent(source, raw);
|
|
123
|
+
const scanResult = scan(rendered, utcIso(clock, fetched));
|
|
124
|
+
const contentPath = join(edir, "content.md");
|
|
125
|
+
let contentWritten = false;
|
|
126
|
+
if (scanResult.passed) {
|
|
127
|
+
atomicWriteText(contentPath, scanResult.transformed_content);
|
|
128
|
+
contentWritten = true;
|
|
129
|
+
}
|
|
130
|
+
else if (existsSync(contentPath)) {
|
|
131
|
+
try {
|
|
132
|
+
unlinkSync(contentPath);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
/* ignore */
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const meta = buildMeta({
|
|
139
|
+
source,
|
|
140
|
+
key,
|
|
141
|
+
fetchedAt: fetched,
|
|
142
|
+
ttlSeconds: ttl,
|
|
143
|
+
expiresAt: expires,
|
|
144
|
+
scanResult,
|
|
145
|
+
sizeBytes: authoritativeSize,
|
|
146
|
+
clock,
|
|
147
|
+
});
|
|
148
|
+
validateMeta(meta);
|
|
149
|
+
atomicWriteText(join(edir, "meta.json"), pythonJsonDump(meta));
|
|
150
|
+
appendAudit({
|
|
151
|
+
event: "cache:put",
|
|
152
|
+
source,
|
|
153
|
+
key,
|
|
154
|
+
timestamp: utcIso(clock),
|
|
155
|
+
scan_passed: scanResult.passed,
|
|
156
|
+
scanner_version: scanResult.scanner_version,
|
|
157
|
+
flags: scanResult.flags.map((f) => ({
|
|
158
|
+
category: f.category,
|
|
159
|
+
severity: f.severity,
|
|
160
|
+
detail: f.detail,
|
|
161
|
+
match_count: f.match_count,
|
|
162
|
+
})),
|
|
163
|
+
content_written: contentWritten,
|
|
164
|
+
}, cacheRoot);
|
|
165
|
+
return {
|
|
166
|
+
source,
|
|
167
|
+
key,
|
|
168
|
+
entryDir: edir,
|
|
169
|
+
meta,
|
|
170
|
+
scanResult: {
|
|
171
|
+
passed: scanResult.passed,
|
|
172
|
+
scanner_version: scanResult.scanner_version,
|
|
173
|
+
flags: scanResult.flags,
|
|
174
|
+
transformed_content: scanResult.transformed_content,
|
|
175
|
+
scanned_at: scanResult.scanned_at,
|
|
176
|
+
},
|
|
177
|
+
contentWritten,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/** Read a cache entry (mirrors `cache.cache_get`). */
|
|
181
|
+
export function cacheGet(source, key, options = {}) {
|
|
182
|
+
const clock = options.clock ?? systemClock;
|
|
183
|
+
const cacheRoot = options.cacheRoot ?? ".deft-cache";
|
|
184
|
+
const allowStale = options.allowStale ?? true;
|
|
185
|
+
const edir = entryDir(source, key, cacheRoot);
|
|
186
|
+
const metaPath = join(edir, "meta.json");
|
|
187
|
+
if (!existsSync(metaPath)) {
|
|
188
|
+
throw new CacheNotFoundError(`cache miss for source='${source}' key='${key}' (expected meta.json at ${metaPath})`);
|
|
189
|
+
}
|
|
190
|
+
let meta;
|
|
191
|
+
try {
|
|
192
|
+
meta = JSON.parse(readFileSync(metaPath, "utf8"));
|
|
193
|
+
}
|
|
194
|
+
catch (exc) {
|
|
195
|
+
const msg = exc instanceof Error ? exc.message : String(exc);
|
|
196
|
+
throw new CacheValidationError(`meta.json at ${metaPath} is not valid JSON: ${msg}`);
|
|
197
|
+
}
|
|
198
|
+
validateMeta(meta);
|
|
199
|
+
const expires = parseIso(String(meta.expires_at));
|
|
200
|
+
const isStale = clock.now() > expires;
|
|
201
|
+
if (isStale && !allowStale) {
|
|
202
|
+
throw new CacheNotFoundError(`cache entry stale for source='${source}' key='${key}'; expires_at=${meta.expires_at} (pass --allow-stale to override)`);
|
|
203
|
+
}
|
|
204
|
+
meta.stale = isStale;
|
|
205
|
+
touchMtime(metaPath);
|
|
206
|
+
const contentPath = join(edir, "content.md");
|
|
207
|
+
return {
|
|
208
|
+
source,
|
|
209
|
+
key,
|
|
210
|
+
entryDir: edir,
|
|
211
|
+
meta,
|
|
212
|
+
contentPath: existsSync(contentPath) ? contentPath : null,
|
|
213
|
+
stale: isStale,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/** Delete entry + audit (mirrors `cache.cache_invalidate`). */
|
|
217
|
+
export function cacheInvalidate(source, key, options = {}) {
|
|
218
|
+
const clock = options.clock ?? systemClock;
|
|
219
|
+
validateKey(source, key);
|
|
220
|
+
const cacheRoot = options.cacheRoot ?? ".deft-cache";
|
|
221
|
+
const edir = entryDir(source, key, cacheRoot);
|
|
222
|
+
const existed = existsSync(edir);
|
|
223
|
+
if (existed)
|
|
224
|
+
removeEntryDir(edir);
|
|
225
|
+
appendAudit({
|
|
226
|
+
event: "cache:invalidate",
|
|
227
|
+
source,
|
|
228
|
+
key,
|
|
229
|
+
timestamp: utcIso(clock),
|
|
230
|
+
reason: options.reason ?? "",
|
|
231
|
+
existed,
|
|
232
|
+
}, cacheRoot);
|
|
233
|
+
return existed;
|
|
234
|
+
}
|
|
235
|
+
function metaKeyOrRelpath(metaPath, srcRoot) {
|
|
236
|
+
const parent = join(metaPath, "..");
|
|
237
|
+
if (parent.startsWith(srcRoot)) {
|
|
238
|
+
return parent
|
|
239
|
+
.slice(srcRoot.length + 1)
|
|
240
|
+
.split(/[/\\]/)
|
|
241
|
+
.join("/");
|
|
242
|
+
}
|
|
243
|
+
return parent;
|
|
244
|
+
}
|
|
245
|
+
/** Remove entries past TTL threshold (mirrors `cache.cache_prune`). */
|
|
246
|
+
export function cachePrune(options = {}) {
|
|
247
|
+
const clock = options.clock ?? systemClock;
|
|
248
|
+
const olderThanDays = options.olderThanDays ?? 30;
|
|
249
|
+
if (olderThanDays < 0) {
|
|
250
|
+
throw new CacheError(`--older-than-days must be >= 0 (got ${JSON.stringify(olderThanDays)})`);
|
|
251
|
+
}
|
|
252
|
+
const cacheRoot = options.cacheRoot ?? ".deft-cache";
|
|
253
|
+
if (!existsSync(cacheRoot))
|
|
254
|
+
return [];
|
|
255
|
+
const cutoff = addSeconds(clock.now(), -olderThanDays * 24 * 60 * 60);
|
|
256
|
+
const removed = [];
|
|
257
|
+
const sources = options.source ? [options.source] : [...ALLOWED_SOURCES];
|
|
258
|
+
for (const src of sources) {
|
|
259
|
+
const srcRoot = join(cacheRoot, src);
|
|
260
|
+
if (!existsSync(srcRoot))
|
|
261
|
+
continue;
|
|
262
|
+
const metaPaths = collectMetaPathsUnder(srcRoot);
|
|
263
|
+
for (const metaPath of metaPaths) {
|
|
264
|
+
const edir = join(metaPath, "..");
|
|
265
|
+
let expires;
|
|
266
|
+
let meta = {};
|
|
267
|
+
try {
|
|
268
|
+
meta = JSON.parse(readFileSync(metaPath, "utf8"));
|
|
269
|
+
expires = parseIso(String(meta.expires_at));
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
expires = addSeconds(cutoff, -86400);
|
|
273
|
+
meta = {};
|
|
274
|
+
}
|
|
275
|
+
if (expires >= cutoff)
|
|
276
|
+
continue;
|
|
277
|
+
if (!options.dryRun) {
|
|
278
|
+
removeEntryDir(edir);
|
|
279
|
+
appendAudit({
|
|
280
|
+
event: "cache:prune-entry",
|
|
281
|
+
source: src,
|
|
282
|
+
key: metaKeyOrRelpath(metaPath, srcRoot),
|
|
283
|
+
timestamp: utcIso(clock),
|
|
284
|
+
expires_at: typeof meta === "object" && meta !== null && "expires_at" in meta
|
|
285
|
+
? meta.expires_at
|
|
286
|
+
: "unknown",
|
|
287
|
+
}, cacheRoot);
|
|
288
|
+
}
|
|
289
|
+
removed.push(edir);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return removed;
|
|
293
|
+
}
|
|
294
|
+
function collectMetaPathsUnder(srcRoot) {
|
|
295
|
+
const found = [];
|
|
296
|
+
function walk(dir) {
|
|
297
|
+
if (!existsSync(dir))
|
|
298
|
+
return;
|
|
299
|
+
for (const name of readdirSync(dir, { withFileTypes: true })) {
|
|
300
|
+
const full = join(dir, name.name);
|
|
301
|
+
if (name.isDirectory())
|
|
302
|
+
walk(full);
|
|
303
|
+
else if (name.name === "meta.json")
|
|
304
|
+
found.push(full);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
walk(srcRoot);
|
|
308
|
+
return found;
|
|
309
|
+
}
|
|
310
|
+
/** LRU-evict until under caps (mirrors `cache.cache_prune_to_cap`). */
|
|
311
|
+
export function cachePruneToCap(options = {}) {
|
|
312
|
+
const clock = options.clock ?? systemClock;
|
|
313
|
+
const cacheRoot = options.cacheRoot ?? ".deft-cache";
|
|
314
|
+
const resolved = options.caps ?? resolveCaps();
|
|
315
|
+
if (!resolved.maxBytes && !resolved.maxEntries)
|
|
316
|
+
return [];
|
|
317
|
+
if (options.dryRun) {
|
|
318
|
+
return predictEvictionSet(cacheRoot, resolved);
|
|
319
|
+
}
|
|
320
|
+
const enforceResult = enforceCaps(cacheRoot, {
|
|
321
|
+
caps: resolved,
|
|
322
|
+
onEvict: (victim, reason) => {
|
|
323
|
+
makeEvictAuditCallback(cacheRoot, "cache:prune-to-cap", clock)(victim, reason);
|
|
324
|
+
},
|
|
325
|
+
});
|
|
326
|
+
return enforceResult.evicted;
|
|
327
|
+
}
|
|
328
|
+
export function isFresh(metaPath, clock = systemClock) {
|
|
329
|
+
if (!existsSync(metaPath))
|
|
330
|
+
return false;
|
|
331
|
+
try {
|
|
332
|
+
const meta = JSON.parse(readFileSync(metaPath, "utf8"));
|
|
333
|
+
validateMeta(meta);
|
|
334
|
+
const expires = parseIso(String(meta.expires_at));
|
|
335
|
+
return clock.now() <= expires;
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/** Validate repo slug for fetch-all. */
|
|
342
|
+
export function validateRepo(repo) {
|
|
343
|
+
if (!REPO_RE.test(repo)) {
|
|
344
|
+
throw new CacheError(`invalid --repo '${repo}': expected 'owner/repo' (alphanumerics, '.', '_', '-' only)`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
export { SCANNER_VERSION };
|
|
348
|
+
//# sourceMappingURL=operations.js.map
|