woopcode 0.1.0

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 (67) hide show
  1. package/CONTRIBUTING.md +329 -0
  2. package/LICENSE +21 -0
  3. package/README.md +582 -0
  4. package/cli.ts +17 -0
  5. package/commands/agent.tsx +139 -0
  6. package/commands/agentController.ts +138 -0
  7. package/commands/models.ts +21 -0
  8. package/commands/providers/index.ts +12 -0
  9. package/commands/providers/listProviders.ts +28 -0
  10. package/commands/providers/login.ts +28 -0
  11. package/commands/providers/logout.ts +33 -0
  12. package/commands/providers/setProvider.ts +34 -0
  13. package/config/authProvider.ts +54 -0
  14. package/config/client.ts +163 -0
  15. package/config/config.ts +118 -0
  16. package/config/conversation.json +1 -0
  17. package/config/models.json +50 -0
  18. package/config/paths.ts +96 -0
  19. package/config/providers.json +21 -0
  20. package/config/runtime.ts +130 -0
  21. package/config/systemPrompt.ts +54 -0
  22. package/config/types.ts +88 -0
  23. package/onboarding/FLOW.md +291 -0
  24. package/onboarding/index.ts +56 -0
  25. package/onboarding/providers.ts +47 -0
  26. package/onboarding/setupWizard.tsx +193 -0
  27. package/onboarding/test-reset.ts +55 -0
  28. package/package.json +86 -0
  29. package/tools/createFile.ts +24 -0
  30. package/tools/editFile.ts +85 -0
  31. package/tools/findFiles.ts +94 -0
  32. package/tools/grep.ts +68 -0
  33. package/tools/index.ts +26 -0
  34. package/tools/listFiles.ts +49 -0
  35. package/tools/readFile.ts +53 -0
  36. package/tools/runTests.ts +29 -0
  37. package/tools/terminal.ts +37 -0
  38. package/tools/writeFile.ts +75 -0
  39. package/tui/package.json +0 -0
  40. package/tui/src/app.tsx +60 -0
  41. package/tui/src/components/ApprovalFooter.tsx +29 -0
  42. package/tui/src/components/AsciiLogo.tsx +78 -0
  43. package/tui/src/components/BootScreen.tsx +76 -0
  44. package/tui/src/components/CapabilityRow.tsx +17 -0
  45. package/tui/src/components/CodeBlock.tsx +70 -0
  46. package/tui/src/components/DiffPreview.tsx +46 -0
  47. package/tui/src/components/DiffViewer.tsx +36 -0
  48. package/tui/src/components/HomeFooter.tsx +11 -0
  49. package/tui/src/components/HomeScreen.tsx +71 -0
  50. package/tui/src/components/InlineCode.tsx +13 -0
  51. package/tui/src/components/LogoReveal.tsx +158 -0
  52. package/tui/src/components/Markdown.tsx +280 -0
  53. package/tui/src/components/MessageRenderer.tsx +84 -0
  54. package/tui/src/components/PromptCard.tsx +52 -0
  55. package/tui/src/components/StreamingCursor.tsx +13 -0
  56. package/tui/src/components/ThinkingIndicator.tsx +14 -0
  57. package/tui/src/components/ToolStatus.tsx +26 -0
  58. package/tui/src/header.tsx +25 -0
  59. package/tui/src/hooks/useBootAnimation.ts +67 -0
  60. package/tui/src/hooks/useLogoAnimation.ts +114 -0
  61. package/tui/src/index.ts +5 -0
  62. package/tui/src/prompt.tsx +66 -0
  63. package/tui/src/statusBar.tsx +83 -0
  64. package/tui/src/store/ui-store.ts +234 -0
  65. package/tui/src/store/useUIStore.ts +9 -0
  66. package/tui/src/timeline.tsx +96 -0
  67. package/tui/src/types.ts +40 -0
@@ -0,0 +1,329 @@
1
+ # Contributing to Woopcode
2
+
3
+ Thank you for your interest in contributing to Woopcode! This document provides guidelines and instructions for contributing.
4
+
5
+ ## Getting Started
6
+
7
+ ### Prerequisites
8
+
9
+ - [Bun](https://bun.sh) v1.0.0 or higher
10
+ - TypeScript knowledge
11
+ - Git
12
+
13
+ ### Development Setup
14
+
15
+ 1. Fork the repository on GitHub
16
+
17
+ 2. Clone your fork:
18
+ ```bash
19
+ git clone https://github.com/YOUR_USERNAME/woopcode.git
20
+ cd woopcode
21
+ ```
22
+
23
+ 3. Install dependencies:
24
+ ```bash
25
+ bun install
26
+ ```
27
+
28
+ 4. Create a feature branch:
29
+ ```bash
30
+ git checkout -b feature/my-feature-name
31
+ ```
32
+
33
+ 5. Configure a provider (for testing):
34
+ ```bash
35
+ bun cli.ts
36
+ # Follow the onboarding wizard
37
+ ```
38
+
39
+ ## Development Workflow
40
+
41
+ ### Running Locally
42
+
43
+ ```bash
44
+ # Run the CLI
45
+ bun cli.ts
46
+
47
+ # Run with a specific prompt
48
+ bun cli.ts --prompt "Explain this repository"
49
+
50
+ # Test onboarding flow
51
+ bun onboarding/test-reset.ts # Clear config
52
+ bun cli.ts # Test onboarding
53
+ bun onboarding/test-reset.ts restore # Restore config
54
+ ```
55
+
56
+ ### Type Checking
57
+
58
+ ```bash
59
+ bunx tsc --noEmit --skipLibCheck
60
+ ```
61
+
62
+ ### Running Tests
63
+
64
+ ```bash
65
+ # Run all tests
66
+ bun test
67
+
68
+ # Run specific test file
69
+ bun test packages/tests/runtime/agentLoop.test.ts
70
+
71
+ # Run tests matching a pattern
72
+ bun test --test-name-pattern "streaming"
73
+
74
+ # Run benchmarks
75
+ bun run-benchmarks.ts
76
+ ```
77
+
78
+ ### Code Style
79
+
80
+ - Use TypeScript strict mode
81
+ - Follow existing code conventions
82
+ - Use Bun-native APIs over Node.js equivalents
83
+ - Prefer functional patterns where appropriate
84
+ - Keep functions small and focused
85
+
86
+ Example:
87
+ ```typescript
88
+ // Good: Bun-native API
89
+ const content = await Bun.file(path).text();
90
+
91
+ // Avoid: Node.js API
92
+ const content = await fs.readFile(path, 'utf-8');
93
+ ```
94
+
95
+ ## Contribution Areas
96
+
97
+ ### Adding Tools
98
+
99
+ New tools should be added to the `tools/` directory. See [Extending Woopcode](README.md#extending-woopcode) in the README.
100
+
101
+ **Good candidates for new tools:**
102
+ - Git operations (commit, diff, log)
103
+ - Code analysis (linting, type checking)
104
+ - Documentation generation
105
+ - Dependency management
106
+ - Database operations
107
+
108
+ **Tool requirements:**
109
+ - Clear, specific purpose
110
+ - Safe by default
111
+ - Idempotent when possible
112
+ - Comprehensive error handling
113
+ - Unit tests
114
+
115
+ ### Adding Providers
116
+
117
+ See the [Provider Implementation Guide](README.md#adding-a-new-provider) in the README.
118
+
119
+ **Provider requirements:**
120
+ - Streaming support
121
+ - Tool calling capability
122
+ - Proper error handling
123
+ - Authentication validation
124
+ - Integration tests
125
+
126
+ ### Improving Documentation
127
+
128
+ Documentation improvements are always welcome:
129
+ - README clarifications
130
+ - Code comments
131
+ - Usage examples
132
+ - Architecture diagrams
133
+ - Tutorial content
134
+
135
+ ### Fixing Bugs
136
+
137
+ When fixing bugs:
138
+ 1. Create an issue describing the bug (if one doesn't exist)
139
+ 2. Write a failing test that reproduces the bug
140
+ 3. Fix the bug
141
+ 4. Ensure the test passes
142
+ 5. Submit a PR referencing the issue
143
+
144
+ ### Adding Tests
145
+
146
+ We value comprehensive testing. Test additions are welcome in these categories:
147
+
148
+ - **Unit tests** - Test individual functions and components
149
+ - **Integration tests** - Test tool and provider integration
150
+ - **Property tests** - Use fast-check for fuzz testing
151
+ - **Golden tests** - Snapshot testing for runtime behavior
152
+ - **E2E tests** - Full agent session testing
153
+
154
+ Place tests in `packages/tests/` following the existing structure.
155
+
156
+ ## Pull Request Process
157
+
158
+ ### Before Submitting
159
+
160
+ - [ ] Code follows project style guidelines
161
+ - [ ] Tests added for new functionality
162
+ - [ ] All tests pass (`bun test`)
163
+ - [ ] TypeScript compiles without errors
164
+ - [ ] Documentation updated if needed
165
+ - [ ] Commits are clean and well-described
166
+
167
+ ### PR Guidelines
168
+
169
+ 1. **Title**: Clear, concise description
170
+ - Good: "Add OpenAI provider support"
171
+ - Bad: "Update files"
172
+
173
+ 2. **Description**: Explain what and why
174
+ - What problem does this solve?
175
+ - What approach did you take?
176
+ - Any breaking changes?
177
+ - Screenshots/demos if applicable
178
+
179
+ 3. **Size**: Keep PRs focused
180
+ - One feature/fix per PR
181
+ - Break large changes into multiple PRs
182
+ - Easier to review = faster merge
183
+
184
+ 4. **Tests**: Include tests
185
+ - New features require tests
186
+ - Bug fixes should include regression tests
187
+ - Document why tests aren't needed if that's the case
188
+
189
+ ### Review Process
190
+
191
+ 1. Maintainers will review your PR
192
+ 2. Address any requested changes
193
+ 3. Once approved, a maintainer will merge
194
+
195
+ Expected review time: 2-5 days for most PRs.
196
+
197
+ ## Commit Message Guidelines
198
+
199
+ We use conventional commit messages:
200
+
201
+ ```
202
+ <type>(<scope>): <description>
203
+
204
+ [optional body]
205
+
206
+ [optional footer]
207
+ ```
208
+
209
+ ### Types
210
+
211
+ - `feat:` - New feature
212
+ - `fix:` - Bug fix
213
+ - `docs:` - Documentation changes
214
+ - `test:` - Test additions or changes
215
+ - `refactor:` - Code refactoring
216
+ - `perf:` - Performance improvements
217
+ - `chore:` - Maintenance tasks
218
+
219
+ ### Examples
220
+
221
+ ```bash
222
+ feat(tools): add git commit tool
223
+
224
+ Adds a new tool for creating git commits with AI-generated messages.
225
+
226
+ Closes #123
227
+ ```
228
+
229
+ ```bash
230
+ fix(runtime): prevent infinite tool loops
231
+
232
+ Tool loop detection now checks both tool name and arguments to properly
233
+ detect cycles.
234
+ ```
235
+
236
+ ```bash
237
+ docs(readme): clarify provider setup process
238
+
239
+ Add step-by-step instructions for obtaining API keys.
240
+ ```
241
+
242
+ ## Testing Philosophy
243
+
244
+ ### What to Test
245
+
246
+ - **Public APIs** - All exported functions and classes
247
+ - **Error cases** - Invalid inputs, edge cases, failures
248
+ - **Integration points** - Tool execution, provider calls
249
+ - **Critical paths** - Agent loop, streaming, file operations
250
+
251
+ ### What Not to Test
252
+
253
+ - Private implementation details (test behavior, not internals)
254
+ - Third-party libraries (trust their tests)
255
+ - Configuration files (unless logic involved)
256
+
257
+ ### Test Quality
258
+
259
+ Good tests are:
260
+ - **Fast** - Run in milliseconds
261
+ - **Isolated** - No dependencies on other tests
262
+ - **Deterministic** - Same input always produces same output
263
+ - **Readable** - Clear what's being tested and why
264
+
265
+ Example:
266
+ ```typescript
267
+ import { test, expect } from "bun:test";
268
+ import { myFunction } from "./myModule";
269
+
270
+ test("myFunction handles empty input", () => {
271
+ const result = myFunction("");
272
+ expect(result).toBe(expectedValue);
273
+ });
274
+
275
+ test("myFunction throws on invalid input", () => {
276
+ expect(() => myFunction(null)).toThrow("Invalid input");
277
+ });
278
+ ```
279
+
280
+ ## Project Architecture
281
+
282
+ Understanding the architecture helps with contributions:
283
+
284
+ ### Key Concepts
285
+
286
+ **Runtime Loop** (`config/runtime.ts`)
287
+ - Orchestrates agent execution
288
+ - Manages streaming from providers
289
+ - Executes tools
290
+ - Handles errors and cancellation
291
+
292
+ **Tool System** (`tools/`)
293
+ - Uniform interface for agent capabilities
294
+ - Tools registered in `tools/index.ts`
295
+ - Each tool returns a string result
296
+
297
+ **Provider Abstraction** (`config/client.ts`)
298
+ - Standardized interface for LLM providers
299
+ - Streaming-first design
300
+ - Support for tool calling
301
+
302
+ **TUI** (`tui/src/`)
303
+ - React components with Ink
304
+ - State management in `store/`
305
+ - Handles user input and displays output
306
+
307
+ ## Getting Help
308
+
309
+ - **Questions**: Open a GitHub Discussion
310
+ - **Bugs**: Open a GitHub Issue
311
+ - **Security**: Email security@woopcode.dev (if applicable)
312
+ - **Chat**: Join our Discord (if available)
313
+
314
+ ## Code of Conduct
315
+
316
+ Be respectful and constructive. We're all here to build something useful.
317
+
318
+ - Be patient with newcomers
319
+ - Assume good intent
320
+ - Give constructive feedback
321
+ - Credit others for their work
322
+
323
+ ## License
324
+
325
+ By contributing, you agree that your contributions will be licensed under the MIT License.
326
+
327
+ ---
328
+
329
+ Thank you for contributing to Woopcode! 🚀
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Manas Raghuwanshi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.