chore: constitution v1.2.0 (Principle VI + TDD) + stage-buttons UI + pre-commit lint gate - #2
Conversation
Adds a sixth core principle codifying code-hygiene expectations enforced by /speckit-plan Constitution Check and PR review: - DRY: rule-of-three extraction, ban literal config/string duplication, reject premature abstraction. - SOLID: SRP/OCP/LSP/ISP/DIP mapped to Laravel idioms (slim controllers, policies/events for OCP, container-resolved dependencies, focused interfaces, contract-honoring subclasses). - KISS: simplest design wins; no speculative configurability or plugin layers; reduce indirection; prefer framework-native primitives. Bump 1.0.0 -> 1.1.0 (MINOR, additive). Sync Impact Report and amendment date updated.
…s box The "Iniciar proyecto" / "Abortar proyecto" / completion buttons now live inside the volunteer progress card on the project detail page instead of floating between the header and the gallery. CrowdfundingProgress accepts an optional children slot rendered after the percentage line; show.tsx passes ProjectStageActions (owner-gated) as the child. Standalone block removed.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughBumps constitution to v1.2.0 (Last Amended 2026-05-05), replaces Principle II with an explicit Red‑Green‑Refactor TDD mandate, adds Automated Lint Gate requiring a tracked ChangesConstitution Document Update
Frontend Composition + Git Hook
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 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)
Comment |
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)
resources/js/pages/proyectos/show.tsx (1)
101-103:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd rejection handler to the
loadCommentscall in the effect.
loadCommentsis an async function that can reject on fetch or JSON parsing errors, but the useEffect at lines 101-103 doesn't handle promise rejections. If the request fails, you'll get an unhandled promise rejection.Proposed fix
useEffect(() => { -loadComments() + void loadComments().catch(() => { + setCommentsList([]) + }) }, [])Also note the indentation issue on line 102.
🤖 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 `@resources/js/pages/proyectos/show.tsx` around lines 101 - 103, The useEffect currently calls the async loadComments() without handling rejections and has an indentation issue; update the effect (the useEffect block that invokes loadComments) to either call an async IIFE that awaits loadComments inside a try/catch or append a .catch handler to loadComments() and log or handle the error appropriately, and fix the indentation on the loadComments() line so it aligns with the effect body; reference the loadComments function and the useEffect wrapper to locate where to add the error handling.
🤖 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 `@resources/js/components/ui/proyectos/CrowdfundingProgress.tsx`:
- Around line 1-4: Reorder the imports to satisfy the ESLint import/order rule
by moving the type import for ProjectRole (from
'@/components/ui/proyectos/ProjectRoles') above the CoinIcon import;
specifically ensure the type-only import (ProjectRole) appears with other
local/module imports before the component import CoinIcon so the import order
groups types and modules correctly and the linter error is resolved.
---
Outside diff comments:
In `@resources/js/pages/proyectos/show.tsx`:
- Around line 101-103: The useEffect currently calls the async loadComments()
without handling rejections and has an indentation issue; update the effect (the
useEffect block that invokes loadComments) to either call an async IIFE that
awaits loadComments inside a try/catch or append a .catch handler to
loadComments() and log or handle the error appropriately, and fix the
indentation on the loadComments() line so it aligns with the effect body;
reference the loadComments function and the useEffect wrapper to locate where to
add the error handling.
🪄 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 Plus
Run ID: 733216f9-2aac-4376-8dcf-5fe4c1aa8193
📒 Files selected for processing (3)
.specify/memory/constitution.mdresources/js/components/ui/proyectos/CrowdfundingProgress.tsxresources/js/pages/proyectos/show.tsx
Constitution v1.2.0:
- Reframe Principle II from "Test-First" to explicit "Test-Driven
Development (NON-NEGOTIABLE)" — Red-Green-Refactor cycle, Vitest
coverage for frontend in addition to Pest, requirement that PRs show
the test arriving with or before production code.
- Add "Automated Lint Gate" subsection to Development Workflow.
- Bump 1.1.0 -> 1.2.0 (MINOR, additive expansion).
Pre-commit hook:
- New .githooks/pre-commit runs ESLint against staged JS/TS files
(filtered via git diff --cached), aborts commit on any error.
- Zero new dependencies — hook is plain bash, dispatches via bun x or
npx. Honors Constitution Principle III (no parallel framework).
- package.json gains a "prepare" script that sets
core.hooksPath=.githooks on install so contributors auto-activate the
hook after `bun install` / `npm install`.
- Existing clones can opt in once via:
git config --local core.hooksPath .githooks
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 @.githooks/pre-commit:
- Around line 21-24: The hook invokes ESLint via "bun x eslint" and "npx
--no-install eslint" passing "${staged[@]}" directly which allows filenames
beginning with "-" to be treated as options; update the two invocations in
.githooks/pre-commit (the lines calling bun x eslint and npx --no-install
eslint) to insert a standalone "--" before the file arguments so ESLint treats
staged entries as paths, not flags.
- Around line 12-24: The hook runs ESLint on working-tree files (the bun/npx
eslint invocations) which fails for partially staged files; change the ES Lint
invocation to lint the staged snapshot instead by extracting each staged path
from the staged array and passing staged contents to ESLint (e.g. use git show
:<path> piped to eslint --stdin --stdin-filename or write each git show :<path>
to a temporary file and run eslint on those temp files) so that the bun x eslint
/ npx --no-install eslint calls operate on the staged snapshot rather than the
working tree; update the logic around staged (the staged array and the two
eslint invocations) to perform this extraction for each file and clean up any
temp files afterward.
In `@package.json`:
- Line 12: The prepare script is currently hiding failures by redirecting stderr
and forcing success; update the "prepare" script in package.json (the "prepare"
property) to stop swallowing errors from git config --local core.hooksPath
.githooks so hook-install failures surface. Replace the current command's
redirection and "|| true" with a command that either lets git's non‑zero exit
bubble up or explicitly checks the exit code and prints a clear error message
(referencing core.hooksPath and .githooks) and exits non‑zero so CI/devs are
alerted when hook installation fails.
🪄 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 Plus
Run ID: 8662a3ca-8feb-4bbd-8bbd-0a0344a0dbd7
📒 Files selected for processing (3)
.githooks/pre-commit.specify/memory/constitution.mdpackage.json
- CrowdfundingProgress.tsx: fix import/order (ProjectRoles before CoinIcon).
- show.tsx: add .catch() to the loadComments() invocation in useEffect so a
failed fetch resets the loading state and shows an empty comments view
instead of leaving the spinner stuck (CodeRabbit outside-diff finding;
drive-by fix).
- .githooks/pre-commit:
- Reject partially staged JS/TS files. ESLint reads the working tree, so
linting partially staged content would produce false pass/fail and
silently undermine the staged-content gate.
- Insert `--` before "${staged[@]}" in both bun and npx invocations so
a filename starting with `-` cannot be misread as an ESLint flag.
- package.json: replace silent `2>/dev/null || true` on the prepare script
with a visible warning when `git config core.hooksPath` cannot be set
(e.g., installing from a tarball outside a git checkout). Errors no
longer disappear; the developer is told to run the command manually.
Summary
.githooks/pre-commitESLint hook and forbidding silent removal/bypass..githooks/pre-commitruns ESLint against staged*.js/*.jsx/*.ts/*.tsx/*.cjs/*.mjsfiles viabun x eslint(ornpx eslint) and aborts on any error.package.jsonadds apreparescript that setscore.hooksPath=.githookson install — contributors auto-activate afterbun install/npm install.git config --local core.hooksPath .githooks.CrowdfundingProgressgains achildrenslot;show.tsxpassesProjectStageActions(owner-gated) as the child.Test plan
bun install(ornpm install) on a fresh clone — confirmgit config core.hooksPathreads.githooks.php artisan test --compactpasses.bun run test:jspasses.vendor/bin/pint --test --format agentpasses.1.2.0.Notes
preparescript is one line. Honors Constitution Principle III ("Convention Over Custom") and the Technology Constraints section ("Dependency additions … MUST be approved").Summary by CodeRabbit
New Features
Bug Fixes
Chores