@mengde1231/rudder 0.6.20 → 0.6.22
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 +148 -136
- package/bin/rudder.js +0 -0
- package/dist/migrations/manifests/0.4.0-beta.1.json +5 -5
- package/dist/migrations/manifests/0.5.14.json +9 -0
- package/dist/migrations/manifests/0.5.15.json +9 -0
- package/dist/migrations/manifests/0.5.16.json +9 -0
- package/dist/migrations/manifests/0.5.17.json +9 -0
- package/dist/migrations/manifests/0.5.19.json +9 -0
- package/dist/migrations/manifests/0.5.20.json +9 -0
- package/dist/migrations/manifests/0.5.21.json +9 -0
- package/dist/migrations/manifests/0.5.22.json +9 -0
- package/dist/migrations/manifests/0.5.23.json +9 -0
- package/dist/migrations/manifests/0.5.30.json +9 -0
- package/dist/migrations/manifests/0.6.1.json +9 -0
- package/dist/migrations/manifests/0.6.11.json +9 -0
- package/dist/migrations/manifests/0.6.20.json +9 -0
- package/dist/migrations/manifests/0.6.21.json +9 -0
- package/dist/migrations/manifests/0.6.22.json +9 -0
- package/dist/templates/codex/config.toml +30 -30
- package/dist/templates/common/bundled-skills/rudder-meta/references/customize-local/change-workflow.md +5 -4
- package/dist/templates/common/bundled-skills/rudder-meta/references/local-architecture/task-system.md +7 -2
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/SKILL.md +41 -41
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/mcp-setup.md +90 -90
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/repository-analysis.md +59 -59
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/spec-task-planning.md +61 -61
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/spec-writing.md +70 -70
- package/dist/templates/common/commands/continue.md +9 -5
- package/dist/templates/common/commands/start.md +8 -8
- package/dist/templates/common/skills/brainstorm.md +28 -27
- package/dist/templates/common/skills/check.md +8 -1
- package/dist/templates/rudder/config.yaml +13 -2
- package/dist/templates/rudder/index.d.ts +1 -0
- package/dist/templates/rudder/index.d.ts.map +1 -1
- package/dist/templates/rudder/index.js +2 -0
- package/dist/templates/rudder/index.js.map +1 -1
- package/dist/templates/rudder/scripts/common/task_context.py +42 -1
- package/dist/templates/rudder/scripts/common/task_readiness.py +176 -0
- package/dist/templates/rudder/scripts/common/task_store.py +23 -36
- package/dist/templates/rudder/scripts/common/types.py +1 -0
- package/dist/templates/rudder/scripts/common/workflow_phase.py +45 -0
- package/dist/templates/rudder/scripts/task.py +45 -4
- package/dist/templates/rudder/workflow.md +75 -37
- package/dist/utils/task-json.d.ts +6 -0
- package/dist/utils/task-json.d.ts.map +1 -1
- package/dist/utils/task-json.js +6 -0
- package/dist/utils/task-json.js.map +1 -1
- package/package.json +26 -27
|
@@ -22,11 +22,15 @@ Shows the Phase Index (Plan / Execute / Finish) with routing + skill mapping.
|
|
|
22
22
|
|
|
23
23
|
## Step 3: Decide Where You Are
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
First apply **Request routing** in `.rudder/workflow.md`: direct questions, code inspection, scheduler administration, and commit-wording requests do not advance a task. Verify that any development request serves the task's business objective and acceptance scope. Supplements, fixes, continuation, and moving from design to implementation reuse related unfinished work; an unrelated objective follows direct-low-risk/new-task routing instead. Same session/module alone does not establish relevance.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- `status=planning` +
|
|
27
|
+
For a related task, route by `status`, PRD completeness, approval, and the invoking platform's execution mode (`codex.dispatch_mode` for Codex; inline by default):
|
|
28
|
+
|
|
29
|
+
- `status=planning` + missing/incomplete PRD or unresolved business decisions → **1.1** (load `rudder-brainstorm`). File existence alone is insufficient.
|
|
30
|
+
- `status=planning` + complete PRD + no user approval → **1.1**, ask only for the unresolved approval/decision. An explicit instruction to implement the agreed plan is already approval; do not ask again.
|
|
31
|
+
- `status=planning` + approved PRD + missing/stale recorded confirmation → record it using `task.py confirm <task-dir>`; do not request the same approval again unless requirements materially changed.
|
|
32
|
+
- `status=planning` + confirmed PRD + sub-agent execution + either JSONL missing, invalid, or seed-only → **1.3**, curate both `implement.jsonl` and `check.jsonl`.
|
|
33
|
+
- `status=planning` + confirmed PRD + (inline execution, or sub-agent execution with both JSONL files valid/curated) → **1.4**, run `task.py start <task-dir> --platform {{CLI_FLAG}}`. Inline ignores old JSONL seeds. A failed readiness gate leaves status planning; resolve the reported blockers instead of entering Phase 2.
|
|
30
34
|
- `status=in_progress` + implementation not started → **2.1**
|
|
31
35
|
- `status=in_progress` + implementation done, not yet checked → **2.2**
|
|
32
36
|
- `status=in_progress` + check passed → **3.1**
|
|
@@ -35,7 +39,7 @@ Shows the Phase Index (Plan / Execute / Finish) with routing + skill mapping.
|
|
|
35
39
|
Phase rules (full detail in `.rudder/workflow.md`):
|
|
36
40
|
|
|
37
41
|
1. Run steps **in order** within a phase — `[required]` steps must not be skipped
|
|
38
|
-
2. `[once]` steps
|
|
42
|
+
2. Skip `[once]` steps only when their completion conditions hold: a complete/approved PRD, current confirmation, and both valid curated JSONL files when applicable. Artifact presence alone is insufficient.
|
|
39
43
|
3. You may go back to an earlier phase if discoveries require it
|
|
40
44
|
|
|
41
45
|
## Step 4: Load the Specific Step
|
|
@@ -34,14 +34,14 @@ cat .rudder/spec/<package>/<layer>/index.md # for each relevant layer
|
|
|
34
34
|
Index files list the specific guideline docs to read when you actually start coding.
|
|
35
35
|
|
|
36
36
|
## Step 4: Decide next action
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
37
|
+
Apply **Request routing** in `.rudder/workflow.md` before resuming any phase:
|
|
38
|
+
|
|
39
|
+
1. Questions, code inspection, scheduler administration, and commit-message drafting are direct requests. Do not create or advance a task; only provide the requested output/action. Business features involving scheduled jobs follow normal routing.
|
|
40
|
+
2. Check whether the request serves an unfinished task's **business objective and acceptance scope**. Read its PRD and status before reuse; same session/module or an active pointer alone does not establish relevance. Supplements, corrections, pre-acceptance fixes, continuation, and design-to-development reuse that task and update relevant artifacts. Check other unfinished tasks when needed; ask one focused question only if ownership is unclear.
|
|
41
|
+
3. A clear, local, low-risk independent edit can be made directly with relevant guidelines and checks; no special bypass phrase or file-count threshold is required.
|
|
42
|
+
4. Otherwise create a task for the independent objective needing durable tracking; an unrelated active task must not absorb it. Use `task.py create "<title>" --slug <name> --platform {{CLI_FLAG}}`, then load `rudder-brainstorm`.
|
|
43
|
+
|
|
44
|
+
For a related task, follow {{CMD_REF:continue}}'s status/approval/mode-aware routing. A planning task with a PRD is **not automatically ready for implementation**. Resolve missing requirements and open questions first; user approval of the agreed plan counts as confirmation without another prompt. Curate both JSONL files only for sub-agent execution, record approval via `task.py confirm`, then run `task.py start <task-dir> --platform {{CLI_FLAG}}`. Codex inline does not require JSONL, including old seed files.
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Brainstorm - Requirements Discovery (AI Coding Enhanced)
|
|
2
2
|
|
|
3
|
-
**CoreRule**:
|
|
3
|
+
**CoreRule**: Resolve business decisions and acceptance boundaries before implementation. Ask only questions that remain unanswered, one at a time, with a recommended option. An explicit instruction to implement a clearly agreed plan is approval; record it and continue without repeating the same confirmation.
|
|
4
4
|
|
|
5
5
|
Ask the questions one at a time.
|
|
6
6
|
|
|
@@ -30,8 +30,8 @@ Triggered from {{CMD_REF:start}} when the user describes a development task, esp
|
|
|
30
30
|
|
|
31
31
|
## Core Principles (Non-negotiable)
|
|
32
32
|
|
|
33
|
-
1. **
|
|
34
|
-
|
|
33
|
+
1. **Route first, then capture**
|
|
34
|
+
Apply Request routing in `.rudder/workflow.md` before entering this skill. Direct answers, scheduler administration, commit-message drafting, and independent low-risk edits do not need a task. For tracked work, reuse a related unfinished task or create one for a new objective.
|
|
35
35
|
|
|
36
36
|
2. **Action before asking**
|
|
37
37
|
If you can derive the answer from repo code, docs, configs, conventions, or quick research — do that first.
|
|
@@ -54,21 +54,25 @@ Triggered from {{CMD_REF:start}} when the user describes a development task, esp
|
|
|
54
54
|
|
|
55
55
|
---
|
|
56
56
|
|
|
57
|
-
## Step 0:
|
|
57
|
+
## Step 0: Establish Task Ownership
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Compare the request with the current and, when relevant, other unfinished tasks' business objectives and acceptance scopes. Reuse a related task for supplements, fixes, continuation, or design-to-development; update its PRD rather than creating a duplicate. Same session/module or an active pointer alone is not evidence of relevance. If ownership is genuinely unclear, ask one focused question.
|
|
60
|
+
|
|
61
|
+
For a new objective requiring durable tracking, create a task even when an unrelated task is active. Direct work was already routed out before this skill. Preserve any previous task's artifacts and status.
|
|
60
62
|
|
|
61
63
|
* Use a **temporary working title** derived from the user's message.
|
|
62
64
|
* It's OK if the title is imperfect — refine later in PRD.
|
|
63
65
|
|
|
64
66
|
```bash
|
|
65
|
-
TASK_DIR=$(python3 ./.rudder/scripts/task.py create "brainstorm: <short goal>" --slug <auto>)
|
|
67
|
+
TASK_DIR=$(python3 ./.rudder/scripts/task.py create "brainstorm: <short goal>" --slug <auto> --platform <platform>)
|
|
66
68
|
```
|
|
67
69
|
|
|
68
70
|
Use a slug without a date prefix. `task.py create` adds the `MM-DD-`
|
|
69
71
|
directory prefix automatically.
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
Replace `<platform>` with the actual invoking CLI flag (e.g. `codex`, `claude`, `gemini`), not the last platform that wrote this shared skill. Task creation and startup must use that same platform; Codex resolves its inline/sub-agent setting from `.rudder/config.yaml`.
|
|
74
|
+
|
|
75
|
+
For a new task, create/seed `prd.md` immediately with what you know. For a related task, update its existing sections and preserve prior decisions:
|
|
72
76
|
|
|
73
77
|
```markdown
|
|
74
78
|
# brainstorm: <short goal>
|
|
@@ -140,16 +144,15 @@ Write findings into PRD:
|
|
|
140
144
|
|
|
141
145
|
---
|
|
142
146
|
|
|
143
|
-
## Step 2:
|
|
147
|
+
## Step 2: Choose Discovery Depth
|
|
144
148
|
|
|
145
149
|
| Complexity | Criteria | Action |
|
|
146
150
|
| ------------ | ------------------------------------------------------ | ------------------------------------------- |
|
|
147
|
-
| **
|
|
148
|
-
| **
|
|
149
|
-
| **
|
|
150
|
-
| **Complex** | Vague goal, architectural choices, multiple approaches | Full brainstorm |
|
|
151
|
+
| **Clear** | Goal, scope, and acceptance are already agreed | Persist the plan; reuse approval and proceed |
|
|
152
|
+
| **Moderate** | Some unresolved business decisions | Ask only the remaining high-value questions |
|
|
153
|
+
| **Complex** | Vague goal, architectural choices, multiple approaches | Explore options and converge on acceptance |
|
|
151
154
|
|
|
152
|
-
>
|
|
155
|
+
> Discovery depth does not determine task boundaries. File count alone is neither a risk measure nor a reason to ask for confirmation. If the user has already approved the scope, skip settled questions and expansion sweeps; revisit only new business decisions or material changes.
|
|
153
156
|
|
|
154
157
|
---
|
|
155
158
|
|
|
@@ -404,7 +407,7 @@ Record the outcome in PRD as an ADR-lite section:
|
|
|
404
407
|
|
|
405
408
|
## Step 8: Final Confirmation + Implementation Plan
|
|
406
409
|
|
|
407
|
-
When open questions are resolved,
|
|
410
|
+
When open questions are resolved, persist the complete requirements and implementation plan. If the user has already instructed you to implement that agreed plan, reuse that approval and continue. Otherwise present the structured summary once and ask only for the outstanding approval. Do not repeat confirmation between workflow phases or for implementation-detail adjustments.
|
|
408
411
|
|
|
409
412
|
### Final confirmation format
|
|
410
413
|
|
|
@@ -449,8 +452,8 @@ For complex tasks with multiple independent work items, create subtasks:
|
|
|
449
452
|
|
|
450
453
|
```bash
|
|
451
454
|
# Create child tasks
|
|
452
|
-
CHILD1=$(python3 ./.rudder/scripts/task.py create "Child task 1" --slug child1 --parent "$TASK_DIR")
|
|
453
|
-
CHILD2=$(python3 ./.rudder/scripts/task.py create "Child task 2" --slug child2 --parent "$TASK_DIR")
|
|
455
|
+
CHILD1=$(python3 ./.rudder/scripts/task.py create "Child task 1" --slug child1 --parent "$TASK_DIR" --platform <platform>)
|
|
456
|
+
CHILD2=$(python3 ./.rudder/scripts/task.py create "Child task 2" --slug child2 --parent "$TASK_DIR" --platform <platform>)
|
|
454
457
|
|
|
455
458
|
# Or link existing tasks
|
|
456
459
|
python3 ./.rudder/scripts/task.py add-subtask "$TASK_DIR" "$CHILD_DIR"
|
|
@@ -512,25 +515,23 @@ Context / Decision / Consequences
|
|
|
512
515
|
|
|
513
516
|
## Integration with Start Workflow
|
|
514
517
|
|
|
515
|
-
After
|
|
518
|
+
After requirements are complete and approved (including approval already given for the agreed plan), continue within `.rudder/workflow.md` Phase 1:
|
|
516
519
|
|
|
517
520
|
```text
|
|
518
521
|
Brainstorm
|
|
519
|
-
Step 0:
|
|
522
|
+
Step 0: Reuse related task or create a new tracked objective
|
|
520
523
|
Step 1–7: Discover requirements, research, converge
|
|
521
|
-
Step 8:
|
|
524
|
+
Step 8: Persist complete requirements → reuse approval or ask once
|
|
522
525
|
↓
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
→
|
|
526
|
-
→ Configure code-spec context (jsonl files)
|
|
527
|
-
→ Activate task
|
|
526
|
+
Phase 1.3: Curate both JSONL files for sub-agent execution; skip for inline
|
|
527
|
+
→ Phase 1.4: task.py confirm <task-dir>
|
|
528
|
+
→ task.py start <task-dir> --platform <platform>
|
|
528
529
|
↓
|
|
529
|
-
|
|
530
|
-
Implement → Check →
|
|
530
|
+
Phase 2 (Execute)
|
|
531
|
+
Implement → Check → Verify → Phase 3 (Finish)
|
|
531
532
|
```
|
|
532
533
|
|
|
533
|
-
|
|
534
|
+
Do not recreate the task or discard the PRD when moving from design to implementation. A PRD file alone does not mean planning is complete: requirements, approval/hash, and applicable context must pass the startup gate. Inline startup ignores existing JSONL seed files.
|
|
534
535
|
|
|
535
536
|
---
|
|
536
537
|
|
|
@@ -6,6 +6,13 @@ Comprehensive quality verification for recently written code. Combines spec comp
|
|
|
6
6
|
|
|
7
7
|
## Step 1: Identify What Changed
|
|
8
8
|
|
|
9
|
+
**Check/Verify boundary (mandatory):** Check reviews the complete task diff;
|
|
10
|
+
Verify executes lint, type-check, tests, build, and business acceptance
|
|
11
|
+
commands. Run this skill only after the implementer has finished the complete
|
|
12
|
+
requirement set and no more planned code remains. Review the full diff, then
|
|
13
|
+
run Verify once. If either stage finds issues, fix them and rerun the affected
|
|
14
|
+
stage; do not alternate between writing one file and verifying it.
|
|
15
|
+
|
|
9
16
|
```bash
|
|
10
17
|
git diff --name-only HEAD
|
|
11
18
|
git status
|
|
@@ -25,7 +32,7 @@ cat .rudder/spec/<package>/<layer>/index.md
|
|
|
25
32
|
|
|
26
33
|
Read the specific guideline files referenced — the index is a pointer, not the goal.
|
|
27
34
|
|
|
28
|
-
## Step 3:
|
|
35
|
+
## Step 3: Verify the Complete Implementation
|
|
29
36
|
|
|
30
37
|
Run the project's lint, type-check, and test commands. Fix any failures before proceeding.
|
|
31
38
|
|
|
@@ -19,9 +19,9 @@ max_journal_lines: 2000
|
|
|
19
19
|
#-------------------------------------------------------------------------------
|
|
20
20
|
|
|
21
21
|
# Auto-commit behavior for session journal + task archive operations.
|
|
22
|
-
# -
|
|
22
|
+
# - false (default): scripts do not auto-stage or auto-commit journal / task changes
|
|
23
23
|
# after add_session.py / task.py archive runs.
|
|
24
|
-
# -
|
|
24
|
+
# - true: scripts auto-stage and auto-commit journal / task changes
|
|
25
25
|
# are still written to disk; you decide whether to git add / commit.
|
|
26
26
|
#
|
|
27
27
|
# Use `false` if your project's .gitignore intentionally excludes `.rudder/`
|
|
@@ -112,6 +112,17 @@ max_journal_lines: 2000
|
|
|
112
112
|
# prompt_injection:
|
|
113
113
|
# skip_keyword: "skip rudder" # empty string disables the configured alias
|
|
114
114
|
|
|
115
|
+
#-------------------------------------------------------------------------------
|
|
116
|
+
# Explicit Rudder bypass
|
|
117
|
+
#-------------------------------------------------------------------------------
|
|
118
|
+
# This is intentionally commented out and reserved as a project-level policy
|
|
119
|
+
# placeholder. The default behavior remains unchanged: an explicit user request
|
|
120
|
+
# such as "skip rudder" may skip the per-turn workflow breadcrumb for that turn.
|
|
121
|
+
# The current runtime does not read this placeholder.
|
|
122
|
+
#
|
|
123
|
+
# skip_rudder:
|
|
124
|
+
# enabled: false
|
|
125
|
+
|
|
115
126
|
#-------------------------------------------------------------------------------
|
|
116
127
|
# Sub-agent context injection limits
|
|
117
128
|
#-------------------------------------------------------------------------------
|
|
@@ -31,6 +31,7 @@ export declare const commonGit: string;
|
|
|
31
31
|
export declare const commonTypes: string;
|
|
32
32
|
export declare const commonTasks: string;
|
|
33
33
|
export declare const commonTaskContext: string;
|
|
34
|
+
export declare const commonTaskReadiness: string;
|
|
34
35
|
export declare const commonTaskStore: string;
|
|
35
36
|
export declare const commonSessionContext: string;
|
|
36
37
|
export declare const commonPackagesContext: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/rudder/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH,eAAO,MAAM,WAAW,QAAsC,CAAC;AAG/D,eAAO,MAAM,UAAU,QAA6C,CAAC;AACrE,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,eAAe,QAA8C,CAAC;AAC3E,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAC9E,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAC9E,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAC9E,eAAO,MAAM,YAAY,QAA2C,CAAC;AACrE,eAAO,MAAM,QAAQ,QAAuC,CAAC;AAC7D,eAAO,MAAM,SAAS,QAAwC,CAAC;AAC/D,eAAO,MAAM,SAAS,QAAwC,CAAC;AAC/D,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,iBAAiB,QAAiD,CAAC;AAChF,eAAO,MAAM,eAAe,QAA+C,CAAC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AM,SAAS,QAAwC,CAAC;AAC/D,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,WAAW,QAA0C,CAAC;AACnE,eAAO,MAAM,iBAAiB,QAAiD,CAAC;AAChF,eAAO,MAAM,mBAAmB,QAAmD,CAAC;AACpF,eAAO,MAAM,eAAe,QAA+C,CAAC;AAC5E,eAAO,MAAM,oBAAoB,QAEhC,CAAC;AACF,eAAO,MAAM,qBAAqB,QAEjC,CAAC;AACF,eAAO,MAAM,mBAAmB,QAE/B,CAAC;AACF,eAAO,MAAM,kBAAkB,QAE9B,CAAC;AACF,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAG9E,eAAO,MAAM,kBAAkB,QAA2C,CAAC;AAC3E,eAAO,MAAM,mBAAmB,QAA4C,CAAC;AAC7E,eAAO,MAAM,UAAU,QAAkC,CAAC;AAC1D,eAAO,MAAM,gBAAgB,QAAyC,CAAC;AACvE,eAAO,MAAM,gBAAgB,QAAyC,CAAC;AAGvE,eAAO,MAAM,kBAAkB,QAA8B,CAAC;AAC9D,eAAO,MAAM,kBAAkB,QAA8B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,QAAmC,CAAC;AACvE,eAAO,MAAM,iBAAiB,QAAgC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,aAAa,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsCnD"}
|
|
@@ -41,6 +41,7 @@ export const commonGit = readTemplate("scripts/common/git.py");
|
|
|
41
41
|
export const commonTypes = readTemplate("scripts/common/types.py");
|
|
42
42
|
export const commonTasks = readTemplate("scripts/common/tasks.py");
|
|
43
43
|
export const commonTaskContext = readTemplate("scripts/common/task_context.py");
|
|
44
|
+
export const commonTaskReadiness = readTemplate("scripts/common/task_readiness.py");
|
|
44
45
|
export const commonTaskStore = readTemplate("scripts/common/task_store.py");
|
|
45
46
|
export const commonSessionContext = readTemplate("scripts/common/session_context.py");
|
|
46
47
|
export const commonPackagesContext = readTemplate("scripts/common/packages_context.py");
|
|
@@ -81,6 +82,7 @@ export function getAllScripts() {
|
|
|
81
82
|
scripts.set("common/types.py", commonTypes);
|
|
82
83
|
scripts.set("common/tasks.py", commonTasks);
|
|
83
84
|
scripts.set("common/task_context.py", commonTaskContext);
|
|
85
|
+
scripts.set("common/task_readiness.py", commonTaskReadiness);
|
|
84
86
|
scripts.set("common/task_store.py", commonTaskStore);
|
|
85
87
|
scripts.set("common/session_context.py", commonSessionContext);
|
|
86
88
|
scripts.set("common/packages_context.py", commonPackagesContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/rudder/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED,gCAAgC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAE/D,0BAA0B;AAC1B,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC,4BAA4B,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,yBAAyB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY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|
import argparse
|
|
21
21
|
import json
|
|
22
|
+
from datetime import datetime, timezone
|
|
22
23
|
from pathlib import Path
|
|
23
24
|
|
|
24
25
|
from .log import Colors, colored
|
|
25
|
-
from .paths import get_repo_root
|
|
26
|
+
from .paths import get_developer, get_repo_root
|
|
26
27
|
from .task_utils import resolve_task_dir
|
|
28
|
+
from .task_readiness import prd_hash, validate_prd
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def cmd_confirm(args: argparse.Namespace) -> int:
|
|
32
|
+
"""Record explicit user confirmation for the current PRD."""
|
|
33
|
+
repo_root = get_repo_root()
|
|
34
|
+
target_dir = resolve_task_dir(args.dir, repo_root)
|
|
35
|
+
task_json = target_dir / "task.json"
|
|
36
|
+
prd_path = target_dir / "prd.md"
|
|
37
|
+
if not target_dir.is_dir() or not task_json.is_file():
|
|
38
|
+
print(colored("Error: task directory with task.json required", Colors.RED))
|
|
39
|
+
return 1
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
existing_data = json.loads(task_json.read_text(encoding="utf-8"))
|
|
43
|
+
except (OSError, json.JSONDecodeError):
|
|
44
|
+
print(colored(f"Error: failed to read {task_json}", Colors.RED))
|
|
45
|
+
return 1
|
|
46
|
+
if existing_data.get("status") != "planning":
|
|
47
|
+
print(colored("Error: requirements can only be confirmed while task is planning", Colors.RED))
|
|
48
|
+
return 1
|
|
49
|
+
|
|
50
|
+
errors = validate_prd(prd_path)
|
|
51
|
+
if errors:
|
|
52
|
+
print(colored("Requirements are not ready for confirmation:", Colors.RED))
|
|
53
|
+
for error in errors:
|
|
54
|
+
print(f" - {error}")
|
|
55
|
+
return 1
|
|
56
|
+
|
|
57
|
+
developer = get_developer(repo_root) or "unknown"
|
|
58
|
+
data = existing_data
|
|
59
|
+
data["requirements"] = {
|
|
60
|
+
"status": "confirmed",
|
|
61
|
+
"confirmed_by": developer,
|
|
62
|
+
"confirmed_at": datetime.now(timezone.utc).isoformat(),
|
|
63
|
+
"prd_hash": prd_hash(prd_path),
|
|
64
|
+
}
|
|
65
|
+
task_json.write_text(json.dumps(data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
|
66
|
+
print(colored(f"Requirements confirmed for: {target_dir.name}", Colors.GREEN))
|
|
67
|
+
return 0
|
|
27
68
|
|
|
28
69
|
|
|
29
70
|
# =============================================================================
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Readiness checks for entering the implementation phase."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import hashlib
|
|
7
|
+
import json
|
|
8
|
+
import re
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from .workflow_phase import requires_task_context
|
|
12
|
+
|
|
13
|
+
_SECTION_RE = re.compile(r"^##\s+(.+?)\s*$", re.IGNORECASE)
|
|
14
|
+
_CHECKBOX_RE = re.compile(r"^\s*[-*+]\s+\[[ xX]\]\s+\S+")
|
|
15
|
+
_EMPTY_QUESTIONS = {
|
|
16
|
+
"none",
|
|
17
|
+
"no",
|
|
18
|
+
"n/a",
|
|
19
|
+
"na",
|
|
20
|
+
"resolved",
|
|
21
|
+
"\u65e0",
|
|
22
|
+
"\u65e0\u95ee\u9898",
|
|
23
|
+
"\u5df2\u89e3\u51b3",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# Conservative checks for unambiguous mutually exclusive rules.
|
|
27
|
+
_CONFLICT_RULES: tuple[tuple[str, str, str], ...] = (
|
|
28
|
+
(
|
|
29
|
+
"automatic save vs explicit save",
|
|
30
|
+
r"(?:automatic|auto[- ]?)save|自动保存",
|
|
31
|
+
r"(?:click(?:s|ed)?|button|manual|explicit)[ -]?save|点击保存|手动保存|点击[“\"]?保存",
|
|
32
|
+
),
|
|
33
|
+
(
|
|
34
|
+
"lock after success vs continue editing",
|
|
35
|
+
r"(?:lock|locked|read[- ]only)\b.{0,50}(?:after|on|when)?\s*success|成功后锁定|成功后只读",
|
|
36
|
+
r"(?:continue|仍可|继续)\s*(?:edit|editing)|成功后继续编辑|成功后仍可编辑",
|
|
37
|
+
),
|
|
38
|
+
(
|
|
39
|
+
"row mutation allowed vs forbidden",
|
|
40
|
+
r"(?:allow|支持|允许).{0,30}(?:add|delete|remove)\s*(?:row|rows)?|允许新增|允许删除|可新增|可删除",
|
|
41
|
+
r"(?:cannot|must not|禁止|不允许).{0,30}(?:add|delete|remove)\s*(?:row|rows)?|禁止新增|禁止删除|不可新增|不可删除",
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def prd_hash(prd_path: Path) -> str:
|
|
47
|
+
"""Return a stable SHA-256 hash for a UTF-8 PRD file."""
|
|
48
|
+
return hashlib.sha256(prd_path.read_bytes()).hexdigest()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _section_body(content: str, title: str) -> list[str] | None:
|
|
52
|
+
lines = content.splitlines()
|
|
53
|
+
in_section = False
|
|
54
|
+
body: list[str] = []
|
|
55
|
+
for line in lines:
|
|
56
|
+
match = _SECTION_RE.match(line.strip())
|
|
57
|
+
if match:
|
|
58
|
+
if in_section:
|
|
59
|
+
break
|
|
60
|
+
in_section = match.group(1).strip().lower() == title.lower()
|
|
61
|
+
continue
|
|
62
|
+
if in_section:
|
|
63
|
+
body.append(line)
|
|
64
|
+
return body if in_section else None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _has_unresolved_questions(body: list[str]) -> bool:
|
|
68
|
+
for line in body:
|
|
69
|
+
value = re.sub(r"^\s*(?:[-*+]\s+|\d+[.)]\s+)", "", line).strip()
|
|
70
|
+
if not value or value.startswith("<!--") or value.endswith("-->"):
|
|
71
|
+
continue
|
|
72
|
+
if value.lower().rstrip("。.!!") in _EMPTY_QUESTIONS:
|
|
73
|
+
continue
|
|
74
|
+
return True
|
|
75
|
+
return False
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def validate_prd(prd_path: Path) -> list[str]:
|
|
79
|
+
"""Validate the minimum PRD contract required before implementation."""
|
|
80
|
+
errors: list[str] = []
|
|
81
|
+
if not prd_path.is_file():
|
|
82
|
+
return ["prd.md is missing"]
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
content = prd_path.read_text(encoding="utf-8")
|
|
86
|
+
except OSError as exc:
|
|
87
|
+
return [f"prd.md cannot be read: {exc}"]
|
|
88
|
+
if not content.strip():
|
|
89
|
+
errors.append("prd.md is empty")
|
|
90
|
+
|
|
91
|
+
acceptance = _section_body(content, "Acceptance Criteria")
|
|
92
|
+
if acceptance is None:
|
|
93
|
+
errors.append("prd.md is missing an 'Acceptance Criteria' section")
|
|
94
|
+
elif not any(_CHECKBOX_RE.match(line) for line in acceptance):
|
|
95
|
+
errors.append("Acceptance Criteria must contain at least one checklist item")
|
|
96
|
+
|
|
97
|
+
questions = _section_body(content, "Open Questions")
|
|
98
|
+
if questions is not None and _has_unresolved_questions(questions):
|
|
99
|
+
errors.append("prd.md contains unresolved Open Questions")
|
|
100
|
+
lowered = content.lower()
|
|
101
|
+
for label, left, right in _CONFLICT_RULES:
|
|
102
|
+
if re.search(left, lowered, re.IGNORECASE) and re.search(right, lowered, re.IGNORECASE):
|
|
103
|
+
errors.append(f"prd.md contains conflicting rules: {label}")
|
|
104
|
+
return errors
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _jsonl_entries(path: Path, repo_root: Path) -> tuple[int, list[str]]:
|
|
108
|
+
if not path.is_file():
|
|
109
|
+
return 0, [f"{path.name} is missing"]
|
|
110
|
+
entries = 0
|
|
111
|
+
errors: list[str] = []
|
|
112
|
+
for line_number, line in enumerate(path.read_text(encoding="utf-8").splitlines(), 1):
|
|
113
|
+
if not line.strip():
|
|
114
|
+
continue
|
|
115
|
+
try:
|
|
116
|
+
data = json.loads(line)
|
|
117
|
+
except json.JSONDecodeError:
|
|
118
|
+
errors.append(f"{path.name}:{line_number} contains invalid JSON")
|
|
119
|
+
continue
|
|
120
|
+
if not isinstance(data, dict):
|
|
121
|
+
errors.append(f"{path.name}:{line_number} must contain a JSON object")
|
|
122
|
+
continue
|
|
123
|
+
file_path = data.get("file")
|
|
124
|
+
if not file_path:
|
|
125
|
+
continue
|
|
126
|
+
entries += 1
|
|
127
|
+
target = repo_root / str(file_path).rstrip("/")
|
|
128
|
+
if data.get("type", "file") == "directory":
|
|
129
|
+
if not target.is_dir():
|
|
130
|
+
errors.append(f"{path.name}:{line_number} references missing directory: {file_path}")
|
|
131
|
+
elif not target.is_file():
|
|
132
|
+
errors.append(f"{path.name}:{line_number} references missing file: {file_path}")
|
|
133
|
+
return entries, errors
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def validate_context_files(
|
|
137
|
+
task_dir: Path, repo_root: Path, platform: str | None = None,
|
|
138
|
+
) -> list[str]:
|
|
139
|
+
"""Require curated JSONL for sub-agent execution, including missing files."""
|
|
140
|
+
if not requires_task_context(repo_root, platform):
|
|
141
|
+
return []
|
|
142
|
+
files = [task_dir / "implement.jsonl", task_dir / "check.jsonl"]
|
|
143
|
+
errors: list[str] = []
|
|
144
|
+
for path in files:
|
|
145
|
+
entries, entry_errors = _jsonl_entries(path, repo_root)
|
|
146
|
+
errors.extend(entry_errors)
|
|
147
|
+
if entries == 0:
|
|
148
|
+
errors.append(f"{path.name} has no curated context entries (seed-only or empty)")
|
|
149
|
+
return errors
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def validate_task_readiness(
|
|
153
|
+
task_dir: Path,
|
|
154
|
+
repo_root: Path,
|
|
155
|
+
task_data: dict,
|
|
156
|
+
platform: str | None = None,
|
|
157
|
+
) -> list[str]:
|
|
158
|
+
"""Return blocking reasons for a planning task entering implementation."""
|
|
159
|
+
errors = validate_prd(task_dir / "prd.md")
|
|
160
|
+
errors.extend(validate_context_files(task_dir, repo_root, platform))
|
|
161
|
+
|
|
162
|
+
requirements = task_data.get("requirements")
|
|
163
|
+
if not isinstance(requirements, dict) or requirements.get("status") != "confirmed":
|
|
164
|
+
errors.append("requirements are not confirmed; run 'task.py confirm <task-dir>'")
|
|
165
|
+
else:
|
|
166
|
+
expected_hash = requirements.get("prd_hash")
|
|
167
|
+
prd_path = task_dir / "prd.md"
|
|
168
|
+
current_hash: str | None = None
|
|
169
|
+
if prd_path.is_file():
|
|
170
|
+
try:
|
|
171
|
+
current_hash = prd_hash(prd_path)
|
|
172
|
+
except OSError:
|
|
173
|
+
current_hash = None
|
|
174
|
+
if not isinstance(expected_hash, str) or expected_hash != current_hash:
|
|
175
|
+
errors.append("prd.md changed after confirmation; reconfirm the requirements")
|
|
176
|
+
return errors
|
|
@@ -53,6 +53,7 @@ from .task_utils import (
|
|
|
53
53
|
resolve_task_dir,
|
|
54
54
|
run_task_hooks,
|
|
55
55
|
)
|
|
56
|
+
from .workflow_phase import requires_task_context
|
|
56
57
|
|
|
57
58
|
|
|
58
59
|
# =============================================================================
|
|
@@ -87,25 +88,6 @@ def ensure_tasks_dir(repo_root: Path) -> Path:
|
|
|
87
88
|
# Sub-agent platform detection + JSONL seeding
|
|
88
89
|
# =============================================================================
|
|
89
90
|
|
|
90
|
-
# Config directories of platforms that consume implement.jsonl / check.jsonl.
|
|
91
|
-
# Keep in sync with src/types/ai-tools.ts AI_TOOLS entries — these are the
|
|
92
|
-
# platforms listed in workflow.md's "agent-capable" Skill Routing block
|
|
93
|
-
# (Class-1 hook-inject + Class-2 pull-based preludes). Kilo / Antigravity /
|
|
94
|
-
# Windsurf are NOT in this list: they do not consume JSONL.
|
|
95
|
-
_SUBAGENT_CONFIG_DIRS: tuple[str, ...] = (
|
|
96
|
-
".claude",
|
|
97
|
-
".cursor",
|
|
98
|
-
".codex",
|
|
99
|
-
".kiro",
|
|
100
|
-
".gemini",
|
|
101
|
-
".opencode",
|
|
102
|
-
".qoder",
|
|
103
|
-
".codebuddy",
|
|
104
|
-
".factory", # Factory Droid
|
|
105
|
-
".github/copilot",
|
|
106
|
-
".pi", # Pi Agent
|
|
107
|
-
)
|
|
108
|
-
|
|
109
91
|
_SEED_EXAMPLE = (
|
|
110
92
|
"Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. "
|
|
111
93
|
"Put spec/research files only — no code paths. "
|
|
@@ -114,19 +96,6 @@ _SEED_EXAMPLE = (
|
|
|
114
96
|
)
|
|
115
97
|
|
|
116
98
|
|
|
117
|
-
def _has_subagent_platform(repo_root: Path) -> bool:
|
|
118
|
-
"""Return True if any sub-agent-capable platform is configured.
|
|
119
|
-
|
|
120
|
-
Detected by probing well-known config directories at the repo root. Used
|
|
121
|
-
only to decide whether ``task.py create`` should seed empty
|
|
122
|
-
``implement.jsonl`` / ``check.jsonl`` files.
|
|
123
|
-
"""
|
|
124
|
-
for config_dir in _SUBAGENT_CONFIG_DIRS:
|
|
125
|
-
if (repo_root / config_dir).is_dir():
|
|
126
|
-
return True
|
|
127
|
-
return False
|
|
128
|
-
|
|
129
|
-
|
|
130
99
|
def _write_seed_jsonl(path: Path) -> None:
|
|
131
100
|
"""Write a one-line seed JSONL file with a self-describing ``_example``.
|
|
132
101
|
|
|
@@ -146,6 +115,15 @@ def cmd_create(args: argparse.Namespace) -> int:
|
|
|
146
115
|
"""Create a new task."""
|
|
147
116
|
repo_root = get_repo_root()
|
|
148
117
|
|
|
118
|
+
# Resolve before writing task files; an invalid platform must not leave a
|
|
119
|
+
# partially created task behind.
|
|
120
|
+
platform = getattr(args, "platform", None)
|
|
121
|
+
try:
|
|
122
|
+
context_required = requires_task_context(repo_root, platform)
|
|
123
|
+
except ValueError as exc:
|
|
124
|
+
print(colored(f"Error: {exc}", Colors.RED), file=sys.stderr)
|
|
125
|
+
return 1
|
|
126
|
+
|
|
149
127
|
if not args.title:
|
|
150
128
|
print(colored("Error: title is required", Colors.RED), file=sys.stderr)
|
|
151
129
|
return 1
|
|
@@ -229,16 +207,22 @@ def cmd_create(args: argparse.Namespace) -> int:
|
|
|
229
207
|
"relatedFiles": [],
|
|
230
208
|
"notes": "",
|
|
231
209
|
"meta": {},
|
|
210
|
+
"requirements": {
|
|
211
|
+
"status": "pending",
|
|
212
|
+
"confirmed_by": None,
|
|
213
|
+
"confirmed_at": None,
|
|
214
|
+
"prd_hash": None,
|
|
215
|
+
},
|
|
232
216
|
}
|
|
233
217
|
|
|
234
218
|
write_json(task_json_path, task_data)
|
|
235
219
|
|
|
236
|
-
# Seed implement.jsonl / check.jsonl for
|
|
220
|
+
# Seed implement.jsonl / check.jsonl only for this execution mode.
|
|
237
221
|
# Agent curates real entries in Phase 1.3 (see .rudder/workflow.md).
|
|
238
222
|
# Agent-less platforms (Kilo / Antigravity / Windsurf) skip this — they
|
|
239
223
|
# load specs via the rudder-before-dev skill instead of JSONL.
|
|
240
224
|
seeded_jsonl = False
|
|
241
|
-
if
|
|
225
|
+
if context_required:
|
|
242
226
|
for jsonl_name in ("implement.jsonl", "check.jsonl"):
|
|
243
227
|
jsonl_path = task_dir / jsonl_name
|
|
244
228
|
if not jsonl_path.exists():
|
|
@@ -286,6 +270,7 @@ def cmd_create(args: argparse.Namespace) -> int:
|
|
|
286
270
|
print(colored(f"Created task: {dir_name}", Colors.GREEN), file=sys.stderr)
|
|
287
271
|
print("", file=sys.stderr)
|
|
288
272
|
print(colored("Next steps:", Colors.BLUE), file=sys.stderr)
|
|
273
|
+
platform_option = f" --platform {platform}" if platform else ""
|
|
289
274
|
print(" 1. Create prd.md with requirements", file=sys.stderr)
|
|
290
275
|
if seeded_jsonl:
|
|
291
276
|
print(
|
|
@@ -293,9 +278,11 @@ def cmd_create(args: argparse.Namespace) -> int:
|
|
|
293
278
|
"see .rudder/workflow.md Phase 1.3)",
|
|
294
279
|
file=sys.stderr,
|
|
295
280
|
)
|
|
296
|
-
print(" 3. Run: python3 task.py
|
|
281
|
+
print(" 3. Run: python3 task.py confirm <dir>", file=sys.stderr)
|
|
282
|
+
print(f" 4. Run: python3 task.py start <dir>{platform_option}", file=sys.stderr)
|
|
297
283
|
else:
|
|
298
|
-
print(" 2. Run: python3 task.py
|
|
284
|
+
print(" 2. Run: python3 task.py confirm <dir>", file=sys.stderr)
|
|
285
|
+
print(f" 3. Run: python3 task.py start <dir>{platform_option}", file=sys.stderr)
|
|
299
286
|
print("", file=sys.stderr)
|
|
300
287
|
|
|
301
288
|
# Output relative path for script chaining
|