ai-eng-system 0.0.5 → 0.0.6
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/dist/.claude-plugin/commands/clean.md +39 -4
- package/dist/.claude-plugin/commands/optimize.md +49 -5
- package/dist/.claude-plugin/marketplace.json +1 -1
- package/dist/.claude-plugin/plugin.json +2 -5
- package/dist/.opencode/command/ai-eng/clean.md +39 -4
- package/dist/.opencode/command/ai-eng/optimize.md +49 -5
- package/dist/.opencode/opencode.jsonc +1 -4
- package/package.json +3 -1
- package/scripts/AGENTS.md +49 -0
- package/scripts/install.js +153 -0
- package/scripts/setup-swarms.js +264 -0
- package/dist/.claude-plugin/commands/clean-comments.md +0 -280
- package/dist/.claude-plugin/commands/clean-docs.md +0 -309
- package/dist/.claude-plugin/commands/clean-slop.md +0 -234
- package/dist/.opencode/command/ai-eng/clean-comments.md +0 -280
- package/dist/.opencode/command/ai-eng/clean-docs.md +0 -309
- package/dist/.opencode/command/ai-eng/clean-slop.md +0 -234
|
@@ -11,10 +11,45 @@ Router command for removing AI-generated verbosity and redundancy from various c
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
/clean
|
|
15
|
-
/clean
|
|
16
|
-
/clean
|
|
17
|
-
/clean
|
|
14
|
+
/clean --help # Show help and available types
|
|
15
|
+
/clean <content-or-file> # Auto-detect and clean content
|
|
16
|
+
/clean <content> --slop # Remove AI filler patterns
|
|
17
|
+
/clean <file-or-dir> --comments # Optimize code comments (recursive)
|
|
18
|
+
/clean <file-or-dir> --docs # Clean documentation (recursive)
|
|
19
|
+
/clean <content> --type=<type> # Explicit type flag
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Help
|
|
23
|
+
|
|
24
|
+
When `--help` is passed, display:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
CLEAN COMMAND - Remove AI-generated verbosity
|
|
28
|
+
|
|
29
|
+
USAGE:
|
|
30
|
+
/clean <content-or-file> [--type] Auto-detect and clean content
|
|
31
|
+
/clean <content> --slop Remove AI conversational filler
|
|
32
|
+
/clean <path> --comments Optimize code comments (recursive)
|
|
33
|
+
/clean <path> --docs Clean documentation verbosity (recursive)
|
|
34
|
+
|
|
35
|
+
TYPES:
|
|
36
|
+
--slop AI filler: "Certainly!", "I'd be happy to help", hedging
|
|
37
|
+
--comments Code comments: redundant, verbose, obvious explanations
|
|
38
|
+
--docs Documentation: conversational tone, excessive politeness
|
|
39
|
+
--all Apply all cleanup techniques
|
|
40
|
+
|
|
41
|
+
OPTIONS:
|
|
42
|
+
-m, --mode Aggressiveness: conservative | moderate | aggressive
|
|
43
|
+
-p, --preview Show changes without applying
|
|
44
|
+
-a, --apply Apply confirmed changes
|
|
45
|
+
-v, --verbose Show detailed analysis
|
|
46
|
+
--help Show this help
|
|
47
|
+
|
|
48
|
+
EXAMPLES:
|
|
49
|
+
/clean "Certainly! I'd be happy to help..." --slop --preview
|
|
50
|
+
/clean src/ --comments --apply
|
|
51
|
+
/clean docs/README.md --docs --mode=aggressive
|
|
52
|
+
/clean ./docs --docs --recursive
|
|
18
53
|
```
|
|
19
54
|
|
|
20
55
|
## Types
|
|
@@ -11,11 +11,55 @@ Interactive optimization tool that enhances content using research-backed techni
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
/optimize
|
|
15
|
-
/optimize
|
|
16
|
-
/optimize
|
|
17
|
-
/optimize
|
|
18
|
-
/optimize
|
|
14
|
+
/optimize --help # Show help and available types
|
|
15
|
+
/optimize <content-or-file> # Auto-detect type and optimize
|
|
16
|
+
/optimize <content> --prompt # Optimize AI prompts
|
|
17
|
+
/optimize <content> --query # Enhance database/search queries
|
|
18
|
+
/optimize <content> --code # Improve code quality
|
|
19
|
+
/optimize <content> --commit # Optimize commit messages
|
|
20
|
+
/optimize <content> --docs # Enhance documentation
|
|
21
|
+
/optimize <content> --email # Improve communication
|
|
22
|
+
/optimize <content> --type=<type> # Explicit type flag
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Help
|
|
26
|
+
|
|
27
|
+
When `--help` is passed, display:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
OPTIMIZE COMMAND - Enhance content using research-backed techniques
|
|
31
|
+
|
|
32
|
+
USAGE:
|
|
33
|
+
/optimize <content-or-file> [--type] Auto-detect and optimize content
|
|
34
|
+
/optimize <content> --prompt Optimize AI prompts
|
|
35
|
+
/optimize <content> --query Enhance database/search queries
|
|
36
|
+
/optimize <content> --code Improve code quality
|
|
37
|
+
/optimize <content> --commit Optimize commit messages
|
|
38
|
+
/optimize <content> --docs Enhance documentation
|
|
39
|
+
/optimize <content> --email Improve communication
|
|
40
|
+
|
|
41
|
+
TYPES:
|
|
42
|
+
--prompt AI prompts: structure, personas, reasoning chains
|
|
43
|
+
--query Database/search: indexes, execution plans, caching
|
|
44
|
+
--code Source code: performance, readability, error handling
|
|
45
|
+
--commit Git messages: clarity, conventional format
|
|
46
|
+
--docs Documentation: structure, examples, clarity
|
|
47
|
+
--email Communication: tone, clarity, call-to-action
|
|
48
|
+
|
|
49
|
+
OPTIONS:
|
|
50
|
+
-m, --mode Approach: conservative | moderate | aggressive
|
|
51
|
+
-p, --preview Show changes without applying
|
|
52
|
+
-a, --apply Apply confirmed optimizations
|
|
53
|
+
-i, --interactive Enable clarifying questions
|
|
54
|
+
-s, --source Research sources: anthropic | openai | opencode | all
|
|
55
|
+
-v, --verbose Show detailed process
|
|
56
|
+
--help Show this help
|
|
57
|
+
|
|
58
|
+
EXAMPLES:
|
|
59
|
+
/optimize "Help me debug auth" --prompt --interactive
|
|
60
|
+
/optimize "SELECT * FROM users" --query --preview
|
|
61
|
+
/optimize src/auth.js --code --apply
|
|
62
|
+
/optimize "fix: resolve login bug" --commit
|
|
19
63
|
```
|
|
20
64
|
|
|
21
65
|
## Types
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"name": "ai-eng-system",
|
|
15
15
|
"source": "./plugins/ai-eng-system",
|
|
16
16
|
"description": "AI Engineering System with context engineering, research orchestration, 15 commands, 29 specialized agents, and 4 skill packs for Claude Code & OpenCode",
|
|
17
|
-
|
|
17
|
+
"version": "0.0.6",
|
|
18
18
|
"author": {
|
|
19
19
|
"name": "v1truv1us",
|
|
20
20
|
"email": "contact@v1truv1us.dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-eng-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "AI Engineering System with context engineering and research orchestration for Claude Code",
|
|
5
5
|
"author": "v1truv1us",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,9 +20,6 @@
|
|
|
20
20
|
"./commands/plan.md",
|
|
21
21
|
"./commands/research.md",
|
|
22
22
|
"./commands/review.md",
|
|
23
|
-
"./commands/clean.md"
|
|
24
|
-
"./commands/clean-slop.md",
|
|
25
|
-
"./commands/clean-comments.md",
|
|
26
|
-
"./commands/clean-docs.md"
|
|
23
|
+
"./commands/clean.md"
|
|
27
24
|
]
|
|
28
25
|
}
|
|
@@ -11,10 +11,45 @@ Router command for removing AI-generated verbosity and redundancy from various c
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
/clean
|
|
15
|
-
/clean
|
|
16
|
-
/clean
|
|
17
|
-
/clean
|
|
14
|
+
/clean --help # Show help and available types
|
|
15
|
+
/clean <content-or-file> # Auto-detect and clean content
|
|
16
|
+
/clean <content> --slop # Remove AI filler patterns
|
|
17
|
+
/clean <file-or-dir> --comments # Optimize code comments (recursive)
|
|
18
|
+
/clean <file-or-dir> --docs # Clean documentation (recursive)
|
|
19
|
+
/clean <content> --type=<type> # Explicit type flag
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Help
|
|
23
|
+
|
|
24
|
+
When `--help` is passed, display:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
CLEAN COMMAND - Remove AI-generated verbosity
|
|
28
|
+
|
|
29
|
+
USAGE:
|
|
30
|
+
/clean <content-or-file> [--type] Auto-detect and clean content
|
|
31
|
+
/clean <content> --slop Remove AI conversational filler
|
|
32
|
+
/clean <path> --comments Optimize code comments (recursive)
|
|
33
|
+
/clean <path> --docs Clean documentation verbosity (recursive)
|
|
34
|
+
|
|
35
|
+
TYPES:
|
|
36
|
+
--slop AI filler: "Certainly!", "I'd be happy to help", hedging
|
|
37
|
+
--comments Code comments: redundant, verbose, obvious explanations
|
|
38
|
+
--docs Documentation: conversational tone, excessive politeness
|
|
39
|
+
--all Apply all cleanup techniques
|
|
40
|
+
|
|
41
|
+
OPTIONS:
|
|
42
|
+
-m, --mode Aggressiveness: conservative | moderate | aggressive
|
|
43
|
+
-p, --preview Show changes without applying
|
|
44
|
+
-a, --apply Apply confirmed changes
|
|
45
|
+
-v, --verbose Show detailed analysis
|
|
46
|
+
--help Show this help
|
|
47
|
+
|
|
48
|
+
EXAMPLES:
|
|
49
|
+
/clean "Certainly! I'd be happy to help..." --slop --preview
|
|
50
|
+
/clean src/ --comments --apply
|
|
51
|
+
/clean docs/README.md --docs --mode=aggressive
|
|
52
|
+
/clean ./docs --docs --recursive
|
|
18
53
|
```
|
|
19
54
|
|
|
20
55
|
## Types
|
|
@@ -11,11 +11,55 @@ Interactive optimization tool that enhances content using research-backed techni
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
/optimize
|
|
15
|
-
/optimize
|
|
16
|
-
/optimize
|
|
17
|
-
/optimize
|
|
18
|
-
/optimize
|
|
14
|
+
/optimize --help # Show help and available types
|
|
15
|
+
/optimize <content-or-file> # Auto-detect type and optimize
|
|
16
|
+
/optimize <content> --prompt # Optimize AI prompts
|
|
17
|
+
/optimize <content> --query # Enhance database/search queries
|
|
18
|
+
/optimize <content> --code # Improve code quality
|
|
19
|
+
/optimize <content> --commit # Optimize commit messages
|
|
20
|
+
/optimize <content> --docs # Enhance documentation
|
|
21
|
+
/optimize <content> --email # Improve communication
|
|
22
|
+
/optimize <content> --type=<type> # Explicit type flag
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Help
|
|
26
|
+
|
|
27
|
+
When `--help` is passed, display:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
OPTIMIZE COMMAND - Enhance content using research-backed techniques
|
|
31
|
+
|
|
32
|
+
USAGE:
|
|
33
|
+
/optimize <content-or-file> [--type] Auto-detect and optimize content
|
|
34
|
+
/optimize <content> --prompt Optimize AI prompts
|
|
35
|
+
/optimize <content> --query Enhance database/search queries
|
|
36
|
+
/optimize <content> --code Improve code quality
|
|
37
|
+
/optimize <content> --commit Optimize commit messages
|
|
38
|
+
/optimize <content> --docs Enhance documentation
|
|
39
|
+
/optimize <content> --email Improve communication
|
|
40
|
+
|
|
41
|
+
TYPES:
|
|
42
|
+
--prompt AI prompts: structure, personas, reasoning chains
|
|
43
|
+
--query Database/search: indexes, execution plans, caching
|
|
44
|
+
--code Source code: performance, readability, error handling
|
|
45
|
+
--commit Git messages: clarity, conventional format
|
|
46
|
+
--docs Documentation: structure, examples, clarity
|
|
47
|
+
--email Communication: tone, clarity, call-to-action
|
|
48
|
+
|
|
49
|
+
OPTIONS:
|
|
50
|
+
-m, --mode Approach: conservative | moderate | aggressive
|
|
51
|
+
-p, --preview Show changes without applying
|
|
52
|
+
-a, --apply Apply confirmed optimizations
|
|
53
|
+
-i, --interactive Enable clarifying questions
|
|
54
|
+
-s, --source Research sources: anthropic | openai | opencode | all
|
|
55
|
+
-v, --verbose Show detailed process
|
|
56
|
+
--help Show this help
|
|
57
|
+
|
|
58
|
+
EXAMPLES:
|
|
59
|
+
/optimize "Help me debug auth" --prompt --interactive
|
|
60
|
+
/optimize "SELECT * FROM users" --query --preview
|
|
61
|
+
/optimize src/auth.js --code --apply
|
|
62
|
+
/optimize "fix: resolve login bug" --commit
|
|
19
63
|
```
|
|
20
64
|
|
|
21
65
|
## Types
|
|
@@ -2,8 +2,5 @@
|
|
|
2
2
|
"$schema": "https://opencode.ai/config.json",
|
|
3
3
|
|
|
4
4
|
// AI Engineering System configuration
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// Commands and agents are provided by markdown config under:
|
|
8
|
-
// .opencode/command and .opencode/agent in the built distribution.
|
|
5
|
+
// Plugins are auto-loaded from .opencode/plugin/ directory
|
|
9
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-eng-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Compounding engineering system for Claude Code and OpenCode. Shared agents, commands, skills, and plugin development tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist/",
|
|
16
|
+
"scripts/",
|
|
16
17
|
"index.js",
|
|
17
18
|
"index.d.ts",
|
|
18
19
|
"README.md",
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
"typecheck": "tsc --noEmit",
|
|
27
28
|
"typecheck:plugin": "tsc -p tsconfig.plugin.json",
|
|
28
29
|
"prepublishOnly": "bun build.ts",
|
|
30
|
+
"postinstall": "node scripts/install.js --global",
|
|
29
31
|
"test": "bun test tests/build.test.ts"
|
|
30
32
|
},
|
|
31
33
|
"publishConfig": {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Scripts Context
|
|
2
|
+
|
|
3
|
+
**Hierarchy Level:** Build automation and deployment utilities
|
|
4
|
+
**Parent:** [../AGENTS.md](../AGENTS.md) — Agent coordination
|
|
5
|
+
**Philosophy:** [../CLAUDE.md](../CLAUDE.md) — Compounding Engineering philosophy
|
|
6
|
+
|
|
7
|
+
Build scripts and installation utilities that support the agent infrastructure defined in AGENTS.md.
|
|
8
|
+
|
|
9
|
+
## Project Overview
|
|
10
|
+
Build and installation utilities for the Ferg Engineering System.
|
|
11
|
+
|
|
12
|
+
## Technology Stack
|
|
13
|
+
- **Runtime**: Bun (ES modules)
|
|
14
|
+
- **Language**: JavaScript/TypeScript
|
|
15
|
+
- **Shebang**: `#!/usr/bin/env bun`
|
|
16
|
+
|
|
17
|
+
## Build Commands
|
|
18
|
+
```bash
|
|
19
|
+
# Main build process
|
|
20
|
+
bun run build
|
|
21
|
+
|
|
22
|
+
# Watch mode for development
|
|
23
|
+
bun run build:watch
|
|
24
|
+
|
|
25
|
+
# Clean build artifacts
|
|
26
|
+
bun run clean
|
|
27
|
+
|
|
28
|
+
# Validate build
|
|
29
|
+
bun run validate
|
|
30
|
+
|
|
31
|
+
# Installation scripts
|
|
32
|
+
bun scripts/install.js --global # Global installation
|
|
33
|
+
bun scripts/install.js --local # Local installation
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Code Style
|
|
37
|
+
- Use ES modules (`import`/`export`)
|
|
38
|
+
- Follow Bun best practices
|
|
39
|
+
- Include proper shebang for executable scripts
|
|
40
|
+
- Use JSDoc comments for documentation
|
|
41
|
+
|
|
42
|
+
## Key Files
|
|
43
|
+
- `install.js` - Main installation script (global/local support)
|
|
44
|
+
- `build.ts` - TypeScript build configuration (in root)
|
|
45
|
+
|
|
46
|
+
## Integration Notes
|
|
47
|
+
- Scripts integrate with package.json build pipeline
|
|
48
|
+
- Must support both global and local OpenCode installation
|
|
49
|
+
- Handle dependency resolution and file copying
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AI Engineering System Installation Script (OpenCode)
|
|
5
|
+
*
|
|
6
|
+
* Installs the pre-built OpenCode distribution (dist/.opencode + dist/skills)
|
|
7
|
+
* into either:
|
|
8
|
+
* - global: ~/.config/opencode (default)
|
|
9
|
+
* - local: ./.opencode (in the target project)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import fs from 'fs'
|
|
13
|
+
import path from 'path'
|
|
14
|
+
import { fileURLToPath } from 'url'
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
17
|
+
const __dirname = path.dirname(__filename)
|
|
18
|
+
const packageRoot = path.dirname(__dirname)
|
|
19
|
+
|
|
20
|
+
// Namespace configuration for OpenCode installations
|
|
21
|
+
const NAMESPACE_PREFIX = 'ai-eng'
|
|
22
|
+
|
|
23
|
+
function printUsage(exitCode = 1) {
|
|
24
|
+
console.log('AI Engineering System Installer (OpenCode)')
|
|
25
|
+
console.log('========================================\n')
|
|
26
|
+
console.log('Usage:')
|
|
27
|
+
console.log(' bun scripts/install.js # Install globally to ~/.config/opencode (default)')
|
|
28
|
+
console.log(' bun scripts/install.js --global # Install globally to ~/.config/opencode')
|
|
29
|
+
console.log(' bun scripts/install.js --local # Install locally to ./.opencode (in current dir)')
|
|
30
|
+
process.exit(exitCode)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function parseArgs(argv) {
|
|
34
|
+
const args = argv.slice(2)
|
|
35
|
+
|
|
36
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
37
|
+
printUsage(0)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const allowed = new Set(['--global', '--local', '--help', '-h'])
|
|
41
|
+
|
|
42
|
+
for (const a of args) {
|
|
43
|
+
if (!allowed.has(a)) {
|
|
44
|
+
console.error(`Unknown flag: ${a}`)
|
|
45
|
+
printUsage(1)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const wantsGlobal = args.includes('--global')
|
|
50
|
+
const wantsLocal = args.includes('--local')
|
|
51
|
+
|
|
52
|
+
if (wantsGlobal && wantsLocal) {
|
|
53
|
+
console.error('Cannot use both --global and --local')
|
|
54
|
+
printUsage(1)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// If no args specified, check if we're running during npm install
|
|
58
|
+
if (!wantsGlobal && !wantsLocal) {
|
|
59
|
+
const isPostInstall = process.env.npm_lifecycle_event === 'postinstall'
|
|
60
|
+
return { mode: isPostInstall ? 'global' : 'global' }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return { mode: wantsLocal ? 'local' : 'global' }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function copyRecursive(src, dest) {
|
|
67
|
+
const stat = fs.statSync(src)
|
|
68
|
+
|
|
69
|
+
if (stat.isDirectory()) {
|
|
70
|
+
fs.mkdirSync(dest, { recursive: true })
|
|
71
|
+
for (const entry of fs.readdirSync(src)) {
|
|
72
|
+
copyRecursive(path.join(src, entry), path.join(dest, entry))
|
|
73
|
+
}
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true })
|
|
78
|
+
fs.copyFileSync(src, dest)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function installOpenCode(targetDir, description) {
|
|
82
|
+
const isPostInstall = process.env.npm_lifecycle_event === 'postinstall'
|
|
83
|
+
if (!isPostInstall) {
|
|
84
|
+
console.log(`Installing to ${description}...`)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const distOpenCodeRoot = path.join(packageRoot, 'dist', '.opencode')
|
|
88
|
+
const distSkillsRoot = path.join(packageRoot, 'dist', 'skills')
|
|
89
|
+
|
|
90
|
+
// Check if OpenCode is installed (look for config directory)
|
|
91
|
+
const openCodeConfigDir = path.join(process.env.HOME || '', '.config', 'opencode')
|
|
92
|
+
if (!fs.existsSync(openCodeConfigDir)) {
|
|
93
|
+
if (isPostInstall) {
|
|
94
|
+
// Silently skip if OpenCode not installed during npm install
|
|
95
|
+
return
|
|
96
|
+
} else {
|
|
97
|
+
console.error('Error: OpenCode not found. Please install OpenCode first:')
|
|
98
|
+
console.error('curl -fsSL https://opencode.ai/install | bash')
|
|
99
|
+
process.exit(1)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (!fs.existsSync(distOpenCodeRoot)) {
|
|
104
|
+
console.error('Error: dist/.opencode not found.')
|
|
105
|
+
console.error('Run "bun run build" first (or install from a pre-built package).')
|
|
106
|
+
process.exit(1)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Copy OpenCode config
|
|
110
|
+
const configSrc = path.join(distOpenCodeRoot, 'opencode.jsonc')
|
|
111
|
+
if (fs.existsSync(configSrc)) {
|
|
112
|
+
fs.mkdirSync(targetDir, { recursive: true })
|
|
113
|
+
fs.copyFileSync(configSrc, path.join(targetDir, 'opencode.jsonc'))
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Copy plugin script
|
|
117
|
+
const pluginSrc = path.join(distOpenCodeRoot, 'plugin', 'ai-eng-system.ts')
|
|
118
|
+
if (fs.existsSync(pluginSrc)) {
|
|
119
|
+
copyRecursive(pluginSrc, path.join(targetDir, 'plugin', 'ai-eng-system.ts'))
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Copy commands (ai-eng subdirectory)
|
|
123
|
+
const commandsSrc = path.join(distOpenCodeRoot, 'command', NAMESPACE_PREFIX)
|
|
124
|
+
if (fs.existsSync(commandsSrc)) {
|
|
125
|
+
copyRecursive(commandsSrc, path.join(targetDir, 'command', NAMESPACE_PREFIX))
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Copy agents (MUST be recursive; categories are subfolders)
|
|
129
|
+
const agentsSrc = path.join(distOpenCodeRoot, 'agent', NAMESPACE_PREFIX)
|
|
130
|
+
if (fs.existsSync(agentsSrc)) {
|
|
131
|
+
copyRecursive(agentsSrc, path.join(targetDir, 'agent', NAMESPACE_PREFIX))
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Copy skills
|
|
135
|
+
if (fs.existsSync(distSkillsRoot)) {
|
|
136
|
+
copyRecursive(distSkillsRoot, path.join(targetDir, 'skills'))
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!isPostInstall) {
|
|
140
|
+
console.log('Installation complete.')
|
|
141
|
+
console.log(`Namespace: ${NAMESPACE_PREFIX}`)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const { mode } = parseArgs(process.argv)
|
|
146
|
+
|
|
147
|
+
if (mode === 'global') {
|
|
148
|
+
const globalDir = path.join(process.env.HOME || '', '.config', 'opencode')
|
|
149
|
+
installOpenCode(globalDir, 'global ~/.config/opencode')
|
|
150
|
+
} else {
|
|
151
|
+
const localDir = path.join(process.cwd(), '.opencode')
|
|
152
|
+
installOpenCode(localDir, 'local ./.opencode')
|
|
153
|
+
}
|