mergestory 0.0.0-stage → 1.0.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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +48 -2
- package/assets/kokoro-plugin/package-lock.json +1139 -0
- package/dist/analyzer/analyze.d.ts +8 -0
- package/dist/analyzer/analyze.js +328 -0
- package/dist/analyzer/components.d.ts +18 -0
- package/dist/analyzer/components.js +266 -0
- package/dist/analyzer/dependencies.d.ts +13 -0
- package/dist/analyzer/dependencies.js +349 -0
- package/dist/analyzer/evidence.d.ts +15 -0
- package/dist/analyzer/evidence.js +73 -0
- package/dist/analyzer/hunks.d.ts +21 -0
- package/dist/analyzer/hunks.js +88 -0
- package/dist/analyzer/imports.d.ts +46 -0
- package/dist/analyzer/imports.js +87 -0
- package/dist/analyzer/index.d.ts +14 -0
- package/dist/analyzer/index.js +16 -0
- package/dist/analyzer/languages/go.d.ts +2 -0
- package/dist/analyzer/languages/go.js +76 -0
- package/dist/analyzer/languages/index.d.ts +18 -0
- package/dist/analyzer/languages/index.js +72 -0
- package/dist/analyzer/languages/javascript.d.ts +2 -0
- package/dist/analyzer/languages/javascript.js +336 -0
- package/dist/analyzer/languages/jvm.d.ts +2 -0
- package/dist/analyzer/languages/jvm.js +157 -0
- package/dist/analyzer/languages/others.d.ts +2 -0
- package/dist/analyzer/languages/others.js +40 -0
- package/dist/analyzer/languages/php.d.ts +2 -0
- package/dist/analyzer/languages/php.js +81 -0
- package/dist/analyzer/languages/python.d.ts +2 -0
- package/dist/analyzer/languages/python.js +180 -0
- package/dist/analyzer/languages/ruby.d.ts +2 -0
- package/dist/analyzer/languages/ruby.js +99 -0
- package/dist/analyzer/languages/rust.d.ts +2 -0
- package/dist/analyzer/languages/rust.js +164 -0
- package/dist/analyzer/languages/shared.d.ts +35 -0
- package/dist/analyzer/languages/shared.js +43 -0
- package/dist/analyzer/languages/types.d.ts +78 -0
- package/dist/analyzer/languages/types.js +2 -0
- package/dist/analyzer/pack-format.d.ts +27 -0
- package/dist/analyzer/pack-format.js +139 -0
- package/dist/analyzer/pack.d.ts +26 -0
- package/dist/analyzer/pack.js +498 -0
- package/dist/analyzer/relationships.d.ts +17 -0
- package/dist/analyzer/relationships.js +34 -0
- package/dist/analyzer/risk-rules.d.ts +287 -0
- package/dist/analyzer/risk-rules.js +373 -0
- package/dist/analyzer/risks.d.ts +36 -0
- package/dist/analyzer/risks.js +480 -0
- package/dist/analyzer/roles.d.ts +11 -0
- package/dist/analyzer/roles.js +280 -0
- package/dist/analyzer/scan.d.ts +26 -0
- package/dist/analyzer/scan.js +157 -0
- package/dist/analyzer/signals.d.ts +20 -0
- package/dist/analyzer/signals.js +51 -0
- package/dist/analyzer/symbol-changes.d.ts +11 -0
- package/dist/analyzer/symbol-changes.js +101 -0
- package/dist/analyzer/symbol-types.d.ts +17 -0
- package/dist/analyzer/symbol-types.js +9 -0
- package/dist/analyzer/symbols.d.ts +4 -0
- package/dist/analyzer/symbols.js +16 -0
- package/dist/analyzer/trivial.d.ts +13 -0
- package/dist/analyzer/trivial.js +137 -0
- package/dist/analyzer/util.d.ts +6 -0
- package/dist/analyzer/util.js +24 -0
- package/dist/cli/commands/authoring.d.ts +9 -0
- package/dist/cli/commands/authoring.js +98 -0
- package/dist/cli/commands/cache.d.ts +4 -0
- package/dist/cli/commands/cache.js +37 -0
- package/dist/cli/commands/doctor.d.ts +5 -0
- package/dist/cli/commands/doctor.js +37 -0
- package/dist/cli/commands/generate.d.ts +8 -0
- package/dist/cli/commands/generate.js +69 -0
- package/dist/cli/commands/jobs.d.ts +8 -0
- package/dist/cli/commands/jobs.js +70 -0
- package/dist/cli/commands/publish.d.ts +8 -0
- package/dist/cli/commands/publish.js +120 -0
- package/dist/cli/commands/serve.d.ts +4 -0
- package/dist/cli/commands/serve.js +69 -0
- package/dist/cli/commands/setup.d.ts +14 -0
- package/dist/cli/commands/setup.js +108 -0
- package/dist/cli/commands/shared.d.ts +18 -0
- package/dist/cli/commands/shared.js +24 -0
- package/dist/cli/files.d.ts +26 -0
- package/dist/cli/files.js +98 -0
- package/dist/cli/format.d.ts +55 -0
- package/dist/cli/format.js +295 -0
- package/dist/cli/inputs.d.ts +23 -0
- package/dist/cli/inputs.js +96 -0
- package/dist/cli/io.d.ts +19 -0
- package/dist/cli/io.js +31 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +15 -0
- package/dist/cli/options.d.ts +105 -0
- package/dist/cli/options.js +324 -0
- package/dist/cli/program.d.ts +12 -0
- package/dist/cli/program.js +146 -0
- package/dist/cli/runtime.d.ts +59 -0
- package/dist/cli/runtime.js +83 -0
- package/dist/cli/style.d.ts +13 -0
- package/dist/cli/style.js +27 -0
- package/dist/core/binaries.d.ts +7 -0
- package/dist/core/binaries.js +33 -0
- package/dist/core/binary-paths.d.ts +5 -0
- package/dist/core/binary-paths.js +92 -0
- package/dist/core/cache.d.ts +14 -0
- package/dist/core/cache.js +43 -0
- package/dist/core/child-env.d.ts +9 -0
- package/dist/core/child-env.js +61 -0
- package/dist/core/concurrency.d.ts +13 -0
- package/dist/core/concurrency.js +58 -0
- package/dist/core/config.d.ts +223 -0
- package/dist/core/config.js +454 -0
- package/dist/core/context.d.ts +39 -0
- package/dist/core/context.js +44 -0
- package/dist/core/cost.d.ts +46 -0
- package/dist/core/cost.js +108 -0
- package/dist/core/diagram-metrics.d.ts +57 -0
- package/dist/core/diagram-metrics.js +63 -0
- package/dist/core/diff-view.d.ts +44 -0
- package/dist/core/diff-view.js +136 -0
- package/dist/core/errors.d.ts +47 -0
- package/dist/core/errors.js +94 -0
- package/dist/core/ids.d.ts +11 -0
- package/dist/core/ids.js +36 -0
- package/dist/core/json.d.ts +8 -0
- package/dist/core/json.js +17 -0
- package/dist/core/languages.d.ts +19 -0
- package/dist/core/languages.js +292 -0
- package/dist/core/logger.d.ts +29 -0
- package/dist/core/logger.js +68 -0
- package/dist/core/net.d.ts +16 -0
- package/dist/core/net.js +80 -0
- package/dist/core/path-policy.d.ts +20 -0
- package/dist/core/path-policy.js +202 -0
- package/dist/core/paths.d.ts +18 -0
- package/dist/core/paths.js +53 -0
- package/dist/core/posix.d.ts +12 -0
- package/dist/core/posix.js +50 -0
- package/dist/core/process.d.ts +22 -0
- package/dist/core/process.js +117 -0
- package/dist/core/providers.d.ts +204 -0
- package/dist/core/providers.js +2 -0
- package/dist/core/redact.d.ts +11 -0
- package/dist/core/redact.js +70 -0
- package/dist/core/render-plan.d.ts +307 -0
- package/dist/core/render-plan.js +7 -0
- package/dist/core/retry.d.ts +54 -0
- package/dist/core/retry.js +116 -0
- package/dist/core/run-folder.d.ts +74 -0
- package/dist/core/run-folder.js +129 -0
- package/dist/core/secrets.d.ts +56 -0
- package/dist/core/secrets.js +301 -0
- package/dist/core/storyboard-facts.d.ts +22 -0
- package/dist/core/storyboard-facts.js +61 -0
- package/dist/core/storyboard-schema.d.ts +1279 -0
- package/dist/core/storyboard-schema.js +342 -0
- package/dist/core/text.d.ts +43 -0
- package/dist/core/text.js +94 -0
- package/dist/core/types.d.ts +459 -0
- package/dist/core/types.js +17 -0
- package/dist/doctor/check.d.ts +6 -0
- package/dist/doctor/check.js +18 -0
- package/dist/doctor/deps.d.ts +2 -0
- package/dist/doctor/deps.js +90 -0
- package/dist/doctor/format.d.ts +9 -0
- package/dist/doctor/format.js +19 -0
- package/dist/doctor/github.d.ts +2 -0
- package/dist/doctor/github.js +13 -0
- package/dist/doctor/home.d.ts +2 -0
- package/dist/doctor/home.js +26 -0
- package/dist/doctor/index.d.ts +18 -0
- package/dist/doctor/index.js +81 -0
- package/dist/doctor/llm.d.ts +2 -0
- package/dist/doctor/llm.js +32 -0
- package/dist/doctor/publish.d.ts +2 -0
- package/dist/doctor/publish.js +16 -0
- package/dist/doctor/s3.d.ts +2 -0
- package/dist/doctor/s3.js +125 -0
- package/dist/doctor/speech.d.ts +2 -0
- package/dist/doctor/speech.js +112 -0
- package/dist/doctor/tools.d.ts +5 -0
- package/dist/doctor/tools.js +58 -0
- package/dist/doctor/types.d.ts +92 -0
- package/dist/doctor/types.js +2 -0
- package/dist/doctor/youtube.d.ts +2 -0
- package/dist/doctor/youtube.js +73 -0
- package/dist/github/client.d.ts +108 -0
- package/dist/github/client.js +499 -0
- package/dist/github/errors.d.ts +37 -0
- package/dist/github/errors.js +155 -0
- package/dist/github/index.d.ts +13 -0
- package/dist/github/index.js +9 -0
- package/dist/github/linked-issues.d.ts +37 -0
- package/dist/github/linked-issues.js +131 -0
- package/dist/github/model.d.ts +81 -0
- package/dist/github/model.js +114 -0
- package/dist/github/notify.d.ts +27 -0
- package/dist/github/notify.js +118 -0
- package/dist/github/pr-url.d.ts +27 -0
- package/dist/github/pr-url.js +122 -0
- package/dist/github/token.d.ts +16 -0
- package/dist/github/token.js +69 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +19 -0
- package/dist/jobs/input-rules.d.ts +20 -0
- package/dist/jobs/input-rules.js +100 -0
- package/dist/jobs/model.d.ts +47 -0
- package/dist/jobs/model.js +18 -0
- package/dist/jobs/runner.d.ts +43 -0
- package/dist/jobs/runner.js +165 -0
- package/dist/jobs/store.d.ts +67 -0
- package/dist/jobs/store.js +314 -0
- package/dist/jobs/view.d.ts +48 -0
- package/dist/jobs/view.js +111 -0
- package/dist/jobs/worker.d.ts +24 -0
- package/dist/jobs/worker.js +47 -0
- package/dist/llm/anthropic.d.ts +11 -0
- package/dist/llm/anthropic.js +225 -0
- package/dist/llm/index.d.ts +10 -0
- package/dist/llm/index.js +27 -0
- package/dist/llm/openai-compatible.d.ts +33 -0
- package/dist/llm/openai-compatible.js +378 -0
- package/dist/llm/prices.d.ts +26 -0
- package/dist/llm/prices.js +41 -0
- package/dist/llm/shared.d.ts +30 -0
- package/dist/llm/shared.js +115 -0
- package/dist/narration/assemble.d.ts +36 -0
- package/dist/narration/assemble.js +282 -0
- package/dist/narration/audio.d.ts +61 -0
- package/dist/narration/audio.js +301 -0
- package/dist/narration/captions.d.ts +37 -0
- package/dist/narration/captions.js +195 -0
- package/dist/narration/chunking.d.ts +6 -0
- package/dist/narration/chunking.js +46 -0
- package/dist/narration/convert.d.ts +9 -0
- package/dist/narration/convert.js +90 -0
- package/dist/narration/elevenlabs.d.ts +5 -0
- package/dist/narration/elevenlabs.js +53 -0
- package/dist/narration/http-errors.d.ts +14 -0
- package/dist/narration/http-errors.js +74 -0
- package/dist/narration/index.d.ts +21 -0
- package/dist/narration/index.js +22 -0
- package/dist/narration/kokoro-install.d.ts +30 -0
- package/dist/narration/kokoro-install.js +284 -0
- package/dist/narration/kokoro-model.d.ts +54 -0
- package/dist/narration/kokoro-model.js +168 -0
- package/dist/narration/kokoro-plugin.d.ts +78 -0
- package/dist/narration/kokoro-plugin.js +245 -0
- package/dist/narration/kokoro.d.ts +22 -0
- package/dist/narration/kokoro.js +231 -0
- package/dist/narration/openai.d.ts +4 -0
- package/dist/narration/openai.js +54 -0
- package/dist/narration/pricing.d.ts +8 -0
- package/dist/narration/pricing.js +17 -0
- package/dist/narration/remote-speech.d.ts +53 -0
- package/dist/narration/remote-speech.js +100 -0
- package/dist/narration/say.d.ts +28 -0
- package/dist/narration/say.js +178 -0
- package/dist/narration/select.d.ts +27 -0
- package/dist/narration/select.js +80 -0
- package/dist/narration/silent.d.ts +2 -0
- package/dist/narration/silent.js +18 -0
- package/dist/narration/speakable.d.ts +20 -0
- package/dist/narration/speakable.js +398 -0
- package/dist/narration/synthesize.d.ts +25 -0
- package/dist/narration/synthesize.js +220 -0
- package/dist/narration/wav.d.ts +37 -0
- package/dist/narration/wav.js +170 -0
- package/dist/pipeline/authoring.d.ts +8 -0
- package/dist/pipeline/authoring.js +117 -0
- package/dist/pipeline/commands.d.ts +9 -0
- package/dist/pipeline/commands.js +21 -0
- package/dist/pipeline/fit-duration.d.ts +41 -0
- package/dist/pipeline/fit-duration.js +150 -0
- package/dist/pipeline/index.d.ts +9 -0
- package/dist/pipeline/index.js +9 -0
- package/dist/pipeline/inputs.d.ts +42 -0
- package/dist/pipeline/inputs.js +171 -0
- package/dist/pipeline/plan.d.ts +8 -0
- package/dist/pipeline/plan.js +85 -0
- package/dist/pipeline/planned-egress.d.ts +21 -0
- package/dist/pipeline/planned-egress.js +43 -0
- package/dist/pipeline/prepare.d.ts +26 -0
- package/dist/pipeline/prepare.js +84 -0
- package/dist/pipeline/presentation.d.ts +26 -0
- package/dist/pipeline/presentation.js +110 -0
- package/dist/pipeline/publish-run.d.ts +71 -0
- package/dist/pipeline/publish-run.js +295 -0
- package/dist/pipeline/run.d.ts +7 -0
- package/dist/pipeline/run.js +196 -0
- package/dist/pipeline/storyboard-choice.d.ts +34 -0
- package/dist/pipeline/storyboard-choice.js +129 -0
- package/dist/pipeline/types.d.ts +76 -0
- package/dist/pipeline/types.js +2 -0
- package/dist/publish/access-probe.d.ts +55 -0
- package/dist/publish/access-probe.js +249 -0
- package/dist/publish/bundle.d.ts +20 -0
- package/dist/publish/bundle.js +57 -0
- package/dist/publish/comment.d.ts +10 -0
- package/dist/publish/comment.js +184 -0
- package/dist/publish/content-types.d.ts +15 -0
- package/dist/publish/content-types.js +41 -0
- package/dist/publish/index.d.ts +18 -0
- package/dist/publish/index.js +30 -0
- package/dist/publish/keys.d.ts +10 -0
- package/dist/publish/keys.js +30 -0
- package/dist/publish/local.d.ts +33 -0
- package/dist/publish/local.js +143 -0
- package/dist/publish/privacy.d.ts +20 -0
- package/dist/publish/privacy.js +21 -0
- package/dist/publish/s3/bucket.d.ts +22 -0
- package/dist/publish/s3/bucket.js +82 -0
- package/dist/publish/s3/client.d.ts +33 -0
- package/dist/publish/s3/client.js +134 -0
- package/dist/publish/s3/failures.d.ts +22 -0
- package/dist/publish/s3/failures.js +110 -0
- package/dist/publish/s3/index.d.ts +5 -0
- package/dist/publish/s3/index.js +6 -0
- package/dist/publish/s3/links.d.ts +38 -0
- package/dist/publish/s3/links.js +60 -0
- package/dist/publish/s3/protected-links.d.ts +29 -0
- package/dist/publish/s3/protected-links.js +67 -0
- package/dist/publish/s3/publisher.d.ts +32 -0
- package/dist/publish/s3/publisher.js +123 -0
- package/dist/publish/s3/settings.d.ts +29 -0
- package/dist/publish/s3/settings.js +64 -0
- package/dist/publish/s3/upload.d.ts +29 -0
- package/dist/publish/s3/upload.js +145 -0
- package/dist/publish/severity.d.ts +9 -0
- package/dist/publish/severity.js +18 -0
- package/dist/publish/text.d.ts +23 -0
- package/dist/publish/text.js +94 -0
- package/dist/publish/types.d.ts +67 -0
- package/dist/publish/types.js +12 -0
- package/dist/publish/vtt.d.ts +9 -0
- package/dist/publish/vtt.js +43 -0
- package/dist/publish/watch-page.d.ts +4 -0
- package/dist/publish/watch-page.js +463 -0
- package/dist/publish/youtube/credentials.d.ts +33 -0
- package/dist/publish/youtube/credentials.js +162 -0
- package/dist/publish/youtube/description.d.ts +56 -0
- package/dist/publish/youtube/description.js +197 -0
- package/dist/publish/youtube/google-api.d.ts +95 -0
- package/dist/publish/youtube/google-api.js +339 -0
- package/dist/publish/youtube/index.d.ts +7 -0
- package/dist/publish/youtube/index.js +8 -0
- package/dist/publish/youtube/loopback.d.ts +13 -0
- package/dist/publish/youtube/loopback.js +144 -0
- package/dist/publish/youtube/oauth.d.ts +68 -0
- package/dist/publish/youtube/oauth.js +159 -0
- package/dist/publish/youtube/prompt.d.ts +27 -0
- package/dist/publish/youtube/prompt.js +94 -0
- package/dist/publish/youtube/publisher.d.ts +38 -0
- package/dist/publish/youtube/publisher.js +346 -0
- package/dist/publish/youtube/scopes.d.ts +32 -0
- package/dist/publish/youtube/scopes.js +55 -0
- package/dist/publish/youtube/sign-in.d.ts +37 -0
- package/dist/publish/youtube/sign-in.js +137 -0
- package/dist/publish/youtube/upload.d.ts +43 -0
- package/dist/publish/youtube/upload.js +210 -0
- package/dist/render/browser.d.ts +23 -0
- package/dist/render/browser.js +219 -0
- package/dist/render/chromium-renderer.d.ts +56 -0
- package/dist/render/chromium-renderer.js +519 -0
- package/dist/render/ffmpeg.d.ts +55 -0
- package/dist/render/ffmpeg.js +212 -0
- package/dist/render/fonts.d.ts +10 -0
- package/dist/render/fonts.js +42 -0
- package/dist/render/index.d.ts +9 -0
- package/dist/render/index.js +11 -0
- package/dist/render/page.d.ts +46 -0
- package/dist/render/page.js +123 -0
- package/dist/render/playwright.d.ts +3 -0
- package/dist/render/playwright.js +6 -0
- package/dist/render/runtime-bundle.d.ts +2 -0
- package/dist/render/runtime-bundle.js +72 -0
- package/dist/runtime/runtime.js +1626 -0
- package/dist/server/auth.d.ts +17 -0
- package/dist/server/auth.js +58 -0
- package/dist/server/http.d.ts +43 -0
- package/dist/server/http.js +119 -0
- package/dist/server/index.d.ts +46 -0
- package/dist/server/index.js +310 -0
- package/dist/server/queue.d.ts +30 -0
- package/dist/server/queue.js +76 -0
- package/dist/server/schema.d.ts +103 -0
- package/dist/server/schema.js +121 -0
- package/dist/server/source.d.ts +17 -0
- package/dist/server/source.js +100 -0
- package/dist/sources/assemble.d.ts +86 -0
- package/dist/sources/assemble.js +117 -0
- package/dist/sources/diff-parser.d.ts +14 -0
- package/dist/sources/diff-parser.js +84 -0
- package/dist/sources/git.d.ts +28 -0
- package/dist/sources/git.js +108 -0
- package/dist/sources/github.d.ts +20 -0
- package/dist/sources/github.js +192 -0
- package/dist/sources/hunk-selection.d.ts +25 -0
- package/dist/sources/hunk-selection.js +46 -0
- package/dist/sources/index.d.ts +23 -0
- package/dist/sources/index.js +62 -0
- package/dist/sources/limits.d.ts +27 -0
- package/dist/sources/limits.js +22 -0
- package/dist/sources/local.d.ts +34 -0
- package/dist/sources/local.js +555 -0
- package/dist/sources/reader.d.ts +13 -0
- package/dist/sources/reader.js +45 -0
- package/dist/sources/remote.d.ts +13 -0
- package/dist/sources/remote.js +41 -0
- package/dist/sources/repo-context.d.ts +34 -0
- package/dist/sources/repo-context.js +144 -0
- package/dist/sources/text.d.ts +25 -0
- package/dist/sources/text.js +71 -0
- package/dist/storyboard/authoring.d.ts +108 -0
- package/dist/storyboard/authoring.js +196 -0
- package/dist/storyboard/claims.d.ts +35 -0
- package/dist/storyboard/claims.js +318 -0
- package/dist/storyboard/coderef.d.ts +28 -0
- package/dist/storyboard/coderef.js +118 -0
- package/dist/storyboard/generate.d.ts +25 -0
- package/dist/storyboard/generate.js +194 -0
- package/dist/storyboard/heuristic-code.d.ts +91 -0
- package/dist/storyboard/heuristic-code.js +524 -0
- package/dist/storyboard/heuristic-context.d.ts +42 -0
- package/dist/storyboard/heuristic-context.js +102 -0
- package/dist/storyboard/heuristic-facts.d.ts +106 -0
- package/dist/storyboard/heuristic-facts.js +415 -0
- package/dist/storyboard/heuristic-overview.d.ts +4 -0
- package/dist/storyboard/heuristic-overview.js +151 -0
- package/dist/storyboard/heuristic-review.d.ts +10 -0
- package/dist/storyboard/heuristic-review.js +158 -0
- package/dist/storyboard/heuristic-scenes.d.ts +8 -0
- package/dist/storyboard/heuristic-scenes.js +357 -0
- package/dist/storyboard/heuristic-shared.d.ts +43 -0
- package/dist/storyboard/heuristic-shared.js +136 -0
- package/dist/storyboard/heuristic.d.ts +15 -0
- package/dist/storyboard/heuristic.js +324 -0
- package/dist/storyboard/identifiers.d.ts +51 -0
- package/dist/storyboard/identifiers.js +195 -0
- package/dist/storyboard/index.d.ts +10 -0
- package/dist/storyboard/index.js +10 -0
- package/dist/storyboard/prompts.d.ts +16 -0
- package/dist/storyboard/prompts.js +61 -0
- package/dist/storyboard/run.d.ts +82 -0
- package/dist/storyboard/run.js +332 -0
- package/dist/storyboard/text.d.ts +16 -0
- package/dist/storyboard/text.js +103 -0
- package/dist/storyboard/types.d.ts +47 -0
- package/dist/storyboard/types.js +2 -0
- package/dist/storyboard/urls.d.ts +15 -0
- package/dist/storyboard/urls.js +83 -0
- package/dist/storyboard/validate.d.ts +8 -0
- package/dist/storyboard/validate.js +525 -0
- package/dist/storyboard/visuals.d.ts +23 -0
- package/dist/storyboard/visuals.js +324 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/visuals/code.d.ts +68 -0
- package/dist/visuals/code.js +385 -0
- package/dist/visuals/highlight.d.ts +17 -0
- package/dist/visuals/highlight.js +85 -0
- package/dist/visuals/image.d.ts +12 -0
- package/dist/visuals/image.js +96 -0
- package/dist/visuals/index.d.ts +10 -0
- package/dist/visuals/index.js +10 -0
- package/dist/visuals/layout.d.ts +89 -0
- package/dist/visuals/layout.js +506 -0
- package/dist/visuals/plan.d.ts +33 -0
- package/dist/visuals/plan.js +511 -0
- package/dist/visuals/timeline.d.ts +31 -0
- package/dist/visuals/timeline.js +96 -0
- package/package.json +74 -4
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type { FileRole, RiskCategory, RiskSeverity } from '../core/types.ts';
|
|
2
|
+
/** What one kind of risk says: its place in the report and the words the reviewer reads. */
|
|
3
|
+
export interface RiskKind {
|
|
4
|
+
category: RiskCategory;
|
|
5
|
+
severity: RiskSeverity;
|
|
6
|
+
/** Starts the detail sentence: "Adds", "Changes", "Removes" or "Reads". */
|
|
7
|
+
verb: string;
|
|
8
|
+
/** A review prompt: starts with "Check" or "Confirm". */
|
|
9
|
+
title: string;
|
|
10
|
+
/** What was found, in plain words. A function when the text counts what it found. */
|
|
11
|
+
what: string | ((count: number) => string);
|
|
12
|
+
}
|
|
13
|
+
export declare const RISK_KINDS: {
|
|
14
|
+
eval: {
|
|
15
|
+
category: "security";
|
|
16
|
+
severity: "high";
|
|
17
|
+
verb: string;
|
|
18
|
+
title: string;
|
|
19
|
+
what: string;
|
|
20
|
+
};
|
|
21
|
+
'process-exec': {
|
|
22
|
+
category: "security";
|
|
23
|
+
severity: "medium";
|
|
24
|
+
verb: string;
|
|
25
|
+
title: string;
|
|
26
|
+
what: string;
|
|
27
|
+
};
|
|
28
|
+
'shell-option': {
|
|
29
|
+
category: "security";
|
|
30
|
+
severity: "medium";
|
|
31
|
+
verb: string;
|
|
32
|
+
title: string;
|
|
33
|
+
what: string;
|
|
34
|
+
};
|
|
35
|
+
'tls-off': {
|
|
36
|
+
category: "security";
|
|
37
|
+
severity: "high";
|
|
38
|
+
verb: string;
|
|
39
|
+
title: string;
|
|
40
|
+
what: string;
|
|
41
|
+
};
|
|
42
|
+
'html-injection': {
|
|
43
|
+
category: "security";
|
|
44
|
+
severity: "medium";
|
|
45
|
+
verb: string;
|
|
46
|
+
title: string;
|
|
47
|
+
what: string;
|
|
48
|
+
};
|
|
49
|
+
'sql-concat': {
|
|
50
|
+
category: "security";
|
|
51
|
+
severity: "medium";
|
|
52
|
+
verb: string;
|
|
53
|
+
title: string;
|
|
54
|
+
what: string;
|
|
55
|
+
};
|
|
56
|
+
'security-check-removed': {
|
|
57
|
+
category: "security";
|
|
58
|
+
severity: "medium";
|
|
59
|
+
verb: string;
|
|
60
|
+
title: string;
|
|
61
|
+
what: string;
|
|
62
|
+
};
|
|
63
|
+
'destructive-sql': {
|
|
64
|
+
category: "data";
|
|
65
|
+
severity: "high";
|
|
66
|
+
verb: string;
|
|
67
|
+
title: string;
|
|
68
|
+
what: string;
|
|
69
|
+
};
|
|
70
|
+
'empty-handler': {
|
|
71
|
+
category: "error-handling";
|
|
72
|
+
severity: "medium";
|
|
73
|
+
verb: string;
|
|
74
|
+
title: string;
|
|
75
|
+
what: string;
|
|
76
|
+
};
|
|
77
|
+
'error-handling-removed': {
|
|
78
|
+
category: "error-handling";
|
|
79
|
+
severity: "medium";
|
|
80
|
+
verb: string;
|
|
81
|
+
title: string;
|
|
82
|
+
what: string;
|
|
83
|
+
};
|
|
84
|
+
suppression: {
|
|
85
|
+
category: "error-handling";
|
|
86
|
+
severity: "low";
|
|
87
|
+
verb: string;
|
|
88
|
+
title: string;
|
|
89
|
+
what: string;
|
|
90
|
+
};
|
|
91
|
+
todo: {
|
|
92
|
+
category: "complexity";
|
|
93
|
+
severity: "low";
|
|
94
|
+
verb: string;
|
|
95
|
+
title: string;
|
|
96
|
+
what: string;
|
|
97
|
+
};
|
|
98
|
+
concurrency: {
|
|
99
|
+
category: "concurrency";
|
|
100
|
+
severity: "low";
|
|
101
|
+
verb: string;
|
|
102
|
+
title: string;
|
|
103
|
+
what: string;
|
|
104
|
+
};
|
|
105
|
+
'feature-flag': {
|
|
106
|
+
category: "config";
|
|
107
|
+
severity: "low";
|
|
108
|
+
verb: string;
|
|
109
|
+
title: string;
|
|
110
|
+
what: string;
|
|
111
|
+
};
|
|
112
|
+
'skipped-test': {
|
|
113
|
+
category: "tests";
|
|
114
|
+
severity: "low";
|
|
115
|
+
verb: string;
|
|
116
|
+
title: string;
|
|
117
|
+
what: string;
|
|
118
|
+
};
|
|
119
|
+
'test-removed': {
|
|
120
|
+
category: "tests";
|
|
121
|
+
severity: "low";
|
|
122
|
+
verb: string;
|
|
123
|
+
title: string;
|
|
124
|
+
what: string;
|
|
125
|
+
};
|
|
126
|
+
'async-loop': {
|
|
127
|
+
category: "concurrency";
|
|
128
|
+
severity: "low";
|
|
129
|
+
verb: string;
|
|
130
|
+
title: string;
|
|
131
|
+
what: string;
|
|
132
|
+
};
|
|
133
|
+
'numeric-setting': {
|
|
134
|
+
category: "performance";
|
|
135
|
+
severity: "low";
|
|
136
|
+
verb: string;
|
|
137
|
+
title: string;
|
|
138
|
+
what: string;
|
|
139
|
+
};
|
|
140
|
+
'security-path': {
|
|
141
|
+
category: "security";
|
|
142
|
+
severity: "medium";
|
|
143
|
+
verb: string;
|
|
144
|
+
title: string;
|
|
145
|
+
what: string;
|
|
146
|
+
};
|
|
147
|
+
'security-words': {
|
|
148
|
+
category: "security";
|
|
149
|
+
severity: "low";
|
|
150
|
+
verb: string;
|
|
151
|
+
title: string;
|
|
152
|
+
what: string;
|
|
153
|
+
};
|
|
154
|
+
'migration-deleted': {
|
|
155
|
+
category: "migration";
|
|
156
|
+
severity: "medium";
|
|
157
|
+
verb: string;
|
|
158
|
+
title: string;
|
|
159
|
+
what: string;
|
|
160
|
+
};
|
|
161
|
+
'migration-destructive': {
|
|
162
|
+
category: "migration";
|
|
163
|
+
severity: "high";
|
|
164
|
+
verb: string;
|
|
165
|
+
title: string;
|
|
166
|
+
what: string;
|
|
167
|
+
};
|
|
168
|
+
'migration-edited': {
|
|
169
|
+
category: "migration";
|
|
170
|
+
severity: "medium";
|
|
171
|
+
verb: string;
|
|
172
|
+
title: string;
|
|
173
|
+
what: string;
|
|
174
|
+
};
|
|
175
|
+
'migration-alter': {
|
|
176
|
+
category: "migration";
|
|
177
|
+
severity: "medium";
|
|
178
|
+
verb: string;
|
|
179
|
+
title: string;
|
|
180
|
+
what: string;
|
|
181
|
+
};
|
|
182
|
+
'migration-new': {
|
|
183
|
+
category: "migration";
|
|
184
|
+
severity: "low";
|
|
185
|
+
verb: string;
|
|
186
|
+
title: string;
|
|
187
|
+
what: string;
|
|
188
|
+
};
|
|
189
|
+
'api-removed': {
|
|
190
|
+
category: "public-api";
|
|
191
|
+
severity: "medium";
|
|
192
|
+
verb: string;
|
|
193
|
+
title: string;
|
|
194
|
+
what: (n: number) => string;
|
|
195
|
+
};
|
|
196
|
+
'api-signature': {
|
|
197
|
+
category: "public-api";
|
|
198
|
+
severity: "medium";
|
|
199
|
+
verb: string;
|
|
200
|
+
title: string;
|
|
201
|
+
what: (n: number) => string;
|
|
202
|
+
};
|
|
203
|
+
'dep-added': {
|
|
204
|
+
category: "dependency";
|
|
205
|
+
severity: "low";
|
|
206
|
+
verb: string;
|
|
207
|
+
title: string;
|
|
208
|
+
what: (n: number) => string;
|
|
209
|
+
};
|
|
210
|
+
'dep-major': {
|
|
211
|
+
category: "dependency";
|
|
212
|
+
severity: "medium";
|
|
213
|
+
verb: string;
|
|
214
|
+
title: string;
|
|
215
|
+
what: (n: number) => string;
|
|
216
|
+
};
|
|
217
|
+
'dep-removed': {
|
|
218
|
+
category: "dependency";
|
|
219
|
+
severity: "info";
|
|
220
|
+
verb: string;
|
|
221
|
+
title: string;
|
|
222
|
+
what: (n: number) => string;
|
|
223
|
+
};
|
|
224
|
+
'no-tests': {
|
|
225
|
+
category: "tests";
|
|
226
|
+
severity: "low";
|
|
227
|
+
verb: string;
|
|
228
|
+
title: string;
|
|
229
|
+
what: string;
|
|
230
|
+
};
|
|
231
|
+
'tests-deleted': {
|
|
232
|
+
category: "tests";
|
|
233
|
+
severity: "medium";
|
|
234
|
+
verb: string;
|
|
235
|
+
title: string;
|
|
236
|
+
what: string;
|
|
237
|
+
};
|
|
238
|
+
'large-hunk': {
|
|
239
|
+
category: "complexity";
|
|
240
|
+
severity: "low";
|
|
241
|
+
verb: string;
|
|
242
|
+
title: string;
|
|
243
|
+
what: string;
|
|
244
|
+
};
|
|
245
|
+
'large-function': {
|
|
246
|
+
category: "complexity";
|
|
247
|
+
severity: "low";
|
|
248
|
+
verb: string;
|
|
249
|
+
title: string;
|
|
250
|
+
what: string;
|
|
251
|
+
};
|
|
252
|
+
'env-vars': {
|
|
253
|
+
category: "config";
|
|
254
|
+
severity: "low";
|
|
255
|
+
verb: string;
|
|
256
|
+
title: string;
|
|
257
|
+
what: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
export type RiskKindId = keyof typeof RISK_KINDS;
|
|
261
|
+
/** A pattern over changed lines. What a match means is in RISK_KINDS under the same key. */
|
|
262
|
+
export interface LineRule {
|
|
263
|
+
key: RiskKindId;
|
|
264
|
+
/**
|
|
265
|
+
* "added" tests added lines. "removed" tests removed lines and only fires when the file loses
|
|
266
|
+
* more matching lines than it gains, so moved or rewritten code does not trigger it.
|
|
267
|
+
*/
|
|
268
|
+
on: 'added' | 'removed';
|
|
269
|
+
pattern: RegExp;
|
|
270
|
+
roles: ReadonlySet<FileRole>;
|
|
271
|
+
/** Also test comment lines (TODO notes, lint suppressions). */
|
|
272
|
+
includeComments?: boolean;
|
|
273
|
+
/** An opening line and the line right after it that together match, for handlers written over two lines. */
|
|
274
|
+
span?: readonly (readonly [RegExp, RegExp])[];
|
|
275
|
+
}
|
|
276
|
+
export declare const CODE_ROLES: ReadonlySet<FileRole>;
|
|
277
|
+
export declare const CODE_AND_CONFIG_ROLES: ReadonlySet<FileRole>;
|
|
278
|
+
export declare const LINE_RULES: readonly LineRule[];
|
|
279
|
+
/** Environment variable reads. Group 1..n hold the variable name. */
|
|
280
|
+
export declare const ENV_READ: RegExp;
|
|
281
|
+
/** CLI command registrations. */
|
|
282
|
+
export declare const CLI_COMMAND: RegExp;
|
|
283
|
+
export declare const NUMERIC_SETTING: RegExp;
|
|
284
|
+
export declare const SECURITY_PATH: RegExp;
|
|
285
|
+
export declare const SECURITY_WORDS: RegExp;
|
|
286
|
+
export declare const DESTRUCTIVE_MIGRATION: RegExp;
|
|
287
|
+
export declare const ALTER_MIGRATION: RegExp;
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/** Line-level review signals. Each rule turns a pattern in changed lines into a question for the reviewer. */
|
|
2
|
+
import { plural } from '../core/text.js';
|
|
3
|
+
export const RISK_KINDS = {
|
|
4
|
+
eval: {
|
|
5
|
+
category: 'security',
|
|
6
|
+
severity: 'high',
|
|
7
|
+
verb: 'Adds',
|
|
8
|
+
title: 'Check the new dynamic code evaluation',
|
|
9
|
+
what: 'a call that runs text as code (eval or new Function)',
|
|
10
|
+
},
|
|
11
|
+
'process-exec': {
|
|
12
|
+
category: 'security',
|
|
13
|
+
severity: 'medium',
|
|
14
|
+
verb: 'Adds',
|
|
15
|
+
title: 'Check the new external process execution',
|
|
16
|
+
what: 'a call that starts an external process',
|
|
17
|
+
},
|
|
18
|
+
'shell-option': {
|
|
19
|
+
category: 'security',
|
|
20
|
+
severity: 'medium',
|
|
21
|
+
verb: 'Adds',
|
|
22
|
+
title: 'Confirm the shell option is needed',
|
|
23
|
+
what: 'a process option that runs the command through a shell',
|
|
24
|
+
},
|
|
25
|
+
'tls-off': {
|
|
26
|
+
category: 'security',
|
|
27
|
+
severity: 'high',
|
|
28
|
+
verb: 'Adds',
|
|
29
|
+
title: 'Confirm TLS certificate verification stays enabled',
|
|
30
|
+
what: 'a setting that turns off TLS certificate verification',
|
|
31
|
+
},
|
|
32
|
+
'html-injection': {
|
|
33
|
+
category: 'security',
|
|
34
|
+
severity: 'medium',
|
|
35
|
+
verb: 'Adds',
|
|
36
|
+
title: 'Check that the HTML inserted here is sanitised',
|
|
37
|
+
what: 'code that inserts raw HTML',
|
|
38
|
+
},
|
|
39
|
+
'sql-concat': {
|
|
40
|
+
category: 'security',
|
|
41
|
+
severity: 'medium',
|
|
42
|
+
verb: 'Adds',
|
|
43
|
+
title: 'Check that this SQL is built with bound parameters',
|
|
44
|
+
what: 'an SQL statement built by joining strings',
|
|
45
|
+
},
|
|
46
|
+
'security-check-removed': {
|
|
47
|
+
category: 'security',
|
|
48
|
+
severity: 'medium',
|
|
49
|
+
verb: 'Removes',
|
|
50
|
+
title: 'Confirm the removed security check is replaced or no longer needed',
|
|
51
|
+
what: 'a sanitising or authorisation check',
|
|
52
|
+
},
|
|
53
|
+
'destructive-sql': {
|
|
54
|
+
category: 'data',
|
|
55
|
+
severity: 'high',
|
|
56
|
+
verb: 'Adds',
|
|
57
|
+
title: 'Confirm this destructive statement is intended and guarded',
|
|
58
|
+
what: 'a statement that deletes data',
|
|
59
|
+
},
|
|
60
|
+
'empty-handler': {
|
|
61
|
+
category: 'error-handling',
|
|
62
|
+
severity: 'medium',
|
|
63
|
+
verb: 'Adds',
|
|
64
|
+
title: 'Check the new error handler that ignores the error',
|
|
65
|
+
what: 'an error handler that does nothing',
|
|
66
|
+
},
|
|
67
|
+
'error-handling-removed': {
|
|
68
|
+
category: 'error-handling',
|
|
69
|
+
severity: 'medium',
|
|
70
|
+
verb: 'Removes',
|
|
71
|
+
title: 'Confirm the removed error handling is no longer needed',
|
|
72
|
+
what: 'try/catch or recovery code',
|
|
73
|
+
},
|
|
74
|
+
suppression: {
|
|
75
|
+
category: 'error-handling',
|
|
76
|
+
severity: 'low',
|
|
77
|
+
verb: 'Adds',
|
|
78
|
+
title: 'Check why the new lint or type-check suppression is needed',
|
|
79
|
+
what: 'a lint or type-check suppression',
|
|
80
|
+
},
|
|
81
|
+
todo: {
|
|
82
|
+
category: 'complexity',
|
|
83
|
+
severity: 'low',
|
|
84
|
+
verb: 'Adds',
|
|
85
|
+
title: 'Check the new TODO, FIXME or HACK notes',
|
|
86
|
+
what: 'a TODO, FIXME or HACK note',
|
|
87
|
+
},
|
|
88
|
+
concurrency: {
|
|
89
|
+
category: 'concurrency',
|
|
90
|
+
severity: 'low',
|
|
91
|
+
verb: 'Adds',
|
|
92
|
+
title: 'Check shared state and ordering around the new concurrent code',
|
|
93
|
+
what: 'concurrent or locking code',
|
|
94
|
+
},
|
|
95
|
+
'feature-flag': {
|
|
96
|
+
category: 'config',
|
|
97
|
+
severity: 'low',
|
|
98
|
+
verb: 'Adds',
|
|
99
|
+
title: 'Confirm the feature flag default and rollout plan',
|
|
100
|
+
what: 'a feature flag',
|
|
101
|
+
},
|
|
102
|
+
'skipped-test': {
|
|
103
|
+
category: 'tests',
|
|
104
|
+
severity: 'low',
|
|
105
|
+
verb: 'Adds',
|
|
106
|
+
title: 'Check the newly skipped tests',
|
|
107
|
+
what: 'a skipped test',
|
|
108
|
+
},
|
|
109
|
+
'test-removed': {
|
|
110
|
+
category: 'tests',
|
|
111
|
+
severity: 'low',
|
|
112
|
+
verb: 'Removes',
|
|
113
|
+
title: 'Check the removed test cases',
|
|
114
|
+
what: 'test cases',
|
|
115
|
+
},
|
|
116
|
+
'async-loop': {
|
|
117
|
+
category: 'concurrency',
|
|
118
|
+
severity: 'low',
|
|
119
|
+
verb: 'Adds',
|
|
120
|
+
title: 'Check the async calls inside a loop',
|
|
121
|
+
what: 'async work repeated in a loop (sequential awaits or unawaited callbacks)',
|
|
122
|
+
},
|
|
123
|
+
'numeric-setting': {
|
|
124
|
+
category: 'performance',
|
|
125
|
+
severity: 'low',
|
|
126
|
+
verb: 'Changes',
|
|
127
|
+
title: 'Check the changed timeout, retry or interval values',
|
|
128
|
+
what: 'a timeout, retry or interval value',
|
|
129
|
+
},
|
|
130
|
+
'security-path': {
|
|
131
|
+
category: 'security',
|
|
132
|
+
severity: 'medium',
|
|
133
|
+
verb: 'Changes',
|
|
134
|
+
title: 'Confirm the change to security-sensitive code is intended',
|
|
135
|
+
what: 'code in a security-related file',
|
|
136
|
+
},
|
|
137
|
+
'security-words': {
|
|
138
|
+
category: 'security',
|
|
139
|
+
severity: 'low',
|
|
140
|
+
verb: 'Changes',
|
|
141
|
+
title: 'Check the security-related logic that changed',
|
|
142
|
+
what: 'logic that mentions authentication, secrets or encryption',
|
|
143
|
+
},
|
|
144
|
+
'migration-deleted': {
|
|
145
|
+
category: 'migration',
|
|
146
|
+
severity: 'medium',
|
|
147
|
+
verb: 'Removes',
|
|
148
|
+
title: 'Confirm deleting this migration is safe for databases that already ran it',
|
|
149
|
+
what: 'a migration file',
|
|
150
|
+
},
|
|
151
|
+
'migration-destructive': {
|
|
152
|
+
category: 'migration',
|
|
153
|
+
severity: 'high',
|
|
154
|
+
verb: 'Adds',
|
|
155
|
+
title: 'Confirm the destructive schema change is safe for existing data',
|
|
156
|
+
what: 'a migration that drops, renames or truncates schema or data',
|
|
157
|
+
},
|
|
158
|
+
'migration-edited': {
|
|
159
|
+
category: 'migration',
|
|
160
|
+
severity: 'medium',
|
|
161
|
+
verb: 'Changes',
|
|
162
|
+
title: 'Confirm editing an existing migration is safe where it already ran',
|
|
163
|
+
what: 'an existing migration file',
|
|
164
|
+
},
|
|
165
|
+
'migration-alter': {
|
|
166
|
+
category: 'migration',
|
|
167
|
+
severity: 'medium',
|
|
168
|
+
verb: 'Adds',
|
|
169
|
+
title: 'Check the schema change against existing rows and the deploy order',
|
|
170
|
+
what: 'a migration that alters existing tables',
|
|
171
|
+
},
|
|
172
|
+
'migration-new': {
|
|
173
|
+
category: 'migration',
|
|
174
|
+
severity: 'low',
|
|
175
|
+
verb: 'Adds',
|
|
176
|
+
title: 'Confirm the new migration can run on existing data',
|
|
177
|
+
what: 'a migration file',
|
|
178
|
+
},
|
|
179
|
+
'api-removed': {
|
|
180
|
+
category: 'public-api',
|
|
181
|
+
severity: 'medium',
|
|
182
|
+
verb: 'Removes',
|
|
183
|
+
title: 'Confirm callers of the removed exports are updated',
|
|
184
|
+
what: (n) => plural(n, 'exported symbol'),
|
|
185
|
+
},
|
|
186
|
+
'api-signature': {
|
|
187
|
+
category: 'public-api',
|
|
188
|
+
severity: 'medium',
|
|
189
|
+
verb: 'Changes',
|
|
190
|
+
title: 'Confirm callers still match the changed signatures',
|
|
191
|
+
what: (n) => `the signature of ${plural(n, 'exported symbol')}`,
|
|
192
|
+
},
|
|
193
|
+
'dep-added': {
|
|
194
|
+
category: 'dependency',
|
|
195
|
+
severity: 'low',
|
|
196
|
+
verb: 'Adds',
|
|
197
|
+
title: 'Confirm the new dependencies are needed and maintained',
|
|
198
|
+
what: (n) => plural(n, 'dependency', 'dependencies'),
|
|
199
|
+
},
|
|
200
|
+
'dep-major': {
|
|
201
|
+
category: 'dependency',
|
|
202
|
+
severity: 'medium',
|
|
203
|
+
verb: 'Changes',
|
|
204
|
+
title: 'Check the major version upgrades for breaking changes',
|
|
205
|
+
what: (n) => plural(n, 'dependency', 'dependencies'),
|
|
206
|
+
},
|
|
207
|
+
'dep-removed': {
|
|
208
|
+
category: 'dependency',
|
|
209
|
+
severity: 'info',
|
|
210
|
+
verb: 'Removes',
|
|
211
|
+
title: 'Confirm the removed dependencies are no longer used',
|
|
212
|
+
what: (n) => plural(n, 'dependency', 'dependencies'),
|
|
213
|
+
},
|
|
214
|
+
'no-tests': {
|
|
215
|
+
category: 'tests',
|
|
216
|
+
severity: 'low',
|
|
217
|
+
verb: 'Changes',
|
|
218
|
+
title: 'Confirm the changed behaviour is covered by tests',
|
|
219
|
+
what: 'source files while no test file changed',
|
|
220
|
+
},
|
|
221
|
+
'tests-deleted': {
|
|
222
|
+
category: 'tests',
|
|
223
|
+
severity: 'medium',
|
|
224
|
+
verb: 'Removes',
|
|
225
|
+
title: 'Confirm the deleted tests are no longer needed',
|
|
226
|
+
what: 'test files',
|
|
227
|
+
},
|
|
228
|
+
'large-hunk': {
|
|
229
|
+
category: 'complexity',
|
|
230
|
+
severity: 'low',
|
|
231
|
+
verb: 'Changes',
|
|
232
|
+
title: 'Check the large change that is hard to review in one piece',
|
|
233
|
+
what: 'a single block of more than 80 lines',
|
|
234
|
+
},
|
|
235
|
+
'large-function': {
|
|
236
|
+
category: 'complexity',
|
|
237
|
+
severity: 'low',
|
|
238
|
+
verb: 'Changes',
|
|
239
|
+
title: 'Check the size of the long function',
|
|
240
|
+
what: 'a function of more than 120 lines',
|
|
241
|
+
},
|
|
242
|
+
'env-vars': {
|
|
243
|
+
category: 'config',
|
|
244
|
+
severity: 'low',
|
|
245
|
+
verb: 'Reads',
|
|
246
|
+
title: 'Check the new environment variables',
|
|
247
|
+
what: 'new environment variables',
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
export const CODE_ROLES = new Set(['source', 'build', 'other']);
|
|
251
|
+
export const CODE_AND_CONFIG_ROLES = new Set([
|
|
252
|
+
'source',
|
|
253
|
+
'build',
|
|
254
|
+
'other',
|
|
255
|
+
'ci',
|
|
256
|
+
'config',
|
|
257
|
+
]);
|
|
258
|
+
const TEST_ROLES = new Set(['test']);
|
|
259
|
+
const SQL_SHAPE = '(?:SELECT\\s[^\'"`\\n]*\\sFROM|INSERT\\s+INTO|UPDATE\\s+\\w+\\s+SET|DELETE\\s+FROM)';
|
|
260
|
+
export const LINE_RULES = [
|
|
261
|
+
{
|
|
262
|
+
key: 'eval',
|
|
263
|
+
on: 'added',
|
|
264
|
+
pattern: /(?<![.$\w])eval\s*\(|\bnew\s+Function\s*\(/,
|
|
265
|
+
roles: CODE_ROLES,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
key: 'process-exec',
|
|
269
|
+
on: 'added',
|
|
270
|
+
pattern: /\bchild_process\b|(?<![.\w$])(?:execSync|execFileSync|spawnSync)\s*\(|\b(?:cp|childProcess)\.(?:exec|execFile|spawn|fork)\s*\(|\bsubprocess\.(?:run|call|Popen|check_output|check_call)\s*\(|\bos\.(?:system|popen)\s*\(|\bexec\.Command(?:Context)?\s*\(|\bRuntime\.getRuntime\(\)\.exec|\bnew\s+ProcessBuilder\s*\(|\b(?:shell_exec|passthru|proc_open|popen)\s*\(|\bProcess\.Start\s*\(|\bOpen3\.\w+\s*\(|\bCommand::new\s*\(/,
|
|
271
|
+
roles: CODE_ROLES,
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
key: 'shell-option',
|
|
275
|
+
on: 'added',
|
|
276
|
+
pattern: /\bshell\s*[:=]\s*(?:true|True)\b/,
|
|
277
|
+
roles: CODE_ROLES,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
key: 'tls-off',
|
|
281
|
+
on: 'added',
|
|
282
|
+
pattern: /rejectUnauthorized\s*:\s*false|NODE_TLS_REJECT_UNAUTHORIZED\s*[=:]\s*['"]?0|\bverify\s*=\s*False|InsecureSkipVerify\s*:\s*true|CURLOPT_SSL_VERIFY(?:PEER|HOST)[^\n]*(?:false|0)|\bssl_verify\w*\s*[=:]\s*false/i,
|
|
283
|
+
roles: CODE_AND_CONFIG_ROLES,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
key: 'html-injection',
|
|
287
|
+
on: 'added',
|
|
288
|
+
pattern: /dangerouslySetInnerHTML|\.innerHTML\s*\+?=|\.outerHTML\s*=|document\.write\s*\(|\bv-html\b|insertAdjacentHTML\s*\(/,
|
|
289
|
+
roles: CODE_ROLES,
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
key: 'sql-concat',
|
|
293
|
+
on: 'added',
|
|
294
|
+
pattern: new RegExp(`['"\`][^'"\`\\n]*\\b${SQL_SHAPE}\\b[^'"\`\\n]*['"\`]\\s*\\+\\s*[\\w$(]|(?:\`|\\bf["'])[^\`'"\\n]*\\b${SQL_SHAPE}\\b[^\`\\n]*(?:\\$\\{|\\{[\\w.\\[\\]'"()]+\\})`, 'i'),
|
|
295
|
+
roles: CODE_ROLES,
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
key: 'security-check-removed',
|
|
299
|
+
on: 'removed',
|
|
300
|
+
pattern: /\b(?:sanitiz\w*|escapeHtml|DOMPurify|htmlspecialchars|csrf\w*|isAuthenticated|isAuthorized|requireAuth\w*|checkPermission\w*|hasPermission\w*|authoriz\w*|verifyToken|validateToken)\b/i,
|
|
301
|
+
roles: CODE_ROLES,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
key: 'destructive-sql',
|
|
305
|
+
on: 'added',
|
|
306
|
+
pattern: /\bDROP\s+(?:TABLE|DATABASE|SCHEMA)\b|\bTRUNCATE\s+(?:TABLE\s+)?\w+|\bDELETE\s+FROM\s+(?![^\n]*\bWHERE\b)[\w."`]+/i,
|
|
307
|
+
roles: CODE_ROLES,
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
key: 'empty-handler',
|
|
311
|
+
on: 'added',
|
|
312
|
+
pattern: /\bcatch\s*(?:\([^)]*\))?\s*\{\s*(?:\/\/[^\n]*|\/\*.*?\*\/)?\s*\}|\.catch\(\s*(?:\(\s*\w*\s*\)|\w+|_)\s*=>\s*(?:\{\s*\}|undefined|null|void 0)\s*\)|\bexcept\b[^:\n]*:\s*pass\b|\bif\s+err\s*!=\s*nil\s*\{\s*\}|\brescue\b[^\n]*\bnil\s*$/,
|
|
313
|
+
roles: CODE_ROLES,
|
|
314
|
+
span: [
|
|
315
|
+
[/\bcatch\s*(?:\([^)]*\))?\s*\{\s*$/, /^\s*\}\s*$/],
|
|
316
|
+
[/^\s*except\b[^:\n]*:\s*$/, /^\s*pass\s*$/],
|
|
317
|
+
],
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
key: 'error-handling-removed',
|
|
321
|
+
on: 'removed',
|
|
322
|
+
pattern: /^\s*(?:\}\s*)?(?:try\s*\{|try\s*:|catch\s*[({]|except\b[^\n]*:|rescue\b|finally\s*\{)|\brecover\s*\(\)/,
|
|
323
|
+
roles: CODE_ROLES,
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
key: 'suppression',
|
|
327
|
+
on: 'added',
|
|
328
|
+
pattern: /eslint-disable|@ts-ignore|@ts-nocheck|@ts-expect-error|#\s*noqa\b|#\s*type:\s*ignore|#\s*pylint:\s*disable|\bnolint\b|nosemgrep|biome-ignore|#\[allow\(|@SuppressWarnings|rubocop:disable|phpcs:ignore|\bNOLINT\b|istanbul\s+ignore/,
|
|
329
|
+
roles: CODE_ROLES,
|
|
330
|
+
includeComments: true,
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
key: 'todo',
|
|
334
|
+
on: 'added',
|
|
335
|
+
pattern: /(?:\/\/|#|\/\*|^\s*\*|--|<!--)[^\n]*\b(?:TODO|FIXME|HACK|XXX)\b/,
|
|
336
|
+
roles: CODE_ROLES,
|
|
337
|
+
includeComments: true,
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
key: 'concurrency',
|
|
341
|
+
on: 'added',
|
|
342
|
+
pattern: /\b(?:sync\.(?:Mutex|RWMutex|WaitGroup|Once|Map|Pool)|Mutex|RwLock|Semaphore|AtomicInteger|AtomicLong|AtomicReference|AtomicBool|threading\.(?:Thread|Lock|RLock|Semaphore|Event)|ThreadPoolExecutor|ProcessPoolExecutor|asyncio\.(?:gather|Lock|Semaphore|Queue|create_task)|Promise\.(?:all|allSettled|race|any)\s*\(|worker_threads|Atomics\.|SharedArrayBuffer|tokio::spawn|thread::spawn|crossbeam)|\bgo\s+(?:func\s*\(|[\w.]+\s*\()|\bnew\s+Worker\s*\(|\bsynchronized\s*[({]|\.\s*(?:lock|acquire)\s*\(\)/,
|
|
343
|
+
roles: CODE_ROLES,
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
key: 'feature-flag',
|
|
347
|
+
on: 'added',
|
|
348
|
+
pattern: /\b(?:featureFlags?|feature_flags?|FEATURE_[A-Z0-9_]{3,}|useFeatureFlag|isFeatureEnabled|ldClient\.variation|flagsmith|unleash\.isEnabled)\b/,
|
|
349
|
+
roles: CODE_AND_CONFIG_ROLES,
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
key: 'skipped-test',
|
|
353
|
+
on: 'added',
|
|
354
|
+
pattern: /\b(?:it|test|describe)\.skip\s*\(|\bx(?:it|describe)\s*\(|@pytest\.mark\.skip|@Disabled\b|\bt\.Skip(?:f|Now)?\s*\(|#\[ignore\]|\.todo\s*\(/,
|
|
355
|
+
roles: TEST_ROLES,
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
key: 'test-removed',
|
|
359
|
+
on: 'removed',
|
|
360
|
+
pattern: /^\s*(?:it|test|describe)(?:\.(?:each|only))?\s*\(|^\s*def\s+test_|^\s*func\s+Test\w+|^\s*@Test\b|^\s*#\[test\]/,
|
|
361
|
+
roles: TEST_ROLES,
|
|
362
|
+
},
|
|
363
|
+
];
|
|
364
|
+
/** Environment variable reads. Group 1..n hold the variable name. */
|
|
365
|
+
export const ENV_READ = /process\.env\.([A-Z][A-Z0-9_]+)|process\.env\[\s*['"]([A-Z][A-Z0-9_]+)['"]\s*\]|import\.meta\.env\.([A-Z][A-Z0-9_]+)|os\.environ(?:\.get)?\s*[([]\s*['"]([A-Z][A-Z0-9_]+)['"]|os\.getenv\(\s*['"]([A-Z][A-Z0-9_]+)['"]|os\.(?:Getenv|LookupEnv)\(\s*"([A-Z][A-Z0-9_]+)"|System\.getenv\(\s*"([A-Z][A-Z0-9_]+)"|\bENV(?:\.fetch\(|\[)\s*['"]([A-Z][A-Z0-9_]+)['"]|\bgetenv\(\s*['"]([A-Z][A-Z0-9_]+)['"]|\$_ENV\[\s*['"]([A-Z][A-Z0-9_]+)['"]|env::var\(\s*"([A-Z][A-Z0-9_]+)"/g;
|
|
366
|
+
/** CLI command registrations. */
|
|
367
|
+
export const CLI_COMMAND = /\.command\(\s*['"]([A-Za-z][\w-]*)(?:\s[^'"]*)?['"]|\badd_parser\(\s*['"]([A-Za-z][\w-]*)['"]|\bUse:\s*"([A-Za-z][\w-]*)(?:\s[^"]*)?"/g;
|
|
368
|
+
export const NUMERIC_SETTING = /\b([A-Za-z_]*?(?:timeout|retries|retry|attempts|backoff|delay|ttl|interval|max_?age|poll)[A-Za-z_]*)\s*[:=]\s*(\d[\d_.]*(?:\s*\*\s*\d[\d_.]*)*)/gi;
|
|
369
|
+
export const SECURITY_PATH = /(^|\/)(auth\w*|login|logout|session\w*|crypto\w*|security|permissions?|acl|rbac|oauth\w*|jwt|passw\w+|secrets?|credentials?)(\/|\.|_|-|$)/i;
|
|
370
|
+
export const SECURITY_WORDS = /\b(?:auth(?:enticat\w*|oriz\w*)?|session|password|passwd|credential\w*|jwt|csrf|cors|crypto\w*|bcrypt|argon2|hmac|encrypt\w*|decrypt\w*|permission\w*|rbac|acl|access_?token|refresh_?token|api_?key|bearer)\b/i;
|
|
371
|
+
export const DESTRUCTIVE_MIGRATION = /\bDROP\s+(?:TABLE|COLUMN|INDEX|SCHEMA|DATABASE|VIEW|TYPE|CONSTRAINT)\b|\bTRUNCATE\b|\bRENAME\s+(?:COLUMN|TO)\b|op\.drop_(?:column|table|index|constraint)|\bdrop_(?:table|column|index)\b|\b(?:dropTable|dropColumn|removeColumn|renameColumn|dropIndex)\s*\(|\bremove_column\b|\brename_column\b|\bchange_column\b|\bDELETE\s+FROM\s+(?![^\n]*\bWHERE\b)[\w."`]+/i;
|
|
372
|
+
export const ALTER_MIGRATION = /\bALTER\s+TABLE\b|op\.alter_column|\badd_column\b|\bADD\s+COLUMN\b|\bSET\s+NOT\s+NULL\b|\bCREATE\s+(?:UNIQUE\s+)?INDEX\b|\baddColumn\s*\(/i;
|
|
373
|
+
//# sourceMappingURL=risk-rules.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review risk signals. Each one is a question for the reviewer, never a claim that something is
|
|
3
|
+
* broken: titles start with "Check" or "Confirm".
|
|
4
|
+
*/
|
|
5
|
+
import type { ChangedFile, ContextInputs, DependencyChange, FileRole, RiskSignal, SymbolChange } from '../core/types.ts';
|
|
6
|
+
export interface RiskFile {
|
|
7
|
+
file: ChangedFile;
|
|
8
|
+
role: FileRole;
|
|
9
|
+
trivial: boolean;
|
|
10
|
+
commentOnly: boolean;
|
|
11
|
+
/** Sensitive or excluded: never inspected. */
|
|
12
|
+
hidden: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface IdentifiedSymbol extends SymbolChange {
|
|
15
|
+
signatureChanged: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RiskInputs {
|
|
18
|
+
files: readonly RiskFile[];
|
|
19
|
+
symbols: readonly IdentifiedSymbol[];
|
|
20
|
+
dependencies: readonly DependencyChange[];
|
|
21
|
+
inputs: ContextInputs;
|
|
22
|
+
meaningfulLines: number;
|
|
23
|
+
}
|
|
24
|
+
export interface CodeSite {
|
|
25
|
+
name: string;
|
|
26
|
+
fileId: string;
|
|
27
|
+
path: string;
|
|
28
|
+
line: number;
|
|
29
|
+
}
|
|
30
|
+
export interface RiskResult {
|
|
31
|
+
risks: RiskSignal[];
|
|
32
|
+
/** Environment variables read for the first time by the change. */
|
|
33
|
+
envVars: CodeSite[];
|
|
34
|
+
cliCommands: CodeSite[];
|
|
35
|
+
}
|
|
36
|
+
export declare function detectRisks(input: RiskInputs): RiskResult;
|