agentcrumbs
Version:
Debug mode for any agent.
109 lines (101 loc) • 4.18 kB
JavaScript
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const collect_js_1 = require("./commands/collect.js");
const tail_js_1 = require("./commands/tail.js");
const query_js_1 = require("./commands/query.js");
const follow_js_1 = require("./commands/follow.js");
const session_js_1 = require("./commands/session.js");
const sessions_js_1 = require("./commands/sessions.js");
const replay_js_1 = require("./commands/replay.js");
const stats_js_1 = require("./commands/stats.js");
const clear_js_1 = require("./commands/clear.js");
const strip_js_1 = require("./commands/strip.js");
const HELP = `agentcrumbs — debug tracing for agents
Usage: agentcrumbs <command> [options]
Commands:
collect Start the collector (HTTP server)
tail Live tail of crumbs
query Query historical crumbs
follow Follow a specific trace
session start|stop Start or stop a debug session
sessions List all sessions
replay <id> Replay a session
strip Strip crumb markers from source files
stats Show statistics
clear Clear the crumb trail
Tail options:
--ns <pattern> Filter by namespace (supports wildcards)
--tag <tag> Filter by tag
--match <text> Filter by text content
--session <id> Filter by session ID
--json Output as JSON
Query options:
--since <duration> Relative time window (e.g., 5m, 1h, 24h)
--after <timestamp> Crumbs after this ISO timestamp
--before <timestamp> Crumbs before this ISO timestamp
--cursor <id> Resume from a previous page (8-char ID from output)
--limit <n> Results per page (default: 50)
--ns <pattern> Filter by namespace
--tag <tag> Filter by tag
--session <id> Filter by session ID
--match <text> Filter by text content
--json Output as JSON
Collect options:
--port <n> HTTP port (default: 8374)
--dir <path> Storage directory (default: ~/.agentcrumbs)
--quiet Don't print crumbs to stdout
Strip options:
--check Check for markers without removing (exits 1 if found)
--dry-run Show what would be removed
--dir <path> Directory to scan (default: cwd)
--ext <list> File extensions (default: .ts,.tsx,.js,.jsx,.mjs,.mts)
App filtering (available on most commands):
--app <name> Scope to a specific app (default: auto-detect from package.json)
--all-apps Show crumbs from all apps
Environment:
AGENTCRUMBS Enable debug tracing (see docs for format)
AGENTCRUMBS_APP Override app name (default: auto-detect from package.json)
`;
async function main() {
const args = process.argv.slice(2);
const command = args[0];
const commandArgs = args.slice(1);
switch (command) {
case "collect":
return (0, collect_js_1.collect)(commandArgs);
case "tail":
return (0, tail_js_1.tail)(commandArgs);
case "query":
return (0, query_js_1.query)(commandArgs);
case "follow":
return (0, follow_js_1.follow)(commandArgs);
case "session":
return (0, session_js_1.session)(commandArgs);
case "sessions":
return (0, sessions_js_1.sessions)(commandArgs);
case "replay":
return (0, replay_js_1.replay)(commandArgs);
case "strip":
return (0, strip_js_1.strip)(commandArgs);
case "stats":
return (0, stats_js_1.stats)(commandArgs);
case "clear":
return (0, clear_js_1.clear)(commandArgs);
case "--help":
case "-h":
case "help":
case undefined:
process.stdout.write(HELP);
break;
default:
process.stderr.write(`Unknown command: ${command}\n\n`);
process.stdout.write(HELP);
process.exit(1);
}
}
main().catch((err) => {
process.stderr.write(`Error: ${err.message}\n`);
process.exit(1);
});
//# sourceMappingURL=index.js.map