From ae05be1bbb622cabddaf91cee2b7ee633d896b52 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Feb 2026 15:15:39 +0000 Subject: [PATCH] fix: make skill installer work without prior package installation Resolve the skills directory relative to the script itself (via import.meta.url) instead of relative to CWD, so the installer works when invoked through npx -p / yarn dlx / pnpm dlx without having @funstack/static installed first. Update all documented install commands to use the zero-install variants and add yarn dlx / pnpm dlx equivalents. https://claude.ai/code/session_0171KKmMhMFZuwbzbCxqgCNd --- README.md | 8 ++++---- packages/docs/src/pages/GettingStarted.mdx | 6 +++++- packages/docs/src/pages/MigratingFromViteSPA.mdx | 2 +- packages/static/README.md | 8 ++++---- packages/static/src/bin/skill-installer.ts | 12 ++++++++---- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f803a60..0094948 100644 --- a/README.md +++ b/README.md @@ -37,14 +37,14 @@ export default defineConfig({ ### :robot: FUNSTACK Static Skill -FUNSTACK Static provides an Agent Skill to feed your AI agents with knowledge about this framework. After installing `@funstack/static`, run the following command to add the skill to the project: +FUNSTACK Static provides an Agent Skill to feed your AI agents with knowledge about this framework. Run the following command to add the skill to the project: ```sh -npx funstack-static-skill-installer +npx -p @funstack/static funstack-static-skill-installer # or -yarn funstack-static-skill-installer +yarn dlx -p @funstack/static funstack-static-skill-installer # or -pnpm funstack-static-skill-installer +pnpm --package @funstack/static dlx funstack-static-skill-installer # or, if you use skills CLI (https://skills.sh/) npx skills add uhyo/funstack-static ``` diff --git a/packages/docs/src/pages/GettingStarted.mdx b/packages/docs/src/pages/GettingStarted.mdx index 5fd92e8..b6bd9ea 100644 --- a/packages/docs/src/pages/GettingStarted.mdx +++ b/packages/docs/src/pages/GettingStarted.mdx @@ -168,7 +168,11 @@ Only two files are required: `Root.tsx` and `App.tsx`. The paths to these files If you use AI coding assistants like [Claude Code](https://docs.anthropic.com/en/docs/claude-code), you can install the FUNSTACK Static knowledge skill to help your AI assistant better understand the framework: ```bash -npx funstack-static-skill-installer +npx -p @funstack/static funstack-static-skill-installer +# or +yarn dlx -p @funstack/static funstack-static-skill-installer +# or +pnpm --package @funstack/static dlx funstack-static-skill-installer # or, if you use skills CLI (https://skills.sh/) npx skills add uhyo/funstack-static ``` diff --git a/packages/docs/src/pages/MigratingFromViteSPA.mdx b/packages/docs/src/pages/MigratingFromViteSPA.mdx index a61ce7e..4a1b384 100644 --- a/packages/docs/src/pages/MigratingFromViteSPA.mdx +++ b/packages/docs/src/pages/MigratingFromViteSPA.mdx @@ -27,7 +27,7 @@ Or with pnpm: pnpm add @funstack/static ``` -**Hint:** at this point, a skill installer command is available to add FUNSTACK Static knowledge to your AI agents. Run `npx funstack-static-skill-installer` (or `npx skills add uhyo/funstack-static` if you use [skills CLI](https://skills.sh/)) to add the skill. Then you can ask your AI assistant for help with the migration! +**Hint:** at this point, you can add FUNSTACK Static knowledge to your AI agents. Run `npx -p @funstack/static funstack-static-skill-installer` (or `npx skills add uhyo/funstack-static` if you use [skills CLI](https://skills.sh/)) to add the skill. Then you can ask your AI assistant for help with the migration! ## Step 2: Update Vite Config diff --git a/packages/static/README.md b/packages/static/README.md index 8c131e3..b155dce 100644 --- a/packages/static/README.md +++ b/packages/static/README.md @@ -41,14 +41,14 @@ For detailed API documentation and guides, visit the **[Documentation](https://s ### :robot: FUNSTACK Static Skill -FUNSTACK Static provides an Agent Skill to feed your AI agents with knowledge about this framework. After installing `@funstack/static`, run the following command to add the skill to the project: +FUNSTACK Static provides an Agent Skill to feed your AI agents with knowledge about this framework. Run the following command to add the skill to the project: ```sh -npx funstack-static-skill-installer +npx -p @funstack/static funstack-static-skill-installer # or -yarn funstack-static-skill-installer +yarn dlx -p @funstack/static funstack-static-skill-installer # or -pnpm funstack-static-skill-installer +pnpm --package @funstack/static dlx funstack-static-skill-installer # or, if you use skills CLI (https://skills.sh/) npx skills add uhyo/funstack-static ``` diff --git a/packages/static/src/bin/skill-installer.ts b/packages/static/src/bin/skill-installer.ts index 7feb2e1..2745b2f 100644 --- a/packages/static/src/bin/skill-installer.ts +++ b/packages/static/src/bin/skill-installer.ts @@ -2,11 +2,15 @@ import { install } from "@funstack/skill-installer"; import path from "node:path"; +import { fileURLToPath } from "node:url"; -const skillDir = - "./node_modules/@funstack/static/skills/funstack-static-knowledge"; - -const resolved = path.resolve(skillDir); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +// Resolve relative to this script (dist/bin/) so it works +// both when installed locally and via npx -p / pnpm dlx / yarn dlx. +const resolved = path.resolve( + __dirname, + "../../skills/funstack-static-knowledge", +); console.log("Installing skill from:", resolved);