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,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Facts for the offline narration, each taken from data the analysis already has: values in risk
|
|
3
|
+
* details, dependency changes, test files, the names of changed symbols, and statements by the
|
|
4
|
+
* author. Nothing here says more than the data does. Author statements are quoted and attributed.
|
|
5
|
+
*/
|
|
6
|
+
import type { RiskSignal } from '../core/types.ts';
|
|
7
|
+
import { type SymbolView } from './heuristic-code.ts';
|
|
8
|
+
import { type Ctx, type Line } from './heuristic-context.ts';
|
|
9
|
+
export interface NumericFact {
|
|
10
|
+
name: string;
|
|
11
|
+
/** The value before the change, or null when the setting is new. */
|
|
12
|
+
from: string | null;
|
|
13
|
+
to: string;
|
|
14
|
+
}
|
|
15
|
+
/** A number as it is said: no digit separators, and "*" read as "times". */
|
|
16
|
+
export declare function formatNumber(raw: string): string;
|
|
17
|
+
/** The values the analysis found in a "changed timeout, retry or interval" risk. Empty for other risks. */
|
|
18
|
+
export declare function numericFacts(risk: RiskSignal): NumericFact[];
|
|
19
|
+
/**
|
|
20
|
+
* The values as sentences: "DEFAULT_RETRY sets retries to 3 and maxDelayMs to 4000." New values are
|
|
21
|
+
* "set", values that were there before are "changed". `subject` is the name that holds them, or null for "It".
|
|
22
|
+
*/
|
|
23
|
+
export declare function numericSentences(facts: readonly NumericFact[], subject: string | null, max?: number): string[];
|
|
24
|
+
/** Names after "Affected:" in the detail of a public API risk. */
|
|
25
|
+
export declare function affectedNames(risk: RiskSignal): string[];
|
|
26
|
+
/** The names a dependency risk lists after "New:", "Upgraded:" and "Removed:", as sentences: "It adds zod." */
|
|
27
|
+
export declare function dependencySentences(risk: RiskSignal, say: (name: string) => string | null): string[];
|
|
28
|
+
export interface Statement {
|
|
29
|
+
/** The sentence as the author wrote it, masked. */
|
|
30
|
+
full: string;
|
|
31
|
+
/** What the video says: the sentence, or its first clause when the sentence reads badly aloud. */
|
|
32
|
+
spoken: string;
|
|
33
|
+
source: 'NOTES' | 'PR';
|
|
34
|
+
/** The words that introduce it: "The notes say". */
|
|
35
|
+
lead: string;
|
|
36
|
+
/** Names in the sentence that look like code: camelCase, snake_case and UPPER_CASE. */
|
|
37
|
+
tokens: Set<string>;
|
|
38
|
+
/** All words of four letters or more, in lower case. */
|
|
39
|
+
words: Set<string>;
|
|
40
|
+
}
|
|
41
|
+
export declare function distinctiveTokens(text: string): Set<string>;
|
|
42
|
+
/** Sentences from the notes and the pull request description that may be quoted next to the code they mention. */
|
|
43
|
+
export declare function authorStatements(ctx: Ctx): Statement[];
|
|
44
|
+
/** What a code window shows, for matching statements to it. */
|
|
45
|
+
export interface WindowText {
|
|
46
|
+
/** The lines on screen, joined. */
|
|
47
|
+
code: string;
|
|
48
|
+
/** Names of the symbols on screen, including the last part of a dotted name. */
|
|
49
|
+
names: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface StatementMatch {
|
|
52
|
+
statement: Statement;
|
|
53
|
+
/** The names that the statement and the code share. */
|
|
54
|
+
shared: string[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The statement that talks about the same names as the code on screen. A symbol that is on screen
|
|
58
|
+
* counts the most. At least one such name, or two names that look like code, must be shared.
|
|
59
|
+
*/
|
|
60
|
+
export declare function pickStatement(statements: readonly Statement[], window: WindowText, used: ReadonlySet<string>): StatementMatch | null;
|
|
61
|
+
export interface ReviewHint {
|
|
62
|
+
/** The sentence for the narration. */
|
|
63
|
+
spoken: string;
|
|
64
|
+
title: string;
|
|
65
|
+
detail: string;
|
|
66
|
+
source: 'NOTES';
|
|
67
|
+
/** Whether the author's lead-in ("Worth a careful review:") was removed. */
|
|
68
|
+
stripped: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** The first note that asks for a careful review, with its lead-in removed. Only the caller's notes count. */
|
|
71
|
+
export declare function reviewHint(ctx: Ctx): ReviewHint | null;
|
|
72
|
+
/** One line about added, updated and removed dependencies, or null. */
|
|
73
|
+
export declare function dependencyLine(ctx: Ctx): Line | null;
|
|
74
|
+
/** One line naming the test files that were added, changed or removed, or null. */
|
|
75
|
+
export declare function testsLine(ctx: Ctx): Line | null;
|
|
76
|
+
/** What the caller reported about runs of tests, checks and the like: every result, said once. */
|
|
77
|
+
export interface ReportedRuns {
|
|
78
|
+
line: Line;
|
|
79
|
+
/** The same in a few words, for the closing list. */
|
|
80
|
+
point: string;
|
|
81
|
+
/** At least one run did not pass. Such a line is never left out to save time. */
|
|
82
|
+
failed: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Every result the caller reported, with the ones that did not pass first. The wording never says
|
|
86
|
+
* "tests pass" about a mixed set, and never puts a number in front of "passed", which is how a
|
|
87
|
+
* claim of passing tests reads. A result is only reported, never confirmed: MergeStory runs nothing.
|
|
88
|
+
*/
|
|
89
|
+
export declare function reportedRuns(ctx: Ctx): ReportedRuns | null;
|
|
90
|
+
/**
|
|
91
|
+
* The most important symbols of the whole change, by the same ranking that picks the anchor of a
|
|
92
|
+
* code scene. A changed class gives way to the members that changed inside it, and the members of
|
|
93
|
+
* a new class are left to the class.
|
|
94
|
+
*/
|
|
95
|
+
export declare function topSymbols(ctx: Ctx): SymbolView[];
|
|
96
|
+
/** What the change does to its most important symbols, by name. */
|
|
97
|
+
export interface Recap {
|
|
98
|
+
/** "adds withRetry and backoffDelay, and modifies WeatherClient.getForecast". */
|
|
99
|
+
clause: string;
|
|
100
|
+
/** Evidence ids of the symbols named. */
|
|
101
|
+
ids: string[];
|
|
102
|
+
}
|
|
103
|
+
/** The most important symbols that were added, changed or removed, or null when no symbol qualifies. */
|
|
104
|
+
export declare function recap(ctx: Ctx): Recap | null;
|
|
105
|
+
/** The quoted statement as one narration line. */
|
|
106
|
+
export declare function quoteLine(ctx: Ctx, statement: Statement, ...ids: (string | null | undefined)[]): Line;
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Facts for the offline narration, each taken from data the analysis already has: values in risk
|
|
3
|
+
* details, dependency changes, test files, the names of changed symbols, and statements by the
|
|
4
|
+
* author. Nothing here says more than the data does. Author statements are quoted and attributed.
|
|
5
|
+
*/
|
|
6
|
+
import { isShowable } from '../core/path-policy.js';
|
|
7
|
+
import { basename } from '../core/posix.js';
|
|
8
|
+
import { STORYBOARD_LIMITS } from '../core/storyboard-schema.js';
|
|
9
|
+
import { countWords, naturalList, plural } from '../core/text.js';
|
|
10
|
+
import { compareViews, nestedIn, proseName, symbolViews } from './heuristic-code.js';
|
|
11
|
+
import { cite, isTrivial, maskText, safeText } from './heuristic-context.js';
|
|
12
|
+
import { capitalise, splitSentences, stripMarkdown, truncateText } from './text.js';
|
|
13
|
+
const NUMBER = String.raw `\d[\d_]*(?:\.\d+)?(?:\*\d[\d_]*(?:\.\d+)?)*`;
|
|
14
|
+
const END = String.raw `(?=[;.\s]|$)`;
|
|
15
|
+
const NEW_VALUE = new RegExp(String.raw `([A-Za-z_]\w*): new value (${NUMBER})${END}`, 'g');
|
|
16
|
+
const CHANGED_VALUE = new RegExp(String.raw `([A-Za-z_]\w*): (${NUMBER}) to (${NUMBER})${END}`, 'g');
|
|
17
|
+
/** A number as it is said: no digit separators, and "*" read as "times". */
|
|
18
|
+
export function formatNumber(raw) {
|
|
19
|
+
return raw.replace(/_/g, '').replace(/\*/g, ' times ');
|
|
20
|
+
}
|
|
21
|
+
/** The values the analysis found in a "changed timeout, retry or interval" risk. Empty for other risks. */
|
|
22
|
+
export function numericFacts(risk) {
|
|
23
|
+
const found = [];
|
|
24
|
+
for (const match of risk.detail.matchAll(NEW_VALUE)) {
|
|
25
|
+
found.push({ at: match.index ?? 0, fact: { name: match[1], from: null, to: formatNumber(match[2]) } });
|
|
26
|
+
}
|
|
27
|
+
for (const match of risk.detail.matchAll(CHANGED_VALUE)) {
|
|
28
|
+
found.push({
|
|
29
|
+
at: match.index ?? 0,
|
|
30
|
+
fact: { name: match[1], from: formatNumber(match[2]), to: formatNumber(match[3]) },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return found.sort((a, b) => a.at - b.at).map((item) => item.fact);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The values as sentences: "DEFAULT_RETRY sets retries to 3 and maxDelayMs to 4000." New values are
|
|
37
|
+
* "set", values that were there before are "changed". `subject` is the name that holds them, or null for "It".
|
|
38
|
+
*/
|
|
39
|
+
export function numericSentences(facts, subject, max = 4) {
|
|
40
|
+
const shown = facts.slice(0, max);
|
|
41
|
+
const only = shown[0];
|
|
42
|
+
// A constant that holds its own value: "TOKEN_TTL_SECONDS is 3600".
|
|
43
|
+
if (subject !== null && shown.length === 1 && only?.name === subject) {
|
|
44
|
+
return [
|
|
45
|
+
only.from === null ? `${subject} is ${only.to}.` : `${subject} goes from ${only.from} to ${only.to}.`,
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
const lead = subject ?? 'It';
|
|
49
|
+
const out = [];
|
|
50
|
+
const fresh = shown.filter((fact) => fact.from === null);
|
|
51
|
+
const changed = shown.filter((fact) => fact.from !== null);
|
|
52
|
+
if (fresh.length > 0) {
|
|
53
|
+
out.push(`${lead} sets ${naturalList(fresh.map((fact) => `${fact.name} to ${fact.to}`))}.`);
|
|
54
|
+
}
|
|
55
|
+
if (changed.length > 0) {
|
|
56
|
+
out.push(`${fresh.length > 0 ? 'It' : lead} changes ${naturalList(changed.map((fact) => `${fact.name} from ${fact.from} to ${fact.to}`))}.`);
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/** Names after "Affected:" in the detail of a public API risk. */
|
|
61
|
+
export function affectedNames(risk) {
|
|
62
|
+
const match = /Affected: (.+?)\.(?:\s|$)/.exec(risk.detail);
|
|
63
|
+
if (!match)
|
|
64
|
+
return [];
|
|
65
|
+
return match[1]
|
|
66
|
+
.replace(/ and \d+ more$/, '')
|
|
67
|
+
.split(/,\s*/)
|
|
68
|
+
.map((name) => name.trim())
|
|
69
|
+
.filter(Boolean);
|
|
70
|
+
}
|
|
71
|
+
/** The names a dependency risk lists after "New:", "Upgraded:" and "Removed:", as sentences: "It adds zod." */
|
|
72
|
+
export function dependencySentences(risk, say) {
|
|
73
|
+
const verbs = { New: 'adds', Upgraded: 'upgrades', Removed: 'removes' };
|
|
74
|
+
const out = [];
|
|
75
|
+
for (const match of risk.detail.matchAll(/\b(New|Upgraded|Removed): (.+?)\.(?:\s|$)/g)) {
|
|
76
|
+
const names = match[2]
|
|
77
|
+
.replace(/ and \d+ more$/, '')
|
|
78
|
+
.split(/,\s*/)
|
|
79
|
+
.map((name) => say(name.trim()))
|
|
80
|
+
.filter((name) => name !== null && name !== '');
|
|
81
|
+
if (names.length > 0)
|
|
82
|
+
out.push(`It ${verbs[match[1]]} ${naturalList(names.slice(0, 3))}.`);
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
const WORD = /[A-Za-z_][A-Za-z0-9_]{3,}/g;
|
|
87
|
+
/** Characters that are code, not speech. A sentence with them is shortened or left out. */
|
|
88
|
+
const CODE_CHARS = /[*^{}|\\<>=]/;
|
|
89
|
+
/** A quoted statement and its lead-in must stay within the line limit. */
|
|
90
|
+
const MAX_QUOTE_WORDS = 30;
|
|
91
|
+
/** A narration line stays within the limit for a caption. */
|
|
92
|
+
const MAX_LINE_WORDS = STORYBOARD_LIMITS.maxWordsPerNarrationLine;
|
|
93
|
+
export function distinctiveTokens(text) {
|
|
94
|
+
const out = new Set();
|
|
95
|
+
for (const match of text.matchAll(WORD)) {
|
|
96
|
+
const word = match[0];
|
|
97
|
+
if (/[a-z][A-Z]/.test(word) || word.includes('_') || /^[A-Z0-9]{4,}$/.test(word))
|
|
98
|
+
out.add(word);
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
function ensureEnd(text) {
|
|
103
|
+
return /[.!?]$/.test(text) ? text : `${text}.`;
|
|
104
|
+
}
|
|
105
|
+
/** The sentence as it is said aloud, or null when it cannot be said well. */
|
|
106
|
+
function spokenForm(sentence) {
|
|
107
|
+
const flat = sentence.replace(/\s+/g, ' ').replace(/"/g, "'").trim();
|
|
108
|
+
if (!CODE_CHARS.test(flat) && countWords(flat) <= MAX_QUOTE_WORDS)
|
|
109
|
+
return ensureEnd(flat);
|
|
110
|
+
const clause = (flat.split(/:\s|;\s|\s[—–-]\s/)[0] ?? '').trim();
|
|
111
|
+
if (countWords(clause) >= 3 && countWords(clause) <= MAX_QUOTE_WORDS && !CODE_CHARS.test(clause)) {
|
|
112
|
+
return ensureEnd(clause);
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
/** Bullets and paragraphs, each as one unit of text. */
|
|
117
|
+
function blocks(text) {
|
|
118
|
+
const out = [];
|
|
119
|
+
let open = false;
|
|
120
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
121
|
+
const line = raw.trim();
|
|
122
|
+
if (!line) {
|
|
123
|
+
open = false;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const bullet = /^(?:[-*+]|\d{1,3}[.)])\s+(.*)$/.exec(line);
|
|
127
|
+
if (bullet) {
|
|
128
|
+
out.push(bullet[1]);
|
|
129
|
+
open = true;
|
|
130
|
+
}
|
|
131
|
+
else if (open) {
|
|
132
|
+
out[out.length - 1] += ` ${line}`;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
out.push(line);
|
|
136
|
+
open = true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
function statementsFrom(ctx, text, source, lead) {
|
|
142
|
+
if (!text)
|
|
143
|
+
return [];
|
|
144
|
+
const out = [];
|
|
145
|
+
for (const block of blocks(text)) {
|
|
146
|
+
// Stripping Markdown removes web addresses and leaves a broken sentence behind, so such a block is left out whole.
|
|
147
|
+
if (/(?:https?:\/\/|www\.)\S/i.test(block))
|
|
148
|
+
continue;
|
|
149
|
+
for (const sentence of splitSentences(stripMarkdown(block))) {
|
|
150
|
+
const full = safeText(ctx, sentence);
|
|
151
|
+
if (full === null || countWords(full) < 4)
|
|
152
|
+
continue;
|
|
153
|
+
const spoken = spokenForm(full);
|
|
154
|
+
if (spoken === null)
|
|
155
|
+
continue;
|
|
156
|
+
out.push({
|
|
157
|
+
full,
|
|
158
|
+
spoken,
|
|
159
|
+
source,
|
|
160
|
+
lead,
|
|
161
|
+
tokens: distinctiveTokens(full),
|
|
162
|
+
words: new Set([...full.matchAll(WORD)].map((match) => match[0].toLowerCase())),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
168
|
+
/** Sentences from the notes and the pull request description that may be quoted next to the code they mention. */
|
|
169
|
+
export function authorStatements(ctx) {
|
|
170
|
+
return [
|
|
171
|
+
...statementsFrom(ctx, ctx.inputs.notes, 'NOTES', 'The notes say'),
|
|
172
|
+
...statementsFrom(ctx, ctx.changeSet.pr?.body, 'PR', 'The description says'),
|
|
173
|
+
].filter((statement) => ctx.evidence.has(statement.source));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The statement that talks about the same names as the code on screen. A symbol that is on screen
|
|
177
|
+
* counts the most. At least one such name, or two names that look like code, must be shared.
|
|
178
|
+
*/
|
|
179
|
+
export function pickStatement(statements, window, used) {
|
|
180
|
+
const codeTokens = distinctiveTokens(window.code);
|
|
181
|
+
const names = window.names.filter((name) => name.length >= 5);
|
|
182
|
+
let best = null;
|
|
183
|
+
for (const statement of statements) {
|
|
184
|
+
if (used.has(statement.full))
|
|
185
|
+
continue;
|
|
186
|
+
const shared = new Set();
|
|
187
|
+
let score = 0;
|
|
188
|
+
for (const name of names) {
|
|
189
|
+
if (statement.tokens.has(name) || statement.words.has(name.toLowerCase())) {
|
|
190
|
+
shared.add(name);
|
|
191
|
+
score += 3;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
for (const token of statement.tokens) {
|
|
195
|
+
if (codeTokens.has(token) && !shared.has(token)) {
|
|
196
|
+
shared.add(token);
|
|
197
|
+
score += 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (score >= 2 && (best === null || score > best.score)) {
|
|
201
|
+
best = { match: { statement, shared: [...shared] }, score };
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return best?.match ?? null;
|
|
205
|
+
}
|
|
206
|
+
const REVIEW_WORDS = /\b(?:review|reviewer|reviewers|careful|caution|caveat|risk|risky|be aware|watch out)\b/i;
|
|
207
|
+
const LEAD_IN = /^(?:worth\s+(?:a\s+)?(?:careful\s+|close\s+)?(?:review|look)(?:ing)?|please\s+review|review|careful|caveat|risk|note)[^:]{0,24}:\s*/i;
|
|
208
|
+
/** The first note that asks for a careful review, with its lead-in removed. Only the caller's notes count. */
|
|
209
|
+
export function reviewHint(ctx) {
|
|
210
|
+
if (!ctx.evidence.has('NOTES'))
|
|
211
|
+
return null;
|
|
212
|
+
for (const statement of statementsFrom(ctx, ctx.inputs.notes, 'NOTES', 'The notes say')) {
|
|
213
|
+
if (!REVIEW_WORDS.test(statement.full))
|
|
214
|
+
continue;
|
|
215
|
+
const rest = statement.full.replace(LEAD_IN, '');
|
|
216
|
+
const stripped = rest !== statement.full;
|
|
217
|
+
const spoken = spokenForm(rest);
|
|
218
|
+
if (spoken === null || countWords(spoken) < 4)
|
|
219
|
+
continue;
|
|
220
|
+
const [first, ...others] = spoken.replace(/\.$/, '').split(/;\s*/);
|
|
221
|
+
const title = truncateText(capitalise((first ?? spoken).trim()), 80);
|
|
222
|
+
const more = others
|
|
223
|
+
.join('; ')
|
|
224
|
+
.replace(/^and\s+/i, '')
|
|
225
|
+
.trim();
|
|
226
|
+
return {
|
|
227
|
+
spoken,
|
|
228
|
+
title,
|
|
229
|
+
detail: truncateText(capitalise(ensureEnd(more || (first ?? spoken).trim())), 160),
|
|
230
|
+
source: 'NOTES',
|
|
231
|
+
stripped,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
// Dependencies, tests and the names of what changed
|
|
238
|
+
// ---------------------------------------------------------------------------
|
|
239
|
+
const PLAIN_VERSION = /^[\^~<>=v]*\d+(?:\.\d+){0,3}(?:[-+][\w.]+)?$/;
|
|
240
|
+
/** One line about added, updated and removed dependencies, or null. */
|
|
241
|
+
export function dependencyLine(ctx) {
|
|
242
|
+
const shown = ctx.analysis.dependencies.filter((dependency) => {
|
|
243
|
+
const file = ctx.fileById.get(dependency.fileId);
|
|
244
|
+
return file !== undefined && isShowable(file) && safeText(ctx, dependency.name) !== null;
|
|
245
|
+
});
|
|
246
|
+
if (shown.length === 0)
|
|
247
|
+
return null;
|
|
248
|
+
const sentences = [];
|
|
249
|
+
const first = (items) => items.slice(0, 3);
|
|
250
|
+
const names = (items) => naturalList(first(items).map((dependency) => safeText(ctx, dependency.name)));
|
|
251
|
+
const added = shown.filter((dependency) => dependency.change === 'added');
|
|
252
|
+
const updated = shown.filter((dependency) => dependency.change === 'updated');
|
|
253
|
+
const removed = shown.filter((dependency) => dependency.change === 'removed');
|
|
254
|
+
if (added.length > 0) {
|
|
255
|
+
sentences.push({
|
|
256
|
+
text: `It adds the ${added.length === 1 ? 'dependency' : 'dependencies'} ${names(added)}.`,
|
|
257
|
+
ids: first(added).map((dependency) => dependency.id),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (updated.length > 0) {
|
|
261
|
+
const lead = updated[0];
|
|
262
|
+
// A version such as "git+https://host/repo" is not read out; only plain version numbers are.
|
|
263
|
+
const plain = (version) => version !== null && PLAIN_VERSION.test(version);
|
|
264
|
+
const versions = plain(lead.from) && plain(lead.to) ? ` from ${lead.from} to ${lead.to}` : '';
|
|
265
|
+
const rest = updated.length > 1
|
|
266
|
+
? `, and ${plural(updated.length - 1, 'other dependency', 'other dependencies')}`
|
|
267
|
+
: '';
|
|
268
|
+
sentences.push({ text: `It updates ${safeText(ctx, lead.name)}${versions}${rest}.`, ids: [lead.id] });
|
|
269
|
+
}
|
|
270
|
+
if (removed.length > 0) {
|
|
271
|
+
sentences.push({
|
|
272
|
+
text: `It removes the ${removed.length === 1 ? 'dependency' : 'dependencies'} ${names(removed)}.`,
|
|
273
|
+
ids: first(removed).map((dependency) => dependency.id),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
const said = sentences.slice(0, 2);
|
|
277
|
+
return {
|
|
278
|
+
text: said.map((sentence) => sentence.text).join(' '),
|
|
279
|
+
evidence: cite(ctx, ...said.flatMap((s) => s.ids)),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
/** One line naming the test files that were added, changed or removed, or null. */
|
|
283
|
+
export function testsLine(ctx) {
|
|
284
|
+
const named = (paths) => {
|
|
285
|
+
const files = paths
|
|
286
|
+
.map((path) => ctx.fileByPath.get(path))
|
|
287
|
+
.filter((file) => file !== undefined && isShowable(file));
|
|
288
|
+
return { names: files.map((file) => basename(file.path)), ids: files.map((file) => file.id) };
|
|
289
|
+
};
|
|
290
|
+
const added = named(ctx.analysis.tests.added);
|
|
291
|
+
const modified = named(ctx.analysis.tests.modified);
|
|
292
|
+
const pick = added.names.length > 0
|
|
293
|
+
? { verb: 'were added in', ...added }
|
|
294
|
+
: modified.names.length > 0
|
|
295
|
+
? { verb: 'were changed in', ...modified }
|
|
296
|
+
: null;
|
|
297
|
+
if (pick === null)
|
|
298
|
+
return null;
|
|
299
|
+
const list = naturalList(pick.names.slice(0, 3));
|
|
300
|
+
const more = pick.names.length > 3 ? ` and ${pick.names.length - 3} more` : '';
|
|
301
|
+
return { text: `Tests ${pick.verb} ${list}${more}.`, evidence: cite(ctx, ...pick.ids.slice(0, 3)) };
|
|
302
|
+
}
|
|
303
|
+
/** Who reported a run, as it is said in a sentence. */
|
|
304
|
+
const REPORTER = {
|
|
305
|
+
ci: 'CI',
|
|
306
|
+
agent: 'the coding agent',
|
|
307
|
+
user: 'the author',
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Every result the caller reported, with the ones that did not pass first. The wording never says
|
|
311
|
+
* "tests pass" about a mixed set, and never puts a number in front of "passed", which is how a
|
|
312
|
+
* claim of passing tests reads. A result is only reported, never confirmed: MergeStory runs nothing.
|
|
313
|
+
*/
|
|
314
|
+
export function reportedRuns(ctx) {
|
|
315
|
+
const runs = ctx.inputs.tests.filter((run) => ctx.evidence.has(run.id));
|
|
316
|
+
if (runs.length === 0)
|
|
317
|
+
return null;
|
|
318
|
+
const failed = runs.filter((run) => !run.passed);
|
|
319
|
+
const passed = runs.filter((run) => run.passed);
|
|
320
|
+
const labels = naturalList([...new Set(runs.map((run) => REPORTER[run.source]))]);
|
|
321
|
+
const who = capitalise(labels);
|
|
322
|
+
const name = (run) => {
|
|
323
|
+
const text = safeText(ctx, run.command);
|
|
324
|
+
return text ? truncateText(text, 40) : `run ${runs.indexOf(run) + 1}`;
|
|
325
|
+
};
|
|
326
|
+
const list = (group, shown) => {
|
|
327
|
+
const names = group.slice(0, shown).map(name);
|
|
328
|
+
return group.length > shown ? `${names.join(', ')} and ${group.length - shown} more` : naturalList(names);
|
|
329
|
+
};
|
|
330
|
+
const count = runs.length;
|
|
331
|
+
// Fewer names when the line is too long to read as a caption.
|
|
332
|
+
const lineWith = (shown) => {
|
|
333
|
+
if (count === 1)
|
|
334
|
+
return `${who} reported that ${name(runs[0])} ${passed.length === 1 ? 'passed' : 'did not pass'}.`;
|
|
335
|
+
if (failed.length === 0) {
|
|
336
|
+
return `${who} reported ${count} runs, and all of them passed${shown > 0 ? `: ${list(passed, shown)}` : ''}.`;
|
|
337
|
+
}
|
|
338
|
+
if (passed.length === 0) {
|
|
339
|
+
return `${who} reported ${count} runs, and none of them passed${shown > 0 ? `: ${list(failed, shown)}` : ''}.`;
|
|
340
|
+
}
|
|
341
|
+
return shown > 0
|
|
342
|
+
? `${who} reported ${count} runs. Did not pass: ${list(failed, shown)}. Passed: ${list(passed, shown)}.`
|
|
343
|
+
: `${who} reported ${count} runs, and ${failed.length} of them did not pass.`;
|
|
344
|
+
};
|
|
345
|
+
let text = lineWith(3);
|
|
346
|
+
for (const shown of [2, 1, 0]) {
|
|
347
|
+
if (countWords(text) <= MAX_LINE_WORDS)
|
|
348
|
+
break;
|
|
349
|
+
text = lineWith(shown);
|
|
350
|
+
}
|
|
351
|
+
const verdict = failed.length === 0
|
|
352
|
+
? count === 1
|
|
353
|
+
? 'passed'
|
|
354
|
+
: 'all passed'
|
|
355
|
+
: passed.length === 0
|
|
356
|
+
? count === 1
|
|
357
|
+
? 'did not pass'
|
|
358
|
+
: 'none passed'
|
|
359
|
+
: `${failed.length} of ${count} did not pass`;
|
|
360
|
+
return {
|
|
361
|
+
line: { text, evidence: cite(ctx, ...runs.map((run) => run.id)) },
|
|
362
|
+
point: `Reported ${count === 1 ? 'run' : 'runs'}: ${verdict} (${labels})`,
|
|
363
|
+
failed: failed.length > 0,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The most important symbols of the whole change, by the same ranking that picks the anchor of a
|
|
368
|
+
* code scene. A changed class gives way to the members that changed inside it, and the members of
|
|
369
|
+
* a new class are left to the class.
|
|
370
|
+
*/
|
|
371
|
+
export function topSymbols(ctx) {
|
|
372
|
+
const all = [];
|
|
373
|
+
for (const file of ctx.changeSet.files) {
|
|
374
|
+
if (!isShowable(file) || isTrivial(ctx, file))
|
|
375
|
+
continue;
|
|
376
|
+
const role = ctx.insightByFile.get(file.id)?.role;
|
|
377
|
+
if (role === 'test' || role === 'docs')
|
|
378
|
+
continue;
|
|
379
|
+
const views = [
|
|
380
|
+
...(file.status === 'deleted' ? [] : symbolViews(ctx, file, 'head')),
|
|
381
|
+
...symbolViews(ctx, file, 'base'),
|
|
382
|
+
];
|
|
383
|
+
all.push(...views.filter((view) => !(view.symbol.change === 'modified' && views.some((other) => nestedIn(other, view))) &&
|
|
384
|
+
!views.some((outer) => outer.symbol.change === 'added' && nestedIn(view, outer))));
|
|
385
|
+
}
|
|
386
|
+
return all.sort(compareViews);
|
|
387
|
+
}
|
|
388
|
+
/** The most important symbols that were added, changed or removed, or null when no symbol qualifies. */
|
|
389
|
+
export function recap(ctx) {
|
|
390
|
+
const named = topSymbols(ctx).filter((view) => view.symbol.kind !== 'other');
|
|
391
|
+
const pick = (change, max) => named.filter((view) => view.symbol.change === change).slice(0, max);
|
|
392
|
+
const added = pick('added', 3);
|
|
393
|
+
const modified = pick('modified', 2);
|
|
394
|
+
const removed = pick('removed', 2);
|
|
395
|
+
const prose = (view) => proseName(view.symbol.kind, view.name);
|
|
396
|
+
const parts = [];
|
|
397
|
+
if (added.length > 0)
|
|
398
|
+
parts.push(`adds ${naturalList(added.map(prose))}`);
|
|
399
|
+
if (modified.length > 0)
|
|
400
|
+
parts.push(`modifies ${naturalList(modified.map(prose))}`);
|
|
401
|
+
if (removed.length > 0)
|
|
402
|
+
parts.push(`removes ${naturalList(removed.map(prose))}`);
|
|
403
|
+
if (parts.length === 0)
|
|
404
|
+
return null;
|
|
405
|
+
const clause = parts.length > 1 ? `${parts.slice(0, -1).join(', ')}, and ${parts[parts.length - 1]}` : parts[0];
|
|
406
|
+
return { clause, ids: [...added, ...modified, ...removed].map((view) => view.symbol.id) };
|
|
407
|
+
}
|
|
408
|
+
/** The quoted statement as one narration line. */
|
|
409
|
+
export function quoteLine(ctx, statement, ...ids) {
|
|
410
|
+
return {
|
|
411
|
+
text: `${statement.lead}: ${maskText(ctx, statement.spoken)}`,
|
|
412
|
+
evidence: cite(ctx, statement.source, ...ids),
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
//# sourceMappingURL=heuristic-facts.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The big picture scene: a diagram when components are connected, the list of files when they are not. */
|
|
2
|
+
import { type Scene } from '../core/storyboard-schema.ts';
|
|
3
|
+
import { type Build } from './heuristic-shared.ts';
|
|
4
|
+
export declare function bigPictureScene(b: Build): Scene;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** The big picture scene: a diagram when components are connected, the list of files when they are not. */
|
|
2
|
+
import { STORYBOARD_LIMITS as LIMITS } from '../core/storyboard-schema.js';
|
|
3
|
+
import { countWords, naturalList, plural } from '../core/text.js';
|
|
4
|
+
import { cite } from './heuristic-context.js';
|
|
5
|
+
import { dependencyLine, testsLine } from './heuristic-facts.js';
|
|
6
|
+
import { componentName, componentPhrase, fileBrief, fileClause, meaningfulComponents, NODE_KIND, scene, sizeText, topFiles, } from './heuristic-shared.js';
|
|
7
|
+
import { capitalise } from './text.js';
|
|
8
|
+
/** What a relationship says, for a subject in the singular and in the plural. */
|
|
9
|
+
const VERB = {
|
|
10
|
+
imports: ['imports from', 'import from'],
|
|
11
|
+
tests: ['imports from', 'import from'],
|
|
12
|
+
configures: ['configures', 'configure'],
|
|
13
|
+
};
|
|
14
|
+
/** "the http tests", "the docs" and "the project files" are plural; "the http module" is not. */
|
|
15
|
+
const isPlural = (phrase) => /\b(?:tests|docs|files)$/.test(phrase);
|
|
16
|
+
function architectureScene(b, components) {
|
|
17
|
+
const { ctx, level } = b;
|
|
18
|
+
const { files: fileCount } = ctx.changeSet.stats;
|
|
19
|
+
const nodesFor = components.slice(0, LIMITS.maxArchitectureNodes);
|
|
20
|
+
const present = new Set(nodesFor.map((component) => component.id));
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
const relationships = ctx.analysis.relationships
|
|
23
|
+
.filter((rel) => present.has(rel.from) && present.has(rel.to) && rel.from !== rel.to)
|
|
24
|
+
.filter((rel) => {
|
|
25
|
+
const key = `${rel.from}>${rel.to}:${rel.kind}`;
|
|
26
|
+
if (seen.has(key))
|
|
27
|
+
return false;
|
|
28
|
+
seen.add(key);
|
|
29
|
+
return true;
|
|
30
|
+
})
|
|
31
|
+
.slice(0, 12);
|
|
32
|
+
// Boxes with nothing between them say less than the list of files does.
|
|
33
|
+
if (nodesFor.length < 2 || relationships.length === 0)
|
|
34
|
+
return null;
|
|
35
|
+
const top = components[0];
|
|
36
|
+
const byId = new Map(nodesFor.map((component) => [component.id, component]));
|
|
37
|
+
const lines = [
|
|
38
|
+
{
|
|
39
|
+
text: `The change touches ${plural(fileCount, 'file')} in ${plural(components.length, 'component')}.`,
|
|
40
|
+
evidence: cite(ctx, ...components.slice(0, 3).map((c) => c.id)),
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
if (level.bigPictureLines >= 2) {
|
|
44
|
+
lines.push({
|
|
45
|
+
text: `The biggest part is ${componentPhrase(ctx, top)}, with ${sizeText(top.additions, top.deletions)}.`,
|
|
46
|
+
evidence: cite(ctx, top.id),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (level.bigPictureLines >= 3) {
|
|
50
|
+
const sentences = relationships.slice(0, 2).flatMap((rel) => {
|
|
51
|
+
const from = byId.get(rel.from);
|
|
52
|
+
const to = byId.get(rel.to);
|
|
53
|
+
if (!from || !to)
|
|
54
|
+
return [];
|
|
55
|
+
const subject = componentPhrase(ctx, from);
|
|
56
|
+
const verb = VERB[rel.kind]?.[isPlural(subject) ? 1 : 0] ?? (isPlural(subject) ? 'use' : 'uses');
|
|
57
|
+
return [`${capitalise(subject)} ${verb} ${componentPhrase(ctx, to)}.`];
|
|
58
|
+
});
|
|
59
|
+
lines.push({
|
|
60
|
+
text: sentences.join(' '),
|
|
61
|
+
evidence: cite(ctx, ...relationships.slice(0, 2).flatMap((rel) => [rel.evidence, rel.from, rel.to])),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (level.bigPictureLines >= 4) {
|
|
65
|
+
const extra = testsAndDependencies(ctx);
|
|
66
|
+
if (extra)
|
|
67
|
+
lines.push(extra);
|
|
68
|
+
}
|
|
69
|
+
const topBeat = lines.length > 1 ? 1 : 0;
|
|
70
|
+
const otherBeat = lines.length > 2 ? 2 : lines.length - 1;
|
|
71
|
+
const beatOf = new Map(nodesFor.map((component) => [component.id, component.id === top.id ? topBeat : otherBeat]));
|
|
72
|
+
const nodes = nodesFor.map((component) => {
|
|
73
|
+
const fileIds = component.fileIds.filter((id) => ctx.fileById.has(id));
|
|
74
|
+
return {
|
|
75
|
+
id: component.id,
|
|
76
|
+
label: componentName(ctx, component),
|
|
77
|
+
detail: `${plural(fileIds.length, 'file')} · +${component.additions} −${component.deletions}`,
|
|
78
|
+
kind: NODE_KIND[component.kind],
|
|
79
|
+
status: component.status,
|
|
80
|
+
beat: beatOf.get(component.id) ?? 0,
|
|
81
|
+
evidence: cite(ctx, component.id, ...fileIds.slice(0, 2)),
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
const edges = relationships.map((rel) => ({
|
|
85
|
+
from: rel.from,
|
|
86
|
+
to: rel.to,
|
|
87
|
+
label: rel.kind,
|
|
88
|
+
status: 'unchanged',
|
|
89
|
+
beat: Math.max(beatOf.get(rel.from) ?? 0, beatOf.get(rel.to) ?? 0),
|
|
90
|
+
}));
|
|
91
|
+
return scene('big-picture', 'The big picture', lines.slice(0, level.bigPictureLines), { type: 'architecture', direction: 'LR', nodes, edges }, 'A diagram of the components that changed and how they relate.', 'slide');
|
|
92
|
+
}
|
|
93
|
+
/** The test files and the dependencies of the change, in one line when both fit, or null. */
|
|
94
|
+
function testsAndDependencies(ctx) {
|
|
95
|
+
const tests = testsLine(ctx);
|
|
96
|
+
const dependencies = dependencyLine(ctx);
|
|
97
|
+
if (tests && dependencies) {
|
|
98
|
+
const text = `${tests.text} ${dependencies.text}`;
|
|
99
|
+
if (countWords(text) <= LIMITS.maxWordsPerNarrationLine) {
|
|
100
|
+
return { text, evidence: [...new Set([...tests.evidence, ...dependencies.evidence])] };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return tests ?? dependencies;
|
|
104
|
+
}
|
|
105
|
+
function filesScene(b, components) {
|
|
106
|
+
const { ctx, level } = b;
|
|
107
|
+
const { files: fileCount, additions, deletions } = ctx.changeSet.stats;
|
|
108
|
+
const shown = topFiles(ctx, 8);
|
|
109
|
+
const narrated = shown.slice(0, 3);
|
|
110
|
+
const lines = [];
|
|
111
|
+
if (narrated.length === 0) {
|
|
112
|
+
lines.push({
|
|
113
|
+
text: `The change touches ${plural(fileCount, 'file')}, with ${sizeText(additions, deletions)}.`,
|
|
114
|
+
evidence: cite(ctx),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const [first, ...next] = narrated;
|
|
119
|
+
const total = shown.length;
|
|
120
|
+
lines.push({
|
|
121
|
+
text: total === 1
|
|
122
|
+
? `The only changed file is ${fileClause(first)}.`
|
|
123
|
+
: `The largest change is in ${fileClause(first)}.`,
|
|
124
|
+
evidence: cite(ctx, first.id),
|
|
125
|
+
});
|
|
126
|
+
if (next.length > 0 && level.bigPictureLines >= 2) {
|
|
127
|
+
lines.push({
|
|
128
|
+
text: `Next come ${naturalList(next.map(fileBrief))}.`,
|
|
129
|
+
evidence: cite(ctx, ...next.map((file) => file.id)),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (level.bigPictureLines >= 3) {
|
|
133
|
+
const extra = testsAndDependencies(ctx);
|
|
134
|
+
const main = components[0];
|
|
135
|
+
if (extra)
|
|
136
|
+
lines.push(extra);
|
|
137
|
+
else if (main && total > 1) {
|
|
138
|
+
lines.push({
|
|
139
|
+
text: `Most of it is in ${componentPhrase(ctx, main)}.`,
|
|
140
|
+
evidence: cite(ctx, main.id),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return scene('big-picture', 'The big picture', lines.slice(0, level.bigPictureLines), { type: 'files', highlightPaths: narrated.map((file) => file.path), caption: null }, 'The list of changed files, grouped by component, with the largest changes highlighted.', 'slide');
|
|
146
|
+
}
|
|
147
|
+
export function bigPictureScene(b) {
|
|
148
|
+
const components = meaningfulComponents(b.ctx);
|
|
149
|
+
return architectureScene(b, components) ?? filesScene(b, components);
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=heuristic-overview.js.map
|