claude-power-setup 1.0.1
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/LICENSE +21 -0
- package/README.md +275 -0
- package/assets/banner.svg +96 -0
- package/bin/claude-aliases.sh +71 -0
- package/bin/claude-loop.sh +84 -0
- package/bin/claude-session-save.sh +61 -0
- package/cli.js +288 -0
- package/config/env-settings.json +5 -0
- package/config/observer-config.json +8 -0
- package/contexts/dev.md +23 -0
- package/contexts/orchestrate.md +31 -0
- package/contexts/research.md +25 -0
- package/contexts/review.md +23 -0
- package/install.ps1 +178 -0
- package/install.sh +431 -0
- package/instincts/de-sloppify-separate-pass.md +22 -0
- package/instincts/dual-review-catches-more.md +24 -0
- package/instincts/parallel-agents-for-independent-files.md +25 -0
- package/instincts/uuid-esm-incompatibility-jest.md +26 -0
- package/package.json +49 -0
- package/reference/ORCHESTRATION-REFERENCE.md +293 -0
- package/uninstall.sh +195 -0
package/cli.js
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Claude Power Setup — npm CLI installer
|
|
3
|
+
// Usage: npx claude-power-setup [--dry-run] [--force] [--skip-shell] [--skip-ecc]
|
|
4
|
+
//
|
|
5
|
+
// Delegates to install.sh if bash is available.
|
|
6
|
+
// Falls back to pure Node.js file operations on Windows without bash.
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
const { execFileSync } = require("child_process");
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const os = require("os");
|
|
14
|
+
|
|
15
|
+
const SCRIPT_DIR = __dirname;
|
|
16
|
+
const CLAUDE_HOME = path.join(os.homedir(), ".claude");
|
|
17
|
+
const VERSION = "1.0.0";
|
|
18
|
+
|
|
19
|
+
const args = process.argv.slice(2);
|
|
20
|
+
|
|
21
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
22
|
+
console.log(`
|
|
23
|
+
Claude Power Setup v${VERSION}
|
|
24
|
+
Multi-agent orchestration + self-improvement for Claude Code
|
|
25
|
+
|
|
26
|
+
Usage: npx claude-power-setup [OPTIONS]
|
|
27
|
+
|
|
28
|
+
Options:
|
|
29
|
+
--dry-run Show what would be installed without writing files
|
|
30
|
+
--force Overwrite existing files instead of skipping
|
|
31
|
+
--skip-shell Don't modify shell profile (.bashrc/.zshrc)
|
|
32
|
+
--skip-ecc Don't check for ECC installation
|
|
33
|
+
--uninstall Run the uninstaller instead
|
|
34
|
+
--help Show this help
|
|
35
|
+
`);
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ── Try bash delegation ──────────────────────────────────────────
|
|
40
|
+
function findBash() {
|
|
41
|
+
const candidates = [
|
|
42
|
+
"/bin/bash",
|
|
43
|
+
"/usr/bin/bash",
|
|
44
|
+
"/usr/local/bin/bash",
|
|
45
|
+
"C:\\Program Files\\Git\\bin\\bash.exe",
|
|
46
|
+
"C:\\Program Files (x86)\\Git\\bin\\bash.exe",
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
for (const candidate of candidates) {
|
|
50
|
+
try {
|
|
51
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
52
|
+
} catch {
|
|
53
|
+
// skip
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Try PATH
|
|
58
|
+
try {
|
|
59
|
+
execFileSync("bash", ["--version"], { stdio: "ignore" });
|
|
60
|
+
return "bash";
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const bashPath = findBash();
|
|
67
|
+
|
|
68
|
+
if (bashPath) {
|
|
69
|
+
const script = args.includes("--uninstall")
|
|
70
|
+
? path.join(SCRIPT_DIR, "uninstall.sh")
|
|
71
|
+
: path.join(SCRIPT_DIR, "install.sh");
|
|
72
|
+
|
|
73
|
+
const bashArgs = args.filter((a) => a !== "--uninstall");
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
execFileSync(bashPath, [script, ...bashArgs], {
|
|
77
|
+
stdio: "inherit",
|
|
78
|
+
env: { ...process.env, HOME: os.homedir() },
|
|
79
|
+
});
|
|
80
|
+
} catch (err) {
|
|
81
|
+
process.exit(err.status || 1);
|
|
82
|
+
}
|
|
83
|
+
process.exit(0);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ── Pure Node.js fallback (no bash available) ────────────────────
|
|
87
|
+
const DRY_RUN = args.includes("--dry-run");
|
|
88
|
+
const FORCE = args.includes("--force");
|
|
89
|
+
|
|
90
|
+
console.log(`
|
|
91
|
+
Claude Power Setup v${VERSION}
|
|
92
|
+
Multi-agent orchestration + self-improvement
|
|
93
|
+
(Node.js native mode — bash not found)
|
|
94
|
+
`);
|
|
95
|
+
|
|
96
|
+
if (DRY_RUN) {
|
|
97
|
+
console.log("[!] DRY RUN — no files will be written\n");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (args.includes("--uninstall")) {
|
|
101
|
+
console.log("[!] Uninstall requires bash. Please run:");
|
|
102
|
+
console.log(" bash uninstall.sh");
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function safeCopy(src, dest, label) {
|
|
107
|
+
if (DRY_RUN) {
|
|
108
|
+
if (fs.existsSync(dest) && !FORCE) {
|
|
109
|
+
console.log(`[i] SKIP (exists): ${label}`);
|
|
110
|
+
} else {
|
|
111
|
+
console.log(`[i] WOULD COPY: ${label} -> ${dest}`);
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const destDir = path.dirname(dest);
|
|
117
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
118
|
+
|
|
119
|
+
if (fs.existsSync(dest) && !FORCE) {
|
|
120
|
+
console.log(`[i] Skip (exists): ${label}`);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
fs.copyFileSync(src, dest);
|
|
125
|
+
console.log(`[+] Installed: ${label}`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ── Context profiles ─────────────────────────────────────────────
|
|
129
|
+
console.log("Installing context profiles...");
|
|
130
|
+
for (const name of ["dev.md", "orchestrate.md", "review.md", "research.md"]) {
|
|
131
|
+
safeCopy(
|
|
132
|
+
path.join(SCRIPT_DIR, "contexts", name),
|
|
133
|
+
path.join(CLAUDE_HOME, "contexts", name),
|
|
134
|
+
`contexts/${name}`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ── Reference doc ────────────────────────────────────────────────
|
|
139
|
+
console.log("\nInstalling orchestration reference...");
|
|
140
|
+
safeCopy(
|
|
141
|
+
path.join(SCRIPT_DIR, "reference", "ORCHESTRATION-REFERENCE.md"),
|
|
142
|
+
path.join(CLAUDE_HOME, "contexts", "ORCHESTRATION-REFERENCE.md"),
|
|
143
|
+
"reference/ORCHESTRATION-REFERENCE.md"
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
// ── Automation scripts ───────────────────────────────────────────
|
|
147
|
+
console.log("\nInstalling automation scripts...");
|
|
148
|
+
const binDir = path.join(SCRIPT_DIR, "bin");
|
|
149
|
+
for (const file of fs.readdirSync(binDir)) {
|
|
150
|
+
if (file.endsWith(".sh")) {
|
|
151
|
+
safeCopy(
|
|
152
|
+
path.join(binDir, file),
|
|
153
|
+
path.join(CLAUDE_HOME, "bin", file),
|
|
154
|
+
`bin/${file}`
|
|
155
|
+
);
|
|
156
|
+
if (!DRY_RUN) {
|
|
157
|
+
try {
|
|
158
|
+
fs.chmodSync(path.join(CLAUDE_HOME, "bin", file), 0o755);
|
|
159
|
+
} catch {
|
|
160
|
+
// chmod may not work on Windows — that's fine
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ── Instincts ────────────────────────────────────────────────────
|
|
167
|
+
console.log("\nInstalling learned instincts...");
|
|
168
|
+
const instinctDest = path.join(
|
|
169
|
+
CLAUDE_HOME,
|
|
170
|
+
"homunculus",
|
|
171
|
+
"instincts",
|
|
172
|
+
"personal"
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
if (!DRY_RUN) {
|
|
176
|
+
for (const dir of [
|
|
177
|
+
instinctDest,
|
|
178
|
+
path.join(CLAUDE_HOME, "homunculus", "instincts", "inherited"),
|
|
179
|
+
path.join(CLAUDE_HOME, "homunculus", "evolved", "agents"),
|
|
180
|
+
path.join(CLAUDE_HOME, "homunculus", "evolved", "skills"),
|
|
181
|
+
path.join(CLAUDE_HOME, "homunculus", "evolved", "commands"),
|
|
182
|
+
path.join(CLAUDE_HOME, "session-data"),
|
|
183
|
+
path.join(CLAUDE_HOME, "plans"),
|
|
184
|
+
]) {
|
|
185
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const instinctsDir = path.join(SCRIPT_DIR, "instincts");
|
|
190
|
+
for (const file of fs.readdirSync(instinctsDir)) {
|
|
191
|
+
if (file.endsWith(".md")) {
|
|
192
|
+
safeCopy(
|
|
193
|
+
path.join(instinctsDir, file),
|
|
194
|
+
path.join(instinctDest, file),
|
|
195
|
+
`instincts/${file}`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ── Merge env settings ───────────────────────────────────────────
|
|
201
|
+
console.log("\nConfiguring settings.json...");
|
|
202
|
+
const settingsFile = path.join(CLAUDE_HOME, "settings.json");
|
|
203
|
+
const envFile = path.join(SCRIPT_DIR, "config", "env-settings.json");
|
|
204
|
+
|
|
205
|
+
if (!DRY_RUN && fs.existsSync(settingsFile) && fs.existsSync(envFile)) {
|
|
206
|
+
try {
|
|
207
|
+
const settings = JSON.parse(fs.readFileSync(settingsFile, "utf8"));
|
|
208
|
+
const newEnv = JSON.parse(fs.readFileSync(envFile, "utf8"));
|
|
209
|
+
|
|
210
|
+
if (!settings.env) settings.env = {};
|
|
211
|
+
|
|
212
|
+
let added = 0;
|
|
213
|
+
for (const [key, value] of Object.entries(newEnv)) {
|
|
214
|
+
if (!(key in settings.env)) {
|
|
215
|
+
settings.env[key] = value;
|
|
216
|
+
added++;
|
|
217
|
+
console.log(`[+] Added env: ${key}=${value}`);
|
|
218
|
+
} else {
|
|
219
|
+
console.log(`[i] Skip env (exists): ${key}=${settings.env[key]}`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (added > 0) {
|
|
224
|
+
fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2) + "\n");
|
|
225
|
+
}
|
|
226
|
+
} catch (err) {
|
|
227
|
+
console.log(`[!] Could not merge env settings: ${err.message}`);
|
|
228
|
+
}
|
|
229
|
+
} else if (DRY_RUN) {
|
|
230
|
+
console.log(
|
|
231
|
+
"[i] WOULD MERGE: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS, ECC_HOOK_PROFILE, CLAUDE_CODE_ENABLE_COST_TRACKING"
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// ── Observer config ──────────────────────────────────────────────
|
|
236
|
+
console.log("\nConfiguring continuous learning observer...");
|
|
237
|
+
const observerSrc = path.join(SCRIPT_DIR, "config", "observer-config.json");
|
|
238
|
+
const clv2Config = path.join(
|
|
239
|
+
CLAUDE_HOME,
|
|
240
|
+
"skills",
|
|
241
|
+
"continuous-learning-v2",
|
|
242
|
+
"config.json"
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
if (fs.existsSync(clv2Config)) {
|
|
246
|
+
if (DRY_RUN) {
|
|
247
|
+
console.log(`[i] WOULD UPDATE: ${clv2Config} (observer.enabled=true)`);
|
|
248
|
+
} else {
|
|
249
|
+
fs.copyFileSync(observerSrc, clv2Config);
|
|
250
|
+
console.log("[+] Observer enabled");
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
console.log("[!] CLv2 config not found — install ECC first for observer");
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// ── Write marker ─────────────────────────────────────────────────
|
|
257
|
+
if (!DRY_RUN) {
|
|
258
|
+
const marker = {
|
|
259
|
+
version: VERSION,
|
|
260
|
+
installed_at: new Date().toISOString(),
|
|
261
|
+
platform: process.platform,
|
|
262
|
+
installer: "npm",
|
|
263
|
+
components: [
|
|
264
|
+
"contexts",
|
|
265
|
+
"bin-scripts",
|
|
266
|
+
"instincts",
|
|
267
|
+
"env-settings",
|
|
268
|
+
"observer-config",
|
|
269
|
+
"reference-doc",
|
|
270
|
+
],
|
|
271
|
+
};
|
|
272
|
+
fs.writeFileSync(
|
|
273
|
+
path.join(CLAUDE_HOME, ".claude-power-setup-installed"),
|
|
274
|
+
JSON.stringify(marker, null, 2) + "\n"
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// ── Summary ──────────────────────────────────────────────────────
|
|
279
|
+
console.log(`
|
|
280
|
+
Installation Complete
|
|
281
|
+
|
|
282
|
+
Next steps:
|
|
283
|
+
1. source ~/.claude/bin/claude-aliases.sh (or restart terminal)
|
|
284
|
+
2. Open a project and run: claude
|
|
285
|
+
3. Try: 'Please use a team of specialists for this'
|
|
286
|
+
|
|
287
|
+
Reference: ~/.claude/contexts/ORCHESTRATION-REFERENCE.md
|
|
288
|
+
`);
|
package/contexts/dev.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Development Mode
|
|
2
|
+
|
|
3
|
+
You are in focused development mode. Priorities:
|
|
4
|
+
|
|
5
|
+
1. **Plan before coding** - Use /plan for non-trivial tasks, get confirmation before writing code
|
|
6
|
+
2. **TDD workflow** - Write failing tests first, then implement, then verify
|
|
7
|
+
3. **De-sloppify** - After implementation, do a cleanup pass removing test slop, console.logs, dead code
|
|
8
|
+
4. **Strategic compaction** - /compact after exploration phase, before implementation phase
|
|
9
|
+
5. **Commit atomically** - Small, focused conventional commits with clear messages
|
|
10
|
+
|
|
11
|
+
## Model Routing
|
|
12
|
+
- Exploration/search: delegate to Haiku subagents
|
|
13
|
+
- Implementation: use current model (Sonnet for routine, Opus for complex)
|
|
14
|
+
- Security review: always Opus
|
|
15
|
+
|
|
16
|
+
## Memory
|
|
17
|
+
- Check ~/.claude/session-data/ for previous session state on this project
|
|
18
|
+
- Before ending, run /save-session to persist progress
|
|
19
|
+
- Use /learn to extract reusable patterns
|
|
20
|
+
|
|
21
|
+
## Quality Gates
|
|
22
|
+
- Run build + lint + tests before every commit
|
|
23
|
+
- Use /verify for comprehensive checks before PR
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Orchestration Mode
|
|
2
|
+
|
|
3
|
+
You are the team lead in a multi-agent orchestration session. Your job is to PLAN, DELEGATE, and SYNTHESIZE - not write code yourself.
|
|
4
|
+
|
|
5
|
+
## Agent Teams Protocol
|
|
6
|
+
1. Decompose the task into independent work units with dependency DAG
|
|
7
|
+
2. Assign each unit a complexity tier: trivial, small, medium, large
|
|
8
|
+
3. Spawn specialist teammates for parallel execution
|
|
9
|
+
4. Monitor progress via shared task board
|
|
10
|
+
5. Synthesize results and resolve conflicts
|
|
11
|
+
|
|
12
|
+
## Teammate Specializations
|
|
13
|
+
- **architect**: System design, API contracts, data models
|
|
14
|
+
- **backend**: Server logic, database, API implementation
|
|
15
|
+
- **frontend**: UI components, state management, styling
|
|
16
|
+
- **tester**: Unit tests, integration tests, E2E tests
|
|
17
|
+
- **reviewer**: Code review, security audit, quality checks
|
|
18
|
+
- **docs**: Documentation, API docs, README updates
|
|
19
|
+
|
|
20
|
+
## Quality Pipeline Per Unit
|
|
21
|
+
- trivial: implement -> test
|
|
22
|
+
- small: implement -> test -> review
|
|
23
|
+
- medium: research -> plan -> implement -> test -> review
|
|
24
|
+
- large: research -> plan -> implement -> test -> review -> final-review
|
|
25
|
+
|
|
26
|
+
## Rules
|
|
27
|
+
- Max 5 teammates active at once
|
|
28
|
+
- Each teammate works in isolated git worktree
|
|
29
|
+
- Reviewer must NOT be the same agent that implemented
|
|
30
|
+
- Use SHARED_TASK_NOTES.md for cross-iteration context
|
|
31
|
+
- Never merge without tests passing
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Research Mode
|
|
2
|
+
|
|
3
|
+
You are in research and exploration mode. DO NOT write code unless explicitly asked.
|
|
4
|
+
|
|
5
|
+
## Priorities
|
|
6
|
+
1. Understand before suggesting
|
|
7
|
+
2. Read the full codebase architecture before proposing changes
|
|
8
|
+
3. Use iterative retrieval: broad search -> evaluate -> refine -> repeat (max 3 cycles)
|
|
9
|
+
4. Document findings in structured files for later use
|
|
10
|
+
|
|
11
|
+
## Tools
|
|
12
|
+
- Use read-only tools only: Read, Grep, Glob, WebSearch, WebFetch
|
|
13
|
+
- Save findings to .claude/plans/ or .claude/research/
|
|
14
|
+
- Use /aside for quick side questions without losing context
|
|
15
|
+
|
|
16
|
+
## Output Format
|
|
17
|
+
For each finding:
|
|
18
|
+
- **Source**: File path, URL, or documentation reference
|
|
19
|
+
- **Relevance**: High/Medium/Low with explanation
|
|
20
|
+
- **Implications**: How this affects the current task
|
|
21
|
+
- **Gaps**: What we still don't know
|
|
22
|
+
|
|
23
|
+
## Memory
|
|
24
|
+
- Save research output to files for cross-session persistence
|
|
25
|
+
- Use /learn to extract patterns discovered during research
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Review Mode
|
|
2
|
+
|
|
3
|
+
You are in code review mode. Focus on finding real issues, not style nitpicks.
|
|
4
|
+
|
|
5
|
+
## Review Priorities (in order)
|
|
6
|
+
1. **Security** - Injection, XSS, auth bypass, secrets in code, OWASP Top 10
|
|
7
|
+
2. **Correctness** - Logic bugs, edge cases, race conditions, error handling
|
|
8
|
+
3. **Data integrity** - Migration safety, transaction boundaries, constraint enforcement
|
|
9
|
+
4. **Performance** - N+1 queries, unbounded iterations, memory leaks, missing indexes
|
|
10
|
+
5. **Maintainability** - Only if something is genuinely confusing
|
|
11
|
+
|
|
12
|
+
## Tools
|
|
13
|
+
- Use /santa-loop for adversarial dual-model review (Claude + Codex/Gemini)
|
|
14
|
+
- Use /code-review for standard review
|
|
15
|
+
- Spawn parallel reviewer agents for different perspectives (security, performance, architecture)
|
|
16
|
+
|
|
17
|
+
## Output Format
|
|
18
|
+
For each issue:
|
|
19
|
+
- **Severity**: critical / high / medium / low
|
|
20
|
+
- **File:Line**: Exact location
|
|
21
|
+
- **Issue**: What's wrong
|
|
22
|
+
- **Fix**: Specific suggestion
|
|
23
|
+
- **Evidence**: Why this matters (CVE, benchmark, etc.)
|
package/install.ps1
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#Requires -Version 5.1
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Claude Power Setup — Windows PowerShell Installer
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
Installs multi-agent orchestration, automation scripts, and self-improvement
|
|
7
|
+
tools for Claude Code. Layers on top of ECC (Everything Claude Code).
|
|
8
|
+
|
|
9
|
+
If bash is available (Git Bash, WSL, MSYS2), delegates to install.sh.
|
|
10
|
+
Otherwise, performs native PowerShell file copies.
|
|
11
|
+
.PARAMETER DryRun
|
|
12
|
+
Show what would be installed without writing files.
|
|
13
|
+
.PARAMETER Force
|
|
14
|
+
Overwrite existing files instead of skipping.
|
|
15
|
+
.PARAMETER SkipShell
|
|
16
|
+
Don't modify shell profile.
|
|
17
|
+
.PARAMETER SkipECC
|
|
18
|
+
Don't check for ECC installation.
|
|
19
|
+
.EXAMPLE
|
|
20
|
+
powershell -ExecutionPolicy Bypass -File install.ps1
|
|
21
|
+
.EXAMPLE
|
|
22
|
+
powershell -ExecutionPolicy Bypass -File install.ps1 -DryRun
|
|
23
|
+
#>
|
|
24
|
+
param(
|
|
25
|
+
[switch]$DryRun,
|
|
26
|
+
[switch]$Force,
|
|
27
|
+
[switch]$SkipShell,
|
|
28
|
+
[switch]$SkipECC,
|
|
29
|
+
[switch]$Help
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
$Version = "1.0.0"
|
|
33
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
|
34
|
+
$ClaudeHome = Join-Path $env:USERPROFILE ".claude"
|
|
35
|
+
|
|
36
|
+
if ($Help) {
|
|
37
|
+
Get-Help $MyInvocation.MyCommand.Definition -Detailed
|
|
38
|
+
exit 0
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# ── Try to delegate to bash ────────────────────────────────────
|
|
42
|
+
$BashPaths = @(
|
|
43
|
+
"C:\Program Files\Git\bin\bash.exe",
|
|
44
|
+
"C:\Program Files (x86)\Git\bin\bash.exe",
|
|
45
|
+
(Get-Command bash -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source -ErrorAction SilentlyContinue)
|
|
46
|
+
) | Where-Object { $_ -and (Test-Path $_ -ErrorAction SilentlyContinue) }
|
|
47
|
+
|
|
48
|
+
if ($BashPaths.Count -gt 0) {
|
|
49
|
+
$BashExe = $BashPaths[0]
|
|
50
|
+
Write-Host "[i] Found bash at: $BashExe" -ForegroundColor Cyan
|
|
51
|
+
Write-Host "[i] Delegating to install.sh..." -ForegroundColor Cyan
|
|
52
|
+
|
|
53
|
+
$Args = @()
|
|
54
|
+
if ($DryRun) { $Args += "--dry-run" }
|
|
55
|
+
if ($Force) { $Args += "--force" }
|
|
56
|
+
if ($SkipShell) { $Args += "--skip-shell" }
|
|
57
|
+
if ($SkipECC) { $Args += "--skip-ecc" }
|
|
58
|
+
|
|
59
|
+
$InstallScript = Join-Path $ScriptDir "install.sh"
|
|
60
|
+
& $BashExe $InstallScript @Args
|
|
61
|
+
exit $LASTEXITCODE
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# ── Native PowerShell fallback ─────────────────────────────────
|
|
65
|
+
Write-Host ""
|
|
66
|
+
Write-Host " Claude Power Setup v$Version" -ForegroundColor White
|
|
67
|
+
Write-Host " Multi-agent orchestration + self-improvement" -ForegroundColor Gray
|
|
68
|
+
Write-Host " (PowerShell native mode — bash not found)" -ForegroundColor Yellow
|
|
69
|
+
Write-Host ""
|
|
70
|
+
|
|
71
|
+
if ($DryRun) {
|
|
72
|
+
Write-Host "[!] DRY RUN - no files will be written" -ForegroundColor Yellow
|
|
73
|
+
Write-Host ""
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function Safe-Copy {
|
|
77
|
+
param([string]$Source, [string]$Dest, [string]$Label)
|
|
78
|
+
|
|
79
|
+
if ($DryRun) {
|
|
80
|
+
if ((Test-Path $Dest) -and -not $Force) {
|
|
81
|
+
Write-Host "[i] SKIP (exists): $Label" -ForegroundColor Cyan
|
|
82
|
+
} else {
|
|
83
|
+
Write-Host "[i] WOULD COPY: $Label -> $Dest" -ForegroundColor Cyan
|
|
84
|
+
}
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
$DestDir = Split-Path -Parent $Dest
|
|
89
|
+
if (-not (Test-Path $DestDir)) {
|
|
90
|
+
New-Item -ItemType Directory -Path $DestDir -Force | Out-Null
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if ((Test-Path $Dest) -and -not $Force) {
|
|
94
|
+
Write-Host "[i] Skip (exists): $Label" -ForegroundColor Cyan
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
Copy-Item -Path $Source -Destination $Dest -Force
|
|
99
|
+
Write-Host "[+] Installed: $Label" -ForegroundColor Green
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# ── Install files ──────────────────────────────────────────────
|
|
103
|
+
Write-Host "Installing context profiles..." -ForegroundColor White
|
|
104
|
+
@("dev.md", "orchestrate.md", "review.md", "research.md") | ForEach-Object {
|
|
105
|
+
Safe-Copy (Join-Path $ScriptDir "contexts\$_") (Join-Path $ClaudeHome "contexts\$_") "contexts\$_"
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
Write-Host "`nInstalling orchestration reference..." -ForegroundColor White
|
|
109
|
+
Safe-Copy (Join-Path $ScriptDir "reference\ORCHESTRATION-REFERENCE.md") `
|
|
110
|
+
(Join-Path $ClaudeHome "contexts\ORCHESTRATION-REFERENCE.md") `
|
|
111
|
+
"reference\ORCHESTRATION-REFERENCE.md"
|
|
112
|
+
|
|
113
|
+
Write-Host "`nInstalling automation scripts..." -ForegroundColor White
|
|
114
|
+
Get-ChildItem (Join-Path $ScriptDir "bin\*.sh") | ForEach-Object {
|
|
115
|
+
Safe-Copy $_.FullName (Join-Path $ClaudeHome "bin\$($_.Name)") "bin\$($_.Name)"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Write-Host "`nInstalling learned instincts..." -ForegroundColor White
|
|
119
|
+
$InstinctDir = Join-Path $ClaudeHome "homunculus\instincts\personal"
|
|
120
|
+
if (-not $DryRun) {
|
|
121
|
+
@(
|
|
122
|
+
$InstinctDir,
|
|
123
|
+
(Join-Path $ClaudeHome "homunculus\instincts\inherited"),
|
|
124
|
+
(Join-Path $ClaudeHome "homunculus\evolved\agents"),
|
|
125
|
+
(Join-Path $ClaudeHome "homunculus\evolved\skills"),
|
|
126
|
+
(Join-Path $ClaudeHome "homunculus\evolved\commands"),
|
|
127
|
+
(Join-Path $ClaudeHome "session-data"),
|
|
128
|
+
(Join-Path $ClaudeHome "plans")
|
|
129
|
+
) | ForEach-Object {
|
|
130
|
+
if (-not (Test-Path $_)) { New-Item -ItemType Directory -Path $_ -Force | Out-Null }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
Get-ChildItem (Join-Path $ScriptDir "instincts\*.md") | ForEach-Object {
|
|
134
|
+
Safe-Copy $_.FullName (Join-Path $InstinctDir $_.Name) "instincts\$($_.Name)"
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
# ── Merge env settings ────────────────────────────────────────
|
|
138
|
+
Write-Host "`nConfiguring settings.json..." -ForegroundColor White
|
|
139
|
+
$SettingsFile = Join-Path $ClaudeHome "settings.json"
|
|
140
|
+
$EnvFile = Join-Path $ScriptDir "config\env-settings.json"
|
|
141
|
+
|
|
142
|
+
if (-not $DryRun -and (Test-Path $SettingsFile) -and (Test-Path $EnvFile)) {
|
|
143
|
+
try {
|
|
144
|
+
$Settings = Get-Content $SettingsFile -Raw | ConvertFrom-Json
|
|
145
|
+
$NewEnv = Get-Content $EnvFile -Raw | ConvertFrom-Json
|
|
146
|
+
|
|
147
|
+
if (-not $Settings.env) {
|
|
148
|
+
$Settings | Add-Member -Type NoteProperty -Name "env" -Value ([PSCustomObject]@{})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
$NewEnv.PSObject.Properties | ForEach-Object {
|
|
152
|
+
if (-not $Settings.env.PSObject.Properties[$_.Name]) {
|
|
153
|
+
$Settings.env | Add-Member -Type NoteProperty -Name $_.Name -Value $_.Value
|
|
154
|
+
Write-Host "[+] Added env: $($_.Name)=$($_.Value)" -ForegroundColor Green
|
|
155
|
+
} else {
|
|
156
|
+
Write-Host "[i] Skip env (exists): $($_.Name)" -ForegroundColor Cyan
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
$Settings | ConvertTo-Json -Depth 10 | Set-Content $SettingsFile -Encoding UTF8
|
|
161
|
+
} catch {
|
|
162
|
+
Write-Host "[!] Could not merge env settings: $_" -ForegroundColor Yellow
|
|
163
|
+
}
|
|
164
|
+
} elseif ($DryRun) {
|
|
165
|
+
Write-Host "[i] WOULD MERGE: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS, ECC_HOOK_PROFILE, CLAUDE_CODE_ENABLE_COST_TRACKING" -ForegroundColor Cyan
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
# ── Summary ───────────────────────────────────────────────────
|
|
169
|
+
Write-Host ""
|
|
170
|
+
Write-Host " Installation Complete" -ForegroundColor Green
|
|
171
|
+
Write-Host ""
|
|
172
|
+
Write-Host " Next steps:" -ForegroundColor White
|
|
173
|
+
Write-Host " 1. Open Git Bash and run: source ~/.claude/bin/claude-aliases.sh"
|
|
174
|
+
Write-Host " 2. Open a project and run: claude"
|
|
175
|
+
Write-Host " 3. Try: 'Please use a team of specialists for this'"
|
|
176
|
+
Write-Host ""
|
|
177
|
+
Write-Host " Reference: ~/.claude/contexts/ORCHESTRATION-REFERENCE.md"
|
|
178
|
+
Write-Host ""
|