@cubocicloide/stack-frappe 2.0.5 → 2.2.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.
@@ -0,0 +1,238 @@
1
+ ---
2
+ name: fix-issues
3
+ description: Fix 1–5 Jira issues. Single-issue uses a standard flow; multiple issues run parallel agents in isolated git worktrees, then consolidate into one branch and open a PR.
4
+ disable-model-invocation: false
5
+ allowed-tools: "Bash(git *) Bash(dude *) Bash(docker *) Bash(cat *) Bash(find *) Read Write mcp__atlassian__getJiraIssue mcp__atlassian__getTransitionsForJiraIssue mcp__atlassian__transitionJiraIssue mcp__atlassian__addCommentToJiraIssue mcp__atlassian__createPullRequest mcp__atlassian__getRepository PushNotification"
6
+ ---
7
+
8
+ # Fix Issues (Router + Parallel + Consolidation)
9
+
10
+ Fixes 1–5 Jira issues. For a single issue a standard single-agent flow is
11
+ used. For multiple issues, agents run in parallel using isolated git worktrees
12
+ and their branches are merged into one consolidated branch before the PR is
13
+ created.
14
+
15
+ Each issue is routed to the appropriate agent based on its labels:
16
+ - Issues labelled `security` → **`security-fixer`** agent
17
+ - All other issues (features, bugs, tasks) → **`issue-fixer`** agent
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ /fix-issues PROJ-52
23
+ /fix-issues PROJ-52 PROJ-55 PROJ-59
24
+ /fix-issues PROJ-52 PROJ-53 PROJ-54 PROJ-57 PROJ-60
25
+ ```
26
+
27
+ ## Validation
28
+
29
+ If more than 5 issue IDs are provided, stop and ask the user to split the
30
+ request into batches of at most 5.
31
+
32
+ ---
33
+
34
+ ## Step 0 — Autodiscovery
35
+
36
+ ### Project root
37
+
38
+ ```bash
39
+ find . -maxdepth 3 -name "dude.json" | head -1
40
+ ```
41
+
42
+ If not found, report: _"No dude.json found — are you inside a dude project?"_ and stop.
43
+
44
+ ### Jira + Bitbucket configuration
45
+
46
+ Read `## Saved configuration` at the bottom of this file.
47
+
48
+ - If `workspace`, `repo`, and `jira-project` keys are present, use them silently.
49
+ - If any are absent, ask:
50
+ - **"What is the Bitbucket workspace slug?"** (e.g. `myteam`)
51
+ - **"What is the repository slug?"** (e.g. `my-project`)
52
+ - **"What is the Jira project key?"** (e.g. `PROJ`)
53
+ - Then offer to save all three in this file's `## Saved configuration` section.
54
+
55
+ Resolve automatically:
56
+ - **Jira URL**: `getAccessibleAtlassianResources` → first site URL
57
+ - **Current user**: `atlassianUserInfo` → display name (used in PR description)
58
+
59
+ ---
60
+
61
+ ## Phase 0 — Route: fetch issues and pick agents
62
+
63
+ Before launching any fix agent, fetch all issues with `getJiraIssue`
64
+ (in parallel if N>1) and read `labels` for each.
65
+
66
+ For each issue, select the agent:
67
+ - `labels` contains `security` → `security-fixer`
68
+ - otherwise → `issue-fixer`
69
+
70
+ Build a per-issue map: `{ issue_id: agent_type }`.
71
+
72
+ ### Branch naming
73
+
74
+ - **Single issue (N=1)**: branch = lowercase issue key (e.g. `proj-52`)
75
+ - **Multiple issues (N>1)**:
76
+ - Individual branches: lowercase issue key per agent
77
+ - Consolidated branch: `fix/<key1>-<key2>-...` (keys sorted numerically)
78
+ - If **all** issues are security-labelled: `security/<key1>-<key2>-...`
79
+
80
+ ---
81
+
82
+ ## Phase 1 — Fix agents (parallel for N>1, single for N=1)
83
+
84
+ Launch one agent **per issue** in the **same message** (so they run in parallel
85
+ when N>1), using the agent type determined in Phase 0. Each agent uses
86
+ `isolation: "worktree"` to get its own isolated git checkout.
87
+
88
+ Prompt template for each agent:
89
+
90
+ > Fix Jira issue `<ISSUE_ID>` in PARALLEL MODE.
91
+ >
92
+ > Project root: `<PROJECT_ROOT>`
93
+ > Jira URL: `<JIRA_URL>`
94
+ > Bitbucket workspace: `<workspace>`, repo: `<repo>`
95
+ >
96
+ > PARALLEL MODE: create branch `<issue-id>` from `develop`, apply fix, push.
97
+ > Do NOT create a PR. Do NOT transition the Jira issue.
98
+
99
+ Wait for **all agents** to finish before proceeding.
100
+
101
+ Collect from each agent:
102
+ - Branch name pushed
103
+ - Files changed
104
+ - Commit hash
105
+ - Any `BLOCKED: <reason>` if the agent could not complete the fix
106
+
107
+ ---
108
+
109
+ ## Phase 2 — Consolidation (N>1 only)
110
+
111
+ For a **single issue**, skip this phase — go directly to Phase 3 using the
112
+ agent's own branch.
113
+
114
+ For **multiple issues**, collect branch names, then:
115
+
116
+ ```bash
117
+ git fetch origin
118
+ git checkout develop && git pull origin develop --rebase
119
+ git checkout -b fix/<key1>-<key2>-...
120
+
121
+ git merge --no-ff <key1>
122
+ git merge --no-ff <key2>
123
+ # … one per agent branch
124
+ ```
125
+
126
+ If any merge produces a conflict:
127
+ - Report which branch caused it and the conflicting files.
128
+ - Stop — do **not** force-push or discard changes.
129
+ - Ask the user how to proceed.
130
+
131
+ ---
132
+
133
+ ## Phase 3 — Tests
134
+
135
+ Run on the consolidated branch (or the single agent branch):
136
+
137
+ ```bash
138
+ dude lint
139
+ ```
140
+
141
+ Run the project's own test suite next:
142
+
143
+ ```bash
144
+ dude test
145
+ ```
146
+
147
+ `dude help test` lists the suites this project actually exposes (`--backend`,
148
+ `--e2e`, …) — they differ per stack. If the change is scoped to one suite, run
149
+ that one rather than the lot.
150
+
151
+ If any step fails, report the output and stop — do **not** create a PR.
152
+
153
+ ---
154
+
155
+ ## Phase 4 — Push and create one PR
156
+
157
+ ```bash
158
+ git push -u origin <source-branch>
159
+ ```
160
+
161
+ Create a pull request via `createPullRequest`:
162
+
163
+ - **Title**:
164
+ - N=1: `[<ISSUE_ID>] <issue summary>`
165
+ - N>1: `[<KEY1>, <KEY2>, …] <short batch description>`
166
+ - **Source branch**: `<source-branch>`
167
+ - **Destination branch**: `develop`
168
+ - **Description**:
169
+ ```
170
+ ## Summary
171
+ <bullet points per issue: what was changed and why>
172
+
173
+ ## Issues
174
+ - [<ISSUE_ID>] <summary> — <Jira URL>/<ISSUE_ID>
175
+ - …
176
+
177
+ ## Test plan
178
+ - [ ] dude lint: ✓
179
+ - [ ] tests: ✓
180
+ ```
181
+ - **Close source branch**: `true`
182
+
183
+ ---
184
+
185
+ ## Phase 5 — Transition all Jira issues
186
+
187
+ For each issue, call `getTransitionsForJiraIssue` → find a transition whose
188
+ name contains "Review" or "Peer review" (case-insensitive) →
189
+ `transitionJiraIssue`.
190
+
191
+ If no matching transition is found (the workflow may differ), skip silently.
192
+
193
+ ---
194
+
195
+ ## Phase 6 — Report
196
+
197
+ ```
198
+ Fix complete
199
+ ══════════════════════════════════════════════════════
200
+
201
+ Branch
202
+ <branch-name>
203
+
204
+ Issues (N)
205
+ <KEY> [issue-fixer] — commit <hash> — <description>
206
+ <KEY> [security-fixer] — commit <hash> — <description>
207
+
208
+ Tests
209
+ dude lint: ✓
210
+ dude test: ✓
211
+
212
+ Pull request
213
+ <PR URL>
214
+
215
+ Jira
216
+ <KEY> → In Review
217
+ <KEY> → In Review
218
+ ```
219
+
220
+ ---
221
+
222
+ ## Notes
223
+
224
+ - Each agent runs in its own git worktree (`isolation: "worktree"`) — git
225
+ operations never conflict during Phase 1.
226
+ - `security/baseline.json` is **not** touched by individual agents. Baseline
227
+ cleanup is handled by `verify-security-fixes` after the PR is merged.
228
+ - Each agent calls `PushNotification` when it completes so you are notified
229
+ immediately as each fix lands.
230
+ - Agents marked `BLOCKED` are reported in Phase 6 but do not prevent the PR
231
+ from being created for the remaining issues.
232
+
233
+ ---
234
+
235
+ <!-- ------------------------------------------------------------------ -->
236
+ <!-- Everything below this line is written automatically by the skill. -->
237
+ <!-- Do not edit manually. -->
238
+ <!-- ------------------------------------------------------------------ -->
@@ -0,0 +1,34 @@
1
+ # PRJ001 — Example project rule
2
+
3
+ This file is the prose half of the example project check
4
+ (`.dude/lint/checks/PRJ/001.ts`). Rename, edit or delete both together.
5
+
6
+ ## What it does
7
+
8
+ Nothing yet — the shipped check returns no diagnostics. It exists so you have a
9
+ working pair to copy: a rule module, and the Markdown that explains it.
10
+
11
+ ## Why the file is here
12
+
13
+ `dude explain PRJ001` prints **this file**, and `dude cheatsheet` uses its first
14
+ heading as the rule's one-line title. A project rule with no Markdown beside it
15
+ still runs, but it can only ever be listed as a bare code — which tells whoever
16
+ hits the diagnostic (a teammate, or a coding agent) nothing about how to fix it.
17
+
18
+ The convention is a sibling file, matching the check's path:
19
+
20
+ ```
21
+ .dude/lint/checks/PRJ/001.ts ← the rule
22
+ .dude/lint/checks/PRJ/001.md ← this file
23
+ ```
24
+
25
+ `dude lint` ignores non-module files, so the Markdown never runs as a check.
26
+
27
+ > Stack rules follow the mirror-image convention — their prose lives under
28
+ > `.claude/rules/<GROUP>/<NNN>.md`. Both are served by `dude explain <CODE>`.
29
+
30
+ ## How to fix a violation
31
+
32
+ Describe the fix here, concretely enough that someone can act on it without
33
+ opening the check's source. Start the file with `# <CODE> — <title>` so the
34
+ title is picked up.
@@ -38,9 +38,26 @@ export default function check(root: string): RawDiagnostic[] {
38
38
  Checks are loaded with [jiti](https://github.com/unjs/jiti), so you can write
39
39
  real TypeScript and `import` any package you add to the project.
40
40
 
41
- You can document a rule with a Markdown file next to it
42
- (`PRJ/001.md`) — `dude lint` ignores non-module files. Co-located tests
43
- (`001.test.ts`) are ignored too.
41
+ ## Documenting a rule
42
+
43
+ Put a Markdown file next to the check, named after it:
44
+
45
+ ```
46
+ .dude/lint/checks/PRJ/001.ts ← the rule
47
+ .dude/lint/checks/PRJ/001.md ← what it means and how to fix it
48
+ ```
49
+
50
+ `dude explain PRJ001` prints that file, and `dude cheatsheet` uses its first
51
+ heading (`# PRJ001 — <title>`) as the rule's one-line title. Without it the rule
52
+ still runs, but it can only be reported as a bare code — which tells whoever hits
53
+ the diagnostic nothing about how to fix it. The shipped `PRJ/001.md` is a worked
54
+ example.
55
+
56
+ `dude lint` ignores non-module files, so the Markdown never runs as a check.
57
+ Co-located tests (`001.test.ts`) are ignored too.
58
+
59
+ > Stack rules use the mirror-image location, `.claude/rules/<GROUP>/<NNN>.md`.
60
+ > `dude explain <CODE>` serves both.
44
61
 
45
62
  ## Choosing codes
46
63
 
@@ -0,0 +1,42 @@
1
+ # AGENTS.md
2
+
3
+ Entry point for coding agents. This file is deliberately a **pointer**, not a
4
+ second copy of the project guidance — duplicated instructions drift.
5
+
6
+ ## 1. Ask the project what it is
7
+
8
+ ```bash
9
+ dude cheatsheet --format json
10
+ ```
11
+
12
+ One call returns this project's live command catalog, every lint rule with its
13
+ code and title, the verify loop, and the answers it was scaffolded with. It is
14
+ generated from the project itself, so it is always current. Prefer it over any
15
+ hand-written command list.
16
+
17
+ `dude help --format json` returns just the command catalog, if that is all you
18
+ need.
19
+
20
+ ## 2. Read the conventions before writing code
21
+
22
+ - **[CLAUDE.md](CLAUDE.md)** — the full project guidance: layout, stack
23
+ conventions, workflows, and what not to do. Written for Claude Code, but it is
24
+ plain Markdown and applies to any agent.
25
+ - **`.claude/rules/<GROUP>/<NNN>.md`** — one file per lint rule, explaining why
26
+ it exists and how to fix a violation. A reported code maps to its file by
27
+ splitting group from number: `<GROUP><NNN>` lives at
28
+ `.claude/rules/<GROUP>/<NNN>.md`. Run `dude cheatsheet` to see this project's
29
+ actual codes — the groups differ per stack.
30
+
31
+ ## 3. Verify your own work
32
+
33
+ Do not report a change as done until these pass:
34
+
35
+ ```bash
36
+ dude lint # structural conventions — the project's actual contract
37
+ dude test # the test suites
38
+ ```
39
+
40
+ `dude lint` is the point: this project's conventions are enforced mechanically,
41
+ so you can check your output instead of guessing. If a diagnostic is in your way,
42
+ read its rule file and fix the cause — do not work around the check.
@@ -4,6 +4,31 @@ Frappe Framework ticketing project scaffolded by `dude` (stack: `frappe`).
4
4
  {{#if withHelpdesk}}Frappe Helpdesk provides the ticketing UI; the custom app
5
5
  `apps/ticketing/` extends it.{{/if}}
6
6
 
7
+ ## Start here: `dude cheatsheet`
8
+
9
+ Before reading further, run:
10
+
11
+ ```bash
12
+ dude cheatsheet --format json
13
+ ```
14
+
15
+ One call returns **this project's** live command catalog, every lint rule with its
16
+ code and title, the verify loop, and the answers it was scaffolded with. It is
17
+ generated from the project itself, so it cannot drift from reality the way a
18
+ hand-written list can — prefer it over any command list in this file.
19
+
20
+ Then verify your own work before claiming it is done:
21
+
22
+ ```bash
23
+ dude lint # structural conventions; each code has prose in .claude/rules/
24
+ dude test # the project's test suites
25
+ ```
26
+
27
+ When `dude lint` reports a code, read `.claude/rules/<GROUP>/<NNN>.md` for why the
28
+ rule exists and how to fix it properly — do not work around a diagnostic.
29
+
30
+ ---
31
+
7
32
  ## Architecture
8
33
 
9
34
  - **Local runtime** — Docker Compose: `mariadb`, `redis-cache`, `redis-queue`
@@ -0,0 +1,28 @@
1
+ # Cheatsheet
2
+
3
+ !!! info "Auto-generated"
4
+ This page is generated from **this project** every time you run `dude docs`:
5
+ the commands it actually has, the conventions `dude lint` enforces, the verify
6
+ loop, and how it was scaffolded. So it always matches your init choices
7
+ (database, Celery, IaC…) and any project-local commands under
8
+ `.dude/commands/`.
9
+
10
+ You're seeing this placeholder because the docs haven't been served yet. Run:
11
+
12
+ ```bash
13
+ dude docs
14
+ ```
15
+
16
+ and this page will be replaced with the real cheatsheet. You can also print it
17
+ yourself at any time:
18
+
19
+ ```bash
20
+ dude cheatsheet # this page, as Markdown
21
+ dude cheatsheet --format json # the same data for tooling and coding agents
22
+ dude cheatsheet --out NOTES.md # write it somewhere instead of stdout
23
+ ```
24
+
25
+ !!! tip "Working with a coding agent?"
26
+ Point it at `dude cheatsheet --format json`. One call returns the command
27
+ catalog, every lint rule with its code, and the verify loop — so it knows what
28
+ it may run and what will be checked, without crawling this whole site.
@@ -145,6 +145,7 @@ transaction) and run inside the bench via `bench run-tests`.
145
145
  | Command | Description |
146
146
  |---------|-------------|
147
147
  | `dude lint` | Structural Frappe conventions over `apps/` (APP/DT/PY rules — see `.claude/rules/`) |
148
+ | `dude explain <CODE>` | Print the prose behind a lint code — why the rule exists and how to fix it |
148
149
  | `dude lint --quiet` | Errors only, no warnings |
149
150
  | `dude format` | `ruff format` + autofix over `apps/` (Frappe style — tabs) |
150
151
  | `dude review` | One pass: stack lint rules + `ruff check` (no autofix) |
@@ -155,13 +156,29 @@ transaction) and run inside the bench via `bench run-tests`.
155
156
  `dude lint` also runs any rules you define under `.dude/lint/checks/` — the
156
157
  rule code is derived from the path (`.dude/lint/checks/PRJ/001.ts` → `PRJ001`)
157
158
  and the contract is the same one the stack's own checks use. See
158
- `.dude/lint/checks/README.md` and the `PRJ/001.ts` example. To disable a
159
- built-in rule, list its code in `dude.json`:
159
+ `.dude/lint/checks/README.md` and the `PRJ/001.ts` example. Document a rule with
160
+ a Markdown file next to it (`PRJ/001.md`) and `dude explain PRJ001` serves it.
161
+ To disable a built-in rule, list its code in `dude.json`:
160
162
 
161
163
  ```json
162
164
  { "lint": { "disable": ["PY001"] } }
163
165
  ```
164
166
 
167
+ ### Verifying your work mechanically
168
+
169
+ `dude lint` and `dude explain` are designed to be used together — the fastest
170
+ loop for anyone, human or coding agent, working in this project:
171
+
172
+ ```bash
173
+ dude lint --format json # what broke, where, and under which rule code
174
+ dude explain PY001 # why that rule exists and how to satisfy it
175
+ ```
176
+
177
+ `--format json` writes nothing but the JSON document to stdout, so it pipes
178
+ cleanly (`dude lint --format json | jq '.diagnostics[].code'`). Exit codes are
179
+ the same as the human format: non-zero only when there is at least one error.
180
+ Run `dude explain` with no code to list every rule that applies here.
181
+
165
182
  ### Upgrading pinned versions
166
183
 
167
184
  `dude upgrade` updates version pins only. It does **not** migrate existing
@@ -200,6 +217,7 @@ command list is in `dude help` (and the [Command reference](api.md)).
200
217
  | Command | Description |
201
218
  |---------|-------------|
202
219
  | `dude docs` | Serve this documentation in dev mode at <http://localhost:8001> |
220
+ | `dude cheatsheet` | One dense reference for this project — commands, lint rules, verify loop. `--format json` for coding agents |
203
221
  | `dude docs --port 9000` | Use a custom port |
204
222
  | `dude help --format md` | Print the full command reference as Markdown |
205
223
  | `dude help --format json` | Print the same catalog as JSON (for tooling / LLMs) |
@@ -115,7 +115,7 @@ Hooks on a DocType that isn't installed are harmless — the handlers simply
115
115
  never fire (which is why the example app also works without Helpdesk).
116
116
  Detect field changes with `doc.get_doc_before_save()`, as `on_update` does.
117
117
 
118
- **Lint rules**: APP002 (handler dotted paths must resolve).
118
+ **Lint rules**: APP003 (`doc_events` handler dotted paths must resolve).
119
119
 
120
120
  ---
121
121
 
@@ -154,7 +154,7 @@ as a fixture, declare in `hooks.py`.
154
154
  with no filters would export every workflow on the site — including other
155
155
  apps' — into your app.
156
156
 
157
- **Lint rules**: APP003 (fixtures declared in `hooks.py` ↔ JSON files shipped
157
+ **Lint rules**: APP004 (fixtures declared in `hooks.py` ↔ JSON files shipped
158
158
  in `fixtures/` stay in sync).
159
159
 
160
160
  ---
@@ -19,6 +19,7 @@ nav:
19
19
  - Extending the app: extending.md
20
20
  - Working with dude: dude.md
21
21
  - Command reference: api.md
22
+ - Cheatsheet: cheatsheet.md
22
23
  - Writing docs: mkdocs.md
23
24
  {{#if withIac}}
24
25
  - Deploy (AWS ECS): deploy.md