@coding-with-hassan/devkit 1.3.0 → 1.5.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/README.md +75 -12
- package/claude/skills/add-error-code/SKILL.md +77 -0
- package/claude/skills/merge-upstream/SKILL.md +10 -5
- package/claude/skills/open-pr/SKILL.md +110 -0
- package/claude/skills/project-setup/SKILL.md +262 -0
- package/claude/skills/sync-theme/SKILL.md +141 -0
- package/claude/skills/ticket-graph/SKILL.md +115 -0
- package/claude/standards.md +39 -2
- package/package.json +1 -1
- package/src/commands/tickets.js +53 -0
- package/src/commands/tracker.js +31 -0
- package/src/core/agents-docs.js +19 -1
- package/src/core/claude.js +57 -7
- package/src/core/config.js +40 -6
- package/src/core/derive.js +9 -3
- package/src/core/tickets/graph.js +169 -0
- package/src/core/tracker/github.js +100 -1
- package/src/core/tracker/index.js +31 -4
- package/src/core/tracker/jira.js +182 -5
- package/src/core/worktrees.js +11 -4
- package/src/index.js +4 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The way of working of Hassan's client projects as one versioned package: parallel git worktrees with isolated Docker stacks, the pre-commit chain, a CI job with commit standards and an Nx cache, the Claude Code standards/agents/hooks, and the bilingual acceptance-test workbooks. A project installs it, fills one config block in `package.json`, runs `hassan-devkit init`, and picks up every later standard by bumping the version. Design: `docs/design/way-of-working.md`; decisions: `docs/adr/`.
|
|
4
4
|
|
|
5
|
-
New projects start from [hassan-devkit-template](https://github.com/CodiNG-With-Hassan/hassan-devkit-template),
|
|
5
|
+
New projects start from [hassan-devkit-template](https://github.com/CodiNG-With-Hassan/hassan-devkit-template): a maintained Nx `apps/*` + `libs/*` pnpm workspace in the shape of a real project (a NestJS API with the error-code contract, an Angular staff app, a server-rendered Angular customer site and the shared libs), already wired to this package. It reaches a running stack with `pnpm install` and `pnpm docker:dev:up`, and typing `/project-setup` in the fresh clone takes it to its setup PR (see [Claude Code layer](#claude-code-layer)). `init` is for adopting the devkit in a workspace that already exists.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -74,11 +74,13 @@ Everything a project declares lives in the `hassan-devkit` block of the root `pa
|
|
|
74
74
|
"ready": { "url": "http://localhost:${DEVKIT_PORT_API}/api-json" },
|
|
75
75
|
"env": { "API_PROXY_TARGET": "http://localhost:${DEVKIT_PORT_API}" }
|
|
76
76
|
},
|
|
77
|
-
"tracker": { "kind": "jira", "project": "DAZ", "baseUrl": "https://x.atlassian.net"
|
|
77
|
+
"tracker": { "kind": "jira", "project": "DAZ", "baseUrl": "https://x.atlassian.net",
|
|
78
|
+
"transitions": { "prOpened": "In Review", "merged": "Acceptance" } }, // optional, these are the defaults; null turns one off
|
|
78
79
|
// | { "kind": "github", "prefix": "GH" } | { "kind": "none" }
|
|
79
80
|
"commits": { "docsUrl": "https://…/Git+Workflow" }, // types/extraScopes/requireSigned/exemptAuthors have defaults
|
|
80
81
|
"ci": { "checks": [{ "name": "translations", "paths": ["^libs/i18n/"], "run": "pnpm exec nx run-many -t check-translations" }] },
|
|
81
|
-
"testCases": { "dir": "docs/testing", "languages": ["en", "nl"] }
|
|
82
|
+
"testCases": { "dir": "docs/testing", "languages": ["en", "nl"] },
|
|
83
|
+
"design": { "url": "https://claude.ai/artifact/…" } // the project's design system; the `sync-theme` skill reads it, and stores the link when it is missing
|
|
82
84
|
}
|
|
83
85
|
```
|
|
84
86
|
|
|
@@ -110,18 +112,45 @@ One worktree per ticket, each with its own Docker stack (own compose project, ho
|
|
|
110
112
|
- `hassan-devkit worktree:env [--slot N]` — refresh this checkout's managed block (keeps slot + profiles, recomputes the image tag, builds missing images, drops stale `node_modules` volumes). Refuses a slot another checkout holds. `docker:up` runs it implicitly.
|
|
111
113
|
- `hassan-devkit worktree:profiles list|add|remove <names>` — the compose profiles this stack runs (derived from the compose file; `worktree.profiles.required` cannot be removed).
|
|
112
114
|
- `hassan-devkit worktree:remove <BRANCH> [--keep-data] [--force]` — stack down (volumes deleted unless `--keep-data`), worktree removed, branch kept, unreferenced image tags garbage-collected.
|
|
113
|
-
- `hassan-devkit worktree:prune [--dry-run]` — remove every worktree whose PR is merged (`gh pr list --head`, base repo = `upstream`); dirty trees are never force-removed.
|
|
115
|
+
- `hassan-devkit worktree:prune [--dry-run]` — remove every worktree whose PR is merged (`gh pr list --head`, base repo = `upstream`) and report `merged` to the tracker for its ticket; dirty trees are never force-removed.
|
|
114
116
|
- `hassan-devkit worktree:list` — worktrees with slot, ports, profiles, image tag; warns on duplicate slots.
|
|
115
117
|
|
|
116
118
|
### Tracker adapters (`tracker.kind`)
|
|
117
119
|
|
|
118
|
-
| kind | on `worktree:create` | credentials |
|
|
119
|
-
| --- | --- | --- |
|
|
120
|
-
| `jira` | assign the branch's `<PROJECT>-<n>` ticket to you; `To Do` → `In Progress` | `JIRA_EMAIL`, `JIRA_API_TOKEN`, `JIRA_URL` from the environment or `~/.config/jira/env` |
|
|
121
|
-
| `github` | `gh issue edit <n> --add-assignee @me` on the base repo for a `<PREFIX>-<n>-…` branch; PR bodies end with `Closes #<n>` | `gh auth` |
|
|
122
|
-
| `none` | nothing | — |
|
|
120
|
+
| kind | on `worktree:create` | PR opened / PR merged | credentials |
|
|
121
|
+
| --- | --- | --- | --- |
|
|
122
|
+
| `jira` | assign the branch's `<PROJECT>-<n>` ticket to you; `To Do` → `In Progress` | move the ticket to `tracker.transitions.prOpened` (default `In Review`) / `.merged` (default `Acceptance`) | `JIRA_EMAIL`, `JIRA_API_TOKEN`, `JIRA_URL` from the environment or `~/.config/jira/env` |
|
|
123
|
+
| `github` | `gh issue edit <n> --add-assignee @me` on the base repo for a `<PREFIX>-<n>-…` branch; PR bodies end with `Closes #<n>` | nothing: an open PR stays the progress signal | `gh auth` |
|
|
124
|
+
| `none` | nothing | nothing | — |
|
|
123
125
|
|
|
124
|
-
|
|
126
|
+
- `hassan-devkit tracker:transition <TICKET> <prOpened|merged>` — report a PR event for a ticket (a key, or a branch name starting with it). The jira adapter moves the ticket to the status `tracker.transitions` names for the event, looked up by target status name among the ticket's available transitions; a ticket already in or past that status is left alone, and a key set to `null` turns the transition off. Run it with `prOpened` after opening the PR (the `open-pr` skill does); `worktree:prune` reports `merged` itself for the ticket of every worktree it removes.
|
|
127
|
+
|
|
128
|
+
All best effort: a missing token or unreachable tracker prints a `note:` and never blocks the worktree or fails the command (in `tracker:transition`, an unknown event name is a usage error and exits 1). `init` renders `docs/agents/issue-tracker.md`, `triage-labels.md` and `domain.md` from this config for the engineering skills.
|
|
129
|
+
|
|
130
|
+
### Ticket dependency chart (`tickets:graph`)
|
|
131
|
+
|
|
132
|
+
`hassan-devkit tickets:graph [--epic <KEY>] [--out <file>]` reads the configured tracker and prints the ticket dependencies as a Mermaid flowchart: what blocks what, and what can be started next.
|
|
133
|
+
|
|
134
|
+
- **Scope**: every ticket that is not done, plus the tickets that block them directly, so a done blocker one hop away stays visible. `--epic DAZ-241` (a bare `241` or `#241` works too) narrows to one epic and keeps the blockers from other epics.
|
|
135
|
+
- **Chart**: one subgraph per epic, an arrow from a blocker to the ticket it blocks, nodes coloured by status category (to do, in progress, done). **Ready tickets** — not started, every blocker done — are highlighted; a blocker that is not a node (an epic, an issue that could not be read) still counts until it is done. An edge that a longer path of unfinished tickets already implies is dropped (transitive reduction), so a project-wide chart stays readable.
|
|
136
|
+
- **Output**: the chart on stdout (everything else goes to stderr, so it pipes) and a Markdown page around it — chart, colour key, the ready tickets by name — in `docs/tickets/dependencies.md`. That path is in the managed `.gitignore` block (written by `init` and on every install); the chart is never committed. `--out <file>` writes somewhere else, relative to the cwd; a `.mmd` / `.mermaid` file gets the chart alone.
|
|
137
|
+
|
|
138
|
+
| kind | tickets | blocking edges | epic | status category |
|
|
139
|
+
| --- | --- | --- | --- | --- |
|
|
140
|
+
| `jira` | the issues of `tracker.project` that are not done, plus the issues blocking them; sub-tasks are left out | `Blocks` issue links | the parent | the status's own category |
|
|
141
|
+
| `github` | the open issues of the base repo, plus the issues they reference | `Blocked by #<n>` lines in the body (`Blocked by: #1, #2` and a `## Blocked by` section count too; a mention inside a sentence or a code fence does not) | the `Part of #<n>` line or `## Parent` section | closed is done, open with an assignee is in progress, open without one is to do |
|
|
142
|
+
| `none` | — the command exits with a note | | | |
|
|
143
|
+
|
|
144
|
+
Credentials are those of the adapters above. Unlike the `worktree:create` hook this is not best effort: a tracker that cannot be read fails the command.
|
|
145
|
+
|
|
146
|
+
**Unlinked dependencies (the `ticket-graph` skill).** The chart shows the dependencies the tracker holds as links; one that is only stated in a ticket description is missing from it, and the ticket it blocks can look ready. The house skill `ticket-graph` covers that gap. Asking Claude for the ticket graph, what blocks what or what to start next triggers it (or type `/ticket-graph`):
|
|
147
|
+
|
|
148
|
+
1. It runs `tickets:graph`, with `--epic` when you named one, and shows the chart.
|
|
149
|
+
2. It reads the descriptions of the tickets on the chart and looks for dependencies that have no link. One that is already linked, that the chart implies through a path of unfinished tickets, or that has a done ticket at either end is left out.
|
|
150
|
+
3. It shows the chart again with those as dashed edges and lists each with the sentence it came from.
|
|
151
|
+
4. It asks which ones to record. The confirmed ones become the links the command reads — a `Blocks` link in Jira, a `Blocked by #<n>` line appended to the GitHub issue body — and the command runs again, which shows whether each write landed.
|
|
152
|
+
|
|
153
|
+
Nothing is written to the tracker before that answer, and only the dependencies you picked are recorded.
|
|
125
154
|
|
|
126
155
|
### Pre-commit chain
|
|
127
156
|
|
|
@@ -157,11 +186,44 @@ The hook never rewrites silently. lint-staged re-stages the fixes `eslint --fix`
|
|
|
157
186
|
|
|
158
187
|
`hassan-devkit claude:install` (run by `prepare` and by `init`) wires the house standards into Claude Code without copying content:
|
|
159
188
|
|
|
160
|
-
- one `@import` line in the project's `CLAUDE.md` (`.claude/CLAUDE.md` when it exists) pulling `node_modules/@coding-with-hassan/devkit/claude/standards.md` — Docker via scripts, worktrees, commit/push consent + commit-writer, tickets, the acceptance-case quality gate, lint/format/CI parity, domain docs. In-repo imports load at launch without an approval dialog;
|
|
189
|
+
- one `@import` line in the project's `CLAUDE.md` (`.claude/CLAUDE.md` when it exists) pulling `node_modules/@coding-with-hassan/devkit/claude/standards.md` — Docker via scripts, worktrees, commit/push consent + commit-writer, tickets, the acceptance-case quality gate, lint/format/CI parity, domain docs, grilling rounds asked through the question dialog; where a house rule and a skill body differ, the house rule wins. In-repo imports load at launch without an approval dialog;
|
|
161
190
|
- `.claude/agents/commit-writer.md` as a **stub** whose body says "read the shipped file and follow it" — the stub never changes, the content ships with the devkit version;
|
|
162
|
-
- one `.claude/skills/<name>/SKILL.md` stub per skill, same pattern: the house skills `implement-ticket` and `
|
|
191
|
+
- one `.claude/skills/<name>/SKILL.md` stub per skill, same pattern: the house skills `add-error-code`, `implement-ticket`, `merge-upstream`, `open-pr`, `project-setup`, `sync-theme` and `ticket-graph` (bodies shipped by the devkit; all model-invocable except `open-pr` and `project-setup`, which are user-typed only — `merge-upstream` runs only when the user asks to bring `main` in or fix a PR's conflicts, since that ask is the consent for the merge commit; `open-pr` takes a ticket branch from finished work to an open PR, see below; `project-setup` takes a fresh template clone to its setup PR, see below; `add-error-code` names no project: it finds the API app, the i18n lib and the frontends from `hassan-devkit config:show --json` and follows the error-code contract from there; `sync-theme` derives the theme library from the project's design system, see below; `ticket-graph` is described under [Ticket dependency chart](#ticket-dependency-chart-ticketsgraph)) and every skill of the project's `mattpocock-skills` dependency — `init` adds `github:mattpocock/skills#v1.2.3` to `devDependencies`, a GitHub tarball pinned to an upstream release tag that pnpm integrity-locks — except `implement` and `setup-matt-pocock-skills`, which the house skill and `init` replace. The stub copies the skill's frontmatter verbatim (user-invocable-only skills stay user-only) and points at the body under `node_modules`. Stubs are derived on every install and **gitignored** through a managed block (which also lists the `tickets:graph` chart), so nothing is committed and a bump changes nothing in git; they are what makes the skills reach every clone and the skill pickers that only scan `.claude/skills` (T3 Code). A `SKILL.md` the project wrote itself at one of those paths (anything that is not a stub) is the project's own copy: it is neither overwritten nor gitignored, and `claude:install` prints a note until the folder is deleted, after which the stub takes over. Renovate bumps the tag (the shared preset automerges it), so an upstream skills release needs no devkit release;
|
|
163
192
|
- two managed hook entries merged idempotently into `.claude/settings.json`, both running `hassan-devkit claude:hook <id>` from the checkout's `node_modules` (recognised by that id, so a reworded command replaces the entry and the inline `jq` hook of devkit ≤ 1.2 is dropped): `pre-bash` (`PreToolUse` on `Bash`) denies `gh pr create` without `--assignee`, `docker compose` run directly, `git worktree add|remove|prune|…` and `git commit` on `ci.baseBranch` — each with the house command to use instead; `post-edit` (`PostToolUse` on `Edit|Write|MultiEdit`) runs `format:file` on the edited file and tells Claude to re-read it when Prettier changed it. The rules live in the package, so a bump adds a guard with nothing to re-commit; every hook fails open (a broken hook never blocks a tool call).
|
|
164
193
|
|
|
194
|
+
**`/open-pr`** closes a ticket's work in one user-typed step. The skill has `disable-model-invocation: true`, so Claude can never start it: typing it is the explicit ask for the commits, the push and the PR that the consent rule requires. In order, stopping at the first failure and reporting it:
|
|
195
|
+
|
|
196
|
+
1. the `merge-upstream` skill (canonical `main` in, conflicts resolved);
|
|
197
|
+
2. `hassan-devkit ci:check` and `hassan-devkit ci:affected`, on the working tree, so pending work is checked before it is committed (and checked again when the pre-commit hook rewrote a staged file);
|
|
198
|
+
3. the pending work committed through the `commit-writer` plan (skipped when there is none);
|
|
199
|
+
4. `git push -u origin <branch>`, never forced;
|
|
200
|
+
5. no open PR for the branch: `gh pr create --assignee @me`, titled `<TICKET> <Short title>` from the branch name, with a body written with the `pr` skill and ending with the tracker's ticket reference (`Closes #<n>` for GitHub); a PR already open: its body rewritten for the branch as it is now;
|
|
201
|
+
6. `hassan-devkit tracker:transition <TICKET> prOpened`;
|
|
202
|
+
7. the PR link.
|
|
203
|
+
|
|
204
|
+
It refuses to run on the base branch. When uncommitted work collides with what the merge brings in, a bare `merge-upstream` stops; here the ask for the commits is given, so the pending work is checked and committed first, then merged, and the checks run again on the merged result. The `pr` skill ships with `mattpocock-skills` from v1.3; on an older tag the body is a plain one (what changed and why, how it was verified, what to review).
|
|
205
|
+
|
|
206
|
+
**`sync-theme`** keeps the theme library in line with the project's design system, so the translation is no longer redone by prompt for each project and again at every design change. Asking Claude to sync or update the theme, the brand colours, the fonts or the logo from the design system triggers it (or type `/sync-theme`):
|
|
207
|
+
|
|
208
|
+
1. It takes the design system link from `hassan-devkit.design.url`. When the key is missing it asks for the link and stores it in the root `package.json`, so the next run needs no question.
|
|
209
|
+
2. It reads the design system (a Claude design system, read through the artifact tool): colours per colour scheme, typography, radii, spacing and the logo assets.
|
|
210
|
+
3. It updates the PrimeNG preset of the theme library, the font setup of every frontend and their logo and favicon. Values come from the design system, the structure stays the project's; a logo is copied, never redrawn. Nothing is at a fixed path: the theme library and the frontends are found through `hassan-devkit config:show --json`.
|
|
211
|
+
4. It runs `hassan-devkit ci:affected`, updates the acceptance cases that state what changed (a brand name, a logo) and reports four lists: what changed, what it derived (a ramp from a single brand colour), what in the design system has no counterpart in the preset, and what the theme keeps that the design system says nothing about.
|
|
212
|
+
|
|
213
|
+
It runs in a ticket worktree like any other change, stops on the base branch and never commits. A design token the theme has no place for is reported, not given a new token group: growing the theme stays your decision. A design system that cannot be read stops the skill; no value is guessed.
|
|
214
|
+
|
|
215
|
+
**`/project-setup`** turns a repository freshly created from the template into its project, up to the **setup PR**. Run it once, in the fresh clone after `pnpm install`. Like `/open-pr` it has `disable-model-invocation: true`: it writes outside the working tree (a ticket, a worktree, the repository's settings), so only you can start it. Every step first checks whether it is already done, so after an interruption you type it again and it continues where it stopped (the last step, the checks, runs on every run):
|
|
216
|
+
|
|
217
|
+
1. It asks for the project name, the tracker (a Jira project, or GitHub issues with a ticket key), the languages and a concept brief (a file or pasted text). It derives the slug, the database name and a set of host ports that collide with none of the projects checked out next to it, and shows them for correction.
|
|
218
|
+
2. It creates the setup ticket in the tracker, with the answers and the brief as its description, and the setup worktree: `hassan-devkit worktree:create <TICKET>-Project-Setup --no-up`.
|
|
219
|
+
3. It renames the template's placeholders in that worktree: the `hassan-devkit` config block, the project name (`template`, `Template`), the ticket key (`TPL`, and with it the `tpl-i18n` package), the host ports and the languages. Generated files are regenerated, not edited: the lockfile, the managed block of `.env.dist` and `docs/agents/*.md` (`hassan-devkit init --only env,agents`), the API spec and its packages (from the worktree's own stack, which starts here under the project's name), the acceptance workbooks.
|
|
220
|
+
4. It runs the `grill-with-docs` skill on the concept brief, which writes `CONTEXT.md` and an ADR for each decision the brief forces. `grill-with-docs` is user-typed only; typing `/project-setup` is the ask for it here.
|
|
221
|
+
5. It runs the `sync-theme` skill (skipped, and reported, when there is no design system yet).
|
|
222
|
+
6. It sets the repository settings: merge commits as the only merge method (a squash or a rebase drops the commits' signatures and standard subjects) and delete branch on merge. Branch rules are not set: they are unavailable on private repositories on the free plan. For Renovate it removes the template's own automerge rule from `renovate.json` and gives you the link to add the repository to the Renovate app, which a personal token cannot do.
|
|
223
|
+
7. It runs `hassan-devkit ci:check` and `hassan-devkit ci:affected`, then reports and hands over: you type `/open-pr` for the setup PR.
|
|
224
|
+
|
|
225
|
+
It never commits or pushes. Its report ends with what to do once the setup PR is merged: run `hassan-devkit worktree:prune` in the main checkout before bringing `main` in, because the setup worktree was created under the template's `worktree.baseDir` and the devkit stops looking there once the project's own config is in. The report also names what the merge does not reach: the main checkout's own `.env`, and with a Jira tracker the ticket's `merged` transition. Specs and tickets come after it, with the `to-spec` and `to-tickets` skills; deployment configuration is out of scope.
|
|
226
|
+
|
|
165
227
|
Project-specific rules stay in the project's own `CLAUDE.md` below the import. A devkit bump therefore changes what Claude does with nothing to re-commit.
|
|
166
228
|
|
|
167
229
|
### Acceptance test cases (`test-cases:generate`)
|
|
@@ -184,6 +246,7 @@ import { tc, type Area, type KnownIssue, type Readme } from '@coding-with-hassan
|
|
|
184
246
|
- **CI**: `init --only ci --force` writes the thin workflow; delete hand-rolled affected/cache scripts. Commit scopes are derived from the workspace (`commits:show`).
|
|
185
247
|
- **Claude**: `init --only claude,agents` adds the standards import, the stubs, the PR-assignee hook and regenerates `docs/agents`; trim your `CLAUDE.md` to project specifics.
|
|
186
248
|
- **Skills** (1.1): `init --only config` adds the `mattpocock-skills` devDependency; `pnpm install` then writes the skill stubs and the `.gitignore` block, and `claude:install` prints the one-off `git rm --cached` for the `implement-ticket` stub you committed under 1.0. With the plugin still enabled in `~/.claude`, a bare `/grilling` runs the project stub and `/mattpocock-skills:grilling` the plugin (same body).
|
|
249
|
+
- **`add-error-code`** (1.5): the skill ships with the devkit. A project with its own committed `.claude/skills/add-error-code/` keeps it, and `claude:install` says so on every install. To switch: `git rm -r .claude/skills/add-error-code`, `pnpm install` (writes the stub and adds the folder to the `.gitignore` block), commit the deletion with `.gitignore`. Keep the project's `.claude/rules/api-errors.md`: the shipped skill reads the project-specific names from it.
|
|
187
250
|
- Adopt piece by piece with `init --only <part>`; `ci:doctor` reports what is not adopted yet.
|
|
188
251
|
|
|
189
252
|
## Layout-agnostic commands
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-error-code
|
|
3
|
+
description: "Add a client-facing API error code end to end, the house error-code contract: the ErrorCode enum member in the API app, the text in every language's ERRORS catalog of the i18n lib plus the ERROR_CODES / ERROR_CODE_PARAMS mirrors, the spec and generated API packages regenerated from THIS worktree's running API, the reachability note and the acceptance cases. Use whenever a new failure needs a code, or check-translations fails on catalog/enum drift."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# add-error-code (body shipped by @coding-with-hassan/devkit)
|
|
7
|
+
|
|
8
|
+
The contract: the API returns codes, never user-facing text; the frontends translate each code
|
|
9
|
+
from one shared `ERRORS` catalog. A project that has adopted the contract states its own
|
|
10
|
+
version of it in `.claude/rules/api-errors.md` and the ADR that file names. When the file
|
|
11
|
+
exists, read both first: they give the names this file cannot know (the pipe that renders an
|
|
12
|
+
error, the scripts), and where they are more specific than this file, they win.
|
|
13
|
+
|
|
14
|
+
## 1. Find the pieces
|
|
15
|
+
|
|
16
|
+
Run `hassan-devkit config:show --json` from the checkout root. `derived.projects[]` lists every
|
|
17
|
+
workspace project with its `name`, `dir`, `kind` and `packageName`; nothing below is at a fixed
|
|
18
|
+
path, so take every path from there.
|
|
19
|
+
|
|
20
|
+
- **API app**: the project with `kind: "api"`. Its `src` holds the `ErrorCode` enum
|
|
21
|
+
(`grep -rn "enum ErrorCode" <api dir>/src`) and, next to it, `DomainException`. With more
|
|
22
|
+
than one `api` project, the one that holds the enum.
|
|
23
|
+
- **i18n lib**: the `kind: "lib"` project whose `src/errors/` holds the catalogs, one
|
|
24
|
+
`<lang>.json` per supported language. Those files are the language list: list the folder,
|
|
25
|
+
never assume a count. The same lib holds the mirrors `src/error-codes.ts` (`ERROR_CODES`) and
|
|
26
|
+
`src/error-code-params.ts` (`ERROR_CODE_PARAMS`), and its `README.md` has the "Register per
|
|
27
|
+
language" table.
|
|
28
|
+
- **Frontends**: every project with `kind: "spa"`, web and mobile alike.
|
|
29
|
+
- **Acceptance cases**: `config.testCases.dir` and `config.testCases.languages`.
|
|
30
|
+
`config.testCases` is `null` in a project that has not configured its acceptance cases.
|
|
31
|
+
|
|
32
|
+
Stop and report when a piece is missing (no `api` project, no `ErrorCode` enum, no
|
|
33
|
+
`src/errors/` catalogs). The project has not adopted the contract then; this skill adds a code
|
|
34
|
+
to an existing contract, and introducing the contract is a design decision for the user.
|
|
35
|
+
|
|
36
|
+
## 2. One change, in this order
|
|
37
|
+
|
|
38
|
+
Every partial state fails `check-translations` or the pre-commit guard.
|
|
39
|
+
|
|
40
|
+
1. **API**: add the enum member as `NAME = 'NAME'` (value equals name; append it to its domain
|
|
41
|
+
block) with a JSDoc line giving the HTTP status and, when it carries params, a
|
|
42
|
+
`` Params: `a`, `b` `` note. Throw it with
|
|
43
|
+
`new DomainException(ErrorCode.NAME, 'English debug message', HttpStatus.X, { a, b })`.
|
|
44
|
+
2. **Catalog**: add the text to every `<lang>.json` under the i18n lib's `src/errors/`, in the
|
|
45
|
+
register its README sets for that language, with counts phrased count-neutrally (never
|
|
46
|
+
`file(s)`). Add the code to `ERROR_CODES`. If the text interpolates `{{a}}`, add the code to
|
|
47
|
+
`ERROR_CODE_PARAMS`: the placeholders must be identical in every language, equal that entry,
|
|
48
|
+
and appear in the member's `Params:` note. Never add a catalog-only key: `UNKNOWN` is the
|
|
49
|
+
only one (hard-coded in the project's error-translations check script).
|
|
50
|
+
3. **Contract**: with THIS worktree's stack running (`pnpm docker:dev:up`, then
|
|
51
|
+
`pnpm docker:dev:logs` until the API has recompiled), run the project's contract script
|
|
52
|
+
(`pnpm api:types`; the root `package.json` and `.claude/rules/api-contract.md` name it). It
|
|
53
|
+
regenerates the OpenAPI spec and the generated API packages from this worktree's own port.
|
|
54
|
+
The regenerated files belong in the same commit as the enum change: the enum file is a
|
|
55
|
+
contract file, so the pre-commit guard rejects it without the spec, and the check fails
|
|
56
|
+
while the committed spec's `ErrorCode` enum differs from the API enum.
|
|
57
|
+
4. **Cache**: nothing to bump. The catalog is served un-hashed with `Cache-Control: no-cache`,
|
|
58
|
+
and every frontend's translation loader takes the frozen `I18N_CATALOG_VERSION` from the
|
|
59
|
+
i18n lib (`grep -rn I18N_CATALOG_VERSION` over the `spa` dirs finds them). Never reintroduce
|
|
60
|
+
a per-app `version` literal.
|
|
61
|
+
5. **Reachability**: every code must be reachable from some UI, or its enum JSDoc must state
|
|
62
|
+
that it is server-side-only (jobs, webhooks, mock-only endpoints).
|
|
63
|
+
6. **Acceptance cases**: cover the new user-visible failure in the `tc-data-*.ts` files under
|
|
64
|
+
`testCases.dir`, in every one of `testCases.languages`, then run
|
|
65
|
+
`hassan-devkit test-cases:generate`. With `testCases` `null`, skip this step and say in
|
|
66
|
+
the report that the failure has no acceptance case.
|
|
67
|
+
|
|
68
|
+
## 3. Verify before reporting
|
|
69
|
+
|
|
70
|
+
- `pnpm exec nx run-many -t check-translations` (catalog ↔ enum, mirrors, placeholders, the
|
|
71
|
+
language mirror and the committed spec's `ErrorCode` enum) and the contract drift check
|
|
72
|
+
(`pnpm api:types:check`).
|
|
73
|
+
- The new code is thrown from the API path that needs it and rendered by the UI that reaches
|
|
74
|
+
it, through `toErrorTranslation` and the pipe or component the project's
|
|
75
|
+
`.claude/rules/api-errors.md` names. Never a string literal, in the comparison or the text.
|
|
76
|
+
- Do not commit: report the change set as ready for review (the enum, the catalogs, the
|
|
77
|
+
mirrors, the spec and the generated packages, the acceptance cases).
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: merge-upstream
|
|
3
|
-
description: "Bring the canonical remote's main into the current checkout the house way: fetch, stop when up to date, merge (fast-forward only on the base branch), install the merged toolchain BEFORE completing a conflicted merge so the pre-commit fixers run with the presets upstream was formatted with, restore hook-rewritten files, then refresh what the merged files need.
|
|
4
|
-
disable-model-invocation: true
|
|
3
|
+
description: "Bring the canonical remote's main into the current checkout the house way: fetch, stop when up to date, merge (fast-forward only on the base branch), install the merged toolchain BEFORE completing a conflicted merge so the pre-commit fixers run with the presets upstream was formatted with, restore hook-rewritten files, then refresh what the merged files need. Use when the user asks to bring main in, update the branch or fix its PR's conflicts: that ask is the consent for the merge commit."
|
|
5
4
|
---
|
|
6
5
|
|
|
7
6
|
# merge-upstream (body shipped by @coding-with-hassan/devkit)
|
|
8
7
|
|
|
9
|
-
Bring the canonical `main` into the checkout you are in.
|
|
10
|
-
|
|
8
|
+
Bring the canonical `main` into the checkout you are in. Run it only when the user asks for
|
|
9
|
+
it in their own words, in the current request: typing `/merge-upstream`, typing `/open-pr`
|
|
10
|
+
(this skill is its first step), or asking to bring `main` in, update the branch or fix its PR's
|
|
11
|
+
conflicts. That ask is the consent for exactly one
|
|
12
|
+
commit, the merge commit. A branch that is merely behind, or a PR you notice conflicts, is never
|
|
13
|
+
a reason to run it unasked: report it and let the user decide. Never rebase (branches are shared
|
|
11
14
|
through their PRs and the house merges).
|
|
12
15
|
|
|
13
16
|
## 1. Where you are
|
|
@@ -81,4 +84,6 @@ know, reformats with old options) and the hook aborts the commit listing them.
|
|
|
81
84
|
|
|
82
85
|
One short message: the range merged (`<old>..<new>`, count of commits), whether conflicts were
|
|
83
86
|
resolved and in which files, whether `pnpm install` ran, and what the user still has to do
|
|
84
|
-
(restart, regenerate, re-run a build). Do not push
|
|
87
|
+
(restart, regenerate, re-run a build). Do not push unless the same request asked for it ("fix the
|
|
88
|
+
conflicts and push"); then run the project's pre-push checks first (`hassan-devkit ci:check`
|
|
89
|
+
and `hassan-devkit ci:affected`) and push only when they pass.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: open-pr
|
|
3
|
+
description: "From finished work to an open pull request in one go, the house way: bring the canonical main in, run ci:check and ci:affected, commit the pending work through the commit-writer plan, push, open the PR (or rewrite the body of the one already open) and report it to the tracker. User-typed only: typing /open-pr is the explicit ask for the commits, the push and the PR."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# open-pr (body shipped by @coding-with-hassan/devkit)
|
|
8
|
+
|
|
9
|
+
Take the branch you are on from finished work to an open pull request. Only the user starts
|
|
10
|
+
this skill: typing `/open-pr` in the current request is their explicit ask for everything
|
|
11
|
+
below — the commits (the merge commit of step 1 among them), the push and the PR. If you are
|
|
12
|
+
reading this file for any other reason (another skill or a plan pointed here, the work looks
|
|
13
|
+
ready to you), stop: that is not consent.
|
|
14
|
+
|
|
15
|
+
Run the steps in order. Stop at the first failure and report it: the step, the output that
|
|
16
|
+
shows the failure, and what is already done (merged, committed, pushed). Do not repair a failed
|
|
17
|
+
check and carry on; the one exception is the hook rewrite in step 3. Never get past a step by
|
|
18
|
+
going around it (`--no-verify`, a forced push).
|
|
19
|
+
|
|
20
|
+
## Before step 1: where you are
|
|
21
|
+
|
|
22
|
+
- Run everything from the checkout's root (`git rev-parse --show-toplevel`).
|
|
23
|
+
- Canonical remote: `upstream` when it exists (`git remote get-url upstream`), else `origin`.
|
|
24
|
+
Base branch: `ci.baseBranch` from `hassan-devkit config:show --json` (default `main`).
|
|
25
|
+
- Branch: `git branch --show-current`. On the base branch, or on no branch at all, refuse: stop
|
|
26
|
+
and say that ticket work lives in a worktree (`hassan-devkit worktree:create
|
|
27
|
+
<TICKET>-<Short-Title>`). Nothing is merged, committed or pushed.
|
|
28
|
+
- Ticket: the key the branch name starts with (`<TICKET>-<Short-Title>`; `hassan-devkit
|
|
29
|
+
commits:show` prints its pattern). With the tracker `none` there is no ticket: the title and
|
|
30
|
+
the body in step 5 then carry none.
|
|
31
|
+
|
|
32
|
+
## 1. Bring `main` in
|
|
33
|
+
|
|
34
|
+
Run the `merge-upstream` skill, with these differences:
|
|
35
|
+
|
|
36
|
+
- Typing `/open-pr` is the consent for its merge commit.
|
|
37
|
+
- Up to date is not a stop here: go on with step 2.
|
|
38
|
+
- It stops when an incoming path is also modified and uncommitted in this checkout. Here the
|
|
39
|
+
user has asked for the commits, so do steps 2 and 3 first (check the pending work, then
|
|
40
|
+
commit it), run the merge again and resolve what conflicts, then run step 2 again on the
|
|
41
|
+
merged result. Nothing is committed unchecked, and nothing unchecked is pushed.
|
|
42
|
+
- Do not send its report. Keep the facts (range merged, conflicts resolved, installs run) for
|
|
43
|
+
step 7.
|
|
44
|
+
|
|
45
|
+
## 2. Run what CI runs
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
hassan-devkit ci:check
|
|
49
|
+
hassan-devkit ci:affected
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Both read the working tree, so the uncommitted work is checked too. A failure in either one:
|
|
53
|
+
stop and report it.
|
|
54
|
+
|
|
55
|
+
## 3. Commit the pending work
|
|
56
|
+
|
|
57
|
+
`git status --porcelain` prints nothing: there is nothing to commit, go to step 4.
|
|
58
|
+
|
|
59
|
+
Otherwise invoke the `commit-writer` agent on the full pending change set BEFORE staging
|
|
60
|
+
anything, giving it the ticket. Execute its plan verbatim: per commit, stage the listed files
|
|
61
|
+
and commit with the drafted message, one commit at a time, in order. Commits are signed and
|
|
62
|
+
carry no AI attribution.
|
|
63
|
+
|
|
64
|
+
When the pre-commit hook aborts because it rewrote staged files, the fixes are already staged:
|
|
65
|
+
review them (`git diff --cached`), run step 2 again because the tree changed, then run the same
|
|
66
|
+
commit again. Any other hook or signing failure: stop and report it.
|
|
67
|
+
|
|
68
|
+
## 4. Push
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
git push -u origin <branch>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`origin` is where your branches go: the canonical repository, or your fork of it. A rejected
|
|
75
|
+
push means the remote branch has commits this checkout lacks: stop and report it.
|
|
76
|
+
|
|
77
|
+
## 5. Open the PR, or bring the open one up to date
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
gh pr list --head <branch> --state open --json number,url
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Write the body to a temporary file outside the checkout, then:
|
|
84
|
+
|
|
85
|
+
- **No open PR**: `gh pr create --assignee @me --base <base> --title "<title>" --body-file <file>`.
|
|
86
|
+
The title is the branch's ticket followed by its short title as words:
|
|
87
|
+
`<TICKET>-Fix-Login-Redirect` becomes `<TICKET> Fix login redirect`.
|
|
88
|
+
- **The body** describes the whole branch as it is now, from `git log <remote>/<base>..HEAD`
|
|
89
|
+
and `git diff <remote>/<base>...HEAD`: not the latest commits, not the conversation. Write it
|
|
90
|
+
with the `pr` skill when the project has one (`.claude/skills/pr/SKILL.md`); without it, say
|
|
91
|
+
what changed and why, how it was verified, and what a reviewer should look at. Its last line
|
|
92
|
+
is the tracker's ticket reference: `Closes #<n>` for GitHub issues, so the issue closes on
|
|
93
|
+
merge; the ticket key on a line of its own for a tracker without a closing keyword.
|
|
94
|
+
- **A PR already open**: `gh pr edit <number> --body-file <file>`. Rewrite the whole body the
|
|
95
|
+
same way; do not append an update note to the old one.
|
|
96
|
+
|
|
97
|
+
## 6. Report the PR to the tracker
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
hassan-devkit tracker:transition <TICKET> prOpened
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Run it whether the PR was created or updated; the branch name works as `<TICKET>`. The command
|
|
104
|
+
is best effort by design: it exits 0, and a `note:` means the tracker moved nothing. Pass the
|
|
105
|
+
note on in step 7; it is not a failure. Skip this step with the tracker `none`.
|
|
106
|
+
|
|
107
|
+
## 7. Report
|
|
108
|
+
|
|
109
|
+
The PR link first. Then, briefly: created or updated, what step 1 merged (or that the branch
|
|
110
|
+
was up to date), the commits made, and any `note:` from step 6.
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-setup
|
|
3
|
+
description: "Turn a repository freshly created from the template into its project, up to the setup PR: asks for the project name, the tracker, the languages and a concept brief, creates the setup ticket and its worktree, renames the template's placeholders, writes the glossary and the first ADRs from the brief with grill-with-docs, applies the design system with sync-theme, sets the repository settings and Renovate, runs the project checks and hands over to /open-pr. Run once per project; every step first checks whether it is already done, so it can be re-run after an interruption. User-typed only: typing /project-setup is the ask for the ticket, the worktree and the repository settings."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# project-setup (body shipped by @coding-with-hassan/devkit)
|
|
8
|
+
|
|
9
|
+
Take a repository freshly created from the template ("Use this template", cloned, `pnpm
|
|
10
|
+
install` run) to its **setup PR**: the pull request that turns the template into this project.
|
|
11
|
+
Only the user starts this skill. Typing `/project-setup` is their ask for what it does outside
|
|
12
|
+
the working tree: a ticket in the tracker, a worktree and the repository's settings. It is not
|
|
13
|
+
an ask for commits or a push: those belong to `/open-pr`, which the user types when this skill
|
|
14
|
+
has finished.
|
|
15
|
+
|
|
16
|
+
Run the steps in order. Every step opens with **Already done**: check that first, and when it
|
|
17
|
+
holds, say so in one line and go to the next step. That is what lets a second run, after an
|
|
18
|
+
interruption, continue where the first one stopped. Stop at the first failure and report it:
|
|
19
|
+
the step, the output that shows the failure, and what is already done. Something only the user
|
|
20
|
+
can do (a Jira project that does not exist, an app to install on the repository) is handed to
|
|
21
|
+
them with its link, never worked around.
|
|
22
|
+
|
|
23
|
+
The skill ends at the setup PR. Specs and tickets are the next stage, with the `to-spec` and
|
|
24
|
+
`to-tickets` skills. Deployment configuration is out of scope.
|
|
25
|
+
|
|
26
|
+
## Before step 1: where you are
|
|
27
|
+
|
|
28
|
+
In the main checkout, run `hassan-devkit config:show --json` and `hassan-devkit worktree:list`.
|
|
29
|
+
|
|
30
|
+
The template's placeholders are the project name `template` (`Template` in titles), the ticket
|
|
31
|
+
key `TPL` with the `tpl-i18n` package named after it, and its host ports. A repository still
|
|
32
|
+
has them when `config.worktree.projectName` is `template`.
|
|
33
|
+
|
|
34
|
+
- **Fresh**: the placeholders are there and no worktree's branch ends in `-Project-Setup`.
|
|
35
|
+
Start at step 1.
|
|
36
|
+
- **Under way**: a worktree's branch ends in `-Project-Setup`. That is the **setup worktree**,
|
|
37
|
+
and its branch name starts with the setup ticket. Go through the steps: their checks find the
|
|
38
|
+
first one left to do.
|
|
39
|
+
- **Set up**: no placeholders on the base branch and no such worktree. This repository already
|
|
40
|
+
is its project: say so and stop. Renaming a project later is ordinary ticket work.
|
|
41
|
+
|
|
42
|
+
Steps 1 and 2 run in the main checkout and change no file there. From step 3 on, every command
|
|
43
|
+
runs in the setup worktree and every edit lands there.
|
|
44
|
+
|
|
45
|
+
## 1. Ask
|
|
46
|
+
|
|
47
|
+
**Already done** when the setup ticket exists: its description holds the answers, because step 2
|
|
48
|
+
writes them there. Read them back and ask only for one that is missing.
|
|
49
|
+
|
|
50
|
+
Ask in one round, in the question dialog when the harness has one:
|
|
51
|
+
|
|
52
|
+
1. **Project name**, as people write it (`Acme Rentals`).
|
|
53
|
+
2. **Tracker**: a Jira project (its key and the site URL), or the GitHub issues of this
|
|
54
|
+
repository (then a short upper-case key the user picks for the ticket prefix). Either answer
|
|
55
|
+
gives the project's `<KEY>`.
|
|
56
|
+
3. **Languages** the apps ship in, as language codes, the fallback first.
|
|
57
|
+
4. **Concept brief**: a file or pasted text that says what the product is, who uses it and
|
|
58
|
+
what it has to do. Read a file in full.
|
|
59
|
+
|
|
60
|
+
Derive the rest and show it with the answers, so the user can correct a value before anything
|
|
61
|
+
is created:
|
|
62
|
+
|
|
63
|
+
- **Slug**: the name in lower case with hyphens (`acme-rentals`). It names the root package,
|
|
64
|
+
the compose project, the dev images and the worktree folder.
|
|
65
|
+
- **Database name**: the slug with underscores (`acme_rentals`).
|
|
66
|
+
- **Host ports**: the template's base ports, all moved by one offset. Slot n adds n × 10, so
|
|
67
|
+
two base ports collide when they differ by a multiple of 10 that is at most
|
|
68
|
+
`config.worktree.maxSlot` × 10. Read `hassan-devkit.worktree.ports` in the `package.json` of
|
|
69
|
+
the checkouts next to this one, try the offsets 100, 200, 300 and so on, and take the first
|
|
70
|
+
whose ports collide with none of those and none of the template's own.
|
|
71
|
+
|
|
72
|
+
Done when the name, the slug, the database name, the tracker with its `<KEY>`, the languages,
|
|
73
|
+
the ports and the text of the concept brief are settled.
|
|
74
|
+
|
|
75
|
+
## 2. Setup ticket and setup worktree
|
|
76
|
+
|
|
77
|
+
**Already done** when `hassan-devkit worktree:list` shows a branch ending in `-Project-Setup`.
|
|
78
|
+
When only the ticket exists (one titled `Project setup` in the tracker), reuse it and create
|
|
79
|
+
the worktree.
|
|
80
|
+
|
|
81
|
+
Create the ticket, titled `Project setup`. Its description is the record a later run reads
|
|
82
|
+
back: the answers and the derived values of step 1, then the concept brief in full.
|
|
83
|
+
|
|
84
|
+
- **GitHub**: `gh issue create --title "Project setup" --body-file <file> --assignee @me`, with
|
|
85
|
+
the body in a temporary file outside the checkout. The ticket is `<KEY>-<n>`, `<n>` being the
|
|
86
|
+
issue number.
|
|
87
|
+
- **Jira**: confirm the project exists first (`GET /rest/api/3/project/<KEY>`), then create a
|
|
88
|
+
Task: the Atlassian MCP's `createJiraIssue` when it is connected, else
|
|
89
|
+
`POST /rest/api/3/issue` on the site URL with the credentials in `~/.config/jira/env`
|
|
90
|
+
(`JIRA_EMAIL`, `JIRA_API_TOKEN`). Assign it to the user (`GET /rest/api/3/myself`, then
|
|
91
|
+
`PUT /rest/api/3/issue/<TICKET>/assignee`) and move it to the status that means in progress.
|
|
92
|
+
The config still names the template's tracker, so `worktree:create` does neither. A project
|
|
93
|
+
that does not exist, or missing credentials: stop and report. Never create the Jira project.
|
|
94
|
+
|
|
95
|
+
Then, in the main checkout:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
hassan-devkit worktree:create <TICKET>-Project-Setup --no-up
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`--no-up` because a stack started now would be built under the template's names; step 3
|
|
102
|
+
starts it after the rename. The worktree lands under the template's `worktree.baseDir`. That
|
|
103
|
+
is expected: see "After the merge" in step 7. A stack running in the main checkout is the
|
|
104
|
+
template's too: stop it there with `pnpm docker:dev:down`.
|
|
105
|
+
|
|
106
|
+
## 3. Rename the placeholders
|
|
107
|
+
|
|
108
|
+
**Already done** when, in the setup worktree, `config.worktree.projectName` is the slug,
|
|
109
|
+
`config.tracker` is the project's tracker and the searches of points 2 and 3 print nothing
|
|
110
|
+
that is still a placeholder. After an interruption, those searches are the list of what is
|
|
111
|
+
left.
|
|
112
|
+
|
|
113
|
+
1. **The config block.** In the root `package.json`: the package name (`<slug>-monorepo`)
|
|
114
|
+
and, in the `hassan-devkit` block, `worktree.baseDir` (`../<slug>-worktrees`),
|
|
115
|
+
`worktree.projectName`, `worktree.ports`, `tracker`
|
|
116
|
+
(`{ "kind": "jira", "project": "<KEY>", "baseUrl": "<site>" }` or
|
|
117
|
+
`{ "kind": "github", "prefix": "<KEY>" }`), the package named in `ci.affected.adopted`,
|
|
118
|
+
`testCases.title`, `testCases.languages` and `db.name`. Run `hassan-devkit config:check`.
|
|
119
|
+
2. **The names.** `git grep -n -I -i -e template -e tpl -- . ':!pnpm-lock.yaml'` lists every
|
|
120
|
+
candidate. Go through all of them:
|
|
121
|
+
|
|
122
|
+
| Placeholder | Becomes | Found in |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `template` as a name | the slug | the compose project and its fallbacks, dev image and volume names, stack guards in scripts, the editor workspace file (rename the file too), folder names in the docs |
|
|
125
|
+
| `template` as the database | the database name | `.env.dist`, the server list of the database tooling |
|
|
126
|
+
| `Template`, `TEMPLATE` | the project name | page titles, the API title, the start pages' copy in every language, the acceptance cases, the wordmark and its accessible name, headings in the docs |
|
|
127
|
+
| `TPL`, `tpl` | `<KEY>`, in the same case | branch and ticket examples in the docs |
|
|
128
|
+
| `tpl-i18n` | `<key>-i18n` | the package's own name, every import, the frontends' asset globs and prebundle excludes, the install filters of the Dockerfiles, the docs |
|
|
129
|
+
|
|
130
|
+
The word stays where it is not the placeholder: an Angular template (`templateUrl`,
|
|
131
|
+
`ng-template`), the devkit's workflow template. Text that describes the repository as a
|
|
132
|
+
template (every name is a placeholder, how to start a project from it, how the template is
|
|
133
|
+
maintained) is rewritten for the project or removed.
|
|
134
|
+
3. **The ports.** `git grep -n -I -w -e <port>` with one `-e` per base port of the template.
|
|
135
|
+
Only the host side moves: the `${DEVKIT_PORT_<NAME>:-<port>}` fallbacks of the compose
|
|
136
|
+
file, the CORS origins of `.env.dist`, the host fallbacks in scripts (a proxy target, the
|
|
137
|
+
spec URL) and the port tables in the docs. The managed block of `.env.dist` is not edited
|
|
138
|
+
by hand: point 5 regenerates it. Inside the compose
|
|
139
|
+
network every service keeps its standard port: `EXPOSE`, `PORT=`, the right-hand side of a
|
|
140
|
+
port mapping, `http://<service>:<port>`, a dev server's own port and the database's
|
|
141
|
+
`DB_PORT` are not placeholders.
|
|
142
|
+
4. **The languages.** When they differ from the template's, add and remove languages the way
|
|
143
|
+
the project's i18n rule describes under "Adding a language" (`.claude/rules/i18n.md`); a
|
|
144
|
+
removed language leaves the same places. The first one is the fallback.
|
|
145
|
+
`testCases.languages` takes only the languages the workbook generator has strings for:
|
|
146
|
+
`hassan-devkit test-cases:generate` names them when one is missing. Such a language still
|
|
147
|
+
ships in the apps, and step 7 reports it as having no acceptance workbook yet.
|
|
148
|
+
5. **What is generated is regenerated, never edited.**
|
|
149
|
+
- `pnpm install`, not frozen: the lockfile names the renamed package.
|
|
150
|
+
- `hassan-devkit init --only env,agents` rewrites the managed block of `.env.dist` (compose
|
|
151
|
+
project, ports, URLs) and `docs/agents/*.md` for the new tracker.
|
|
152
|
+
- The worktree's own `.env` was written before the rename and is not in git. Bring the part
|
|
153
|
+
above the managed block in line with the renamed `.env.dist`, then run
|
|
154
|
+
`pnpm docker:dev:up`: it rewrites the managed block for the new ports and builds the
|
|
155
|
+
images under the project's name.
|
|
156
|
+
- The API spec and the packages generated from it carry the API title. Once the URL in
|
|
157
|
+
`API_SPEC_URL` of the worktree's `.env` answers, regenerate them the way the project's
|
|
158
|
+
API contract rule says (`pnpm api:types` in the template), from this worktree's stack
|
|
159
|
+
only.
|
|
160
|
+
- `hassan-devkit test-cases:generate`.
|
|
161
|
+
|
|
162
|
+
Done when the searches are clean and the stack of the setup worktree answers under the
|
|
163
|
+
project's name.
|
|
164
|
+
|
|
165
|
+
## 4. Glossary and first ADRs
|
|
166
|
+
|
|
167
|
+
**Already done** when `CONTEXT.md` exists at the root of the setup worktree and the project's
|
|
168
|
+
`CLAUDE.md` no longer says the glossary is still to be written: that sentence is the last
|
|
169
|
+
thing this step changes. `CONTEXT.md` alone means a session was interrupted: resume it from
|
|
170
|
+
what the glossary and the ADRs already hold.
|
|
171
|
+
|
|
172
|
+
Run the `grill-with-docs` skill on the concept brief, never the plain `grilling` skill:
|
|
173
|
+
without the docs half, what the session settles is written nowhere. It is a user-typed skill,
|
|
174
|
+
and `/project-setup` is the ask for it here: read `.claude/skills/grill-with-docs/SKILL.md`
|
|
175
|
+
and follow it.
|
|
176
|
+
|
|
177
|
+
The brief is the plan being grilled. Settle the domain language (the things, the people, the
|
|
178
|
+
states, what each word excludes) and the decisions the brief forces. Features are not
|
|
179
|
+
specified here: that is `to-spec`, later.
|
|
180
|
+
|
|
181
|
+
Done when the user ends the session, with:
|
|
182
|
+
|
|
183
|
+
- `CONTEXT.md` at the root: the glossary of the terms the session resolved;
|
|
184
|
+
- the first ADRs under `docs/adr/`, numbered on from the ones the template ships, for the
|
|
185
|
+
decisions that are hard to reverse, surprising without context and the result of a real
|
|
186
|
+
trade-off. None is a valid outcome;
|
|
187
|
+
- the project's `CLAUDE.md` no longer saying that the glossary is still to be written.
|
|
188
|
+
|
|
189
|
+
## 5. Theme
|
|
190
|
+
|
|
191
|
+
**Already done** when `config.design.url` is set in the setup worktree and `git status` shows
|
|
192
|
+
the theme library changed.
|
|
193
|
+
|
|
194
|
+
Run the `sync-theme` skill in the setup worktree. It asks for the design system link and
|
|
195
|
+
stores it. When the user has no design system yet, skip this step and say so in step 7: the
|
|
196
|
+
placeholder theme stays, and `sync-theme` runs later in a ticket worktree of its own.
|
|
197
|
+
|
|
198
|
+
## 6. Repository settings and Renovate
|
|
199
|
+
|
|
200
|
+
**Already done** for the settings when
|
|
201
|
+
`gh repo view --json mergeCommitAllowed,squashMergeAllowed,rebaseMergeAllowed,deleteBranchOnMerge`
|
|
202
|
+
shows merge commits as the only merge method and branch deletion on. For the dependency
|
|
203
|
+
updates when the repository has a pull request or an issue by their app
|
|
204
|
+
(`gh pr list --state all --author app/renovate`, the same with `gh issue list`).
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
gh repo edit --enable-merge-commit --enable-squash-merge=false --enable-rebase-merge=false --delete-branch-on-merge
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Merge commits only: a squash or a rebase rewrites the commits, which drops their signatures
|
|
211
|
+
and their standard subjects. The command needs admin rights on the repository; a refusal is
|
|
212
|
+
reported, not worked around.
|
|
213
|
+
|
|
214
|
+
Branch rules are not set: they are unavailable on private repositories on the free plan. Do
|
|
215
|
+
not try them, and never propose making the repository public to get them.
|
|
216
|
+
|
|
217
|
+
Then Renovate:
|
|
218
|
+
|
|
219
|
+
- `renovate.json` already extends the shared preset. Remove the template's own package rule
|
|
220
|
+
from it, the one that merges devkit bumps unattended (its description says it is the
|
|
221
|
+
template's), unless the user wants that for this project too.
|
|
222
|
+
- The Renovate app has to reach the repository, and a personal token cannot install it. When
|
|
223
|
+
the check above finds nothing, give the user the link
|
|
224
|
+
`https://github.com/apps/renovate/installations/new` to add the repository (an organisation
|
|
225
|
+
that gave the app all its repositories needs nothing), list it under "Left for you" in
|
|
226
|
+
step 7 and go on. Do not wait for it.
|
|
227
|
+
|
|
228
|
+
## 7. Checks and handover
|
|
229
|
+
|
|
230
|
+
**Already done** never applies here: run this step on every run. It is the proof of the steps
|
|
231
|
+
before it.
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
hassan-devkit ci:check
|
|
235
|
+
hassan-devkit ci:affected
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Both read the working tree, so the uncommitted setup is what they check. Fix what the rename
|
|
239
|
+
broke (a missed import, a file that was not regenerated) and run them again. Any other
|
|
240
|
+
failure: stop and report it.
|
|
241
|
+
|
|
242
|
+
Do not commit. Report the change set as ready, in this order:
|
|
243
|
+
|
|
244
|
+
1. **Done**: per step, what this run did and what it found already done; the setup ticket with
|
|
245
|
+
its link and the path of the setup worktree.
|
|
246
|
+
2. **Left for you**: the Renovate app when it was not found, the theme when step 5 was
|
|
247
|
+
skipped, a language without an acceptance workbook, anything a step could not do.
|
|
248
|
+
3. **Next**: type `/open-pr`. In this conversation it runs in the setup worktree: it commits
|
|
249
|
+
the setup, pushes it and opens the setup PR.
|
|
250
|
+
4. **After the merge**, in the main checkout and in this order:
|
|
251
|
+
1. `hassan-devkit worktree:prune`, BEFORE bringing `main` in. The main checkout still has
|
|
252
|
+
the template's `worktree.baseDir`, which is where the setup worktree lives. Once `main`
|
|
253
|
+
is in, the devkit looks in the project's own folder and never finds it.
|
|
254
|
+
2. `git fetch <remote> && git merge --ff-only <remote>/main`, then `pnpm install`.
|
|
255
|
+
3. The main checkout's own `.env`, when it has one, still holds the template's values above
|
|
256
|
+
the managed block (the database name, the CORS origins), and every new worktree copies
|
|
257
|
+
them. Bring that part in line with `.env.dist`.
|
|
258
|
+
4. With a Jira tracker: `hassan-devkit tracker:transition <TICKET> merged`. The prune ran on
|
|
259
|
+
the template's config and reported nothing to it.
|
|
260
|
+
|
|
261
|
+
Then come the specs and the tickets: `to-spec` on the brief and the glossary, `to-tickets` on
|
|
262
|
+
the spec.
|