clikit-plugin 0.2.9 → 0.2.10
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 -6
- package/memory/handoffs/2026-02-15-complete-fix.md +140 -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.10";
|
|
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,8 +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
|
|
3499
|
-
var AGENTS_DIR = __dirname;
|
|
3498
|
+
var AGENTS_DIR = import.meta.dir;
|
|
3500
3499
|
function parseAgentMarkdown(filePath) {
|
|
3501
3500
|
try {
|
|
3502
3501
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
@@ -3549,8 +3548,7 @@ function getBuiltinAgents() {
|
|
|
3549
3548
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
3550
3549
|
import * as fs2 from "fs";
|
|
3551
3550
|
import * as path2 from "path";
|
|
3552
|
-
var
|
|
3553
|
-
var COMMANDS_DIR = path2.join(__dirname, "../../command");
|
|
3551
|
+
var COMMANDS_DIR = path2.join(import.meta.dir, "../../command");
|
|
3554
3552
|
function parseCommandMarkdown(filePath) {
|
|
3555
3553
|
try {
|
|
3556
3554
|
const content = fs2.readFileSync(filePath, "utf-8");
|
|
@@ -4791,8 +4789,7 @@ var RITUAL_FILE = path8.join(process.cwd(), ".opencode", "memory", "ritual-state
|
|
|
4791
4789
|
var import_gray_matter3 = __toESM(require_gray_matter(), 1);
|
|
4792
4790
|
import * as fs8 from "fs";
|
|
4793
4791
|
import * as path9 from "path";
|
|
4794
|
-
var
|
|
4795
|
-
var SKILLS_DIR = path9.join(__dirname, "..", "..", "skill");
|
|
4792
|
+
var SKILLS_DIR = path9.join(import.meta.dir, "../../skill");
|
|
4796
4793
|
function getBuiltinSkills() {
|
|
4797
4794
|
const skills = {};
|
|
4798
4795
|
if (!fs8.existsSync(SKILLS_DIR)) {
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
date: 2026-02-15
|
|
3
|
+
phase: implementing
|
|
4
|
+
branch: main
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Handoff: CliKit Complete Type Guard & SQLite Fix
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Status Summary
|
|
12
|
+
|
|
13
|
+
CliKit plugin v0.2.1 → v0.2.9 published with comprehensive type guards across all hooks and tools. Fixed SQLite schema migration issues, removed backup logic, and added defensive programming patterns throughout the codebase. Plugin should now handle all edge cases where OpenCode passes unexpected data types.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Version History
|
|
18
|
+
|
|
19
|
+
| Version | Fix |
|
|
20
|
+
|---------|-----|
|
|
21
|
+
| 0.2.1 | Type guards in hooks (truncator, security-check, compaction) |
|
|
22
|
+
| 0.2.2 | Abort on JSON parse error |
|
|
23
|
+
| 0.2.3 | Fix JSONC comment stripping breaking URLs |
|
|
24
|
+
| 0.2.4 | Remove backup logic, fix `todos.filter` error |
|
|
25
|
+
| 0.2.5 | Fix `path.join` error - guards for projectDir/cwd params |
|
|
26
|
+
| 0.2.6 | Fix `text.toLowerCase` error in subagent-question-blocker |
|
|
27
|
+
| 0.2.7 | Fix remaining type guards (git-guard, swarm-enforcer) |
|
|
28
|
+
| 0.2.8 | SQLite migration - add missing columns |
|
|
29
|
+
| 0.2.9 | Type guards for ALL tool functions |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Task Status
|
|
34
|
+
|
|
35
|
+
### ✅ Completed
|
|
36
|
+
- [x] Fix installer to MERGE with existing opencode.json
|
|
37
|
+
- [x] Remove backup creation from cli.ts
|
|
38
|
+
- [x] Add type guards to all hooks (14 hooks)
|
|
39
|
+
- [x] Add type guards to all tools (6 tool files)
|
|
40
|
+
- [x] Fix SQLite schema migration with ALTER TABLE
|
|
41
|
+
- [x] Publish v0.2.1 → v0.2.9 to npm
|
|
42
|
+
|
|
43
|
+
### 📋 Not Started
|
|
44
|
+
- [ ] Test: `opencode` starts without errors
|
|
45
|
+
- [ ] Test: Plugin loads correctly after fresh install
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Files Modified (22 files)
|
|
50
|
+
|
|
51
|
+
| File | Changes |
|
|
52
|
+
|------|---------|
|
|
53
|
+
| `package.json` | v0.2.9 |
|
|
54
|
+
| `cli.ts` | Removed backup, fixed JSONC parsing |
|
|
55
|
+
| `config.ts` | Type guard for loadCliKitConfig |
|
|
56
|
+
| `index.ts` | Array.isArray for todos |
|
|
57
|
+
| `hooks/auto-format.ts` | Type guards for filePath, projectDir |
|
|
58
|
+
| `hooks/comment-checker.ts` | Type guard for content |
|
|
59
|
+
| `hooks/compaction.ts` | Type guards for projectDir, raw content |
|
|
60
|
+
| `hooks/env-context.ts` | Type guard for cwd |
|
|
61
|
+
| `hooks/git-guard.ts` | Type guard for command |
|
|
62
|
+
| `hooks/security-check.ts` | Type guard for content |
|
|
63
|
+
| `hooks/session-notification.ts` | Type guards for sessionId, error |
|
|
64
|
+
| `hooks/subagent-question-blocker.ts` | Type guards for text, toolName |
|
|
65
|
+
| `hooks/swarm-enforcer.ts` | Type guards for filePath, toolName |
|
|
66
|
+
| `hooks/todo-enforcer.ts` | Type guard for todos array |
|
|
67
|
+
| `hooks/truncator.ts` | Type guard for content |
|
|
68
|
+
| `hooks/typecheck-gate.ts` | Type guards for filePath, projectDir, output |
|
|
69
|
+
| `tools/observation.ts` | Type guard + SQLite migration |
|
|
70
|
+
| `tools/memory.ts` | Type guards + SQLite migration |
|
|
71
|
+
| `tools/beads-memory-sync.ts` | Type guard + SQLite migration |
|
|
72
|
+
| `tools/context-summary.ts` | Type guard + SQLite migration |
|
|
73
|
+
| `tools/quick-research.ts` | Type guard for params |
|
|
74
|
+
| `tools/swarm.ts` | Type guard for params |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Git State
|
|
79
|
+
|
|
80
|
+
- **Branch:** `main`
|
|
81
|
+
- **Last commit:** `31b200c` - Update README with simplified installation
|
|
82
|
+
- **Uncommitted changes:** 22 modified files, 5 handoff files
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Known Issues
|
|
87
|
+
|
|
88
|
+
None - all reported runtime errors have been addressed with type guards.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Next Steps
|
|
93
|
+
|
|
94
|
+
1. [ ] User test: `rm -rf ~/.cache/opencode/node_modules/clikit-plugin`
|
|
95
|
+
2. [ ] User test: `bun x clikit-plugin@latest install`
|
|
96
|
+
3. [ ] User test: `opencode` - should start without errors
|
|
97
|
+
4. [ ] If errors persist, check error message and add appropriate type guard
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Context for Resumption
|
|
102
|
+
|
|
103
|
+
### Type Guard Pattern Used Throughout
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
export function myFunc(params: unknown): Result | null {
|
|
107
|
+
if (!params || typeof params !== "object") {
|
|
108
|
+
return defaultResult;
|
|
109
|
+
}
|
|
110
|
+
const p = params as Partial<Params>;
|
|
111
|
+
if (!p.requiredField) {
|
|
112
|
+
return defaultResult;
|
|
113
|
+
}
|
|
114
|
+
// ... rest of function
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### SQLite Migration Pattern
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// Create table with all columns
|
|
122
|
+
db.exec(`CREATE TABLE IF NOT EXISTS observations (...)`);
|
|
123
|
+
|
|
124
|
+
// Migration: add missing columns if they don't exist
|
|
125
|
+
try { db.exec(`ALTER TABLE observations ADD COLUMN new_col TEXT`); } catch {}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Key Files to Review
|
|
129
|
+
- `.opencode/src/hooks/*.ts` — All hooks have type guards
|
|
130
|
+
- `.opencode/src/tools/*.ts` — All tools have type guards + SQLite migration
|
|
131
|
+
- `.opencode/src/cli.ts` — Installer logic, JSONC parsing
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Resume Command
|
|
136
|
+
|
|
137
|
+
To resume, use `/resume` and it will:
|
|
138
|
+
1. Load this handoff
|
|
139
|
+
2. Check for new runtime errors
|
|
140
|
+
3. Propose adding appropriate type guards if needed
|
package/package.json
CHANGED
package/src/agents/index.ts
CHANGED