Repository navigation
refactor(vigutils): migrate shared scripts into vig-utils package entrypoints - #218
Merged
Merged
Conversation
c-vigo
enabled auto-merge
March 4, 2026 12:27
c-vigo
disabled auto-merge
March 4, 2026 12:59
c-vigo
enabled auto-merge
March 5, 2026 15:39
4 tasks
c-vigo
force-pushed
the
feature/217-reorganize-scripts-vig-utils
branch
from
March 7, 2026 07:07
58057ac to
1814b28
Compare
Contributor
Author
|
Force-push notice: Rebased onto updated
The 7 issue-#217 commits are unchanged in content, rebased onto the new |
gerchowl
approved these changes
Mar 7, 2026
gerchowl
left a comment
Contributor
There was a problem hiding this comment.
Reviewed: package structure, migrated modules, caller updates, manifest sync, and test coverage. All clean.
Added 4 minor test improvements:
- CI=true env var path coverage (check_agent_identity)
- setup-labels entry point availability test
- Invalid TOML error propagation test (load_blocklist)
- Stronger assertion on contains_agent_fingerprint call args
- Add CI=true env var path test for check_agent_identity - Add setup-labels entry point availability test - Add invalid TOML error propagation test for load_blocklist - Strengthen assertion on contains_agent_fingerprint call args Refs: #217
This was referenced Mar 9, 2026
c-vigo
added a commit
that referenced
this pull request
Mar 9, 2026
## Description Fix the inverted `IN_CONTAINER` guard in workspace githooks that silently allowed host commits through. Issue #238 describes three defects (A, B, C) from #163. After analysing the current codebase, **defects A and B were already resolved** by the `vig-utils` migration (#218): - **A (wrong `project_root`):** The old `Path(__file__).resolve().parent.parent` was replaced by `find_repo_root()` which traverses up from `cwd` looking for `.github/`. - **B (missing `vig_utils` dependency):** The scripts now live inside `vig-utils` and are invoked as entry points — no external import needed. **Defect C** was the only remaining bug: all three workspace githooks used `= "false"` to check `IN_CONTAINER`, but outside the devcontainer the variable is typically **unset** (empty string), not the literal `"false"`. The guard never triggered, so host commits were not blocked. Changed to `!= "true"` to fail closed. ## Type of Change - [ ] `feat` -- New feature - [x] `fix` -- Bug fix - [ ] `docs` -- Documentation only - [ ] `chore` -- Maintenance task (deps, config, etc.) - [ ] `refactor` -- Code restructuring (no behavior change) - [ ] `test` -- Adding or updating tests - [ ] `ci` -- CI/CD pipeline changes - [ ] `build` -- Build system or dependency changes - [ ] `revert` -- Reverts a previous commit - [ ] `style` -- Code style (formatting, whitespace) ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made - `assets/workspace/.githooks/pre-commit` — changed `= "false"` to `!= "true"` - `assets/workspace/.githooks/prepare-commit-msg` — changed `= "false"` to `!= "true"` - `assets/workspace/.githooks/commit-msg` — changed `= "false"` to `!= "true"` - `tests/bats/githooks.bats` — new BATS test suite (12 tests: 3 hooks × 4 scenarios: unset, empty, "false", "true") - `CHANGELOG.md` — added entry under `### Fixed` ## Changelog Entry ### Fixed - **IN_CONTAINER guard never triggers on host** ([#238](#238)) - Workspace githooks used `= "false"` but `IN_CONTAINER` is unset (not `"false"`) outside the devcontainer - Changed to `!= "true"` in `pre-commit`, `prepare-commit-msg`, and `commit-msg` hooks to fail closed ## Testing - [ ] Tests pass locally (`just test`) - [x] Manual testing performed (describe below) ### Manual Testing Details BATS test suite `tests/bats/githooks.bats` — 12 tests, all pass: ``` ok 1 pre-commit blocks when IN_CONTAINER is unset ok 2 pre-commit blocks when IN_CONTAINER is empty ok 3 pre-commit blocks when IN_CONTAINER is false ok 4 pre-commit does not show guard message when IN_CONTAINER is true ok 5 prepare-commit-msg blocks when IN_CONTAINER is unset ok 6 prepare-commit-msg blocks when IN_CONTAINER is empty ok 7 prepare-commit-msg blocks when IN_CONTAINER is false ok 8 prepare-commit-msg does not show guard message when IN_CONTAINER is true ok 9 commit-msg blocks when IN_CONTAINER is unset ok 10 commit-msg blocks when IN_CONTAINER is empty ok 11 commit-msg blocks when IN_CONTAINER is false ok 12 commit-msg does not show guard message when IN_CONTAINER is true ``` ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly (edit `docs/templates/`, then run `just docs`) - [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and pasted the entry above) - [x] My changes generate no new warnings or errors - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published ## Additional Notes The implementation plan with full triage analysis is posted as a [comment on issue #238](#238 (comment)). Refs: #238
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reorganize the
scripts/directory by migrating all shared utilities intopackages/vig-utils/as proper Python modules with CLI entry points. After this change,scripts/contains only project-specific container build tooling, while all downstream-shared scripts are importable, testable, and callable by command name via vig-utils entry points.This resolves the root cause of pre-commit hooks failing in deployed workspaces (#161) — callers no longer reference loose script paths that don't exist downstream; they invoke vig-utils entry points installed via
uv pip install.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
Python scripts migrated into vig-utils modules with entry points:
scripts/check-agent-identity.py→vig_utils.check_agent_identity(entry point:check-agent-identity)assets/workspace/.devcontainer/scripts/gh_issues.py→vig_utils.gh_issues(entry point:gh-issues)assets/workspace/.devcontainer/scripts/check-pr-agent-fingerprints.py→vig_utils.check_pr_agent_fingerprints(entry point:check-pr-agent-fingerprints)assets/workspace/.devcontainer/scripts/prepare-commit-msg-strip-trailers.py→vig_utils.prepare_commit_msg_strip_trailers(entry point:prepare-commit-msg-strip-trailers)Shell scripts bundled as package data with wrapper entry points:
scripts/check-skill-names.sh→vig_utils/shell/check-skill-names.sh(entry point:check-skill-names)scripts/derive-branch-summary.sh→vig_utils/shell/derive-branch-summary.sh(entry point:derive-branch-summary)scripts/resolve-branch.sh→vig_utils/shell/resolve-branch.sh(entry point:resolve-branch)assets/workspace/.devcontainer/scripts/setup-labels.sh→vig_utils/shell/setup-labels.sh(entry point:setup-labels)Consolidation & cleanup:
vig_utils/utils.py— agent fingerprint helpers (is_agent_commit,is_agent_pr,load_agent_blocklist,agent_display_name) consolidated from duplicated logic incheck_agent_identity.pyandcheck_pr_agent_fingerprints.pyscripts/utils.pyshim removed (superseded byvig_utils.utils)assets/workspace/.devcontainer/scripts/removedtests/bats/skill-naming.bats) removed — coverage migrated totest_shell_entrypoints.pyCaller updates:
justfile.gh,justfile.worktree,assets/workspace/.devcontainer/justfile.gh,assets/workspace/.devcontainer/justfile.worktree— switched from script paths to entry point commands.pre-commit-config.yaml— hooks use entry point commandsscripts/manifest.toml— sync entries updated (no more script-path copies).github/CODEOWNERS,.github/label-taxonomy.toml— paths updatedTests added:
test_shell_entrypoints.py— 156 lines covering all 4 shell wrapper entry pointstest_check_agent_identity.py— 162 linestest_check_pr_agent_fingerprints.py— 102 linestest_prepare_commit_msg_strip_trailers.py— 107 linestest_utils.py— 498 lines (shared helpers)test_gh_issues.py— migrated fromtests/topackages/vig-utils/tests/Changelog Entry
Changed
vig-utilspackage entrypoints (#217, #161, #179)check-skill-names.sh,derive-branch-summary.sh,resolve-branch.sh,setup-labels.sh) bundled insidevig_utils.shelland exposed asvig-<name>CLI entrypointsgh_issues.py,check-agent-identity.py,check-pr-agent-fingerprints.py,prepare-commit-msg-strip-trailers.py) migrated intovig-utilsmodules with entrypointsvig_utils.utilsmodulevig-utilsentrypointsRemoved
scripts/check-agent-identity.py,scripts/check-skill-names.sh,scripts/derive-branch-summary.sh,scripts/resolve-branch.sh— now invig-utilsassets/workspace/.devcontainer/scripts/gh_issues.py,check-pr-agent-fingerprints.py,prepare-commit-msg-strip-trailers.py— now invig-utilsscripts/utils.pyshim — superseded byvig_utils.utilsTesting
just test)Manual Testing Details
Deployed to smoke test repository and verified:
just gh-issuesworks end-to-endjust precommithooks passChecklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Regarding #185 (make container scripts callable via PATH): This PR effectively resolves #185 through a different mechanism than originally proposed. Instead of adding a scripts directory to PATH, shared scripts are now callable by command name via vig-utils package entry points (
uv pip install -e packages/vig-utils). The remaining files inscripts/are all project-specific build tooling — there are no "deploy-only" scripts left to reorganize.Refs: #217, #161, #179, #185