cc-discipline 2.8.0 → 2.9.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/bin/cli.js +145 -0
- package/package.json +2 -2
- package/templates/.claude/skills/investigate/SKILL.md +55 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// cc-discipline CLI entry point (cross-platform)
|
|
3
|
+
// Detects platform and spawns bash with correct paths
|
|
4
|
+
|
|
5
|
+
const { execSync, spawnSync } = require('child_process');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
|
|
9
|
+
const PKG_DIR = path.resolve(__dirname, '..');
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
// Find bash executable
|
|
13
|
+
function findBash() {
|
|
14
|
+
// Unix: bash is always available
|
|
15
|
+
if (process.platform !== 'win32') return 'bash';
|
|
16
|
+
|
|
17
|
+
// Windows: try common Git Bash locations
|
|
18
|
+
const candidates = [
|
|
19
|
+
'C:\\Program Files\\Git\\bin\\bash.exe',
|
|
20
|
+
'C:\\Program Files (x86)\\Git\\bin\\bash.exe',
|
|
21
|
+
process.env.PROGRAMFILES + '\\Git\\bin\\bash.exe',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
for (const candidate of candidates) {
|
|
25
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Try PATH
|
|
29
|
+
try {
|
|
30
|
+
execSync('bash --version', { stdio: 'ignore' });
|
|
31
|
+
return 'bash';
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error('Error: bash not found. Please install Git for Windows (https://git-scm.com/download/win)');
|
|
34
|
+
console.error('Git Bash is required to run cc-discipline on Windows.');
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const bash = findBash();
|
|
40
|
+
|
|
41
|
+
// Convert Windows path to Unix-style for bash
|
|
42
|
+
function toUnixPath(p) {
|
|
43
|
+
if (process.platform !== 'win32') return p;
|
|
44
|
+
// C:\Users\foo → /c/Users/foo
|
|
45
|
+
return p.replace(/\\/g, '/').replace(/^([A-Za-z]):/, (_, drive) => '/' + drive.toLowerCase());
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Route subcommands
|
|
49
|
+
const command = args[0] || 'init';
|
|
50
|
+
const restArgs = args.slice(1);
|
|
51
|
+
|
|
52
|
+
let script;
|
|
53
|
+
let scriptArgs;
|
|
54
|
+
|
|
55
|
+
switch (command) {
|
|
56
|
+
case 'init':
|
|
57
|
+
script = path.join(PKG_DIR, 'init.sh');
|
|
58
|
+
scriptArgs = restArgs;
|
|
59
|
+
break;
|
|
60
|
+
case 'upgrade':
|
|
61
|
+
script = path.join(PKG_DIR, 'init.sh');
|
|
62
|
+
scriptArgs = ['--auto', ...restArgs];
|
|
63
|
+
break;
|
|
64
|
+
case 'status':
|
|
65
|
+
script = path.join(PKG_DIR, 'lib', 'status.sh');
|
|
66
|
+
scriptArgs = [];
|
|
67
|
+
break;
|
|
68
|
+
case 'doctor':
|
|
69
|
+
script = path.join(PKG_DIR, 'lib', 'doctor.sh');
|
|
70
|
+
scriptArgs = [];
|
|
71
|
+
break;
|
|
72
|
+
case 'add-stack':
|
|
73
|
+
if (restArgs.length === 0) {
|
|
74
|
+
console.log('Usage: cc-discipline add-stack <numbers>');
|
|
75
|
+
console.log(' e.g.: cc-discipline add-stack 3 4');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
script = path.join(PKG_DIR, 'init.sh');
|
|
79
|
+
scriptArgs = ['--stack', restArgs.join(' '), '--no-global'];
|
|
80
|
+
break;
|
|
81
|
+
case 'remove-stack':
|
|
82
|
+
script = path.join(PKG_DIR, 'lib', 'stack-remove.sh');
|
|
83
|
+
scriptArgs = restArgs;
|
|
84
|
+
break;
|
|
85
|
+
case '-v':
|
|
86
|
+
case '--version':
|
|
87
|
+
case 'version':
|
|
88
|
+
const pkg = require(path.join(PKG_DIR, 'package.json'));
|
|
89
|
+
console.log(`cc-discipline v${pkg.version}`);
|
|
90
|
+
process.exit(0);
|
|
91
|
+
case '-h':
|
|
92
|
+
case '--help':
|
|
93
|
+
case 'help':
|
|
94
|
+
const ver = require(path.join(PKG_DIR, 'package.json')).version;
|
|
95
|
+
console.log(`cc-discipline v${ver} — Discipline framework for Claude Code
|
|
96
|
+
|
|
97
|
+
Usage: cc-discipline <command> [options]
|
|
98
|
+
|
|
99
|
+
Commands:
|
|
100
|
+
init [options] Install discipline into current project (default)
|
|
101
|
+
upgrade Upgrade rules/hooks (shortcut for init --auto)
|
|
102
|
+
add-stack <numbers> Add stack rules (e.g., add-stack 3 4)
|
|
103
|
+
remove-stack <numbers> Remove stack rules
|
|
104
|
+
status Show installed version, stacks, and hooks
|
|
105
|
+
doctor Check installation integrity
|
|
106
|
+
version Show version
|
|
107
|
+
|
|
108
|
+
Init options:
|
|
109
|
+
--auto Non-interactive with defaults
|
|
110
|
+
--stack <choices> Stack selection: 1-7, space-separated
|
|
111
|
+
--name <name> Project name (default: directory name)
|
|
112
|
+
--global Install global rules to ~/.claude/CLAUDE.md
|
|
113
|
+
--no-global Skip global rules install
|
|
114
|
+
|
|
115
|
+
Stacks:
|
|
116
|
+
1=RTL 2=Embedded 3=Python 4=JS/TS 5=Mobile 6=Fullstack 7=General
|
|
117
|
+
|
|
118
|
+
Examples:
|
|
119
|
+
npx cc-discipline # Interactive setup
|
|
120
|
+
npx cc-discipline init --auto # Non-interactive defaults
|
|
121
|
+
npx cc-discipline init --auto --stack "3 4" # Python + JS/TS
|
|
122
|
+
npx cc-discipline upgrade # Upgrade to latest
|
|
123
|
+
npx cc-discipline status # Check what's installed
|
|
124
|
+
npx cc-discipline doctor # Diagnose issues`);
|
|
125
|
+
process.exit(0);
|
|
126
|
+
default:
|
|
127
|
+
console.error(`Unknown command: ${command}`);
|
|
128
|
+
console.error("Run 'cc-discipline --help' for usage");
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Run the bash script
|
|
133
|
+
const unixScript = toUnixPath(script);
|
|
134
|
+
const env = {
|
|
135
|
+
...process.env,
|
|
136
|
+
CC_DISCIPLINE_PKG_DIR: process.platform === 'win32' ? toUnixPath(PKG_DIR) : PKG_DIR,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const result = spawnSync(bash, [unixScript, ...scriptArgs], {
|
|
140
|
+
stdio: 'inherit',
|
|
141
|
+
env,
|
|
142
|
+
cwd: process.cwd(),
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
process.exit(result.status || 0);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-discipline",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Discipline framework for Claude Code — rules, hooks, and agents that keep AI on track",
|
|
5
5
|
"bin": {
|
|
6
|
-
"cc-discipline": "bin/cli.
|
|
6
|
+
"cc-discipline": "bin/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"bin/",
|
|
@@ -9,6 +9,7 @@ Determine which mode based on user input:
|
|
|
9
9
|
|
|
10
10
|
- **Research mode** — User gives a topic/question with no existing proposal. Goal: build comprehensive understanding before forming an opinion.
|
|
11
11
|
- **Review mode** — User gives an existing document, proposal, or design. Goal: stress-test it from multiple angles, find blind spots and weaknesses.
|
|
12
|
+
- **Simulate mode** — User gives a plan and wants to "dry run" it. Goal: walk through execution step by step, let hidden problems surface naturally.
|
|
12
13
|
|
|
13
14
|
State which mode you're using and why.
|
|
14
15
|
|
|
@@ -126,6 +127,59 @@ Don't just tear it apart. For each issue found, suggest what would fix it.
|
|
|
126
127
|
|
|
127
128
|
---
|
|
128
129
|
|
|
130
|
+
# Simulate Mode
|
|
131
|
+
|
|
132
|
+
You have a plan or proposal. Instead of analyzing it on paper, **walk through it as if you're actually executing it**, step by step. Let problems surface naturally.
|
|
133
|
+
|
|
134
|
+
## Step 1: Extract execution steps
|
|
135
|
+
|
|
136
|
+
Read the plan and break it into concrete sequential steps. For each step, identify:
|
|
137
|
+
- What it requires (inputs, resources, preconditions)
|
|
138
|
+
- What it produces (outputs, state changes)
|
|
139
|
+
- What it assumes
|
|
140
|
+
|
|
141
|
+
Present the steps and confirm with the user: "Is this the execution sequence?"
|
|
142
|
+
|
|
143
|
+
## Step 2: Assign simulation agents
|
|
144
|
+
|
|
145
|
+
Spawn one agent per phase or critical step. Each agent:
|
|
146
|
+
- **Actually attempts to execute** (or traces through execution) of their assigned step
|
|
147
|
+
- Works with real files, real code, real environment where possible
|
|
148
|
+
- If can't actually execute (e.g., deployment plan), does a detailed walkthrough: "At this point I would need X, but looking at the current state, X is not available because..."
|
|
149
|
+
- Reports for each step:
|
|
150
|
+
- **Went as planned** — step worked / would work as described
|
|
151
|
+
- **Missing precondition** — "Step 3 assumes X exists, but step 2 doesn't create it"
|
|
152
|
+
- **Harder than expected** — "This was described as 'configure Y' but actually requires Z, which takes much longer"
|
|
153
|
+
- **Hidden dependency** — "This step silently depends on A, which the plan doesn't mention"
|
|
154
|
+
- **Order problem** — "This needs to happen before step N, not after"
|
|
155
|
+
- **Ambiguity** — "The plan says 'set up the database' but doesn't specify which schema, migration, or seed data"
|
|
156
|
+
|
|
157
|
+
## Step 3: Compile discoveries
|
|
158
|
+
|
|
159
|
+
After all agents return, compile a simulation report:
|
|
160
|
+
|
|
161
|
+
### Execution timeline
|
|
162
|
+
Show the steps as actually executed (vs. as planned). Highlight where reality diverged from plan.
|
|
163
|
+
|
|
164
|
+
### Issues discovered
|
|
165
|
+
For each issue:
|
|
166
|
+
- **Severity**: blocker / significant / minor
|
|
167
|
+
- **When discovered**: which step
|
|
168
|
+
- **Root cause**: why the plan missed this
|
|
169
|
+
- **Fix**: specific change to the plan
|
|
170
|
+
|
|
171
|
+
### Missing steps
|
|
172
|
+
Steps that the plan didn't include but simulation revealed are necessary.
|
|
173
|
+
|
|
174
|
+
### Revised plan
|
|
175
|
+
Present the original plan with all fixes, missing steps, and reordering applied. Mark what changed and why.
|
|
176
|
+
|
|
177
|
+
## Step 4: Present to user
|
|
178
|
+
|
|
179
|
+
Show the simulation report. Let the user decide which fixes to adopt. The revised plan is a suggestion, not a mandate.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
129
183
|
## When to use this skill
|
|
130
184
|
|
|
131
185
|
- Researching a technology choice or architectural decision
|
|
@@ -133,5 +187,6 @@ Don't just tear it apart. For each issue found, suggest what would fix it.
|
|
|
133
187
|
- Evaluating a migration or major refactor
|
|
134
188
|
- **Reviewing an existing proposal, RFC, design doc, or plan**
|
|
135
189
|
- **Stress-testing your own plan before presenting it to stakeholders**
|
|
190
|
+
- **Simulating execution of a plan before committing to it — technical, engineering, or operational**
|
|
136
191
|
- Any situation where you catch yourself going deep on one angle and ignoring others
|
|
137
192
|
- When the user says "you're being narrow" or "what about X?" — that's a sign you needed this from the start
|