devtronic 1.2.2 → 1.2.4

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.
Files changed (21) hide show
  1. package/dist/index.js +154 -149
  2. package/package.json +1 -1
  3. package/templates/addons/auto-devtronic/agents/failure-analyst.md +156 -0
  4. package/templates/addons/auto-devtronic/agents/issue-parser.md +145 -0
  5. package/templates/addons/auto-devtronic/agents/quality-runner.md +85 -0
  6. package/templates/addons/auto-devtronic/manifest.json +16 -0
  7. package/templates/addons/auto-devtronic/skills/auto-devtronic/SKILL.md +611 -0
  8. package/templates/addons/design-best-practices/manifest.json +28 -0
  9. package/templates/addons/design-best-practices/reference/color-and-contrast.md +146 -0
  10. package/templates/addons/design-best-practices/reference/interaction-design.md +208 -0
  11. package/templates/addons/design-best-practices/reference/motion-design.md +167 -0
  12. package/templates/addons/design-best-practices/reference/responsive-design.md +180 -0
  13. package/templates/addons/design-best-practices/reference/spatial-design.md +161 -0
  14. package/templates/addons/design-best-practices/reference/typography.md +136 -0
  15. package/templates/addons/design-best-practices/reference/ux-writing.md +190 -0
  16. package/templates/addons/design-best-practices/rules/design-quality.md +53 -0
  17. package/templates/addons/design-best-practices/skills/design-harden/SKILL.md +142 -0
  18. package/templates/addons/design-best-practices/skills/design-init/SKILL.md +95 -0
  19. package/templates/addons/design-best-practices/skills/design-refine/SKILL.md +124 -0
  20. package/templates/addons/design-best-practices/skills/design-review/SKILL.md +107 -0
  21. package/templates/addons/design-best-practices/skills/design-system/SKILL.md +125 -0
@@ -0,0 +1,611 @@
1
+ ---
2
+ name: devtronic
3
+ description: Autonomous engineering loop. Takes a GitHub issue or description, runs the full spec→test→plan→execute→review→PR pipeline, and self-corrects via failing tests until done. Two modes: --hitl (human gates, default) and --afk (fully autonomous).
4
+ allowed-tools: Task, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
5
+ argument-hint: "[issue-url|description] [--hitl|--afk] [--validate] [--max-retries N] [--skip-spec] [--branch name] [--dry-run]"
6
+ ---
7
+
8
+ # devtronic — Autonomous Engineering Loop
9
+
10
+ Execute the full devtronic pipeline autonomously for `$ARGUMENTS`.
11
+
12
+ The key innovation over a manual pipeline: the **execute-verify-correct loop**. Instead of stopping at test failures, the agent analyzes what broke, amends the plan, and retries — up to `--max-retries` times (default: 3).
13
+
14
+ ## Modes
15
+
16
+ | Mode | Flag | Human gates | Use when |
17
+ |------|------|-------------|----------|
18
+ | **HITL** | `--hitl` (default) | Brief, tests, each retry, PR | Unfamiliar codebase, risky changes |
19
+ | **AFK** | `--afk` | None | Routine issues, high test coverage, trusted scope |
20
+
21
+ ## Flags
22
+
23
+ | Flag | Default | Description |
24
+ |------|---------|-------------|
25
+ | `--validate` | no | Validate task AFK-readiness before proceeding (score 70+ = proceed, <70 in AFK mode = ask for HITL) |
26
+ | `--hitl` | yes | Pause at key gates for human approval |
27
+ | `--afk` | no | Fully autonomous, no pauses |
28
+ | `--max-retries N` | 3 | Max loop iterations before escalating |
29
+ | `--skip-spec` | no | Skip spec interview, auto-generate from brief |
30
+ | `--branch name` | auto | Branch name (auto-derived from issue) |
31
+ | `--dry-run` | no | Run everything including code changes, but skip `gh pr create`. Prints PR body to stdout instead. Use to inspect results before publishing. |
32
+
33
+ ## Mode Resolution
34
+
35
+ Mode is resolved in this order (highest priority first):
36
+
37
+ 1. **CLI flag** (`--afk` / `--hitl`) — overrides all
38
+ 2. **Project config** (`.claude/devtronic.json` → `mode` field) — read at pipeline start with the `Read` tool
39
+ 3. **Default**: HITL
40
+
41
+ At pipeline start, before step 0:
42
+ - Attempt to read `.claude/devtronic.json`
43
+ - If `mode` field is present and no CLI flag was passed, use it as the active mode
44
+ - Log the resolved mode: `Mode: afk (from project config)` or `Mode: hitl (default)`
45
+
46
+ ## Pipeline Position
47
+
48
+ ```
49
+ INPUT (issue URL or description)
50
+
51
+
52
+ 0. VALIDATE (if --validate) — /validate-task-afk
53
+ Score: 70+? Proceed silently.
54
+ Score: <70 in AFK mode? Ask for HITL confirmation.
55
+
56
+
57
+ 1. INTAKE — parse issue, extract structured brief
58
+
59
+
60
+ 2. BRIEF — 3-layer PRD: context → tasks → validation
61
+ │ [HITL gate: confirm brief]
62
+
63
+ 3. TESTS — generate tests-as-DoD from brief
64
+ │ [HITL gate: confirm tests]
65
+
66
+ 4. PLAN — implementation plan with task dependencies
67
+
68
+
69
+ 5. EXECUTE LOOP ◄──────────────────────┐
70
+ │ execute-plan │
71
+ │ run quality checks │
72
+ │ if FAIL → failure-analyst ────────┘ (amend plan + retry)
73
+ │ if PASS → continue
74
+ │ [HITL gate on each retry: confirm strategy]
75
+
76
+ 6. REVIEW — /post-review --quick
77
+
78
+
79
+ 7. PR — gh pr create, link to issue
80
+ [HITL gate: confirm PR body]
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Step 0: Validate Task (if --validate)
86
+
87
+ Only if the `--validate` flag is provided:
88
+
89
+ ### Invoke /validate-task-afk
90
+
91
+ ```
92
+ /validate-task-afk <input>
93
+ ```
94
+
95
+ Where `<input>` is the GitHub issue URL or plain text description provided by the user.
96
+
97
+ ### Interpret Score
98
+
99
+ The validator returns a viability score (0-100) across 5 dimensions:
100
+
101
+ | Score | Status | Action |
102
+ |-------|--------|--------|
103
+ | **70-100** | ✅ AFK Viable | Proceed to step 1 |
104
+ | **40-70** | ⚠️ Medium Risk | If `--afk`: ask user "Switch to HITL mode?" If yes, set `--hitl`. If no, proceed. If `--hitl`: proceed. |
105
+ | **0-40** | ❌ Needs Refinement | Ask user "Refine the task description and re-validate?" If yes, exit to let user improve. If no, proceed at own risk. |
106
+
107
+ ### Display Results
108
+
109
+ Show the user:
110
+ 1. **Viability score** (0-100)
111
+ 2. **Dimension breakdown** (clarity, scope, dependency scores)
112
+ 3. **Gaps found** (if any) with suggestions
113
+ 4. **Recommended mode** (AFK vs HITL)
114
+
115
+ **In AFK mode with score <70**: Pause and confirm before proceeding.
116
+ **In HITL mode**: Always show results, but proceed unless user rejects.
117
+
118
+ ---
119
+
120
+ ## Step 1: Parse Input
121
+
122
+ ### Verify core skills
123
+
124
+ Before proceeding, confirm the required devtronic core skills are present:
125
+
126
+ ```bash
127
+ ls .claude/skills/ 2>/dev/null | grep -E "generate-tests|create-plan|execute-plan"
128
+ ```
129
+
130
+ If any are missing:
131
+ - **HITL mode**: warn and ask "Required skills not found. Continue anyway?"
132
+ - **AFK mode**: escalate immediately — "Required skills missing. Install devtronic core first: `npx devtronic init`"
133
+
134
+ ---
135
+
136
+ ### Detect input type
137
+
138
+ **If `$ARGUMENTS` contains a GitHub issue URL** (e.g. `https://github.com/org/repo/issues/42`):
139
+
140
+ ```bash
141
+ gh issue view <number> --repo <org/repo> --json title,body,labels,comments,assignees,milestone
142
+ ```
143
+
144
+ Extract:
145
+ - Title
146
+ - Body (full description)
147
+ - Labels (used to infer type: bug/feature/chore)
148
+ - Comments (may contain acceptance criteria refinements)
149
+
150
+ **If `$ARGUMENTS` is a plain description** (no URL): use it directly as raw brief input.
151
+
152
+ **If no `$ARGUMENTS`**: ask the user for the issue URL or description before proceeding.
153
+
154
+ ### Detect branch state
155
+
156
+ ```bash
157
+ git status --short
158
+ git branch --show-current
159
+ ```
160
+
161
+ If there are uncommitted changes, warn in HITL mode. In AFK mode, stash and continue:
162
+ ```bash
163
+ git stash push -m "devtronic: stash before run"
164
+ ```
165
+
166
+ > **Note**: The stash will be popped automatically at the end of Step 8 (Report).
167
+ > If the run is aborted or escalated before completion, restore your changes with:
168
+ > `git stash list | grep "devtronic"` then `git stash pop`.
169
+
170
+ ### Create working branch
171
+
172
+ If `--branch` is not specified, derive from issue:
173
+ - From URL: `feat/issue-42-<slug>` where slug = first 4 words of title, kebab-cased
174
+ - From description: `feat/<slug>` where slug = first 4 words, kebab-cased
175
+
176
+ ```bash
177
+ git checkout -b <branch-name>
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Step 2: Generate Brief (issue-parser agent)
183
+
184
+ Invoke the **issue-parser** subagent with the raw issue data:
185
+
186
+ ```
187
+ Parse this GitHub issue into a structured 3-layer brief.
188
+
189
+ RAW ISSUE:
190
+ Title: <title>
191
+ Body: <body>
192
+ Labels: <labels>
193
+ Comments: <comments>
194
+
195
+ Output the brief in the format specified in your instructions.
196
+ ```
197
+
198
+ The agent outputs a `thoughts/devtronic/brief.md` file with the 3-layer structure:
199
+
200
+ ```markdown
201
+ # Brief: <issue title>
202
+
203
+ **Source**: <issue URL or "manual input">
204
+ **Type**: bug | feature | chore
205
+ **Branch**: <branch-name>
206
+
207
+ ## Layer 1: Context
208
+
209
+ [What the system currently does. What files/modules are relevant. Why this matters.]
210
+
211
+ ## Layer 2: Tasks
212
+
213
+ Atomic implementation steps, ordered by dependency:
214
+
215
+ 1. [Task description — specific enough to implement without ambiguity]
216
+ 2. [Task description]
217
+ ...
218
+
219
+ ## Layer 3: Validation
220
+
221
+ Acceptance criteria as testable assertions:
222
+
223
+ - [ ] [Criterion 1 — observable, binary outcome]
224
+ - [ ] [Criterion 2]
225
+ ...
226
+ ```
227
+
228
+ ### HITL gate: confirm brief
229
+
230
+ **In HITL mode only:**
231
+
232
+ ```markdown
233
+ ## Brief Generated
234
+
235
+ [display brief.md contents]
236
+
237
+ Does this brief accurately capture what needs to be done?
238
+
239
+ Options:
240
+ 1. Yes, proceed to test generation
241
+ 2. No, let me describe what's missing → [amend brief]
242
+ 3. Abort
243
+ ```
244
+
245
+ Wait for user response before continuing.
246
+
247
+ **If `--skip-spec`**: Skip the HITL confirmation gate above. Treat the
248
+ issue-parser output as approved and proceed directly to Step 3.
249
+ Note: `--skip-spec` does not change brief generation — it only bypasses
250
+ the human review gate. Equivalent to running AFK mode for this one step only.
251
+
252
+ ---
253
+
254
+ ## Step 3: Generate Tests
255
+
256
+ Follow the same process as `/generate-tests`:
257
+
258
+ Read `thoughts/devtronic/brief.md`, specifically the **Validation** layer, and generate failing tests that encode each acceptance criterion.
259
+
260
+ Save to:
261
+ - Test files in the appropriate test directory (detect from project structure)
262
+ - `thoughts/devtronic/tests-manifest.md` — traceability: criterion → test name → file
263
+
264
+ **Test naming convention**: `[feature].[criterion-slug].test.ts` or follow existing conventions.
265
+
266
+ **Verify tests fail** before implementation:
267
+ ```bash
268
+ <pm> test --filter <test-pattern>
269
+ ```
270
+
271
+ Expected: all new tests fail (red). If any pass without implementation, flag it — either the criterion is already satisfied (mention it) or the test is incorrect.
272
+
273
+ ### HITL gate: confirm tests
274
+
275
+ **In HITL mode only:**
276
+
277
+ ```markdown
278
+ ## Tests Generated
279
+
280
+ [list of test files and test names]
281
+ [X tests failing as expected — red ✓]
282
+
283
+ Do these tests correctly encode the acceptance criteria?
284
+
285
+ Options:
286
+ 1. Yes, proceed to planning
287
+ 2. No, describe what's wrong → [revise tests]
288
+ 3. Abort
289
+ ```
290
+
291
+ ---
292
+
293
+ ## Step 4: Create Plan
294
+
295
+ Follow the same process as `/create-plan`, using:
296
+ - `thoughts/devtronic/brief.md` as the spec
297
+ - `thoughts/devtronic/tests-manifest.md` as the DoD
298
+
299
+ Save plan to `thoughts/devtronic/plan.md`.
300
+
301
+ The plan **must include**:
302
+ - `## Task Dependencies` YAML block (required for parallel execution)
303
+ - `## Done Criteria` section referencing the test names from the manifest
304
+
305
+ ---
306
+
307
+ ## Step 5: Execute Loop
308
+
309
+ This is the RALPH core. Runs until tests pass or retries are exhausted.
310
+
311
+ ### Initialize loop state
312
+
313
+ ```
314
+ attempt = 1
315
+ max_retries = N (from --max-retries, default 3)
316
+ last_failure = null
317
+ plan_path = thoughts/devtronic/plan.md
318
+ ```
319
+
320
+ ### Loop body
321
+
322
+ ```
323
+ WHILE attempt <= max_retries:
324
+
325
+ ── 5a. Execute Plan ────────────────────────────────────
326
+ Follow the /execute-plan process for plan_path.
327
+ Include last_failure context in subagent prompts (if attempt > 1).
328
+
329
+ ── 5b. Run Quality Checks ──────────────────────────────
330
+ Invoke the quality-runner agent:
331
+ "Run all quality checks (typecheck, lint, test)"
332
+
333
+ ── 5c. Evaluate Result ─────────────────────────────────
334
+ IF all checks pass:
335
+ → BREAK (proceed to Step 6)
336
+
337
+ IF checks fail:
338
+ last_failure = {
339
+ attempt: N,
340
+ output: <quality-runner output>,
341
+ affected_files: <list from git diff>
342
+ }
343
+
344
+ ── 5d. Analyze Failure ───────────────────────────────
345
+ Invoke the failure-analyst agent with last_failure.
346
+ Agent outputs:
347
+ - root_cause: [description]
348
+ - affected_tasks: [task IDs from plan]
349
+ - fix_strategy: [specific changes needed]
350
+ - confidence: high | medium | low
351
+ - recommend: retry | escalate
352
+
353
+ IF recommend == escalate OR attempt == max_retries:
354
+ → ESCALATE (see below)
355
+
356
+ IF recommend == retry:
357
+
358
+ [HITL gate only]:
359
+ Show failure analysis and ask:
360
+ "Retry attempt N with this fix strategy? (yes / modify / abort)"
361
+ Wait for user response.
362
+
363
+ Amend plan_path with fix_strategy context:
364
+ - Update affected tasks with failure context
365
+ - Add note: "Attempt N failed: <root_cause>. Fix: <fix_strategy>"
366
+
367
+ attempt++
368
+ → CONTINUE loop
369
+ ```
370
+
371
+ ### Escalation
372
+
373
+ When retries are exhausted or analyst recommends escalating:
374
+
375
+ ```markdown
376
+ ## devtronic: Cannot Self-Correct ⚠️
377
+
378
+ **Attempts**: N / max_retries
379
+ **Last failure**: [quality-runner output summary]
380
+
381
+ **Failure analysis**:
382
+ - Root cause: [description]
383
+ - Affected: [files/tasks]
384
+
385
+ **Why retrying won't help**: [analyst reasoning]
386
+
387
+ **Options**:
388
+ 1. Increase max-retries and continue (risky)
389
+ 2. Show me the failing tests so I can fix manually
390
+ 3. Abort — reset branch to start
391
+
392
+ What would you like to do?
393
+ ```
394
+
395
+ Wait for user input regardless of mode (always escalate to human).
396
+
397
+ ### Loop progress display
398
+
399
+ After each attempt:
400
+
401
+ ```
402
+ ● Loop attempt 2/3
403
+ ✖ typecheck — 3 errors in auth/session.ts
404
+ ✖ tests — 2/5 passing
405
+ → Analyzing failures...
406
+ → Amending plan: patch session.ts type signatures
407
+ → Starting attempt 3...
408
+ ```
409
+
410
+ ---
411
+
412
+ ## Step 6: Review
413
+
414
+ Once the loop exits with all checks passing:
415
+
416
+ Follow the `/post-review --quick` process:
417
+ - Run quality checks one final time (full suite)
418
+ - Verify done criteria from the test manifest
419
+ - Check no regressions (compare test count to baseline if available)
420
+
421
+ Output:
422
+
423
+ ```markdown
424
+ ## Review: PASS ✅
425
+
426
+ - Types: ✅
427
+ - Lint: ✅
428
+ - Tests: ✅ (N new, 0 regressions)
429
+
430
+ ### Done Criteria
431
+ | # | Criterion | Test | Status |
432
+ |---|-----------|------|--------|
433
+ | 1 | [text] | [test name] | ✅ PASS |
434
+ | 2 | [text] | [test name] | ✅ PASS |
435
+
436
+ **All criteria met. Ready for PR.**
437
+ ```
438
+
439
+ ---
440
+
441
+ ## Step 7: Create PR
442
+
443
+ ### Build PR description
444
+
445
+ ```markdown
446
+ ## <issue title>
447
+
448
+ **Closes**: #<issue-number> (or "Resolves: <issue-url>")
449
+ **Branch**: <branch-name>
450
+ **Attempts**: N (devtronic)
451
+
452
+ ### What changed
453
+
454
+ [Summary of implementation based on plan phases completed]
455
+
456
+ ### Tests
457
+
458
+ - N new tests added
459
+ - All acceptance criteria covered
460
+
461
+ ### Acceptance criteria
462
+
463
+ | # | Criterion | Status |
464
+ |---|-----------|--------|
465
+ | 1 | [text] | ✅ |
466
+ | 2 | [text] | ✅ |
467
+
468
+ 🤖 Generated with [devtronic](https://github.com/devtronic/devtronic)
469
+ ```
470
+
471
+ ### HITL gate: confirm PR
472
+
473
+ **In HITL mode only:**
474
+
475
+ ```
476
+ ## PR Ready
477
+
478
+ [display PR description above]
479
+
480
+ Create this PR?
481
+ 1. Yes
482
+ 2. Edit title/body first
483
+ 3. No (I'll create manually)
484
+ ```
485
+
486
+ ### Create PR
487
+
488
+ ```bash
489
+ # Detect base branch (use repo default)
490
+ BASE_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null || echo "main")
491
+
492
+ git push -u origin <branch-name>
493
+
494
+ gh pr create \
495
+ --title "<issue title>" \
496
+ --body "<pr-description>" \
497
+ --head <branch-name> \
498
+ --base "$BASE_BRANCH"
499
+ ```
500
+
501
+ If `--dry-run`: skip `gh pr create`, print PR body to stdout instead.
502
+
503
+ ---
504
+
505
+ ## Step 8: Report
506
+
507
+ Final summary after PR creation:
508
+
509
+ ### Restore stash (AFK mode only)
510
+
511
+ If a stash was created in Step 1, pop it now:
512
+
513
+ ```bash
514
+ git stash list | grep "devtronic" && git stash pop
515
+ ```
516
+
517
+ ---
518
+
519
+ ```markdown
520
+ ## devtronic: Complete ✅
521
+
522
+ **Issue**: <title> (<url>)
523
+ **PR**: <pr-url>
524
+ **Branch**: <branch-name>
525
+ **Loop attempts**: N
526
+
527
+ ### Stats
528
+ - Files changed: X
529
+ - Tests added: Y
530
+ - Loop retries needed: N-1
531
+ - Duration: [phase count] phases
532
+
533
+ ### Files
534
+ | File | Change |
535
+ |------|--------|
536
+ | `path/to/file.ts` | Added / Modified |
537
+
538
+ ### Session artifacts
539
+ - Brief: `thoughts/devtronic/brief.md`
540
+ - Tests manifest: `thoughts/devtronic/tests-manifest.md`
541
+ - Plan: `thoughts/devtronic/plan.md`
542
+ ```
543
+
544
+ ---
545
+
546
+ ## Error Handling
547
+
548
+ ### No tests in project
549
+
550
+ If the project has no test runner configured:
551
+ - In HITL: warn and ask "Continue without test validation?"
552
+ - In AFK: skip test generation and loop, go directly to plan → execute → review → PR
553
+
554
+ ### Branch already exists
555
+
556
+ ```bash
557
+ git branch -a | grep <branch-name>
558
+ ```
559
+
560
+ If exists:
561
+ - HITL: ask user (use existing / rename / abort)
562
+ - AFK: append `-2`, `-3` etc. until unique
563
+
564
+ ### `gh` CLI not authenticated
565
+
566
+ ```bash
567
+ gh auth status
568
+ ```
569
+
570
+ If fails:
571
+ - Always escalate to human: "Run `gh auth login` before using devtronic"
572
+
573
+ ### Merge conflicts during execution
574
+
575
+ If a subagent task fails due to conflicts:
576
+ - Pass conflict context to failure-analyst
577
+ - Analyst recommends: rebase first or resolve conflicts manually
578
+ - Always escalate to human for conflict resolution
579
+
580
+ ---
581
+
582
+ ## Examples
583
+
584
+ ```bash
585
+ # Standard HITL run from a GitHub issue
586
+ /devtronic https://github.com/myorg/myapp/issues/42
587
+
588
+ # Fully autonomous run
589
+ /devtronic https://github.com/myorg/myapp/issues/42 --afk
590
+
591
+ # From a plain description
592
+ /devtronic "Add rate limiting to /api/auth/login, max 5 requests per minute per IP"
593
+
594
+ # Increase retries for complex issue
595
+ /devtronic https://github.com/myorg/myapp/issues/88 --afk --max-retries 5
596
+
597
+ # Preview without creating PR
598
+ /devtronic https://github.com/myorg/myapp/issues/42 --dry-run
599
+
600
+ # Skip spec interview (auto-generate from issue body)
601
+ /devtronic https://github.com/myorg/myapp/issues/42 --skip-spec
602
+ ```
603
+
604
+ ---
605
+
606
+ ## Notes
607
+
608
+ - **Requires devtronic core skills** — devtronic uses the same logic as `/generate-tests`, `/create-plan`, and `/execute-plan`. Those skills must be installed.
609
+ - **Requires `gh` CLI** — authenticated with repo write access.
610
+ - **AFK is not magic** — it reduces friction, not mistakes. Start with HITL on unfamiliar codebases.
611
+ - **Session artifacts** — all intermediate files are saved to `thoughts/devtronic/`. Do not delete them until the PR is merged.
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "design-best-practices",
3
+ "description": "Frontend design quality skills: typography, color, layout, accessibility, motion, and UX writing.",
4
+ "version": "1.0.0",
5
+ "license": "MIT",
6
+ "attribution": "Reference docs derived from Anthropic frontend-design skill (Apache 2.0). See NOTICE.md for details.",
7
+ "files": {
8
+ "skills": [
9
+ "design-init",
10
+ "design-review",
11
+ "design-refine",
12
+ "design-system",
13
+ "design-harden"
14
+ ],
15
+ "reference": [
16
+ "typography.md",
17
+ "color-and-contrast.md",
18
+ "spatial-design.md",
19
+ "motion-design.md",
20
+ "interaction-design.md",
21
+ "responsive-design.md",
22
+ "ux-writing.md"
23
+ ],
24
+ "rules": [
25
+ "design-quality.md"
26
+ ]
27
+ }
28
+ }