chore(repo): package cleanup audit and context tooling - #773
chore(repo): package cleanup audit and context tooling#773njrini99-code wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
WalkthroughThis PR adds Repomix context-pack tooling (config, ignore rules, generation script, and a GitHub Actions workflow), dependency-cruiser architecture rules, Knip configuration tuning, git audit/cleanup bash scripts, several dated audit/planning markdown documents, review prompt templates, and small generated-file/documentation updates. ChangesRepomix context pack tooling and CI
Git audit and cleanup scripts
Cleanup and audit planning documentation
Generated files and docs updates
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Workflow as repomix-context.yml
participant Script as repomix.sh
participant Repomix as repomix
participant Artifact as .repomix/
Workflow->>Script: run ctx:docs, ctx:db, ctx:admin
Workflow->>Script: run changed-files XML on pull_request
Workflow->>Script: run compressed repo pack on workflow_dispatch
Script->>Repomix: npx repomix@1.16.0 "$@"
Repomix->>Artifact: write context files
Workflow->>Artifact: upload repomix-context
Suggested labels: 🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (11 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
PR Summary by QodoPackage repo cleanup audit docs + Repomix/Knip/git hygiene tooling
AI Description
Diagram
High-Level Assessment
Files changed (23)
|
|
@greptileai please review this PR with the updated .greptile/files.json cleanup-audit context. Focus especially on the Repomix workflow/config, Knip baseline changes, generated-file drift docs, Supabase linked-lint plan, and whether the packaged issue/report context is accurate enough for follow-up fixes. |
Code Review by Qodo
Context used✅ Compliance rules (platform):
97 rules 1.
|
| /// <reference types="next" /> | ||
| /// <reference types="next/image-types/global" /> | ||
| import "./.next/dev/types/routes.d.ts"; | ||
| import "./.next/types/routes.d.ts"; |
There was a problem hiding this comment.
3. Broken ci typecheck import 🐞 Bug ≡ Correctness
next-env.d.ts imports ./.next/types/routes.d.ts, but .next/ is gitignored and the CI TypeScript job runs tsc --noEmit without generating .next first, so clean CI runs will fail with a missing-module error.
Agent Prompt
## Issue description
`next-env.d.ts` imports a generated file under `.next/`, but `.next/` is ignored and not present on clean checkouts. CI runs `npm run typecheck` (`tsc --noEmit`) before any `next build/dev` step in the TypeScript job, so the import can break CI.
## Issue Context
- `.next/` is ignored by git.
- `tsconfig.json` already includes `.next/types/**/*.ts` and `.next/dev/types/**/*.ts` when they exist, so the explicit import is unnecessary for type inclusion and creates a hard dependency on a generated file.
## Fix Focus Areas
- next-env.d.ts[1-6]
- tsconfig.json[58-66]
- package.json[16-24]
- .github/workflows/ci.yml[89-110]
## Recommended fix
- Remove the `import "./.next/types/routes.d.ts";` line from `next-env.d.ts`.
- Rely on `tsconfig.json` `include` globs (`.next/types/**/*.ts`, `.next/dev/types/**/*.ts`) to pick up those files when they exist (e.g., after `next dev` / `next build`).
## Verification
- On a clean checkout with no `.next/` directory: `npm ci && npm run typecheck` should pass.
- After a `next build` (which generates `.next/types`): `npm run typecheck` should still pass and include generated types via `tsconfig.json`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
@greptileai please rerun on the latest commit. I added the cleanup-audit context, fixed Repomix artifact upload, pinned Repomix, hardened checkout credentials, and removed the generated .next import from next-env.d.ts. |
Greptile SummaryThis PR packages repo cleanup audit work and adds context-pack tooling. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "chore(review): address cleanup audit fee..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 8
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/repomix-context.yml:
- Around line 26-29: The Checkout step in the repomix-context workflow keeps git
credentials on disk by default, which is unnecessary for this read-only job.
Update the actions/checkout configuration in the Checkout step to explicitly
disable credential persistence with persist-credentials set to false, since this
job only runs npm ci and repomix and never pushes changes back.
- Around line 51-57: The workflow step currently interpolates github.base_ref
directly inside run:, which creates shell-injection risk and triggers the
security findings. Move the base branch value into env: on the same job step,
then reference that shell variable in both the git fetch and git diff commands
in the repomix context generation step. Keep the existing behavior in the
workflow that runs scripts/context/repomix.sh, but ensure no ${{ }} expression
is expanded inside the shell script itself.
- Around line 3-16: The repomix-context workflow currently allows multiple
overlapping runs for the same pull request, which can pile up on repeated
pushes. Update the workflow in the `on.pull_request` path to add a concurrency
group keyed to the PR ref so newer runs cancel superseded ones, and make sure
`workflow_dispatch` still works cleanly with the same workflow definition.
In `@package.json`:
- Around line 69-86: The new ctx:* scripts in package.json rely on
scripts/context/repomix.sh, but the current engines.node floor still advertises
an older Node range. Update the engines.node entry to match the actual Node 22+
requirement, or explicitly document that Node version enforcement is handled
elsewhere so the lower floor is intentional; use the ctx:repo and fresh:context
script entries as the anchor for locating the affected block.
- Around line 75-85: The new ctx:* scripts added to package.json are not
documented in the workflow guide, so update
docs/operations/REPOMIX_CONTEXT_PACKS.md to enumerate the new script names and
what each pack covers. Use the package.json entries for ctx:db, ctx:baseball,
ctx:golf, ctx:admin, ctx:ui, ctx:tests, ctx:changed, ctx:staged, ctx:docs,
ctx:budget:compressed, and ctx:budget:changed as the source of truth, and keep
the documentation aligned with the existing ctx:repo-style descriptions.
- Line 73: The script named ctx:repo:npx is misleading because it still calls
scripts/context/repomix.sh instead of invoking Repomix through npx. Update the
package.json script so the ctx:repo:npx entry actually uses npx -y
repomix@latest (consistent with the project convention), or rename the script to
match its current wrapper-based behavior; keep the related ctx:repo script
naming and behavior aligned so the intent is clear.
In `@repomix.config.json`:
- Line 2: The Repomix config is using the floating latest schema alias, which
can change behavior without any repo diff. Update the $schema entry in
repomix.config.json to a pinned schema version that matches the repomix@latest
CLI version used by scripts/context/repomix.sh, or remove the schema pointer if
you are switching to a specific tagged version.
In `@scripts/git/stash-audit.sh`:
- Around line 4-6: The stash audit script is not idempotent because stale stash
stat files can remain when the stash count shrinks. Update
`scripts/git/stash-audit.sh` so it cleans up any previously generated
`stash-*-stat.txt` files in `out_dir` before regenerating the current set, or
otherwise removes files beyond the current stash count; keep the logic aligned
with the existing output generation so `README.md` and the files in `out_dir`
always match.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2049f366-1dd4-41f0-94eb-86b5602c94fd
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json,!**/package-lock.json
📒 Files selected for processing (24)
.dependency-cruiser.cjs.github/workflows/repomix-context.yml.gitignore.repomixignoreCLAUDE.mddocs/audits/AGENT_HANDOFF_CLEANUP_KNIP_SUPABASE_2026-07-03.mddocs/audits/CLEANUP_PR_SEQUENCE_2026-07-03.mddocs/audits/KNIP_TRIAGE_2026-07-03.mddocs/audits/REPO_FRESHNESS_BASELINE_2026-07-03.mddocs/audits/SUPABASE_LINKED_LINT_FIX_PLAN_2026-07-03.mddocs/operations/REPOMIX_CONTEXT_PACKS.mddocs/prompts/repomix/changed-files-review.mddocs/prompts/repomix/db-audit.mddocs/prompts/repomix/repo-cleanup.mdknip.jsonnext-env.d.tspackage.jsonpublic/sw.jsrepomix.config.jsonscripts/README.mdscripts/context/repomix.shscripts/git/audit.shscripts/git/clean-dry.shscripts/git/stash-audit.sh
| "ctx:repo": "mkdir -p .repomix && bash scripts/context/repomix.sh --output .repomix/helmv3-full.xml --style xml --include-logs --include-logs-count 30 --top-files-len 30", | ||
| "ctx:repo:compressed": "mkdir -p .repomix && bash scripts/context/repomix.sh --compress --output .repomix/helmv3-compressed.xml --style xml --include-logs --include-logs-count 30 --top-files-len 30", | ||
| "ctx:repo:diff": "mkdir -p .repomix && bash scripts/context/repomix.sh --include-diffs --include-logs --include-logs-count 20 --output .repomix/helmv3-diff-context.xml --style xml --top-files-len 30", | ||
| "ctx:repo:md": "mkdir -p .repomix && bash scripts/context/repomix.sh --output .repomix/helmv3-full.md --style markdown --include-logs --include-logs-count 30 --top-files-len 30", | ||
| "ctx:repo:npx": "mkdir -p .repomix && bash scripts/context/repomix.sh --output .repomix/helmv3-full.xml --style xml --include-logs --include-logs-count 30", | ||
| "ctx:token-tree": "bash scripts/context/repomix.sh --token-count-tree 1000 --no-files --top-files-len 50", | ||
| "ctx:db": "mkdir -p .repomix && bash scripts/context/repomix.sh --include \"supabase/migrations/**/*.sql,src/lib/types/database.ts,scripts/db/**/*.sql,scripts/check-migration-ledger.mjs,scripts/check-types-drift.sh,memory/glossary.md,memory/context/golfhelm-database.md\" --output .repomix/helmv3-db-context.xml --style xml --include-logs --include-logs-count 20", | ||
| "ctx:baseball": "mkdir -p .repomix && bash scripts/context/repomix.sh --include \"src/app/baseball/**,src/components/baseball/**,src/lib/baseball/**,scripts/baseball/**,memory/context/baseballhelm-features.md,docs/audits/BASEBALLHELM_CANONICAL_SPEC.md\" --output .repomix/baseballhelm-context.xml --style xml --include-logs --include-logs-count 20 --top-files-len 40", | ||
| "ctx:golf": "mkdir -p .repomix && bash scripts/context/repomix.sh --include \"src/app/golf/**,src/app/dashboard/**,src/components/golf/**,src/lib/golf/**,memory/context/golfhelm-features.md,memory/projects/golfhelm.md\" --output .repomix/golfhelm-context.xml --style xml --include-logs --include-logs-count 20 --top-files-len 40", | ||
| "ctx:admin": "mkdir -p .repomix && bash scripts/context/repomix.sh --include \"src/app/admin/**,src/app/api/admin/**,src/lib/admin/**,src/components/admin/**,.github/workflows/**,docs/audits/**\" --output .repomix/admin-bridge-context.xml --style xml --include-logs --include-logs-count 20 --top-files-len 40", | ||
| "ctx:ui": "mkdir -p .repomix && bash scripts/context/repomix.sh --include \"src/app/**/page.tsx,src/components/**/*.tsx,src/app/globals.css,tailwind.config.ts,components.json\" --ignore \"**/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx\" --output .repomix/ui-context.xml --style xml --top-files-len 40", | ||
| "ctx:tests": "mkdir -p .repomix && bash scripts/context/repomix.sh --include \"tests/**,src/**/*.test.ts,src/**/*.test.tsx,src/**/*.spec.ts,src/**/*.spec.tsx,playwright*.config.*,vitest.config.*\" --output .repomix/test-context.xml --style xml --top-files-len 40", | ||
| "ctx:changed": "mkdir -p .repomix && git ls-files --modified --others --exclude-standard | bash scripts/context/repomix.sh --stdin --include-diffs --include-logs --include-logs-count 15 --output .repomix/changed-files-context.xml --style xml --top-files-len 40", | ||
| "ctx:staged": "mkdir -p .repomix && git diff --cached --name-only | bash scripts/context/repomix.sh --stdin --include-diffs --include-logs --include-logs-count 15 --output .repomix/staged-files-context.xml --style xml --top-files-len 40", | ||
| "ctx:docs": "mkdir -p .repomix && bash scripts/context/repomix.sh --include \"CLAUDE.md,memory/**,docs/**/*.md,README.md,.github/workflows/docs-regen.yml,scripts/regen-docs.mjs\" --output .repomix/docs-memory-context.xml --style xml --include-logs --include-logs-count 20", | ||
| "ctx:budget:compressed": "mkdir -p .repomix && bash scripts/context/repomix.sh --compress --token-budget 500000 --output .repomix/helmv3-compressed.xml --style xml", | ||
| "ctx:budget:changed": "mkdir -p .repomix && git ls-files --modified --others --exclude-standard | bash scripts/context/repomix.sh --stdin --include-diffs --token-budget 200000 --output .repomix/changed-files-context.xml --style xml", | ||
| "fresh:context": "npm run docs:check && npm run knowledge:check && npm run ctx:repo:compressed && npm run ctx:changed && npm run ctx:db" |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
engines.node (>=20.16.0) doesn't reflect the Node 22+ requirement for the new ctx:* scripts.
14 new ctx:* scripts (lines 69-86) all shell out to scripts/context/repomix.sh. Per project learnings, Repomix context-pack generation requires Node 22+ (e.g. via nvm use 22). The declared engines.node floor is >=20.16.0 (line 93), so npm install/npm run won't warn a contributor on Node 20.16–21.x before they hit an opaque failure inside the wrapper script.
Either bump engines.node to reflect the real floor, or make sure the floor is intentionally decoupled and the wrapper's own version guard (per PR description, "enforcing Node version prerequisites") is the sole enforcement point — in which case this is fine, but worth a one-line comment in package.json so it isn't "fixed" incorrectly later.
Also applies to: 93-93
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` around lines 69 - 86, The new ctx:* scripts in package.json
rely on scripts/context/repomix.sh, but the current engines.node floor still
advertises an older Node range. Update the engines.node entry to match the
actual Node 22+ requirement, or explicitly document that Node version
enforcement is handled elsewhere so the lower floor is intentional; use the
ctx:repo and fresh:context script entries as the anchor for locating the
affected block.
Source: Learnings
|
Review/fix status as of commit 130bd23 on PR #773. Collected context from:
Applied in this follow-up commit:
Validation run locally:
Notes/deferred:
@greptileai please rerun on the latest commit 130bd23. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/operations/REPOMIX_CONTEXT_PACKS.md`:
- Around line 19-23: The Repomix override example is using the wrapper’s current
default version, so it does not demonstrate an actual override. Update the
example under the Repomix version guidance to use a different non-default
candidate value (or a clearly placeholder version) so it matches the description
of testing via REPOMIX_VERSION and can be located in REPOMIX_VERSION and
scripts/context/repomix.sh references.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4b5a689b-6982-4eee-9b74-5ceee2b3f8a6
📒 Files selected for processing (5)
.github/workflows/repomix-context.yml.greptile/files.jsondocs/operations/REPOMIX_CONTEXT_PACKS.mdnext-env.d.tsscripts/context/repomix.sh
💤 Files with no reviewable changes (1)
- next-env.d.ts
| To test a Repomix upgrade before changing the pinned default, set `REPOMIX_VERSION`: | ||
|
|
||
| ```bash | ||
| REPOMIX_VERSION=1.16.0 bash scripts/context/repomix.sh --version | ||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Make the override example actually test an override.
REPOMIX_VERSION=1.16.0 is the wrapper’s current default, so this sample never exercises the env override described above. Use a different candidate version (or a placeholder) so the example matches the text.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/operations/REPOMIX_CONTEXT_PACKS.md` around lines 19 - 23, The Repomix
override example is using the wrapper’s current default version, so it does not
demonstrate an actual override. Update the example under the Repomix version
guidance to use a different non-default candidate value (or a clearly
placeholder version) so it matches the description of testing via
REPOMIX_VERSION and can be located in REPOMIX_VERSION and
scripts/context/repomix.sh references.
Source: Path instructions
| name: Generate context packs | ||
| runs-on: ubuntu-latest | ||
| # Do not run PR-controlled package scripts for forked pull requests. | ||
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository |
There was a problem hiding this comment.
Same-Repo PR Execution
This guard skips forked PRs, but same-repository PR branches still run the job with PR-controlled code. A branch can change package.json lifecycle hooks, scripts/context/repomix.sh, or the Repomix config; the workflow then runs npm ci, runs the ctx:* scripts, and uploads .repomix/. That can produce a poisoned or over-broad context artifact before the changed scripts/config are merged. Use base-branch tooling for PR events, require manual dispatch, or disable PR-controlled lifecycle/script execution before generating artifacts.
Context Used: .greptile/config.json (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/repomix-context.yml
Line: 30
Comment:
**Same-Repo PR Execution**
This guard skips forked PRs, but same-repository PR branches still run the job with PR-controlled code. A branch can change `package.json` lifecycle hooks, `scripts/context/repomix.sh`, or the Repomix config; the workflow then runs `npm ci`, runs the `ctx:*` scripts, and uploads `.repomix/`. That can produce a poisoned or over-broad context artifact before the changed scripts/config are merged. Use base-branch tooling for PR events, require manual dispatch, or disable PR-controlled lifecycle/script execution before generating artifacts.
**Context Used:** .greptile/config.json ([source](https://app.greptile.com/helm/-/custom-context?memory=04251bf8-c7c3-42b7-859d-0ed056d5ef5e))
How can I resolve this? If you propose a fix, please make it concise.| else | ||
| baseline_ref="HEAD" | ||
| fi |
There was a problem hiding this comment.
Reject Missing Baseline
When neither the local nor remote default branch exists, this falls back to HEAD and still prints merged/non-merged cleanup guidance. In a detached or shallow checkout, git branch --merged HEAD answers a different question than “merged into the default branch”, so the audit can list branches as cleanup candidates even though they were never merged into the intended baseline. This path should stop and ask for an explicit baseline instead of producing deletion guidance from HEAD.
| else | |
| baseline_ref="HEAD" | |
| fi | |
| else | |
| echo "Unable to resolve a default branch ref. Pass the baseline branch explicitly, for example: npm run git:audit -- main." >&2 | |
| exit 1 | |
| fi |
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/git/audit.sh
Line: 16-18
Comment:
**Reject Missing Baseline**
When neither the local nor remote default branch exists, this falls back to `HEAD` and still prints merged/non-merged cleanup guidance. In a detached or shallow checkout, `git branch --merged HEAD` answers a different question than “merged into the default branch”, so the audit can list branches as cleanup candidates even though they were never merged into the intended baseline. This path should stop and ask for an explicit baseline instead of producing deletion guidance from `HEAD`.
```suggestion
else
echo "Unable to resolve a default branch ref. Pass the baseline branch explicitly, for example: npm run git:audit -- main." >&2
exit 1
fi
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/git/audit.sh (1)
63-85: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value
status=$?correctly captures the fsck exit code — verified, no bug.Since
git fsck --fullis the condition of theif,set -edoesn't apply to it, and$?at the top of theelseblock is preserved from that condition per bash semantics. Confirmed correct.One minor robustness note:
mktemp/rm -f(lines 65, 84) has notrapfor cleanup on interrupt (e.g. Ctrl-C mid-fsck) — the temp file would leak onSIGINT. Low stakes for a local dev-only audit script, optional to harden withtrap 'rm -f "$tmp"' EXIT.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/git/audit.sh` around lines 63 - 85, The fsck summary flow in audit.sh leaves the mktemp file behind if the script is interrupted before rm -f runs. Update the temporary-file cleanup around the git fsck --full block by adding an EXIT trap (and restoring any prior trap if needed) so the file created for awk parsing is always removed, even on SIGINT or early exit; use the tmp variable and the existing fsck summary block as the place to wire this in.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/git/audit.sh`:
- Line 33: The merged-branch filter in the audit script is using `grep -v
"^$default_branch$"` with a regex pattern, so branch names containing
metacharacters can be matched incorrectly. Update the `git branch --merged`
pipeline in `audit.sh` to do a literal exact-name exclusion for `default_branch`
(for example by using a fixed-string exact match option) so `Merged Non-Baseline
Branches` only excludes the intended branch name.
---
Outside diff comments:
In `@scripts/git/audit.sh`:
- Around line 63-85: The fsck summary flow in audit.sh leaves the mktemp file
behind if the script is interrupted before rm -f runs. Update the temporary-file
cleanup around the git fsck --full block by adding an EXIT trap (and restoring
any prior trap if needed) so the file created for awk parsing is always removed,
even on SIGINT or early exit; use the tmp variable and the existing fsck summary
block as the place to wire this in.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ecf83708-8632-472b-8075-4e4916143954
📒 Files selected for processing (8)
.github/workflows/repomix-context.yml.gitignoredocs/audits/REPO_FRESHNESS_BASELINE_2026-07-03.mddocs/operations/REPOMIX_CONTEXT_PACKS.mdpackage.jsonrepomix.config.jsonscripts/git/audit.shscripts/git/stash-audit.sh
💤 Files with no reviewable changes (1)
- repomix.config.json
|
|
||
| echo | ||
| echo "## Merged Non-Baseline Branches" | ||
| git branch --merged "$baseline_ref" | sed 's/^[* ]*//' | grep -v "^$default_branch$" || true |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔵 Trivial | 💤 Low value
Unescaped regex in grep -v can under-filter branch names.
grep -v "^$default_branch$" treats $default_branch as a BRE pattern, not a literal string. Any branch name containing regex metacharacters (., +, *, [, etc. — common in names like release.1.2) will have those chars match unintended characters, causing the filter to incorrectly include/exclude branches from the "Merged Non-Baseline Branches" report.
🛠️ Proposed fix — literal fixed-string match
-git branch --merged "$baseline_ref" | sed 's/^[* ]*//' | grep -v "^$default_branch$" || true
+git branch --merged "$baseline_ref" | sed 's/^[* ]*//' | grep -vFx "$default_branch" || trueAs per path instructions: "Bash scripts: ... quote all expansions" — the variable is quoted as a string, but the regex-interpolation gap defeats the intent of an exact literal match here.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| git branch --merged "$baseline_ref" | sed 's/^[* ]*//' | grep -v "^$default_branch$" || true | |
| git branch --merged "$baseline_ref" | sed 's/^[* ]*//' | grep -vFx "$default_branch" || true |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/git/audit.sh` at line 33, The merged-branch filter in the audit
script is using `grep -v "^$default_branch$"` with a regex pattern, so branch
names containing metacharacters can be matched incorrectly. Update the `git
branch --merged` pipeline in `audit.sh` to do a literal exact-name exclusion for
`default_branch` (for example by using a fixed-string exact match option) so
`Merged Non-Baseline Branches` only excludes the intended branch name.
Source: Path instructions
npm run knip:deps (tuned in #773) reports 3 unlisted-dependency findings — all genuinely imported, just missing from package.json because they were only ever resolved transitively: - @radix-ui/react-compose-refs — imported directly by Fairway's tabs component (src/components/fairway/controls/tabs.tsx). - fflate — imported directly by the Baseball XLSX/PDF stat-import adapters (src/lib/baseball/adapters/{xlsx,pdf}-reader.ts). - postcss-load-config — referenced as a JSDoc type import in postcss.config.mjs (devDependency: build-time only, not runtime). Verified via grep before adding (all three have real, non-test production usages except the type-only postcss-load-config import). Versions pinned to what npm already resolves transitively today, so this is a manifest correction, not a version bump. Co-authored-by: Fable Integrator <fable@helm.local> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Closing as superseded by the split stabilization PRs that are now on main: generated-file policy (#778), dependency declarations (#779), dead-file cleanup (#780), git hygiene (#781), issue ledger (#782), plus the follow-up dependency/action PRs. This omnibus branch still carries unresolved review concerns around PR-controlled Repomix execution, generated-file drift bundling, and git-audit robustness, so merging it now would reduce reviewability rather than improve production readiness. |
Summary
Refs #772.
Packages the cleanup audit and context tooling so Greptile and the rest of the review stack can audit the repo hygiene work as a concrete PR diff.
This PR intentionally keeps the scope to docs, generated-file policy, review/context tooling, and static-analysis configuration. It does not mutate Supabase, close issues, delete source files, or run dependency audit fixes.
What changed
npm run git:auditnpm run git:clean:drynpm run git:stash:auditpackage.json.knip.jsonto model CRM migration scripts, native Capacitor packages, and intentional admin fixtures.scripts/README.mdsodb:types:checkis documented as a regenerating check, not harmless read-only verification.next-env.d.tsandpublic/sw.jsinto the PR for review.Current findings packaged here
next-env.d.tsandpublic/sw.js; docs explain the commit-vs-generate policy choice.public.can_manage_baseball_lift_groupreferencing missingpublic.baseball_strength_groupspublic.baseball_accept_staff_invitereferencing missingv_invitation.invitee_emailRepomix
npm run fresh:contextpassed locally and generated gitignored packs under.repomix/:.repomix/helmv3-compressed.xml.repomix/changed-files-context.xml.repomix/helmv3-db-context.xmlAll local Repomix security checks passed.
Validation
Passed locally:
Notes:
npm run test:runresult from local pass: 4,398 passed, 39 skipped.npm run knip,npm run knip:files, andnpm run knip:depsintentionally still exit 1 with the tuned baseline documented indocs/audits/KNIP_TRIAGE_2026-07-03.md.