clikit-plugin 0.2.10 → 0.2.11
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/cli.js +1 -1
- package/dist/index.js +3 -3
- package/memory/handoffs/2026-02-15-importmeta-fix.md +131 -0
- package/package.json +1 -1
- package/src/agents/index.ts +1 -1
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as fs from "fs";
|
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import * as os from "os";
|
|
8
8
|
var PLUGIN_NAME = "clikit-plugin";
|
|
9
|
-
var VERSION = "0.2.
|
|
9
|
+
var VERSION = "0.2.11";
|
|
10
10
|
function getRealHome() {
|
|
11
11
|
if (process.env.SNAP_REAL_HOME) {
|
|
12
12
|
return process.env.SNAP_REAL_HOME;
|
package/dist/index.js
CHANGED
|
@@ -3495,7 +3495,7 @@ var require_gray_matter = __commonJS((exports, module) => {
|
|
|
3495
3495
|
var import_gray_matter = __toESM(require_gray_matter(), 1);
|
|
3496
3496
|
import * as fs from "fs";
|
|
3497
3497
|
import * as path from "path";
|
|
3498
|
-
var AGENTS_DIR = import.meta.dir;
|
|
3498
|
+
var AGENTS_DIR = path.join(import.meta.dir, "../src/agents");
|
|
3499
3499
|
function parseAgentMarkdown(filePath) {
|
|
3500
3500
|
try {
|
|
3501
3501
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
@@ -3548,7 +3548,7 @@ function getBuiltinAgents() {
|
|
|
3548
3548
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
3549
3549
|
import * as fs2 from "fs";
|
|
3550
3550
|
import * as path2 from "path";
|
|
3551
|
-
var COMMANDS_DIR = path2.join(import.meta.dir, "
|
|
3551
|
+
var COMMANDS_DIR = path2.join(import.meta.dir, "../command");
|
|
3552
3552
|
function parseCommandMarkdown(filePath) {
|
|
3553
3553
|
try {
|
|
3554
3554
|
const content = fs2.readFileSync(filePath, "utf-8");
|
|
@@ -4789,7 +4789,7 @@ var RITUAL_FILE = path8.join(process.cwd(), ".opencode", "memory", "ritual-state
|
|
|
4789
4789
|
var import_gray_matter3 = __toESM(require_gray_matter(), 1);
|
|
4790
4790
|
import * as fs8 from "fs";
|
|
4791
4791
|
import * as path9 from "path";
|
|
4792
|
-
var SKILLS_DIR = path9.join(import.meta.dir, "
|
|
4792
|
+
var SKILLS_DIR = path9.join(import.meta.dir, "../skill");
|
|
4793
4793
|
function getBuiltinSkills() {
|
|
4794
4794
|
const skills = {};
|
|
4795
4795
|
if (!fs8.existsSync(SKILLS_DIR)) {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
date: 2026-02-15
|
|
3
|
+
phase: verifying
|
|
4
|
+
branch: main
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Handoff: CliKit `import.meta.dir` Path Fix (v0.2.10)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Status Summary
|
|
12
|
+
|
|
13
|
+
Fixed critical bug where bun build inlined `__dirname` to absolute build-time paths, causing plugin to fail on user machines. Replaced with `import.meta.dir` which is preserved as runtime expression.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Bug Description
|
|
18
|
+
|
|
19
|
+
**Problem:** After `bun build`, the bundled code had hardcoded paths:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
// Before (broken):
|
|
23
|
+
var __dirname = "/mnt/c/Users/Kira/Desktop/clikit/.opencode/src/agents";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
When users installed via npm, the plugin looked for files at the BUILD machine's path, not the installed location.
|
|
27
|
+
|
|
28
|
+
**Root Cause:** Bun bundler inlines `__dirname` to the build-time absolute path. `import.meta.dir` is preserved as a runtime expression.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Fix Applied
|
|
33
|
+
|
|
34
|
+
| File | Before | After |
|
|
35
|
+
|------|--------|-------|
|
|
36
|
+
| `src/agents/index.ts:6` | `const AGENTS_DIR = __dirname;` | `const AGENTS_DIR = import.meta.dir;` |
|
|
37
|
+
| `src/commands/index.ts:6` | `path.join(__dirname, "../../command")` | `path.join(import.meta.dir, "../../command")` |
|
|
38
|
+
| `src/skills/index.ts:5` | `path.join(__dirname, "..", "..", "skill")` | `path.join(import.meta.dir, "../../skill")` |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Verification
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Published package shows runtime expressions (not inlined):
|
|
46
|
+
npm pack clikit-plugin@latest && tar -xzf clikit-plugin-0.2.10.tgz
|
|
47
|
+
grep import.meta.dir package/dist/index.js
|
|
48
|
+
|
|
49
|
+
# Output:
|
|
50
|
+
# var AGENTS_DIR = import.meta.dir;
|
|
51
|
+
# var COMMANDS_DIR = path2.join(import.meta.dir, "../../command");
|
|
52
|
+
# var SKILLS_DIR = path9.join(import.meta.dir, "../../skill");
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Version History
|
|
58
|
+
|
|
59
|
+
| Version | Fix |
|
|
60
|
+
|---------|-----|
|
|
61
|
+
| 0.2.1-0.2.9 | Type guards for hooks/tools |
|
|
62
|
+
| 0.2.10 | `__dirname` → `import.meta.dir` path fix |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Next Steps
|
|
67
|
+
|
|
68
|
+
1. [ ] User test: `rm -rf ~/.cache/opencode/node_modules/clikit-plugin`
|
|
69
|
+
2. [ ] User test: `bun x clikit-plugin@latest install`
|
|
70
|
+
3. [ ] User test: `opencode` - should start without errors
|
|
71
|
+
4. [ ] Verify agents/commands/skills load correctly
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Files Modified (3 files)
|
|
76
|
+
|
|
77
|
+
| File | Changes |
|
|
78
|
+
|------|---------|
|
|
79
|
+
| `src/agents/index.ts` | `__dirname` → `import.meta.dir` |
|
|
80
|
+
| `src/commands/index.ts` | `__dirname` → `import.meta.dir` |
|
|
81
|
+
| `src/skills/index.ts` | `__dirname` → `import.meta.dir` |
|
|
82
|
+
| `package.json` | v0.2.10 |
|
|
83
|
+
| `src/cli.ts` | VERSION = "0.2.10" |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Git State
|
|
88
|
+
|
|
89
|
+
- **Branch:** `main`
|
|
90
|
+
- **Uncommitted changes:** All previous fixes + this fix
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Context for Resumption
|
|
95
|
+
|
|
96
|
+
### Why `import.meta.dir` Works
|
|
97
|
+
|
|
98
|
+
Bun's bundler treats `import.meta.dir` specially - it's preserved as a runtime expression that evaluates to the actual file's directory at runtime, not build time. This is standard ESM behavior.
|
|
99
|
+
|
|
100
|
+
### Path Resolution After Fix
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Installed location: ~/.cache/opencode/node_modules/clikit-plugin/
|
|
104
|
+
|
|
105
|
+
dist/index.js
|
|
106
|
+
├── import.meta.dir → ~/.cache/opencode/node_modules/clikit-plugin/dist/
|
|
107
|
+
├── AGENTS_DIR = import.meta.dir → ~/.cache/.../dist/ (contains compiled index.js)
|
|
108
|
+
│ └── Resolved from src/agents/*.md via package.json "files": ["src/agents"]
|
|
109
|
+
├── COMMANDS_DIR = import.meta.dir + "../../command" → ~/.cache/.../command/
|
|
110
|
+
└── SKILLS_DIR = import.meta.dir + "../../skill" → ~/.cache/.../skill/
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Note: `AGENTS_DIR` points to `dist/` which doesn't contain `.md` files directly. The `src/agents` directory IS included in package.json `files` array, but the path resolution may need adjustment.
|
|
114
|
+
|
|
115
|
+
### Potential Issue
|
|
116
|
+
|
|
117
|
+
Looking at the package structure:
|
|
118
|
+
- `dist/index.js` is the entry point
|
|
119
|
+
- `import.meta.dir` in `dist/index.js` evaluates to `.../clikit-plugin/dist/`
|
|
120
|
+
- But `src/agents/*.md` files are at `.../clikit-plugin/src/agents/`
|
|
121
|
+
|
|
122
|
+
The agents directory resolution may need adjustment. Check if agents load correctly after install.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Resume Command
|
|
127
|
+
|
|
128
|
+
To resume, use `/resume` and verify:
|
|
129
|
+
1. Plugin starts without errors
|
|
130
|
+
2. Agents load (check `[CliKit] Loaded X agents` log)
|
|
131
|
+
3. Commands load (check `[CliKit] Loaded X commands` log)
|
package/package.json
CHANGED
package/src/agents/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as fs from "fs";
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import matter from "gray-matter";
|
|
5
5
|
|
|
6
|
-
const AGENTS_DIR = import.meta.dir;
|
|
6
|
+
const AGENTS_DIR = path.join(import.meta.dir, "../src/agents");
|
|
7
7
|
|
|
8
8
|
function parseAgentMarkdown(filePath: string): AgentConfig | null {
|
|
9
9
|
try {
|