@blogic-cz/agent-tools 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.
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/package.json +70 -0
- package/schemas/agent-tools.schema.json +319 -0
- package/src/az-tool/build.ts +295 -0
- package/src/az-tool/config.ts +33 -0
- package/src/az-tool/errors.ts +26 -0
- package/src/az-tool/extract-option-value.ts +12 -0
- package/src/az-tool/index.ts +181 -0
- package/src/az-tool/security.ts +130 -0
- package/src/az-tool/service.ts +292 -0
- package/src/az-tool/types.ts +67 -0
- package/src/config/index.ts +12 -0
- package/src/config/loader.ts +170 -0
- package/src/config/types.ts +82 -0
- package/src/credential-guard/claude-hook.ts +28 -0
- package/src/credential-guard/index.ts +435 -0
- package/src/db-tool/config-service.ts +38 -0
- package/src/db-tool/errors.ts +40 -0
- package/src/db-tool/index.ts +91 -0
- package/src/db-tool/schema.ts +69 -0
- package/src/db-tool/security.ts +116 -0
- package/src/db-tool/service.ts +605 -0
- package/src/db-tool/types.ts +33 -0
- package/src/gh-tool/config.ts +7 -0
- package/src/gh-tool/errors.ts +47 -0
- package/src/gh-tool/index.ts +140 -0
- package/src/gh-tool/issue.ts +361 -0
- package/src/gh-tool/pr/commands.ts +432 -0
- package/src/gh-tool/pr/core.ts +497 -0
- package/src/gh-tool/pr/helpers.ts +84 -0
- package/src/gh-tool/pr/index.ts +19 -0
- package/src/gh-tool/pr/review.ts +571 -0
- package/src/gh-tool/repo.ts +147 -0
- package/src/gh-tool/service.ts +192 -0
- package/src/gh-tool/types.ts +97 -0
- package/src/gh-tool/workflow.ts +542 -0
- package/src/index.ts +1 -0
- package/src/k8s-tool/errors.ts +21 -0
- package/src/k8s-tool/index.ts +151 -0
- package/src/k8s-tool/service.ts +227 -0
- package/src/k8s-tool/types.ts +9 -0
- package/src/logs-tool/errors.ts +29 -0
- package/src/logs-tool/index.ts +176 -0
- package/src/logs-tool/service.ts +323 -0
- package/src/logs-tool/types.ts +40 -0
- package/src/session-tool/config.ts +55 -0
- package/src/session-tool/errors.ts +38 -0
- package/src/session-tool/index.ts +270 -0
- package/src/session-tool/service.ts +210 -0
- package/src/session-tool/types.ts +28 -0
- package/src/shared/bun.ts +59 -0
- package/src/shared/cli.ts +38 -0
- package/src/shared/error-renderer.ts +42 -0
- package/src/shared/exec.ts +62 -0
- package/src/shared/format.ts +27 -0
- package/src/shared/index.ts +16 -0
- package/src/shared/throttle.ts +35 -0
- package/src/shared/types.ts +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Blogic s.r.o.
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# @blogic-cz/agent-tools
|
|
2
|
+
|
|
3
|
+
Safe CLI wrappers for AI coding agents. 6 tools for GitHub, databases, Kubernetes, Azure DevOps, logs, and OpenCode sessions — with JSON5 config and a credential guard that blocks agents from touching secrets.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
AI agents need CLI access. Giving them raw `gh`, `kubectl`, `psql` is dangerous — they can leak credentials, hit production, or run destructive commands.
|
|
8
|
+
|
|
9
|
+
These tools wrap each CLI with:
|
|
10
|
+
|
|
11
|
+
- **Security guardrails** — blocked paths, secret detection, dangerous command filtering
|
|
12
|
+
- **Audit trail** — every command goes through a wrapper, not raw shell
|
|
13
|
+
- **Project config** — agents use the right cluster, namespace, and database without guessing
|
|
14
|
+
- **Consistent output** — structured JSON or token-efficient TOON format for LLM consumption
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bun add @blogic-cz/agent-tools
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Requirements:** [Bun](https://bun.sh/) >=1.0.0
|
|
23
|
+
|
|
24
|
+
### For agents reading this
|
|
25
|
+
|
|
26
|
+
Clone the repo and look at the source. The tools are in `src/`, each tool is self-contained:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git clone https://github.com/blogic-cz/agent-tools.git
|
|
30
|
+
ls src/ # gh-tool/ db-tool/ k8s-tool/ az-tool/ logs-tool/ session-tool/ credential-guard/
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
1. Install the package in your project
|
|
36
|
+
2. Create `agent-tools.json5` in your project root:
|
|
37
|
+
|
|
38
|
+
```json5
|
|
39
|
+
{
|
|
40
|
+
$schema: "https://raw.githubusercontent.com/blogic-cz/agent-tools/main/schemas/agent-tools.schema.json",
|
|
41
|
+
kubernetes: {
|
|
42
|
+
default: {
|
|
43
|
+
clusterId: "your-cluster-id",
|
|
44
|
+
namespaces: { test: "your-ns-test", prod: "your-ns-prod" },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
logs: {
|
|
48
|
+
default: {
|
|
49
|
+
localDir: "apps/web-app/logs",
|
|
50
|
+
remotePath: "/app/logs",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
3. Run tools:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx agent-tools-gh pr list
|
|
60
|
+
npx agent-tools-k8s kubectl -n prod-ns get pods
|
|
61
|
+
npx agent-tools-logs list --env local
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
4. Hook up the credential guard in your agent config (Claude Code, OpenCode, etc.):
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { handleToolExecuteBefore } from "@blogic-cz/agent-tools/credential-guard";
|
|
68
|
+
|
|
69
|
+
export default { handleToolExecuteBefore };
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Tools
|
|
73
|
+
|
|
74
|
+
| Binary | Description |
|
|
75
|
+
| --------------------- | --------------------------------------------------------------- |
|
|
76
|
+
| `agent-tools-gh` | GitHub CLI wrapper — PR management, issues, workflows |
|
|
77
|
+
| `agent-tools-db` | Database query tool — SQL execution, schema introspection |
|
|
78
|
+
| `agent-tools-k8s` | Kubernetes tool — kubectl with config-driven context resolution |
|
|
79
|
+
| `agent-tools-az` | Azure DevOps tool — pipelines, builds, repos |
|
|
80
|
+
| `agent-tools-logs` | Application logs — read local and remote (k8s pod) logs |
|
|
81
|
+
| `agent-tools-session` | OpenCode session browser — list, read, search sessions |
|
|
82
|
+
|
|
83
|
+
All tools support `--help` for full usage documentation.
|
|
84
|
+
|
|
85
|
+
## Configuration
|
|
86
|
+
|
|
87
|
+
Config is loaded from `agent-tools.json5` (or `agent-tools.json`) by walking up from the current working directory. Missing config = zero-config mode (works for `gh-tool`; others require config).
|
|
88
|
+
|
|
89
|
+
### IDE Autocompletion
|
|
90
|
+
|
|
91
|
+
Add `$schema` to your config file:
|
|
92
|
+
|
|
93
|
+
```json5
|
|
94
|
+
{
|
|
95
|
+
$schema: "https://raw.githubusercontent.com/blogic-cz/agent-tools/main/schemas/agent-tools.schema.json",
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Named Profiles
|
|
100
|
+
|
|
101
|
+
Each tool section supports multiple named profiles. Select with `--profile <name>`:
|
|
102
|
+
|
|
103
|
+
```json5
|
|
104
|
+
{
|
|
105
|
+
azure: {
|
|
106
|
+
default: { organization: "https://dev.azure.com/main-org", defaultProject: "platform" },
|
|
107
|
+
legacy: { organization: "https://dev.azure.com/old-org", defaultProject: "app" },
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx agent-tools-az pipeline list # uses "default" profile
|
|
114
|
+
npx agent-tools-az pipeline list --profile legacy # uses "legacy" profile
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Profile resolution:** `--profile` flag > auto-select (single profile) > `"default"` key > error.
|
|
118
|
+
|
|
119
|
+
### Full Config Reference
|
|
120
|
+
|
|
121
|
+
See [`examples/agent-tools.json5`](./examples/agent-tools.json5) for a complete example with all options documented.
|
|
122
|
+
|
|
123
|
+
## Environment Variables
|
|
124
|
+
|
|
125
|
+
Secrets are **never** stored in the config file. Use environment variables:
|
|
126
|
+
|
|
127
|
+
| Variable | Used By | Description |
|
|
128
|
+
| ------------------ | ------- | --------------------------------------------------------- |
|
|
129
|
+
| `AGENT_TOOLS_DB_*` | db-tool | DB passwords (name defined by `passwordEnvVar` in config) |
|
|
130
|
+
| `GITHUB_TOKEN` | gh-tool | GitHub API token (falls back to `gh` CLI auth) |
|
|
131
|
+
|
|
132
|
+
### Setting up credentials
|
|
133
|
+
|
|
134
|
+
The config file only references env var **names** (via `passwordEnvVar`), never actual secrets. Set the values in your shell:
|
|
135
|
+
|
|
136
|
+
**macOS / Linux** — add to `~/.zshrc` or `~/.bashrc`:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
export AGENT_TOOLS_DB_PASSWORD="your-password"
|
|
140
|
+
export GITHUB_TOKEN="ghp_xxxxxxxxxxxx"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Windows** — PowerShell (persistent, user-level):
|
|
144
|
+
|
|
145
|
+
```powershell
|
|
146
|
+
[Environment]::SetEnvironmentVariable("AGENT_TOOLS_DB_PASSWORD", "your-password", "User")
|
|
147
|
+
[Environment]::SetEnvironmentVariable("GITHUB_TOKEN", "ghp_xxxxxxxxxxxx", "User")
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Restart your terminal after adding env vars. The credential guard ensures these values never leak into agent output.
|
|
151
|
+
|
|
152
|
+
## Credential Guard
|
|
153
|
+
|
|
154
|
+
The guard blocks agents from accessing sensitive files, leaking secrets, and running dangerous commands. Every block message links to the source — if an agent thinks a block is wrong, it can fork the repo and submit a PR.
|
|
155
|
+
|
|
156
|
+
**What it blocks:**
|
|
157
|
+
|
|
158
|
+
- Reads of secret files (`.env`, `.pem`, `.key`, `.ssh/`, etc.)
|
|
159
|
+
- Writes containing detected secrets (API keys, tokens, passwords)
|
|
160
|
+
- Dangerous shell patterns (`printenv`, `cat .env`, etc.)
|
|
161
|
+
- Direct CLI usage (`gh`, `kubectl`, `psql`, `az`) — must use wrapper tools
|
|
162
|
+
|
|
163
|
+
### Setup for Claude Code
|
|
164
|
+
|
|
165
|
+
Claude Code uses shell command hooks. The package ships a ready-made wrapper script.
|
|
166
|
+
|
|
167
|
+
1. Add to `.claude/settings.json` (or `.claude/settings.local.json` for gitignored config):
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"hooks": {
|
|
172
|
+
"PreToolUse": [
|
|
173
|
+
{
|
|
174
|
+
"matcher": ".*",
|
|
175
|
+
"hooks": [
|
|
176
|
+
{
|
|
177
|
+
"type": "command",
|
|
178
|
+
"command": "bun node_modules/@blogic-cz/agent-tools/src/credential-guard/claude-hook.ts"
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
That's it. The hook reads tool input from stdin, runs the guard, and exits with code 2 (blocked + reason on stderr) or 0 (allowed).
|
|
188
|
+
|
|
189
|
+
### Setup for OpenCode
|
|
190
|
+
|
|
191
|
+
OpenCode loads plugins automatically from `.opencode/plugins/`. Create a plugin file:
|
|
192
|
+
|
|
193
|
+
**`.opencode/plugins/credential-guard.ts`**
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { handleToolExecuteBefore } from "@blogic-cz/agent-tools/credential-guard";
|
|
197
|
+
|
|
198
|
+
export const CredentialGuard = async () => ({
|
|
199
|
+
"tool.execute.before": handleToolExecuteBefore,
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
If the package isn't already in your project dependencies, add a `.opencode/package.json`:
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"dependencies": {
|
|
208
|
+
"@blogic-cz/agent-tools": "*"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
OpenCode installs plugin dependencies automatically at startup.
|
|
214
|
+
|
|
215
|
+
### Custom patterns
|
|
216
|
+
|
|
217
|
+
Use the `credentialGuard` config section to extend built-in defaults (arrays are merged, not replaced):
|
|
218
|
+
|
|
219
|
+
```json5
|
|
220
|
+
{
|
|
221
|
+
credentialGuard: {
|
|
222
|
+
additionalBlockedPaths: ["private/secrets/"],
|
|
223
|
+
additionalAllowedPaths: ["apps/web-app/.env.test"],
|
|
224
|
+
additionalBlockedCliTools: [{ tool: "helm", suggestion: "Use agent-tools-k8s instead" }],
|
|
225
|
+
additionalDangerousBashPatterns: ["rm -rf /"],
|
|
226
|
+
},
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Extending the guard
|
|
231
|
+
|
|
232
|
+
The guard source is at [`src/credential-guard/index.ts`](./src/credential-guard/index.ts). Fork the repo, adjust patterns, submit a PR: https://github.com/blogic-cz/agent-tools
|
|
233
|
+
|
|
234
|
+
## License
|
|
235
|
+
|
|
236
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blogic-cz/agent-tools",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI tools for AI coding agent workflows — GitHub, database, Kubernetes, Azure DevOps, logs, and sessions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"ai",
|
|
8
|
+
"cli",
|
|
9
|
+
"database",
|
|
10
|
+
"devops",
|
|
11
|
+
"github",
|
|
12
|
+
"kubernetes",
|
|
13
|
+
"tools"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/blogic-cz/agent-tools#readme",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/blogic-cz/agent-tools.git"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"agent-tools-az": "./src/az-tool/index.ts",
|
|
23
|
+
"agent-tools-db": "./src/db-tool/index.ts",
|
|
24
|
+
"agent-tools-gh": "./src/gh-tool/index.ts",
|
|
25
|
+
"agent-tools-k8s": "./src/k8s-tool/index.ts",
|
|
26
|
+
"agent-tools-logs": "./src/logs-tool/index.ts",
|
|
27
|
+
"agent-tools-session": "./src/session-tool/index.ts"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"src/",
|
|
31
|
+
"schemas/",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"type": "module",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": "./src/index.ts",
|
|
38
|
+
"./credential-guard": "./src/credential-guard/index.ts",
|
|
39
|
+
"./config": "./src/config/index.ts"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"check": "bun check.ts",
|
|
43
|
+
"check:ci": "bun check.ts ci",
|
|
44
|
+
"format": "oxfmt",
|
|
45
|
+
"format:check": "oxfmt --check",
|
|
46
|
+
"lint": "oxlint -c ./.oxlintrc.json --deny-warnings",
|
|
47
|
+
"lint:fix": "oxlint -c ./.oxlintrc.json --fix",
|
|
48
|
+
"test": "vitest run"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@effect/platform-bun": "4.0.0-beta.20",
|
|
52
|
+
"@toon-format/toon": "2.1.0",
|
|
53
|
+
"effect": "4.0.0-beta.20"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@effect/language-service": "0.77.0",
|
|
57
|
+
"@effect/vitest": "4.0.0-beta.20",
|
|
58
|
+
"@types/bun": "1.3.9",
|
|
59
|
+
"oxfmt": "0.35.0",
|
|
60
|
+
"oxlint": "1.50.0",
|
|
61
|
+
"typescript": "5.9.3",
|
|
62
|
+
"vitest": "^4.0.18"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"bun": ">=1.0.0"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/blogic-cz/agent-tools/main/schemas/agent-tools.schema.json",
|
|
4
|
+
"title": "Agent Tools Configuration",
|
|
5
|
+
"description": "Root configuration for the agent-tools package. Tool-specific sections (azure, kubernetes, database, logs) are maps of named profiles keyed by profile name. Tools choose a profile via --profile <name> (default key is 'default', single-entry maps can be auto-selected). session and credentialGuard are global sections.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"description": "Optional self-reference URL to this JSON Schema.",
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"azure": {
|
|
14
|
+
"description": "Named Azure DevOps profiles as Record<string, AzureConfig>.",
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": {
|
|
17
|
+
"description": "Azure DevOps profile configuration for a specific environment or project.",
|
|
18
|
+
"$ref": "#/definitions/AzureConfig"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"kubernetes": {
|
|
22
|
+
"description": "Named Kubernetes cluster profiles as Record<string, K8sConfig>.",
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": {
|
|
25
|
+
"description": "Kubernetes cluster configuration for a specific environment.",
|
|
26
|
+
"$ref": "#/definitions/K8sConfig"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"database": {
|
|
30
|
+
"description": "Named database profiles as Record<string, DatabaseConfig>.",
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": {
|
|
33
|
+
"description": "Database profile configuration containing one or more environments.",
|
|
34
|
+
"$ref": "#/definitions/DatabaseConfig"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"logs": {
|
|
38
|
+
"description": "Named logs profiles as Record<string, LogsConfig>.",
|
|
39
|
+
"type": "object",
|
|
40
|
+
"additionalProperties": {
|
|
41
|
+
"description": "Logs profile configuration for local and remote access.",
|
|
42
|
+
"$ref": "#/definitions/LogsConfig"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"session": {
|
|
46
|
+
"description": "Global session configuration shared across profiles.",
|
|
47
|
+
"$ref": "#/definitions/SessionConfig"
|
|
48
|
+
},
|
|
49
|
+
"credentialGuard": {
|
|
50
|
+
"description": "Global credential guard configuration merged with built-in defaults.",
|
|
51
|
+
"$ref": "#/definitions/CredentialGuardConfig"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"definitions": {
|
|
55
|
+
"AzureConfig": {
|
|
56
|
+
"description": "Azure DevOps profile configuration.",
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"properties": {
|
|
60
|
+
"organization": {
|
|
61
|
+
"description": "Azure DevOps organization URL or identifier.",
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"defaultProject": {
|
|
65
|
+
"description": "Default Azure DevOps project name.",
|
|
66
|
+
"type": "string"
|
|
67
|
+
},
|
|
68
|
+
"timeoutMs": {
|
|
69
|
+
"description": "Optional command timeout in milliseconds.",
|
|
70
|
+
"type": "number"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"required": ["organization", "defaultProject"]
|
|
74
|
+
},
|
|
75
|
+
"K8sConfig": {
|
|
76
|
+
"description": "Kubernetes cluster profile configuration.",
|
|
77
|
+
"type": "object",
|
|
78
|
+
"additionalProperties": false,
|
|
79
|
+
"properties": {
|
|
80
|
+
"clusterId": {
|
|
81
|
+
"description": "Cluster identifier.",
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"namespaces": {
|
|
85
|
+
"description": "Named namespaces map, for example { \"test\": \"my-app-test\", \"prod\": \"my-app-prod\" }.",
|
|
86
|
+
"type": "object",
|
|
87
|
+
"additionalProperties": {
|
|
88
|
+
"description": "Kubernetes namespace value for the given key.",
|
|
89
|
+
"type": "string"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"timeoutMs": {
|
|
93
|
+
"description": "Optional command timeout in milliseconds.",
|
|
94
|
+
"type": "number"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"required": ["clusterId", "namespaces"]
|
|
98
|
+
},
|
|
99
|
+
"DbEnvConfig": {
|
|
100
|
+
"description": "Single database environment connection details.",
|
|
101
|
+
"type": "object",
|
|
102
|
+
"additionalProperties": false,
|
|
103
|
+
"properties": {
|
|
104
|
+
"host": {
|
|
105
|
+
"description": "Database host name or address.",
|
|
106
|
+
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"port": {
|
|
109
|
+
"description": "Database port.",
|
|
110
|
+
"type": "number"
|
|
111
|
+
},
|
|
112
|
+
"user": {
|
|
113
|
+
"description": "Database user name.",
|
|
114
|
+
"type": "string"
|
|
115
|
+
},
|
|
116
|
+
"database": {
|
|
117
|
+
"description": "Database name.",
|
|
118
|
+
"type": "string"
|
|
119
|
+
},
|
|
120
|
+
"passwordEnvVar": {
|
|
121
|
+
"description": "Name of the environment variable holding the database password.",
|
|
122
|
+
"type": "string"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"required": ["host", "port", "user", "database"]
|
|
126
|
+
},
|
|
127
|
+
"DatabaseConfig": {
|
|
128
|
+
"description": "Database profile configuration.",
|
|
129
|
+
"type": "object",
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"properties": {
|
|
132
|
+
"environments": {
|
|
133
|
+
"description": "Named database environments as Record<string, DbEnvConfig>.",
|
|
134
|
+
"type": "object",
|
|
135
|
+
"additionalProperties": {
|
|
136
|
+
"$ref": "#/definitions/DbEnvConfig"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"kubectl": {
|
|
140
|
+
"description": "Optional kubectl tunnel settings.",
|
|
141
|
+
"type": "object",
|
|
142
|
+
"additionalProperties": false,
|
|
143
|
+
"properties": {
|
|
144
|
+
"context": {
|
|
145
|
+
"description": "Kubectl context name.",
|
|
146
|
+
"type": "string"
|
|
147
|
+
},
|
|
148
|
+
"namespace": {
|
|
149
|
+
"description": "Kubectl namespace for tunnel commands.",
|
|
150
|
+
"type": "string"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": ["context", "namespace"]
|
|
154
|
+
},
|
|
155
|
+
"tunnelTimeoutMs": {
|
|
156
|
+
"description": "Optional timeout for establishing a tunnel, in milliseconds.",
|
|
157
|
+
"type": "number"
|
|
158
|
+
},
|
|
159
|
+
"remotePort": {
|
|
160
|
+
"description": "Optional remote database port used by the tunnel.",
|
|
161
|
+
"type": "number"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"required": ["environments"]
|
|
165
|
+
},
|
|
166
|
+
"LogsConfig": {
|
|
167
|
+
"description": "Logs profile configuration.",
|
|
168
|
+
"type": "object",
|
|
169
|
+
"additionalProperties": false,
|
|
170
|
+
"properties": {
|
|
171
|
+
"localDir": {
|
|
172
|
+
"description": "Local logs directory path.",
|
|
173
|
+
"type": "string"
|
|
174
|
+
},
|
|
175
|
+
"remotePath": {
|
|
176
|
+
"description": "Remote logs path used in container or host environments.",
|
|
177
|
+
"type": "string"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"required": ["localDir", "remotePath"]
|
|
181
|
+
},
|
|
182
|
+
"SessionConfig": {
|
|
183
|
+
"description": "Global session configuration.",
|
|
184
|
+
"type": "object",
|
|
185
|
+
"additionalProperties": false,
|
|
186
|
+
"properties": {
|
|
187
|
+
"storagePath": {
|
|
188
|
+
"description": "Filesystem path used for session storage.",
|
|
189
|
+
"type": "string"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"required": ["storagePath"]
|
|
193
|
+
},
|
|
194
|
+
"CliToolOverride": {
|
|
195
|
+
"description": "CLI override entry that blocks a tool and recommends a safer wrapper.",
|
|
196
|
+
"type": "object",
|
|
197
|
+
"additionalProperties": false,
|
|
198
|
+
"properties": {
|
|
199
|
+
"tool": {
|
|
200
|
+
"description": "CLI tool name to block.",
|
|
201
|
+
"type": "string"
|
|
202
|
+
},
|
|
203
|
+
"suggestion": {
|
|
204
|
+
"description": "Suggested wrapper command or alternative.",
|
|
205
|
+
"type": "string"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"required": ["tool", "suggestion"]
|
|
209
|
+
},
|
|
210
|
+
"CredentialGuardConfig": {
|
|
211
|
+
"description": "Credential guard additions merged with built-in defaults.",
|
|
212
|
+
"type": "object",
|
|
213
|
+
"additionalProperties": false,
|
|
214
|
+
"properties": {
|
|
215
|
+
"additionalBlockedPaths": {
|
|
216
|
+
"description": "Additional blocked file path patterns.",
|
|
217
|
+
"type": "array",
|
|
218
|
+
"items": {
|
|
219
|
+
"description": "Blocked path pattern.",
|
|
220
|
+
"type": "string"
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"additionalAllowedPaths": {
|
|
224
|
+
"description": "Additional allowed file path patterns.",
|
|
225
|
+
"type": "array",
|
|
226
|
+
"items": {
|
|
227
|
+
"description": "Allowed path pattern.",
|
|
228
|
+
"type": "string"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"additionalBlockedCliTools": {
|
|
232
|
+
"description": "Additional blocked CLI tools and recommendations.",
|
|
233
|
+
"type": "array",
|
|
234
|
+
"items": {
|
|
235
|
+
"description": "Blocked CLI tool override entry.",
|
|
236
|
+
"$ref": "#/definitions/CliToolOverride"
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"additionalDangerousBashPatterns": {
|
|
240
|
+
"description": "Additional dangerous bash patterns to block.",
|
|
241
|
+
"type": "array",
|
|
242
|
+
"items": {
|
|
243
|
+
"description": "Dangerous bash pattern.",
|
|
244
|
+
"type": "string"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"examples": [
|
|
251
|
+
{
|
|
252
|
+
"$schema": "https://raw.githubusercontent.com/blogic-cz/agent-tools/main/schemas/agent-tools.schema.json",
|
|
253
|
+
"azure": {
|
|
254
|
+
"default": {
|
|
255
|
+
"organization": "https://dev.azure.com/example-org",
|
|
256
|
+
"defaultProject": "platform",
|
|
257
|
+
"timeoutMs": 60000
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
"kubernetes": {
|
|
261
|
+
"default": {
|
|
262
|
+
"clusterId": "398bf1ad-788c-40f5-a7e0-88366648d9d9",
|
|
263
|
+
"namespaces": {
|
|
264
|
+
"test": "my-app-test",
|
|
265
|
+
"prod": "my-app-prod",
|
|
266
|
+
"system": "bl-system"
|
|
267
|
+
},
|
|
268
|
+
"timeoutMs": 60000
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"database": {
|
|
272
|
+
"default": {
|
|
273
|
+
"environments": {
|
|
274
|
+
"local": {
|
|
275
|
+
"host": "127.0.0.1",
|
|
276
|
+
"port": 25538,
|
|
277
|
+
"user": "my-app-user",
|
|
278
|
+
"database": "my-app",
|
|
279
|
+
"passwordEnvVar": "AGENT_TOOLS_DB_LOCAL_CRED"
|
|
280
|
+
},
|
|
281
|
+
"test": {
|
|
282
|
+
"host": "127.0.0.1",
|
|
283
|
+
"port": 25437,
|
|
284
|
+
"user": "readonly-user",
|
|
285
|
+
"database": "my-app-test",
|
|
286
|
+
"passwordEnvVar": "AGENT_TOOLS_DB_TEST_CRED"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"kubectl": {
|
|
290
|
+
"context": "cloud2-example-cz",
|
|
291
|
+
"namespace": "bl-system"
|
|
292
|
+
},
|
|
293
|
+
"tunnelTimeoutMs": 5000,
|
|
294
|
+
"remotePort": 5432
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"logs": {
|
|
298
|
+
"default": {
|
|
299
|
+
"localDir": "apps/web-app/logs",
|
|
300
|
+
"remotePath": "/app/logs"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"session": {
|
|
304
|
+
"storagePath": "~/.local/share/opencode/storage"
|
|
305
|
+
},
|
|
306
|
+
"credentialGuard": {
|
|
307
|
+
"additionalBlockedPaths": ["private/"],
|
|
308
|
+
"additionalAllowedPaths": ["apps/web-app/.env.test"],
|
|
309
|
+
"additionalBlockedCliTools": [
|
|
310
|
+
{
|
|
311
|
+
"tool": "kubectl",
|
|
312
|
+
"suggestion": "Use bun run k8s-tool instead"
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"additionalDangerousBashPatterns": ["rm -rf /"]
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
}
|