codemini-cli 0.1.16 → 0.1.18

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/OPERATIONS.md CHANGED
@@ -85,6 +85,7 @@ codemini config list
85
85
  codemini config set shell.default powershell
86
86
  codemini config set ui.language en
87
87
  codemini config set soul.preset professional
88
+ codemini config set soul.preset pirate
88
89
  ```
89
90
 
90
91
  ```bash
package/README.md CHANGED
@@ -28,6 +28,7 @@ It is designed for teams that want a coding assistant that feels practical, cont
28
28
  - Structured code tools for small models: `locate`, `open_target`, `edit_target`
29
29
  - More conservative `plan auto` acceptance checks with reviewer/tester goal checklists
30
30
  - Tone presets through `soul`, without changing plans or code behavior
31
+ - Example soul presets include `professional`, `playful`, `anime`, `pirate`, `caveman`, and `ceo`
31
32
  - Sub-agents for planning, coding, review, and testing
32
33
 
33
34
  ### Quick Start
@@ -142,6 +143,7 @@ CodeMini CLI 是一个为小模型工作流优化过的代码助手 CLI,重点
142
143
  - 为小模型补了结构化代码工具:`locate`、`open_target`、`edit_target`
143
144
  - `plan auto` 会基于原始目标生成验收清单,并更保守地处理 reviewer/tester 结果
144
145
  - `soul` 只影响语气,不影响计划和代码行为
146
+ - 可用的 `soul` 示例包括 `professional`、`playful`、`anime`、`pirate`、`caveman`、`ceo`
145
147
  - 支持 planner、coder、reviewer、tester 多角色 sub-agent
146
148
 
147
149
  ### 快速开始
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemini-cli",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Coding CLI optimized for small-model workflows and Windows PowerShell",
5
5
  "keywords": [
6
6
  "cli",
@@ -4,41 +4,16 @@ description: Lightweight brainstorming skill for 30B-class models. Use when a fe
4
4
  version: 0.1.0
5
5
  ---
6
6
 
7
- Use this skill only after the controller has decided the task needs clarification or option comparison before coding.
7
+ Use this skill only when the task needs clarification or option comparison before coding.
8
8
 
9
- Primary purpose:
10
- - ask one high-value question when a key constraint is missing
11
- - compare 2-3 short options when the goal is clear but the approach is not
12
- - stop at a clear decision point
13
-
14
- Rules:
15
-
16
- 1. Ask one question at a time.
17
- Do not dump a long questionnaire. Pick the most important uncertainty and resolve it first.
18
-
19
- 1a. If a key uncertainty remains, stop after one question.
20
- Do not ask multiple numbered questions in the same reply. Do not continue into options, decisions, code, or file edits until that question is answered.
21
-
22
- 2. Stay concrete.
23
- Focus only on the uncertainty that blocks execution.
24
-
25
- 3. Offer 2-3 approaches only when the key constraint is already clear.
26
- Keep each option short and focused on the main tradeoff.
27
-
28
- 4. Keep the design small.
29
- Do not expand a simple task into a long design discussion.
30
-
31
- 5. Confirm before implementation.
32
- If options were given, wait for the user to choose unless the user explicitly asks for a recommendation.
33
-
34
- 6. No code before convergence.
35
- Do not write implementation code, pseudo-code, or file edits while the direction is still being chosen.
36
-
37
- 7. Do not decide for the user when the request is still under-specified.
38
- If the user has not provided enough information to choose confidently, ask the next best question and wait.
39
-
40
- 8. Do not inspect the repo unless existing project context is directly relevant.
41
- For greenfield brainstorming, stay in conversation mode first.
9
+ Core rules:
10
+ - ask one question at a time
11
+ - if a key uncertainty remains, ask the next best question and stop
12
+ - give 2-3 short options only when the blocking constraint is already clear
13
+ - keep options concrete and focused on the main tradeoff
14
+ - present any conclusion as a suggested decision, not a final choice for the user
15
+ - stop at the decision point unless the user clearly asks to continue
16
+ - do not write code, pseudo-code, file edits, or broad repo exploration while direction is still being chosen
42
17
 
43
18
  Output format:
44
19
 
@@ -67,20 +42,9 @@ Option 3 (optional):
67
42
  - pros:
68
43
  - cons:
69
44
 
70
- Decision:
71
- - chosen:
45
+ Suggested decision:
46
+ - recommended:
72
47
  - reason:
73
48
 
74
- After decision:
75
- - stop after the chosen direction unless the user clearly asks to continue into implementation
76
-
77
- Suggested flow:
78
- - Restate the task briefly
79
- - Choose one mode only: Question or Options
80
- - Stop at a clear decision point
81
-
82
- Avoid:
83
- - large ceremonies
84
- - repeating the full conversation
85
- - asking multiple independent questions in one turn
86
- - proposing implementation details before the problem is clear
49
+ After suggested decision:
50
+ - stop after the recommended direction unless the user clearly asks to continue into implementation
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: superpowers-lite
3
- description: Concise workflow skill tuned for 30B-class models: search first, keep context tight, use sub-agents for narrow tasks, and verify before claiming success.
3
+ description: Concise workflow skill tuned for 30B-class models: prefer structured code tools first, keep context tight, use sub-agents for narrow tasks, and verify before claiming success.
4
4
  version: 0.1.0
5
5
  ---
6
6
 
@@ -33,10 +33,17 @@ Routing:
33
33
  - ask one high-value question before coding
34
34
  - do not assume features, storage model, or scope unless the user already gave them
35
35
 
36
+ Tool order:
37
+ - prefer `locate` first for repo search and candidate discovery
38
+ - use `open_target` to inspect the smallest useful code block with edit metadata
39
+ - use `edit_target` for minimal validated edits
40
+ - use `search_code`, `read_block`, and `read_symbol_context` when lower-level structured context is needed
41
+ - use shell search such as `rg` only as a fallback when structured tools are not enough
42
+
36
43
  Core rules:
37
44
 
38
45
  1. Search first.
39
- Use `rg` for repo search before broad file reads. Prefer local context commands and read only the smallest useful slice.
46
+ Prefer structured search before broad file reads. Start with `locate`, then inspect with `open_target`, and only fall back to shell search such as `rg` when the structured tools are not enough.
40
47
 
41
48
  2. Keep context tight.
42
49
  Do not carry full conversation history into every step. Summarize, narrow scope, and work from the most recent relevant evidence.
@@ -55,18 +62,18 @@ If the requested behavior, scope, or acceptance is unclear, do not jump into imp
55
62
  - clear enough to build -> proceed
56
63
 
57
64
  5. Read and write with intent.
58
- Use `read_file` only when shell output is not enough. Use `write_file` for edits. Avoid unnecessary tool calls and avoid rereading the same file without a reason.
65
+ Use `open_target`, `read_block`, and `read_symbol_context` before `read_file` when possible. Use `edit_target` for focused edits. Use `write_file` only for full-file writes. Avoid unnecessary tool calls and avoid rereading the same file without a reason.
59
66
 
60
67
  6. Verify before claiming success.
61
68
  Run the relevant test, check, or command before saying work is fixed or complete.
62
69
 
63
70
  Default workflow:
64
- - Search with `rg`
65
- - Inspect local context
71
+ - Search with `locate`
72
+ - Inspect local context with `open_target`
66
73
  - If the request is unclear, first decide: ask one question, brainstorm, or proceed
67
74
  - Plan the next smallest step
68
75
  - Delegate if the work is independent
69
- - Edit
76
+ - Edit with `edit_target`
70
77
  - Verify
71
78
  - Summarize briefly
72
79
 
@@ -0,0 +1,3 @@
1
+ Respond with a simple caveman-inspired tone.
2
+ Keep sentences short, readable, and practical, while still preserving technical accuracy.
3
+ Do not make the wording so primitive that instructions become unclear.
package/souls/ceo.md ADDED
@@ -0,0 +1,3 @@
1
+ Respond with a bold CEO-style tone.
2
+ Keep the answer concise, forward-moving, and focused on fundamentals, tradeoffs, and execution.
3
+ Do not imitate any real person, and do not let the style override careful technical judgment.
@@ -0,0 +1,3 @@
1
+ Respond with a playful pirate-inspired tone.
2
+ Keep the answer clear, useful, and technically accurate first, with light nautical flavor.
3
+ Do not overdo slang, and do not let the roleplay reduce precision.
package/src/cli.js CHANGED
@@ -4,7 +4,7 @@ import { handleConfig } from './commands/config.js';
4
4
  import { handleDoctor } from './commands/doctor.js';
5
5
  import { handleSkill } from './commands/skill.js';
6
6
 
7
- const VERSION = '0.1.16';
7
+ const VERSION = '0.1.18';
8
8
 
9
9
  function printHelp() {
10
10
  console.log(`codemini ${VERSION}
@@ -2545,7 +2545,7 @@ export async function createChatRuntime({
2545
2545
  'Explicit brainstorm mode:',
2546
2546
  '- Ask exactly one clarifying question first if any important uncertainty remains.',
2547
2547
  '- Do not inspect the repo or generate code unless the user explicitly asks for that.',
2548
- '- Do not choose an option on the first reply unless the request is already specific enough or the user explicitly asks you to recommend one.',
2548
+ '- If you recommend an option, present it as a suggested decision rather than a final choice for the user.',
2549
2549
  parsedInput.args.length > 0 ? `Current question:\n${parsedInput.args.join(' ')}` : ''
2550
2550
  ]
2551
2551
  .filter(Boolean)
@@ -16,13 +16,13 @@ function suggestionForToken(token, config) {
16
16
  const shell = String(config?.shell?.default || '').toLowerCase();
17
17
  if (token === 'find' || token === 'grep') {
18
18
  return shell === 'powershell'
19
- ? 'Use allowed search and context commands such as Get-ChildItem, Select-String, Get-Content, or rg when available.'
20
- : 'Use allowed search and context commands such as rg, find, grep, sed, cat, or ls.';
19
+ ? 'Prefer structured tools like locate and open_target first. If you need shell fallback, use allowed search and context commands such as Get-ChildItem, Select-String, Get-Content, or rg when available.'
20
+ : 'Prefer structured tools like locate and open_target first. If you need shell fallback, use allowed search and context commands such as rg, find, grep, sed, cat, or ls.';
21
21
  }
22
22
  if (shell === 'powershell') {
23
- return 'Use allowed shell commands for search and local context such as Get-ChildItem, Get-Content, Select-String, or rg when available.';
23
+ return 'Prefer structured tools like locate, open_target, and edit_target first. If you need shell fallback, use allowed shell commands for search and local context such as Get-ChildItem, Get-Content, Select-String, or rg when available.';
24
24
  }
25
- return 'Use allowed shell commands for search and local context such as rg, find, grep, sed, cat, or ls.';
25
+ return 'Prefer structured tools like locate, open_target, and edit_target first. If you need shell fallback, use allowed shell commands for search and local context such as rg, find, grep, sed, cat, or ls.';
26
26
  }
27
27
 
28
28
  export function evaluateCommandPolicy(command, config, workspaceRoot = process.cwd()) {
@@ -118,5 +118,5 @@ export function getEffectivePolicy(config) {
118
118
 
119
119
  export function getShellSystemPrompt(value) {
120
120
  const profile = getShellProfile(value);
121
- return `You are CodeMini CLI working in a ${profile.label} shell environment. Prefer the high-level structured workflow first: use locate to find candidates, open_target to inspect the smallest useful block and receive edit metadata, and edit_target to apply minimal edits. When you need lower-level control, use search_code, read_block, read_symbol_context, validate_edit, replace_block, replace_text, insert_before, insert_after, and generate_diff. Use start_service, list_services, get_service_status, get_service_logs, and stop_service for long-running servers or watchers. Use run_command only for one-shot commands that should exit on their own. Use read_file only when structured reads are not enough. Use write_file only for full-file writes and always provide a concrete file path, not a directory. Avoid unnecessary tool calls.`;
121
+ return `You are CodeMini CLI working in a ${profile.label} shell environment. Prefer the high-level structured workflow first: use locate to find candidates, open_target to inspect the smallest useful block and receive edit metadata, and edit_target to apply minimal edits. When you need lower-level control, use search_code, read_block, read_symbol_context, validate_edit, replace_block, replace_text, insert_before, insert_after, and generate_diff. Use start_service, list_services, get_service_status, get_service_logs, and stop_service for long-running servers or watchers. Use run_command only for one-shot commands that should exit on their own. Use read_file only when structured reads are not enough. Use write_file only for full-file writes and always provide a concrete file path, not a directory. For existing code files, prefer locate -> open_target -> edit_target and only use write_file with full_file_rewrite=true when a whole-file rewrite is truly intended. Avoid unnecessary tool calls.`;
122
122
  }
package/src/core/tools.js CHANGED
@@ -37,6 +37,25 @@ const TEXT_EXTENSIONS = new Set([
37
37
  '.sh',
38
38
  '.ps1'
39
39
  ]);
40
+ const CODE_WRITE_GUARD_EXTENSIONS = new Set([
41
+ '.js',
42
+ '.jsx',
43
+ '.ts',
44
+ '.tsx',
45
+ '.mjs',
46
+ '.cjs',
47
+ '.py',
48
+ '.rb',
49
+ '.go',
50
+ '.rs',
51
+ '.java',
52
+ '.cs',
53
+ '.css',
54
+ '.scss',
55
+ '.html',
56
+ '.sh',
57
+ '.ps1'
58
+ ]);
40
59
  const LANGUAGE_FILE_TYPES = {
41
60
  js: ['js', 'jsx', 'mjs', 'cjs'],
42
61
  ts: ['ts', 'tsx'],
@@ -100,6 +119,10 @@ function detectTextFile(filePath) {
100
119
  return TEXT_EXTENSIONS.has(path.extname(filePath).toLowerCase());
101
120
  }
102
121
 
122
+ function isCodeLikePath(filePath) {
123
+ return CODE_WRITE_GUARD_EXTENSIONS.has(path.extname(String(filePath || '')).toLowerCase());
124
+ }
125
+
103
126
  function normalizeFileTypes(args = {}) {
104
127
  const explicit = Array.isArray(args?.file_types) ? args.file_types.map((item) => String(item || '').trim().toLowerCase()).filter(Boolean) : [];
105
128
  const language = String(args?.language || '').trim().toLowerCase();
@@ -490,6 +513,11 @@ async function writeFile(root, args) {
490
513
  } catch {
491
514
  existed = false;
492
515
  }
516
+ if (existed && !args?.append && !args?.full_file_rewrite && isCodeLikePath(rawPath)) {
517
+ throw new Error(
518
+ 'write_file blocks full overwrite for existing code files by default. Use locate -> open_target -> edit_target for minimal edits, or pass full_file_rewrite=true when a full-file rewrite is truly intended.'
519
+ );
520
+ }
493
521
  await fs.mkdir(path.dirname(target), { recursive: true });
494
522
  if (args?.append) {
495
523
  await fs.appendFile(target, args?.content || '', 'utf8');
@@ -1404,13 +1432,15 @@ export function getBuiltinTools({ workspaceRoot = process.cwd(), config }) {
1404
1432
  type: 'function',
1405
1433
  function: {
1406
1434
  name: 'write_file',
1407
- description: 'Write a UTF-8 text file in workspace. Always provide a full file path, not a directory.',
1435
+ description:
1436
+ 'Write a UTF-8 text file in workspace. Always provide a full file path, not a directory. Existing code files require full_file_rewrite=true for whole-file overwrites.',
1408
1437
  parameters: {
1409
1438
  type: 'object',
1410
1439
  properties: {
1411
1440
  path: { type: 'string' },
1412
1441
  content: { type: 'string' },
1413
- append: { type: 'boolean' }
1442
+ append: { type: 'boolean' },
1443
+ full_file_rewrite: { type: 'boolean' }
1414
1444
  },
1415
1445
  required: ['path', 'content']
1416
1446
  }