@web42/stask 0.2.1 → 0.2.2
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.
|
@@ -7,6 +7,26 @@ description: Task lifecycle framework — spec-first workflow, Slack sync, statu
|
|
|
7
7
|
|
|
8
8
|
SQLite-backed task lifecycle management with Slack sync. Every operation goes through the `stask` CLI — the database enforces all lifecycle rules via triggers and constraints, and every mutation syncs to Slack atomically.
|
|
9
9
|
|
|
10
|
+
## Multi-Project Support
|
|
11
|
+
|
|
12
|
+
stask supports multiple projects. Each project lives in a repo with a `.stask/` folder at its root (like `.git/`).
|
|
13
|
+
|
|
14
|
+
- **Auto-detection:** stask walks up from cwd to find `.stask/config.json`. If you're in a project repo or its worktree, it auto-detects.
|
|
15
|
+
- **Explicit selection:** Use `--project <name>` flag on any command to target a specific project.
|
|
16
|
+
- **Project registry:** `npx @web42/stask projects` lists all registered projects.
|
|
17
|
+
- **Cross-project heartbeat:** `npx @web42/stask heartbeat-all <agent>` returns pending work across all projects.
|
|
18
|
+
- **New project:** `npx @web42/stask init <name> --repo <path>` scaffolds a new project.
|
|
19
|
+
- **Secrets:** `SLACK_TOKEN` comes from env var or `~/.stask/config.json` (no `.env` files).
|
|
20
|
+
|
|
21
|
+
### Multi-project commands
|
|
22
|
+
|
|
23
|
+
| Command | Purpose |
|
|
24
|
+
|---------|---------|
|
|
25
|
+
| `npx @web42/stask init <name> --repo <path>` | Create a new stask project |
|
|
26
|
+
| `npx @web42/stask projects [show <name>]` | List/show registered projects |
|
|
27
|
+
| `npx @web42/stask heartbeat-all <agent-name>` | Get pending work across all projects |
|
|
28
|
+
| `--project <name>` | Global flag — target a specific project |
|
|
29
|
+
|
|
10
30
|
## Core Rules
|
|
11
31
|
|
|
12
32
|
1. **No task exists without a spec uploaded to Slack.** Every task must have a Spec value: `specs/<name>.md (F0XXXXXXXXX)`.
|
|
@@ -103,7 +123,7 @@ Guards run automatically before transitions. Checks run first (read-only); if al
|
|
|
103
123
|
|
|
104
124
|
## Thread Communication
|
|
105
125
|
|
|
106
|
-
Every task has a dedicated Slack thread linked to its list item. The thread reference (`channelId` + `threadTs`) is stored in the DB and included in `stask show` and `heartbeat` output.
|
|
126
|
+
Every task has a dedicated Slack thread linked to its list item. The thread reference (`channelId` + `threadTs`) is stored in the DB and included in `npx @web42/stask show` and `heartbeat` output.
|
|
107
127
|
|
|
108
128
|
**All agents MUST post updates to the task thread at every step.** Use the Slack API `chat.postMessage` with the thread's `channel` and `thread_ts` to post replies. The thread is the single place for all task communication.
|
|
109
129
|
|
|
@@ -137,7 +157,7 @@ Use the `SLACK_TOKEN` from the environment for authorization.
|
|
|
137
157
|
|
|
138
158
|
## Rules for All Agents
|
|
139
159
|
|
|
140
|
-
1. **Never edit tracker.db directly.** Use `stask` commands only.
|
|
160
|
+
1. **Never edit tracker.db directly.** Use `npx @web42/stask` commands only.
|
|
141
161
|
2. **Every task needs a spec.** No exceptions.
|
|
142
162
|
3. **Work in the task worktree.** Never in the main repo checkout.
|
|
143
163
|
4. **Commit and push before marking done.** Guards will block Testing if you don't.
|
|
@@ -13,8 +13,8 @@ stask supports multiple projects. Each project lives in a repo with a `.stask/`
|
|
|
13
13
|
|
|
14
14
|
- **Auto-detection:** If you're inside a project repo (or its worktree), stask auto-detects the project.
|
|
15
15
|
- **Explicit selection:** Use `--project <name>` when working outside the repo or across projects.
|
|
16
|
-
- **Discover projects:** Run `stask projects` to list all registered projects.
|
|
17
|
-
- **Cross-project heartbeat:** Run `stask heartbeat-all <your-name>` to see pending work across all projects.
|
|
16
|
+
- **Discover projects:** Run `npx @web42/stask projects` to list all registered projects.
|
|
17
|
+
- **Cross-project heartbeat:** Run `npx @web42/stask heartbeat-all <your-name>` to see pending work across all projects.
|
|
18
18
|
|
|
19
19
|
When heartbeat returns tasks with a `project` field, include `--project <name>` in all subsequent stask commands for that task.
|
|
20
20
|
|
|
@@ -37,14 +37,14 @@ You follow a strict 6-phase process. Never skip a phase.
|
|
|
37
37
|
- Save to `../shared/specs/<task-name>.md`
|
|
38
38
|
|
|
39
39
|
### Phase 4: Approval & Delegation
|
|
40
|
-
- Create task via `stask create` (uploads spec to Slack, creates in tracker.db)
|
|
41
|
-
- Wait for Yan to check `spec_approved` or run `stask approve`
|
|
40
|
+
- Create task via `npx @web42/stask create` (uploads spec to Slack, creates in tracker.db)
|
|
41
|
+
- Wait for Yan to check `spec_approved` or run `npx @web42/stask approve`
|
|
42
42
|
- Create subtasks using the breakdowns from Phase 2
|
|
43
43
|
- Transition to In-Progress (auto-creates worktree + branch)
|
|
44
44
|
|
|
45
45
|
### Phase 5: Implementation (Spawn Workers)
|
|
46
46
|
- Spawn workers with Implementation Prompts referencing their spec section
|
|
47
|
-
- Monitor via `stask heartbeat richard`
|
|
47
|
+
- Monitor via `npx @web42/stask heartbeat richard`
|
|
48
48
|
- When all subtasks Done → auto-transitions to Testing
|
|
49
49
|
|
|
50
50
|
### Phase 6: QA → Review → Done
|
|
@@ -57,44 +57,44 @@ You follow a strict 6-phase process. Never skip a phase.
|
|
|
57
57
|
|
|
58
58
|
| Command | When |
|
|
59
59
|
|---------|------|
|
|
60
|
-
| `stask heartbeat <your-name>` | Check what work you have pending |
|
|
61
|
-
| `stask heartbeat-all <your-name>` | Check work across ALL projects |
|
|
62
|
-
| `stask show <task-id>` | View task details, subtasks, and status |
|
|
63
|
-
| `stask subtask create --parent <id> --name "..." --assign <worker>` | Break work into subtasks |
|
|
64
|
-
| `stask transition <task-id> In-Progress` | Start work (auto-creates worktree) |
|
|
65
|
-
| `stask transition <task-id> "Ready for Human Review"` | After QA pass + PR created |
|
|
66
|
-
| `stask transition <task-id> Done` | After Human merges the PR |
|
|
67
|
-
| `stask pr-status <task-id>` | Check PR comments and merge status |
|
|
68
|
-
| `stask assign <task-id> <name>` | Reassign a task |
|
|
69
|
-
| `stask create --spec <path> --name "..." --type Feature` | Create new task with spec |
|
|
70
|
-
| `stask spec-update <task-id> --spec <path>` | Update spec after Yan feedback |
|
|
71
|
-
| `stask projects` | List all registered projects |
|
|
60
|
+
| `npx @web42/stask heartbeat <your-name>` | Check what work you have pending |
|
|
61
|
+
| `npx @web42/stask heartbeat-all <your-name>` | Check work across ALL projects |
|
|
62
|
+
| `npx @web42/stask show <task-id>` | View task details, subtasks, and status |
|
|
63
|
+
| `npx @web42/stask subtask create --parent <id> --name "..." --assign <worker>` | Break work into subtasks |
|
|
64
|
+
| `npx @web42/stask transition <task-id> In-Progress` | Start work (auto-creates worktree) |
|
|
65
|
+
| `npx @web42/stask transition <task-id> "Ready for Human Review"` | After QA pass + PR created |
|
|
66
|
+
| `npx @web42/stask transition <task-id> Done` | After Human merges the PR |
|
|
67
|
+
| `npx @web42/stask pr-status <task-id>` | Check PR comments and merge status |
|
|
68
|
+
| `npx @web42/stask assign <task-id> <name>` | Reassign a task |
|
|
69
|
+
| `npx @web42/stask create --spec <path> --name "..." --type Feature` | Create new task with spec |
|
|
70
|
+
| `npx @web42/stask spec-update <task-id> --spec <path>` | Update spec after Yan feedback |
|
|
71
|
+
| `npx @web42/stask projects` | List all registered projects |
|
|
72
72
|
|
|
73
73
|
> **Tip:** Add `--project <name>` to any command when working outside the project repo or across multiple projects.
|
|
74
74
|
|
|
75
75
|
## When You Receive Work
|
|
76
76
|
|
|
77
77
|
### Spec Approved (To-Do, assigned to you)
|
|
78
|
-
1. Read the spec (use the Slack file ID from `stask show`)
|
|
79
|
-
2. Create subtasks: `stask subtask create --parent T-XXX --name "..." --assign <worker>`
|
|
80
|
-
3. Transition: `stask transition T-XXX In-Progress`
|
|
78
|
+
1. Read the spec (use the Slack file ID from `npx @web42/stask show`)
|
|
79
|
+
2. Create subtasks: `npx @web42/stask subtask create --parent T-XXX --name "..." --assign <worker>`
|
|
80
|
+
3. Transition: `npx @web42/stask transition T-XXX In-Progress`
|
|
81
81
|
|
|
82
82
|
### QA Passed (Testing, reassigned to you)
|
|
83
83
|
1. Read the spec, QA report, git log, and diff
|
|
84
84
|
2. Create a draft PR: `gh pr create --draft` in the worktree
|
|
85
85
|
3. Write a rich PR description (summary, changes, QA results, screenshots)
|
|
86
|
-
4. Transition: `stask transition T-XXX "Ready for Human Review"`
|
|
86
|
+
4. Transition: `npx @web42/stask transition T-XXX "Ready for Human Review"`
|
|
87
87
|
|
|
88
88
|
### QA Failed (In-Progress, reassigned to you)
|
|
89
89
|
1. Review the QA report — identify what failed
|
|
90
|
-
2. Create NEW fix subtasks: `stask subtask create --parent T-XXX --name "Fix: ..." --assign <worker>`
|
|
90
|
+
2. Create NEW fix subtasks: `npx @web42/stask subtask create --parent T-XXX --name "Fix: ..." --assign <worker>`
|
|
91
91
|
3. Workers fix in the same worktree (same branch, same PR)
|
|
92
92
|
4. When fix subtasks are Done, auto-transitions back to Testing
|
|
93
93
|
|
|
94
94
|
### PR Feedback (Ready for Human Review, detected by heartbeat)
|
|
95
95
|
1. Read the feedback and judge:
|
|
96
96
|
- **Code change needed** (bug, wrong behavior, missing feature):
|
|
97
|
-
- `stask transition T-XXX In-Progress`
|
|
97
|
+
- `npx @web42/stask transition T-XXX In-Progress`
|
|
98
98
|
- Create fix subtasks, delegate to Workers
|
|
99
99
|
- After fixes: QA re-tests, you update PR, transition back to RHR
|
|
100
100
|
- **Cosmetic fix** (PR description, naming):
|
|
@@ -102,7 +102,7 @@ You follow a strict 6-phase process. Never skip a phase.
|
|
|
102
102
|
2. The PR stays open. The branch stays the same. All prior data is preserved.
|
|
103
103
|
|
|
104
104
|
### PR Merged (detected by heartbeat)
|
|
105
|
-
- Run `stask transition T-XXX Done`
|
|
105
|
+
- Run `npx @web42/stask transition T-XXX Done`
|
|
106
106
|
|
|
107
107
|
## Key Rules
|
|
108
108
|
|
|
@@ -7,6 +7,10 @@ description: QA agent workflow — tests tasks against acceptance criteria, take
|
|
|
7
7
|
|
|
8
8
|
You are **QA**. You test completed work against the spec's acceptance criteria. You produce evidence (screenshots, test output) and submit a verdict. Your reports are the basis for the Human's review.
|
|
9
9
|
|
|
10
|
+
## Multi-Project Awareness
|
|
11
|
+
|
|
12
|
+
stask supports multiple projects. If you're inside a project repo, stask auto-detects it. Otherwise use `--project <name>` on any command. Run `npx @web42/stask heartbeat-all <your-name>` to see work across all projects.
|
|
13
|
+
|
|
10
14
|
## Your Responsibilities
|
|
11
15
|
|
|
12
16
|
1. **Check for work** using heartbeat
|
|
@@ -7,6 +7,10 @@ description: Worker agent workflow — implements subtasks in git worktrees, com
|
|
|
7
7
|
|
|
8
8
|
You are a **Worker**. You implement subtasks assigned to you by the Lead. You write code in the task's git worktree, commit, push, and mark your subtask done.
|
|
9
9
|
|
|
10
|
+
## Multi-Project Awareness
|
|
11
|
+
|
|
12
|
+
stask supports multiple projects. If you're inside a project repo or its worktree, stask auto-detects it. Otherwise use `--project <name>` on any command. Run `npx @web42/stask heartbeat-all <your-name>` to see work across all projects.
|
|
13
|
+
|
|
10
14
|
## Your Responsibilities
|
|
11
15
|
|
|
12
16
|
1. **Check for work** using heartbeat
|
package/bin/stask.mjs
CHANGED
|
@@ -23,6 +23,32 @@
|
|
|
23
23
|
import fs from 'fs';
|
|
24
24
|
import path from 'path';
|
|
25
25
|
import { fileURLToPath } from 'url';
|
|
26
|
+
import { execFileSync } from 'child_process';
|
|
27
|
+
|
|
28
|
+
// ─── Auto-rebuild better-sqlite3 if compiled for wrong Node version ─
|
|
29
|
+
{
|
|
30
|
+
try {
|
|
31
|
+
const mod = await import('better-sqlite3');
|
|
32
|
+
// Trigger actual load by constructing a DB (import alone may not load the native binding)
|
|
33
|
+
new mod.default(':memory:').close();
|
|
34
|
+
} catch (err) {
|
|
35
|
+
if (err.code === 'ERR_DLOPEN_FAILED') {
|
|
36
|
+
const __dir = path.dirname(fileURLToPath(import.meta.url));
|
|
37
|
+
console.error('Native module mismatch — rebuilding better-sqlite3...');
|
|
38
|
+
execFileSync('npm', ['rebuild', 'better-sqlite3'], {
|
|
39
|
+
cwd: path.resolve(__dir, '..'),
|
|
40
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
41
|
+
});
|
|
42
|
+
// Re-exec ourselves — can't reload native modules in same process
|
|
43
|
+
const result = execFileSync(process.execPath, process.argv.slice(1), {
|
|
44
|
+
stdio: 'inherit',
|
|
45
|
+
env: process.env,
|
|
46
|
+
});
|
|
47
|
+
process.exit(0);
|
|
48
|
+
}
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
26
52
|
|
|
27
53
|
// ─── Extract --project flag before module loading ─────────────────
|
|
28
54
|
// Must happen before env.mjs is imported since it resolves project root at import time.
|
package/lib/resolve-home.mjs
CHANGED
|
@@ -110,6 +110,12 @@ let _resolved = null;
|
|
|
110
110
|
export function resolveProjectRoot() {
|
|
111
111
|
if (_resolved) return _resolved;
|
|
112
112
|
|
|
113
|
+
// 0. STASK_HOME env var — direct override for CI, Docker, or explicit configuration
|
|
114
|
+
if (process.env.STASK_HOME) {
|
|
115
|
+
_resolved = process.env.STASK_HOME;
|
|
116
|
+
return _resolved;
|
|
117
|
+
}
|
|
118
|
+
|
|
113
119
|
const projectName = extractProjectFlag(process.argv);
|
|
114
120
|
|
|
115
121
|
// 1. Explicit --project flag or STASK_PROJECT env var
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web42/stask",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "SQLite-backed task lifecycle CLI with Slack sync for AI agent teams",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"config.example.json"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"test": "node --test test/*.test.mjs"
|
|
18
|
+
"test": "STASK_HOME=test/fixtures/.stask node --test test/*.test.mjs",
|
|
19
|
+
"test:e2e": "node --test test/multi-project.test.mjs",
|
|
20
|
+
"test:unit": "STASK_HOME=test/fixtures/.stask node --test test/cascade.test.mjs test/lifecycle.test.mjs test/roles.test.mjs test/session.test.mjs test/slack-row.test.mjs test/transitions.test.mjs test/tx.test.mjs"
|
|
19
21
|
},
|
|
20
22
|
"keywords": [
|
|
21
23
|
"cli",
|