berget 2.2.5 → 2.2.7

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 (148) hide show
  1. package/.github/workflows/publish.yml +8 -8
  2. package/.github/workflows/test.yml +12 -6
  3. package/.husky/pre-commit +1 -0
  4. package/.prettierignore +15 -0
  5. package/.prettierrc +5 -3
  6. package/CONTRIBUTING.md +38 -0
  7. package/README.md +2 -148
  8. package/dist/index.js +21 -21
  9. package/dist/package.json +30 -2
  10. package/dist/src/agents/app.js +28 -0
  11. package/dist/src/agents/backend.js +25 -0
  12. package/dist/src/agents/devops.js +34 -0
  13. package/dist/src/agents/frontend.js +25 -0
  14. package/dist/src/agents/fullstack.js +25 -0
  15. package/dist/src/agents/index.js +61 -0
  16. package/dist/src/agents/quality.js +70 -0
  17. package/dist/src/agents/security.js +26 -0
  18. package/dist/src/agents/types.js +2 -0
  19. package/dist/src/client.js +54 -62
  20. package/dist/src/commands/api-keys.js +132 -140
  21. package/dist/src/commands/auth.js +9 -9
  22. package/dist/src/commands/autocomplete.js +9 -9
  23. package/dist/src/commands/billing.js +7 -9
  24. package/dist/src/commands/chat.js +90 -92
  25. package/dist/src/commands/clusters.js +12 -12
  26. package/dist/src/commands/code/__tests__/auth-sync.test.js +348 -0
  27. package/dist/src/commands/code/__tests__/fake-api-key-service.js +23 -0
  28. package/dist/src/commands/code/__tests__/fake-auth-service.js +55 -0
  29. package/dist/src/commands/code/__tests__/fake-command-runner.js +50 -0
  30. package/dist/src/commands/code/__tests__/fake-file-store.js +55 -0
  31. package/dist/src/commands/code/__tests__/fake-prompter.js +133 -0
  32. package/dist/src/commands/code/__tests__/setup-flow.test.js +505 -0
  33. package/dist/src/commands/code/adapters/clack-prompter.js +81 -0
  34. package/dist/src/commands/code/adapters/fs-file-store.js +80 -0
  35. package/dist/src/commands/code/adapters/spawn-command-runner.js +53 -0
  36. package/dist/src/commands/code/auth-sync.js +283 -0
  37. package/dist/src/commands/code/errors.js +27 -0
  38. package/dist/src/commands/code/ports/auth-services.js +2 -0
  39. package/dist/src/commands/code/ports/command-runner.js +2 -0
  40. package/dist/src/commands/code/ports/file-store.js +2 -0
  41. package/dist/src/commands/code/ports/prompter.js +2 -0
  42. package/dist/src/commands/code/setup.js +533 -0
  43. package/dist/src/commands/code.js +223 -779
  44. package/dist/src/commands/models.js +13 -15
  45. package/dist/src/commands/users.js +6 -8
  46. package/dist/src/constants/command-structure.js +116 -114
  47. package/dist/src/services/api-key-service.js +43 -48
  48. package/dist/src/services/auth-service.js +60 -299
  49. package/dist/src/services/browser-auth.js +278 -0
  50. package/dist/src/services/chat-service.js +78 -91
  51. package/dist/src/services/cluster-service.js +6 -6
  52. package/dist/src/services/collaborator-service.js +5 -8
  53. package/dist/src/services/flux-service.js +5 -8
  54. package/dist/src/services/helm-service.js +5 -8
  55. package/dist/src/services/kubectl-service.js +7 -10
  56. package/dist/src/utils/config-checker.js +5 -5
  57. package/dist/src/utils/config-loader.js +25 -25
  58. package/dist/src/utils/default-api-key.js +23 -23
  59. package/dist/src/utils/env-manager.js +7 -7
  60. package/dist/src/utils/error-handler.js +60 -61
  61. package/dist/src/utils/logger.js +7 -7
  62. package/dist/src/utils/markdown-renderer.js +2 -2
  63. package/dist/src/utils/opencode-validator.js +17 -20
  64. package/dist/src/utils/token-manager.js +38 -11
  65. package/dist/tests/commands/chat.test.js +24 -24
  66. package/dist/tests/commands/code.test.js +169 -138
  67. package/dist/tests/utils/config-loader.test.js +114 -114
  68. package/dist/tests/utils/env-manager.test.js +57 -57
  69. package/dist/tests/utils/opencode-validator.test.js +44 -43
  70. package/dist/vitest.config.js +1 -1
  71. package/eslint.config.mjs +47 -0
  72. package/index.ts +42 -48
  73. package/package.json +30 -2
  74. package/src/agents/app.ts +27 -0
  75. package/src/agents/backend.ts +24 -0
  76. package/src/agents/devops.ts +33 -0
  77. package/src/agents/frontend.ts +24 -0
  78. package/src/agents/fullstack.ts +24 -0
  79. package/src/agents/index.ts +71 -0
  80. package/src/agents/quality.ts +69 -0
  81. package/src/agents/security.ts +26 -0
  82. package/src/agents/types.ts +17 -0
  83. package/src/client.ts +125 -167
  84. package/src/commands/api-keys.ts +261 -358
  85. package/src/commands/auth.ts +24 -30
  86. package/src/commands/autocomplete.ts +12 -12
  87. package/src/commands/billing.ts +22 -27
  88. package/src/commands/chat.ts +230 -323
  89. package/src/commands/clusters.ts +33 -33
  90. package/src/commands/code/__tests__/auth-sync.test.ts +481 -0
  91. package/src/commands/code/__tests__/fake-api-key-service.ts +13 -0
  92. package/src/commands/code/__tests__/fake-auth-service.ts +50 -0
  93. package/src/commands/code/__tests__/fake-command-runner.ts +44 -0
  94. package/src/commands/code/__tests__/fake-file-store.ts +44 -0
  95. package/src/commands/code/__tests__/fake-prompter.ts +121 -0
  96. package/src/commands/code/__tests__/setup-flow.test.ts +628 -0
  97. package/src/commands/code/adapters/clack-prompter.ts +55 -0
  98. package/src/commands/code/adapters/fs-file-store.ts +37 -0
  99. package/src/commands/code/adapters/spawn-command-runner.ts +40 -0
  100. package/src/commands/code/auth-sync.ts +329 -0
  101. package/src/commands/code/errors.ts +23 -0
  102. package/src/commands/code/ports/auth-services.ts +14 -0
  103. package/src/commands/code/ports/command-runner.ts +10 -0
  104. package/src/commands/code/ports/file-store.ts +7 -0
  105. package/src/commands/code/ports/prompter.ts +29 -0
  106. package/src/commands/code/setup.ts +630 -0
  107. package/src/commands/code.ts +335 -1074
  108. package/src/commands/index.ts +19 -19
  109. package/src/commands/models.ts +32 -37
  110. package/src/commands/users.ts +15 -22
  111. package/src/constants/command-structure.ts +120 -140
  112. package/src/services/api-key-service.ts +96 -113
  113. package/src/services/auth-service.ts +92 -339
  114. package/src/services/browser-auth.ts +296 -0
  115. package/src/services/chat-service.ts +246 -279
  116. package/src/services/cluster-service.ts +29 -32
  117. package/src/services/collaborator-service.ts +13 -18
  118. package/src/services/flux-service.ts +16 -18
  119. package/src/services/helm-service.ts +16 -18
  120. package/src/services/kubectl-service.ts +12 -14
  121. package/src/types/api.d.ts +924 -926
  122. package/src/types/json.d.ts +3 -3
  123. package/src/utils/config-checker.ts +10 -10
  124. package/src/utils/config-loader.ts +110 -127
  125. package/src/utils/default-api-key.ts +81 -93
  126. package/src/utils/env-manager.ts +36 -40
  127. package/src/utils/error-handler.ts +83 -78
  128. package/src/utils/logger.ts +41 -41
  129. package/src/utils/markdown-renderer.ts +11 -11
  130. package/src/utils/opencode-validator.ts +51 -56
  131. package/src/utils/token-manager.ts +84 -64
  132. package/templates/agents/app.md +23 -0
  133. package/templates/agents/backend.md +23 -0
  134. package/templates/agents/devops.md +30 -0
  135. package/templates/agents/frontend.md +25 -0
  136. package/templates/agents/fullstack.md +23 -0
  137. package/templates/agents/quality.md +69 -0
  138. package/templates/agents/security.md +21 -0
  139. package/tests/commands/chat.test.ts +60 -70
  140. package/tests/commands/code.test.ts +346 -345
  141. package/tests/utils/config-loader.test.ts +260 -260
  142. package/tests/utils/env-manager.test.ts +127 -134
  143. package/tests/utils/opencode-validator.test.ts +65 -69
  144. package/tsconfig.json +2 -2
  145. package/vitest.config.ts +3 -3
  146. package/AGENTS.md +0 -374
  147. package/TODO.md +0 -19
  148. package/opencode.json +0 -146
@@ -4,7 +4,7 @@ on:
4
4
  workflow_dispatch:
5
5
  inputs:
6
6
  bump:
7
- description: 'Version bump type'
7
+ description: "Version bump type"
8
8
  required: true
9
9
  type: choice
10
10
  options:
@@ -14,7 +14,7 @@ on:
14
14
 
15
15
  jobs:
16
16
  test:
17
- runs-on: ubuntu-latest
17
+ runs-on: [infra-runner-set]
18
18
  steps:
19
19
  - name: Checkout code
20
20
  uses: actions/checkout@v4
@@ -22,8 +22,8 @@ jobs:
22
22
  - name: Setup Node.js
23
23
  uses: actions/setup-node@v4
24
24
  with:
25
- node-version: '18'
26
- cache: 'npm'
25
+ node-version: "22"
26
+ cache: "npm"
27
27
 
28
28
  - name: Install dependencies
29
29
  run: npm ci
@@ -36,7 +36,7 @@ jobs:
36
36
 
37
37
  publish:
38
38
  needs: test
39
- runs-on: ubuntu-latest
39
+ runs-on: [infra-runner-set]
40
40
  steps:
41
41
  - name: Checkout code
42
42
  uses: actions/checkout@v4
@@ -47,9 +47,9 @@ jobs:
47
47
  - name: Setup Node.js
48
48
  uses: actions/setup-node@v4
49
49
  with:
50
- node-version: '18'
51
- registry-url: 'https://registry.npmjs.org'
52
- cache: 'npm'
50
+ node-version: "22"
51
+ registry-url: "https://registry.npmjs.org"
52
+ cache: "npm"
53
53
 
54
54
  - name: Install dependencies
55
55
  run: npm ci
@@ -10,10 +10,10 @@ on:
10
10
 
11
11
  jobs:
12
12
  test:
13
- runs-on: ubuntu-latest
13
+ runs-on: [infra-runner-set]
14
14
  strategy:
15
15
  matrix:
16
- node-version: [18, 20]
16
+ node-version: [22]
17
17
 
18
18
  steps:
19
19
  - name: Checkout code
@@ -23,16 +23,22 @@ jobs:
23
23
  uses: actions/setup-node@v4
24
24
  with:
25
25
  node-version: ${{ matrix.node-version }}
26
- cache: 'npm'
26
+ cache: "npm"
27
27
 
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
@@ -0,0 +1,15 @@
1
+ node_modules
2
+ dist
3
+ build
4
+ *.lock
5
+ package-lock.json
6
+ .lockfile
7
+ .husky
8
+ coverage
9
+ .nyc_output
10
+ test-results
11
+ playwright-report
12
+ .pi
13
+ env
14
+ .aider*
15
+ .env
package/.prettierrc CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
+ "semi": true,
3
+ "singleQuote": false,
2
4
  "tabWidth": 2,
3
- "useTabs": false,
4
- "semi": false,
5
- "singleQuote": true
5
+ "trailingComma": "es5",
6
+ "printWidth": 100,
7
+ "arrowParens": "avoid"
6
8
  }
@@ -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's infrastructure and AI models.
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
- Berget CLI is open source. Contributions are welcome!
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
@@ -9,11 +9,11 @@ const commands_1 = require("./src/commands");
9
9
  const config_checker_1 = require("./src/utils/config-checker");
10
10
  const chalk_1 = __importDefault(require("chalk"));
11
11
  const package_json_1 = require("./package.json");
12
- process.env.DOTENV_CONFIG_OVERRIDE = 'true';
12
+ process.env.DOTENV_CONFIG_OVERRIDE = "true";
13
13
  require("dotenv/config");
14
14
  // Set version and description
15
15
  commander_1.program
16
- .name('berget')
16
+ .name("berget")
17
17
  .description(`______ _ ___ _____
18
18
  | ___ \\ | | / _ \\|_ _|
19
19
  | |_/ / ___ _ __ __ _ ___| |_ / /_\\ \\ | |
@@ -23,10 +23,10 @@ commander_1.program
23
23
  __/ |
24
24
  |___/ AI on European terms
25
25
  Version: ${package_json_1.version}`)
26
- .version(package_json_1.version, '-v, --version')
27
- .addOption(new commander_1.Option('--local').default(false).hideHelp())
28
- .addOption(new commander_1.Option('--stage').default(false).hideHelp())
29
- .option('--debug', 'Enable debug output', false);
26
+ .version(package_json_1.version, "-v, --version")
27
+ .addOption(new commander_1.Option("--local").default(false).hideHelp())
28
+ .addOption(new commander_1.Option("--stage").default(false).hideHelp())
29
+ .option("--debug", "Enable debug output", false);
30
30
  // Register all commands
31
31
  (0, commands_1.registerCommands)(commander_1.program);
32
32
  // Check for .bergetconfig if not running a command
@@ -38,18 +38,18 @@ if (process.argv.length <= 2) {
38
38
  }
39
39
  // Add helpful suggestions for common command mistakes
40
40
  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
- 'create-key': 'api-keys create',
47
- 'list-clusters': 'clusters list',
48
- usage: 'billing usage',
49
- init: 'code init',
41
+ login: "auth login",
42
+ logout: "auth logout",
43
+ whoami: "auth whoami",
44
+ "list-models": "models list",
45
+ "list-keys": "api-keys list",
46
+ "create-key": "api-keys create",
47
+ "list-clusters": "clusters list",
48
+ usage: "billing usage",
49
+ init: "code init",
50
50
  };
51
51
  // Add error handler for unknown commands
52
- commander_1.program.on('command:*', (operands) => {
52
+ commander_1.program.on("command:*", operands => {
53
53
  const unknownCommand = operands[0];
54
54
  console.error(chalk_1.default.red(`Error: unknown command '${unknownCommand}'`));
55
55
  // Check if this is a known mistake and suggest the correct command
@@ -58,15 +58,15 @@ commander_1.program.on('command:*', (operands) => {
58
58
  }
59
59
  else {
60
60
  // Try to find similar commands
61
- const availableCommands = commander_1.program.commands.map((cmd) => cmd.name());
62
- const similarCommands = availableCommands.filter((cmd) => cmd.includes(unknownCommand) || unknownCommand.includes(cmd));
61
+ const availableCommands = commander_1.program.commands.map(cmd => cmd.name());
62
+ const similarCommands = availableCommands.filter(cmd => cmd.includes(unknownCommand) || unknownCommand.includes(cmd));
63
63
  if (similarCommands.length > 0) {
64
- console.log(chalk_1.default.yellow('Similar commands:'));
65
- similarCommands.forEach((cmd) => {
64
+ console.log(chalk_1.default.yellow("Similar commands:"));
65
+ similarCommands.forEach(cmd => {
66
66
  console.log(chalk_1.default.yellow(` ${chalk_1.default.bold(`berget ${cmd}`)}`));
67
67
  });
68
68
  }
69
- console.log(chalk_1.default.blue('\nRun `berget --help` for a list of available commands.'));
69
+ console.log(chalk_1.default.blue("\nRun `berget --help` for a list of available commands."));
70
70
  }
71
71
  process.exit(1);
72
72
  });
package/dist/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "berget",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
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,17 +37,27 @@
28
37
  "@types/marked": "^5.0.2",
29
38
  "@types/marked-terminal": "^6.1.1",
30
39
  "@types/node": "^20.11.20",
40
+ "@typescript-eslint/eslint-plugin": "^8.59.3",
41
+ "@typescript-eslint/parser": "^8.59.3",
42
+ "eslint": "^10.3.0",
43
+ "eslint-config-prettier": "^10.1.8",
44
+ "eslint-plugin-prettier": "^5.5.5",
45
+ "husky": "^9.1.7",
46
+ "lint-staged": "^17.0.4",
47
+ "prettier": "^3.8.3",
31
48
  "tsx": "^4.19.3",
32
49
  "typescript": "^5.3.3",
33
50
  "vitest": "^1.0.0"
34
51
  },
35
52
  "dependencies": {
53
+ "@clack/prompts": "^0.10.0",
36
54
  "ajv": "^8.17.1",
37
55
  "ajv-formats": "^3.0.1",
38
56
  "chalk": "^4.1.2",
39
57
  "commander": "^12.0.0",
40
58
  "dotenv": "^17.2.3",
41
59
  "fs-extra": "^11.3.0",
60
+ "jsonc-parser": "^3.3.1",
42
61
  "marked": "^9.1.6",
43
62
  "marked-terminal": "^6.2.0",
44
63
  "open": "^9.1.0",
@@ -46,5 +65,14 @@
46
65
  "openapi-typescript": "^6.7.4",
47
66
  "readline": "^1.3.0",
48
67
  "zod": "^4.1.12"
68
+ },
69
+ "lint-staged": {
70
+ "*.{ts,tsx}": [
71
+ "eslint --fix",
72
+ "prettier --write"
73
+ ],
74
+ "*.{json,yml,yaml,md}": [
75
+ "prettier --write"
76
+ ]
49
77
  }
50
78
  }
@@ -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
+ name: "app",
7
+ description: "Expo + React Native apps; props-first, offline-aware, shared tokens.",
8
+ mode: "primary",
9
+ temperature: 0.4,
10
+ top_p: 0.9,
11
+ permission: {
12
+ edit: "allow",
13
+ bash: "deny",
14
+ webfetch: "allow",
15
+ },
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
+ name: "backend",
7
+ description: "Functional, modular Koa + TypeScript services",
8
+ mode: "primary",
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
+ name: "devops",
7
+ description: "Declarative GitOps infra with FluxCD, Kustomize, Helm, operators.",
8
+ mode: "primary",
9
+ temperature: 0.3,
10
+ top_p: 0.8,
11
+ permission: {
12
+ edit: "allow",
13
+ bash: "allow",
14
+ webfetch: "allow",
15
+ },
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
+ name: "frontend",
7
+ description: "Scandinavian, type-safe UIs with React, Tailwind, and Shadcn",
8
+ mode: "primary",
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
+ name: "fullstack",
7
+ description: "Router/coordinator agent for full-stack development",
8
+ mode: "primary",
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
+ };