@blogic-cz/agent-tools 0.2.6 → 0.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.
- package/README.md +17 -1
- package/package.json +1 -1
- package/src/gh-tool/pr/core.ts +8 -1
- package/src/k8s-tool/security.ts +4 -2
- package/src/shared/error-renderer.ts +2 -4
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ These tools wrap each CLI with:
|
|
|
24
24
|
### Manual installation
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
bun add @blogic-cz/agent-tools
|
|
27
|
+
bun add -d @blogic-cz/agent-tools
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
**Requirements:** [Bun](https://bun.sh/) >=1.0.0
|
|
@@ -75,6 +75,22 @@ bunx agent-tools-gh pr review-triage # interactive summary of PR feedback
|
|
|
75
75
|
bunx agent-tools-k8s pods --env test # list pods (structured command)
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
Optionally, add script aliases to your `package.json` for shorter invocation:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"scripts": {
|
|
83
|
+
"gh-tool": "agent-tools-gh",
|
|
84
|
+
"k8s-tool": "agent-tools-k8s",
|
|
85
|
+
"db-tool": "agent-tools-db",
|
|
86
|
+
"logs-tool": "agent-tools-logs",
|
|
87
|
+
"session-tool": "agent-tools-session"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then run via `bun run k8s-tool -- pods --env test` instead of `bunx agent-tools-k8s pods --env test`.
|
|
93
|
+
|
|
78
94
|
4. Hook up the credential guard in your agent config (Claude Code, OpenCode, etc.):
|
|
79
95
|
|
|
80
96
|
```typescript
|
package/package.json
CHANGED
package/src/gh-tool/pr/core.ts
CHANGED
|
@@ -449,7 +449,14 @@ export const fetchChecks = Effect.fn("pr.fetchChecks")(function* (
|
|
|
449
449
|
return yield* gh.runGhJson<CheckResult[]>([...args, "--json", "name,state,bucket,link"]);
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
|
|
452
|
+
const results = yield* gh.runGhJson<CheckResult[]>([...args, "--json", "name,state,bucket,link"]);
|
|
453
|
+
if (results.some((c) => c.bucket === "pending")) {
|
|
454
|
+
yield* Console.warn(
|
|
455
|
+
`ℹ️ Some checks are still running. Prefer --watch to block until completion instead of polling:\n` +
|
|
456
|
+
` bun agent-tools-gh pr checks${pr !== null ? ` --pr ${pr}` : ""} --watch`,
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
return results;
|
|
453
460
|
});
|
|
454
461
|
|
|
455
462
|
export const fetchFailedChecks = Effect.fn("pr.fetchFailedChecks")(function* (pr: number | null) {
|
package/src/k8s-tool/security.ts
CHANGED
|
@@ -68,8 +68,10 @@ export function isKubectlCommandAllowed(cmd: string): K8sSecurityCheckResult {
|
|
|
68
68
|
const kubectlPart = trimmed.split("|")[0].trim();
|
|
69
69
|
|
|
70
70
|
// Extract verb: first non-flag word
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
const verb = kubectlPart
|
|
72
|
+
.split(/\s+/)
|
|
73
|
+
.find((word) => !word.startsWith("-"))
|
|
74
|
+
?.toLowerCase();
|
|
73
75
|
|
|
74
76
|
if (!verb) {
|
|
75
77
|
return { allowed: false, command: cmd, reason: "Empty kubectl command." };
|
|
@@ -32,12 +32,10 @@ const formatError = (error: unknown): string => {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const formatCause = (cause: Cause.Cause<unknown>): string => {
|
|
35
|
-
const
|
|
36
|
-
const firstFailure = failures[0];
|
|
35
|
+
const firstFailure = cause.reasons.find(Cause.isFailReason);
|
|
37
36
|
if (firstFailure !== undefined) return formatError(firstFailure.error);
|
|
38
37
|
|
|
39
|
-
const
|
|
40
|
-
const firstDefect = defects[0];
|
|
38
|
+
const firstDefect = cause.reasons.find(Cause.isDieReason);
|
|
41
39
|
if (firstDefect !== undefined) {
|
|
42
40
|
if (firstDefect.defect instanceof Error)
|
|
43
41
|
return `Unexpected error: ${firstDefect.defect.message}`;
|