clikit-plugin 0.1.3 → 0.1.7

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/README.md CHANGED
@@ -16,22 +16,21 @@ Curated agents, commands, skills, and memory system for OpenCode.
16
16
 
17
17
  ## Installation
18
18
 
19
- ### Option 1: Via npm (Recommended)
20
-
21
19
  ```bash
22
- # In your project
23
- bun add -d clikit-plugin
20
+ # Install CliKit globally for OpenCode
21
+ bun x clikit-plugin install
24
22
 
25
- # Create .opencode/index.ts
26
- echo 'import CliKitPlugin from "clikit-plugin";
27
- export default CliKitPlugin;' > .opencode/index.ts
23
+ # Restart OpenCode
28
24
  ```
29
25
 
30
- ### Option 2: Direct Copy
26
+ That's it! The plugin will be registered in `~/.config/opencode/opencode.json`.
31
27
 
32
- ```bash
33
- # Copy the built plugin to OpenCode plugin directory
34
- cp dist/index.js ~/.config/opencode/plugin/clikit-plugin.js
28
+ ## Quick Start
29
+
30
+ After installation, use these commands:
31
+
32
+ ```
33
+ /create → /plan → /start → /verify → /ship
35
34
  ```
36
35
 
37
36
  ## Configuration
package/dist/cli.js CHANGED
@@ -4,73 +4,137 @@
4
4
  // src/cli.ts
5
5
  import * as fs from "fs";
6
6
  import * as path from "path";
7
- var VERSION = "0.1.0";
8
- function getCwd() {
9
- return process.cwd();
7
+ import * as os from "os";
8
+ var PLUGIN_NAME = "clikit-plugin";
9
+ var VERSION = "0.1.7";
10
+ function getRealHome() {
11
+ return process.env.SNAP_REAL_HOME || os.homedir();
12
+ }
13
+ function getConfigDir() {
14
+ const home = getRealHome();
15
+ if (process.platform === "win32") {
16
+ return path.join(process.env.APPDATA || path.join(home, "AppData", "Roaming"), "opencode");
17
+ }
18
+ return path.join(process.env.XDG_CONFIG_HOME || path.join(home, ".config"), "opencode");
19
+ }
20
+ function getConfigPath() {
21
+ const configDir = getConfigDir();
22
+ const jsonPath = path.join(configDir, "opencode.json");
23
+ const jsoncPath = path.join(configDir, "opencode.jsonc");
24
+ if (fs.existsSync(jsonPath))
25
+ return jsonPath;
26
+ if (fs.existsSync(jsoncPath))
27
+ return jsoncPath;
28
+ return jsonPath;
29
+ }
30
+ function ensureConfigDir() {
31
+ const configDir = getConfigDir();
32
+ if (!fs.existsSync(configDir)) {
33
+ fs.mkdirSync(configDir, { recursive: true });
34
+ }
35
+ }
36
+ function parseConfig(configPath) {
37
+ try {
38
+ if (!fs.existsSync(configPath)) {
39
+ return {};
40
+ }
41
+ const content = fs.readFileSync(configPath, "utf-8");
42
+ const cleaned = content.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
43
+ return JSON.parse(cleaned);
44
+ } catch {
45
+ return {};
46
+ }
47
+ }
48
+ function writeConfig(configPath, config) {
49
+ ensureConfigDir();
50
+ const tmpPath = `${configPath}.tmp`;
51
+ const content = JSON.stringify(config, null, 2) + `
52
+ `;
53
+ fs.writeFileSync(tmpPath, content);
54
+ fs.renameSync(tmpPath, configPath);
10
55
  }
11
56
  async function install() {
12
- const cwd = getCwd();
13
- const opencodeDir = path.join(cwd, ".opencode");
14
- console.log(`\uD83D\uDE80 Installing CliKit...
57
+ console.log(`
58
+ CliKit Installer
59
+ ================
15
60
  `);
16
- if (!fs.existsSync(opencodeDir)) {
17
- fs.mkdirSync(opencodeDir, { recursive: true });
18
- console.log("\u2705 Created .opencode directory");
61
+ console.log("[1/3] Adding CliKit plugin to OpenCode config...");
62
+ try {
63
+ ensureConfigDir();
64
+ } catch (err) {
65
+ console.error(`\u2717 Failed to create config directory: ${err}`);
66
+ return 1;
19
67
  }
20
- const indexPath = path.join(opencodeDir, "index.ts");
21
- if (!fs.existsSync(indexPath)) {
22
- fs.writeFileSync(indexPath, `import CliKitPlugin from "clikit-plugin";
23
- export default CliKitPlugin;
24
- `);
25
- console.log("\u2705 Created .opencode/index.ts");
26
- } else {
27
- console.log("\u2139\uFE0F .opencode/index.ts already exists");
68
+ const configPath = getConfigPath();
69
+ try {
70
+ const config = parseConfig(configPath) || {};
71
+ const plugins = config.plugin || [];
72
+ const filteredPlugins = plugins.filter((p) => p !== PLUGIN_NAME && !p.startsWith(`${PLUGIN_NAME}@`));
73
+ filteredPlugins.push(PLUGIN_NAME);
74
+ config.plugin = filteredPlugins;
75
+ writeConfig(configPath, config);
76
+ console.log(`\u2713 Plugin added to ${configPath}`);
77
+ } catch (err) {
78
+ console.error(`\u2717 Failed to update OpenCode config: ${err}`);
79
+ return 1;
28
80
  }
29
- const configPath = path.join(opencodeDir, "clikit.config.json");
30
- if (!fs.existsSync(configPath)) {
31
- fs.writeFileSync(configPath, JSON.stringify({
32
- $schema: "https://unpkg.com/clikit-plugin/schema.json",
33
- disabled_agents: [],
34
- disabled_commands: [],
35
- agents: {},
36
- hooks: {}
37
- }, null, 2));
38
- console.log("\u2705 Created .opencode/clikit.config.json");
39
- } else {
40
- console.log("\u2139\uFE0F .opencode/clikit.config.json already exists");
41
- }
42
- const memoryDir = path.join(opencodeDir, "memory");
81
+ console.log(`
82
+ [2/3] Creating memory directories...`);
83
+ const memoryDir = path.join(getConfigDir(), "memory");
43
84
  const memorySubdirs = ["specs", "plans", "research", "reviews", "handoffs", "beads", "prds"];
44
85
  for (const subdir of memorySubdirs) {
45
86
  const dir = path.join(memoryDir, subdir);
46
87
  if (!fs.existsSync(dir)) {
47
88
  fs.mkdirSync(dir, { recursive: true });
48
- console.log(`\u2705 Created .opencode/memory/${subdir}/`);
49
89
  }
50
90
  }
91
+ console.log(`\u2713 Memory directories created in ${memoryDir}`);
51
92
  console.log(`
52
- \u2705 CliKit installed successfully!`);
93
+ [3/3] Creating CliKit config...`);
94
+ const clikitConfigPath = path.join(getConfigDir(), "clikit.config.json");
95
+ if (!fs.existsSync(clikitConfigPath)) {
96
+ const defaultConfig = {
97
+ $schema: `https://unpkg.com/${PLUGIN_NAME}@latest/schema.json`,
98
+ disabled_agents: [],
99
+ disabled_commands: [],
100
+ agents: {},
101
+ hooks: {}
102
+ };
103
+ writeConfig(clikitConfigPath, defaultConfig);
104
+ console.log(`\u2713 Config created at ${clikitConfigPath}`);
105
+ } else {
106
+ console.log(`\u2713 Config already exists at ${clikitConfigPath}`);
107
+ }
53
108
  console.log(`
54
- Next steps:`);
55
- console.log(" 1. Run: bun add -d clikit-plugin");
56
- console.log(" 2. Restart OpenCode");
109
+ \u2713 CliKit installed successfully!
110
+ `);
111
+ console.log("Available commands:");
112
+ console.log(" /create - Start new task with specification");
113
+ console.log(" /start - Begin implementing from plan");
114
+ console.log(" /plan - Create implementation plan");
115
+ console.log(" /verify - Run verification suite");
116
+ console.log(" /ship - Commit, PR, and cleanup");
117
+ console.log(" /review - Request code review");
118
+ console.log(" /debug - Debug issues");
57
119
  console.log(`
58
- Available commands: /create, /start, /plan, /ship, /verify, /review, /debug, /pr`);
120
+ Restart OpenCode to use CliKit.
121
+ `);
122
+ return 0;
59
123
  }
60
124
  function help() {
61
125
  console.log(`
62
126
  CliKit - OpenCode Plugin
63
127
 
64
128
  Usage:
65
- clikit <command>
129
+ bun x clikit-plugin <command>
66
130
 
67
131
  Commands:
68
- install Install CliKit in current project
132
+ install Install CliKit globally for OpenCode
69
133
  help Show this help message
70
134
  version Show version
71
135
 
72
136
  Examples:
73
- bunx clikit install
137
+ bun x clikit-plugin install
74
138
  `);
75
139
  }
76
140
  function version() {
@@ -79,10 +143,11 @@ function version() {
79
143
  async function main() {
80
144
  const args = process.argv.slice(2);
81
145
  const command = args[0] || "help";
146
+ let exitCode = 0;
82
147
  switch (command) {
83
148
  case "install":
84
149
  case "i":
85
- await install();
150
+ exitCode = await install();
86
151
  break;
87
152
  case "help":
88
153
  case "-h":
@@ -97,7 +162,11 @@ async function main() {
97
162
  default:
98
163
  console.error(`Unknown command: ${command}`);
99
164
  help();
100
- process.exit(1);
165
+ exitCode = 1;
101
166
  }
167
+ process.exit(exitCode);
102
168
  }
103
- main().catch(console.error);
169
+ main().catch((err) => {
170
+ console.error(err);
171
+ process.exit(1);
172
+ });
@@ -0,0 +1,90 @@
1
+ ---
2
+ date: 2026-02-15
3
+ phase: implementing
4
+ branch: main
5
+ ---
6
+
7
+ # Handoff: CliKit Plugin Installation Fix
8
+
9
+ ## Status Summary
10
+
11
+ CliKit plugin fully implemented (10 agents, 19 commands, 48 skills, 14 hooks, 6 tools). Published to npm as `clikit-plugin@0.1.6`. **Critical issue**: Plugin NOT registered in `~/.config/opencode/opencode.json` — the "plugin" key is missing entirely. This means the CLI installer was either never run or failed silently.
12
+
13
+ ## Task Status
14
+
15
+ ### ✅ Completed
16
+ - [x] T-001: Create 10 agents with proper model assignments
17
+ - [x] T-002: Create 19 slash commands
18
+ - [x] T-003: Create 48 workflow skills
19
+ - [x] T-004: Create 14 runtime hooks
20
+ - [x] T-005: Create 6 custom tools
21
+ - [x] T-006: Publish to npm as clikit-plugin@0.1.6
22
+ - [x] T-007: Create CLI installer code
23
+
24
+ ### 🔄 In Progress
25
+ - [ ] T-008: Fix plugin registration in OpenCode config
26
+ - **Current state:** `~/.config/opencode/opencode.json` has no "plugin" key
27
+ - **Next step:** Run CLI installer and debug why registration isn't persisting
28
+
29
+ ### 📋 Not Started
30
+ - [ ] T-009: Verify plugin loads when OpenCode starts
31
+ - [ ] T-010: Test installation in fresh environment
32
+
33
+ ## Files Modified
34
+
35
+ | File | Status | Notes |
36
+ |------|--------|-------|
37
+ | `.opencode/src/index.ts` | Complete | Main plugin entry point |
38
+ | `.opencode/src/cli.ts` | Complete | CLI installer script |
39
+ | `.opencode/src/config.ts` | Complete | Config loader |
40
+ | `.opencode/package.json` | Complete | npm package config |
41
+
42
+ ## Git State
43
+
44
+ - **Branch:** `main`
45
+ - **Last commit:** `31b200c` - Update README with simplified installation
46
+ - **Uncommitted:** No
47
+
48
+ ## Known Issues
49
+
50
+ 1. **Plugin not registered** - `~/.config/opencode/opencode.json` has NO "plugin" array
51
+ 2. **Plugin not cached** - `~/.cache/opencode/node_modules/` missing clikit-plugin
52
+ 3. **Possible path mismatch** - snap/bun may use different config path than native bun
53
+
54
+ ## Next Steps
55
+
56
+ 1. [ ] Run `bun x clikit-plugin install` to test CLI
57
+ 2. [ ] Verify output with `grep '"plugin"' ~/.config/opencode/opencode.json`
58
+ 3. [ ] Check if snap/bun path issue: `/home/kira/snap/bun-js/87/.config/opencode/`
59
+ 4. [ ] Restart OpenCode and check for `[CliKit]` logs
60
+
61
+ ## Context for Resumption
62
+
63
+ ### Key Discovery
64
+ The opencode.json at `~/.config/opencode/opencode.json` exists but has no "plugin" array. CLI code at `.opencode/src/cli.ts:72-84` writes to this path, but the key is missing.
65
+
66
+ ### Possible Causes
67
+ 1. CLI was never executed by user
68
+ 2. Bun snap uses different home path: `/home/kira/snap/bun-js/87/`
69
+ 3. Write operation failed silently
70
+
71
+ ### Verification Commands
72
+ ```bash
73
+ # Run installer
74
+ bun x clikit-plugin install
75
+
76
+ # Check registration
77
+ grep -A2 '"plugin"' ~/.config/opencode/opencode.json
78
+
79
+ # Check snap path
80
+ ls /home/kira/snap/bun-js/87/.config/opencode/
81
+ ```
82
+
83
+ ### Reference Implementation
84
+ - oh-my-opencode-slim: https://github.com/alvinunreal/oh-my-opencode-slim
85
+ - Plugin docs: https://opencode.ai/docs/plugins/
86
+
87
+ ### Key Files to Review
88
+ - `.opencode/src/cli.ts` — CLI installer logic (lines 55-88)
89
+ - `~/.config/opencode/opencode.json` — Target config file
90
+ - `.opencode/package.json` — Package config with `main` and `bin`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clikit-plugin",
3
- "version": "0.1.3",
3
+ "version": "0.1.7",
4
4
  "description": "OpenCode plugin with 10 agents, 19 commands, 48 skills, 14 hooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "homepage": "https://github.com/KiraKas-Tr/CliKit#readme",
54
54
  "dependencies": {
55
- "@opencode-ai/plugin": "1.1.64",
55
+ "@opencode-ai/plugin": "1.2.1",
56
56
  "gray-matter": "^4.0.3"
57
57
  },
58
58
  "devDependencies": {