@sentry/warden 0.0.0 → 0.1.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/.github/workflows/ci.yml +1 -1
- package/.github/workflows/release.yml +6 -1
- package/.github/workflows/warden.yml +1 -1
- package/dist/action/159.index.js +523 -0
- package/dist/action/159.index.js.map +1 -0
- package/dist/action/action/index.d.ts +2 -0
- package/dist/action/action/index.d.ts.map +1 -0
- package/dist/action/action/main.d.ts +2 -0
- package/dist/action/action/main.d.ts.map +1 -0
- package/dist/action/cli/args.d.ts +74 -0
- package/dist/action/cli/args.d.ts.map +1 -0
- package/dist/action/cli/args.test.d.ts +2 -0
- package/dist/action/cli/args.test.d.ts.map +1 -0
- package/dist/action/cli/commands/add.d.ts +7 -0
- package/dist/action/cli/commands/add.d.ts.map +1 -0
- package/dist/action/cli/commands/init.d.ts +10 -0
- package/dist/action/cli/commands/init.d.ts.map +1 -0
- package/dist/action/cli/commands/init.test.d.ts +2 -0
- package/dist/action/cli/commands/init.test.d.ts.map +1 -0
- package/dist/action/cli/commands/setup-app/browser.d.ts +9 -0
- package/dist/action/cli/commands/setup-app/browser.d.ts.map +1 -0
- package/dist/action/cli/commands/setup-app/credentials.d.ts +15 -0
- package/dist/action/cli/commands/setup-app/credentials.d.ts.map +1 -0
- package/dist/action/cli/commands/setup-app/manifest.d.ts +24 -0
- package/dist/action/cli/commands/setup-app/manifest.d.ts.map +1 -0
- package/dist/action/cli/commands/setup-app/server.d.ts +28 -0
- package/dist/action/cli/commands/setup-app/server.d.ts.map +1 -0
- package/dist/action/cli/commands/setup-app.d.ts +11 -0
- package/dist/action/cli/commands/setup-app.d.ts.map +1 -0
- package/dist/action/cli/commands/sync.d.ts +9 -0
- package/dist/action/cli/commands/sync.d.ts.map +1 -0
- package/dist/action/cli/context.d.ts +27 -0
- package/dist/action/cli/context.d.ts.map +1 -0
- package/dist/action/cli/files.d.ts +22 -0
- package/dist/action/cli/files.d.ts.map +1 -0
- package/dist/action/cli/files.test.d.ts +2 -0
- package/dist/action/cli/files.test.d.ts.map +1 -0
- package/dist/action/cli/fix.d.ts +41 -0
- package/dist/action/cli/fix.d.ts.map +1 -0
- package/dist/action/cli/fix.test.d.ts +2 -0
- package/dist/action/cli/fix.test.d.ts.map +1 -0
- package/dist/action/cli/git.d.ts +73 -0
- package/dist/action/cli/git.d.ts.map +1 -0
- package/dist/action/cli/git.test.d.ts +2 -0
- package/dist/action/cli/git.test.d.ts.map +1 -0
- package/dist/action/cli/index.d.ts +3 -0
- package/dist/action/cli/index.d.ts.map +1 -0
- package/dist/action/cli/main.d.ts +7 -0
- package/dist/action/cli/main.d.ts.map +1 -0
- package/dist/action/cli/output/box.d.ts +75 -0
- package/dist/action/cli/output/box.d.ts.map +1 -0
- package/dist/action/cli/output/formatters.d.ts +90 -0
- package/dist/action/cli/output/formatters.d.ts.map +1 -0
- package/dist/action/cli/output/formatters.test.d.ts +2 -0
- package/dist/action/cli/output/formatters.test.d.ts.map +1 -0
- package/dist/action/cli/output/icons.d.ts +11 -0
- package/dist/action/cli/output/icons.d.ts.map +1 -0
- package/dist/action/cli/output/index.d.ts +10 -0
- package/dist/action/cli/output/index.d.ts.map +1 -0
- package/dist/action/cli/output/ink-runner.d.ts +9 -0
- package/dist/action/cli/output/ink-runner.d.ts.map +1 -0
- package/dist/action/cli/output/jsonl.d.ts +43 -0
- package/dist/action/cli/output/jsonl.d.ts.map +1 -0
- package/dist/action/cli/output/jsonl.test.d.ts +2 -0
- package/dist/action/cli/output/jsonl.test.d.ts.map +1 -0
- package/dist/action/cli/output/reporter.d.ts +108 -0
- package/dist/action/cli/output/reporter.d.ts.map +1 -0
- package/dist/action/cli/output/tasks.d.ts +89 -0
- package/dist/action/cli/output/tasks.d.ts.map +1 -0
- package/dist/action/cli/output/tty.d.ts +21 -0
- package/dist/action/cli/output/tty.d.ts.map +1 -0
- package/dist/action/cli/output/tty.test.d.ts +2 -0
- package/dist/action/cli/output/tty.test.d.ts.map +1 -0
- package/dist/action/cli/output/verbosity.d.ts +20 -0
- package/dist/action/cli/output/verbosity.d.ts.map +1 -0
- package/dist/action/cli/output/verbosity.test.d.ts +2 -0
- package/dist/action/cli/output/verbosity.test.d.ts.map +1 -0
- package/dist/action/cli/terminal.d.ts +19 -0
- package/dist/action/cli/terminal.d.ts.map +1 -0
- package/dist/action/cli/terminal.test.d.ts +2 -0
- package/dist/action/cli/terminal.test.d.ts.map +1 -0
- package/dist/action/config/index.d.ts +4 -0
- package/dist/action/config/index.d.ts.map +1 -0
- package/dist/action/config/loader.d.ts +27 -0
- package/dist/action/config/loader.d.ts.map +1 -0
- package/dist/action/config/loader.test.d.ts +2 -0
- package/dist/action/config/loader.test.d.ts.map +1 -0
- package/dist/action/config/schema.d.ts +318 -0
- package/dist/action/config/schema.d.ts.map +1 -0
- package/dist/action/config/writer.d.ts +11 -0
- package/dist/action/config/writer.d.ts.map +1 -0
- package/dist/action/config/writer.test.d.ts +2 -0
- package/dist/action/config/writer.test.d.ts.map +1 -0
- package/dist/action/diff/classify.d.ts +29 -0
- package/dist/action/diff/classify.d.ts.map +1 -0
- package/dist/action/diff/classify.test.d.ts +2 -0
- package/dist/action/diff/classify.test.d.ts.map +1 -0
- package/dist/action/diff/coalesce.d.ts +42 -0
- package/dist/action/diff/coalesce.d.ts.map +1 -0
- package/dist/action/diff/coalesce.test.d.ts +2 -0
- package/dist/action/diff/coalesce.test.d.ts.map +1 -0
- package/dist/action/diff/context.d.ts +30 -0
- package/dist/action/diff/context.d.ts.map +1 -0
- package/dist/action/diff/context.test.d.ts +2 -0
- package/dist/action/diff/context.test.d.ts.map +1 -0
- package/dist/action/diff/index.d.ts +5 -0
- package/dist/action/diff/index.d.ts.map +1 -0
- package/dist/action/diff/parser.d.ts +52 -0
- package/dist/action/diff/parser.d.ts.map +1 -0
- package/dist/action/diff/parser.test.d.ts +2 -0
- package/dist/action/diff/parser.test.d.ts.map +1 -0
- package/dist/action/event/context.d.ts +9 -0
- package/dist/action/event/context.d.ts.map +1 -0
- package/dist/action/event/index.d.ts +3 -0
- package/dist/action/event/index.d.ts.map +1 -0
- package/dist/action/event/schedule-context.d.ts +30 -0
- package/dist/action/event/schedule-context.d.ts.map +1 -0
- package/dist/action/examples/examples.integration.test.d.ts +2 -0
- package/dist/action/examples/examples.integration.test.d.ts.map +1 -0
- package/dist/action/examples/index.d.ts +50 -0
- package/dist/action/examples/index.d.ts.map +1 -0
- package/dist/action/examples/index.test.d.ts +2 -0
- package/dist/action/examples/index.test.d.ts.map +1 -0
- package/dist/action/examples/setup.d.ts +2 -0
- package/dist/action/examples/setup.d.ts.map +1 -0
- package/dist/action/index.d.ts +11 -0
- package/dist/action/index.d.ts.map +1 -0
- package/dist/action/index.js +38231 -0
- package/dist/action/index.js.map +1 -0
- package/dist/action/licenses.txt +992 -0
- package/dist/action/main.d.ts +2 -0
- package/dist/action/main.d.ts.map +1 -0
- package/dist/action/main.js +707 -0
- package/dist/action/main.js.map +1 -0
- package/dist/action/output/dedup.d.ts +153 -0
- package/dist/action/output/dedup.d.ts.map +1 -0
- package/dist/action/output/dedup.test.d.ts +2 -0
- package/dist/action/output/dedup.test.d.ts.map +1 -0
- package/dist/action/output/github-checks.d.ts +106 -0
- package/dist/action/output/github-checks.d.ts.map +1 -0
- package/dist/action/output/github-checks.test.d.ts +2 -0
- package/dist/action/output/github-checks.test.d.ts.map +1 -0
- package/dist/action/output/github-issues.d.ts +35 -0
- package/dist/action/output/github-issues.d.ts.map +1 -0
- package/dist/action/output/index.d.ts +6 -0
- package/dist/action/output/index.d.ts.map +1 -0
- package/dist/action/output/issue-renderer.d.ts +20 -0
- package/dist/action/output/issue-renderer.d.ts.map +1 -0
- package/dist/action/output/renderer.d.ts +4 -0
- package/dist/action/output/renderer.d.ts.map +1 -0
- package/dist/action/output/renderer.test.d.ts +2 -0
- package/dist/action/output/renderer.test.d.ts.map +1 -0
- package/dist/action/output/stale.d.ts +31 -0
- package/dist/action/output/stale.d.ts.map +1 -0
- package/dist/action/output/stale.test.d.ts +2 -0
- package/dist/action/output/stale.test.d.ts.map +1 -0
- package/dist/action/output/types.d.ts +31 -0
- package/dist/action/output/types.d.ts.map +1 -0
- package/dist/action/package.json +3 -0
- package/dist/action/sdk/index.d.ts +2 -0
- package/dist/action/sdk/index.d.ts.map +1 -0
- package/dist/action/sdk/runner.d.ts +202 -0
- package/dist/action/sdk/runner.d.ts.map +1 -0
- package/dist/action/sdk/runner.test.d.ts +2 -0
- package/dist/action/sdk/runner.test.d.ts.map +1 -0
- package/dist/action/skills/index.d.ts +5 -0
- package/dist/action/skills/index.d.ts.map +1 -0
- package/dist/action/skills/loader.d.ts +111 -0
- package/dist/action/skills/loader.d.ts.map +1 -0
- package/dist/action/skills/loader.test.d.ts +2 -0
- package/dist/action/skills/loader.test.d.ts.map +1 -0
- package/dist/action/skills/remote.d.ts +117 -0
- package/dist/action/skills/remote.d.ts.map +1 -0
- package/dist/action/skills/remote.test.d.ts +2 -0
- package/dist/action/skills/remote.test.d.ts.map +1 -0
- package/dist/action/sourcemap-register.cjs +1 -0
- package/dist/action/triggers/matcher.d.ts +30 -0
- package/dist/action/triggers/matcher.d.ts.map +1 -0
- package/dist/action/triggers/matcher.test.d.ts +2 -0
- package/dist/action/triggers/matcher.test.d.ts.map +1 -0
- package/dist/action/types/index.d.ts +269 -0
- package/dist/action/types/index.d.ts.map +1 -0
- package/dist/action/utils/async.d.ts +5 -0
- package/dist/action/utils/async.d.ts.map +1 -0
- package/dist/action/utils/index.d.ts +16 -0
- package/dist/action/utils/index.d.ts.map +1 -0
- package/dist/action/utils/index.test.d.ts +2 -0
- package/dist/action/utils/index.test.d.ts.map +1 -0
- package/dist/action/utils/version.d.ts +3 -0
- package/dist/action/utils/version.d.ts.map +1 -0
- package/dist/cli/args.d.ts +74 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +359 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/args.test.d.ts +2 -0
- package/dist/cli/args.test.d.ts.map +1 -0
- package/dist/cli/args.test.js +392 -0
- package/dist/cli/args.test.js.map +1 -0
- package/dist/cli/commands/add.d.ts +7 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +380 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/init.d.ts +10 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +113 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/init.test.d.ts +2 -0
- package/dist/cli/commands/init.test.d.ts.map +1 -0
- package/dist/cli/commands/init.test.js +117 -0
- package/dist/cli/commands/init.test.js.map +1 -0
- package/dist/cli/commands/setup-app/browser.d.ts +9 -0
- package/dist/cli/commands/setup-app/browser.d.ts.map +1 -0
- package/dist/cli/commands/setup-app/browser.js +36 -0
- package/dist/cli/commands/setup-app/browser.js.map +1 -0
- package/dist/cli/commands/setup-app/credentials.d.ts +15 -0
- package/dist/cli/commands/setup-app/credentials.d.ts.map +1 -0
- package/dist/cli/commands/setup-app/credentials.js +29 -0
- package/dist/cli/commands/setup-app/credentials.js.map +1 -0
- package/dist/cli/commands/setup-app/manifest.d.ts +24 -0
- package/dist/cli/commands/setup-app/manifest.d.ts.map +1 -0
- package/dist/cli/commands/setup-app/manifest.js +29 -0
- package/dist/cli/commands/setup-app/manifest.js.map +1 -0
- package/dist/cli/commands/setup-app/server.d.ts +28 -0
- package/dist/cli/commands/setup-app/server.d.ts.map +1 -0
- package/dist/cli/commands/setup-app/server.js +136 -0
- package/dist/cli/commands/setup-app/server.js.map +1 -0
- package/dist/cli/commands/setup-app.d.ts +11 -0
- package/dist/cli/commands/setup-app.d.ts.map +1 -0
- package/dist/cli/commands/setup-app.js +139 -0
- package/dist/cli/commands/setup-app.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +9 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +96 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/context.d.ts +27 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +101 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/files.d.ts +22 -0
- package/dist/cli/files.d.ts.map +1 -0
- package/dist/cli/files.js +66 -0
- package/dist/cli/files.js.map +1 -0
- package/dist/cli/files.test.d.ts +2 -0
- package/dist/cli/files.test.d.ts.map +1 -0
- package/dist/cli/files.test.js +117 -0
- package/dist/cli/files.test.js.map +1 -0
- package/dist/cli/fix.d.ts +41 -0
- package/dist/cli/fix.d.ts.map +1 -0
- package/dist/cli/fix.js +320 -0
- package/dist/cli/fix.js.map +1 -0
- package/dist/cli/fix.test.d.ts +2 -0
- package/dist/cli/fix.test.d.ts.map +1 -0
- package/dist/cli/fix.test.js +251 -0
- package/dist/cli/fix.test.js.map +1 -0
- package/dist/cli/git.d.ts +73 -0
- package/dist/cli/git.d.ts.map +1 -0
- package/dist/cli/git.js +267 -0
- package/dist/cli/git.js.map +1 -0
- package/dist/cli/git.test.d.ts +2 -0
- package/dist/cli/git.test.d.ts.map +1 -0
- package/dist/cli/git.test.js +96 -0
- package/dist/cli/git.test.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +13 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/main.d.ts +7 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +560 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/output/box.d.ts +75 -0
- package/dist/cli/output/box.d.ts.map +1 -0
- package/dist/cli/output/box.js +191 -0
- package/dist/cli/output/box.js.map +1 -0
- package/dist/cli/output/formatters.d.ts +90 -0
- package/dist/cli/output/formatters.d.ts.map +1 -0
- package/dist/cli/output/formatters.js +248 -0
- package/dist/cli/output/formatters.js.map +1 -0
- package/dist/cli/output/formatters.test.d.ts +2 -0
- package/dist/cli/output/formatters.test.d.ts.map +1 -0
- package/dist/cli/output/formatters.test.js +152 -0
- package/dist/cli/output/formatters.test.js.map +1 -0
- package/dist/cli/output/icons.d.ts +11 -0
- package/dist/cli/output/icons.d.ts.map +1 -0
- package/dist/cli/output/icons.js +11 -0
- package/dist/cli/output/icons.js.map +1 -0
- package/dist/cli/output/index.d.ts +10 -0
- package/dist/cli/output/index.d.ts.map +1 -0
- package/dist/cli/output/index.js +10 -0
- package/dist/cli/output/index.js.map +1 -0
- package/dist/cli/output/ink-runner.d.ts +9 -0
- package/dist/cli/output/ink-runner.d.ts.map +1 -0
- package/dist/cli/output/ink-runner.js +207 -0
- package/dist/cli/output/ink-runner.js.map +1 -0
- package/dist/cli/output/jsonl.d.ts +43 -0
- package/dist/cli/output/jsonl.d.ts.map +1 -0
- package/dist/cli/output/jsonl.js +89 -0
- package/dist/cli/output/jsonl.js.map +1 -0
- package/dist/cli/output/jsonl.test.d.ts +2 -0
- package/dist/cli/output/jsonl.test.d.ts.map +1 -0
- package/dist/cli/output/jsonl.test.js +284 -0
- package/dist/cli/output/jsonl.test.js.map +1 -0
- package/dist/cli/output/reporter.d.ts +108 -0
- package/dist/cli/output/reporter.d.ts.map +1 -0
- package/dist/cli/output/reporter.js +378 -0
- package/dist/cli/output/reporter.js.map +1 -0
- package/dist/cli/output/tasks.d.ts +89 -0
- package/dist/cli/output/tasks.d.ts.map +1 -0
- package/dist/cli/output/tasks.js +251 -0
- package/dist/cli/output/tasks.js.map +1 -0
- package/dist/cli/output/tty.d.ts +21 -0
- package/dist/cli/output/tty.d.ts.map +1 -0
- package/dist/cli/output/tty.js +44 -0
- package/dist/cli/output/tty.js.map +1 -0
- package/dist/cli/output/tty.test.d.ts +2 -0
- package/dist/cli/output/tty.test.d.ts.map +1 -0
- package/dist/cli/output/tty.test.js +105 -0
- package/dist/cli/output/tty.test.js.map +1 -0
- package/dist/cli/output/verbosity.d.ts +20 -0
- package/dist/cli/output/verbosity.d.ts.map +1 -0
- package/dist/cli/output/verbosity.js +32 -0
- package/dist/cli/output/verbosity.js.map +1 -0
- package/dist/cli/output/verbosity.test.d.ts +2 -0
- package/dist/cli/output/verbosity.test.d.ts.map +1 -0
- package/dist/cli/output/verbosity.test.js +35 -0
- package/dist/cli/output/verbosity.test.js.map +1 -0
- package/dist/cli/terminal.d.ts +19 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +247 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/terminal.test.d.ts +2 -0
- package/dist/cli/terminal.test.d.ts.map +1 -0
- package/dist/cli/terminal.test.js +123 -0
- package/dist/cli/terminal.test.js.map +1 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +27 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +77 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/loader.test.d.ts +2 -0
- package/dist/config/loader.test.d.ts.map +1 -0
- package/dist/config/loader.test.js +263 -0
- package/dist/config/loader.test.js.map +1 -0
- package/dist/config/schema.d.ts +318 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +137 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/writer.d.ts +11 -0
- package/dist/config/writer.d.ts.map +1 -0
- package/dist/config/writer.js +74 -0
- package/dist/config/writer.js.map +1 -0
- package/dist/config/writer.test.d.ts +2 -0
- package/dist/config/writer.test.d.ts.map +1 -0
- package/dist/config/writer.test.js +98 -0
- package/dist/config/writer.test.js.map +1 -0
- package/dist/diff/classify.d.ts +29 -0
- package/dist/diff/classify.d.ts.map +1 -0
- package/dist/diff/classify.js +74 -0
- package/dist/diff/classify.js.map +1 -0
- package/dist/diff/classify.test.d.ts +2 -0
- package/dist/diff/classify.test.d.ts.map +1 -0
- package/dist/diff/classify.test.js +140 -0
- package/dist/diff/classify.test.js.map +1 -0
- package/dist/diff/coalesce.d.ts +42 -0
- package/dist/diff/coalesce.d.ts.map +1 -0
- package/dist/diff/coalesce.js +104 -0
- package/dist/diff/coalesce.js.map +1 -0
- package/dist/diff/coalesce.test.d.ts +2 -0
- package/dist/diff/coalesce.test.d.ts.map +1 -0
- package/dist/diff/coalesce.test.js +159 -0
- package/dist/diff/coalesce.test.js.map +1 -0
- package/dist/diff/context.d.ts +30 -0
- package/dist/diff/context.d.ts.map +1 -0
- package/dist/diff/context.js +144 -0
- package/dist/diff/context.js.map +1 -0
- package/dist/diff/context.test.d.ts +2 -0
- package/dist/diff/context.test.d.ts.map +1 -0
- package/dist/diff/context.test.js +190 -0
- package/dist/diff/context.test.js.map +1 -0
- package/dist/diff/index.d.ts +5 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +5 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/diff/parser.d.ts +52 -0
- package/dist/diff/parser.d.ts.map +1 -0
- package/dist/diff/parser.js +95 -0
- package/dist/diff/parser.js.map +1 -0
- package/dist/diff/parser.test.d.ts +2 -0
- package/dist/diff/parser.test.d.ts.map +1 -0
- package/dist/diff/parser.test.js +178 -0
- package/dist/diff/parser.test.js.map +1 -0
- package/dist/event/context.d.ts +9 -0
- package/dist/event/context.d.ts.map +1 -0
- package/dist/event/context.js +94 -0
- package/dist/event/context.js.map +1 -0
- package/dist/event/index.d.ts +3 -0
- package/dist/event/index.d.ts.map +1 -0
- package/dist/event/index.js +3 -0
- package/dist/event/index.js.map +1 -0
- package/dist/event/schedule-context.d.ts +30 -0
- package/dist/event/schedule-context.d.ts.map +1 -0
- package/dist/event/schedule-context.js +57 -0
- package/dist/event/schedule-context.js.map +1 -0
- package/dist/examples/examples.integration.test.d.ts +2 -0
- package/dist/examples/examples.integration.test.d.ts.map +1 -0
- package/dist/examples/examples.integration.test.js +55 -0
- package/dist/examples/examples.integration.test.js.map +1 -0
- package/dist/examples/index.d.ts +50 -0
- package/dist/examples/index.d.ts.map +1 -0
- package/dist/examples/index.js +104 -0
- package/dist/examples/index.js.map +1 -0
- package/dist/examples/index.test.d.ts +2 -0
- package/dist/examples/index.test.d.ts.map +1 -0
- package/dist/examples/index.test.js +88 -0
- package/dist/examples/index.test.js.map +1 -0
- package/dist/examples/setup.d.ts +2 -0
- package/dist/examples/setup.d.ts.map +1 -0
- package/dist/examples/setup.js +22 -0
- package/dist/examples/setup.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/output/dedup.d.ts +153 -0
- package/dist/output/dedup.d.ts.map +1 -0
- package/dist/output/dedup.js +416 -0
- package/dist/output/dedup.js.map +1 -0
- package/dist/output/dedup.test.d.ts +2 -0
- package/dist/output/dedup.test.d.ts.map +1 -0
- package/dist/output/dedup.test.js +357 -0
- package/dist/output/dedup.test.js.map +1 -0
- package/dist/output/github-checks.d.ts +106 -0
- package/dist/output/github-checks.d.ts.map +1 -0
- package/dist/output/github-checks.js +321 -0
- package/dist/output/github-checks.js.map +1 -0
- package/dist/output/github-checks.test.d.ts +2 -0
- package/dist/output/github-checks.test.d.ts.map +1 -0
- package/dist/output/github-checks.test.js +255 -0
- package/dist/output/github-checks.test.js.map +1 -0
- package/dist/output/github-issues.d.ts +35 -0
- package/dist/output/github-issues.d.ts.map +1 -0
- package/dist/output/github-issues.js +246 -0
- package/dist/output/github-issues.js.map +1 -0
- package/dist/output/index.d.ts +6 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +6 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/issue-renderer.d.ts +20 -0
- package/dist/output/issue-renderer.d.ts.map +1 -0
- package/dist/output/issue-renderer.js +154 -0
- package/dist/output/issue-renderer.js.map +1 -0
- package/dist/output/renderer.d.ts +4 -0
- package/dist/output/renderer.d.ts.map +1 -0
- package/dist/output/renderer.js +168 -0
- package/dist/output/renderer.js.map +1 -0
- package/dist/output/renderer.test.d.ts +2 -0
- package/dist/output/renderer.test.d.ts.map +1 -0
- package/dist/output/renderer.test.js +645 -0
- package/dist/output/renderer.test.js.map +1 -0
- package/dist/output/stale.d.ts +31 -0
- package/dist/output/stale.d.ts.map +1 -0
- package/dist/output/stale.js +114 -0
- package/dist/output/stale.js.map +1 -0
- package/dist/output/stale.test.d.ts +2 -0
- package/dist/output/stale.test.d.ts.map +1 -0
- package/dist/output/stale.test.js +330 -0
- package/dist/output/stale.test.js.map +1 -0
- package/dist/output/types.d.ts +31 -0
- package/dist/output/types.d.ts.map +1 -0
- package/dist/output/types.js +2 -0
- package/dist/output/types.js.map +1 -0
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/runner.d.ts +202 -0
- package/dist/sdk/runner.d.ts.map +1 -0
- package/dist/sdk/runner.js +888 -0
- package/dist/sdk/runner.js.map +1 -0
- package/dist/sdk/runner.test.d.ts +2 -0
- package/dist/sdk/runner.test.d.ts.map +1 -0
- package/dist/sdk/runner.test.js +677 -0
- package/dist/sdk/runner.test.js.map +1 -0
- package/dist/skills/index.d.ts +5 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +3 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +111 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +319 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/loader.test.d.ts +2 -0
- package/dist/skills/loader.test.d.ts.map +1 -0
- package/dist/skills/loader.test.js +241 -0
- package/dist/skills/loader.test.js.map +1 -0
- package/dist/skills/remote.d.ts +117 -0
- package/dist/skills/remote.d.ts.map +1 -0
- package/dist/skills/remote.js +496 -0
- package/dist/skills/remote.js.map +1 -0
- package/dist/skills/remote.test.d.ts +2 -0
- package/dist/skills/remote.test.d.ts.map +1 -0
- package/dist/skills/remote.test.js +582 -0
- package/dist/skills/remote.test.js.map +1 -0
- package/dist/triggers/matcher.d.ts +30 -0
- package/dist/triggers/matcher.d.ts.map +1 -0
- package/dist/triggers/matcher.js +122 -0
- package/dist/triggers/matcher.js.map +1 -0
- package/dist/triggers/matcher.test.d.ts +2 -0
- package/dist/triggers/matcher.test.d.ts.map +1 -0
- package/dist/triggers/matcher.test.js +234 -0
- package/dist/triggers/matcher.test.js.map +1 -0
- package/dist/types/index.d.ts +269 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +162 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/async.d.ts +5 -0
- package/dist/utils/async.d.ts.map +1 -0
- package/dist/utils/async.js +13 -0
- package/dist/utils/async.js.map +1 -0
- package/dist/utils/index.d.ts +16 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +44 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.test.d.ts +2 -0
- package/dist/utils/index.test.d.ts.map +1 -0
- package/dist/utils/index.test.js +68 -0
- package/dist/utils/index.test.js.map +1 -0
- package/dist/utils/version.d.ts +3 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +16 -0
- package/dist/utils/version.js.map +1 -0
- package/docs/src/pages/config.astro +2 -1
- package/docs/src/pages/guide.astro +2 -1
- package/docs/src/utils/version.ts +6 -0
- package/package.json +12 -2
- package/src/cli/args.ts +2 -3
- package/src/cli/commands/init.test.ts +2 -1
- package/src/cli/commands/init.ts +3 -1
- package/src/cli/output/reporter.ts +3 -4
- package/src/utils/index.ts +1 -0
- package/src/utils/version.ts +17 -0
- package/.claude/settings.local.json +0 -88
- package/docs/.claude/settings.local.json +0 -11
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface GitFileChange {
|
|
2
|
+
filename: string;
|
|
3
|
+
status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied';
|
|
4
|
+
additions: number;
|
|
5
|
+
deletions: number;
|
|
6
|
+
patch?: string;
|
|
7
|
+
chunks?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get the current branch name.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCurrentBranch(cwd?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Get the HEAD commit SHA.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getHeadSha(cwd?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Detect the default branch by checking common branch names locally.
|
|
19
|
+
* Does not perform any remote operations to avoid SSH prompts.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getDefaultBranch(cwd?: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the repository root path.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getRepoRoot(cwd?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get the repository name from the git remote or directory name.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getRepoName(cwd?: string): {
|
|
30
|
+
owner: string;
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Get the GitHub repository URL if the remote is on GitHub.
|
|
35
|
+
* Returns null if the remote is not GitHub or not configured.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getGitHubRepoUrl(cwd?: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Get list of changed files between two refs.
|
|
40
|
+
* If head is undefined, compares against the working tree.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getChangedFiles(base: string, head?: string, cwd?: string): GitFileChange[];
|
|
43
|
+
/**
|
|
44
|
+
* Get the patch for a specific file.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getFilePatch(base: string, head: string | undefined, filename: string, cwd?: string): string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Get patches for all changed files in a single git command.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getChangedFilesWithPatches(base: string, head?: string, cwd?: string): GitFileChange[];
|
|
51
|
+
/**
|
|
52
|
+
* Check if there are uncommitted changes in the working tree.
|
|
53
|
+
*/
|
|
54
|
+
export declare function hasUncommittedChanges(cwd?: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Check if a ref exists.
|
|
57
|
+
*/
|
|
58
|
+
export declare function refExists(ref: string, cwd?: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Commit message with subject and body separated.
|
|
61
|
+
*/
|
|
62
|
+
export interface CommitMessage {
|
|
63
|
+
/** First line of the commit message */
|
|
64
|
+
subject: string;
|
|
65
|
+
/** Remaining lines after the subject (may be empty) */
|
|
66
|
+
body: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the commit message for a specific ref.
|
|
70
|
+
* Returns subject (first line) and body (remaining lines) separately.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getCommitMessage(ref: string, cwd?: string): CommitMessage;
|
|
73
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/cli/git.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAmBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAE9D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAsBpE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAE/D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAE,MAAsB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAiBxF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAiB3E;AAsBD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,GAAE,MAAsB,GAC1B,aAAa,EAAE,CA8CjB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,MAAsB,GAC1B,MAAM,GAAG,SAAS,CAOpB;AA6BD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,GAAE,MAAsB,GAC1B,aAAa,EAAE,CA0BjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAG1E;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,OAAO,CAO3E;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,aAAa,CAKxF"}
|
package/dist/cli/git.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { countPatchChunks } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Execute a git command and return stdout.
|
|
5
|
+
*/
|
|
6
|
+
function git(args, cwd = process.cwd()) {
|
|
7
|
+
try {
|
|
8
|
+
return execSync(`git ${args}`, {
|
|
9
|
+
cwd,
|
|
10
|
+
encoding: 'utf-8',
|
|
11
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
12
|
+
}).trim();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
const execError = error;
|
|
16
|
+
const stderr = execError.stderr?.toString() ?? '';
|
|
17
|
+
throw new Error(`Git command failed: git ${args}\n${stderr || execError.message}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the current branch name.
|
|
22
|
+
*/
|
|
23
|
+
export function getCurrentBranch(cwd = process.cwd()) {
|
|
24
|
+
return git('rev-parse --abbrev-ref HEAD', cwd);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the HEAD commit SHA.
|
|
28
|
+
*/
|
|
29
|
+
export function getHeadSha(cwd = process.cwd()) {
|
|
30
|
+
return git('rev-parse HEAD', cwd);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Detect the default branch by checking common branch names locally.
|
|
34
|
+
* Does not perform any remote operations to avoid SSH prompts.
|
|
35
|
+
*/
|
|
36
|
+
export function getDefaultBranch(cwd = process.cwd()) {
|
|
37
|
+
// Check common default branches locally (no remote operations)
|
|
38
|
+
for (const branch of ['main', 'master', 'develop']) {
|
|
39
|
+
try {
|
|
40
|
+
git(`rev-parse --verify ${branch}`, cwd);
|
|
41
|
+
return branch;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Try next branch
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Check git config for user-configured default branch
|
|
48
|
+
try {
|
|
49
|
+
const configuredDefault = git('config init.defaultBranch', cwd);
|
|
50
|
+
if (configuredDefault) {
|
|
51
|
+
return configuredDefault;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Config not set
|
|
56
|
+
}
|
|
57
|
+
return 'main'; // Default fallback
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the repository root path.
|
|
61
|
+
*/
|
|
62
|
+
export function getRepoRoot(cwd = process.cwd()) {
|
|
63
|
+
return git('rev-parse --show-toplevel', cwd);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get the repository name from the git remote or directory name.
|
|
67
|
+
*/
|
|
68
|
+
export function getRepoName(cwd = process.cwd()) {
|
|
69
|
+
try {
|
|
70
|
+
const remoteUrl = git('config --get remote.origin.url', cwd);
|
|
71
|
+
// Handle SSH: git@github.com:owner/repo.git
|
|
72
|
+
// Handle HTTPS: https://github.com/owner/repo.git
|
|
73
|
+
const match = remoteUrl.match(/[/:]([\w.-]+)\/([\w.-]+?)(?:\.git)?$/);
|
|
74
|
+
if (match && match[1] && match[2]) {
|
|
75
|
+
return { owner: match[1], name: match[2] };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// No remote configured
|
|
80
|
+
}
|
|
81
|
+
// Fall back to directory name
|
|
82
|
+
const repoRoot = getRepoRoot(cwd);
|
|
83
|
+
const dirName = repoRoot.split('/').pop() ?? 'unknown';
|
|
84
|
+
return { owner: 'local', name: dirName };
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get the GitHub repository URL if the remote is on GitHub.
|
|
88
|
+
* Returns null if the remote is not GitHub or not configured.
|
|
89
|
+
*/
|
|
90
|
+
export function getGitHubRepoUrl(cwd = process.cwd()) {
|
|
91
|
+
try {
|
|
92
|
+
const remoteUrl = git('config --get remote.origin.url', cwd);
|
|
93
|
+
// Handle SSH: git@github.com:owner/repo.git
|
|
94
|
+
const sshMatch = remoteUrl.match(/git@github\.com:([\w.-]+)\/([\w.-]+?)(?:\.git)?$/);
|
|
95
|
+
if (sshMatch && sshMatch[1] && sshMatch[2]) {
|
|
96
|
+
return `https://github.com/${sshMatch[1]}/${sshMatch[2]}`;
|
|
97
|
+
}
|
|
98
|
+
// Handle HTTPS: https://github.com/owner/repo.git
|
|
99
|
+
const httpsMatch = remoteUrl.match(/https:\/\/github\.com\/([\w.-]+)\/([\w.-]+?)(?:\.git)?$/);
|
|
100
|
+
if (httpsMatch && httpsMatch[1] && httpsMatch[2]) {
|
|
101
|
+
return `https://github.com/${httpsMatch[1]}/${httpsMatch[2]}`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// No remote configured
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Map git status letter to FileChange status.
|
|
111
|
+
*/
|
|
112
|
+
function mapStatus(status) {
|
|
113
|
+
switch (status[0]) {
|
|
114
|
+
case 'A':
|
|
115
|
+
return 'added';
|
|
116
|
+
case 'D':
|
|
117
|
+
return 'removed';
|
|
118
|
+
case 'M':
|
|
119
|
+
return 'modified';
|
|
120
|
+
case 'R':
|
|
121
|
+
return 'renamed';
|
|
122
|
+
case 'C':
|
|
123
|
+
return 'copied';
|
|
124
|
+
default:
|
|
125
|
+
return 'modified';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get list of changed files between two refs.
|
|
130
|
+
* If head is undefined, compares against the working tree.
|
|
131
|
+
*/
|
|
132
|
+
export function getChangedFiles(base, head, cwd = process.cwd()) {
|
|
133
|
+
// Get file statuses
|
|
134
|
+
const diffArgs = head ? `${base}...${head}` : base;
|
|
135
|
+
const nameStatusOutput = git(`diff --name-status ${diffArgs}`, cwd);
|
|
136
|
+
if (!nameStatusOutput) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
const files = [];
|
|
140
|
+
for (const line of nameStatusOutput.split('\n')) {
|
|
141
|
+
if (!line.trim())
|
|
142
|
+
continue;
|
|
143
|
+
const parts = line.split('\t');
|
|
144
|
+
const status = parts[0] ?? '';
|
|
145
|
+
// For renames, format is "R100\told-name\tnew-name"
|
|
146
|
+
const filename = parts.length > 2 ? (parts[2] ?? '') : (parts[1] ?? '');
|
|
147
|
+
if (!filename)
|
|
148
|
+
continue;
|
|
149
|
+
files.push({
|
|
150
|
+
filename,
|
|
151
|
+
status: mapStatus(status),
|
|
152
|
+
additions: 0,
|
|
153
|
+
deletions: 0,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// Get numstat for additions/deletions
|
|
157
|
+
const numstatOutput = git(`diff --numstat ${diffArgs}`, cwd);
|
|
158
|
+
if (numstatOutput) {
|
|
159
|
+
for (const line of numstatOutput.split('\n')) {
|
|
160
|
+
if (!line.trim())
|
|
161
|
+
continue;
|
|
162
|
+
const parts = line.split('\t');
|
|
163
|
+
const additions = parts[0] ?? '0';
|
|
164
|
+
const deletions = parts[1] ?? '0';
|
|
165
|
+
const filename = parts[2] ?? '';
|
|
166
|
+
const file = files.find((f) => f.filename === filename);
|
|
167
|
+
if (file) {
|
|
168
|
+
file.additions = additions === '-' ? 0 : parseInt(additions, 10);
|
|
169
|
+
file.deletions = deletions === '-' ? 0 : parseInt(deletions, 10);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return files;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get the patch for a specific file.
|
|
177
|
+
*/
|
|
178
|
+
export function getFilePatch(base, head, filename, cwd = process.cwd()) {
|
|
179
|
+
try {
|
|
180
|
+
const diffArgs = head ? `${base}...${head}` : base;
|
|
181
|
+
return git(`diff ${diffArgs} -- "${filename}"`, cwd);
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Parse a combined diff output into individual file patches.
|
|
189
|
+
*/
|
|
190
|
+
function parseCombinedDiff(diffOutput) {
|
|
191
|
+
const patches = new Map();
|
|
192
|
+
if (!diffOutput)
|
|
193
|
+
return patches;
|
|
194
|
+
// Split by "diff --git" but keep the delimiter
|
|
195
|
+
const parts = diffOutput.split(/(?=^diff --git )/m);
|
|
196
|
+
for (const part of parts) {
|
|
197
|
+
if (!part.trim())
|
|
198
|
+
continue;
|
|
199
|
+
// Extract filename from "diff --git a/path b/path" line
|
|
200
|
+
const match = part.match(/^diff --git a\/(.+?) b\/(.+?)\n/);
|
|
201
|
+
if (match) {
|
|
202
|
+
// Use the "b" path (destination) as the filename
|
|
203
|
+
const filename = match[2];
|
|
204
|
+
if (filename) {
|
|
205
|
+
patches.set(filename, part);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return patches;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get patches for all changed files in a single git command.
|
|
213
|
+
*/
|
|
214
|
+
export function getChangedFilesWithPatches(base, head, cwd = process.cwd()) {
|
|
215
|
+
const files = getChangedFiles(base, head, cwd);
|
|
216
|
+
if (files.length === 0) {
|
|
217
|
+
return files;
|
|
218
|
+
}
|
|
219
|
+
// Get all patches in a single git diff command
|
|
220
|
+
try {
|
|
221
|
+
const diffArgs = head ? `${base}...${head}` : base;
|
|
222
|
+
const combinedDiff = git(`diff ${diffArgs}`, cwd);
|
|
223
|
+
const patches = parseCombinedDiff(combinedDiff);
|
|
224
|
+
for (const file of files) {
|
|
225
|
+
file.patch = patches.get(file.filename);
|
|
226
|
+
file.chunks = countPatchChunks(file.patch);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
// Fall back to per-file patches if combined diff fails
|
|
231
|
+
for (const file of files) {
|
|
232
|
+
file.patch = getFilePatch(base, head, file.filename, cwd);
|
|
233
|
+
file.chunks = countPatchChunks(file.patch);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return files;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Check if there are uncommitted changes in the working tree.
|
|
240
|
+
*/
|
|
241
|
+
export function hasUncommittedChanges(cwd = process.cwd()) {
|
|
242
|
+
const status = git('status --porcelain', cwd);
|
|
243
|
+
return status.length > 0;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Check if a ref exists.
|
|
247
|
+
*/
|
|
248
|
+
export function refExists(ref, cwd = process.cwd()) {
|
|
249
|
+
try {
|
|
250
|
+
git(`rev-parse --verify ${ref}`, cwd);
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get the commit message for a specific ref.
|
|
259
|
+
* Returns subject (first line) and body (remaining lines) separately.
|
|
260
|
+
*/
|
|
261
|
+
export function getCommitMessage(ref, cwd = process.cwd()) {
|
|
262
|
+
// %s = subject, %b = body
|
|
263
|
+
const subject = git(`log -1 --format=%s ${ref}`, cwd);
|
|
264
|
+
const body = git(`log -1 --format=%b ${ref}`, cwd);
|
|
265
|
+
return { subject, body };
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/cli/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAWrD;;GAEG;AACH,SAAS,GAAG,CAAC,IAAY,EAAE,MAAc,OAAO,CAAC,GAAG,EAAE;IACpD,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,OAAO,IAAI,EAAE,EAAE;YAC7B,GAAG;YACH,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,KAAsD,CAAC;QACzE,MAAM,MAAM,GAAG,SAAS,CA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CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC/D,MAAM,MAAM,GAAG,GAAG,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,MAAc,OAAO,CAAC,GAAG,EAAE;IAChE,IAAI,CAAC;QACH,GAAG,CAAC,sBAAsB,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAYD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,MAAc,OAAO,CAAC,GAAG,EAAE;IACvE,0BAA0B;IAC1B,MAAM,OAAO,GAAG,GAAG,CAAC,sBAAsB,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,GAAG,CAAC,sBAAsB,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.test.d.ts","sourceRoot":"","sources":["../../src/cli/git.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
3
|
+
import { getDefaultBranch, getCurrentBranch, getCommitMessage } from './git.js';
|
|
4
|
+
vi.mock('node:child_process', () => ({
|
|
5
|
+
execSync: vi.fn(),
|
|
6
|
+
}));
|
|
7
|
+
const mockExecSync = vi.mocked(execSync);
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
mockExecSync.mockReset();
|
|
10
|
+
});
|
|
11
|
+
describe('git error handling', () => {
|
|
12
|
+
it('includes stderr in error message when git command fails', () => {
|
|
13
|
+
const error = new Error('Command failed');
|
|
14
|
+
error.stderr = 'fatal: not a git repository';
|
|
15
|
+
mockExecSync.mockImplementation(() => {
|
|
16
|
+
throw error;
|
|
17
|
+
});
|
|
18
|
+
expect(() => getCurrentBranch()).toThrow('Git command failed: git rev-parse --abbrev-ref HEAD\nfatal: not a git repository');
|
|
19
|
+
});
|
|
20
|
+
it('includes command in error message when stderr is empty', () => {
|
|
21
|
+
mockExecSync.mockImplementation(() => {
|
|
22
|
+
throw new Error('Command failed');
|
|
23
|
+
});
|
|
24
|
+
expect(() => getCurrentBranch()).toThrow('Git command failed: git rev-parse --abbrev-ref HEAD\nCommand failed');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Creates a mock that simulates git branch detection.
|
|
29
|
+
* Returns success for branches in existingBranches, and optionally a config value.
|
|
30
|
+
*/
|
|
31
|
+
function mockBranchDetection(existingBranches, configDefault) {
|
|
32
|
+
return (cmd) => {
|
|
33
|
+
for (const branch of existingBranches) {
|
|
34
|
+
if (cmd === `git rev-parse --verify ${branch}`) {
|
|
35
|
+
return 'abc123\n';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (cmd === 'git config init.defaultBranch' && configDefault) {
|
|
39
|
+
return `${configDefault}\n`;
|
|
40
|
+
}
|
|
41
|
+
throw new Error('Not found');
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
describe('getDefaultBranch', () => {
|
|
45
|
+
it('returns main when main branch exists locally', () => {
|
|
46
|
+
mockExecSync.mockImplementation(mockBranchDetection(['main']));
|
|
47
|
+
expect(getDefaultBranch()).toBe('main');
|
|
48
|
+
});
|
|
49
|
+
it('returns master when main does not exist but master does', () => {
|
|
50
|
+
mockExecSync.mockImplementation(mockBranchDetection(['master']));
|
|
51
|
+
expect(getDefaultBranch()).toBe('master');
|
|
52
|
+
});
|
|
53
|
+
it('returns develop when main and master do not exist but develop does', () => {
|
|
54
|
+
mockExecSync.mockImplementation(mockBranchDetection(['develop']));
|
|
55
|
+
expect(getDefaultBranch()).toBe('develop');
|
|
56
|
+
});
|
|
57
|
+
it('returns git config init.defaultBranch when no common branches exist', () => {
|
|
58
|
+
mockExecSync.mockImplementation(mockBranchDetection([], 'trunk'));
|
|
59
|
+
expect(getDefaultBranch()).toBe('trunk');
|
|
60
|
+
});
|
|
61
|
+
it('returns hardcoded main when no branches exist and no config is set', () => {
|
|
62
|
+
mockExecSync.mockImplementation(mockBranchDetection([]));
|
|
63
|
+
expect(getDefaultBranch()).toBe('main');
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('getCommitMessage', () => {
|
|
67
|
+
it('returns subject and body from commit', () => {
|
|
68
|
+
mockExecSync.mockImplementation((cmd) => {
|
|
69
|
+
if (cmd === 'git log -1 --format=%s HEAD') {
|
|
70
|
+
return 'feat: Add new feature\n';
|
|
71
|
+
}
|
|
72
|
+
if (cmd === 'git log -1 --format=%b HEAD') {
|
|
73
|
+
return 'This is the commit body.\n\nWith multiple paragraphs.\n';
|
|
74
|
+
}
|
|
75
|
+
throw new Error('Unexpected command');
|
|
76
|
+
});
|
|
77
|
+
const result = getCommitMessage('HEAD');
|
|
78
|
+
expect(result.subject).toBe('feat: Add new feature');
|
|
79
|
+
expect(result.body).toBe('This is the commit body.\n\nWith multiple paragraphs.');
|
|
80
|
+
});
|
|
81
|
+
it('returns empty body when commit has no body', () => {
|
|
82
|
+
mockExecSync.mockImplementation((cmd) => {
|
|
83
|
+
if (cmd === 'git log -1 --format=%s abc123') {
|
|
84
|
+
return 'fix: Quick fix\n';
|
|
85
|
+
}
|
|
86
|
+
if (cmd === 'git log -1 --format=%b abc123') {
|
|
87
|
+
return '\n';
|
|
88
|
+
}
|
|
89
|
+
throw new Error('Unexpected command');
|
|
90
|
+
});
|
|
91
|
+
const result = getCommitMessage('abc123');
|
|
92
|
+
expect(result.subject).toBe('fix: Quick fix');
|
|
93
|
+
expect(result.body).toBe('');
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=git.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.test.js","sourceRoot":"","sources":["../../src/cli/git.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEhF,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE;CAClB,CAAC,CAAC,CAAC;AAEJ,MAAM,YAAY,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEzC,UAAU,CAAC,GAAG,EAAE;IACd,YAAY,CAAC,SAAS,EAAE,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,gBAAgB,CAA+B,CAAC;QACxE,KAAK,CAAC,MAAM,GAAG,6BAA6B,CAAC;QAC7C,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE;YACnC,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC,OAAO,CACtC,kFAAkF,CACnF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,E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C,IAAI,CAAC,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,YAAY,CAAC,kBAAkB,CAAC,CAAC,GAAW,EAAE,EAAE;YAC9C,IAAI,GAAG,KAAK,+BAA+B,EAAE,CAAC;gBAC5C,OAAO,kBAAkB,CAAC;YAC5B,CAAC;YACD,IAAI,GAAG,KAAK,+BAA+B,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main, abortController } from './main.js';
|
|
3
|
+
process.on('SIGINT', () => {
|
|
4
|
+
// Abort any running SDK queries
|
|
5
|
+
abortController.abort();
|
|
6
|
+
process.stderr.write('\n');
|
|
7
|
+
process.exit(130);
|
|
8
|
+
});
|
|
9
|
+
main().catch((error) => {
|
|
10
|
+
console.error('Fatal error:', error);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,gCAAgC;IAChC,eAAe,CAAC,KAAK,EAAE,CAAC;IACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAoCA;;;GAGG;AACH,eAAO,MAAM,eAAe,iBAAwB,CAAC;AAokBrD,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAmD1C"}
|