@crafter/cli-tree 0.1.0
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/LICENSE +21 -0
- package/README.md +328 -0
- package/dist/archaeology/cache.d.ts +11 -0
- package/dist/archaeology/delegate.d.ts +43 -0
- package/dist/archaeology/index.d.ts +12 -0
- package/dist/archaeology/index.js +61 -0
- package/dist/archaeology/index.js.map +9 -0
- package/dist/archaeology/llm.d.ts +1 -0
- package/dist/archaeology/merge.d.ts +3 -0
- package/dist/archaeology/orchestrator.d.ts +25 -0
- package/dist/archaeology/prompts.d.ts +13 -0
- package/dist/archaeology/types.d.ts +101 -0
- package/dist/archaeology/validate.d.ts +18 -0
- package/dist/chunk-57gtsvhb.js +434 -0
- package/dist/chunk-57gtsvhb.js.map +16 -0
- package/dist/chunk-5aahbfr2.js +293 -0
- package/dist/chunk-5aahbfr2.js.map +10 -0
- package/dist/chunk-pkfpaae1.js +678 -0
- package/dist/chunk-pkfpaae1.js.map +15 -0
- package/dist/chunk-q4se2rwe.js +181 -0
- package/dist/chunk-q4se2rwe.js.map +14 -0
- package/dist/chunk-v5w3w6bd.js +168 -0
- package/dist/chunk-v5w3w6bd.js.map +11 -0
- package/dist/chunk-ykze151b.js +770 -0
- package/dist/chunk-ykze151b.js.map +16 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +433 -0
- package/dist/cli.js.map +10 -0
- package/dist/encoders/ansi.d.ts +2 -0
- package/dist/encoders/html.d.ts +10 -0
- package/dist/encoders/string.d.ts +2 -0
- package/dist/flow/encode.d.ts +5 -0
- package/dist/flow/index.d.ts +8 -0
- package/dist/flow/index.js +25 -0
- package/dist/flow/index.js.map +9 -0
- package/dist/flow/layout.d.ts +30 -0
- package/dist/flow/parse.d.ts +2 -0
- package/dist/flow/render.d.ts +3 -0
- package/dist/flow/types.d.ts +42 -0
- package/dist/flow/validate.d.ts +3 -0
- package/dist/flow/yaml.d.ts +4 -0
- package/dist/grid.d.ts +14 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +9 -0
- package/dist/miner/history.d.ts +6 -0
- package/dist/miner/index.d.ts +18 -0
- package/dist/miner/index.js +38 -0
- package/dist/miner/index.js.map +9 -0
- package/dist/miner/sessions.d.ts +3 -0
- package/dist/miner/stats.d.ts +2 -0
- package/dist/miner/suggest.d.ts +11 -0
- package/dist/miner/transitions.d.ts +6 -0
- package/dist/miner/types.d.ts +46 -0
- package/dist/miner/workflows.d.ts +11 -0
- package/dist/parse.d.ts +3 -0
- package/dist/render.d.ts +3 -0
- package/dist/types.d.ts +39 -0
- package/package.json +85 -0
- package/skill/SKILL.md +263 -0
- package/skill/evals/evals.json +26 -0
- package/skill/install.sh +38 -0
- package/skill/references/archaeology-guide.md +157 -0
- package/skill/references/skill-template.md +120 -0
- package/src/archaeology/cache.ts +107 -0
- package/src/archaeology/delegate.ts +113 -0
- package/src/archaeology/index.ts +48 -0
- package/src/archaeology/llm.ts +10 -0
- package/src/archaeology/merge.ts +155 -0
- package/src/archaeology/orchestrator.ts +185 -0
- package/src/archaeology/prompts.ts +178 -0
- package/src/archaeology/types.ts +139 -0
- package/src/archaeology/validate.ts +157 -0
- package/src/cli.ts +451 -0
- package/src/encoders/ansi.ts +32 -0
- package/src/encoders/html.ts +78 -0
- package/src/encoders/string.ts +20 -0
- package/src/flow/encode.ts +21 -0
- package/src/flow/index.ts +15 -0
- package/src/flow/layout.ts +150 -0
- package/src/flow/parse.ts +100 -0
- package/src/flow/render.ts +186 -0
- package/src/flow/types.ts +45 -0
- package/src/flow/validate.ts +111 -0
- package/src/flow/yaml.ts +235 -0
- package/src/grid.ts +59 -0
- package/src/index.ts +24 -0
- package/src/miner/history.ts +156 -0
- package/src/miner/index.ts +76 -0
- package/src/miner/sessions.ts +39 -0
- package/src/miner/stats.ts +43 -0
- package/src/miner/suggest.ts +101 -0
- package/src/miner/transitions.ts +62 -0
- package/src/miner/types.ts +45 -0
- package/src/miner/workflows.ts +96 -0
- package/src/parse.ts +321 -0
- package/src/render.ts +182 -0
- package/src/types.ts +62 -0
- package/workflows/docker-deploy.yml +42 -0
- package/workflows/docker-parallel.yml +36 -0
- package/workflows/gh-issue-to-pr.yml +48 -0
- package/workflows/git-pr-flow.yml +36 -0
- package/workflows/kubectl-rollout.yml +37 -0
- package/workflows/npm-publish.yml +42 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/archaeology/types.ts", "../src/archaeology/prompts.ts", "../src/archaeology/validate.ts", "../src/archaeology/merge.ts", "../src/archaeology/cache.ts", "../src/archaeology/delegate.ts", "../src/archaeology/orchestrator.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { CLINode, Flag, Arg } from \"../types\";\n\nexport type SourceKind =\n\t| \"help\"\n\t| \"llm-survey\"\n\t| \"llm-deep-dive\"\n\t| \"llm-cartography\"\n\t| \"llm-validated\"\n\t| \"man\"\n\t| \"completion\"\n\t| \"user\";\n\nexport interface Source {\n\ttype: SourceKind;\n\tconfidence: number;\n\tverifiedAt?: string;\n\tnote?: string;\n}\n\nexport interface EnrichedFlag extends Flag {\n\thidden?: boolean;\n\tdeprecated?: boolean;\n\texperimental?: boolean;\n\tsource?: Source;\n\texamples?: string[];\n\texcludes?: string[];\n\trequires?: string[];\n}\n\nexport interface EnrichedArg extends Arg {\n\tsource?: Source;\n}\n\nexport interface Example {\n\tcommand: string;\n\tdescription?: string;\n\tsource?: Source;\n}\n\nexport interface FlagConstraint {\n\ttype: \"mutually-exclusive\" | \"requires\" | \"implies\";\n\tflags: string[];\n\tdescription?: string;\n}\n\nexport interface EnrichedCLINode {\n\tname: string;\n\tdescription?: string;\n\taliases?: string[];\n\thidden?: boolean;\n\tdeprecated?: boolean;\n\texperimental?: boolean;\n\tsubcommands?: EnrichedCLINode[];\n\tflags?: EnrichedFlag[];\n\targs?: EnrichedArg[];\n\tconstraints?: FlagConstraint[];\n\texamples?: Example[];\n\tsource?: Source;\n}\n\nexport interface SurveyHypothesis {\n\tcli: string;\n\tdescription: string;\n\tfamilies: Array<{\n\t\tname: string;\n\t\tdescription: string;\n\t\tsubcommands: string[];\n\t}>;\n\ttopLevelFlags: string[];\n}\n\nexport interface DeepDiveProposal {\n\tcommand: string[];\n\tflags: Array<{\n\t\tname: string;\n\t\tshort?: string;\n\t\ttype: \"boolean\" | \"string\" | \"number\" | \"enum\";\n\t\thidden?: boolean;\n\t\tdeprecated?: boolean;\n\t\tdescription?: string;\n\t}>;\n\texamples: string[];\n}\n\nexport interface ValidationVerdict {\n\tcommand: string[];\n\texists: boolean;\n\tverifiedFlags: string[];\n\trejectedFlags: string[];\n\tunconfirmedFlags: string[];\n\trawHelp?: string;\n\terror?: string;\n}\n\nexport interface ArchaeologyCache {\n\tcli: string;\n\tcliVersion?: string;\n\tcreatedAt: string;\n\ttree: EnrichedCLINode;\n\tphases: {\n\t\tsurvey: boolean;\n\t\texcavation: boolean;\n\t\tdeepDive: boolean;\n\t\tcartography: boolean;\n\t};\n}\n\nexport interface ArchaeologyOptions {\n\tcacheDir?: string;\n\tskipCache?: boolean;\n\tincludeUnverified?: boolean;\n\tmaxDepth?: number;\n\tphases?: {\n\t\tsurvey?: boolean;\n\t\texcavation?: boolean;\n\t\tdeepDive?: boolean;\n\t\tcartography?: boolean;\n\t};\n}\n\nexport function toCLINode(node: EnrichedCLINode): CLINode {\n\tconst base: CLINode = { name: node.name };\n\tif (node.description) base.description = node.description;\n\tif (node.aliases) base.aliases = node.aliases;\n\tif (node.subcommands) base.subcommands = node.subcommands.map(toCLINode);\n\tif (node.flags) base.flags = node.flags.map(f => ({ ...f }));\n\tif (node.args) base.args = node.args.map(a => ({ ...a }));\n\treturn base;\n}\n\nexport function fromCLINode(node: CLINode, source: Source = { type: \"help\", confidence: 1 }): EnrichedCLINode {\n\tconst base: EnrichedCLINode = { name: node.name, source };\n\tif (node.description) base.description = node.description;\n\tif (node.aliases) base.aliases = node.aliases;\n\tif (node.subcommands) base.subcommands = node.subcommands.map(s => fromCLINode(s, source));\n\tif (node.flags) base.flags = node.flags.map(f => ({ ...f, source }));\n\tif (node.args) base.args = node.args.map(a => ({ ...a, source }));\n\treturn base;\n}\n",
|
|
6
|
+
"import type { EnrichedCLINode } from \"./types\";\n\nexport interface PromptContext {\n\tcli: string;\n\tversion?: string;\n\tknownCommands?: string[];\n\tknownTree?: EnrichedCLINode;\n}\n\nexport function surveyPrompt(ctx: PromptContext): string {\n\treturn `You are a CLI archaeologist. Your task is to produce a hypothesis map of the \\`${ctx.cli}\\` CLI based on your training knowledge.\n\n${ctx.version ? `Version: ${ctx.version}\\n` : \"\"}Do not invoke the CLI yet. This is survey phase — hypothesize what families of commands exist and what subcommands belong to each family.\n\nOutput STRICT JSON matching this schema:\n\n\\`\\`\\`json\n{\n \"cli\": \"${ctx.cli}\",\n \"description\": \"<one-line description of the CLI>\",\n \"families\": [\n {\n \"name\": \"<family name, e.g. 'container management'>\",\n \"description\": \"<one line>\",\n \"subcommands\": [\"<subcommand-name>\", ...]\n }\n ],\n \"topLevelFlags\": [\"--global-flag-1\", \"--global-flag-2\"]\n}\n\\`\\`\\`\n\nRules:\n- Group related subcommands into families (container, image, network, auth, config, etc).\n- List ONLY subcommand names — no descriptions in this phase.\n- Include hidden/experimental commands you know about.\n- topLevelFlags = flags that work on the root (e.g. --version, --help, --config).\n- Output ONLY the JSON, no prose before or after.`;\n}\n\nexport function excavationPrompt(ctx: PromptContext, subcommandPath: string[]): string {\n\tconst cmd = [ctx.cli, ...subcommandPath].join(\" \");\n\treturn `You are a CLI archaeologist, currently excavating the \\`${cmd}\\` subcommand.\n\nYou will validate your hypothesis by running the real CLI. Use the Bash tool to run:\n\n\\`${cmd} --help\\`\n\nThen parse its output and produce a structured description of this subcommand.\n\nOutput STRICT JSON matching this schema:\n\n\\`\\`\\`json\n{\n \"command\": ${JSON.stringify([ctx.cli, ...subcommandPath])},\n \"exists\": true|false,\n \"description\": \"<description from help output>\",\n \"subcommands\": [\n { \"name\": \"<sub>\", \"description\": \"<desc>\" }\n ],\n \"flags\": [\n {\n \"name\": \"flag-name\",\n \"short\": \"f\",\n \"type\": \"boolean|string|number|enum\",\n \"description\": \"<desc>\",\n \"required\": false\n }\n ],\n \"args\": [\n { \"name\": \"input\", \"required\": true, \"variadic\": false }\n ]\n}\n\\`\\`\\`\n\nRules:\n- If the command does not exist or --help fails, set exists: false and return empty arrays.\n- Extract every flag and arg from the help output.\n- Do NOT invent anything — only what is in the actual help text.\n- Output ONLY the JSON.`;\n}\n\nexport function deepDivePrompt(ctx: PromptContext, subcommandPath: string[]): string {\n\tconst cmd = [ctx.cli, ...subcommandPath].join(\" \");\n\treturn `You are a CLI archaeologist. You already excavated \\`${cmd}\\` from --help.\n\nNow dig deeper: based on your training knowledge, what flags exist for this command that are NOT documented in --help? Focus on:\n- Hidden flags (work but undocumented)\n- Experimental flags (marked as experimental in source code)\n- Deprecated flags (still functional but hidden)\n- Flags that only appear in man pages or shell completion scripts\n\nOutput STRICT JSON:\n\n\\`\\`\\`json\n{\n \"command\": ${JSON.stringify([ctx.cli, ...subcommandPath])},\n \"hiddenFlags\": [\n {\n \"name\": \"flag-name\",\n \"short\": \"f\",\n \"type\": \"boolean|string|number|enum\",\n \"hidden\": true,\n \"description\": \"<what it does>\",\n \"source\": \"source-code|man-page|completion|community-known\"\n }\n ],\n \"deprecatedFlags\": [\n {\n \"name\": \"old-flag\",\n \"description\": \"Deprecated in favor of --new-flag\",\n \"replacement\": \"new-flag\"\n }\n ],\n \"examples\": [\n \"${cmd} --example-use-case\"\n ]\n}\n\\`\\`\\`\n\nRules:\n- Only suggest flags you are confident about. Confidence > 70%.\n- Prefer flags you have seen in real usage, PRs, issues, or man pages.\n- If unsure, omit. This phase is about quality, not quantity.\n- Output ONLY the JSON.`;\n}\n\nexport function cartographyPrompt(ctx: PromptContext, subcommandPath: string[]): string {\n\tconst cmd = [ctx.cli, ...subcommandPath].join(\" \");\n\treturn `You are a CLI archaeologist mapping flag interactions for \\`${cmd}\\`.\n\nIdentify constraints between flags:\n- Mutually exclusive (cannot use together)\n- Requires (using A requires B)\n- Implies (using A sets B automatically)\n\nOutput STRICT JSON:\n\n\\`\\`\\`json\n{\n \"command\": ${JSON.stringify([ctx.cli, ...subcommandPath])},\n \"constraints\": [\n {\n \"type\": \"mutually-exclusive|requires|implies\",\n \"flags\": [\"--flag-a\", \"--flag-b\"],\n \"description\": \"<human explanation>\"\n }\n ]\n}\n\\`\\`\\`\n\nRules:\n- Only list constraints you are confident about.\n- Reference real flags from the --help output, not hypothetical ones.\n- Output ONLY the JSON.`;\n}\n\nexport function validationInstructions(cli: string): string {\n\treturn `You are validating an archaeology result for \\`${cli}\\`.\n\nFor each command/flag proposed by the LLM survey phase, you must:\n\n1. Run \\`<cli> <subcommand> --help\\` via the Bash tool.\n2. Parse the real help output.\n3. Mark each flag as:\n - \"verified\" — appears in --help, can confirm it exists\n - \"rejected\" — does NOT appear in --help, LLM hallucinated\n - \"unconfirmed\" — not in --help but LLM may still be correct (hidden flags)\n\nReturn a validation report. Flags marked \"rejected\" must be removed from the final tree.\nFlags marked \"unconfirmed\" are kept only if --include-unverified is set.`;\n}\n\nexport function extractJsonFromLlmResponse(response: string): unknown {\n\tconst fenced = response.match(/```(?:json)?\\s*([\\s\\S]*?)\\s*```/);\n\tconst raw = fenced ? fenced[1]! : response;\n\tconst trimmed = raw.trim();\n\treturn JSON.parse(trimmed);\n}\n",
|
|
7
|
+
"import { parseHelp } from \"../parse\";\nimport type { CLINode } from \"../types\";\nimport type { ValidationVerdict, EnrichedCLINode, SurveyHypothesis, DeepDiveProposal } from \"./types\";\n\nexport async function runHelpCommand(binary: string, subcommandPath: string[]): Promise<string | null> {\n\ttry {\n\t\tconst proc = Bun.spawn([binary, ...subcommandPath, \"--help\"], {\n\t\t\tstdout: \"pipe\",\n\t\t\tstderr: \"pipe\",\n\t\t});\n\n\t\tconst timeout = setTimeout(() => proc.kill(), 5000);\n\n\t\tconst [stdout, stderr] = await Promise.all([\n\t\t\tnew Response(proc.stdout).text(),\n\t\t\tnew Response(proc.stderr).text(),\n\t\t]);\n\n\t\tclearTimeout(timeout);\n\t\tawait proc.exited;\n\n\t\tconst output = stdout || stderr;\n\t\treturn output.trim() ? output : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function validateSubcommandExists(\n\tbinary: string,\n\tsubcommandPath: string[],\n): Promise<boolean> {\n\tconst output = await runHelpCommand(binary, subcommandPath);\n\tif (!output) return false;\n\n\tconst lower = output.toLowerCase();\n\tconst hasError =\n\t\t/unknown (command|subcommand)|command not found|no such command/.test(lower) ||\n\t\t/is not a \\w+ command/.test(lower) ||\n\t\t/invalid (command|subcommand)/.test(lower) ||\n\t\t/error: unrecognized/.test(lower);\n\treturn !hasError;\n}\n\nexport async function validateSurvey(\n\tbinary: string,\n\tsurvey: SurveyHypothesis,\n): Promise<{ confirmed: string[]; rejected: string[] }> {\n\tconst confirmed: string[] = [];\n\tconst rejected: string[] = [];\n\n\tconst allSubs = survey.families.flatMap(f => f.subcommands);\n\tconst unique = Array.from(new Set(allSubs));\n\n\tconst BATCH = 5;\n\tfor (let i = 0; i < unique.length; i += BATCH) {\n\t\tconst batch = unique.slice(i, i + BATCH);\n\t\tconst results = await Promise.all(\n\t\t\tbatch.map(async sub => ({ sub, exists: await validateSubcommandExists(binary, [sub]) })),\n\t\t);\n\t\tfor (const { sub, exists } of results) {\n\t\t\tif (exists) confirmed.push(sub);\n\t\t\telse rejected.push(sub);\n\t\t}\n\t}\n\n\treturn { confirmed, rejected };\n}\n\nexport async function excavateCommand(\n\tbinary: string,\n\tsubcommandPath: string[],\n): Promise<CLINode | null> {\n\tconst output = await runHelpCommand(binary, subcommandPath);\n\tif (!output) return null;\n\n\tconst name = subcommandPath[subcommandPath.length - 1] ?? binary;\n\treturn parseHelp(name, output);\n}\n\nexport async function validateDeepDive(\n\tbinary: string,\n\tproposal: DeepDiveProposal,\n): Promise<ValidationVerdict> {\n\tconst subcommandPath = proposal.command.slice(1);\n\tconst realHelp = await runHelpCommand(binary, subcommandPath);\n\n\tif (!realHelp) {\n\t\treturn {\n\t\t\tcommand: proposal.command,\n\t\t\texists: false,\n\t\t\tverifiedFlags: [],\n\t\t\trejectedFlags: proposal.flags.map(f => f.name),\n\t\t\tunconfirmedFlags: [],\n\t\t\terror: \"Command did not produce help output\",\n\t\t};\n\t}\n\n\tconst parsed = parseHelp(subcommandPath[subcommandPath.length - 1] ?? binary, realHelp);\n\tconst realFlagNames = new Set(parsed.flags?.map(f => f.name) ?? []);\n\n\tconst verifiedFlags: string[] = [];\n\tconst rejectedFlags: string[] = [];\n\tconst unconfirmedFlags: string[] = [];\n\n\tfor (const flag of proposal.flags) {\n\t\tif (realFlagNames.has(flag.name)) {\n\t\t\tverifiedFlags.push(flag.name);\n\t\t} else if (flag.hidden || flag.deprecated) {\n\t\t\tunconfirmedFlags.push(flag.name);\n\t\t} else {\n\t\t\trejectedFlags.push(flag.name);\n\t\t}\n\t}\n\n\treturn {\n\t\tcommand: proposal.command,\n\t\texists: true,\n\t\tverifiedFlags,\n\t\trejectedFlags,\n\t\tunconfirmedFlags,\n\t\trawHelp: realHelp,\n\t};\n}\n\nexport interface ValidationSummary {\n\ttotalProposed: number;\n\tverified: number;\n\trejected: number;\n\tunconfirmed: number;\n\thallucinations: string[];\n}\n\nexport function summarizeValidation(verdicts: ValidationVerdict[]): ValidationSummary {\n\tlet verified = 0;\n\tlet rejected = 0;\n\tlet unconfirmed = 0;\n\tconst hallucinations: string[] = [];\n\n\tfor (const v of verdicts) {\n\t\tverified += v.verifiedFlags.length;\n\t\trejected += v.rejectedFlags.length;\n\t\tunconfirmed += v.unconfirmedFlags.length;\n\n\t\tfor (const flag of v.rejectedFlags) {\n\t\t\thallucinations.push(`${v.command.join(\" \")} --${flag}`);\n\t\t}\n\t}\n\n\treturn {\n\t\ttotalProposed: verified + rejected + unconfirmed,\n\t\tverified,\n\t\trejected,\n\t\tunconfirmed,\n\t\thallucinations,\n\t};\n}\n",
|
|
8
|
+
"import type { EnrichedCLINode, EnrichedFlag, EnrichedArg, Source, SourceKind } from \"./types\";\n\nconst SOURCE_PRIORITY: Record<SourceKind, number> = {\n\t\"user\": 100,\n\t\"help\": 90,\n\t\"llm-validated\": 70,\n\t\"man\": 60,\n\t\"completion\": 55,\n\t\"llm-cartography\": 40,\n\t\"llm-deep-dive\": 35,\n\t\"llm-survey\": 20,\n};\n\nfunction sourceRank(source: Source | undefined): number {\n\tif (!source) return 0;\n\treturn SOURCE_PRIORITY[source.type] ?? 0;\n}\n\nexport function mergeNodes(a: EnrichedCLINode, b: EnrichedCLINode): EnrichedCLINode {\n\tif (a.name !== b.name) {\n\t\tthrow new Error(`Cannot merge nodes with different names: ${a.name} vs ${b.name}`);\n\t}\n\n\tconst highPriority = sourceRank(a.source) >= sourceRank(b.source) ? a : b;\n\tconst lowPriority = highPriority === a ? b : a;\n\n\tconst merged: EnrichedCLINode = {\n\t\tname: a.name,\n\t\tsource: highPriority.source,\n\t};\n\n\tmerged.description = highPriority.description ?? lowPriority.description;\n\n\tif (highPriority.aliases || lowPriority.aliases) {\n\t\tconst set = new Set([...(highPriority.aliases ?? []), ...(lowPriority.aliases ?? [])]);\n\t\tmerged.aliases = Array.from(set);\n\t}\n\n\tmerged.hidden = highPriority.hidden ?? lowPriority.hidden;\n\tmerged.deprecated = highPriority.deprecated ?? lowPriority.deprecated;\n\tmerged.experimental = highPriority.experimental ?? lowPriority.experimental;\n\n\tmerged.flags = mergeFlags(highPriority.flags ?? [], lowPriority.flags ?? []);\n\tif (merged.flags.length === 0) delete merged.flags;\n\n\tmerged.args = mergeArgs(highPriority.args ?? [], lowPriority.args ?? []);\n\tif (merged.args.length === 0) delete merged.args;\n\n\tmerged.subcommands = mergeSubcommands(highPriority.subcommands ?? [], lowPriority.subcommands ?? []);\n\tif (merged.subcommands.length === 0) delete merged.subcommands;\n\n\tif (highPriority.constraints || lowPriority.constraints) {\n\t\tmerged.constraints = [...(highPriority.constraints ?? []), ...(lowPriority.constraints ?? [])];\n\t}\n\n\tif (highPriority.examples || lowPriority.examples) {\n\t\tmerged.examples = dedupeExamples([...(highPriority.examples ?? []), ...(lowPriority.examples ?? [])]);\n\t}\n\n\treturn merged;\n}\n\nfunction mergeFlags(primary: EnrichedFlag[], secondary: EnrichedFlag[]): EnrichedFlag[] {\n\tconst byName = new Map<string, EnrichedFlag>();\n\n\tfor (const flag of primary) {\n\t\tbyName.set(flag.name, flag);\n\t}\n\n\tfor (const flag of secondary) {\n\t\tconst existing = byName.get(flag.name);\n\t\tif (!existing) {\n\t\t\tbyName.set(flag.name, flag);\n\t\t} else {\n\t\t\tbyName.set(flag.name, mergeFlag(existing, flag));\n\t\t}\n\t}\n\n\treturn Array.from(byName.values()).sort((a, b) => a.name.localeCompare(b.name));\n}\n\nfunction mergeFlag(a: EnrichedFlag, b: EnrichedFlag): EnrichedFlag {\n\tconst high = sourceRank(a.source) >= sourceRank(b.source) ? a : b;\n\tconst low = high === a ? b : a;\n\n\treturn {\n\t\t...low,\n\t\t...high,\n\t\tdescription: high.description ?? low.description,\n\t\tshort: high.short ?? low.short,\n\t\texamples: [...(high.examples ?? []), ...(low.examples ?? [])],\n\t\texcludes: Array.from(new Set([...(high.excludes ?? []), ...(low.excludes ?? [])])),\n\t\trequires: Array.from(new Set([...(high.requires ?? []), ...(low.requires ?? [])])),\n\t};\n}\n\nfunction mergeArgs(primary: EnrichedArg[], secondary: EnrichedArg[]): EnrichedArg[] {\n\tconst byName = new Map<string, EnrichedArg>();\n\tfor (const arg of primary) byName.set(arg.name, arg);\n\tfor (const arg of secondary) {\n\t\tif (!byName.has(arg.name)) byName.set(arg.name, arg);\n\t}\n\treturn Array.from(byName.values());\n}\n\nfunction mergeSubcommands(primary: EnrichedCLINode[], secondary: EnrichedCLINode[]): EnrichedCLINode[] {\n\tconst byName = new Map<string, EnrichedCLINode>();\n\n\tfor (const sub of primary) byName.set(sub.name, sub);\n\tfor (const sub of secondary) {\n\t\tconst existing = byName.get(sub.name);\n\t\tif (!existing) {\n\t\t\tbyName.set(sub.name, sub);\n\t\t} else {\n\t\t\tbyName.set(sub.name, mergeNodes(existing, sub));\n\t\t}\n\t}\n\n\treturn Array.from(byName.values()).sort((a, b) => a.name.localeCompare(b.name));\n}\n\nfunction dedupeExamples(examples: { command: string; description?: string; source?: Source }[]) {\n\tconst byCommand = new Map<string, { command: string; description?: string; source?: Source }>();\n\tfor (const ex of examples) {\n\t\tconst existing = byCommand.get(ex.command);\n\t\tif (!existing || sourceRank(ex.source) > sourceRank(existing.source)) {\n\t\t\tbyCommand.set(ex.command, ex);\n\t\t}\n\t}\n\treturn Array.from(byCommand.values());\n}\n\nexport function filterUnverified(node: EnrichedCLINode): EnrichedCLINode {\n\tconst copy: EnrichedCLINode = { ...node };\n\n\tif (copy.flags) {\n\t\tcopy.flags = copy.flags.filter(f => {\n\t\t\tconst rank = sourceRank(f.source);\n\t\t\treturn rank >= SOURCE_PRIORITY[\"llm-validated\"];\n\t\t});\n\t\tif (copy.flags.length === 0) delete copy.flags;\n\t}\n\n\tif (copy.subcommands) {\n\t\tcopy.subcommands = copy.subcommands\n\t\t\t.filter(s => {\n\t\t\t\tconst rank = sourceRank(s.source);\n\t\t\t\treturn rank >= SOURCE_PRIORITY[\"llm-validated\"];\n\t\t\t})\n\t\t\t.map(filterUnverified);\n\t\tif (copy.subcommands.length === 0) delete copy.subcommands;\n\t}\n\n\treturn copy;\n}\n",
|
|
9
|
+
"import type { ArchaeologyCache, EnrichedCLINode } from \"./types\";\n\nexport interface CacheOptions {\n\tcacheDir?: string;\n\tttlDays?: number;\n}\n\nfunction getCacheDir(opts?: CacheOptions): string {\n\tif (opts?.cacheDir) return opts.cacheDir;\n\tconst home = process.env.HOME ?? \"\";\n\tif (!home) throw new Error(\"HOME is not set; cannot determine cache directory\");\n\treturn `${home}/.clitree/cache`;\n}\n\nfunction cachePath(cli: string, opts?: CacheOptions): string {\n\tconst dir = getCacheDir(opts);\n\tconst safe = cli.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n\treturn `${dir}/${safe}.json`;\n}\n\nexport async function loadCache(cli: string, opts?: CacheOptions): Promise<ArchaeologyCache | null> {\n\tconst path = cachePath(cli, opts);\n\tconst file = Bun.file(path);\n\tconst exists = await file.exists();\n\tif (!exists) return null;\n\n\ttry {\n\t\tconst data = await file.json();\n\t\treturn data as ArchaeologyCache;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function saveCache(cli: string, cache: ArchaeologyCache, opts?: CacheOptions): Promise<void> {\n\tconst dir = getCacheDir(opts);\n\tawait ensureDir(dir);\n\n\tconst path = cachePath(cli, opts);\n\tawait Bun.write(path, JSON.stringify(cache, null, 2));\n}\n\nexport async function invalidateCache(cli: string, opts?: CacheOptions): Promise<void> {\n\tconst path = cachePath(cli, opts);\n\tconst file = Bun.file(path);\n\tif (await file.exists()) {\n\t\tawait Bun.$`rm ${path}`.quiet();\n\t}\n}\n\nexport function isCacheStale(cache: ArchaeologyCache, currentVersion?: string, ttlDays?: number): boolean {\n\tif (currentVersion && cache.cliVersion && cache.cliVersion !== currentVersion) {\n\t\treturn true;\n\t}\n\n\tif (ttlDays) {\n\t\tconst created = new Date(cache.createdAt).getTime();\n\t\tconst now = Date.now();\n\t\tconst ageDays = (now - created) / (1000 * 60 * 60 * 24);\n\t\tif (ageDays > ttlDays) return true;\n\t}\n\n\treturn false;\n}\n\nexport async function detectCliVersion(binary: string): Promise<string | undefined> {\n\tconst candidates = [\"--version\", \"-v\", \"version\"];\n\tfor (const arg of candidates) {\n\t\ttry {\n\t\t\tconst proc = Bun.spawn([binary, arg], { stdout: \"pipe\", stderr: \"pipe\" });\n\t\t\tconst timeout = setTimeout(() => proc.kill(), 3000);\n\n\t\t\tconst [stdout, stderr] = await Promise.all([\n\t\t\t\tnew Response(proc.stdout).text(),\n\t\t\t\tnew Response(proc.stderr).text(),\n\t\t\t]);\n\t\t\tclearTimeout(timeout);\n\t\t\tawait proc.exited;\n\n\t\t\tconst output = (stdout || stderr).trim();\n\t\t\tconst match = output.match(/v?\\d+\\.\\d+(?:\\.\\d+)?(?:-[a-zA-Z0-9.]+)?/);\n\t\t\tif (match) return match[0];\n\t\t} catch {}\n\t}\n\treturn undefined;\n}\n\nasync function ensureDir(dir: string): Promise<void> {\n\ttry {\n\t\tawait Bun.$`mkdir -p ${dir}`.quiet();\n\t} catch {}\n}\n\nexport function createEmptyCache(cli: string, tree: EnrichedCLINode, cliVersion?: string): ArchaeologyCache {\n\treturn {\n\t\tcli,\n\t\tcliVersion,\n\t\tcreatedAt: new Date().toISOString(),\n\t\ttree,\n\t\tphases: {\n\t\t\tsurvey: false,\n\t\t\texcavation: false,\n\t\t\tdeepDive: false,\n\t\t\tcartography: false,\n\t\t},\n\t};\n}\n",
|
|
10
|
+
"import type { DeepDiveProposal, SurveyHypothesis, FlagConstraint } from \"./types\";\n\nexport interface ArchaeologyDelegate {\n\treadonly name: string;\n\treadonly available: boolean;\n\n\tsurvey?(cli: string, version?: string): Promise<SurveyHypothesis>;\n\n\tproposeHiddenFlags?(cli: string, subcommand: string[]): Promise<DeepDiveProposal>;\n\n\tproposeConstraints?(cli: string, subcommand: string[]): Promise<FlagConstraint[]>;\n}\n\nexport class NullDelegate implements ArchaeologyDelegate {\n\treadonly name = \"null\";\n\treadonly available = false;\n}\n\nexport class BridgeFileDelegate implements ArchaeologyDelegate {\n\treadonly name = \"bridge-file\";\n\treadonly available = true;\n\tprivate requestsPath: string;\n\tprivate responsesPath: string;\n\tprivate timeoutMs: number;\n\n\tconstructor(opts: { requestsPath?: string; responsesPath?: string; timeoutMs?: number } = {}) {\n\t\tconst tmp = process.env.TMPDIR ?? \"/tmp\";\n\t\tthis.requestsPath = opts.requestsPath ?? `${tmp}/clitree-requests.jsonl`;\n\t\tthis.responsesPath = opts.responsesPath ?? `${tmp}/clitree-responses.jsonl`;\n\t\tthis.timeoutMs = opts.timeoutMs ?? 120_000;\n\t}\n\n\tasync survey(cli: string, version?: string): Promise<SurveyHypothesis> {\n\t\tconst id = crypto.randomUUID();\n\t\tawait this.writeRequest({ id, kind: \"survey\", cli, version });\n\t\tconst response = await this.awaitResponse(id);\n\t\treturn response as SurveyHypothesis;\n\t}\n\n\tasync proposeHiddenFlags(cli: string, subcommand: string[]): Promise<DeepDiveProposal> {\n\t\tconst id = crypto.randomUUID();\n\t\tawait this.writeRequest({ id, kind: \"deep-dive\", cli, subcommand });\n\t\tconst response = await this.awaitResponse(id);\n\t\treturn response as DeepDiveProposal;\n\t}\n\n\tasync proposeConstraints(cli: string, subcommand: string[]): Promise<FlagConstraint[]> {\n\t\tconst id = crypto.randomUUID();\n\t\tawait this.writeRequest({ id, kind: \"cartography\", cli, subcommand });\n\t\tconst response = await this.awaitResponse(id);\n\t\treturn (response as { constraints: FlagConstraint[] }).constraints ?? [];\n\t}\n\n\tprivate async writeRequest(req: unknown): Promise<void> {\n\t\tconst existing = await this.readFile(this.requestsPath);\n\t\tconst line = JSON.stringify(req) + \"\\n\";\n\t\tawait Bun.write(this.requestsPath, existing + line, { createPath: true });\n\t}\n\n\tprivate async awaitResponse(id: string): Promise<unknown> {\n\t\tconst start = Date.now();\n\t\twhile (Date.now() - start < this.timeoutMs) {\n\t\t\tconst text = await this.readFile(this.responsesPath);\n\t\t\tconst lines = text.split(\"\\n\").filter(l => l.trim());\n\t\t\tfor (const line of lines) {\n\t\t\t\ttry {\n\t\t\t\t\tconst parsed = JSON.parse(line);\n\t\t\t\t\tif (parsed.id === id) return parsed.result;\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\tawait new Promise(r => setTimeout(r, 250));\n\t\t}\n\t\tthrow new Error(`Timed out waiting for delegate response to request ${id}`);\n\t}\n\n\tprivate async readFile(path: string): Promise<string> {\n\t\ttry {\n\t\t\tconst file = Bun.file(path);\n\t\t\tif (!(await file.exists())) return \"\";\n\t\t\treturn await file.text();\n\t\t} catch {\n\t\t\treturn \"\";\n\t\t}\n\t}\n}\n\nexport class InlineDelegate implements ArchaeologyDelegate {\n\treadonly name = \"inline\";\n\treadonly available = true;\n\n\tconstructor(\n\t\tprivate handlers: {\n\t\t\tsurvey?: (cli: string, version?: string) => Promise<SurveyHypothesis>;\n\t\t\tproposeHiddenFlags?: (cli: string, subcommand: string[]) => Promise<DeepDiveProposal>;\n\t\t\tproposeConstraints?: (cli: string, subcommand: string[]) => Promise<FlagConstraint[]>;\n\t\t},\n\t) {}\n\n\tasync survey(cli: string, version?: string): Promise<SurveyHypothesis> {\n\t\tif (!this.handlers.survey) throw new Error(\"InlineDelegate: survey handler not provided\");\n\t\treturn this.handlers.survey(cli, version);\n\t}\n\n\tasync proposeHiddenFlags(cli: string, subcommand: string[]): Promise<DeepDiveProposal> {\n\t\tif (!this.handlers.proposeHiddenFlags) throw new Error(\"InlineDelegate: proposeHiddenFlags handler not provided\");\n\t\treturn this.handlers.proposeHiddenFlags(cli, subcommand);\n\t}\n\n\tasync proposeConstraints(cli: string, subcommand: string[]): Promise<FlagConstraint[]> {\n\t\tif (!this.handlers.proposeConstraints) throw new Error(\"InlineDelegate: proposeConstraints handler not provided\");\n\t\treturn this.handlers.proposeConstraints(cli, subcommand);\n\t}\n}\n",
|
|
11
|
+
"import { parseHelpRecursive } from \"../parse\";\nimport { validateSurvey, excavateCommand, validateDeepDive, summarizeValidation } from \"./validate\";\nimport { loadCache, saveCache, isCacheStale, detectCliVersion, createEmptyCache } from \"./cache\";\nimport { fromCLINode, toCLINode, type EnrichedCLINode, type ArchaeologyOptions, type ValidationVerdict, type Source } from \"./types\";\nimport type { ArchaeologyDelegate } from \"./delegate\";\nimport { NullDelegate } from \"./delegate\";\nimport type { CLINode } from \"../types\";\n\nexport interface ArchaeologyProgress {\n\tphase: \"cache\" | \"excavation\" | \"survey\" | \"deep-dive\" | \"cartography\" | \"merge\" | \"done\";\n\tmessage: string;\n\tpercent?: number;\n}\n\nexport interface ArchaeologyResult {\n\ttree: EnrichedCLINode;\n\tstats: {\n\t\thelpCommands: number;\n\t\tllmProposed: number;\n\t\tverified: number;\n\t\trejected: number;\n\t\tunconfirmed: number;\n\t\thallucinations: string[];\n\t};\n\tfromCache: boolean;\n}\n\nexport async function runArchaeology(\n\tbinary: string,\n\tdelegate: ArchaeologyDelegate = new NullDelegate(),\n\topts: ArchaeologyOptions & {\n\t\tonProgress?: (p: ArchaeologyProgress) => void;\n\t\tmaxHelpDepth?: number;\n\t} = {},\n): Promise<ArchaeologyResult> {\n\tconst report = opts.onProgress ?? (() => {});\n\tconst phases = {\n\t\tsurvey: opts.phases?.survey ?? true,\n\t\texcavation: opts.phases?.excavation ?? true,\n\t\tdeepDive: opts.phases?.deepDive ?? true,\n\t\tcartography: opts.phases?.cartography ?? false,\n\t};\n\n\treport({ phase: \"cache\", message: \"Checking cache...\" });\n\n\tconst version = await detectCliVersion(binary);\n\tif (!opts.skipCache) {\n\t\tconst cached = await loadCache(binary, { cacheDir: opts.cacheDir });\n\t\tif (cached && !isCacheStale(cached, version, 30)) {\n\t\t\treport({ phase: \"done\", message: \"Loaded from cache\" });\n\t\t\treturn {\n\t\t\t\ttree: cached.tree,\n\t\t\t\tstats: { helpCommands: 0, llmProposed: 0, verified: 0, rejected: 0, unconfirmed: 0, hallucinations: [] },\n\t\t\t\tfromCache: true,\n\t\t\t};\n\t\t}\n\t}\n\n\treport({ phase: \"excavation\", message: `Parsing ${binary} --help recursively...` });\n\tconst helpTree = await parseHelpRecursive(binary, [], opts.maxHelpDepth ?? 2);\n\tconst helpSource: Source = { type: \"help\", confidence: 1.0, verifiedAt: new Date().toISOString() };\n\tconst tree: EnrichedCLINode = fromCLINode(helpTree, helpSource);\n\tconst helpCommandCount = countCommands(tree);\n\n\tlet llmProposed = 0;\n\tconst allVerdicts: ValidationVerdict[] = [];\n\n\tif (delegate.available && phases.survey && delegate.survey) {\n\t\treport({ phase: \"survey\", message: \"Delegate hypothesis survey...\" });\n\t\ttry {\n\t\t\tconst survey = await delegate.survey(binary, version);\n\t\t\tconst existingCommands = new Set(tree.subcommands?.map(s => s.name) ?? []);\n\n\t\t\tconst { confirmed } = await validateSurvey(binary, survey);\n\t\t\tconst llmSurveySource: Source = { type: \"llm-validated\", confidence: 0.8, verifiedAt: new Date().toISOString() };\n\n\t\t\tfor (const sub of confirmed) {\n\t\t\t\tif (!existingCommands.has(sub)) {\n\t\t\t\t\tllmProposed += 1;\n\t\t\t\t\tconst excavated = await excavateCommand(binary, [sub]);\n\t\t\t\t\tif (excavated) {\n\t\t\t\t\t\tconst enriched = fromCLINode(excavated, llmSurveySource);\n\t\t\t\t\t\tif (!tree.subcommands) tree.subcommands = [];\n\t\t\t\t\t\ttree.subcommands.push(enriched);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e: any) {\n\t\t\treport({ phase: \"survey\", message: `Survey failed: ${e.message}` });\n\t\t}\n\t}\n\n\tif (delegate.available && phases.deepDive && delegate.proposeHiddenFlags && tree.subcommands) {\n\t\tconst topCommands = tree.subcommands.slice(0, 10);\n\t\treport({ phase: \"deep-dive\", message: `Deep dive into ${topCommands.length} subcommands...` });\n\n\t\tfor (const sub of topCommands) {\n\t\t\ttry {\n\t\t\t\tconst proposal = await delegate.proposeHiddenFlags(binary, [sub.name]);\n\t\t\t\tconst verdict = await validateDeepDive(binary, proposal);\n\t\t\t\tallVerdicts.push(verdict);\n\n\t\t\t\tconst verifiedSet = new Set(verdict.verifiedFlags);\n\t\t\t\tconst unconfirmedSet = new Set(verdict.unconfirmedFlags);\n\n\t\t\t\tfor (const flag of proposal.flags ?? []) {\n\t\t\t\t\tif (verifiedSet.has(flag.name) || (opts.includeUnverified && unconfirmedSet.has(flag.name))) {\n\t\t\t\t\t\tllmProposed += 1;\n\t\t\t\t\t\tconst source: Source = {\n\t\t\t\t\t\t\ttype: verifiedSet.has(flag.name) ? \"llm-validated\" : \"llm-deep-dive\",\n\t\t\t\t\t\t\tconfidence: verifiedSet.has(flag.name) ? 0.9 : 0.6,\n\t\t\t\t\t\t\tverifiedAt: new Date().toISOString(),\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (!sub.flags) sub.flags = [];\n\t\t\t\t\t\tconst existing = sub.flags.find(f => f.name === flag.name);\n\t\t\t\t\t\tif (!existing) {\n\t\t\t\t\t\t\tsub.flags.push({\n\t\t\t\t\t\t\t\tname: flag.name,\n\t\t\t\t\t\t\t\tshort: flag.short,\n\t\t\t\t\t\t\t\ttype: flag.type,\n\t\t\t\t\t\t\t\tdescription: flag.description,\n\t\t\t\t\t\t\t\thidden: flag.hidden,\n\t\t\t\t\t\t\t\tdeprecated: flag.deprecated,\n\t\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e: any) {\n\t\t\t\treport({ phase: \"deep-dive\", message: `Deep dive failed for ${sub.name}: ${e.message}` });\n\t\t\t}\n\t\t}\n\t}\n\n\tif (delegate.available && phases.cartography && delegate.proposeConstraints && tree.subcommands) {\n\t\treport({ phase: \"cartography\", message: \"Mapping flag constraints...\" });\n\t\tfor (const sub of tree.subcommands.slice(0, 5)) {\n\t\t\ttry {\n\t\t\t\tconst constraints = await delegate.proposeConstraints(binary, [sub.name]);\n\t\t\t\tif (constraints.length > 0) {\n\t\t\t\t\tsub.constraints = constraints;\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\treport({ phase: \"merge\", message: \"Finalizing tree...\" });\n\tconst summary = summarizeValidation(allVerdicts);\n\n\tif (!opts.skipCache) {\n\t\tconst cache = createEmptyCache(binary, tree, version);\n\t\tcache.phases = {\n\t\t\tsurvey: phases.survey,\n\t\t\texcavation: true,\n\t\t\tdeepDive: phases.deepDive,\n\t\t\tcartography: phases.cartography,\n\t\t};\n\t\tawait saveCache(binary, cache, { cacheDir: opts.cacheDir });\n\t}\n\n\treport({ phase: \"done\", message: \"Archaeology complete\" });\n\n\treturn {\n\t\ttree,\n\t\tstats: {\n\t\t\thelpCommands: helpCommandCount,\n\t\t\tllmProposed,\n\t\t\tverified: summary.verified,\n\t\t\trejected: summary.rejected,\n\t\t\tunconfirmed: summary.unconfirmed,\n\t\t\thallucinations: summary.hallucinations,\n\t\t},\n\t\tfromCache: false,\n\t};\n}\n\nfunction countCommands(node: EnrichedCLINode): number {\n\tlet count = 1;\n\tif (node.subcommands) for (const s of node.subcommands) count += countCommands(s);\n\treturn count;\n}\n\nexport function enrichedToTree(enriched: EnrichedCLINode): CLINode {\n\treturn toCLINode(enriched);\n}\n"
|
|
12
|
+
],
|
|
13
|
+
"mappings": ";;;;;;AAwHO,SAAS,SAAS,CAAC,MAAgC;AAAA,EACzD,MAAM,OAAgB,EAAE,MAAM,KAAK,KAAK;AAAA,EACxC,IAAI,KAAK;AAAA,IAAa,KAAK,cAAc,KAAK;AAAA,EAC9C,IAAI,KAAK;AAAA,IAAS,KAAK,UAAU,KAAK;AAAA,EACtC,IAAI,KAAK;AAAA,IAAa,KAAK,cAAc,KAAK,YAAY,IAAI,SAAS;AAAA,EACvE,IAAI,KAAK;AAAA,IAAO,KAAK,QAAQ,KAAK,MAAM,IAAI,QAAM,KAAK,EAAE,EAAE;AAAA,EAC3D,IAAI,KAAK;AAAA,IAAM,KAAK,OAAO,KAAK,KAAK,IAAI,QAAM,KAAK,EAAE,EAAE;AAAA,EACxD,OAAO;AAAA;AAGD,SAAS,WAAW,CAAC,MAAe,SAAiB,EAAE,MAAM,QAAQ,YAAY,EAAE,GAAoB;AAAA,EAC7G,MAAM,OAAwB,EAAE,MAAM,KAAK,MAAM,OAAO;AAAA,EACxD,IAAI,KAAK;AAAA,IAAa,KAAK,cAAc,KAAK;AAAA,EAC9C,IAAI,KAAK;AAAA,IAAS,KAAK,UAAU,KAAK;AAAA,EACtC,IAAI,KAAK;AAAA,IAAa,KAAK,cAAc,KAAK,YAAY,IAAI,OAAK,YAAY,GAAG,MAAM,CAAC;AAAA,EACzF,IAAI,KAAK;AAAA,IAAO,KAAK,Q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U,QAAQ,OAAO,EAAE,UAAU,KAAK,SAAS,CAAC;AAAA,EAC3D;AAAA,EAEA,OAAO,EAAE,OAAO,QAAQ,SAAS,uBAAuB,CAAC;AAAA,EAEzD,OAAO;AAAA,IACN;AAAA,IACA,OAAO;AAAA,MACN,cAAc;AAAA,MACd;AAAA,MACA,UAAU,QAAQ;AAAA,MAClB,UAAU,QAAQ;AAAA,MAClB,aAAa,QAAQ;AAAA,MACrB,gBAAgB,QAAQ;AAAA,IACzB;AAAA,IACA,WAAW;AAAA,EACZ;AAAA;AAGD,SAAS,aAAa,CAAC,MAA+B;AAAA,EACrD,IAAI,QAAQ;AAAA,EACZ,IAAI,KAAK;AAAA,IAAa,WAAW,KAAK,KAAK;AAAA,MAAa,SAAS,cAAc,CAAC;AAAA,EAChF,OAAO;AAAA;AAGD,SAAS,cAAc,CAAC,UAAoC;AAAA,EAClE,OAAO,UAAU,QAAQ;AAAA;",
|
|
14
|
+
"debugId": "7B12E24C921CA3F964756E2164756E21",
|
|
15
|
+
"names": []
|
|
16
|
+
}
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import {
|
|
3
|
+
printTree,
|
|
4
|
+
treeToHtml,
|
|
5
|
+
treeToString
|
|
6
|
+
} from "./chunk-v5w3w6bd.js";
|
|
7
|
+
import {
|
|
8
|
+
mineCli
|
|
9
|
+
} from "./chunk-57gtsvhb.js";
|
|
10
|
+
import {
|
|
11
|
+
NullDelegate,
|
|
12
|
+
runArchaeology
|
|
13
|
+
} from "./chunk-ykze151b.js";
|
|
14
|
+
import {
|
|
15
|
+
parseHelp,
|
|
16
|
+
parseHelpRecursive
|
|
17
|
+
} from "./chunk-5aahbfr2.js";
|
|
18
|
+
import {
|
|
19
|
+
flowToAnsi,
|
|
20
|
+
flowToHtml,
|
|
21
|
+
flowToString,
|
|
22
|
+
parseWorkflow,
|
|
23
|
+
validateWorkflow
|
|
24
|
+
} from "./chunk-pkfpaae1.js";
|
|
25
|
+
import"./chunk-q4se2rwe.js";
|
|
26
|
+
|
|
27
|
+
// src/cli.ts
|
|
28
|
+
var args = process.argv.slice(2);
|
|
29
|
+
var subcommand = args[0];
|
|
30
|
+
var HELP_SUBCOMMANDS = new Set(["flow", "mine", "archaeology"]);
|
|
31
|
+
var isHelpFlag = args.includes("--help") || args.includes("-h");
|
|
32
|
+
if (!subcommand || isHelpFlag && !HELP_SUBCOMMANDS.has(subcommand ?? "")) {
|
|
33
|
+
printMainHelp();
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
if (isHelpFlag) {
|
|
37
|
+
if (subcommand === "flow")
|
|
38
|
+
printFlowHelp();
|
|
39
|
+
else if (subcommand === "mine")
|
|
40
|
+
printMineHelp();
|
|
41
|
+
else if (subcommand === "archaeology")
|
|
42
|
+
printArchaeologyHelp();
|
|
43
|
+
else
|
|
44
|
+
printMainHelp();
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
if (subcommand === "flow") {
|
|
48
|
+
await runFlow(args.slice(1));
|
|
49
|
+
} else if (subcommand === "mine") {
|
|
50
|
+
await runMine(args.slice(1));
|
|
51
|
+
} else if (subcommand === "archaeology") {
|
|
52
|
+
await runArchaeologyCmd(args.slice(1));
|
|
53
|
+
} else {
|
|
54
|
+
await runTree(args);
|
|
55
|
+
}
|
|
56
|
+
function printMainHelp() {
|
|
57
|
+
console.log(`
|
|
58
|
+
clitree — Visualize and explore any CLI
|
|
59
|
+
|
|
60
|
+
Usage:
|
|
61
|
+
clitree <binary> [options] Render command tree from --help
|
|
62
|
+
clitree flow <file> [options] Render a workflow YAML as a DAG
|
|
63
|
+
clitree mine <binary> [options] Mine shell history for workflows
|
|
64
|
+
clitree archaeology <binary> [options] Full analysis: tree + mining + (LLM)
|
|
65
|
+
|
|
66
|
+
Examples:
|
|
67
|
+
clitree docker # basic tree
|
|
68
|
+
clitree mine git # "what workflows do I repeat with git?"
|
|
69
|
+
clitree archaeology bun # tree + mining + LLM archaeology
|
|
70
|
+
|
|
71
|
+
Subcommands:
|
|
72
|
+
tree Parse --help output (default; passing a binary name invokes this)
|
|
73
|
+
flow Render a workflow YAML file as an ASCII DAG
|
|
74
|
+
mine Discover workflows from your shell history
|
|
75
|
+
archaeology Run full analysis (tree + mine + LLM proposals when available)
|
|
76
|
+
|
|
77
|
+
Help for a subcommand: clitree <subcommand> --help
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
80
|
+
function printMineHelp() {
|
|
81
|
+
console.log(`
|
|
82
|
+
cli-tree mine — Mine your shell history for CLI workflows
|
|
83
|
+
|
|
84
|
+
Usage:
|
|
85
|
+
cli-tree mine <binary> [options]
|
|
86
|
+
|
|
87
|
+
Examples:
|
|
88
|
+
cli-tree mine git
|
|
89
|
+
cli-tree mine docker --min-support 5
|
|
90
|
+
cli-tree mine bun --format json > bun-flows.json
|
|
91
|
+
|
|
92
|
+
Options:
|
|
93
|
+
--min-support <n> Minimum occurrences to count as a workflow (default: 3)
|
|
94
|
+
--history-path <p> Custom shell history path (default: ~/.zsh_history)
|
|
95
|
+
--format <fmt> Output format: ansi (default), json
|
|
96
|
+
--max-paths <n> Max workflows to show (default: 10)
|
|
97
|
+
-h, --help Show this help
|
|
98
|
+
`);
|
|
99
|
+
}
|
|
100
|
+
function printArchaeologyHelp() {
|
|
101
|
+
console.log(`
|
|
102
|
+
cli-tree archaeology — Full CLI analysis: tree + mining + LLM archaeology
|
|
103
|
+
|
|
104
|
+
Usage:
|
|
105
|
+
cli-tree archaeology <binary> [options]
|
|
106
|
+
|
|
107
|
+
When run from the command line without a delegate, only the deterministic
|
|
108
|
+
phases run (help parsing + shell history mining). LLM archaeology requires
|
|
109
|
+
running inside the clitree skill (see ./skill/SKILL.md).
|
|
110
|
+
|
|
111
|
+
Examples:
|
|
112
|
+
cli-tree archaeology git # help + history
|
|
113
|
+
cli-tree archaeology docker --no-cache # bypass cache
|
|
114
|
+
cli-tree archaeology bun --format json # JSON output
|
|
115
|
+
|
|
116
|
+
Options:
|
|
117
|
+
--no-cache Skip cache, always re-run
|
|
118
|
+
--max-depth <n> Max --help recursion depth (default: 2)
|
|
119
|
+
--format <fmt> Output format: ansi (default), json
|
|
120
|
+
-h, --help Show this help
|
|
121
|
+
`);
|
|
122
|
+
}
|
|
123
|
+
function printFlowHelp() {
|
|
124
|
+
console.log(`
|
|
125
|
+
cli-tree flow — Render a CLI workflow YAML as a DAG
|
|
126
|
+
|
|
127
|
+
Usage:
|
|
128
|
+
cli-tree flow <file> [options]
|
|
129
|
+
|
|
130
|
+
Examples:
|
|
131
|
+
cli-tree flow workflows/git-pr-flow.yml
|
|
132
|
+
cli-tree flow my-workflow.yml --format html > flow.html
|
|
133
|
+
cli-tree flow workflows/docker-deploy.yml --compact --no-color
|
|
134
|
+
|
|
135
|
+
Options:
|
|
136
|
+
--compact Hide description and legend
|
|
137
|
+
--no-color Disable colors
|
|
138
|
+
--format <fmt> Output format: ansi (default), string, html
|
|
139
|
+
--no-validate Skip validation
|
|
140
|
+
-h, --help Show this help
|
|
141
|
+
`);
|
|
142
|
+
}
|
|
143
|
+
async function runTree(args2) {
|
|
144
|
+
const opts = {
|
|
145
|
+
color: true,
|
|
146
|
+
showFlags: true,
|
|
147
|
+
showArgs: true,
|
|
148
|
+
showDescriptions: true,
|
|
149
|
+
showTypes: true,
|
|
150
|
+
showDefaults: true,
|
|
151
|
+
compact: false
|
|
152
|
+
};
|
|
153
|
+
let depth = 2;
|
|
154
|
+
let format = "ansi";
|
|
155
|
+
let stdinName = null;
|
|
156
|
+
let binary = null;
|
|
157
|
+
for (let i = 0;i < args2.length; i++) {
|
|
158
|
+
const arg = args2[i];
|
|
159
|
+
if (arg === "--depth" && args2[i + 1]) {
|
|
160
|
+
depth = Number.parseInt(args2[++i], 10);
|
|
161
|
+
} else if (arg === "--compact") {
|
|
162
|
+
opts.compact = true;
|
|
163
|
+
opts.showDescriptions = false;
|
|
164
|
+
} else if (arg === "--no-flags") {
|
|
165
|
+
opts.showFlags = false;
|
|
166
|
+
} else if (arg === "--no-args") {
|
|
167
|
+
opts.showArgs = false;
|
|
168
|
+
} else if (arg === "--no-color") {
|
|
169
|
+
opts.color = false;
|
|
170
|
+
} else if (arg === "--format" && args2[i + 1]) {
|
|
171
|
+
format = args2[++i];
|
|
172
|
+
} else if (arg === "--stdin" && args2[i + 1]) {
|
|
173
|
+
stdinName = args2[++i];
|
|
174
|
+
} else if (!arg.startsWith("-")) {
|
|
175
|
+
binary = arg;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
let tree;
|
|
180
|
+
if (stdinName) {
|
|
181
|
+
const input = await readStdin();
|
|
182
|
+
tree = parseHelp(stdinName, input);
|
|
183
|
+
} else if (binary) {
|
|
184
|
+
tree = await parseHelpRecursive(binary, [], depth);
|
|
185
|
+
} else {
|
|
186
|
+
console.error("Error: provide a binary name or use --stdin <name>");
|
|
187
|
+
process.exit(1);
|
|
188
|
+
}
|
|
189
|
+
if (format === "json") {
|
|
190
|
+
console.log(JSON.stringify(tree, null, 2));
|
|
191
|
+
} else if (format === "html") {
|
|
192
|
+
console.log(treeToHtml(tree, opts));
|
|
193
|
+
} else if (format === "string") {
|
|
194
|
+
console.log(treeToString(tree, opts));
|
|
195
|
+
} else {
|
|
196
|
+
printTree(tree, opts);
|
|
197
|
+
}
|
|
198
|
+
} catch (err) {
|
|
199
|
+
console.error(`Error: ${err.message}`);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async function runFlow(args2) {
|
|
204
|
+
const opts = {
|
|
205
|
+
color: true,
|
|
206
|
+
showDescriptions: true,
|
|
207
|
+
showCommands: true,
|
|
208
|
+
compact: false
|
|
209
|
+
};
|
|
210
|
+
let format = "ansi";
|
|
211
|
+
let file = null;
|
|
212
|
+
let skipValidate = false;
|
|
213
|
+
for (let i = 0;i < args2.length; i++) {
|
|
214
|
+
const arg = args2[i];
|
|
215
|
+
if (arg === "--compact") {
|
|
216
|
+
opts.compact = true;
|
|
217
|
+
opts.showDescriptions = false;
|
|
218
|
+
} else if (arg === "--no-color") {
|
|
219
|
+
opts.color = false;
|
|
220
|
+
} else if (arg === "--no-validate") {
|
|
221
|
+
skipValidate = true;
|
|
222
|
+
} else if (arg === "--format" && args2[i + 1]) {
|
|
223
|
+
format = args2[++i];
|
|
224
|
+
} else if (!arg.startsWith("-")) {
|
|
225
|
+
file = arg;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (!file) {
|
|
229
|
+
console.error("Error: provide a workflow YAML file");
|
|
230
|
+
console.error("Run 'cli-tree flow --help' for usage");
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
const text = await Bun.file(file).text();
|
|
235
|
+
const workflow = parseWorkflow(text);
|
|
236
|
+
if (!skipValidate) {
|
|
237
|
+
const result = validateWorkflow(workflow);
|
|
238
|
+
for (const err of result.errors) {
|
|
239
|
+
const prefix = err.severity === "error" ? "\x1B[31m✗" : "\x1B[33m⚠";
|
|
240
|
+
const reset = "\x1B[0m";
|
|
241
|
+
const location = err.node ? ` [${err.node}]` : err.edge ? ` [${err.edge.from}→${err.edge.to}]` : "";
|
|
242
|
+
console.error(`${prefix}${location} ${err.message}${reset}`);
|
|
243
|
+
}
|
|
244
|
+
if (!result.valid)
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
if (format === "html") {
|
|
248
|
+
console.log(flowToHtml(workflow, opts));
|
|
249
|
+
} else if (format === "string") {
|
|
250
|
+
console.log(flowToString(workflow, opts));
|
|
251
|
+
} else {
|
|
252
|
+
console.log(flowToAnsi(workflow, opts));
|
|
253
|
+
}
|
|
254
|
+
} catch (err) {
|
|
255
|
+
console.error(`Error: ${err.message}`);
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async function readStdin() {
|
|
260
|
+
const chunks = [];
|
|
261
|
+
for await (const chunk of process.stdin) {
|
|
262
|
+
chunks.push(chunk);
|
|
263
|
+
}
|
|
264
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
265
|
+
}
|
|
266
|
+
async function runMine(args2) {
|
|
267
|
+
let binary = null;
|
|
268
|
+
let minSupport = 3;
|
|
269
|
+
let historyPath;
|
|
270
|
+
let format = "ansi";
|
|
271
|
+
let maxPaths = 10;
|
|
272
|
+
for (let i = 0;i < args2.length; i++) {
|
|
273
|
+
const arg = args2[i];
|
|
274
|
+
if (arg === "--min-support" && args2[i + 1]) {
|
|
275
|
+
minSupport = Number.parseInt(args2[++i], 10);
|
|
276
|
+
} else if (arg === "--history-path" && args2[i + 1]) {
|
|
277
|
+
historyPath = args2[++i];
|
|
278
|
+
} else if (arg === "--format" && args2[i + 1]) {
|
|
279
|
+
format = args2[++i];
|
|
280
|
+
} else if (arg === "--max-paths" && args2[i + 1]) {
|
|
281
|
+
maxPaths = Number.parseInt(args2[++i], 10);
|
|
282
|
+
} else if (!arg.startsWith("-")) {
|
|
283
|
+
binary = arg;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (!binary) {
|
|
287
|
+
console.error("Error: provide a binary name");
|
|
288
|
+
console.error("Run 'cli-tree mine --help' for usage");
|
|
289
|
+
process.exit(1);
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const result = await mineCli(binary, { minSupport, historyPath });
|
|
293
|
+
if (format === "json") {
|
|
294
|
+
console.log(JSON.stringify(result, null, 2));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const C = {
|
|
298
|
+
reset: "\x1B[0m",
|
|
299
|
+
bold: "\x1B[1m",
|
|
300
|
+
dim: "\x1B[2m",
|
|
301
|
+
cyan: "\x1B[36m",
|
|
302
|
+
green: "\x1B[32m",
|
|
303
|
+
yellow: "\x1B[33m",
|
|
304
|
+
magenta: "\x1B[35m",
|
|
305
|
+
gray: "\x1B[90m"
|
|
306
|
+
};
|
|
307
|
+
console.log(`
|
|
308
|
+
${C.bold}${C.magenta}${binary}${C.reset} ${C.gray}— shell history analysis${C.reset}
|
|
309
|
+
`);
|
|
310
|
+
console.log(`${C.bold}Usage:${C.reset}`);
|
|
311
|
+
console.log(` ${C.dim}Invocations:${C.reset} ${C.cyan}${result.stats.totalInvocations}${C.reset}`);
|
|
312
|
+
console.log(` ${C.dim}Subcommands:${C.reset} ${C.cyan}${result.stats.uniqueSubcommands}${C.reset}`);
|
|
313
|
+
console.log(` ${C.dim}Sessions:${C.reset} ${C.cyan}${result.sessionsAnalyzed}${C.reset}
|
|
314
|
+
`);
|
|
315
|
+
if (result.stats.topSubcommands.length > 0) {
|
|
316
|
+
console.log(`${C.bold}Top subcommands:${C.reset}`);
|
|
317
|
+
const max = result.stats.topSubcommands[0].count;
|
|
318
|
+
for (const { subcommand: subcommand2, count } of result.stats.topSubcommands.slice(0, 5)) {
|
|
319
|
+
const bar = "█".repeat(Math.max(1, Math.round(count / max * 30)));
|
|
320
|
+
console.log(` ${C.green}${subcommand2.padEnd(20)}${C.reset} ${C.cyan}${bar}${C.reset} ${C.dim}${count}${C.reset}`);
|
|
321
|
+
}
|
|
322
|
+
console.log();
|
|
323
|
+
}
|
|
324
|
+
if (result.workflows.length > 0) {
|
|
325
|
+
console.log(`${C.bold}Discovered workflows:${C.reset}`);
|
|
326
|
+
for (const wf of result.workflows.slice(0, maxPaths)) {
|
|
327
|
+
const chain = wf.path[0].map((p) => `${C.green}${p}${C.reset}`).join(` ${C.gray}→${C.reset} `);
|
|
328
|
+
console.log(` ${chain} ${C.dim}(${wf.support}×)${C.reset}`);
|
|
329
|
+
}
|
|
330
|
+
console.log();
|
|
331
|
+
}
|
|
332
|
+
if (result.suggestions.length > 0) {
|
|
333
|
+
console.log(`${C.bold}${C.yellow}\uD83D\uDCA1 Skill suggestions:${C.reset}`);
|
|
334
|
+
for (const s of result.suggestions.slice(0, 3)) {
|
|
335
|
+
const badge = s.priority === "high" ? `${C.green}[HIGH]${C.reset}` : s.priority === "medium" ? `${C.yellow}[MED]${C.reset}` : `${C.dim}[LOW]${C.reset}`;
|
|
336
|
+
console.log(`
|
|
337
|
+
${badge} ${C.bold}/${s.name}${C.reset} — ${s.description}`);
|
|
338
|
+
console.log(` ${C.dim}${s.reason}${C.reset}`);
|
|
339
|
+
console.log(` ${C.dim}${s.commands.join(" && ")}${C.reset}`);
|
|
340
|
+
}
|
|
341
|
+
console.log();
|
|
342
|
+
}
|
|
343
|
+
} catch (err) {
|
|
344
|
+
console.error(`Error: ${err.message}`);
|
|
345
|
+
process.exit(1);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
async function runArchaeologyCmd(args2) {
|
|
349
|
+
let binary = null;
|
|
350
|
+
let skipCache = false;
|
|
351
|
+
let maxDepth = 2;
|
|
352
|
+
let format = "ansi";
|
|
353
|
+
for (let i = 0;i < args2.length; i++) {
|
|
354
|
+
const arg = args2[i];
|
|
355
|
+
if (arg === "--no-cache") {
|
|
356
|
+
skipCache = true;
|
|
357
|
+
} else if (arg === "--max-depth" && args2[i + 1]) {
|
|
358
|
+
maxDepth = Number.parseInt(args2[++i], 10);
|
|
359
|
+
} else if (arg === "--format" && args2[i + 1]) {
|
|
360
|
+
format = args2[++i];
|
|
361
|
+
} else if (!arg.startsWith("-")) {
|
|
362
|
+
binary = arg;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (!binary) {
|
|
366
|
+
console.error("Error: provide a binary name");
|
|
367
|
+
console.error("Run 'cli-tree archaeology --help' for usage");
|
|
368
|
+
process.exit(1);
|
|
369
|
+
}
|
|
370
|
+
const C = {
|
|
371
|
+
reset: "\x1B[0m",
|
|
372
|
+
bold: "\x1B[1m",
|
|
373
|
+
dim: "\x1B[2m",
|
|
374
|
+
cyan: "\x1B[36m",
|
|
375
|
+
green: "\x1B[32m",
|
|
376
|
+
yellow: "\x1B[33m",
|
|
377
|
+
red: "\x1B[31m",
|
|
378
|
+
magenta: "\x1B[35m",
|
|
379
|
+
gray: "\x1B[90m"
|
|
380
|
+
};
|
|
381
|
+
try {
|
|
382
|
+
console.error(`${C.dim}⚠ LLM archaeology requires running inside the clitree skill.${C.reset}`);
|
|
383
|
+
console.error(`${C.dim} Running deterministic phases only (help + history mining).${C.reset}`);
|
|
384
|
+
console.error("");
|
|
385
|
+
const [arch, mine] = await Promise.all([
|
|
386
|
+
runArchaeology(binary, new NullDelegate, { skipCache, maxHelpDepth: maxDepth }),
|
|
387
|
+
mineCli(binary, { minSupport: 3 }).catch(() => null)
|
|
388
|
+
]);
|
|
389
|
+
if (format === "json") {
|
|
390
|
+
console.log(JSON.stringify({ archaeology: arch, mining: mine }, null, 2));
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
console.log(`${C.bold}${C.magenta}${binary}${C.reset}`);
|
|
394
|
+
if (arch.tree.description) {
|
|
395
|
+
console.log(`${C.gray}${arch.tree.description}${C.reset}`);
|
|
396
|
+
}
|
|
397
|
+
console.log();
|
|
398
|
+
console.log(`${C.bold}Tree:${C.reset}`);
|
|
399
|
+
console.log(` ${C.dim}Commands:${C.reset} ${C.cyan}${arch.stats.helpCommands}${C.reset}`);
|
|
400
|
+
console.log(` ${C.dim}Cached:${C.reset} ${arch.fromCache ? `${C.green}yes${C.reset}` : `${C.dim}no${C.reset}`}`);
|
|
401
|
+
console.log();
|
|
402
|
+
if (mine) {
|
|
403
|
+
console.log(`${C.bold}Usage from shell history:${C.reset}`);
|
|
404
|
+
console.log(` ${C.dim}Invocations:${C.reset} ${C.cyan}${mine.stats.totalInvocations}${C.reset}`);
|
|
405
|
+
console.log(` ${C.dim}Subcommands:${C.reset} ${C.cyan}${mine.stats.uniqueSubcommands}${C.reset}`);
|
|
406
|
+
if (mine.workflows.length > 0) {
|
|
407
|
+
console.log(`
|
|
408
|
+
${C.bold}Workflows you repeat:${C.reset}`);
|
|
409
|
+
for (const wf of mine.workflows.slice(0, 5)) {
|
|
410
|
+
const chain = wf.path[0].map((p) => `${C.green}${p}${C.reset}`).join(` ${C.gray}→${C.reset} `);
|
|
411
|
+
console.log(` ${chain} ${C.dim}(${wf.support}×)${C.reset}`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (mine.suggestions.length > 0) {
|
|
415
|
+
console.log(`
|
|
416
|
+
${C.bold}${C.yellow}\uD83D\uDCA1 Skill suggestions:${C.reset}`);
|
|
417
|
+
for (const s of mine.suggestions.slice(0, 3)) {
|
|
418
|
+
console.log(` ${C.bold}/${s.name}${C.reset} — ${s.description}`);
|
|
419
|
+
console.log(` ${C.dim}${s.reason}${C.reset}`);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
console.log();
|
|
424
|
+
console.log(`${C.dim}Install the clitree skill for full LLM archaeology:${C.reset}`);
|
|
425
|
+
console.log(`${C.dim} bash ./skill/install.sh${C.reset}`);
|
|
426
|
+
console.log();
|
|
427
|
+
} catch (err) {
|
|
428
|
+
console.error(`${C.red}Error: ${err.message}${C.reset}`);
|
|
429
|
+
process.exit(1);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
//# debugId=0D7762FF3B565BB064756E2164756E21
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"#!/usr/bin/env bun\nimport { parseHelpRecursive, parseHelp } from \"./parse\";\nimport { printTree, treeToString, treeToHtml } from \"./index\";\nimport type { TreeOptions } from \"./types\";\nimport { parseWorkflow, validateWorkflow, flowToAnsi, flowToString, flowToHtml } from \"./flow\";\nimport type { FlowRenderOptions } from \"./flow/types\";\nimport { mineCli } from \"./miner\";\nimport { runArchaeology, NullDelegate } from \"./archaeology\";\n\nconst args = process.argv.slice(2);\nconst subcommand = args[0];\n\nconst HELP_SUBCOMMANDS = new Set([\"flow\", \"mine\", \"archaeology\"]);\nconst isHelpFlag = args.includes(\"--help\") || args.includes(\"-h\");\n\nif (!subcommand || (isHelpFlag && !HELP_SUBCOMMANDS.has(subcommand ?? \"\"))) {\n\tprintMainHelp();\n\tprocess.exit(0);\n}\n\nif (isHelpFlag) {\n\tif (subcommand === \"flow\") printFlowHelp();\n\telse if (subcommand === \"mine\") printMineHelp();\n\telse if (subcommand === \"archaeology\") printArchaeologyHelp();\n\telse printMainHelp();\n\tprocess.exit(0);\n}\n\nif (subcommand === \"flow\") {\n\tawait runFlow(args.slice(1));\n} else if (subcommand === \"mine\") {\n\tawait runMine(args.slice(1));\n} else if (subcommand === \"archaeology\") {\n\tawait runArchaeologyCmd(args.slice(1));\n} else {\n\tawait runTree(args);\n}\n\nfunction printMainHelp() {\n\tconsole.log(`\n clitree — Visualize and explore any CLI\n\n Usage:\n clitree <binary> [options] Render command tree from --help\n clitree flow <file> [options] Render a workflow YAML as a DAG\n clitree mine <binary> [options] Mine shell history for workflows\n clitree archaeology <binary> [options] Full analysis: tree + mining + (LLM)\n\n Examples:\n clitree docker # basic tree\n clitree mine git # \"what workflows do I repeat with git?\"\n clitree archaeology bun # tree + mining + LLM archaeology\n\n Subcommands:\n tree Parse --help output (default; passing a binary name invokes this)\n flow Render a workflow YAML file as an ASCII DAG\n mine Discover workflows from your shell history\n archaeology Run full analysis (tree + mine + LLM proposals when available)\n\n Help for a subcommand: clitree <subcommand> --help\n`);\n}\n\nfunction printMineHelp() {\n\tconsole.log(`\n cli-tree mine — Mine your shell history for CLI workflows\n\n Usage:\n cli-tree mine <binary> [options]\n\n Examples:\n cli-tree mine git\n cli-tree mine docker --min-support 5\n cli-tree mine bun --format json > bun-flows.json\n\n Options:\n --min-support <n> Minimum occurrences to count as a workflow (default: 3)\n --history-path <p> Custom shell history path (default: ~/.zsh_history)\n --format <fmt> Output format: ansi (default), json\n --max-paths <n> Max workflows to show (default: 10)\n -h, --help Show this help\n`);\n}\n\nfunction printArchaeologyHelp() {\n\tconsole.log(`\n cli-tree archaeology — Full CLI analysis: tree + mining + LLM archaeology\n\n Usage:\n cli-tree archaeology <binary> [options]\n\n When run from the command line without a delegate, only the deterministic\n phases run (help parsing + shell history mining). LLM archaeology requires\n running inside the clitree skill (see ./skill/SKILL.md).\n\n Examples:\n cli-tree archaeology git # help + history\n cli-tree archaeology docker --no-cache # bypass cache\n cli-tree archaeology bun --format json # JSON output\n\n Options:\n --no-cache Skip cache, always re-run\n --max-depth <n> Max --help recursion depth (default: 2)\n --format <fmt> Output format: ansi (default), json\n -h, --help Show this help\n`);\n}\n\nfunction printFlowHelp() {\n\tconsole.log(`\n cli-tree flow — Render a CLI workflow YAML as a DAG\n\n Usage:\n cli-tree flow <file> [options]\n\n Examples:\n cli-tree flow workflows/git-pr-flow.yml\n cli-tree flow my-workflow.yml --format html > flow.html\n cli-tree flow workflows/docker-deploy.yml --compact --no-color\n\n Options:\n --compact Hide description and legend\n --no-color Disable colors\n --format <fmt> Output format: ansi (default), string, html\n --no-validate Skip validation\n -h, --help Show this help\n`);\n}\n\nasync function runTree(args: string[]) {\n\tconst opts: TreeOptions = {\n\t\tcolor: true,\n\t\tshowFlags: true,\n\t\tshowArgs: true,\n\t\tshowDescriptions: true,\n\t\tshowTypes: true,\n\t\tshowDefaults: true,\n\t\tcompact: false,\n\t};\n\n\tlet depth = 2;\n\tlet format: \"ansi\" | \"string\" | \"html\" | \"json\" = \"ansi\";\n\tlet stdinName: string | null = null;\n\tlet binary: string | null = null;\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i]!;\n\t\tif (arg === \"--depth\" && args[i + 1]) {\n\t\t\tdepth = Number.parseInt(args[++i]!, 10);\n\t\t} else if (arg === \"--compact\") {\n\t\t\topts.compact = true;\n\t\t\topts.showDescriptions = false;\n\t\t} else if (arg === \"--no-flags\") {\n\t\t\topts.showFlags = false;\n\t\t} else if (arg === \"--no-args\") {\n\t\t\topts.showArgs = false;\n\t\t} else if (arg === \"--no-color\") {\n\t\t\topts.color = false;\n\t\t} else if (arg === \"--format\" && args[i + 1]) {\n\t\t\tformat = args[++i] as \"ansi\" | \"string\" | \"html\" | \"json\";\n\t\t} else if (arg === \"--stdin\" && args[i + 1]) {\n\t\t\tstdinName = args[++i]!;\n\t\t} else if (!arg.startsWith(\"-\")) {\n\t\t\tbinary = arg;\n\t\t}\n\t}\n\n\ttry {\n\t\tlet tree;\n\t\tif (stdinName) {\n\t\t\tconst input = await readStdin();\n\t\t\ttree = parseHelp(stdinName, input);\n\t\t} else if (binary) {\n\t\t\ttree = await parseHelpRecursive(binary, [], depth);\n\t\t} else {\n\t\t\tconsole.error(\"Error: provide a binary name or use --stdin <name>\");\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tif (format === \"json\") {\n\t\t\tconsole.log(JSON.stringify(tree, null, 2));\n\t\t} else if (format === \"html\") {\n\t\t\tconsole.log(treeToHtml(tree, opts));\n\t\t} else if (format === \"string\") {\n\t\t\tconsole.log(treeToString(tree, opts));\n\t\t} else {\n\t\t\tprintTree(tree, opts);\n\t\t}\n\t} catch (err: any) {\n\t\tconsole.error(`Error: ${err.message}`);\n\t\tprocess.exit(1);\n\t}\n}\n\nasync function runFlow(args: string[]) {\n\tconst opts: FlowRenderOptions = {\n\t\tcolor: true,\n\t\tshowDescriptions: true,\n\t\tshowCommands: true,\n\t\tcompact: false,\n\t};\n\n\tlet format: \"ansi\" | \"string\" | \"html\" = \"ansi\";\n\tlet file: string | null = null;\n\tlet skipValidate = false;\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i]!;\n\t\tif (arg === \"--compact\") {\n\t\t\topts.compact = true;\n\t\t\topts.showDescriptions = false;\n\t\t} else if (arg === \"--no-color\") {\n\t\t\topts.color = false;\n\t\t} else if (arg === \"--no-validate\") {\n\t\t\tskipValidate = true;\n\t\t} else if (arg === \"--format\" && args[i + 1]) {\n\t\t\tformat = args[++i] as \"ansi\" | \"string\" | \"html\";\n\t\t} else if (!arg.startsWith(\"-\")) {\n\t\t\tfile = arg;\n\t\t}\n\t}\n\n\tif (!file) {\n\t\tconsole.error(\"Error: provide a workflow YAML file\");\n\t\tconsole.error(\"Run 'cli-tree flow --help' for usage\");\n\t\tprocess.exit(1);\n\t}\n\n\ttry {\n\t\tconst text = await Bun.file(file).text();\n\t\tconst workflow = parseWorkflow(text);\n\n\t\tif (!skipValidate) {\n\t\t\tconst result = validateWorkflow(workflow);\n\t\t\tfor (const err of result.errors) {\n\t\t\t\tconst prefix = err.severity === \"error\" ? \"\\x1b[31m✗\" : \"\\x1b[33m⚠\";\n\t\t\t\tconst reset = \"\\x1b[0m\";\n\t\t\t\tconst location = err.node ? ` [${err.node}]` : err.edge ? ` [${err.edge.from}→${err.edge.to}]` : \"\";\n\t\t\t\tconsole.error(`${prefix}${location} ${err.message}${reset}`);\n\t\t\t}\n\t\t\tif (!result.valid) process.exit(1);\n\t\t}\n\n\t\tif (format === \"html\") {\n\t\t\tconsole.log(flowToHtml(workflow, opts));\n\t\t} else if (format === \"string\") {\n\t\t\tconsole.log(flowToString(workflow, opts));\n\t\t} else {\n\t\t\tconsole.log(flowToAnsi(workflow, opts));\n\t\t}\n\t} catch (err: any) {\n\t\tconsole.error(`Error: ${err.message}`);\n\t\tprocess.exit(1);\n\t}\n}\n\nasync function readStdin(): Promise<string> {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of process.stdin) {\n\t\tchunks.push(chunk as Buffer);\n\t}\n\treturn Buffer.concat(chunks).toString(\"utf-8\");\n}\n\nasync function runMine(args: string[]) {\n\tlet binary: string | null = null;\n\tlet minSupport = 3;\n\tlet historyPath: string | undefined;\n\tlet format: \"ansi\" | \"json\" = \"ansi\";\n\tlet maxPaths = 10;\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i]!;\n\t\tif (arg === \"--min-support\" && args[i + 1]) {\n\t\t\tminSupport = Number.parseInt(args[++i]!, 10);\n\t\t} else if (arg === \"--history-path\" && args[i + 1]) {\n\t\t\thistoryPath = args[++i]!;\n\t\t} else if (arg === \"--format\" && args[i + 1]) {\n\t\t\tformat = args[++i] as \"ansi\" | \"json\";\n\t\t} else if (arg === \"--max-paths\" && args[i + 1]) {\n\t\t\tmaxPaths = Number.parseInt(args[++i]!, 10);\n\t\t} else if (!arg.startsWith(\"-\")) {\n\t\t\tbinary = arg;\n\t\t}\n\t}\n\n\tif (!binary) {\n\t\tconsole.error(\"Error: provide a binary name\");\n\t\tconsole.error(\"Run 'cli-tree mine --help' for usage\");\n\t\tprocess.exit(1);\n\t}\n\n\ttry {\n\t\tconst result = await mineCli(binary, { minSupport, historyPath });\n\n\t\tif (format === \"json\") {\n\t\t\tconsole.log(JSON.stringify(result, null, 2));\n\t\t\treturn;\n\t\t}\n\n\t\tconst C = {\n\t\t\treset: \"\\x1b[0m\",\n\t\t\tbold: \"\\x1b[1m\",\n\t\t\tdim: \"\\x1b[2m\",\n\t\t\tcyan: \"\\x1b[36m\",\n\t\t\tgreen: \"\\x1b[32m\",\n\t\t\tyellow: \"\\x1b[33m\",\n\t\t\tmagenta: \"\\x1b[35m\",\n\t\t\tgray: \"\\x1b[90m\",\n\t\t};\n\n\t\tconsole.log(`\\n${C.bold}${C.magenta}${binary}${C.reset} ${C.gray}— shell history analysis${C.reset}\\n`);\n\t\tconsole.log(`${C.bold}Usage:${C.reset}`);\n\t\tconsole.log(` ${C.dim}Invocations:${C.reset} ${C.cyan}${result.stats.totalInvocations}${C.reset}`);\n\t\tconsole.log(` ${C.dim}Subcommands:${C.reset} ${C.cyan}${result.stats.uniqueSubcommands}${C.reset}`);\n\t\tconsole.log(` ${C.dim}Sessions:${C.reset} ${C.cyan}${result.sessionsAnalyzed}${C.reset}\\n`);\n\n\t\tif (result.stats.topSubcommands.length > 0) {\n\t\t\tconsole.log(`${C.bold}Top subcommands:${C.reset}`);\n\t\t\tconst max = result.stats.topSubcommands[0]!.count;\n\t\t\tfor (const { subcommand, count } of result.stats.topSubcommands.slice(0, 5)) {\n\t\t\t\tconst bar = \"█\".repeat(Math.max(1, Math.round((count / max) * 30)));\n\t\t\t\tconsole.log(` ${C.green}${subcommand.padEnd(20)}${C.reset} ${C.cyan}${bar}${C.reset} ${C.dim}${count}${C.reset}`);\n\t\t\t}\n\t\t\tconsole.log();\n\t\t}\n\n\t\tif (result.workflows.length > 0) {\n\t\t\tconsole.log(`${C.bold}Discovered workflows:${C.reset}`);\n\t\t\tfor (const wf of result.workflows.slice(0, maxPaths)) {\n\t\t\t\tconst chain = wf.path[0]!.map(p => `${C.green}${p}${C.reset}`).join(` ${C.gray}→${C.reset} `);\n\t\t\t\tconsole.log(` ${chain} ${C.dim}(${wf.support}×)${C.reset}`);\n\t\t\t}\n\t\t\tconsole.log();\n\t\t}\n\n\t\tif (result.suggestions.length > 0) {\n\t\t\tconsole.log(`${C.bold}${C.yellow}💡 Skill suggestions:${C.reset}`);\n\t\t\tfor (const s of result.suggestions.slice(0, 3)) {\n\t\t\t\tconst badge =\n\t\t\t\t\ts.priority === \"high\"\n\t\t\t\t\t\t? `${C.green}[HIGH]${C.reset}`\n\t\t\t\t\t\t: s.priority === \"medium\"\n\t\t\t\t\t\t\t? `${C.yellow}[MED]${C.reset}`\n\t\t\t\t\t\t\t: `${C.dim}[LOW]${C.reset}`;\n\t\t\t\tconsole.log(`\\n ${badge} ${C.bold}/${s.name}${C.reset} — ${s.description}`);\n\t\t\t\tconsole.log(` ${C.dim}${s.reason}${C.reset}`);\n\t\t\t\tconsole.log(` ${C.dim}${s.commands.join(\" && \")}${C.reset}`);\n\t\t\t}\n\t\t\tconsole.log();\n\t\t}\n\t} catch (err: any) {\n\t\tconsole.error(`Error: ${err.message}`);\n\t\tprocess.exit(1);\n\t}\n}\n\nasync function runArchaeologyCmd(args: string[]) {\n\tlet binary: string | null = null;\n\tlet skipCache = false;\n\tlet maxDepth = 2;\n\tlet format: \"ansi\" | \"json\" = \"ansi\";\n\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i]!;\n\t\tif (arg === \"--no-cache\") {\n\t\t\tskipCache = true;\n\t\t} else if (arg === \"--max-depth\" && args[i + 1]) {\n\t\t\tmaxDepth = Number.parseInt(args[++i]!, 10);\n\t\t} else if (arg === \"--format\" && args[i + 1]) {\n\t\t\tformat = args[++i] as \"ansi\" | \"json\";\n\t\t} else if (!arg.startsWith(\"-\")) {\n\t\t\tbinary = arg;\n\t\t}\n\t}\n\n\tif (!binary) {\n\t\tconsole.error(\"Error: provide a binary name\");\n\t\tconsole.error(\"Run 'cli-tree archaeology --help' for usage\");\n\t\tprocess.exit(1);\n\t}\n\n\tconst C = {\n\t\treset: \"\\x1b[0m\",\n\t\tbold: \"\\x1b[1m\",\n\t\tdim: \"\\x1b[2m\",\n\t\tcyan: \"\\x1b[36m\",\n\t\tgreen: \"\\x1b[32m\",\n\t\tyellow: \"\\x1b[33m\",\n\t\tred: \"\\x1b[31m\",\n\t\tmagenta: \"\\x1b[35m\",\n\t\tgray: \"\\x1b[90m\",\n\t};\n\n\ttry {\n\t\tconsole.error(`${C.dim}⚠ LLM archaeology requires running inside the clitree skill.${C.reset}`);\n\t\tconsole.error(`${C.dim} Running deterministic phases only (help + history mining).${C.reset}`);\n\t\tconsole.error(\"\");\n\n\t\tconst [arch, mine] = await Promise.all([\n\t\t\trunArchaeology(binary, new NullDelegate(), { skipCache, maxHelpDepth: maxDepth }),\n\t\t\tmineCli(binary, { minSupport: 3 }).catch(() => null),\n\t\t]);\n\n\t\tif (format === \"json\") {\n\t\t\tconsole.log(JSON.stringify({ archaeology: arch, mining: mine }, null, 2));\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.log(`${C.bold}${C.magenta}${binary}${C.reset}`);\n\t\tif (arch.tree.description) {\n\t\t\tconsole.log(`${C.gray}${arch.tree.description}${C.reset}`);\n\t\t}\n\t\tconsole.log();\n\n\t\tconsole.log(`${C.bold}Tree:${C.reset}`);\n\t\tconsole.log(` ${C.dim}Commands:${C.reset} ${C.cyan}${arch.stats.helpCommands}${C.reset}`);\n\t\tconsole.log(` ${C.dim}Cached:${C.reset} ${arch.fromCache ? `${C.green}yes${C.reset}` : `${C.dim}no${C.reset}`}`);\n\t\tconsole.log();\n\n\t\tif (mine) {\n\t\t\tconsole.log(`${C.bold}Usage from shell history:${C.reset}`);\n\t\t\tconsole.log(` ${C.dim}Invocations:${C.reset} ${C.cyan}${mine.stats.totalInvocations}${C.reset}`);\n\t\t\tconsole.log(` ${C.dim}Subcommands:${C.reset} ${C.cyan}${mine.stats.uniqueSubcommands}${C.reset}`);\n\n\t\t\tif (mine.workflows.length > 0) {\n\t\t\t\tconsole.log(`\\n${C.bold}Workflows you repeat:${C.reset}`);\n\t\t\t\tfor (const wf of mine.workflows.slice(0, 5)) {\n\t\t\t\t\tconst chain = wf.path[0]!.map(p => `${C.green}${p}${C.reset}`).join(` ${C.gray}→${C.reset} `);\n\t\t\t\t\tconsole.log(` ${chain} ${C.dim}(${wf.support}×)${C.reset}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (mine.suggestions.length > 0) {\n\t\t\t\tconsole.log(`\\n${C.bold}${C.yellow}💡 Skill suggestions:${C.reset}`);\n\t\t\t\tfor (const s of mine.suggestions.slice(0, 3)) {\n\t\t\t\t\tconsole.log(` ${C.bold}/${s.name}${C.reset} — ${s.description}`);\n\t\t\t\t\tconsole.log(` ${C.dim}${s.reason}${C.reset}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconsole.log();\n\t\tconsole.log(`${C.dim}Install the clitree skill for full LLM archaeology:${C.reset}`);\n\t\tconsole.log(`${C.dim} bash ./skill/install.sh${C.reset}`);\n\t\tconsole.log();\n\t} catch (err: any) {\n\t\tconsole.error(`${C.red}Error: ${err.message}${C.reset}`);\n\t\tprocess.exit(1);\n\t}\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,IAAM,aAAa,KAAK;AAEx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KAAK,SAAS,EAAE,OAAO,GAAG,YAAW,EAAE,OAAO;AAAA,QAC3D;AAAA,MACD;AAAA,MAEA,IAAI,KAAK,YAAY,SAAS,GAAG;AAAA,QAChC,QAAQ,IAAI;AAAA,EAAK,EAAE,OAAO,EAAE,wCAA6B,EAAE,OAAO;AAAA,QAClE,WAAW,KAAK,KAAK,YAAY,MAAM,GAAG,CAAC,GAAG;AAAA,UAC7C,QAAQ,IAAI,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAU,EAAE,aAAa;AAAA,UAC/D,QAAQ,IAAI,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO;AAAA,QAChD;AAAA,MACD;AAAA,IACD;AAAA,IAEA,QAAQ,IAAI;AAAA,IACZ,QAAQ,IAAI,GAAG,EAAE,yDAAyD,EAAE,OAAO;AAAA,IACnF,QAAQ,IAAI,GAAG,EAAE,+BAA+B,EAAE,OAAO;AAAA,IACzD,QAAQ,IAAI;AAAA,IACX,OAAO,KAAU;AAAA,IAClB,QAAQ,MAAM,GAAG,EAAE,aAAa,IAAI,UAAU,EAAE,OAAO;AAAA,IACvD,QAAQ,KAAK,CAAC;AAAA;AAAA;",
|
|
8
|
+
"debugId": "0D7762FF3B565BB064756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Grid } from "../grid";
|
|
2
|
+
export interface HtmlEncodeOptions {
|
|
3
|
+
wrap?: boolean;
|
|
4
|
+
background?: string;
|
|
5
|
+
foreground?: string;
|
|
6
|
+
fontFamily?: string;
|
|
7
|
+
fontSize?: string;
|
|
8
|
+
padding?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function encodeHtml(grid: Grid, opts?: HtmlEncodeOptions): string;
|