dream-wf 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -0
- package/bin/dream-wf.js +10 -0
- package/core/dependencies.md +79 -0
- package/core/grill-prd-policy.md +35 -0
- package/core/mcp-tool-policy.md +90 -0
- package/core/spec-bootstrap-policy.md +39 -0
- package/core/workflow-profile.md +30 -0
- package/package.json +24 -0
- package/src/cli/index.js +198 -0
- package/src/deps/index.js +96 -0
- package/src/doctor/index.js +16 -0
- package/src/lib/files.js +64 -0
- package/src/lib/json.js +44 -0
- package/src/lib/platforms.js +32 -0
- package/src/lib/trellis.js +118 -0
- package/src/platforms/claude-code/index.js +54 -0
- package/src/platforms/cursor/index.js +50 -0
- package/src/platforms/opencode/index.js +26 -0
- package/src/platforms/shared.js +58 -0
- package/templates/hooks/claude-code/dream-wf-guard.py +128 -0
- package/templates/hooks/cursor/dream-wf-guard.py +121 -0
- package/templates/hooks/opencode/dream-wf-guard.js +108 -0
- package/templates/rules/claude-code/dream-wf-block.md +23 -0
- package/templates/rules/cursor/dream-wf.mdc +38 -0
- package/templates/rules/opencode/dream-wf-block.md +23 -0
- package/templates/skills/dream-wf-grill-prd/SKILL.md +94 -0
- package/templates/skills/dream-wf-mcp-policy/SKILL.md +53 -0
- package/templates/spec/guides/dream-wf-mcp-policy.md +29 -0
- package/templates/spec/guides/dream-wf-prd-policy.md +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# DREAM-WORKFLOW
|
|
2
|
+
|
|
3
|
+
Personal Trellis workflow patch installer for Cursor, Claude Code, and OpenCode.
|
|
4
|
+
|
|
5
|
+
`dream-wf` does not replace Trellis. It installs a small custom profile on top of Trellis:
|
|
6
|
+
|
|
7
|
+
- PRD clarification uses grill-me behavior automatically; the user does not need to mention `dream-wf`.
|
|
8
|
+
- Trellis task lifecycle, specs, hooks, skills, sub-agents, checks, and finish-work remain native.
|
|
9
|
+
- Initial spec candidates combine user answers, PRD decisions, and verified project facts.
|
|
10
|
+
- Code semantic search prefers `fast-context-mcp`.
|
|
11
|
+
- External docs and live web search prefer `grok-search-mcp`.
|
|
12
|
+
- Strict mode guards against implementation before active task / PRD confirmation.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx dream-wf init -p cursor
|
|
18
|
+
npx dream-wf init -p claude
|
|
19
|
+
npx dream-wf init -p opencode
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`-p` is required. Default install is project-level and default mode is `strict`.
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx dream-wf init -p cursor
|
|
28
|
+
npx dream-wf doctor -p cursor
|
|
29
|
+
npx dream-wf update -p cursor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Options:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
-p cursor|claude|opencode
|
|
36
|
+
--mode strict|advisory
|
|
37
|
+
--install-deps
|
|
38
|
+
--developer <name>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Trellis Dependency
|
|
42
|
+
|
|
43
|
+
Source: https://github.com/mindfold-ai/trellis
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install -g @mindfoldhq/trellis@latest
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Initialize Trellis first, or let `dream-wf` tell you the exact command:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
trellis init -u your-name --cursor
|
|
53
|
+
trellis init -u your-name --claude
|
|
54
|
+
trellis init -u your-name --opencode
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Grill Me Dependency
|
|
58
|
+
|
|
59
|
+
Source: https://github.com/mattpocock/skills/blob/main/skills/productivity/grill-me/SKILL.md
|
|
60
|
+
|
|
61
|
+
`dream-wf` installs a project-local `dream-wf-grill-prd` skill that vendors the behavior:
|
|
62
|
+
|
|
63
|
+
- Ask one question at a time.
|
|
64
|
+
- Provide options and a recommended answer.
|
|
65
|
+
- Inspect code before asking when possible.
|
|
66
|
+
- Update `prd.md` after each answer.
|
|
67
|
+
- Require explicit PRD confirmation before implementation.
|
|
68
|
+
|
|
69
|
+
## Fast Context MCP
|
|
70
|
+
|
|
71
|
+
Source: https://github.com/SammySnake-d/fast-context-mcp
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install @sammysnake/fast-context-mcp
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Example MCP server config:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"fast-context": {
|
|
82
|
+
"command": "npx",
|
|
83
|
+
"args": [
|
|
84
|
+
"-y",
|
|
85
|
+
"--prefer-online",
|
|
86
|
+
"fast-context-mcp@latest"
|
|
87
|
+
],
|
|
88
|
+
"env": {
|
|
89
|
+
"WINDSURF_API_KEY": "devin-session-xx"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Grok Search MCP
|
|
96
|
+
|
|
97
|
+
Source: https://github.com/GuDaStudio/GrokSearch
|
|
98
|
+
|
|
99
|
+
Requires Python 3.10+ and `uv` / `uvx`.
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"grok-search": {
|
|
104
|
+
"type": "stdio",
|
|
105
|
+
"command": "uvx",
|
|
106
|
+
"args": [
|
|
107
|
+
"--from",
|
|
108
|
+
"git+https://github.com/GuDaStudio/GrokSearch@grok-with-tavily",
|
|
109
|
+
"grok-search"
|
|
110
|
+
],
|
|
111
|
+
"env": {
|
|
112
|
+
"GROK_API_URL": "https://your-api-endpoint.com/v1",
|
|
113
|
+
"GROK_API_KEY": "your-grok-api-key",
|
|
114
|
+
"GROK_MODEL":"your-model",
|
|
115
|
+
"TAVILY_API_KEY": "optional-tavily-key",
|
|
116
|
+
"TAVILY_API_URL": "https://api.tavily.com"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Do not commit real API keys or MCP secrets into project files.
|
|
123
|
+
|
|
124
|
+
## Generated Files
|
|
125
|
+
|
|
126
|
+
Cursor:
|
|
127
|
+
|
|
128
|
+
- `.cursor/rules/dream-wf.mdc`
|
|
129
|
+
- `.cursor/skills/dream-wf-grill-prd/SKILL.md`
|
|
130
|
+
- `.cursor/skills/dream-wf-mcp-policy/SKILL.md`
|
|
131
|
+
- `.cursor/hooks/dream-wf-guard.py`
|
|
132
|
+
- `.cursor/hooks.json`
|
|
133
|
+
|
|
134
|
+
Claude Code:
|
|
135
|
+
|
|
136
|
+
- `CLAUDE.md` dream-wf entry block
|
|
137
|
+
- `.claude/skills/dream-wf-grill-prd/SKILL.md`
|
|
138
|
+
- `.claude/skills/dream-wf-mcp-policy/SKILL.md`
|
|
139
|
+
- `.claude/hooks/dream-wf-guard.py`
|
|
140
|
+
- `.claude/settings.json`
|
|
141
|
+
|
|
142
|
+
OpenCode:
|
|
143
|
+
|
|
144
|
+
- `AGENTS.md` dream-wf entry block
|
|
145
|
+
- `.opencode/skills/dream-wf-grill-prd/SKILL.md`
|
|
146
|
+
- `.opencode/skills/dream-wf-mcp-policy/SKILL.md`
|
|
147
|
+
- `.opencode/plugins/dream-wf-guard.js`
|
|
148
|
+
|
|
149
|
+
Trellis:
|
|
150
|
+
|
|
151
|
+
- Appends a `Dream WF Profile` section to `.trellis/workflow.md`.
|
|
152
|
+
- Installs `.trellis/spec/guides/dream-wf-prd-policy.md`.
|
|
153
|
+
- Installs `.trellis/spec/guides/dream-wf-mcp-policy.md`.
|
|
154
|
+
|
|
155
|
+
## Strict Mode
|
|
156
|
+
|
|
157
|
+
Strict mode blocks mutating actions when:
|
|
158
|
+
|
|
159
|
+
- No active Trellis task exists.
|
|
160
|
+
- A task is still in `planning` and `prd.md` is not confirmed.
|
|
161
|
+
|
|
162
|
+
Mark PRD confirmation with one of these markers in `prd.md`:
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
PRD confirmed
|
|
166
|
+
confirmed: true
|
|
167
|
+
status: confirmed
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Security
|
|
171
|
+
|
|
172
|
+
Run doctor before committing:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npx dream-wf doctor -p cursor
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The doctor checks for obvious MCP secret patterns in project files and reports suspicious findings.
|
package/bin/dream-wf.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
|
|
3
|
+
`dream-wf` expects Trellis plus two MCP servers and the grill-me skill behavior.
|
|
4
|
+
|
|
5
|
+
## Trellis
|
|
6
|
+
|
|
7
|
+
Source: https://github.com/mindfold-ai/trellis
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @mindfoldhq/trellis@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Initialize per platform:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
trellis init -u your-name --cursor
|
|
17
|
+
trellis init -u your-name --claude
|
|
18
|
+
trellis init -u your-name --opencode
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Grill Me
|
|
22
|
+
|
|
23
|
+
Source: https://github.com/mattpocock/skills/blob/main/skills/productivity/grill-me/SKILL.md
|
|
24
|
+
|
|
25
|
+
`dream-wf` vendors the behavior as `dream-wf-grill-prd` rather than depending on a global skill installer.
|
|
26
|
+
|
|
27
|
+
## Fast Context MCP
|
|
28
|
+
|
|
29
|
+
Source: https://github.com/SammySnake-d/fast-context-mcp
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @sammysnake/fast-context-mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Example MCP server config:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"command": "npx",
|
|
40
|
+
"args": [
|
|
41
|
+
"-y",
|
|
42
|
+
"--prefer-online",
|
|
43
|
+
"fast-context-mcp@latest"
|
|
44
|
+
],
|
|
45
|
+
"env": {
|
|
46
|
+
"WINDSURF_API_KEY": "devin-session-xx"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Grok Search MCP
|
|
52
|
+
|
|
53
|
+
Source: https://github.com/GuDaStudio/GrokSearch
|
|
54
|
+
|
|
55
|
+
Requires Python 3.10+ and `uv`/`uvx`.
|
|
56
|
+
|
|
57
|
+
Example MCP server config with placeholders only:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"grok-search": {
|
|
62
|
+
"type": "stdio",
|
|
63
|
+
"command": "uvx",
|
|
64
|
+
"args": [
|
|
65
|
+
"--from",
|
|
66
|
+
"git+https://github.com/GuDaStudio/GrokSearch@grok-with-tavily",
|
|
67
|
+
"grok-search"
|
|
68
|
+
],
|
|
69
|
+
"env": {
|
|
70
|
+
"GROK_API_URL": "https://your-api-endpoint.com/v1",
|
|
71
|
+
"GROK_API_KEY": "your-grok-api-key",
|
|
72
|
+
"TAVILY_API_KEY": "optional-tavily-key",
|
|
73
|
+
"GROK_MODEL":"your-model-name"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Do not commit real MCP API keys into project files.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Grill PRD Policy
|
|
2
|
+
|
|
3
|
+
Source skill: https://github.com/mattpocock/skills/blob/main/skills/productivity/grill-me/SKILL.md
|
|
4
|
+
|
|
5
|
+
Use grill-me behavior during Trellis planning. This replaces only the interview style, not Trellis task creation or planning artifacts.
|
|
6
|
+
|
|
7
|
+
## Rules
|
|
8
|
+
|
|
9
|
+
- Ask one question at a time.
|
|
10
|
+
- Resolve decision dependencies one branch at a time.
|
|
11
|
+
- For each question, provide 2-3 concrete options and a recommended answer.
|
|
12
|
+
- If a question can be answered by exploring the codebase, docs, config, existing specs, or task history, explore first instead of asking the user.
|
|
13
|
+
- After each answer, update `prd.md` immediately.
|
|
14
|
+
- Keep open questions explicit until they are answered or intentionally deferred.
|
|
15
|
+
- Do not start implementation until the PRD is reviewed and confirmed.
|
|
16
|
+
|
|
17
|
+
## Required PRD Sections
|
|
18
|
+
|
|
19
|
+
- Goal
|
|
20
|
+
- In scope
|
|
21
|
+
- Out of scope
|
|
22
|
+
- Requirements
|
|
23
|
+
- Acceptance criteria
|
|
24
|
+
- Decisions
|
|
25
|
+
- Technical notes
|
|
26
|
+
- Open questions
|
|
27
|
+
- Spec candidates
|
|
28
|
+
|
|
29
|
+
## Trellis Compatibility
|
|
30
|
+
|
|
31
|
+
- Keep `task.py create` as the task creation mechanism.
|
|
32
|
+
- Keep `prd.md` as the canonical requirements artifact.
|
|
33
|
+
- Use `design.md` and `implement.md` for complex tasks.
|
|
34
|
+
- Use `implement.jsonl` and `check.jsonl` for stable context files.
|
|
35
|
+
- Continue to use `trellis-before-dev`, `trellis-check`, `trellis-update-spec`, and `trellis-break-loop`.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# MCP Tool Policy
|
|
2
|
+
|
|
3
|
+
`dream-wf` uses MCP tools deliberately. Classify the information need before searching.
|
|
4
|
+
|
|
5
|
+
## Preferred Tools
|
|
6
|
+
|
|
7
|
+
### Codebase Semantic Context
|
|
8
|
+
|
|
9
|
+
Use `fast-context-mcp` first when the task requires semantic understanding of a codebase.
|
|
10
|
+
|
|
11
|
+
Source: https://github.com/SammySnake-d/fast-context-mcp
|
|
12
|
+
|
|
13
|
+
Preferred tool:
|
|
14
|
+
|
|
15
|
+
- `fast_context_search`
|
|
16
|
+
|
|
17
|
+
Use it for:
|
|
18
|
+
|
|
19
|
+
- Finding where a behavior is implemented.
|
|
20
|
+
- Understanding architecture or cross-file flows.
|
|
21
|
+
- Discovering relevant files from a natural-language query.
|
|
22
|
+
- Initial context gathering for PRD, design, or implementation planning.
|
|
23
|
+
|
|
24
|
+
Fallback:
|
|
25
|
+
|
|
26
|
+
- Use exact search only when looking for known symbols, strings, paths, or small scoped patterns.
|
|
27
|
+
- If `fast-context-mcp` is unavailable, say why before falling back.
|
|
28
|
+
|
|
29
|
+
### External Docs and Live Web Information
|
|
30
|
+
|
|
31
|
+
Use `grok-search-mcp` first for external docs, live technical information, real-time search, webpage fetch, and source discovery.
|
|
32
|
+
|
|
33
|
+
Source: https://github.com/GuDaStudio/GrokSearch
|
|
34
|
+
|
|
35
|
+
Preferred tools:
|
|
36
|
+
|
|
37
|
+
- `web_search`
|
|
38
|
+
- `web_fetch`
|
|
39
|
+
- `web_map`
|
|
40
|
+
- `get_sources`
|
|
41
|
+
|
|
42
|
+
Use it for:
|
|
43
|
+
|
|
44
|
+
- Current documentation.
|
|
45
|
+
- API usage and examples.
|
|
46
|
+
- Live technology information.
|
|
47
|
+
- Fetching webpage content.
|
|
48
|
+
- Finding and citing source URLs.
|
|
49
|
+
|
|
50
|
+
Fallback:
|
|
51
|
+
|
|
52
|
+
- Use built-in web tools only when `grok-search-mcp` is unavailable or insufficient.
|
|
53
|
+
- State the fallback reason before using another web tool.
|
|
54
|
+
|
|
55
|
+
## Strict Mode Rules
|
|
56
|
+
|
|
57
|
+
In strict mode:
|
|
58
|
+
|
|
59
|
+
- Do not start broad code exploration with plain grep when semantic search is available.
|
|
60
|
+
- Do not use built-in web search before `grok-search-mcp` for external docs or live information.
|
|
61
|
+
- Do not silently degrade when an MCP is unavailable.
|
|
62
|
+
- Do not put API keys or MCP secrets into tracked project files.
|
|
63
|
+
|
|
64
|
+
## Installation References
|
|
65
|
+
|
|
66
|
+
Fast Context MCP:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install @sammysnake/fast-context-mcp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Grok Search MCP requires Python 3.10+ and `uv`/`uvx`. Example MCP command uses placeholders only:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"type": "stdio",
|
|
77
|
+
"command": "uvx",
|
|
78
|
+
"args": [
|
|
79
|
+
"--from",
|
|
80
|
+
"git+https://github.com/GuDaStudio/GrokSearch@grok-with-tavily",
|
|
81
|
+
"grok-search"
|
|
82
|
+
],
|
|
83
|
+
"env": {
|
|
84
|
+
"GROK_API_URL": "https://your-api-endpoint.com/v1",
|
|
85
|
+
"GROK_API_KEY": "your-grok-api-key",
|
|
86
|
+
"TAVILY_API_KEY": "optional-tavily-key",
|
|
87
|
+
"GROK_MODEL":"your-model-name"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Spec Bootstrap Policy
|
|
2
|
+
|
|
3
|
+
Trellis creates `.trellis/spec/` templates during initialization. Those templates are placeholders until the project has a reviewed first spec pass.
|
|
4
|
+
|
|
5
|
+
## First Spec Pass
|
|
6
|
+
|
|
7
|
+
Generate candidate specs from three sources:
|
|
8
|
+
|
|
9
|
+
1. User decisions captured through grill-me PRD clarification.
|
|
10
|
+
2. Product and technical decisions recorded in `prd.md`, `design.md`, and `implement.md`.
|
|
11
|
+
3. Verified project facts from code, tests, configs, docs, and existing conventions.
|
|
12
|
+
|
|
13
|
+
Do not write speculative architecture as if it is already true.
|
|
14
|
+
|
|
15
|
+
## New Projects
|
|
16
|
+
|
|
17
|
+
For new projects, specs should describe decisions that have actually been made:
|
|
18
|
+
|
|
19
|
+
- Product boundaries and acceptance criteria from the first PRD.
|
|
20
|
+
- Chosen tech stack and package structure.
|
|
21
|
+
- API, component, state, data, error, logging, test, and validation conventions that are needed now.
|
|
22
|
+
- Minimal rules needed for the next task, not a complete imaginary architecture.
|
|
23
|
+
|
|
24
|
+
## Existing Projects
|
|
25
|
+
|
|
26
|
+
For existing projects, specs should be evidence-backed:
|
|
27
|
+
|
|
28
|
+
- Read representative source files before writing conventions.
|
|
29
|
+
- Reference concrete file paths and patterns.
|
|
30
|
+
- Remove rules that cannot be traced to code, docs, or confirmed user decisions.
|
|
31
|
+
- Prefer empty templates over incorrect templates.
|
|
32
|
+
|
|
33
|
+
## Review Gate
|
|
34
|
+
|
|
35
|
+
Initial specs are candidates until the user reviews them. After confirmation, future tasks may treat them as project conventions.
|
|
36
|
+
|
|
37
|
+
## Long-Term Maintenance
|
|
38
|
+
|
|
39
|
+
Use `trellis-update-spec` after tasks when a reusable learning, decision, gotcha, anti-pattern, or repeated correction should become project memory.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Dream WF Profile
|
|
2
|
+
|
|
3
|
+
`dream-wf` is a personal custom patch profile for Trellis. It does not replace Trellis. It installs small, project-level preferences on top of Trellis so Cursor, Claude Code, and OpenCode follow the same workflow.
|
|
4
|
+
|
|
5
|
+
## Positioning
|
|
6
|
+
|
|
7
|
+
- Trellis owns task lifecycle, workflow-state injection, specs, task artifacts, context manifests, sub-agent context injection, checks, spec updates, and finish-work.
|
|
8
|
+
- `dream-wf` owns preference patches: grill-me style PRD clarification, MCP tool priority, dependency checks, and strict guardrails.
|
|
9
|
+
- Project files remain the source of truth. Do not rely on chat memory for requirements, project conventions, or task state.
|
|
10
|
+
|
|
11
|
+
## Preserved Trellis Flow
|
|
12
|
+
|
|
13
|
+
Keep the native Trellis flow:
|
|
14
|
+
|
|
15
|
+
1. Classify the user request.
|
|
16
|
+
2. Ask for Trellis task-creation consent when useful.
|
|
17
|
+
3. Create a task and enter `planning`.
|
|
18
|
+
4. Write `prd.md` for every task.
|
|
19
|
+
5. Write `design.md` and `implement.md` for complex tasks.
|
|
20
|
+
6. Curate `implement.jsonl` and `check.jsonl` when stable context manifests are useful.
|
|
21
|
+
7. Start the task and enter `in_progress`.
|
|
22
|
+
8. Run before-dev context loading, implementation, check, update-spec, and finish-work.
|
|
23
|
+
|
|
24
|
+
## Dream WF Patch Points
|
|
25
|
+
|
|
26
|
+
- Use `dream-wf-grill-prd` for PRD clarification instead of open-ended brainstorm interviewing.
|
|
27
|
+
- Generate initial spec candidates from user answers, PRD decisions, and verified project facts.
|
|
28
|
+
- Prefer `fast-context-mcp` for codebase semantic search.
|
|
29
|
+
- Prefer `grok-search-mcp` for external docs, live technical information, and webpage fetching.
|
|
30
|
+
- Use strict guardrails to prevent implementation before active task and PRD readiness.
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dream-wf",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Personal Trellis workflow patch installer for Cursor, Claude Code, and OpenCode.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dream-wf": "bin/dream-wf.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"check": "node --check bin/dream-wf.js && node --check src/cli/index.js && node --check src/lib/files.js && node --check src/lib/platforms.js && node --check src/lib/trellis.js && node --check src/lib/json.js && node --check src/doctor/index.js && node --check src/deps/index.js && node --check src/platforms/shared.js && node --check src/platforms/cursor/index.js && node --check src/platforms/claude-code/index.js && node --check src/platforms/opencode/index.js && node --check templates/hooks/opencode/dream-wf-guard.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"trellis",
|
|
14
|
+
"workflow",
|
|
15
|
+
"cursor",
|
|
16
|
+
"claude",
|
|
17
|
+
"opencode",
|
|
18
|
+
"mcp"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/cli/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { assertSupportedPlatform, normalizePlatform } from '../lib/platforms.js';
|
|
5
|
+
import { ensureTrellisInitialized, installTrellisProfile } from '../lib/trellis.js';
|
|
6
|
+
import { formatRelative } from '../lib/files.js';
|
|
7
|
+
import { installCursor } from '../platforms/cursor/index.js';
|
|
8
|
+
import { installClaudeCode } from '../platforms/claude-code/index.js';
|
|
9
|
+
import { installOpenCode } from '../platforms/opencode/index.js';
|
|
10
|
+
import { runDoctor, formatDoctorReport } from '../doctor/index.js';
|
|
11
|
+
|
|
12
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
13
|
+
|
|
14
|
+
export async function run(argv) {
|
|
15
|
+
const { command, options } = parseArgs(argv);
|
|
16
|
+
|
|
17
|
+
if (options.help || command === 'help') {
|
|
18
|
+
writeOutput(helpText());
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!command) {
|
|
23
|
+
throw new Error(`Missing command.\n\n${helpText()}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const platform = normalizePlatform(options.platform);
|
|
27
|
+
assertSupportedPlatform(platform);
|
|
28
|
+
|
|
29
|
+
const rootDir = process.cwd();
|
|
30
|
+
const mode = options.mode ?? 'strict';
|
|
31
|
+
if (!['strict', 'advisory'].includes(mode)) {
|
|
32
|
+
throw new Error('Invalid --mode. Use strict or advisory.');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (command === 'init') {
|
|
36
|
+
await init(rootDir, { ...options, platform, mode });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (command === 'doctor') {
|
|
41
|
+
const report = await runDoctor(rootDir, platform);
|
|
42
|
+
writeOutput(formatDoctorReport(report));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (command === 'update') {
|
|
47
|
+
await init(rootDir, { ...options, platform, mode });
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (command === 'uninstall') {
|
|
52
|
+
throw new Error('uninstall is planned but not implemented in this MVP. Remove dream-wf generated files manually if needed.');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
throw new Error(`Unknown command "${command}".\n\n${helpText()}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function init(rootDir, options) {
|
|
59
|
+
writeOutput(formatBanner());
|
|
60
|
+
|
|
61
|
+
const results = [];
|
|
62
|
+
const trellis = await ensureTrellisInitialized(rootDir, options);
|
|
63
|
+
|
|
64
|
+
if (!trellis.initialized) {
|
|
65
|
+
writeOutput([
|
|
66
|
+
'Trellis is not initialized in this project.',
|
|
67
|
+
`Run: ${trellis.initCommand}`,
|
|
68
|
+
'Then rerun dream-wf init.'
|
|
69
|
+
].join('\n'));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
results.push(await installTrellisProfile(rootDir));
|
|
74
|
+
|
|
75
|
+
if (options.platform === 'cursor') {
|
|
76
|
+
results.push(...await installCursor(packageRoot, rootDir, options));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (options.platform === 'claude') {
|
|
80
|
+
results.push(...await installClaudeCode(packageRoot, rootDir, options));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (options.platform === 'opencode') {
|
|
84
|
+
results.push(...await installOpenCode(packageRoot, rootDir, options));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const report = await runDoctor(rootDir, options.platform);
|
|
88
|
+
writeOutput(`${formatInstallReport(rootDir, results)}\n\n${formatDoctorReport(report)}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function parseArgs(argv) {
|
|
92
|
+
const [command, ...rest] = argv;
|
|
93
|
+
const options = {};
|
|
94
|
+
|
|
95
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
96
|
+
const arg = rest[index];
|
|
97
|
+
|
|
98
|
+
if (arg === '--help' || arg === '-h') {
|
|
99
|
+
options.help = true;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (arg === '--install-deps') {
|
|
104
|
+
options.installDeps = true;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (arg === '--skip-deps') {
|
|
109
|
+
options.installDeps = false;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (arg === '--yes' || arg === '-y') {
|
|
114
|
+
options.yes = true;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (arg === '-p') {
|
|
119
|
+
const value = rest[index + 1];
|
|
120
|
+
if (!value || value.startsWith('-')) {
|
|
121
|
+
throw new Error('Missing value for -p. Use -p <cursor|claude|opencode>.');
|
|
122
|
+
}
|
|
123
|
+
options.platform = value;
|
|
124
|
+
index += 1;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (arg === '--mode') {
|
|
129
|
+
options.mode = readOptionValue(arg, rest, index);
|
|
130
|
+
index += 1;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (arg.startsWith('--mode=')) {
|
|
135
|
+
options.mode = arg.slice('--mode='.length);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (arg === '--developer') {
|
|
140
|
+
options.developer = readOptionValue(arg, rest, index);
|
|
141
|
+
index += 1;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (arg.startsWith('--developer=')) {
|
|
146
|
+
options.developer = arg.slice('--developer='.length);
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
throw new Error(`Unexpected argument: ${arg}`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return { command, options };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function readOptionValue(arg, rest, index) {
|
|
157
|
+
const value = rest[index + 1];
|
|
158
|
+
if (!value || value.startsWith('-')) {
|
|
159
|
+
throw new Error(`Missing value for ${arg}.`);
|
|
160
|
+
}
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function formatInstallReport(rootDir, results) {
|
|
165
|
+
const lines = ['dream-wf install report:'];
|
|
166
|
+
for (const result of results.flat().filter(Boolean)) {
|
|
167
|
+
const suffix = result.reason ? ` (${result.reason})` : '';
|
|
168
|
+
lines.push(`- ${result.action}: ${formatRelative(rootDir, result.path)}${suffix}`);
|
|
169
|
+
}
|
|
170
|
+
return lines.join('\n');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function writeOutput(message) {
|
|
174
|
+
process.stdout.write(`${message}\n`);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function formatBanner() {
|
|
178
|
+
const banner = [
|
|
179
|
+
'██████╗ ██████╗ ███████╗ █████╗ ███╗ ███╗',
|
|
180
|
+
'██╔══██╗██╔══██╗██╔════╝██╔══██╗████╗ ████║',
|
|
181
|
+
'██║ ██║██████╔╝█████╗ ███████║██╔████╔██║',
|
|
182
|
+
'██║ ██║██╔══██╗██╔══╝ ██╔══██║██║╚██╔╝██║',
|
|
183
|
+
'██████╔╝██║ ██║███████╗██║ ██║██║ ╚═╝ ██║',
|
|
184
|
+
'╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝',
|
|
185
|
+
'',
|
|
186
|
+
' Dream WF · Trellis workflow profile installer'
|
|
187
|
+
].join('\n');
|
|
188
|
+
|
|
189
|
+
if (!process.stdout.isTTY || process.env.NO_COLOR) {
|
|
190
|
+
return banner;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return `\u001B[35m${banner}\u001B[0m`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function helpText() {
|
|
197
|
+
return `dream-wf\n\nUsage:\n dream-wf init -p <cursor|claude|opencode> [--mode strict|advisory] [--install-deps --developer <name>]\n dream-wf doctor -p <cursor|claude|opencode>\n dream-wf update -p <cursor|claude|opencode>\n\nDefaults:\n --mode strict\n project-level install\n\nExamples:\n npx dream-wf init -p cursor\n npx dream-wf init -p claude --install-deps --developer ashe\n npx dream-wf doctor -p opencode`;
|
|
198
|
+
}
|