@programinglive/dev-workflow-mcp-server 1.1.7 โ 1.1.16
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/.github/workflows/npm-publish.yml +47 -0
- package/CHANGELOG.md +81 -0
- package/README.md +144 -5
- package/db/index.js +204 -0
- package/docs/product/PRD.md +64 -0
- package/docs/web-dashboard.md +163 -0
- package/exec.js +46 -1
- package/index.js +81 -6
- package/install.js +5 -1
- package/package.json +19 -8
- package/release-wrapper.js +26 -1
- package/tests/build.test.js +37 -0
- package/tests/exec.test.js +35 -0
- package/tests/handlers.test.js +288 -0
- package/tests/release-wrapper.test.js +15 -5
- package/tests/workflowState.test.js +272 -1
- package/tools/definitions.js +103 -0
- package/tools/handlers.js +261 -8
- package/vite.config.js +43 -0
- package/web/index.html +747 -0
- package/web/server.js +90 -0
- package/workflow-state.js +502 -15
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: Publish package
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
env:
|
|
17
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout repository
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: "20"
|
|
27
|
+
cache: "npm"
|
|
28
|
+
registry-url: https://registry.npmjs.org
|
|
29
|
+
scope: "@programinglive"
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: npm ci
|
|
33
|
+
|
|
34
|
+
- name: Build package
|
|
35
|
+
run: npm run build
|
|
36
|
+
|
|
37
|
+
- name: Verify tag matches package version
|
|
38
|
+
run: |
|
|
39
|
+
EXPECTED_TAG="${GITHUB_REF#refs/tags/}"
|
|
40
|
+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
41
|
+
if [ "v${PACKAGE_VERSION}" != "${EXPECTED_TAG}" ]; then
|
|
42
|
+
echo "Package version ${PACKAGE_VERSION} does not match tag ${EXPECTED_TAG}"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
- name: Publish to npm
|
|
47
|
+
run: npm publish --provenance
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,87 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.16](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.15...v1.1.16) (2025-10-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ๐งน Chores
|
|
9
|
+
|
|
10
|
+
* align npm provenance metadata ([459572e](https://github.com/programinglive/dev-workflow-mcp-server/commit/459572e07efa340ef87cc679535fb24413d8c997))
|
|
11
|
+
|
|
12
|
+
### [1.1.15](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.14...v1.1.15) (2025-10-31)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### ๐ Documentation
|
|
16
|
+
|
|
17
|
+
* add npm publish workflow automation ([c923734](https://github.com/programinglive/dev-workflow-mcp-server/commit/c923734ab4399afbcb0166abcd16cd01c3e50c0e))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### ๐ท Continuous Integration
|
|
21
|
+
|
|
22
|
+
* **npm:** build + provenance in npm-publish workflow ([5ae04db](https://github.com/programinglive/dev-workflow-mcp-server/commit/5ae04db33e33fe64c33d8eac08db70e98754ea64))
|
|
23
|
+
|
|
24
|
+
### [1.1.14](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.13...v1.1.14) (2025-10-31)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### ๐ Bug Fixes
|
|
28
|
+
|
|
29
|
+
* improve workflow state project root resolution ([a575e24](https://github.com/programinglive/dev-workflow-mcp-server/commit/a575e2404d26e550c8e52e4a524a75a3fa64752d))
|
|
30
|
+
|
|
31
|
+
### [1.1.13](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.12...v1.1.13) (2025-10-30)
|
|
32
|
+
|
|
33
|
+
### [1.1.12](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.11...v1.1.12) (2025-10-30)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### โจ Features
|
|
37
|
+
|
|
38
|
+
* **cli:** add 'call' subcommand to invoke MCP tools directly (e.g., node index.js call drop_task) ([c9b8fae](https://github.com/programinglive/dev-workflow-mcp-server/commit/c9b8fae7e24e0915d857135d03fa969b10dcac67))
|
|
39
|
+
* **web:** docs modal, docs API, navbar redesign ([902242b](https://github.com/programinglive/dev-workflow-mcp-server/commit/902242b1318b01f8f62ef7c4c0f6347cb8517617))
|
|
40
|
+
* **web:** embed docs modal and redesign dashboard ([d2cf2fb](https://github.com/programinglive/dev-workflow-mcp-server/commit/d2cf2fb4ae90e61b20c72ed26f25dc0e5119247a))
|
|
41
|
+
|
|
42
|
+
### [1.1.11](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.10...v1.1.11) (2025-10-30)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### ๐งน Chores
|
|
46
|
+
|
|
47
|
+
* verify run_full_workflow with persisted project summary ([6fdb475](https://github.com/programinglive/dev-workflow-mcp-server/commit/6fdb475f65ee6ef2c061b0b1cf954a282406e2a1))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### โจ Features
|
|
51
|
+
|
|
52
|
+
* add per-user state, SQLite project summary, and dashboard ([7b57b6e](https://github.com/programinglive/dev-workflow-mcp-server/commit/7b57b6e067ad59f2999a2badcb51b1293192c96b))
|
|
53
|
+
* per-project workflow state with unique per-user IDs; smarter workflow ([b710a52](https://github.com/programinglive/dev-workflow-mcp-server/commit/b710a524997583f58cd6da2567ba9fd14abdd3c9))
|
|
54
|
+
|
|
55
|
+
### [1.1.10](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.9...v1.1.10) (2025-10-29)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### โจ Features
|
|
59
|
+
|
|
60
|
+
* add project knowledge library with persisted summary file for future database integration ([b9dc13f](https://github.com/programinglive/dev-workflow-mcp-server/commit/b9dc13f4b25dec756088a55185ccbfdb3988a644))
|
|
61
|
+
|
|
62
|
+
### [1.1.9](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.8...v1.1.9) (2025-10-29)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### ๐งน Chores
|
|
66
|
+
|
|
67
|
+
* interim commit ([b1aead0](https://github.com/programinglive/dev-workflow-mcp-server/commit/b1aead05920c766a183988fb93d3f0edc3e1eafc))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### โ
Tests
|
|
71
|
+
|
|
72
|
+
* update README.md, exec.js, package-lock.json +7 more ([894fdf1](https://github.com/programinglive/dev-workflow-mcp-server/commit/894fdf1eace33ddf0081c565028d214e1c7697bf))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### โจ Features
|
|
76
|
+
|
|
77
|
+
* make run_full_workflow smart and resumable from current phase ([930eb3c](https://github.com/programinglive/dev-workflow-mcp-server/commit/930eb3cb84c241b14f0e194cf490313e1e99a7ce))
|
|
78
|
+
|
|
79
|
+
### [1.1.8](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.7...v1.1.8) (2025-10-27)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### ๐ Documentation
|
|
83
|
+
|
|
84
|
+
* note DEV_WORKFLOW_STATE_FILE override ([bbeb11b](https://github.com/programinglive/dev-workflow-mcp-server/commit/bbeb11bc7f8be33f7c1a51b336283a3b2a48d3ea))
|
|
85
|
+
|
|
5
86
|
### [1.1.7](https://github.com/programinglive/dev-workflow-mcp-server/compare/v1.1.6...v1.1.7) (2025-10-26)
|
|
6
87
|
|
|
7
88
|
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Each project gets its own isolated workflow state file.
|
|
|
24
24
|
npm install @programinglive/dev-workflow-mcp-server
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
This will automatically create a `.workflow-state.json` file in the **project where you ran `npm install`** (using npm's `INIT_CWD`), keeping workflow history separate per project. If you're installing the package itself (inside `node_modules`), the script skips creation so it never pollutes the shared package directory.
|
|
27
|
+
This will automatically create a `.state/workflow-state.json` file in the **project where you ran `npm install`** (using npm's `INIT_CWD`), keeping workflow history separate per project. If you're installing the package itself (inside `node_modules`), the script skips creation so it never pollutes the shared package directory.
|
|
28
28
|
|
|
29
29
|
### Option 2: Install from Source
|
|
30
30
|
|
|
@@ -34,6 +34,31 @@ cd dev-workflow-mcp-server
|
|
|
34
34
|
npm install
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
> **Windows prerequisites:** Installing dependencies from source compiles native modules such as `better-sqlite3`. Make sure Python 3 (added to PATH) and the Visual Studio Build Tools โDesktop development with C++โ workload are installed before running `npm install`. Without them, npm will fail with a โneed pythonโ or build error.
|
|
38
|
+
|
|
39
|
+
### Option 3: Install on Plesk Hosting
|
|
40
|
+
|
|
41
|
+
Plesk supports Node.js applications through its Node.js extension. To deploy the MCP server on a Plesk subscription:
|
|
42
|
+
|
|
43
|
+
1. **Enable Node.js support** โ Ensure the Plesk administrator has installed the Node.js extension and enabled SSH access for your subscription.
|
|
44
|
+
2. **Upload the project** โ Either clone the repository or upload an archive into the directory you will run it from (e.g., `httpdocs/dev-workflow-mcp-server`). From SSH you can run:
|
|
45
|
+
```bash
|
|
46
|
+
cd httpdocs
|
|
47
|
+
git clone https://github.com/programinglive/dev-workflow-mcp-server.git
|
|
48
|
+
cd dev-workflow-mcp-server
|
|
49
|
+
```
|
|
50
|
+
3. **Install dependencies** โ In Pleskโs **Node.js** panel use โNPM installโ (or run `npm install --production` over SSH). Linux hosts already ship the Python/build toolchain required for `better-sqlite3`; if your plan uses a Windows host, install Python 3 and the Visual Studio Build Tools beforehand or ask your provider to enable them.
|
|
51
|
+
4. **Define environment variables** โ In the Node.js panel add any environment variables you need (for example `DEV_WORKFLOW_USER_ID` or `DEV_WORKFLOW_STATE_FILE`). This keeps state files outside the web root if desired.
|
|
52
|
+
5. **Configure the application** โ Set **Application startup file** to `index.js` and **Application mode** to `production`. Plesk will run the server with `node index.js`.
|
|
53
|
+
6. **Start/Restart the app** โ Click โRestart Appโ so Plesk launches the MCP server with the new configuration. When you update the code, rerun โNPM installโ and restart.
|
|
54
|
+
|
|
55
|
+
> **Tip:** The MCP server communicates over stdio. If you only need it as a CLI tool, you can also run `npx @programinglive/dev-workflow-mcp-server` directly in an SSH session without keeping it running under the Node.js panel.
|
|
56
|
+
|
|
57
|
+
#### Two Usage Modes
|
|
58
|
+
|
|
59
|
+
- **Local (source)**: Point your MCP client to `index.js`. This runs directly from source and requires no build step. Recommended for MCP usage.
|
|
60
|
+
- **Production (built)**: Run `npm run build` once to generate `dist/`. This creates an optimized bundle but isnโt needed for MCP usage.
|
|
61
|
+
|
|
37
62
|
### 3. Configure in Windsurf/Claude Desktop
|
|
38
63
|
|
|
39
64
|
Point your MCP client to the server entry point. Replace `<PROJECT_ROOT>` with the absolute path to this repository on your machine.
|
|
@@ -128,27 +153,128 @@ Point your MCP client to the server entry point. Replace `<PROJECT_ROOT>` with t
|
|
|
128
153
|
|
|
129
154
|
After adding the configuration, restart the application to load the MCP server.
|
|
130
155
|
|
|
156
|
+
## ๐๏ธ Build System
|
|
157
|
+
|
|
158
|
+
This project includes a Vite-based build system for creating optimized distributions.
|
|
159
|
+
|
|
160
|
+
### Scripts
|
|
161
|
+
|
|
162
|
+
- `npm run build` - Bundle the source into `dist/index.mjs` for distribution
|
|
163
|
+
- `npm run dev` - Run in development mode with file watching
|
|
164
|
+
- `npm run local` - Alias for running from source (same as `npm start`)
|
|
165
|
+
- `npm run web` - Launch the lightweight workflow dashboard for browsing task history (see [Web Dashboard docs](./docs/web-dashboard.md))
|
|
166
|
+
|
|
167
|
+
#### `npm run web`
|
|
168
|
+
|
|
169
|
+
This command starts the dashboard defined in `web/server.js`, giving you a quick view of workflow history and summary statistics.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm run web
|
|
173
|
+
# ๐ Dev Workflow Dashboard running at http://localhost:3111
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- **Default port:** 3111 (or the next free port if occupied). Override with `DEV_WORKFLOW_WEB_PORT`.
|
|
177
|
+
- **Query parameter:** `?user=<id>` lets you inspect another userโs history (defaults to `default`).
|
|
178
|
+
- **API endpoints:**
|
|
179
|
+
- `GET /api/summary?user=<id>` โ overall stats for the user.
|
|
180
|
+
- `GET /api/history?user=<id>&page=1&pageSize=20&startDate=YYYY-MM-DD&endDate=YYYY-MM-DD` โ paginated task history.
|
|
181
|
+
- `GET /api/history-summary?user=<id>&frequency=daily|monthly|yearly` โ aggregated counts over time.
|
|
182
|
+
|
|
183
|
+
Open `http://localhost:3111` in a browser to view the dashboard UI (`web/index.html`).
|
|
184
|
+
|
|
185
|
+
### Build Output
|
|
186
|
+
|
|
187
|
+
Running `npm run build` generates:
|
|
188
|
+
- `dist/index.mjs` - Optimized ES module bundle
|
|
189
|
+
- Source maps and other build artifacts
|
|
190
|
+
|
|
191
|
+
The build bundles all source files while externalizing Node.js built-in modules and dependencies, resulting in a single file distribution.
|
|
192
|
+
|
|
193
|
+
### Usage
|
|
194
|
+
|
|
195
|
+
For MCP server usage, point your client at `index.js` (source) to avoid stdio transport compatibility issues. The built `dist/index.mjs` is primarily for:
|
|
196
|
+
- npm package distribution
|
|
197
|
+
- Performance optimization
|
|
198
|
+
- Embedding in other projects
|
|
199
|
+
|
|
131
200
|
## ๐ Project-Specific Workflow State
|
|
132
201
|
|
|
133
|
-
When you install this package in a project, a `.workflow-state.json` file is automatically created in your project root. This file:
|
|
202
|
+
When you install this package in a project, a `.state/workflow-state.json` file is automatically created in your project root. This file:
|
|
134
203
|
|
|
135
204
|
- **Stores workflow history** specific to that project
|
|
136
205
|
- **Tracks task progress** independently per project
|
|
137
206
|
- **Should be gitignored** (already in `.gitignore` by default)
|
|
138
207
|
- **Persists across sessions** so your workflow state is preserved
|
|
208
|
+
- **Stays centralized** even if you run the server from nested build outputs like `dist/`. The MCP server walks back to the project root (looking for `.git` or `package.json`) before reading or writing workflow state, so you never need duplicate copies under build directories.
|
|
139
209
|
|
|
140
|
-
Each project maintains its own isolated workflow history, so you can work on multiple projects without mixing their histories.
|
|
210
|
+
Each project maintains its own isolated workflow history, so you can work on multiple projects without mixing their histories. Within that `.state` directory, the MCP server automatically creates a unique per-user subdirectory (e.g., `.state/users/user-abc123/`). The generated identifier persists locally so multiple developers sharing the same repository never clobber each otherโs workflow files. If you prefer a specific name, set `DEV_WORKFLOW_USER_ID` before launching the server and that value will be used instead of the auto-generated ID.
|
|
141
211
|
|
|
142
212
|
### Adding to .gitignore
|
|
143
213
|
|
|
144
214
|
If you're using this package, add this to your project's `.gitignore`:
|
|
145
215
|
|
|
146
216
|
```
|
|
147
|
-
.
|
|
217
|
+
.state/
|
|
148
218
|
```
|
|
149
219
|
|
|
150
220
|
This keeps workflow state local to each developer's machine.
|
|
151
221
|
|
|
222
|
+
> **Need to override the location?** Set `DEV_WORKFLOW_STATE_FILE=/absolute/path/to/your/project/.state/workflow-state.json` before launching the server (or inside your MCP client config). The server will honor that path, letting you keep the package installed centrally while maintaining per-project workflow history.
|
|
223
|
+
|
|
224
|
+
## ๐ ๏ธ Available Tools
|
|
225
|
+
|
|
226
|
+
- `start_task` - Begin a new coding task
|
|
227
|
+
- `mark_bug_fixed` - Mark the feature/bug as fixed (requires tests next)
|
|
228
|
+
- `create_tests` - Mark that tests have been created
|
|
229
|
+
- `skip_tests` - Skip tests with justification
|
|
230
|
+
- `run_tests` - Record test results (must pass to proceed)
|
|
231
|
+
- `create_documentation` - Mark documentation as created
|
|
232
|
+
- `check_ready_to_commit` - Verify all steps are complete
|
|
233
|
+
- `commit_and_push` - Commit and push changes
|
|
234
|
+
- `perform_release` - Record release details
|
|
235
|
+
- `complete_task` - Mark task as complete and reset
|
|
236
|
+
- `force_complete_task` - Force completion with reason
|
|
237
|
+
- `drop_task` - Abandon current task
|
|
238
|
+
- `get_workflow_status` - Show current status
|
|
239
|
+
- `view_history` - View completed tasks
|
|
240
|
+
- `continue_workflow` - Get next-step guidance
|
|
241
|
+
- `rerun_workflow` - Reset and restart the current task from the beginning
|
|
242
|
+
- `run_full_workflow` - Execute every workflow step in sequence with a single command (requires supplying the details for each phase)
|
|
243
|
+
|
|
244
|
+
### `run_full_workflow`
|
|
245
|
+
|
|
246
|
+
Use this when you already have all the information needed for each workflow phase and want to execute them in one go.
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"summary": "Add payment webhooks",
|
|
251
|
+
"testCommand": "npm test",
|
|
252
|
+
"documentationType": "README",
|
|
253
|
+
"documentationSummary": "Document webhook configuration",
|
|
254
|
+
"commitMessage": "feat: add payment webhooks",
|
|
255
|
+
"releaseCommand": "npm run release:minor",
|
|
256
|
+
"releaseNotes": "Release webhook support",
|
|
257
|
+
"branch": "feature/payments",
|
|
258
|
+
"testsPassed": true,
|
|
259
|
+
"testDetails": "node --test; 42 tests",
|
|
260
|
+
"releaseType": "minor",
|
|
261
|
+
"preset": "minor"
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The tool will:
|
|
266
|
+
|
|
267
|
+
1. `mark_bug_fixed` using `summary`
|
|
268
|
+
2. `create_tests`
|
|
269
|
+
3. `run_tests` with `testsPassed`, `testCommand`, and optional `testDetails`
|
|
270
|
+
4. `create_documentation` with `documentationType` and `documentationSummary`
|
|
271
|
+
5. `check_ready_to_commit`
|
|
272
|
+
6. `commit_and_push` with `commitMessage` and optional `branch`
|
|
273
|
+
7. `perform_release` with `releaseCommand`, plus optional `releaseNotes`, `releaseType`, and `preset`
|
|
274
|
+
8. `complete_task` reusing `commitMessage`
|
|
275
|
+
|
|
276
|
+
All arguments except the optional flags are required and must be non-empty strings.
|
|
277
|
+
|
|
152
278
|
## ๐ซ Releasing Without the Workflow Steps
|
|
153
279
|
|
|
154
280
|
The package ships with a release guard (`release-wrapper.js`) that backs the `npm run release:*` scripts. The guard refuses to run unless:
|
|
@@ -162,6 +288,19 @@ If any requirements are missing, the guard exits with guidance to return to the
|
|
|
162
288
|
1. Use `perform_release {"command":"patch"}` (or `minor`/`major`) via the MCP client.
|
|
163
289
|
2. The guard runs automatically, verifies the workflow state, and records the release before letting you finish with `complete_task`.
|
|
164
290
|
|
|
291
|
+
### Automated npm Publishing
|
|
292
|
+
|
|
293
|
+
This repository ships with `.github/workflows/npm-publish.yml`, which publishes the package to npm whenever a git tag matching `v*` is pushed (for example, `v1.1.14`). To enable the workflow:
|
|
294
|
+
|
|
295
|
+
1. Create an npm automation token with publish rights (`npm token create --read-only false`).
|
|
296
|
+
2. In the repository settings, add a secret named **`NPM_TOKEN`** containing that token.
|
|
297
|
+
3. Ensure your release process pushes tags after running `npm run release:<type>` so the workflow triggers.
|
|
298
|
+
4. Confirm `npm run build` succeeds locally; the workflow runs the build before publishing so broken bundles block the release.
|
|
299
|
+
5. GitHub provenance is enabled via `npm publish --provenance`. Leave GitHub Actions' default OIDC permissions enabled so the job can request an ID token.
|
|
300
|
+
6. Keep the `repository.url` field in `package.json` pointing at this GitHub repo. Provenance validation fails if it does not match the repository that built the package.
|
|
301
|
+
|
|
302
|
+
The workflow verifies that the tag version matches `package.json` before publishing and fails fast if they diverge.
|
|
303
|
+
|
|
165
304
|
## ๐ ๏ธ Available Tools
|
|
166
305
|
|
|
167
306
|
### Tool Argument Requirements
|
|
@@ -372,7 +511,7 @@ You can modify the workflow in `index.js`:
|
|
|
372
511
|
|
|
373
512
|
## ๐ State Management
|
|
374
513
|
|
|
375
|
-
The server maintains state in `.workflow-state.json`:
|
|
514
|
+
The server maintains state in `.state/workflow-state.json`:
|
|
376
515
|
- Current phase
|
|
377
516
|
- Task description
|
|
378
517
|
- Completion status of each step
|
package/db/index.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import Database from "better-sqlite3";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
const DB_FILENAME = "dev-workflow.db";
|
|
9
|
+
const FREQUENCY_FORMATS = {
|
|
10
|
+
daily: "%Y-%m-%d",
|
|
11
|
+
monthly: "%Y-%m",
|
|
12
|
+
yearly: "%Y",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function getDbPath() {
|
|
16
|
+
const initCwd = process.env.INIT_CWD || process.cwd();
|
|
17
|
+
let projectRoot = initCwd;
|
|
18
|
+
while (projectRoot !== path.dirname(projectRoot)) {
|
|
19
|
+
if (existsSync(path.join(projectRoot, "package.json"))) break;
|
|
20
|
+
projectRoot = path.dirname(projectRoot);
|
|
21
|
+
}
|
|
22
|
+
return path.join(projectRoot, ".state", DB_FILENAME);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let db;
|
|
26
|
+
export function getDb() {
|
|
27
|
+
if (!db) {
|
|
28
|
+
const dbPath = getDbPath();
|
|
29
|
+
db = new Database(dbPath);
|
|
30
|
+
db.pragma("journal_mode = WAL");
|
|
31
|
+
migrate();
|
|
32
|
+
}
|
|
33
|
+
return db;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function migrate() {
|
|
37
|
+
const createHistory = `
|
|
38
|
+
CREATE TABLE IF NOT EXISTS workflow_history (
|
|
39
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
40
|
+
user_id TEXT NOT NULL,
|
|
41
|
+
task_description TEXT NOT NULL,
|
|
42
|
+
task_type TEXT NOT NULL,
|
|
43
|
+
commit_message TEXT,
|
|
44
|
+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
45
|
+
forced INTEGER DEFAULT 0,
|
|
46
|
+
force_reason TEXT,
|
|
47
|
+
dropped INTEGER DEFAULT 0,
|
|
48
|
+
drop_reason TEXT,
|
|
49
|
+
UNIQUE(user_id, timestamp, task_description)
|
|
50
|
+
)
|
|
51
|
+
`;
|
|
52
|
+
const createSummary = `
|
|
53
|
+
CREATE TABLE IF NOT EXISTS project_summary (
|
|
54
|
+
user_id TEXT PRIMARY KEY,
|
|
55
|
+
total_tasks INTEGER DEFAULT 0,
|
|
56
|
+
task_types TEXT DEFAULT '{}',
|
|
57
|
+
last_active DATETIME,
|
|
58
|
+
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
59
|
+
recent_tasks TEXT DEFAULT '[]'
|
|
60
|
+
)
|
|
61
|
+
`;
|
|
62
|
+
const idxHistory = `CREATE INDEX IF NOT EXISTS idx_workflow_history_user ON workflow_history(user_id)`;
|
|
63
|
+
const idxSummary = `CREATE INDEX IF NOT EXISTS idx_project_summary_user ON project_summary(user_id)`;
|
|
64
|
+
|
|
65
|
+
db.exec(createHistory);
|
|
66
|
+
db.exec(createSummary);
|
|
67
|
+
db.exec(idxHistory);
|
|
68
|
+
db.exec(idxSummary);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function insertHistoryEntry(userId, entry) {
|
|
72
|
+
const stmt = getDb().prepare(`
|
|
73
|
+
INSERT OR REPLACE INTO workflow_history
|
|
74
|
+
(user_id, task_description, task_type, commit_message, timestamp, forced, force_reason, dropped, drop_reason)
|
|
75
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
76
|
+
`);
|
|
77
|
+
stmt.run(
|
|
78
|
+
userId,
|
|
79
|
+
entry.taskDescription,
|
|
80
|
+
entry.taskType,
|
|
81
|
+
entry.commitMessage,
|
|
82
|
+
entry.timestamp || new Date().toISOString(),
|
|
83
|
+
entry.forced ? 1 : 0,
|
|
84
|
+
entry.forceReason || null,
|
|
85
|
+
entry.dropped ? 1 : 0,
|
|
86
|
+
entry.dropReason || null
|
|
87
|
+
);
|
|
88
|
+
updateSummaryForUser(userId);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function updateSummaryForUser(userId) {
|
|
92
|
+
const getHistory = getDb().prepare(`
|
|
93
|
+
SELECT task_type, timestamp, task_description
|
|
94
|
+
FROM workflow_history
|
|
95
|
+
WHERE user_id = ?
|
|
96
|
+
ORDER BY timestamp DESC
|
|
97
|
+
LIMIT 20
|
|
98
|
+
`);
|
|
99
|
+
const rows = getHistory.all(userId);
|
|
100
|
+
|
|
101
|
+
const taskTypes = {};
|
|
102
|
+
for (const row of rows) {
|
|
103
|
+
taskTypes[row.task_type] = (taskTypes[row.task_type] || 0) + 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const recentTasks = rows.slice(0, 5).map(r => ({
|
|
107
|
+
description: r.task_description,
|
|
108
|
+
type: r.task_type,
|
|
109
|
+
timestamp: r.timestamp,
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
const lastActive = rows[0]?.timestamp || null;
|
|
113
|
+
|
|
114
|
+
const upsert = getDb().prepare(`
|
|
115
|
+
INSERT OR REPLACE INTO project_summary
|
|
116
|
+
(user_id, total_tasks, task_types, last_active, recent_tasks, updated_at)
|
|
117
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
118
|
+
`);
|
|
119
|
+
upsert.run(
|
|
120
|
+
userId,
|
|
121
|
+
rows.length,
|
|
122
|
+
JSON.stringify(taskTypes),
|
|
123
|
+
lastActive,
|
|
124
|
+
JSON.stringify(recentTasks),
|
|
125
|
+
new Date().toISOString()
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function getSummaryForUser(userId) {
|
|
130
|
+
const stmt = getDb().prepare(`
|
|
131
|
+
SELECT * FROM project_summary WHERE user_id = ?
|
|
132
|
+
`);
|
|
133
|
+
const row = stmt.get(userId);
|
|
134
|
+
if (!row) return null;
|
|
135
|
+
return {
|
|
136
|
+
totalTasks: row.total_tasks,
|
|
137
|
+
taskTypes: JSON.parse(row.task_types),
|
|
138
|
+
lastActive: row.last_active,
|
|
139
|
+
recentTasks: JSON.parse(row.recent_tasks),
|
|
140
|
+
updatedAt: row.updated_at,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function buildHistoryFilters({ startDate, endDate }) {
|
|
145
|
+
const clauses = [];
|
|
146
|
+
const params = [];
|
|
147
|
+
if (startDate) {
|
|
148
|
+
clauses.push("DATE(timestamp) >= DATE(?)");
|
|
149
|
+
params.push(startDate);
|
|
150
|
+
}
|
|
151
|
+
if (endDate) {
|
|
152
|
+
clauses.push("DATE(timestamp) <= DATE(?)");
|
|
153
|
+
params.push(endDate);
|
|
154
|
+
}
|
|
155
|
+
return { clauses, params };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function getHistoryForUser(userId, options = {}) {
|
|
159
|
+
const { page = 1, pageSize = 20, startDate, endDate } = options;
|
|
160
|
+
const sanitizedPage = Math.max(1, Number.isFinite(Number(page)) ? Math.floor(Number(page)) : 1);
|
|
161
|
+
const sanitizedPageSize = Math.min(100, Math.max(1, Number.isFinite(Number(pageSize)) ? Math.floor(Number(pageSize)) : 20));
|
|
162
|
+
const offset = (sanitizedPage - 1) * sanitizedPageSize;
|
|
163
|
+
|
|
164
|
+
const { clauses, params } = buildHistoryFilters({ startDate, endDate });
|
|
165
|
+
const where = ["user_id = ?", ...clauses].join(" AND ");
|
|
166
|
+
const dbInstance = getDb();
|
|
167
|
+
|
|
168
|
+
const countStmt = dbInstance.prepare(`SELECT COUNT(*) as total FROM workflow_history WHERE ${where}`);
|
|
169
|
+
const total = countStmt.get(userId, ...params).total;
|
|
170
|
+
|
|
171
|
+
const rowsStmt = dbInstance.prepare(`
|
|
172
|
+
SELECT *
|
|
173
|
+
FROM workflow_history
|
|
174
|
+
WHERE ${where}
|
|
175
|
+
ORDER BY timestamp DESC
|
|
176
|
+
LIMIT ?
|
|
177
|
+
OFFSET ?
|
|
178
|
+
`);
|
|
179
|
+
const entries = rowsStmt.all(userId, ...params, sanitizedPageSize, offset);
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
entries,
|
|
183
|
+
total,
|
|
184
|
+
page: sanitizedPage,
|
|
185
|
+
pageSize: sanitizedPageSize,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function getHistorySummary(userId, options = {}) {
|
|
190
|
+
const { startDate, endDate, frequency = "daily" } = options;
|
|
191
|
+
const format = FREQUENCY_FORMATS[frequency] || FREQUENCY_FORMATS.daily;
|
|
192
|
+
const { clauses, params } = buildHistoryFilters({ startDate, endDate });
|
|
193
|
+
const where = ["user_id = ?", ...clauses].join(" AND ");
|
|
194
|
+
const stmt = getDb().prepare(`
|
|
195
|
+
SELECT strftime('${format}', timestamp) AS period, COUNT(*) AS count
|
|
196
|
+
FROM workflow_history
|
|
197
|
+
WHERE ${where}
|
|
198
|
+
GROUP BY period
|
|
199
|
+
ORDER BY period DESC
|
|
200
|
+
`);
|
|
201
|
+
return stmt
|
|
202
|
+
.all(userId, ...params)
|
|
203
|
+
.map((row) => ({ period: row.period, count: row.count }));
|
|
204
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Product Requirements Document (PRD)
|
|
2
|
+
|
|
3
|
+
## 1. Overview
|
|
4
|
+
- **Product**: Development Workflow MCP Server
|
|
5
|
+
- **Prepared by**: Cascade (AI assistant)
|
|
6
|
+
- **Date**: 2025-10-31
|
|
7
|
+
- **Status**: Draft v0.1
|
|
8
|
+
|
|
9
|
+
## 2. Problem Statement
|
|
10
|
+
Developers need structured guidance to maintain disciplined workflows across projects. Existing tooling lacks enforcement of sequential best practices (testing, documentation, release hygiene) and offers limited visibility into historical task execution.
|
|
11
|
+
|
|
12
|
+
## 3. Goals & Objectives
|
|
13
|
+
1. Enforce a consistent, auditable development workflow across teams.
|
|
14
|
+
2. Provide actionable guidance for each workflow phase within IDE-integrated environments.
|
|
15
|
+
3. Maintain per-project, per-user workflow state while supporting shared infrastructure (e.g., SQLite summaries, dashboard).
|
|
16
|
+
|
|
17
|
+
## 4. Non-Goals
|
|
18
|
+
- Replacing full-featured project management tools.
|
|
19
|
+
- Implementing source control hosting or CI/CD pipelines.
|
|
20
|
+
- Providing opinionated task estimation or prioritization features.
|
|
21
|
+
|
|
22
|
+
## 5. Target Users & Personas
|
|
23
|
+
- **Individual developers** seeking workflow discipline.
|
|
24
|
+
- **Team leads** requiring enforced process compliance.
|
|
25
|
+
- **Tool integrators** embedding MCP capabilities into IDEs or agents.
|
|
26
|
+
|
|
27
|
+
## 6. User Stories
|
|
28
|
+
1. As a developer, I want to be guided through the workflow steps so I can avoid skipping critical tasks.
|
|
29
|
+
2. As a team lead, I want an auditable history of workflow completion so I can ensure compliance.
|
|
30
|
+
3. As an integrator, I want a simple API (tools/prompts) so I can plug the MCP server into existing agent workflows.
|
|
31
|
+
|
|
32
|
+
## 7. Functional Requirements
|
|
33
|
+
- Provide MCP tools covering the full workflow lifecycle (start task, fix, test, document, commit, release, complete).
|
|
34
|
+
- Persist workflow state per project and per user, with compatibility handling for legacy locations.
|
|
35
|
+
- Offer aggregated project summaries (JSON artifacts, SQLite sync, optional web dashboard).
|
|
36
|
+
- Guard release commands to ensure prerequisites are satisfied.
|
|
37
|
+
- Support `run_full_workflow` for scripted execution of all steps with validation.
|
|
38
|
+
|
|
39
|
+
## 8. Technical Considerations
|
|
40
|
+
- Node.js (ESM) codebase leveraging `@modelcontextprotocol/sdk`.
|
|
41
|
+
- File-based state stored under `.state/users/<user>/workflow-state.json` with compatibility symlinks.
|
|
42
|
+
- Optional SQLite integration for history and summary caching.
|
|
43
|
+
- Vite build pipeline for distribution bundle; source usage recommended for MCP.
|
|
44
|
+
- Windows compatibility requirements (Python, Build Tools for native modules).
|
|
45
|
+
|
|
46
|
+
## 9. Success Metrics
|
|
47
|
+
- โฅ90% of workflow operations executed via MCP tools (vs. manual overrides).
|
|
48
|
+
- Reduction in release guard violations to <5% of attempts.
|
|
49
|
+
- Positive qualitative feedback on guidance clarity from pilot teams.
|
|
50
|
+
|
|
51
|
+
## 10. Milestones
|
|
52
|
+
1. **MVP**: Core workflow tools, state persistence, basic history (complete).
|
|
53
|
+
2. **Enhancements**: Improved project root detection, compatibility mirrors, `run_full_workflow` automation (in progress).
|
|
54
|
+
3. **Future**: Expanded dashboard analytics, customizable workflows, richer integrations.
|
|
55
|
+
|
|
56
|
+
## 11. Risks & Mitigations
|
|
57
|
+
- **Risk**: Workflow feels overly prescriptive. **Mitigation**: Provide escape hatches (`force_complete_task`, `drop_task`) with audit trails.
|
|
58
|
+
- **Risk**: State corruption due to concurrent access. **Mitigation**: File locking and defensive JSON parsing (existing code handles gracefully, but monitor).
|
|
59
|
+
- **Risk**: Integration friction with IDE clients. **Mitigation**: Maintain detailed README instructions and example configurations.
|
|
60
|
+
|
|
61
|
+
## 12. Open Questions
|
|
62
|
+
- Should additional workflow phases (e.g., design review) be supported?
|
|
63
|
+
- How should multi-branch workflows be represented in history summaries?
|
|
64
|
+
- What telemetry or analytics are acceptable within privacy constraints?
|