clikit-plugin 0.3.0 → 0.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clikit-plugin",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "OpenCode plugin — 7 agents, 15 commands, 22 skills, 10 hooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,43 +10,60 @@ When any task requires reading files or exploring a codebase, follow this priori
10
10
  ## Priority Chain
11
11
 
12
12
  ```
13
- 1. tilth → smart, outline-aware, section-targeted reading
14
- 2. read → raw file content (fallback for full-file needs)
15
- 3. glob → fallback when you need to discover file paths
16
- 4. grep → fallback when you need to search content patterns
13
+ 1. bash: tilth <path> → smart, outline-aware, section-targeted reading
14
+ 2. read <path> → raw file content (auto-enhanced by hook when tilth available)
15
+ 3. glob <pattern> → fallback when you need to discover file paths
16
+ 4. grep <pattern> → fallback when you need to search content patterns
17
17
  ```
18
18
 
19
+ ## Two Paths — Know Which to Use
20
+
21
+ | Situation | How to invoke tilth |
22
+ |-----------|-------------------|
23
+ | Want smart full read or outline | `bash: tilth <path>` |
24
+ | Want a specific section or heading | `bash: tilth <path> --section "## Heading"` |
25
+ | Want a line range | `bash: tilth <path> --section 45-89` |
26
+ | Tilth unavailable or bash not permitted | `read <path>` (hook auto-enhances when possible) |
27
+ | Need to discover paths first | `glob pattern="…"` |
28
+ | Need content pattern search | `grep pattern="…"` |
29
+
30
+ > **Runtime hook:** the `tilth_reading` hook already enhances `read` tool output via tilth when tilth is on PATH.
31
+ > So `read` alone is often sufficient for full-file reads — use explicit `bash: tilth` when you need section targeting or outline-only mode.
32
+
19
33
  ## Workflow
20
34
 
21
- ### Step 1 — Try tilth (always first)
35
+ ### Step 1 — Try tilth via bash (always first for large/unknown files)
22
36
 
23
37
  ```bash
38
+ # Check tilth is available (cache result — don't repeat every call)
39
+ tilth --version
40
+
24
41
  # Read a whole file (smart: outline or full depending on size)
25
42
  tilth <path>
26
43
 
27
- # Read a specific section by line range
28
- tilth <path> --section 45-89
29
-
30
44
  # Read a specific section by markdown heading
31
45
  tilth <path> --section "## Installation"
32
- ```
33
46
 
34
- **Tilth is available if:** `npx tilth --version` exits 0, or a local `tilth` binary is on PATH.
47
+ # Read a specific section by line range
48
+ tilth <path> --section 45-89
49
+ ```
35
50
 
36
51
  **When tilth succeeds:** use its output directly. Do not duplicate with `read`.
37
52
 
38
- **When tilth fails or is unavailable:** immediately fall back — do not retry tilth for the same path.
53
+ **When tilth fails or is unavailable:** fall back immediately — do not retry tilth for the same path.
39
54
 
40
55
  ---
41
56
 
42
- ### Step 2 — Fallback: read (full file content)
57
+ ### Step 2 — Fallback: read (full file content, hook-enhanced)
43
58
 
44
- Use when you need complete, unprocessed file content and tilth is not available.
59
+ Use when tilth bash is unavailable or you need raw content.
45
60
 
46
61
  ```
47
62
  read <path>
48
63
  ```
49
64
 
65
+ The `tilth_reading` runtime hook automatically runs tilth on the output when available.
66
+
50
67
  Use `read` with `offset` + `limit` to scope large files:
51
68
  ```
52
69
  read <path> offset=<line> limit=<n>
@@ -81,13 +98,13 @@ Combine with `glob` results when searching a pre-discovered set of files.
81
98
 
82
99
  ## Decision Table
83
100
 
84
- | Need | Tool |
85
- |------|------|
86
- | Read a known file, outline/section | `tilth` |
87
- | Read a known file, need full raw content | `tilth` `read` |
88
- | Find files matching a name/extension pattern | `tilth` → `glob` |
89
- | Search for a symbol/pattern across files | `tilth` `grep` |
90
- | tilth unavailable or errored | `read` + `glob` + `grep` as needed |
101
+ | Need | Primary | Fallback |
102
+ |------|---------|---------|
103
+ | Read known file — smart outline | `bash: tilth <path>` | `read <path>` |
104
+ | Read known file specific section | `bash: tilth <path> --section "…"` | `read <path> offset=X limit=N` |
105
+ | Discover file paths | `glob pattern="…"` | |
106
+ | Search content patterns | `bash: tilth <path>` then `grep` | `grep pattern="…"` |
107
+ | tilth unavailable / bash denied | `read <path>` | `glob` + `grep` |
91
108
 
92
109
  ---
93
110
 
@@ -96,14 +113,14 @@ Combine with `glob` results when searching a pre-discovered set of files.
96
113
  - **Never use `read` + `tilth` for the same path** — pick one.
97
114
  - **Never use `glob` when you already know the path** — call `read`/`tilth` directly.
98
115
  - **Never call `grep` for something `tilth --section` can already isolate.**
99
- - **Log fallback reason** when possible (e.g. "tilth not found, using read").
116
+ - **Never assume bash: tilth works** verify permission first (`tilth*: allow` in agent frontmatter).
100
117
 
101
118
  ## Red Flags
102
119
 
103
- - Calling `read` on a large file (>500 lines) without first trying `tilth` — tilth's outline mode saves context.
120
+ - Calling `read` on a large file (>500 lines) without first trying `bash: tilth` — tilth's outline mode saves context.
104
121
  - Using `grep` to extract a known section — use `tilth --section` instead.
105
- - Ignoring tilth exit code and retrying without fallback.
106
- - Calling `glob` to discover a path you already know.
122
+ - Agent has `bash: "*": deny` without `tilth*: allow` tilth is silently blocked; fallback to `read`.
123
+ - Assuming `read` is not enhanced the hook runs tilth on `read` output automatically.
107
124
 
108
125
  ## References
109
126
 
@@ -201,15 +201,24 @@ The `files_in_scope` field is the execution boundary — read it first.
201
201
 
202
202
  **File reading: load `tilth-reading` skill — tilth first, fallback to read/glob/grep.**
203
203
 
204
+ ```bash
205
+ # 1st choice: smart outline-aware read (bash tool)
206
+ tilth <path>
207
+ tilth <path> --section "## Heading" # section by heading
208
+ tilth <path> --section 45-89 # section by line range
209
+ ```
210
+
204
211
  ```
205
- tilth <path> # 1st choice: smart outline-aware read
206
- tilth <path> --section "## Heading" # section-targeted read
207
- read <path> # fallback: full raw content
208
- glob + grep # fallback: discovery + pattern search
212
+ # Fallback: use these tools when tilth unavailable or fails
213
+ read <path> # full raw content
214
+ glob + grep # discovery + pattern search
209
215
  ```
210
216
 
211
- > The runtime hook already enhances `read` output via tilth automatically.
212
- > For large files (>500 lines), call `tilth` directly before `read` to get the outline first.
217
+ > **Two paths available:**
218
+ > - **Automatic:** `read` tool output is already enhanced by the tilth runtime hook when tilth is available.
219
+ > - **Explicit:** call `bash: tilth <path>` for section-targeted reads or outline-only mode.
220
+ >
221
+ > For large files (>500 lines), prefer explicit `tilth` via bash to get an outline first.
213
222
 
214
223
  Use LSP tools to understand the code before touching it:
215
224
 
@@ -19,6 +19,8 @@ tools:
19
19
  permission:
20
20
  edit: deny
21
21
  bash:
22
+ "tilth*": allow
23
+ "npx tilth*": allow
22
24
  "git log*": allow
23
25
  "git blame*": allow
24
26
  "git show*": allow
@@ -56,17 +58,24 @@ Work from precise to broad. **Stop when the answer is found** — do not over-ex
56
58
 
57
59
  ### Reading priority (load `tilth-reading` skill before heavy file work)
58
60
 
59
- When reading files, follow the tilth-first chain:
61
+ When reading files, use `bash: tilth` first — it is now allowed in your bash permissions.
60
62
 
63
+ ```bash
64
+ # 1st choice — bash tool (allowed: tilth* and npx tilth*)
65
+ bash: tilth <path>
66
+ bash: tilth <path> --section "## Heading"
67
+ bash: tilth <path> --section 45-89
61
68
  ```
62
- 1. tilth <path> — smart read (full or outline)
63
- 2. tilth <path> --section "## Heading" — section-targeted
64
- 3. read <path> — fallback: full raw content
65
- 4. glob + grep — fallback: discovery + pattern search
69
+
70
+ ```
71
+ # Fallback tools (when tilth unavailable or bash fails)
72
+ read <path> — full raw content (hook auto-enhances via tilth when available)
73
+ glob <pattern> — file discovery
74
+ grep <pattern> — content search
66
75
  ```
67
76
 
68
- > The runtime hook automatically enhances `read` output via tilth when available.
69
- > For large files (>500 lines), prefer `tilth` directly to get an outline before committing to full read.
77
+ > `tilth` is permitted via `bash` in your frontmatter (`tilth*: allow`).
78
+ > Use it for any file that may be large (>200 lines) or where section targeting helps.
70
79
 
71
80
  ### Search priority table
72
81
 
@@ -75,9 +84,10 @@ When reading files, follow the tilth-first chain:
75
84
  | 1 | Symbol definitions, type signatures | `lsp_workspace_symbols`, `lsp_goto_definition`, `lsp_hover` |
76
85
  | 2 | File structure, file listing | `glob` (pattern), `read` (directory listing) |
77
86
  | 3 | All call sites / usages | `lsp_find_references` |
78
- | 4 | File content — known path | `tilth <path>` → `read <path>` (fallback) |
79
- | 5 | Text pattern across files | `grep` (dedicated tool, not bash) |
80
- | 6 | Recent changes, authorship | `bash: git log`, `git blame`, `git show`, `git diff` |
87
+ | 4 | File content — known path | `bash: tilth <path>` → `read <path>` (fallback) |
88
+ | 5 | File section known heading/range | `bash: tilth <path> --section "…"` |
89
+ | 6 | Text pattern across files | `grep` (dedicated tool, not bash) |
90
+ | 7 | Recent changes, authorship | `bash: git log`, `git blame`, `git show`, `git diff` |
81
91
 
82
92
  **Prefer LSP over text search for symbols.** `lsp_find_references` returns all usages with zero false positives; text grep may miss renamed or aliased identifiers.
83
93
 
@@ -21,6 +21,8 @@ tools:
21
21
  permission:
22
22
  edit: deny
23
23
  bash:
24
+ "tilth*": allow
25
+ "npx tilth*": allow
24
26
  "git log*": allow
25
27
  "git blame*": allow
26
28
  "git show*": allow
@@ -95,20 +97,29 @@ If the request is ambiguous, state your interpretation assumption at the top —
95
97
 
96
98
  ## Phase 2 — Gather Local Evidence
97
99
 
98
- Use **LSP tools first**, then `tilth`/`read`/`glob`/`grep`, then git history last.
100
+ Use **LSP tools first**, then `bash: tilth`/`read`/`glob`/`grep`, then git history last.
99
101
 
100
- > Load the `tilth-reading` skill for file reading. Priority: `tilth <path>` → `read` (fallback) → `glob` + `grep` (fallback).
101
- > The runtime hook enhances `read` output via tilth automatically when tilth is available.
102
+ > Load the `tilth-reading` skill for file reading.
103
+ > `tilth` is permitted via bash (`tilth*: allow` in your frontmatter).
104
+ > Priority: `bash: tilth <path>` → `read` (auto-enhanced fallback) → `glob` + `grep`.
105
+
106
+ ```bash
107
+ # Explicit tilth for outline or section (allowed via bash permissions)
108
+ bash: tilth <path>
109
+ bash: tilth <path> --section "## SectionName"
110
+ bash: tilth <path> --section 45-89
111
+ ```
102
112
 
103
113
  | Priority | What to find | Tools |
104
114
  |----------|-------------|-------|
105
115
  | 1 | Symbol definitions, type signatures, current design | `lsp_workspace_symbols`, `lsp_goto_definition`, `lsp_hover` |
106
116
  | 2 | All callers / consumers of affected code | `lsp_find_references` |
107
117
  | 3 | Structural patterns, coupling, duplication | `ast_grep_search`, `grep` |
108
- | 4 | File content — smart read (outline or full) | `tilth <path>` → `read <path>` (fallback) |
109
- | 5 | File structure, scope of change | `glob`, directory listing via `read` |
110
- | 6 | Recent changes, authorship, regression risk | `bash: git log`, `git blame`, `git diff` |
111
- | 7 | Type errors, lint issues in affected scope | `lsp_diagnostics` |
118
+ | 4 | File content — smart read (outline or full) | `bash: tilth <path>` → `read <path>` (fallback) |
119
+ | 5 | File section targeted by heading or range | `bash: tilth <path> --section "…"` |
120
+ | 6 | File structure, scope of change | `glob`, directory listing via `read` |
121
+ | 7 | Recent changes, authorship, regression risk | `bash: git log`, `git blame`, `git diff` |
122
+ | 8 | Type errors, lint issues in affected scope | `lsp_diagnostics` |
112
123
 
113
124
  **Stop when you have enough evidence to make a well-grounded recommendation.** Do not over-read beyond what the decision requires.
114
125