|
| 1 | +# Contributing to HackCode |
| 2 | + |
| 3 | +Thanks for wanting to contribute to HackCode. Whether it's a bug fix, new feature, or documentation improvement — all contributions are welcome. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### 1. Fork & Clone |
| 8 | + |
| 9 | +```bash |
| 10 | +git clone https://github.com/<your-username>/hackcode.git ~/hackcode |
| 11 | +cd ~/hackcode |
| 12 | +bun install |
| 13 | +``` |
| 14 | + |
| 15 | +### 2. Run locally |
| 16 | + |
| 17 | +```bash |
| 18 | +bun run dev |
| 19 | +``` |
| 20 | + |
| 21 | +This starts HackCode directly from source. You need [Ollama](https://ollama.ai) running with at least one model pulled. |
| 22 | + |
| 23 | +### 3. Project structure |
| 24 | + |
| 25 | +``` |
| 26 | +src/ |
| 27 | +├── index.ts # Main REPL loop, AI streaming, commands, config |
| 28 | +├── prompt.ts # System prompt and ASCII banner |
| 29 | +├── tools.ts # Built-in AI tools (bash, read, write, edit, grep, list) |
| 30 | +├── setup.ts # First-run wizard (hardware detection, model pull, tool install) |
| 31 | +└── scanner.ts # Security tool availability scanner |
| 32 | +``` |
| 33 | + |
| 34 | +The entire app is 5 TypeScript files with 4 dependencies. Keep it that way. |
| 35 | + |
| 36 | +## Guidelines |
| 37 | + |
| 38 | +### Keep it simple |
| 39 | + |
| 40 | +HackCode was rewritten from scratch to escape dependency hell (the previous version had 4,627 packages). We're not going back. Before adding a dependency, ask yourself if you really need it. |
| 41 | + |
| 42 | +- **4 production dependencies** — `ai`, `@ai-sdk/openai-compatible`, `@ai-sdk/openai`, `zod` |
| 43 | +- If your feature needs a new dependency, explain why in the PR |
| 44 | +- Prefer standard library and built-in Node/Bun APIs |
| 45 | + |
| 46 | +### Code style |
| 47 | + |
| 48 | +- TypeScript, no build step — Bun runs `.ts` directly |
| 49 | +- No classes unless genuinely needed — functions are fine |
| 50 | +- No unnecessary abstractions — if it's used once, inline it |
| 51 | +- Keep files focused — one file per concern |
| 52 | + |
| 53 | +### What we're looking for |
| 54 | + |
| 55 | +**High priority:** |
| 56 | +- MCP server integration (connecting the existing Python MCP servers in `mcp-servers/`) |
| 57 | +- New AI tools (e.g., network tools, screenshot analysis) |
| 58 | +- Better error handling and edge cases |
| 59 | +- Improvements to the system prompt for better tool chaining |
| 60 | +- Support for more platforms (Windows/WSL, more Linux distros) |
| 61 | + |
| 62 | +**Always welcome:** |
| 63 | +- Bug fixes |
| 64 | +- Performance improvements |
| 65 | +- Better setup wizard UX |
| 66 | +- New cheatsheets in `cheatsheets/` |
| 67 | +- Documentation improvements |
| 68 | + |
| 69 | +**Please don't:** |
| 70 | +- Add React, Vue, or any UI framework — HackCode is a terminal app |
| 71 | +- Rewrite the REPL to use a TUI library — we tried, it caused more problems than it solved |
| 72 | +- Add cloud API support — HackCode is local-only by design |
| 73 | +- Add telemetry or analytics of any kind |
| 74 | + |
| 75 | +## How to Submit |
| 76 | + |
| 77 | +### Bug reports |
| 78 | + |
| 79 | +Open an issue with: |
| 80 | +- What you expected to happen |
| 81 | +- What actually happened |
| 82 | +- Your OS, RAM, and which model you're using |
| 83 | +- The error message (if any) |
| 84 | + |
| 85 | +### Pull requests |
| 86 | + |
| 87 | +1. Fork the repo |
| 88 | +2. Create a branch (`git checkout -b fix/my-fix`) |
| 89 | +3. Make your changes |
| 90 | +4. Test it locally (`bun run dev`) |
| 91 | +5. Push and open a PR against the `dev` branch |
| 92 | + |
| 93 | +Keep PRs focused — one feature or fix per PR. Write a clear description of what changed and why. |
| 94 | + |
| 95 | +### New AI tools |
| 96 | + |
| 97 | +If you want to add a new tool the AI can use, add it to `src/tools.ts`. Follow the existing pattern: |
| 98 | + |
| 99 | +```typescript |
| 100 | +my_tool: tool({ |
| 101 | + description: "What this tool does — be specific, the AI reads this", |
| 102 | + parameters: z.object({ |
| 103 | + param: z.string().describe("What this parameter is for"), |
| 104 | + }), |
| 105 | + execute: async ({ param }) => { |
| 106 | + // Do the thing |
| 107 | + return "result string that the AI will read" |
| 108 | + }, |
| 109 | +}), |
| 110 | +``` |
| 111 | + |
| 112 | +### New cheatsheets |
| 113 | + |
| 114 | +Add a markdown file to `cheatsheets/` following the naming pattern `SKILL-<topic>.md`. Look at the existing ones for format. |
| 115 | + |
| 116 | +## Running Tests |
| 117 | + |
| 118 | +There are no tests yet. If you want to add a testing setup, that would be a great first contribution. Keep it minimal — `bun test` with no extra dependencies. |
| 119 | + |
| 120 | +## Questions? |
| 121 | + |
| 122 | +Open an issue or start a discussion. No question is too basic. |
| 123 | + |
| 124 | +## License |
| 125 | + |
| 126 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
0 commit comments