berget 2.2.6 → 2.2.8
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/.github/workflows/publish.yml +2 -2
- package/.github/workflows/test.yml +10 -4
- package/.husky/pre-commit +1 -0
- package/.prettierignore +15 -0
- package/.prettierrc +7 -3
- package/CONTRIBUTING.md +38 -0
- package/README.md +2 -148
- package/dist/index.js +10 -11
- package/dist/package.json +30 -2
- package/dist/src/agents/app.js +28 -0
- package/dist/src/agents/backend.js +25 -0
- package/dist/src/agents/devops.js +34 -0
- package/dist/src/agents/frontend.js +25 -0
- package/dist/src/agents/fullstack.js +25 -0
- package/dist/src/agents/index.js +61 -0
- package/dist/src/agents/quality.js +70 -0
- package/dist/src/agents/security.js +26 -0
- package/dist/src/agents/types.js +2 -0
- package/dist/src/client.js +97 -117
- package/dist/src/commands/api-keys.js +75 -90
- package/dist/src/commands/auth.js +7 -16
- package/dist/src/commands/autocomplete.js +1 -1
- package/dist/src/commands/billing.js +6 -17
- package/dist/src/commands/chat.js +68 -101
- package/dist/src/commands/clusters.js +9 -18
- package/dist/src/commands/code/__tests__/auth-sync.test.js +351 -0
- package/dist/src/commands/code/__tests__/fake-api-key-service.js +13 -0
- package/dist/src/commands/code/__tests__/fake-auth-service.js +47 -0
- package/dist/src/commands/code/__tests__/fake-command-runner.js +21 -34
- package/dist/src/commands/code/__tests__/fake-file-store.js +20 -33
- package/dist/src/commands/code/__tests__/fake-prompter.js +83 -57
- package/dist/src/commands/code/__tests__/setup-flow.test.js +359 -92
- package/dist/src/commands/code/adapters/clack-prompter.js +15 -22
- package/dist/src/commands/code/adapters/fs-file-store.js +26 -40
- package/dist/src/commands/code/adapters/spawn-command-runner.js +27 -37
- package/dist/src/commands/code/auth-sync.js +270 -0
- package/dist/src/commands/code/errors.js +12 -9
- package/dist/src/commands/code/ports/auth-services.js +2 -0
- package/dist/src/commands/code/setup.js +387 -281
- package/dist/src/commands/code.js +205 -332
- package/dist/src/commands/index.js +5 -5
- package/dist/src/commands/models.js +6 -17
- package/dist/src/commands/users.js +5 -16
- package/dist/src/constants/command-structure.js +104 -104
- package/dist/src/services/api-key-service.js +132 -157
- package/dist/src/services/auth-service.js +89 -342
- package/dist/src/services/browser-auth.js +268 -0
- package/dist/src/services/chat-service.js +371 -401
- package/dist/src/services/cluster-service.js +47 -62
- package/dist/src/services/collaborator-service.js +10 -25
- package/dist/src/services/flux-service.js +14 -29
- package/dist/src/services/helm-service.js +10 -25
- package/dist/src/services/kubectl-service.js +16 -33
- package/dist/src/utils/config-checker.js +3 -3
- package/dist/src/utils/config-loader.js +95 -95
- package/dist/src/utils/default-api-key.js +124 -134
- package/dist/src/utils/env-manager.js +55 -66
- package/dist/src/utils/error-handler.js +20 -21
- package/dist/src/utils/logger.js +72 -65
- package/dist/src/utils/markdown-renderer.js +27 -27
- package/dist/src/utils/opencode-validator.js +63 -68
- package/dist/src/utils/token-manager.js +74 -45
- package/dist/tests/commands/chat.test.js +16 -25
- package/dist/tests/commands/code.test.js +95 -104
- package/dist/tests/utils/config-loader.test.js +48 -48
- package/dist/tests/utils/env-manager.test.js +43 -52
- package/dist/tests/utils/opencode-validator.test.js +22 -21
- package/dist/vitest.config.js +1 -1
- package/eslint.config.mjs +67 -0
- package/index.ts +35 -42
- package/package.json +30 -2
- package/src/agents/app.ts +27 -0
- package/src/agents/backend.ts +24 -0
- package/src/agents/devops.ts +33 -0
- package/src/agents/frontend.ts +24 -0
- package/src/agents/fullstack.ts +24 -0
- package/src/agents/index.ts +73 -0
- package/src/agents/quality.ts +69 -0
- package/src/agents/security.ts +26 -0
- package/src/agents/types.ts +17 -0
- package/src/client.ts +118 -152
- package/src/commands/api-keys.ts +241 -333
- package/src/commands/auth.ts +22 -27
- package/src/commands/autocomplete.ts +9 -9
- package/src/commands/billing.ts +20 -24
- package/src/commands/chat.ts +248 -338
- package/src/commands/clusters.ts +27 -26
- package/src/commands/code/__tests__/auth-sync.test.ts +482 -0
- package/src/commands/code/__tests__/fake-api-key-service.ts +13 -0
- package/src/commands/code/__tests__/fake-auth-service.ts +50 -0
- package/src/commands/code/__tests__/fake-command-runner.ts +45 -42
- package/src/commands/code/__tests__/fake-file-store.ts +32 -23
- package/src/commands/code/__tests__/fake-prompter.ts +116 -77
- package/src/commands/code/__tests__/setup-flow.test.ts +624 -268
- package/src/commands/code/adapters/clack-prompter.ts +53 -39
- package/src/commands/code/adapters/fs-file-store.ts +32 -27
- package/src/commands/code/adapters/spawn-command-runner.ts +38 -29
- package/src/commands/code/auth-sync.ts +329 -0
- package/src/commands/code/errors.ts +18 -18
- package/src/commands/code/ports/auth-services.ts +14 -0
- package/src/commands/code/ports/command-runner.ts +8 -4
- package/src/commands/code/ports/file-store.ts +5 -4
- package/src/commands/code/ports/prompter.ts +24 -18
- package/src/commands/code/setup.ts +570 -340
- package/src/commands/code.ts +338 -539
- package/src/commands/index.ts +20 -19
- package/src/commands/models.ts +28 -32
- package/src/commands/users.ts +15 -21
- package/src/constants/command-structure.ts +134 -157
- package/src/services/api-key-service.ts +105 -122
- package/src/services/auth-service.ts +99 -345
- package/src/services/browser-auth.ts +296 -0
- package/src/services/chat-service.ts +265 -299
- package/src/services/cluster-service.ts +42 -45
- package/src/services/collaborator-service.ts +14 -19
- package/src/services/flux-service.ts +23 -25
- package/src/services/helm-service.ts +19 -21
- package/src/services/kubectl-service.ts +17 -19
- package/src/types/api.d.ts +1905 -1907
- package/src/types/json.d.ts +2 -2
- package/src/utils/config-checker.ts +10 -10
- package/src/utils/config-loader.ts +162 -178
- package/src/utils/default-api-key.ts +114 -125
- package/src/utils/env-manager.ts +53 -57
- package/src/utils/error-handler.ts +61 -56
- package/src/utils/logger.ts +79 -73
- package/src/utils/markdown-renderer.ts +31 -31
- package/src/utils/opencode-validator.ts +85 -89
- package/src/utils/token-manager.ts +108 -87
- package/templates/agents/app.md +1 -0
- package/templates/agents/backend.md +1 -0
- package/templates/agents/devops.md +2 -0
- package/templates/agents/frontend.md +1 -0
- package/templates/agents/fullstack.md +1 -0
- package/templates/agents/quality.md +45 -40
- package/templates/agents/security.md +1 -0
- package/tests/commands/chat.test.ts +53 -62
- package/tests/commands/code.test.ts +265 -310
- package/tests/utils/config-loader.test.ts +189 -188
- package/tests/utils/env-manager.test.ts +110 -113
- package/tests/utils/opencode-validator.test.ts +52 -56
- package/tsconfig.json +4 -3
- package/vitest.config.ts +3 -3
- package/AGENTS.md +0 -374
- package/TODO.md +0 -19
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
- name: Setup Node.js
|
|
23
23
|
uses: actions/setup-node@v4
|
|
24
24
|
with:
|
|
25
|
-
node-version: '
|
|
25
|
+
node-version: '22'
|
|
26
26
|
cache: 'npm'
|
|
27
27
|
|
|
28
28
|
- name: Install dependencies
|
|
@@ -47,7 +47,7 @@ jobs:
|
|
|
47
47
|
- name: Setup Node.js
|
|
48
48
|
uses: actions/setup-node@v4
|
|
49
49
|
with:
|
|
50
|
-
node-version: '
|
|
50
|
+
node-version: '22'
|
|
51
51
|
registry-url: 'https://registry.npmjs.org'
|
|
52
52
|
cache: 'npm'
|
|
53
53
|
|
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
runs-on: [infra-runner-set]
|
|
14
14
|
strategy:
|
|
15
15
|
matrix:
|
|
16
|
-
node-version: [
|
|
16
|
+
node-version: [22]
|
|
17
17
|
|
|
18
18
|
steps:
|
|
19
19
|
- name: Checkout code
|
|
@@ -28,11 +28,17 @@ jobs:
|
|
|
28
28
|
- name: Install dependencies
|
|
29
29
|
run: npm ci
|
|
30
30
|
|
|
31
|
+
- name: Check TypeScript
|
|
32
|
+
run: npm run typecheck
|
|
33
|
+
|
|
34
|
+
- name: Run ESLint
|
|
35
|
+
run: npm run lint
|
|
36
|
+
|
|
37
|
+
- name: Check formatting with Prettier
|
|
38
|
+
run: npm run format:check
|
|
39
|
+
|
|
31
40
|
- name: Run tests
|
|
32
41
|
run: npm run test:run
|
|
33
42
|
|
|
34
43
|
- name: Build project
|
|
35
44
|
run: npm run build
|
|
36
|
-
|
|
37
|
-
- name: Check TypeScript
|
|
38
|
-
run: npx tsc --noEmit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/.prettierignore
ADDED
package/.prettierrc
CHANGED
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contributing to Berget CLI
|
|
2
|
+
|
|
3
|
+
Berget CLI is open source. Contributions are welcome!
|
|
4
|
+
|
|
5
|
+
- GitHub: [berget-ai/cli](https://github.com/berget-ai/cli)
|
|
6
|
+
- Issues: [Report bugs](https://github.com/berget-ai/cli/issues)
|
|
7
|
+
- Documentation: [docs.berget.ai](https://docs.berget.ai)
|
|
8
|
+
|
|
9
|
+
## Development Setup
|
|
10
|
+
|
|
11
|
+
Clone the repository and install dependencies:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/berget-ai/cli.git
|
|
15
|
+
cd cli
|
|
16
|
+
npm install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Testing Locally
|
|
20
|
+
|
|
21
|
+
Use the `start` script to test the CLI locally with the `--local` flag:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm start -- <command> [options]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For example:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Test login
|
|
31
|
+
npm start -- auth login
|
|
32
|
+
|
|
33
|
+
# Test whoami
|
|
34
|
+
npm start -- auth whoami
|
|
35
|
+
|
|
36
|
+
# Test with debug output
|
|
37
|
+
npm start -- auth whoami --debug
|
|
38
|
+
```
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Berget CLI
|
|
2
2
|
|
|
3
|
-
A command-line tool for interacting with Berget AI
|
|
3
|
+
A command-line tool for interacting with [Berget AI](https://berget.ai).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -43,98 +43,6 @@ npx berget chat run openai/gpt-oss "Explain what Docker is"
|
|
|
43
43
|
echo "What is Kubernetes?" | npx berget chat run openai/gpt-oss
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
### Practical Use Cases
|
|
47
|
-
|
|
48
|
-
#### 1. Git Commit Messages
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Generate commit message from git diff
|
|
52
|
-
git diff | npx berget chat run openai/gpt-oss "Create a conventional commit message for this diff. Reply with only the message:"
|
|
53
|
-
|
|
54
|
-
# Use as alias
|
|
55
|
-
alias gitcommit='git diff | npx berget chat run openai/gpt-oss "Generate a conventional commit message for this diff. Reply with only the commit message, nothing else:"'
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
#### 2. Code Review and Explanations
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# Explain code
|
|
62
|
-
cat src/main.js | npx berget chat run openai/gpt-oss "Explain what this code does:"
|
|
63
|
-
|
|
64
|
-
# Find bugs
|
|
65
|
-
cat problematic-file.py | npx berget chat run openai/gpt-oss "Analyze this code and find potential bugs:"
|
|
66
|
-
|
|
67
|
-
# Improvement suggestions
|
|
68
|
-
git diff | npx berget chat run openai/gpt-oss "Give suggestions for improvements to this code change:"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
#### 3. Documentation
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
# Generate README
|
|
75
|
-
ls -la | npx berget chat run openai/gpt-oss "Create a README.md for this project based on the file structure:"
|
|
76
|
-
|
|
77
|
-
# Comment code
|
|
78
|
-
cat uncommented-code.js | npx berget chat run openai/gpt-oss "Add JSDoc comments to this code:"
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
#### 4. System Administration
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
# Analyze logs
|
|
85
|
-
tail -n 100 /var/log/nginx/error.log | npx berget chat run openai/gpt-oss "Analyze these error logs and suggest solutions:"
|
|
86
|
-
|
|
87
|
-
# Explain commands
|
|
88
|
-
npx berget chat run openai/gpt-oss "Explain what this bash command does: find . -name '*.js' -exec grep -l 'TODO' {} \;"
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Useful Bash/Zsh Aliases
|
|
92
|
-
|
|
93
|
-
Add these to your `~/.bashrc`, `~/.zshrc` or similar:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
# Git-related aliases
|
|
97
|
-
alias gai='git diff | npx berget chat run openai/gpt-oss "Generate a conventional commit message for this diff. Reply with only the commit message, nothing else:"'
|
|
98
|
-
alias gexplain='git log --oneline -10 | npx berget chat run openai/gpt-oss "Explain what these commits do:"'
|
|
99
|
-
alias gsec='~/bin/security-check'
|
|
100
|
-
|
|
101
|
-
# Code-related aliases
|
|
102
|
-
alias explain='npx berget chat run openai/gpt-oss "Explain this code:"'
|
|
103
|
-
alias review='npx berget chat run openai/gpt-oss "Review this code and give improvement suggestions:"'
|
|
104
|
-
alias debug='npx berget chat run openai/gpt-oss "Find and explain potential bugs in this code:"'
|
|
105
|
-
|
|
106
|
-
# Documentation aliases
|
|
107
|
-
alias docgen='npx berget chat run openai/gpt-oss "Generate documentation for this code:"'
|
|
108
|
-
alias readme='ls -la | npx berget chat run openai/gpt-oss "Create a README.md for this project:"'
|
|
109
|
-
|
|
110
|
-
# System aliases
|
|
111
|
-
alias loganalyze='npx berget chat run openai/gpt-oss "Analyze these logs and suggest solutions:"'
|
|
112
|
-
alias cmdexplain='npx berget chat run openai/gpt-oss "Explain this command:"'
|
|
113
|
-
|
|
114
|
-
# Quick AI assistant
|
|
115
|
-
alias ai='npx berget chat run openai/gpt-oss'
|
|
116
|
-
alias ask='npx berget chat run openai/gpt-oss'
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Advanced Examples
|
|
120
|
-
|
|
121
|
-
See the `examples/` folder for complete scripts:
|
|
122
|
-
|
|
123
|
-
- **smart-commit.sh** - Automatic generation of conventional commit messages
|
|
124
|
-
- **ai-review.sh** - AI-driven code review
|
|
125
|
-
- **security-check.sh** - Security review of commits
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
# Copy example scripts
|
|
129
|
-
cp examples/*.sh ~/bin/
|
|
130
|
-
chmod +x ~/bin/*.sh
|
|
131
|
-
|
|
132
|
-
# Use them
|
|
133
|
-
~/bin/smart-commit.sh
|
|
134
|
-
~/bin/ai-review.sh src/main.js
|
|
135
|
-
~/bin/security-check.sh
|
|
136
|
-
```
|
|
137
|
-
|
|
138
46
|
## Environment Variables
|
|
139
47
|
|
|
140
48
|
```bash
|
|
@@ -148,25 +56,8 @@ export LOG_LEVEL=debug
|
|
|
148
56
|
export API_BASE_URL=https://your-custom-api.example.com
|
|
149
57
|
```
|
|
150
58
|
|
|
151
|
-
## Tips and Tricks
|
|
152
|
-
|
|
153
|
-
1. **Use pipes**: Combine with other Unix tools for powerful workflows
|
|
154
|
-
2. **Short prompts**: Be specific but concise in your prompts for best results
|
|
155
|
-
3. **Streaming**: Streaming is enabled by default for faster responses
|
|
156
|
-
4. **Model selection**: Experiment with different models for different tasks
|
|
157
|
-
5. **Aliases**: Create aliases for common use cases to save time
|
|
158
|
-
|
|
159
59
|
## Command Reference
|
|
160
60
|
|
|
161
|
-
- `auth login` - Login to Berget
|
|
162
|
-
- `auth logout` - Logout from Berget
|
|
163
|
-
- `auth whoami` - Show current user information
|
|
164
|
-
- `api-keys list` - List API keys
|
|
165
|
-
- `api-keys create` - Create a new API key
|
|
166
|
-
- `models list` - List available AI models
|
|
167
|
-
- `chat run` - Start a chat session with an AI model
|
|
168
|
-
- `chat list` - List available chat models
|
|
169
|
-
|
|
170
61
|
For a complete list of commands, run:
|
|
171
62
|
|
|
172
63
|
```bash
|
|
@@ -189,43 +80,6 @@ npx berget chat list
|
|
|
189
80
|
npx berget api-keys list
|
|
190
81
|
```
|
|
191
82
|
|
|
192
|
-
## Development
|
|
193
|
-
|
|
194
|
-
### Setup
|
|
195
|
-
|
|
196
|
-
Clone the repository and install dependencies:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
git clone https://github.com/berget-ai/cli.git
|
|
200
|
-
cd cli
|
|
201
|
-
npm install
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Test Locally
|
|
205
|
-
|
|
206
|
-
Use the `start` script to test the CLI locally with the `--local` flag:
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
npm start -- <command> [options]
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
For example:
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
# Test login
|
|
216
|
-
npm start -- auth login
|
|
217
|
-
|
|
218
|
-
# Test whoami
|
|
219
|
-
npm start -- auth whoami
|
|
220
|
-
|
|
221
|
-
# Test with debug output
|
|
222
|
-
npm start -- auth whoami --debug
|
|
223
|
-
```
|
|
224
|
-
|
|
225
83
|
## Contributing
|
|
226
84
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
- GitHub: [berget-ai/cli](https://github.com/berget-ai/cli)
|
|
230
|
-
- Issues: [Report bugs](https://github.com/berget-ai/cli/issues)
|
|
231
|
-
- Documentation: [docs.berget.ai](https://docs.berget.ai)
|
|
85
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development instructions.
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
4
|
};
|
|
6
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
|
+
const package_json_1 = require("./package.json");
|
|
8
9
|
const commands_1 = require("./src/commands");
|
|
9
10
|
const config_checker_1 = require("./src/utils/config-checker");
|
|
10
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const package_json_1 = require("./package.json");
|
|
12
11
|
process.env.DOTENV_CONFIG_OVERRIDE = 'true';
|
|
13
12
|
require("dotenv/config");
|
|
14
13
|
// Set version and description
|
|
@@ -38,15 +37,15 @@ if (process.argv.length <= 2) {
|
|
|
38
37
|
}
|
|
39
38
|
// Add helpful suggestions for common command mistakes
|
|
40
39
|
const commonMistakes = {
|
|
41
|
-
login: 'auth login',
|
|
42
|
-
logout: 'auth logout',
|
|
43
|
-
whoami: 'auth whoami',
|
|
44
|
-
'list-models': 'models list',
|
|
45
|
-
'list-keys': 'api-keys list',
|
|
46
40
|
'create-key': 'api-keys create',
|
|
41
|
+
init: 'code init',
|
|
47
42
|
'list-clusters': 'clusters list',
|
|
43
|
+
'list-keys': 'api-keys list',
|
|
44
|
+
'list-models': 'models list',
|
|
45
|
+
login: 'auth login',
|
|
46
|
+
logout: 'auth logout',
|
|
48
47
|
usage: 'billing usage',
|
|
49
|
-
|
|
48
|
+
whoami: 'auth whoami',
|
|
50
49
|
};
|
|
51
50
|
// Add error handler for unknown commands
|
|
52
51
|
commander_1.program.on('command:*', (operands) => {
|
|
@@ -62,9 +61,9 @@ commander_1.program.on('command:*', (operands) => {
|
|
|
62
61
|
const similarCommands = availableCommands.filter((cmd) => cmd.includes(unknownCommand) || unknownCommand.includes(cmd));
|
|
63
62
|
if (similarCommands.length > 0) {
|
|
64
63
|
console.log(chalk_1.default.yellow('Similar commands:'));
|
|
65
|
-
|
|
64
|
+
for (const cmd of similarCommands) {
|
|
66
65
|
console.log(chalk_1.default.yellow(` ${chalk_1.default.bold(`berget ${cmd}`)}`));
|
|
67
|
-
}
|
|
66
|
+
}
|
|
68
67
|
}
|
|
69
68
|
console.log(chalk_1.default.blue('\nRun `berget --help` for a list of available commands.'));
|
|
70
69
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "berget",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"berget": "dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"private": false,
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20.0.0"
|
|
11
|
+
},
|
|
9
12
|
"publishConfig": {
|
|
10
13
|
"access": "public"
|
|
11
14
|
},
|
|
@@ -17,8 +20,14 @@
|
|
|
17
20
|
"build": "tsc",
|
|
18
21
|
"test": "vitest",
|
|
19
22
|
"test:run": "vitest run",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"lint": "eslint . --ext .ts,.tsx,.js",
|
|
25
|
+
"lint:fix": "eslint . --ext .ts,.tsx,.js --fix",
|
|
26
|
+
"format": "prettier --write .",
|
|
27
|
+
"format:check": "prettier --check .",
|
|
20
28
|
"prepublishOnly": "npm run build",
|
|
21
|
-
"generate-types": "openapi-typescript https://api.berget.ai/openapi.json -o src/types/api.d.ts"
|
|
29
|
+
"generate-types": "openapi-typescript https://api.berget.ai/openapi.json -o src/types/api.d.ts",
|
|
30
|
+
"prepare": "husky"
|
|
22
31
|
},
|
|
23
32
|
"author": "Berget AI AB",
|
|
24
33
|
"license": "MIT",
|
|
@@ -28,8 +37,18 @@
|
|
|
28
37
|
"@types/marked": "^5.0.2",
|
|
29
38
|
"@types/marked-terminal": "^6.1.1",
|
|
30
39
|
"@types/node": "^20.11.20",
|
|
40
|
+
"@vitest/eslint-plugin": "^1.6.17",
|
|
41
|
+
"eslint": "^10.3.0",
|
|
42
|
+
"eslint-config-prettier": "^10.1.8",
|
|
43
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
44
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
45
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
46
|
+
"husky": "^9.1.7",
|
|
47
|
+
"lint-staged": "^17.0.4",
|
|
48
|
+
"prettier": "^3.8.3",
|
|
31
49
|
"tsx": "^4.19.3",
|
|
32
50
|
"typescript": "^5.3.3",
|
|
51
|
+
"typescript-eslint": "^8.59.3",
|
|
33
52
|
"vitest": "^1.0.0"
|
|
34
53
|
},
|
|
35
54
|
"dependencies": {
|
|
@@ -48,5 +67,14 @@
|
|
|
48
67
|
"openapi-typescript": "^6.7.4",
|
|
49
68
|
"readline": "^1.3.0",
|
|
50
69
|
"zod": "^4.1.12"
|
|
70
|
+
},
|
|
71
|
+
"lint-staged": {
|
|
72
|
+
"*.{ts,tsx}": [
|
|
73
|
+
"eslint --fix",
|
|
74
|
+
"prettier --write"
|
|
75
|
+
],
|
|
76
|
+
"*.{json,yml,yaml,md}": [
|
|
77
|
+
"prettier --write"
|
|
78
|
+
]
|
|
51
79
|
}
|
|
52
80
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agent = void 0;
|
|
4
|
+
exports.agent = {
|
|
5
|
+
config: {
|
|
6
|
+
description: 'Expo + React Native apps; props-first, offline-aware, shared tokens.',
|
|
7
|
+
mode: 'primary',
|
|
8
|
+
name: 'app',
|
|
9
|
+
permission: {
|
|
10
|
+
bash: 'deny',
|
|
11
|
+
edit: 'allow',
|
|
12
|
+
webfetch: 'allow',
|
|
13
|
+
},
|
|
14
|
+
temperature: 0.4,
|
|
15
|
+
top_p: 0.9,
|
|
16
|
+
},
|
|
17
|
+
systemPrompt: `You are Berget Code App agent. Voice: Scandinavian calm—precise, concise, confident. Expo + React Native + TypeScript. Structure by components/hooks/services/navigation. Components are pure; data via props; refactor shared logic into hooks/stores. Share tokens with frontend. Mock data in /data via typed hooks; later replace with live APIs. Offline via SQLite/MMKV; notifications via Expo. Request permissions only when needed. Subtle, meaningful motion; light/dark parity.
|
|
18
|
+
|
|
19
|
+
GIT WORKFLOW RULES (CRITICAL):
|
|
20
|
+
- NEVER push directly to main branch - ALWAYS use pull requests
|
|
21
|
+
- NEVER use 'git add .' - ALWAYS add specific files with 'git add path/to/file'
|
|
22
|
+
- ALWAYS clean up test files, documentation files, and temporary artifacts before committing
|
|
23
|
+
- ALWAYS ensure git history maintains production quality - no test commits, no debugging code
|
|
24
|
+
- ALWAYS create descriptive commit messages following project conventions
|
|
25
|
+
- ALWAYS run tests and build before creating PR
|
|
26
|
+
|
|
27
|
+
CRITICAL: When all app implementation tasks are complete and ready for merge, ALWAYS invoke @quality subagent to handle testing, building, and complete PR management including URL provision.`,
|
|
28
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agent = void 0;
|
|
4
|
+
exports.agent = {
|
|
5
|
+
config: {
|
|
6
|
+
description: 'Functional, modular Koa + TypeScript services',
|
|
7
|
+
mode: 'primary',
|
|
8
|
+
name: 'backend',
|
|
9
|
+
},
|
|
10
|
+
systemPrompt: `# Backend Agent
|
|
11
|
+
|
|
12
|
+
Functional, modular Koa + TypeScript services with schema-first approach and code quality focus.
|
|
13
|
+
|
|
14
|
+
**Use when:**
|
|
15
|
+
|
|
16
|
+
- Working with Koa routers and services
|
|
17
|
+
- Backend development in /services
|
|
18
|
+
- API development and database work
|
|
19
|
+
|
|
20
|
+
**Key features:**
|
|
21
|
+
|
|
22
|
+
- Zod validation and OpenAPI generation
|
|
23
|
+
- Code quality and refactoring principles
|
|
24
|
+
- PR workflow integration`,
|
|
25
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agent = void 0;
|
|
4
|
+
exports.agent = {
|
|
5
|
+
config: {
|
|
6
|
+
description: 'Declarative GitOps infra with FluxCD, Kustomize, Helm, operators.',
|
|
7
|
+
mode: 'primary',
|
|
8
|
+
name: 'devops',
|
|
9
|
+
permission: {
|
|
10
|
+
bash: 'allow',
|
|
11
|
+
edit: 'allow',
|
|
12
|
+
webfetch: 'allow',
|
|
13
|
+
},
|
|
14
|
+
temperature: 0.3,
|
|
15
|
+
top_p: 0.8,
|
|
16
|
+
},
|
|
17
|
+
systemPrompt: `You are Berget Code DevOps agent. Voice: Scandinavian calm—precise, concise, confident. Start simple: k8s/{deployment,service,ingress}. Add FluxCD sync to repo and image automation. Use Kustomize bases/overlays (staging, production). Add dependencies via Helm from upstream sources; prefer native operators when available (CloudNativePG, cert-manager, external-dns). SemVer with -rc tags keeps CI environments current. Observability with Prometheus/Grafana. No manual kubectl in production—Git is the source of truth.
|
|
18
|
+
|
|
19
|
+
GIT WORKFLOW RULES (CRITICAL):
|
|
20
|
+
- NEVER push directly to main branch - ALWAYS use pull requests
|
|
21
|
+
- NEVER use 'git add .' - ALWAYS add specific files with 'git add path/to/file'
|
|
22
|
+
- ALWAYS clean up test files, documentation files, and temporary artifacts before committing
|
|
23
|
+
- ALWAYS ensure git history maintains production quality - no test commits, no debugging code
|
|
24
|
+
- ALWAYS create descriptive commit messages following project conventions
|
|
25
|
+
- ALWAYS run tests and build before creating PR
|
|
26
|
+
|
|
27
|
+
Helm Values Configuration Process:
|
|
28
|
+
1. Documentation First Approach: Always fetch official documentation from Artifact Hub/GitHub for the specific chart version before writing values. Search Artifact Hub for exact chart version documentation, check the chart's GitHub repository for official docs and examples, verify the exact version being used in the deployment.
|
|
29
|
+
2. Validation Requirements: Check for available validation schemas before committing YAML files. Use Helm's built-in validation tools (helm lint, helm template). Validate against JSON schema if available for the chart. Ensure YAML syntax correctness with linters.
|
|
30
|
+
3. Standard Workflow: Identify chart name and exact version. Fetch official documentation from Artifact Hub/GitHub. Check for available schemas and validation tools. Write values according to official documentation. Validate against schema (if available). Test with helm template or helm lint. Commit validated YAML files.
|
|
31
|
+
4. Quality Assurance: Never commit unvalidated Helm values. Use helm dependency update when adding new charts. Test rendering with helm template --dry-run before deployment. Document any custom values with comments referencing official docs.
|
|
32
|
+
|
|
33
|
+
CRITICAL: When all devops implementation tasks are complete and ready for merge, ALWAYS invoke @quality subagent to handle testing, building, and complete PR management including URL provision.`,
|
|
34
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agent = void 0;
|
|
4
|
+
exports.agent = {
|
|
5
|
+
config: {
|
|
6
|
+
description: 'Scandinavian, type-safe UIs with React, Tailwind, and Shadcn',
|
|
7
|
+
mode: 'primary',
|
|
8
|
+
name: 'frontend',
|
|
9
|
+
},
|
|
10
|
+
systemPrompt: `# Frontend Agent
|
|
11
|
+
|
|
12
|
+
Builds Scandinavian, type-safe UIs with React, Tailwind, and Shadcn.
|
|
13
|
+
|
|
14
|
+
**Use when:**
|
|
15
|
+
|
|
16
|
+
- Working with React components (.tsx files)
|
|
17
|
+
- Frontend development in /apps/frontend
|
|
18
|
+
- UI/UX implementation
|
|
19
|
+
|
|
20
|
+
**Key features:**
|
|
21
|
+
|
|
22
|
+
- Design system integration
|
|
23
|
+
- Semantic tokens and accessibility
|
|
24
|
+
- Props-first component architecture`,
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agent = void 0;
|
|
4
|
+
exports.agent = {
|
|
5
|
+
config: {
|
|
6
|
+
description: 'Router/coordinator agent for full-stack development',
|
|
7
|
+
mode: 'primary',
|
|
8
|
+
name: 'fullstack',
|
|
9
|
+
},
|
|
10
|
+
systemPrompt: `# Fullstack Agent
|
|
11
|
+
|
|
12
|
+
Router/coordinator agent for full-stack development with schema-driven architecture. Handles routing between different personas based on file paths and task requirements.
|
|
13
|
+
|
|
14
|
+
**Use when:**
|
|
15
|
+
|
|
16
|
+
- Working across multiple parts of a monorepo
|
|
17
|
+
- Need to coordinate between frontend, backend, devops, and app
|
|
18
|
+
- Starting new projects and need to determine tech stack
|
|
19
|
+
|
|
20
|
+
**Key features:**
|
|
21
|
+
|
|
22
|
+
- Schema-driven development (database → OpenAPI → types)
|
|
23
|
+
- Automatic routing to appropriate persona
|
|
24
|
+
- Tech stack discovery and recommendations`,
|
|
25
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toPiPrompt = exports.toMarkdown = exports.toAgentTemplate = exports.getAllAgents = exports.getAgent = exports.agents = void 0;
|
|
4
|
+
const app_js_1 = require("./app.js");
|
|
5
|
+
const backend_js_1 = require("./backend.js");
|
|
6
|
+
const devops_js_1 = require("./devops.js");
|
|
7
|
+
const frontend_js_1 = require("./frontend.js");
|
|
8
|
+
const fullstack_js_1 = require("./fullstack.js");
|
|
9
|
+
const quality_js_1 = require("./quality.js");
|
|
10
|
+
const security_js_1 = require("./security.js");
|
|
11
|
+
const agents = {
|
|
12
|
+
app: app_js_1.agent,
|
|
13
|
+
backend: backend_js_1.agent,
|
|
14
|
+
devops: devops_js_1.agent,
|
|
15
|
+
frontend: frontend_js_1.agent,
|
|
16
|
+
fullstack: fullstack_js_1.agent,
|
|
17
|
+
quality: quality_js_1.agent,
|
|
18
|
+
security: security_js_1.agent,
|
|
19
|
+
};
|
|
20
|
+
exports.agents = agents;
|
|
21
|
+
function getAgent(name) {
|
|
22
|
+
return agents[name];
|
|
23
|
+
}
|
|
24
|
+
exports.getAgent = getAgent;
|
|
25
|
+
function getAllAgents() {
|
|
26
|
+
return Object.values(agents);
|
|
27
|
+
}
|
|
28
|
+
exports.getAllAgents = getAllAgents;
|
|
29
|
+
function toAgentTemplate(agent) {
|
|
30
|
+
return {
|
|
31
|
+
content: agent.systemPrompt,
|
|
32
|
+
description: agent.config.description,
|
|
33
|
+
name: agent.config.name,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.toAgentTemplate = toAgentTemplate;
|
|
37
|
+
function toMarkdown(agent) {
|
|
38
|
+
const { config, systemPrompt } = agent;
|
|
39
|
+
let frontmatter = `---\nname: ${config.name}\ndescription: ${config.description}\n`;
|
|
40
|
+
if (config.mode) {
|
|
41
|
+
frontmatter += `mode: ${config.mode}\n`;
|
|
42
|
+
}
|
|
43
|
+
if (config.temperature) {
|
|
44
|
+
frontmatter += `temperature: ${config.temperature}\n`;
|
|
45
|
+
}
|
|
46
|
+
if (config.top_p) {
|
|
47
|
+
frontmatter += `top_p: ${config.top_p}\n`;
|
|
48
|
+
}
|
|
49
|
+
if (config.permission) {
|
|
50
|
+
frontmatter += `permission:\n`;
|
|
51
|
+
for (const [key, value] of Object.entries(config.permission)) {
|
|
52
|
+
frontmatter += ` ${key}: ${value}\n`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return `${frontmatter}---\n\n${systemPrompt}`;
|
|
56
|
+
}
|
|
57
|
+
exports.toMarkdown = toMarkdown;
|
|
58
|
+
function toPiPrompt(agent) {
|
|
59
|
+
return agent.systemPrompt;
|
|
60
|
+
}
|
|
61
|
+
exports.toPiPrompt = toPiPrompt;
|