@tothemax/tasking 0.0.0-stage → 0.6.15
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 +119 -2
- package/README.zh-CN.md +120 -0
- package/assets/skills/install-glab/SKILL.md +70 -0
- package/assets/skills/land/SKILL.md +63 -0
- package/assets/skills/land/land_watch.py +312 -0
- package/assets/skills/openspec-archive-change/SKILL.md +114 -0
- package/assets/skills/opsx-grill-with-docs/SKILL.md +193 -0
- package/assets/skills/opsx-implement/SKILL.md +258 -0
- package/assets/skills/opsx-propose-with-tdd/SKILL.md +271 -0
- package/assets/workflows/WORKFLOW.code-mr.en.md.example +345 -0
- package/assets/workflows/WORKFLOW.code-mr.md.example +339 -0
- package/assets/workflows/WORKFLOW.feishu-direct.en.md.example +267 -0
- package/assets/workflows/WORKFLOW.feishu-direct.md.example +258 -0
- package/assets/workflows/WORKFLOW.grill-openspec.en.md.example +362 -0
- package/assets/workflows/WORKFLOW.grill-openspec.md.example +356 -0
- package/assets/workflows/WORKFLOW.minimal.en.md.example +296 -0
- package/assets/workflows/WORKFLOW.minimal.md.example +289 -0
- package/dist/adapters/feishu/events.d.ts +55 -0
- package/dist/adapters/feishu/events.d.ts.map +1 -0
- package/dist/adapters/feishu/events.js +184 -0
- package/dist/adapters/feishu/events.js.map +1 -0
- package/dist/adapters/feishu/index.d.ts +2 -0
- package/dist/adapters/feishu/index.d.ts.map +1 -0
- package/dist/adapters/feishu/index.js +2 -0
- package/dist/adapters/feishu/index.js.map +1 -0
- package/dist/adapters/feishu/probe.d.ts +31 -0
- package/dist/adapters/feishu/probe.d.ts.map +1 -0
- package/dist/adapters/feishu/probe.js +179 -0
- package/dist/adapters/feishu/probe.js.map +1 -0
- package/dist/adapters/feishu/source.d.ts +124 -0
- package/dist/adapters/feishu/source.d.ts.map +1 -0
- package/dist/adapters/feishu/source.js +715 -0
- package/dist/adapters/feishu/source.js.map +1 -0
- package/dist/adapters/jira/index.d.ts +2 -0
- package/dist/adapters/jira/index.d.ts.map +1 -0
- package/dist/adapters/jira/index.js +2 -0
- package/dist/adapters/jira/index.js.map +1 -0
- package/dist/adapters/jira/tracker.d.ts +63 -0
- package/dist/adapters/jira/tracker.d.ts.map +1 -0
- package/dist/adapters/jira/tracker.js +402 -0
- package/dist/adapters/jira/tracker.js.map +1 -0
- package/dist/bridge/binding-store.d.ts +93 -0
- package/dist/bridge/binding-store.d.ts.map +1 -0
- package/dist/bridge/binding-store.js +365 -0
- package/dist/bridge/binding-store.js.map +1 -0
- package/dist/bridge/commands.d.ts +45 -0
- package/dist/bridge/commands.d.ts.map +1 -0
- package/dist/bridge/commands.js +197 -0
- package/dist/bridge/commands.js.map +1 -0
- package/dist/bridge/comment-bridge.d.ts +116 -0
- package/dist/bridge/comment-bridge.d.ts.map +1 -0
- package/dist/bridge/comment-bridge.js +1473 -0
- package/dist/bridge/comment-bridge.js.map +1 -0
- package/dist/cli/daemon-info.d.ts +17 -0
- package/dist/cli/daemon-info.d.ts.map +1 -0
- package/dist/cli/daemon-info.js +64 -0
- package/dist/cli/daemon-info.js.map +1 -0
- package/dist/cli/daemon.d.ts +27 -0
- package/dist/cli/daemon.d.ts.map +1 -0
- package/dist/cli/daemon.js +77 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/doctor.d.ts +7 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +156 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/event-channel.d.ts +16 -0
- package/dist/cli/event-channel.d.ts.map +1 -0
- package/dist/cli/event-channel.js +51 -0
- package/dist/cli/event-channel.js.map +1 -0
- package/dist/cli/help.d.ts +3 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +155 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +774 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +64 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +1296 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/instance-lock.d.ts +13 -0
- package/dist/cli/instance-lock.d.ts.map +1 -0
- package/dist/cli/instance-lock.js +53 -0
- package/dist/cli/instance-lock.js.map +1 -0
- package/dist/cli/prompts.d.ts +13 -0
- package/dist/cli/prompts.d.ts.map +1 -0
- package/dist/cli/prompts.js +26 -0
- package/dist/cli/prompts.js.map +1 -0
- package/dist/cli/style.d.ts +26 -0
- package/dist/cli/style.d.ts.map +1 -0
- package/dist/cli/style.js +58 -0
- package/dist/cli/style.js.map +1 -0
- package/dist/cli/tui-helpers.d.ts +5 -0
- package/dist/cli/tui-helpers.d.ts.map +1 -0
- package/dist/cli/tui-helpers.js +124 -0
- package/dist/cli/tui-helpers.js.map +1 -0
- package/dist/cli/workflow-path.d.ts +12 -0
- package/dist/cli/workflow-path.d.ts.map +1 -0
- package/dist/cli/workflow-path.js +37 -0
- package/dist/cli/workflow-path.js.map +1 -0
- package/dist/config/config-types.d.ts +180 -0
- package/dist/config/config-types.d.ts.map +1 -0
- package/dist/config/config-types.js +71 -0
- package/dist/config/config-types.js.map +1 -0
- package/dist/config/dotenv.d.ts +2 -0
- package/dist/config/dotenv.d.ts.map +1 -0
- package/dist/config/dotenv.js +10 -0
- package/dist/config/dotenv.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +5 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +304 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/manager.d.ts +31 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +110 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/resolver.d.ts +6 -0
- package/dist/config/resolver.d.ts.map +1 -0
- package/dist/config/resolver.js +267 -0
- package/dist/config/resolver.js.map +1 -0
- package/dist/config/validator.d.ts +9 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +70 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/direct/card.d.ts +49 -0
- package/dist/direct/card.d.ts.map +1 -0
- package/dist/direct/card.js +274 -0
- package/dist/direct/card.js.map +1 -0
- package/dist/direct/command.d.ts +12 -0
- package/dist/direct/command.d.ts.map +1 -0
- package/dist/direct/command.js +23 -0
- package/dist/direct/command.js.map +1 -0
- package/dist/direct/manager.d.ts +159 -0
- package/dist/direct/manager.d.ts.map +1 -0
- package/dist/direct/manager.js +1862 -0
- package/dist/direct/manager.js.map +1 -0
- package/dist/mcp/inject.d.ts +5 -0
- package/dist/mcp/inject.d.ts.map +1 -0
- package/dist/mcp/inject.js +51 -0
- package/dist/mcp/inject.js.map +1 -0
- package/dist/mcp/jira-server.d.ts +29 -0
- package/dist/mcp/jira-server.d.ts.map +1 -0
- package/dist/mcp/jira-server.js +288 -0
- package/dist/mcp/jira-server.js.map +1 -0
- package/dist/observability/activity-store.d.ts +29 -0
- package/dist/observability/activity-store.d.ts.map +1 -0
- package/dist/observability/activity-store.js +32 -0
- package/dist/observability/activity-store.js.map +1 -0
- package/dist/observability/config-view.d.ts +19 -0
- package/dist/observability/config-view.d.ts.map +1 -0
- package/dist/observability/config-view.js +61 -0
- package/dist/observability/config-view.js.map +1 -0
- package/dist/observability/http-dashboard.d.ts +36 -0
- package/dist/observability/http-dashboard.d.ts.map +1 -0
- package/dist/observability/http-dashboard.js +297 -0
- package/dist/observability/http-dashboard.js.map +1 -0
- package/dist/observability/log-buffer.d.ts +21 -0
- package/dist/observability/log-buffer.d.ts.map +1 -0
- package/dist/observability/log-buffer.js +69 -0
- package/dist/observability/log-buffer.js.map +1 -0
- package/dist/observability/logger.d.ts +37 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +114 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/snapshot.d.ts +11 -0
- package/dist/observability/snapshot.d.ts.map +1 -0
- package/dist/observability/snapshot.js +59 -0
- package/dist/observability/snapshot.js.map +1 -0
- package/dist/observability/terminal-dashboard.d.ts +155 -0
- package/dist/observability/terminal-dashboard.d.ts.map +1 -0
- package/dist/observability/terminal-dashboard.js +1598 -0
- package/dist/observability/terminal-dashboard.js.map +1 -0
- package/dist/observability/wrap.d.ts +4 -0
- package/dist/observability/wrap.d.ts.map +1 -0
- package/dist/observability/wrap.js +80 -0
- package/dist/observability/wrap.js.map +1 -0
- package/dist/scheduler/index.d.ts +2 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +2 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/scheduler/scheduler.d.ts +52 -0
- package/dist/scheduler/scheduler.d.ts.map +1 -0
- package/dist/scheduler/scheduler.js +535 -0
- package/dist/scheduler/scheduler.js.map +1 -0
- package/dist/shared/agent-resolver.d.ts +11 -0
- package/dist/shared/agent-resolver.d.ts.map +1 -0
- package/dist/shared/agent-resolver.js +20 -0
- package/dist/shared/agent-resolver.js.map +1 -0
- package/dist/shared/errors.d.ts +14 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +24 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/info-card.d.ts +24 -0
- package/dist/shared/info-card.d.ts.map +1 -0
- package/dist/shared/info-card.js +46 -0
- package/dist/shared/info-card.js.map +1 -0
- package/dist/shared/types.d.ts +148 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +15 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/translate/card.d.ts +2 -0
- package/dist/translate/card.d.ts.map +1 -0
- package/dist/translate/card.js +17 -0
- package/dist/translate/card.js.map +1 -0
- package/dist/translate/dict.d.ts +7 -0
- package/dist/translate/dict.d.ts.map +1 -0
- package/dist/translate/dict.js +895 -0
- package/dist/translate/dict.js.map +1 -0
- package/dist/translate/locale.d.ts +8 -0
- package/dist/translate/locale.d.ts.map +1 -0
- package/dist/translate/locale.js +75 -0
- package/dist/translate/locale.js.map +1 -0
- package/dist/translate/normalize.d.ts +4 -0
- package/dist/translate/normalize.d.ts.map +1 -0
- package/dist/translate/normalize.js +38 -0
- package/dist/translate/normalize.js.map +1 -0
- package/dist/translate/output.d.ts +3 -0
- package/dist/translate/output.d.ts.map +1 -0
- package/dist/translate/output.js +16 -0
- package/dist/translate/output.js.map +1 -0
- package/dist/worker/prompt.d.ts +11 -0
- package/dist/worker/prompt.d.ts.map +1 -0
- package/dist/worker/prompt.js +153 -0
- package/dist/worker/prompt.js.map +1 -0
- package/dist/worker/runner.d.ts +101 -0
- package/dist/worker/runner.d.ts.map +1 -0
- package/dist/worker/runner.js +448 -0
- package/dist/worker/runner.js.map +1 -0
- package/dist/workspace/index.d.ts +2 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +2 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/manager.d.ts +37 -0
- package/dist/workspace/manager.d.ts.map +1 -0
- package/dist/workspace/manager.js +157 -0
- package/dist/workspace/manager.js.map +1 -0
- package/package.json +65 -4
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opsx-propose-with-tdd
|
|
3
|
+
description: Propose a new change - create it and generate all artifacts in one step, with TDD guidance for task structure
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Propose a new change - create the change and generate all artifacts in one step.
|
|
7
|
+
|
|
8
|
+
I'll create a change with artifacts:
|
|
9
|
+
- proposal.md (what & why)
|
|
10
|
+
- design.md (how)
|
|
11
|
+
- tasks.md (implementation steps)
|
|
12
|
+
|
|
13
|
+
When ready to implement, run /opsx-implement
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Input**: The argument after `/opsx-propose-with-tdd` is the change name (kebab-case), OR a description of what the user wants to build.
|
|
18
|
+
|
|
19
|
+
**Steps**
|
|
20
|
+
|
|
21
|
+
1. **If no input provided, ask what they want to build**
|
|
22
|
+
|
|
23
|
+
Use the **question tool** (open-ended, no preset options) to ask:
|
|
24
|
+
> "What change do you want to work on? Describe what you want to build or fix."
|
|
25
|
+
|
|
26
|
+
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
|
27
|
+
|
|
28
|
+
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
29
|
+
|
|
30
|
+
2. **Create the change directory**
|
|
31
|
+
```bash
|
|
32
|
+
openspec new change "<name>"
|
|
33
|
+
```
|
|
34
|
+
This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
|
|
35
|
+
|
|
36
|
+
3. **Get the artifact build order**
|
|
37
|
+
```bash
|
|
38
|
+
openspec status --change "<name>" --json
|
|
39
|
+
```
|
|
40
|
+
Parse the JSON to get:
|
|
41
|
+
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
|
42
|
+
- `artifacts`: list of all artifacts with their status and dependencies
|
|
43
|
+
|
|
44
|
+
4. **Create artifacts in sequence until apply-ready**
|
|
45
|
+
|
|
46
|
+
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
47
|
+
|
|
48
|
+
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
|
49
|
+
|
|
50
|
+
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
|
51
|
+
- Get instructions:
|
|
52
|
+
```bash
|
|
53
|
+
openspec instructions <artifact-id> --change "<name>" --json
|
|
54
|
+
```
|
|
55
|
+
- The instructions JSON includes:
|
|
56
|
+
- `context`: Project background (constraints for you - do NOT include in output)
|
|
57
|
+
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
58
|
+
- `template`: The structure to use for your output file
|
|
59
|
+
- `instruction`: Schema-specific guidance for this artifact type
|
|
60
|
+
- `outputPath`: Where to write the artifact
|
|
61
|
+
- `dependencies`: Completed artifacts to read for context
|
|
62
|
+
- Read any completed dependency files for context
|
|
63
|
+
- Create the artifact file using `template` as the structure
|
|
64
|
+
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
|
65
|
+
- Show brief progress: "Created <artifact-id>"
|
|
66
|
+
|
|
67
|
+
b. **Continue until all `applyRequires` artifacts are complete**
|
|
68
|
+
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
|
69
|
+
- Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
|
|
70
|
+
- Stop when all `applyRequires` artifacts are done
|
|
71
|
+
|
|
72
|
+
c. **If an artifact requires user input** (unclear context):
|
|
73
|
+
- Use **question tool** to clarify
|
|
74
|
+
- Then continue with creation
|
|
75
|
+
|
|
76
|
+
5. **Show final status**
|
|
77
|
+
```bash
|
|
78
|
+
openspec status --change "<name>"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Output**
|
|
82
|
+
|
|
83
|
+
After completing all artifacts, summarize:
|
|
84
|
+
- Change name and location
|
|
85
|
+
- List of artifacts created with brief descriptions
|
|
86
|
+
- What's ready: "All artifacts created! Ready for implementation."
|
|
87
|
+
- Prompt: "Run `/opsx-implement` to start implementing."
|
|
88
|
+
|
|
89
|
+
**Artifact Creation Guidelines**
|
|
90
|
+
|
|
91
|
+
- Follow the `instruction` field from `openspec instructions` for each artifact type
|
|
92
|
+
- The schema defines what each artifact should contain - follow it
|
|
93
|
+
- Read dependency artifacts for context before creating new ones
|
|
94
|
+
- Use `template` as the structure for your output file - fill in its sections
|
|
95
|
+
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
|
96
|
+
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
|
97
|
+
- These guide what you write, but should never appear in the output
|
|
98
|
+
- **When creating tasks.md**: Follow the TDD reference below. Each testable task MUST combine test and implementation in one task — do not separate into "implementation tasks" and "test tasks". Task descriptions should reflect the red → green flow (e.g., "Implement X (write failing test first, then implement)"). This ensures the apply phase executes TDD naturally by following tasks.
|
|
99
|
+
|
|
100
|
+
**Guardrails**
|
|
101
|
+
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
|
|
102
|
+
- Always read dependency artifacts before creating a new one
|
|
103
|
+
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
|
|
104
|
+
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
|
105
|
+
- Verify each artifact file exists after writing before proceeding to next
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
# Test-Driven Development
|
|
110
|
+
|
|
111
|
+
TDD is the red → green loop. This reference makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies when writing tasks — consult them before and during task creation, not after.
|
|
112
|
+
|
|
113
|
+
When exploring the codebase, read `CONTEXT.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
|
|
114
|
+
|
|
115
|
+
## What a good test is
|
|
116
|
+
|
|
117
|
+
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification — "user can checkout with valid cart" tells you exactly what capability exists — and survives refactors because it doesn't care about internal structure.
|
|
118
|
+
|
|
119
|
+
### Good and Bad Tests
|
|
120
|
+
|
|
121
|
+
**Integration-style**: Test through real interfaces, not mocks of internal parts.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// GOOD: Tests observable behavior
|
|
125
|
+
test("user can checkout with valid cart", async () => {
|
|
126
|
+
const cart = createCart();
|
|
127
|
+
cart.add(product);
|
|
128
|
+
const result = await checkout(cart, paymentMethod);
|
|
129
|
+
expect(result.status).toBe("confirmed");
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Characteristics:
|
|
134
|
+
|
|
135
|
+
- Tests behavior users/callers care about
|
|
136
|
+
- Uses public API only
|
|
137
|
+
- Survives internal refactors
|
|
138
|
+
- Describes WHAT, not HOW
|
|
139
|
+
- One logical assertion per test
|
|
140
|
+
|
|
141
|
+
**Implementation-detail tests**: Coupled to internal structure.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// BAD: Tests implementation details
|
|
145
|
+
test("checkout calls paymentService.process", async () => {
|
|
146
|
+
const mockPayment = jest.mock(paymentService);
|
|
147
|
+
await checkout(cart, payment);
|
|
148
|
+
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Red flags:
|
|
153
|
+
|
|
154
|
+
- Mocking internal collaborators
|
|
155
|
+
- Testing private methods
|
|
156
|
+
- Asserting on call counts/order
|
|
157
|
+
- Test breaks when refactoring without behavior change
|
|
158
|
+
- Test name describes HOW not WHAT
|
|
159
|
+
- Verifying through external means instead of interface
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// BAD: Bypasses interface to verify
|
|
163
|
+
test("createUser saves to database", async () => {
|
|
164
|
+
await createUser({ name: "Alice" });
|
|
165
|
+
const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
|
|
166
|
+
expect(row).toBeDefined();
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// GOOD: Verifies through interface
|
|
170
|
+
test("createUser makes user retrievable", async () => {
|
|
171
|
+
const user = await createUser({ name: "Alice" });
|
|
172
|
+
const retrieved = await getUser(user.id);
|
|
173
|
+
expect(retrieved.name).toBe("Alice");
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Tautological tests**: Expected value restates the implementation, so the test passes by construction.
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
// BAD: Expected value is recomputed the way the code computes it
|
|
181
|
+
test("calculateTotal sums line items", () => {
|
|
182
|
+
const items = [{ price: 10 }, { price: 5 }];
|
|
183
|
+
const expected = items.reduce((sum, i) => sum + i.price, 0);
|
|
184
|
+
expect(calculateTotal(items)).toBe(expected);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// GOOD: Expected value is an independent, known literal
|
|
188
|
+
test("calculateTotal sums line items", () => {
|
|
189
|
+
expect(calculateTotal([{ price: 10 }, { price: 5 }])).toBe(15);
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Seams — where tests go
|
|
194
|
+
|
|
195
|
+
A **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.
|
|
196
|
+
|
|
197
|
+
**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything — agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.
|
|
198
|
+
|
|
199
|
+
Ask: "What's the public interface, and which seams should we test?"
|
|
200
|
+
|
|
201
|
+
## When to Mock
|
|
202
|
+
|
|
203
|
+
Mock at **system boundaries** only:
|
|
204
|
+
|
|
205
|
+
- External APIs (payment, email, etc.)
|
|
206
|
+
- Databases (sometimes - prefer test DB)
|
|
207
|
+
- Time/randomness
|
|
208
|
+
- File system (sometimes)
|
|
209
|
+
|
|
210
|
+
Don't mock:
|
|
211
|
+
|
|
212
|
+
- Your own classes/modules
|
|
213
|
+
- Internal collaborators
|
|
214
|
+
- Anything you control
|
|
215
|
+
|
|
216
|
+
### Designing for Mockability
|
|
217
|
+
|
|
218
|
+
At system boundaries, design interfaces that are easy to mock:
|
|
219
|
+
|
|
220
|
+
**1. Use dependency injection**
|
|
221
|
+
|
|
222
|
+
Pass external dependencies in rather than creating them internally:
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
// Easy to mock
|
|
226
|
+
function processPayment(order, paymentClient) {
|
|
227
|
+
return paymentClient.charge(order.total);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Hard to mock
|
|
231
|
+
function processPayment(order) {
|
|
232
|
+
const client = new StripeClient(process.env.STRIPE_KEY);
|
|
233
|
+
return client.charge(order.total);
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**2. Prefer SDK-style interfaces over generic fetchers**
|
|
238
|
+
|
|
239
|
+
Create specific functions for each external operation instead of one generic function with conditional logic:
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
// GOOD: Each function is independently mockable
|
|
243
|
+
const api = {
|
|
244
|
+
getUser: (id) => fetch(`/users/${id}`),
|
|
245
|
+
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
|
246
|
+
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// BAD: Mocking requires conditional logic inside the mock
|
|
250
|
+
const api = {
|
|
251
|
+
fetch: (endpoint, options) => fetch(endpoint, options),
|
|
252
|
+
};
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The SDK approach means:
|
|
256
|
+
- Each mock returns one specific shape
|
|
257
|
+
- No conditional logic in test setup
|
|
258
|
+
- Easier to see which endpoints a test exercises
|
|
259
|
+
- Type safety per endpoint
|
|
260
|
+
|
|
261
|
+
## Anti-patterns
|
|
262
|
+
|
|
263
|
+
- **Implementation-coupled** — mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
|
|
264
|
+
- **Tautological** — the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth — a known-good literal, a worked example, the spec.
|
|
265
|
+
- **Horizontal slicing** — writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead — one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.
|
|
266
|
+
|
|
267
|
+
## Rules of the loop
|
|
268
|
+
|
|
269
|
+
- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
|
|
270
|
+
- **One slice at a time.** One seam, one test, one minimal implementation per cycle.
|
|
271
|
+
- **Refactoring is not part of the loop.** It belongs to the review stage, not the red → green implementation cycle.
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface_language: zh
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# tracker: structured task source (Jira)
|
|
5
|
+
# ============================================================================
|
|
6
|
+
tracker:
|
|
7
|
+
# Required. Only "jira" is supported.
|
|
8
|
+
kind: jira
|
|
9
|
+
|
|
10
|
+
# Jira REST API endpoint. Cloud: https://your-domain.atlassian.net/rest/api/3
|
|
11
|
+
# Self-hosted: http://your-host:port/rest/api/2
|
|
12
|
+
endpoint: https://your-domain.atlassian.net/rest/api/3
|
|
13
|
+
|
|
14
|
+
# Required. Jira API token. Prefer a $VAR environment-variable reference; never commit plaintext.
|
|
15
|
+
# Cloud: Account settings → Security → Create API token
|
|
16
|
+
# Self-hosted: User management → Generate PAT
|
|
17
|
+
api_key: $JIRA_API_TOKEN
|
|
18
|
+
|
|
19
|
+
# Required in basic mode (Cloud email or self-hosted username). Omit in bearer mode.
|
|
20
|
+
api_user: you@example.com
|
|
21
|
+
|
|
22
|
+
# Auth mode. "basic" = email + token (common on Cloud); "bearer" = token only (self-hosted PAT)
|
|
23
|
+
auth_mode: basic
|
|
24
|
+
|
|
25
|
+
# Name of the review handoff state (e.g. "In Review").
|
|
26
|
+
# Keep this state out of active_states and terminal_states — it automatically becomes an implicit intermediate state.
|
|
27
|
+
# The agent transitions here after creating an MR; the scheduler stops the worker but preserves the workspace.
|
|
28
|
+
review_state: 代码评审中
|
|
29
|
+
|
|
30
|
+
# Required. Jira project key (e.g. "ENG"). Mutually exclusive with project_slug.
|
|
31
|
+
project_key: ENG
|
|
32
|
+
|
|
33
|
+
# Alternative to project_key; set either one.
|
|
34
|
+
project_slug: null
|
|
35
|
+
|
|
36
|
+
# Filter by assignee. null = no filter (pull all matching issues in the project). "me" = currentUser() (current API user).
|
|
37
|
+
assignee: null
|
|
38
|
+
|
|
39
|
+
# Required-label filter. Empty = no filter. E.g. ["tothemax"] dispatches only issues carrying that label.
|
|
40
|
+
required_labels: []
|
|
41
|
+
|
|
42
|
+
# Candidate states. Only issues currently in these states are pulled as dispatch candidates.
|
|
43
|
+
# NOTE: State names differ across Jira deployments — adjust them to match YOUR Jira instance
|
|
44
|
+
# (these placeholder values are Chinese because the canonical zh deployment uses them).
|
|
45
|
+
# Three-tier state model: active (dispatch) / neither-review (stop worker, keep workspace) / terminal (clean up workspace).
|
|
46
|
+
# The review state stays out of active_states / terminal_states — it becomes an implicit intermediate state automatically.
|
|
47
|
+
# After human review there are two paths: back to the initial state = incremental fix (same branch);
|
|
48
|
+
# to the rework state = full reset (close MR, fresh branch).
|
|
49
|
+
active_states:
|
|
50
|
+
- 待办
|
|
51
|
+
- 处理中
|
|
52
|
+
- 合并中
|
|
53
|
+
- 重置处理
|
|
54
|
+
|
|
55
|
+
# Terminal states. Issues in these states are never dispatched, and their workspaces are cleaned up at startup.
|
|
56
|
+
terminal_states:
|
|
57
|
+
- 完成
|
|
58
|
+
- 关闭
|
|
59
|
+
- 取消
|
|
60
|
+
- 重复
|
|
61
|
+
|
|
62
|
+
# ============================================================================
|
|
63
|
+
# polling: polling cadence
|
|
64
|
+
# ============================================================================
|
|
65
|
+
polling:
|
|
66
|
+
# Poll interval (ms). Default 30000 = 30 seconds. Must be > 0.
|
|
67
|
+
interval_ms: 30000
|
|
68
|
+
|
|
69
|
+
# ============================================================================
|
|
70
|
+
# workspace: per-task workspace
|
|
71
|
+
# ============================================================================
|
|
72
|
+
workspace:
|
|
73
|
+
# Workspace root directory. ~ expands to home. Relative paths resolve against the WORKFLOW.md directory.
|
|
74
|
+
# Each issue gets <root>/<sanitized_identifier>.
|
|
75
|
+
root: ~/tasking_workspaces
|
|
76
|
+
|
|
77
|
+
# ============================================================================
|
|
78
|
+
# hooks: workspace lifecycle hooks (optional)
|
|
79
|
+
# ============================================================================
|
|
80
|
+
hooks:
|
|
81
|
+
# Timeout for all hooks (ms). Default 60000 = 60 seconds. Must be > 0.
|
|
82
|
+
timeout_ms: 60000
|
|
83
|
+
|
|
84
|
+
# Runs only when a new workspace is created. Failure aborts creation. Commonly git clone + dependency install.
|
|
85
|
+
after_create: null
|
|
86
|
+
|
|
87
|
+
# Runs before each attempt. Failure aborts the current attempt.
|
|
88
|
+
# before_run: |
|
|
89
|
+
# git pull --ff-only origin main
|
|
90
|
+
|
|
91
|
+
# Runs after each attempt (success/failure/timeout alike). Failures are logged only.
|
|
92
|
+
after_run: null
|
|
93
|
+
|
|
94
|
+
# Runs before workspace removal (issue reached a terminal state). Failures are logged only; removal is not blocked.
|
|
95
|
+
# before_remove: |
|
|
96
|
+
# cd elixir && mix workspace.before_remove
|
|
97
|
+
|
|
98
|
+
# ============================================================================
|
|
99
|
+
# agent: concurrency & retry policy
|
|
100
|
+
# ============================================================================
|
|
101
|
+
agent:
|
|
102
|
+
# Global concurrency cap. At most this many opencode run subprocesses run simultaneously.
|
|
103
|
+
max_concurrent_agents: 10
|
|
104
|
+
|
|
105
|
+
# Turn limit within a single worker. When reached, the worker exits and the scheduler schedules a continuation retry.
|
|
106
|
+
# Starting at 3 is recommended to avoid oversized first-run token consumption.
|
|
107
|
+
max_turns: 20
|
|
108
|
+
|
|
109
|
+
# Backoff ceiling (ms). Default 300000 = 5 minutes.
|
|
110
|
+
max_retry_backoff_ms: 300000
|
|
111
|
+
|
|
112
|
+
# Per-state concurrency limits. Empty = unlimited. E.g. {"in progress": 2} caps the In Progress state at 2 concurrent workers.
|
|
113
|
+
max_concurrent_agents_by_state: {}
|
|
114
|
+
|
|
115
|
+
# ============================================================================
|
|
116
|
+
# opencode: worker subprocess configuration
|
|
117
|
+
# ============================================================================
|
|
118
|
+
opencode:
|
|
119
|
+
# opencode launch command. Default "opencode run".
|
|
120
|
+
command: opencode run
|
|
121
|
+
|
|
122
|
+
# opencode agent profile name.
|
|
123
|
+
agent: build
|
|
124
|
+
|
|
125
|
+
# Optional. Advisory catalog of known opencode agent profiles (string array). Surfaced by the `/agent` command; warns on unknown names.
|
|
126
|
+
# Empty array (default) = no validation, any `agent:<name>` passes through; non-empty = advisory validation, unknown names warn and fall back to the default. Not a hard allowlist.
|
|
127
|
+
agents: []
|
|
128
|
+
|
|
129
|
+
# Optional. opencode model (provider/model format), maps to `--model`. Default null (unset; uses opencode's default model).
|
|
130
|
+
model: null
|
|
131
|
+
|
|
132
|
+
# Optional. Model variant (provider-specific reasoning effort such as high/max/minimal), maps to `--variant`. Default null (unset). Independent of model.
|
|
133
|
+
variant: null
|
|
134
|
+
|
|
135
|
+
# Per-turn timeout (ms). Default 3600000 = 1 hour. Must be > 0.
|
|
136
|
+
# Hard wall-clock timeout: kills the turn when time is up regardless of activity.
|
|
137
|
+
turn_timeout_ms: 3600000
|
|
138
|
+
|
|
139
|
+
# Stall timeout (ms). Terminates the worker after this much time without activity.
|
|
140
|
+
# Default 7200000 = 2 hours. Set 0 to disable stall detection.
|
|
141
|
+
# Scheduler-level backstop: when neither the inactivity nor the wall-clock timeout can kill the subprocess
|
|
142
|
+
# (e.g. it refuses to honor SIGTERM). Timeouts SIGTERM first, then process-group
|
|
143
|
+
# SIGKILL after a 10s grace (see docs/adr/0020); this is only a backstop if
|
|
144
|
+
# the escalation itself fails.
|
|
145
|
+
# Set above turn_timeout_ms so normal turns are not mis-killed.
|
|
146
|
+
stall_timeout_ms: 7200000
|
|
147
|
+
|
|
148
|
+
# Inactivity timeout (ms). SIGTERM after stdout/stderr produces no data for this long.
|
|
149
|
+
# Default 600000 = 10 minutes. Set 0 to disable the inactivity timeout.
|
|
150
|
+
# Subprocess level: checks raw bytes and resets the timer whenever data arrives.
|
|
151
|
+
inactivity_timeout_ms: 600000
|
|
152
|
+
|
|
153
|
+
# ============================================================================
|
|
154
|
+
# router: route-agent triage for the unstructured source (Feishu)
|
|
155
|
+
# ============================================================================
|
|
156
|
+
# Not implemented: parsed only, no runtime code (reserved for a future route agent).
|
|
157
|
+
# router:
|
|
158
|
+
# Whether to enable the route agent. When enabled it runs in a bounded way per tick,
|
|
159
|
+
# triaging Feishu messages into Tasks.
|
|
160
|
+
# enabled: false
|
|
161
|
+
|
|
162
|
+
# opencode agent profile used by the route agent.
|
|
163
|
+
# agent: triage
|
|
164
|
+
|
|
165
|
+
# Max inbox entries processed per route-agent run.
|
|
166
|
+
# batch_size: 20
|
|
167
|
+
|
|
168
|
+
# Route-agent per-run timeout (ms). Default 120000 = 2 minutes.
|
|
169
|
+
# timeout_ms: 120000
|
|
170
|
+
|
|
171
|
+
# ============================================================================
|
|
172
|
+
# feishu: Feishu ↔ Jira comment bridge (REST polling, no public port)
|
|
173
|
+
# ============================================================================
|
|
174
|
+
feishu:
|
|
175
|
+
# When enabled, Feishu mirrors comments of existing Jira issues: threads bind 1:1 to issues, comments mirror both ways.
|
|
176
|
+
# Inbound uses REST polling (no webhooks, no exposed public port). See docs/feishu-quickstart.md.
|
|
177
|
+
enabled: false
|
|
178
|
+
|
|
179
|
+
# Feishu edition: feishu (China mainland, open.feishu.cn) | lark (overseas, open.larksuite.com). Defaults to feishu.
|
|
180
|
+
edition: feishu
|
|
181
|
+
|
|
182
|
+
# Feishu app credentials. Plaintext or a $VAR env reference both work.
|
|
183
|
+
app_id: $FEISHU_APP_ID
|
|
184
|
+
app_secret: $FEISHU_APP_SECRET
|
|
185
|
+
|
|
186
|
+
# Intake group chat_id: the dedicated group hosting all issue threads (get via GET /im/v1/chats). Required when enabled.
|
|
187
|
+
intake_chat_id: $FEISHU_INTAKE_CHAT_ID
|
|
188
|
+
|
|
189
|
+
# Jira→Feishu comment mirror cadence (ms), default 5s. Receiving runs over the event channel, not polling.
|
|
190
|
+
forward_interval_ms: 5000
|
|
191
|
+
|
|
192
|
+
# Sweep loss-backstop cadence (ms), default 12h. Catches offline windows; also fires at start and on WS reconnect.
|
|
193
|
+
sweep_interval_ms: 43200000
|
|
194
|
+
|
|
195
|
+
# Default issueType for /issue (tasking init lists the project's available types). Required when enabled.
|
|
196
|
+
create_issue_type: Task
|
|
197
|
+
|
|
198
|
+
# Webhook-mode only (unused under REST polling; reserved for a future webhook mode).
|
|
199
|
+
# verification_token: $FEISHU_VERIFICATION_TOKEN
|
|
200
|
+
# encrypt_key: $FEISHU_ENCRYPT_KEY
|
|
201
|
+
|
|
202
|
+
# --------------------------------------------------------------------------
|
|
203
|
+
# Direct sessions (feishu.direct): bypass Jira and run opencode in fixed directories.
|
|
204
|
+
# Enabled by default when feishu.enabled is true; an explicit enabled: false opts out. See docs/configuration.md.
|
|
205
|
+
# --------------------------------------------------------------------------
|
|
206
|
+
direct:
|
|
207
|
+
# An explicit false turns direct sessions off.
|
|
208
|
+
enabled: true
|
|
209
|
+
|
|
210
|
+
# Project name → directory map, used by `/chat <project> <msg>`. The object form {path, auto_approve} overrides the global value.
|
|
211
|
+
# Example:
|
|
212
|
+
# projects:
|
|
213
|
+
# tasking: /home/me/workspace/tasking
|
|
214
|
+
# other: {path: /abs/dir, auto_approve: true}
|
|
215
|
+
projects:
|
|
216
|
+
|
|
217
|
+
# Directory-prefix allow-list for ad-hoc path mode (`/chat /abs/path <msg>`); empty = unrestricted.
|
|
218
|
+
path_roots: []
|
|
219
|
+
|
|
220
|
+
# true = pass --auto to opencode run (auto-approve permissions not explicitly denied).
|
|
221
|
+
# Default false: the permission stance comes from the target directory's own .opencode config.
|
|
222
|
+
auto_approve: false
|
|
223
|
+
|
|
224
|
+
# How much is mirrored to Feishu: quiet (final reply only) | summary (reply + stats line) | detailed (default; one process card per turn; collapsible panels need Feishu/Lark client >= V7.9).
|
|
225
|
+
verbosity: detailed
|
|
226
|
+
|
|
227
|
+
# Daemon-wide cap on concurrent direct turns (independent of Jira's max_concurrent_agents); per directory/session is always serial.
|
|
228
|
+
max_concurrent: 5
|
|
229
|
+
|
|
230
|
+
# Idle time before a session is marked expired (ms; it does not delete the opencode session on disk). Default 2592000000 = 30 days.
|
|
231
|
+
idle_ttl_ms: 2592000000
|
|
232
|
+
|
|
233
|
+
# ============================================================================
|
|
234
|
+
# server: HTTP dashboard (optional)
|
|
235
|
+
# ============================================================================
|
|
236
|
+
server:
|
|
237
|
+
# Dashboard port. null = do not start. Set e.g. 8080 to start.
|
|
238
|
+
port: null
|
|
239
|
+
|
|
240
|
+
# Bind address. "0.0.0.0" = all interfaces (externally reachable). "127.0.0.1" = local only.
|
|
241
|
+
host: 0.0.0.0
|
|
242
|
+
|
|
243
|
+
# ============================================================================
|
|
244
|
+
# logging: file logging (optional)
|
|
245
|
+
# ============================================================================
|
|
246
|
+
logging:
|
|
247
|
+
file:
|
|
248
|
+
# File log path. null = no file (stderr only). The CLI defaults to ./tasking.log at startup.
|
|
249
|
+
path: null
|
|
250
|
+
|
|
251
|
+
# Max bytes per file. Rotated once exceeded. Default 10485760 = 10 MB.
|
|
252
|
+
max_bytes: 10485760
|
|
253
|
+
|
|
254
|
+
# Rotation backup count. Keeps the most recent N backup files.
|
|
255
|
+
max_files: 5
|
|
256
|
+
|
|
257
|
+
# ============================================================================
|
|
258
|
+
# env: environment variables injected into worker subprocesses (optional)
|
|
259
|
+
# ============================================================================
|
|
260
|
+
# Values support $VAR indirection (same semantics as tracker.api_key).
|
|
261
|
+
# A variable resolving to an empty string is injected as an empty value. A missing env section defaults to {}.
|
|
262
|
+
env:
|
|
263
|
+
# GitLab token for the glab CLI. glab reads this env var automatically.
|
|
264
|
+
GITLAB_TOKEN: $GITLAB_TOKEN
|
|
265
|
+
GITLAB_HOST: $GITLAB_HOST
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
<!-- tasking-workflow-lang: en -->
|
|
269
|
+
|
|
270
|
+
<!-- tasking-workflow: code-mr -->
|
|
271
|
+
|
|
272
|
+
You are a coding agent working on: {{ task.identifier }} - {{ task.title }}
|
|
273
|
+
|
|
274
|
+
{% if task.description %}
|
|
275
|
+
## Description
|
|
276
|
+
{{ task.description }}
|
|
277
|
+
{% endif %}
|
|
278
|
+
|
|
279
|
+
## Skills
|
|
280
|
+
|
|
281
|
+
Available skills in `.opencode/skills/`:
|
|
282
|
+
- `land` — MR landing playbook (CI/review monitoring, conflict resolution, squash-merge). Only read when you need to merge an MR.
|
|
283
|
+
- `install-glab` — idempotently install the GitLab CLI; run before any `glab` step when `command -v glab` fails.
|
|
284
|
+
|
|
285
|
+
## State Flow
|
|
286
|
+
|
|
287
|
+
Three state buckets control how the scheduler manages your task:
|
|
288
|
+
|
|
289
|
+
- **Active** ({{ active_states }}): The scheduler dispatches agents in these states.
|
|
290
|
+
Includes initial state, in-progress state, merging state, and rework state.
|
|
291
|
+
- **Review** (`{{ review_state }}`): Transition here after creating MR. The scheduler
|
|
292
|
+
stops your worker but preserves the workspace. Wait for human review.
|
|
293
|
+
- **Terminal** ({{ terminal_states }}): The scheduler cleans the workspace.
|
|
294
|
+
|
|
295
|
+
### Flow
|
|
296
|
+
|
|
297
|
+
1. Start (active) → transition to in-progress state (active) before working
|
|
298
|
+
2. Create MR, ensure CI green → transition to `{{ review_state }}` (review state)
|
|
299
|
+
3. Human reviews — two paths:
|
|
300
|
+
- **Incremental fix**: human moves back to initial active state (MR still open) →
|
|
301
|
+
you get re-dispatched → fix on same branch → push → ensure CI green → back to `{{ review_state }}`
|
|
302
|
+
- **Full reset**: human moves to rework active state → you get re-dispatched →
|
|
303
|
+
close old MR, new branch from origin/main, start over → back to `{{ review_state }}`
|
|
304
|
+
4. Human approves → moves to merging active state → you get re-dispatched →
|
|
305
|
+
read `land` skill → merge → transition to terminal state
|
|
306
|
+
|
|
307
|
+
## Workflow
|
|
308
|
+
|
|
309
|
+
{% if attempt %}
|
|
310
|
+
This is attempt {{ attempt }}. Check the current Jira state and route accordingly:
|
|
311
|
+
- **Initial active state** (MR still open): incremental fix — read Jira comments for feedback, fix on same branch, push (MR auto-updates), ensure CI green, transition back to `{{ review_state }}`
|
|
312
|
+
- **Rework active state**: full reset — close old MR, new branch from origin/main, start over, transition back to `{{ review_state }}`
|
|
313
|
+
- **Merging active state**: read `land` skill to merge, then transition to terminal state
|
|
314
|
+
- **`{{ review_state }}`** (review state): do nothing — wait for human to move the task
|
|
315
|
+
If stuck, check `tasking.log` for execution failures. If you have an open merge request, read `land` skill.
|
|
316
|
+
{% else %}
|
|
317
|
+
This is the first attempt. Transition Jira to an in-progress active state (query transitions first via jira_rest MCP tool, find the id by name — do NOT hardcode it), then sync from origin/main into a new feature branch (see step 2 for the name), then read the codebase and understand the task before starting. NEVER commit or push directly to main — always work on a feature branch.
|
|
318
|
+
{% endif %}
|
|
319
|
+
|
|
320
|
+
### For code tasks (workspace has a git repo):
|
|
321
|
+
1. Transition Jira from current state to an in-progress active state (query transitions first via jira_rest MCP tool, find the id by name — do NOT hardcode it)
|
|
322
|
+
2. Sync from origin/main into a new feature branch before making any change. Name it `feature/{{ task.identifier }}-<short-slug>` (e.g. `feature/{{ task.identifier }}-fix-login`). Do NOT commit, amend, or push to main directly — main is protected; all work goes on the feature branch.
|
|
323
|
+
3. Make the necessary code changes on the feature branch
|
|
324
|
+
4. Create a conventional commit on the feature branch
|
|
325
|
+
5. Push the feature branch and create a GitLab MR from it via `glab mr create --source-branch feature/{{ task.identifier }}-<short-slug> --target-branch main` (glab is pre-authenticated via GITLAB_TOKEN). Do NOT push the feature branch to main.
|
|
326
|
+
6. Sweep MR feedback, ensure CI is green
|
|
327
|
+
7. Transition Jira to `{{ review_state }}`, add a comment summarizing your changes (files, rationale, MR link) via jira_rest MCP tool
|
|
328
|
+
8. If you have output files (screenshots, logs, test reports), upload them as Jira attachments via jira_upload_attachment MCP tool
|
|
329
|
+
9. Your worker will stop. Workspace is preserved. Wait for human review.
|
|
330
|
+
|
|
331
|
+
When re-dispatched from review (human moved your task):
|
|
332
|
+
- If back to initial active state (MR still open) → **incremental fix**: read MR discussion threads via `glab` (`glab mr view` / `glab api`) and Jira comments for feedback; for each thread — address substantive ones (reply with what you did + resolve), and briefly acknowledge + resolve nitpicks/out-of-scope ones; then fix on same branch, push (MR auto-updates), ensure CI green, transition back to `{{ review_state }}`
|
|
333
|
+
- If to rework active state → **full reset**: close old MR, new branch from origin/main, start over, transition back to `{{ review_state }}`
|
|
334
|
+
- If to merging active state → read `land` skill to merge; before merging ensure all MR discussion threads are resolved (addressed or acknowledged-and-resolved), resolve any unresolved blocking thread first, then transition to terminal state ({{ terminal_states }})
|
|
335
|
+
|
|
336
|
+
### For non-code tasks (documentation, research, config):
|
|
337
|
+
1. Complete the work
|
|
338
|
+
2. Add a comment with a summary, query transitions, and transition directly to a terminal state (find the id by name via jira_rest MCP tool)
|
|
339
|
+
3. If you have output files (reports, documents), upload them as Jira attachments via jira_upload_attachment MCP tool
|
|
340
|
+
|
|
341
|
+
## Tracking
|
|
342
|
+
- Always add a comment before finishing, describing what you did
|
|
343
|
+
- If you created a MR, include the MR link in the comment
|
|
344
|
+
- If you have screenshots or demo links, include them in the comment
|
|
345
|
+
- If you have output files, upload them as attachments via jira_upload_attachment MCP tool
|