chief-clancy 0.1.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/LICENSE +21 -0
- package/README.md +426 -0
- package/bin/install.js +169 -0
- package/package.json +42 -0
- package/registry/boards.json +47 -0
- package/src/agents/arch-agent.md +72 -0
- package/src/agents/concerns-agent.md +89 -0
- package/src/agents/design-agent.md +130 -0
- package/src/agents/quality-agent.md +161 -0
- package/src/agents/tech-agent.md +92 -0
- package/src/commands/doctor.md +7 -0
- package/src/commands/help.md +50 -0
- package/src/commands/init.md +7 -0
- package/src/commands/logs.md +7 -0
- package/src/commands/map-codebase.md +16 -0
- package/src/commands/once.md +13 -0
- package/src/commands/review.md +9 -0
- package/src/commands/run.md +11 -0
- package/src/commands/settings.md +7 -0
- package/src/commands/status.md +9 -0
- package/src/commands/uninstall.md +5 -0
- package/src/commands/update-docs.md +9 -0
- package/src/commands/update.md +9 -0
- package/src/templates/.env.example.github +43 -0
- package/src/templates/.env.example.jira +53 -0
- package/src/templates/.env.example.linear +43 -0
- package/src/templates/CLAUDE.md +69 -0
- package/src/templates/scripts/clancy-afk.sh +111 -0
- package/src/templates/scripts/clancy-once-github.sh +225 -0
- package/src/templates/scripts/clancy-once-linear.sh +252 -0
- package/src/templates/scripts/clancy-once.sh +259 -0
- package/src/workflows/doctor.md +115 -0
- package/src/workflows/init.md +423 -0
- package/src/workflows/logs.md +82 -0
- package/src/workflows/map-codebase.md +124 -0
- package/src/workflows/once.md +80 -0
- package/src/workflows/review.md +165 -0
- package/src/workflows/run.md +119 -0
- package/src/workflows/scaffold.md +289 -0
- package/src/workflows/settings.md +344 -0
- package/src/workflows/status.md +120 -0
- package/src/workflows/uninstall.md +75 -0
- package/src/workflows/update-docs.md +89 -0
- package/src/workflows/update.md +67 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Clancy Review Workflow
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Fetch the next ticket from the board and score how well-specified it is. Returns a confidence score (0–100%) and actionable recommendations. Does not implement anything.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1 — Preflight checks
|
|
10
|
+
|
|
11
|
+
Same as status workflow. Check `.clancy/`, `.clancy/.env`, and board credentials.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Step 2 — Fetch next ticket
|
|
16
|
+
|
|
17
|
+
Detect board from `.clancy/.env` and fetch with `maxResults=1`. The query must match `clancy-once.sh` exactly — what review shows is what run would pick up.
|
|
18
|
+
|
|
19
|
+
**Jira:** Build JQL using the same clauses as `clancy-once.sh`:
|
|
20
|
+
- Sprint clause: include `AND sprint in openSprints()` if `CLANCY_JQL_SPRINT` is set
|
|
21
|
+
- Label clause: include `AND labels = "$CLANCY_LABEL"` if `CLANCY_LABEL` is set
|
|
22
|
+
- `CLANCY_JQL_STATUS` defaults to `To Do` if not set
|
|
23
|
+
|
|
24
|
+
Full JQL: `project=$JIRA_PROJECT_KEY [AND sprint in openSprints()] [AND labels = "$CLANCY_LABEL"] AND assignee=currentUser() AND status="$CLANCY_JQL_STATUS" ORDER BY priority ASC`
|
|
25
|
+
|
|
26
|
+
Use the POST `/rest/api/3/search/jql` endpoint (the old GET `/rest/api/3/search` was removed Aug 2025):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
RESPONSE=$(curl -s \
|
|
30
|
+
-u "$JIRA_USER:$JIRA_API_TOKEN" \
|
|
31
|
+
-X POST \
|
|
32
|
+
-H "Content-Type: application/json" \
|
|
33
|
+
-H "Accept: application/json" \
|
|
34
|
+
"$JIRA_BASE_URL/rest/api/3/search/jql" \
|
|
35
|
+
-d '{"jql": "<jql as above>", "maxResults": 1, "fields": ["summary", "description", "issuelinks", "parent", "customfield_10014"]}')
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**GitHub Issues:** `GET /repos/$GITHUB_REPO/issues?state=open&assignee=@me&labels=clancy&per_page=1` — filter out PRs (entries with `pull_request` key)
|
|
39
|
+
|
|
40
|
+
**Linear:** GraphQL `viewer.assignedIssues` with `filter: { state: { type: { eq: "unstarted" } }, team: { id: { eq: "$LINEAR_TEAM_ID" } }[, labels: { name: { eq: "$CLANCY_LABEL" } }] }` (label clause only if `CLANCY_LABEL` is set), `first: 1`, `orderBy: priority`
|
|
41
|
+
|
|
42
|
+
Fetch full ticket content: summary, description (full text), acceptance criteria (if present), epic/parent info, blockers/issue links.
|
|
43
|
+
|
|
44
|
+
If no tickets found:
|
|
45
|
+
```
|
|
46
|
+
No tickets in the queue. Nothing to review.
|
|
47
|
+
```
|
|
48
|
+
Stop.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Step 3 — Score against 7 criteria
|
|
53
|
+
|
|
54
|
+
Score each criterion as pass / warn / fail using the rubric below. Compute weighted confidence score.
|
|
55
|
+
|
|
56
|
+
### Scoring rubric
|
|
57
|
+
|
|
58
|
+
| # | Criterion | Weight | Pass | Warn | Fail |
|
|
59
|
+
|---|---|---|---|---|---|
|
|
60
|
+
| 1 | Summary clarity | 10% | Specific, scopeable | Vague but workable | Too broad or meaningless |
|
|
61
|
+
| 2 | Description quality | 15% | Explains what + why | What only, no why | Missing or one-liner |
|
|
62
|
+
| 3 | Acceptance criteria | 25% | Concrete + testable | Present but vague | Missing entirely |
|
|
63
|
+
| 4 | Figma URL (UI tickets only) | 15% | URL present in description | — | UI ticket, no Figma URL |
|
|
64
|
+
| 5 | Scope realism | 15% | Single focused deliverable | Multiple deliverables or borderline | Too large, "and also" tasks, or spans unrelated systems |
|
|
65
|
+
| 6 | Dependencies stated | 5% | Blockers explicit | — | No mention of dependencies |
|
|
66
|
+
| 7 | Clancy executability | 15% | Purely codebase work | Mostly codebase, minor external touch | Requires work outside the codebase |
|
|
67
|
+
|
|
68
|
+
**Criterion 7 — Clancy executability:** Score as Fail if the ticket primarily requires any of the following — Clancy cannot do these from within the codebase:
|
|
69
|
+
- **External system admin:** "in Google Analytics", "in Salesforce", "in HubSpot", "in the AWS console", "in Jira admin", "in the app store dashboard"
|
|
70
|
+
- **Human process steps:** "get sign-off from", "send an email to customers", "coordinate with", "schedule a meeting", "announce to users"
|
|
71
|
+
- **Production ops (non-repo):** "deploy to production", "rotate the API keys in prod", "scale the fleet", "restart the service" — unless the ticket is purely about CI/CD config files that live in the repo
|
|
72
|
+
- **Non-code deliverables:** "write a runbook", "update the wiki", "create a presentation", "document in Confluence"
|
|
73
|
+
|
|
74
|
+
Score as Warn if the ticket is mostly codebase work but has an incidental external touch (e.g. "add a new event to the existing analytics tracking" — the code change is in the repo, even if the event appears in a dashboard).
|
|
75
|
+
|
|
76
|
+
**Tech stack coherence (part of criterion 7):** If `.clancy/docs/STACK.md` exists, read it and check the ticket against the documented stack. If the ticket mentions a technology or platform not in the documented stack that appears to be an external service (not a new dependency to install), score criterion 7 as Warn and note the mismatch explicitly.
|
|
77
|
+
|
|
78
|
+
**Figma criterion:** Only applies if the ticket description mentions UI, components, screens, design, or visual elements. Backend/API/config tickets skip criterion 4 and redistribute its 15% weight proportionally across the remaining criteria.
|
|
79
|
+
|
|
80
|
+
**Figma URL quality checks:**
|
|
81
|
+
- URL present but points to file root (no `node-id`) → warn: recommend scoping to specific frame
|
|
82
|
+
- `FIGMA_API_KEY` not configured but UI ticket has Figma URL → warn: link will be ignored at runtime
|
|
83
|
+
|
|
84
|
+
**Scope realism — additional Fail signals:**
|
|
85
|
+
- Ticket contains multiple distinct deliverables ("and also", "additionally", "while you're at it", "as well as")
|
|
86
|
+
- Ticket implies setting up new infrastructure from scratch where none exists in the repo (new database, new service, new deployment pipeline)
|
|
87
|
+
- Ticket references 4+ unrelated subsystems that would each require deep separate context
|
|
88
|
+
|
|
89
|
+
**Score calculation:**
|
|
90
|
+
- Pass = full weight
|
|
91
|
+
- Warn = half weight
|
|
92
|
+
- Fail = zero weight
|
|
93
|
+
- Sum all weighted scores → overall percentage
|
|
94
|
+
|
|
95
|
+
**Hard gate — executability override:** If criterion 7 scores Fail, cap the verdict at "Needs work" regardless of the calculated score. A ticket that requires work outside the codebase cannot be run reliably no matter how well it is specified.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Step 4 — Generate recommendations
|
|
100
|
+
|
|
101
|
+
For each warn or fail criterion, generate a specific, actionable recommendation — specific to this ticket, not generic advice.
|
|
102
|
+
|
|
103
|
+
Good: "Add a Figma URL to the ticket description — this ticket mentions updating the profile header component"
|
|
104
|
+
Bad: "Ensure design specs are provided"
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Step 5 — Display output
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Reviewing: [{TICKET-KEY}] {Summary}
|
|
112
|
+
|
|
113
|
+
Confidence: {score}% — {band label}
|
|
114
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
115
|
+
|
|
116
|
+
{for each criterion:}
|
|
117
|
+
✓ {criterion name} — {pass reason}
|
|
118
|
+
⚠ {criterion name} — {warn reason}
|
|
119
|
+
→ {specific recommendation}
|
|
120
|
+
✗ {criterion name} — {fail reason}
|
|
121
|
+
→ {specific recommendation}
|
|
122
|
+
|
|
123
|
+
Verdict: {action based on band}
|
|
124
|
+
{next step options}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Confidence bands
|
|
128
|
+
|
|
129
|
+
| Score | Label | Verdict action |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| 85–100% | Ready | "Run with confidence." |
|
|
132
|
+
| 65–84% | Good to go with caveats | "Review the warnings above, then run /clancy:once." |
|
|
133
|
+
| 40–64% | Needs work | "Address the ✗ items in the ticket, then re-run /clancy:review." |
|
|
134
|
+
| 0–39% | Not ready | "This ticket needs significant rework before Clancy can implement it reliably." |
|
|
135
|
+
|
|
136
|
+
**Executability override:** If criterion 7 (Clancy executability) scores Fail, ignore the calculated band and show:
|
|
137
|
+
```
|
|
138
|
+
Verdict: Not ready for Clancy
|
|
139
|
+
This ticket requires work outside the codebase — Clancy can only implement code changes.
|
|
140
|
+
Update the ticket to focus on the codebase side, or remove it from the queue.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Next-step line per band (append after the verdict — never suggest bypassing the review on low-confidence tickets):
|
|
144
|
+
- **Ready:** `Run /clancy:once to pick it up.`
|
|
145
|
+
- **Good to go:** `Fix the warnings if possible, then run /clancy:once.`
|
|
146
|
+
- **Needs work:** `Update the ticket to address the ✗ items above, then re-run /clancy:review.`
|
|
147
|
+
- **Not ready / executability override:** `Rework the ticket first — do not run Clancy on it yet.`
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Step 6 — Log the review
|
|
152
|
+
|
|
153
|
+
Append to `.clancy/progress.txt`:
|
|
154
|
+
```
|
|
155
|
+
YYYY-MM-DD HH:MM | {TICKET-KEY} | REVIEW | {score}%
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Notes
|
|
161
|
+
|
|
162
|
+
- Recommendations are specific to this ticket — never generic
|
|
163
|
+
- The verdict always suggests a next step — never leaves the user without a clear action
|
|
164
|
+
- Re-running `/clancy:review` multiple times is safe — the score may improve as the ticket is updated
|
|
165
|
+
- Do not implement anything — Claude is invoked for analysis only
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
## Update check
|
|
2
|
+
|
|
3
|
+
Before doing anything else, check for updates:
|
|
4
|
+
|
|
5
|
+
1. Run: `npm show chief-clancy version`
|
|
6
|
+
2. Read the installed version from the Clancy `package.json`
|
|
7
|
+
3. If a newer version exists, print: `ℹ Clancy v{current} → v{latest} available. Run /clancy:update to upgrade.` then continue normally.
|
|
8
|
+
4. If already on latest, continue silently.
|
|
9
|
+
5. If the npm check fails for any reason (offline, network error), continue silently. Never block on this.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Clancy Run Workflow
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
Run Clancy in loop mode. Processes tickets from the Kanban board until the queue is empty or MAX_ITERATIONS is reached.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1 — Parse argument
|
|
22
|
+
|
|
23
|
+
The command may be invoked as `/clancy:run` or `/clancy:run N` where N is a positive integer.
|
|
24
|
+
|
|
25
|
+
- If N is provided: use it as `MAX_ITERATIONS` for this session only. Never write it to `.clancy/.env`.
|
|
26
|
+
- If no argument: read `MAX_ITERATIONS` from `.clancy/.env`. If not set there, default to 5.
|
|
27
|
+
|
|
28
|
+
If the resolved value of `MAX_ITERATIONS` is **10 or greater**, show a warning before continuing:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
⚠ You're about to run Clancy for up to {N} tickets.
|
|
32
|
+
|
|
33
|
+
At rough estimates per ticket (Sonnet):
|
|
34
|
+
Simple tickets ~$0.25–$0.75 each → up to ~${low} total
|
|
35
|
+
Complex tickets ~$2.00–$5.00 each → up to ~${high} total
|
|
36
|
+
|
|
37
|
+
Mistakes compound — if Claude misreads a ticket, it will do so {N} times before you check.
|
|
38
|
+
Consider starting with /clancy:once or a smaller run to validate first.
|
|
39
|
+
|
|
40
|
+
Continue with {N} tickets? [Y/n]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Where `{low}` = N × 0.75 (rounded to nearest dollar) and `{high}` = N × 5 (rounded to nearest dollar).
|
|
44
|
+
If the user types `n` or `N`: print `Cancelled.` and stop. Any other input (including enter) continues.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Step 2 — Preflight checks
|
|
49
|
+
|
|
50
|
+
1. Check `.clancy/` exists. If not:
|
|
51
|
+
```
|
|
52
|
+
.clancy/ not found. Run /clancy:init first to set up Clancy.
|
|
53
|
+
```
|
|
54
|
+
Stop.
|
|
55
|
+
|
|
56
|
+
2. Check `.clancy/.env` exists. If not:
|
|
57
|
+
```
|
|
58
|
+
.clancy/.env not found. Run /clancy:init first.
|
|
59
|
+
```
|
|
60
|
+
Stop.
|
|
61
|
+
|
|
62
|
+
3. Source `.clancy/.env` and check that board credentials are present.
|
|
63
|
+
|
|
64
|
+
**Jira:** `JIRA_BASE_URL`, `JIRA_USER`, `JIRA_API_TOKEN`, `JIRA_PROJECT_KEY`
|
|
65
|
+
**GitHub:** `GITHUB_TOKEN`, `GITHUB_REPO`
|
|
66
|
+
**Linear:** `LINEAR_API_KEY`, `LINEAR_TEAM_ID`
|
|
67
|
+
|
|
68
|
+
If any required var is missing:
|
|
69
|
+
```
|
|
70
|
+
Missing credentials in .clancy/.env: <var name>
|
|
71
|
+
Run /clancy:init to reconfigure, or edit .clancy/.env directly.
|
|
72
|
+
```
|
|
73
|
+
Stop.
|
|
74
|
+
|
|
75
|
+
4. Check `.clancy/clancy-afk.sh` exists. If not:
|
|
76
|
+
```
|
|
77
|
+
.clancy/clancy-afk.sh not found. Run /clancy:init to scaffold scripts.
|
|
78
|
+
```
|
|
79
|
+
Stop.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Step 3 — Start
|
|
84
|
+
|
|
85
|
+
Display:
|
|
86
|
+
```
|
|
87
|
+
Starting Clancy — will process up to {N} ticket(s). Ctrl+C to stop early.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Step 4 — Run
|
|
93
|
+
|
|
94
|
+
Execute:
|
|
95
|
+
```bash
|
|
96
|
+
MAX_ITERATIONS={N} bash .clancy/clancy-afk.sh
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Stream output directly — do not buffer or summarise.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Step 5 — Finish
|
|
104
|
+
|
|
105
|
+
When the script exits, echo the final summary line from the output.
|
|
106
|
+
|
|
107
|
+
If `clancy-afk.sh` exits with a non-zero status:
|
|
108
|
+
```
|
|
109
|
+
Clancy stopped with an error. Check the output above.
|
|
110
|
+
Run /clancy:once for more detail on the next ticket.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Notes
|
|
116
|
+
|
|
117
|
+
- The `N` argument is session-only. It never modifies `.clancy/.env`.
|
|
118
|
+
- If the user wants to permanently change their default, they edit `.clancy/.env` directly or re-run `/clancy:init` advanced setup.
|
|
119
|
+
- Do not attempt to run scripts from `src/templates/` — only run scripts in `.clancy/`.
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# Clancy Scaffold Workflow
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Shared scaffolding logic used during `/clancy:init`. Not a standalone command.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Doc templates
|
|
10
|
+
|
|
11
|
+
Create these files in `.clancy/docs/` with section headings but no content:
|
|
12
|
+
|
|
13
|
+
### STACK.md
|
|
14
|
+
```markdown
|
|
15
|
+
# Stack
|
|
16
|
+
|
|
17
|
+
## Runtime
|
|
18
|
+
|
|
19
|
+
## Package Manager
|
|
20
|
+
|
|
21
|
+
## Frameworks
|
|
22
|
+
|
|
23
|
+
## Key Libraries
|
|
24
|
+
|
|
25
|
+
## Build Tools
|
|
26
|
+
|
|
27
|
+
## Dev Servers
|
|
28
|
+
|
|
29
|
+
## Environment
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### INTEGRATIONS.md
|
|
33
|
+
```markdown
|
|
34
|
+
# Integrations
|
|
35
|
+
|
|
36
|
+
## External APIs
|
|
37
|
+
|
|
38
|
+
## Authentication
|
|
39
|
+
|
|
40
|
+
## Data Storage
|
|
41
|
+
|
|
42
|
+
## Third-party Services
|
|
43
|
+
|
|
44
|
+
## Environment Variables Required
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### ARCHITECTURE.md
|
|
48
|
+
```markdown
|
|
49
|
+
# Architecture
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
## Directory Structure
|
|
54
|
+
|
|
55
|
+
## Key Modules
|
|
56
|
+
|
|
57
|
+
## Data Flow
|
|
58
|
+
|
|
59
|
+
## API Design
|
|
60
|
+
|
|
61
|
+
## State Management
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### CONVENTIONS.md
|
|
65
|
+
```markdown
|
|
66
|
+
# Conventions
|
|
67
|
+
|
|
68
|
+
## Code Style
|
|
69
|
+
|
|
70
|
+
## Naming Conventions
|
|
71
|
+
|
|
72
|
+
## File Organisation
|
|
73
|
+
|
|
74
|
+
## Component Patterns
|
|
75
|
+
|
|
76
|
+
## Error Handling
|
|
77
|
+
|
|
78
|
+
## Logging
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### TESTING.md
|
|
82
|
+
```markdown
|
|
83
|
+
# Testing
|
|
84
|
+
|
|
85
|
+
## Test Runner
|
|
86
|
+
|
|
87
|
+
## Test Structure
|
|
88
|
+
|
|
89
|
+
## Unit Tests
|
|
90
|
+
|
|
91
|
+
## Integration Tests
|
|
92
|
+
|
|
93
|
+
## E2E Tests
|
|
94
|
+
|
|
95
|
+
## Coverage Expectations
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### GIT.md
|
|
99
|
+
```markdown
|
|
100
|
+
# Git Conventions
|
|
101
|
+
|
|
102
|
+
## Branch Naming
|
|
103
|
+
|
|
104
|
+
## Commit Format
|
|
105
|
+
|
|
106
|
+
## Merge Strategy
|
|
107
|
+
|
|
108
|
+
## Pull Request Process
|
|
109
|
+
|
|
110
|
+
## Versioning
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### DESIGN-SYSTEM.md
|
|
114
|
+
```markdown
|
|
115
|
+
# Design System
|
|
116
|
+
|
|
117
|
+
## Token System
|
|
118
|
+
|
|
119
|
+
## Component Library
|
|
120
|
+
|
|
121
|
+
## Theming
|
|
122
|
+
|
|
123
|
+
## Responsive Breakpoints
|
|
124
|
+
|
|
125
|
+
## Icon System
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### ACCESSIBILITY.md
|
|
129
|
+
```markdown
|
|
130
|
+
# Accessibility
|
|
131
|
+
|
|
132
|
+
## WCAG Level
|
|
133
|
+
|
|
134
|
+
## ARIA Patterns
|
|
135
|
+
|
|
136
|
+
## Keyboard Navigation
|
|
137
|
+
|
|
138
|
+
## Focus Management
|
|
139
|
+
|
|
140
|
+
## Screen Reader Support
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### DEFINITION-OF-DONE.md
|
|
144
|
+
```markdown
|
|
145
|
+
# Definition of Done
|
|
146
|
+
|
|
147
|
+
## Code Quality
|
|
148
|
+
|
|
149
|
+
## Testing
|
|
150
|
+
|
|
151
|
+
## Documentation
|
|
152
|
+
|
|
153
|
+
## Design
|
|
154
|
+
|
|
155
|
+
## Accessibility
|
|
156
|
+
|
|
157
|
+
## Review
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### CONCERNS.md
|
|
161
|
+
```markdown
|
|
162
|
+
# Concerns
|
|
163
|
+
|
|
164
|
+
## Known Tech Debt
|
|
165
|
+
|
|
166
|
+
## Security Considerations
|
|
167
|
+
|
|
168
|
+
## Performance Bottlenecks
|
|
169
|
+
|
|
170
|
+
## Areas to Avoid Changing
|
|
171
|
+
|
|
172
|
+
## Deprecated Patterns
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## PLAYWRIGHT.md template
|
|
178
|
+
|
|
179
|
+
Create `.clancy/docs/PLAYWRIGHT.md` when `PLAYWRIGHT_ENABLED=true`:
|
|
180
|
+
|
|
181
|
+
```markdown
|
|
182
|
+
# Playwright Visual Checks
|
|
183
|
+
|
|
184
|
+
Clancy runs visual checks after implementing UI tickets. This file defines
|
|
185
|
+
which server to use and how to start it.
|
|
186
|
+
|
|
187
|
+
## Decision Rule
|
|
188
|
+
|
|
189
|
+
Apply in order:
|
|
190
|
+
1. If the ticket mentions: route, page, screen, layout, full-page → use **dev server**
|
|
191
|
+
2. If the ticket mentions: component, atom, molecule, organism, variant, story → use **Storybook**
|
|
192
|
+
3. Ambiguous → default to **dev server**
|
|
193
|
+
|
|
194
|
+
## Dev Server
|
|
195
|
+
|
|
196
|
+
| Key | Value |
|
|
197
|
+
|---|---|
|
|
198
|
+
| Start command | `{PLAYWRIGHT_DEV_COMMAND}` |
|
|
199
|
+
| Port | `{PLAYWRIGHT_DEV_PORT}` |
|
|
200
|
+
| Health check | `http://localhost:{PLAYWRIGHT_DEV_PORT}` |
|
|
201
|
+
| Startup wait | {PLAYWRIGHT_STARTUP_WAIT}s (use health check polling, not sleep) |
|
|
202
|
+
|
|
203
|
+
## Storybook
|
|
204
|
+
|
|
205
|
+
<!-- Remove this section if Storybook is not used -->
|
|
206
|
+
|
|
207
|
+
| Key | Value |
|
|
208
|
+
|---|---|
|
|
209
|
+
| Start command | `{PLAYWRIGHT_STORYBOOK_COMMAND}` |
|
|
210
|
+
| Port | `{PLAYWRIGHT_STORYBOOK_PORT}` |
|
|
211
|
+
| Story URL pattern | `http://localhost:{PLAYWRIGHT_STORYBOOK_PORT}/?path=/story/{component-name}` |
|
|
212
|
+
|
|
213
|
+
## Visual Check Process
|
|
214
|
+
|
|
215
|
+
1. Determine which server to use (decision rule above)
|
|
216
|
+
2. Start the server using health check polling — poll every 2s, timeout after {PLAYWRIGHT_STARTUP_WAIT}s
|
|
217
|
+
3. Navigate to the relevant route or story URL
|
|
218
|
+
4. Screenshot the full page
|
|
219
|
+
5. Assess visually — check layout, spacing, colours, responsive behaviour
|
|
220
|
+
6. Check browser console for errors
|
|
221
|
+
7. Fix anything wrong before committing
|
|
222
|
+
8. Kill server by PID, then sweep the port unconditionally
|
|
223
|
+
9. Log result: `YYYY-MM-DD HH:MM | TICKET-KEY | PLAYWRIGHT_PASS|FAIL | dev-server|storybook`
|
|
224
|
+
|
|
225
|
+
## Server Health Check Pattern
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Start server in background
|
|
229
|
+
{PLAYWRIGHT_DEV_COMMAND} &
|
|
230
|
+
SERVER_PID=$!
|
|
231
|
+
|
|
232
|
+
# Poll until ready
|
|
233
|
+
MAX_WAIT={PLAYWRIGHT_STARTUP_WAIT}
|
|
234
|
+
ELAPSED=0
|
|
235
|
+
until curl -s http://localhost:{PLAYWRIGHT_DEV_PORT} >/dev/null 2>&1; do
|
|
236
|
+
sleep 2
|
|
237
|
+
ELAPSED=$((ELAPSED + 2))
|
|
238
|
+
if [ $ELAPSED -ge $MAX_WAIT ]; then
|
|
239
|
+
echo "Server did not start within ${MAX_WAIT}s"
|
|
240
|
+
kill $SERVER_PID 2>/dev/null
|
|
241
|
+
exit 1
|
|
242
|
+
fi
|
|
243
|
+
done
|
|
244
|
+
|
|
245
|
+
# ... run visual check ...
|
|
246
|
+
|
|
247
|
+
# Cleanup — kill by PID, then sweep port unconditionally
|
|
248
|
+
kill $SERVER_PID 2>/dev/null
|
|
249
|
+
lsof -ti:{PLAYWRIGHT_DEV_PORT} | xargs kill -9 2>/dev/null || true
|
|
250
|
+
```
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## CLAUDE.md merge logic
|
|
256
|
+
|
|
257
|
+
### If CLAUDE.md does not exist
|
|
258
|
+
|
|
259
|
+
Write the full template as `CLAUDE.md` (see `src/templates/CLAUDE.md`).
|
|
260
|
+
|
|
261
|
+
### If CLAUDE.md already exists
|
|
262
|
+
|
|
263
|
+
Check for existing `<!-- clancy:start -->` marker:
|
|
264
|
+
- Found: Replace everything between `<!-- clancy:start -->` and `<!-- clancy:end -->` with updated content
|
|
265
|
+
- Not found: Append the Clancy section to the end of the file
|
|
266
|
+
|
|
267
|
+
Never overwrite the entire file. Always preserve existing content.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## .gitignore check
|
|
272
|
+
|
|
273
|
+
Read the project's `.gitignore`. If `.clancy/.env` is not present, append:
|
|
274
|
+
```
|
|
275
|
+
# Clancy credentials
|
|
276
|
+
.clancy/.env
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
If no `.gitignore` exists, create one with:
|
|
280
|
+
```
|
|
281
|
+
# Clancy credentials
|
|
282
|
+
.clancy/.env
|
|
283
|
+
|
|
284
|
+
# Dependencies
|
|
285
|
+
node_modules/
|
|
286
|
+
|
|
287
|
+
# OS
|
|
288
|
+
.DS_Store
|
|
289
|
+
```
|