continuous-improvement 3.1.0 → 3.8.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-plugin/marketplace.json +78 -0
- package/CHANGELOG.md +191 -0
- package/LICENSE +21 -21
- package/QUICKSTART.md +101 -81
- package/README.md +207 -359
- package/SKILL.md +87 -9
- package/action.yml +33 -33
- package/bin/analyze.sh +161 -153
- package/bin/backfill.mjs +172 -0
- package/bin/check-docs-substrings.mjs +333 -0
- package/bin/check-everything-mirror.mjs +145 -0
- package/bin/check-routing-targets.mjs +151 -0
- package/bin/check-skill-law-tag.mjs +128 -0
- package/bin/check-skill-mirror.mjs +119 -0
- package/bin/check-skill-tiers.mjs +116 -0
- package/bin/check-third-party-shape.mjs +202 -0
- package/bin/generate-plugin-manifests.mjs +169 -0
- package/bin/harvest-friction.mjs +279 -0
- package/bin/hook-stats.mjs +258 -0
- package/bin/install.mjs +417 -516
- package/bin/lint-transcript.mjs +182 -210
- package/bin/mcp-server.mjs +840 -617
- package/bin/observe.mjs +148 -0
- package/bin/pre-commit-block-strays.sh +49 -0
- package/bin/refresh-third-party.mjs +416 -0
- package/bin/unified-cli.mjs +533 -0
- package/commands/continuous-improvement.md +115 -74
- package/commands/dashboard.md +56 -56
- package/commands/discipline.md +51 -37
- package/commands/harvest.md +76 -0
- package/commands/learn-eval.md +117 -0
- package/commands/planning-with-files.md +66 -0
- package/commands/proceed-with-the-recommendation.md +62 -0
- package/commands/ralph.md +103 -0
- package/commands/release-train.md +81 -0
- package/commands/seven-laws.md +16 -0
- package/commands/superpowers.md +153 -0
- package/commands/swarm.md +101 -0
- package/commands/workspace-surface-audit.md +77 -0
- package/hooks/observe.sh +172 -134
- package/hooks/session.sh +106 -106
- package/hooks/three-section-close.mjs +181 -0
- package/instinct-packs/go.json +58 -58
- package/instinct-packs/meta.json +16 -0
- package/instinct-packs/python.json +58 -58
- package/instinct-packs/react.json +58 -58
- package/lib/cli-anything.mjs +401 -0
- package/lib/compound-engineering.mjs +831 -0
- package/lib/observe-event.mjs +128 -0
- package/lib/plugin-metadata.mjs +432 -0
- package/lib/pm-marketplace.mjs +61 -0
- package/lib/pm-skills.mjs +1274 -0
- package/lib/resolve-home-dir.mjs +43 -0
- package/lib/skill-tiers.mjs +137 -0
- package/lib/unified-plugin.mjs +924 -0
- package/llms.txt +68 -43
- package/package.json +28 -19
- package/plugins/beginner.json +17 -6
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +20 -0
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +26 -0
- package/plugins/continuous-improvement/LICENSE +21 -0
- package/plugins/continuous-improvement/README.md +56 -0
- package/plugins/continuous-improvement/bin/backfill.mjs +172 -0
- package/plugins/continuous-improvement/bin/mcp-server.mjs +886 -0
- package/plugins/continuous-improvement/bin/observe.mjs +148 -0
- package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -0
- package/plugins/continuous-improvement/commands/dashboard.md +56 -0
- package/plugins/continuous-improvement/commands/discipline.md +51 -0
- package/plugins/continuous-improvement/commands/harvest.md +76 -0
- package/plugins/continuous-improvement/commands/learn-eval.md +117 -0
- package/plugins/continuous-improvement/commands/planning-with-files.md +66 -0
- package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -0
- package/plugins/continuous-improvement/commands/ralph.md +103 -0
- package/plugins/continuous-improvement/commands/release-train.md +81 -0
- package/plugins/continuous-improvement/commands/seven-laws.md +16 -0
- package/plugins/continuous-improvement/commands/superpowers.md +153 -0
- package/plugins/continuous-improvement/commands/swarm.md +101 -0
- package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -0
- package/plugins/continuous-improvement/hooks/hooks.json +60 -0
- package/plugins/continuous-improvement/hooks/observe.sh +172 -0
- package/plugins/continuous-improvement/hooks/session.sh +106 -0
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -0
- package/plugins/continuous-improvement/instinct-packs/go.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/meta.json +16 -0
- package/plugins/continuous-improvement/instinct-packs/python.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/react.json +58 -0
- package/plugins/continuous-improvement/lib/observe-event.mjs +128 -0
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +432 -0
- package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +43 -0
- package/plugins/continuous-improvement/skills/README.md +34 -0
- package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +249 -0
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +131 -0
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +155 -0
- package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -0
- package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +454 -0
- package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -0
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -0
- package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -0
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +212 -0
- package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -0
- package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -0
- package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +192 -0
- package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -0
- package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +147 -0
- package/plugins/continuous-improvement/templates/planning-with-files/findings.md +8 -0
- package/plugins/continuous-improvement/templates/planning-with-files/progress.md +7 -0
- package/plugins/continuous-improvement/templates/planning-with-files/task_plan.md +23 -0
- package/plugins/expert.json +26 -5
- package/skills/README.md +79 -0
- package/skills/deploy-receipt.md +131 -0
- package/skills/gateguard.md +155 -0
- package/skills/para-memory-files.md +108 -0
- package/skills/proceed-with-the-recommendation.md +454 -0
- package/skills/ralph.md +221 -0
- package/skills/safety-guard.md +76 -0
- package/skills/strategic-compact.md +104 -0
- package/skills/superpowers.md +212 -0
- package/skills/tdd-workflow.md +411 -0
- package/skills/token-budget-advisor.md +136 -0
- package/skills/verification-loop.md +192 -0
- package/skills/wild-risa-balance.md +191 -0
- package/skills/workspace-surface-audit.md +147 -0
- package/templates/planning-with-files/findings.md +8 -0
- package/templates/planning-with-files/progress.md +7 -0
- package/templates/planning-with-files/task_plan.md +23 -0
- package/templates/verify-ladder.example.json +47 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Unified Continuous Improvement CLI.
|
|
4
|
+
*
|
|
5
|
+
* Comprehensive command-line interface for the unified plugin that combines
|
|
6
|
+
* CLI-Anything, Compound Engineering, and PM-Skills.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import UnifiedContinuousImprovement from "../lib/unified-plugin.mjs";
|
|
11
|
+
const DEFAULT_CONFIG = {
|
|
12
|
+
workspace: "./ci-workspace",
|
|
13
|
+
verbose: false,
|
|
14
|
+
defaultMode: "expert",
|
|
15
|
+
};
|
|
16
|
+
function getErrorMessage(error) {
|
|
17
|
+
return error instanceof Error ? error.message : String(error);
|
|
18
|
+
}
|
|
19
|
+
function parseJsonOption(raw) {
|
|
20
|
+
if (!raw)
|
|
21
|
+
return undefined;
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(raw);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
throw new Error(`Invalid JSON option: ${getErrorMessage(error)}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
class UnifiedCLI {
|
|
30
|
+
plugin = null;
|
|
31
|
+
config;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.config = this.loadConfig();
|
|
34
|
+
}
|
|
35
|
+
loadConfig() {
|
|
36
|
+
const configPath = join(process.cwd(), ".ci-config.json");
|
|
37
|
+
if (existsSync(configPath)) {
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(readFileSync(configPath, "utf8"));
|
|
40
|
+
return { ...DEFAULT_CONFIG, ...parsed };
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
console.warn("Warning: Invalid config file, using defaults");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { ...DEFAULT_CONFIG };
|
|
47
|
+
}
|
|
48
|
+
initializePlugin(options) {
|
|
49
|
+
this.plugin = new UnifiedContinuousImprovement({
|
|
50
|
+
workspace: options.workspace ?? this.config.workspace,
|
|
51
|
+
verbose: options.verbose ?? this.config.verbose,
|
|
52
|
+
});
|
|
53
|
+
return this.plugin;
|
|
54
|
+
}
|
|
55
|
+
requirePlugin() {
|
|
56
|
+
if (!this.plugin) {
|
|
57
|
+
throw new Error("CLI plugin not initialized");
|
|
58
|
+
}
|
|
59
|
+
return this.plugin;
|
|
60
|
+
}
|
|
61
|
+
async runCommand(command, args, options = {}) {
|
|
62
|
+
this.initializePlugin(options);
|
|
63
|
+
switch (command) {
|
|
64
|
+
case "init":
|
|
65
|
+
return this.handleInit(args, options);
|
|
66
|
+
case "workflow":
|
|
67
|
+
return this.handleWorkflow(args, options);
|
|
68
|
+
case "research":
|
|
69
|
+
return this.handleResearch(options);
|
|
70
|
+
case "planning":
|
|
71
|
+
return this.handlePlanning(options);
|
|
72
|
+
case "execution":
|
|
73
|
+
return this.handleExecution();
|
|
74
|
+
case "review":
|
|
75
|
+
return this.handleReview(options);
|
|
76
|
+
case "status":
|
|
77
|
+
return this.handleStatus();
|
|
78
|
+
case "cli":
|
|
79
|
+
return this.handleCLI(args);
|
|
80
|
+
case "pm":
|
|
81
|
+
return this.handlePM(args, options);
|
|
82
|
+
case "compound":
|
|
83
|
+
return this.handleCompound(args);
|
|
84
|
+
case "learnings":
|
|
85
|
+
return this.handleLearnings(args);
|
|
86
|
+
case "config":
|
|
87
|
+
return this.handleConfig(args);
|
|
88
|
+
default:
|
|
89
|
+
throw new Error(`Unknown command: ${command}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async handleInit(args, options) {
|
|
93
|
+
if (args.length < 2) {
|
|
94
|
+
throw new Error("Usage: ci init <project-name> <objective> [options]");
|
|
95
|
+
}
|
|
96
|
+
const [name, ...objectiveParts] = args;
|
|
97
|
+
const objective = objectiveParts.join(" ");
|
|
98
|
+
console.log(`🚀 Initializing project: ${name}`);
|
|
99
|
+
console.log(`📋 Objective: ${objective}`);
|
|
100
|
+
const plugin = this.requirePlugin();
|
|
101
|
+
const result = await plugin.initializeProject({
|
|
102
|
+
name: name,
|
|
103
|
+
objective,
|
|
104
|
+
product: parseJsonOption(options.product) ?? {},
|
|
105
|
+
industry: options.industry ?? "",
|
|
106
|
+
targetMarket: parseJsonOption(options.targetMarket) ?? {},
|
|
107
|
+
});
|
|
108
|
+
console.log(`✅ Project initialized successfully!`);
|
|
109
|
+
console.log(`🆔 Project ID: ${result.projectId}`);
|
|
110
|
+
console.log(`🔗 Session ID: ${result.sessionId}`);
|
|
111
|
+
console.log(`📊 PM Analysis: ${result.pmAnalysis.totalSkills} skills completed`);
|
|
112
|
+
console.log(`\n🎯 Next steps:`);
|
|
113
|
+
result.nextSteps.forEach((step, i) => {
|
|
114
|
+
console.log(` ${i + 1}. ${step}`);
|
|
115
|
+
});
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
async handleWorkflow(args, options) {
|
|
119
|
+
if (args.length < 2) {
|
|
120
|
+
throw new Error("Usage: ci workflow <project-name> <objective> [options]");
|
|
121
|
+
}
|
|
122
|
+
const [name, ...objectiveParts] = args;
|
|
123
|
+
const objective = objectiveParts.join(" ");
|
|
124
|
+
console.log(`🚀 Starting complete workflow for: ${name}`);
|
|
125
|
+
console.log(`📋 Objective: ${objective}`);
|
|
126
|
+
const progressCallback = (message) => {
|
|
127
|
+
console.log(` ⏳ ${message}`);
|
|
128
|
+
};
|
|
129
|
+
const plugin = this.requirePlugin();
|
|
130
|
+
const result = await plugin.executeCompleteWorkflow({
|
|
131
|
+
name: name,
|
|
132
|
+
objective,
|
|
133
|
+
product: parseJsonOption(options.product) ?? {},
|
|
134
|
+
industry: options.industry ?? "",
|
|
135
|
+
targetMarket: parseJsonOption(options.targetMarket) ?? {},
|
|
136
|
+
}, {
|
|
137
|
+
researchContext: options.repo ? { repositoryPath: options.repo } : {},
|
|
138
|
+
progressCallback,
|
|
139
|
+
});
|
|
140
|
+
console.log(`🎉 Complete workflow finished!`);
|
|
141
|
+
console.log(`🆔 Project: ${result.project}`);
|
|
142
|
+
console.log(`🔗 Session: ${result.sessionId}`);
|
|
143
|
+
for (const [phase] of Object.entries(result.phases)) {
|
|
144
|
+
console.log(`\n📊 ${phase.charAt(0).toUpperCase() + phase.slice(1)} Phase:`);
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
async handleResearch(options) {
|
|
149
|
+
console.log(`🔍 Starting research phase...`);
|
|
150
|
+
const context = {};
|
|
151
|
+
if (options.repo)
|
|
152
|
+
context.repositoryPath = options.repo;
|
|
153
|
+
if (options.context)
|
|
154
|
+
context.additionalContext = parseJsonOption(options.context);
|
|
155
|
+
const plugin = this.requirePlugin();
|
|
156
|
+
const result = await plugin.executeResearchPhase(context);
|
|
157
|
+
console.log(`✅ Research phase completed!`);
|
|
158
|
+
console.log(`💡 Generated ${result.brainstorm.ideas.length} ideas`);
|
|
159
|
+
console.log(`🔍 Identified ${result.brainstorm.risks.length} risks`);
|
|
160
|
+
if (result.cliTools) {
|
|
161
|
+
console.log(`🛠️ Generated CLI with ${result.cliTools.commands.length} commands`);
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
async handlePlanning(options) {
|
|
166
|
+
console.log(`📋 Starting planning phase...`);
|
|
167
|
+
const preferences = parseJsonOption(options.preferences) ?? {};
|
|
168
|
+
const plugin = this.requirePlugin();
|
|
169
|
+
const result = await plugin.executePlanningPhase(preferences);
|
|
170
|
+
console.log(`✅ Planning phase completed!`);
|
|
171
|
+
console.log(`📈 Created plan with ${result.corePlan.steps.length} steps`);
|
|
172
|
+
const estimated = result.corePlan.timeline?.estimated;
|
|
173
|
+
if (estimated)
|
|
174
|
+
console.log(`⏱️ Timeline: ${estimated}`);
|
|
175
|
+
console.log(`⚠️ Identified ${result.risks.length} risks`);
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
async handleExecution() {
|
|
179
|
+
console.log(`🔧 Starting execution phase...`);
|
|
180
|
+
const progressCallback = (message) => {
|
|
181
|
+
console.log(` ⚡ ${message}`);
|
|
182
|
+
};
|
|
183
|
+
const plugin = this.requirePlugin();
|
|
184
|
+
const result = await plugin.executeWorkingPhase(progressCallback);
|
|
185
|
+
console.log(`✅ Execution phase completed!`);
|
|
186
|
+
console.log(`📋 Completed ${result.coreWork.steps.length} steps`);
|
|
187
|
+
console.log(`🔧 Resolved ${result.issues.length} issues`);
|
|
188
|
+
console.log(`💡 Applied ${result.solutions.length} solutions`);
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
async handleReview(options) {
|
|
192
|
+
console.log(`🔍 Starting review phase...`);
|
|
193
|
+
const criteria = parseJsonOption(options.criteria);
|
|
194
|
+
const plugin = this.requirePlugin();
|
|
195
|
+
const result = await plugin.executeReviewPhase(criteria);
|
|
196
|
+
console.log(`✅ Review phase completed!`);
|
|
197
|
+
console.log(`📊 Overall score: ${result.coreReview.review.overallScore}/100`);
|
|
198
|
+
console.log(`💡 Generated ${result.learnings.length} learnings`);
|
|
199
|
+
console.log(`📋 Created ${result.recommendations.length} recommendations`);
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
async handleStatus() {
|
|
203
|
+
const plugin = this.requirePlugin();
|
|
204
|
+
const status = await plugin.getProjectStatus();
|
|
205
|
+
console.log(`📊 Project Status:`);
|
|
206
|
+
console.log(` Project: ${status.project ?? "No active project"}`);
|
|
207
|
+
console.log(` Session: ${status.sessionId ?? "N/A"}`);
|
|
208
|
+
console.log(` Current Phase: ${status.currentPhase ?? "N/A"}`);
|
|
209
|
+
if (status.progress) {
|
|
210
|
+
console.log(` Progress: ${status.progress.completed}/${status.progress.total} (${status.progress.percentage}%)`);
|
|
211
|
+
}
|
|
212
|
+
if (status.nextSteps && status.nextSteps.length > 0) {
|
|
213
|
+
console.log(`\n🎯 Next Steps:`);
|
|
214
|
+
status.nextSteps.forEach((step, i) => {
|
|
215
|
+
console.log(` ${i + 1}. ${step}`);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return status;
|
|
219
|
+
}
|
|
220
|
+
async handleCLI(args) {
|
|
221
|
+
const [subcommand, ...subArgs] = args;
|
|
222
|
+
switch (subcommand) {
|
|
223
|
+
case "generate":
|
|
224
|
+
if (subArgs.length === 0) {
|
|
225
|
+
throw new Error("Usage: ci cli generate <repository-path>");
|
|
226
|
+
}
|
|
227
|
+
return this.handleCLIGenerate(subArgs[0]);
|
|
228
|
+
case "list":
|
|
229
|
+
return this.handleCLIList();
|
|
230
|
+
default:
|
|
231
|
+
throw new Error("Usage: ci cli <generate|list> [args]");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async handleCLIGenerate(repoPath) {
|
|
235
|
+
console.log(`🛠️ Generating CLI for: ${repoPath}`);
|
|
236
|
+
const plugin = this.requirePlugin();
|
|
237
|
+
const result = await plugin.cliAnything.generateCLI(repoPath);
|
|
238
|
+
console.log(`✅ CLI generated successfully!`);
|
|
239
|
+
console.log(`📁 Output: ${result.outputPath}`);
|
|
240
|
+
console.log(`🔧 Commands: ${result.commands.length}`);
|
|
241
|
+
console.log(`\n📋 Available Commands:`);
|
|
242
|
+
for (const cmd of result.commands) {
|
|
243
|
+
console.log(` ${cmd.name.padEnd(15)} - ${cmd.description}`);
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
handleCLIList() {
|
|
248
|
+
console.log(`🛠️ CLI Generation Tool Status: Ready`);
|
|
249
|
+
console.log(` Repository Analysis: Supported`);
|
|
250
|
+
console.log(` Project Types: Node.js, React, Python, Docker, and more`);
|
|
251
|
+
console.log(` Output Format: Executable JavaScript`);
|
|
252
|
+
}
|
|
253
|
+
async handlePM(args, options) {
|
|
254
|
+
const [subcommand, ...subArgs] = args;
|
|
255
|
+
switch (subcommand) {
|
|
256
|
+
case "analyze":
|
|
257
|
+
return this.handlePMAnalyze(options);
|
|
258
|
+
case "skill":
|
|
259
|
+
return this.handlePMSkill(subArgs);
|
|
260
|
+
case "list":
|
|
261
|
+
return this.handlePMList();
|
|
262
|
+
default:
|
|
263
|
+
throw new Error("Usage: ci pm <analyze|skill|list> [args]");
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async handlePMAnalyze(options) {
|
|
267
|
+
console.log(`📊 Running comprehensive PM analysis...`);
|
|
268
|
+
const productInfo = {
|
|
269
|
+
product: parseJsonOption(options.product) ?? {},
|
|
270
|
+
industry: options.industry ?? "Technology",
|
|
271
|
+
targetMarket: parseJsonOption(options.targetMarket) ?? {},
|
|
272
|
+
};
|
|
273
|
+
const plugin = this.requirePlugin();
|
|
274
|
+
const result = await plugin.pmSkills.runProductAnalysis(productInfo);
|
|
275
|
+
console.log(`✅ PM analysis completed!`);
|
|
276
|
+
console.log(`📊 Summary: ${result.summary.completedSkills}/${result.summary.totalSkills} skills completed`);
|
|
277
|
+
console.log(`💡 Key insights: ${result.summary.keyInsights.length}`);
|
|
278
|
+
console.log(`📋 Recommendations: ${result.summary.recommendations.length}`);
|
|
279
|
+
console.log(`📁 Results saved to: ${result.savedTo}`);
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
async handlePMSkill(args) {
|
|
283
|
+
if (args.length === 0) {
|
|
284
|
+
throw new Error("Usage: ci pm skill <skill-name>");
|
|
285
|
+
}
|
|
286
|
+
const [skillName] = args;
|
|
287
|
+
console.log(`📊 Executing PM skill: ${skillName}`);
|
|
288
|
+
const input = {
|
|
289
|
+
product: { name: "Sample Product" },
|
|
290
|
+
market: { size: "Medium" },
|
|
291
|
+
};
|
|
292
|
+
const plugin = this.requirePlugin();
|
|
293
|
+
const result = await plugin.pmSkills.executeSkill(skillName, input);
|
|
294
|
+
console.log(`✅ PM skill ${skillName} completed!`);
|
|
295
|
+
console.log(`📁 Results saved to: ${result.savedTo}`);
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
handlePMList() {
|
|
299
|
+
const plugin = this.requirePlugin();
|
|
300
|
+
const skills = plugin.pmSkills.getAvailableSkills();
|
|
301
|
+
console.log(`📊 Available PM Skills:`);
|
|
302
|
+
for (const skill of skills) {
|
|
303
|
+
console.log(` ${skill.name.padEnd(20)} - ${skill.description} [${skill.category}]`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async handleCompound(args) {
|
|
307
|
+
const [subcommand, ...subArgs] = args;
|
|
308
|
+
switch (subcommand) {
|
|
309
|
+
case "session":
|
|
310
|
+
return this.handleCompoundSession(subArgs);
|
|
311
|
+
case "learnings":
|
|
312
|
+
return this.handleCompoundLearnings();
|
|
313
|
+
default:
|
|
314
|
+
throw new Error("Usage: ci compound <session|learnings> [args]");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
async handleCompoundSession(args) {
|
|
318
|
+
if (args.length < 2) {
|
|
319
|
+
throw new Error("Usage: ci compound session <project-name> <objective>");
|
|
320
|
+
}
|
|
321
|
+
const [name, ...objectiveParts] = args;
|
|
322
|
+
const objective = objectiveParts.join(" ");
|
|
323
|
+
console.log(`🔧 Starting compound engineering session...`);
|
|
324
|
+
const plugin = this.requirePlugin();
|
|
325
|
+
const session = await plugin.compoundEngineering.startSession(name, objective);
|
|
326
|
+
console.log(`✅ Session started!`);
|
|
327
|
+
console.log(`🆔 Session ID: ${session.id}`);
|
|
328
|
+
console.log(`📋 Objective: ${session.objective}`);
|
|
329
|
+
console.log(`🔄 Current Phase: ${session.phase}`);
|
|
330
|
+
return session;
|
|
331
|
+
}
|
|
332
|
+
async handleCompoundLearnings() {
|
|
333
|
+
console.log(`📚 Loading compound engineering learnings...`);
|
|
334
|
+
const plugin = this.requirePlugin();
|
|
335
|
+
await plugin.compoundEngineering.loadLearnings();
|
|
336
|
+
const learnings = plugin.compoundEngineering.getAllLearnings();
|
|
337
|
+
console.log(`📚 Found ${learnings.length} learnings:`);
|
|
338
|
+
for (const learning of learnings) {
|
|
339
|
+
console.log(` [${learning.confidence.toFixed(2)}] ${learning.summary}`);
|
|
340
|
+
}
|
|
341
|
+
return learnings;
|
|
342
|
+
}
|
|
343
|
+
async handleLearnings(args) {
|
|
344
|
+
const [subcommand, ...subArgs] = args;
|
|
345
|
+
switch (subcommand) {
|
|
346
|
+
case "search":
|
|
347
|
+
return this.handleLearningsSearch(subArgs.join(" "));
|
|
348
|
+
case "all":
|
|
349
|
+
return this.handleLearningsAll();
|
|
350
|
+
default:
|
|
351
|
+
throw new Error("Usage: ci learnings <search|all> [query]");
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
async handleLearningsSearch(query) {
|
|
355
|
+
console.log(`🔍 Searching learnings for: "${query}"`);
|
|
356
|
+
const plugin = this.requirePlugin();
|
|
357
|
+
await plugin.compoundEngineering.loadLearnings();
|
|
358
|
+
const results = plugin.compoundEngineering.searchLearnings(query);
|
|
359
|
+
console.log(`🔍 Found ${results.length} matching learnings:`);
|
|
360
|
+
for (const learning of results) {
|
|
361
|
+
console.log(` [${learning.confidence.toFixed(2)}] ${learning.summary}`);
|
|
362
|
+
}
|
|
363
|
+
return results;
|
|
364
|
+
}
|
|
365
|
+
async handleLearningsAll() {
|
|
366
|
+
console.log(`📚 Loading all learnings...`);
|
|
367
|
+
const plugin = this.requirePlugin();
|
|
368
|
+
await plugin.compoundEngineering.loadLearnings();
|
|
369
|
+
const learnings = plugin.compoundEngineering.getAllLearnings();
|
|
370
|
+
console.log(`📚 Total learnings: ${learnings.length}`);
|
|
371
|
+
const grouped = learnings.reduce((groups, learning) => {
|
|
372
|
+
const type = learning.type || "general";
|
|
373
|
+
if (!groups[type])
|
|
374
|
+
groups[type] = [];
|
|
375
|
+
groups[type].push(learning);
|
|
376
|
+
return groups;
|
|
377
|
+
}, {});
|
|
378
|
+
for (const [type, items] of Object.entries(grouped)) {
|
|
379
|
+
console.log(`\n ${type.charAt(0).toUpperCase() + type.slice(1)} (${items.length}):`);
|
|
380
|
+
for (const learning of items) {
|
|
381
|
+
console.log(` [${learning.confidence.toFixed(2)}] ${learning.summary}`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return learnings;
|
|
385
|
+
}
|
|
386
|
+
async handleConfig(args) {
|
|
387
|
+
const [subcommand, ...subArgs] = args;
|
|
388
|
+
switch (subcommand) {
|
|
389
|
+
case "show":
|
|
390
|
+
return this.handleConfigShow();
|
|
391
|
+
case "set":
|
|
392
|
+
return this.handleConfigSet(subArgs);
|
|
393
|
+
default:
|
|
394
|
+
throw new Error("Usage: ci config <show|set> [key] [value]");
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
handleConfigShow() {
|
|
398
|
+
console.log(`⚙️ Current Configuration:`);
|
|
399
|
+
console.log(` Workspace: ${this.config.workspace}`);
|
|
400
|
+
console.log(` Verbose: ${this.config.verbose}`);
|
|
401
|
+
console.log(` Default Mode: ${this.config.defaultMode}`);
|
|
402
|
+
}
|
|
403
|
+
handleConfigSet(args) {
|
|
404
|
+
if (args.length < 2) {
|
|
405
|
+
throw new Error("Usage: ci config set <key> <value>");
|
|
406
|
+
}
|
|
407
|
+
const [key, value] = args;
|
|
408
|
+
if (!key || value === undefined) {
|
|
409
|
+
throw new Error("Usage: ci config set <key> <value>");
|
|
410
|
+
}
|
|
411
|
+
if (key === "workspace") {
|
|
412
|
+
this.config.workspace = value;
|
|
413
|
+
}
|
|
414
|
+
else if (key === "verbose") {
|
|
415
|
+
this.config.verbose = value === "true";
|
|
416
|
+
}
|
|
417
|
+
else if (key === "defaultMode") {
|
|
418
|
+
this.config.defaultMode = value;
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
throw new Error(`Unknown config key: ${key}`);
|
|
422
|
+
}
|
|
423
|
+
console.log(`✅ Configuration updated: ${key} = ${value}`);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function parseGlobalOptions(args) {
|
|
427
|
+
const options = {};
|
|
428
|
+
for (let i = 0; i < args.length; i++) {
|
|
429
|
+
const flag = args[i];
|
|
430
|
+
const next = args[i + 1];
|
|
431
|
+
const consumeValue = (key) => {
|
|
432
|
+
if (next === undefined)
|
|
433
|
+
return;
|
|
434
|
+
options[key] = next;
|
|
435
|
+
args.splice(i, 2);
|
|
436
|
+
i--;
|
|
437
|
+
};
|
|
438
|
+
switch (flag) {
|
|
439
|
+
case "--workspace":
|
|
440
|
+
consumeValue("workspace");
|
|
441
|
+
break;
|
|
442
|
+
case "--verbose":
|
|
443
|
+
options.verbose = true;
|
|
444
|
+
args.splice(i, 1);
|
|
445
|
+
i--;
|
|
446
|
+
break;
|
|
447
|
+
case "--repo":
|
|
448
|
+
consumeValue("repo");
|
|
449
|
+
break;
|
|
450
|
+
case "--product":
|
|
451
|
+
consumeValue("product");
|
|
452
|
+
break;
|
|
453
|
+
case "--industry":
|
|
454
|
+
consumeValue("industry");
|
|
455
|
+
break;
|
|
456
|
+
case "--target-market":
|
|
457
|
+
consumeValue("targetMarket");
|
|
458
|
+
break;
|
|
459
|
+
default:
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return options;
|
|
464
|
+
}
|
|
465
|
+
async function main() {
|
|
466
|
+
const [, , command, ...args] = process.argv;
|
|
467
|
+
if (!command || command === "--help" || command === "-h") {
|
|
468
|
+
console.log(`
|
|
469
|
+
Unified Continuous Improvement CLI
|
|
470
|
+
|
|
471
|
+
Usage: ci <command> [args] [options]
|
|
472
|
+
|
|
473
|
+
Main Commands:
|
|
474
|
+
init <name> <objective> Initialize new project with comprehensive analysis
|
|
475
|
+
workflow <name> <objective> Run complete end-to-end workflow
|
|
476
|
+
research Execute research phase
|
|
477
|
+
planning Execute planning phase
|
|
478
|
+
execution Execute execution phase
|
|
479
|
+
review Execute review phase
|
|
480
|
+
status Show project status
|
|
481
|
+
|
|
482
|
+
Tool Commands:
|
|
483
|
+
cli generate <repo-path> Generate CLI for repository
|
|
484
|
+
pm analyze Run comprehensive PM analysis
|
|
485
|
+
pm skill <name> Execute specific PM skill
|
|
486
|
+
pm list List available PM skills
|
|
487
|
+
compound session <name> <obj> Start compound engineering session
|
|
488
|
+
compound learnings Show compound engineering learnings
|
|
489
|
+
learnings search <query> Search through all learnings
|
|
490
|
+
learnings all Show all learnings
|
|
491
|
+
|
|
492
|
+
Configuration:
|
|
493
|
+
config show Show current configuration
|
|
494
|
+
config set <key> <value> Set configuration value
|
|
495
|
+
|
|
496
|
+
Global Options:
|
|
497
|
+
--workspace <dir> Workspace directory
|
|
498
|
+
--verbose Enable verbose logging
|
|
499
|
+
--repo <path> Repository path for CLI generation
|
|
500
|
+
--product <json> Product information as JSON
|
|
501
|
+
--industry <name> Industry name
|
|
502
|
+
--target-market <json> Target market as JSON
|
|
503
|
+
|
|
504
|
+
Examples:
|
|
505
|
+
ci init "MyApp" "Build a task management app"
|
|
506
|
+
ci workflow "MyApp" "Build task management" --repo ./my-app
|
|
507
|
+
ci cli generate ./my-repo
|
|
508
|
+
ci pm analyze --industry "SaaS" --target-market '{"segment":"SMB"}'
|
|
509
|
+
ci learnings search "performance"
|
|
510
|
+
`);
|
|
511
|
+
process.exit(0);
|
|
512
|
+
}
|
|
513
|
+
const cli = new UnifiedCLI();
|
|
514
|
+
const options = parseGlobalOptions(args);
|
|
515
|
+
try {
|
|
516
|
+
const result = await cli.runCommand(command, args, options);
|
|
517
|
+
if (options.verbose && result) {
|
|
518
|
+
console.log(`\n🔍 Detailed result:`);
|
|
519
|
+
console.log(JSON.stringify(result, null, 2));
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
catch (error) {
|
|
523
|
+
console.error(`❌ Error: ${getErrorMessage(error)}`);
|
|
524
|
+
process.exit(1);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
528
|
+
main().catch((error) => {
|
|
529
|
+
console.error(`❌ Fatal error: ${getErrorMessage(error)}`);
|
|
530
|
+
process.exit(1);
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
export default UnifiedCLI;
|