@groeponline/pi-missions 0.2.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/CHANGELOG.md +150 -0
- package/LICENSE +21 -0
- package/README.md +149 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.js +713 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/database/schema.sql +322 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3970 -0
- package/dist/index.js.map +1 -0
- package/package.json +95 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-08-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Release flow: `scripts/release.mjs` (auto bump from conventional commit subjects, CHANGELOG roll, annotated tag), idempotent `scripts/npm-publish.sh`, idempotent `scripts/github-release.sh`, and `.github/workflows/release.yml` that cuts the tag and publishes on merge to main.
|
|
14
|
+
- `npm run verify:package` catalog contract: package identity, discovery keywords, shipped files, npmjs registry, and the pi peer range.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- Publishes to npmjs.org as a public package instead of GitHub Packages, so `pi install npm:@groeponline/pi-missions` works and the pi.dev catalog card resolves.
|
|
18
|
+
- Pi peer ranges widened to `>=0.74.0 <0.85.0`; `^0.74.0` pinned a single 0.x minor and failed installs on pi 0.84.
|
|
19
|
+
- `pi.image` points at the repository banner for the catalog card.
|
|
20
|
+
|
|
21
|
+
## [0.1.3] - 2026-05-29
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Migrated package scope from `@devctx/pi-missions` to `@groeponline/pi-missions`.
|
|
25
|
+
- Added `publishConfig` for GitHub Packages.
|
|
26
|
+
- Updated test count badges: 834 → 892.
|
|
27
|
+
- Added license badge to README.
|
|
28
|
+
- Updated wiki references.
|
|
29
|
+
|
|
30
|
+
## [0.1.2] - 2026-05-29
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Migrated peer dependencies from `@mariozechner/pi-*` to `@earendil-works/pi-*` scope.
|
|
34
|
+
- Optimized hot-path array allocations and iterations in state management.
|
|
35
|
+
- Hardened database initialization with dual driver detection (better-sqlite3 / node:sqlite).
|
|
36
|
+
- Added CI smoke test script for build artifact verification.
|
|
37
|
+
- Improved schema path resolution for ESM and packaged builds.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- SQL injection prevention via column name whitelist validation in update methods.
|
|
41
|
+
- Coverage thresholds adjusted to match current test coverage levels.
|
|
42
|
+
|
|
43
|
+
## [0.1.1] - 2026-05-22
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- Fixed strict TypeScript errors around feature token accounting and test fixtures.
|
|
47
|
+
- Hardened SQLite initialization for ESM and packaged builds.
|
|
48
|
+
- Removed the default native SQLite install path; database loading now uses an optional `better-sqlite3` driver when present or Node.js `node:sqlite` otherwise.
|
|
49
|
+
- Added a real CLI build entry and package `bin` mapping.
|
|
50
|
+
- Copied database schema assets into `dist/` during build.
|
|
51
|
+
- Updated README and CI to match the implemented feature set.
|
|
52
|
+
|
|
53
|
+
## [0.1.0] - 2026-05-19
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
#### Core Features
|
|
58
|
+
- **Long-running missions** across multiple Pi sessions
|
|
59
|
+
- **Durable local state** in `~/.pi/missions/<mission-id>/`
|
|
60
|
+
- **Smart feature queue** (`pending` → `active` → `blocked` → `done`)
|
|
61
|
+
- **Phase-aware tool policy** — read-only bash in planning, full access in execution
|
|
62
|
+
- **Evidence capture** for completed work
|
|
63
|
+
- **Append-only history** (JSONL) for full audit trail
|
|
64
|
+
- **Session handoff** – attach/detach across sessions
|
|
65
|
+
|
|
66
|
+
#### Commands (19 total)
|
|
67
|
+
- `/mission start <goal>` — Create a new mission (alias for `/mission new`)
|
|
68
|
+
- `/mission new <title>` — Create a new mission with planning wizard
|
|
69
|
+
- `/mission list` — List all missions
|
|
70
|
+
- `/mission load <id>` — Load a mission into the current session
|
|
71
|
+
- `/mission status` — Show current status & active feature
|
|
72
|
+
- `/mission dashboard` — Open Mission Control dashboard widget
|
|
73
|
+
- `/mission next` — Advance to the next unblocked feature
|
|
74
|
+
- `/mission done [evidence]` — Mark active feature done + attach evidence
|
|
75
|
+
- `/mission block <reason>` — Block the current feature
|
|
76
|
+
- `/mission pause` / `resume` — Pause or resume the mission
|
|
77
|
+
- `/mission fork <reason>` — Fork active feature into a new session
|
|
78
|
+
- `/mission debug [id]` — Inspect recent history and events
|
|
79
|
+
- `/mission metrics` — Show mission/session metrics
|
|
80
|
+
- `/mission export [filename]` — Export mission to Markdown report
|
|
81
|
+
- `/mission templates` — List and use mission templates
|
|
82
|
+
- `/mission clear` — Detach mission from this session
|
|
83
|
+
- `/mission edit <feature-id>` — Edit a feature
|
|
84
|
+
- `/mission history [feature_id|event|search]` — View mission history
|
|
85
|
+
- `/mission migrate [id]` — Migrate mission schema
|
|
86
|
+
|
|
87
|
+
#### Agent Tools (10 total)
|
|
88
|
+
- `mission_feature_done` — Mark the active feature complete with evidence
|
|
89
|
+
- `mission_next_feature` — Automatically advance to the next pending feature
|
|
90
|
+
- `mission_ask_user` — Ask for clarification when a safe assumption isn't enough
|
|
91
|
+
- `mission_block_self` — Self-block when stuck instead of looping
|
|
92
|
+
- `mission_fork` — Split a risky or parallel approach into a linked fork
|
|
93
|
+
- `mission_error_status` — Inspect error recovery state
|
|
94
|
+
- `mission_retry_error` — Retry a recorded error
|
|
95
|
+
- `mission_spawn_worker` — Spawn a child pi process to work on a feature autonomously
|
|
96
|
+
- `mission_worker_status` — Check running worker process status
|
|
97
|
+
- `mission_kill_worker` — Kill a runaway worker process
|
|
98
|
+
|
|
99
|
+
#### Engines
|
|
100
|
+
- **Autopilot** — Autonomous feature advancement
|
|
101
|
+
- **Completion Detection** — Auto-detects feature completion from agent output
|
|
102
|
+
- **Error Recovery** — Retry/ask_user/block on tool failures
|
|
103
|
+
- **Metrics** — Session metrics collection
|
|
104
|
+
- **Worker** — Child process worker spawning
|
|
105
|
+
|
|
106
|
+
#### UI
|
|
107
|
+
- **Factory Droid Dashboard** — Milestone progress bars, feature hierarchy, acceptance criteria inline
|
|
108
|
+
- **Phase line** — Shows current tool phase in dashboard
|
|
109
|
+
- **Footer status** — `🎯 title [done/total %] — active feature`
|
|
110
|
+
|
|
111
|
+
#### Safety & Reliability
|
|
112
|
+
- **Crash-safe writes** (EXDEV-safe temp + rename)
|
|
113
|
+
- **File locking** — Prevents concurrent modification conflicts
|
|
114
|
+
- **Schema validation** — Ensures data integrity with TypeBox schemas
|
|
115
|
+
- **Structured logging** — Detailed debug logs for troubleshooting
|
|
116
|
+
- **Graceful degradation** — Continues working with degraded functionality when errors occur
|
|
117
|
+
- **Stuck detection** — Auto-blocks features when agent is stuck
|
|
118
|
+
|
|
119
|
+
#### Templates (9 total)
|
|
120
|
+
- `refactor`, `fix-bug`, `add-feature`, `docs`, `investigate`, `auth`, `ci-cd`, `security-audit`, `performance-opt`
|
|
121
|
+
|
|
122
|
+
#### Documentation
|
|
123
|
+
- Comprehensive README with architecture overview
|
|
124
|
+
- Detailed implementation plan (PLAN.md)
|
|
125
|
+
- Documentation plan (DOCUMENTATION_PLAN.md)
|
|
126
|
+
- Improvement tracking (IMPROVEMENTS.md)
|
|
127
|
+
- UI reference (UI_REFERENCE.md)
|
|
128
|
+
|
|
129
|
+
#### Testing
|
|
130
|
+
- 522 unit tests across 19 test files
|
|
131
|
+
- End-to-end test runner script
|
|
132
|
+
- TypeScript type checking
|
|
133
|
+
- Vitest for testing and benchmarking
|
|
134
|
+
|
|
135
|
+
### Changed
|
|
136
|
+
- N/A (initial release)
|
|
137
|
+
|
|
138
|
+
### Deprecated
|
|
139
|
+
- N/A (initial release)
|
|
140
|
+
|
|
141
|
+
### Removed
|
|
142
|
+
- N/A (initial release)
|
|
143
|
+
|
|
144
|
+
### Fixed
|
|
145
|
+
- N/A (initial release)
|
|
146
|
+
|
|
147
|
+
### Security
|
|
148
|
+
- Path traversal protection via `sanitizeMissionId()`
|
|
149
|
+
- Tool whitelist per phase (planning=read-only, execution=write)
|
|
150
|
+
- Budget exhaustion protection via `maxToolCallsPerFeature` and `tokensBudget`
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DevCTX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
# 🚀 @groeponline/pi-missions
|
|
6
|
+
|
|
7
|
+
**Durable mission orchestration + task queues + state handoffs for the Pi coding agent**
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
`pi-missions` turns short-lived Pi sessions into long-running execution tracks. It gives an agent a durable mission plan, feature queue, history log, evidence folder, and session handoff layer so multi-step work can survive restarts, context resets, forks, and interruptions.
|
|
14
|
+
|
|
15
|
+
[](https://www.npmjs.com/package/@groeponline/pi-missions)   
|
|
16
|
+
|
|
17
|
+
## Status
|
|
18
|
+
|
|
19
|
+
This repository is a hardened `0.1.x` release candidate, not a finished marketplace platform. The extension entrypoint, state management, mission commands, tools, analytics dashboard, CLI, database repositories, and tests are wired. Integration classes for GitHub/Slack/webhooks are still lightweight scaffolding and should not be advertised as production integrations yet.
|
|
20
|
+
|
|
21
|
+
Verified in this snapshot:
|
|
22
|
+
|
|
23
|
+
- `npm run check` passes.
|
|
24
|
+
- `npm test` passes: 31 test files, 892 tests.
|
|
25
|
+
- `npm run build` produces `dist/index.js`, `dist/index.d.ts`, `dist/cli/index.js`, and copied database schema assets.
|
|
26
|
+
- `./scripts/smoke-test.sh` confirms the Pi extension exports the default `piMissions` function.
|
|
27
|
+
- `node dist/cli/index.js doctor` works on Node.js 22 using `node:sqlite`.
|
|
28
|
+
|
|
29
|
+
## Requirements
|
|
30
|
+
|
|
31
|
+
- Node.js `>=22.5.0` for the built-in `node:sqlite` database driver.
|
|
32
|
+
- Pi coding agent packages compatible with the peer dependencies in `package.json`.
|
|
33
|
+
- Optional: install `better-sqlite3` manually in the host project if you prefer that native SQLite driver. Pi Missions will use it when available and fall back to `node:sqlite` otherwise.
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Install the extension
|
|
39
|
+
pi install npm:@groeponline/pi-missions
|
|
40
|
+
|
|
41
|
+
# Start a mission
|
|
42
|
+
/mission start "Implement user auth"
|
|
43
|
+
|
|
44
|
+
# Check progress
|
|
45
|
+
/mission status
|
|
46
|
+
|
|
47
|
+
# Mark features done
|
|
48
|
+
/mission done "Login form works, tests pass"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Install and local development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm ci
|
|
55
|
+
npm run check
|
|
56
|
+
npm test
|
|
57
|
+
npm run build
|
|
58
|
+
./scripts/smoke-test.sh
|
|
59
|
+
|
|
60
|
+
# Run locally in Pi after build
|
|
61
|
+
pi -e ./dist/index.js
|
|
62
|
+
|
|
63
|
+
# CLI diagnostics
|
|
64
|
+
node dist/cli/index.js doctor
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Pi slash commands
|
|
68
|
+
|
|
69
|
+
| Command | Description |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `/mission new <title>` / `/mission start <title>` | Create a new mission. |
|
|
72
|
+
| `/mission list` | List saved missions. |
|
|
73
|
+
| `/mission load <id>` | Load a mission into the current session. |
|
|
74
|
+
| `/mission status` | Show current mission status and progress. |
|
|
75
|
+
| `/mission dashboard` | Render the mission dashboard. |
|
|
76
|
+
| `/mission metrics` | Show metrics overview. |
|
|
77
|
+
| `/mission next` | Advance to the next ready feature. |
|
|
78
|
+
| `/mission done [evidence]` | Mark the active feature done with evidence. |
|
|
79
|
+
| `/mission block <reason>` | Block the active feature. |
|
|
80
|
+
| `/mission pause` / `/mission resume` / `/mission stop` | Control mission execution. |
|
|
81
|
+
| `/mission fork <reason>` | Fork the active feature into a separate track. |
|
|
82
|
+
| `/mission templates` | List or use built-in templates. |
|
|
83
|
+
| `/mission history` | Show mission history. |
|
|
84
|
+
| `/mission worker`, `/mission worker-status`, `/mission kill-worker` | Worker controls. |
|
|
85
|
+
| `/mission migrate` | Inspect or migrate old mission state. |
|
|
86
|
+
| `/mission debug` | Inspect debug information. |
|
|
87
|
+
|
|
88
|
+
## Agent tools
|
|
89
|
+
|
|
90
|
+
The extension registers these mission tools for agent workflows:
|
|
91
|
+
|
|
92
|
+
- `mission_feature_done`
|
|
93
|
+
- `mission_next_feature`
|
|
94
|
+
- `mission_ask_user`
|
|
95
|
+
- `mission_block_self`
|
|
96
|
+
- `mission_fork`
|
|
97
|
+
- `mission_error_status`
|
|
98
|
+
- `mission_retry_error`
|
|
99
|
+
- `mission_spawn_worker`
|
|
100
|
+
- `mission_worker_status`
|
|
101
|
+
- `mission_kill_worker`
|
|
102
|
+
|
|
103
|
+
## Architecture
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
src/
|
|
107
|
+
├── core/ # Extension runtime, state, migrations, mission transitions
|
|
108
|
+
├── commands/ # /mission command registration and handlers
|
|
109
|
+
├── tools/ # Agent-facing mission tools
|
|
110
|
+
├── engines/ # Autopilot, completion detection, recovery, metrics, workers
|
|
111
|
+
├── database/ # SQLite schema and repository layer
|
|
112
|
+
├── templates/ # Built-in mission templates
|
|
113
|
+
├── ui/ # Dashboard and terminal UI helpers
|
|
114
|
+
├── utils/ # Filesystem, context, markdown, logging, feedback helpers
|
|
115
|
+
└── cli/ # pi-missions CLI
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Database
|
|
119
|
+
|
|
120
|
+
Pi Missions stores structured data in SQLite. The schema includes missions, milestones, features, acceptance criteria, history, learnings, patterns, predictions, templates, sessions, metrics, plugins, and summary views. The source schema is copied into `dist/database/schema.sql` during build so the packaged CLI can initialize cleanly.
|
|
121
|
+
|
|
122
|
+
## Package notes
|
|
123
|
+
|
|
124
|
+
The original native `better-sqlite3` hard dependency was removed from the default install path because it can fail or hang in restricted environments when prebuilt binaries or Node headers are unavailable. Runtime database loading now tries `better-sqlite3` first if the host has installed it, then falls back to Node.js `node:sqlite`.
|
|
125
|
+
|
|
126
|
+
## State Model
|
|
127
|
+
|
|
128
|
+

|
|
129
|
+
|
|
130
|
+
Mission state is stored locally under `~/.pi/missions/<mission-id>/`:
|
|
131
|
+
- `plan.json`: Current mission plan, feature list, and active pointer.
|
|
132
|
+
- `plan.json.bak`: Backup copy for recovery.
|
|
133
|
+
- `history.jsonl`: Append-style event log for transitions.
|
|
134
|
+
- `evidence/`: Completion proof and artifacts.
|
|
135
|
+
- `sessions/`: Session attachment and handoff metadata.
|
|
136
|
+
|
|
137
|
+
## Typical Workflow
|
|
138
|
+
|
|
139
|
+

|
|
140
|
+
|
|
141
|
+
1. Create a mission with `/mission new <title>`.
|
|
142
|
+
2. Break the mission into features or load an existing plan.
|
|
143
|
+
3. Advance to the next unblocked feature with `/mission next`.
|
|
144
|
+
4. Let the agent work on the current feature.
|
|
145
|
+
5. Capture proof with `/mission done [evidence]`.
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
MIT © OnlineChef
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface CLICommand {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
declare class CLI {
|
|
8
|
+
private commands;
|
|
9
|
+
constructor();
|
|
10
|
+
registerCommand(cmd: CLICommand): void;
|
|
11
|
+
execute(args: string[]): Promise<string>;
|
|
12
|
+
showHelp(): string;
|
|
13
|
+
private registerDefaultCommands;
|
|
14
|
+
}
|
|
15
|
+
declare function createCLI(): CLI;
|
|
16
|
+
|
|
17
|
+
export { CLI, type CLICommand, createCLI };
|