vouchington-tooling 0.58.0 → 0.60.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/README.md +80 -0
- package/dist/agent-issue-labels/ensure-labels.d.mts +1 -1
- package/dist/agent-issue-labels/ensure-labels.mjs +1 -1
- package/dist/browser-session-runner/tail-queue.d.mts +1 -1
- package/dist/browser-session-runner/tail-queue.mjs +1 -1
- package/dist/cli/commands/gitleaks-directory-scan.d.mts +4 -0
- package/dist/cli/commands/gitleaks-directory-scan.mjs +9 -0
- package/dist/cli/commands/hook.d.mts +2 -0
- package/dist/cli/commands/hook.mjs +19 -0
- package/dist/cli/commands/transient-retry.d.mts +13 -0
- package/dist/cli/commands/transient-retry.mjs +68 -0
- package/dist/cli/index.mjs +14 -53
- package/dist/cli/parse-forwarded-commands.d.mts +12 -0
- package/dist/cli/parse-forwarded-commands.mjs +8 -0
- package/dist/cli/parse.d.mts +12 -0
- package/dist/cli/script-paths.d.mts +5 -0
- package/dist/cli/script-paths.mjs +48 -0
- package/dist/cli/usage-text.d.mts +1 -0
- package/dist/cli/usage-text.mjs +170 -0
- package/dist/cli/usage.d.mts +2 -1
- package/dist/cli/usage.mjs +2 -149
- package/dist/command-policy/engine.d.mts +7 -0
- package/dist/command-policy/engine.mjs +58 -0
- package/dist/command-policy/git-patterns.d.mts +20 -0
- package/dist/command-policy/git-patterns.mjs +82 -0
- package/dist/command-policy/git-process.d.mts +4 -0
- package/dist/command-policy/git-process.mjs +54 -0
- package/dist/command-policy/github-checkout-owners.d.mts +22 -0
- package/dist/command-policy/github-checkout-owners.mjs +122 -0
- package/dist/command-policy/github-command-context.d.mts +6 -0
- package/dist/command-policy/github-command-context.mjs +19 -0
- package/dist/command-policy/github-command-cwd.d.mts +8 -0
- package/dist/command-policy/github-command-cwd.mjs +130 -0
- package/dist/command-policy/github-command-position.d.mts +7 -0
- package/dist/command-policy/github-command-position.mjs +12 -0
- package/dist/command-policy/github-configured-base.d.mts +25 -0
- package/dist/command-policy/github-configured-base.mjs +59 -0
- package/dist/command-policy/github-invocation.d.mts +9 -0
- package/dist/command-policy/github-invocation.mjs +80 -0
- package/dist/command-policy/github-merge-authority.d.mts +21 -0
- package/dist/command-policy/github-merge-authority.mjs +86 -0
- package/dist/command-policy/github-option-flags.d.mts +3 -0
- package/dist/command-policy/github-option-flags.mjs +67 -0
- package/dist/command-policy/github-options.d.mts +12 -0
- package/dist/command-policy/github-options.mjs +73 -0
- package/dist/command-policy/github-stack-workflow.d.mts +9 -0
- package/dist/command-policy/github-stack-workflow.mjs +94 -0
- package/dist/command-policy/github-workflow.d.mts +7 -0
- package/dist/command-policy/github-workflow.mjs +50 -0
- package/dist/command-policy/hook/args.d.mts +11 -0
- package/dist/command-policy/hook/args.mjs +49 -0
- package/dist/command-policy/hook/harness.d.mts +26 -0
- package/dist/command-policy/hook/harness.mjs +119 -0
- package/dist/command-policy/hook/policy-module.d.mts +7 -0
- package/dist/command-policy/hook/policy-module.mjs +48 -0
- package/dist/command-policy/hook/post-tool-use.d.mts +9 -0
- package/dist/command-policy/hook/post-tool-use.mjs +51 -0
- package/dist/command-policy/hook/pre-tool-use.d.mts +21 -0
- package/dist/command-policy/hook/pre-tool-use.mjs +45 -0
- package/dist/command-policy/hook/run.d.mts +17 -0
- package/dist/command-policy/hook/run.mjs +69 -0
- package/dist/command-policy/hook/types.d.mts +33 -0
- package/dist/command-policy/hook/types.mjs +5 -0
- package/dist/command-policy/index.d.mts +29 -0
- package/dist/command-policy/index.mjs +23 -0
- package/dist/command-policy/path-references.d.mts +14 -0
- package/dist/command-policy/path-references.mjs +68 -0
- package/dist/command-policy/path-rules.d.mts +11 -0
- package/dist/command-policy/path-rules.mjs +37 -0
- package/dist/command-policy/payload.d.mts +8 -0
- package/dist/command-policy/payload.mjs +54 -0
- package/dist/command-policy/types.d.mts +77 -0
- package/dist/command-policy/types.mjs +1 -0
- package/dist/dead-code/baseline.d.mts +19 -0
- package/dist/dead-code/baseline.mjs +124 -0
- package/dist/dead-code/child-command.d.mts +6 -0
- package/dist/dead-code/child-command.mjs +107 -0
- package/dist/dead-code/cli.d.mts +5 -0
- package/dist/dead-code/cli.mjs +71 -0
- package/dist/dead-code/entry-roots.d.mts +7 -0
- package/dist/dead-code/entry-roots.mjs +43 -0
- package/dist/dead-code/fixture-deadline.test-helpers.d.mts +1 -0
- package/dist/dead-code/fixture-deadline.test-helpers.mjs +9 -0
- package/dist/dead-code/gate.d.mts +29 -0
- package/dist/dead-code/gate.mjs +33 -0
- package/dist/dead-code/gate.test-helpers.d.mts +14 -0
- package/dist/dead-code/gate.test-helpers.mjs +35 -0
- package/dist/dead-code/index.d.mts +9 -0
- package/dist/dead-code/index.mjs +7 -0
- package/dist/dead-code/scan.d.mts +11 -0
- package/dist/dead-code/scan.mjs +37 -0
- package/dist/dead-code/tracked-snapshot.d.mts +2 -0
- package/dist/dead-code/tracked-snapshot.mjs +72 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/markdown/details-scope.d.mts +1 -1
- package/dist/markdown/details-scope.mjs +1 -1
- package/dist/tmux/cli-shared.d.mts +18 -0
- package/dist/tmux/cli-shared.mjs +8 -0
- package/dist/tmux/cli.d.mts +3 -0
- package/dist/tmux/cli.mjs +34 -0
- package/dist/tmux/config.d.mts +24 -0
- package/dist/tmux/config.mjs +91 -0
- package/dist/tmux/fake-tmux.test-helpers.d.mts +46 -0
- package/dist/tmux/fake-tmux.test-helpers.mjs +105 -0
- package/dist/tmux/hook-payload.d.mts +8 -0
- package/dist/tmux/hook-payload.mjs +39 -0
- package/dist/tmux/index.d.mts +9 -0
- package/dist/tmux/index.mjs +7 -0
- package/dist/tmux/launcher.d.mts +11 -0
- package/dist/tmux/launcher.mjs +127 -0
- package/dist/tmux/reminder-post-tool.d.mts +21 -0
- package/dist/tmux/reminder-post-tool.mjs +88 -0
- package/dist/tmux/runner.d.mts +11 -0
- package/dist/tmux/runner.mjs +26 -0
- package/dist/tmux/session-name.d.mts +5 -0
- package/dist/tmux/session-name.mjs +10 -0
- package/dist/tmux/shell-quote.d.mts +9 -0
- package/dist/tmux/shell-quote.mjs +16 -0
- package/dist/tmux/up.d.mts +2 -0
- package/dist/tmux/up.mjs +73 -0
- package/dist/tmux/windows.d.mts +18 -0
- package/dist/tmux/windows.mjs +50 -0
- package/dist/transient-retry/attempts.d.mts +1 -1
- package/dist/transient-retry/attempts.mjs +1 -1
- package/dist/transient-retry/decision-evaluator.d.mts +3 -3
- package/dist/transient-retry/gh-api.d.mts +30 -0
- package/dist/transient-retry/gh-api.mjs +68 -0
- package/dist/transient-retry/github-actions-log.d.mts +7 -0
- package/dist/transient-retry/github-actions-log.mjs +33 -0
- package/dist/transient-retry/index.d.mts +15 -0
- package/dist/transient-retry/index.mjs +8 -0
- package/dist/transient-retry/log-stream.d.mts +12 -0
- package/dist/transient-retry/log-stream.mjs +39 -0
- package/dist/transient-retry/log-window.d.mts +18 -0
- package/dist/transient-retry/log-window.mjs +94 -0
- package/dist/transient-retry/rerun.d.mts +23 -0
- package/dist/transient-retry/rerun.mjs +68 -0
- package/dist/transient-retry/run-context-annotations.d.mts +7 -0
- package/dist/transient-retry/run-context-annotations.mjs +44 -0
- package/dist/transient-retry/run-context-jobs.d.mts +20 -0
- package/dist/transient-retry/run-context-jobs.mjs +54 -0
- package/dist/transient-retry/run-context-logs.d.mts +12 -0
- package/dist/transient-retry/run-context-logs.mjs +86 -0
- package/dist/transient-retry/run-context-rule-attempts.d.mts +14 -0
- package/dist/transient-retry/run-context-rule-attempts.mjs +65 -0
- package/dist/transient-retry/run-context-types.d.mts +49 -0
- package/dist/transient-retry/run-context-types.mjs +3 -0
- package/dist/transient-retry/run-context.d.mts +9 -0
- package/dist/transient-retry/run-context.mjs +25 -0
- package/dist/transient-retry/run-context.test-helpers.d.mts +16 -0
- package/dist/transient-retry/run-context.test-helpers.mjs +56 -0
- package/dist/transient-retry/types.d.mts +8 -7
- package/dist/vitest-diagnostics/vitest-worker-exit-diagnostics-reporter.mjs +1 -1
- package/dist/workflow-secrets-drift/gh.d.mts +1 -1
- package/dist/workflow-secrets-drift/gh.mjs +1 -1
- package/package.json +16 -1
- package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
- package/scripts/tmux/tmux-agent-reminder.sh +68 -0
- package/scripts/tmux/tmux-name.sh +34 -0
- package/scripts/tmux/tmux-read-title.sh +13 -0
- package/scripts/tmux/tmux-target.sh +130 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
export const USAGE = `Usage: vouchington <command> [options]
|
|
2
|
+
|
|
3
|
+
Commands:
|
|
4
|
+
runner-port-policy Print or validate a runner port policy
|
|
5
|
+
with-host-lock Run a command under a host-wide lock
|
|
6
|
+
host-storage Check free space on caller-supplied paths
|
|
7
|
+
gha-runtime-audit Audit successful GitHub Actions job runtimes
|
|
8
|
+
require-up-to-date Require HEAD to include a fetched remote branch
|
|
9
|
+
fresh-base Classify the worktree against a remote base branch
|
|
10
|
+
gitleaks-directory-scan Scan a directory with Gitleaks
|
|
11
|
+
ast-grep-examples Run AST-grep rule examples
|
|
12
|
+
ast-grep-pack Print shipped unconditional AST-grep pack paths as JSON
|
|
13
|
+
gha-workspace-policy Check GitHub Actions workspace safety policy
|
|
14
|
+
gha-output Write a collision-safe multiline GITHUB_OUTPUT record
|
|
15
|
+
gha-needs-results Fail if required GitHub Actions job results failed
|
|
16
|
+
download-with-diagnostics Download a URL and report HTTP status on failure
|
|
17
|
+
download-optional-run-artifacts Download optional artifacts from the current run
|
|
18
|
+
host-pressure-diagnostics Print a bounded host memory/OOM/PSI snapshot
|
|
19
|
+
allocate-browser-safe-ports Allocate Fetch-safe localhost ports
|
|
20
|
+
diagnose-port-collision Capture bounded localhost port diagnostics
|
|
21
|
+
prepare-trivy-db Download the Trivy vulnerability database
|
|
22
|
+
gha-artifacts-cleanup Delete classified GitHub Actions artifacts
|
|
23
|
+
agent-issue-labels Map changed paths to labels; create missing repository labels
|
|
24
|
+
http-origin Validate an optional HTTP(S) origin
|
|
25
|
+
vitest-blob-manifest Stamp a vitest-blob-manifest:v1 identity file
|
|
26
|
+
vitest-report-attempt Write or read a Vitest report-attempt marker
|
|
27
|
+
prepare-vitest-reports Validate and select Vitest report JSON files
|
|
28
|
+
pnpm-install Install a pnpm workspace with retry and release-age fail-fast
|
|
29
|
+
check-cache-size Measure a path and decide whether to save a GHA cache
|
|
30
|
+
make-shard-matrix Emit a [1..N] GitHub Actions shard matrix
|
|
31
|
+
load-runner-env Overlay a runner env file onto GITHUB_ENV with injection guards
|
|
32
|
+
clean-workspace Reset a persistent-runner workspace with a fork-PR trust gate
|
|
33
|
+
install-github-release Download a checksum-verified GitHub Release binary
|
|
34
|
+
run-with-timeout Run a command with GNU timeout or a Perl fallback
|
|
35
|
+
lint-links Two-pass lychee: internal links fail, external warn
|
|
36
|
+
materialize-pr-context Dump PR title/body/files/diff/comments and #N crawl
|
|
37
|
+
wait-for-apt-locks Wait until apt/dpkg lock files are free
|
|
38
|
+
install-playwright-chromium-arm64 Install Playwright Chromium from browsers.json
|
|
39
|
+
ghcr-package-retention Delete old GHCR package versions (KEEP_MIN or --main-history)
|
|
40
|
+
harness-admission-lane Compute a GITHUB_RUN_ID admission lane for fleet fan-out
|
|
41
|
+
harness-assert-gates Fail if any named HARNESS_*_ENABLED gate is enabled
|
|
42
|
+
gha-collaborator-trust Classify authors as write-access collaborators or not
|
|
43
|
+
nuget-central-version Validate a Directory.Packages.props PackageVersion delta
|
|
44
|
+
verify-workflow-secrets Check a secret inventory against live repository and environment secrets
|
|
45
|
+
dead-code Gate unused code against a committed jscpd baseline
|
|
46
|
+
swift-semantic-equal Compare Swift sources ignoring comments and whitespace
|
|
47
|
+
post-review Post one COMMENT review from a staged payload file
|
|
48
|
+
stage-review-payload Validate a review payload file into a staging directory
|
|
49
|
+
retrospective-transcript Format facts from Claude-compatible, Codex, or Grok transcripts
|
|
50
|
+
link-skill Link one packaged skill into an explicit consumer directory
|
|
51
|
+
retrospective-facts Gather immutable facts for a retrospective
|
|
52
|
+
agent-blackboard Probe an Agent Blackboard deployment, classify distill sessions, manage snapshots
|
|
53
|
+
mcp Serve the agent-blackboard journal tools over stdio (MCP)
|
|
54
|
+
hook Run a repository policy module as a pre/post tool-use hook
|
|
55
|
+
worktree Reclaim finished git worktrees (dry run unless --yes)
|
|
56
|
+
tmux Run configured dev windows in tmux; name panes; agent reminders
|
|
57
|
+
story-coverage Check component exports are imported by stories
|
|
58
|
+
transient-retry Rerun a failed GitHub Actions run when an injected rule matches
|
|
59
|
+
|
|
60
|
+
Options:
|
|
61
|
+
-h, --help Show this help
|
|
62
|
+
-v, --version Print the package version
|
|
63
|
+
|
|
64
|
+
runner-port-policy
|
|
65
|
+
(no args) Print the shipped policy as JSON
|
|
66
|
+
--file <path> Validate and print a policy file
|
|
67
|
+
--reserved <port> Print true if the port is reserved
|
|
68
|
+
|
|
69
|
+
with-host-lock
|
|
70
|
+
--name <family>
|
|
71
|
+
[--slots <n>]
|
|
72
|
+
--timeout-seconds <n>
|
|
73
|
+
[--command-timeout-seconds <n>]
|
|
74
|
+
[--failure-diagnostics <absolute-script>]
|
|
75
|
+
[--on-acquire-timeout fail|run-unlocked]
|
|
76
|
+
-- <command> [args...]
|
|
77
|
+
|
|
78
|
+
host-storage --path <path> [--path <path>...] [--minimum-free-bytes <bytes>] [--pnpm-store] [--docker-root] [--docker-desktop-path <path>] [--discovery-timeout-ms <ms>]
|
|
79
|
+
|
|
80
|
+
gha-runtime-audit
|
|
81
|
+
[--repository owner/name] Default GITHUB_REPOSITORY
|
|
82
|
+
[--branch main]
|
|
83
|
+
[--median-threshold-floor <seconds>] Off unless set. Must be below the ceiling
|
|
84
|
+
[--median-threshold-ceiling <seconds>] Default 360. Flags a five-sample median above this
|
|
85
|
+
--pr-workflow <name|/regex/> Repeatable
|
|
86
|
+
--push-workflow <name|/regex/> Repeatable
|
|
87
|
+
|
|
88
|
+
require-up-to-date --remote <name> --branch <name>
|
|
89
|
+
fresh-base [--remote <name>] [--branch <name>] [--skip-fetch]
|
|
90
|
+
gitleaks-directory-scan --config <path> [--directory <path>]
|
|
91
|
+
ast-grep-examples --rules <directory> --config <path>
|
|
92
|
+
ast-grep-pack
|
|
93
|
+
gha-workspace-policy [--root <directory>] [--workflow-directory <directory>] [--action-directory <directory>]
|
|
94
|
+
|
|
95
|
+
gha-output <name>
|
|
96
|
+
gha-needs-results [label]
|
|
97
|
+
download-with-diagnostics <url> <destination> [-- curl-args...]
|
|
98
|
+
download-optional-run-artifacts (--name <name>... | --pattern <pattern>) --dir <directory>
|
|
99
|
+
host-pressure-diagnostics
|
|
100
|
+
allocate-browser-safe-ports <count> [--policy path] [--forbidden-ports path]
|
|
101
|
+
diagnose-port-collision [--ports "2200 2216"] [--output-dir PATH]
|
|
102
|
+
prepare-trivy-db
|
|
103
|
+
gha-artifacts-cleanup run --run-id <id> [--keep-pattern glob] [--delete-pattern glob] [--patterns-file json]
|
|
104
|
+
gha-artifacts-cleanup sweep --older-than-hours <n> [--keep-pattern glob] [--delete-pattern glob] [--patterns-file json]
|
|
105
|
+
agent-issue-labels labels-from-paths [--labeler <path>] <path>...
|
|
106
|
+
agent-issue-labels ensure-labels [--repo owner/name] [--policy-file json] [--update] <label>...
|
|
107
|
+
http-origin [--field NAME] [value]
|
|
108
|
+
vitest-blob-manifest <suite> [reports-directory]
|
|
109
|
+
vitest-report-attempt <write DIRECTORY SUITE|read ROOT>
|
|
110
|
+
prepare-vitest-reports [primary-directory] [fallback-directory] [output-directory]
|
|
111
|
+
pnpm-install --runner-lifecycle persistent|ephemeral|ephemeral-full --install-scripts true|false
|
|
112
|
+
check-cache-size <path> <max-bytes> <label>
|
|
113
|
+
make-shard-matrix <total>
|
|
114
|
+
load-runner-env
|
|
115
|
+
clean-workspace
|
|
116
|
+
install-github-release --repo owner/name --version X --asset 'name-{platform}.tar.gz' --bin name [--tag-prefix PREFIX] [--expected-sha256 SHA256] [--no-checksum] [--checksums-asset NAME] [--version-flag FLAG] [--bin-dir DIR]
|
|
117
|
+
run-with-timeout <timeout-seconds> <kill-after-seconds> <command...>
|
|
118
|
+
lint-links [--offline] [--config PATH] [--glob PATTERN] [files...]
|
|
119
|
+
materialize-pr-context
|
|
120
|
+
wait-for-apt-locks
|
|
121
|
+
install-playwright-chromium-arm64 [name:archive...]
|
|
122
|
+
ghcr-package-retention [--main-history] [--apply|--dry-run] [<url-encoded-package>...]
|
|
123
|
+
harness-admission-lane <lanes>
|
|
124
|
+
harness-assert-gates <gate>...
|
|
125
|
+
gha-collaborator-trust <owner/repo> [--allow-bot <login>]... < authors.json
|
|
126
|
+
nuget-central-version <trusted-props> <candidate-props> <metadata-json> <output-props>
|
|
127
|
+
verify-workflow-secrets [--repo OWNER/NAME] [--confirm NAME,...] [--inventory MODULE] [--export NAME] [--branch NAME]
|
|
128
|
+
dead-code --baseline PATH [--seed|--update] [--config PATH] [--binary PATH] [--repo-root PATH] [--entry GLOB]... [--snapshot-ignore GLOB]... [--exclude GLOB]...
|
|
129
|
+
swift-semantic-equal <base> <head> <file.swift>
|
|
130
|
+
post-review
|
|
131
|
+
stage-review-payload optional|required <source> <destination>
|
|
132
|
+
retrospective-transcript [--session-id ID] [--jsonl PATH] [--projects-dir PATH] [--codex-sessions-dir PATH] [--grok-sessions-dir PATH]
|
|
133
|
+
link-skill <name> --source-root <skills-dir> --target-root <consumer-skills-dir> Link a packaged or repository-local skill
|
|
134
|
+
retrospective-facts (--pr NUMBER | --branch NAME | --no-pr) [--repo OWNER/NAME] [--raw]
|
|
135
|
+
agent-blackboard probe
|
|
136
|
+
agent-blackboard session-start [--skip-env NAME] [--setup-hint TEXT] [--docs-path PATH] [--restore-hint TEXT] [--timeout-ms N] (SessionStart hook; payload on stdin)
|
|
137
|
+
agent-blackboard distill classify <partition.jsonl> --retro-cutoff ISO8601 --session-cutoff ISO8601
|
|
138
|
+
agent-blackboard snapshot partition --snapshot PATH --checksum SHA256 --counts '{"sessions":N,"entries":N,"records":N,"bytes":N}'
|
|
139
|
+
agent-blackboard snapshot cleanup [--snapshot PATH] [--partition-directory PATH --receipt JSON]
|
|
140
|
+
mcp
|
|
141
|
+
(no args) Serve journal_append, journal_entries, outbox_status, outbox_flush,
|
|
142
|
+
session_ensure, retrospective_check, retrospective_save,
|
|
143
|
+
pr_validate, pr_create, pr_update,
|
|
144
|
+
snapshot_export, snapshot_cleanup, and session_archive over stdio.
|
|
145
|
+
Needs the optional @modelcontextprotocol/sdk peer (and zod).
|
|
146
|
+
Launch it from inside the repository's git worktree.
|
|
147
|
+
|
|
148
|
+
hook pre-tool-use|post-tool-use --harness claude|codex|cursor|grok --policy <module> [--root <dir>] [--automation-env NAME]...
|
|
149
|
+
Reads the harness hook payload on stdin. <module> default-exports a policy object (or a function
|
|
150
|
+
of the hook context returning one) with a command rule table, post-tool-use checkers, and an
|
|
151
|
+
optional reminder. pre-tool-use exits 2 to block, and also when the policy cannot load.
|
|
152
|
+
post-tool-use is advisory and always exits 0. --root defaults to the working directory.
|
|
153
|
+
Each --automation-env NAME (repeatable) marks the run unattended when that environment variable
|
|
154
|
+
is set, non-empty, and not 0 or false; CI markers and claude -p are always unattended.
|
|
155
|
+
|
|
156
|
+
worktree reclaim [--yes] [--json]
|
|
157
|
+
Dry run by default. Removes clean, fully pushed worktrees whose same-repository PR for the
|
|
158
|
+
branch is merged or closed at exactly HEAD, using git worktree remove (never forced).
|
|
159
|
+
Skips the main checkout, the current worktree, and locked, bare or detached worktrees.
|
|
160
|
+
|
|
161
|
+
transient-retry --rules <module> [--repo owner/name] [--token-env NAME] [--dry-run] <run-id>
|
|
162
|
+
Loads a module exporting "rules" (and optionally "limits"), evaluates them against the failed run,
|
|
163
|
+
and reruns only on a match. Exits 0 on rerun, 2 when none is warranted, 1 on error.
|
|
164
|
+
|
|
165
|
+
tmux up --config <file> [--root <dir>] [--no-attach] [-v|--verbose]
|
|
166
|
+
tmux name [--socket PATH --pane %ID --worktree PATH] <name> | read-title | post-tool | agent-reminder <event>
|
|
167
|
+
Environment: TMUX_TARGET_BIN, TMUX_TARGET_ROOT, TMUX_NAME_COMMAND, AGENT_TMUX_SOCKET/PANE/WORKTREE.
|
|
168
|
+
|
|
169
|
+
story-coverage --root <dir> --component-root <rel> --story-root <rel> --source-extension <ext> --component-extension <ext> --marker <regex> --story-pattern <regex> [--alias <prefix>=<path>] [--exclusions <json>] [--exclusions-label <text>]
|
|
170
|
+
`;
|
package/dist/cli/usage.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { USAGE } from './usage-text.mts';
|
|
2
|
+
export { USAGE };
|
|
2
3
|
export declare function printUsage(stream?: NodeJS.WritableStream): void;
|
|
3
4
|
export declare function commandNames(usage?: string): string[];
|
|
4
5
|
export declare function commandUsage(command: string, usage?: string): string;
|
package/dist/cli/usage.mjs
CHANGED
|
@@ -1,152 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Commands:
|
|
4
|
-
runner-port-policy Print or validate a runner port policy
|
|
5
|
-
with-host-lock Run a command under a host-wide lock
|
|
6
|
-
host-storage Check free space on caller-supplied paths
|
|
7
|
-
gha-runtime-audit Audit successful GitHub Actions job runtimes
|
|
8
|
-
require-up-to-date Require HEAD to include a fetched remote branch
|
|
9
|
-
fresh-base Classify the worktree against a remote base branch
|
|
10
|
-
gitleaks-directory-scan Scan a directory with Gitleaks
|
|
11
|
-
ast-grep-examples Run AST-grep rule examples
|
|
12
|
-
ast-grep-pack Print shipped unconditional AST-grep pack paths as JSON
|
|
13
|
-
gha-workspace-policy Check GitHub Actions workspace safety policy
|
|
14
|
-
gha-output Write a collision-safe multiline GITHUB_OUTPUT record
|
|
15
|
-
gha-needs-results Fail if required GitHub Actions job results failed
|
|
16
|
-
download-with-diagnostics Download a URL and report HTTP status on failure
|
|
17
|
-
download-optional-run-artifacts Download optional artifacts from the current run
|
|
18
|
-
host-pressure-diagnostics Print a bounded host memory/OOM/PSI snapshot
|
|
19
|
-
allocate-browser-safe-ports Allocate Fetch-safe localhost ports
|
|
20
|
-
diagnose-port-collision Capture bounded localhost port diagnostics
|
|
21
|
-
prepare-trivy-db Download the Trivy vulnerability database
|
|
22
|
-
gha-artifacts-cleanup Delete classified GitHub Actions artifacts
|
|
23
|
-
agent-issue-labels Map changed paths to labels; create missing repository labels
|
|
24
|
-
http-origin Validate an optional HTTP(S) origin
|
|
25
|
-
vitest-blob-manifest Stamp a vitest-blob-manifest:v1 identity file
|
|
26
|
-
vitest-report-attempt Write or read a Vitest report-attempt marker
|
|
27
|
-
prepare-vitest-reports Validate and select Vitest report JSON files
|
|
28
|
-
pnpm-install Install a pnpm workspace with retry and release-age fail-fast
|
|
29
|
-
check-cache-size Measure a path and decide whether to save a GHA cache
|
|
30
|
-
make-shard-matrix Emit a [1..N] GitHub Actions shard matrix
|
|
31
|
-
load-runner-env Overlay a runner env file onto GITHUB_ENV with injection guards
|
|
32
|
-
clean-workspace Reset a persistent-runner workspace with a fork-PR trust gate
|
|
33
|
-
install-github-release Download a checksum-verified GitHub Release binary
|
|
34
|
-
run-with-timeout Run a command with GNU timeout or a Perl fallback
|
|
35
|
-
lint-links Two-pass lychee: internal links fail, external warn
|
|
36
|
-
materialize-pr-context Dump PR title/body/files/diff/comments and #N crawl
|
|
37
|
-
wait-for-apt-locks Wait until apt/dpkg lock files are free
|
|
38
|
-
install-playwright-chromium-arm64 Install Playwright Chromium from browsers.json
|
|
39
|
-
ghcr-package-retention Delete old GHCR package versions (KEEP_MIN or --main-history)
|
|
40
|
-
harness-admission-lane Compute a GITHUB_RUN_ID admission lane for fleet fan-out
|
|
41
|
-
harness-assert-gates Fail if any named HARNESS_*_ENABLED gate is enabled
|
|
42
|
-
gha-collaborator-trust Classify authors as write-access collaborators or not
|
|
43
|
-
nuget-central-version Validate a Directory.Packages.props PackageVersion delta
|
|
44
|
-
verify-workflow-secrets Check a secret inventory against live repository and environment secrets
|
|
45
|
-
swift-semantic-equal Compare Swift sources ignoring comments and whitespace
|
|
46
|
-
post-review Post one COMMENT review from a staged payload file
|
|
47
|
-
stage-review-payload Validate a review payload file into a staging directory
|
|
48
|
-
retrospective-transcript Format facts from Claude-compatible, Codex, or Grok transcripts
|
|
49
|
-
link-skill Link one packaged skill into an explicit consumer directory
|
|
50
|
-
retrospective-facts Gather immutable facts for a retrospective
|
|
51
|
-
agent-blackboard Probe an Agent Blackboard deployment, classify distill sessions, manage snapshots
|
|
52
|
-
mcp Serve the agent-blackboard journal tools over stdio (MCP)
|
|
53
|
-
worktree Reclaim finished git worktrees (dry run unless --yes)
|
|
54
|
-
story-coverage Check component exports are imported by stories
|
|
55
|
-
|
|
56
|
-
Options:
|
|
57
|
-
-h, --help Show this help
|
|
58
|
-
-v, --version Print the package version
|
|
59
|
-
|
|
60
|
-
runner-port-policy
|
|
61
|
-
(no args) Print the shipped policy as JSON
|
|
62
|
-
--file <path> Validate and print a policy file
|
|
63
|
-
--reserved <port> Print true if the port is reserved
|
|
64
|
-
|
|
65
|
-
with-host-lock
|
|
66
|
-
--name <family>
|
|
67
|
-
[--slots <n>]
|
|
68
|
-
--timeout-seconds <n>
|
|
69
|
-
[--command-timeout-seconds <n>]
|
|
70
|
-
[--failure-diagnostics <absolute-script>]
|
|
71
|
-
[--on-acquire-timeout fail|run-unlocked]
|
|
72
|
-
-- <command> [args...]
|
|
73
|
-
|
|
74
|
-
host-storage --path <path> [--path <path>...] [--minimum-free-bytes <bytes>] [--pnpm-store] [--docker-root] [--docker-desktop-path <path>] [--discovery-timeout-ms <ms>]
|
|
75
|
-
|
|
76
|
-
gha-runtime-audit
|
|
77
|
-
[--repository owner/name] Default GITHUB_REPOSITORY
|
|
78
|
-
[--branch main]
|
|
79
|
-
[--median-threshold-floor <seconds>] Off unless set. Must be below the ceiling
|
|
80
|
-
[--median-threshold-ceiling <seconds>] Default 360. Flags a five-sample median above this
|
|
81
|
-
--pr-workflow <name|/regex/> Repeatable
|
|
82
|
-
--push-workflow <name|/regex/> Repeatable
|
|
83
|
-
|
|
84
|
-
require-up-to-date --remote <name> --branch <name>
|
|
85
|
-
fresh-base [--remote <name>] [--branch <name>] [--skip-fetch]
|
|
86
|
-
gitleaks-directory-scan --config <path> [--directory <path>]
|
|
87
|
-
ast-grep-examples --rules <directory> --config <path>
|
|
88
|
-
ast-grep-pack
|
|
89
|
-
gha-workspace-policy [--root <directory>] [--workflow-directory <directory>] [--action-directory <directory>]
|
|
90
|
-
|
|
91
|
-
gha-output <name>
|
|
92
|
-
gha-needs-results [label]
|
|
93
|
-
download-with-diagnostics <url> <destination> [-- curl-args...]
|
|
94
|
-
download-optional-run-artifacts (--name <name>... | --pattern <pattern>) --dir <directory>
|
|
95
|
-
host-pressure-diagnostics
|
|
96
|
-
allocate-browser-safe-ports <count> [--policy path] [--forbidden-ports path]
|
|
97
|
-
diagnose-port-collision [--ports "2200 2216"] [--output-dir PATH]
|
|
98
|
-
prepare-trivy-db
|
|
99
|
-
gha-artifacts-cleanup run --run-id <id> [--keep-pattern glob] [--delete-pattern glob] [--patterns-file json]
|
|
100
|
-
gha-artifacts-cleanup sweep --older-than-hours <n> [--keep-pattern glob] [--delete-pattern glob] [--patterns-file json]
|
|
101
|
-
agent-issue-labels labels-from-paths [--labeler <path>] <path>...
|
|
102
|
-
agent-issue-labels ensure-labels [--repo owner/name] [--policy-file json] [--update] <label>...
|
|
103
|
-
http-origin [--field NAME] [value]
|
|
104
|
-
vitest-blob-manifest <suite> [reports-directory]
|
|
105
|
-
vitest-report-attempt <write DIRECTORY SUITE|read ROOT>
|
|
106
|
-
prepare-vitest-reports [primary-directory] [fallback-directory] [output-directory]
|
|
107
|
-
pnpm-install --runner-lifecycle persistent|ephemeral|ephemeral-full --install-scripts true|false
|
|
108
|
-
check-cache-size <path> <max-bytes> <label>
|
|
109
|
-
make-shard-matrix <total>
|
|
110
|
-
load-runner-env
|
|
111
|
-
clean-workspace
|
|
112
|
-
install-github-release --repo owner/name --version X --asset 'name-{platform}.tar.gz' --bin name [--tag-prefix PREFIX] [--expected-sha256 SHA256] [--no-checksum] [--checksums-asset NAME] [--version-flag FLAG] [--bin-dir DIR]
|
|
113
|
-
run-with-timeout <timeout-seconds> <kill-after-seconds> <command...>
|
|
114
|
-
lint-links [--offline] [--config PATH] [--glob PATTERN] [files...]
|
|
115
|
-
materialize-pr-context
|
|
116
|
-
wait-for-apt-locks
|
|
117
|
-
install-playwright-chromium-arm64 [name:archive...]
|
|
118
|
-
ghcr-package-retention [--main-history] [--apply|--dry-run] [<url-encoded-package>...]
|
|
119
|
-
harness-admission-lane <lanes>
|
|
120
|
-
harness-assert-gates <gate>...
|
|
121
|
-
gha-collaborator-trust <owner/repo> [--allow-bot <login>]... < authors.json
|
|
122
|
-
nuget-central-version <trusted-props> <candidate-props> <metadata-json> <output-props>
|
|
123
|
-
verify-workflow-secrets [--repo OWNER/NAME] [--confirm NAME,...] [--inventory MODULE] [--export NAME] [--branch NAME]
|
|
124
|
-
swift-semantic-equal <base> <head> <file.swift>
|
|
125
|
-
post-review
|
|
126
|
-
stage-review-payload optional|required <source> <destination>
|
|
127
|
-
retrospective-transcript [--session-id ID] [--jsonl PATH] [--projects-dir PATH] [--codex-sessions-dir PATH] [--grok-sessions-dir PATH]
|
|
128
|
-
link-skill <name> --source-root <skills-dir> --target-root <consumer-skills-dir> Link a packaged or repository-local skill
|
|
129
|
-
retrospective-facts (--pr NUMBER | --branch NAME | --no-pr) [--repo OWNER/NAME] [--raw]
|
|
130
|
-
agent-blackboard probe
|
|
131
|
-
agent-blackboard session-start [--skip-env NAME] [--setup-hint TEXT] [--docs-path PATH] [--restore-hint TEXT] [--timeout-ms N] (SessionStart hook; payload on stdin)
|
|
132
|
-
agent-blackboard distill classify <partition.jsonl> --retro-cutoff ISO8601 --session-cutoff ISO8601
|
|
133
|
-
agent-blackboard snapshot partition --snapshot PATH --checksum SHA256 --counts '{"sessions":N,"entries":N,"records":N,"bytes":N}'
|
|
134
|
-
agent-blackboard snapshot cleanup [--snapshot PATH] [--partition-directory PATH --receipt JSON]
|
|
135
|
-
mcp
|
|
136
|
-
(no args) Serve journal_append, journal_entries, outbox_status, outbox_flush,
|
|
137
|
-
session_ensure, retrospective_check, retrospective_save,
|
|
138
|
-
pr_validate, pr_create, pr_update,
|
|
139
|
-
snapshot_export, snapshot_cleanup, and session_archive over stdio.
|
|
140
|
-
Needs the optional @modelcontextprotocol/sdk peer (and zod).
|
|
141
|
-
Launch it from inside the repository's git worktree.
|
|
142
|
-
|
|
143
|
-
worktree reclaim [--yes] [--json]
|
|
144
|
-
Dry run by default. Removes clean, fully pushed worktrees whose same-repository PR for the
|
|
145
|
-
branch is merged or closed at exactly HEAD, using git worktree remove (never forced).
|
|
146
|
-
Skips the main checkout, the current worktree, and locked, bare or detached worktrees.
|
|
147
|
-
|
|
148
|
-
story-coverage --root <dir> --component-root <rel> --story-root <rel> --source-extension <ext> --component-extension <ext> --marker <regex> --story-pattern <regex> [--alias <prefix>=<path>] [--exclusions <json>] [--exclusions-label <text>]
|
|
149
|
-
`;
|
|
1
|
+
import { USAGE } from "./usage-text.mjs";
|
|
2
|
+
export { USAGE };
|
|
150
3
|
export function printUsage(stream = process.stdout) {
|
|
151
4
|
stream.write(USAGE);
|
|
152
5
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BlockDecision, CommandPolicy, EvaluateOptions, HookPayload } from './types.mts';
|
|
2
|
+
/**
|
|
3
|
+
* Decides whether a tool call may run under a caller-supplied rule table. Every check that can
|
|
4
|
+
* block runs first; the interactive lone-merge confirm is the final return, so a block anywhere in
|
|
5
|
+
* the command always beats the merge allow. Returns null when the policy has no opinion.
|
|
6
|
+
*/
|
|
7
|
+
export declare function evaluateCommandPolicy(payload: HookPayload, policy: CommandPolicy, options?: EvaluateOptions): BlockDecision | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { commandsToInspectForGitPolicy, isInteractiveRebaseContinue, } from "../shell-parse/index.mjs";
|
|
2
|
+
import { findBlockedPatternReason } from "./git-patterns.mjs";
|
|
3
|
+
import { findGitHubWorkflowBlock } from "./github-workflow.mjs";
|
|
4
|
+
import { findInteractiveMergeConfirm } from "./github-merge-authority.mjs";
|
|
5
|
+
import { extractToolCommand, hookCwd } from "./payload.mjs";
|
|
6
|
+
import { findPathTypo, referencesProtectedPath } from "./path-rules.mjs";
|
|
7
|
+
/**
|
|
8
|
+
* Decides whether a tool call may run under a caller-supplied rule table. Every check that can
|
|
9
|
+
* block runs first; the interactive lone-merge confirm is the final return, so a block anywhere in
|
|
10
|
+
* the command always beats the merge allow. Returns null when the policy has no opinion.
|
|
11
|
+
*/
|
|
12
|
+
export function evaluateCommandPolicy(payload, policy, options = {}) {
|
|
13
|
+
const command = extractToolCommand(payload);
|
|
14
|
+
const automationContext = options.automationContext ?? true;
|
|
15
|
+
const typo = findPathTypo(payload, command, policy.typoPaths ?? []);
|
|
16
|
+
if (typo !== undefined) {
|
|
17
|
+
return { reason: typo.reason };
|
|
18
|
+
}
|
|
19
|
+
if (automationContext &&
|
|
20
|
+
policy.protectedPaths !== undefined &&
|
|
21
|
+
referencesProtectedPath(payload, command, policy.protectedPaths)) {
|
|
22
|
+
return { reason: policy.protectedPaths.reason };
|
|
23
|
+
}
|
|
24
|
+
// An apply_patch payload is path-checked above and carries no shell to inspect.
|
|
25
|
+
if (command === '' || command.startsWith('*** Begin Patch')) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const workflowBlock = findGitHubWorkflowBlock(command, options.cwd ?? hookCwd(payload), {
|
|
29
|
+
automationContext,
|
|
30
|
+
mergeGuidance: policy.mergeGuidance,
|
|
31
|
+
stack: policy.stack,
|
|
32
|
+
});
|
|
33
|
+
if (workflowBlock !== null) {
|
|
34
|
+
return workflowBlock;
|
|
35
|
+
}
|
|
36
|
+
return (findScriptBlock(command, policy) ??
|
|
37
|
+
findInteractiveMergeConfirm(command, automationContext, policy.mergeGuidance ?? ''));
|
|
38
|
+
}
|
|
39
|
+
function findScriptBlock(command, policy) {
|
|
40
|
+
const scripts = commandsToInspectForGitPolicy(command);
|
|
41
|
+
for (const script of scripts) {
|
|
42
|
+
const reason = findBlockedPatternReason(script, policy.commandPatterns ?? []);
|
|
43
|
+
if (reason !== null)
|
|
44
|
+
return { reason };
|
|
45
|
+
}
|
|
46
|
+
if (!/\bgit\b/.test(command)) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
for (const script of scripts) {
|
|
50
|
+
if (policy.rebaseContinueReason !== undefined && isInteractiveRebaseContinue(script)) {
|
|
51
|
+
return { reason: policy.rebaseContinueReason };
|
|
52
|
+
}
|
|
53
|
+
const reason = findBlockedPatternReason(script, policy.gitPatterns ?? []);
|
|
54
|
+
if (reason !== null)
|
|
55
|
+
return { reason };
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PatternRule } from './types.mts';
|
|
2
|
+
/**
|
|
3
|
+
* Why a git command breaks the given rules, or null. Each rule reads one simple command: the span
|
|
4
|
+
* after `git` stops at `|`, `;`, `&`, and newline, so a flag on a piped or chained command
|
|
5
|
+
* (`git commit -F msg | tail -n 20`) is not a git flag. A command substitution's own separators
|
|
6
|
+
* are blanked first, so `git push origin $(git branch --show-current | head -1) --force` is one
|
|
7
|
+
* command.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findBlockedPatternReason(command: string, rules: readonly PatternRule[]): string | null;
|
|
10
|
+
export declare const PLAIN_FORCE_PUSH_REASON = "Force pushes are banned by repository policy.";
|
|
11
|
+
/**
|
|
12
|
+
* The generic git-hygiene bans, as an opt-in preset for `CommandPolicy.gitPatterns`: plain force
|
|
13
|
+
* pushes, amends, ours/theirs strategies, and every way to skip git hooks. Each reason is
|
|
14
|
+
* overridable; `pullRebaseReason` is the only one a repository usually rewrites, to name its own
|
|
15
|
+
* rebase script.
|
|
16
|
+
*/
|
|
17
|
+
export declare function standardGitPatterns(reasons?: {
|
|
18
|
+
forcePush?: string;
|
|
19
|
+
pullRebase?: string;
|
|
20
|
+
}): PatternRule[];
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { readBacktickSubstitution, readParenthesizedSubstitution } from "../shell-parse/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Why a git command breaks the given rules, or null. Each rule reads one simple command: the span
|
|
4
|
+
* after `git` stops at `|`, `;`, `&`, and newline, so a flag on a piped or chained command
|
|
5
|
+
* (`git commit -F msg | tail -n 20`) is not a git flag. A command substitution's own separators
|
|
6
|
+
* are blanked first, so `git push origin $(git branch --show-current | head -1) --force` is one
|
|
7
|
+
* command.
|
|
8
|
+
*/
|
|
9
|
+
export function findBlockedPatternReason(command, rules) {
|
|
10
|
+
const text = blankSubstitutionSeparators(command);
|
|
11
|
+
return rules.find(({ pattern }) => matches(pattern, text))?.reason ?? null;
|
|
12
|
+
}
|
|
13
|
+
// A global or sticky pattern keeps `lastIndex` between tests, so reset it to keep decisions pure.
|
|
14
|
+
function matches(pattern, text) {
|
|
15
|
+
pattern.lastIndex = 0;
|
|
16
|
+
return pattern.test(text);
|
|
17
|
+
}
|
|
18
|
+
function blankSubstitutionSeparators(command) {
|
|
19
|
+
let result = '';
|
|
20
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
21
|
+
const endIndex = substitutionEndIndex(command, index);
|
|
22
|
+
if (endIndex === null) {
|
|
23
|
+
result += command[index];
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
result += command.slice(index, endIndex + 1).replace(/[|;&\n]/g, ' ');
|
|
27
|
+
index = endIndex;
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function substitutionEndIndex(command, index) {
|
|
32
|
+
if (command.startsWith('$(', index)) {
|
|
33
|
+
return readParenthesizedSubstitution(command, index + 2)?.endIndex ?? null;
|
|
34
|
+
}
|
|
35
|
+
if (command[index] === '`') {
|
|
36
|
+
return readBacktickSubstitution(command, index + 1)?.endIndex ?? null;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
export const PLAIN_FORCE_PUSH_REASON = 'Force pushes are banned by repository policy.';
|
|
41
|
+
/**
|
|
42
|
+
* The generic git-hygiene bans, as an opt-in preset for `CommandPolicy.gitPatterns`: plain force
|
|
43
|
+
* pushes, amends, ours/theirs strategies, and every way to skip git hooks. Each reason is
|
|
44
|
+
* overridable; `pullRebaseReason` is the only one a repository usually rewrites, to name its own
|
|
45
|
+
* rebase script.
|
|
46
|
+
*/
|
|
47
|
+
export function standardGitPatterns(reasons = {}) {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
pattern: /\bgit\s+push\b[^|;&\n]*\s(?:--force(?!-with-lease(?:\b|=))\b|--mirror\b|-[A-Za-z]*f[A-Za-z]*\b|\+[^;&|()\s]+)/,
|
|
51
|
+
reason: reasons.forcePush ?? PLAIN_FORCE_PUSH_REASON,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pattern: /\bgit\s+commit\b[^|;&\n]*--amend\b/,
|
|
55
|
+
reason: 'Commit amend is banned by repository policy.',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
pattern: /\bgit\s+pull\b[^|;&\n]*(?:--rebase\b|\s-[A-Za-z]*r[A-Za-z]*\b)/,
|
|
59
|
+
reason: reasons.pullRebase ?? 'git pull --rebase and git pull -r are banned.',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
pattern: /\bgit\b[^|;&\n]*(?:\s-X(?:=|\s)?(?:ours|theirs)\b|\s-X(?:ours|theirs)\b|\s(?:-s\s*|--strategy(?:=|\s+))ours\b|--strategy-option(?:=|\s+)(?:ours|theirs)\b)/,
|
|
63
|
+
reason: 'Git strategy options for ours/theirs are banned; during rebase they can silently keep the wrong side.',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
pattern: /\bgit\s+(?:checkout|restore)\b[^|;&\n]*(?:--ours|--theirs)\b/,
|
|
67
|
+
reason: 'git checkout/restore --ours/--theirs is banned; resolve rebase conflicts manually.',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
pattern: /\bgit\b[^|;&\n]*--no-verify\b/,
|
|
71
|
+
reason: '--no-verify bypasses repository git hooks. Fix the underlying failure instead of skipping hooks.',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
pattern: /\bgit\s+commit\b[^|;&\n]*\s-[A-Za-z]*n[A-Za-z]*\b/,
|
|
75
|
+
reason: 'git commit -n bypasses the commit-msg and pre-commit hooks. Fix the underlying failure instead.',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
pattern: /\bgit\b[^|;&\n]*-c\s+core\.hooksPath\s*=/i,
|
|
79
|
+
reason: 'Overriding core.hooksPath disables git hooks. Fix the underlying failure instead.',
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
const WORKTREE_OVERRIDE_ENV = new Set(['GIT_DIR', 'GIT_WORK_TREE', 'GIT_INDEX_FILE', 'GIT_PREFIX']);
|
|
3
|
+
function probeEnv() {
|
|
4
|
+
return Object.fromEntries(Object.entries(process.env).filter(([key]) => !WORKTREE_OVERRIDE_ENV.has(key)));
|
|
5
|
+
}
|
|
6
|
+
function run(cwd, args) {
|
|
7
|
+
try {
|
|
8
|
+
const stdout = execFileSync('git', args, {
|
|
9
|
+
cwd,
|
|
10
|
+
encoding: 'utf8',
|
|
11
|
+
env: probeEnv(),
|
|
12
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
13
|
+
timeout: 5_000,
|
|
14
|
+
});
|
|
15
|
+
return { ok: true, stdout };
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
return { ok: false, status: err.status };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function trimmed(cwd, args) {
|
|
22
|
+
const result = run(cwd, args);
|
|
23
|
+
const text = result.ok ? result.stdout.trim() : '';
|
|
24
|
+
return text === '' ? undefined : text;
|
|
25
|
+
}
|
|
26
|
+
const gitCurrentBranch = (cwd) => trimmed(cwd, ['branch', '--show-current']);
|
|
27
|
+
const gitConfigValue = (cwd, key) => trimmed(cwd, ['config', '--get', key]);
|
|
28
|
+
// Full object id a fully qualified ref names, or undefined when the ref is missing or git fails.
|
|
29
|
+
const gitResolveRef = (cwd, ref) => trimmed(cwd, ['rev-parse', '--verify', '--quiet', `${ref}^{commit}`]);
|
|
30
|
+
// `merge-base --is-ancestor` is exit-code-only: 0 = ancestor, 1 = provably not, anything else
|
|
31
|
+
// (128 for an unknown ref, a timeout, a missing binary) is indeterminate and fails open.
|
|
32
|
+
function gitIsAncestor(cwd, ancestor, descendant) {
|
|
33
|
+
const result = run(cwd, ['merge-base', '--is-ancestor', ancestor, descendant]);
|
|
34
|
+
if (result.ok)
|
|
35
|
+
return true;
|
|
36
|
+
return result.status === 1 ? false : undefined;
|
|
37
|
+
}
|
|
38
|
+
export function gitRemoteVerbose(cwd) {
|
|
39
|
+
const result = run(cwd, ['remote', '-v']);
|
|
40
|
+
return result.ok ? result.stdout : undefined;
|
|
41
|
+
}
|
|
42
|
+
// `config --get-regexp` exits 1 when nothing matches, which is an empty answer, not a failure.
|
|
43
|
+
export function gitConfiguredRemoteDefaults(cwd) {
|
|
44
|
+
const result = run(cwd, ['config', '--get-regexp', '^remote\\..+\\.gh-resolved$']);
|
|
45
|
+
if (result.ok)
|
|
46
|
+
return result.stdout;
|
|
47
|
+
return result.status === 1 ? '' : undefined;
|
|
48
|
+
}
|
|
49
|
+
export const defaultGitProbe = {
|
|
50
|
+
currentBranch: gitCurrentBranch,
|
|
51
|
+
configValue: gitConfigValue,
|
|
52
|
+
isAncestor: gitIsAncestor,
|
|
53
|
+
resolveRef: gitResolveRef,
|
|
54
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every lowercased owner of a checkout's GitHub repositories, read the way gh reads them: the fetch
|
|
3
|
+
* URLs of `git remote -v` plus any `gh repo set-default` (`remote.<name>.gh-resolved`). Hostless
|
|
4
|
+
* (local-path) remotes are ignored, like gh does; undefined when the checkout can't be read, prints
|
|
5
|
+
* a remote line the hook doesn't recognize, or has a hosted remote or set-default that isn't
|
|
6
|
+
* OWNER/REPO.
|
|
7
|
+
*/
|
|
8
|
+
export declare function checkoutOwners(cwd: string): ReadonlySet<string> | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* A checkout's owner when {@link checkoutOwners} finds exactly one, so whichever remote gh picks is
|
|
11
|
+
* that owner's; undefined when there are none or several.
|
|
12
|
+
*/
|
|
13
|
+
export declare function checkoutOwner(cwd: string): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The owners a session's own checkout belongs to: its {@link checkoutOwners} plus the owner of its
|
|
16
|
+
* root `package.json` `repository`, so a fork-only checkout still counts the upstream it declares.
|
|
17
|
+
* Undefined — keep every content rule — when either is unreadable, the declared repository isn't
|
|
18
|
+
* a hosted OWNER/REPO, or no owner is known at all.
|
|
19
|
+
*/
|
|
20
|
+
export declare function sessionHomeOwners(worktreeRoot: string): ReadonlySet<string> | undefined;
|
|
21
|
+
export declare function ownerOfRepoSelector(value: string): string | undefined;
|
|
22
|
+
export declare function githubOwner(value: string): string | undefined;
|