@rxpm/forge-cli 0.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 (63) hide show
  1. package/.dockerignore +6 -0
  2. package/.prettierrc +9 -0
  3. package/AGENT_RULES.md +42 -0
  4. package/Dockerfile +32 -0
  5. package/README.md +117 -0
  6. package/REQUIREMENTS.md +233 -0
  7. package/assets/preview_explain.webp +0 -0
  8. package/dist/agent/loop.d.ts +6 -0
  9. package/dist/agent/loop.js +62 -0
  10. package/dist/agent/loop.js.map +1 -0
  11. package/dist/cli/commands.d.ts +3 -0
  12. package/dist/cli/commands.js +40 -0
  13. package/dist/cli/commands.js.map +1 -0
  14. package/dist/config/env.d.ts +9 -0
  15. package/dist/config/env.js +16 -0
  16. package/dist/config/env.js.map +1 -0
  17. package/dist/index.d.ts +7 -0
  18. package/dist/index.js +20 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/llm/provider.d.ts +4 -0
  21. package/dist/llm/provider.js +12 -0
  22. package/dist/llm/provider.js.map +1 -0
  23. package/dist/tools/code.d.ts +15 -0
  24. package/dist/tools/code.js +53 -0
  25. package/dist/tools/code.js.map +1 -0
  26. package/dist/tools/fs.d.ts +18 -0
  27. package/dist/tools/fs.js +70 -0
  28. package/dist/tools/fs.js.map +1 -0
  29. package/dist/tools/git.d.ts +15 -0
  30. package/dist/tools/git.js +61 -0
  31. package/dist/tools/git.js.map +1 -0
  32. package/dist/tools/index.d.ts +35 -0
  33. package/dist/tools/index.js +22 -0
  34. package/dist/tools/index.js.map +1 -0
  35. package/dist/tools/shell.d.ts +9 -0
  36. package/dist/tools/shell.js +31 -0
  37. package/dist/tools/shell.js.map +1 -0
  38. package/dist/ui/activity.d.ts +49 -0
  39. package/dist/ui/activity.js +421 -0
  40. package/dist/ui/activity.js.map +1 -0
  41. package/dist/utils/logger.d.ts +8 -0
  42. package/dist/utils/logger.js +10 -0
  43. package/dist/utils/logger.js.map +1 -0
  44. package/dist/utils/logger2.d.ts +16 -0
  45. package/dist/utils/logger2.js +55 -0
  46. package/dist/utils/logger2.js.map +1 -0
  47. package/dist/utils/test-tools.d.ts +1 -0
  48. package/dist/utils/test-tools.js +31 -0
  49. package/dist/utils/test-tools.js.map +1 -0
  50. package/package.json +43 -0
  51. package/src/agent/loop.ts +68 -0
  52. package/src/cli/commands.ts +44 -0
  53. package/src/config/env.ts +17 -0
  54. package/src/index.ts +22 -0
  55. package/src/llm/provider.ts +13 -0
  56. package/src/tools/code.ts +53 -0
  57. package/src/tools/fs.ts +71 -0
  58. package/src/tools/git.ts +60 -0
  59. package/src/tools/index.ts +23 -0
  60. package/src/tools/shell.ts +32 -0
  61. package/src/ui/activity.ts +504 -0
  62. package/src/utils/logger.ts +10 -0
  63. package/tsconfig.json +18 -0
package/.dockerignore ADDED
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ dist
3
+ .env
4
+ .git
5
+ .DS_Store
6
+ package-lock.json
package/.prettierrc ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "tabWidth": 4,
3
+ "semi": true,
4
+ "singleQuote": true,
5
+ "trailingComma": "all",
6
+ "printWidth": 180,
7
+ "bracketSameLine": true,
8
+ "bracketSpacing": true
9
+ }
package/AGENT_RULES.md ADDED
@@ -0,0 +1,42 @@
1
+ ## Execution Discipline
2
+
3
+ 1. Always read before writing
4
+ 2. Never assume context
5
+ 3. Break tasks into steps
6
+ 4. Validate after every change
7
+
8
+ ---
9
+
10
+ ## Tool Usage Policy
11
+
12
+ * Prefer read_file before any modification
13
+ * Use search before scanning entire repo
14
+ * Use small edits instead of full rewrites
15
+
16
+ ---
17
+
18
+ ## Failure Recovery
19
+
20
+ If stuck:
21
+
22
+ 1. Re-evaluate plan
23
+ 2. Re-read relevant files
24
+ 3. Try alternative approach
25
+
26
+ ---
27
+
28
+ ## Coding Standards
29
+
30
+ * Follow existing code style
31
+ * Do not introduce new frameworks
32
+ * Keep changes minimal and reversible
33
+
34
+ ---
35
+
36
+ ## Communication
37
+
38
+ * Be direct
39
+ * No verbose explanations
40
+ * Focus on actions
41
+
42
+ ---
package/Dockerfile ADDED
@@ -0,0 +1,32 @@
1
+ # Use Node.js 22 as the base image
2
+ FROM node:22-slim
3
+
4
+ # Install git and grep (required by tools)
5
+ RUN apt-get update && apt-get install -y git grep && rm -rf /var/lib/apt/lists/*
6
+
7
+ # Set the working directory
8
+ WORKDIR /app
9
+
10
+ # Copy package files
11
+ COPY package*.json ./
12
+
13
+ # Install dependencies
14
+ RUN npm install
15
+
16
+ # Copy the rest of the source code
17
+ COPY . .
18
+
19
+ # Build the TypeScript project
20
+ RUN npm run build
21
+
22
+ # Make the binary executable
23
+ RUN chmod +x dist/index.js
24
+
25
+ # Link the package so 'forge' is available globally in the container
26
+ RUN npm link
27
+
28
+ # Set the working directory to /workspace for user projects
29
+ WORKDIR /workspace
30
+
31
+ # Default entrypoint
32
+ ENTRYPOINT ["forge"]
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ <!--
2
+ File: README.md
3
+ Author: Rajat Sharma
4
+ Date: 2026-03-26
5
+ -->
6
+
7
+ # Forge Coding Agent
8
+
9
+ A terminal-based AI coding agent built with Node.js, TypeScript, and the Vercel AI SDK. This agent can read, modify, and generate code in your local repository using LLMs via Ollama.
10
+
11
+ ![Preview](./assets/preview_explain.webp)
12
+
13
+ ## Prerequisites
14
+
15
+ - **Node.js**: >= 18.x
16
+ - **Ollama**: A running Ollama instance (local or cloud).
17
+
18
+ ## Installation
19
+
20
+ 1. **Clone the repository**:
21
+
22
+ ```bash
23
+ git clone <repository-url>
24
+ cd forge
25
+ ```
26
+
27
+ 2. **Install dependencies**:
28
+
29
+ ```bash
30
+ npm install
31
+ ```
32
+
33
+ 3. **Configure Environment**:
34
+
35
+ Create a `.env` file in the root directory:
36
+
37
+ ```env
38
+ OLLAMA_API_URL="https://your-ollama-endpoint"
39
+ OLLAMA_API_KEY="your-api-key-if-needed"
40
+ ```
41
+
42
+ 4. **Build the project**:
43
+
44
+ ```bash
45
+ npm run build
46
+ ```
47
+
48
+ 5. **Link the CLI (Optional)**:
49
+
50
+ To use the `agent` command globally:
51
+
52
+ ```bash
53
+ npm link
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ ### Run a Task
59
+
60
+ Execute a specific coding task:
61
+
62
+ ```bash
63
+ forge "Add a new endpoint to src/server.ts that returns system health"
64
+ ```
65
+
66
+ ### Explain Code
67
+
68
+ Get an explanation for a specific file:
69
+
70
+ ```bash
71
+ forge explain src/agent/loop.ts
72
+ ```
73
+
74
+ ### Fix Errors
75
+
76
+ Automatically detect and attempt to fix errors in the project:
77
+
78
+ ```bash
79
+ forge fix
80
+ ```
81
+
82
+ ### Interactive Chat
83
+
84
+ Start an interactive session (currently executes as a single multi-step task):
85
+
86
+ ```bash
87
+ forge chat
88
+ ```
89
+
90
+ ### Docker Usage
91
+
92
+ You can run the agent as a Docker container to avoid local Node.js environment setup.
93
+
94
+ 1. **Build the image**:
95
+
96
+ ```bash
97
+ docker build -t forge-agent .
98
+ ```
99
+
100
+ 2. **Run the agent** (mount your project as `/workspace`):
101
+
102
+ ```bash
103
+ docker run -it --rm \
104
+ -v $(pwd):/workspace \
105
+ --env-file .env \
106
+ forge-agent "List files in the workspace"
107
+ ```
108
+
109
+ Note: Ensure your `.env` file contains the correct `OLLAMA_API_URL` accessible from inside the container.
110
+
111
+ ## License
112
+
113
+ ISC
114
+
115
+ ## Author
116
+
117
+ Rajat Sharma (rajatxt@proton.me)
@@ -0,0 +1,233 @@
1
+ ## 1. Objective
2
+
3
+ Build a terminal-based AI coding agent (CLI tool) capable of reading, modifying, and generating code across a local repository using an open-source LLM via Ollama.
4
+
5
+ The agent must behave similarly to Claude Code:
6
+
7
+ * Understand user intent
8
+ * Explore codebase
9
+ * Plan changes
10
+ * Execute edits
11
+ * Iterate until task completion
12
+
13
+ ---
14
+
15
+ ## 2. Core Principles
16
+
17
+ 1. Deterministic over clever
18
+ 2. Small, verifiable steps
19
+ 3. Tool-driven execution (no hallucinated actions)
20
+ 4. Always validate before proceeding
21
+ 5. Prefer editing existing files over creating new ones
22
+
23
+ ---
24
+
25
+ ## 3. Tech Stack
26
+
27
+ * Runtime: Node.js (>=18)
28
+ * Language: TypeScript
29
+ * CLI: commander (or yargs)
30
+ * UI (optional): ink
31
+ * LLM: Ollama (OpenAI-compatible API)
32
+ * SDK: Vercel AI SDK (`ai`)
33
+ * Validation: zod
34
+
35
+ ---
36
+
37
+ ## 4. High-Level Architecture
38
+
39
+ CLI Input
40
+ → Agent Loop
41
+ → LLM (Ollama)
42
+ → Tool Calls
43
+ → Execution Layer
44
+ → Updated Context
45
+ → Repeat
46
+
47
+ ---
48
+
49
+ ## 5. Required Features
50
+
51
+ ### 5.1 CLI Commands
52
+
53
+ * `agent "<task>"` → execute coding task
54
+ * `agent chat` → interactive mode
55
+ * `agent explain <file>` → explain code
56
+ * `agent fix` → detect and fix errors
57
+
58
+ ---
59
+
60
+ ### 5.2 Agent Loop
61
+
62
+ The agent MUST follow this loop:
63
+
64
+ 1. Read current context
65
+ 2. Ask LLM for next step
66
+ 3. If tool call:
67
+
68
+ * Execute tool
69
+ * Append result to context
70
+ 4. If final answer:
71
+
72
+ * Output to user
73
+ * Exit loop
74
+
75
+ Loop must have:
76
+
77
+ * max iterations limit (default: 10)
78
+ * timeout protection
79
+ * retry mechanism (on invalid tool call)
80
+
81
+ ---
82
+
83
+ ### 5.3 Tool System
84
+
85
+ All actions MUST go through tools.
86
+
87
+ #### Required Tools
88
+
89
+ ##### File System
90
+
91
+ * read_file(path)
92
+ * write_file(path, content)
93
+ * list_files(path)
94
+
95
+ ##### Codebase Navigation
96
+
97
+ * search_code(query)
98
+ * open_file_lines(path, start, end)
99
+
100
+ ##### Shell
101
+
102
+ * run_command(cmd)
103
+
104
+ ##### Git (optional but recommended)
105
+
106
+ * git_status()
107
+ * git_diff()
108
+ * git_commit(message)
109
+
110
+ ---
111
+
112
+ ### 5.4 Tool Rules
113
+
114
+ * NEVER assume file contents without reading
115
+ * NEVER overwrite files without justification
116
+ * ALWAYS show diffs before major rewrites
117
+ * LIMIT file size (max 5000 lines per read)
118
+
119
+ ---
120
+
121
+ ## 6. Prompting Strategy
122
+
123
+ System prompt MUST enforce:
124
+
125
+ * You are a coding agent operating in a real filesystem
126
+ * You must use tools to interact with environment
127
+ * Do not hallucinate file contents
128
+ * Prefer minimal changes
129
+ * Always verify results
130
+
131
+ ---
132
+
133
+ ## 7. Context Management
134
+
135
+ * Maintain conversation history
136
+ * Include:
137
+
138
+ * user request
139
+ * tool outputs
140
+ * recent file contents
141
+ * Trim context when too large
142
+
143
+ ---
144
+
145
+ ## 8. Streaming
146
+
147
+ * Stream LLM responses to terminal
148
+ * Show tool usage clearly
149
+ * Indicate current step (e.g. "Reading file...", "Applying patch...")
150
+
151
+ ---
152
+
153
+ ## 9. Error Handling
154
+
155
+ Must handle:
156
+
157
+ * invalid tool calls
158
+ * missing files
159
+ * command failures
160
+ * LLM malformed output
161
+
162
+ On error:
163
+
164
+ * retry once with correction
165
+ * otherwise surface error clearly
166
+
167
+ ---
168
+
169
+ ## 10. Safety Constraints
170
+
171
+ * Do not run destructive commands without confirmation
172
+ * Do not modify system files outside project root
173
+ * Do not execute arbitrary shell commands without validation
174
+
175
+ ---
176
+
177
+ ## 11. Configuration
178
+
179
+ Support:
180
+
181
+ * model selection (default: llama3)
182
+ * max iterations
183
+ * temperature (optional)
184
+ * root directory
185
+
186
+ ---
187
+
188
+ ## 12. Output Behavior
189
+
190
+ * Be concise
191
+ * Show actions taken
192
+ * Show diffs for edits
193
+ * Avoid unnecessary explanations
194
+
195
+ ---
196
+
197
+ ## 13. Project Structure
198
+
199
+ /src
200
+ /cli
201
+ /agent
202
+ /tools
203
+ /llm
204
+ /utils
205
+
206
+ ---
207
+
208
+ ## 14. Definition of Done
209
+
210
+ Task is complete when:
211
+
212
+ * requested changes are implemented
213
+ * code compiles / runs (if applicable)
214
+ * no pending errors detected
215
+
216
+ ---
217
+
218
+ ## 15. Non-Goals
219
+
220
+ * No GUI
221
+ * No cloud dependency
222
+ * No long-term memory (v1)
223
+
224
+ ---
225
+
226
+ ## 16. Future Enhancements (Optional)
227
+
228
+ * multi-agent planning
229
+ * test generation
230
+ * auto-debug loop
231
+ * IDE integration
232
+
233
+ ---
Binary file
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Runs the AI agent to solve the given task.
3
+ * @param task The task to solve.
4
+ * @param maxIterations The maximum number of iterations to run the agent for.
5
+ */
6
+ export declare function runAgent(task: string, maxIterations?: number): Promise<void>;
@@ -0,0 +1,62 @@
1
+ import { stepCountIs, ToolLoopAgent } from 'ai';
2
+ import { ollama, defaultModel } from '../llm/provider.js';
3
+ import { tools } from '../tools/index.js';
4
+ import { ActivityDisplay } from '../ui/activity.js';
5
+ const SYSTEM_PROMPT = `
6
+ You are a senior AI coding agent operating in a real filesystem.
7
+ Your goal is to solve the user's coding task by following a logical process:
8
+ 1. Explore the codebase to understand the current state.
9
+ 2. Plan your changes carefully.
10
+ 3. Execute the changes by writing complete, valid files or code blocks.
11
+ 4. Verify your work using the tools provided.
12
+
13
+ ## Core Rules:
14
+ 1. ALWAYS read a file before modifying it.
15
+ 2. NEVER guess file content.
16
+ 3. When writing a file, PROVIDE THE FULL CONTENT of the file unless instructed otherwise.
17
+ 4. Use small, verifiable steps.
18
+ 5. If a command fails, analyze the error and try a different approach.
19
+ 6. Be concise and professional. No fluff.
20
+
21
+ ## Tools Available:
22
+ - read_file(path): Returns the full content of a file.
23
+ - write_file(path, content): Writes the EXACT content to a file.
24
+ - list_files(path): Lists all files in the given directory.
25
+ - search_code(query): Searches for a string in the codebase.
26
+ - open_file_lines(path, start, end): Reads specific lines (1-indexed).
27
+ - run_command(cmd): Executes a shell command.
28
+ - git_status(), git_diff(), git_commit(message): Git operations.
29
+
30
+ Always verify your changes after writing.
31
+ `;
32
+ /**
33
+ * Runs the AI agent to solve the given task.
34
+ * @param task The task to solve.
35
+ * @param maxIterations The maximum number of iterations to run the agent for.
36
+ */
37
+ export async function runAgent(task, maxIterations = 10) {
38
+ const display = new ActivityDisplay();
39
+ try {
40
+ // Show branded banner
41
+ ActivityDisplay.printBanner(task);
42
+ // Start thinking indicator
43
+ display.startThinking();
44
+ const agent = new ToolLoopAgent({
45
+ model: ollama(defaultModel),
46
+ instructions: SYSTEM_PROMPT,
47
+ tools,
48
+ maxRetries: 2,
49
+ toolChoice: 'required',
50
+ stopWhen: stepCountIs(maxIterations),
51
+ onStepFinish(step) {
52
+ display.onStepFinish(step);
53
+ },
54
+ });
55
+ await agent.generate({ prompt: task });
56
+ display.printSummary('success');
57
+ }
58
+ catch (error) {
59
+ display.printSummary('error', error.message);
60
+ }
61
+ }
62
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/agent/loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,aAAa,GAAG,EAAE;IAC3D,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IAEtC,IAAI,CAAC;QACD,sBAAsB;QACtB,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAElC,2BAA2B;QAC3B,OAAO,CAAC,aAAa,EAAE,CAAC;QAExB,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC;YAC5B,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC;YAC3B,YAAY,EAAE,aAAa;YAC3B,KAAK;YACL,UAAU,EAAE,CAAC;YACb,UAAU,EAAE,UAAU;YACtB,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC;YACpC,YAAY,CAAC,IAAI;gBACb,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;SACJ,CAAC,CAAC;QAEH,MAAM,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ declare const program: Command;
3
+ export { program };
@@ -0,0 +1,40 @@
1
+ import { Command } from 'commander';
2
+ import { runAgent } from '../agent/loop.js';
3
+ import { logger } from '../utils/logger.js';
4
+ const program = new Command();
5
+ program
6
+ .name('forge')
7
+ .description('AI coding agent CLI tool')
8
+ .version('0.0.1')
9
+ .argument('[task]', 'The task to execute (default if no command provided)')
10
+ .option('-i, --iterations <number>', 'Maximum number of iterations', '10')
11
+ .action(async function (task, options) {
12
+ if (task) {
13
+ await runAgent(task, parseInt(options.iterations));
14
+ }
15
+ else {
16
+ program.help();
17
+ }
18
+ });
19
+ program
20
+ .command('chat')
21
+ .description('Interactive mode (v1: executes a single multi-step task)')
22
+ .action(async function () {
23
+ logger.warn('Interactive chat mode is currently limited to executing single tasks via main "agent <task>" command.');
24
+ });
25
+ program
26
+ .command('explain')
27
+ .argument('<file>', 'The file to explain')
28
+ .action(async function (file) {
29
+ const task = `Explain the code in the file: ${file}`;
30
+ await runAgent(task);
31
+ });
32
+ program
33
+ .command('fix')
34
+ .description('Detect and fix errors in the project')
35
+ .action(async function () {
36
+ const task = `Search for errors in the project, check git status, and try to fix any obvious bugs.`;
37
+ await runAgent(task);
38
+ });
39
+ export { program };
40
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACF,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,0BAA0B,CAAC;KACvC,OAAO,CAAC,OAAO,CAAC;KAChB,QAAQ,CAAC,QAAQ,EAAE,sDAAsD,CAAC;KAC1E,MAAM,CAAC,2BAA2B,EAAE,8BAA8B,EAAE,IAAI,CAAC;KACzE,MAAM,CAAC,KAAK,WAAW,IAAI,EAAE,OAAO;IACjC,IAAI,IAAI,EAAE,CAAC;QACP,MAAM,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;AACL,CAAC,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,0DAA0D,CAAC;KACvE,MAAM,CAAC,KAAK;IACT,MAAM,CAAC,IAAI,CAAC,uGAAuG,CAAC,CAAC;AACzH,CAAC,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,SAAS,CAAC;KAClB,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;KACzC,MAAM,CAAC,KAAK,WAAW,IAAI;IACxB,MAAM,IAAI,GAAG,iCAAiC,IAAI,EAAE,CAAC;IACrD,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,sCAAsC,CAAC;KACnD,MAAM,CAAC,KAAK;IACT,MAAM,IAAI,GAAG,sFAAsF,CAAC;IACpG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC;AAEP,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ /** Get the API URL for the Ollama server. */
3
+ readonly ollamaApiUrl: string;
4
+ /** Get the API secret for the Ollama server. */
5
+ readonly ollamaApiSecret: string;
6
+ /** Get the default model to use for the AI agent. */
7
+ readonly defaultModel: string;
8
+ };
9
+ export default _default;
@@ -0,0 +1,16 @@
1
+ export default {
2
+ /** Get the API URL for the Ollama server. */
3
+ get ollamaApiUrl() {
4
+ const baseUrl = process.env.OLLAMA_API_URL || 'http://localhost:11434';
5
+ return `${baseUrl}/api`;
6
+ },
7
+ /** Get the API secret for the Ollama server. */
8
+ get ollamaApiSecret() {
9
+ return process.env.OLLAMA_API_KEY || '';
10
+ },
11
+ /** Get the default model to use for the AI agent. */
12
+ get defaultModel() {
13
+ return process.env.OLLAMA_DEFAULT_MODEL || 'gpt-oss:120b';
14
+ },
15
+ };
16
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,6CAA6C;IAC7C,IAAI,YAAY;QACZ,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,wBAAwB,CAAC;QACvE,OAAO,GAAG,OAAO,MAAM,CAAC;IAC5B,CAAC;IAED,gDAAgD;IAChD,IAAI,eAAe;QACf,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED,qDAAqD;IACrD,IAAI,YAAY;QACZ,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,cAAc,CAAC;IAC9D,CAAC;CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * File: src/index.ts
4
+ * Author: Rajat Sharma
5
+ * Description: The main entry point for the CLI tool.
6
+ */
7
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * File: src/index.ts
4
+ * Author: Rajat Sharma
5
+ * Description: The main entry point for the CLI tool.
6
+ */
7
+ import { program } from './cli/commands.js';
8
+ import { logger } from './utils/logger.js';
9
+ /** The main function that parses the command line arguments and executes the corresponding command. */
10
+ async function main() {
11
+ try {
12
+ await program.parseAsync(process.argv);
13
+ }
14
+ catch (error) {
15
+ logger.error(`CLI execution failed: ${error.message}`);
16
+ process.exit(1);
17
+ }
18
+ }
19
+ main();
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,uGAAuG;AACvG,KAAK,UAAU,IAAI;IACf,IAAI,CAAC;QACD,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,MAAM,CAAC,KAAK,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** The default model to use for the AI agent. */
2
+ export declare const defaultModel: string;
3
+ /** The Ollama client for the AI agent. */
4
+ export declare const ollama: import("ollama-ai-provider-v2").OllamaProvider;
@@ -0,0 +1,12 @@
1
+ import { createOllama } from 'ollama-ai-provider-v2';
2
+ import env from '../config/env.js';
3
+ /** The default model to use for the AI agent. */
4
+ export const defaultModel = env.defaultModel;
5
+ /** The Ollama client for the AI agent. */
6
+ export const ollama = createOllama({
7
+ baseURL: env.ollamaApiUrl + '/api',
8
+ headers: {
9
+ Authorization: `Bearer ${env.ollamaApiSecret}`,
10
+ },
11
+ });
12
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/llm/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAEnC,iDAAiD;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;AAE7C,0CAA0C;AAC1C,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC;IAC/B,OAAO,EAAE,GAAG,CAAC,YAAY,GAAG,MAAM;IAClC,OAAO,EAAE;QACL,aAAa,EAAE,UAAU,GAAG,CAAC,eAAe,EAAE;KACjD;CACJ,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * File: code.ts
3
+ * Author: Rajat Sharma
4
+ * Description: Code tools for the AI agent.
5
+ */
6
+ /** Searches for a string in the codebase using grep. */
7
+ export declare const searchCodeTool: import("ai").Tool<{
8
+ query: string;
9
+ }, string>;
10
+ /** Opens a file and reads specific line range. */
11
+ export declare const openFileLinesTool: import("ai").Tool<{
12
+ path: string;
13
+ start: number;
14
+ end: number;
15
+ }, string>;