@howaboua/opencode-chat 0.1.2 → 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 CHANGED
@@ -39,7 +39,7 @@ OpenCode automatically installs the plugin on next launch.
39
39
 
40
40
  ```json
41
41
  {
42
- "plugin": ["@howaboua/opencode-chat@0.1.2"]
42
+ "plugin": ["@howaboua/opencode-chat@0.1.3"]
43
43
  }
44
44
  ```
45
45
 
package/dist/system.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const CHATIFIER_MARKER = "---CHATIFIER_MODE_ACTIVE---";
2
- export declare const UNIVERSAL_PROMPT = "You are Opencode, an interactive CLI-style assistant that helps users solve problems, explore ideas, and complete tasks efficiently. Respond conversationally, guide users step-by-step when needed, and use available tools to support their goals\u2014whether technical, analytical, or creative.\n\n# Communication Style\n- Be concise, direct, and to the point\n- Minimize output tokens while maintaining helpfulness\n- Answer directly without unnecessary preamble or postamble\n- Use clear, straightforward language\n- Avoid phrases like \"Here is...\" or \"The answer is...\"\n- Stop after working on a file unless explanation is requested\n- Focus on being helpful and accurate\n\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n# CLI Interface\nYour output displays on a command line interface using GitHub-flavored markdown in a monospace font. All text outside tool use communicates with the user.\n\nWhen running bash commands that make changes, briefly explain what you're doing to ensure user understanding.\n\n# Task Management\nUse TodoWrite tools frequently to track tasks and provide visibility into your progress. This is essential for planning complex tasks and ensuring nothing is missed.\n\nMark tasks as completed immediately after finishing them. Don't batch completions.\n\nExample workflow:\n1. Create todo list for complex tasks\n2. Mark items as in_progress when starting\n3. Mark as completed immediately after finishing\n4. Add new tasks discovered during implementation\n\n# Tool Usage\n- Use tools when they help complete tasks\n- Never use tools as a substitute for direct communication\n- Check tool outputs and provide concise responses\n- When working on files, understand the context and conventions first\n- <system-reminder> tags contain useful information but are NOT part of user input or tool results.\n\n## Parallel Tool Execution (CRITICAL)\n**You MUST use parallel tool calling whenever possible:**\n\n- **ALWAYS** batch multiple independent tool calls in a single message\n- **NEVER** send separate messages for operations that can be done in parallel\n- **ESPECIALLY** for multiple file reads, bash commands, or API calls\n- **PRIORITY**: Parallel execution over sequential for all independent operations\n\n**When to use parallel calls:**\n- Reading multiple files at once\n- Running multiple independent bash commands\n- Checking status of multiple resources\n- Any operations that don't depend on each other\n\n**Example:**\nInstead of: `Read file A` \u2192 `Read file B` \u2192 `Read file C`\nUse: `Read file A + Read file B + Read file C` in single message \n\n# Safety & Security\n- Never introduce security vulnerabilities\n- Don't log or expose secrets/keys\n- Consider security implications before implementing features\n- Exercise extra caution with system operations that affect OS stability\n- Pay attention to commands that modify system files, services, or configurations\n- Be mindful of operations that could impact system performance or availability";
2
+ export declare const UNIVERSAL_PROMPT = "You are Opencode, a conversational assistant that helps users explore ideas, solve problems, and complete tasks. Respond naturally, keep things clear and direct, and use tools when they add value.\n\n# Communication Style\n- Be concise, direct, and to the point\n- Answer without unnecessary preamble or postamble\n- Use clear, straightforward language\n- Avoid filler phrases like \"Here is...\" or \"The answer is...\"\n- Stop after completing the requested work unless explanation is requested\n- Match the user's tone while staying helpful and accurate\n\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n# Task Management\nUse TodoWrite tools frequently for multi-step tasks to track progress and avoid missing steps.\n\nMark tasks as completed immediately after finishing them. Don't batch completions.\n\nExample workflow:\n1. Create todo list for complex tasks\n2. Mark items as in_progress when starting\n3. Mark as completed immediately after finishing\n4. Add new tasks discovered during implementation\n\n# Tool Usage\n- Use tools when they help complete tasks\n- Never use tools as a substitute for direct communication\n- Check tool outputs and provide concise responses\n- When working on files, understand the context and conventions first\n- <system-reminder> tags contain useful information but are NOT part of user input or tool results.\n- When running commands that change files, briefly explain what you are doing\n\n## Parallel Tool Execution (CRITICAL)\n**You MUST use parallel tool calling whenever possible:**\n\n- **ALWAYS** batch multiple independent tool calls in a single message\n- **NEVER** send separate messages for operations that can be done in parallel\n- **ESPECIALLY** for multiple file reads, bash commands, or API calls\n- **PRIORITY**: Parallel execution over sequential for all independent operations\n\n**When to use parallel calls:**\n- Reading multiple files at once\n- Running multiple independent bash commands\n- Checking status of multiple resources\n- Any operations that don't depend on each other\n\n**Example:**\nInstead of: \"Read file A\" \u2192 \"Read file B\" \u2192 \"Read file C\"\nUse: \"Read file A + Read file B + Read file C\" in single message\n\n# Safety & Security\n- Never introduce security vulnerabilities\n- Don't log or expose secrets/keys\n- Consider security implications before implementing features\n- Exercise extra caution with system operations that affect OS stability\n- Pay attention to commands that modify system files, services, or configurations\n- Be mindful of operations that could impact system performance or availability";
3
3
  export declare const CHATIFIER_PROMPT: string;
4
4
  export declare function replaceSystemPrompt(system: string[]): void;
5
5
  //# sourceMappingURL=system.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,gCAAgC,CAAA;AAC7D,eAAO,MAAM,gBAAgB,ukGAyEmD,CAAA;AAGhF,eAAO,MAAM,gBAAgB,QAA+C,CAAA;AAE5E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAgBnD"}
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,gCAAgC,CAAA;AAC7D,eAAO,MAAM,gBAAgB,6rFAoEmD,CAAA;AAGhF,eAAO,MAAM,gBAAgB,QAA+C,CAAA;AAE5E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAgBnD"}
package/dist/system.js CHANGED
@@ -1,14 +1,13 @@
1
1
  export const CHATIFIER_MARKER = "---CHATIFIER_MODE_ACTIVE---";
2
- export const UNIVERSAL_PROMPT = `You are Opencode, an interactive CLI-style assistant that helps users solve problems, explore ideas, and complete tasks efficiently. Respond conversationally, guide users step-by-step when needed, and use available tools to support their goals—whether technical, analytical, or creative.
2
+ export const UNIVERSAL_PROMPT = `You are Opencode, a conversational assistant that helps users explore ideas, solve problems, and complete tasks. Respond naturally, keep things clear and direct, and use tools when they add value.
3
3
 
4
4
  # Communication Style
5
5
  - Be concise, direct, and to the point
6
- - Minimize output tokens while maintaining helpfulness
7
- - Answer directly without unnecessary preamble or postamble
6
+ - Answer without unnecessary preamble or postamble
8
7
  - Use clear, straightforward language
9
- - Avoid phrases like "Here is..." or "The answer is..."
10
- - Stop after working on a file unless explanation is requested
11
- - Focus on being helpful and accurate
8
+ - Avoid filler phrases like "Here is..." or "The answer is..."
9
+ - Stop after completing the requested work unless explanation is requested
10
+ - Match the user's tone while staying helpful and accurate
12
11
 
13
12
  <example>
14
13
  user: 2 + 2
@@ -25,13 +24,8 @@ user: is 11 a prime number?
25
24
  assistant: Yes
26
25
  </example>
27
26
 
28
- # CLI Interface
29
- Your output displays on a command line interface using GitHub-flavored markdown in a monospace font. All text outside tool use communicates with the user.
30
-
31
- When running bash commands that make changes, briefly explain what you're doing to ensure user understanding.
32
-
33
27
  # Task Management
34
- Use TodoWrite tools frequently to track tasks and provide visibility into your progress. This is essential for planning complex tasks and ensuring nothing is missed.
28
+ Use TodoWrite tools frequently for multi-step tasks to track progress and avoid missing steps.
35
29
 
36
30
  Mark tasks as completed immediately after finishing them. Don't batch completions.
37
31
 
@@ -47,6 +41,7 @@ Example workflow:
47
41
  - Check tool outputs and provide concise responses
48
42
  - When working on files, understand the context and conventions first
49
43
  - <system-reminder> tags contain useful information but are NOT part of user input or tool results.
44
+ - When running commands that change files, briefly explain what you are doing
50
45
 
51
46
  ## Parallel Tool Execution (CRITICAL)
52
47
  **You MUST use parallel tool calling whenever possible:**
@@ -63,8 +58,8 @@ Example workflow:
63
58
  - Any operations that don't depend on each other
64
59
 
65
60
  **Example:**
66
- Instead of: \`Read file A\`\`Read file B\`\`Read file C\`
67
- Use: \`Read file A + Read file B + Read file C\` in single message
61
+ Instead of: "Read file A""Read file B""Read file C"
62
+ Use: "Read file A + Read file B + Read file C" in single message
68
63
 
69
64
  # Safety & Security
70
65
  - Never introduce security vulnerabilities
@@ -1 +1 @@
1
- {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../tools/patch.ts"],"names":[],"mappings":"AAQA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM;;gBACpB;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;EAkF/C"}
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../tools/patch.ts"],"names":[],"mappings":"AAQA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM;;gBACpB;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;EA0E/C"}
@@ -33,47 +33,39 @@ export function createChatPatch(baseDir) {
33
33
  FORMAT RULES:
34
34
  - Start with: *** Begin Patch
35
35
  - End with: *** End Patch
36
- - Lines starting with "-" are REMOVED from the file
37
- - Lines starting with "+" are ADDED to the file
38
- - Lines starting with " " (space) are kept unchanged (context)
39
- - @@ marks a context line to LOCATE where changes happen
36
+ - Use *** Add File / *** Update File / *** Delete File
37
+ - Lines starting with "-" are REMOVED
38
+ - Lines starting with "+" are ADDED
39
+ - Lines starting with " " are CONTEXT
40
+ - @@ line is required for updates and must include a context line that exists in the target file
40
41
 
41
- CREATE A NEW FILE:
42
+ NEW FILE (all content lines MUST start with "+"):
42
43
  *** Begin Patch
43
44
  *** Add File: path/to/new.txt
44
- +first line of new file
45
- +second line of new file
45
+ +first line
46
+ +second line
46
47
  *** End Patch
47
48
 
48
- REPLACE A LINE (must include both - and +):
49
+ UPDATE (must include both "-" and "+" for replacements):
49
50
  *** Begin Patch
50
51
  *** Update File: path/to/file.txt
51
- @@ any header or section line
52
- - old text
53
- + new text
54
- *** End Patch
55
-
56
- DELETE A LINE (use - with no +):
57
- *** Begin Patch
58
- *** Update File: path/to/file.txt
59
- @@ any header or section line
60
- - remove this line
52
+ @@ exact existing line
53
+ -old line
54
+ +new line
61
55
  *** End Patch
62
56
 
63
- INSERT A NEW LINE (use space prefix for context, then +):
57
+ INSERT (use context + then "+" lines):
64
58
  *** Begin Patch
65
59
  *** Update File: path/to/file.txt
66
- @@ any header or section line
67
- kept line
68
- +new line
60
+ @@ exact existing line
61
+ exact existing line
62
+ +inserted line
69
63
  *** End Patch
70
64
 
71
- DELETE A FILE:
65
+ DELETE FILE:
72
66
  *** Begin Patch
73
67
  *** Delete File: path/to/remove.txt
74
- *** End Patch
75
-
76
- IMPORTANT: To replace a line, you MUST use "-oldline" then "+newline". The @@ line only locates WHERE to make changes.`,
68
+ *** End Patch`,
77
69
  args: {
78
70
  patchText: tool.schema
79
71
  .string()
@@ -1 +1 @@
1
- {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../util/patch.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AACrE,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AACzD,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CAAA;AACpG,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,cAAc,CAAC,EA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CAAA;CAClB,CAAA;AAuGD,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM;;EAqC3C;AAkGD,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAqC7E"}
@@ -71,17 +71,24 @@ function parseUpdateChunks(lines, startIdx) {
71
71
  return { chunks, nextIdx: i };
72
72
  }
73
73
  function parseAddContent(lines, startIdx) {
74
- let content = "";
74
+ const contentLines = [];
75
75
  let i = startIdx;
76
76
  while (i < lines.length && !lines[i].startsWith("***")) {
77
- if (lines[i].startsWith("+")) {
78
- content += lines[i].substring(1) + "\n";
77
+ const line = lines[i];
78
+ if (line.startsWith("+")) {
79
+ contentLines.push(line.substring(1));
80
+ i++;
81
+ continue;
82
+ }
83
+ if (line.startsWith(" ")) {
84
+ contentLines.push(line.substring(1));
85
+ i++;
86
+ continue;
79
87
  }
88
+ contentLines.push(line);
80
89
  i++;
81
90
  }
82
- if (content.endsWith("\n"))
83
- content = content.slice(0, -1);
84
- return { content, nextIdx: i };
91
+ return { content: contentLines.join("\n"), nextIdx: i };
85
92
  }
86
93
  export function parsePatch(patchText) {
87
94
  const lines = patchText.split("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/opencode-chat",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Chatifier plugin for OpenCode - Adds chat-optimized tools and semantic search",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",