kodu 1.2.0 → 2.0.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.
Files changed (138) hide show
  1. package/AGENTS.md +36 -68
  2. package/README.md +128 -96
  3. package/dist/package.json +1 -2
  4. package/dist/src/app.module.js +0 -8
  5. package/dist/src/app.module.js.map +1 -1
  6. package/dist/src/commands/clean/clean.command.d.ts +14 -1
  7. package/dist/src/commands/clean/clean.command.js +142 -32
  8. package/dist/src/commands/clean/clean.command.js.map +1 -1
  9. package/dist/src/commands/init/init.command.d.ts +2 -9
  10. package/dist/src/commands/init/init.command.js +15 -241
  11. package/dist/src/commands/init/init.command.js.map +1 -1
  12. package/dist/src/commands/pack/pack.command.d.ts +12 -1
  13. package/dist/src/commands/pack/pack.command.js +81 -6
  14. package/dist/src/commands/pack/pack.command.js.map +1 -1
  15. package/dist/src/commands/pack/pack.module.js +2 -1
  16. package/dist/src/commands/pack/pack.module.js.map +1 -1
  17. package/dist/src/core/config/config.schema.d.ts +0 -46
  18. package/dist/src/core/config/config.schema.js +1 -51
  19. package/dist/src/core/config/config.schema.js.map +1 -1
  20. package/dist/src/core/config/config.service.js +2 -2
  21. package/dist/src/core/config/config.service.js.map +1 -1
  22. package/dist/src/core/config/prompt.service.d.ts +1 -4
  23. package/dist/src/core/config/prompt.service.js +4 -17
  24. package/dist/src/core/config/prompt.service.js.map +1 -1
  25. package/dist/src/shared/cleaner/cleaner.service.d.ts +2 -0
  26. package/dist/src/shared/cleaner/cleaner.service.js +32 -7
  27. package/dist/src/shared/cleaner/cleaner.service.js.map +1 -1
  28. package/dist/src/shared/cleaner/cleaner.types.d.ts +7 -0
  29. package/dist/src/shared/constants.d.ts +0 -4
  30. package/dist/src/shared/constants.js +1 -5
  31. package/dist/src/shared/constants.js.map +1 -1
  32. package/dist/src/shared/git/git.module.js +0 -2
  33. package/dist/src/shared/git/git.module.js.map +1 -1
  34. package/dist/src/shared/git/git.service.d.ts +1 -8
  35. package/dist/src/shared/git/git.service.js +10 -33
  36. package/dist/src/shared/git/git.service.js.map +1 -1
  37. package/dist/src/shared/tokenizer/tokenizer.module.js +0 -2
  38. package/dist/src/shared/tokenizer/tokenizer.module.js.map +1 -1
  39. package/dist/src/shared/tokenizer/tokenizer.service.d.ts +0 -6
  40. package/dist/src/shared/tokenizer/tokenizer.service.js +8 -38
  41. package/dist/src/shared/tokenizer/tokenizer.service.js.map +1 -1
  42. package/dist/tsconfig.build.tsbuildinfo +1 -1
  43. package/kodu.schema.json +0 -139
  44. package/package.json +1 -2
  45. package/src/app.module.ts +0 -8
  46. package/src/commands/clean/clean.command.ts +143 -33
  47. package/src/commands/init/init.command.ts +15 -310
  48. package/src/commands/pack/pack.command.ts +74 -4
  49. package/src/commands/pack/pack.module.ts +2 -1
  50. package/src/core/config/config.schema.ts +1 -68
  51. package/src/core/config/config.service.ts +2 -2
  52. package/src/core/config/prompt.service.ts +4 -26
  53. package/src/shared/cleaner/cleaner.service.ts +43 -12
  54. package/src/shared/cleaner/cleaner.types.ts +7 -0
  55. package/src/shared/constants.ts +0 -4
  56. package/src/shared/git/git.module.ts +0 -2
  57. package/src/shared/git/git.service.ts +9 -31
  58. package/src/shared/tokenizer/tokenizer.module.ts +0 -2
  59. package/src/shared/tokenizer/tokenizer.service.ts +9 -39
  60. package/.kodu/prompts/.keep +0 -0
  61. package/.kodu/prompts/commit.md +0 -9
  62. package/.kodu/prompts/pack.md +0 -7
  63. package/.kodu/prompts/review-bug.md +0 -6
  64. package/.kodu/prompts/review-security.md +0 -6
  65. package/.kodu/prompts/review-style.md +0 -6
  66. package/.opencode/command/openspec-apply.md +0 -24
  67. package/.opencode/command/openspec-archive.md +0 -27
  68. package/.opencode/command/openspec-proposal.md +0 -29
  69. package/.opencode/skills/kodu-ops/SKILL.md +0 -184
  70. package/dist/src/commands/commit/commit.command.d.ts +0 -18
  71. package/dist/src/commands/commit/commit.command.js +0 -149
  72. package/dist/src/commands/commit/commit.command.js.map +0 -1
  73. package/dist/src/commands/commit/commit.module.d.ts +0 -2
  74. package/dist/src/commands/commit/commit.module.js +0 -25
  75. package/dist/src/commands/commit/commit.module.js.map +0 -1
  76. package/dist/src/commands/ops/ops.command.d.ts +0 -4
  77. package/dist/src/commands/ops/ops.command.js +0 -39
  78. package/dist/src/commands/ops/ops.command.js.map +0 -1
  79. package/dist/src/commands/ops/ops.module.d.ts +0 -2
  80. package/dist/src/commands/ops/ops.module.js +0 -33
  81. package/dist/src/commands/ops/ops.module.js.map +0 -1
  82. package/dist/src/commands/ops/ops.types.d.ts +0 -13
  83. package/dist/src/commands/ops/ops.types.js +0 -12
  84. package/dist/src/commands/ops/ops.types.js.map +0 -1
  85. package/dist/src/commands/ops/ops.utils.d.ts +0 -13
  86. package/dist/src/commands/ops/ops.utils.js +0 -121
  87. package/dist/src/commands/ops/ops.utils.js.map +0 -1
  88. package/dist/src/commands/ops/subcommands/ops-env.command.d.ts +0 -24
  89. package/dist/src/commands/ops/subcommands/ops-env.command.js +0 -156
  90. package/dist/src/commands/ops/subcommands/ops-env.command.js.map +0 -1
  91. package/dist/src/commands/ops/subcommands/ops-routes.command.d.ts +0 -22
  92. package/dist/src/commands/ops/subcommands/ops-routes.command.js +0 -203
  93. package/dist/src/commands/ops/subcommands/ops-routes.command.js.map +0 -1
  94. package/dist/src/commands/ops/subcommands/ops-service.command.d.ts +0 -22
  95. package/dist/src/commands/ops/subcommands/ops-service.command.js +0 -169
  96. package/dist/src/commands/ops/subcommands/ops-service.command.js.map +0 -1
  97. package/dist/src/commands/ops/subcommands/ops-sysinfo.command.d.ts +0 -14
  98. package/dist/src/commands/ops/subcommands/ops-sysinfo.command.js +0 -75
  99. package/dist/src/commands/ops/subcommands/ops-sysinfo.command.js.map +0 -1
  100. package/dist/src/commands/review/review.command.d.ts +0 -26
  101. package/dist/src/commands/review/review.command.js +0 -205
  102. package/dist/src/commands/review/review.command.js.map +0 -1
  103. package/dist/src/commands/review/review.module.d.ts +0 -2
  104. package/dist/src/commands/review/review.module.js +0 -26
  105. package/dist/src/commands/review/review.module.js.map +0 -1
  106. package/dist/src/core/config/default-prompts.d.ts +0 -9
  107. package/dist/src/core/config/default-prompts.js +0 -49
  108. package/dist/src/core/config/default-prompts.js.map +0 -1
  109. package/dist/src/shared/ai/ai.module.d.ts +0 -2
  110. package/dist/src/shared/ai/ai.module.js +0 -23
  111. package/dist/src/shared/ai/ai.module.js.map +0 -1
  112. package/dist/src/shared/ai/ai.service.d.ts +0 -22
  113. package/dist/src/shared/ai/ai.service.js +0 -164
  114. package/dist/src/shared/ai/ai.service.js.map +0 -1
  115. package/dist/src/shared/ssh/ssh.module.d.ts +0 -2
  116. package/dist/src/shared/ssh/ssh.module.js +0 -21
  117. package/dist/src/shared/ssh/ssh.module.js.map +0 -1
  118. package/dist/src/shared/ssh/ssh.service.d.ts +0 -11
  119. package/dist/src/shared/ssh/ssh.service.js +0 -53
  120. package/dist/src/shared/ssh/ssh.service.js.map +0 -1
  121. package/dist/tsconfig.tsbuildinfo +0 -1
  122. package/src/commands/commit/commit.command.ts +0 -139
  123. package/src/commands/commit/commit.module.ts +0 -12
  124. package/src/commands/ops/ops.command.ts +0 -30
  125. package/src/commands/ops/ops.module.ts +0 -20
  126. package/src/commands/ops/ops.types.ts +0 -24
  127. package/src/commands/ops/ops.utils.ts +0 -160
  128. package/src/commands/ops/subcommands/ops-env.command.ts +0 -165
  129. package/src/commands/ops/subcommands/ops-routes.command.ts +0 -221
  130. package/src/commands/ops/subcommands/ops-service.command.ts +0 -190
  131. package/src/commands/ops/subcommands/ops-sysinfo.command.ts +0 -77
  132. package/src/commands/review/review.command.ts +0 -199
  133. package/src/commands/review/review.module.ts +0 -13
  134. package/src/core/config/default-prompts.ts +0 -53
  135. package/src/shared/ai/ai.module.ts +0 -10
  136. package/src/shared/ai/ai.service.ts +0 -216
  137. package/src/shared/ssh/ssh.module.ts +0 -8
  138. 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, code cleaning, reviews, and commit drafting.
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
- - **Current Phase:** Phase 4 - AI Integration with Mastra/Git
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
- ├── clean/ # kodu clean
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
- | Command | Description | Key Options |
176
- |---------|-------------|-------------|
177
- | `kodu init` | Interactive setup wizard | - |
178
- | `kodu pack` | Bundle files for LLM | `--copy`, `--template`, `--out` |
179
- | `kodu clean` | Remove comments (AST-based) | `--dry-run` |
180
- | `kodu review` | AI code review | `--mode`, `--ci`, `--output` |
181
- | `kodu commit` | Generate commit message | `--ci`, `--output` |
182
- | `kodu ops` | Remote server operations over SSH (JSON-only) | `sysinfo`, `env`, `routes`, `service` |
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 in Cleaner:** `clean` command is deterministic (AST-based), never AI-generated
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. **Secrets:** Never commit secrets. API keys from env vars only
189
- 4. **Performance:** Mindful of import costs. Use lightweight libraries
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,203 @@
1
1
  <div align="center">
2
2
 
3
- # Kodu 🦄
3
+ # Kodu
4
4
 
5
- **The AI-First CLI for Modern Developers**
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
  [![npm version](https://img.shields.io/npm/v/kodu?style=flat-square&color=black)](https://www.npmjs.com/package/kodu)
10
8
  [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square&color=black)](LICENSE)
11
- [![Privacy](https://img.shields.io/badge/Privacy-First-green.svg?style=flat-square)](https://github.com/uxname/kodu)
12
9
 
13
10
  </div>
14
11
 
15
12
  ---
16
13
 
17
- ## The Problem vs. Kodu
14
+ ## What it does
18
15
 
19
- | You (Manual) ❌ | Kodu (Automated) ✅ |
16
+ | Problem | Kodu |
20
17
  | :--- | :--- |
21
- | Copy-pasting 10 files one by one | **`kodu pack`** bundles context in 1 click |
22
- | Hitting token limits with comments | **`kodu clean`** strips noise deterministically |
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
- ## 🚀 Instant Start
30
-
31
- Don't want to install? Run it directly:
23
+ ## Install
32
24
 
33
25
  ```bash
34
- # 1. Initialize config (creates kodu.json)
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
- **Or install globally for speed (<0.5s startup):**
29
+ Or run without installing:
42
30
 
43
31
  ```bash
44
- npm install -g kodu
32
+ npx kodu pack --copy
45
33
  ```
46
34
 
47
35
  ---
48
36
 
49
- ## 🛡️ Privacy & Security
37
+ ## kodu init
50
38
 
51
- We know trust is paramount when dealing with code.
39
+ Add `.kodu/context.txt` to `.gitignore` so generated context files are never committed:
52
40
 
53
- * **Local Execution:** Code analysis runs locally.
54
- * **Zero Data Retention:** We don't store your code.
55
- * **Explicit Control:** `.env`, `node_modules`, and lockfiles are ignored by default.
56
- * **You Own the Keys:** Your API key (`OPENAI_API_KEY`) goes directly to the provider.
41
+ ```bash
42
+ kodu init
43
+ ```
44
+
45
+ Run once after cloning or setting up the project.
57
46
 
58
47
  ---
59
48
 
60
- ## 💡 Common Workflows
49
+ ## kodu pack
61
50
 
62
- ### 1. "I need to ask ChatGPT about my project"
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
- ### 2. "I want to save money on API costs"
71
- Strip comments and docs to reduce token count by ~30% before sending.
57
+ # Pack only specific directories
58
+ kodu pack --path src --path tests --copy
72
59
 
73
- ```bash
74
- # Preview savings
75
- kodu clean --dry-run
60
+ # Just see what files would be included
61
+ kodu pack --list
76
62
 
77
- # Clean only what you changed (Great for PRs)
78
- kodu clean --changed
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
- ### 3. "Check my code before I push"
82
- Get an AI review of your **staged** changes without leaving the terminal.
73
+ ### Output format
83
74
 
84
- ```bash
85
- # Detect bugs and logical errors
86
- kodu review --mode bug
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
- # Check for security leaks
89
- kodu review --mode security
83
+ <file path="src/utils.ts">
84
+ // more code
85
+ </file>
86
+ </files>
90
87
  ```
91
88
 
92
- ### 4. "I need my agent to inspect a server"
93
- Run remote diagnostics and operations via `kodu ops` with strict JSON output.
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
+ | `--clean` | Strip comments in-memory before packing (files not modified) |
102
+ | `-t, --template <name>` | Wrap output in a prompt template from `.kodu/prompts/` |
103
+
104
+ ---
105
+
106
+ ## kodu clean
107
+
108
+ Remove comments from source files using AST-based parsing. No AI, fully deterministic.
94
109
 
95
110
  ```bash
96
- # Server health snapshot
97
- kodu ops sysinfo dev
111
+ # Preview what would be removed (with byte/token savings)
112
+ kodu clean --dry-run
98
113
 
99
- # Manage app env vars remotely
100
- kodu ops env dev set my-app --key NODE_ENV --val production
114
+ # Show every removed comment, not just first 3
115
+ kodu clean --dry-run --verbose
101
116
 
102
- # Read Caddy routes (raw Caddyfile)
103
- kodu ops routes dev list
117
+ # Clean only git-staged files
118
+ kodu clean --staged
119
+
120
+ # Clean only git-changed files (staged + unstaged + untracked)
121
+ kodu clean --changed
122
+
123
+ # Target specific files or directories
124
+ kodu clean src/utils.ts src/helpers/
125
+
126
+ # Remove JSDoc too (overrides config)
127
+ kodu clean --no-jsdoc
128
+
129
+ # Backup originals before modifying
130
+ kodu clean --backup
131
+
132
+ # Read from stdin, write to stdout (great for scripting)
133
+ cat src/foo.ts | kodu clean --stdin
134
+
135
+ # Clean all project files
136
+ kodu clean
104
137
  ```
105
138
 
106
- ---
139
+ Supports `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.html`. Respects `cleaner.whitelist` in `kodu.json` (e.g. `//!` to preserve important comments).
140
+
141
+ ### Options
107
142
 
108
- ## ⚙️ Configuration
143
+ | Flag | Description |
144
+ |------|-------------|
145
+ | `-d, --dry-run` | Show what will be removed without modifying files |
146
+ | `-v, --verbose` | Show all removed comments in dry-run (not just first 3) |
147
+ | `-c, --changed` | Clean only git-changed files (staged + unstaged + untracked) |
148
+ | `-s, --staged` | Clean only git-staged files |
149
+ | `-n, --no-jsdoc` | Remove JSDoc comments (overrides `keepJSDoc` in config) |
150
+ | `-b, --backup` | Save originals to `.kodu/backup/` before modifying |
151
+ | `--stdin` | Read from stdin, write cleaned result to stdout |
109
152
 
110
- Kodu creates a `kodu.json` in your root. It's pre-configured, but fully hackable.
153
+ ---
154
+
155
+ ## Configuration
111
156
 
112
- <details>
113
- <summary><b>Click to see example configuration</b></summary>
157
+ Create `kodu.json` in your project root:
114
158
 
115
159
  ```json
116
160
  {
117
- "llm": {
118
- "model": "openai/gpt-4o",
119
- "apiKeyEnv": "OPENAI_API_KEY"
120
- },
121
161
  "cleaner": {
122
- // Kodu will NEVER remove comments starting with these:
123
- "whitelist": ["//!"]
162
+ "whitelist": ["//!"],
163
+ "keepJSDoc": true,
164
+ "useGitignore": true
124
165
  },
125
166
  "packer": {
126
- "ignore": ["package-lock.json", "dist", "coverage"]
127
- },
128
- "ops": {
129
- "servers": {
130
- "dev": {
131
- "host": "example.com",
132
- "port": 22,
133
- "user": "ubuntu",
134
- "sshKeyPath": "~/.ssh/id_rsa",
135
- "paths": {
136
- "apps": "/var/agent-apps",
137
- "caddy": "/var/agent-apps/caddy"
138
- }
139
- }
140
- }
141
- },
167
+ "ignore": ["package-lock.json", "dist", "coverage"],
168
+ "useGitignore": true
169
+ }
170
+ }
171
+ ```
172
+
173
+ Both commands work without a config file using sensible defaults.
174
+
175
+ ### Custom pack template
176
+
177
+ Point `prompts.pack` at a markdown file to wrap packed context in a prompt:
178
+
179
+ ```json
180
+ {
142
181
  "prompts": {
143
- "review": {
144
- "bug": ".kodu/prompts/review-bug.md"
145
- }
182
+ "pack": ".kodu/prompts/pack.md"
146
183
  }
147
184
  }
148
185
  ```
149
186
 
150
- `kodu ops` is designed for agents: responses are strict JSON (including errors), with no spinner/colors/prompts.
151
- </details>
187
+ Available template variables: `{{context}}`, `{{fileList}}`, `{{tokenCount}}`, `{{usdEstimate}}`.
152
188
 
153
189
  ---
154
190
 
155
- ## 🏎️ Tech Stack (Fresh & Modern)
156
-
157
- Built for speed and maintainability.
191
+ ## Privacy
158
192
 
159
- * **Runtime:** Node.js (ESM)
160
- * **Framework:** NestJS + Commander
161
- * **Parsing:** `ts-morph` (AST-based, not Regex)
162
- * **Globbing:** `tinyglobby`
163
- * **UI:** `@inquirer` + `yocto-spinner`
193
+ - All processing runs locally
194
+ - No data sent anywhere
195
+ - API keys are never stored — only read from env vars
164
196
 
165
197
  ---
166
198
 
167
199
  <div align="center">
168
- <sub>Built with ❤️ for productive developers.</sub>
200
+ <sub>Built for productive developers.</sub>
169
201
  <br>
170
202
  <a href="CONTRIBUTING.md">Contributing</a> • <a href="LICENSE">License</a>
171
203
  </div>
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodu",
3
- "version": "1.2.0",
3
+ "version": "2.0.1",
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",
@@ -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,mEAA+D;AAC/D,6DAAyD;AACzD,0DAAsD;AACtD,6DAAyD;AACzD,mEAA+D;AAC/D,+DAA2D;AAC3D,4DAAwD;AACxD,mDAA+C;AAC/C,qDAAiD;AACjD,wDAAoD;AACpD,0EAAsE;AAkB/D,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IAhBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,oBAAQ;YACR,oBAAQ;YACR,sBAAS;YACT,oBAAQ;YACR,kCAAe;YACf,wBAAU;YACV,wBAAU;YACV,0BAAW;YACX,4BAAY;YACZ,4BAAY;YACZ,sBAAS;SACV;KACF,CAAC;GACW,SAAS,CAAG"}
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"}
@@ -7,6 +7,11 @@ import { GitService } from '../../shared/git/git.service';
7
7
  type CleanOptions = {
8
8
  dryRun?: boolean;
9
9
  changed?: boolean;
10
+ staged?: boolean;
11
+ backup?: boolean;
12
+ noJsdoc?: boolean;
13
+ verbose?: boolean;
14
+ stdin?: boolean;
10
15
  };
11
16
  export declare class CleanCommand extends CommandRunner {
12
17
  private readonly ui;
@@ -17,8 +22,16 @@ export declare class CleanCommand extends CommandRunner {
17
22
  constructor(ui: UiService, fsService: FsService, cleaner: CleanerService, config: ConfigService, git: GitService);
18
23
  parseDryRun(): boolean;
19
24
  parseChanged(): boolean;
20
- run(_inputs: string[], options?: CleanOptions): Promise<void>;
25
+ parseStaged(): boolean;
26
+ parseBackup(): boolean;
27
+ parseNoJsdoc(): boolean;
28
+ parseVerbose(): boolean;
29
+ parseStdin(): boolean;
30
+ run(inputs: string[], options?: CleanOptions): Promise<void>;
31
+ private runStdin;
32
+ private readStdin;
21
33
  private buildSpinnerText;
34
+ private noFilesMessage;
22
35
  private collectTargets;
23
36
  }
24
37
  export {};