kodu 1.2.0 → 2.0.0
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/AGENTS.md +36 -68
- package/README.md +97 -96
- package/dist/package.json +1 -2
- package/dist/src/app.module.js +0 -8
- package/dist/src/app.module.js.map +1 -1
- package/dist/src/commands/init/init.command.d.ts +2 -9
- package/dist/src/commands/init/init.command.js +15 -241
- package/dist/src/commands/init/init.command.js.map +1 -1
- package/dist/src/commands/pack/pack.command.d.ts +7 -0
- package/dist/src/commands/pack/pack.command.js +59 -3
- package/dist/src/commands/pack/pack.command.js.map +1 -1
- package/dist/src/core/config/config.schema.d.ts +0 -46
- package/dist/src/core/config/config.schema.js +1 -51
- package/dist/src/core/config/config.schema.js.map +1 -1
- package/dist/src/core/config/config.service.js +2 -2
- package/dist/src/core/config/config.service.js.map +1 -1
- package/dist/src/core/config/prompt.service.d.ts +1 -4
- package/dist/src/core/config/prompt.service.js +4 -17
- package/dist/src/core/config/prompt.service.js.map +1 -1
- package/dist/src/shared/constants.d.ts +0 -4
- package/dist/src/shared/constants.js +1 -5
- package/dist/src/shared/constants.js.map +1 -1
- package/dist/src/shared/git/git.module.js +0 -2
- package/dist/src/shared/git/git.module.js.map +1 -1
- package/dist/src/shared/git/git.service.d.ts +0 -8
- package/dist/src/shared/git/git.service.js +2 -34
- package/dist/src/shared/git/git.service.js.map +1 -1
- package/dist/src/shared/tokenizer/tokenizer.module.js +0 -2
- package/dist/src/shared/tokenizer/tokenizer.module.js.map +1 -1
- package/dist/src/shared/tokenizer/tokenizer.service.d.ts +0 -6
- package/dist/src/shared/tokenizer/tokenizer.service.js +8 -38
- package/dist/src/shared/tokenizer/tokenizer.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/kodu.schema.json +0 -139
- package/package.json +1 -2
- package/src/app.module.ts +0 -8
- package/src/commands/init/init.command.ts +15 -310
- package/src/commands/pack/pack.command.ts +56 -3
- package/src/core/config/config.schema.ts +1 -68
- package/src/core/config/config.service.ts +2 -2
- package/src/core/config/prompt.service.ts +4 -26
- package/src/shared/constants.ts +0 -4
- package/src/shared/git/git.module.ts +0 -2
- package/src/shared/git/git.service.ts +1 -33
- package/src/shared/tokenizer/tokenizer.module.ts +0 -2
- package/src/shared/tokenizer/tokenizer.service.ts +9 -39
- package/.kodu/prompts/.keep +0 -0
- package/.kodu/prompts/commit.md +0 -9
- package/.kodu/prompts/pack.md +0 -7
- package/.kodu/prompts/review-bug.md +0 -6
- package/.kodu/prompts/review-security.md +0 -6
- package/.kodu/prompts/review-style.md +0 -6
- package/.opencode/command/openspec-apply.md +0 -24
- package/.opencode/command/openspec-archive.md +0 -27
- package/.opencode/command/openspec-proposal.md +0 -29
- package/.opencode/skills/kodu-ops/SKILL.md +0 -184
- package/dist/src/commands/commit/commit.command.d.ts +0 -18
- package/dist/src/commands/commit/commit.command.js +0 -149
- package/dist/src/commands/commit/commit.command.js.map +0 -1
- package/dist/src/commands/commit/commit.module.d.ts +0 -2
- package/dist/src/commands/commit/commit.module.js +0 -25
- package/dist/src/commands/commit/commit.module.js.map +0 -1
- package/dist/src/commands/ops/ops.command.d.ts +0 -4
- package/dist/src/commands/ops/ops.command.js +0 -39
- package/dist/src/commands/ops/ops.command.js.map +0 -1
- package/dist/src/commands/ops/ops.module.d.ts +0 -2
- package/dist/src/commands/ops/ops.module.js +0 -33
- package/dist/src/commands/ops/ops.module.js.map +0 -1
- package/dist/src/commands/ops/ops.types.d.ts +0 -13
- package/dist/src/commands/ops/ops.types.js +0 -12
- package/dist/src/commands/ops/ops.types.js.map +0 -1
- package/dist/src/commands/ops/ops.utils.d.ts +0 -13
- package/dist/src/commands/ops/ops.utils.js +0 -121
- package/dist/src/commands/ops/ops.utils.js.map +0 -1
- package/dist/src/commands/ops/subcommands/ops-env.command.d.ts +0 -24
- package/dist/src/commands/ops/subcommands/ops-env.command.js +0 -156
- package/dist/src/commands/ops/subcommands/ops-env.command.js.map +0 -1
- package/dist/src/commands/ops/subcommands/ops-routes.command.d.ts +0 -22
- package/dist/src/commands/ops/subcommands/ops-routes.command.js +0 -203
- package/dist/src/commands/ops/subcommands/ops-routes.command.js.map +0 -1
- package/dist/src/commands/ops/subcommands/ops-service.command.d.ts +0 -22
- package/dist/src/commands/ops/subcommands/ops-service.command.js +0 -169
- package/dist/src/commands/ops/subcommands/ops-service.command.js.map +0 -1
- package/dist/src/commands/ops/subcommands/ops-sysinfo.command.d.ts +0 -14
- package/dist/src/commands/ops/subcommands/ops-sysinfo.command.js +0 -75
- package/dist/src/commands/ops/subcommands/ops-sysinfo.command.js.map +0 -1
- package/dist/src/commands/review/review.command.d.ts +0 -26
- package/dist/src/commands/review/review.command.js +0 -205
- package/dist/src/commands/review/review.command.js.map +0 -1
- package/dist/src/commands/review/review.module.d.ts +0 -2
- package/dist/src/commands/review/review.module.js +0 -26
- package/dist/src/commands/review/review.module.js.map +0 -1
- package/dist/src/core/config/default-prompts.d.ts +0 -9
- package/dist/src/core/config/default-prompts.js +0 -49
- package/dist/src/core/config/default-prompts.js.map +0 -1
- package/dist/src/shared/ai/ai.module.d.ts +0 -2
- package/dist/src/shared/ai/ai.module.js +0 -23
- package/dist/src/shared/ai/ai.module.js.map +0 -1
- package/dist/src/shared/ai/ai.service.d.ts +0 -22
- package/dist/src/shared/ai/ai.service.js +0 -164
- package/dist/src/shared/ai/ai.service.js.map +0 -1
- package/dist/src/shared/ssh/ssh.module.d.ts +0 -2
- package/dist/src/shared/ssh/ssh.module.js +0 -21
- package/dist/src/shared/ssh/ssh.module.js.map +0 -1
- package/dist/src/shared/ssh/ssh.service.d.ts +0 -11
- package/dist/src/shared/ssh/ssh.service.js +0 -53
- package/dist/src/shared/ssh/ssh.service.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/commands/commit/commit.command.ts +0 -139
- package/src/commands/commit/commit.module.ts +0 -12
- package/src/commands/ops/ops.command.ts +0 -30
- package/src/commands/ops/ops.module.ts +0 -20
- package/src/commands/ops/ops.types.ts +0 -24
- package/src/commands/ops/ops.utils.ts +0 -160
- package/src/commands/ops/subcommands/ops-env.command.ts +0 -165
- package/src/commands/ops/subcommands/ops-routes.command.ts +0 -221
- package/src/commands/ops/subcommands/ops-service.command.ts +0 -190
- package/src/commands/ops/subcommands/ops-sysinfo.command.ts +0 -77
- package/src/commands/review/review.command.ts +0 -199
- package/src/commands/review/review.module.ts +0 -13
- package/src/core/config/default-prompts.ts +0 -53
- package/src/shared/ai/ai.module.ts +0 -10
- package/src/shared/ai/ai.service.ts +0 -216
- package/src/shared/ssh/ssh.module.ts +0 -8
- package/src/shared/ssh/ssh.service.ts +0 -61
package/AGENTS.md
CHANGED
|
@@ -4,11 +4,10 @@ This file provides guidelines and instructions for AI assistants working on the
|
|
|
4
4
|
|
|
5
5
|
## 1. Project Overview
|
|
6
6
|
|
|
7
|
-
**Kodu** is a high-performance CLI utility that bridges local development environments with LLMs. It automates context preparation
|
|
7
|
+
**Kodu** is a high-performance CLI utility that bridges local development environments with LLMs. It automates context preparation and code cleaning.
|
|
8
8
|
|
|
9
9
|
- **Key Goals:** Speed (<0.5s startup), Determinism (no AI for critical file ops), DX (Developer Experience)
|
|
10
|
-
- **
|
|
11
|
-
- **Available Commands:** `init`, `pack`, `clean`, `review`, `commit`, `ops`
|
|
10
|
+
- **Available Commands:** `pack`, `clean`
|
|
12
11
|
|
|
13
12
|
## 2. Technology Stack (Enforced)
|
|
14
13
|
|
|
@@ -18,10 +17,8 @@ This file provides guidelines and instructions for AI assistants working on the
|
|
|
18
17
|
| File System | node:fs/promises + tinyglobby | fs-extra, glob, rimraf |
|
|
19
18
|
| Config | lilconfig | cosmiconfig, rc |
|
|
20
19
|
| Validation | zod | class-validator, joi |
|
|
21
|
-
| Process/Git | execa | child_process, shelljs |
|
|
22
20
|
| CLI UI | @inquirer/prompts + picocolors | inquirer (legacy), chalk |
|
|
23
21
|
| Spinners | yocto-spinner | ora, cli-spinners |
|
|
24
|
-
| AI Agent | mastra | Direct openai SDK |
|
|
25
22
|
| AST/Parsing | ts-morph | Regex, babel |
|
|
26
23
|
| Tokens | js-tiktoken | gpt-3-encoder |
|
|
27
24
|
| Clipboard | clipboardy | Native APIs |
|
|
@@ -39,16 +36,10 @@ src/
|
|
|
39
36
|
├── shared/ # Shared Business Logic
|
|
40
37
|
│ ├── tokenizer/ # TokenizerModule
|
|
41
38
|
│ ├── git/ # GitModule
|
|
42
|
-
│ ├── ai/ # AiModule (Mastra)
|
|
43
39
|
│ └── cleaner/ # CleanerService (AST)
|
|
44
|
-
│ └── ssh/ # SshModule (remote ops via SSH)
|
|
45
40
|
└── commands/ # Feature Commands
|
|
46
|
-
├── init/ # kodu init
|
|
47
41
|
├── pack/ # kodu pack
|
|
48
|
-
|
|
49
|
-
├── review/ # kodu review
|
|
50
|
-
├── commit/ # kodu commit
|
|
51
|
-
└── ops/ # kodu ops <subcommand>
|
|
42
|
+
└── clean/ # kodu clean
|
|
52
43
|
```
|
|
53
44
|
|
|
54
45
|
## 4. Build, Lint & Test Commands
|
|
@@ -70,26 +61,6 @@ npm run lint:fix # Biome with auto-fix
|
|
|
70
61
|
|
|
71
62
|
# Full check (required before commit)
|
|
72
63
|
npm run check # TypeCheck + Biome + Knip
|
|
73
|
-
|
|
74
|
-
# Run tests (if configured)
|
|
75
|
-
npm test # Run all tests
|
|
76
|
-
npm test -- <pattern> # Run tests matching pattern
|
|
77
|
-
npm test -- --testPathPattern=<pattern> # Alternative
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Running a Single Test
|
|
81
|
-
```bash
|
|
82
|
-
# By file name
|
|
83
|
-
npm test -- filename
|
|
84
|
-
|
|
85
|
-
# By pattern
|
|
86
|
-
npm test -- --testNamePattern="test name"
|
|
87
|
-
|
|
88
|
-
# Watch mode
|
|
89
|
-
npm test -- --watch
|
|
90
|
-
|
|
91
|
-
# With coverage
|
|
92
|
-
npm test -- --coverage
|
|
93
64
|
```
|
|
94
65
|
|
|
95
66
|
## 5. Code Style Guidelines
|
|
@@ -136,10 +107,6 @@ npm test -- --coverage
|
|
|
136
107
|
|
|
137
108
|
```json
|
|
138
109
|
{
|
|
139
|
-
"llm": {
|
|
140
|
-
"model": "openai/gpt-4o",
|
|
141
|
-
"apiKeyEnv": "OPENAI_API_KEY"
|
|
142
|
-
},
|
|
143
110
|
"cleaner": {
|
|
144
111
|
"whitelist": ["//!"],
|
|
145
112
|
"keepJSDoc": true,
|
|
@@ -148,48 +115,50 @@ npm test -- --coverage
|
|
|
148
115
|
"packer": {
|
|
149
116
|
"ignore": ["*.lock", "node_modules", "dist"],
|
|
150
117
|
"useGitignore": true
|
|
151
|
-
},
|
|
152
|
-
"ops": {
|
|
153
|
-
"servers": {
|
|
154
|
-
"dev": {
|
|
155
|
-
"host": "example.com",
|
|
156
|
-
"port": 22,
|
|
157
|
-
"user": "ubuntu",
|
|
158
|
-
"sshKeyPath": "~/.ssh/id_rsa",
|
|
159
|
-
"paths": {
|
|
160
|
-
"apps": "/var/agent-apps",
|
|
161
|
-
"caddy": "/var/agent-apps/caddy"
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
118
|
}
|
|
166
119
|
}
|
|
167
120
|
```
|
|
168
121
|
|
|
169
|
-
- Model format: `provider/model-name` (e.g., `openai/gpt-4o`, `anthropic/claude-4-5-sonnet`)
|
|
170
|
-
- API keys from env vars only (never store in config)
|
|
171
122
|
- Config validated via Zod on startup
|
|
123
|
+
- `kodu.json` must be in current working directory
|
|
172
124
|
|
|
173
125
|
## 7. Commands Reference
|
|
174
126
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
127
|
+
### `kodu init`
|
|
128
|
+
|
|
129
|
+
Add `.kodu/context.txt` to `.gitignore` (if `.gitignore` exists). Run once after cloning or setting up a project.
|
|
130
|
+
|
|
131
|
+
### `kodu pack`
|
|
132
|
+
|
|
133
|
+
Bundle project files into a single context file for LLMs.
|
|
134
|
+
|
|
135
|
+
| Option | Description |
|
|
136
|
+
|--------|-------------|
|
|
137
|
+
| `-c, --copy` | Copy result to clipboard |
|
|
138
|
+
| `-o, --out <path>` | Path to save result (default: `.kodu/context.txt`) |
|
|
139
|
+
| `-p, --path <path>` | Directory or glob to include (repeatable) |
|
|
140
|
+
| `-e, --exclude <pattern>` | Additional exclude pattern (repeatable) |
|
|
141
|
+
| `-l, --list` | Print file list only, without content |
|
|
142
|
+
| `-f, --format <format>` | Output format: `xml` (default) or `text` |
|
|
143
|
+
| `-t, --template <name>` | Template name from `.kodu/prompts` |
|
|
144
|
+
|
|
145
|
+
Output format `xml` wraps each file in `<file path="...">` tags — recommended for LLM consumption. Format `text` uses `// file: ...` header comments.
|
|
146
|
+
|
|
147
|
+
### `kodu clean`
|
|
148
|
+
|
|
149
|
+
Remove comments from source files using AST-based parsing (deterministic, no AI).
|
|
150
|
+
|
|
151
|
+
| Option | Description |
|
|
152
|
+
|--------|-------------|
|
|
153
|
+
| `-d, --dry-run` | Show what will be removed without modifying files |
|
|
154
|
+
| `-c, --changed` | Clean only git-changed files |
|
|
183
155
|
|
|
184
156
|
## 8. Critical Constraints
|
|
185
157
|
|
|
186
|
-
1. **No AI
|
|
158
|
+
1. **No AI:** Both commands are deterministic — no AI integration
|
|
187
159
|
2. **Validation First:** Invalid `kodu.json` causes graceful crash with Zod error
|
|
188
|
-
3. **
|
|
189
|
-
4. **
|
|
190
|
-
5. **Git Preconditions:** AI commands require git repo with staged changes
|
|
191
|
-
6. **Config Location:** `kodu.json` must be in current working directory
|
|
192
|
-
7. **AgentOps Output Contract:** `kodu ops` commands must return strict JSON (no spinners/colors/prompts)
|
|
160
|
+
3. **Performance:** Mindful of import costs. Use lightweight libraries
|
|
161
|
+
4. **Config Location:** `kodu.json` must be in current working directory
|
|
193
162
|
|
|
194
163
|
## 9. Development Workflow
|
|
195
164
|
|
|
@@ -199,7 +168,7 @@ npm test -- --coverage
|
|
|
199
168
|
3. Implement `run()` extending `CommandRunner`
|
|
200
169
|
4. Decorate with `@Command()` from `nest-commander`
|
|
201
170
|
5. Register module in `app.module.ts`
|
|
202
|
-
6. Test: `npm run build && node dist/main.js <name>`
|
|
171
|
+
6. Test: `npm run build && node dist/src/main.js <name>`
|
|
203
172
|
|
|
204
173
|
### Before Commit
|
|
205
174
|
Always run:
|
|
@@ -214,7 +183,6 @@ This executes: TypeScript check + Biome lint + Knip dead code detection.
|
|
|
214
183
|
- **Primary Gate:** Static analysis (TypeScript + Biome + Knip)
|
|
215
184
|
- **No Legacy Tests:** Project relies on strict static typing
|
|
216
185
|
- If tests exist: place in `__tests__/` or `*.test.ts` files
|
|
217
|
-
- Use Vitest or Jest (check package.json for actual test runner)
|
|
218
186
|
|
|
219
187
|
## 11. Handling Uncertainties
|
|
220
188
|
|
package/README.md
CHANGED
|
@@ -1,171 +1,172 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
# Kodu
|
|
3
|
+
# Kodu
|
|
4
4
|
|
|
5
|
-
**
|
|
6
|
-
|
|
7
|
-
Generate contexts, clean code, review PRs, draft commits, and run remote ops—instantly.
|
|
5
|
+
**Bundle your codebase for LLMs. Strip noise. Ship faster.**
|
|
8
6
|
|
|
9
7
|
[](https://www.npmjs.com/package/kodu)
|
|
10
8
|
[](LICENSE)
|
|
11
|
-
[](https://github.com/uxname/kodu)
|
|
12
9
|
|
|
13
10
|
</div>
|
|
14
11
|
|
|
15
12
|
---
|
|
16
13
|
|
|
17
|
-
##
|
|
14
|
+
## What it does
|
|
18
15
|
|
|
19
|
-
|
|
|
16
|
+
| Problem | Kodu |
|
|
20
17
|
| :--- | :--- |
|
|
21
|
-
| Copy-pasting
|
|
22
|
-
| Hitting token limits with comments |
|
|
23
|
-
| Context switching for code reviews | **`kodu review`** checks logic inside your terminal |
|
|
24
|
-
| Writing boring commit messages | **`kodu commit`** generates semantic git messages |
|
|
25
|
-
| SSHing around servers manually | **`kodu ops`** runs machine-readable remote operations |
|
|
18
|
+
| Copy-pasting files one by one into ChatGPT | `kodu pack` bundles your entire project in one command |
|
|
19
|
+
| Hitting token limits with comments and docs | `kodu clean` strips comments deterministically via AST |
|
|
26
20
|
|
|
27
21
|
---
|
|
28
22
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
Don't want to install? Run it directly:
|
|
23
|
+
## Install
|
|
32
24
|
|
|
33
25
|
```bash
|
|
34
|
-
|
|
35
|
-
npx kodu init
|
|
36
|
-
|
|
37
|
-
# 2. Bundle your project to clipboard
|
|
38
|
-
npx kodu pack --copy
|
|
26
|
+
npm install -g kodu
|
|
39
27
|
```
|
|
40
28
|
|
|
41
|
-
|
|
29
|
+
Or run without installing:
|
|
42
30
|
|
|
43
31
|
```bash
|
|
44
|
-
|
|
32
|
+
npx kodu pack --copy
|
|
45
33
|
```
|
|
46
34
|
|
|
47
35
|
---
|
|
48
36
|
|
|
49
|
-
##
|
|
37
|
+
## kodu init
|
|
50
38
|
|
|
51
|
-
|
|
39
|
+
Add `.kodu/context.txt` to `.gitignore` so generated context files are never committed:
|
|
52
40
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
```bash
|
|
42
|
+
kodu init
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Run once after cloning or setting up the project.
|
|
57
46
|
|
|
58
47
|
---
|
|
59
48
|
|
|
60
|
-
##
|
|
49
|
+
## kodu pack
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
Pack your entire source code (minus ignored files) into the clipboard, optimized for tokens.
|
|
51
|
+
Bundle project files into a single context file optimized for LLMs.
|
|
64
52
|
|
|
65
53
|
```bash
|
|
54
|
+
# Pack everything and copy to clipboard
|
|
66
55
|
kodu pack --copy
|
|
67
|
-
# Output: Copied 45 files (12k tokens) to clipboard. Paste into ChatGPT!
|
|
68
|
-
```
|
|
69
56
|
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
# Pack only specific directories
|
|
58
|
+
kodu pack --path src --path tests --copy
|
|
72
59
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
kodu clean --dry-run
|
|
60
|
+
# Just see what files would be included
|
|
61
|
+
kodu pack --list
|
|
76
62
|
|
|
77
|
-
#
|
|
78
|
-
kodu
|
|
63
|
+
# Exclude extra patterns on the fly
|
|
64
|
+
kodu pack --exclude "**/*.test.ts" --exclude "docs/" --copy
|
|
65
|
+
|
|
66
|
+
# Save to a custom path
|
|
67
|
+
kodu pack --out /tmp/context.txt
|
|
68
|
+
|
|
69
|
+
# Use plain text format instead of XML
|
|
70
|
+
kodu pack --format text --copy
|
|
79
71
|
```
|
|
80
72
|
|
|
81
|
-
###
|
|
82
|
-
Get an AI review of your **staged** changes without leaving the terminal.
|
|
73
|
+
### Output format
|
|
83
74
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
By default, kodu wraps each file in XML tags — the format that LLMs parse most reliably:
|
|
76
|
+
|
|
77
|
+
```xml
|
|
78
|
+
<files>
|
|
79
|
+
<file path="src/index.ts">
|
|
80
|
+
// your code here
|
|
81
|
+
</file>
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
<file path="src/utils.ts">
|
|
84
|
+
// more code
|
|
85
|
+
</file>
|
|
86
|
+
</files>
|
|
90
87
|
```
|
|
91
88
|
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
Use `--format text` for legacy `// file: path` style headers.
|
|
90
|
+
|
|
91
|
+
### Options
|
|
92
|
+
|
|
93
|
+
| Flag | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `-c, --copy` | Copy result to clipboard |
|
|
96
|
+
| `-o, --out <path>` | Output file path (default: `.kodu/context.txt`) |
|
|
97
|
+
| `-p, --path <path>` | Include only this directory/glob (repeatable) |
|
|
98
|
+
| `-e, --exclude <pattern>` | Additional exclude pattern (repeatable) |
|
|
99
|
+
| `-l, --list` | Print file list only, no content |
|
|
100
|
+
| `-f, --format <xml\|text>` | Output format (default: `xml`) |
|
|
101
|
+
| `-t, --template <name>` | Wrap output in a prompt template from `.kodu/prompts/` |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## kodu clean
|
|
106
|
+
|
|
107
|
+
Remove comments from source files using AST-based parsing. No AI, fully deterministic.
|
|
94
108
|
|
|
95
109
|
```bash
|
|
96
|
-
#
|
|
97
|
-
kodu
|
|
110
|
+
# Preview what would be removed
|
|
111
|
+
kodu clean --dry-run
|
|
98
112
|
|
|
99
|
-
#
|
|
100
|
-
kodu
|
|
113
|
+
# Clean only git-changed files (great before committing)
|
|
114
|
+
kodu clean --changed
|
|
101
115
|
|
|
102
|
-
#
|
|
103
|
-
kodu
|
|
116
|
+
# Clean all project files
|
|
117
|
+
kodu clean
|
|
104
118
|
```
|
|
105
119
|
|
|
106
|
-
|
|
120
|
+
Supports `.ts`, `.tsx`, `.js`, `.jsx`, `.html`. Respects `cleaner.whitelist` in `kodu.json` (e.g. `//!` to preserve important comments).
|
|
107
121
|
|
|
108
|
-
|
|
122
|
+
---
|
|
109
123
|
|
|
110
|
-
|
|
124
|
+
## Configuration
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
<summary><b>Click to see example configuration</b></summary>
|
|
126
|
+
Create `kodu.json` in your project root:
|
|
114
127
|
|
|
115
128
|
```json
|
|
116
129
|
{
|
|
117
|
-
"llm": {
|
|
118
|
-
"model": "openai/gpt-4o",
|
|
119
|
-
"apiKeyEnv": "OPENAI_API_KEY"
|
|
120
|
-
},
|
|
121
130
|
"cleaner": {
|
|
122
|
-
|
|
123
|
-
"
|
|
131
|
+
"whitelist": ["//!"],
|
|
132
|
+
"keepJSDoc": true,
|
|
133
|
+
"useGitignore": true
|
|
124
134
|
},
|
|
125
135
|
"packer": {
|
|
126
|
-
"ignore": ["package-lock.json", "dist", "coverage"]
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
},
|
|
136
|
+
"ignore": ["package-lock.json", "dist", "coverage"],
|
|
137
|
+
"useGitignore": true
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Both commands work without a config file using sensible defaults.
|
|
143
|
+
|
|
144
|
+
### Custom pack template
|
|
145
|
+
|
|
146
|
+
Point `prompts.pack` at a markdown file to wrap packed context in a prompt:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
142
150
|
"prompts": {
|
|
143
|
-
"
|
|
144
|
-
"bug": ".kodu/prompts/review-bug.md"
|
|
145
|
-
}
|
|
151
|
+
"pack": ".kodu/prompts/pack.md"
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
154
|
```
|
|
149
155
|
|
|
150
|
-
|
|
151
|
-
</details>
|
|
156
|
+
Available template variables: `{{context}}`, `{{fileList}}`, `{{tokenCount}}`, `{{usdEstimate}}`.
|
|
152
157
|
|
|
153
158
|
---
|
|
154
159
|
|
|
155
|
-
##
|
|
156
|
-
|
|
157
|
-
Built for speed and maintainability.
|
|
160
|
+
## Privacy
|
|
158
161
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
* **Globbing:** `tinyglobby`
|
|
163
|
-
* **UI:** `@inquirer` + `yocto-spinner`
|
|
162
|
+
- All processing runs locally
|
|
163
|
+
- No data sent anywhere
|
|
164
|
+
- API keys are never stored — only read from env vars
|
|
164
165
|
|
|
165
166
|
---
|
|
166
167
|
|
|
167
168
|
<div align="center">
|
|
168
|
-
<sub>Built
|
|
169
|
+
<sub>Built for productive developers.</sub>
|
|
169
170
|
<br>
|
|
170
171
|
<a href="CONTRIBUTING.md">Contributing</a> • <a href="LICENSE">License</a>
|
|
171
172
|
</div>
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kodu",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "High-performance CLI to prepare codebase for LLMs, automate reviews, and draft commits.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"@inquirer/confirm": "^6.0.4",
|
|
51
51
|
"@inquirer/input": "^5.0.4",
|
|
52
52
|
"@inquirer/select": "^5.0.4",
|
|
53
|
-
"@mastra/core": "^1.0.4",
|
|
54
53
|
"@nestjs/common": "^11.0.1",
|
|
55
54
|
"@nestjs/core": "^11.0.1",
|
|
56
55
|
"clipboardy": "^5.0.2",
|
package/dist/src/app.module.js
CHANGED
|
@@ -9,15 +9,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.AppModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const clean_module_1 = require("./commands/clean/clean.module");
|
|
12
|
-
const commit_module_1 = require("./commands/commit/commit.module");
|
|
13
12
|
const init_module_1 = require("./commands/init/init.module");
|
|
14
|
-
const ops_module_1 = require("./commands/ops/ops.module");
|
|
15
13
|
const pack_module_1 = require("./commands/pack/pack.module");
|
|
16
|
-
const review_module_1 = require("./commands/review/review.module");
|
|
17
14
|
const config_module_1 = require("./core/config/config.module");
|
|
18
15
|
const fs_module_1 = require("./core/file-system/fs.module");
|
|
19
16
|
const ui_module_1 = require("./core/ui/ui.module");
|
|
20
|
-
const ai_module_1 = require("./shared/ai/ai.module");
|
|
21
17
|
const git_module_1 = require("./shared/git/git.module");
|
|
22
18
|
const tokenizer_module_1 = require("./shared/tokenizer/tokenizer.module");
|
|
23
19
|
let AppModule = class AppModule {
|
|
@@ -30,14 +26,10 @@ exports.AppModule = AppModule = __decorate([
|
|
|
30
26
|
ui_module_1.UiModule,
|
|
31
27
|
fs_module_1.FsModule,
|
|
32
28
|
git_module_1.GitModule,
|
|
33
|
-
ai_module_1.AiModule,
|
|
34
29
|
tokenizer_module_1.TokenizerModule,
|
|
35
30
|
init_module_1.InitModule,
|
|
36
31
|
pack_module_1.PackModule,
|
|
37
32
|
clean_module_1.CleanModule,
|
|
38
|
-
review_module_1.ReviewModule,
|
|
39
|
-
commit_module_1.CommitModule,
|
|
40
|
-
ops_module_1.OpsModule,
|
|
41
33
|
],
|
|
42
34
|
})
|
|
43
35
|
], AppModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,gEAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,gEAA4D;AAC5D,6DAAyD;AACzD,6DAAyD;AACzD,+DAA2D;AAC3D,4DAAwD;AACxD,mDAA+C;AAC/C,wDAAoD;AACpD,0EAAsE;AAc/D,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IAZrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,oBAAQ;YACR,oBAAQ;YACR,sBAAS;YACT,kCAAe;YACf,wBAAU;YACV,wBAAU;YACV,0BAAW;SACZ;KACF,CAAC;GACW,SAAS,CAAG"}
|
|
@@ -4,13 +4,6 @@ export declare class InitCommand extends CommandRunner {
|
|
|
4
4
|
private readonly ui;
|
|
5
5
|
constructor(ui: UiService);
|
|
6
6
|
run(): Promise<void>;
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private mergeWhitelist;
|
|
10
|
-
private writeConfig;
|
|
11
|
-
private ensurePromptFiles;
|
|
12
|
-
private buildPromptPaths;
|
|
13
|
-
private writePromptIfMissing;
|
|
14
|
-
private ensureGitignore;
|
|
15
|
-
private fileExists;
|
|
7
|
+
private updateGitignore;
|
|
8
|
+
private exists;
|
|
16
9
|
}
|