codecruise 0.1.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/LICENSE +21 -0
- package/README.md +111 -0
- package/bin/codecruise.js +68 -0
- package/config/CLAUDE.md +107 -0
- package/config/agents/analyst.md +48 -0
- package/config/agents/architect-reviewer.md +161 -0
- package/config/agents/architect.md +119 -0
- package/config/agents/critic.md +63 -0
- package/config/agents/developer.md +96 -0
- package/config/agents/devops.md +81 -0
- package/config/agents/orchestrator.md +91 -0
- package/config/agents/planner.md +139 -0
- package/config/agents/retro.md +52 -0
- package/config/agents/reviewer.md +101 -0
- package/config/agents/security-reviewer.md +57 -0
- package/config/agents/stack/expo/AGENT.md +473 -0
- package/config/agents/stack/expo/rules/critical.md +427 -0
- package/config/agents/stack/expo/rules/native.md +455 -0
- package/config/agents/stack/expo/rules/navigation.md +445 -0
- package/config/agents/stack/expo/rules/performance.md +415 -0
- package/config/agents/stack/fastify/AGENT.md +397 -0
- package/config/agents/stack/fastify/rules/api-design.md +283 -0
- package/config/agents/stack/fastify/rules/critical.md +232 -0
- package/config/agents/stack/fastify/rules/queues.md +303 -0
- package/config/agents/stack/fastify/rules/security.md +384 -0
- package/config/agents/stack/index.yaml +48 -0
- package/config/agents/stack/nextjs/AGENT.md +421 -0
- package/config/agents/stack/nextjs/rules/components.md +413 -0
- package/config/agents/stack/nextjs/rules/critical.md +391 -0
- package/config/agents/stack/nextjs/rules/performance.md +403 -0
- package/config/agents/stack/nextjs/rules/styling.md +334 -0
- package/config/agents/stack/shared-ts/AGENT.md +384 -0
- package/config/agents/stack/shared-ts/rules/critical.md +315 -0
- package/config/agents/stack/shared-ts/rules/patterns.md +384 -0
- package/config/agents/stack/shared-ts/rules/zod.md +427 -0
- package/config/agents/tester.md +79 -0
- package/config/commands/architect-discuss.md +366 -0
- package/config/commands/architect-list.md +160 -0
- package/config/commands/architect-review.md +111 -0
- package/config/commands/architect.md +118 -0
- package/config/commands/compact.md +118 -0
- package/config/commands/companion.md +279 -0
- package/config/commands/dashboard.md +152 -0
- package/config/commands/doctor.md +227 -0
- package/config/commands/dogfood-report.md +101 -0
- package/config/commands/flags/run-autonomous.md +110 -0
- package/config/commands/flags/run-pause.md +80 -0
- package/config/commands/ingest.md +173 -0
- package/config/commands/init.md +128 -0
- package/config/commands/metrics.md +87 -0
- package/config/commands/parallel.md +320 -0
- package/config/commands/pause.md +55 -0
- package/config/commands/plan-review.md +130 -0
- package/config/commands/plan.md +216 -0
- package/config/commands/production-check.md +308 -0
- package/config/commands/refine.md +323 -0
- package/config/commands/resume.md +72 -0
- package/config/commands/retro.md +121 -0
- package/config/commands/retry.md +75 -0
- package/config/commands/role.md +310 -0
- package/config/commands/run.md +417 -0
- package/config/commands/scope.md +85 -0
- package/config/commands/setup-permissions.md +104 -0
- package/config/commands/skip.md +75 -0
- package/config/commands/spec-forge.md +213 -0
- package/config/commands/spec-help.md +194 -0
- package/config/commands/spec-patch.md +342 -0
- package/config/commands/spec-resolve.md +110 -0
- package/config/commands/spec-review.md +153 -0
- package/config/commands/status.md +114 -0
- package/config/commands/sync.md +131 -0
- package/config/commands/task.md +138 -0
- package/config/commands/verify.md +124 -0
- package/config/hooks/README.md +632 -0
- package/config/hooks/activity-log.sh +187 -0
- package/config/hooks/anti-rationalize.sh +52 -0
- package/config/hooks/capture-verification.sh +112 -0
- package/config/hooks/collect-metrics.sh +135 -0
- package/config/hooks/enforce-file-scope.sh +75 -0
- package/config/hooks/enforce-state-machine.sh +161 -0
- package/config/hooks/enforce-tdd.sh +180 -0
- package/config/hooks/format.sh +40 -0
- package/config/hooks/lib/activity-helpers.sh +162 -0
- package/config/hooks/lib/read-settings.sh +71 -0
- package/config/hooks/load-context-skills.sh +95 -0
- package/config/hooks/notify.sh +81 -0
- package/config/hooks/pre-commit.sample +35 -0
- package/config/hooks/protect-files.sh +63 -0
- package/config/hooks/track-agents.sh +41 -0
- package/config/hooks/track-commands.sh +37 -0
- package/config/hooks/track-enforcement.sh +44 -0
- package/config/hooks/track-ooda.sh +77 -0
- package/config/hooks/validate-commit-msg.sh +35 -0
- package/config/hooks/validate-plan.sh +213 -0
- package/config/hooks/verify-criteria.sh +46 -0
- package/config/hooks/verify-todo-completion.sh +140 -0
- package/config/rules/comments.md +25 -0
- package/config/rules/decision-rules.md +308 -0
- package/config/rules/hygiene.md +247 -0
- package/config/rules/pattern-detection.md +372 -0
- package/config/rules/profiles.md +193 -0
- package/config/rules/recovery.md +83 -0
- package/config/rules/scope-detection.md +213 -0
- package/config/rules/standards.md +127 -0
- package/config/rules/workflow.md +121 -0
- package/config/schemas.md +767 -0
- package/config/settings.json +195 -0
- package/config/skills/backend/SKILL.md +734 -0
- package/config/skills/database/SKILL.md +426 -0
- package/config/skills/frontend/SKILL.md +434 -0
- package/config/skills/git/SKILL.md +396 -0
- package/config/skills/index.yaml +36 -0
- package/config/skills/observability/SKILL.md +430 -0
- package/config/skills/package-dev/SKILL.md +498 -0
- package/config/skills/performance/SKILL.md +378 -0
- package/config/skills/resilience/SKILL.md +573 -0
- package/config/skills/testing/SKILL.md +398 -0
- package/config/skills/testing-patterns/SKILL.md +276 -0
- package/config/skills/typescript/SKILL.md +152 -0
- package/config/templates/CLAUDE.md +70 -0
- package/config/templates/README.md +117 -0
- package/config/templates/steering/adr-template.md +102 -0
- package/config/templates/steering/product.md +60 -0
- package/config/templates/steering/rfc-template.md +159 -0
- package/config/templates/steering/structure.md +146 -0
- package/config/templates/steering/tech.md +85 -0
- package/package.json +40 -0
- package/src/install.js +163 -0
- package/src/report.js +310 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Project Structure
|
|
2
|
+
|
|
3
|
+
> Architecture, patterns, and conventions.
|
|
4
|
+
|
|
5
|
+
## System Context (C4 Level 1)
|
|
6
|
+
|
|
7
|
+
<!-- How does this system fit in the larger ecosystem? -->
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ [Users/Actors] │
|
|
12
|
+
│ │ │
|
|
13
|
+
│ ▼ │
|
|
14
|
+
│ ┌─────────────┐ │
|
|
15
|
+
│ │ {System} │ │
|
|
16
|
+
│ └─────────────┘ │
|
|
17
|
+
│ │ │
|
|
18
|
+
│ ┌───────────┼───────────┐ │
|
|
19
|
+
│ ▼ ▼ ▼ │
|
|
20
|
+
│ [External] [External] [External] │
|
|
21
|
+
│ [System 1] [System 2] [System 3] │
|
|
22
|
+
└─────────────────────────────────────────────────────────────┘
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Container Diagram (C4 Level 2)
|
|
26
|
+
|
|
27
|
+
<!-- Major deployable units -->
|
|
28
|
+
|
|
29
|
+
| Container | Technology | Purpose |
|
|
30
|
+
|-----------|------------|---------|
|
|
31
|
+
| | | |
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
35
|
+
│ {System Name} │
|
|
36
|
+
├─────────────────────────────────────────────────────────────┤
|
|
37
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
38
|
+
│ │ Web App │───▶│ API │───▶│ Database │ │
|
|
39
|
+
│ │ (React) │ │ (Node) │ │ (Postgres)│ │
|
|
40
|
+
│ └──────────┘ └──────────┘ └──────────┘ │
|
|
41
|
+
└─────────────────────────────────────────────────────────────┘
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Directory Structure
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
{project}/
|
|
48
|
+
├── src/
|
|
49
|
+
│ ├── {layer}/ # {description}
|
|
50
|
+
│ ├── {layer}/ # {description}
|
|
51
|
+
│ └── {layer}/ # {description}
|
|
52
|
+
├── tests/
|
|
53
|
+
│ ├── unit/
|
|
54
|
+
│ └── integration/
|
|
55
|
+
├── docs/
|
|
56
|
+
│ ├── canon/ # Canonical spec (spec.md, issues.md)
|
|
57
|
+
│ ├── context/ # Per-feature context
|
|
58
|
+
│ └── steering/ # This file, product.md, tech.md
|
|
59
|
+
├── roadmap/ # Phase/feature/TODO definitions
|
|
60
|
+
└── {config files}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Architectural Patterns
|
|
64
|
+
|
|
65
|
+
<!-- List patterns used and where -->
|
|
66
|
+
|
|
67
|
+
| Pattern | Where Used | Example |
|
|
68
|
+
|---------|------------|---------|
|
|
69
|
+
| | | |
|
|
70
|
+
|
|
71
|
+
## Naming Conventions
|
|
72
|
+
|
|
73
|
+
| Element | Convention | Example |
|
|
74
|
+
|---------|------------|---------|
|
|
75
|
+
| Files | | |
|
|
76
|
+
| Components | | |
|
|
77
|
+
| Functions | | |
|
|
78
|
+
| Variables | | |
|
|
79
|
+
| Constants | | |
|
|
80
|
+
| Types/Interfaces | | |
|
|
81
|
+
| CSS Classes | | |
|
|
82
|
+
| Database Tables | | |
|
|
83
|
+
| API Endpoints | | |
|
|
84
|
+
|
|
85
|
+
## Import Order
|
|
86
|
+
|
|
87
|
+
<!-- Specify import ordering for consistency -->
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// 1. External packages
|
|
91
|
+
import React from 'react';
|
|
92
|
+
|
|
93
|
+
// 2. Internal packages (monorepo)
|
|
94
|
+
import { Button } from '@myorg/ui';
|
|
95
|
+
|
|
96
|
+
// 3. Relative imports (parent)
|
|
97
|
+
import { utils } from '../utils';
|
|
98
|
+
|
|
99
|
+
// 4. Relative imports (sibling/child)
|
|
100
|
+
import { Component } from './Component';
|
|
101
|
+
|
|
102
|
+
// 5. Types (if separate)
|
|
103
|
+
import type { Props } from './types';
|
|
104
|
+
|
|
105
|
+
// 6. Styles
|
|
106
|
+
import './styles.css';
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Module Boundaries
|
|
110
|
+
|
|
111
|
+
<!-- What can import what? -->
|
|
112
|
+
|
|
113
|
+
| Module | Can Import | Cannot Import |
|
|
114
|
+
|--------|------------|---------------|
|
|
115
|
+
| | | |
|
|
116
|
+
|
|
117
|
+
## Error Handling
|
|
118
|
+
|
|
119
|
+
<!-- Standard error handling patterns -->
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// Example pattern
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Logging
|
|
126
|
+
|
|
127
|
+
<!-- Logging conventions -->
|
|
128
|
+
|
|
129
|
+
| Level | When to Use | Example |
|
|
130
|
+
|-------|-------------|---------|
|
|
131
|
+
| error | | |
|
|
132
|
+
| warn | | |
|
|
133
|
+
| info | | |
|
|
134
|
+
| debug | | |
|
|
135
|
+
|
|
136
|
+
## Testing Strategy
|
|
137
|
+
|
|
138
|
+
| Type | Location | Naming | Coverage Target |
|
|
139
|
+
|------|----------|--------|-----------------|
|
|
140
|
+
| Unit | | | |
|
|
141
|
+
| Integration | | | |
|
|
142
|
+
| E2E | | | |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
*Last updated: {date}*
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Tech Stack
|
|
2
|
+
|
|
3
|
+
> Languages, frameworks, tools, and constraints.
|
|
4
|
+
|
|
5
|
+
## Core Stack
|
|
6
|
+
|
|
7
|
+
| Layer | Technology | Version | Rationale |
|
|
8
|
+
|-------|------------|---------|-----------|
|
|
9
|
+
| Language | | | |
|
|
10
|
+
| Runtime | | | |
|
|
11
|
+
| Framework | | | |
|
|
12
|
+
| Database | | | |
|
|
13
|
+
| Cache | | | |
|
|
14
|
+
| Queue | | | |
|
|
15
|
+
|
|
16
|
+
## Package Manager
|
|
17
|
+
|
|
18
|
+
<!-- Critical for AI agents to know -->
|
|
19
|
+
```
|
|
20
|
+
{npm|pnpm|yarn|bun} {version}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Key Dependencies
|
|
24
|
+
|
|
25
|
+
<!-- Only list non-obvious or opinionated choices -->
|
|
26
|
+
|
|
27
|
+
| Package | Purpose | Why This One |
|
|
28
|
+
|---------|---------|--------------|
|
|
29
|
+
| | | |
|
|
30
|
+
|
|
31
|
+
## Dev Tools
|
|
32
|
+
|
|
33
|
+
| Tool | Purpose | Command |
|
|
34
|
+
|------|---------|---------|
|
|
35
|
+
| Linter | | `{command}` |
|
|
36
|
+
| Formatter | | `{command}` |
|
|
37
|
+
| Type Checker | | `{command}` |
|
|
38
|
+
| Test Runner | | `{command}` |
|
|
39
|
+
| Build | | `{command}` |
|
|
40
|
+
|
|
41
|
+
## Quality Command
|
|
42
|
+
|
|
43
|
+
<!-- Single command that validates code quality. Must be <10s. -->
|
|
44
|
+
```bash
|
|
45
|
+
{quality_command}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Environment
|
|
49
|
+
|
|
50
|
+
| Variable | Purpose | Example |
|
|
51
|
+
|----------|---------|---------|
|
|
52
|
+
| | | |
|
|
53
|
+
|
|
54
|
+
## External Services
|
|
55
|
+
|
|
56
|
+
| Service | Purpose | Auth Method |
|
|
57
|
+
|---------|---------|-------------|
|
|
58
|
+
| | | |
|
|
59
|
+
|
|
60
|
+
## Constraints
|
|
61
|
+
|
|
62
|
+
<!-- Technical limitations or requirements -->
|
|
63
|
+
|
|
64
|
+
- **Browser Support**: {e.g., "Last 2 versions, no IE"}
|
|
65
|
+
- **Node Version**: {e.g., ">=20"}
|
|
66
|
+
- **Performance**: {e.g., "First contentful paint <2s"}
|
|
67
|
+
- **Bundle Size**: {e.g., "Main bundle <200KB gzipped"}
|
|
68
|
+
|
|
69
|
+
## Security Requirements
|
|
70
|
+
|
|
71
|
+
- [ ] No secrets in code/logs/commits
|
|
72
|
+
- [ ] {project-specific requirement}
|
|
73
|
+
- [ ] {project-specific requirement}
|
|
74
|
+
|
|
75
|
+
## Deployment
|
|
76
|
+
|
|
77
|
+
| Environment | Platform | URL |
|
|
78
|
+
|-------------|----------|-----|
|
|
79
|
+
| Development | | |
|
|
80
|
+
| Staging | | |
|
|
81
|
+
| Production | | |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
*Last updated: {date}*
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codecruise",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Autonomous code execution on cruise control - A workflow system for Claude Code",
|
|
5
|
+
"author": "Mateeq Azam",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"codecruise": "./bin/codecruise.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./bin/codecruise.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/",
|
|
16
|
+
"src/",
|
|
17
|
+
"config/"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepublishOnly": "node --check bin/codecruise.js && node --check src/install.js"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"claude",
|
|
24
|
+
"claude-code",
|
|
25
|
+
"ai",
|
|
26
|
+
"coding-assistant",
|
|
27
|
+
"autonomous",
|
|
28
|
+
"tdd",
|
|
29
|
+
"workflow"
|
|
30
|
+
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/mateeqazam/codecruise.git"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/mateeqazam/codecruise#readme",
|
|
36
|
+
"bugs": "https://github.com/mateeqazam/codecruise/issues",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/src/install.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* codecruise install - Copy config to ~/.claude/
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { createInterface } from 'readline';
|
|
6
|
+
import { existsSync, mkdirSync, cpSync, readdirSync, renameSync, statSync, chmodSync, rmSync } from 'fs';
|
|
7
|
+
import { join, dirname } from 'path';
|
|
8
|
+
import { homedir } from 'os';
|
|
9
|
+
import { execSync } from 'child_process';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
|
|
15
|
+
const CLAUDE_DIR = join(homedir(), '.claude');
|
|
16
|
+
const CONFIG_SOURCE = join(__dirname, '..', 'config');
|
|
17
|
+
|
|
18
|
+
function confirm(question) {
|
|
19
|
+
const rl = createInterface({
|
|
20
|
+
input: process.stdin,
|
|
21
|
+
output: process.stdout,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return new Promise((resolve) => {
|
|
25
|
+
rl.question(`${question} [y/N] `, (answer) => {
|
|
26
|
+
rl.close();
|
|
27
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function checkClaudeCli() {
|
|
33
|
+
try {
|
|
34
|
+
execSync('claude --version', { stdio: 'pipe' });
|
|
35
|
+
return true;
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function hasContent(dir) {
|
|
42
|
+
if (!existsSync(dir)) return false;
|
|
43
|
+
try {
|
|
44
|
+
return readdirSync(dir).length > 0;
|
|
45
|
+
} catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getBackupDirName() {
|
|
51
|
+
const timestamp = new Date().toISOString()
|
|
52
|
+
.replace(/[:.]/g, '-')
|
|
53
|
+
.replace('T', '_')
|
|
54
|
+
.slice(0, 19);
|
|
55
|
+
return `${CLAUDE_DIR}-backup-${timestamp}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function countFiles(dir) {
|
|
59
|
+
let count = 0;
|
|
60
|
+
for (const item of readdirSync(dir)) {
|
|
61
|
+
const fullPath = join(dir, item);
|
|
62
|
+
if (statSync(fullPath).isDirectory()) {
|
|
63
|
+
count += countFiles(fullPath);
|
|
64
|
+
} else {
|
|
65
|
+
count++;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return count;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function makeExecutable(dir) {
|
|
72
|
+
if (!existsSync(dir)) return;
|
|
73
|
+
for (const item of readdirSync(dir)) {
|
|
74
|
+
const fullPath = join(dir, item);
|
|
75
|
+
if (statSync(fullPath).isDirectory()) {
|
|
76
|
+
makeExecutable(fullPath);
|
|
77
|
+
} else if (item.endsWith('.sh')) {
|
|
78
|
+
chmodSync(fullPath, 0o755);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function runInstall() {
|
|
84
|
+
console.log(`
|
|
85
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
86
|
+
║ codecruise install ║
|
|
87
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
88
|
+
`);
|
|
89
|
+
|
|
90
|
+
// Check Claude CLI
|
|
91
|
+
if (!checkClaudeCli()) {
|
|
92
|
+
console.log('✗ Claude CLI not found\n');
|
|
93
|
+
console.log('Install Claude CLI first:');
|
|
94
|
+
console.log(' npm install -g @anthropic-ai/claude-code\n');
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
console.log('✓ Claude CLI found\n');
|
|
98
|
+
|
|
99
|
+
// Backup if exists
|
|
100
|
+
let backupDir = null;
|
|
101
|
+
if (hasContent(CLAUDE_DIR)) {
|
|
102
|
+
console.log('~/.claude/ exists. This will replace it.');
|
|
103
|
+
console.log('Your existing config will be backed up.\n');
|
|
104
|
+
|
|
105
|
+
if (!await confirm('Continue?')) {
|
|
106
|
+
console.log('\nCancelled.');
|
|
107
|
+
process.exit(0);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
backupDir = getBackupDirName();
|
|
111
|
+
renameSync(CLAUDE_DIR, backupDir);
|
|
112
|
+
console.log(`\n✓ Backed up to ${backupDir}\n`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Copy
|
|
116
|
+
if (!existsSync(CONFIG_SOURCE)) {
|
|
117
|
+
console.log(`✗ Config not found: ${CONFIG_SOURCE}`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
cpSync(CONFIG_SOURCE, CLAUDE_DIR, { recursive: true });
|
|
125
|
+
makeExecutable(join(CLAUDE_DIR, 'hooks'));
|
|
126
|
+
} catch (err) {
|
|
127
|
+
console.error(`\n✗ Failed to copy config: ${err.message}`);
|
|
128
|
+
|
|
129
|
+
// Restore backup if we had one
|
|
130
|
+
if (backupDir && existsSync(backupDir)) {
|
|
131
|
+
console.log('Restoring backup...');
|
|
132
|
+
rmSync(CLAUDE_DIR, { recursive: true, force: true });
|
|
133
|
+
renameSync(backupDir, CLAUDE_DIR);
|
|
134
|
+
console.log('✓ Backup restored\n');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Summary
|
|
141
|
+
console.log('Installed:\n');
|
|
142
|
+
for (const dir of ['commands', 'hooks', 'agents', 'rules', 'skills']) {
|
|
143
|
+
const dirPath = join(CLAUDE_DIR, dir);
|
|
144
|
+
if (existsSync(dirPath)) {
|
|
145
|
+
console.log(` ✓ ${dir}/ (${countFiles(dirPath)} files)`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
console.log(`
|
|
150
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
151
|
+
║ ✓ Installed! ║
|
|
152
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
153
|
+
║ Next: ║
|
|
154
|
+
║ cd your-project ║
|
|
155
|
+
║ claude ║
|
|
156
|
+
║ /init ║
|
|
157
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
158
|
+
`);
|
|
159
|
+
|
|
160
|
+
if (backupDir) {
|
|
161
|
+
console.log(`Backup: ${backupDir}\n`);
|
|
162
|
+
}
|
|
163
|
+
}
|