Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"test": "node --test --import tsx tests/*.test.ts",
"smoke": "npm run build && node dist/cli.js redact examples/agent-session.log --out /tmp/logveil-smoke.md --json-out /tmp/logveil-smoke.json && node dist/cli.js audit examples/agent-session.log --format json --fail-on none >/tmp/logveil-audit.json",
"smoke": "npm run build && node dist/cli.js --help | grep -q 'LogVeil' && node dist/cli.js --version | grep -q '0.1.0' && node dist/cli.js redact examples/agent-session.log --out /tmp/logveil-smoke.md --json-out /tmp/logveil-smoke.json && node dist/cli.js audit examples/agent-session.log --format json --fail-on none >/tmp/logveil-audit.json",
"package:smoke": "npm pack --dry-run",
"release:check": "npm test && npm run check && npm run build && npm run package:smoke"
},
Expand Down
7 changes: 6 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ export async function main(argv = process.argv.slice(2)): Promise<number> {

function parseArgs(argv: string[]): CliOptions {
const [commandRaw, ...rest] = argv;
const command = (commandRaw ?? "help") as CliOptions["command"];
const normalizedCommand = commandRaw === "--help" || commandRaw === "-h"
? "help"
: commandRaw === "--version" || commandRaw === "-v"
? "version"
: commandRaw;
const command = (normalizedCommand ?? "help") as CliOptions["command"];
if (!["redact", "audit", "help", "version"].includes(command)) throw new Error(`Unknown command: ${commandRaw}`);
const options: CliOptions = { command, inputs: [], format: command === "audit" ? "json" : "markdown", redact: true };
for (let i = 0; i < rest.length; i += 1) {
Expand Down