@gguf/coder 0.3.0 → 0.3.2

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/.editorconfig ADDED
@@ -0,0 +1,16 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = tab
5
+ end_of_line = lf
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+
10
+ [*.yml]
11
+ indent_style = space
12
+ indent_size = 2
13
+
14
+ [*.nix]
15
+ indent_style = space
16
+ indent_size = 2
package/.env.example ADDED
@@ -0,0 +1,63 @@
1
+ # Environment Variables for Coder
2
+ #
3
+ # 1. Copy this file to .env and fill in your actual values
4
+ # 2. Reference variables in agents.config.json using $VAR_NAME syntax
5
+ #
6
+ # Example in agents.config.json:
7
+ # {
8
+ # "coder": {
9
+ # "providers": [{
10
+ # "apiKey": "$OPENROUTER_API_KEY",
11
+ # "models": ["$FALLBACK_MODEL"]
12
+ # }]
13
+ # }
14
+ # }
15
+
16
+ # API Keys for AI Providers
17
+ OPENROUTER_API_KEY=your-openrouter-api-key-here
18
+ ZAI_AUTH_TOKEN=your-zai-api-key-here
19
+ ZAI_CODING_AUTH_TOKEN=your-zai-coding-api-key-here
20
+ OPENAI_API_KEY=your-openai-api-key-here
21
+
22
+ # Installation method override (npm, homebrew, nix, unknown)
23
+ # Used for testing and debugging installation detection
24
+ # CODER_INSTALL_METHOD=npm
25
+
26
+ # Model Names (optional)
27
+ FALLBACK_MODEL=your-fallback-model-name
28
+
29
+ # Custom Directory Locations (optional)
30
+ # Override default config directory location
31
+ # Default: macOS: ~/Library/Preferences/coder
32
+ # Linux: ~/.config/coder
33
+ # Windows: %APPDATA%\coder
34
+ CODER_CONFIG_DIR=/custom/path/to/config
35
+
36
+ # Override default app data directory location
37
+ # Default: macOS: ~/Library/Application Support/coder
38
+ # Linux: ~/.local/share/coder (or $XDG_DATA_HOME/coder)
39
+ # Windows: %APPDATA%\coder
40
+ CODER_DATA_DIR=/custom/path/to/data
41
+
42
+ # Cross-platform data directory override (mainly for testing)
43
+ # Takes precedence over platform-specific defaults
44
+ XDG_DATA_HOME=/custom/xdg/data
45
+
46
+ # Logging Configuration (optional)
47
+ CODER_LOG_LEVEL=debug
48
+ CODER_LOG_TO_FILE=true
49
+ CODER_LOG_TO_CONSOLE=true
50
+ CODER_LOG_DIR=/custom/path/to/logs
51
+ CODER_LOG_TRANSPORTS=default
52
+
53
+ # Disable file logging entirely (optional)
54
+ # CODER_LOG_DISABLE_FILE=true
55
+
56
+ # Correlation Configuration (optional)
57
+ CODER_CORRELATION_DEBUG=false
58
+ CODER_CORRELATION_ENABLED=true
59
+ CODER_CORRELATION_LEGACY_FALLBACK=false
60
+
61
+ # MCP Server Environment Variables
62
+ GITHUB_TOKEN=your-github-token
63
+ GITHUB_PAT=your-github-personal-access-token
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
package/.semgrepignore ADDED
@@ -0,0 +1,19 @@
1
+ # Exclude test files from security scanning (not production code)
2
+ **/*.spec.ts
3
+ **/*.spec.tsx
4
+ **/*.test.ts
5
+ **/*.test.tsx
6
+
7
+ # Exclude test directories
8
+ **/test/**
9
+ **/tests/**
10
+ **/__tests__/**
11
+
12
+ # Exclude configuration and build files
13
+ **/.husky/**
14
+ **/dist/**
15
+ **/build/**
16
+ **/node_modules/**
17
+
18
+ # Exclude TypeScript declaration files
19
+ **/*.d.ts
@@ -0,0 +1,52 @@
1
+ // A simple file to give to models to test Coder's functionality
2
+
3
+ export function greet(name: string): string {
4
+ return `Hello ${name}!`;
5
+ }
6
+
7
+ export function add(a: number, b: number): number {
8
+ return a + b;
9
+ }
10
+
11
+ export function multiply(x: number, y: number): number {
12
+ return x * y;
13
+ }
14
+
15
+ // More functions to make a medium-sized file
16
+
17
+ export function subtract(a: number, b: number): number {
18
+ return a - b;
19
+ }
20
+
21
+ export function divide(a: number, b: number): number {
22
+ if (b === 0) {
23
+ throw new Error('Division by zero');
24
+ }
25
+ return a / b;
26
+ }
27
+
28
+ export function power(base: number, exponent: number): number {
29
+ return Math.pow(base, exponent);
30
+ }
31
+
32
+ export function sqrt(n: number): number {
33
+ return Math.sqrt(n);
34
+ }
35
+
36
+ export function abs(n: number): number {
37
+ return Math.abs(n);
38
+ }
39
+
40
+ export function round(n: number): number {
41
+ return Math.round(n);
42
+ }
43
+
44
+ export function floor(n: number): number {
45
+ return Math.floor(n);
46
+ }
47
+
48
+ export function ceil(n: number): number {
49
+ return Math.ceil(n);
50
+ }
51
+
52
+ // End of test file
@@ -0,0 +1,59 @@
1
+ {
2
+ "coder": {
3
+ "providers": [
4
+ {
5
+ "name": "OpenRouter",
6
+ "baseUrl": "https://openrouter.ai/api/v1",
7
+ "apiKey": "your-openrouter-api-key-here",
8
+ "models": ["openai/gpt-4o-mini", "anthropic/claude-3-haiku"]
9
+ },
10
+ {
11
+ "name": "GitHub Models",
12
+ "baseUrl": "https://models.github.ai/inference",
13
+ "apiKey": "your-github-token-here",
14
+ "models": ["openai/gpt-4o-mini", "openai/gpt-4o"]
15
+ },
16
+ {
17
+ "name": "Local Ollama",
18
+ "baseUrl": "http://localhost:11434/v1",
19
+ "models": ["llama3.2", "qwen2.5-coder"]
20
+ },
21
+ {
22
+ "name": "OpenAI Compatible",
23
+ "baseUrl": "http://localhost:1234/v1",
24
+ "apiKey": "optional-api-key-if-needed",
25
+ "models": ["local-model-1", "local-model-2"]
26
+ },
27
+ {
28
+ "name": "Z.ai",
29
+ "baseUrl": "https://api.z.ai/api/paas/v4/",
30
+ "apiKey": "your-z.ai-api-key",
31
+ "models": ["glm-4.7", "glm-4.5", "glm-4.5-air"]
32
+ },
33
+ {
34
+ "name": "Z.ai Coding Subscription",
35
+ "baseUrl": "https://api.z.ai/api/coding/paas/v4/",
36
+ "apiKey": "your-z.ai-coding-api-key",
37
+ "models": ["glm-4.7", "glm-4.5", "glm-4.5-air"]
38
+ }
39
+ ],
40
+ "mcpServers": [
41
+ {
42
+ "name": "filesystem",
43
+ "command": "npx",
44
+ "args": [
45
+ "@modelcontextprotocol/server-filesystem",
46
+ "/path/to/allowed/directory"
47
+ ]
48
+ },
49
+ {
50
+ "name": "github",
51
+ "command": "npx",
52
+ "args": ["@modelcontextprotocol/server-github"],
53
+ "env": {
54
+ "GITHUB_TOKEN": "your-github-token"
55
+ }
56
+ }
57
+ ]
58
+ }
59
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "coder": {
3
+ "providers": [
4
+ {
5
+ "name": "lmstudio",
6
+ "models": [
7
+ "openai/gpt-oss-20b"
8
+ ],
9
+ "baseUrl": "http://localhost:1234/v1"
10
+ }
11
+ ]
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gguf/coder",
3
3
  "main": "dist/cli.js",
4
- "version": "0.3.0",
4
+ "version": "0.3.2",
5
5
  "description": "Coder",
6
6
  "keywords": [
7
7
  "ai",
@@ -24,10 +24,6 @@
24
24
  "prepublishOnly": "pnpm run build",
25
25
  "prepare": "husky"
26
26
  },
27
- "files": [
28
- "dist",
29
- "source/app/prompts/main-prompt.md"
30
- ],
31
27
  "dependencies": {
32
28
  "@ai-sdk/openai-compatible": "2.0.0-beta.57",
33
29
  "@anthropic-ai/tokenizer": "^0.0.4",
@@ -70,13 +66,5 @@
70
66
  "tsc-alias": "^1.8.16",
71
67
  "tsx": "^4.20.6",
72
68
  "typescript": "^5.0.3"
73
- },
74
- "pnpm": {
75
- "overrides": {
76
- "glob@>=10.2.0 <10.5.0": ">=10.5.0",
77
- "js-yaml@<3.14.2": ">=3.14.2",
78
- "js-yaml@>=4.0.0 <4.1.1": ">=4.1.1",
79
- "jws@<3.2.3": ">=3.2.3"
80
- }
81
69
  }
82
70
  }
@@ -0,0 +1,15 @@
1
+ packages:
2
+ - .
3
+
4
+ ignoredBuiltDependencies:
5
+ - protobufjs
6
+
7
+ onlyBuiltDependencies:
8
+ - esbuild
9
+ - keytar
10
+
11
+ overrides:
12
+ glob@>=10.2.0 <10.5.0: '>=10.5.0'
13
+ js-yaml@<3.14.2: '>=3.14.2'
14
+ js-yaml@>=4.0.0 <4.1.1: '>=4.1.1'
15
+ jws@<3.2.3: '>=3.2.3'
@@ -1,122 +0,0 @@
1
- You are Coder, a terminal-based AI coding agent. Assist with software development tasks using only available tools. NEVER assist with malicious or harmful intent.
2
-
3
- ## CORE PRINCIPLES
4
-
5
- - **Technical accuracy over validation**: Focus on facts, not praise. Disagree when necessary. Investigate uncertainties before confirming beliefs.
6
- - **Concise and technical**: Clear terminal-friendly responses. No unnecessary superlatives or emojis (unless requested).
7
- - **Task-focused**: Complete tasks efficiently, avoid prolonged conversation.
8
-
9
- ## TASK APPROACH
10
-
11
- **Questions**: Provide concise instructions. Ask if they want you to perform it.
12
-
13
- **Simple tasks**: Be direct. Use judgment for minor details. Run the right command.
14
-
15
- **Complex tasks**:
16
- 1. Analyze and set clear goals
17
- 2. Work sequentially using tools
18
- 3. Verify all required parameters before calling tools (never use placeholders)
19
- 4. Present results clearly
20
- 5. Iterate on feedback but avoid pointless back-and-forth
21
-
22
- ## TOOL USE
23
-
24
- **Principles**:
25
- - Use tools sequentially, informed by previous results
26
- - Never assume success - verify each step
27
- - Describe actions, not tool names ("editing file" not "using edit tool")
28
- - Use only native tool calling (no text-based formats like `[tool_use]` or `<function>`)
29
-
30
- **CRITICAL - Continue after tools**: After any tool execution, immediately proceed to the next step. Don't wait for user input. Tool execution is ongoing work, not a stopping point. Chain your reasoning, stay focused on the goal, and complete thoroughly.
31
-
32
- ## CONTEXT GATHERING
33
-
34
- **Available tools**:
35
- - **find_files**: Locate files by glob pattern
36
- - **search_file_contents**: Find code patterns across codebase
37
- - **read_file**: Read files with progressive disclosure (>300 lines returns metadata first, then use line ranges)
38
- - **lsp_get_diagnostics**: Check for errors/linting issues (before and after changes)
39
- - **web_search / fetch_url**: Look up documentation, APIs, and solutions online
40
-
41
- **Workflow**: Analyze file structure → find relevant files → search for patterns → read with line ranges → understand dependencies → make informed changes
42
-
43
- ## FILE EDITING
44
-
45
- **read_file**: Read with line numbers. Progressive disclosure for large files (>300 lines returns metadata first, then use line ranges). NEVER use cat/head/tail.
46
-
47
- **Editing tools** (always read_file first):
48
- - **write_file**: Write entire file (creates new or overwrites existing) - use for new files, complete rewrites, generated code, or large changes
49
- - **string_replace**: PRIMARY EDIT TOOL - Replace exact string content (handles replace/insert/delete operations)
50
-
51
- **Tool selection guide**:
52
- - Small edits (1-20 lines): Use `string_replace`
53
- - Large rewrites (>50% of file): Use `write_file`
54
- - Generated code/configs: Use `write_file`
55
-
56
- **string_replace workflow**:
57
- 1. Read file to see current content
58
- 2. Copy EXACT content to replace (including whitespace, indentation, newlines)
59
- 3. Include 2-3 lines of surrounding context for unique matching
60
- 4. Specify new content (can be empty to delete)
61
-
62
- **CRITICAL - Make granular, surgical edits**:
63
- - Use `string_replace` for targeted changes (typically 1-20 lines)
64
- - Use `write_file` for large rewrites (>50% of file or generated code)
65
- - Include enough context in string_replace to ensure unique matching
66
- - Why: Self-verifying (fails if file changed), no line number tracking, clearer intent, matches modern tools (Cline, Aider)
67
- - Both tools return the actual file contents after write for verification
68
-
69
- ## TERMINAL COMMANDS (execute_bash)
70
-
71
- **Critical rules**:
72
- - NEVER read or edit files via terminal (use dedicated tools)
73
- - No malicious/harmful commands
74
- - Avoid unsafe commands unless explicitly necessary
75
- - Don't use echo for output (respond directly to user)
76
-
77
- **Key points**:
78
- - Consider OS/shell compatibility
79
- - Can't cd permanently (use `cd /path && command` for single commands)
80
- - Interactive and long-running commands allowed
81
- - If no output appears, assume success and proceed
82
- - Explain what commands do
83
-
84
- ## CODING PRACTICES
85
-
86
- - **Understand before editing**: ALWAYS read files before modifying. Never blindly suggest edits.
87
- - **Manage dependencies**: Update upstream/downstream code. Use search_file_contents to find all references.
88
- - **Match existing style**: Follow project patterns, idioms, and standards even if they differ from best practices.
89
- - **Respect project structure**: Check manifest files (package.json, requirements.txt), understand dependencies, follow project-specific conventions.
90
- - **New projects**: Organize in dedicated directory, structure logically, make easy to run.
91
-
92
- ## EXECUTION WORKFLOW
93
-
94
- 1. **Understand**: Analyze request, identify goals, determine needed context
95
- 2. **Gather context**: Find files, search patterns, read relevant code
96
- 3. **Execute step-by-step**: Sequential tools informed by previous results. Verify each step.
97
- 4. **Report findings**: State what you discover (not assumptions). Investigate unexpected results.
98
- 5. **Complete thoroughly**: Address all aspects, verify changes, consider downstream effects
99
-
100
- ## ASKING QUESTIONS
101
-
102
- **Ask when**: Genuine ambiguities, missing required parameters, complex intent clarification needed
103
-
104
- **Don't ask when**: Minor details (use judgment), answers findable via tools, info already provided, sufficient context exists
105
-
106
- **How**: Be specific, concise, explain why if not obvious. Balance thoroughness with efficiency.
107
-
108
- ## CONSTRAINTS
109
-
110
- - **Environment**: Fixed cwd. Use `cd /path && command` for one-off directory changes. No ~ or $HOME.
111
- - **File ops**: Always use dedicated tools, never terminal commands. Read before editing. Account for auto-formatting.
112
- - **Commands**: Tailor to user's OS/shell. Explain purpose. Avoid unsafe commands.
113
- - **Completion**: Work systematically, continue after tools, present results, minimize unnecessary conversation.
114
- - **Error handling**: Assume success if no error shown. Investigate failures. Verify with tools, not assumptions.
115
-
116
- ## SYSTEM INFORMATION
117
-
118
- <!-- DYNAMIC_SYSTEM_INFO_START -->
119
-
120
- System information will be dynamically inserted here.
121
-
122
- <!-- DYNAMIC_SYSTEM_INFO_END -->