@blogic-cz/agent-tools 1.5.3 → 1.5.5
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 +7 -6
- package/dist/audit-tool/main.d.ts +3 -0
- package/dist/audit-tool/main.d.ts.map +1 -0
- package/dist/az-tool/main.d.ts +3 -0
- package/dist/az-tool/main.d.ts.map +1 -0
- package/dist/azdo-tool/main.d.ts +3 -0
- package/dist/azdo-tool/main.d.ts.map +1 -0
- package/dist/credential-guard/index.d.ts.map +1 -1
- package/dist/db-tool/main.d.ts +3 -0
- package/dist/db-tool/main.d.ts.map +1 -0
- package/dist/gh-tool/main.d.ts +3 -0
- package/dist/gh-tool/main.d.ts.map +1 -0
- package/dist/gh-tool/pr/core.d.ts.map +1 -1
- package/dist/gh-tool/workflow.d.ts.map +1 -1
- package/dist/k8s-tool/main.d.ts +3 -0
- package/dist/k8s-tool/main.d.ts.map +1 -0
- package/dist/logs-tool/index.d.ts +1 -19
- package/dist/logs-tool/index.d.ts.map +1 -1
- package/dist/logs-tool/main.d.ts +21 -0
- package/dist/logs-tool/main.d.ts.map +1 -0
- package/dist/observability-tool/main.d.ts +3 -0
- package/dist/observability-tool/main.d.ts.map +1 -0
- package/dist/session-tool/index.d.ts +1 -11
- package/dist/session-tool/index.d.ts.map +1 -1
- package/dist/session-tool/main.d.ts +13 -0
- package/dist/session-tool/main.d.ts.map +1 -0
- package/dist/shared/effect-version.d.ts +4 -0
- package/dist/shared/effect-version.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/audit-tool/index.ts +3 -109
- package/src/audit-tool/main.ts +111 -0
- package/src/az-tool/index.ts +3 -151
- package/src/az-tool/main.ts +153 -0
- package/src/azdo-tool/index.ts +3 -220
- package/src/azdo-tool/main.ts +222 -0
- package/src/credential-guard/index.ts +570 -96
- package/src/db-tool/index.ts +3 -260
- package/src/db-tool/main.ts +262 -0
- package/src/gh-tool/index.ts +3 -256
- package/src/gh-tool/main.ts +258 -0
- package/src/gh-tool/pr/core.ts +52 -2
- package/src/gh-tool/workflow.ts +1 -0
- package/src/k8s-tool/index.ts +3 -487
- package/src/k8s-tool/main.ts +489 -0
- package/src/logs-tool/index.ts +3 -247
- package/src/logs-tool/main.ts +249 -0
- package/src/observability-tool/index.ts +3 -34
- package/src/observability-tool/main.ts +36 -0
- package/src/session-tool/index.ts +3 -337
- package/src/session-tool/main.ts +339 -0
- package/src/shared/effect-version.ts +32 -0
package/README.md
CHANGED
|
@@ -27,10 +27,10 @@ These tools wrap each CLI with:
|
|
|
27
27
|
bun add -d @blogic-cz/agent-tools
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
`effect` is a peer dependency
|
|
31
|
-
|
|
32
|
-
Two copies of `effect` are structurally incompatible types, so the values this
|
|
33
|
-
exports stop typechecking in your project when the versions drift.
|
|
30
|
+
`effect` is a peer dependency with the range `^4.0.0-rc.117`, which matches
|
|
31
|
+
`@effect/platform-bun`. If your project depends on `effect` too, use a version in this
|
|
32
|
+
range. Two copies of `effect` are structurally incompatible types, so the values this
|
|
33
|
+
package exports stop typechecking in your project when the versions drift.
|
|
34
34
|
|
|
35
35
|
### Skill installation
|
|
36
36
|
|
|
@@ -634,8 +634,9 @@ Claude Code uses shell command hooks. The package ships a ready-made wrapper scr
|
|
|
634
634
|
|
|
635
635
|
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).
|
|
636
636
|
|
|
637
|
-
The guard permits static `printenv` reads only for exact names in `credentialGuard.allowedEnvironmentVariables`. The default list is empty. Multiple names are allowed only when each name is approved.
|
|
638
|
-
|
|
637
|
+
The guard permits static `printenv` reads and simple `echo`/`printf` expansions only for exact names in `credentialGuard.allowedEnvironmentVariables`. The default list is empty. Multiple names are allowed only when each name is approved. Leading standalone literal assignments such as `F=README.md; cat "$F"` work in supported static commands. Conditional assignments, loop variables, mutation such as `printf -v`, and unknown commands cannot establish that proof. Use a literal path or a leading semicolon-terminated assignment for these cases. Approved environment values may be displayed, but redirecting their pipeline or passing them to an executor stays blocked.
|
|
638
|
+
Ordinary navigation operands such as `cd "$HOME"` and `git -C "$WORKTREE_ROOT" status --short` do not need display permission. This does not authorize printing those values, using them as code/options, or reading unknown file paths. In `printf`, approved values belong in data arguments after a fixed nonmutating format, for example `printf -- '%s' "$WORKSPACE_LABEL"`.
|
|
639
|
+
It recognizes `rtk`, `rtk proxy`, `command`, and supported `env` prefixes and checks each command in a pipeline or chain. Quoted filenames, comments, and redirects retain the sensitive-path checks. Jq object selectors and inline awk programs qualify only when their actual program and options establish passive behavior.
|
|
639
640
|
Literal environment-command text in `rg`, `grep`, `git grep`, `echo`, and `printf` is allowed. In pipelines, every other command must be a known passive text command or an approved static environment read.
|
|
640
641
|
Each pipeline is checked separately from statements joined by `;`, `&&`, or `||`.
|
|
641
642
|
Execution options, other environment reads, and environment reads in dynamic or unsupported shell syntax stay blocked. Custom dangerous-command patterns still apply to the complete input.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/audit-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/az-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/azdo-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/credential-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAM5E,8CAA8C;AAC9C,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,UAA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,MAAM,aAAa,YA75CC,MAAM,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IA65CjB,CAAC;AAExD,yEAAyE;AACzE,eAAO,MAAM,aAAa,aA/5CE,MAAM,KAAK,OA+5CgB,CAAC;AAExD,yDAAyD;AACzD,eAAO,MAAM,aAAa,aAj6CE,MAAM,KAAK,OAi6CgB,CAAC;AAExD,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,YAn6CC,MAAM,KAAK,OAm6C0B,CAAC;AAE1E,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,YAr6CC,MAAM,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAq6Cf,CAAC;AAEhE,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,YAv6CC,MAAM,KAAK,OAu6CsB,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,YAz6CC,MAAM,KAAK,MAAM,GAAG,IAy6Ca,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/db-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/gh-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAE1E,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EAEjB,WAAW,EACX,aAAa,EACb,MAAM,EAGN,iBAAiB,EAIlB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,C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CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;kDAyBtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/k8s-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
* Application Logs Tool for Coding Agents
|
|
4
|
-
*
|
|
5
|
-
* Reads application logs from local development or test/prod environments.
|
|
6
|
-
* For test/prod, uses k8s-tool internally to access logs from PVC.
|
|
7
|
-
*
|
|
8
|
-
* Run with --help for full usage documentation.
|
|
9
|
-
*
|
|
10
|
-
* IMPORTANT FOR AI AGENTS:
|
|
11
|
-
* Use this tool to investigate application behavior and errors.
|
|
12
|
-
* Always start with --list to see available log files.
|
|
13
|
-
* Use --format toon for LLM-optimized output (fewer tokens).
|
|
14
|
-
*/
|
|
15
|
-
import { Command } from "effect/unstable/cli";
|
|
16
|
-
import { Effect } from "effect";
|
|
17
|
-
import { ConfigService } from "#config";
|
|
18
|
-
import { LogsConfigError } from "./errors";
|
|
19
|
-
import { LogsService } from "./service";
|
|
20
|
-
export declare const run: (input: ReadonlyArray<string>) => Effect.Effect<void, LogsConfigError | import("effect/unstable/cli/CliError").CliError, ConfigService | LogsService | Command.Environment>;
|
|
2
|
+
export {};
|
|
21
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logs-tool/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logs-tool/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Application Logs Tool for Coding Agents
|
|
4
|
+
*
|
|
5
|
+
* Reads application logs from local development or test/prod environments.
|
|
6
|
+
* For test/prod, uses k8s-tool internally to access logs from PVC.
|
|
7
|
+
*
|
|
8
|
+
* Run with --help for full usage documentation.
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT FOR AI AGENTS:
|
|
11
|
+
* Use this tool to investigate application behavior and errors.
|
|
12
|
+
* Always start with --list to see available log files.
|
|
13
|
+
* Use --format toon for LLM-optimized output (fewer tokens).
|
|
14
|
+
*/
|
|
15
|
+
import { Command } from "effect/unstable/cli";
|
|
16
|
+
import { Effect } from "effect";
|
|
17
|
+
import { ConfigService } from "#config";
|
|
18
|
+
import { LogsConfigError } from "./errors";
|
|
19
|
+
import { LogsService } from "./service";
|
|
20
|
+
export declare const run: (input: ReadonlyArray<string>) => Effect.Effect<void, LogsConfigError | import("effect/unstable/cli/CliError").CliError, ConfigService | LogsService | Command.Environment>;
|
|
21
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/logs-tool/main.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAyB,MAAM,QAAQ,CAAC;AAavD,OAAO,EAAE,aAAa,EAA6C,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,eAAe,EAAsD,MAAM,UAAU,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAoB,MAAM,WAAW,CAAC;AAsM1D,eAAO,MAAM,GAAG,6KAEd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/observability-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
* OpenCode Session Tool for Coding Agents
|
|
4
|
-
*
|
|
5
|
-
* Lists, searches, and reads OpenCode session history.
|
|
6
|
-
* Uses current project scope by default, or all projects with --all.
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from "effect/unstable/cli";
|
|
9
|
-
import { Effect } from "effect";
|
|
10
|
-
import { ResolvedPaths } from "./config";
|
|
11
|
-
import { SessionService } from "./service";
|
|
12
|
-
export declare const run: (input: ReadonlyArray<string>) => Effect.Effect<void, import("effect/unstable/cli/CliError").CliError, ResolvedPaths | SessionService | Command.Environment>;
|
|
2
|
+
export {};
|
|
13
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session-tool/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session-tool/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* OpenCode Session Tool for Coding Agents
|
|
4
|
+
*
|
|
5
|
+
* Lists, searches, and reads OpenCode session history.
|
|
6
|
+
* Uses current project scope by default, or all projects with --all.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from "effect/unstable/cli";
|
|
9
|
+
import { Effect } from "effect";
|
|
10
|
+
import { ResolvedPaths } from "./config";
|
|
11
|
+
import { SessionService } from "./service";
|
|
12
|
+
export declare const run: (input: ReadonlyArray<string>) => Effect.Effect<void, import("effect/unstable/cli/CliError").CliError, ResolvedPaths | SessionService | Command.Environment>;
|
|
13
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/session-tool/main.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAY,OAAO,EAAQ,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAiB,MAAM,QAAQ,CAAC;AAQ/C,OAAO,EAAE,aAAa,EAAsB,MAAM,UAAU,CAAC;AAE7D,OAAO,EAAc,cAAc,EAAuB,MAAM,WAAW,CAAC;AAgT5E,eAAO,MAAM,GAAG,8JAEd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect-version.d.ts","sourceRoot":"","sources":["../../src/shared/effect-version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,QAA8B,CAAC;AAEhE,eAAO,MAAM,kBAAkB,YAAa,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAOzE,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,OAAO,CAe1D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blogic-cz/agent-tools",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "CLI tools for AI coding agent workflows — GitHub, database, Kubernetes, Azure platform, Azure DevOps, logs, sessions, and audit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"vitest": "5.0.1"
|
|
163
163
|
},
|
|
164
164
|
"peerDependencies": {
|
|
165
|
-
"effect": "4.0.0-rc.117"
|
|
165
|
+
"effect": "^4.0.0-rc.117"
|
|
166
166
|
},
|
|
167
167
|
"overrides": {
|
|
168
168
|
"@effect/platform-node-shared": "4.0.0-rc.117"
|
package/src/audit-tool/index.ts
CHANGED
|
@@ -1,111 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
3
|
-
import { BunRuntime, BunServices } from "@effect/platform-bun";
|
|
4
|
-
import { Effect, Layer, Option } from "effect";
|
|
2
|
+
import { checkEffectVersion } from "#shared/effect-version";
|
|
5
3
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
formatOption,
|
|
9
|
-
formatOutput,
|
|
10
|
-
logText,
|
|
11
|
-
renderCauseToStderr,
|
|
12
|
-
VERSION,
|
|
13
|
-
} from "#shared";
|
|
14
|
-
import { AuditService, AuditServiceLayer, withAudit } from "#shared/audit";
|
|
15
|
-
|
|
16
|
-
type AuditToolResult<T> = {
|
|
17
|
-
success: boolean;
|
|
18
|
-
executionTimeMs: number;
|
|
19
|
-
data?: T;
|
|
20
|
-
error?: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const commonFlags = {
|
|
24
|
-
format: formatOption,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const listCommand = Command.make(
|
|
28
|
-
"list",
|
|
29
|
-
{
|
|
30
|
-
...commonFlags,
|
|
31
|
-
limit: Flag.Int("limit").pipe(
|
|
32
|
-
Flag.withDescription("Maximum number of recent audit entries to return"),
|
|
33
|
-
Flag.withDefault(20),
|
|
34
|
-
),
|
|
35
|
-
project: Flag.optional(Flag.String("project")).pipe(
|
|
36
|
-
Flag.withDescription("Filter entries by exact working directory path"),
|
|
37
|
-
),
|
|
38
|
-
tool: Flag.optional(Flag.String("tool")).pipe(
|
|
39
|
-
Flag.withDescription("Filter entries by tool name (gh, k8s, db, az, logs, session, audit)"),
|
|
40
|
-
),
|
|
41
|
-
},
|
|
42
|
-
({ format, limit, project, tool }) =>
|
|
43
|
-
Effect.gen(function* () {
|
|
44
|
-
const startTime = Date.now();
|
|
45
|
-
const audit = yield* AuditService;
|
|
46
|
-
const entries = yield* audit.listRecent(limit);
|
|
47
|
-
const toolFilteredEntries = Option.match(tool, {
|
|
48
|
-
onNone: () => entries,
|
|
49
|
-
onSome: (value) => entries.filter((entry) => entry.tool === value),
|
|
50
|
-
});
|
|
51
|
-
const filteredEntries = Option.match(project, {
|
|
52
|
-
onNone: () => toolFilteredEntries,
|
|
53
|
-
onSome: (value) => toolFilteredEntries.filter((entry) => entry.project === value),
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const result: AuditToolResult<typeof filteredEntries> = {
|
|
57
|
-
success: true,
|
|
58
|
-
executionTimeMs: Date.now() - startTime,
|
|
59
|
-
data: filteredEntries,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
yield* logText(formatOutput(result, format));
|
|
63
|
-
}),
|
|
64
|
-
).pipe(Command.withDescription("List recent audit log entries"));
|
|
65
|
-
|
|
66
|
-
const purgeCommand = Command.make(
|
|
67
|
-
"purge",
|
|
68
|
-
{
|
|
69
|
-
...commonFlags,
|
|
70
|
-
days: Flag.Int("days").pipe(
|
|
71
|
-
Flag.withDescription("Delete audit entries older than this many days"),
|
|
72
|
-
Flag.withDefault(90),
|
|
73
|
-
),
|
|
74
|
-
},
|
|
75
|
-
({ days, format }) =>
|
|
76
|
-
Effect.gen(function* () {
|
|
77
|
-
const startTime = Date.now();
|
|
78
|
-
const audit = yield* AuditService;
|
|
79
|
-
const deleted = yield* audit.purgeOlderThanDays(days);
|
|
80
|
-
|
|
81
|
-
const result: AuditToolResult<{ deleted: number; days: number }> = {
|
|
82
|
-
success: true,
|
|
83
|
-
executionTimeMs: Date.now() - startTime,
|
|
84
|
-
data: { deleted, days },
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
yield* logText(formatOutput(result, format));
|
|
88
|
-
}),
|
|
89
|
-
).pipe(Command.withDescription("Delete old audit log entries"));
|
|
90
|
-
|
|
91
|
-
const commandsCommand = makeSchemaCommand(() => mainCommand);
|
|
92
|
-
|
|
93
|
-
const mainCommand = Command.make("audit-tool", {}).pipe(
|
|
94
|
-
Command.withDescription("Audit log inspection and maintenance for agent-tools"),
|
|
95
|
-
Command.withSubcommands([listCommand, purgeCommand, commandsCommand]),
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
const cli = Command.run(mainCommand, {
|
|
99
|
-
version: VERSION,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const MainLayer = AuditServiceLayer.pipe(Layer.provideMerge(BunServices.layer));
|
|
103
|
-
|
|
104
|
-
const program = withAudit("audit", cli).pipe(
|
|
105
|
-
Effect.provide(MainLayer),
|
|
106
|
-
Effect.tapCause(renderCauseToStderr),
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
BunRuntime.runMain(program, {
|
|
110
|
-
disableErrorReporting: true,
|
|
111
|
-
});
|
|
4
|
+
if (await checkEffectVersion()) await import("./main");
|
|
5
|
+
else process.exitCode = 1;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { Command, Flag } from "effect/unstable/cli";
|
|
3
|
+
import { BunRuntime, BunServices } from "@effect/platform-bun";
|
|
4
|
+
import { Effect, Layer, Option } from "effect";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
makeSchemaCommand,
|
|
8
|
+
formatOption,
|
|
9
|
+
formatOutput,
|
|
10
|
+
logText,
|
|
11
|
+
renderCauseToStderr,
|
|
12
|
+
VERSION,
|
|
13
|
+
} from "#shared";
|
|
14
|
+
import { AuditService, AuditServiceLayer, withAudit } from "#shared/audit";
|
|
15
|
+
|
|
16
|
+
type AuditToolResult<T> = {
|
|
17
|
+
success: boolean;
|
|
18
|
+
executionTimeMs: number;
|
|
19
|
+
data?: T;
|
|
20
|
+
error?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const commonFlags = {
|
|
24
|
+
format: formatOption,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const listCommand = Command.make(
|
|
28
|
+
"list",
|
|
29
|
+
{
|
|
30
|
+
...commonFlags,
|
|
31
|
+
limit: Flag.Int("limit").pipe(
|
|
32
|
+
Flag.withDescription("Maximum number of recent audit entries to return"),
|
|
33
|
+
Flag.withDefault(20),
|
|
34
|
+
),
|
|
35
|
+
project: Flag.optional(Flag.String("project")).pipe(
|
|
36
|
+
Flag.withDescription("Filter entries by exact working directory path"),
|
|
37
|
+
),
|
|
38
|
+
tool: Flag.optional(Flag.String("tool")).pipe(
|
|
39
|
+
Flag.withDescription("Filter entries by tool name (gh, k8s, db, az, logs, session, audit)"),
|
|
40
|
+
),
|
|
41
|
+
},
|
|
42
|
+
({ format, limit, project, tool }) =>
|
|
43
|
+
Effect.gen(function* () {
|
|
44
|
+
const startTime = Date.now();
|
|
45
|
+
const audit = yield* AuditService;
|
|
46
|
+
const entries = yield* audit.listRecent(limit);
|
|
47
|
+
const toolFilteredEntries = Option.match(tool, {
|
|
48
|
+
onNone: () => entries,
|
|
49
|
+
onSome: (value) => entries.filter((entry) => entry.tool === value),
|
|
50
|
+
});
|
|
51
|
+
const filteredEntries = Option.match(project, {
|
|
52
|
+
onNone: () => toolFilteredEntries,
|
|
53
|
+
onSome: (value) => toolFilteredEntries.filter((entry) => entry.project === value),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const result: AuditToolResult<typeof filteredEntries> = {
|
|
57
|
+
success: true,
|
|
58
|
+
executionTimeMs: Date.now() - startTime,
|
|
59
|
+
data: filteredEntries,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
yield* logText(formatOutput(result, format));
|
|
63
|
+
}),
|
|
64
|
+
).pipe(Command.withDescription("List recent audit log entries"));
|
|
65
|
+
|
|
66
|
+
const purgeCommand = Command.make(
|
|
67
|
+
"purge",
|
|
68
|
+
{
|
|
69
|
+
...commonFlags,
|
|
70
|
+
days: Flag.Int("days").pipe(
|
|
71
|
+
Flag.withDescription("Delete audit entries older than this many days"),
|
|
72
|
+
Flag.withDefault(90),
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
({ days, format }) =>
|
|
76
|
+
Effect.gen(function* () {
|
|
77
|
+
const startTime = Date.now();
|
|
78
|
+
const audit = yield* AuditService;
|
|
79
|
+
const deleted = yield* audit.purgeOlderThanDays(days);
|
|
80
|
+
|
|
81
|
+
const result: AuditToolResult<{ deleted: number; days: number }> = {
|
|
82
|
+
success: true,
|
|
83
|
+
executionTimeMs: Date.now() - startTime,
|
|
84
|
+
data: { deleted, days },
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
yield* logText(formatOutput(result, format));
|
|
88
|
+
}),
|
|
89
|
+
).pipe(Command.withDescription("Delete old audit log entries"));
|
|
90
|
+
|
|
91
|
+
const commandsCommand = makeSchemaCommand(() => mainCommand);
|
|
92
|
+
|
|
93
|
+
const mainCommand = Command.make("audit-tool", {}).pipe(
|
|
94
|
+
Command.withDescription("Audit log inspection and maintenance for agent-tools"),
|
|
95
|
+
Command.withSubcommands([listCommand, purgeCommand, commandsCommand]),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const cli = Command.run(mainCommand, {
|
|
99
|
+
version: VERSION,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const MainLayer = AuditServiceLayer.pipe(Layer.provideMerge(BunServices.layer));
|
|
103
|
+
|
|
104
|
+
const program = withAudit("audit", cli).pipe(
|
|
105
|
+
Effect.provide(MainLayer),
|
|
106
|
+
Effect.tapCause(renderCauseToStderr),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
BunRuntime.runMain(program, {
|
|
110
|
+
disableErrorReporting: true,
|
|
111
|
+
});
|
package/src/az-tool/index.ts
CHANGED
|
@@ -1,153 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
3
|
-
import { BunRuntime, BunServices } from "@effect/platform-bun";
|
|
4
|
-
import { Effect, Layer, Option } from "effect";
|
|
2
|
+
import { checkEffectVersion } from "#shared/effect-version";
|
|
5
3
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
formatAny,
|
|
9
|
-
formatOption,
|
|
10
|
-
logText,
|
|
11
|
-
renderCauseToStderr,
|
|
12
|
-
VERSION,
|
|
13
|
-
} from "#shared";
|
|
14
|
-
import { AuditServiceLayer, withAudit } from "#shared/audit";
|
|
15
|
-
import { AzService, AzServiceLayer } from "./service";
|
|
16
|
-
import { ConfigServiceLayer } from "#config";
|
|
17
|
-
|
|
18
|
-
const profileFlag = Flag.optional(Flag.String("profile")).pipe(
|
|
19
|
-
Flag.withDescription("Azure platform profile name (from agent-tools config)"),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const commonFlags = {
|
|
23
|
-
format: formatOption,
|
|
24
|
-
profile: profileFlag,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/** Run a fixed read-only command through the same security gate as `cmd`. */
|
|
28
|
-
const runFixed = (cmd: string, profile: Option.Option<string>, format: "toon" | "json") =>
|
|
29
|
-
Effect.gen(function* () {
|
|
30
|
-
const az = yield* AzService;
|
|
31
|
-
const result = yield* az.runCommand(cmd, Option.getOrUndefined(profile));
|
|
32
|
-
yield* logText(formatAny(result.data, format));
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
// Typed subcommands
|
|
37
|
-
// ---------------------------------------------------------------------------
|
|
38
|
-
|
|
39
|
-
const subscriptionCommand = Command.make("subscription", commonFlags, ({ format, profile }) =>
|
|
40
|
-
runFixed("account show", profile, format),
|
|
41
|
-
).pipe(Command.withDescription("Show the subscription every command in this profile is pinned to"));
|
|
42
|
-
|
|
43
|
-
const groupsCommand = Command.make("groups", commonFlags, ({ format, profile }) =>
|
|
44
|
-
runFixed("group list", profile, format),
|
|
45
|
-
).pipe(Command.withDescription("List resource groups in the pinned subscription"));
|
|
46
|
-
|
|
47
|
-
const resourcesCommand = Command.make(
|
|
48
|
-
"resources",
|
|
49
|
-
{
|
|
50
|
-
...commonFlags,
|
|
51
|
-
group: Flag.optional(Flag.String("group")).pipe(
|
|
52
|
-
Flag.withDescription("Limit the listing to one resource group"),
|
|
53
|
-
),
|
|
54
|
-
},
|
|
55
|
-
({ format, group, profile }) =>
|
|
56
|
-
Effect.gen(function* () {
|
|
57
|
-
const groupName = Option.getOrUndefined(group);
|
|
58
|
-
const cmd = groupName ? `resource list --resource-group ${groupName}` : "resource list";
|
|
59
|
-
yield* runFixed(cmd, profile, format);
|
|
60
|
-
}),
|
|
61
|
-
).pipe(Command.withDescription("List resources, optionally scoped to one resource group"));
|
|
62
|
-
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
// Raw command passthrough
|
|
65
|
-
// ---------------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
const cmdCommand = Command.make(
|
|
68
|
-
"cmd",
|
|
69
|
-
{
|
|
70
|
-
...commonFlags,
|
|
71
|
-
cmd: Flag.String("cmd").pipe(Flag.withDescription("az command (without the 'az' prefix)")),
|
|
72
|
-
dryRun: Flag.Boolean("dry-run").pipe(
|
|
73
|
-
Flag.withDescription("Show the command that would run, after security checks"),
|
|
74
|
-
Flag.withDefault(false),
|
|
75
|
-
),
|
|
76
|
-
},
|
|
77
|
-
({ cmd, dryRun, format, profile }) =>
|
|
78
|
-
Effect.gen(function* () {
|
|
79
|
-
const az = yield* AzService;
|
|
80
|
-
const profileName = Option.getOrUndefined(profile);
|
|
81
|
-
|
|
82
|
-
if (dryRun) {
|
|
83
|
-
const rendered = yield* az.renderCommand(cmd, profileName);
|
|
84
|
-
yield* logText(`[DRY-RUN] Would execute: ${rendered}`);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const result = yield* az.runCommand(cmd, profileName);
|
|
89
|
-
yield* logText(formatAny(result.data, format));
|
|
90
|
-
}),
|
|
91
|
-
).pipe(
|
|
92
|
-
Command.withDescription(
|
|
93
|
-
`Execute a read-only Azure platform command.
|
|
94
|
-
|
|
95
|
-
The subscription is pinned by the selected profile — passing --subscription is rejected.
|
|
96
|
-
Mutating verbs, unknown verbs, credential reads, and shell syntax are all blocked.
|
|
97
|
-
|
|
98
|
-
EXAMPLES:
|
|
99
|
-
az-tool cmd --cmd "vm list"
|
|
100
|
-
az-tool cmd --cmd "webapp show --name my-app --resource-group my-rg"
|
|
101
|
-
az-tool cmd --cmd "aks list --query \\"[].{name:name,version:kubernetesVersion}\\""
|
|
102
|
-
az-tool cmd --cmd "storage account list" --profile prod --dry-run`,
|
|
103
|
-
),
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
// ---------------------------------------------------------------------------
|
|
107
|
-
// Main command
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
const commandsCommand = makeSchemaCommand(() => mainCommand);
|
|
111
|
-
|
|
112
|
-
const mainCommand = Command.make("az-tool", {}).pipe(
|
|
113
|
-
Command.withDescription(
|
|
114
|
-
`Azure Platform Tool for Coding Agents (READ-ONLY)
|
|
115
|
-
|
|
116
|
-
Inspects Azure PaaS resources — vm, webapp, storage, aks, acr, monitor, and the rest.
|
|
117
|
-
For Azure DevOps pipelines, builds, and repos use azdo-tool instead.
|
|
118
|
-
|
|
119
|
-
Typed subcommands:
|
|
120
|
-
az-tool subscription
|
|
121
|
-
az-tool groups
|
|
122
|
-
az-tool resources --group my-rg
|
|
123
|
-
|
|
124
|
-
Raw az wrapper:
|
|
125
|
-
az-tool cmd --cmd "webapp list"`,
|
|
126
|
-
),
|
|
127
|
-
Command.withSubcommands([
|
|
128
|
-
subscriptionCommand,
|
|
129
|
-
groupsCommand,
|
|
130
|
-
resourcesCommand,
|
|
131
|
-
cmdCommand,
|
|
132
|
-
commandsCommand,
|
|
133
|
-
]),
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const cli = Command.run(mainCommand, {
|
|
137
|
-
version: VERSION,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
const MainLayer = AzServiceLayer.pipe(
|
|
141
|
-
Layer.provideMerge(ConfigServiceLayer),
|
|
142
|
-
Layer.provideMerge(BunServices.layer),
|
|
143
|
-
Layer.provideMerge(AuditServiceLayer),
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const program = withAudit("az", cli).pipe(
|
|
147
|
-
Effect.provide(MainLayer),
|
|
148
|
-
Effect.tapCause(renderCauseToStderr),
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
BunRuntime.runMain(program, {
|
|
152
|
-
disableErrorReporting: true,
|
|
153
|
-
});
|
|
4
|
+
if (await checkEffectVersion()) await import("./main");
|
|
5
|
+
else process.exitCode = 1;
|