@theglitchking/persistent-planning 1.0.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/.claude/commands/start-planning.md +65 -0
- package/.claude/settings.local.json +13 -0
- package/.claude-plugin/plugin.json +21 -0
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/README.md +195 -0
- package/bin/persistent-planning.js +241 -0
- package/docs/examples.md +221 -0
- package/docs/reference.md +110 -0
- package/package.json +55 -0
- package/postinstall.js +34 -0
- package/scripts/init-planning.sh +233 -0
- package/skills/SKILL.md +267 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: start-planning
|
|
3
|
+
description: "Initialize persistent planning structure for a task. Creates .planning/[task-slug]/ with task_plan.md and notes.md for on-disk working memory that persists across sessions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /start-planning
|
|
7
|
+
|
|
8
|
+
Initialize the persistent planning structure for a task.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/start-planning "Your task name here"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
/start-planning "Refactor authentication system"
|
|
22
|
+
/start-planning "Build REST API with JWT"
|
|
23
|
+
/start-planning "Fix memory leak in worker process"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## What To Do
|
|
29
|
+
|
|
30
|
+
When the user runs `/start-planning "Task Name"`:
|
|
31
|
+
|
|
32
|
+
1. Run the init script:
|
|
33
|
+
```bash
|
|
34
|
+
bash "$(dirname "$(readlink -f "$0")")/../scripts/init-planning.sh" "Task Name"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If the script is not found at that path, try these fallbacks in order:
|
|
38
|
+
```bash
|
|
39
|
+
bash scripts/init-planning.sh "Task Name"
|
|
40
|
+
bash ~/.claude/skills/persistent-planning/scripts/init-planning.sh "Task Name"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. After the script completes, remind the user:
|
|
44
|
+
- Edit `.planning/[task-slug]/task_plan.md` to define phases
|
|
45
|
+
- Update the Status section as they work
|
|
46
|
+
- Save findings to `.planning/[task-slug]/notes.md`
|
|
47
|
+
- Re-read `task_plan.md` before major decisions
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## What It Creates
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
.planning/
|
|
55
|
+
└── [task-slug]/
|
|
56
|
+
├── task_plan.md # Track phases and progress
|
|
57
|
+
└── notes.md # Store research and findings
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Task Slug Conversion
|
|
61
|
+
|
|
62
|
+
Task names are converted to URL-friendly slugs:
|
|
63
|
+
- "Refactor Authentication" -> `refactor-authentication`
|
|
64
|
+
- "Build REST API" -> `build-rest-api`
|
|
65
|
+
- "Fix Bug #123" -> `fix-bug-123`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "persistent-planning",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Persistent markdown-based planning with task directories, progress tracking, and context engineering for multi-step Claude Code workflows",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "TheGlitchKing"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/TheGlitchKing/persistent-planning",
|
|
10
|
+
"repository": "https://github.com/TheGlitchKing/persistent-planning.git",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"planning",
|
|
13
|
+
"persistent",
|
|
14
|
+
"markdown",
|
|
15
|
+
"context-engineering",
|
|
16
|
+
"task-tracking",
|
|
17
|
+
"working-memory",
|
|
18
|
+
"goal-tracking",
|
|
19
|
+
"manus"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2026-02-12
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Core skill definition (`skills/SKILL.md`) with persistent markdown-based planning
|
|
9
|
+
- `/start-planning` slash command for one-command setup
|
|
10
|
+
- `init-planning.sh` script for automated `.planning/` directory creation
|
|
11
|
+
- Task-specific subdirectories (`.planning/[task-slug]/`)
|
|
12
|
+
- `task_plan.md` and `notes.md` templates
|
|
13
|
+
- Multiple concurrent task support
|
|
14
|
+
- Reference documentation on Manus context engineering principles
|
|
15
|
+
- Worked examples for research, bug fix, and feature development workflows
|
|
16
|
+
- `install.sh` installer with user/project scope support
|
|
17
|
+
- `uninstall.sh` for clean removal
|
|
18
|
+
- Plugin manifest files for marketplace compatibility
|
|
19
|
+
|
|
20
|
+
### Based On
|
|
21
|
+
- Context engineering principles from [Manus AI](https://manus.im/de/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus)
|
|
22
|
+
- Original [planning-with-files](https://github.com/OthmanAdi/planning-with-files) skill by Ahmad Othman Ammar Adi
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TheGlitchKing
|
|
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,195 @@
|
|
|
1
|
+
# Persistent Planning
|
|
2
|
+
|
|
3
|
+
> Persistent markdown-based planning for Claude Code -- the context engineering pattern pioneered by Manus AI.
|
|
4
|
+
|
|
5
|
+
A Claude Code plugin that uses on-disk markdown files as "working memory" for planning, progress tracking, and knowledge storage. Plans persist across sessions and support multiple concurrent tasks.
|
|
6
|
+
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://github.com/TheGlitchKing/persistent-planning)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why This Plugin?
|
|
13
|
+
|
|
14
|
+
Claude Code (and most AI agents) suffer from:
|
|
15
|
+
|
|
16
|
+
- **Volatile memory** -- in-memory task tracking disappears on context reset
|
|
17
|
+
- **Goal drift** -- after 50+ tool calls, original goals get forgotten
|
|
18
|
+
- **Hidden errors** -- failures aren't tracked, so the same mistakes repeat
|
|
19
|
+
- **Context stuffing** -- everything crammed into context instead of stored on disk
|
|
20
|
+
|
|
21
|
+
Persistent Planning solves all of these with the same approach that made [Manus AI worth $2 billion](https://manus.im/de/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus): use the filesystem as external memory.
|
|
22
|
+
|
|
23
|
+
## The 3-File Pattern
|
|
24
|
+
|
|
25
|
+
For every complex task, create three files:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
.planning/[task-name]/task_plan.md -> Track phases and progress
|
|
29
|
+
.planning/[task-name]/notes.md -> Store research and findings
|
|
30
|
+
[deliverable].md -> Final output
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### The Loop
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
1. Create task_plan.md with goal and phases
|
|
37
|
+
2. Research -> save to notes.md -> update task_plan.md
|
|
38
|
+
3. Read notes.md -> create deliverable -> update task_plan.md
|
|
39
|
+
4. Deliver final output
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Key insight:** By reading `task_plan.md` before each decision, goals stay in the attention window. This is how Manus handles ~50 tool calls without losing track.
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
### Option 1: NPM (Recommended)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Install globally
|
|
50
|
+
npm install -g @theglitchking/persistent-planning
|
|
51
|
+
persistent-planning install --scope user
|
|
52
|
+
|
|
53
|
+
# Or via npx (no global install)
|
|
54
|
+
npx @theglitchking/persistent-planning install --scope user
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Option 2: Installer Script
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://github.com/TheGlitchKing/persistent-planning.git
|
|
61
|
+
cd persistent-planning
|
|
62
|
+
./install.sh --scope user # Available in all projects
|
|
63
|
+
# OR
|
|
64
|
+
./install.sh --scope project # Current project only
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Option 3: Claude Marketplace
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
/plugin install TheGlitchKing/persistent-planning
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Option 4: Manual Installation
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
mkdir -p ~/.claude/skills
|
|
77
|
+
cp -r persistent-planning/skills/SKILL.md ~/.claude/skills/persistent-planning/SKILL.md
|
|
78
|
+
cp -r persistent-planning/scripts ~/.claude/skills/persistent-planning/scripts
|
|
79
|
+
cp -r persistent-planning/docs ~/.claude/skills/persistent-planning/docs
|
|
80
|
+
cp persistent-planning/.claude/commands/start-planning.md ~/.claude/commands/start-planning.md
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
### Quick Start
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
/start-planning "Your task name here"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This creates:
|
|
92
|
+
```
|
|
93
|
+
.planning/
|
|
94
|
+
└── your-task-name/
|
|
95
|
+
├── task_plan.md # Track phases and progress
|
|
96
|
+
└── notes.md # Store research and findings
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Session Persistence
|
|
100
|
+
|
|
101
|
+
**Session 1:**
|
|
102
|
+
```
|
|
103
|
+
/start-planning "Complex feature"
|
|
104
|
+
[Work, update plans]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Session 2 (next day):**
|
|
108
|
+
```
|
|
109
|
+
Read .planning/complex-feature/task_plan.md <- Plans are still here
|
|
110
|
+
Read .planning/complex-feature/notes.md <- Notes are still here
|
|
111
|
+
[Continue work]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Multiple Concurrent Tasks
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
/start-planning "Refactor authentication"
|
|
118
|
+
-> Creates .planning/refactor-authentication/
|
|
119
|
+
|
|
120
|
+
/start-planning "Fix memory leak"
|
|
121
|
+
-> Creates .planning/fix-memory-leak/
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Each task gets its own directory. No conflicts, no overwrites.
|
|
125
|
+
|
|
126
|
+
## Core Principles
|
|
127
|
+
|
|
128
|
+
| Principle | Implementation |
|
|
129
|
+
|-----------|----------------|
|
|
130
|
+
| Filesystem as memory | Store in files, not context |
|
|
131
|
+
| Attention manipulation | Re-read plan before decisions |
|
|
132
|
+
| Error persistence | Log failures in plan file |
|
|
133
|
+
| Goal tracking | Checkboxes show progress |
|
|
134
|
+
| Append-only context | Never modify history |
|
|
135
|
+
|
|
136
|
+
## When to Use
|
|
137
|
+
|
|
138
|
+
**Use for:**
|
|
139
|
+
- Multi-step tasks (3+ steps)
|
|
140
|
+
- Research tasks
|
|
141
|
+
- Building/creating projects
|
|
142
|
+
- Tasks spanning many tool calls
|
|
143
|
+
|
|
144
|
+
**Skip for:**
|
|
145
|
+
- Simple questions
|
|
146
|
+
- Single-file edits
|
|
147
|
+
- Quick lookups
|
|
148
|
+
|
|
149
|
+
## File Structure
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
persistent-planning/
|
|
153
|
+
├── .claude-plugin/
|
|
154
|
+
│ └── plugin.json # Plugin manifest
|
|
155
|
+
├── .claude/
|
|
156
|
+
│ └── commands/
|
|
157
|
+
│ └── start-planning.md # /start-planning command
|
|
158
|
+
├── skills/
|
|
159
|
+
│ └── SKILL.md # Core skill definition
|
|
160
|
+
├── scripts/
|
|
161
|
+
│ └── init-planning.sh # Automated setup script
|
|
162
|
+
├── docs/
|
|
163
|
+
│ ├── reference.md # Manus context engineering principles
|
|
164
|
+
│ └── examples.md # Worked examples
|
|
165
|
+
├── install.sh # Plugin installer
|
|
166
|
+
├── uninstall.sh # Plugin uninstaller
|
|
167
|
+
├── plugin.json # Root plugin metadata
|
|
168
|
+
├── README.md # This file
|
|
169
|
+
├── LICENSE # MIT license
|
|
170
|
+
└── CHANGELOG.md # Version history
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Cleanup
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Remove a single task's planning files
|
|
177
|
+
rm -rf .planning/[task-name]/
|
|
178
|
+
|
|
179
|
+
# Remove all planning files
|
|
180
|
+
rm -rf .planning/
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Acknowledgments
|
|
184
|
+
|
|
185
|
+
- **Manus AI** -- for pioneering context engineering patterns
|
|
186
|
+
- **Ahmad Othman Ammar Adi** ([OthmanAdi](https://github.com/OthmanAdi)) -- for the original [planning-with-files](https://github.com/OthmanAdi/planning-with-files) skill
|
|
187
|
+
- **Anthropic** -- for Claude Code and the skills framework
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT License -- see [LICENSE](./LICENSE)
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
**Author:** [TheGlitchKing](https://github.com/TheGlitchKing)
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const PLUGIN_ROOT = path.join(__dirname, '..');
|
|
7
|
+
|
|
8
|
+
const colors = {
|
|
9
|
+
reset: '\x1b[0m',
|
|
10
|
+
green: '\x1b[32m',
|
|
11
|
+
blue: '\x1b[34m',
|
|
12
|
+
yellow: '\x1b[33m',
|
|
13
|
+
red: '\x1b[31m',
|
|
14
|
+
cyan: '\x1b[36m'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function showHelp() {
|
|
18
|
+
console.log(`
|
|
19
|
+
${colors.blue}persistent-planning CLI${colors.reset}
|
|
20
|
+
|
|
21
|
+
${colors.green}Usage:${colors.reset}
|
|
22
|
+
persistent-planning install [--scope user|project]
|
|
23
|
+
persistent-planning uninstall [--scope user|project]
|
|
24
|
+
persistent-planning status
|
|
25
|
+
persistent-planning help
|
|
26
|
+
|
|
27
|
+
${colors.green}Commands:${colors.reset}
|
|
28
|
+
install Install persistent-planning skill and /start-planning command
|
|
29
|
+
uninstall Remove persistent-planning from Claude Code
|
|
30
|
+
status Show installation status
|
|
31
|
+
help Show this help message
|
|
32
|
+
|
|
33
|
+
${colors.green}Install Options:${colors.reset}
|
|
34
|
+
--scope {user|project} Install scope (default: user)
|
|
35
|
+
user - Install globally (~/.claude/)
|
|
36
|
+
project - Install in current project (.claude/)
|
|
37
|
+
|
|
38
|
+
${colors.green}Examples:${colors.reset}
|
|
39
|
+
persistent-planning install --scope user
|
|
40
|
+
persistent-planning install --scope project
|
|
41
|
+
persistent-planning uninstall --scope user
|
|
42
|
+
persistent-planning status
|
|
43
|
+
|
|
44
|
+
${colors.green}After Installation:${colors.reset}
|
|
45
|
+
Run this command in Claude Code:
|
|
46
|
+
/start-planning "Your task name"
|
|
47
|
+
`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function copyRecursive(src, dest) {
|
|
51
|
+
const stats = fs.statSync(src);
|
|
52
|
+
if (stats.isDirectory()) {
|
|
53
|
+
if (!fs.existsSync(dest)) {
|
|
54
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
fs.readdirSync(src).forEach(file => {
|
|
57
|
+
copyRecursive(path.join(src, file), path.join(dest, file));
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
fs.copyFileSync(src, dest);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getInstallDir(scope) {
|
|
65
|
+
return scope === 'user'
|
|
66
|
+
? path.join(process.env.HOME || process.env.USERPROFILE, '.claude')
|
|
67
|
+
: '.claude';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function checkInstallation(scope) {
|
|
71
|
+
const installDir = getInstallDir(scope);
|
|
72
|
+
const skillPath = path.join(installDir, 'skills', 'persistent-planning', 'SKILL.md');
|
|
73
|
+
const commandPath = path.join(installDir, 'commands', 'start-planning.md');
|
|
74
|
+
return {
|
|
75
|
+
skill: fs.existsSync(skillPath),
|
|
76
|
+
command: fs.existsSync(commandPath)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function showStatus() {
|
|
81
|
+
console.log(`\n${colors.blue}persistent-planning Installation Status${colors.reset}\n`);
|
|
82
|
+
|
|
83
|
+
const userInstall = checkInstallation('user');
|
|
84
|
+
const projectInstall = checkInstallation('project');
|
|
85
|
+
|
|
86
|
+
console.log(`User Scope (~/.claude/):`);
|
|
87
|
+
console.log(` Skill: ${userInstall.skill ? colors.green + 'Installed' : colors.yellow + 'Not installed'}${colors.reset}`);
|
|
88
|
+
console.log(` Command: ${userInstall.command ? colors.green + 'Installed' : colors.yellow + 'Not installed'}${colors.reset}`);
|
|
89
|
+
|
|
90
|
+
console.log(`\nProject Scope (./.claude/):`);
|
|
91
|
+
console.log(` Skill: ${projectInstall.skill ? colors.green + 'Installed' : colors.yellow + 'Not installed'}${colors.reset}`);
|
|
92
|
+
console.log(` Command: ${projectInstall.command ? colors.green + 'Installed' : colors.yellow + 'Not installed'}${colors.reset}`);
|
|
93
|
+
|
|
94
|
+
if (!userInstall.skill && !projectInstall.skill) {
|
|
95
|
+
console.log(`\n${colors.yellow}Run: persistent-planning install${colors.reset}`);
|
|
96
|
+
}
|
|
97
|
+
console.log();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function runInstall(args) {
|
|
101
|
+
const scope = args.includes('--scope') ? args[args.indexOf('--scope') + 1] : 'user';
|
|
102
|
+
const installDir = getInstallDir(scope);
|
|
103
|
+
|
|
104
|
+
console.log(`${colors.blue}Installing persistent-planning...${colors.reset}`);
|
|
105
|
+
console.log(` Scope: ${scope} (${installDir})\n`);
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
// Create directories
|
|
109
|
+
const skillDir = path.join(installDir, 'skills', 'persistent-planning');
|
|
110
|
+
const scriptsDir = path.join(skillDir, 'scripts');
|
|
111
|
+
const docsDir = path.join(skillDir, 'docs');
|
|
112
|
+
const commandsDir = path.join(installDir, 'commands');
|
|
113
|
+
|
|
114
|
+
fs.mkdirSync(scriptsDir, { recursive: true });
|
|
115
|
+
fs.mkdirSync(docsDir, { recursive: true });
|
|
116
|
+
fs.mkdirSync(commandsDir, { recursive: true });
|
|
117
|
+
|
|
118
|
+
// Copy skill
|
|
119
|
+
fs.copyFileSync(
|
|
120
|
+
path.join(PLUGIN_ROOT, 'skills', 'SKILL.md'),
|
|
121
|
+
path.join(skillDir, 'SKILL.md')
|
|
122
|
+
);
|
|
123
|
+
console.log(`${colors.green}+${colors.reset} Installed SKILL.md`);
|
|
124
|
+
|
|
125
|
+
// Copy init script
|
|
126
|
+
const initScript = path.join(scriptsDir, 'init-planning.sh');
|
|
127
|
+
fs.copyFileSync(
|
|
128
|
+
path.join(PLUGIN_ROOT, 'scripts', 'init-planning.sh'),
|
|
129
|
+
initScript
|
|
130
|
+
);
|
|
131
|
+
fs.chmodSync(initScript, 0o755);
|
|
132
|
+
console.log(`${colors.green}+${colors.reset} Installed init-planning.sh`);
|
|
133
|
+
|
|
134
|
+
// Copy docs
|
|
135
|
+
fs.copyFileSync(
|
|
136
|
+
path.join(PLUGIN_ROOT, 'docs', 'reference.md'),
|
|
137
|
+
path.join(docsDir, 'reference.md')
|
|
138
|
+
);
|
|
139
|
+
fs.copyFileSync(
|
|
140
|
+
path.join(PLUGIN_ROOT, 'docs', 'examples.md'),
|
|
141
|
+
path.join(docsDir, 'examples.md')
|
|
142
|
+
);
|
|
143
|
+
console.log(`${colors.green}+${colors.reset} Installed reference docs`);
|
|
144
|
+
|
|
145
|
+
// Copy command
|
|
146
|
+
fs.copyFileSync(
|
|
147
|
+
path.join(PLUGIN_ROOT, '.claude', 'commands', 'start-planning.md'),
|
|
148
|
+
path.join(commandsDir, 'start-planning.md')
|
|
149
|
+
);
|
|
150
|
+
console.log(`${colors.green}+${colors.reset} Installed /start-planning command`);
|
|
151
|
+
|
|
152
|
+
// Update .gitignore if project scope
|
|
153
|
+
if (scope === 'project') {
|
|
154
|
+
const gitignorePath = '.gitignore';
|
|
155
|
+
if (fs.existsSync(gitignorePath)) {
|
|
156
|
+
const content = fs.readFileSync(gitignorePath, 'utf8');
|
|
157
|
+
if (!content.includes('.claude/')) {
|
|
158
|
+
fs.appendFileSync(gitignorePath, '\n.claude/\n');
|
|
159
|
+
console.log(`${colors.green}+${colors.reset} Updated .gitignore`);
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
fs.writeFileSync(gitignorePath, '.claude/\n');
|
|
163
|
+
console.log(`${colors.green}+${colors.reset} Created .gitignore`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
console.log(`\n${colors.green}Installation Complete!${colors.reset}\n`);
|
|
168
|
+
console.log(`${colors.yellow}Usage:${colors.reset}`);
|
|
169
|
+
console.log(` In Claude Code, run: ${colors.cyan}/start-planning "Your task name"${colors.reset}\n`);
|
|
170
|
+
console.log(`${colors.yellow}Uninstall:${colors.reset}`);
|
|
171
|
+
console.log(` ${colors.cyan}persistent-planning uninstall --scope ${scope}${colors.reset}\n`);
|
|
172
|
+
|
|
173
|
+
} catch (error) {
|
|
174
|
+
console.error(`${colors.red}Installation failed: ${error.message}${colors.reset}`);
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function runUninstall(args) {
|
|
180
|
+
const scope = args.includes('--scope') ? args[args.indexOf('--scope') + 1] : 'user';
|
|
181
|
+
const installDir = getInstallDir(scope);
|
|
182
|
+
|
|
183
|
+
console.log(`${colors.blue}Uninstalling persistent-planning...${colors.reset}`);
|
|
184
|
+
console.log(` Scope: ${scope} (${installDir})\n`);
|
|
185
|
+
|
|
186
|
+
let removed = 0;
|
|
187
|
+
|
|
188
|
+
try {
|
|
189
|
+
const skillDir = path.join(installDir, 'skills', 'persistent-planning');
|
|
190
|
+
if (fs.existsSync(skillDir)) {
|
|
191
|
+
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
192
|
+
console.log(`${colors.green}+${colors.reset} Removed skill`);
|
|
193
|
+
removed++;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const commandFile = path.join(installDir, 'commands', 'start-planning.md');
|
|
197
|
+
if (fs.existsSync(commandFile)) {
|
|
198
|
+
fs.unlinkSync(commandFile);
|
|
199
|
+
console.log(`${colors.green}+${colors.reset} Removed /start-planning command`);
|
|
200
|
+
removed++;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (removed === 0) {
|
|
204
|
+
console.log(`${colors.yellow}Nothing to remove. persistent-planning not found in ${installDir}/${colors.reset}`);
|
|
205
|
+
} else {
|
|
206
|
+
console.log(`\n${colors.green}Uninstall complete.${colors.reset}`);
|
|
207
|
+
console.log(`\nNote: .planning/ directories in your projects are not removed.`);
|
|
208
|
+
console.log(`To clean those up: rm -rf .planning/\n`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.error(`${colors.red}Uninstallation failed: ${error.message}${colors.reset}`);
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Main
|
|
218
|
+
const args = process.argv.slice(2);
|
|
219
|
+
const command = args[0];
|
|
220
|
+
|
|
221
|
+
switch (command) {
|
|
222
|
+
case 'install':
|
|
223
|
+
runInstall(args.slice(1));
|
|
224
|
+
break;
|
|
225
|
+
case 'uninstall':
|
|
226
|
+
runUninstall(args.slice(1));
|
|
227
|
+
break;
|
|
228
|
+
case 'status':
|
|
229
|
+
showStatus();
|
|
230
|
+
break;
|
|
231
|
+
case 'help':
|
|
232
|
+
case '--help':
|
|
233
|
+
case '-h':
|
|
234
|
+
case undefined:
|
|
235
|
+
showHelp();
|
|
236
|
+
break;
|
|
237
|
+
default:
|
|
238
|
+
console.error(`${colors.red}Unknown command: ${command}${colors.reset}`);
|
|
239
|
+
console.log(`Run 'persistent-planning help' for usage information`);
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|