@kolisachint/hoocode-agent 0.4.43 → 0.4.44
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/CHANGELOG.md +2 -0
- package/README.md +3 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +10 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/subagent-pool.d.ts.map +1 -1
- package/dist/core/subagent-pool.js +4 -2
- package/dist/core/subagent-pool.js.map +1 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +1 -1
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/task-panel.d.ts +2 -2
- package/dist/modes/interactive/components/task-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-panel.js +10 -5
- package/dist/modes/interactive/components/task-panel.js.map +1 -1
- package/dist/resources-cli.d.ts +2 -0
- package/dist/resources-cli.d.ts.map +1 -0
- package/dist/resources-cli.js +184 -0
- package/dist/resources-cli.js.map +1 -0
- package/docs/docs.json +4 -0
- package/docs/project-local-resources.md +124 -0
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-panel.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-panel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,KAAK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C,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAEjF,MAAM,KAAK,GAAa,CAAC,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;QAChF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import type { Component, TUI } from \"@kolisachint/hoocode-tui\";\nimport { truncateToWidth, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport type { Task, TaskSource, TaskStatus } from \"../../../core/task-store.js\";\nimport { taskStore } from \"../../../core/task-store.js\";\nimport { theme } from \"../theme/theme.js\";\n\nconst TASK_STATUS_ICON: Record<TaskStatus, string> = {\n\tpending: \"●\",\n\tin_progress: \"◐\",\n\tdone: \"✓\",\n\tfailed: \"✗\",\n};\n\n/**\n * A single-cell source marker placed before the id so a subagent row and an MCP\n * row are distinguishable at a glance. Plain tasks reserve the cell (blank) to keep\n * the id column aligned. Deliberately a glyph, not a text tag — the pane stays\n * tag-free (no `[explore]`); the glyph just says *where the work came from*.\n */\nconst TASK_SOURCE_GLYPH: Record<TaskSource, string> = {\n\tsubagent: \"⚙\",\n\tmcp: \"⧉\",\n};\n\n/** Braille spinner frames + cadence, matched to the TUI Loader so the active row animates in step. */\nconst SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nconst SPINNER_INTERVAL_MS = 80;\n\n/** A thin colored left rail groups the pane without a box, the way the design's `border-left` does. */\nconst RAIL = \"▎\";\n\n/** Cells in the deterministic progress bar (matches the design's 14-cell track). */\nconst PROGRESS_CELLS = 14;\n\n/** Overall pane state, derived from the task statuses. Drives the rail color + header stamp. */\ntype PanelState = \"working\" | \"reviewed\" | \"stopped\";\n\ninterface StatePresentation {\n\treadonly icon: string;\n\treadonly label: string;\n\treadonly color: \"warning\" | \"success\" | \"error\";\n}\n\nconst STATE_PRESENTATION: Record<PanelState, StatePresentation> = {\n\tworking: { icon: \"◐\", label: \"working\", color: \"warning\" },\n\treviewed: { icon: \"✓\", label: \"reviewed\", color: \"success\" },\n\tstopped: { icon: \"✗\", label: \"stopped\", color: \"error\" },\n};\n\nfunction panelState(tasks: readonly Task[]): PanelState {\n\tif (tasks.some((t) => t.status === \"failed\")) return \"stopped\";\n\tconst active = tasks.some((t) => t.status === \"in_progress\" || t.status === \"pending\");\n\treturn active ? \"working\" : \"reviewed\";\n}\n\nfunction taskStatusColor(status: TaskStatus): \"dim\" | \"warning\" | \"success\" | \"error\" {\n\tswitch (status) {\n\t\tcase \"in_progress\":\n\t\t\treturn \"warning\";\n\t\tcase \"done\":\n\t\t\treturn \"success\";\n\t\tcase \"failed\":\n\t\t\treturn \"error\";\n\t\tdefault:\n\t\t\treturn \"dim\";\n\t}\n}\n\n/** Format a duration in seconds into a compact, terminal-friendly string. */\nfunction formatDuration(secs: number): string {\n\tconst s = Math.max(0, secs);\n\tif (s < 10) return `${s.toFixed(1)}s`;\n\tif (s < 60) return `${Math.round(s)}s`;\n\tconst mins = Math.floor(s / 60);\n\tconst rem = Math.round(s % 60);\n\treturn `${mins}m${rem.toString().padStart(2, \"0\")}s`;\n}\n\n/** Wall-clock time a task occupied, derived from its create/update stamps. */\nfunction taskElapsedSecs(task: Task): number {\n\treturn Math.max(0, (task.updatedAt - task.createdAt) / 1000);\n}\n\n/** Sum the token + cost usage reported by the tasks shown this turn. */\nfunction sumTurnUsage(tasks: readonly Task[]): { input: number; output: number; cost: number } | null {\n\tlet input = 0;\n\tlet output = 0;\n\tlet cost = 0;\n\tfor (const task of tasks) {\n\t\tif (!task.usage) continue;\n\t\tinput += task.usage.input;\n\t\toutput += task.usage.output;\n\t\tcost += task.usage.cost;\n\t}\n\tif (input === 0 && output === 0 && cost === 0) return null;\n\treturn { input, output, cost };\n}\n\n/**\n * Deterministic block-glyph progress bar: a heavy run (━) for the completed\n * fraction over a dim track. In-progress tasks count as half, so the bar moves\n * the moment work starts. Fraction is the only input — no animation, no guess.\n */\nfunction progressBar(done: number, active: number, total: number): { plain: string; styled: string } {\n\tconst ratio = total > 0 ? Math.max(0, Math.min(1, (done + active * 0.5) / total)) : 0;\n\tconst filled = Math.round(ratio * PROGRESS_CELLS);\n\tconst fill = \"━\".repeat(filled);\n\tconst track = \"━\".repeat(PROGRESS_CELLS - filled);\n\treturn {\n\t\tplain: fill + track,\n\t\tstyled: theme.fg(\"success\", fill) + theme.fg(\"dim\", track),\n\t};\n}\n\n/**\n * Ledger header: a state stamp (◐ working / ✓ reviewed / ✗ stopped) + a\n * deterministic progress bar and done/total count on the left, and the per-turn\n * token + elapsed + cost delta (summed across the tasks below) on the right.\n */\nfunction formatHeader(tasks: readonly Task[], width: number, state: PanelState, totalSecs: number): string {\n\tconst total = tasks.length;\n\tconst done = tasks.filter((t) => t.status === \"done\").length;\n\tconst active = tasks.filter((t) => t.status === \"in_progress\").length;\n\n\tconst { icon, label, color } = STATE_PRESENTATION[state];\n\tconst stampPlain = `${icon} ${label.toUpperCase()}`;\n\tconst stamp = `${theme.fg(color, icon)} ${theme.bold(theme.fg(color, label.toUpperCase()))}`;\n\n\tconst bar = progressBar(done, active, total);\n\tconst countPlain = `${done}/${total}`;\n\tconst count = theme.fg(\"muted\", `${done}`) + theme.fg(\"dim\", \"/\") + theme.fg(\"muted\", `${total}`);\n\n\t// Left cluster has a full form (stamp · bar · count) and a compact fallback\n\t// (stamp · count) that drops the bar when the terminal is too narrow.\n\tconst leftFullPlain = `${stampPlain} ${bar.plain} ${countPlain}`;\n\tconst leftFull = `${stamp} ${bar.styled} ${count}`;\n\tconst leftMinPlain = `${stampPlain} ${countPlain}`;\n\tconst leftMin = `${stamp} ${count}`;\n\n\tconst turn = sumTurnUsage(tasks);\n\tlet turnPlain = \"\";\n\tlet turnText = \"\";\n\tif (turn) {\n\t\tconst inTok = formatTokens(turn.input);\n\t\tconst outTok = formatTokens(turn.output);\n\t\tconst elapsed = formatDuration(totalSecs);\n\t\tconst showCost = turn.cost > 0;\n\t\tconst costStr = showCost ? `$${turn.cost.toFixed(3)}` : \"\";\n\t\tturnPlain = `turn ↑${inTok} ↓${outTok} · ${elapsed}${showCost ? ` · ${costStr}` : \"\"}`;\n\t\t// Turn delta: muted framing, numbers one step brighter (bold), separators dim.\n\t\tturnText =\n\t\t\ttheme.fg(\"muted\", \"turn ↑\") +\n\t\t\ttheme.bold(inTok) +\n\t\t\ttheme.fg(\"muted\", \" ↓\") +\n\t\t\ttheme.bold(outTok) +\n\t\t\ttheme.fg(\"dim\", \" · \") +\n\t\t\ttheme.fg(\"muted\", elapsed) +\n\t\t\t(showCost ? theme.fg(\"dim\", \" · \") + theme.bold(costStr) : \"\");\n\t}\n\n\tif (turnPlain) {\n\t\tif (visibleWidth(leftFullPlain) + 2 + visibleWidth(turnPlain) <= width) {\n\t\t\tconst pad = Math.max(2, width - visibleWidth(leftFullPlain) - visibleWidth(turnPlain));\n\t\t\treturn leftFull + \" \".repeat(pad) + turnText;\n\t\t}\n\t\tif (visibleWidth(leftMinPlain) + 2 + visibleWidth(turnPlain) <= width) {\n\t\t\tconst pad = Math.max(2, width - visibleWidth(leftMinPlain) - visibleWidth(turnPlain));\n\t\t\treturn leftMin + \" \".repeat(pad) + turnText;\n\t\t}\n\t}\n\tif (visibleWidth(leftFullPlain) <= width) return leftFull;\n\treturn truncateToWidth(leftMin, width, \"…\");\n}\n\nfunction formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\treturn `${(count / 1000000).toFixed(1)}M`;\n}\n\nfunction formatTaskLine(task: Task, width: number, frame: number, idColWidth: number): string {\n\tconst isProgress = task.status === \"in_progress\";\n\tconst iconGlyph = isProgress\n\t\t? (SPINNER_FRAMES[frame] ?? TASK_STATUS_ICON.in_progress)\n\t\t: TASK_STATUS_ICON[task.status];\n\tconst icon = theme.fg(taskStatusColor(task.status), iconGlyph);\n\n\t// Source marker between the status icon and the id. Reserve the cell (blank) for\n\t// plain tasks so ids stay column-aligned whether or not a glyph is present.\n\tconst sourceGlyph = task.source ? TASK_SOURCE_GLYPH[task.source] : \" \";\n\tconst styledSource = task.source ? theme.fg(\"dim\", sourceGlyph) : \" \";\n\n\t// Right-pad the id to the shared column width so titles line up across rows even\n\t// when ids differ in digit count (#1 vs #10). Padding is plain spaces inside the\n\t// dim styling, so it adds no visible color.\n\tconst idLabel = `#${task.id}`.padEnd(idColWidth);\n\tconst title = task.title;\n\t// The id recedes (dim); the title carries the line. Done titles fade to muted\n\t// (settled work), pending dim (not started), active goes bold, failed turns red.\n\tconst styledId = theme.fg(\"dim\", idLabel);\n\tlet styledTitle: string;\n\tswitch (task.status) {\n\t\tcase \"done\":\n\t\t\tstyledTitle = theme.fg(\"muted\", title);\n\t\t\tbreak;\n\t\tcase \"pending\":\n\t\t\tstyledTitle = theme.fg(\"dim\", title);\n\t\t\tbreak;\n\t\tcase \"failed\":\n\t\t\tstyledTitle = theme.fg(\"error\", title);\n\t\t\tbreak;\n\t\tcase \"in_progress\":\n\t\t\tstyledTitle = theme.bold(title);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstyledTitle = title;\n\t}\n\n\t// Right column: settled rows carry their audit stamp (tokens + elapsed); the\n\t// active row reads `running…`, pending rows read `queued`.\n\tlet rightPlain = \"\";\n\tlet rightStyled = \"\";\n\tif (task.status === \"done\" || task.status === \"failed\") {\n\t\tconst parts: string[] = [];\n\t\tlet tokenText = \"\";\n\t\tif (task.usage) {\n\t\t\tconst totalTok = task.usage.input + task.usage.output;\n\t\t\tif (totalTok > 0) tokenText = formatTokens(totalTok);\n\t\t}\n\t\tconst elapsed = formatDuration(taskElapsedSecs(task));\n\t\tif (tokenText) {\n\t\t\tparts.push(tokenText, elapsed);\n\t\t\trightStyled = theme.fg(\"muted\", tokenText) + theme.fg(\"dim\", ` · ${elapsed}`);\n\t\t} else {\n\t\t\tparts.push(elapsed);\n\t\t\trightStyled = theme.fg(\"dim\", elapsed);\n\t\t}\n\t\trightPlain = parts.join(\" · \");\n\t} else if (task.status === \"in_progress\") {\n\t\trightPlain = \"running…\";\n\t\trightStyled = theme.fg(\"warning\", rightPlain);\n\t} else if (task.status === \"pending\") {\n\t\trightPlain = \"queued\";\n\t\trightStyled = theme.fg(\"dim\", rightPlain);\n\t}\n\n\t// A warning note (e.g. inherited-model fallback, exhaustion skip) takes over the\n\t// right column as a ⚠ cue, replacing the usage/status stamp for that row.\n\tif (task.note) {\n\t\trightPlain = `⚠ ${task.note}`;\n\t\trightStyled = theme.fg(\"warning\", rightPlain);\n\t}\n\n\tconst rightWidth = rightPlain ? visibleWidth(rightPlain) + 1 : 0;\n\tconst leftWidth = Math.max(0, width - rightWidth);\n\n\t// truncateToWidth measures visible width (ANSI-aware), so the styled left can be\n\t// truncated against the full left budget directly. Subtracting the prefix here\n\t// (as a prior version did) truncated titles early and unevenly per id width.\n\tconst left = truncateToWidth(`${icon} ${styledSource} ${styledId} ${styledTitle}`, leftWidth, \"…\");\n\n\tif (!rightPlain) return left;\n\n\tconst pad = Math.max(1, width - visibleWidth(left) - visibleWidth(rightPlain));\n\treturn left + \" \".repeat(pad) + rightStyled;\n}\n\n/**\n * Task panel rendered just above the editor prompt.\n *\n * - A state-colored left rail groups the pane (working=warning, reviewed=success,\n * stopped=error) without drawing a box.\n * - A ledger header tops the list: a state stamp + deterministic progress bar +\n * done/total count on the left, the per-turn token/elapsed/cost delta on the right.\n * - Shows all tasks with all statuses (pending / in_progress / done / failed).\n * The active row animates a braille spinner; pending rows read `queued`.\n * - A single-cell source glyph (⚙ subagent / ⧉ MCP) sits before the id so the two\n * kinds of background work are distinguishable. The subagent *mode* tag (e.g.\n * \"[explore]\") is still intentionally NOT shown — the pane stays tag-free.\n * - LIFO within the window: newest tasks appear at the bottom (closest to the prompt).\n * - Finished tasks carry their wall-clock cost and stay visible until the next\n * user message arrives (see taskStore.reset()), not the moment they finish.\n * - Collapses to zero lines when there are no tasks.\n */\nexport class TaskPanelComponent implements Component {\n\tprivate readonly ui: TUI | null;\n\tprivate frame = 0;\n\tprivate animationTimer: ReturnType<typeof setInterval> | null = null;\n\n\tconstructor(ui?: TUI) {\n\t\tthis.ui = ui ?? null;\n\t}\n\n\tinvalidate(): void {\n\t\t// No cached rendering state.\n\t}\n\n\t/** Run the spinner timer only while a task is active, ticking re-renders. */\n\tprivate ensureAnimation(active: boolean): void {\n\t\tif (active && this.ui && !this.animationTimer) {\n\t\t\tthis.animationTimer = setInterval(() => {\n\t\t\t\tthis.frame = (this.frame + 1) % SPINNER_FRAMES.length;\n\t\t\t\tthis.ui?.requestRender();\n\t\t\t}, SPINNER_INTERVAL_MS);\n\t\t\tthis.animationTimer.unref?.();\n\t\t} else if (!active && this.animationTimer) {\n\t\t\tclearInterval(this.animationTimer);\n\t\t\tthis.animationTimer = null;\n\t\t\tthis.frame = 0;\n\t\t}\n\t}\n\n\t/** Stop the spinner timer. Call on teardown. */\n\tdispose(): void {\n\t\tif (this.animationTimer) {\n\t\t\tclearInterval(this.animationTimer);\n\t\t\tthis.animationTimer = null;\n\t\t}\n\t}\n\n\trender(width: number): string[] {\n\t\tconst tasks = taskStore.list();\n\t\tif (tasks.length === 0) {\n\t\t\tthis.ensureAnimation(false);\n\t\t\treturn [];\n\t\t}\n\n\t\tconst hasActive = tasks.some((t) => t.status === \"in_progress\");\n\t\tthis.ensureAnimation(hasActive);\n\n\t\tconst state = panelState(tasks);\n\t\tconst totalSecs = tasks.reduce((sum, t) => sum + taskElapsedSecs(t), 0);\n\t\tconst railColor = STATE_PRESENTATION[state].color;\n\t\tconst gutter = `${theme.fg(railColor, RAIL)} `;\n\t\tconst inner = Math.max(0, width - visibleWidth(RAIL) - 1);\n\n\t\t// Width of the id column, sized to the widest id on screen, so every title\n\t\t// starts at the same column regardless of digit count (#1 vs #10 vs #100).\n\t\tconst idColWidth = tasks.reduce((max, t) => Math.max(max, `#${t.id}`.length), 0);\n\n\t\tconst lines: string[] = [gutter + formatHeader(tasks, inner, state, totalSecs)];\n\t\tfor (const task of tasks) {\n\t\t\tlines.push(gutter + formatTaskLine(task, inner, this.frame, idColWidth));\n\t\t}\n\t\treturn lines;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"task-panel.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-panel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,MAAM,gBAAgB,GAA+B;IACpD,OAAO,EAAE,KAAG;IACZ,WAAW,EAAE,KAAG;IAChB,IAAI,EAAE,KAAG;IACT,MAAM,EAAE,KAAG;CACX,CAAC;AAEF;;;;;GAKG;AACH,MAAM,iBAAiB,GAA+B;IACrD,QAAQ,EAAE,KAAG;IACb,GAAG,EAAE,KAAG;CACR,CAAC;AAEF,sGAAsG;AACtG,MAAM,cAAc,GAAG,CAAC,KAAG,EAAE,KAAG,EAAE,KAAG,EAAE,KAAG,EAAE,KAAG,EAAE,KAAG,EAAE,KAAG,EAAE,KAAG,EAAE,KAAG,EAAE,KAAG,CAAC,CAAC;AAC1E,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,uGAAuG;AACvG,MAAM,IAAI,GAAG,KAAG,CAAC;AAEjB,oFAAoF;AACpF,MAAM,cAAc,GAAG,EAAE,CAAC;AAW1B,MAAM,kBAAkB,GAA0C;IACjE,OAAO,EAAE,EAAE,IAAI,EAAE,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AC,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import type { Component, TUI } from \"@kolisachint/hoocode-tui\";\nimport { truncateToWidth, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport type { Task, TaskSource, TaskStatus } from \"../../../core/task-store.js\";\nimport { taskStore } from \"../../../core/task-store.js\";\nimport { theme } from \"../theme/theme.js\";\n\nconst TASK_STATUS_ICON: Record<TaskStatus, string> = {\n\tpending: \"●\",\n\tin_progress: \"◐\",\n\tdone: \"✓\",\n\tfailed: \"✗\",\n};\n\n/**\n * A single-cell source marker placed before the id so a subagent row and an MCP\n * row are distinguishable at a glance. Plain tasks reserve the cell (blank) to keep\n * the id column aligned. The glyph says *where the work came from* at a glance; the\n * row also carries a text origin tag before the title (see formatTaskLine).\n */\nconst TASK_SOURCE_GLYPH: Record<TaskSource, string> = {\n\tsubagent: \"⚙\",\n\tmcp: \"⧉\",\n};\n\n/** Braille spinner frames + cadence, matched to the TUI Loader so the active row animates in step. */\nconst SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nconst SPINNER_INTERVAL_MS = 80;\n\n/** A thin colored left rail groups the pane without a box, the way the design's `border-left` does. */\nconst RAIL = \"▎\";\n\n/** Cells in the deterministic progress bar (matches the design's 14-cell track). */\nconst PROGRESS_CELLS = 14;\n\n/** Overall pane state, derived from the task statuses. Drives the rail color + header stamp. */\ntype PanelState = \"working\" | \"reviewed\" | \"stopped\";\n\ninterface StatePresentation {\n\treadonly icon: string;\n\treadonly label: string;\n\treadonly color: \"warning\" | \"success\" | \"error\";\n}\n\nconst STATE_PRESENTATION: Record<PanelState, StatePresentation> = {\n\tworking: { icon: \"◐\", label: \"working\", color: \"warning\" },\n\treviewed: { icon: \"✓\", label: \"reviewed\", color: \"success\" },\n\tstopped: { icon: \"✗\", label: \"stopped\", color: \"error\" },\n};\n\nfunction panelState(tasks: readonly Task[]): PanelState {\n\tif (tasks.some((t) => t.status === \"failed\")) return \"stopped\";\n\tconst active = tasks.some((t) => t.status === \"in_progress\" || t.status === \"pending\");\n\treturn active ? \"working\" : \"reviewed\";\n}\n\nfunction taskStatusColor(status: TaskStatus): \"dim\" | \"warning\" | \"success\" | \"error\" {\n\tswitch (status) {\n\t\tcase \"in_progress\":\n\t\t\treturn \"warning\";\n\t\tcase \"done\":\n\t\t\treturn \"success\";\n\t\tcase \"failed\":\n\t\t\treturn \"error\";\n\t\tdefault:\n\t\t\treturn \"dim\";\n\t}\n}\n\n/** Format a duration in seconds into a compact, terminal-friendly string. */\nfunction formatDuration(secs: number): string {\n\tconst s = Math.max(0, secs);\n\tif (s < 10) return `${s.toFixed(1)}s`;\n\tif (s < 60) return `${Math.round(s)}s`;\n\tconst mins = Math.floor(s / 60);\n\tconst rem = Math.round(s % 60);\n\treturn `${mins}m${rem.toString().padStart(2, \"0\")}s`;\n}\n\n/** Wall-clock time a task occupied, derived from its create/update stamps. */\nfunction taskElapsedSecs(task: Task): number {\n\treturn Math.max(0, (task.updatedAt - task.createdAt) / 1000);\n}\n\n/** Sum the token + cost usage reported by the tasks shown this turn. */\nfunction sumTurnUsage(tasks: readonly Task[]): { input: number; output: number; cost: number } | null {\n\tlet input = 0;\n\tlet output = 0;\n\tlet cost = 0;\n\tfor (const task of tasks) {\n\t\tif (!task.usage) continue;\n\t\tinput += task.usage.input;\n\t\toutput += task.usage.output;\n\t\tcost += task.usage.cost;\n\t}\n\tif (input === 0 && output === 0 && cost === 0) return null;\n\treturn { input, output, cost };\n}\n\n/**\n * Deterministic block-glyph progress bar: a heavy run (━) for the completed\n * fraction over a dim track. In-progress tasks count as half, so the bar moves\n * the moment work starts. Fraction is the only input — no animation, no guess.\n */\nfunction progressBar(done: number, active: number, total: number): { plain: string; styled: string } {\n\tconst ratio = total > 0 ? Math.max(0, Math.min(1, (done + active * 0.5) / total)) : 0;\n\tconst filled = Math.round(ratio * PROGRESS_CELLS);\n\tconst fill = \"━\".repeat(filled);\n\tconst track = \"━\".repeat(PROGRESS_CELLS - filled);\n\treturn {\n\t\tplain: fill + track,\n\t\tstyled: theme.fg(\"success\", fill) + theme.fg(\"dim\", track),\n\t};\n}\n\n/**\n * Ledger header: a state stamp (◐ working / ✓ reviewed / ✗ stopped) + a\n * deterministic progress bar and done/total count on the left, and the per-turn\n * token + elapsed + cost delta (summed across the tasks below) on the right.\n */\nfunction formatHeader(tasks: readonly Task[], width: number, state: PanelState, totalSecs: number): string {\n\tconst total = tasks.length;\n\tconst done = tasks.filter((t) => t.status === \"done\").length;\n\tconst active = tasks.filter((t) => t.status === \"in_progress\").length;\n\n\tconst { icon, label, color } = STATE_PRESENTATION[state];\n\tconst stampPlain = `${icon} ${label.toUpperCase()}`;\n\tconst stamp = `${theme.fg(color, icon)} ${theme.bold(theme.fg(color, label.toUpperCase()))}`;\n\n\tconst bar = progressBar(done, active, total);\n\tconst countPlain = `${done}/${total}`;\n\tconst count = theme.fg(\"muted\", `${done}`) + theme.fg(\"dim\", \"/\") + theme.fg(\"muted\", `${total}`);\n\n\t// Left cluster has a full form (stamp · bar · count) and a compact fallback\n\t// (stamp · count) that drops the bar when the terminal is too narrow.\n\tconst leftFullPlain = `${stampPlain} ${bar.plain} ${countPlain}`;\n\tconst leftFull = `${stamp} ${bar.styled} ${count}`;\n\tconst leftMinPlain = `${stampPlain} ${countPlain}`;\n\tconst leftMin = `${stamp} ${count}`;\n\n\tconst turn = sumTurnUsage(tasks);\n\tlet turnPlain = \"\";\n\tlet turnText = \"\";\n\tif (turn) {\n\t\tconst inTok = formatTokens(turn.input);\n\t\tconst outTok = formatTokens(turn.output);\n\t\tconst elapsed = formatDuration(totalSecs);\n\t\tconst showCost = turn.cost > 0;\n\t\tconst costStr = showCost ? `$${turn.cost.toFixed(3)}` : \"\";\n\t\tturnPlain = `turn ↑${inTok} ↓${outTok} · ${elapsed}${showCost ? ` · ${costStr}` : \"\"}`;\n\t\t// Turn delta: muted framing, numbers one step brighter (bold), separators dim.\n\t\tturnText =\n\t\t\ttheme.fg(\"muted\", \"turn ↑\") +\n\t\t\ttheme.bold(inTok) +\n\t\t\ttheme.fg(\"muted\", \" ↓\") +\n\t\t\ttheme.bold(outTok) +\n\t\t\ttheme.fg(\"dim\", \" · \") +\n\t\t\ttheme.fg(\"muted\", elapsed) +\n\t\t\t(showCost ? theme.fg(\"dim\", \" · \") + theme.bold(costStr) : \"\");\n\t}\n\n\tif (turnPlain) {\n\t\tif (visibleWidth(leftFullPlain) + 2 + visibleWidth(turnPlain) <= width) {\n\t\t\tconst pad = Math.max(2, width - visibleWidth(leftFullPlain) - visibleWidth(turnPlain));\n\t\t\treturn leftFull + \" \".repeat(pad) + turnText;\n\t\t}\n\t\tif (visibleWidth(leftMinPlain) + 2 + visibleWidth(turnPlain) <= width) {\n\t\t\tconst pad = Math.max(2, width - visibleWidth(leftMinPlain) - visibleWidth(turnPlain));\n\t\t\treturn leftMin + \" \".repeat(pad) + turnText;\n\t\t}\n\t}\n\tif (visibleWidth(leftFullPlain) <= width) return leftFull;\n\treturn truncateToWidth(leftMin, width, \"…\");\n}\n\nfunction formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\treturn `${(count / 1000000).toFixed(1)}M`;\n}\n\nfunction formatTaskLine(task: Task, width: number, frame: number, idColWidth: number): string {\n\tconst isProgress = task.status === \"in_progress\";\n\tconst iconGlyph = isProgress\n\t\t? (SPINNER_FRAMES[frame] ?? TASK_STATUS_ICON.in_progress)\n\t\t: TASK_STATUS_ICON[task.status];\n\tconst icon = theme.fg(taskStatusColor(task.status), iconGlyph);\n\n\t// Source marker between the status icon and the id. Reserve the cell (blank) for\n\t// plain tasks so ids stay column-aligned whether or not a glyph is present.\n\tconst sourceGlyph = task.source ? TASK_SOURCE_GLYPH[task.source] : \" \";\n\tconst styledSource = task.source ? theme.fg(\"dim\", sourceGlyph) : \" \";\n\n\t// Right-pad the id to the shared column width so titles line up across rows even\n\t// when ids differ in digit count (#1 vs #10). Padding is plain spaces inside the\n\t// dim styling, so it adds no visible color.\n\tconst idLabel = `#${task.id}`.padEnd(idColWidth);\n\t// Source tag prefixed to the title: the subagent mode (e.g. \"[explore]\") for\n\t// subagent rows, \"[MCP]\" for MCP rows. Drawn in accent so it reads as the row's\n\t// origin label, parallel to the chat's `Agent [explore]` / `MCP [server › tool]`.\n\tconst tag = task.source === \"mcp\" ? \"[MCP]\" : task.subagentMode ? `[${task.subagentMode}]` : \"\";\n\tconst styledTag = tag ? `${theme.fg(\"accent\", tag)} ` : \"\";\n\tconst title = task.title;\n\t// The id recedes (dim); the title carries the line. Done titles fade to muted\n\t// (settled work), pending dim (not started), active goes bold, failed turns red.\n\tconst styledId = theme.fg(\"dim\", idLabel);\n\tlet styledTitle: string;\n\tswitch (task.status) {\n\t\tcase \"done\":\n\t\t\tstyledTitle = theme.fg(\"muted\", title);\n\t\t\tbreak;\n\t\tcase \"pending\":\n\t\t\tstyledTitle = theme.fg(\"dim\", title);\n\t\t\tbreak;\n\t\tcase \"failed\":\n\t\t\tstyledTitle = theme.fg(\"error\", title);\n\t\t\tbreak;\n\t\tcase \"in_progress\":\n\t\t\tstyledTitle = theme.bold(title);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstyledTitle = title;\n\t}\n\n\t// Right column: settled rows carry their audit stamp (tokens + elapsed); the\n\t// active row reads `running…`, pending rows read `queued`.\n\tlet rightPlain = \"\";\n\tlet rightStyled = \"\";\n\tif (task.status === \"done\" || task.status === \"failed\") {\n\t\tconst parts: string[] = [];\n\t\tlet tokenText = \"\";\n\t\tif (task.usage) {\n\t\t\tconst totalTok = task.usage.input + task.usage.output;\n\t\t\tif (totalTok > 0) tokenText = formatTokens(totalTok);\n\t\t}\n\t\tconst elapsed = formatDuration(taskElapsedSecs(task));\n\t\tif (tokenText) {\n\t\t\tparts.push(tokenText, elapsed);\n\t\t\trightStyled = theme.fg(\"muted\", tokenText) + theme.fg(\"dim\", ` · ${elapsed}`);\n\t\t} else {\n\t\t\tparts.push(elapsed);\n\t\t\trightStyled = theme.fg(\"dim\", elapsed);\n\t\t}\n\t\trightPlain = parts.join(\" · \");\n\t} else if (task.status === \"in_progress\") {\n\t\trightPlain = \"running…\";\n\t\trightStyled = theme.fg(\"warning\", rightPlain);\n\t} else if (task.status === \"pending\") {\n\t\trightPlain = \"queued\";\n\t\trightStyled = theme.fg(\"dim\", rightPlain);\n\t}\n\n\t// A warning note (e.g. inherited-model fallback, exhaustion skip) takes over the\n\t// right column as a ⚠ cue, replacing the usage/status stamp for that row.\n\tif (task.note) {\n\t\trightPlain = `⚠ ${task.note}`;\n\t\trightStyled = theme.fg(\"warning\", rightPlain);\n\t}\n\n\tconst rightWidth = rightPlain ? visibleWidth(rightPlain) + 1 : 0;\n\tconst leftWidth = Math.max(0, width - rightWidth);\n\n\t// truncateToWidth measures visible width (ANSI-aware), so the styled left can be\n\t// truncated against the full left budget directly. Subtracting the prefix here\n\t// (as a prior version did) truncated titles early and unevenly per id width.\n\tconst left = truncateToWidth(`${icon} ${styledSource} ${styledId} ${styledTag}${styledTitle}`, leftWidth, \"…\");\n\n\tif (!rightPlain) return left;\n\n\tconst pad = Math.max(1, width - visibleWidth(left) - visibleWidth(rightPlain));\n\treturn left + \" \".repeat(pad) + rightStyled;\n}\n\n/**\n * Task panel rendered just above the editor prompt.\n *\n * - A state-colored left rail groups the pane (working=warning, reviewed=success,\n * stopped=error) without drawing a box.\n * - A ledger header tops the list: a state stamp + deterministic progress bar +\n * done/total count on the left, the per-turn token/elapsed/cost delta on the right.\n * - Shows all tasks with all statuses (pending / in_progress / done / failed).\n * The active row animates a braille spinner; pending rows read `queued`.\n * - A single-cell source glyph (⚙ subagent / ⧉ MCP) sits before the id so the two\n * kinds of background work are distinguishable, and a text origin tag is shown\n * before the title: the subagent mode (e.g. \"[explore]\") or \"[MCP]\".\n * - LIFO within the window: newest tasks appear at the bottom (closest to the prompt).\n * - Finished tasks carry their wall-clock cost and stay visible until the next\n * user message arrives (see taskStore.reset()), not the moment they finish.\n * - Collapses to zero lines when there are no tasks.\n */\nexport class TaskPanelComponent implements Component {\n\tprivate readonly ui: TUI | null;\n\tprivate frame = 0;\n\tprivate animationTimer: ReturnType<typeof setInterval> | null = null;\n\n\tconstructor(ui?: TUI) {\n\t\tthis.ui = ui ?? null;\n\t}\n\n\tinvalidate(): void {\n\t\t// No cached rendering state.\n\t}\n\n\t/** Run the spinner timer only while a task is active, ticking re-renders. */\n\tprivate ensureAnimation(active: boolean): void {\n\t\tif (active && this.ui && !this.animationTimer) {\n\t\t\tthis.animationTimer = setInterval(() => {\n\t\t\t\tthis.frame = (this.frame + 1) % SPINNER_FRAMES.length;\n\t\t\t\tthis.ui?.requestRender();\n\t\t\t}, SPINNER_INTERVAL_MS);\n\t\t\tthis.animationTimer.unref?.();\n\t\t} else if (!active && this.animationTimer) {\n\t\t\tclearInterval(this.animationTimer);\n\t\t\tthis.animationTimer = null;\n\t\t\tthis.frame = 0;\n\t\t}\n\t}\n\n\t/** Stop the spinner timer. Call on teardown. */\n\tdispose(): void {\n\t\tif (this.animationTimer) {\n\t\t\tclearInterval(this.animationTimer);\n\t\t\tthis.animationTimer = null;\n\t\t}\n\t}\n\n\trender(width: number): string[] {\n\t\tconst tasks = taskStore.list();\n\t\tif (tasks.length === 0) {\n\t\t\tthis.ensureAnimation(false);\n\t\t\treturn [];\n\t\t}\n\n\t\tconst hasActive = tasks.some((t) => t.status === \"in_progress\");\n\t\tthis.ensureAnimation(hasActive);\n\n\t\tconst state = panelState(tasks);\n\t\tconst totalSecs = tasks.reduce((sum, t) => sum + taskElapsedSecs(t), 0);\n\t\tconst railColor = STATE_PRESENTATION[state].color;\n\t\tconst gutter = `${theme.fg(railColor, RAIL)} `;\n\t\tconst inner = Math.max(0, width - visibleWidth(RAIL) - 1);\n\n\t\t// Width of the id column, sized to the widest id on screen, so every title\n\t\t// starts at the same column regardless of digit count (#1 vs #10 vs #100).\n\t\tconst idColWidth = tasks.reduce((max, t) => Math.max(max, `#${t.id}`.length), 0);\n\n\t\tconst lines: string[] = [gutter + formatHeader(tasks, inner, state, totalSecs)];\n\t\tfor (const task of tasks) {\n\t\t\tlines.push(gutter + formatTaskLine(task, inner, this.frame, idColWidth));\n\t\t}\n\t\treturn lines;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources-cli.d.ts","sourceRoot":"","sources":["../src/resources-cli.ts"],"names":[],"mappings":"AAuJA,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAoD7E","sourcesContent":["import { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport chalk from \"chalk\";\nimport { APP_NAME, CONFIG_DIR_NAME, getAgentDir, getHooCodeDir } from \"./config.js\";\nimport { loadAgentRegistry } from \"./core/agent-registry.js\";\nimport { DefaultResourceLoader } from \"./core/resource-loader.js\";\nimport { SettingsManager } from \"./core/settings-manager.js\";\nimport type { SourceInfo } from \"./core/source-info.js\";\n\ninterface ResourceRow {\n\tname: string;\n\tdetail?: string;\n\torigin: string;\n\tpath: string;\n}\n\n/**\n * Derive a short origin label from a resource path and scope. Distinguishes the\n * four discovery surfaces a user cares about when debugging: project vs user, and\n * the cross-vendor `.agents/` vs Claude Code `.claude/` directories.\n */\nfunction classifyOrigin(path: string, scope: string): string {\n\tif (path.includes(`${join(\"\", \".agents\", \"\")}`) || path.includes(\"/.agents/\")) return `${scope} (.agents)`;\n\tif (path.includes(\"/.claude/\")) return `${scope} (.claude)`;\n\tif (path.includes(`${CONFIG_DIR_NAME}/`)) return `${scope} (${CONFIG_DIR_NAME})`;\n\treturn scope;\n}\n\nfunction originFromSourceInfo(sourceInfo: SourceInfo): string {\n\treturn classifyOrigin(sourceInfo.path, sourceInfo.scope);\n}\n\n/** Map an AgentSource value to the same origin vocabulary used elsewhere. */\nfunction originFromAgentSource(source: string, path: string | undefined): string {\n\tswitch (source) {\n\t\tcase \"builtin\":\n\t\t\treturn \"builtin\";\n\t\tcase \"user\":\n\t\t\treturn path ? classifyOrigin(path, \"user\") : \"user\";\n\t\tcase \"project\":\n\t\t\treturn path ? classifyOrigin(path, \"project\") : \"project\";\n\t\tcase \"claude-user\":\n\t\t\treturn \"user (.claude)\";\n\t\tcase \"claude-project\":\n\t\t\treturn \"project (.claude)\";\n\t\tdefault:\n\t\t\treturn source;\n\t}\n}\n\ninterface DiscoveredMcpServer {\n\tname: string;\n\tpath: string;\n\tscope: \"user\" | \"project\";\n}\n\n/**\n * Read-only replica of the MCP discovery surfaces in\n * `extensions/core/hoo-core.ts` (setupMcpLoader). First-wins by name across all\n * sources. Kept in sync with that loader; it is the source of truth.\n */\nfunction discoverMcpServers(cwd: string): DiscoveredMcpServer[] {\n\tconst servers: DiscoveredMcpServer[] = [];\n\tconst seen = new Set<string>();\n\tconst add = (name: string, path: string, scope: \"user\" | \"project\"): void => {\n\t\tif (!name || seen.has(name)) return;\n\t\tseen.add(name);\n\t\tservers.push({ name, path, scope });\n\t};\n\n\tconst standardFiles: Array<{ path: string; scope: \"user\" | \"project\" }> = [\n\t\t{ path: join(homedir(), \".agents\", \"mcp.json\"), scope: \"user\" },\n\t\t{ path: join(cwd, \".agents\", \"mcp.json\"), scope: \"project\" },\n\t\t{ path: join(homedir(), \".config\", \"claude\", \"mcp.json\"), scope: \"user\" },\n\t];\n\tfor (const { path, scope } of standardFiles) {\n\t\tif (!existsSync(path)) continue;\n\t\ttry {\n\t\t\tconst config = JSON.parse(readFileSync(path, \"utf8\")) as { mcpServers?: Record<string, unknown> };\n\t\t\tfor (const name of Object.keys(config.mcpServers ?? {})) {\n\t\t\t\tadd(name, path, scope);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore malformed config; the loader does the same.\n\t\t}\n\t}\n\n\tconst perServerDirs: Array<{ dir: string; scope: \"user\" | \"project\" }> = [\n\t\t{ dir: join(getHooCodeDir(), \"mcp-servers\"), scope: \"user\" },\n\t\t{ dir: join(cwd, CONFIG_DIR_NAME, \"mcp-servers\"), scope: \"project\" },\n\t];\n\tfor (const { dir, scope } of perServerDirs) {\n\t\tif (!existsSync(dir)) continue;\n\t\tlet files: string[];\n\t\ttry {\n\t\t\tfiles = readdirSync(dir).filter((f) => f.endsWith(\".json\"));\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const file of files) {\n\t\t\tconst path = join(dir, file);\n\t\t\ttry {\n\t\t\t\tconst config = JSON.parse(readFileSync(path, \"utf8\")) as { name?: string };\n\t\t\t\tif (config.name) add(config.name, path, scope);\n\t\t\t} catch {\n\t\t\t\t// Ignore malformed config.\n\t\t\t}\n\t\t}\n\t}\n\n\treturn servers;\n}\n\n/** Collapse a description to a single short line for the table. */\nfunction oneLine(text: string | undefined): string | undefined {\n\tif (!text) return undefined;\n\tconst firstLine = text\n\t\t.split(\"\\n\")\n\t\t.map((l) => l.trim())\n\t\t.find((l) => l.length > 0);\n\tif (!firstLine) return undefined;\n\treturn firstLine.length > 80 ? `${firstLine.slice(0, 77)}...` : firstLine;\n}\n\nfunction printSection(title: string, rows: ResourceRow[]): void {\n\tconsole.log(chalk.bold(`${title} (${rows.length})`));\n\tif (rows.length === 0) {\n\t\tconsole.log(chalk.dim(\" (none)\"));\n\t\tconsole.log();\n\t\treturn;\n\t}\n\tfor (const row of rows) {\n\t\tconst summary = oneLine(row.detail);\n\t\tconst detail = summary ? chalk.dim(` - ${summary}`) : \"\";\n\t\tconsole.log(` ${row.name}${detail} ${chalk.dim(`[${row.origin}]`)}`);\n\t\tconsole.log(chalk.dim(` ${row.path}`));\n\t}\n\tconsole.log();\n}\n\nfunction printHelp(): void {\n\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${APP_NAME} resources\n\nPrint the skills, subagents, slash commands, and MCP servers discovered for the\ncurrent working directory, with their source path and origin. Read-only; makes\nno LLM call.\n`);\n}\n\nexport async function handleResourcesCommand(args: string[]): Promise<boolean> {\n\tif (args[0] !== \"resources\") {\n\t\treturn false;\n\t}\n\n\tif (args.includes(\"-h\") || args.includes(\"--help\")) {\n\t\tprintHelp();\n\t\treturn true;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst settingsManager = SettingsManager.create(cwd, agentDir);\n\tconst resourceLoader = new DefaultResourceLoader({ cwd, agentDir, settingsManager });\n\tawait resourceLoader.reload();\n\n\tconst skills = resourceLoader.getSkills().skills.map<ResourceRow>((skill) => ({\n\t\tname: skill.name,\n\t\tdetail: skill.description,\n\t\torigin: originFromSourceInfo(skill.sourceInfo),\n\t\tpath: skill.sourceInfo.path,\n\t}));\n\n\tconst agents = loadAgentRegistry({ cwd, agentDir })\n\t\t.list()\n\t\t.map<ResourceRow>((agent) => ({\n\t\t\tname: agent.name,\n\t\t\tdetail: agent.description,\n\t\t\torigin: originFromAgentSource(agent.source, agent.filePath),\n\t\t\tpath: agent.filePath ?? \"<builtin>\",\n\t\t}));\n\n\tconst slashCommands = resourceLoader.getPrompts().prompts.map<ResourceRow>((prompt) => ({\n\t\tname: `/${prompt.name}`,\n\t\tdetail: prompt.description,\n\t\torigin: originFromSourceInfo(prompt.sourceInfo),\n\t\tpath: prompt.sourceInfo.path,\n\t}));\n\n\tconst mcpServers = discoverMcpServers(cwd).map<ResourceRow>((server) => ({\n\t\tname: server.name,\n\t\torigin: classifyOrigin(server.path, server.scope),\n\t\tpath: server.path,\n\t}));\n\n\tconsole.log(chalk.dim(`Resources discovered for ${cwd}\\n`));\n\tprintSection(\"Skills\", skills);\n\tprintSection(\"Subagents\", agents);\n\tprintSection(\"Slash commands\", slashCommands);\n\tprintSection(\"MCP servers\", mcpServers);\n\n\treturn true;\n}\n"]}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { APP_NAME, CONFIG_DIR_NAME, getAgentDir, getHooCodeDir } from "./config.js";
|
|
6
|
+
import { loadAgentRegistry } from "./core/agent-registry.js";
|
|
7
|
+
import { DefaultResourceLoader } from "./core/resource-loader.js";
|
|
8
|
+
import { SettingsManager } from "./core/settings-manager.js";
|
|
9
|
+
/**
|
|
10
|
+
* Derive a short origin label from a resource path and scope. Distinguishes the
|
|
11
|
+
* four discovery surfaces a user cares about when debugging: project vs user, and
|
|
12
|
+
* the cross-vendor `.agents/` vs Claude Code `.claude/` directories.
|
|
13
|
+
*/
|
|
14
|
+
function classifyOrigin(path, scope) {
|
|
15
|
+
if (path.includes(`${join("", ".agents", "")}`) || path.includes("/.agents/"))
|
|
16
|
+
return `${scope} (.agents)`;
|
|
17
|
+
if (path.includes("/.claude/"))
|
|
18
|
+
return `${scope} (.claude)`;
|
|
19
|
+
if (path.includes(`${CONFIG_DIR_NAME}/`))
|
|
20
|
+
return `${scope} (${CONFIG_DIR_NAME})`;
|
|
21
|
+
return scope;
|
|
22
|
+
}
|
|
23
|
+
function originFromSourceInfo(sourceInfo) {
|
|
24
|
+
return classifyOrigin(sourceInfo.path, sourceInfo.scope);
|
|
25
|
+
}
|
|
26
|
+
/** Map an AgentSource value to the same origin vocabulary used elsewhere. */
|
|
27
|
+
function originFromAgentSource(source, path) {
|
|
28
|
+
switch (source) {
|
|
29
|
+
case "builtin":
|
|
30
|
+
return "builtin";
|
|
31
|
+
case "user":
|
|
32
|
+
return path ? classifyOrigin(path, "user") : "user";
|
|
33
|
+
case "project":
|
|
34
|
+
return path ? classifyOrigin(path, "project") : "project";
|
|
35
|
+
case "claude-user":
|
|
36
|
+
return "user (.claude)";
|
|
37
|
+
case "claude-project":
|
|
38
|
+
return "project (.claude)";
|
|
39
|
+
default:
|
|
40
|
+
return source;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read-only replica of the MCP discovery surfaces in
|
|
45
|
+
* `extensions/core/hoo-core.ts` (setupMcpLoader). First-wins by name across all
|
|
46
|
+
* sources. Kept in sync with that loader; it is the source of truth.
|
|
47
|
+
*/
|
|
48
|
+
function discoverMcpServers(cwd) {
|
|
49
|
+
const servers = [];
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const add = (name, path, scope) => {
|
|
52
|
+
if (!name || seen.has(name))
|
|
53
|
+
return;
|
|
54
|
+
seen.add(name);
|
|
55
|
+
servers.push({ name, path, scope });
|
|
56
|
+
};
|
|
57
|
+
const standardFiles = [
|
|
58
|
+
{ path: join(homedir(), ".agents", "mcp.json"), scope: "user" },
|
|
59
|
+
{ path: join(cwd, ".agents", "mcp.json"), scope: "project" },
|
|
60
|
+
{ path: join(homedir(), ".config", "claude", "mcp.json"), scope: "user" },
|
|
61
|
+
];
|
|
62
|
+
for (const { path, scope } of standardFiles) {
|
|
63
|
+
if (!existsSync(path))
|
|
64
|
+
continue;
|
|
65
|
+
try {
|
|
66
|
+
const config = JSON.parse(readFileSync(path, "utf8"));
|
|
67
|
+
for (const name of Object.keys(config.mcpServers ?? {})) {
|
|
68
|
+
add(name, path, scope);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// Ignore malformed config; the loader does the same.
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const perServerDirs = [
|
|
76
|
+
{ dir: join(getHooCodeDir(), "mcp-servers"), scope: "user" },
|
|
77
|
+
{ dir: join(cwd, CONFIG_DIR_NAME, "mcp-servers"), scope: "project" },
|
|
78
|
+
];
|
|
79
|
+
for (const { dir, scope } of perServerDirs) {
|
|
80
|
+
if (!existsSync(dir))
|
|
81
|
+
continue;
|
|
82
|
+
let files;
|
|
83
|
+
try {
|
|
84
|
+
files = readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
for (const file of files) {
|
|
90
|
+
const path = join(dir, file);
|
|
91
|
+
try {
|
|
92
|
+
const config = JSON.parse(readFileSync(path, "utf8"));
|
|
93
|
+
if (config.name)
|
|
94
|
+
add(config.name, path, scope);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// Ignore malformed config.
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return servers;
|
|
102
|
+
}
|
|
103
|
+
/** Collapse a description to a single short line for the table. */
|
|
104
|
+
function oneLine(text) {
|
|
105
|
+
if (!text)
|
|
106
|
+
return undefined;
|
|
107
|
+
const firstLine = text
|
|
108
|
+
.split("\n")
|
|
109
|
+
.map((l) => l.trim())
|
|
110
|
+
.find((l) => l.length > 0);
|
|
111
|
+
if (!firstLine)
|
|
112
|
+
return undefined;
|
|
113
|
+
return firstLine.length > 80 ? `${firstLine.slice(0, 77)}...` : firstLine;
|
|
114
|
+
}
|
|
115
|
+
function printSection(title, rows) {
|
|
116
|
+
console.log(chalk.bold(`${title} (${rows.length})`));
|
|
117
|
+
if (rows.length === 0) {
|
|
118
|
+
console.log(chalk.dim(" (none)"));
|
|
119
|
+
console.log();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
for (const row of rows) {
|
|
123
|
+
const summary = oneLine(row.detail);
|
|
124
|
+
const detail = summary ? chalk.dim(` - ${summary}`) : "";
|
|
125
|
+
console.log(` ${row.name}${detail} ${chalk.dim(`[${row.origin}]`)}`);
|
|
126
|
+
console.log(chalk.dim(` ${row.path}`));
|
|
127
|
+
}
|
|
128
|
+
console.log();
|
|
129
|
+
}
|
|
130
|
+
function printHelp() {
|
|
131
|
+
console.log(`${chalk.bold("Usage:")}
|
|
132
|
+
${APP_NAME} resources
|
|
133
|
+
|
|
134
|
+
Print the skills, subagents, slash commands, and MCP servers discovered for the
|
|
135
|
+
current working directory, with their source path and origin. Read-only; makes
|
|
136
|
+
no LLM call.
|
|
137
|
+
`);
|
|
138
|
+
}
|
|
139
|
+
export async function handleResourcesCommand(args) {
|
|
140
|
+
if (args[0] !== "resources") {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
if (args.includes("-h") || args.includes("--help")) {
|
|
144
|
+
printHelp();
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
const cwd = process.cwd();
|
|
148
|
+
const agentDir = getAgentDir();
|
|
149
|
+
const settingsManager = SettingsManager.create(cwd, agentDir);
|
|
150
|
+
const resourceLoader = new DefaultResourceLoader({ cwd, agentDir, settingsManager });
|
|
151
|
+
await resourceLoader.reload();
|
|
152
|
+
const skills = resourceLoader.getSkills().skills.map((skill) => ({
|
|
153
|
+
name: skill.name,
|
|
154
|
+
detail: skill.description,
|
|
155
|
+
origin: originFromSourceInfo(skill.sourceInfo),
|
|
156
|
+
path: skill.sourceInfo.path,
|
|
157
|
+
}));
|
|
158
|
+
const agents = loadAgentRegistry({ cwd, agentDir })
|
|
159
|
+
.list()
|
|
160
|
+
.map((agent) => ({
|
|
161
|
+
name: agent.name,
|
|
162
|
+
detail: agent.description,
|
|
163
|
+
origin: originFromAgentSource(agent.source, agent.filePath),
|
|
164
|
+
path: agent.filePath ?? "<builtin>",
|
|
165
|
+
}));
|
|
166
|
+
const slashCommands = resourceLoader.getPrompts().prompts.map((prompt) => ({
|
|
167
|
+
name: `/${prompt.name}`,
|
|
168
|
+
detail: prompt.description,
|
|
169
|
+
origin: originFromSourceInfo(prompt.sourceInfo),
|
|
170
|
+
path: prompt.sourceInfo.path,
|
|
171
|
+
}));
|
|
172
|
+
const mcpServers = discoverMcpServers(cwd).map((server) => ({
|
|
173
|
+
name: server.name,
|
|
174
|
+
origin: classifyOrigin(server.path, server.scope),
|
|
175
|
+
path: server.path,
|
|
176
|
+
}));
|
|
177
|
+
console.log(chalk.dim(`Resources discovered for ${cwd}\n`));
|
|
178
|
+
printSection("Skills", skills);
|
|
179
|
+
printSection("Subagents", agents);
|
|
180
|
+
printSection("Slash commands", slashCommands);
|
|
181
|
+
printSection("MCP servers", mcpServers);
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=resources-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources-cli.js","sourceRoot":"","sources":["../src/resources-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAU7D;;;;GAIG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,KAAa,EAAU;IAC5D,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,GAAG,KAAK,YAAY,CAAC;IAC3G,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,GAAG,KAAK,YAAY,CAAC;IAC5D,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,eAAe,GAAG,CAAC;QAAE,OAAO,GAAG,KAAK,KAAK,eAAe,GAAG,CAAC;I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AC,WAAW;QAC1B,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,UAAU,CAAC;QAC/C,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;KAC5B,CAAC,CAAC,CAAC;IAEJ,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;QACjD,IAAI,EAAE,MAAM,CAAC,IAAI;KACjB,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/B,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAClC,YAAY,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IAC9C,YAAY,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IAExC,OAAO,IAAI,CAAC;AAAA,CACZ","sourcesContent":["import { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport chalk from \"chalk\";\nimport { APP_NAME, CONFIG_DIR_NAME, getAgentDir, getHooCodeDir } from \"./config.js\";\nimport { loadAgentRegistry } from \"./core/agent-registry.js\";\nimport { DefaultResourceLoader } from \"./core/resource-loader.js\";\nimport { SettingsManager } from \"./core/settings-manager.js\";\nimport type { SourceInfo } from \"./core/source-info.js\";\n\ninterface ResourceRow {\n\tname: string;\n\tdetail?: string;\n\torigin: string;\n\tpath: string;\n}\n\n/**\n * Derive a short origin label from a resource path and scope. Distinguishes the\n * four discovery surfaces a user cares about when debugging: project vs user, and\n * the cross-vendor `.agents/` vs Claude Code `.claude/` directories.\n */\nfunction classifyOrigin(path: string, scope: string): string {\n\tif (path.includes(`${join(\"\", \".agents\", \"\")}`) || path.includes(\"/.agents/\")) return `${scope} (.agents)`;\n\tif (path.includes(\"/.claude/\")) return `${scope} (.claude)`;\n\tif (path.includes(`${CONFIG_DIR_NAME}/`)) return `${scope} (${CONFIG_DIR_NAME})`;\n\treturn scope;\n}\n\nfunction originFromSourceInfo(sourceInfo: SourceInfo): string {\n\treturn classifyOrigin(sourceInfo.path, sourceInfo.scope);\n}\n\n/** Map an AgentSource value to the same origin vocabulary used elsewhere. */\nfunction originFromAgentSource(source: string, path: string | undefined): string {\n\tswitch (source) {\n\t\tcase \"builtin\":\n\t\t\treturn \"builtin\";\n\t\tcase \"user\":\n\t\t\treturn path ? classifyOrigin(path, \"user\") : \"user\";\n\t\tcase \"project\":\n\t\t\treturn path ? classifyOrigin(path, \"project\") : \"project\";\n\t\tcase \"claude-user\":\n\t\t\treturn \"user (.claude)\";\n\t\tcase \"claude-project\":\n\t\t\treturn \"project (.claude)\";\n\t\tdefault:\n\t\t\treturn source;\n\t}\n}\n\ninterface DiscoveredMcpServer {\n\tname: string;\n\tpath: string;\n\tscope: \"user\" | \"project\";\n}\n\n/**\n * Read-only replica of the MCP discovery surfaces in\n * `extensions/core/hoo-core.ts` (setupMcpLoader). First-wins by name across all\n * sources. Kept in sync with that loader; it is the source of truth.\n */\nfunction discoverMcpServers(cwd: string): DiscoveredMcpServer[] {\n\tconst servers: DiscoveredMcpServer[] = [];\n\tconst seen = new Set<string>();\n\tconst add = (name: string, path: string, scope: \"user\" | \"project\"): void => {\n\t\tif (!name || seen.has(name)) return;\n\t\tseen.add(name);\n\t\tservers.push({ name, path, scope });\n\t};\n\n\tconst standardFiles: Array<{ path: string; scope: \"user\" | \"project\" }> = [\n\t\t{ path: join(homedir(), \".agents\", \"mcp.json\"), scope: \"user\" },\n\t\t{ path: join(cwd, \".agents\", \"mcp.json\"), scope: \"project\" },\n\t\t{ path: join(homedir(), \".config\", \"claude\", \"mcp.json\"), scope: \"user\" },\n\t];\n\tfor (const { path, scope } of standardFiles) {\n\t\tif (!existsSync(path)) continue;\n\t\ttry {\n\t\t\tconst config = JSON.parse(readFileSync(path, \"utf8\")) as { mcpServers?: Record<string, unknown> };\n\t\t\tfor (const name of Object.keys(config.mcpServers ?? {})) {\n\t\t\t\tadd(name, path, scope);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore malformed config; the loader does the same.\n\t\t}\n\t}\n\n\tconst perServerDirs: Array<{ dir: string; scope: \"user\" | \"project\" }> = [\n\t\t{ dir: join(getHooCodeDir(), \"mcp-servers\"), scope: \"user\" },\n\t\t{ dir: join(cwd, CONFIG_DIR_NAME, \"mcp-servers\"), scope: \"project\" },\n\t];\n\tfor (const { dir, scope } of perServerDirs) {\n\t\tif (!existsSync(dir)) continue;\n\t\tlet files: string[];\n\t\ttry {\n\t\t\tfiles = readdirSync(dir).filter((f) => f.endsWith(\".json\"));\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const file of files) {\n\t\t\tconst path = join(dir, file);\n\t\t\ttry {\n\t\t\t\tconst config = JSON.parse(readFileSync(path, \"utf8\")) as { name?: string };\n\t\t\t\tif (config.name) add(config.name, path, scope);\n\t\t\t} catch {\n\t\t\t\t// Ignore malformed config.\n\t\t\t}\n\t\t}\n\t}\n\n\treturn servers;\n}\n\n/** Collapse a description to a single short line for the table. */\nfunction oneLine(text: string | undefined): string | undefined {\n\tif (!text) return undefined;\n\tconst firstLine = text\n\t\t.split(\"\\n\")\n\t\t.map((l) => l.trim())\n\t\t.find((l) => l.length > 0);\n\tif (!firstLine) return undefined;\n\treturn firstLine.length > 80 ? `${firstLine.slice(0, 77)}...` : firstLine;\n}\n\nfunction printSection(title: string, rows: ResourceRow[]): void {\n\tconsole.log(chalk.bold(`${title} (${rows.length})`));\n\tif (rows.length === 0) {\n\t\tconsole.log(chalk.dim(\" (none)\"));\n\t\tconsole.log();\n\t\treturn;\n\t}\n\tfor (const row of rows) {\n\t\tconst summary = oneLine(row.detail);\n\t\tconst detail = summary ? chalk.dim(` - ${summary}`) : \"\";\n\t\tconsole.log(` ${row.name}${detail} ${chalk.dim(`[${row.origin}]`)}`);\n\t\tconsole.log(chalk.dim(` ${row.path}`));\n\t}\n\tconsole.log();\n}\n\nfunction printHelp(): void {\n\tconsole.log(`${chalk.bold(\"Usage:\")}\n ${APP_NAME} resources\n\nPrint the skills, subagents, slash commands, and MCP servers discovered for the\ncurrent working directory, with their source path and origin. Read-only; makes\nno LLM call.\n`);\n}\n\nexport async function handleResourcesCommand(args: string[]): Promise<boolean> {\n\tif (args[0] !== \"resources\") {\n\t\treturn false;\n\t}\n\n\tif (args.includes(\"-h\") || args.includes(\"--help\")) {\n\t\tprintHelp();\n\t\treturn true;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst settingsManager = SettingsManager.create(cwd, agentDir);\n\tconst resourceLoader = new DefaultResourceLoader({ cwd, agentDir, settingsManager });\n\tawait resourceLoader.reload();\n\n\tconst skills = resourceLoader.getSkills().skills.map<ResourceRow>((skill) => ({\n\t\tname: skill.name,\n\t\tdetail: skill.description,\n\t\torigin: originFromSourceInfo(skill.sourceInfo),\n\t\tpath: skill.sourceInfo.path,\n\t}));\n\n\tconst agents = loadAgentRegistry({ cwd, agentDir })\n\t\t.list()\n\t\t.map<ResourceRow>((agent) => ({\n\t\t\tname: agent.name,\n\t\t\tdetail: agent.description,\n\t\t\torigin: originFromAgentSource(agent.source, agent.filePath),\n\t\t\tpath: agent.filePath ?? \"<builtin>\",\n\t\t}));\n\n\tconst slashCommands = resourceLoader.getPrompts().prompts.map<ResourceRow>((prompt) => ({\n\t\tname: `/${prompt.name}`,\n\t\tdetail: prompt.description,\n\t\torigin: originFromSourceInfo(prompt.sourceInfo),\n\t\tpath: prompt.sourceInfo.path,\n\t}));\n\n\tconst mcpServers = discoverMcpServers(cwd).map<ResourceRow>((server) => ({\n\t\tname: server.name,\n\t\torigin: classifyOrigin(server.path, server.scope),\n\t\tpath: server.path,\n\t}));\n\n\tconsole.log(chalk.dim(`Resources discovered for ${cwd}\\n`));\n\tprintSection(\"Skills\", skills);\n\tprintSection(\"Subagents\", agents);\n\tprintSection(\"Slash commands\", slashCommands);\n\tprintSection(\"MCP servers\", mcpServers);\n\n\treturn true;\n}\n"]}
|
package/docs/docs.json
CHANGED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Project-local resources via `.agents/`
|
|
2
|
+
|
|
3
|
+
hoocode discovers project-local resources from four directory conventions. Each resource type (slash commands, subagents, MCP servers, skills) has its own precedence order across these roots.
|
|
4
|
+
|
|
5
|
+
## Discovery roots
|
|
6
|
+
|
|
7
|
+
| Root | Scope | Notes |
|
|
8
|
+
|------|-------|-------|
|
|
9
|
+
| `.hoocode/` | project + user (`~/.hoocode/`) | hoocode-native convention |
|
|
10
|
+
| `.agents/` | project (ancestor-walked) + user (`~/.agents/`) | cross-vendor convention |
|
|
11
|
+
| `.claude/` | project + user (`~/.claude/`) | Claude Code native import |
|
|
12
|
+
| `hoocode.*` manifest fields | installed packages | declared in `package.json` |
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Ancestor-walk-to-git-root rule
|
|
17
|
+
|
|
18
|
+
Source: `packages/coding-agent/src/utils/paths.ts` (`collectAgentsAncestorDirs`, `findGitRepoRoot`).
|
|
19
|
+
|
|
20
|
+
For `.agents/<subdir>` only, hoocode walks upward from the current working directory, collecting `<dir>/.agents/<subdir>` at each level, stopping at (and including) the nearest ancestor that contains a `.git` entry (the git repo root). If the cwd is not inside a git repo, the walk continues to the filesystem root.
|
|
21
|
+
|
|
22
|
+
Directories are collected **cwd-first**, so a closer `.agents/` directory beats an ancestor under first-match-wins semantics.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Slash commands / prompt templates
|
|
27
|
+
|
|
28
|
+
Source: `packages/coding-agent/src/core/resource-loader.ts` (`defaultSlashCommandDirs` in `reload()`).
|
|
29
|
+
|
|
30
|
+
**First-match-wins**, highest precedence first:
|
|
31
|
+
|
|
32
|
+
1. `{cwd}/.hoocode/commands`
|
|
33
|
+
2. `{cwd}/.claude/commands`
|
|
34
|
+
3. `.agents/commands` — ancestor-walk from cwd up to git root, cwd-first
|
|
35
|
+
4. `{agentDir}/commands` (i.e. `~/.hoocode/commands`)
|
|
36
|
+
5. `~/.agents/commands`
|
|
37
|
+
6. `~/.claude/commands`
|
|
38
|
+
|
|
39
|
+
Pass `--no-slash-commands` or `--no-prompt-templates` to disable discovery. Explicit `--slash-command`/`--prompt-template` paths still load when discovery is off.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Subagents
|
|
44
|
+
|
|
45
|
+
Source: `packages/coding-agent/src/core/agent-registry.ts` (`loadAgentRegistry`).
|
|
46
|
+
|
|
47
|
+
Registered **lowest precedence first**; later sources override earlier ones by name:
|
|
48
|
+
|
|
49
|
+
1. Built-in agents
|
|
50
|
+
2. Package-manifest agents (`hoocode.agents` in `package.json`)
|
|
51
|
+
3. `~/.claude/agents` (source `claude-user`)
|
|
52
|
+
4. `{agentDir}/agents` i.e. `~/.hoocode/agents` (source `user`)
|
|
53
|
+
5. `.agents/agents` — ancestor-walk from cwd up to git root, registered git-root-first so the cwd-level entry overrides ancestors (source `project`)
|
|
54
|
+
6. `{cwd}/.claude/agents` (source `claude-project`)
|
|
55
|
+
7. `{cwd}/.hoocode/agents` (source `project`)
|
|
56
|
+
8. CLI `--agent` paths (highest precedence)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## MCP servers
|
|
61
|
+
|
|
62
|
+
Source: `packages/coding-agent/src/extensions/core/hoo-core.ts` (`setupMcpLoader`).
|
|
63
|
+
|
|
64
|
+
**First-wins by server name**, in this order:
|
|
65
|
+
|
|
66
|
+
1. `~/.agents/mcp.json` — user, standard format (`mcpServers` object)
|
|
67
|
+
2. `./.agents/mcp.json` — project, standard format
|
|
68
|
+
3. `~/.config/claude/mcp.json` — Claude Desktop, standard format
|
|
69
|
+
4. `~/.hoocode/mcp-servers/*.json` — user, one file per server (each with top-level `name`/`command`)
|
|
70
|
+
5. `./.hoocode/mcp-servers/*.json` — project, per-server format
|
|
71
|
+
|
|
72
|
+
Standard `mcp.json` format:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"mcpServers": {
|
|
77
|
+
"my-server": {
|
|
78
|
+
"command": "npx",
|
|
79
|
+
"args": ["-y", "my-mcp-server"],
|
|
80
|
+
"env": { "API_KEY": "..." }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Per-server format (`.hoocode/mcp-servers/<name>.json`):
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"name": "my-server",
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": ["-y", "my-mcp-server"]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Debugging discovery
|
|
99
|
+
|
|
100
|
+
Run `hoocode resources` to print everything that was discovered for the current cwd — skills, subagents, slash commands, and MCP servers — with source path and origin label.
|
|
101
|
+
|
|
102
|
+
Source: `packages/coding-agent/src/resources-cli.ts`.
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
$ hoocode resources
|
|
106
|
+
Resources discovered for /path/to/project
|
|
107
|
+
|
|
108
|
+
Skills (0)
|
|
109
|
+
(none)
|
|
110
|
+
|
|
111
|
+
Subagents (1)
|
|
112
|
+
docs - Maintain project documentation [project (.hoocode)]
|
|
113
|
+
/path/to/project/.hoocode/agents/docs.md
|
|
114
|
+
|
|
115
|
+
Slash commands (1)
|
|
116
|
+
/review - Review a diff for risk [project (.hoocode)]
|
|
117
|
+
/path/to/project/.hoocode/commands/review.md
|
|
118
|
+
|
|
119
|
+
MCP servers (1)
|
|
120
|
+
my-db-tools [project (.agents)]
|
|
121
|
+
/path/to/project/.agents/mcp.json
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This is the fastest way to verify why a `.agents/` resource is or is not being loaded.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolisachint/hoocode-agent",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.44",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"hoocodeConfig": {
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"prepublishOnly": "npm run clean && npm run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@kolisachint/hoocode-agent-core": "^0.4.
|
|
48
|
-
"@kolisachint/hoocode-ai": "^0.4.
|
|
49
|
-
"@kolisachint/hoocode-tui": "^0.4.
|
|
47
|
+
"@kolisachint/hoocode-agent-core": "^0.4.44",
|
|
48
|
+
"@kolisachint/hoocode-ai": "^0.4.44",
|
|
49
|
+
"@kolisachint/hoocode-tui": "^0.4.44",
|
|
50
50
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
51
51
|
"chalk": "^5.5.0",
|
|
52
52
|
"cli-highlight": "^2.1.11",
|