@kitnai/cli 0.1.0 → 0.1.3
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 +186 -0
- package/dist/index.js +697 -234
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# @kitnai/cli
|
|
2
|
+
|
|
3
|
+
CLI for installing AI agent components from the kitn registry.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run directly with npx
|
|
9
|
+
npx @kitnai/cli init
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g @kitnai/cli
|
|
13
|
+
kitn init
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Works with any package manager:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bunx @kitnai/cli init
|
|
20
|
+
pnpm dlx @kitnai/cli init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
### `kitn init`
|
|
26
|
+
|
|
27
|
+
Initialize kitn in your project. Creates a `kitn.json` configuration file.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
kitn init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Prompts for:
|
|
34
|
+
- **Runtime**: bun, node, or deno
|
|
35
|
+
- **Alias directories**: Where each component type gets installed (defaults to `src/agents`, `src/tools`, `src/skills`, `src/storage`)
|
|
36
|
+
|
|
37
|
+
Also offers to install `@kitnai/hono` as a dependency.
|
|
38
|
+
|
|
39
|
+
### `kitn add [components...]`
|
|
40
|
+
|
|
41
|
+
Add components from the registry. Resolves `registryDependencies` transitively.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Add a single component
|
|
45
|
+
kitn add weather-agent
|
|
46
|
+
|
|
47
|
+
# Add multiple components
|
|
48
|
+
kitn add weather-agent hackernews-tool eli5
|
|
49
|
+
|
|
50
|
+
# Overwrite existing files without prompting
|
|
51
|
+
kitn add weather-agent --overwrite
|
|
52
|
+
|
|
53
|
+
# Filter interactive selection by type
|
|
54
|
+
kitn add --type agent
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Flags:**
|
|
58
|
+
|
|
59
|
+
| Flag | Description |
|
|
60
|
+
|------|-------------|
|
|
61
|
+
| `-o, --overwrite` | Overwrite existing files without prompting |
|
|
62
|
+
| `-t, --type <type>` | Filter components by type when browsing |
|
|
63
|
+
|
|
64
|
+
When a file already exists and differs from the registry version, you'll see a unified diff and be prompted to keep your version or overwrite.
|
|
65
|
+
|
|
66
|
+
After installation, the CLI:
|
|
67
|
+
- Installs npm dependencies via your detected package manager
|
|
68
|
+
- Checks for missing environment variables
|
|
69
|
+
- Shows post-install documentation
|
|
70
|
+
|
|
71
|
+
### `kitn list`
|
|
72
|
+
|
|
73
|
+
List available and installed components from the registry.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# List all components
|
|
77
|
+
kitn list
|
|
78
|
+
|
|
79
|
+
# Only show installed components
|
|
80
|
+
kitn list --installed
|
|
81
|
+
|
|
82
|
+
# Filter by type
|
|
83
|
+
kitn list --type tool
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Flags:**
|
|
87
|
+
|
|
88
|
+
| Flag | Description |
|
|
89
|
+
|------|-------------|
|
|
90
|
+
| `-i, --installed` | Only show installed components |
|
|
91
|
+
| `-t, --type <type>` | Filter by type (`agent`, `tool`, `skill`, `storage`) |
|
|
92
|
+
|
|
93
|
+
### `kitn diff <component>`
|
|
94
|
+
|
|
95
|
+
Show differences between your local version and the current registry version.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
kitn diff weather-agent
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Outputs a unified diff for each file in the component. Shows "up to date" if there are no differences.
|
|
102
|
+
|
|
103
|
+
### `kitn remove <component>`
|
|
104
|
+
|
|
105
|
+
Remove an installed component. Deletes files and removes tracking from `kitn.json`.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
kitn remove weather-agent
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Prompts for confirmation before deleting files.
|
|
112
|
+
|
|
113
|
+
### `kitn update [components...]`
|
|
114
|
+
|
|
115
|
+
Update installed components to the latest registry version.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Update specific components
|
|
119
|
+
kitn update weather-agent weather-tool
|
|
120
|
+
|
|
121
|
+
# Update all installed components
|
|
122
|
+
kitn update
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This re-fetches components from the registry and applies the same conflict resolution as `kitn add --overwrite`.
|
|
126
|
+
|
|
127
|
+
## Configuration
|
|
128
|
+
|
|
129
|
+
### `kitn.json`
|
|
130
|
+
|
|
131
|
+
Created by `kitn init`. Controls where components are installed and which registries to use.
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"$schema": "https://kitn.dev/schema/config.json",
|
|
136
|
+
"runtime": "bun",
|
|
137
|
+
"aliases": {
|
|
138
|
+
"agents": "src/agents",
|
|
139
|
+
"tools": "src/tools",
|
|
140
|
+
"skills": "src/skills",
|
|
141
|
+
"storage": "src/storage"
|
|
142
|
+
},
|
|
143
|
+
"registries": {
|
|
144
|
+
"@kitn": "https://kitn-ai.github.io/registry/r/{type}/{name}.json"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
| Field | Description |
|
|
150
|
+
|-------|-------------|
|
|
151
|
+
| `runtime` | `bun`, `node`, or `deno` |
|
|
152
|
+
| `aliases` | Directory paths for each component type |
|
|
153
|
+
| `registries` | Named registries with URL templates |
|
|
154
|
+
| `installed` | Auto-managed tracking of installed components (don't edit manually) |
|
|
155
|
+
|
|
156
|
+
### Custom Registries
|
|
157
|
+
|
|
158
|
+
Add custom registries alongside or instead of the default:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"registries": {
|
|
163
|
+
"@kitn": "https://kitn-ai.github.io/registry/r/{type}/{name}.json",
|
|
164
|
+
"@myteam": "https://registry.myteam.dev/r/{type}/{name}.json"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The URL template uses `{type}` and `{name}` placeholders. Components are fetched by replacing these with the component's type directory (`agents`, `tools`, `skills`, `storage`) and name.
|
|
170
|
+
|
|
171
|
+
The registry index is fetched by replacing `{type}/{name}.json` with `registry.json` in the URL template.
|
|
172
|
+
|
|
173
|
+
## Package Manager Detection
|
|
174
|
+
|
|
175
|
+
The CLI automatically detects your package manager by checking for lockfiles in this order:
|
|
176
|
+
|
|
177
|
+
1. `bun.lock` / `bun.lockb` → bun
|
|
178
|
+
2. `pnpm-lock.yaml` → pnpm
|
|
179
|
+
3. `yarn.lock` → yarn
|
|
180
|
+
4. `package-lock.json` → npm
|
|
181
|
+
|
|
182
|
+
## How It Works
|
|
183
|
+
|
|
184
|
+
Components are **source code**, not packages. `kitn add` copies TypeScript files directly into your project. You own the code and can modify it freely.
|
|
185
|
+
|
|
186
|
+
The CLI tracks what it installed in `kitn.json` under `installed`, storing file paths and content hashes. This enables `kitn diff` to detect local changes and `kitn update` to apply registry updates.
|