cue-ai 0.9.3 → 0.10.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 +59 -0
- package/README.md +322 -346
- package/dist/cue.js +13046 -7369
- package/get.sh +37 -20
- package/install.sh +45 -34
- package/package.json +3 -3
- package/plugins/cue/.claude-plugin/plugin.json +19 -0
- package/profiles/SCHEMA.md +43 -1
- package/profiles/_types.ts +46 -4
- package/profiles/aws/profile.yaml +54 -0
- package/profiles/backend/profile.yaml +13 -3
- package/profiles/claude-ads/profile.yaml +151 -0
- package/profiles/commerce/profile.yaml +5 -1
- package/profiles/core/profile.yaml +54 -27
- package/profiles/creativity/profile.yaml +1 -0
- package/profiles/full/profile.yaml +7 -1
- package/profiles/google-ads/profile.yaml +5 -0
- package/profiles/gstack/profile.yaml +3 -1
- package/profiles/headroom/README.md +38 -0
- package/profiles/headroom/profile.yaml +45 -0
- package/profiles/hostinger/profile.yaml +1 -0
- package/profiles/legal/profile.yaml +48 -0
- package/profiles/marketing/profile.yaml +1 -0
- package/profiles/medusa-vite/profile.yaml +1 -34
- package/profiles/ops/profile.yaml +11 -3
- package/profiles/postizz/profile.yaml +4 -0
- package/profiles/readme-writer/profile.yaml +2 -1
- package/profiles/research/profile.yaml +1 -0
- package/profiles/ros2/profile.yaml +31 -0
- package/profiles/schema.json +76 -4
- package/profiles/seo/profile.yaml +14 -0
- package/profiles/supercomputer/profile.yaml +1 -0
- package/profiles/video/profile.yaml +1 -0
- package/resources/mcps/configs/claude.sanitized.json +32 -0
- package/resources/mcps/configs/codex.sanitized.json +12 -0
- package/resources/skills/skills/browser/agent-browser/SKILL.md +6 -1
- package/resources/skills/skills/browser/lightpanda/SKILL.md +1 -0
- package/resources/skills/skills/browser/playwright/SKILL.md +1 -0
- package/resources/skills/skills/career/resume-version-manager/SKILL.md +2 -2
- package/resources/skills/skills/content/pdf/SKILL.md +1 -1
- package/resources/skills/skills/content/trend-to-thread/SKILL.md +1 -0
- package/resources/skills/skills/deployment/coolify/SKILL.md +8 -0
- package/resources/skills/skills/design/banana/SKILL.md +0 -30
- package/resources/skills/skills/design/design-taste-frontend/SKILL.md +1 -1
- package/resources/skills/skills/design/remotion-best-practices/rules/mapbox.md +1 -1
- package/resources/skills/skills/design/taste-skill-v1/SKILL.md +1 -1
- package/resources/skills/skills/design/ui-ux-pro-max/SKILL.md +2 -2
- package/resources/skills/skills/gstack/benchmark/SKILL.md +1 -1
- package/resources/skills/skills/gstack/design-html/SKILL.md +3 -2
- package/resources/skills/skills/gstack/gstack-upgrade/SKILL.md +2 -1
- package/resources/skills/skills/gstack/learn/SKILL.md +2 -1
- package/resources/skills/skills/gstack/retro/SKILL.md +1 -1
- package/resources/skills/skills/gstack/setup-gbrain/SKILL.md +4 -2
- package/resources/skills/skills/gstack/sync-gbrain/SKILL.md +3 -1
- package/resources/skills/skills/hostinger/dns/SKILL.md +1 -0
- package/resources/skills/skills/hostinger/domains/SKILL.md +1 -0
- package/resources/skills/skills/hostinger/hosting/SKILL.md +1 -0
- package/resources/skills/skills/hostinger/vps/SKILL.md +1 -0
- package/resources/skills/skills/legal/legal/SKILL.md +94 -0
- package/resources/skills/skills/legal/legal-agreement/SKILL.md +418 -0
- package/resources/skills/skills/legal/legal-compare/SKILL.md +177 -0
- package/resources/skills/skills/legal/legal-compliance/SKILL.md +370 -0
- package/resources/skills/skills/legal/legal-freelancer/SKILL.md +454 -0
- package/resources/skills/skills/legal/legal-missing/SKILL.md +232 -0
- package/resources/skills/skills/legal/legal-nda/SKILL.md +283 -0
- package/resources/skills/skills/legal/legal-negotiate/SKILL.md +248 -0
- package/resources/skills/skills/legal/legal-plain/SKILL.md +169 -0
- package/resources/skills/skills/legal/legal-privacy/SKILL.md +327 -0
- package/resources/skills/skills/legal/legal-report-pdf/SKILL.md +400 -0
- package/resources/skills/skills/legal/legal-report-pdf/scripts/generate_legal_pdf.py +446 -0
- package/resources/skills/skills/legal/legal-report-pdf/templates/contract-review-template.md +190 -0
- package/resources/skills/skills/legal/legal-review/SKILL.md +202 -0
- package/resources/skills/skills/legal/legal-risks/SKILL.md +171 -0
- package/resources/skills/skills/legal/legal-terms/SKILL.md +263 -0
- package/resources/skills/skills/marketing/google-ads-audit/SKILL.md +1 -1
- package/resources/skills/skills/marketing/icp-research-assistant/SKILL.md +1 -1
- package/resources/skills/skills/marketing/programmatic-seo-builder/SKILL.md +1 -1
- package/resources/skills/skills/media/design-guide/SKILL.md +2 -2
- package/resources/skills/skills/media/logo-creator/SKILL.md +1 -1
- package/resources/skills/skills/media/multi-angle-shots/SKILL.md +2 -2
- package/resources/skills/skills/media/nano-banana/SKILL.md +1 -1
- package/resources/skills/skills/medusa/building-with-medusa/SKILL.md +1 -1
- package/resources/skills/skills/medusa/higgsfield-to-medusa-products/SKILL.md +1 -0
- package/resources/skills/skills/medusa/marva-blog-author/SKILL.md +1 -0
- package/resources/skills/skills/medusa/woocommerce-to-medusa-import/SKILL.md +1 -0
- package/resources/skills/skills/meta/autoresearch/SKILL.md +5 -0
- package/resources/skills/skills/meta/prompt-master/SKILL.md +5 -5
- package/resources/skills/skills/meta/smart-loader/scripts/smart-lookup.sh +43 -0
- package/resources/skills/skills/orchestration/oh-my-agent/SKILL.md +1 -0
- package/resources/skills/skills/polymarket/polymarket-predictions-audit/SKILL.md +1 -0
- package/resources/skills/skills/polymarket/polymarket-research/SKILL.md +1 -0
- package/resources/skills/skills/research/keyword-research/SKILL.md +1 -1
- package/resources/skills/skills/research/openai-docs/SKILL.md +1 -0
- package/resources/skills/skills/research/trendradar/SKILL.md +2 -1
- package/resources/skills/skills/review/code-review/SKILL.md +1 -1
- package/resources/skills/skills/review/security-review/SKILL.md +1 -1
- package/resources/skills/skills/robotics/ros-skill/LICENSE +201 -0
- package/resources/skills/skills/robotics/ros-skill/README.md +113 -0
- package/resources/skills/skills/robotics/ros-skill/SKILL.md +312 -0
- package/resources/skills/skills/robotics/ros-skill/examples/openclaw.md +135 -0
- package/resources/skills/skills/robotics/ros-skill/examples/sensor-monitor.md +60 -0
- package/resources/skills/skills/robotics/ros-skill/examples/turtlesim.md +82 -0
- package/resources/skills/skills/robotics/ros-skill/references/COMMANDS.md +550 -0
- package/resources/skills/skills/robotics/ros-skill/scripts/ros_cli.py +861 -0
- package/resources/skills/skills/rust/async-tokio/SKILL.md +5 -0
- package/resources/skills/skills/rust/axum-api/SKILL.md +5 -0
- package/resources/skills/skills/rust/bacon-watch/SKILL.md +5 -0
- package/resources/skills/skills/rust/bevy/SKILL.md +5 -0
- package/resources/skills/skills/rust/bindgen/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-audit/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-basics/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-chef/SKILL.md +4 -0
- package/resources/skills/skills/rust/cargo-edit/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-expand/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-flamegraph/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-fuzz/SKILL.md +4 -0
- package/resources/skills/skills/rust/cargo-hack/SKILL.md +4 -0
- package/resources/skills/skills/rust/cargo-msrv/SKILL.md +4 -0
- package/resources/skills/skills/rust/cargo-mutants/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-nextest/SKILL.md +5 -0
- package/resources/skills/skills/rust/cargo-readme/SKILL.md +4 -0
- package/resources/skills/skills/rust/cbindgen/SKILL.md +4 -0
- package/resources/skills/skills/rust/chisel-tool/SKILL.md +4 -0
- package/resources/skills/skills/rust/clap-cli/SKILL.md +5 -0
- package/resources/skills/skills/rust/clippy-and-fmt/SKILL.md +5 -0
- package/resources/skills/skills/rust/cross-compile/SKILL.md +5 -0
- package/resources/skills/skills/rust/embedded/SKILL.md +5 -0
- package/resources/skills/skills/rust/error-handling/SKILL.md +4 -0
- package/resources/skills/skills/rust/just-runner/SKILL.md +5 -0
- package/resources/skills/skills/rust/mdbook/SKILL.md +4 -0
- package/resources/skills/skills/rust/napi-rs/SKILL.md +4 -0
- package/resources/skills/skills/rust/no-std/SKILL.md +4 -0
- package/resources/skills/skills/rust/property-testing/SKILL.md +5 -0
- package/resources/skills/skills/rust/pyo3/SKILL.md +5 -0
- package/resources/skills/skills/rust/ratatui-tui/SKILL.md +4 -0
- package/resources/skills/skills/rust/release-plz/SKILL.md +4 -0
- package/resources/skills/skills/rust/reqwest/SKILL.md +5 -0
- package/resources/skills/skills/rust/sccache/SKILL.md +4 -0
- package/resources/skills/skills/rust/serde/SKILL.md +5 -0
- package/resources/skills/skills/rust/snapshot-testing/SKILL.md +4 -0
- package/resources/skills/skills/rust/sqlx-cli/SKILL.md +5 -0
- package/resources/skills/skills/rust/tracing/SKILL.md +5 -0
- package/resources/skills/skills/rust/typos-spellcheck/SKILL.md +4 -0
- package/resources/skills/skills/rust/uniffi/SKILL.md +4 -0
- package/resources/skills/skills/rust/wasm-rust/SKILL.md +5 -0
- package/resources/skills/skills/test/scenario-explorer/SKILL.md +5 -0
- package/resources/skills/skills/tools/headroom/SKILL.md +105 -0
- package/resources/skills/skills/vercel/UPSTREAM.md +12 -0
- package/resources/skills/skills/vercel/composition-patterns/AGENTS.md +946 -0
- package/resources/skills/skills/vercel/composition-patterns/README.md +60 -0
- package/resources/skills/skills/vercel/composition-patterns/SKILL.md +89 -0
- package/resources/skills/skills/vercel/composition-patterns/metadata.json +11 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/_sections.md +29 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/_template.md +24 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/architecture-compound-components.md +112 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/state-context-interface.md +191 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/resources/skills/skills/vercel/composition-patterns/rules/state-lift-state.md +125 -0
- package/resources/skills/skills/vercel/deploy-to-vercel/SKILL.md +296 -0
- package/resources/skills/skills/vercel/deploy-to-vercel/resources/deploy-codex.sh +301 -0
- package/resources/skills/skills/vercel/deploy-to-vercel/resources/deploy.sh +301 -0
- package/resources/skills/skills/vercel/react-best-practices/AGENTS.md +3810 -0
- package/resources/skills/skills/vercel/react-best-practices/README.md +123 -0
- package/resources/skills/skills/vercel/react-best-practices/SKILL.md +149 -0
- package/resources/skills/skills/vercel/react-best-practices/metadata.json +15 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/_sections.md +46 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/_template.md +28 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/advanced-init-once.md +42 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/advanced-use-latest.md +39 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/async-api-routes.md +38 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/async-defer-await.md +82 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/async-dependencies.md +51 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/async-parallel.md +28 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/bundle-analyzable-paths.md +63 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/bundle-conditional.md +31 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/bundle-preload.md +50 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/client-event-listeners.md +74 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-cache-storage.md +70 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-early-exit.md +50 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-index-maps.md +37 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-length-check-first.md +49 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-activity.md +26 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-memo.md +44 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-transitions.md +40 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-auth-actions.md +96 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-cache-lru.md +41 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-cache-react.md +76 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-dedup-props.md +65 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/resources/skills/skills/vercel/react-best-practices/rules/server-serialization.md +38 -0
- package/resources/skills/skills/vercel/react-native-skills/AGENTS.md +2897 -0
- package/resources/skills/skills/vercel/react-native-skills/README.md +165 -0
- package/resources/skills/skills/vercel/react-native-skills/SKILL.md +121 -0
- package/resources/skills/skills/vercel/react-native-skills/metadata.json +16 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/_sections.md +86 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/_template.md +28 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/animation-derived-value.md +53 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/animation-gpu-properties.md +65 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/design-system-compound-components.md +66 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/fonts-config-plugin.md +71 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/imports-design-system-folder.md +68 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/js-hoist-intl.md +61 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-callbacks.md +44 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-function-references.md +132 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-images.md +53 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-inline-objects.md +97 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-item-expensive.md +94 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-item-memo.md +82 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-item-types.md +104 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/list-performance-virtualize.md +67 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/navigation-native-navigators.md +188 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/react-state-dispatcher.md +91 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/react-state-fallback.md +56 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/react-state-minimize.md +65 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/scroll-position-no-state.md +82 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/state-ground-truth.md +80 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-expo-image.md +66 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-image-gallery.md +104 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-measure-views.md +78 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-menus.md +174 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-native-modals.md +77 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-pressable.md +61 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
- package/resources/skills/skills/vercel/react-native-skills/rules/ui-styling.md +87 -0
- package/resources/skills/skills/vercel/react-view-transitions/AGENTS.md +955 -0
- package/resources/skills/skills/vercel/react-view-transitions/README.md +42 -0
- package/resources/skills/skills/vercel/react-view-transitions/SKILL.md +320 -0
- package/resources/skills/skills/vercel/react-view-transitions/metadata.json +12 -0
- package/resources/skills/skills/vercel/react-view-transitions/references/css-recipes.md +242 -0
- package/resources/skills/skills/vercel/react-view-transitions/references/implementation.md +182 -0
- package/resources/skills/skills/vercel/react-view-transitions/references/nextjs.md +176 -0
- package/resources/skills/skills/vercel/react-view-transitions/references/patterns.md +262 -0
- package/resources/skills/skills/vercel/vercel-cli-with-tokens/SKILL.md +353 -0
- package/resources/skills/skills/vercel/vercel-optimize/AGENTS.md +48 -0
- package/resources/skills/skills/vercel/vercel-optimize/CONTRIBUTING.md +41 -0
- package/resources/skills/skills/vercel/vercel-optimize/README.md +91 -0
- package/resources/skills/skills/vercel/vercel-optimize/SKILL.md +322 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/auth-route.mjs +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/budget-summary.mjs +182 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/citations.mjs +139 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/cost-coverage.mjs +143 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/dedup-recs.mjs +325 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/deep-dive.mjs +350 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/display-labels.mjs +185 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/extract-claims.mjs +550 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/framework-support.mjs +67 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/build-minutes-fanout.mjs +69 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/cold-start.mjs +66 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/contract.mjs +79 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/cwv-poor.mjs +87 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/external-api-slow.mjs +55 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/hard-gates.mjs +73 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/index.mjs +45 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/isr-overrevalidation.mjs +62 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/middleware-heavy.mjs +51 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/observability-events-attribution.mjs +56 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/platform-bot-protection.mjs +115 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/platform-fluid-compute.mjs +83 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/region-misconfig.mjs +64 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/route-errors.mjs +80 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/scanner-driven.mjs +122 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/select-candidates.mjs +134 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/slow-route.mjs +88 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/types.d.ts +38 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/uncached-route.mjs +93 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/gates/usage-spike-triage.mjs +121 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/grade-recommendation.mjs +155 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/impact-label.mjs +126 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/impact-magnitude.mjs +60 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/investigation-brief.mjs +610 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/observation-safety.mjs +174 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/project-facts.mjs +99 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/queries.mjs +315 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/reconcile-candidates.mjs +372 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/render-report.mjs +955 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/repo-root.mjs +86 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/route-normalize.mjs +220 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/bot-protection-certainty.mjs +38 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/cache-tag-invalidation-certainty.mjs +30 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/count-correct.mjs +52 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/function-duration-invocations.mjs +38 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/index.mjs +79 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/middleware-conflict.mjs +36 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/missing-citation.mjs +16 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/pre-release.mjs +74 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/rate-limit.mjs +67 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/rendering-mode-mislabel.mjs +38 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/undeclared-dep.mjs +78 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/vercel-directive-strip.mjs +37 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/sanitizers/window-units.mjs +32 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/cache-components-suspense-dedupe.mjs +109 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/edge-heavy-import.mjs +94 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/force-dynamic.mjs +42 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/headers-in-page.mjs +44 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/index.mjs +35 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/large-static-asset.mjs +92 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/max-age-without-s-maxage.mjs +42 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/middleware-broad-matcher.mjs +55 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/missing-cache-headers.mjs +90 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/prisma-include-tree.mjs +42 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/region-pin-in-config.mjs +88 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/source-maps-production.mjs +36 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/sveltekit-prerender-missing.mjs +43 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/turbo-force-bypass.mjs +129 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/unoptimized-image.mjs +113 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/scanners/use-cache-date-stamp.mjs +106 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/support-topics.mjs +355 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/throttle.mjs +273 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/util.mjs +17 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/vercel.mjs +864 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/verify-claim.mjs +1296 -0
- package/resources/skills/skills/vercel/vercel-optimize/lib/workspace-resolver.mjs +521 -0
- package/resources/skills/skills/vercel/vercel-optimize/metadata.json +14 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/candidates.md +176 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/data-collection.md +218 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/docs-library.json +683 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/doctrine.md +105 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/observability-plus.md +108 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/README.md +53 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/ai-application.md +32 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/api-service.md +30 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/content-site.md +30 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/ecommerce.md +30 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/marketing.md +30 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/saas.md +31 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/playbooks/sveltekit.md +75 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/recommendations.md +203 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/scanner-patterns.md +251 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/scoring.md +205 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/README.md +46 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/astro-edge-middleware-scope.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/astro-output-mode-and-isr.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/auth-preserving-parallelization.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/bot-protection-product-guardrails.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/build-minutes-monorepo-fanout.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/cache-components-static-shell-boundaries.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/cache-components-suspense-dedupe-pitfall.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/cdn-cache-auth-safety.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/cold-start-initialization-bundle.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/core-web-vitals-client-bottlenecks.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/database-egress-pooling-region.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/dynamic-rendering-traps.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/external-api-critical-path-platform.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/external-api-critical-path.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/fast-data-transfer-payloads.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/fluid-compute-caveats.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/function-duration-io-and-after.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/function-invocation-reduction.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/function-region-misconfiguration-ttfb.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/image-optimization-cost-control.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/isr-revalidation-static-generation.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/middleware-proxy-edge-cost.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/next-fetch-revalidate-floor.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/next-font-cls-self-hosting.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/next-heavy-ui-lazy-load-boundaries.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/next-image-lcp-preload-sizes.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/next-route-handler-get-cache-defaults.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/next-script-third-party-strategy.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/nextjs-version-cache-semantics.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/not-found-catchall-request-waste.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/nuxt-route-rules-cache-isr.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/observability-events-cost-attribution.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/post-response-work-waituntil.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/route-error-durable-offload.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/route-error-runtime-limits.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/runtime-cache-reusable-data.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/sveltekit-isr-prerender-safety.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/sveltekit-split-cold-start-tradeoff.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/usage-spike-triage.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/use-cache-date-stamp-isr-write-amplifier.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/use-cache-remote-shared-origin-data.md +22 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/support-topics/workflow-resumable-stream-routes.md +23 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/verification.md +102 -0
- package/resources/skills/skills/vercel/vercel-optimize/references/voice.md +76 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/budget-summary.mjs +56 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/build-docs.mjs +74 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/check-citations.mjs +81 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/check-docs-fresh.mjs +93 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/collect-signals.mjs +576 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/collect-sub-agent-outputs.mjs +296 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/deep-dive.mjs +319 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/gate-investigations.mjs +166 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/merge-signals.mjs +192 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/prepare-investigation-brief.mjs +231 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/reconcile-candidates.mjs +62 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/render-report.mjs +437 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/scan-codebase.mjs +313 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/verify-and-regen.mjs +346 -0
- package/resources/skills/skills/vercel/vercel-optimize/scripts/verify-finding.mjs +19 -0
- package/resources/skills/skills/vercel/web-design-guidelines/SKILL.md +39 -0
- package/resources/skills/skills/vercel/writing-guidelines/SKILL.md +39 -0
- package/src/commands/_index.test.ts +79 -0
- package/src/commands/_index.ts +36 -14
- package/src/commands/ai.test.ts +113 -0
- package/src/commands/ai.ts +4 -5
- package/src/commands/ask.test.ts +82 -0
- package/src/commands/ask.ts +3 -4
- package/src/commands/audit.test.ts +61 -0
- package/src/commands/benchmark.test.ts +88 -0
- package/src/commands/benchmark.ts +3 -5
- package/src/commands/builtin.test.ts +199 -0
- package/src/commands/builtin.ts +3 -4
- package/src/commands/clean.test.ts +181 -0
- package/src/commands/clean.ts +3 -4
- package/src/commands/cli.test.ts +11 -3
- package/src/commands/cli.ts +3 -4
- package/src/commands/cloud.ts +3 -4
- package/src/commands/colony-dispatch.test.ts +143 -0
- package/src/commands/completions.test.ts +195 -0
- package/src/commands/cost.ts +85 -34
- package/src/commands/create-profile.test.ts +256 -0
- package/src/commands/create-profile.ts +3 -4
- package/src/commands/debug.ts +4 -5
- package/src/commands/diff.test.ts +64 -0
- package/src/commands/diff.ts +3 -4
- package/src/commands/discover.ts +10 -14
- package/src/commands/docs-facts.test.ts +103 -0
- package/src/commands/doctor.test.ts +14 -2
- package/src/commands/doctor.ts +27 -22
- package/src/commands/eval-behavior.ts +3 -4
- package/src/commands/eval.ts +6 -7
- package/src/commands/evolve.test.ts +56 -0
- package/src/commands/evolve.ts +15 -5
- package/src/commands/export-docker.test.ts +190 -0
- package/src/commands/export-docker.ts +3 -4
- package/src/commands/features-batch1.test.ts +1 -1
- package/src/commands/feedback.test.ts +63 -0
- package/src/commands/gc.test.ts +173 -0
- package/src/commands/gc.ts +65 -0
- package/src/commands/handoff.test.ts +284 -0
- package/src/commands/icon.ts +3 -4
- package/src/commands/import-profile.test.ts +199 -0
- package/src/commands/import-profile.ts +4 -5
- package/src/commands/init-cost-proof.test.ts +29 -0
- package/src/commands/init.test.ts +76 -0
- package/src/commands/init.ts +42 -7
- package/src/commands/install-sh.e2e.test.ts +17 -5
- package/src/commands/install.ts +3 -3
- package/src/commands/launch-handoff.e2e.test.ts +7 -1
- package/src/commands/launch.account-runtime.test.ts +117 -0
- package/src/commands/launch.e2e.test.ts +7 -1
- package/src/commands/launch.parse.test.ts +101 -0
- package/src/commands/launch.test.ts +94 -108
- package/src/commands/launch.ts +714 -118
- package/src/commands/lint-skill.test.ts +173 -0
- package/src/commands/loadout.test.ts +225 -0
- package/src/commands/loadout.ts +132 -0
- package/src/commands/lock.test.ts +157 -0
- package/src/commands/lock.ts +4 -5
- package/src/commands/marketplace-manifest.test.ts +39 -0
- package/src/commands/marketplace.test.ts +195 -0
- package/src/commands/marketplace.ts +176 -5
- package/src/commands/materialize.test.ts +59 -0
- package/src/commands/materialize.ts +4 -5
- package/src/commands/mcp.test.ts +109 -0
- package/src/commands/mcps.test.ts +49 -0
- package/src/commands/mcps.ts +5 -6
- package/src/commands/mem.test.ts +94 -0
- package/src/commands/merge.test.ts +57 -0
- package/src/commands/migrate.test.ts +45 -0
- package/src/commands/migrate.ts +3 -4
- package/src/commands/new.test.ts +173 -0
- package/src/commands/optimizer.test.ts +239 -0
- package/src/commands/optimizer.ts +4 -5
- package/src/commands/packs.test.ts +97 -0
- package/src/commands/packs.ts +3 -4
- package/src/commands/playground.test.ts +61 -0
- package/src/commands/playground.ts +3 -4
- package/src/commands/positioning.test.ts +46 -0
- package/src/commands/profile-draft-skill.ts +3 -4
- package/src/commands/profile-suggest.test.ts +67 -0
- package/src/commands/profile-suggest.ts +130 -5
- package/src/commands/profile.test.ts +59 -0
- package/src/commands/replay-whatif.test.ts +154 -0
- package/src/commands/replay.test.ts +68 -0
- package/src/commands/resolve.test.ts +66 -0
- package/src/commands/resolve.ts +415 -0
- package/src/commands/ruler.test.ts +94 -0
- package/src/commands/ruler.ts +213 -0
- package/src/commands/scan.test.ts +83 -0
- package/src/commands/score.test.ts +125 -0
- package/src/commands/score.ts +0 -3
- package/src/commands/security-audit.test.ts +133 -0
- package/src/commands/security-audit.ts +4 -5
- package/src/commands/security.ts +3 -4
- package/src/commands/setup.test.ts +32 -0
- package/src/commands/share.test.ts +102 -0
- package/src/commands/shell.test.ts +251 -23
- package/src/commands/shell.ts +269 -91
- package/src/commands/skill-report.test.ts +110 -0
- package/src/commands/skills-lint.test.ts +74 -0
- package/src/commands/skills-lint.ts +3 -4
- package/src/commands/skills-new.test.ts +96 -0
- package/src/commands/skills-new.ts +3 -4
- package/src/commands/skills-pin.test.ts +169 -0
- package/src/commands/skills-pin.ts +4 -5
- package/src/commands/skills-test.test.ts +215 -0
- package/src/commands/skills.test.ts +109 -0
- package/src/commands/skills.ts +10 -6
- package/src/commands/snapshot.ts +3 -4
- package/src/commands/sources.ts +3 -4
- package/src/commands/stats.test.ts +174 -0
- package/src/commands/status.test.ts +147 -0
- package/src/commands/status.ts +13 -1
- package/src/commands/suggest-pairs.test.ts +166 -0
- package/src/commands/suggest.test.ts +85 -0
- package/src/commands/suggest.ts +3 -5
- package/src/commands/summon.test.ts +8 -1
- package/src/commands/sync.test.ts +26 -0
- package/src/commands/sync.ts +184 -0
- package/src/commands/telemetry.test.ts +162 -0
- package/src/commands/trace.test.ts +48 -0
- package/src/commands/tree.test.ts +76 -0
- package/src/commands/tui.test.ts +55 -0
- package/src/commands/update.test.ts +98 -0
- package/src/commands/update.ts +8 -9
- package/src/commands/upgrade.test.ts +45 -0
- package/src/commands/upgrade.ts +4 -5
- package/src/commands/use.test.ts +63 -0
- package/src/commands/validate.test.ts +80 -0
- package/src/commands/watch-live.test.ts +46 -0
- package/src/commands/watch-live.ts +5 -6
- package/src/commands/watch.test.ts +97 -0
- package/src/commands/why.test.ts +46 -0
- package/src/commands/why.ts +4 -5
- package/src/commands/workspace.test.ts +92 -0
- package/src/index.test.ts +106 -0
- package/src/index.ts +7 -6
- package/src/lib/agent-adapters.test.ts +9 -0
- package/src/lib/agent-adapters.ts +17 -0
- package/src/lib/analytics.ts +27 -10
- package/src/lib/brand-icons.test.ts +129 -0
- package/src/lib/brand-icons.ts +6 -7
- package/src/lib/cache.test.ts +231 -0
- package/src/lib/catalog-index.test.ts +306 -0
- package/src/lib/catalog-index.ts +540 -0
- package/src/lib/claude-binary.test.ts +122 -0
- package/src/lib/claude-binary.ts +49 -19
- package/src/lib/claude-logo.test.ts +64 -0
- package/src/lib/claude-logo.ts +41 -0
- package/src/lib/cli-extractor.ts +3 -4
- package/src/lib/colony-dispatch.test.ts +59 -0
- package/src/lib/colony-dispatch.ts +3 -4
- package/src/lib/combo-history.test.ts +53 -1
- package/src/lib/combo-history.ts +41 -0
- package/src/lib/conflict-detector.test.ts +73 -0
- package/src/lib/conflict-detector.ts +2 -4
- package/src/lib/credentials-sync.ts +32 -25
- package/src/lib/cue-credentials.test.ts +74 -0
- package/src/lib/cue-credentials.ts +64 -0
- package/src/lib/cwd-resolver.ts +5 -3
- package/src/lib/dashboard-server.test.ts +45 -4
- package/src/lib/dashboard-server.ts +39 -0
- package/src/lib/handoff.test.ts +99 -0
- package/src/lib/help.test.ts +69 -0
- package/src/lib/kitty-image.ts +13 -0
- package/src/lib/launch-loader.test.ts +160 -0
- package/src/lib/launch-loader.ts +226 -0
- package/src/lib/lazy-skills.ts +41 -1
- package/src/lib/manifest-cache.test.ts +30 -0
- package/src/lib/market-install.test.ts +128 -0
- package/src/lib/market-install.ts +247 -0
- package/src/lib/mcp-catalog.ts +4 -13
- package/src/lib/mcp-materializer.ts +3 -8
- package/src/lib/mcp-overrides.test.ts +202 -0
- package/src/lib/mcp-overrides.ts +199 -0
- package/src/lib/mcp-picker.test.ts +150 -0
- package/src/lib/mcp-picker.ts +247 -0
- package/src/lib/mcp-token-estimate.test.ts +105 -0
- package/src/lib/mcp-token-estimate.ts +152 -0
- package/src/lib/pack-resolver.test.ts +81 -0
- package/src/lib/pack-resolver.ts +3 -4
- package/src/lib/pair-suggestions.test.ts +32 -5
- package/src/lib/pair-suggestions.ts +15 -12
- package/src/lib/picker/card.test.ts +109 -0
- package/src/lib/picker/card.ts +279 -0
- package/src/lib/picker/categories.test.ts +68 -0
- package/src/lib/picker/categories.ts +48 -0
- package/src/lib/picker/flow.test.ts +49 -0
- package/src/lib/picker/flow.ts +236 -0
- package/src/lib/picker/keys.test.ts +235 -0
- package/src/lib/picker/palette.test.ts +262 -0
- package/src/lib/picker/palette.ts +557 -0
- package/src/lib/picker/render-util.test.ts +213 -0
- package/src/lib/picker/render-util.ts +111 -0
- package/src/lib/picker/selector.test.ts +87 -0
- package/src/lib/picker/selector.ts +51 -0
- package/src/lib/picker/tally.test.ts +166 -0
- package/src/lib/picker/tally.ts +126 -0
- package/src/lib/picker/types.ts +135 -0
- package/src/lib/picker.test.ts +55 -31
- package/src/lib/picker.ts +119 -439
- package/src/lib/plugin-discovery.test.ts +175 -0
- package/src/lib/pr-poster.ts +6 -2
- package/src/lib/profile-conflicts.test.ts +114 -0
- package/src/lib/profile-conflicts.ts +52 -0
- package/src/lib/profile-generator.ts +5 -11
- package/src/lib/profile-linter.ts +33 -14
- package/src/lib/profile-loader.test.ts +128 -1
- package/src/lib/profile-loader.ts +61 -24
- package/src/lib/profile-merge.test.ts +30 -1
- package/src/lib/profile-merge.ts +54 -18
- package/src/lib/profile-metrics.test.ts +176 -0
- package/src/lib/profile-metrics.ts +3 -4
- package/src/lib/project-loadout.test.ts +273 -0
- package/src/lib/project-loadout.ts +358 -0
- package/src/lib/project-scanner.test.ts +228 -0
- package/src/lib/ratings.test.ts +130 -0
- package/src/lib/repo-root.test.ts +80 -0
- package/src/lib/repo-root.ts +38 -0
- package/src/lib/ruler.test.ts +332 -0
- package/src/lib/ruler.ts +374 -0
- package/src/lib/runtime-gc.test.ts +123 -0
- package/src/lib/runtime-gc.ts +203 -0
- package/src/lib/runtime-install.test.ts +70 -0
- package/src/lib/runtime-install.ts +7 -0
- package/src/lib/runtime-lock.test.ts +115 -0
- package/src/lib/runtime-materializer.mcp-prune.test.ts +105 -0
- package/src/lib/runtime-materializer.test.ts +229 -1
- package/src/lib/runtime-materializer.ts +179 -36
- package/src/lib/scan-plugins.ts +10 -5
- package/src/lib/shared-profiles.ts +9 -3
- package/src/lib/shim-dir.test.ts +101 -0
- package/src/lib/shim-dir.ts +120 -0
- package/src/lib/skill-compressor.test.ts +59 -0
- package/src/lib/skill-compressor.ts +2 -4
- package/src/lib/skill-dependencies.getNeeded.test.ts +81 -0
- package/src/lib/skill-dependencies.test.ts +39 -0
- package/src/lib/skill-dependencies.ts +77 -14
- package/src/lib/skill-deps.ts +3 -4
- package/src/lib/skill-linter.test.ts +61 -0
- package/src/lib/skill-linter.ts +72 -4
- package/src/lib/skill-quality.ts +4 -5
- package/src/lib/skill-resolve-journal.test.ts +83 -0
- package/src/lib/skill-resolve-journal.ts +86 -0
- package/src/lib/skill-sandbox.ts +3 -4
- package/src/lib/skill-subset.cache.test.ts +172 -0
- package/src/lib/skill-subset.isolation.test.ts +98 -0
- package/src/lib/skill-subset.test.ts +25 -0
- package/src/lib/skill-subset.ts +388 -39
- package/src/lib/smart-loader-suggest.hook.test.ts +173 -0
- package/src/lib/stack-suggest.test.ts +247 -0
- package/src/lib/stack-suggest.ts +352 -0
- package/src/lib/telemetry-ingest.ts +6 -1
- package/src/lib/token-budget.test.ts +141 -0
- package/src/lib/token-budget.ts +187 -0
- package/src/lib/tui/data.test.ts +206 -0
- package/src/lib/tui/input.test.ts +159 -0
- package/src/lib/tui/screen.test.ts +85 -0
- package/src/lib/uvx-installer.test.ts +54 -1
- package/src/lib/uvx-installer.ts +51 -6
- package/src/lib/webhooks.test.ts +175 -0
- package/src/lib/workflow-store.test.ts +292 -0
- package/src/lib/workspace-secrets.test.ts +99 -0
- package/src/lib/workspaces.test.ts +417 -0
- package/src/lib/workspaces.ts +3 -4
- package/plugins/cue/plugin.json +0 -15
- package/profiles/dash-merge-test/profile.yaml +0 -114
package/src/commands/launch.ts
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* Bypass paths:
|
|
7
7
|
* --cue-profile <name> force this profile
|
|
8
8
|
* --cue-pick always open picker (ignore pins)
|
|
9
|
+
* (CUE_ALWAYS_PICK=1 makes this the default for a
|
|
10
|
+
* bare, interactive launch)
|
|
9
11
|
* --dry-run everything except the final exec; prints env
|
|
10
12
|
*
|
|
11
13
|
* Recursion guard via CUE_LAUNCHING=1 in child env.
|
|
@@ -14,12 +16,15 @@
|
|
|
14
16
|
import { spawn } from "node:child_process";
|
|
15
17
|
import { readFile } from "node:fs/promises";
|
|
16
18
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
17
|
-
import { basename, join, resolve } from "node:path";
|
|
19
|
+
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
18
20
|
import { homedir } from "node:os";
|
|
19
21
|
import { configDir } from "../lib/config-paths";
|
|
22
|
+
import { touchRuntime, maybeAutoGc } from "../lib/runtime-gc";
|
|
20
23
|
import { debug } from "../lib/debug-log";
|
|
21
24
|
import {
|
|
22
25
|
computeTokenBreakdown,
|
|
26
|
+
computeContextBudget,
|
|
27
|
+
formatContextBudgetWarning,
|
|
23
28
|
splitSkillBytes,
|
|
24
29
|
tokenLevelEmoji,
|
|
25
30
|
type SkillTokens,
|
|
@@ -28,8 +33,11 @@ import {
|
|
|
28
33
|
|
|
29
34
|
import { loadProfile, listProfiles, listFeaturedProfiles, parseProfileSelector } from "../lib/profile-loader";
|
|
30
35
|
import { resolveProfileForCwd } from "../lib/cwd-resolver";
|
|
31
|
-
import { DIVIDER_PREFIX, runPicker, type PickerOption, type ProfileTally } from "../lib/picker";
|
|
36
|
+
import { DIVIDER_PREFIX, dedupeSelectorParts, runPicker, type PickerOption, type ProfileTally } from "../lib/picker";
|
|
37
|
+
import type { ComboUsage } from "../lib/combo-history";
|
|
32
38
|
import { materializeRuntime } from "../lib/runtime-materializer";
|
|
39
|
+
import { startLoader } from "../lib/launch-loader";
|
|
40
|
+
import { ensureClaudeLogoPath } from "../lib/claude-logo";
|
|
33
41
|
import { resolveLocalSkill } from "../lib/resolver-local";
|
|
34
42
|
import { expandSkillWildcards, loadMcpRegistry, resolveClaudeCredentialsSource as resolveSharedClaudeCredentialsSource } from "../lib/runtime-install";
|
|
35
43
|
import { detectKittyTerminal, kittyPlaceholderLabel, transmitKittyImage } from "../lib/kitty-image";
|
|
@@ -52,6 +60,23 @@ interface ParsedArgs {
|
|
|
52
60
|
rematerialize: boolean;
|
|
53
61
|
/** `--subset "<prompt>"` — filter skills to those relevant to the prompt before materializing. */
|
|
54
62
|
subset: string | null;
|
|
63
|
+
/** True only when `subset` came from an explicit `--subset` flag (not the
|
|
64
|
+
* CUE_SMART_SUBSET env fold of a `-p` prompt). Explicit intent bypasses the
|
|
65
|
+
* keep-set cache so the user gets a fresh classification; the env-folded
|
|
66
|
+
* path uses the cache so repeat `-p` launches don't re-call the classifier. */
|
|
67
|
+
subsetExplicit: boolean;
|
|
68
|
+
/** `--cue-pick-mcps` — always re-open the MCP toggle, ignoring a remembered choice. */
|
|
69
|
+
forcePickMcps: boolean;
|
|
70
|
+
/** `--cue-full` — skip the project loadout for this launch (materialize every skill). */
|
|
71
|
+
fullLoad: boolean;
|
|
72
|
+
/** `--disable-mcp <id>` (repeatable) — drop these MCPs for THIS launch only
|
|
73
|
+
* (pinned ones excepted); session-scoped, not written as a remembered
|
|
74
|
+
* override. Persist a choice via the interactive picker / `--cue-pick-mcps`. */
|
|
75
|
+
disableMcp: string[];
|
|
76
|
+
// Env `CUE_PRUNE_MCPS=auto|unused|profile|all|1|true|on` — non-interactive auto-prune: drop
|
|
77
|
+
// every MCP no active skill references (pinned excepted). Read inline at launch,
|
|
78
|
+
// not a parsed flag. A remembered picker override or `--disable-mcp` takes
|
|
79
|
+
// precedence; default (unset) stays fail-open and keeps all MCPs.
|
|
55
80
|
passthrough: string[];
|
|
56
81
|
}
|
|
57
82
|
|
|
@@ -62,16 +87,34 @@ function parse(args: string[]): ParsedArgs {
|
|
|
62
87
|
let dryRun = false;
|
|
63
88
|
let rematerialize = false;
|
|
64
89
|
let subset: string | null = null;
|
|
90
|
+
let forcePickMcps = false;
|
|
91
|
+
let fullLoad = false;
|
|
92
|
+
const disableMcp: string[] = [];
|
|
65
93
|
const passthrough: string[] = [];
|
|
66
94
|
|
|
67
95
|
for (let i = 0; i < args.length; i++) {
|
|
68
96
|
const a = args[i];
|
|
97
|
+
if (a === "--") {
|
|
98
|
+
// Conventional separator: everything after it belongs to the agent,
|
|
99
|
+
// verbatim. The `--` itself must NOT reach the agent — `claude -- --version`
|
|
100
|
+
// makes claude treat "--version" as a PROMPT and open an interactive
|
|
101
|
+
// session, which hangs forever when stdin isn't a terminal.
|
|
102
|
+
passthrough.push(...args.slice(i + 1).map((s) => s!));
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
69
105
|
if (i === 0 && (a === "claude" || a === "codex")) {
|
|
70
106
|
agent = a;
|
|
71
107
|
} else if (a === "--cue-profile") {
|
|
72
108
|
override = args[++i] ?? null;
|
|
73
109
|
} else if (a === "--cue-pick") {
|
|
74
110
|
forcePick = true;
|
|
111
|
+
} else if (a === "--cue-pick-mcps") {
|
|
112
|
+
forcePickMcps = true;
|
|
113
|
+
} else if (a === "--cue-full") {
|
|
114
|
+
fullLoad = true;
|
|
115
|
+
} else if (a === "--disable-mcp") {
|
|
116
|
+
const id = args[++i];
|
|
117
|
+
if (id) disableMcp.push(id);
|
|
75
118
|
} else if (a === "--dry-run") {
|
|
76
119
|
dryRun = true;
|
|
77
120
|
} else if (a === "--rematerialize") {
|
|
@@ -82,13 +125,20 @@ function parse(args: string[]): ParsedArgs {
|
|
|
82
125
|
passthrough.push(a!);
|
|
83
126
|
}
|
|
84
127
|
}
|
|
128
|
+
const subsetExplicit = subset !== null;
|
|
85
129
|
// Env var fallback for users who want subset on every launch without retyping.
|
|
130
|
+
// Folds a real passthrough prompt (`claude -p "…"`) into `subset` so it drives
|
|
131
|
+
// classification, but leaves `subsetExplicit` false so it uses the keep-set
|
|
132
|
+
// cache — repeat identical `-p` launches don't re-call the classifier.
|
|
86
133
|
if (!subset && process.env.CUE_SMART_SUBSET && passthrough.length > 0) {
|
|
87
134
|
subset = passthrough.join(" ");
|
|
88
135
|
}
|
|
89
|
-
return { agent, override, forcePick, dryRun, rematerialize, subset, passthrough };
|
|
136
|
+
return { agent, override, forcePick, forcePickMcps, fullLoad, disableMcp, dryRun, rematerialize, subset, subsetExplicit, passthrough };
|
|
90
137
|
}
|
|
91
138
|
|
|
139
|
+
/** Test-only surface. */
|
|
140
|
+
export const __test = { parse, shouldOpenMcpPicker };
|
|
141
|
+
|
|
92
142
|
// ---------------------------------------------------------------------------
|
|
93
143
|
// Workspace overrides — merge active workspace env into profile
|
|
94
144
|
// ---------------------------------------------------------------------------
|
|
@@ -145,6 +195,20 @@ function execAgent(bin: string, args: string[], env: NodeJS.ProcessEnv): Promise
|
|
|
145
195
|
});
|
|
146
196
|
}
|
|
147
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Whether the interactive MCP toggle should open this launch. Only when stdin
|
|
200
|
+
* is a TTY, AND either the user forced it (`--cue-pick-mcps`) or there's no
|
|
201
|
+
* valid remembered choice to honor. A remembered override alone keeps the
|
|
202
|
+
* toggle closed — picking a profile interactively no longer re-forces it.
|
|
203
|
+
*/
|
|
204
|
+
export function shouldOpenMcpPicker(opts: {
|
|
205
|
+
interactive: boolean;
|
|
206
|
+
forcePickMcps: boolean;
|
|
207
|
+
overrideValid: boolean;
|
|
208
|
+
}): boolean {
|
|
209
|
+
return opts.interactive && (opts.forcePickMcps || !opts.overrideValid);
|
|
210
|
+
}
|
|
211
|
+
|
|
148
212
|
function isAgentHelpPassthrough(parsed: ParsedArgs): boolean {
|
|
149
213
|
return (
|
|
150
214
|
!parsed.override &&
|
|
@@ -432,7 +496,6 @@ export {
|
|
|
432
496
|
type SkillTokens,
|
|
433
497
|
type TokenBreakdown,
|
|
434
498
|
} from "../lib/token-budget";
|
|
435
|
-
|
|
436
499
|
/** Format the token-overhead block. Returns `[]` under the 2K always-on floor. */
|
|
437
500
|
export function formatTokenWarning(b: TokenBreakdown): string[] {
|
|
438
501
|
if (b.alwaysOn < 2000) return [];
|
|
@@ -443,6 +506,11 @@ export function formatTokenWarning(b: TokenBreakdown): string[] {
|
|
|
443
506
|
lines.push(
|
|
444
507
|
`${level} Skill overhead: ${c.yellow(`~${alwaysK}`)} always-on (${b.totalSkills} skills)`,
|
|
445
508
|
);
|
|
509
|
+
if (b.alwaysOn >= 50_000) {
|
|
510
|
+
lines.push(
|
|
511
|
+
` ${c.yellow("Very heavy profile:")} prefer \`core\` or a narrow stack; use \`--subset "<task>"\` before launching broad composites.`,
|
|
512
|
+
);
|
|
513
|
+
}
|
|
446
514
|
|
|
447
515
|
// `byProfile[0]` is the primary (the profile the user actively picked);
|
|
448
516
|
// the rest are companions added via the multiselect. We tag whichever part
|
|
@@ -493,6 +561,45 @@ export function formatTokenWarning(b: TokenBreakdown): string[] {
|
|
|
493
561
|
return lines;
|
|
494
562
|
}
|
|
495
563
|
|
|
564
|
+
/**
|
|
565
|
+
* Format the single-line startup identity banner shown on every warm launch.
|
|
566
|
+
* Confirms what you landed in: agent · icon+profile (collapsed to `primary +N`
|
|
567
|
+
* for composites, via formatTmuxTitle) · skill and MCP counts · the always-on
|
|
568
|
+
* token cost. The token segment is omitted under the 2K floor; a `→ cue cost`
|
|
569
|
+
* pointer is appended only for genuinely heavy profiles. The full breakdown —
|
|
570
|
+
* per-profile attribution, heaviest bodies — lives in `cue cost`.
|
|
571
|
+
*/
|
|
572
|
+
const BANNER_TOKEN_FLOOR = 2000;
|
|
573
|
+
const BANNER_HEAVY = 10_000;
|
|
574
|
+
|
|
575
|
+
export interface StartupBannerInfo {
|
|
576
|
+
/** Pre-collapsed title from formatTmuxTitle, e.g. "claude · 🏭 gstack +4". */
|
|
577
|
+
title: string;
|
|
578
|
+
/** Total skills (local + npx). */
|
|
579
|
+
skills: number;
|
|
580
|
+
/** MCP server count. */
|
|
581
|
+
mcps: number;
|
|
582
|
+
/** Always-on token estimate, or undefined when not computed (light profile). */
|
|
583
|
+
alwaysOn?: number;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export function formatStartupBanner(info: StartupBannerInfo): string {
|
|
587
|
+
const c = colorFns();
|
|
588
|
+
const segs: string[] = [`${c.cyan("▸")} ${info.title}`];
|
|
589
|
+
segs.push(`${info.skills} skill${info.skills === 1 ? "" : "s"}`);
|
|
590
|
+
if (info.mcps > 0) segs.push(`${info.mcps} MCP${info.mcps === 1 ? "" : "s"}`);
|
|
591
|
+
if (info.alwaysOn !== undefined && info.alwaysOn >= BANNER_TOKEN_FLOOR) {
|
|
592
|
+
segs.push(
|
|
593
|
+
`${tokenLevelEmoji(info.alwaysOn)} ${c.yellow(`~${Math.round(info.alwaysOn / 1000)}K`)} always-on`,
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
let line = segs.join(c.dim(" · "));
|
|
597
|
+
if (info.alwaysOn !== undefined && info.alwaysOn >= BANNER_HEAVY) {
|
|
598
|
+
line += c.dim(" · → cue cost");
|
|
599
|
+
}
|
|
600
|
+
return line;
|
|
601
|
+
}
|
|
602
|
+
|
|
496
603
|
// ---------------------------------------------------------------------------
|
|
497
604
|
// Doctor warnings — inline summary of diagnostics on first build after a
|
|
498
605
|
// rebuild. Replaces the older "run cue doctor to see" generic message.
|
|
@@ -504,26 +611,17 @@ export interface DoctorWarning {
|
|
|
504
611
|
}
|
|
505
612
|
|
|
506
613
|
/**
|
|
507
|
-
* Format
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
* Top-3 inline, with a "…and N more" footer and a `→ cue doctor --fix`
|
|
511
|
-
* pointer when there's anything to fix.
|
|
614
|
+
* Format doctor warnings as a single compact line. Returns `[]` when there are
|
|
615
|
+
* none. The per-warning detail lives in `cue doctor --fix`; launch only signals
|
|
616
|
+
* that there's something to look at.
|
|
512
617
|
*/
|
|
513
618
|
export function formatDoctorWarnings(warnings: DoctorWarning[]): string[] {
|
|
514
619
|
if (warnings.length === 0) return [];
|
|
515
620
|
const c = colorFns();
|
|
516
|
-
const lines: string[] = [];
|
|
517
621
|
const n = warnings.length;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
if (n > 3) {
|
|
523
|
-
lines.push(` ${c.dim(`…and ${n - 3} more`)}`);
|
|
524
|
-
}
|
|
525
|
-
lines.push(` ${c.dim("→ cue doctor --fix")}`);
|
|
526
|
-
return lines;
|
|
622
|
+
return [
|
|
623
|
+
`${c.yellow(`⚠ ${n} cue-doctor warning${n > 1 ? "s" : ""}`)} ${c.dim("→ cue doctor --fix")}`,
|
|
624
|
+
];
|
|
527
625
|
}
|
|
528
626
|
|
|
529
627
|
/**
|
|
@@ -740,22 +838,29 @@ const PICKER_WARNINGS: Record<string, { labelSuffix: string; hint: string }> = {
|
|
|
740
838
|
* label lists the parts so the stack is self-describing.
|
|
741
839
|
*/
|
|
742
840
|
function makeSelectorOption(selector: string, allProfileOpts: PickerOption[]): PickerOption | undefined {
|
|
743
|
-
|
|
841
|
+
// Dedupe parts up front: legacy analytics / combo history can carry a selector
|
|
842
|
+
// with the same profile repeated many times (an old pre-dedup picker path
|
|
843
|
+
// appended companions to the resolved profile each launch, snowballing
|
|
844
|
+
// "gstack+core+…+gstack+core"). Normalize before we synthesize a row so the
|
|
845
|
+
// value we pin/launch and the label we show each list every profile once.
|
|
846
|
+
const parts = dedupeSelectorParts([selector]);
|
|
847
|
+
const normalized = parts.join("+");
|
|
848
|
+
const existing = allProfileOpts.find((o) => o.value === normalized);
|
|
744
849
|
if (existing) return existing;
|
|
745
850
|
// No standalone option. A composite (`a+b+c`) is a valid stacked pick we
|
|
746
|
-
// synthesize a self-describing row for; a bare unknown name
|
|
747
|
-
// deleted profile and is dropped (undefined)
|
|
748
|
-
|
|
851
|
+
// synthesize a self-describing row for; a bare unknown name (one part, no
|
|
852
|
+
// matching option) is a stale or deleted profile and is dropped (undefined)
|
|
853
|
+
// so it never shows in the picker.
|
|
854
|
+
if (parts.length <= 1) return undefined;
|
|
749
855
|
// Reuse each part's own option label so the combined row carries every part's
|
|
750
856
|
// icon — emoji or kitty image placeholder — e.g. "📈 improver + 🔒 secops + 🐻
|
|
751
857
|
// builder" instead of bare "improver + secops + builder". Parts with no
|
|
752
858
|
// resolved option (stale) fall back to the bare name.
|
|
753
|
-
const label =
|
|
754
|
-
.split("+")
|
|
859
|
+
const label = parts
|
|
755
860
|
.map((part) => allProfileOpts.find((o) => o.value === part)?.label ?? part)
|
|
756
861
|
.join(" + ");
|
|
757
862
|
return {
|
|
758
|
-
value:
|
|
863
|
+
value: normalized,
|
|
759
864
|
label,
|
|
760
865
|
hint: "stacked profile",
|
|
761
866
|
};
|
|
@@ -929,7 +1034,21 @@ export function getDefaultSelector(
|
|
|
929
1034
|
return parts.join("+");
|
|
930
1035
|
}
|
|
931
1036
|
|
|
932
|
-
|
|
1037
|
+
/**
|
|
1038
|
+
* Everything the picker needs about this directory: the option rows plus the
|
|
1039
|
+
* raw signals behind them. v1 only ever needed the rows (the sections baked
|
|
1040
|
+
* the signals into hint strings); v2's suggestion engine ranks stacks from the
|
|
1041
|
+
* signals themselves, so they're returned alongside instead of re-derived.
|
|
1042
|
+
*/
|
|
1043
|
+
interface ProfileOptionSet {
|
|
1044
|
+
options: PickerOption[];
|
|
1045
|
+
recents: RecentEntry[];
|
|
1046
|
+
recentsAreCwdScoped: boolean;
|
|
1047
|
+
featured: string[];
|
|
1048
|
+
defaultSelector?: string;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
async function listProfileOptions(pinnedProfile?: string): Promise<ProfileOptionSet> {
|
|
933
1052
|
const names = await listProfiles();
|
|
934
1053
|
const knownNames = new Set(names);
|
|
935
1054
|
const opts: PickerOption[] = [];
|
|
@@ -1062,7 +1181,13 @@ async function listProfileOptions(pinnedProfile?: string): Promise<PickerOption[
|
|
|
1062
1181
|
const featured = (await listFeaturedProfiles()).filter((n) =>
|
|
1063
1182
|
n.split("+").every((part) => knownProfileNames.has(part)),
|
|
1064
1183
|
);
|
|
1065
|
-
return
|
|
1184
|
+
return {
|
|
1185
|
+
options: buildPickerSections(defaultOpt, sorted, recent, 3, Date.now(), suggested, featured),
|
|
1186
|
+
recents: recent,
|
|
1187
|
+
recentsAreCwdScoped: recentCwd.length > 0,
|
|
1188
|
+
featured,
|
|
1189
|
+
defaultSelector: defaultOpt?.value,
|
|
1190
|
+
};
|
|
1066
1191
|
}
|
|
1067
1192
|
|
|
1068
1193
|
async function readSharedClaudeMd(profile?: { name: string; inheritanceChain?: string[] }): Promise<string> {
|
|
@@ -1103,7 +1228,8 @@ async function readSharedClaudeMd(profile?: { name: string; inheritanceChain?: s
|
|
|
1103
1228
|
}
|
|
1104
1229
|
|
|
1105
1230
|
async function buildUserClaudeMd(profile: ResolvedProfile, agent: "claude-code" | "codex"): Promise<string> {
|
|
1106
|
-
|
|
1231
|
+
const appendUser = shouldAppendUserClaudeMd({ agent, cwd: process.cwd(), home: homedir() });
|
|
1232
|
+
let content = await readSharedClaudeMd(profile) + (appendUser ? await readUserClaudeMd(agent) : "");
|
|
1107
1233
|
|
|
1108
1234
|
// First-time profile suggestion: if no .cue.profile in cwd, inject marker
|
|
1109
1235
|
const cueProfilePath = join(process.cwd(), ".cue.profile");
|
|
@@ -1147,6 +1273,50 @@ async function getProfileListForStamp(): Promise<string> {
|
|
|
1147
1273
|
}
|
|
1148
1274
|
}
|
|
1149
1275
|
|
|
1276
|
+
/**
|
|
1277
|
+
* Decide whether cue should append the user's global agent memory file
|
|
1278
|
+
* (`~/.claude/CLAUDE.md` for claude-code, `~/.codex/AGENTS.md` for codex) into
|
|
1279
|
+
* the materialized runtime memory file.
|
|
1280
|
+
*
|
|
1281
|
+
* Claude Code already loads `~/.claude/CLAUDE.md` on its own whenever the launch
|
|
1282
|
+
* cwd sits under $HOME — verified: it appears as its own distinct memory source
|
|
1283
|
+
* in the running session even though cue relocates CLAUDE_CONFIG_DIR to the
|
|
1284
|
+
* runtime dir. So cue's appended copy is byte-for-byte redundant there (~9KB
|
|
1285
|
+
* injected twice, every session, on every profile). Skip it in that case.
|
|
1286
|
+
*
|
|
1287
|
+
* Still append (cue is the only source) when:
|
|
1288
|
+
* - agent is codex (its memory-load model isn't verified here), or
|
|
1289
|
+
* - cwd is outside $HOME (the harness project-walk never reaches ~/.claude), or
|
|
1290
|
+
* - CUE_APPEND_USER_CLAUDEMD=1|true forces the legacy always-append behavior.
|
|
1291
|
+
*
|
|
1292
|
+
* Net effect is no-regression: worst case (claude-code, cwd outside $HOME, or
|
|
1293
|
+
* forced) is identical to today; the common case (cwd under $HOME) drops the
|
|
1294
|
+
* duplicate.
|
|
1295
|
+
*/
|
|
1296
|
+
export function shouldAppendUserClaudeMd(opts: {
|
|
1297
|
+
agent: "claude-code" | "codex";
|
|
1298
|
+
cwd: string;
|
|
1299
|
+
home: string;
|
|
1300
|
+
env?: Record<string, string | undefined>;
|
|
1301
|
+
}): boolean {
|
|
1302
|
+
const force = (opts.env ?? process.env).CUE_APPEND_USER_CLAUDEMD;
|
|
1303
|
+
if (force === "1" || force === "true") return true;
|
|
1304
|
+
if (opts.agent !== "claude-code") return true;
|
|
1305
|
+
return !isInsideHome(opts.cwd, opts.home);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/** True when `cwd` is `home` itself or nested under it (separator-aware so
|
|
1309
|
+
* `/home/user2` is not treated as inside `/home/user`). */
|
|
1310
|
+
function isInsideHome(cwd: string, home: string): boolean {
|
|
1311
|
+
const c = resolve(cwd);
|
|
1312
|
+
const h = resolve(home);
|
|
1313
|
+
// `h + sep` is the safe boundary: for a normal home it matches nested paths;
|
|
1314
|
+
// for the pathological home === "/" it becomes "//" (which a resolved path
|
|
1315
|
+
// never starts with), so we fall back to appending — the safe default when
|
|
1316
|
+
// we can't be sure the harness loads the file itself.
|
|
1317
|
+
return c === h || c.startsWith(h + sep);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1150
1320
|
async function readUserClaudeMd(agent: "claude-code" | "codex"): Promise<string> {
|
|
1151
1321
|
const path =
|
|
1152
1322
|
agent === "claude-code"
|
|
@@ -1159,21 +1329,20 @@ async function readUserClaudeMd(agent: "claude-code" | "codex"): Promise<string>
|
|
|
1159
1329
|
}
|
|
1160
1330
|
}
|
|
1161
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* Find the real agent binary on PATH. cue's own shim dir is skipped wholesale;
|
|
1334
|
+
* everywhere else shims are detected by CONTENT (small script containing a cue
|
|
1335
|
+
* `launch` call), never by skipping a directory: the native Claude installer
|
|
1336
|
+
* puts the REAL binary in ~/.local/bin — where cue's legacy shim also lived —
|
|
1337
|
+
* and the npm package no longer ships a `claude` bin, so a directory skip there
|
|
1338
|
+
* can leave zero candidates on a healthy machine.
|
|
1339
|
+
* Pure PATH walk — launch deliberately ignores $CLAUDE_CODE_EXECPATH /
|
|
1340
|
+
* $CUE_REAL_CLAUDE (those serve in-session helpers like `cue quick`), so the
|
|
1341
|
+
* binary the user's PATH points at is the one that execs.
|
|
1342
|
+
*/
|
|
1162
1343
|
async function findRealBinary(name: string): Promise<string | null> {
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1165
|
-
for (const dir of pathEnv.split(":")) {
|
|
1166
|
-
if (resolve(dir) === resolve(shimDir)) continue;
|
|
1167
|
-
const candidate = join(dir, name);
|
|
1168
|
-
try {
|
|
1169
|
-
const { stat } = await import("node:fs/promises");
|
|
1170
|
-
const st = await stat(candidate);
|
|
1171
|
-
if (st.isFile() && (st.mode & 0o111) !== 0) return candidate;
|
|
1172
|
-
} catch {
|
|
1173
|
-
// not in this dir
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
return null;
|
|
1344
|
+
const { findRealAgentBin } = await import("../lib/claude-binary");
|
|
1345
|
+
return findRealAgentBin(name);
|
|
1177
1346
|
}
|
|
1178
1347
|
|
|
1179
1348
|
/**
|
|
@@ -1210,12 +1379,12 @@ async function resolveClaudeCredentialsSource(): Promise<string> {
|
|
|
1210
1379
|
* session lands in the account's CLAUDE_CONFIG_DIR immediately instead of
|
|
1211
1380
|
* waiting for that account's next launch. Best-effort: never blocks launch.
|
|
1212
1381
|
*/
|
|
1213
|
-
async function rescueRuntimeCredsToOwner(
|
|
1382
|
+
async function rescueRuntimeCredsToOwner(runtimeKey: string): Promise<void> {
|
|
1214
1383
|
try {
|
|
1215
1384
|
const { listKnownAccountDirs, rescueRuntimeCredentials } = await import("../lib/credentials-sync");
|
|
1216
1385
|
// basename() pins the path inside the runtime tree — this helper WRITES
|
|
1217
|
-
// token files, so a
|
|
1218
|
-
const runtimeClaudeDir = join(configDir(), "runtime", basename(
|
|
1386
|
+
// token files, so a runtime key with a path separator must not escape.
|
|
1387
|
+
const runtimeClaudeDir = join(configDir(), "runtime", basename(runtimeKey), "claude");
|
|
1219
1388
|
const result = await rescueRuntimeCredentials(runtimeClaudeDir, await listKnownAccountDirs(homedir()));
|
|
1220
1389
|
if (result.rescued) {
|
|
1221
1390
|
process.stderr.write(`▸ cue: wrote login-fresh credentials back to ${result.to}\n`);
|
|
@@ -1225,6 +1394,47 @@ async function rescueRuntimeCredsToOwner(profileName: string): Promise<void> {
|
|
|
1225
1394
|
}
|
|
1226
1395
|
}
|
|
1227
1396
|
|
|
1397
|
+
/**
|
|
1398
|
+
* When cue launches under an authmux parallel account, CLAUDE_CONFIG_DIR points
|
|
1399
|
+
* at that account's dir (`~/.claude-accounts/<name>`) or its per-run session
|
|
1400
|
+
* copy (`~/.claude-accounts-sessions/<name>/<ts>-<pid>`). Derive a stable
|
|
1401
|
+
* per-account tag so the runtime dir can be keyed by profile + account. Without
|
|
1402
|
+
* it, two accounts sharing a cue profile share ONE runtime `.credentials.json` /
|
|
1403
|
+
* `.claude.json` and collapse into a single Anthropic login (the credential is
|
|
1404
|
+
* copied, not symlinked, so the shared runtime is the source of truth). Returns
|
|
1405
|
+
* undefined for the default `~/.claude` and any non-authmux config dir, which
|
|
1406
|
+
* preserves the plain per-profile runtime.
|
|
1407
|
+
*/
|
|
1408
|
+
export function authmuxAccountTag(configDirEnv: string | undefined, homeDir: string): string | undefined {
|
|
1409
|
+
if (!configDirEnv) return undefined;
|
|
1410
|
+
const resolved = resolve(configDirEnv);
|
|
1411
|
+
for (const root of [
|
|
1412
|
+
join(homeDir, ".claude-accounts-sessions"),
|
|
1413
|
+
join(homeDir, ".claude-accounts"),
|
|
1414
|
+
]) {
|
|
1415
|
+
const prefix = root + sep;
|
|
1416
|
+
if (resolved.startsWith(prefix)) {
|
|
1417
|
+
const name = resolved.slice(prefix.length).split(sep)[0];
|
|
1418
|
+
// Filesystem-safe, and can't inject the `profile@tag` separator or a path
|
|
1419
|
+
// separator into the runtime dir name. LIMITATION: names differing only in
|
|
1420
|
+
// non-`[A-Za-z0-9._-]` characters (e.g. `a@b` vs `a_b`) sanitize to the same
|
|
1421
|
+
// tag and would share a runtime. authmux account names are simple, user-chosen
|
|
1422
|
+
// ids (`parallel --add <name>`), so this is a theoretical edge, not a live risk.
|
|
1423
|
+
if (name) return name.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
return undefined;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* True iff `CUE_ALWAYS_PICK` is set to an enabling value (1|true|on).
|
|
1431
|
+
* Mirrors `isRulerAutoEnabled`'s convention so the two env flags parse alike.
|
|
1432
|
+
*/
|
|
1433
|
+
export function isAlwaysPickEnabled(envVal: string | undefined): boolean {
|
|
1434
|
+
if (!envVal) return false;
|
|
1435
|
+
return ["1", "true", "on"].includes(envVal.trim().toLowerCase());
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1228
1438
|
// ---------------------------------------------------------------------------
|
|
1229
1439
|
// Main entry point
|
|
1230
1440
|
// ---------------------------------------------------------------------------
|
|
@@ -1233,7 +1443,7 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1233
1443
|
// Recursion guard
|
|
1234
1444
|
if (process.env.CUE_LAUNCHING === "1") {
|
|
1235
1445
|
process.stderr.write(
|
|
1236
|
-
"cue: shim recursion detected — check PATH ordering (
|
|
1446
|
+
"cue: shim recursion detected — check PATH ordering (cue's shim dir must precede the real claude/codex location)\n",
|
|
1237
1447
|
);
|
|
1238
1448
|
return 2;
|
|
1239
1449
|
}
|
|
@@ -1275,7 +1485,20 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1275
1485
|
});
|
|
1276
1486
|
// Force picker if --cue-pick OR (account alias AND no explicit --cue-profile).
|
|
1277
1487
|
// Explicit --cue-profile always wins.
|
|
1278
|
-
|
|
1488
|
+
//
|
|
1489
|
+
// `CUE_ALWAYS_PICK=1` makes a bare `claude` offer the picker instead of
|
|
1490
|
+
// silently honoring whatever .cue.profile resolves to. The resolved profile
|
|
1491
|
+
// still sorts to the top of the list, so Enter reproduces the pinned
|
|
1492
|
+
// behavior — this trades one keystroke for the ability to choose.
|
|
1493
|
+
//
|
|
1494
|
+
// Two guards, both load-bearing: an explicit --cue-profile opts out (that IS
|
|
1495
|
+
// the choice), and it only applies on a TTY. Without the TTY guard a
|
|
1496
|
+
// non-interactive `claude -p "…"` would resolve to "none" and die on "no
|
|
1497
|
+
// profile resolved and stdin is not a TTY" instead of using its pin.
|
|
1498
|
+
const alwaysPick = isAlwaysPickEnabled(process.env.CUE_ALWAYS_PICK)
|
|
1499
|
+
&& !parsed.override
|
|
1500
|
+
&& process.stdin.isTTY === true;
|
|
1501
|
+
const forcePicker = parsed.forcePick || alwaysPick || (isAccountAlias && !parsed.override);
|
|
1279
1502
|
const resolved = forcePicker ? { source: "none" as const } : existingResolved;
|
|
1280
1503
|
const existingProfile = existingResolved.source !== "none"
|
|
1281
1504
|
? (existingResolved as { source: string; profile: string }).profile
|
|
@@ -1317,7 +1540,8 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1317
1540
|
}
|
|
1318
1541
|
} catch { /* never block launch on onboarding failure */ }
|
|
1319
1542
|
|
|
1320
|
-
const
|
|
1543
|
+
const optionSet = await listProfileOptions(existingProfile);
|
|
1544
|
+
const options = optionSet.options;
|
|
1321
1545
|
// Mine local session history for "you usually pair X with Y" suggestions.
|
|
1322
1546
|
// The picker pre-checks empirical partners in the combine multiselect.
|
|
1323
1547
|
// Best-effort: any failure (missing log, malformed lines) yields empty.
|
|
@@ -1418,6 +1642,13 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1418
1642
|
tallyCache.set(value, tally);
|
|
1419
1643
|
return tally;
|
|
1420
1644
|
};
|
|
1645
|
+
// Stacks the user confirmed here before. Feeds the v2 suggestion engine
|
|
1646
|
+
// ("you launched this stack 4×"); best-effort like every other signal.
|
|
1647
|
+
let combos: ComboUsage[] = [];
|
|
1648
|
+
try {
|
|
1649
|
+
const { readCombos } = await import("../lib/combo-history");
|
|
1650
|
+
combos = readCombos();
|
|
1651
|
+
} catch (err) { debug("launch:combo-history", err); }
|
|
1421
1652
|
const picked = await runPicker({
|
|
1422
1653
|
cwd,
|
|
1423
1654
|
options,
|
|
@@ -1427,6 +1658,11 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1427
1658
|
companions,
|
|
1428
1659
|
universalSuggestions,
|
|
1429
1660
|
resourceTally,
|
|
1661
|
+
recents: optionSet.recents,
|
|
1662
|
+
recentsAreCwdScoped: optionSet.recentsAreCwdScoped,
|
|
1663
|
+
combos,
|
|
1664
|
+
featured: optionSet.featured,
|
|
1665
|
+
defaultSelector: optionSet.defaultSelector,
|
|
1430
1666
|
details: async (name) => {
|
|
1431
1667
|
const loaded = await loadProfile(name);
|
|
1432
1668
|
await expandWildcards(loaded);
|
|
@@ -1511,6 +1747,78 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1511
1747
|
? await resolveClaudeCredentialsSource()
|
|
1512
1748
|
: undefined;
|
|
1513
1749
|
|
|
1750
|
+
// Per-account runtime isolation. When launched under an authmux parallel
|
|
1751
|
+
// account, key the runtime dir by profile + account so account1/account2
|
|
1752
|
+
// never share one `.credentials.json` and collapse into a single login.
|
|
1753
|
+
// `profileName` still drives profile source, pins, MCP overrides, and
|
|
1754
|
+
// telemetry — only the physical runtime path switches to `runtimeKey`.
|
|
1755
|
+
const accountTag = agentKind === "claude-code"
|
|
1756
|
+
? authmuxAccountTag(ccd, homedir())
|
|
1757
|
+
: undefined;
|
|
1758
|
+
const runtimeKey = accountTag ? `${profileName}@${accountTag}` : profileName;
|
|
1759
|
+
if (accountTag) debug("launch:account-runtime", { profileName, accountTag, runtimeKey });
|
|
1760
|
+
|
|
1761
|
+
// Pin dir: the directory holding the resolving `.cue.profile`, else cwd
|
|
1762
|
+
// (a freshly-picked profile was just pinned to cwd). Keys both the project
|
|
1763
|
+
// loadout and the remembered MCP override below.
|
|
1764
|
+
const pinDir =
|
|
1765
|
+
existingResolved.source === "pin-file"
|
|
1766
|
+
? dirname((existingResolved as { pinPath: string }).pinPath)
|
|
1767
|
+
: cwd;
|
|
1768
|
+
|
|
1769
|
+
// ── Project loadout ───────────────────────────────────────────────────
|
|
1770
|
+
// Project-aware skill loading: classify each local skill as full (project
|
|
1771
|
+
// signals match — materialized as today) or deferred (excluded from the
|
|
1772
|
+
// skills dir, which is what removes its always-on frontmatter cost, but
|
|
1773
|
+
// listed in one generated index skill so it stays loadable on demand).
|
|
1774
|
+
// Deterministic + remembered per pinDir; recomputed when the profile's
|
|
1775
|
+
// skill set or the project's signals change. Runs BEFORE the MCP block so
|
|
1776
|
+
// `needed` (skill→MCP dependencies) reflects only full skills, and before
|
|
1777
|
+
// materialization so the runtime hash covers the filtered profile.
|
|
1778
|
+
// Fail-open: any error keeps the full profile. Escapes: `--cue-full`
|
|
1779
|
+
// (once), CUE_LOADOUT=off (globally), `cue loadout off` (this project).
|
|
1780
|
+
let loadoutActive = false;
|
|
1781
|
+
const loadoutEnvOff = ["off", "0", "false"].includes(
|
|
1782
|
+
(process.env.CUE_LOADOUT ?? "").trim().toLowerCase(),
|
|
1783
|
+
);
|
|
1784
|
+
if (agentKind === "claude-code" && !parsed.fullLoad && !loadoutEnvOff) {
|
|
1785
|
+
try {
|
|
1786
|
+
const { applyProjectLoadout } = await import("../lib/project-loadout");
|
|
1787
|
+
const { parseMetadataFromContent } = await import("./optimizer");
|
|
1788
|
+
const { readFile: readSkillFile } = await import("node:fs/promises");
|
|
1789
|
+
// Direct-path read (skills live at <root>/<category>/<slug>/SKILL.md);
|
|
1790
|
+
// fuzzy-resolved ids just yield empty metadata — classification then
|
|
1791
|
+
// falls back to id-token matching, and the index row omits the path.
|
|
1792
|
+
const skillsRoot = join(
|
|
1793
|
+
process.env.CUE_REPO_ROOT ?? resolve(new URL(import.meta.url).pathname, "..", "..", ".."),
|
|
1794
|
+
"resources", "skills", "skills",
|
|
1795
|
+
);
|
|
1796
|
+
const result = await applyProjectLoadout({
|
|
1797
|
+
profile,
|
|
1798
|
+
cwd,
|
|
1799
|
+
pinDir,
|
|
1800
|
+
readSkill: async (id) => {
|
|
1801
|
+
const path = join(skillsRoot, id, "SKILL.md");
|
|
1802
|
+
const content = await readSkillFile(path, "utf8").catch(() => "");
|
|
1803
|
+
if (!content) return { description: "", path: "" };
|
|
1804
|
+
return { description: parseMetadataFromContent(content).description, path };
|
|
1805
|
+
},
|
|
1806
|
+
});
|
|
1807
|
+
if (result) {
|
|
1808
|
+
profile = result.profile;
|
|
1809
|
+
loadoutActive = true;
|
|
1810
|
+
const top = result.signals.slice(0, 4).join(", ");
|
|
1811
|
+
process.stderr.write(
|
|
1812
|
+
`[cue] loadout: ${result.full.length} skills full · ${result.deferred.length} deferred` +
|
|
1813
|
+
(top ? ` (${top}${result.signals.length > 4 ? ", …" : ""})` : "") +
|
|
1814
|
+
` · --cue-full loads all · cue loadout to edit\n`,
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
} catch (err) {
|
|
1818
|
+
debug("launch:loadout", err); // fail-open — full profile on any error
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1514
1822
|
// Skill conflict detection is opt-in via `cue skills conflicts` — the
|
|
1515
1823
|
// regex-based detector produces too many false positives on natural-language
|
|
1516
1824
|
// SKILL.md prose to be useful as an inline launch-time warning.
|
|
@@ -1518,7 +1826,7 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1518
1826
|
// --rematerialize: force rebuild by deleting the hash file first
|
|
1519
1827
|
if (parsed.rematerialize) {
|
|
1520
1828
|
const { rm: rmFile } = await import("node:fs/promises");
|
|
1521
|
-
const hashPath = join(configDir(), "runtime",
|
|
1829
|
+
const hashPath = join(configDir(), "runtime", runtimeKey, agentKind === "claude-code" ? "claude" : "codex", ".cue-hash");
|
|
1522
1830
|
try { await rmFile(hashPath, { force: true }); } catch { /* ok */ }
|
|
1523
1831
|
} else {
|
|
1524
1832
|
// Auto-rematerialize on staleness: if profile.yaml is newer than the stored
|
|
@@ -1529,74 +1837,303 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1529
1837
|
// rebuild writes a fresh .cue-hash with a current mtime, so it won't loop.
|
|
1530
1838
|
try {
|
|
1531
1839
|
const { isRuntimeStale } = await import("../lib/runtime-materializer");
|
|
1532
|
-
if (await isRuntimeStale(profileName, agentKind, join(configDir(), "runtime"))) {
|
|
1840
|
+
if (await isRuntimeStale(profileName, agentKind, join(configDir(), "runtime"), runtimeKey)) {
|
|
1533
1841
|
const { rm: rmFile } = await import("node:fs/promises");
|
|
1534
|
-
const hashPath = join(configDir(), "runtime",
|
|
1842
|
+
const hashPath = join(configDir(), "runtime", runtimeKey, agentKind === "claude-code" ? "claude" : "codex", ".cue-hash");
|
|
1535
1843
|
try { await rmFile(hashPath, { force: true }); } catch { /* ok */ }
|
|
1536
1844
|
process.stderr.write(`[cue] profile changed, rebuilding runtime...\n`);
|
|
1537
1845
|
}
|
|
1538
1846
|
} catch (err) { debug("launch:staleness", err); /* fail-open — never blocks launch */ }
|
|
1539
1847
|
}
|
|
1540
1848
|
|
|
1541
|
-
//
|
|
1542
|
-
//
|
|
1543
|
-
|
|
1849
|
+
// Lazy-MCP: ids the user disabled, forwarded to the materializer so the stale
|
|
1850
|
+
// keys are evicted from the runtime .claude.json (which the rebuild preserves).
|
|
1851
|
+
let mcpDisabledIds: string[] = [];
|
|
1852
|
+
// ── Lazy MCP loading ──────────────────────────────────────────────────
|
|
1853
|
+
// Prune the profile's MCP servers to what the chosen skills actually need
|
|
1854
|
+
// (smart-prune) and let the user disable individual servers interactively.
|
|
1855
|
+
// The choice is remembered per pinned directory; later launches apply it
|
|
1856
|
+
// silently until the profile's MCP set changes (fingerprint mismatch).
|
|
1544
1857
|
//
|
|
1545
|
-
//
|
|
1546
|
-
//
|
|
1547
|
-
//
|
|
1548
|
-
//
|
|
1549
|
-
|
|
1550
|
-
if (
|
|
1858
|
+
// Runs BEFORE the loader so the interactive toggle owns a clean TTY, and
|
|
1859
|
+
// BEFORE smart-subset — so `needed` reflects the pre-subset skill set. That
|
|
1860
|
+
// only ever over-keeps an MCP (safe); subset's copy-on-write preserves the
|
|
1861
|
+
// pruned `mcps`. Pruning `profile.mcps` changes the materializer content
|
|
1862
|
+
// hash, so the smaller `.claude.json` rebuilds automatically.
|
|
1863
|
+
if (agentKind === "claude-code" && profile.mcps.length > 0) {
|
|
1551
1864
|
try {
|
|
1552
|
-
const {
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
const
|
|
1556
|
-
const
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1865
|
+
const { getNeededMcps } = await import("../lib/skill-dependencies");
|
|
1866
|
+
const { readMcpOverride, writeMcpOverride, mcpFingerprint, reconcileDisabledWithNeeded, autoPrunableMcps, mcpPruneMode, isRecognizedPruneEnv, readRuntimeMcpServerIds } = await import("../lib/mcp-overrides");
|
|
1867
|
+
|
|
1868
|
+
const allMcpIds = profile.mcps.map((m) => m.id);
|
|
1869
|
+
const fingerprint = mcpFingerprint(allMcpIds);
|
|
1870
|
+
const pinned = new Set(profile.mcps.filter((m) => m.pin).map((m) => m.id.toLowerCase()));
|
|
1871
|
+
const needed = getNeededMcps(profile.skills.local.map((s) => s.id));
|
|
1872
|
+
|
|
1873
|
+
const keepNonPinned = (drop: Set<string>): Set<string> =>
|
|
1874
|
+
new Set(allMcpIds.filter((id) => pinned.has(id.toLowerCase()) || !drop.has(id.toLowerCase())));
|
|
1875
|
+
|
|
1876
|
+
let kept: Set<string> | null = null;
|
|
1877
|
+
let reviewed = false;
|
|
1878
|
+
|
|
1879
|
+
// Effective non-interactive prune mode: a RECOGNIZED `CUE_PRUNE_MCPS` env
|
|
1880
|
+
// (including an explicit `off`) overrides the profile's declared default;
|
|
1881
|
+
// otherwise the profile's `mcpPrune:` applies — this is what makes a heavy
|
|
1882
|
+
// profile auto-prune with no env var. A non-empty but UNRECOGNIZED env
|
|
1883
|
+
// (e.g. a typo like `profil`) must NOT silently suppress the profile
|
|
1884
|
+
// default: warn and fall through, so the typo is a no-op, not a foot-gun.
|
|
1885
|
+
const pruneEnv = process.env.CUE_PRUNE_MCPS;
|
|
1886
|
+
const pruneEnvSet = pruneEnv != null && pruneEnv !== "";
|
|
1887
|
+
const pruneFromEnv = pruneEnvSet && isRecognizedPruneEnv(pruneEnv);
|
|
1888
|
+
if (pruneEnvSet && !pruneFromEnv) {
|
|
1889
|
+
process.stderr.write(
|
|
1890
|
+
`[cue] CUE_PRUNE_MCPS="${pruneEnv}" not recognized (use off|profile|all) — using the profile default\n`,
|
|
1891
|
+
);
|
|
1892
|
+
}
|
|
1893
|
+
const pruneMode = pruneFromEnv ? mcpPruneMode(pruneEnv) : (profile.mcpPrune ?? "off");
|
|
1894
|
+
const pruneSource = pruneFromEnv ? "CUE_PRUNE_MCPS" : "profile mcpPrune";
|
|
1895
|
+
|
|
1896
|
+
if (parsed.disableMcp.length > 0) {
|
|
1897
|
+
// Non-interactive flag path: drop named ids (pinned ones excepted) for
|
|
1898
|
+
// THIS launch only. `reviewed` stays false so the choice is NOT written
|
|
1899
|
+
// as a remembered per-dir override — a one-shot `--disable-mcp` in a CI
|
|
1900
|
+
// run or a debug session must not silently stick on later launches. Use
|
|
1901
|
+
// the interactive picker (or `--cue-pick-mcps`) to persist a choice.
|
|
1902
|
+
kept = keepNonPinned(new Set(parsed.disableMcp.map((s) => s.toLowerCase())));
|
|
1903
|
+
} else {
|
|
1904
|
+
const override = readMcpOverride(pinDir);
|
|
1905
|
+
const overrideValid = override !== undefined && override.fingerprint === fingerprint;
|
|
1906
|
+
const interactive = process.stdin.isTTY === true && !parsed.dryRun;
|
|
1907
|
+
|
|
1908
|
+
// Replay a remembered disable-list, cross-checked against what active
|
|
1909
|
+
// skills now need: a skill added since the override was captured may
|
|
1910
|
+
// need an MCP the user disabled. Re-enable those (honor the dependency)
|
|
1911
|
+
// and say so, rather than silently starving the skill. The override is
|
|
1912
|
+
// keyed only by the MCP id set (fingerprint), so it won't re-prompt.
|
|
1913
|
+
const applyRememberedOverride = (): Set<string> => {
|
|
1914
|
+
const { keepDisabled, reEnabled } = reconcileDisabledWithNeeded(override!.disabled, needed.keys());
|
|
1915
|
+
if (reEnabled.length > 0) {
|
|
1916
|
+
process.stderr.write(
|
|
1917
|
+
`[cue] MCPs: re-enabled ${reEnabled.length} now needed by active skills (${reEnabled.join(", ")}) · --cue-pick-mcps to change\n`,
|
|
1918
|
+
);
|
|
1919
|
+
}
|
|
1920
|
+
return keepNonPinned(new Set(keepDisabled));
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1923
|
+
// The toggle opens on --cue-pick-mcps and when there's no valid
|
|
1924
|
+
// remembered choice (first launch of this MCP set, or the set changed —
|
|
1925
|
+
// the fingerprint invalidates the override). It does NOT re-open just
|
|
1926
|
+
// because the profile was picked interactively this launch: a remembered
|
|
1927
|
+
// choice is honored, so picking `core` from the startup menu no longer
|
|
1928
|
+
// forces an MCP dialog every time. Re-review explicitly with
|
|
1929
|
+
// --cue-pick-mcps. A valid override seeds the checkboxes when it does open.
|
|
1930
|
+
if (shouldOpenMcpPicker({ interactive, forcePickMcps: parsed.forcePickMcps, overrideValid })) {
|
|
1931
|
+
const { pickMcps } = await import("../lib/mcp-picker");
|
|
1932
|
+
// Initial checkbox state, best first: the remembered override (this
|
|
1933
|
+
// is a re-review), else — when a loadout is active — the project-
|
|
1934
|
+
// aware suggestion (unpinned MCPs no full skill needs start
|
|
1935
|
+
// unchecked; Enter persists it as the normal override), else the
|
|
1936
|
+
// picker's built-in defaults.
|
|
1937
|
+
kept = await pickMcps({
|
|
1938
|
+
profileMcpIds: allMcpIds,
|
|
1939
|
+
pinned,
|
|
1940
|
+
needed,
|
|
1941
|
+
initialDisabled: overrideValid
|
|
1942
|
+
? new Set(override!.disabled.map((s) => s.toLowerCase()))
|
|
1943
|
+
: loadoutActive
|
|
1944
|
+
? new Set(autoPrunableMcps(allMcpIds, pinned, needed.keys()))
|
|
1945
|
+
: undefined,
|
|
1946
|
+
});
|
|
1947
|
+
reviewed = kept !== null; // null = user cancelled → persist nothing
|
|
1948
|
+
// Cancelling the review must not silently re-enable everything when a
|
|
1949
|
+
// remembered choice exists — fall back to it, same as a non-picking launch.
|
|
1950
|
+
if (kept === null && overrideValid) kept = applyRememberedOverride();
|
|
1951
|
+
} else if (overrideValid) {
|
|
1952
|
+
kept = applyRememberedOverride();
|
|
1953
|
+
} else if (pruneMode !== "off") {
|
|
1954
|
+
// Non-interactive prune, from CUE_PRUNE_MCPS or the profile's mcpPrune
|
|
1955
|
+
// default. Self-contained: it sets mcpDisabledIds directly (so it can
|
|
1956
|
+
// drop GLOBAL servers that aren't in profile.mcps and thus invisible to
|
|
1957
|
+
// the shared block below) and leaves `kept` null to skip that block.
|
|
1958
|
+
// Recomputed each launch; never persisted, so the picker's remembered
|
|
1959
|
+
// overrides stay intact.
|
|
1960
|
+
//
|
|
1961
|
+
// profile mode → drop unused PROFILE MCPs only (cue's invariant that
|
|
1962
|
+
// user-global servers are never touched holds).
|
|
1963
|
+
// all mode → also drop unused GLOBAL servers present in the
|
|
1964
|
+
// runtime .claude.json (the heavy ones a coding
|
|
1965
|
+
// profile never calls). Removes config set globally.
|
|
1966
|
+
const universe = [...allMcpIds];
|
|
1967
|
+
if (pruneMode === "all") {
|
|
1968
|
+
const rtClaudeJson = join(configDir(), "runtime", runtimeKey, "claude", ".claude.json");
|
|
1969
|
+
for (const id of readRuntimeMcpServerIds(rtClaudeJson)) {
|
|
1970
|
+
if (!universe.some((p) => p.toLowerCase() === id.toLowerCase())) universe.push(id);
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
const drop = new Set(autoPrunableMcps(universe, pinned, needed.keys()));
|
|
1974
|
+
debug("launch:mcp-prune", { mode: pruneMode, source: pruneSource, universe, pinned: [...pinned], needed: [...needed.keys()], drop: [...drop] });
|
|
1975
|
+
if (drop.size > 0) {
|
|
1976
|
+
profile = { ...profile, mcps: profile.mcps.filter((m) => !drop.has(m.id.toLowerCase())) };
|
|
1977
|
+
mcpDisabledIds = [...drop];
|
|
1978
|
+
process.stderr.write(
|
|
1979
|
+
`[cue] MCPs: auto-pruned ${drop.size} unused (${[...drop].join(", ")}) · ${pruneSource}=${pruneMode} · --cue-pick-mcps to keep\n`,
|
|
1980
|
+
);
|
|
1981
|
+
}
|
|
1562
1982
|
}
|
|
1983
|
+
// else: non-interactive with no valid override → keep all (kept stays null).
|
|
1563
1984
|
}
|
|
1564
|
-
} catch { /* fail-open — no captured prompt, run full set */ }
|
|
1565
|
-
}
|
|
1566
1985
|
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1986
|
+
debug("launch:mcp-prune", {
|
|
1987
|
+
all: allMcpIds, pinned: [...pinned], needed: [...needed.keys()], reviewed, kept: kept ? [...kept] : null,
|
|
1988
|
+
});
|
|
1989
|
+
if (kept !== null) {
|
|
1990
|
+
const keptSet = kept;
|
|
1991
|
+
const disabled = allMcpIds.filter((id) => !keptSet.has(id)).map((id) => id.toLowerCase());
|
|
1992
|
+
if (disabled.length > 0) {
|
|
1993
|
+
profile = { ...profile, mcps: profile.mcps.filter((m) => keptSet.has(m.id)) };
|
|
1994
|
+
mcpDisabledIds = disabled;
|
|
1995
|
+
process.stderr.write(
|
|
1996
|
+
`[cue] MCPs: ${keptSet.size} on · ${disabled.length} disabled (${disabled.join(", ")}) · --cue-pick-mcps to change\n`,
|
|
1997
|
+
);
|
|
1998
|
+
}
|
|
1999
|
+
// Persist whenever the user actively reviewed (keeps the remembered set
|
|
2000
|
+
// fresh, and clears a stale override when they re-enable everything).
|
|
2001
|
+
// `disabled` may be [] here — that's intentional: it records "reviewed,
|
|
2002
|
+
// nothing disabled" so a later launch doesn't re-prompt.
|
|
2003
|
+
if (reviewed) writeMcpOverride(pinDir, { profile: profileName, fingerprint, disabled });
|
|
1580
2004
|
}
|
|
1581
2005
|
} catch (err) {
|
|
1582
|
-
|
|
2006
|
+
debug("launch:mcp-prune", err); // fail-open — never blocks a launch
|
|
1583
2007
|
}
|
|
1584
2008
|
}
|
|
1585
2009
|
|
|
1586
|
-
//
|
|
1587
|
-
//
|
|
1588
|
-
//
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
2010
|
+
// ── Launch loader ─────────────────────────────────────────────────────
|
|
2011
|
+
// Animate the two genuinely slow steps of the handoff — smart-subset LLM
|
|
2012
|
+
// classification (cold miss ~2s) and runtime materialization — then fully
|
|
2013
|
+
// restore the terminal before any warning prints or the agent execs.
|
|
2014
|
+
//
|
|
2015
|
+
// The loader returns null (no animation) for --dry-run / --rematerialize and
|
|
2016
|
+
// any non-TTY context. While it animates it OWNS one stderr line, so every
|
|
2017
|
+
// progress message inside the bracket routes through `progress()`: the
|
|
2018
|
+
// loader's setMessage when animating, plain stderr.write otherwise (CI logs,
|
|
2019
|
+
// dry-run). This is what keeps the spinner from interleaving with output.
|
|
2020
|
+
const loader =
|
|
2021
|
+
parsed.dryRun || parsed.rematerialize
|
|
2022
|
+
? null
|
|
2023
|
+
: startLoader({ logoPath: ensureClaudeLogoPath() ?? undefined });
|
|
2024
|
+
const progress = (active: string, fallback: string): void => {
|
|
2025
|
+
if (loader) loader.setMessage(active);
|
|
2026
|
+
else if (fallback) process.stderr.write(fallback);
|
|
2027
|
+
};
|
|
2028
|
+
|
|
2029
|
+
let runtime!: Awaited<ReturnType<typeof materializeRuntime>>;
|
|
2030
|
+
try {
|
|
2031
|
+
// Skill subsetting runs ONLY when this launch carries a real prompt:
|
|
2032
|
+
// - explicit `--subset "<text>"`, or
|
|
2033
|
+
// - `CUE_SMART_SUBSET=1` + a passthrough prompt (`claude -p "…"`), which
|
|
2034
|
+
// parse() folds into `parsed.subset`.
|
|
2035
|
+
// A bare TUI launch (no prompt) classifies NOTHING — it keeps the full skill
|
|
2036
|
+
// set with zero LLM call and zero wait. Lazy skill loading already keeps the
|
|
2037
|
+
// always-on cost low (~3K for 21 skills), so there's nothing to gain by
|
|
2038
|
+
// guessing relevance from a stale prompt. This deliberately drops the old
|
|
2039
|
+
// "reuse the first prompt captured in a prior session for this cwd" path:
|
|
2040
|
+
// it made every TUI start depend on a background `claude --print` and could
|
|
2041
|
+
// reuse an unrelated prompt (e.g. a one-off `--version` run) as the classifier
|
|
2042
|
+
// input. Fails open — any error below keeps the full skill set.
|
|
2043
|
+
const subsetPrompt: string | null = parsed.subset;
|
|
2044
|
+
|
|
2045
|
+
if (subsetPrompt && profile.skills.local.length > 4) {
|
|
2046
|
+
try {
|
|
2047
|
+
const { selectRelevantSkills } = await import("../lib/skill-subset");
|
|
2048
|
+
const ids = profile.skills.local.map((s) => s.id);
|
|
2049
|
+
// Explicit --subset bypasses the keep-set cache (the user is overriding
|
|
2050
|
+
// deliberately); an env-folded `-p` prompt uses the cache so repeat
|
|
2051
|
+
// launches don't re-call the classifier.
|
|
2052
|
+
const result = await selectRelevantSkills(ids, subsetPrompt, { noCache: parsed.subsetExplicit });
|
|
2053
|
+
progress(`Skills: ${result.reason}`, ` 🎯 smart-subset: ${result.reason}\n`);
|
|
2054
|
+
if (result.classified && result.selected.length < ids.length) {
|
|
2055
|
+
const keep = new Set(result.selected);
|
|
2056
|
+
// Copy-on-write: never mutate the (possibly manifest-cached) profile
|
|
2057
|
+
// object in place — a shared reference would poison sibling reads.
|
|
2058
|
+
profile = { ...profile, skills: { ...profile.skills, local: profile.skills.local.filter((s) => keep.has(s.id)) } };
|
|
2059
|
+
// Force a rebuild so the smaller skill set actually lands on disk.
|
|
2060
|
+
const { rm: rmFile } = await import("node:fs/promises");
|
|
2061
|
+
const hashPath = join(configDir(), "runtime", runtimeKey, agentKind === "claude-code" ? "claude" : "codex", ".cue-hash");
|
|
2062
|
+
try { await rmFile(hashPath, { force: true }); } catch { /* ok */ }
|
|
2063
|
+
}
|
|
2064
|
+
} catch (err) {
|
|
2065
|
+
progress("Loading skills…", ` ⚠️ smart-subset failed (${(err as Error).message}) — kept full skill set\n`);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
// Rescue-before-wipe: if this runtime's credentials belong to a different
|
|
2070
|
+
// account than credentialsSource, the materializer's identity guard is
|
|
2071
|
+
// about to discard them — return them to their owning account dir first.
|
|
2072
|
+
if (agentKind === "claude-code") await rescueRuntimeCredsToOwner(runtimeKey);
|
|
2073
|
+
|
|
2074
|
+
// Promote npx skills to local via installed plugin marketplaces.
|
|
2075
|
+
// The materializer only symlinks profile.skills.local; npx refs are
|
|
2076
|
+
// metadata that never reach the runtime unless resolved here. We probe
|
|
2077
|
+
// ~/.claude/plugins/marketplaces/*/skills/<name>/ — the path where
|
|
2078
|
+
// `claude plugin marketplace add` installs skills — so a profile that
|
|
2079
|
+
// lists skills.npx works without a network fetch on every launch.
|
|
2080
|
+
const npxSkillMap = new Map<string, string>(); // skill id → dir path
|
|
2081
|
+
if (profile.skills.npx.length > 0) {
|
|
2082
|
+
const pluginMarketplacesDir = join(homedir(), ".claude", "plugins", "marketplaces");
|
|
2083
|
+
if (existsSync(pluginMarketplacesDir)) {
|
|
2084
|
+
const mpSkillsDirs = readdirSync(pluginMarketplacesDir, { withFileTypes: true })
|
|
2085
|
+
.filter((d) => d.isDirectory())
|
|
2086
|
+
.map((d) => join(pluginMarketplacesDir, d.name, "skills"));
|
|
2087
|
+
for (const npxRef of profile.skills.npx) {
|
|
2088
|
+
for (const skillName of (npxRef.skills ?? [])) {
|
|
2089
|
+
if (npxSkillMap.has(skillName)) continue;
|
|
2090
|
+
for (const skillsDir of mpSkillsDirs) {
|
|
2091
|
+
const skillDir = join(skillsDir, skillName);
|
|
2092
|
+
if (existsSync(join(skillDir, "SKILL.md"))) {
|
|
2093
|
+
npxSkillMap.set(skillName, skillDir);
|
|
2094
|
+
break;
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
if (npxSkillMap.size > 0) {
|
|
2101
|
+
const existingIds = new Set(profile.skills.local.map((s) => s.id));
|
|
2102
|
+
const newSkills = [...npxSkillMap.keys()]
|
|
2103
|
+
.filter((id) => !existingIds.has(id))
|
|
2104
|
+
.map((id) => ({ id }));
|
|
2105
|
+
if (newSkills.length > 0) {
|
|
2106
|
+
profile = { ...profile, skills: { ...profile.skills, local: [...profile.skills.local, ...newSkills] } };
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
progress("Preparing runtime…", "");
|
|
2112
|
+
runtime = await materializeRuntime({
|
|
2113
|
+
profile: await applyWorkspaceOverrides(profile),
|
|
2114
|
+
agent: agentKind,
|
|
2115
|
+
runtimeRoot: join(configDir(), "runtime"),
|
|
2116
|
+
runtimeKey,
|
|
2117
|
+
skillSourceLookup: (id) => {
|
|
2118
|
+
const npxPath = npxSkillMap.get(id);
|
|
2119
|
+
if (npxPath) return Promise.resolve(npxPath);
|
|
2120
|
+
return resolveLocalSkill(id);
|
|
2121
|
+
},
|
|
2122
|
+
mcpRegistry: await loadMcpRegistry(agentKind),
|
|
2123
|
+
userClaudeMd: await buildUserClaudeMd(profile, agentKind),
|
|
2124
|
+
credentialsSource,
|
|
2125
|
+
disabledMcpIds: mcpDisabledIds,
|
|
2126
|
+
});
|
|
2127
|
+
} finally {
|
|
2128
|
+
// Always restore the terminal before the warning block / exec, even if
|
|
2129
|
+
// materialize threw. stop() is idempotent and a no-op when loader is null.
|
|
2130
|
+
loader?.stop();
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
// Stamp the runtime as used NOW so the GC age signal is accurate even for a
|
|
2134
|
+
// long-lived session (a warm launch may not otherwise write anything). Marker
|
|
2135
|
+
// lives in the key dir, next to the `claude/`/`codex/` subdirs GC scans.
|
|
2136
|
+
touchRuntime(join(configDir(), "runtime", runtimeKey), Date.now());
|
|
1600
2137
|
|
|
1601
2138
|
// Run quickDiagnose on every launch — it's cheap (filesystem checks) and
|
|
1602
2139
|
// the result feeds both the first-build inline print AND the tmux health
|
|
@@ -1611,7 +2148,7 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1611
2148
|
if (runtime.rebuilt) {
|
|
1612
2149
|
try {
|
|
1613
2150
|
const { existsSync, writeFileSync } = await import("node:fs");
|
|
1614
|
-
const doctorFlag = join(configDir(), "runtime",
|
|
2151
|
+
const doctorFlag = join(configDir(), "runtime", runtimeKey, ".doctor-done");
|
|
1615
2152
|
if (!existsSync(doctorFlag)) {
|
|
1616
2153
|
const lines = formatDoctorWarnings(warnings);
|
|
1617
2154
|
if (lines.length > 0) {
|
|
@@ -1644,16 +2181,11 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1644
2181
|
(i) => i.rule === "W6" || i.rule === "W7",
|
|
1645
2182
|
);
|
|
1646
2183
|
if (descIssues.length > 0) {
|
|
2184
|
+
const c = colorFns();
|
|
2185
|
+
const n = descIssues.length;
|
|
1647
2186
|
process.stderr.write(
|
|
1648
|
-
|
|
2187
|
+
`${c.yellow(`⚠ ${n} skill description issue${n > 1 ? "s" : ""}`)} ${c.dim(`→ cue validate ${profileName}`)}\n`,
|
|
1649
2188
|
);
|
|
1650
|
-
for (const i of descIssues.slice(0, 5)) {
|
|
1651
|
-
process.stderr.write(` • ${i.message}\n`);
|
|
1652
|
-
}
|
|
1653
|
-
if (descIssues.length > 5) {
|
|
1654
|
-
process.stderr.write(` … +${descIssues.length - 5} more\n`);
|
|
1655
|
-
}
|
|
1656
|
-
process.stderr.write("\n");
|
|
1657
2189
|
}
|
|
1658
2190
|
} catch { /* non-fatal — lint is observability, not a gate */ }
|
|
1659
2191
|
}
|
|
@@ -1673,6 +2205,29 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1673
2205
|
return 0;
|
|
1674
2206
|
}
|
|
1675
2207
|
|
|
2208
|
+
// Auto-ruler: when CUE_RULER_AUTO is on, mirror the profile's rules into the
|
|
2209
|
+
// project's agent rule files (CLAUDE.md, AGENTS.md, .cursorrules, …) in SAFE
|
|
2210
|
+
// mode — it never clobbers a hand-written file and no-ops when already current.
|
|
2211
|
+
// Fail-open: a ruler error must never block the launch.
|
|
2212
|
+
try {
|
|
2213
|
+
const { isRulerAutoEnabled, runAutoRuler } = await import("../lib/ruler");
|
|
2214
|
+
if (isRulerAutoEnabled(process.env.CUE_RULER_AUTO)) {
|
|
2215
|
+
const actions = runAutoRuler({ profile, targetDir: cwd, dryRun: parsed.dryRun });
|
|
2216
|
+
// dry-run yields "dry-write"; a real run yields "write" (mutually exclusive).
|
|
2217
|
+
const wrote = actions.filter((a) => a.kind === "write" || a.kind === "dry-write").length;
|
|
2218
|
+
const skipped = actions.filter((a) => a.kind === "skip-foreign-safe").length;
|
|
2219
|
+
if (wrote || skipped) {
|
|
2220
|
+
process.stderr.write(
|
|
2221
|
+
`[cue] ruler: ${parsed.dryRun ? "would sync" : "synced"} rules → ${wrote} agent file(s)` +
|
|
2222
|
+
(skipped ? `; left ${skipped} hand-written file(s) untouched` : "") +
|
|
2223
|
+
"\n",
|
|
2224
|
+
);
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
} catch (err) {
|
|
2228
|
+
debug("launch:auto-ruler", err); /* fail-open — never blocks launch */
|
|
2229
|
+
}
|
|
2230
|
+
|
|
1676
2231
|
const envKey = agentKind === "claude-code" ? "CLAUDE_CONFIG_DIR" : "CODEX_HOME";
|
|
1677
2232
|
const childEnv: NodeJS.ProcessEnv = {
|
|
1678
2233
|
...process.env,
|
|
@@ -1684,6 +2239,14 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1684
2239
|
// an isolated, SQLite-only store + its own worker/server ports so one profile's
|
|
1685
2240
|
// memory never bleeds into another's. Best-effort — a failure here must never
|
|
1686
2241
|
// block the launch. Opt out with CUE_CLAUDE_MEM_ISOLATE=0. See lib/claude-mem-env.ts.
|
|
2242
|
+
//
|
|
2243
|
+
// SCOPE NOTE: keyed by `profileName`, NOT `runtimeKey` — deliberately. The
|
|
2244
|
+
// per-account runtime isolation above only splits credential/session state so
|
|
2245
|
+
// authmux accounts don't collapse into one login. claude-mem memory stays
|
|
2246
|
+
// shared across accounts on the same profile (re-keying it here would silently
|
|
2247
|
+
// relocate every existing per-profile memory store). Two accounts running the
|
|
2248
|
+
// SAME profile concurrently therefore still share one memory data dir + port
|
|
2249
|
+
// slot; making memory per-account is a separate follow-up.
|
|
1687
2250
|
try {
|
|
1688
2251
|
const { resolveClaudeMemEnv } = await import("../lib/claude-mem-env");
|
|
1689
2252
|
const memEnv = resolveClaudeMemEnv(profileName, { existingEnv: process.env });
|
|
@@ -1735,12 +2298,10 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1735
2298
|
const missing = detectMissingDependencies(profileName, skillIds, mcpIds);
|
|
1736
2299
|
if (missing.length > 0) {
|
|
1737
2300
|
const unique = [...new Set(missing.map(m => m.mcpId))];
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
if (missing.length > 3) process.stderr.write(` …and ${missing.length - 3} more\n`);
|
|
1743
|
-
process.stderr.write(` Fix: cue mcps add ${unique[0]} --profile ${profileName}\n\n`);
|
|
2301
|
+
const c = colorFns();
|
|
2302
|
+
process.stderr.write(
|
|
2303
|
+
`${c.yellow(`⚠ missing MCP${unique.length > 1 ? "s" : ""}: ${unique.join(", ")}`)} ${c.dim(`→ cue mcps add ${unique[0]} --profile ${profileName}`)}\n`,
|
|
2304
|
+
);
|
|
1744
2305
|
}
|
|
1745
2306
|
} catch { /* non-fatal */ }
|
|
1746
2307
|
|
|
@@ -1784,6 +2345,22 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1784
2345
|
const breakdown = computeTokenBreakdown(profile, parts, tokensForSkill);
|
|
1785
2346
|
alwaysOnForBadge = breakdown.alwaysOn;
|
|
1786
2347
|
const lines = formatTokenWarning(breakdown);
|
|
2348
|
+
|
|
2349
|
+
// Model-aware startup budget: skills frontmatter + MCP tool-schema cost
|
|
2350
|
+
// should stay under 50% of the model's context window so the other half
|
|
2351
|
+
// is free for the conversation. Window precedence: profile
|
|
2352
|
+
// contextWindow/model → env (CUE_CONTEXT_WINDOW/CUE_MODEL) → 256K default.
|
|
2353
|
+
const budget = computeContextBudget({
|
|
2354
|
+
skillTokens: breakdown.alwaysOn,
|
|
2355
|
+
mcpCount: profile.mcps.length,
|
|
2356
|
+
window: profile.contextWindow,
|
|
2357
|
+
model: profile.model,
|
|
2358
|
+
});
|
|
2359
|
+
const bc = colorFns();
|
|
2360
|
+
lines.push(
|
|
2361
|
+
...formatContextBudgetWarning(budget, { yellow: bc.yellow, bold: bc.bold, dim: bc.dim }),
|
|
2362
|
+
);
|
|
2363
|
+
|
|
1787
2364
|
if (lines.length > 0) {
|
|
1788
2365
|
process.stderr.write("\n");
|
|
1789
2366
|
for (const l of lines) process.stderr.write(`${l}\n`);
|
|
@@ -1859,6 +2436,22 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1859
2436
|
}
|
|
1860
2437
|
} catch { /* best-effort */ }
|
|
1861
2438
|
|
|
2439
|
+
// One-line startup identity banner (stderr). Always prints on a real launch
|
|
2440
|
+
// so you can see what you landed in — agent, profile (collapsed to `primary
|
|
2441
|
+
// +N` for composites), skill/MCP counts, and always-on token cost. dry-run
|
|
2442
|
+
// and --rematerialize return earlier, so this never pollutes their JSON.
|
|
2443
|
+
{
|
|
2444
|
+
const friendly = agentKind === "claude-code" ? "claude" : agentKind;
|
|
2445
|
+
process.stderr.write(
|
|
2446
|
+
`${formatStartupBanner({
|
|
2447
|
+
title: formatTmuxTitle(friendly, profileName, profileIcons),
|
|
2448
|
+
skills: profile.skills.local.length + profile.skills.npx.length,
|
|
2449
|
+
mcps: profile.mcps.length,
|
|
2450
|
+
alwaysOn: alwaysOnForBadge,
|
|
2451
|
+
})}\n`,
|
|
2452
|
+
);
|
|
2453
|
+
}
|
|
2454
|
+
|
|
1862
2455
|
const overhead = alwaysOnForBadge !== undefined && alwaysOnForBadge >= 2000
|
|
1863
2456
|
? {
|
|
1864
2457
|
dot: tokenLevelEmoji(alwaysOnForBadge),
|
|
@@ -1873,7 +2466,10 @@ export async function run(args: string[]): Promise<number> {
|
|
|
1873
2466
|
|
|
1874
2467
|
const exitCode = await execAgent(realBin, parsed.passthrough, childEnv);
|
|
1875
2468
|
// Persist any /login done inside the session to its account dir now —
|
|
1876
|
-
// don't leave the only live rotated token stranded in the
|
|
1877
|
-
if (agentKind === "claude-code") await rescueRuntimeCredsToOwner(
|
|
2469
|
+
// don't leave the only live rotated token stranded in the per-account runtime.
|
|
2470
|
+
if (agentKind === "claude-code") await rescueRuntimeCredsToOwner(runtimeKey);
|
|
2471
|
+
// Post-session runtime GC: the child has exited, so this costs zero launch
|
|
2472
|
+
// latency. Throttled (~once/day) and never touches the runtime we just used.
|
|
2473
|
+
try { await maybeAutoGc(runtimeKey); } catch { /* GC is best-effort */ }
|
|
1878
2474
|
return exitCode;
|
|
1879
2475
|
}
|