agentikit 0.0.7 → 0.0.9

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.
Files changed (98) hide show
  1. package/README.md +215 -76
  2. package/dist/index.d.ts +17 -3
  3. package/dist/index.js +10 -2
  4. package/dist/src/asset-spec.d.ts +14 -0
  5. package/dist/src/asset-spec.js +46 -0
  6. package/dist/src/cli.js +268 -57
  7. package/dist/src/common.d.ts +8 -0
  8. package/dist/src/common.js +46 -0
  9. package/dist/src/config.d.ts +37 -0
  10. package/dist/src/config.js +124 -0
  11. package/dist/src/embedder.d.ts +10 -0
  12. package/dist/src/embedder.js +87 -0
  13. package/dist/src/frontmatter.d.ts +30 -0
  14. package/dist/src/frontmatter.js +86 -0
  15. package/dist/src/indexer.d.ts +20 -2
  16. package/dist/src/indexer.js +212 -80
  17. package/dist/src/init.d.ts +19 -0
  18. package/dist/src/init.js +87 -0
  19. package/dist/src/llm.d.ts +15 -0
  20. package/dist/src/llm.js +91 -0
  21. package/dist/src/markdown.d.ts +18 -0
  22. package/dist/src/markdown.js +77 -0
  23. package/dist/src/metadata.d.ts +11 -2
  24. package/dist/src/metadata.js +161 -29
  25. package/dist/src/registry-install.d.ts +11 -0
  26. package/dist/src/registry-install.js +208 -0
  27. package/dist/src/registry-resolve.d.ts +3 -0
  28. package/dist/src/registry-resolve.js +231 -0
  29. package/dist/src/registry-search.d.ts +5 -0
  30. package/dist/src/registry-search.js +129 -0
  31. package/dist/src/registry-types.d.ts +55 -0
  32. package/dist/src/registry-types.js +1 -0
  33. package/dist/src/ripgrep-install.d.ts +12 -0
  34. package/dist/src/ripgrep-install.js +169 -0
  35. package/dist/src/ripgrep-resolve.d.ts +13 -0
  36. package/dist/src/ripgrep-resolve.js +68 -0
  37. package/dist/src/ripgrep.d.ts +3 -36
  38. package/dist/src/ripgrep.js +2 -262
  39. package/dist/src/similarity.d.ts +1 -2
  40. package/dist/src/similarity.js +11 -0
  41. package/dist/src/stash-add.d.ts +4 -0
  42. package/dist/src/stash-add.js +59 -0
  43. package/dist/src/stash-ref.d.ts +7 -0
  44. package/dist/src/stash-ref.js +33 -0
  45. package/dist/src/stash-registry.d.ts +18 -0
  46. package/dist/src/stash-registry.js +221 -0
  47. package/dist/src/stash-resolve.d.ts +2 -0
  48. package/dist/src/stash-resolve.js +45 -0
  49. package/dist/src/stash-search.d.ts +8 -0
  50. package/dist/src/stash-search.js +484 -0
  51. package/dist/src/stash-show.d.ts +5 -0
  52. package/dist/src/stash-show.js +114 -0
  53. package/dist/src/stash-types.d.ts +217 -0
  54. package/dist/src/stash-types.js +1 -0
  55. package/dist/src/stash.d.ts +10 -63
  56. package/dist/src/stash.js +6 -633
  57. package/dist/src/tool-runner.d.ts +35 -0
  58. package/dist/src/tool-runner.js +100 -0
  59. package/dist/src/walker.d.ts +19 -0
  60. package/dist/src/walker.js +47 -0
  61. package/package.json +8 -14
  62. package/src/asset-spec.ts +69 -0
  63. package/src/cli.ts +282 -46
  64. package/src/common.ts +58 -0
  65. package/src/config.ts +183 -0
  66. package/src/embedder.ts +117 -0
  67. package/src/frontmatter.ts +95 -0
  68. package/src/indexer.ts +244 -84
  69. package/src/init.ts +106 -0
  70. package/src/llm.ts +124 -0
  71. package/src/markdown.ts +106 -0
  72. package/src/metadata.ts +171 -27
  73. package/src/registry-install.ts +245 -0
  74. package/src/registry-resolve.ts +272 -0
  75. package/src/registry-search.ts +145 -0
  76. package/src/registry-types.ts +64 -0
  77. package/src/ripgrep-install.ts +200 -0
  78. package/src/ripgrep-resolve.ts +72 -0
  79. package/src/ripgrep.ts +3 -315
  80. package/src/similarity.ts +13 -1
  81. package/src/stash-add.ts +66 -0
  82. package/src/stash-ref.ts +41 -0
  83. package/src/stash-registry.ts +259 -0
  84. package/src/stash-resolve.ts +47 -0
  85. package/src/stash-search.ts +595 -0
  86. package/src/stash-show.ts +112 -0
  87. package/src/stash-types.ts +221 -0
  88. package/src/stash.ts +31 -760
  89. package/src/tool-runner.ts +129 -0
  90. package/src/walker.ts +53 -0
  91. package/.claude-plugin/plugin.json +0 -21
  92. package/commands/open.md +0 -11
  93. package/commands/run.md +0 -11
  94. package/commands/search.md +0 -11
  95. package/dist/src/plugin.d.ts +0 -2
  96. package/dist/src/plugin.js +0 -55
  97. package/skills/stash/SKILL.md +0 -73
  98. package/src/plugin.ts +0 -56
package/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  # agentikit
2
2
 
3
- Agentikit is a stash toolkit for AI coding assistants. It exposes three tools so agents can **search**, **open**, and **run** extension assets directly from a stash directory. Works as both an **OpenCode plugin** and a **Claude Code plugin**.
3
+ Agentikit is a CLI tool and library for managing a stash of extension assets for AI coding assistants. It lets you **search** and **show** tools, skills, commands, and agents from a stash directory.
4
+
5
+ The CLI is called **akm** (Agentikit Manager).
4
6
 
5
7
  ## Installation
6
8
 
7
9
  ### npm / bun
8
10
 
9
11
  ```sh
10
- npm install @itlackey/agentikit
12
+ npm install -g agentikit
11
13
  # or
12
- bun add @itlackey/agentikit
14
+ bun add -g agentikit
13
15
  ```
14
16
 
15
17
  ### Standalone binary
@@ -17,131 +19,268 @@ bun add @itlackey/agentikit
17
19
  Use the install scripts for a copy/paste install:
18
20
 
19
21
  ```sh
20
- # macOS / Linux (recommended: pin a release tag)
22
+ # macOS / Linux
23
+ curl -fsSL https://raw.githubusercontent.com/itlackey/agentikit/main/install.sh | bash
24
+ # pin a release tag)
21
25
  curl -fsSL https://raw.githubusercontent.com/itlackey/agentikit/main/install.sh | bash -s -- v1.2.3
22
- ```
23
26
 
24
- ```sh
25
27
  # PowerShell (Windows)
26
- irm https://raw.githubusercontent.com/itlackey/agentikit/main/install.ps1 -OutFile install.ps1; ./install.ps1 v1.2.3
28
+ irm https://raw.githubusercontent.com/itlackey/agentikit/main/install.ps1 -OutFile install.ps1; ./install.ps1
27
29
  ```
28
30
 
29
31
  The shell installer verifies the downloaded binary against release `checksums.txt` before installing it.
30
32
 
31
- ### OpenCode plugin
33
+ ## Stash model
32
34
 
33
- Add agentikit to the `plugin` array in your OpenCode config (`opencode.json`):
35
+ Set a stash path via `AGENTIKIT_STASH_DIR`, or run `akm init` to create one automatically.
34
36
 
35
- ```json
36
- {
37
- "plugin": ["@itlackey/agentikit"]
38
- }
37
+ ```sh
38
+ export AGENTIKIT_STASH_DIR=/abs/path/to/your-stash
39
39
  ```
40
40
 
41
- ### Claude Code plugin
41
+ Expected stash layout:
42
+
43
+ ```
44
+ $AGENTIKIT_STASH_DIR/
45
+ ├── tools/ # recursive files (.sh, .ts, .js, .ps1, .cmd, .bat)
46
+ ├── skills/ # skill directories containing SKILL.md
47
+ ├── commands/ # markdown files
48
+ ├── agents/ # markdown files
49
+ └── knowledge/ # markdown files
50
+ ```
42
51
 
43
- Install agentikit as a Claude Code plugin by pointing to the repo directory:
52
+ ## CLI usage
44
53
 
45
54
  ```sh
46
- claude --plugin-dir /path/to/agentikit
55
+ akm init # Initialize stash directory and set AGENTIKIT_STASH_DIR
56
+ akm index [--full] # Build search index (incremental by default)
57
+ akm add <ref> # Install a registry kit by npm/GitHub ref
58
+ akm list # List installed registry kits from config.registry.installed
59
+ akm remove <target> # Remove installed kit by id/ref (or parsed ref id)
60
+ akm update [target] [--all] # Fresh install from current ref(s), report changed revision/version
61
+ akm reinstall [target] [--all] # Reinstall from stored refs
62
+ akm search [query] # Search local stash and/or registry
63
+ akm show <type:name> # Read a stash asset by ref
47
64
  ```
48
65
 
49
- Or add it to a plugin marketplace for team distribution. See the [Claude Code plugins documentation](https://code.claude.com/docs/en/plugins) for details.
66
+ ### add
50
67
 
51
- Once installed, the plugin provides:
68
+ Install a registry reference and make it searchable immediately.
52
69
 
53
- - **Skill** (`agentikit:stash`) — Claude automatically uses this when you ask about stash assets
54
- - **Commands** — `/agentikit:search`, `/agentikit:open`, `/agentikit:run` slash commands
70
+ ```sh
71
+ akm add @scope/kit
72
+ akm add npm:@scope/kit@latest
73
+ akm add owner/repo
74
+ akm add github:owner/repo#v1.2.3
75
+ ```
55
76
 
56
- ## Stash model
77
+ - Uses registry resolution + install helpers (`npm` and `github` refs)
78
+ - Updates `config.json` registry install records and syncs `additionalStashDirs`
79
+ - If an existing install with the same id is replaced, old cache directories are cleaned up (best effort)
80
+ - Triggers an incremental index build
81
+ - Returns JSON with install details and index stats
57
82
 
58
- Set a stash path via `AGENTIKIT_STASH_DIR`.
83
+ ### list
84
+
85
+ Show installed entries from `config.registry.installed`.
86
+
87
+ - Source of truth is config, not cache directory discovery
88
+ - Each entry includes status flags:
89
+ - `status.cacheDirExists`
90
+ - `status.stashRootExists`
91
+
92
+ ### remove
93
+
94
+ Remove a single installed entry and reindex incrementally.
59
95
 
60
96
  ```sh
61
- export AGENTIKIT_STASH_DIR=/abs/path/to/your-stash
97
+ akm remove npm:@scope/kit
98
+ akm remove github:owner/repo
99
+ akm remove owner/repo
62
100
  ```
63
101
 
64
- Expected stash layout:
102
+ - Target resolution order: exact `id`, exact stored `ref`, then parsed ref `id`
103
+ - Removes entry via config helper (also syncs `additionalStashDirs`)
104
+ - Deletes prior `cacheDir` best effort
105
+ - Runs one incremental reindex
65
106
 
66
- ```
67
- $AGENTIKIT_STASH_DIR/
68
- ├── tools/ # recursive files (.sh, .ts, .js, .ps1, .cmd, .bat)
69
- ├── skills/ # skill directories containing SKILL.md
70
- ├── commands/ # markdown files
71
- └── agents/ # markdown files
107
+ ### reinstall
108
+
109
+ Reinstall one entry or all entries from stored refs.
110
+
111
+ ```sh
112
+ akm reinstall npm:@scope/kit
113
+ akm reinstall --all
72
114
  ```
73
115
 
74
- ## Tools
116
+ - Uses the same registry install flow as `akm add`
117
+ - Upserts config entries + `additionalStashDirs`
118
+ - Cleans up replaced cache directories best effort
119
+ - Runs one incremental reindex after all installs
75
120
 
76
- When loaded as a plugin (OpenCode or Claude Code), Agentikit provides three tools:
121
+ ### update
77
122
 
78
- - `agentikit_search({ query, type?, limit? })`
79
- - `agentikit_open({ ref })`
80
- - `agentikit_run({ ref })`
123
+ Update one entry or all entries by doing a fresh resolve/install from each current ref.
81
124
 
82
- ### `agentikit_search`
125
+ ```sh
126
+ akm update npm:@scope/kit
127
+ akm update --all
128
+ ```
129
+
130
+ - Same target selection rules as `reinstall`
131
+ - Floating refs (for example `@latest` or default branch) resolve to newest available artifact
132
+ - Reports per-entry change flags for version/revision (`changed.version`, `changed.revision`, `changed.any`)
133
+ - Runs one incremental reindex after all installs
83
134
 
84
- Search the stash for extension assets.
135
+ ### search
136
+
137
+ Search local stash assets, registry entries, or both.
138
+
139
+ ```sh
140
+ akm search "deploy" --type tool --limit 10 --usage both
141
+ akm search "lint" --source registry
142
+ akm search "docker" --source both
143
+ ```
85
144
 
86
145
  - `query`: case-insensitive substring over stable names (relative paths)
87
- - `type`: `tool | skill | command | agent | any` (default: `any`)
88
- - `limit`: defaults to `20`
146
+ - `--type`: `tool | skill | command | agent | knowledge | any` (default: `any`)
147
+ - `--limit`: defaults to `20`
148
+ - `--usage`: `none | both | item | guide` (default: `both`)
149
+ - `--source`: `local | registry | both` (default: `local`)
150
+
151
+ By default (`--source local`), results are the existing stash hits with `openRef`, score/explainability details (`score`, `whyMatched`), and, for tools, execution-ready `runCmd`.
89
152
 
90
- Returns typed hits with `openRef` and, for tools, execution-ready `runCmd`.
153
+ When registry results are included (`--source registry|both`), each registry hit includes explicit install guidance:
91
154
 
92
- Tool command generation:
155
+ - `installRef` (normalized ref for install)
156
+ - `installCmd` (ready-to-run command, e.g. `akm add npm:@scope/kit`)
93
157
 
94
- - `.sh` `bash "<absolute-file>"`
95
- - `.ps1` `powershell -ExecutionPolicy Bypass -File "<absolute-file>"`
96
- - `.cmd`/`.bat` → `cmd /c "<absolute-file>"`
97
- - `.ts`/`.js`:
98
- - find nearest `package.json` from script dir upward to stash `tools/` root
99
- - if found: `cd "<pkgDir>" && bun "<absolute-file>"`
100
- - else: `bun "<absolute-file>"`
101
- - optional: set `AGENTIKIT_BUN_INSTALL=true` to include `bun install` before running
158
+ - `usageGuide` is included by default (`--usage both`) and explains how to use each hit type.
159
+ - Per-hit `usage` is optional metadata from `.stash.json` and is included when present.
102
160
 
103
- ### `agentikit_open`
161
+ ### show
104
162
 
105
- Open a hit using `openRef` from search results.
163
+ Show a hit using `openRef` from search results.
164
+
165
+ ```sh
166
+ akm show skill:code-review
167
+ akm show knowledge:guide.md --view toc
168
+ akm show knowledge:guide.md --view section --heading "Getting Started"
169
+ akm show knowledge:guide.md --view lines --start 10 --end 30
170
+ ```
106
171
 
107
172
  Returns full payload by type:
108
173
 
109
- - `skill` full `SKILL.md` content
110
- - `command` full markdown body as `template` (+ best-effort `description`)
111
- - `agent` full markdown body as `prompt` (+ best-effort `description`, `toolPolicy`, `modelHint`)
112
- - `tool` `runCmd`/`kind`
174
+ - `skill` full `SKILL.md` content
175
+ - `command` full markdown body as `template` (+ best-effort `description`)
176
+ - `agent` full markdown body as `prompt` (+ best-effort `description`, `toolPolicy`, `modelHint`)
177
+ - `tool` `runCmd`/`kind` (the agent uses the host's shell to execute `runCmd`)
178
+ - `knowledge` — content with optional view modes (`full`, `toc`, `frontmatter`, `section`, `lines`)
179
+
180
+ ## Library API
181
+
182
+ Agentikit also exports its core functions for use as a library:
183
+
184
+ ```ts
185
+ import {
186
+ agentikitAdd,
187
+ agentikitList,
188
+ agentikitRemove,
189
+ agentikitReinstall,
190
+ agentikitUpdate,
191
+ agentikitSearch,
192
+ agentikitShow,
193
+ agentikitInit,
194
+ agentikitIndex,
195
+ } from "agentikit"
196
+ ```
113
197
 
114
- ### `agentikit_run`
198
+ - `agentikitAdd({ ref })` — install a registry reference and index it
199
+ - `agentikitList()` — list installed registry entries and filesystem status flags
200
+ - `agentikitRemove({ target })` — remove one installed entry and reindex incrementally
201
+ - `agentikitReinstall({ target? , all? })` — reinstall one/all installed entries
202
+ - `agentikitUpdate({ target? , all? })` — fresh resolve/install one/all installed entries with change reporting
203
+ - `agentikitSearch({ query, type?, limit?, usage?, source? })` — search local stash and/or registry
204
+ - `agentikitShow({ ref, view? })` — show a stash asset
205
+ - `agentikitInit()` — initialize stash directory
206
+ - `agentikitIndex()` — build/rebuild search index
115
207
 
116
- Execute a tool from the stash by its `openRef`. Only `tool:` refs are supported.
208
+ ## Configuration
117
209
 
118
- - `ref`: open reference of a tool returned by `agentikit_search`
210
+ Agentikit stores configuration in `config.json` inside the stash directory.
119
211
 
120
- Returns `{ type, name, path, output, exitCode }`.
212
+ ```sh
213
+ akm config # Show current config
214
+ akm config --set key=value # Update a config key
215
+ ```
121
216
 
122
- ## Usage example
217
+ ### Embedding connection
123
218
 
124
- 1. `agentikit_search({ query: "deploy", type: "tool" })`
125
- 2. `agentikit_run({ ref: "<openRef from search>" })`
219
+ By default, agentikit uses the local `@xenova/transformers` library for embeddings. You can configure an OpenAI-compatible embedding endpoint instead:
126
220
 
127
- Or:
221
+ ```sh
222
+ akm config --set 'embedding={"endpoint":"http://localhost:11434/v1/embeddings","model":"nomic-embed-text"}'
223
+ ```
128
224
 
129
- 1. `agentikit_search({ query: "release", type: "command" })`
130
- 2. `agentikit_open({ ref: "<openRef from search>" })`
131
- 3. Apply returned template in-session
225
+ To clear the custom embedding config and revert to local embeddings:
132
226
 
133
- ## Package exports
227
+ ```sh
228
+ akm config --set 'embedding=null'
229
+ ```
134
230
 
135
- - `plugin` — OpenCode plugin exposing `agentikit_search`, `agentikit_open`, and `agentikit_run`
136
- - `agentikitSearch` / `agentikitOpen` / `agentikitRun` — direct library APIs
231
+ ### LLM connection
137
232
 
138
- ## Notes
233
+ When configured, agentikit uses an OpenAI-compatible LLM to generate richer metadata (descriptions, intents, tags) during indexing:
139
234
 
140
- - Agentikit does not write to `.opencode/` or `.claude/`.
141
- - Agentikit does not install or copy kit files.
142
- - Missing or unreadable stash paths return friendly errors.
235
+ ```sh
236
+ akm config --set 'llm={"endpoint":"http://localhost:11434/v1/chat/completions","model":"llama3.2"}'
237
+ ```
238
+
239
+ To clear:
240
+
241
+ ```sh
242
+ akm config --set 'llm=null'
243
+ ```
244
+
245
+ ### Using a local Ollama instance
246
+
247
+ [Ollama](https://ollama.com) provides local models with an OpenAI-compatible API. After installing Ollama and pulling your models:
248
+
249
+ ```sh
250
+ # Pull models
251
+ ollama pull nomic-embed-text
252
+ ollama pull llama3.2
253
+
254
+ # Configure agentikit to use Ollama for both embeddings and metadata generation
255
+ akm config --set 'embedding={"endpoint":"http://localhost:11434/v1/embeddings","model":"nomic-embed-text"}'
256
+ akm config --set 'llm={"endpoint":"http://localhost:11434/v1/chat/completions","model":"llama3.2"}'
143
257
 
144
- ## Docs
258
+ # Rebuild the index — embeddings use Ollama, metadata is LLM-enhanced
259
+ akm index --full
260
+ ```
145
261
 
146
- - **OpenCode**: [Plugins](https://opencode.ai/docs/plugins/) · [Commands](https://opencode.ai/docs/commands/) · [Agents](https://opencode.ai/docs/agents/) · [Agent Skills](https://opencode.ai/docs/skills/) · [Custom tools](https://opencode.ai/docs/custom-tools/) · [Config](https://opencode.ai/docs/config/)
147
- - **Claude Code**: [Plugins](https://code.claude.com/docs/en/plugins) · [Skills](https://code.claude.com/docs/en/skills) · [Plugins reference](https://code.claude.com/docs/en/plugins-reference)
262
+ Both `embedding` and `llm` accept an optional `apiKey` field for authenticated endpoints:
263
+
264
+ ```json
265
+ {
266
+ "endpoint": "https://api.openai.com/v1/embeddings",
267
+ "model": "text-embedding-3-small",
268
+ "apiKey": "sk-..."
269
+ }
270
+ ```
271
+
272
+ ### Config reference
273
+
274
+ | Key | Type | Default | Description |
275
+ |-----|------|---------|-------------|
276
+ | `semanticSearch` | `boolean` | `true` | Enable semantic search ranking |
277
+ | `additionalStashDirs` | `string[]` | `[]` | Extra stash directories to search |
278
+ | `embedding` | `object` | not set | OpenAI-compatible embedding endpoint (`endpoint`, `model`, `apiKey?`) |
279
+ | `llm` | `object` | not set | OpenAI-compatible LLM endpoint (`endpoint`, `model`, `apiKey?`) |
280
+
281
+ ## Notes
282
+
283
+ - `akm add` installs registry kits into the local cache and adds discovered stash roots to `additionalStashDirs`.
284
+ - Registry lifecycle commands (`list`, `remove`, `reinstall`, `update`) use `config.registry.installed` as the source of truth.
285
+ - When commands fail, CLI errors are returned as structured JSON with `error` and `hint` fields.
286
+ - Missing or unreadable stash paths return friendly errors.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,22 @@
1
- export { plugin } from "./src/plugin";
2
- export { agentikitSearch, agentikitOpen, agentikitRun, agentikitInit } from "./src/stash";
3
- export type { AgentikitAssetType, AgentikitSearchType, SearchHit, SearchResponse, OpenResponse, RunResponse, InitResponse, } from "./src/stash";
1
+ export { agentikitAdd, agentikitList, agentikitRemove, agentikitReinstall, agentikitSearch, agentikitShow, agentikitUpdate, } from "./src/stash";
2
+ export { agentikitInit } from "./src/init";
3
+ export type { InitResponse } from "./src/init";
4
+ export type { AgentikitAssetType, AgentikitSearchType, AddResponse, LocalSearchHit, RegistrySearchResultHit, SearchSource, SearchHit, SearchResponse, ShowResponse, KnowledgeView, ListResponse, RemoveResponse, ReinstallResponse, UpdateResponse, RegistryListEntry, RegistryInstallStatus, ReinstallResultItem, UpdateResultItem, } from "./src/stash";
5
+ export type { ToolKind } from "./src/tool-runner";
4
6
  export { agentikitIndex } from "./src/indexer";
5
7
  export type { IndexResponse } from "./src/indexer";
6
8
  export type { StashEntry, StashFile, StashIntent } from "./src/metadata";
7
9
  export { resolveRg, isRgAvailable, ensureRg } from "./src/ripgrep";
8
10
  export type { EnsureRgResult } from "./src/ripgrep";
11
+ export { parseMarkdownToc, extractSection, extractLineRange, extractFrontmatterOnly, formatToc } from "./src/markdown";
12
+ export type { TocHeading, KnowledgeToc } from "./src/markdown";
13
+ export { parseFrontmatter } from "./src/frontmatter";
14
+ export { loadConfig, saveConfig, updateConfig } from "./src/config";
15
+ export type { AgentikitConfig, EmbeddingConnectionConfig, LlmConnectionConfig, RegistryConfig } from "./src/config";
16
+ export { parseRegistryRef, resolveRegistryArtifact } from "./src/registry-resolve";
17
+ export { searchRegistry } from "./src/registry-search";
18
+ export { installRegistryRef, upsertInstalledRegistryEntry, removeInstalledRegistryEntry, getRegistryCacheRootDir, detectStashRoot, } from "./src/registry-install";
19
+ export type { RegistrySource, ParsedRegistryRef, ParsedNpmRef, ParsedGithubRef, ResolvedRegistryArtifact, RegistryInstalledEntry, RegistryInstallResult, RegistrySearchHit, RegistrySearchResponse, } from "./src/registry-types";
20
+ export { enhanceMetadata, isLlmAvailable } from "./src/llm";
21
+ export { embed, cosineSimilarity, isEmbeddingAvailable } from "./src/embedder";
22
+ export type { EmbeddingVector } from "./src/embedder";
package/dist/index.js CHANGED
@@ -1,4 +1,12 @@
1
- export { plugin } from "./src/plugin";
2
- export { agentikitSearch, agentikitOpen, agentikitRun, agentikitInit } from "./src/stash";
1
+ export { agentikitAdd, agentikitList, agentikitRemove, agentikitReinstall, agentikitSearch, agentikitShow, agentikitUpdate, } from "./src/stash";
2
+ export { agentikitInit } from "./src/init";
3
3
  export { agentikitIndex } from "./src/indexer";
4
4
  export { resolveRg, isRgAvailable, ensureRg } from "./src/ripgrep";
5
+ export { parseMarkdownToc, extractSection, extractLineRange, extractFrontmatterOnly, formatToc } from "./src/markdown";
6
+ export { parseFrontmatter } from "./src/frontmatter";
7
+ export { loadConfig, saveConfig, updateConfig } from "./src/config";
8
+ export { parseRegistryRef, resolveRegistryArtifact } from "./src/registry-resolve";
9
+ export { searchRegistry } from "./src/registry-search";
10
+ export { installRegistryRef, upsertInstalledRegistryEntry, removeInstalledRegistryEntry, getRegistryCacheRootDir, detectStashRoot, } from "./src/registry-install";
11
+ export { enhanceMetadata, isLlmAvailable } from "./src/llm";
12
+ export { embed, cosineSimilarity, isEmbeddingAvailable } from "./src/embedder";
@@ -0,0 +1,14 @@
1
+ import type { AgentikitAssetType } from "./common";
2
+ export declare const SCRIPT_EXTENSIONS: Set<string>;
3
+ export interface AssetSpec {
4
+ stashDir: string;
5
+ isRelevantFile: (fileName: string) => boolean;
6
+ toCanonicalName: (typeRoot: string, filePath: string) => string | undefined;
7
+ toAssetPath: (typeRoot: string, name: string) => string;
8
+ }
9
+ export declare const ASSET_SPECS: Record<AgentikitAssetType, AssetSpec>;
10
+ export declare const ASSET_TYPES: AgentikitAssetType[];
11
+ export declare const TYPE_DIRS: Record<AgentikitAssetType, string>;
12
+ export declare function isRelevantAssetFile(assetType: AgentikitAssetType, fileName: string): boolean;
13
+ export declare function deriveCanonicalAssetName(assetType: AgentikitAssetType, typeRoot: string, filePath: string): string | undefined;
14
+ export declare function resolveAssetPathFromName(assetType: AgentikitAssetType, typeRoot: string, name: string): string;
@@ -0,0 +1,46 @@
1
+ import path from "node:path";
2
+ export const SCRIPT_EXTENSIONS = new Set([".sh", ".ts", ".js", ".ps1", ".cmd", ".bat"]);
3
+ const markdownSpec = {
4
+ isRelevantFile: (fileName) => path.extname(fileName).toLowerCase() === ".md",
5
+ toCanonicalName: (typeRoot, filePath) => toPosix(path.relative(typeRoot, filePath)),
6
+ toAssetPath: (typeRoot, name) => path.join(typeRoot, name),
7
+ };
8
+ export const ASSET_SPECS = {
9
+ tool: {
10
+ stashDir: "tools",
11
+ isRelevantFile: (fileName) => SCRIPT_EXTENSIONS.has(path.extname(fileName).toLowerCase()),
12
+ toCanonicalName: (typeRoot, filePath) => toPosix(path.relative(typeRoot, filePath)),
13
+ toAssetPath: (typeRoot, name) => path.join(typeRoot, name),
14
+ },
15
+ skill: {
16
+ stashDir: "skills",
17
+ isRelevantFile: (fileName) => fileName === "SKILL.md",
18
+ toCanonicalName: (typeRoot, filePath) => {
19
+ const relDir = toPosix(path.dirname(path.relative(typeRoot, filePath)));
20
+ if (!relDir || relDir === ".")
21
+ return undefined;
22
+ return relDir;
23
+ },
24
+ toAssetPath: (typeRoot, name) => path.join(typeRoot, name, "SKILL.md"),
25
+ },
26
+ command: { stashDir: "commands", ...markdownSpec },
27
+ agent: { stashDir: "agents", ...markdownSpec },
28
+ knowledge: { stashDir: "knowledge", ...markdownSpec },
29
+ };
30
+ export const ASSET_TYPES = Object.keys(ASSET_SPECS);
31
+ export const TYPE_DIRS = ASSET_TYPES.reduce((acc, type) => {
32
+ acc[type] = ASSET_SPECS[type].stashDir;
33
+ return acc;
34
+ }, {});
35
+ export function isRelevantAssetFile(assetType, fileName) {
36
+ return ASSET_SPECS[assetType].isRelevantFile(fileName);
37
+ }
38
+ export function deriveCanonicalAssetName(assetType, typeRoot, filePath) {
39
+ return ASSET_SPECS[assetType].toCanonicalName(typeRoot, filePath);
40
+ }
41
+ export function resolveAssetPathFromName(assetType, typeRoot, name) {
42
+ return ASSET_SPECS[assetType].toAssetPath(typeRoot, name);
43
+ }
44
+ function toPosix(input) {
45
+ return input.replace(/\\/g, "/");
46
+ }