agents-inc 0.168.0 → 0.170.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/CHANGELOG.md +21 -0
- package/README.md +18 -15
- package/dist/{chunk-JIBCVXXL.js → chunk-3G7X2WKI.js} +4 -4
- package/dist/{chunk-JOEA52NR.js → chunk-44TE3RKH.js} +46 -2
- package/dist/chunk-44TE3RKH.js.map +1 -0
- package/dist/{chunk-NU2K5G54.js → chunk-52HDHJ7I.js} +11 -19
- package/dist/chunk-52HDHJ7I.js.map +1 -0
- package/dist/{chunk-EH2PGPLP.js → chunk-6HNXYYVF.js} +39 -22
- package/dist/chunk-6HNXYYVF.js.map +1 -0
- package/dist/{chunk-4UKMQUAU.js → chunk-6ZRH5RHC.js} +10 -11
- package/dist/chunk-6ZRH5RHC.js.map +1 -0
- package/dist/{chunk-5JUQKGCP.js → chunk-7RDMTR64.js} +14 -34
- package/dist/chunk-7RDMTR64.js.map +1 -0
- package/dist/{chunk-3LZNY46H.js → chunk-BMRUNMPV.js} +4 -4
- package/dist/{chunk-VVRI35SK.js → chunk-CLPUWOSA.js} +4 -4
- package/dist/{chunk-VVRI35SK.js.map → chunk-CLPUWOSA.js.map} +1 -1
- package/dist/{chunk-TW35AEB4.js → chunk-F2BHT5C4.js} +9 -7
- package/dist/chunk-F2BHT5C4.js.map +1 -0
- package/dist/{chunk-27AVGFXH.js → chunk-F5EBEATU.js} +2 -2
- package/dist/{chunk-GE7NUPMI.js → chunk-HED2DAXZ.js} +3 -3
- package/dist/{chunk-7PYXS2QU.js → chunk-KOLDW6SF.js} +3 -3
- package/dist/{chunk-7PYXS2QU.js.map → chunk-KOLDW6SF.js.map} +1 -1
- package/dist/{chunk-C2UISKIM.js → chunk-MQ6CGZNJ.js} +109 -422
- package/dist/chunk-MQ6CGZNJ.js.map +1 -0
- package/dist/{chunk-P6I72PR3.js → chunk-NCWDK6L7.js} +115 -196
- package/dist/chunk-NCWDK6L7.js.map +1 -0
- package/dist/{chunk-VRXX4D6K.js → chunk-NEZ4OAOL.js} +1 -1
- package/dist/chunk-NEZ4OAOL.js.map +1 -0
- package/dist/chunk-NIHUOWE4.js +106 -0
- package/dist/chunk-NIHUOWE4.js.map +1 -0
- package/dist/{chunk-OI2H6M5I.js → chunk-NQW25DCF.js} +2 -2
- package/dist/chunk-NQW25DCF.js.map +1 -0
- package/dist/{chunk-ZUGH4MQG.js → chunk-OYJQUA3D.js} +3 -3
- package/dist/{chunk-ZUGH4MQG.js.map → chunk-OYJQUA3D.js.map} +1 -1
- package/dist/{chunk-AG3ZVM3B.js → chunk-PJWGTNOX.js} +186 -210
- package/dist/chunk-PJWGTNOX.js.map +1 -0
- package/dist/{chunk-HR7TK2XW.js → chunk-RIPSGNLU.js} +3 -3
- package/dist/chunk-RIPSGNLU.js.map +1 -0
- package/dist/{chunk-4DRFEYCE.js → chunk-SZYQISA2.js} +7 -7
- package/dist/chunk-SZYQISA2.js.map +1 -0
- package/dist/{chunk-W6GO2CYX.js → chunk-USVBYQSQ.js} +2 -2
- package/dist/{chunk-H4ZKGGTE.js → chunk-V3KTSP3Q.js} +50 -42
- package/dist/chunk-V3KTSP3Q.js.map +1 -0
- package/dist/{chunk-KTLKR4YY.js → chunk-WTWMGH2C.js} +2 -2
- package/dist/commands/build/marketplace.js +23 -22
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +8 -9
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/compile.js +19 -20
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +17 -18
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +118 -297
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +21 -33
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +17 -45
- package/dist/commands/list.js +19 -17
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +11 -11
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/search.js +12 -13
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +11 -12
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +18 -20
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +8 -9
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/removal-plan-confirm.js +2 -2
- package/dist/components/common/scroll-affordance.js +9 -0
- package/dist/components/common/select-list.js +2 -3
- package/dist/components/common/skill-agent-summary.js +11 -0
- package/dist/components/common/spinner.js +1 -1
- package/dist/{chunk-QWFG7Y3R.js → components/common/summary-panel.js} +57 -31
- package/dist/components/common/summary-panel.js.map +1 -0
- package/dist/config-exports.js +1 -1
- package/dist/hooks/init.js +18 -46
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-YMDWBFDP.js +14 -0
- package/dist/recompile-project-agents-SZ76WNTW.js +18 -0
- package/dist/{source-loader-FRJTCSDL.js → source-loader-C5SQXZXI.js} +5 -5
- package/dist/src/agents/meta/codex-keeper/playbook.md +2 -3
- package/package.json +2 -3
- package/src/agents/meta/codex-keeper/playbook.md +2 -3
- package/src/schemas/project-config.schema.json +1 -1
- package/assets/demo.tape +0 -266
- package/dist/chunk-23DNVNFP.js +0 -292
- package/dist/chunk-23DNVNFP.js.map +0 -1
- package/dist/chunk-3DIDV6H3.js +0 -268
- package/dist/chunk-3DIDV6H3.js.map +0 -1
- package/dist/chunk-4DRFEYCE.js.map +0 -1
- package/dist/chunk-4HWOYYY7.js +0 -92
- package/dist/chunk-4HWOYYY7.js.map +0 -1
- package/dist/chunk-4UKMQUAU.js.map +0 -1
- package/dist/chunk-5JUQKGCP.js.map +0 -1
- package/dist/chunk-6WGXTB2L.js +0 -28
- package/dist/chunk-6WGXTB2L.js.map +0 -1
- package/dist/chunk-AG3ZVM3B.js.map +0 -1
- package/dist/chunk-C2UISKIM.js.map +0 -1
- package/dist/chunk-CMJBKQUH.js +0 -23
- package/dist/chunk-CMJBKQUH.js.map +0 -1
- package/dist/chunk-DJEO3F2H.js +0 -230
- package/dist/chunk-DJEO3F2H.js.map +0 -1
- package/dist/chunk-EH2PGPLP.js.map +0 -1
- package/dist/chunk-GRL73YPF.js +0 -197
- package/dist/chunk-GRL73YPF.js.map +0 -1
- package/dist/chunk-H4ZKGGTE.js.map +0 -1
- package/dist/chunk-HI6YB7XP.js +0 -59
- package/dist/chunk-HI6YB7XP.js.map +0 -1
- package/dist/chunk-HL3GYRMR.js +0 -17
- package/dist/chunk-HL3GYRMR.js.map +0 -1
- package/dist/chunk-HR7TK2XW.js.map +0 -1
- package/dist/chunk-JOEA52NR.js.map +0 -1
- package/dist/chunk-JPMV4E4E.js +0 -118
- package/dist/chunk-JPMV4E4E.js.map +0 -1
- package/dist/chunk-JVUN6AOO.js +0 -237
- package/dist/chunk-JVUN6AOO.js.map +0 -1
- package/dist/chunk-KQ3PDARZ.js +0 -25
- package/dist/chunk-KQ3PDARZ.js.map +0 -1
- package/dist/chunk-L3W2JWBA.js +0 -168
- package/dist/chunk-L3W2JWBA.js.map +0 -1
- package/dist/chunk-LFUJCRCT.js +0 -27
- package/dist/chunk-LFUJCRCT.js.map +0 -1
- package/dist/chunk-NU2K5G54.js.map +0 -1
- package/dist/chunk-OI2H6M5I.js.map +0 -1
- package/dist/chunk-P6I72PR3.js.map +0 -1
- package/dist/chunk-PCFUXQJA.js +0 -317
- package/dist/chunk-PCFUXQJA.js.map +0 -1
- package/dist/chunk-PLX2FLEQ.js +0 -48
- package/dist/chunk-PLX2FLEQ.js.map +0 -1
- package/dist/chunk-QWFG7Y3R.js.map +0 -1
- package/dist/chunk-SLBL3WIP.js +0 -121
- package/dist/chunk-SLBL3WIP.js.map +0 -1
- package/dist/chunk-TSIU7DME.js +0 -43
- package/dist/chunk-TSIU7DME.js.map +0 -1
- package/dist/chunk-TW35AEB4.js.map +0 -1
- package/dist/chunk-VRXX4D6K.js.map +0 -1
- package/dist/chunk-W5KEYSOL.js +0 -51
- package/dist/chunk-W5KEYSOL.js.map +0 -1
- package/dist/chunk-WNLF5EDZ.js +0 -1170
- package/dist/chunk-WNLF5EDZ.js.map +0 -1
- package/dist/chunk-WTJ3AY33.js +0 -31
- package/dist/chunk-WTJ3AY33.js.map +0 -1
- package/dist/chunk-X6ZZEYO3.js +0 -53
- package/dist/chunk-X6ZZEYO3.js.map +0 -1
- package/dist/chunk-XQHZPINL.js +0 -89
- package/dist/chunk-XQHZPINL.js.map +0 -1
- package/dist/chunk-YN3SWF53.js +0 -35
- package/dist/chunk-YN3SWF53.js.map +0 -1
- package/dist/components/wizard/category-grid.js +0 -13
- package/dist/components/wizard/checkbox-grid.js +0 -12
- package/dist/components/wizard/domain-selection.js +0 -18
- package/dist/components/wizard/run-wizard-session.js +0 -40
- package/dist/components/wizard/run-wizard-session.js.map +0 -1
- package/dist/components/wizard/scroll-affordance.js +0 -9
- package/dist/components/wizard/skill-agent-summary.js +0 -13
- package/dist/components/wizard/source-grid.js +0 -16
- package/dist/components/wizard/source-grid.js.map +0 -1
- package/dist/components/wizard/stack-selection.js +0 -17
- package/dist/components/wizard/stack-selection.js.map +0 -1
- package/dist/components/wizard/step-agents.js +0 -18
- package/dist/components/wizard/step-agents.js.map +0 -1
- package/dist/components/wizard/step-build.js +0 -18
- package/dist/components/wizard/step-build.js.map +0 -1
- package/dist/components/wizard/step-confirm.js +0 -18
- package/dist/components/wizard/step-confirm.js.map +0 -1
- package/dist/components/wizard/step-sources.js +0 -19
- package/dist/components/wizard/step-sources.js.map +0 -1
- package/dist/components/wizard/step-stack.js +0 -18
- package/dist/components/wizard/step-stack.js.map +0 -1
- package/dist/components/wizard/summary-panel.js +0 -17
- package/dist/components/wizard/summary-panel.js.map +0 -1
- package/dist/components/wizard/toast.js +0 -9
- package/dist/components/wizard/toast.js.map +0 -1
- package/dist/components/wizard/wizard-layout.js +0 -22
- package/dist/components/wizard/wizard-layout.js.map +0 -1
- package/dist/components/wizard/wizard-tabs.js +0 -11
- package/dist/components/wizard/wizard-tabs.js.map +0 -1
- package/dist/components/wizard/wizard.js +0 -39
- package/dist/components/wizard/wizard.js.map +0 -1
- package/dist/load-agent-defs-5XMVB3MU.js +0 -14
- package/dist/load-agent-defs-5XMVB3MU.js.map +0 -1
- package/dist/recompile-project-agents-7PQWYQ6B.js +0 -18
- package/dist/recompile-project-agents-7PQWYQ6B.js.map +0 -1
- package/dist/source-loader-FRJTCSDL.js.map +0 -1
- package/dist/stores/wizard-store.js +0 -24
- package/dist/stores/wizard-store.js.map +0 -1
- /package/assets/{demo.gif → legacy-wizard.gif} +0 -0
- /package/dist/{chunk-JIBCVXXL.js.map → chunk-3G7X2WKI.js.map} +0 -0
- /package/dist/{chunk-3LZNY46H.js.map → chunk-BMRUNMPV.js.map} +0 -0
- /package/dist/{chunk-27AVGFXH.js.map → chunk-F5EBEATU.js.map} +0 -0
- /package/dist/{chunk-GE7NUPMI.js.map → chunk-HED2DAXZ.js.map} +0 -0
- /package/dist/{chunk-W6GO2CYX.js.map → chunk-USVBYQSQ.js.map} +0 -0
- /package/dist/{chunk-KTLKR4YY.js.map → chunk-WTWMGH2C.js.map} +0 -0
- /package/dist/components/{wizard → common}/scroll-affordance.js.map +0 -0
- /package/dist/components/{wizard → common}/skill-agent-summary.js.map +0 -0
- /package/dist/{components/wizard/category-grid.js.map → load-agent-defs-YMDWBFDP.js.map} +0 -0
- /package/dist/{components/wizard/checkbox-grid.js.map → recompile-project-agents-SZ76WNTW.js.map} +0 -0
- /package/dist/{components/wizard/domain-selection.js.map → source-loader-C5SQXZXI.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/components/wizard/summary-panel.tsx","../src/cli/components/hooks/use-panel-scroll.ts"],"sourcesContent":["import { Box, Text } from \"ink\";\nimport React from \"react\";\nimport { unique } from \"remeda\";\nimport {\n ALL_SKILLS_EJECTED_LABEL,\n CLI_COLORS,\n DEFAULT_PUBLIC_SOURCE_NAME,\n EJECT_SOURCE,\n formatSourceDisplayName,\n} from \"../../consts.js\";\nimport { useWizardStore } from \"../../stores/wizard-store.js\";\nimport type { SkillConfig } from \"../../types/config.js\";\nimport { usePanelScroll } from \"../hooks/use-panel-scroll.js\";\nimport { ScrollAffordance } from \"./scroll-affordance.js\";\nimport { SkillAgentSummary } from \"./skill-agent-summary.js\";\nimport { getStackName } from \"./utils.js\";\n\n/**\n * The Marketplace row's value: the distinct marketplaces the summarised skills come from.\n *\n * `SkillConfig.origin` is authoritative for where a skill came from, and holds exactly one\n * of two things: {@link EJECT_SOURCE}, meaning the files were copied locally, or the marketplace's\n * own name as its `marketplace.json` declares it — which is why a project initialised from a\n * different marketplace names that marketplace here without any extra plumbing.\n *\n * Three cases, and the two zero-marketplace ones are NOT the same state:\n * - **No skills at all.** Reachable — the `I` overlay opens from the stack step before anything is\n * selected. Nothing is claimed yet, so the default public marketplace stands in.\n * - **Skills, but every one ejected.** \"eject\" names no marketplace, so there is none to list;\n * naming the default would assert an origin none of those skills has.\n * - **Any marketplace-sourced skill.** Its marketplace is named. Ejected siblings contribute no\n * name but do not suppress the ones that do.\n *\n * Tombstoned (`excluded`) entries count. One still records a real global install and the\n * marketplace it came from, and `computeScopeDiff` renders it as a row in the summary below, so\n * dropping it here would leave the header disowning a row it sits above.\n *\n * Sorted, so the row cannot reorder between renders on config iteration order alone.\n */\nfunction formatSkillMarketplaces(skillConfigs: SkillConfig[]): string {\n if (skillConfigs.length === 0) return formatSourceDisplayName(DEFAULT_PUBLIC_SOURCE_NAME);\n\n const marketplaceNames = unique(\n skillConfigs.map((config) => config.origin).filter((origin) => origin !== EJECT_SOURCE),\n );\n if (marketplaceNames.length === 0) return ALL_SKILLS_EJECTED_LABEL;\n\n return marketplaceNames\n .map((name) => formatSourceDisplayName(name))\n .sort()\n .join(\" · \");\n}\n\ntype PanelHeaderProps = {\n sourceNames: string;\n stackName: string | undefined;\n};\n\n/**\n * Which marketplaces and which stack the summary below was built from.\n *\n * Rendered inside the scrolled content, so its `marginBottom` scrolls away\n * rather than permanently costing the viewport a row.\n *\n * `flexShrink={0}` is load-bearing: Ink defaults every box to `flexShrink: 1`,\n * so on a short terminal Yoga squeezes this block to fit instead of letting the\n * viewport clip it, and the Marketplace and Stack rows overprint into one\n * unreadable line. Clipping is the panel's job; the header must keep its height.\n */\nconst PanelHeader: React.FC<PanelHeaderProps> = ({ sourceNames, stackName }) => (\n <Box\n flexDirection=\"column\"\n flexShrink={0}\n borderStyle=\"single\"\n borderBottom={true}\n borderTop={false}\n borderLeft={false}\n borderRight={false}\n borderColor={CLI_COLORS.NEUTRAL}\n borderBottomDimColor\n paddingBottom={1}\n marginBottom={1}\n >\n <Box flexDirection=\"row\" columnGap={1}>\n <Text color={CLI_COLORS.WARNING} bold>\n Marketplace\n </Text>\n <Text color={CLI_COLORS.NEUTRAL}>{sourceNames}</Text>\n </Box>\n <Box flexDirection=\"row\" columnGap={1}>\n <Text color={CLI_COLORS.WARNING} bold>\n Stack\n </Text>\n <Text color={CLI_COLORS.NEUTRAL}>{stackName ?? \"none\"}</Text>\n </Box>\n </Box>\n);\n\n/**\n * Marketplace/stack header above a clipped, arrow-scrollable\n * `SkillAgentSummary` — the one panel both summary surfaces render: the `I`\n * overlay in `wizard-layout.tsx` and the confirm step.\n *\n * It owns the `↑`/`↓` keys through `usePanelScroll`. A host that needs other\n * keys adds its own `useInput` alongside it — `StepConfirm` claims `Enter` and\n * `Esc` that way.\n *\n * Horizontal padding only. Vertical padding is unshrinkable, so on a short\n * terminal it claims the last row the viewport has and the content measures 0\n * before it has ever been laid out — the panel then paints neither a summary\n * row nor the affordance that would say rows are missing.\n */\nexport const SummaryPanel: React.FC = () => {\n const skillConfigs = useWizardStore((s) => s.skillConfigs);\n const agentConfigs = useWizardStore((s) => s.agentConfigs);\n const selectedStackId = useWizardStore((s) => s.selectedStackId);\n const setupMarketplace = useWizardStore((s) => s.setupMarketplace);\n const { viewportRef, contentRef, contentMarginTop, hiddenAbove, hiddenBelow } = usePanelScroll();\n\n // A project set up from a marketplace named for it is set up from THAT one, whichever the\n // global install's skills it shows come from.\n const sourceNames =\n setupMarketplace === null\n ? formatSkillMarketplaces(skillConfigs)\n : formatSourceDisplayName(setupMarketplace);\n const stackName = getStackName(selectedStackId);\n\n return (\n <Box\n flexDirection=\"column\"\n flexGrow={1}\n flexBasis={0}\n borderStyle=\"single\"\n borderColor={CLI_COLORS.NEUTRAL}\n paddingX={2}\n >\n <Box ref={viewportRef} flexDirection=\"column\" flexGrow={1} flexBasis={0} overflow=\"hidden\">\n <Box ref={contentRef} flexDirection=\"column\" flexShrink={0} marginTop={contentMarginTop}>\n <PanelHeader sourceNames={sourceNames} stackName={stackName} />\n\n <Box width=\"100%\">\n <SkillAgentSummary skillConfigs={skillConfigs} agentConfigs={agentConfigs} />\n </Box>\n </Box>\n </Box>\n <ScrollAffordance hiddenAbove={hiddenAbove} hiddenBelow={hiddenBelow} />\n </Box>\n );\n};\n","import { useEffect, useRef, useState } from \"react\";\nimport type { Ref, RefObject } from \"react\";\nimport { type DOMElement, measureElement, useInput } from \"ink\";\nimport { useMeasuredHeight } from \"./use-measured-height.js\";\n\nexport type UsePanelScrollResult = {\n /** Attach to the clipping box — the one with `overflow=\"hidden\"`. */\n viewportRef: Ref<DOMElement>;\n /** Attach to the scrolled content box inside the viewport. */\n contentRef: RefObject<DOMElement | null>;\n /** Apply as the content box's `marginTop`; negative by the number of lines scrolled off the top. */\n contentMarginTop: number;\n /** Content lines scrolled off the top of the viewport. */\n hiddenAbove: number;\n /** Content lines clipped below the viewport. */\n hiddenBelow: number;\n};\n\n/**\n * Line scrolling for a single clipped viewport, driven by the `↑`/`↓` keys.\n *\n * The caller renders viewport, content and a `ScrollAffordance` sibling; this\n * owns the offset those three agree on. Distinct from `useSectionScroll`, which\n * moves a viewport to follow focus across variable-height sections — here there\n * is no focus, only the arrow keys.\n *\n * A host that needs other keys adds its own `useInput` alongside it, on keys\n * disjoint from `↑`/`↓`.\n */\nexport function usePanelScroll(): UsePanelScrollResult {\n // Measured on the clipping box itself, inside the border and padding, so it\n // is the height the content actually gets.\n const { ref: viewportRef, measuredHeight: viewportHeight } = useMeasuredHeight();\n const contentRef = useRef<DOMElement>(null);\n const [contentHeight, setContentHeight] = useState(0);\n const [scrollOffset, setScrollOffset] = useState(0);\n\n // Ink's measurement idiom: re-measure on every render, no dependency array\n // on purpose. The setState inside is guarded to fire only when the measured\n // height actually changed, so the chain converges instead of looping — a\n // dependency array here would skip re-measures after layout changes React\n // cannot see.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (!contentRef.current) return;\n const { height } = measureElement(contentRef.current);\n // Yoga under-reports a wrapped subtree measured inside a viewport too\n // short to lay it out, and reports 0 inside a zero-height one, so the\n // tallest reading is the trustworthy one. Believing a squeezed reading\n // would shrink the hidden-line count until the affordance disappeared,\n // which hands its row back and grows the count again — a render loop.\n setContentHeight((prev) => Math.max(prev, height));\n });\n\n // contentHeight only ever sizes the scroll range and the affordance count.\n // It must never gate the clip — which is why it is not returned: a viewport\n // that stops clipping when it looks too small grows to content height, which\n // makes it look big enough to stop clipping — a stable wrong answer that\n // paints the content over the border.\n const maxScroll = Math.max(0, contentHeight - viewportHeight);\n const hiddenBelow = Math.max(0, maxScroll - scrollOffset);\n\n useInput((_input, key) => {\n if (key.upArrow) setScrollOffset((prev) => Math.max(0, prev - 1));\n if (key.downArrow) setScrollOffset((prev) => Math.min(maxScroll, prev + 1));\n });\n\n return {\n viewportRef,\n contentRef,\n contentMarginTop: scrollOffset > 0 ? -scrollOffset : 0,\n hiddenAbove: scrollOffset,\n hiddenBelow,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,YAAY;AAC1B,OAAkB;AAClB,SAAS,cAAc;;;ACFvB,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAA0B,gBAAgB,gBAAgB;AA2BnD,SAAS,iBAAuC;AAGrD,QAAM,EAAE,KAAK,aAAa,gBAAgB,eAAe,IAAI,k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AC,OAAI,OAAM,QACT,8BAAC,qBAAkB,cAA4B,cAA4B,GAC7E;AAAA,WACF,GACF;AAAA,QACA,oBAAC,oBAAiB,aAA0B,aAA0B;AAAA;AAAA;AAAA,EACxE;AAEJ;","names":[]}
|
package/dist/chunk-SLBL3WIP.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
SCROLL_VIEWPORT
|
|
4
|
-
} from "./chunk-AG3ZVM3B.js";
|
|
5
|
-
|
|
6
|
-
// src/cli/components/hooks/use-section-scroll.ts
|
|
7
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
8
|
-
import { measureElement } from "ink";
|
|
9
|
-
function useSectionScroll({
|
|
10
|
-
sectionCount,
|
|
11
|
-
focusedIndex,
|
|
12
|
-
availableHeight,
|
|
13
|
-
minViewportRows = SCROLL_VIEWPORT.MIN_VIEWPORT_ROWS
|
|
14
|
-
}) {
|
|
15
|
-
const sectionRefs = useRef([]);
|
|
16
|
-
const viewportRef = useRef(null);
|
|
17
|
-
const contentRef = useRef(null);
|
|
18
|
-
const [sectionHeights, setSectionHeights] = useState([]);
|
|
19
|
-
const [viewportHeight, setViewportHeight] = useState(0);
|
|
20
|
-
const [contentBoxHeight, setContentBoxHeight] = useState(0);
|
|
21
|
-
const [focusScrollPx, setFocusScrollPx] = useState(0);
|
|
22
|
-
const [overscrollPx, setOverscrollPx] = useState(0);
|
|
23
|
-
const setSectionRef = useCallback((index, el) => {
|
|
24
|
-
sectionRefs.current[index] = el;
|
|
25
|
-
}, []);
|
|
26
|
-
const setViewportRef = useCallback((el) => {
|
|
27
|
-
viewportRef.current = el;
|
|
28
|
-
}, []);
|
|
29
|
-
const setContentRef = useCallback((el) => {
|
|
30
|
-
contentRef.current = el;
|
|
31
|
-
}, []);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
setContentBoxHeight(0);
|
|
34
|
-
}, [sectionCount]);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const heights = sectionRefs.current.map((el) => {
|
|
37
|
-
if (el) {
|
|
38
|
-
const { height } = measureElement(el);
|
|
39
|
-
return height;
|
|
40
|
-
}
|
|
41
|
-
return 0;
|
|
42
|
-
});
|
|
43
|
-
setSectionHeights((prev) => {
|
|
44
|
-
if (prev.length === heights.length && prev.every((h, i) => h === heights[i])) {
|
|
45
|
-
return prev;
|
|
46
|
-
}
|
|
47
|
-
return heights;
|
|
48
|
-
});
|
|
49
|
-
if (viewportRef.current) {
|
|
50
|
-
const { height } = measureElement(viewportRef.current);
|
|
51
|
-
setViewportHeight((prev) => prev !== height ? height : prev);
|
|
52
|
-
}
|
|
53
|
-
if (contentRef.current) {
|
|
54
|
-
const { height } = measureElement(contentRef.current);
|
|
55
|
-
setContentBoxHeight((prev) => height > prev ? height : prev);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const scrollEnabled = availableHeight > 0 && availableHeight >= minViewportRows;
|
|
59
|
-
const contentHeight = contentBoxHeight > 0 ? contentBoxHeight : sectionHeights.reduce((sum, h) => sum + h, 0);
|
|
60
|
-
const effectiveViewport = viewportHeight > 0 ? viewportHeight : availableHeight;
|
|
61
|
-
const maxScrollPx = scrollEnabled ? Math.max(0, contentHeight - effectiveViewport) : 0;
|
|
62
|
-
const maxScrollRef = useRef(0);
|
|
63
|
-
maxScrollRef.current = maxScrollPx;
|
|
64
|
-
const focusScrollRef = useRef(0);
|
|
65
|
-
focusScrollRef.current = focusScrollPx;
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (!scrollEnabled || sectionHeights.length === 0) return;
|
|
68
|
-
let topOfFocused = 0;
|
|
69
|
-
for (let i = 0; i < focusedIndex; i++) {
|
|
70
|
-
topOfFocused += sectionHeights[i] ?? 0;
|
|
71
|
-
}
|
|
72
|
-
const focusedHeight = sectionHeights[focusedIndex] ?? 0;
|
|
73
|
-
const bottomOfFocused = topOfFocused + focusedHeight;
|
|
74
|
-
setFocusScrollPx((prev) => {
|
|
75
|
-
if (topOfFocused < prev) {
|
|
76
|
-
return topOfFocused;
|
|
77
|
-
}
|
|
78
|
-
if (bottomOfFocused > prev + effectiveViewport) {
|
|
79
|
-
return bottomOfFocused - effectiveViewport;
|
|
80
|
-
}
|
|
81
|
-
return prev;
|
|
82
|
-
});
|
|
83
|
-
}, [focusedIndex, sectionHeights, scrollEnabled, effectiveViewport]);
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
setOverscrollPx(0);
|
|
86
|
-
}, [focusedIndex]);
|
|
87
|
-
const scrollBy = useCallback((deltaRows) => {
|
|
88
|
-
setOverscrollPx((prev) => {
|
|
89
|
-
const maxOverscroll = Math.max(0, maxScrollRef.current - focusScrollRef.current);
|
|
90
|
-
return Math.min(maxOverscroll, Math.max(0, prev + deltaRows));
|
|
91
|
-
});
|
|
92
|
-
}, []);
|
|
93
|
-
const scrollTopPx = Math.min(maxScrollPx, focusScrollPx + overscrollPx);
|
|
94
|
-
const hiddenAbove = scrollEnabled ? scrollTopPx : 0;
|
|
95
|
-
const hiddenBelow = scrollEnabled ? Math.max(0, maxScrollPx - scrollTopPx) : 0;
|
|
96
|
-
return {
|
|
97
|
-
setSectionRef,
|
|
98
|
-
setViewportRef,
|
|
99
|
-
setContentRef,
|
|
100
|
-
scrollEnabled,
|
|
101
|
-
scrollTopPx,
|
|
102
|
-
hiddenAbove,
|
|
103
|
-
hiddenBelow,
|
|
104
|
-
scrollBy
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function computeRowScrollTop(focusedRow, currentScrollTop, viewportHeight) {
|
|
108
|
-
if (focusedRow < currentScrollTop) {
|
|
109
|
-
return focusedRow;
|
|
110
|
-
}
|
|
111
|
-
if (focusedRow + 1 > currentScrollTop + viewportHeight) {
|
|
112
|
-
return focusedRow + 1 - viewportHeight;
|
|
113
|
-
}
|
|
114
|
-
return currentScrollTop;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export {
|
|
118
|
-
useSectionScroll,
|
|
119
|
-
computeRowScrollTop
|
|
120
|
-
};
|
|
121
|
-
//# sourceMappingURL=chunk-SLBL3WIP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/components/hooks/use-section-scroll.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { type DOMElement, measureElement } from \"ink\";\nimport { SCROLL_VIEWPORT } from \"../../consts.js\";\n\nexport type UseSectionScrollOptions = {\n sectionCount: number;\n focusedIndex: number;\n availableHeight: number;\n /**\n * Minimum viewport rows before clipping engages (default {@link SCROLL_VIEWPORT.MIN_VIEWPORT_ROWS}).\n * Views that must clip rather than bleed at very short heights (source-grid, which pairs the clip\n * with an overflow affordance) pass a lower value so the gate does not fall back to a bleeding\n * flex layout.\n */\n minViewportRows?: number;\n};\n\nexport type UseSectionScrollResult = {\n setSectionRef: (index: number, el: DOMElement | null) => void;\n /** Attach to the clipping viewport box so overflow counts exclude header/affordance chrome. */\n setViewportRef: (el: DOMElement | null) => void;\n /**\n * Attach to the scrolled content box so overflow counts measure the WHOLE rendered content —\n * section-group margins and labels included — not just the sum of per-section row heights.\n */\n setContentRef: (el: DOMElement | null) => void;\n scrollEnabled: boolean;\n scrollTopPx: number;\n /** Content lines scrolled off the top of the viewport (0 when not scrolling). */\n hiddenAbove: number;\n /** Content lines clipped below the viewport (0 when everything fits). */\n hiddenBelow: number;\n /** Scroll the viewport past the focus-following position to reveal clipped rows (e.g. trailing inert rows). */\n scrollBy: (deltaRows: number) => void;\n};\n\n/**\n * Shared pixel-offset scroll hook for views with variable-height sections.\n *\n * Manages section refs, height measurement, and scroll position to keep the\n * focused section visible within a constrained viewport. Extracted from the\n * identical scroll plumbing in category-grid.tsx and source-grid.tsx.\n *\n * On top of focus-following it exposes an overscroll channel (`scrollBy`) that\n * moves the viewport BEYOND the focused row so rows that can never take focus —\n * trailing inert Sources rows — can still be scrolled into view, plus the\n * `hidden{Above,Below}` counts. Overscroll resets whenever focus moves, so the\n * viewport snaps back to follow focus.\n *\n * The counts are OFFERED, not obligatory. `source-grid.tsx` feeds them to a\n * `ScrollAffordance` sibling; `category-grid.tsx` (the build grid) discards them\n * deliberately — on a grid that dense a half-cut card is self-evidently \"there\n * is more\", so a counted hint would be noise and would cost the viewport a row.\n * A consumer that ignores them is exercising that choice, not overlooking one.\n */\nexport function useSectionScroll({\n sectionCount,\n focusedIndex,\n availableHeight,\n minViewportRows = SCROLL_VIEWPORT.MIN_VIEWPORT_ROWS,\n}: UseSectionScrollOptions): UseSectionScrollResult {\n const sectionRefs = useRef<(DOMElement | null)[]>([]);\n const viewportRef = useRef<DOMElement | null>(null);\n const contentRef = useRef<DOMElement | null>(null);\n const [sectionHeights, setSectionHeights] = useState<number[]>([]);\n const [viewportHeight, setViewportHeight] = useState(0);\n const [contentBoxHeight, setContentBoxHeight] = useState(0);\n const [focusScrollPx, setFocusScrollPx] = useState(0);\n const [overscrollPx, setOverscrollPx] = useState(0);\n\n const setSectionRef = useCallback((index: number, el: DOMElement | null) => {\n sectionRefs.current[index] = el;\n }, []);\n\n const setViewportRef = useCallback((el: DOMElement | null) => {\n viewportRef.current = el;\n }, []);\n\n const setContentRef = useCallback((el: DOMElement | null) => {\n contentRef.current = el;\n }, []);\n\n // A new row set (section count change) invalidates the monotonic content-height reading.\n useEffect(() => {\n setContentBoxHeight(0);\n }, [sectionCount]);\n\n // Measure section, viewport and content heights on every render\n // Ink's measurement idiom: re-measure on every render, no dependency array\n // on purpose. The setState inside is guarded to fire only when the measured\n // height actually changed, so the chain converges instead of looping — a\n // dependency array here would skip re-measures after layout changes React\n // cannot see.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n const heights = sectionRefs.current.map((el) => {\n if (el) {\n const { height } = measureElement(el);\n return height;\n }\n return 0;\n });\n setSectionHeights((prev) => {\n if (prev.length === heights.length && prev.every((h, i) => h === heights[i])) {\n return prev;\n }\n return heights;\n });\n if (viewportRef.current) {\n const { height } = measureElement(viewportRef.current);\n setViewportHeight((prev) => (prev !== height ? height : prev));\n }\n if (contentRef.current) {\n const { height } = measureElement(contentRef.current);\n // Yoga under-reports a wrapped/clipped subtree in some layout passes, so the tallest reading\n // is the trustworthy one — mirrors info-panel/step-confirm. Reset above on row-set change.\n setContentBoxHeight((prev) => (height > prev ? height : prev));\n }\n });\n\n const scrollEnabled = availableHeight > 0 && availableHeight >= minViewportRows;\n\n // The measured content box includes section-group margins and labels; the per-section sum omits\n // them, so it is only the fallback for consumers that do not attach a content ref (category-grid).\n const contentHeight =\n contentBoxHeight > 0 ? contentBoxHeight : sectionHeights.reduce((sum, h) => sum + h, 0);\n // The measured viewport box excludes the header and affordance rows (both\n // siblings of it), so it is the height the sections actually get. Before the\n // first measurement, fall back to availableHeight (which category-grid always\n // uses — it has no separate header outside the viewport).\n const effectiveViewport = viewportHeight > 0 ? viewportHeight : availableHeight;\n const maxScrollPx = scrollEnabled ? Math.max(0, contentHeight - effectiveViewport) : 0;\n\n // Mirror the latest values into refs so `scrollBy` can clamp against them while\n // staying a stable callback (no re-created handler per render).\n const maxScrollRef = useRef(0);\n maxScrollRef.current = maxScrollPx;\n const focusScrollRef = useRef(0);\n focusScrollRef.current = focusScrollPx;\n\n // Keep focused section visible\n useEffect(() => {\n if (!scrollEnabled || sectionHeights.length === 0) return;\n\n let topOfFocused = 0;\n for (let i = 0; i < focusedIndex; i++) {\n topOfFocused += sectionHeights[i] ?? 0;\n }\n const focusedHeight = sectionHeights[focusedIndex] ?? 0;\n const bottomOfFocused = topOfFocused + focusedHeight;\n\n setFocusScrollPx((prev) => {\n if (topOfFocused < prev) {\n return topOfFocused;\n }\n if (bottomOfFocused > prev + effectiveViewport) {\n return bottomOfFocused - effectiveViewport;\n }\n return prev;\n });\n }, [focusedIndex, sectionHeights, scrollEnabled, effectiveViewport]);\n\n // Overscroll is user travel beyond the focus-following position. It resets on\n // focus movement so the viewport tracks the focused row again.\n useEffect(() => {\n setOverscrollPx(0);\n }, [focusedIndex]);\n\n const scrollBy = useCallback((deltaRows: number) => {\n setOverscrollPx((prev) => {\n const maxOverscroll = Math.max(0, maxScrollRef.current - focusScrollRef.current);\n return Math.min(maxOverscroll, Math.max(0, prev + deltaRows));\n });\n }, []);\n\n const scrollTopPx = Math.min(maxScrollPx, focusScrollPx + overscrollPx);\n const hiddenAbove = scrollEnabled ? scrollTopPx : 0;\n const hiddenBelow = scrollEnabled ? Math.max(0, maxScrollPx - scrollTopPx) : 0;\n\n return {\n setSectionRef,\n setViewportRef,\n setContentRef,\n scrollEnabled,\n scrollTopPx,\n hiddenAbove,\n hiddenBelow,\n scrollBy,\n };\n}\n\n/**\n * Pure function for row-based scroll offset computation.\n *\n * For views with uniform 1-line rows (step-agents, checkbox-grid),\n * computes the scroll offset (in rows) to keep `focusedRow` visible within\n * a viewport of `viewportHeight` rows.\n */\nexport function computeRowScrollTop(\n focusedRow: number,\n currentScrollTop: number,\n viewportHeight: number,\n): number {\n if (focusedRow < currentScrollTop) {\n return focusedRow;\n }\n if (focusedRow + 1 > currentScrollTop + viewportHeight) {\n return focusedRow + 1 - viewportHeight;\n }\n return currentScrollTop;\n}\n"],"mappings":";;;;;;AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAA0B,sBAAsB;AAsDzC,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB,gBAAgB;AACpC,GAAoD;AAClD,QAAM,cAAc,OAA8B,CAAC,CAAC;AACpD,QAAM,cAAc,OAA0B,IAAI;AAClD,QAAM,aAAa,OAA0B,IAAI;AACjD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAmB,CAAC,CAAC;AACjE,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,CAAC;AACtD,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,CAAC;AAC1D,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,CAAC;AACpD,QAAM,CAAC,cAAc,eAAe,IAAI,SA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jC,WAAO;AAAA,EACT;AACA,MAAI,aAAa,IAAI,mBAAmB,gBAAgB;AACtD,WAAO,aAAa,IAAI;AAAA,EAC1B;AACA,SAAO;AACT;","names":[]}
|
package/dist/chunk-TSIU7DME.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/cli/components/hooks/use-measured-height.ts
|
|
4
|
-
import { useRef, useState, useEffect } from "react";
|
|
5
|
-
import { measureElement, useStdout } from "ink";
|
|
6
|
-
function useMeasuredHeight() {
|
|
7
|
-
const ref = useRef(null);
|
|
8
|
-
const [measuredHeight, setMeasuredHeight] = useState(0);
|
|
9
|
-
const { stdout } = useStdout();
|
|
10
|
-
const measure = () => {
|
|
11
|
-
if (ref.current) {
|
|
12
|
-
const { height } = measureElement(ref.current);
|
|
13
|
-
setMeasuredHeight((prev) => prev !== height ? height : prev);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
measure();
|
|
18
|
-
});
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const RETRY_DELAYS_MS = [0, 16, 50];
|
|
21
|
-
const timers = [];
|
|
22
|
-
for (const delay of RETRY_DELAYS_MS) {
|
|
23
|
-
timers.push(setTimeout(measure, delay));
|
|
24
|
-
}
|
|
25
|
-
return () => {
|
|
26
|
-
for (const timer of timers) {
|
|
27
|
-
clearTimeout(timer);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}, []);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
stdout.on("resize", measure);
|
|
33
|
-
return () => {
|
|
34
|
-
stdout.off("resize", measure);
|
|
35
|
-
};
|
|
36
|
-
}, [stdout]);
|
|
37
|
-
return { ref, measuredHeight };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export {
|
|
41
|
-
useMeasuredHeight
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=chunk-TSIU7DME.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/components/hooks/use-measured-height.ts"],"sourcesContent":["import { useRef, useState, useEffect } from \"react\";\nimport { type DOMElement, measureElement, useStdout } from \"ink\";\n\n/**\n * Measures the computed height of a Box element using Ink's Yoga layout engine.\n *\n * Returns a ref to attach to a Box with `flexGrow={1}` and the measured height.\n * The Box must be inside a parent chain with a constrained height (e.g., an\n * explicit `height` prop on an ancestor) so Yoga can compute the remaining space.\n *\n * Returns 0 before the first layout pass. Re-measures on terminal resize.\n */\nexport function useMeasuredHeight(): {\n ref: React.Ref<DOMElement>;\n measuredHeight: number;\n} {\n const ref = useRef<DOMElement>(null);\n const [measuredHeight, setMeasuredHeight] = useState(0);\n const { stdout } = useStdout();\n\n const measure = () => {\n if (ref.current) {\n const { height } = measureElement(ref.current);\n setMeasuredHeight((prev) => (prev !== height ? height : prev));\n }\n };\n\n // Re-measure after every render so late-mounted refs (e.g., Sources\n // step switching from \"choice\" to \"customize\" view) get picked up.\n // The state setter avoids unnecessary updates when height is unchanged.\n useEffect(() => {\n measure();\n });\n\n // Yoga may not have computed the layout on the first render, so\n // measureElement() returns 0. Retry with increasing delays to give\n // Yoga time to resolve the full flex constraint chain.\n useEffect(() => {\n const RETRY_DELAYS_MS = [0, 16, 50];\n const timers: ReturnType<typeof setTimeout>[] = [];\n\n for (const delay of RETRY_DELAYS_MS) {\n timers.push(setTimeout(measure, delay));\n }\n\n return () => {\n for (const timer of timers) {\n clearTimeout(timer);\n }\n };\n // Deps are deliberately empty: this is a mount-only retry ladder. `measure`\n // is re-created every render, so listing it would re-arm the timers on every\n // render instead of once.\n }, []);\n\n useEffect(() => {\n stdout.on(\"resize\", measure);\n return () => {\n stdout.off(\"resize\", measure);\n };\n }, [stdout]);\n\n return { ref, measuredHeight };\n}\n"],"mappings":";;;AAAA,SAAS,QAAQ,UAAU,iBAAiB;AAC5C,SAA0B,gBAAgB,iBAAiB;AAWpD,SAAS,oBAGd;AACA,QAAM,MAAM,OAAmB,IAAI;AACnC,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,CAAC;AACtD,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,UAAU,MAAM;AACpB,QAAI,IAAI,SAAS;AACf,YAAM,EAAE,OAAO,IAAI,eAAe,IAAI,OAAO;AAC7C,wBAAkB,CAAC,SAAU,SAAS,SAAS,SAAS,IAAK;AAAA,IAC/D;AAAA,EACF;AAKA,YAAU,MAAM;AACd,YAAQ;AAAA,EACV,CAAC;AAKD,YAAU,MAAM;AACd,UAAM,kBAAkB,CAAC,GAAG,IAAI,EAAE;AAClC,UAAM,SAA0C,CAAC;AAEjD,eAAW,SAAS,iBAAiB;AACnC,aAAO,KAAK,WAAW,SAAS,KAAK,CAAC;AAAA,IACxC;AAEA,WAAO,MAAM;AACX,iBAAW,SAAS,QAAQ;AAC1B,qBAAa,KAAK;AAAA,MACpB;AAAA,IACF;AAAA,EAIF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,WAAO,GAAG,UAAU,OAAO;AAC3B,WAAO,MAAM;AACX,aAAO,IAAI,UAAU,OAAO;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO,EAAE,KAAK,eAAe;AAC/B;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/lib/operations/project/remove-compiled-agents.ts","../src/cli/lib/operations/project/compile-agents.ts","../src/cli/lib/operations/skills/discover-skills.ts","../src/cli/lib/operations/skills/copy-local-skills.ts","../src/cli/lib/operations/skills/uninstall-plugin-skills.ts","../src/cli/lib/loading/catalogue-seat.ts","../src/cli/lib/operations/project/recompile-project-agents.ts"],"sourcesContent":["import path from \"path\";\nimport { pruneStaleCompiledAgents } from \"../../agents/list-compiled-agents.js\";\nimport type { AgentCodec } from \"../../installation/install-layout.js\";\nimport { getErrorMessage } from \"../../../utils/errors.js\";\nimport { remove, removeDirIfEmpty } from \"../../../utils/fs.js\";\nimport type { AgentName } from \"../../../types/index.js\";\n\nconst AGENT_FILE_EXTENSION = \".md\";\n\nexport type RemoveCompiledAgentsOptions = {\n /** The scope's `.claude/agents/` directory holding the compiled files. */\n agentsDir: string;\n agents: readonly AgentName[];\n};\n\nexport type PruneCompiledAgentsOptions = {\n agentsDir: string;\n /**\n * The COMPLETE set of agents that belong in `agentsDir` — every other\n * CLI-compiled agent there is stale. Only an authoritative pass can say this.\n */\n keep: ReadonlySet<AgentName>;\n /** The host's agent file format — Claude's `.md` when absent. */\n codec?: AgentCodec;\n};\n\nexport type RemoveCompiledAgentsResult = {\n /** Agents whose compiled file this call disposed of; an absent file counts. */\n removed: AgentName[];\n /** Agents whose file survived an error, for the caller to report. */\n failed: Array<{ name: AgentName; error: string }>;\n};\n\ntype RemovalOutcome = { name: AgentName; ok: true } | { name: AgentName; ok: false; error: string };\n\n/**\n * Deletes the named agents' compiled `.md` files from `agentsDir`, then takes the\n * directory itself when nothing at all is left in it — the shape `deleteLocalSkill`\n * models for skills.\n *\n * A scope's `.claude/agents/` is an artefact of what it holds, so the removal that\n * empties it owns the tidy and no caller has to remember. An agent with no file on\n * disk is nothing to do rather than an error.\n */\nexport async function removeCompiledAgents(\n options: RemoveCompiledAgentsOptions,\n): Promise<RemoveCompiledAgentsResult> {\n const outcomes = await Promise.all(\n options.agents.map((name) => removeCompiledAgentFile(options.agentsDir, name)),\n );\n await tidyEmptiedAgentsDir(options.agentsDir);\n\n return {\n removed: outcomes.flatMap((outcome) => (outcome.ok ? [outcome.name] : [])),\n failed: outcomes.flatMap((outcome) =>\n outcome.ok ? [] : [{ name: outcome.name, error: outcome.error }],\n ),\n };\n}\n\n/**\n * Deletes every CLI-compiled agent in `agentsDir` outside `keep`, then takes the\n * directory on the same terms as `removeCompiledAgents`.\n *\n * Hand-authored agents are preserved by `pruneStaleCompiledAgents`'s `isAgentName`\n * predicate, so a directory this leaves empty is one nothing at all remains in.\n */\nexport async function pruneCompiledAgents(options: PruneCompiledAgentsOptions): Promise<void> {\n await pruneStaleCompiledAgents(options.agentsDir, options.keep, options.codec);\n await tidyEmptiedAgentsDir(options.agentsDir);\n}\n\nasync function removeCompiledAgentFile(\n agentsDir: string,\n name: AgentName,\n): Promise<RemovalOutcome> {\n try {\n await remove(path.join(agentsDir, `${name}${AGENT_FILE_EXTENSION}`));\n return { name, ok: true };\n } catch (error) {\n return { name, ok: false, error: getErrorMessage(error) };\n }\n}\n\n/**\n * Emptiness is FILESYSTEM emptiness, never roster emptiness: a hand-authored agent\n * or any user-owned file keeps the directory alive whatever a config says. The\n * agents directory only — `.claude/` above it is uninstall's decision, not a\n * removal path's.\n */\nasync function tidyEmptiedAgentsDir(agentsDir: string): Promise<void> {\n await removeDirIfEmpty(agentsDir);\n}\n","import { pruneCompiledAgents } from \"./remove-compiled-agents.js\";\nimport { recompileAgents } from \"../../agents/index.js\";\nimport { loadInstalledConfig } from \"../../configuration/index.js\";\nimport { buildAgentScopeMap } from \"../../installation/index.js\";\nimport { agentCodec, providerInUse } from \"../../installation/install-layout.js\";\nimport type { AgentName, SkillDefinitionMap, SkillScope } from \"../../../types/index.js\";\n\nexport type CompileAgentsOptions = {\n projectDir: string;\n sourcePath: string;\n pluginDir?: string;\n skills?: SkillDefinitionMap;\n agentScopeMap?: Map<AgentName, SkillScope>;\n agents?: AgentName[];\n /** When set, loads config and filters agents to only those matching this scope. */\n scopeFilter?: SkillScope;\n outputDir?: string;\n};\n\nexport type CompilationResult = {\n compiled: AgentName[];\n /**\n * The subset of `compiled` whose file this pass actually wrote. A pass whose\n * `rewritten` is empty changed nothing on disk, which is exactly what the\n * recompile summary reports and what the count it replaced could not say.\n */\n rewritten: AgentName[];\n failed: AgentName[];\n warnings: string[];\n};\n\n/**\n * Compiles agent markdown files from templates + skill content.\n *\n * Thin wrapper around recompileAgents() that standardizes options.\n * The caller invokes this once (edit, update) or twice with scopeFilter (compile).\n */\nexport async function compileAgents(options: CompileAgentsOptions): Promise<CompilationResult> {\n const { agents: resolvedAgents, agentScopeMap: resolvedAgentScopeMap } = options.scopeFilter\n ? await rosterForScope(options, options.scopeFilter)\n : { agents: options.agents, agentScopeMap: options.agentScopeMap };\n\n const recompileResult = await recompileAgents({\n pluginDir: options.pluginDir ?? options.projectDir,\n sourcePath: options.sourcePath,\n ...(resolvedAgents !== undefined && { agents: resolvedAgents }),\n ...(options.skills !== undefined && { skills: options.skills }),\n projectDir: options.projectDir,\n ...(options.outputDir !== undefined && { outputDir: options.outputDir }),\n ...(resolvedAgentScopeMap !== undefined && { agentScopeMap: resolvedAgentScopeMap }),\n });\n\n await pruneStaleAgentsForPass(options, recompileResult);\n\n return {\n compiled: recompileResult.compiled,\n rewritten: recompileResult.rewritten,\n failed: recompileResult.failed,\n warnings: recompileResult.warnings,\n };\n}\n\n/**\n * What a scope-filtered pass compiles, read off the installed config: the requested agents\n * narrowed to those active at `scope` (all of those when none were requested), and the caller's\n * scope routing — auto-built from the config when the caller passed none. With no installed\n * config, both are the caller's as passed.\n */\nasync function rosterForScope(\n options: CompileAgentsOptions,\n scope: SkillScope,\n): Promise<{\n agents: AgentName[] | undefined;\n agentScopeMap: Map<AgentName, SkillScope> | undefined;\n}> {\n const config = (await loadInstalledConfig(options.projectDir))?.config;\n const activeAtScope = config?.agents\n .filter((agent) => !agent.excluded && agent.scope === scope)\n .map((agent) => agent.name);\n\n return {\n agents: requestedAgentsAmong(options.agents, activeAtScope),\n agentScopeMap: options.agentScopeMap ?? (config ? buildAgentScopeMap(config) : undefined),\n };\n}\n\n/** The requested agents that appear in `activeAtScope`; either list alone when the other is absent. */\nfunction requestedAgentsAmong(\n requested: AgentName[] | undefined,\n activeAtScope: AgentName[] | undefined,\n): AgentName[] | undefined {\n if (activeAtScope === undefined) return requested;\n if (requested === undefined) return activeAtScope;\n\n const atScope = new Set(activeAtScope);\n return requested.filter((name) => atScope.has(name));\n}\n\n/**\n * Compiled-agent writes are additive, so a deselected or stale agent's `.md`\n * lingers after recompile. An authoritative, scope-UNfiltered pass owns its\n * entire `outputDir` (its resolved roster is the full set for that directory),\n * so it prunes built-in agents no longer compiled there. A scope-FILTERED pass\n * (the hasBoth two-pass compile, or the registered-project recompile)\n * sees only one scope's agents and must never delete another scope's files, so\n * it skips pruning. Removing the stale files and tidying the directory they\n * emptied is one operation's job, not this pass's.\n */\nasync function pruneStaleAgentsForPass(\n options: CompileAgentsOptions,\n recompileResult: CompilationResult,\n): Promise<void> {\n if (options.scopeFilter || !options.outputDir) return;\n\n const compiledForDir = new Set<AgentName>([\n ...recompileResult.compiled,\n ...recompileResult.failed,\n ]);\n await pruneCompiledAgents({\n agentsDir: options.outputDir,\n keep: compiledForDir,\n // The host this installation compiles for — a Codex role is a `.toml`, and a prune that only\n // knew `.md` left a deselected role in place for Codex to keep offering (CLI-896's sibling).\n codec: agentCodec(providerInUse(options.projectDir)),\n });\n}\n","import { discoverAllPluginSkills } from \"../../plugins/index.js\";\nimport { isHomeDirectory } from \"../../installation/is-home-directory.js\";\n// loadSkillsFromDir lives in loading/ (a leaf) so both this module and\n// plugins/plugin-discovery can share it without an operations↔plugins cycle.\nimport { loadSkillsFromDir, type LoadedSkills } from \"../../loading/index.js\";\nimport { verbose } from \"../../../utils/logger.js\";\nimport { globalInstallRoot } from \"../../../consts.js\";\nimport {\n installBaseDir,\n providerInUse,\n skillsDir,\n skillsPathPrefix,\n} from \"../../installation/install-layout.js\";\nimport { typedEntries, typedKeys } from \"../../../utils/typed-object.js\";\nimport type { UnusableSkillMetadata } from \"../../loading/index.js\";\nimport type {\n SkillDefinition,\n SkillDefinitionMap,\n SkillId,\n SkillScope,\n} from \"../../../types/index.js\";\n\nexport type DiscoveredSkills = {\n allSkills: SkillDefinitionMap;\n totalSkillCount: number;\n pluginSkillCount: number;\n localSkillCount: number;\n globalPluginSkillCount: number;\n globalLocalSkillCount: number;\n /**\n * Installed skills whose metadata.yaml exists but describes no skill, from either\n * scope. Nothing was loaded for them; `compile` refuses the run over any entry\n * here rather than compile agents around a skill its metadata does not describe.\n */\n unusableMetadata: UnusableSkillMetadata[];\n};\n\n/** The result of a local-skill scan that was not performed. */\nconst NO_LOCAL_SKILLS: LoadedSkills = { skills: {}, unusableMetadata: [] };\n\n/**\n * Discovers the skills copied in rather than installed as plugins, at one scope of one project.\n *\n * **It composed `<rootDir>/.claude/skills` until 2026-09-22, for every provider**, which made this\n * the last Claude literal on the eject READ path: a Codex installation copies its skills to\n * `$CODEX_HOME/skills` and `<repo>/.agents/skills` — the WRITE path routes through the layout\n * already — and this read went on looking in a directory that host never writes to. Nothing failed:\n * the scan answered \"no skills\", which is the same answer an empty installation gives.\n *\n * The scope is a required argument rather than a defaulted one, for the reason C2 deleted\n * `DEFAULT_PROVIDER`: a default is invisible at the call site, and the two call sites below mean\n * different things by it. The provider is READ off the scope root the same way\n * `resolveInstallPaths` reads it, from one probe, so the directory and the prefix cannot name two\n * different installations.\n */\nexport async function discoverLocalProjectSkills(\n projectDir: string,\n scope: SkillScope,\n): Promise<LoadedSkills> {\n const provider = providerInUse(installBaseDir(projectDir, scope));\n\n return loadSkillsFromDir(skillsDir(provider, scope, projectDir), {\n pathPrefix: skillsPathPrefix(provider, scope, projectDir),\n requireMetadata: true,\n });\n}\n\n/** Where the global scope's copied-in skills are, for the diagnostic line that names them. */\nfunction globalSkillsRoot(): string {\n const home = globalInstallRoot();\n return skillsDir(providerInUse(home), \"global\", home);\n}\n\n/** The same, for whichever scope the project pass asked. */\nfunction projectSkillsRoot(projectDir: string, scope: SkillScope): string {\n return skillsDir(providerInUse(installBaseDir(projectDir, scope)), scope, projectDir);\n}\n\n/** Merges skill maps — later sources take precedence over earlier ones. */\nexport function mergeSkills(...skillSources: SkillDefinitionMap[]): SkillDefinitionMap {\n const merged: SkillDefinitionMap = {};\n\n for (const source of skillSources) {\n for (const [id, skill] of typedEntries<SkillId, SkillDefinition | undefined>(source)) {\n if (skill) {\n merged[id] = skill;\n }\n }\n }\n\n return merged;\n}\n\n/**\n * Discovers all installed skills for a project directory using a 4-way merge: the global scope's\n * plugins and copied-in skills, then the project's own of each, so the project wins on conflict.\n *\n * **Every one of the four is resolved per PROVIDER rather than spelled as a Claude path.** The\n * plugin halves go through `hostAt(...).listPlugins` and the copied-in halves through\n * {@link discoverLocalProjectSkills}; on Claude that is `~/.claude/{plugins,skills}` and\n * `<project>/.claude/{plugins,skills}` exactly as it always was, and on Codex it is the Codex\n * state root and the repository's own `.agents/skills`.\n *\n * Pure function — no user-facing logging. Callers add their own log messages.\n * Uses verbose() for diagnostic output only.\n */\nexport async function discoverInstalledSkills(projectDir: string): Promise<DiscoveredSkills> {\n const isGlobalProject = isHomeDirectory(projectDir);\n\n // 1. Global plugins\n const globalPluginSkills = isGlobalProject\n ? {}\n : await discoverAllPluginSkills(globalInstallRoot());\n const globalPluginSkillCount = typedKeys<SkillId>(globalPluginSkills).length;\n if (globalPluginSkillCount > 0) {\n verbose(` Found ${globalPluginSkillCount} skills from global plugins`);\n }\n\n // 2. Global local skills\n const globalLocal = isGlobalProject\n ? NO_LOCAL_SKILLS\n : await discoverLocalProjectSkills(projectDir, \"global\");\n const globalLocalSkillCount = typedKeys<SkillId>(globalLocal.skills).length;\n if (globalLocalSkillCount > 0) {\n verbose(` Found ${globalLocalSkillCount} global local skills from ${globalSkillsRoot()}`);\n }\n\n // 3. Project plugins\n const pluginSkills = await discoverAllPluginSkills(projectDir);\n const pluginSkillCount = typedKeys<SkillId>(pluginSkills).length;\n verbose(` Found ${pluginSkillCount} skills from installed plugins`);\n\n // 4. Project local skills.\n //\n // At the HOME root the two scopes are one installation, so the project pass asks the GLOBAL\n // scope — which is the same directory on Claude and is `$CODEX_HOME/skills` rather than\n // `<home>/.agents/skills` on Codex. Asking both and merging would double the local count on\n // every Claude run for no gain.\n const localScope: SkillScope = isGlobalProject ? \"global\" : \"project\";\n const local = await discoverLocalProjectSkills(projectDir, localScope);\n const localSkillCount = typedKeys<SkillId>(local.skills).length;\n verbose(\n ` Found ${localSkillCount} local skills from ${projectSkillsRoot(projectDir, localScope)}`,\n );\n\n // Merge: global first, project second — project wins on conflict\n const allSkills = mergeSkills(globalPluginSkills, globalLocal.skills, pluginSkills, local.skills);\n const totalSkillCount = typedKeys<SkillId>(allSkills).length;\n\n return {\n allSkills,\n totalSkillCount,\n pluginSkillCount: globalPluginSkillCount + pluginSkillCount,\n localSkillCount: globalLocalSkillCount + localSkillCount,\n globalPluginSkillCount,\n globalLocalSkillCount,\n unusableMetadata: [...globalLocal.unusableMetadata, ...local.unusableMetadata],\n };\n}\n","import { resolveInstallPaths } from \"../../installation/index.js\";\nimport { copySkillsToLocalFlattened, type CopiedSkill } from \"../../skills/index.js\";\nimport { ensureDir } from \"../../../utils/fs.js\";\nimport type { SkillConfig } from \"../../../types/config.js\";\nimport type { SourceLoadResult } from \"../../loading/source-loader.js\";\n\nexport type SkillCopyResult = {\n projectCopied: CopiedSkill[];\n globalCopied: CopiedSkill[];\n totalCopied: number;\n};\n\n/** Copies one scope's local skills into its skills directory. */\nasync function copyScopedLocalSkills(\n scopeSkills: SkillConfig[],\n skillsDir: string,\n sourceResult: SourceLoadResult,\n): Promise<CopiedSkill[]> {\n if (scopeSkills.length === 0) return [];\n\n await ensureDir(skillsDir);\n\n return copySkillsToLocalFlattened(\n scopeSkills.map((s) => s.id),\n skillsDir,\n sourceResult,\n );\n}\n\n/**\n * Copies local-source skills to their scope-appropriate directories.\n *\n * Splits skills by scope (project vs global), resolves install paths,\n * ensures directories exist, and copies from source.\n */\nexport async function copyLocalSkills(\n skills: SkillConfig[],\n projectDir: string,\n sourceResult: SourceLoadResult,\n): Promise<SkillCopyResult> {\n const projectLocalSkills = skills.filter((s) => s.scope !== \"global\");\n const globalLocalSkills = skills.filter((s) => s.scope === \"global\");\n\n const projectPaths = resolveInstallPaths(projectDir, \"project\");\n const globalPaths = resolveInstallPaths(projectDir, \"global\");\n\n const projectCopied = await copyScopedLocalSkills(\n projectLocalSkills,\n projectPaths.skillsDir,\n sourceResult,\n );\n const globalCopied = await copyScopedLocalSkills(\n globalLocalSkills,\n globalPaths.skillsDir,\n sourceResult,\n );\n\n return {\n projectCopied,\n globalCopied,\n totalCopied: projectCopied.length + globalCopied.length,\n };\n}\n","import { hostAt } from \"../../hosts/host-for.js\";\nimport { buildMarketplacePluginRef } from \"../../plugins/index.js\";\nimport { getErrorMessage } from \"../../../utils/errors.js\";\nimport type { SkillId } from \"../../../types/index.js\";\nimport type { SkillConfig, SkillScope } from \"../../../types/config.js\";\n\n/**\n * Where a plugin is looked for when the old config has no entry naming the skill at all.\n *\n * The scope translation swallowed this until C3 — an absent scope and a project one mapped to the\n * same Claude scope word — so the behaviour is unchanged and only the silence is gone. It is the\n * safe direction of the two: a project-scoped removal cannot take a plugin away from every other\n * project under one HOME.\n */\nconst SCOPE_OF_AN_UNRECORDED_SKILL: SkillScope = \"project\";\n\nexport type PluginUninstallResult = {\n /**\n * The skills whose plugin registration this run really dropped.\n *\n * OBSERVED rather than asked for: a host's `uninstallPlugin` answers `removed` or\n * `absent`, and until that answer was read this list held every id the caller named — so a\n * plugin the user had already removed themselves was reported as one `edit` had just taken\n * away. Neither is a failure, which is why the distinction cannot be an exception and has to be\n * the return value.\n */\n uninstalled: SkillId[];\n failed: Array<{ id: SkillId; error: string }>;\n};\n\n/**\n * Uninstalls skill plugins through the host this installation belongs to, using the scope the\n * old config filed each one under.\n *\n * Each plugin reference is qualified as `{skillId}@{marketplace}` to match\n * the form used at install time — bare skill IDs will not match the registry.\n */\nexport async function uninstallPluginSkills(\n skillIds: SkillId[],\n oldSkills: SkillConfig[],\n marketplace: string,\n projectDir: string,\n): Promise<PluginUninstallResult> {\n const host = hostAt(projectDir);\n const uninstalled: SkillId[] = [];\n const failed: PluginUninstallResult[\"failed\"] = [];\n\n for (const skillId of skillIds) {\n const oldSkill = oldSkills.find((s) => s.id === skillId);\n const pluginScope = oldSkill?.scope ?? SCOPE_OF_AN_UNRECORDED_SKILL;\n const pluginRef = buildMarketplacePluginRef(skillId, marketplace);\n try {\n const outcome = await host.uninstallPlugin(pluginRef, pluginScope, projectDir);\n if (outcome === \"removed\") uninstalled.push(skillId);\n } catch (error) {\n failed.push({ id: skillId, error: getErrorMessage(error) });\n }\n }\n\n return { uninstalled, failed };\n}\n","import type { MergedSkillsMatrix } from \"../../types\";\nimport { initializeMatrix, matrix } from \"../matrix/matrix-provider.js\";\nimport { loadSkillsMatrixFromSource } from \"./source-loader.js\";\n\n/**\n * Runs `body` with the skills catalogue seated for `projectDir`, hands it the catalogue\n * that was seated, and puts the caller's own seat back afterwards.\n *\n * A registered project's own local skills, and the skills of the marketplace ITS config\n * names, are in that project's catalogue and in nobody else's. Two things a fan-out does to\n * such a project read a catalogue, and both used to read the TRIGGERING command's:\n *\n * - The RENDER of a compiled agent, which reaches the catalogue through the module-level\n * singleton (`matrix` in `matrix-provider.ts`) that `statedUsageFor` and `liveCategoryOf`\n * in `stacks/stacks-loader.ts` read directly, so no argument reaches it. Rendered against\n * somebody else's seat, each of the project's own skills loses the `usageGuidance` it\n * states and falls back to the per-category placeholder.\n * - The DERIVATION of that project's `config-types.ts` unions, which looks each configured\n * skill's category up in the catalogue (`deriveCategories` / `deriveDomains`). Against\n * somebody else's, a skill only this project's catalogue carries resolves to nothing and\n * its category and domain leave the project's `Category` and `Domain` unions.\n *\n * Both have the same ending: the project's own next `compile` writes the value back from its\n * own catalogue, so the two commands undo each other for as long as they are both run.\n *\n * The catalogue is PASSED to the body as well as seated, so a derivation that can take one as\n * an argument does — a body reading the singleton it just asked to be seated cannot say which\n * seat it got, which is the distinction the whole helper exists to keep. `compile.ts`'s\n * `seatMatrixForPass` returns its catalogue for the same reason.\n *\n * The seat is restored rather than left standing because this is a side trip: the caller has\n * its own pass to finish — `init` and `edit` compile their own agents after the gate returns —\n * and would otherwise render them against the last registered project's catalogue.\n *\n * The load sits outside the `try` deliberately. It seats nothing when it throws, so there is\n * no seat to restore, and a project whose catalogue cannot be loaded is left to the caller's\n * own failure handling rather than silently processed against somebody else's — which is the\n * whole defect this exists to stop. Both callers count such a project as one they could not\n * reach and carry on with the rest.\n *\n * The load is an `\"upkeep\"` one: a fan-out rewrites a project that is already installed, so a\n * marketplace that has since lost its manifest does not leave the project naming global content\n * a change elsewhere just removed.\n */\nexport async function withCatalogueSeatedFor<T>(\n projectDir: string,\n body: (catalogue: MergedSkillsMatrix) => Promise<T>,\n): Promise<T> {\n const callersCatalogue = matrix;\n const { matrix: seated } = await loadSkillsMatrixFromSource({\n projectDir,\n purpose: \"upkeep\",\n skipExtraSources: true,\n matrixOnly: true,\n });\n try {\n return await body(seated);\n } finally {\n initializeMatrix(callersCatalogue);\n }\n}\n","import { compileAgents, type CompilationResult } from \"./compile-agents.js\";\nimport { loadAgentDefs } from \"./load-agent-defs.js\";\nimport { discoverInstalledSkills } from \"../skills/index.js\";\nimport { resolveInstallPaths } from \"../../installation/index.js\";\nimport { withCatalogueSeatedFor } from \"../../loading/catalogue-seat.js\";\nimport { getErrorMessage } from \"../../../utils/errors.js\";\n\n/**\n * Recompiles the PROJECT-scoped agents of a registered project after a global\n * config change was propagated into that project's `config.ts`.\n *\n * Propagation (`propagateGlobalChangesToProjects`) rewrites a registered\n * project's `config.ts` / `config-types.ts` but never touches its compiled\n * `.claude/agents/*.md`, so the compiled agents keep emitting whatever skill\n * reference form the OLD global data dictated. Run this per propagated project,\n * after propagation, to bring the compiled artifacts back in step.\n *\n * Scope: project only. The global agents were already recompiled by the\n * triggering operation's own pass; repeating a global pass per project would\n * rewrite `~/.claude/agents` once per registered project for no gain.\n *\n * Both inputs a compiled agent's bytes depend on are resolved from THIS\n * project's directory, and neither is inherited from the command that triggered\n * the fan-out: `skills` is passed explicitly, because without it\n * `recompileAgents` falls back to `discoverAllPluginSkills`, which sees plugin\n * skills only and would silently strip every global-local and project-local\n * skill; and the catalogue is seated by {@link withCatalogueSeatedFor}, because\n * the render reads it from a module-level singleton no argument reaches.\n *\n * Agent partials always come from the CLI itself (`getLocalAgentDefinitions`\n * returns `sourcePath: PROJECT_ROOT`), so no per-project marketplace source\n * resolution is needed.\n */\nexport async function recompileRegisteredProjectAgents(\n projectDir: string,\n): Promise<CompilationResult> {\n return withCatalogueSeatedFor(projectDir, async () => {\n const { allSkills } = await discoverInstalledSkills(projectDir);\n const { sourcePath } = await loadAgentDefs();\n\n return compileAgents({\n projectDir,\n sourcePath,\n skills: allSkills,\n scopeFilter: \"project\",\n outputDir: resolveInstallPaths(projectDir, \"project\").agentsDir,\n });\n });\n}\n\nexport type PropagatedRecompileSummary = {\n /** Projects where at least one compiled agent's content actually moved. */\n rewrittenCount: number;\n /**\n * Projects the fan-out reached whose agents all came back byte-identical. They\n * were visited and left alone, which is a different fact from being recompiled\n * and the one the old single count could not tell apart.\n */\n unchangedCount: number;\n failedCount: number;\n /** Per-project warnings in processing order — the caller surfaces them via warn(). */\n warnings: string[];\n};\n\n/**\n * Runs {@link recompileRegisteredProjectAgents} over every propagated project,\n * isolating per-project failures: one project's unreadable config or broken\n * template must not abort the loop or leave the remaining projects stale.\n * Projects are processed sequentially so the collected warnings keep a\n * deterministic per-project order.\n */\nexport async function recompilePropagatedProjectAgents(\n projectDirs: string[],\n): Promise<PropagatedRecompileSummary> {\n let rewrittenCount = 0;\n let unchangedCount = 0;\n let failedCount = 0;\n const warnings: string[] = [];\n\n for (const dir of projectDirs) {\n try {\n const result = await recompileRegisteredProjectAgents(dir);\n if (result.failed.length > 0) {\n failedCount++;\n warnings.push(...result.warnings);\n continue;\n }\n if (result.rewritten.length > 0) rewrittenCount++;\n else unchangedCount++;\n } catch (error) {\n failedCount++;\n warnings.push(`Could not recompile agents in ${dir}: ${getErrorMessage(error)}`);\n }\n }\n\n return { rewrittenCount, unchangedCount, failedCount, warnings };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAOjB,IAAM,uBAAuB;AAqC7B,eAAsB,qBACpB,SACqC;AACrC,QAAM,WAAW,MAAM,QAAQ;AAAA,IAC7B,QAAQ,OAAO,IA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ClB,QAAM,WAAqB,CAAC;AAE5B,aAAW,OAAO,aAAa;AAC7B,QAAI;AACF,YAAM,SAAS,MAAM,iCAAiC,GAAG;AACzD,UAAI,OAAO,OAAO,SAAS,GAAG;AAC5B;AACA,iBAAS,KAAK,GAAG,OAAO,QAAQ;AAChC;AAAA,MACF;AACA,UAAI,OAAO,UAAU,SAAS,EAAG;AAAA,UAC5B;AAAA,IACP,SAAS,OAAO;AACd;AACA,eAAS,KAAK,iCAAiC,GAAG,KAAK,gBAAgB,KAAK,CAAC,EAAE;AAAA,IACjF;AAAA,EACF;AAEA,SAAO,EAAE,gBAAgB,gBAAgB,aAAa,SAAS;AACjE;","names":["skillsDir"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/components/common/spinner.tsx"],"sourcesContent":["import React from \"react\";\nimport { Text, type Instance } from \"ink\";\nimport { Spinner as InkSpinner } from \"@inkjs/ui\";\nimport { render } from \"../render.js\";\n\ntype SpinnerProps = {\n label: string;\n};\n\nexport const Spinner: React.FC<SpinnerProps> = ({ label }) => <InkSpinner label={label} />;\n\n/**\n * Awaits `load` behind a spinner and takes the spinner down whichever way the await ends, leaving\n * the terminal as it found it — what `init` and `edit` render next is a wizard sized to the\n * terminal's full height, so one line left above it pushes the wizard's top line off the screen.\n *\n * The cleanup is a `finally` because a load that refuses the run throws from inside this await,\n * and oclif would otherwise paint its error under an Ink tree still repainting over it. Never a\n * `catch`: the throw reaches the caller untouched, or both the error rendering and the exit code\n * change with it.\n */\nexport async function awaitUnderSpinner<T>(label: string, load: () => Promise<T>): Promise<T> {\n const spinner = render(<Spinner label={label} />);\n try {\n return await load();\n } finally {\n await takeDownWithoutTrace(spinner, label);\n }\n}\n\n/**\n * Stop the clock, paint what Ink is holding, and only then erase.\n *\n * Ink paints through a render throttle, and a spinner frame that arrives inside its window is\n * held rather than painted. `unmount()` paints whatever is held — so a spinner cleared with a\n * frame held was drawn again after the clear, where nothing erases it. A starved event loop is\n * what puts one there: a spinner tick that runs late is followed by the next one less than a\n * window later. Hence the order: the still line has no clock, so once it replaces the spinner no\n * new frame can be held; the flush paints anything already held; the clear then erases the last\n * thing painted, and `unmount()` finds nothing left to draw.\n */\nasync function takeDownWithoutTrace(spinner: Instance, label: string): Promise<void> {\n spinner.rerender(<Text>{label}</Text>);\n await spinner.waitUntilRenderFlush();\n spinner.clear();\n spinner.unmount();\n}\n"],"mappings":";;;;;;AAAA,OAAkB;AAClB,SAAS,YAA2B;AACpC,SAAS,WAAW,kBAAkB;AAOwB;AAAvD,IAAM,UAAkC,CAAC,EAAE,MAAM,MAAM,oBAAC,cAAW,OAAc;AAYxF,eAAsB,kBAAqB,OAAe,MAAoC;AAC5F,QAAM,UAAU,OAAO,oBAAC,WAAQ,OAAc,CAAE;AAChD,MAAI;AACF,WAAO,MAAM,KAAK;AAAA,EACpB,UAAE;AACA,UAAM,qBAAqB,SAAS,KAAK;AAAA,EAC3C;AACF;AAaA,eAAe,qBAAqB,SAAmB,OAA8B;AACnF,UAAQ,SAAS,oBAAC,QAAM,iBAAM,CAAO;AACrC,QAAM,QAAQ,qBAAqB;AACnC,UAAQ,MAAM;AACd,UAAQ,QAAQ;AAClB;","names":[]}
|
package/dist/chunk-W5KEYSOL.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
useKeyboardNavigation
|
|
4
|
-
} from "./chunk-JOEA52NR.js";
|
|
5
|
-
import {
|
|
6
|
-
CLI_COLORS,
|
|
7
|
-
UI_SYMBOLS
|
|
8
|
-
} from "./chunk-AG3ZVM3B.js";
|
|
9
|
-
|
|
10
|
-
// src/cli/components/common/select-list.tsx
|
|
11
|
-
import { useCallback } from "react";
|
|
12
|
-
import { Box, Text } from "ink";
|
|
13
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
function SelectList({
|
|
15
|
-
items,
|
|
16
|
-
onSelect,
|
|
17
|
-
onCancel,
|
|
18
|
-
renderItem,
|
|
19
|
-
active
|
|
20
|
-
}) {
|
|
21
|
-
const handleEnter = useCallback(
|
|
22
|
-
(index) => {
|
|
23
|
-
const item = items[index];
|
|
24
|
-
if (item) {
|
|
25
|
-
onSelect(item.value);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
[items, onSelect]
|
|
29
|
-
);
|
|
30
|
-
const { focusedIndex } = useKeyboardNavigation(
|
|
31
|
-
items.length,
|
|
32
|
-
{ onEnter: handleEnter, ...onCancel !== void 0 && { onEscape: onCancel } },
|
|
33
|
-
{ vimKeys: false, ...active !== void 0 && { active } }
|
|
34
|
-
);
|
|
35
|
-
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: items.map((item, index) => {
|
|
36
|
-
const isFocused = index === focusedIndex;
|
|
37
|
-
const marker = isFocused ? UI_SYMBOLS.CHEVRON : UI_SYMBOLS.CHEVRON_SPACER;
|
|
38
|
-
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
39
|
-
/* @__PURE__ */ jsxs(Text, { bold: isFocused, ...isFocused && { color: CLI_COLORS.PRIMARY }, children: [
|
|
40
|
-
marker,
|
|
41
|
-
" "
|
|
42
|
-
] }),
|
|
43
|
-
renderItem ? renderItem(item, isFocused) : /* @__PURE__ */ jsx(Text, { bold: isFocused, ...isFocused && { color: CLI_COLORS.PRIMARY }, children: item.label })
|
|
44
|
-
] }, index);
|
|
45
|
-
}) });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
SelectList
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=chunk-W5KEYSOL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/components/common/select-list.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { Box, Text } from \"ink\";\nimport { CLI_COLORS, UI_SYMBOLS } from \"../../consts.js\";\nimport { useKeyboardNavigation } from \"../hooks/use-keyboard-navigation.js\";\n\nexport type SelectListItem<T> = {\n value: T;\n label: string;\n};\n\nexport type SelectListProps<T> = {\n items: readonly SelectListItem<T>[];\n onSelect: (value: T) => void;\n onCancel?: (() => void) | undefined;\n renderItem?: ((item: SelectListItem<T>, isFocused: boolean) => React.ReactNode) | undefined;\n active?: boolean | undefined;\n};\n\nexport function SelectList<T>({\n items,\n onSelect,\n onCancel,\n renderItem,\n active,\n}: SelectListProps<T>): React.ReactElement {\n const handleEnter = useCallback(\n (index: number) => {\n const item = items[index];\n if (item) {\n onSelect(item.value);\n }\n },\n [items, onSelect],\n );\n\n const { focusedIndex } = useKeyboardNavigation(\n items.length,\n { onEnter: handleEnter, ...(onCancel !== undefined && { onEscape: onCancel }) },\n { vimKeys: false, ...(active !== undefined && { active }) },\n );\n\n return (\n <Box flexDirection=\"column\">\n {items.map((item, index) => {\n const isFocused = index === focusedIndex;\n const marker = isFocused ? UI_SYMBOLS.CHEVRON : UI_SYMBOLS.CHEVRON_SPACER;\n\n return (\n <Box key={index}>\n <Text bold={isFocused} {...(isFocused && { color: CLI_COLORS.PRIMARY })}>\n {marker}{\" \"}\n </Text>\n {renderItem ? (\n renderItem(item, isFocused)\n ) : (\n <Text bold={isFocused} {...(isFocused && { color: CLI_COLORS.PRIMARY })}>\n {item.label}\n </Text>\n )}\n </Box>\n );\n })}\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAgB,mBAAmB;AACnC,SAAS,KAAK,YAAY;AAgDd,SAME,KANF;AA/BL,SAAS,WAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA2C;AACzC,QAAM,cAAc;AAAA,IAClB,CAAC,UAAkB;AACjB,YAAM,OAAO,MAAM,KAAK;AACxB,UAAI,MAAM;AACR,iBAAS,KAAK,KAAK;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,OAAO,QAAQ;AAAA,EAClB;AAEA,QAAM,EAAE,aAAa,IAAI;AAAA,IACvB,MAAM;AAAA,IACN,EAAE,SAAS,aAAa,GAAI,aAAa,UAAa,EAAE,UAAU,SAAS,EAAG;AAAA,IAC9E,EAAE,SAAS,OAAO,GAAI,WAAW,UAAa,EAAE,OAAO,EAAG;AAAA,EAC5D;AAEA,SACE,oBAAC,OAAI,eAAc,UAChB,gBAAM,IAAI,CAAC,MAAM,UAAU;AAC1B,UAAM,YAAY,UAAU;AAC5B,UAAM,SAAS,YAAY,WAAW,UAAU,WAAW;AAE3D,WACE,qBAAC,OACC;AAAA,2BAAC,QAAK,MAAM,WAAY,GAAI,aAAa,EAAE,OAAO,WAAW,QAAQ,GAClE;AAAA;AAAA,QAAQ;AAAA,SACX;AAAA,MACC,aACC,WAAW,MAAM,SAAS,IAE1B,oBAAC,QAAK,MAAM,WAAY,GAAI,aAAa,EAAE,OAAO,WAAW,QAAQ,GAClE,eAAK,OACR;AAAA,SATM,KAWV;AAAA,EAEJ,CAAC,GACH;AAEJ;","names":[]}
|