@panchr/tyr 0.1.0 → 0.1.1
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/package.json +9 -2
- package/src/commands/judge.ts +13 -14
- package/src/commands/log.ts +9 -2
- package/src/index.ts +0 -0
package/package.json
CHANGED
|
@@ -3,14 +3,21 @@
|
|
|
3
3
|
"description": "Intelligent permission management for Claude Code hooks",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.1",
|
|
7
7
|
"bin": {
|
|
8
8
|
"tyr": "src/index.ts"
|
|
9
9
|
},
|
|
10
|
-
"files": [
|
|
10
|
+
"files": [
|
|
11
|
+
"src/",
|
|
12
|
+
"!src/__tests__/"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
11
17
|
"scripts": {
|
|
12
18
|
"start": "bun run src/index.ts",
|
|
13
19
|
"build": "bun run scripts/build.ts",
|
|
20
|
+
"publish": "npm publish",
|
|
14
21
|
"lint": "biome check src/",
|
|
15
22
|
"lint:fix": "biome check --write src/",
|
|
16
23
|
"test": "bun test",
|
package/src/commands/judge.ts
CHANGED
|
@@ -99,6 +99,18 @@ export default defineCommand({
|
|
|
99
99
|
|
|
100
100
|
const startTime = performance.now();
|
|
101
101
|
|
|
102
|
+
// Validate config early so broken config is caught before stdin parsing
|
|
103
|
+
let config: TyrConfig;
|
|
104
|
+
try {
|
|
105
|
+
config = await readConfig();
|
|
106
|
+
} catch (err) {
|
|
107
|
+
console.error(
|
|
108
|
+
`[tyr] invalid config: ${err instanceof Error ? err.message : err}`,
|
|
109
|
+
);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
102
114
|
let raw: string;
|
|
103
115
|
try {
|
|
104
116
|
raw = await readStdin();
|
|
@@ -154,8 +166,7 @@ export default defineCommand({
|
|
|
154
166
|
if (verbose) console.error("[tyr] failed to write log:", err);
|
|
155
167
|
}
|
|
156
168
|
try {
|
|
157
|
-
|
|
158
|
-
truncateOldLogs(auditConfig.logRetention);
|
|
169
|
+
truncateOldLogs(config.logRetention);
|
|
159
170
|
} catch {
|
|
160
171
|
// best-effort
|
|
161
172
|
}
|
|
@@ -169,18 +180,6 @@ export default defineCommand({
|
|
|
169
180
|
|
|
170
181
|
// Load env vars from tyr config directory (e.g. API keys)
|
|
171
182
|
loadEnvFile();
|
|
172
|
-
|
|
173
|
-
// Build provider pipeline based on config, applying CLI overrides
|
|
174
|
-
let config: TyrConfig;
|
|
175
|
-
try {
|
|
176
|
-
config = await readConfig();
|
|
177
|
-
} catch (err) {
|
|
178
|
-
console.error(
|
|
179
|
-
`[tyr] invalid config: ${err instanceof Error ? err.message : err}`,
|
|
180
|
-
);
|
|
181
|
-
process.exit(1);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
183
|
if (args.providers !== undefined) {
|
|
185
184
|
const parsed = parseValue("providers", args.providers);
|
|
186
185
|
if (!parsed) {
|
package/src/commands/log.ts
CHANGED
|
@@ -72,7 +72,11 @@ const logArgs = {
|
|
|
72
72
|
},
|
|
73
73
|
cwd: {
|
|
74
74
|
type: "string" as const,
|
|
75
|
-
description: "Filter by cwd path prefix",
|
|
75
|
+
description: "Filter by cwd path prefix (default: current directory)",
|
|
76
|
+
},
|
|
77
|
+
all: {
|
|
78
|
+
type: "boolean" as const,
|
|
79
|
+
description: "Show entries from all projects (default: current directory)",
|
|
76
80
|
},
|
|
77
81
|
};
|
|
78
82
|
|
|
@@ -140,13 +144,16 @@ export default defineCommand({
|
|
|
140
144
|
// Best-effort: don't fail if config is unreadable
|
|
141
145
|
}
|
|
142
146
|
|
|
147
|
+
// Default to current directory unless --all or --cwd is provided
|
|
148
|
+
const cwdFilter = args.all ? undefined : (args.cwd ?? process.cwd());
|
|
149
|
+
|
|
143
150
|
const entries = readLogEntries({
|
|
144
151
|
last: last > 0 ? last : undefined,
|
|
145
152
|
since,
|
|
146
153
|
until,
|
|
147
154
|
decision: args.decision,
|
|
148
155
|
provider: args.provider,
|
|
149
|
-
cwd:
|
|
156
|
+
cwd: cwdFilter,
|
|
150
157
|
});
|
|
151
158
|
|
|
152
159
|
const verboseMode = args.verbose ?? false;
|
package/src/index.ts
CHANGED
|
File without changes
|