@next-friday/create-app 2.1.9 → 4.0.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/package.json +1 -1
- package/templates/base/.agents/agents.json +7 -0
- package/templates/base/.agents/hooks/agent-format-after-edit.sh +15 -0
- package/templates/base/.agents/hooks/agent-production-gate.sh +10 -0
- package/templates/base/.agents/hooks/agent-test-edit-gate.sh +25 -0
- package/templates/base/.agents/review.md +21 -0
- package/templates/base/.agents/rules/no-suppression.md +1 -1
- package/templates/base/.agents/skills/babysit-pr/SKILL.md +8 -0
- package/templates/base/.agents/skills/brand-policy/SKILL.md +12 -0
- package/templates/base/.agents/skills/compliance-policy/SKILL.md +12 -0
- package/templates/base/{.cursor/rules/git-workflow.mdc → .agents/skills/git-workflow/SKILL.md} +2 -2
- package/templates/base/{.cursor/rules/script-driven-changes.mdc → .agents/skills/script-driven-changes/SKILL.md} +2 -2
- package/templates/base/.agents/skills/security-policy/SKILL.md +12 -0
- package/templates/base/.agents/skills/ux-policy/SKILL.md +12 -0
- package/templates/base/.agents/skills/write-intent/SKILL.md +30 -0
- package/templates/base/.agents/skills/write-spec/SKILL.md +12 -0
- package/templates/base/.claude/managed-settings.example.json +26 -0
- package/templates/base/.claude/settings.json +31 -0
- package/templates/base/.claude/skills/babysit-pr/SKILL.md +8 -0
- package/templates/base/.claude/skills/brand-policy/SKILL.md +12 -0
- package/templates/base/.claude/skills/compliance-policy/SKILL.md +12 -0
- package/templates/base/{.agents/rules/git-workflow.md → .claude/skills/git-workflow/SKILL.md} +5 -0
- package/templates/base/{.agents/rules/script-driven-changes.md → .claude/skills/script-driven-changes/SKILL.md} +5 -0
- package/templates/base/.claude/skills/security-policy/SKILL.md +12 -0
- package/templates/base/.claude/skills/ux-policy/SKILL.md +12 -0
- package/templates/base/.claude/skills/write-intent/SKILL.md +30 -0
- package/templates/base/.claude/skills/write-spec/SKILL.md +12 -0
- package/templates/base/.cursor/BUGBOT.md +3 -2
- package/templates/base/.cursor/hooks.json +15 -0
- package/templates/base/.cursor/rules/no-suppression.mdc +1 -1
- package/templates/base/.cursor/skills/babysit-pr/SKILL.md +8 -0
- package/templates/base/.cursor/skills/brand-policy/SKILL.md +12 -0
- package/templates/base/.cursor/skills/compliance-policy/SKILL.md +12 -0
- package/templates/base/.cursor/skills/git-workflow/SKILL.md +15 -0
- package/templates/base/.cursor/skills/script-driven-changes/SKILL.md +12 -0
- package/templates/base/.cursor/skills/security-policy/SKILL.md +12 -0
- package/templates/base/.cursor/skills/ux-policy/SKILL.md +12 -0
- package/templates/base/.cursor/skills/write-intent/SKILL.md +30 -0
- package/templates/base/.cursor/skills/write-spec/SKILL.md +12 -0
- package/templates/base/.github/workflows/agent-evals.yml +128 -0
- package/templates/base/.github/workflows/claude.yml +39 -0
- package/templates/base/.github/zizmor.yml +1 -1
- package/templates/base/REVIEW.md +21 -0
- package/templates/base/SETUP.md +108 -0
- package/templates/base/bands.yaml +10 -0
- package/templates/base/evals/README.md +15 -0
- package/templates/base/evals/check.sh +17 -0
- package/templates/base/intent/README.md +8 -0
- package/templates/base/lessons/README.md +3 -0
- package/templates/base/scripts/sync-agent-rules.ts +111 -1
- package/templates/nestjs/.agents/agents/verifier.md +1 -0
- package/templates/nestjs/.agents/rules.json +23 -9
- package/templates/nestjs/.claude/agents/verifier.md +7 -0
- package/templates/nestjs/.claude/rules/constitution-changes.md +25 -0
- package/templates/nestjs/.claude/rules/diagnostics-and-error-handling.md +13 -0
- package/templates/nestjs/.claude/rules/structured-logging.md +9 -0
- package/templates/nestjs/.cursor/agents/verifier.md +7 -0
- package/templates/{base → nestjs}/.cursor/rules/constitution-changes.mdc +2 -1
- package/templates/{base → nestjs}/.cursor/rules/diagnostics-and-error-handling.mdc +2 -1
- package/templates/{base → nestjs}/.cursor/rules/structured-logging.mdc +2 -1
- package/templates/nestjs/.github/workflows/ci.yml +44 -0
- package/templates/nestjs/AGENTS.md +17 -4
- package/templates/nestjs/README.md +1 -16
- package/templates/nextjs/.agents/agents/verifier.md +1 -0
- package/templates/nextjs/.agents/mcp.json +8 -0
- package/templates/nextjs/.agents/rules.json +23 -9
- package/templates/nextjs/.claude/agents/verifier.md +7 -0
- package/templates/nextjs/.claude/rules/constitution-changes.md +25 -0
- package/templates/nextjs/.claude/rules/diagnostics-and-error-handling.md +15 -0
- package/templates/nextjs/.claude/rules/structured-logging.md +11 -0
- package/templates/nextjs/.cursor/agents/verifier.md +7 -0
- package/templates/nextjs/.cursor/mcp.json +8 -0
- package/templates/nextjs/.cursor/rules/constitution-changes.mdc +11 -0
- package/templates/nextjs/.cursor/rules/diagnostics-and-error-handling.mdc +13 -0
- package/templates/nextjs/.cursor/rules/structured-logging.mdc +9 -0
- package/templates/nextjs/.github/workflows/ci.yml +44 -0
- package/templates/nextjs/.mcp.json +8 -0
- package/templates/nextjs/AGENTS.md +17 -4
- package/templates/nextjs/README.md +1 -16
- package/templates/nodejs/.agents/agents/verifier.md +1 -0
- package/templates/nodejs/.agents/rules.json +23 -9
- package/templates/nodejs/.claude/agents/verifier.md +7 -0
- package/templates/nodejs/.claude/rules/constitution-changes.md +25 -0
- package/templates/nodejs/.claude/rules/diagnostics-and-error-handling.md +13 -0
- package/templates/nodejs/.claude/rules/structured-logging.md +9 -0
- package/templates/nodejs/.cursor/agents/verifier.md +7 -0
- package/templates/nodejs/.cursor/rules/constitution-changes.mdc +11 -0
- package/templates/nodejs/.cursor/rules/diagnostics-and-error-handling.mdc +13 -0
- package/templates/nodejs/.cursor/rules/structured-logging.mdc +9 -0
- package/templates/nodejs/.github/workflows/ci.yml +44 -0
- package/templates/nodejs/AGENTS.md +17 -4
- package/templates/nodejs/README.md +1 -16
- package/templates/payload/.agents/agents/verifier.md +1 -0
- package/templates/payload/.agents/mcp.json +8 -0
- package/templates/payload/.agents/rules.json +23 -9
- package/templates/payload/.claude/agents/verifier.md +7 -0
- package/templates/payload/.claude/rules/constitution-changes.md +25 -0
- package/templates/payload/.claude/rules/diagnostics-and-error-handling.md +15 -0
- package/templates/payload/.claude/rules/structured-logging.md +11 -0
- package/templates/payload/.cursor/agents/verifier.md +7 -0
- package/templates/payload/.cursor/mcp.json +8 -0
- package/templates/payload/.cursor/rules/constitution-changes.mdc +11 -0
- package/templates/payload/.cursor/rules/diagnostics-and-error-handling.mdc +13 -0
- package/templates/payload/.cursor/rules/structured-logging.mdc +9 -0
- package/templates/payload/.github/workflows/ci.yml +44 -0
- package/templates/payload/.mcp.json +8 -0
- package/templates/payload/AGENTS.md +17 -4
- package/templates/payload/README.md +1 -16
- package/templates/turborepo/.agents/agents/verifier.md +1 -0
- package/templates/turborepo/.agents/mcp.json +8 -0
- package/templates/turborepo/.agents/rules.json +23 -9
- package/templates/turborepo/.claude/agents/verifier.md +7 -0
- package/templates/turborepo/.claude/rules/constitution-changes.md +25 -0
- package/templates/turborepo/.claude/rules/diagnostics-and-error-handling.md +15 -0
- package/templates/turborepo/.claude/rules/structured-logging.md +11 -0
- package/templates/turborepo/.cursor/agents/verifier.md +7 -0
- package/templates/turborepo/.cursor/mcp.json +8 -0
- package/templates/turborepo/.cursor/rules/constitution-changes.mdc +11 -0
- package/templates/turborepo/.cursor/rules/diagnostics-and-error-handling.mdc +13 -0
- package/templates/turborepo/.cursor/rules/structured-logging.mdc +9 -0
- package/templates/turborepo/.github/workflows/ci.yml +44 -0
- package/templates/turborepo/.mcp.json +8 -0
- package/templates/turborepo/AGENTS.md +17 -4
- package/templates/turborepo/README.md +1 -16
- package/templates/base/.claude/rules/constitution-changes.md +0 -1
- package/templates/base/.claude/rules/diagnostics-and-error-handling.md +0 -1
- package/templates/base/.claude/rules/git-workflow.md +0 -1
- package/templates/base/.claude/rules/script-driven-changes.md +0 -1
- package/templates/base/.claude/rules/structured-logging.md +0 -1
|
@@ -166,6 +166,50 @@ jobs:
|
|
|
166
166
|
environment: dev
|
|
167
167
|
commit_sha: ${{ github.sha }}
|
|
168
168
|
|
|
169
|
+
triage:
|
|
170
|
+
name: Triage failed build
|
|
171
|
+
needs:
|
|
172
|
+
- checks
|
|
173
|
+
- image
|
|
174
|
+
if: failure() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
|
175
|
+
runs-on: ubuntu-latest
|
|
176
|
+
timeout-minutes: 15
|
|
177
|
+
permissions:
|
|
178
|
+
actions: read # Needed to read the logs of the failed jobs.
|
|
179
|
+
id-token: write # Needed to authenticate to Anthropic with the workflow's OIDC token.
|
|
180
|
+
pull-requests: write # Needed to post the summary on the pull request.
|
|
181
|
+
steps:
|
|
182
|
+
- name: Collect the build log
|
|
183
|
+
env:
|
|
184
|
+
GH_TOKEN: ${{ github.token }}
|
|
185
|
+
REPOSITORY: ${{ github.repository }}
|
|
186
|
+
RUN_ID: ${{ github.run_id }}
|
|
187
|
+
run: |
|
|
188
|
+
mkdir -p out
|
|
189
|
+
for job in $(gh api "repos/$REPOSITORY/actions/runs/$RUN_ID/jobs" --paginate --jq '.jobs[] | select(.conclusion == "failure") | .id'); do
|
|
190
|
+
gh api "repos/$REPOSITORY/actions/jobs/$job/logs" >> out/build.log
|
|
191
|
+
done
|
|
192
|
+
- name: Triage failed build
|
|
193
|
+
id: triage
|
|
194
|
+
uses: anthropics/claude-code-action@61a9c274fa7110a66dfafc1bbbced03833eb25fe # v1.0.269
|
|
195
|
+
with:
|
|
196
|
+
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
|
|
197
|
+
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
|
|
198
|
+
prompt: >
|
|
199
|
+
Read the build log at out/build.log. Identify the most
|
|
200
|
+
likely cause, say whether the failure looks flaky or real, and write a
|
|
201
|
+
three-line summary for the PR thread.
|
|
202
|
+
claude_args: >-
|
|
203
|
+
--allowedTools "Read"
|
|
204
|
+
--json-schema '{"type":"object","properties":{"summary":{"type":"string"}},"required":["summary"]}'
|
|
205
|
+
- name: Post the summary
|
|
206
|
+
env:
|
|
207
|
+
GH_TOKEN: ${{ github.token }}
|
|
208
|
+
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
209
|
+
REPOSITORY: ${{ github.repository }}
|
|
210
|
+
SUMMARY: ${{ fromJSON(steps.triage.outputs.structured_output).summary }}
|
|
211
|
+
run: gh pr comment "$PR_NUMBER" --repo "$REPOSITORY" --body "$SUMMARY"
|
|
212
|
+
|
|
169
213
|
ci:
|
|
170
214
|
name: All Checks
|
|
171
215
|
if: always()
|
|
@@ -14,19 +14,32 @@ NestJS HTTP API in TypeScript on pnpm and Node.js `>=24.15.0 <25`.
|
|
|
14
14
|
| Every check | `pnpm verify` |
|
|
15
15
|
| Render rules after a change | `pnpm rules:sync` |
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Verifying your work
|
|
18
|
+
|
|
19
|
+
- Build: `pnpm build` (prints nothing after `$ tsc -p tsconfig.build.json`)
|
|
20
|
+
- Test: `pnpm test:coverage` (all green, then the coverage summary; never skip or delete a failing test)
|
|
21
|
+
- Lint: `pnpm verify:static` (ESLint allows zero warnings; prints `✔ no dependency violations found`)
|
|
22
|
+
|
|
23
|
+
Run all three before reporting any task complete, and paste the output. `pnpm verify` runs all three.
|
|
24
|
+
If a test fails, fix the code, not the test.
|
|
25
|
+
|
|
26
|
+
## Architecture
|
|
18
27
|
|
|
19
28
|
- `src/main.ts` creates the app from `AppModule` on `parsePort(process.env.PORT)` with Nest's `ConsoleLogger`, which writes JSON lines when `NODE_ENV` is `production`.
|
|
20
29
|
- `AppModule` imports `HealthModule`, whose Terminus controller serves `/health`. Add a feature as its own module and import it in `AppModule`.
|
|
21
30
|
|
|
22
|
-
##
|
|
31
|
+
## Conventions
|
|
23
32
|
|
|
24
|
-
1. **Follow `.agents/rules/`.** `.agents/rules.json` gives each rule's scope; Claude Code and Cursor load them. After changing either, run `pnpm rules:sync`; `pnpm check` fails on stale copies.
|
|
33
|
+
1. **Follow `.agents/rules/`.** `.agents/rules.json` gives each rule's scope; Claude Code and Cursor load them. After changing either, or a skill or subagent in `.agents/skills/` or `.agents/agents/`, run `pnpm rules:sync`; `pnpm check` fails on stale copies.
|
|
25
34
|
2. **Put unit tests next to the code as `src/**/*.test.ts` and end-to-end tests in `test/` as `*.e2e.test.ts`.** `vitest.config.ts` and `vitest.e2e.config.ts` collect only those patterns.
|
|
26
35
|
3. **Read configuration from environment variables and fail when one is missing**, as `parsePort` does. Document each variable in `.env.example`.
|
|
27
36
|
4. **Log through Nest's `Logger`.** It goes to the `ConsoleLogger` set in `src/main.ts`.
|
|
37
|
+
5. **Start from the accepted spec, in plan mode.** Claude Code starts every session in plan mode (`.claude/settings.json`); in Cursor, switch to Plan Mode before the first edit. Give the plan the change's `intent/<change>/intent.md` and `spec.md`, and have it name the files that change, the order of the work, and the tests that prove it. Commit the approved plan as `intent/<change>/plan.md`. When implementation departs from the plan, update `plan.md` in the same commit.
|
|
38
|
+
6. **Start a bug fix with a failing test.** Reproduce the bug as a test, run it, and confirm it fails for the reason you expect. Commit that test. Then create `.git/bug-fix-in-progress`, so `.agents/hooks/agent-test-edit-gate.sh` blocks test edits, and make the test pass without editing it. Delete `.git/bug-fix-in-progress` when the fix is done.
|
|
39
|
+
|
|
40
|
+
## Things Claude gets wrong
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
When Claude makes a mistake twice, add the correction here.
|
|
30
43
|
|
|
31
44
|
- **Agent shell gate**: `.agents/hooks/agent-shell-gate.sh` blocks a shell command that writes to a protected path such as `.agents`, `.cursor`, `.claude/rules`, or `.husky`. It is a convenience, not a security boundary: CI and code-owner review are the boundary.
|
|
32
45
|
|
|
@@ -14,22 +14,7 @@ The server listens on the port set by `PORT` in `.env`, which the CLI created fr
|
|
|
14
14
|
|
|
15
15
|
## After creating a project from this template
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
git add --all
|
|
21
|
-
git commit -m "chore(repo): start from template"
|
|
22
|
-
git push --set-upstream origin main
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
2. Add your team as the owner of every file in `.github/CODEOWNERS`, and replace the owner placeholder in `.github/zizmor.yml`.
|
|
26
|
-
3. Replace the template's description and owner: `package.json#description`, `repository.url`, and `author`. Change `license` from `UNLICENSED` if the project is open source.
|
|
27
|
-
4. In the repository settings:
|
|
28
|
-
- **Actions → General → Workflow permissions:** select **Read repository contents and packages permissions**. Every workflow requests the extra permissions it needs.
|
|
29
|
-
- **Advanced Security:** enable private vulnerability reporting, Dependabot alerts, Dependabot security updates, secret scanning, and push protection. `SECURITY.md` sends reporters to private vulnerability reporting.
|
|
30
|
-
- **Cursor Bugbot:** enable the repository at [Bugbot](https://cursor.com/automations/from-cursor/bugbot). Bugbot reviews pull requests against the rules linked from `.cursor/BUGBOT.md`.
|
|
31
|
-
- **Rules → Rulesets:** protect `main` with squash merges only, a linear history, no force pushes or deletion, and the required checks `All Checks` and `Validate pull request title`. Rulesets in a private repository need GitHub Pro, Team, or Enterprise; on GitHub Free, make the repository public or upgrade.
|
|
32
|
-
- Create the `needs triage` label, which the issue forms apply: `gh label create "needs triage"`.
|
|
17
|
+
Follow [SETUP.md](SETUP.md) in order. It sets up the repository, the reviews, and the AI-native SDLC.
|
|
33
18
|
|
|
34
19
|
## Scripts
|
|
35
20
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Start the app with `pnpm dev`. Exercise the changed behavior and the two nearest neighboring flows. Report what you ran, what you saw, and any behavior that does not match plan.md. Do not fix anything; report only.
|
|
@@ -12,7 +12,25 @@
|
|
|
12
12
|
"description": "Codebase hygiene: modify existing code instead of accumulating new code"
|
|
13
13
|
},
|
|
14
14
|
"constitution-changes": {
|
|
15
|
-
"description": "Constitution changes: change rules, hooks, and agent settings only through a dedicated issue"
|
|
15
|
+
"description": "Constitution changes: change rules, hooks, and agent settings only through a dedicated issue",
|
|
16
|
+
"globs": [
|
|
17
|
+
".agents/rules/**",
|
|
18
|
+
".agents/rules.json",
|
|
19
|
+
".agents/hooks/**",
|
|
20
|
+
".claude/settings.json",
|
|
21
|
+
".claude/rules/**",
|
|
22
|
+
".cursor/rules/**",
|
|
23
|
+
".cursor/hooks/**",
|
|
24
|
+
".cursor/hooks.json",
|
|
25
|
+
"scripts/sync-agent-rules.ts",
|
|
26
|
+
"scripts/check-agent-gates.ts",
|
|
27
|
+
".husky/**",
|
|
28
|
+
".commitlintrc.json",
|
|
29
|
+
"prettier.config.ts",
|
|
30
|
+
"eslint.config.ts",
|
|
31
|
+
".lintstagedrc.json",
|
|
32
|
+
".gitleaks.toml"
|
|
33
|
+
]
|
|
16
34
|
},
|
|
17
35
|
"current-state-authority": {
|
|
18
36
|
"description": "Current state: implement from user requirements and the working tree"
|
|
@@ -32,28 +50,24 @@
|
|
|
32
50
|
"globs": ["**/*.test.ts", "**/*.test.tsx"]
|
|
33
51
|
},
|
|
34
52
|
"diagnostics-and-error-handling": {
|
|
35
|
-
"description": "Diagnostics: fix runtime failures at the source and keep the root cause"
|
|
53
|
+
"description": "Diagnostics: fix runtime failures at the source and keep the root cause",
|
|
54
|
+
"globs": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
|
|
36
55
|
},
|
|
37
56
|
"evidence-before-claims": {
|
|
38
57
|
"description": "Evidence: verify and cite a claim before stating or writing it"
|
|
39
58
|
},
|
|
40
|
-
"git-workflow": {
|
|
41
|
-
"description": "Git workflow: trunk-based branches, commits, and pull requests"
|
|
42
|
-
},
|
|
43
59
|
"no-suppression": {
|
|
44
60
|
"description": "Findings: fix scanner and linter reports without inline suppressions"
|
|
45
61
|
},
|
|
46
62
|
"platform-and-library-first": {
|
|
47
63
|
"description": "Platform and library first: use built-in features, then maintained libraries, then custom code"
|
|
48
64
|
},
|
|
49
|
-
"script-driven-changes": {
|
|
50
|
-
"description": "Scripts: apply a repeated edit across many files with a script"
|
|
51
|
-
},
|
|
52
65
|
"single-author-style": {
|
|
53
66
|
"description": "Sibling style: match layout, naming, and composition in the same project"
|
|
54
67
|
},
|
|
55
68
|
"structured-logging": {
|
|
56
|
-
"description": "Logging: log through a logging library in structured, durable records"
|
|
69
|
+
"description": "Logging: log through a logging library in structured, durable records",
|
|
70
|
+
"globs": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
|
|
57
71
|
},
|
|
58
72
|
"typescript-first": {
|
|
59
73
|
"description": "TypeScript-first: write source, tests, and scripts as .ts or .tsx",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verifier
|
|
3
|
+
description: Runs the app and checks the change works before the session reports done
|
|
4
|
+
tools: Bash, Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Start the app with `pnpm dev`. Exercise the changed behavior and the two nearest neighboring flows. Report what you ran, what you saw, and any behavior that does not match plan.md. Do not fix anything; report only.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- ".agents/rules/**"
|
|
4
|
+
- ".agents/rules.json"
|
|
5
|
+
- ".agents/hooks/**"
|
|
6
|
+
- ".claude/settings.json"
|
|
7
|
+
- ".claude/rules/**"
|
|
8
|
+
- ".cursor/rules/**"
|
|
9
|
+
- ".cursor/hooks/**"
|
|
10
|
+
- ".cursor/hooks.json"
|
|
11
|
+
- "scripts/sync-agent-rules.ts"
|
|
12
|
+
- "scripts/check-agent-gates.ts"
|
|
13
|
+
- ".husky/**"
|
|
14
|
+
- ".commitlintrc.json"
|
|
15
|
+
- "prettier.config.ts"
|
|
16
|
+
- "eslint.config.ts"
|
|
17
|
+
- ".lintstagedrc.json"
|
|
18
|
+
- ".gitleaks.toml"
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Constitution Changes
|
|
22
|
+
|
|
23
|
+
The constitution is the set of files that agent settings deny to agents: rules, hooks, lint, format, and commit configuration, and the agent settings themselves. It is company policy.
|
|
24
|
+
|
|
25
|
+
A developer changes the constitution through a dedicated issue, never inside a feature pull request. When a task needs a constitution change, propose it to the user, reference that issue, and wait for it to merge before the task depends on it.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.ts"
|
|
4
|
+
- "**/*.tsx"
|
|
5
|
+
- "**/*.js"
|
|
6
|
+
- "**/*.jsx"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Diagnostics
|
|
10
|
+
|
|
11
|
+
Resolve runtime failures at the source with the language's standard narrowing, validation, and error types. For missing third-party types, take upstream definitions or a narrow adapter in the established location.
|
|
12
|
+
|
|
13
|
+
Surface errors at the caller or process boundary with diagnostic context. Handle an error to add context, recover, or translate it at an application boundary. Retain the root cause through the language's exception mechanism.
|
|
14
|
+
|
|
15
|
+
Report unresolved type, declaration, or rule conflicts to the user. Findings follow `no-suppression.md`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.ts"
|
|
4
|
+
- "**/*.tsx"
|
|
5
|
+
- "**/*.js"
|
|
6
|
+
- "**/*.jsx"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Logging
|
|
10
|
+
|
|
11
|
+
Application code logs through the stack's logging library or the framework's logger, never `console.*`. Write structured records, and send them to a store that keeps them longer than the host does.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verifier
|
|
3
|
+
description: Runs the app and checks the change works before the session reports done
|
|
4
|
+
readonly: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Start the app with `pnpm dev`. Exercise the changed behavior and the two nearest neighboring flows. Report what you ran, what you saw, and any behavior that does not match plan.md. Do not fix anything; report only.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Constitution changes: change rules, hooks, and agent settings only through a dedicated issue"
|
|
3
|
+
globs: ".agents/rules/**,.agents/rules.json,.agents/hooks/**,.claude/settings.json,.claude/rules/**,.cursor/rules/**,.cursor/hooks/**,.cursor/hooks.json,scripts/sync-agent-rules.ts,scripts/check-agent-gates.ts,.husky/**,.commitlintrc.json,prettier.config.ts,eslint.config.ts,.lintstagedrc.json,.gitleaks.toml"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Constitution Changes
|
|
8
|
+
|
|
9
|
+
The constitution is the set of files that agent settings deny to agents: rules, hooks, lint, format, and commit configuration, and the agent settings themselves. It is company policy.
|
|
10
|
+
|
|
11
|
+
A developer changes the constitution through a dedicated issue, never inside a feature pull request. When a task needs a constitution change, propose it to the user, reference that issue, and wait for it to merge before the task depends on it.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Diagnostics: fix runtime failures at the source and keep the root cause"
|
|
3
|
+
globs: "**/*.ts,**/*.tsx,**/*.js,**/*.jsx"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Diagnostics
|
|
8
|
+
|
|
9
|
+
Resolve runtime failures at the source with the language's standard narrowing, validation, and error types. For missing third-party types, take upstream definitions or a narrow adapter in the established location.
|
|
10
|
+
|
|
11
|
+
Surface errors at the caller or process boundary with diagnostic context. Handle an error to add context, recover, or translate it at an application boundary. Retain the root cause through the language's exception mechanism.
|
|
12
|
+
|
|
13
|
+
Report unresolved type, declaration, or rule conflicts to the user. Findings follow `no-suppression.md`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Logging: log through a logging library in structured, durable records"
|
|
3
|
+
globs: "**/*.ts,**/*.tsx,**/*.js,**/*.jsx"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Logging
|
|
8
|
+
|
|
9
|
+
Application code logs through the stack's logging library or the framework's logger, never `console.*`. Write structured records, and send them to a store that keeps them longer than the host does.
|
|
@@ -172,6 +172,50 @@ jobs:
|
|
|
172
172
|
environment: dev
|
|
173
173
|
commit_sha: ${{ github.sha }}
|
|
174
174
|
|
|
175
|
+
triage:
|
|
176
|
+
name: Triage failed build
|
|
177
|
+
needs:
|
|
178
|
+
- checks
|
|
179
|
+
- image
|
|
180
|
+
if: failure() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
|
181
|
+
runs-on: ubuntu-latest
|
|
182
|
+
timeout-minutes: 15
|
|
183
|
+
permissions:
|
|
184
|
+
actions: read # Needed to read the logs of the failed jobs.
|
|
185
|
+
id-token: write # Needed to authenticate to Anthropic with the workflow's OIDC token.
|
|
186
|
+
pull-requests: write # Needed to post the summary on the pull request.
|
|
187
|
+
steps:
|
|
188
|
+
- name: Collect the build log
|
|
189
|
+
env:
|
|
190
|
+
GH_TOKEN: ${{ github.token }}
|
|
191
|
+
REPOSITORY: ${{ github.repository }}
|
|
192
|
+
RUN_ID: ${{ github.run_id }}
|
|
193
|
+
run: |
|
|
194
|
+
mkdir -p out
|
|
195
|
+
for job in $(gh api "repos/$REPOSITORY/actions/runs/$RUN_ID/jobs" --paginate --jq '.jobs[] | select(.conclusion == "failure") | .id'); do
|
|
196
|
+
gh api "repos/$REPOSITORY/actions/jobs/$job/logs" >> out/build.log
|
|
197
|
+
done
|
|
198
|
+
- name: Triage failed build
|
|
199
|
+
id: triage
|
|
200
|
+
uses: anthropics/claude-code-action@61a9c274fa7110a66dfafc1bbbced03833eb25fe # v1.0.269
|
|
201
|
+
with:
|
|
202
|
+
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
|
|
203
|
+
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
|
|
204
|
+
prompt: >
|
|
205
|
+
Read the build log at out/build.log. Identify the most
|
|
206
|
+
likely cause, say whether the failure looks flaky or real, and write a
|
|
207
|
+
three-line summary for the PR thread.
|
|
208
|
+
claude_args: >-
|
|
209
|
+
--allowedTools "Read"
|
|
210
|
+
--json-schema '{"type":"object","properties":{"summary":{"type":"string"}},"required":["summary"]}'
|
|
211
|
+
- name: Post the summary
|
|
212
|
+
env:
|
|
213
|
+
GH_TOKEN: ${{ github.token }}
|
|
214
|
+
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
215
|
+
REPOSITORY: ${{ github.repository }}
|
|
216
|
+
SUMMARY: ${{ fromJSON(steps.triage.outputs.structured_output).summary }}
|
|
217
|
+
run: gh pr comment "$PR_NUMBER" --repo "$REPOSITORY" --body "$SUMMARY"
|
|
218
|
+
|
|
175
219
|
ci:
|
|
176
220
|
name: All Checks
|
|
177
221
|
if: always()
|
|
@@ -14,19 +14,32 @@ Next.js App Router web app with React and Tailwind CSS, in TypeScript on pnpm an
|
|
|
14
14
|
| Every check | `pnpm verify` |
|
|
15
15
|
| Render rules after a change | `pnpm rules:sync` |
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Verifying your work
|
|
18
|
+
|
|
19
|
+
- Build: `pnpm build` (prints the `Route (app)` table)
|
|
20
|
+
- Test: `pnpm test:coverage` (all green, then the coverage summary; never skip or delete a failing test)
|
|
21
|
+
- Lint: `pnpm verify:static` (ESLint allows zero warnings; prints `✔ no dependency violations found`)
|
|
22
|
+
|
|
23
|
+
Run all three before reporting any task complete, and paste the output. `pnpm verify` runs all three.
|
|
24
|
+
If a test fails, fix the code, not the test.
|
|
25
|
+
|
|
26
|
+
## Architecture
|
|
18
27
|
|
|
19
28
|
- Routes live in `app/`. `app/health/route.ts` serves `/health`.
|
|
20
29
|
- `next.config.ts` builds `output: "standalone"`, enables Cache Components, and sets the security headers. `pnpm start` copies the static assets into `.next/standalone` and serves it.
|
|
21
30
|
|
|
22
|
-
##
|
|
31
|
+
## Conventions
|
|
23
32
|
|
|
24
|
-
1. **Follow `.agents/rules/`.** `.agents/rules.json` gives each rule's scope; Claude Code and Cursor load them. After changing either, run `pnpm rules:sync`; `pnpm check` fails on stale copies.
|
|
33
|
+
1. **Follow `.agents/rules/`.** `.agents/rules.json` gives each rule's scope; Claude Code and Cursor load them. After changing either, or a skill or subagent in `.agents/skills/` or `.agents/agents/`, run `pnpm rules:sync`; `pnpm check` fails on stale copies.
|
|
25
34
|
2. **Put unit tests next to the code as `app/**/*.test.{ts,tsx}` and Playwright end-to-end tests in `test/` as `*.e2e.test.ts`.** Vitest collects only the first pattern.
|
|
26
35
|
3. **Ask the user before adding component tests.** They need a DOM test environment, and Vitest runs in Node.js.
|
|
27
36
|
4. **Read configuration from environment variables and fail when one is missing.** Document each variable in `.env.example`.
|
|
37
|
+
5. **Start from the accepted spec, in plan mode.** Claude Code starts every session in plan mode (`.claude/settings.json`); in Cursor, switch to Plan Mode before the first edit. Give the plan the change's `intent/<change>/intent.md` and `spec.md`, and have it name the files that change, the order of the work, and the tests that prove it. Commit the approved plan as `intent/<change>/plan.md`. When implementation departs from the plan, update `plan.md` in the same commit.
|
|
38
|
+
6. **Start a bug fix with a failing test.** Reproduce the bug as a test, run it, and confirm it fails for the reason you expect. Commit that test. Then create `.git/bug-fix-in-progress`, so `.agents/hooks/agent-test-edit-gate.sh` blocks test edits, and make the test pass without editing it. Delete `.git/bug-fix-in-progress` when the fix is done.
|
|
39
|
+
|
|
40
|
+
## Things Claude gets wrong
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
When Claude makes a mistake twice, add the correction here.
|
|
30
43
|
|
|
31
44
|
- **First end-to-end run**: run `pnpm exec playwright install chromium` once. `pnpm test:e2e` starts the development server unless one is already running.
|
|
32
45
|
- **Agent shell gate**: `.agents/hooks/agent-shell-gate.sh` blocks a shell command that writes to a protected path such as `.agents`, `.cursor`, `.claude/rules`, or `.husky`. It is a convenience, not a security boundary: CI and code-owner review are the boundary.
|
|
@@ -12,22 +12,7 @@ pnpm dev
|
|
|
12
12
|
|
|
13
13
|
## After creating a project from this template
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
git add --all
|
|
19
|
-
git commit -m "chore(repo): start from template"
|
|
20
|
-
git push --set-upstream origin main
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
2. Add your team as the owner of every file in `.github/CODEOWNERS`, and replace the owner placeholder in `.github/zizmor.yml`.
|
|
24
|
-
3. Replace the template's description and owner: `package.json#description`, `repository.url`, and `author`, and the `Next Friday Next.js template` text in `app/layout.tsx`, `app/page.tsx`, and their tests. Change `license` from `UNLICENSED` if the project is open source.
|
|
25
|
-
4. In the repository settings:
|
|
26
|
-
- **Actions → General → Workflow permissions:** select **Read repository contents and packages permissions**. Every workflow requests the extra permissions it needs.
|
|
27
|
-
- **Advanced Security:** enable private vulnerability reporting, Dependabot alerts, Dependabot security updates, secret scanning, and push protection. `SECURITY.md` sends reporters to private vulnerability reporting.
|
|
28
|
-
- **Cursor Bugbot:** enable the repository at [Bugbot](https://cursor.com/automations/from-cursor/bugbot). Bugbot reviews pull requests against the rules linked from `.cursor/BUGBOT.md`.
|
|
29
|
-
- **Rules → Rulesets:** protect `main` with squash merges only, a linear history, no force pushes or deletion, and the required checks `All Checks` and `Validate pull request title`. Rulesets in a private repository need GitHub Pro, Team, or Enterprise; on GitHub Free, make the repository public or upgrade.
|
|
30
|
-
- Create the `needs triage` label, which the issue forms apply: `gh label create "needs triage"`.
|
|
15
|
+
Follow [SETUP.md](SETUP.md) in order. It sets up the repository, the reviews, and the AI-native SDLC. In step 1, also replace the `Next Friday Next.js template` text in `app/layout.tsx`, `app/page.tsx`, and their tests.
|
|
31
16
|
|
|
32
17
|
## Scripts
|
|
33
18
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Start the app with `pnpm start:dev`. Exercise the changed behavior and the two nearest neighboring flows. Report what you ran, what you saw, and any behavior that does not match plan.md. Do not fix anything; report only.
|
|
@@ -12,7 +12,25 @@
|
|
|
12
12
|
"description": "Codebase hygiene: modify existing code instead of accumulating new code"
|
|
13
13
|
},
|
|
14
14
|
"constitution-changes": {
|
|
15
|
-
"description": "Constitution changes: change rules, hooks, and agent settings only through a dedicated issue"
|
|
15
|
+
"description": "Constitution changes: change rules, hooks, and agent settings only through a dedicated issue",
|
|
16
|
+
"globs": [
|
|
17
|
+
".agents/rules/**",
|
|
18
|
+
".agents/rules.json",
|
|
19
|
+
".agents/hooks/**",
|
|
20
|
+
".claude/settings.json",
|
|
21
|
+
".claude/rules/**",
|
|
22
|
+
".cursor/rules/**",
|
|
23
|
+
".cursor/hooks/**",
|
|
24
|
+
".cursor/hooks.json",
|
|
25
|
+
"scripts/sync-agent-rules.ts",
|
|
26
|
+
"scripts/check-agent-gates.ts",
|
|
27
|
+
".husky/**",
|
|
28
|
+
".commitlintrc.json",
|
|
29
|
+
".prettierrc.json",
|
|
30
|
+
"eslint.config.ts",
|
|
31
|
+
".lintstagedrc.json",
|
|
32
|
+
".gitleaks.toml"
|
|
33
|
+
]
|
|
16
34
|
},
|
|
17
35
|
"current-state-authority": {
|
|
18
36
|
"description": "Current state: implement from user requirements and the working tree"
|
|
@@ -32,28 +50,24 @@
|
|
|
32
50
|
"globs": ["**/*.test.ts"]
|
|
33
51
|
},
|
|
34
52
|
"diagnostics-and-error-handling": {
|
|
35
|
-
"description": "Diagnostics: fix runtime failures at the source and keep the root cause"
|
|
53
|
+
"description": "Diagnostics: fix runtime failures at the source and keep the root cause",
|
|
54
|
+
"globs": ["**/*.ts", "**/*.js"]
|
|
36
55
|
},
|
|
37
56
|
"evidence-before-claims": {
|
|
38
57
|
"description": "Evidence: verify and cite a claim before stating or writing it"
|
|
39
58
|
},
|
|
40
|
-
"git-workflow": {
|
|
41
|
-
"description": "Git workflow: trunk-based branches, commits, and pull requests"
|
|
42
|
-
},
|
|
43
59
|
"no-suppression": {
|
|
44
60
|
"description": "Findings: fix scanner and linter reports without inline suppressions"
|
|
45
61
|
},
|
|
46
62
|
"platform-and-library-first": {
|
|
47
63
|
"description": "Platform and library first: use built-in features, then maintained libraries, then custom code"
|
|
48
64
|
},
|
|
49
|
-
"script-driven-changes": {
|
|
50
|
-
"description": "Scripts: apply a repeated edit across many files with a script"
|
|
51
|
-
},
|
|
52
65
|
"single-author-style": {
|
|
53
66
|
"description": "Sibling style: match layout, naming, and composition in the same project"
|
|
54
67
|
},
|
|
55
68
|
"structured-logging": {
|
|
56
|
-
"description": "Logging: log through a logging library in structured, durable records"
|
|
69
|
+
"description": "Logging: log through a logging library in structured, durable records",
|
|
70
|
+
"globs": ["**/*.ts", "**/*.js"]
|
|
57
71
|
},
|
|
58
72
|
"typescript-first": {
|
|
59
73
|
"description": "TypeScript-first: write source, tests, and scripts as .ts",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verifier
|
|
3
|
+
description: Runs the app and checks the change works before the session reports done
|
|
4
|
+
tools: Bash, Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Start the app with `pnpm start:dev`. Exercise the changed behavior and the two nearest neighboring flows. Report what you ran, what you saw, and any behavior that does not match plan.md. Do not fix anything; report only.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- ".agents/rules/**"
|
|
4
|
+
- ".agents/rules.json"
|
|
5
|
+
- ".agents/hooks/**"
|
|
6
|
+
- ".claude/settings.json"
|
|
7
|
+
- ".claude/rules/**"
|
|
8
|
+
- ".cursor/rules/**"
|
|
9
|
+
- ".cursor/hooks/**"
|
|
10
|
+
- ".cursor/hooks.json"
|
|
11
|
+
- "scripts/sync-agent-rules.ts"
|
|
12
|
+
- "scripts/check-agent-gates.ts"
|
|
13
|
+
- ".husky/**"
|
|
14
|
+
- ".commitlintrc.json"
|
|
15
|
+
- ".prettierrc.json"
|
|
16
|
+
- "eslint.config.ts"
|
|
17
|
+
- ".lintstagedrc.json"
|
|
18
|
+
- ".gitleaks.toml"
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Constitution Changes
|
|
22
|
+
|
|
23
|
+
The constitution is the set of files that agent settings deny to agents: rules, hooks, lint, format, and commit configuration, and the agent settings themselves. It is company policy.
|
|
24
|
+
|
|
25
|
+
A developer changes the constitution through a dedicated issue, never inside a feature pull request. When a task needs a constitution change, propose it to the user, reference that issue, and wait for it to merge before the task depends on it.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.ts"
|
|
4
|
+
- "**/*.js"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Diagnostics
|
|
8
|
+
|
|
9
|
+
Resolve runtime failures at the source with the language's standard narrowing, validation, and error types. For missing third-party types, take upstream definitions or a narrow adapter in the established location.
|
|
10
|
+
|
|
11
|
+
Surface errors at the caller or process boundary with diagnostic context. Handle an error to add context, recover, or translate it at an application boundary. Retain the root cause through the language's exception mechanism.
|
|
12
|
+
|
|
13
|
+
Report unresolved type, declaration, or rule conflicts to the user. Findings follow `no-suppression.md`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verifier
|
|
3
|
+
description: Runs the app and checks the change works before the session reports done
|
|
4
|
+
readonly: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Start the app with `pnpm start:dev`. Exercise the changed behavior and the two nearest neighboring flows. Report what you ran, what you saw, and any behavior that does not match plan.md. Do not fix anything; report only.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Constitution changes: change rules, hooks, and agent settings only through a dedicated issue"
|
|
3
|
+
globs: ".agents/rules/**,.agents/rules.json,.agents/hooks/**,.claude/settings.json,.claude/rules/**,.cursor/rules/**,.cursor/hooks/**,.cursor/hooks.json,scripts/sync-agent-rules.ts,scripts/check-agent-gates.ts,.husky/**,.commitlintrc.json,.prettierrc.json,eslint.config.ts,.lintstagedrc.json,.gitleaks.toml"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Constitution Changes
|
|
8
|
+
|
|
9
|
+
The constitution is the set of files that agent settings deny to agents: rules, hooks, lint, format, and commit configuration, and the agent settings themselves. It is company policy.
|
|
10
|
+
|
|
11
|
+
A developer changes the constitution through a dedicated issue, never inside a feature pull request. When a task needs a constitution change, propose it to the user, reference that issue, and wait for it to merge before the task depends on it.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Diagnostics: fix runtime failures at the source and keep the root cause"
|
|
3
|
+
globs: "**/*.ts,**/*.js"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Diagnostics
|
|
8
|
+
|
|
9
|
+
Resolve runtime failures at the source with the language's standard narrowing, validation, and error types. For missing third-party types, take upstream definitions or a narrow adapter in the established location.
|
|
10
|
+
|
|
11
|
+
Surface errors at the caller or process boundary with diagnostic context. Handle an error to add context, recover, or translate it at an application boundary. Retain the root cause through the language's exception mechanism.
|
|
12
|
+
|
|
13
|
+
Report unresolved type, declaration, or rule conflicts to the user. Findings follow `no-suppression.md`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Logging: log through a logging library in structured, durable records"
|
|
3
|
+
globs: "**/*.ts,**/*.js"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Logging
|
|
8
|
+
|
|
9
|
+
Application code logs through the stack's logging library or the framework's logger, never `console.*`. Write structured records, and send them to a store that keeps them longer than the host does.
|