feat: add refactoring baseline audit - #841
Conversation
📝 WalkthroughWalkthroughAdds ChangesPhase 0: Refactoring Baseline and Reference Inventory
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f66813c7f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| git ls-files 'script/*' 'templates/*' | while IFS= read -r file; do | ||
| [ -f "$file" ] || continue | ||
| printf '%s\n' "$file" |
There was a problem hiding this comment.
Resolve audit paths from the repo root
When this script is invoked from any subdirectory (for example, cd script && ../script/audit-references.sh --format tsv), git ls-files still emits repo-relative paths such as script/foo.sh, but this check treats them as relative to the current subdirectory and skips every target; the command then exits successfully with only the TSV header. Please cd to git rev-parse --show-toplevel or prefix these paths with the repo root before filtering/scanning.
Useful? React with 👍 / 👎.
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 `@script/audit-references.sh`:
- Around line 23-26: The --format case handler in the script unconditionally
executes shift 2 without validating that a value was actually provided for the
FORMAT flag, causing a shell error instead of controlled failure. Add an
explicit check after the FORMAT assignment to verify that the value is not empty
(i.e., that a second argument exists), and if the check fails, print a usage
message and exit with status 2 before executing the shift statement.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 15f662a8-360e-47d4-9828-305eb5ba6232
📒 Files selected for processing (4)
.context/refactoring-baseline.mdscript/audit-references.shtest/integration/audit_references.batstest/integration/core-scripts.bats
| --format) | ||
| FORMAT="${2:-}" | ||
| shift 2 | ||
| ;; |
There was a problem hiding this comment.
Handle missing --format value before shifting arguments.
shift 2 is unconditional, so script/audit-references.sh --format exits via shell error instead of your controlled validation path. Add an explicit arity check and fail with usage/status 2.
Proposed fix
case "$1" in
--format)
+ if [ "$#" -lt 2 ] || [ -z "${2:-}" ]; then
+ echo "Missing value for --format (expected: markdown|tsv)" >&2
+ usage >&2
+ exit 2
+ fi
FORMAT="${2:-}"
shift 2
;;📝 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.
| --format) | |
| FORMAT="${2:-}" | |
| shift 2 | |
| ;; | |
| --format) | |
| if [ "$#" -lt 2 ] || [ -z "${2:-}" ]; then | |
| echo "Missing value for --format (expected: markdown|tsv)" >&2 | |
| usage >&2 | |
| exit 2 | |
| fi | |
| FORMAT="${2:-}" | |
| shift 2 | |
| ;; |
🤖 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 `@script/audit-references.sh` around lines 23 - 26, The --format case handler
in the script unconditionally executes shift 2 without validating that a value
was actually provided for the FORMAT flag, causing a shell error instead of
controlled failure. Add an explicit check after the FORMAT assignment to verify
that the value is not empty (i.e., that a second argument exists), and if the
check fails, print a usage message and exit with status 2 before executing the
shift statement.
|
🎉 This PR is included in version 1.117.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Closes #812.
.context/refactoring-baseline.mdwith the phase-0 baseline metrics for CI status, tracked LOC/file count, and Jest coverage.script/audit-references.shto scan trackedscript/andtemplates/files and classify references ascode/ci,test, ordocs.Issue #812 checklist
.context/refactoring-baseline.mdscript/audit-references.sh, including test and docs reference categoriesTests
script/audit-references.sh --format tsvnpx bats test/integration/audit_references.bats test/integration/core-scripts.batsshellcheck -x script/audit-references.shnpm run format:checknpm run lintnpm testnpm run shellchecknpm run test:integrationbash script/update-agents-md.sh --checknpm run test:coverageSummary by CodeRabbit
Chores
script/andtemplates/directories with Markdown and TSV output formats.#812.Tests