diff --git a/package.json b/package.json index cce2d45..00d1641 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "packageManager": "pnpm@11.20.0", "scripts": { "cli": "node packages/cli/dist/cli.js", - "build": "turbo run build && node scripts/align-skill-version.js && node scripts/publish-skills.mjs", + "build": "turbo run build && node scripts/align-skill-version.js && pnpm stage:web", "build:homebrew-cask": "node scripts/render-homebrew-cask.mjs", "build:linux-apt-repository": "node scripts/build-linux-apt-repository.mjs", "build:linux-installer": "node scripts/render-linux-installer.mjs", @@ -55,6 +55,7 @@ "conformance": "node scripts/mpp-conformance.mjs", "conformance:update": "node scripts/mpp-conformance.mjs --update", "changeset": "changeset", + "stage:web": "node scripts/stage-web.mjs", "version-packages": "changeset version && node scripts/align-skill-version.js", "release": "pnpm --filter @inflowpayai/inflow build:shim && changeset publish", "clean": "turbo run clean && rm -rf node_modules", diff --git a/scripts/publish-skills.mjs b/scripts/stage-web.mjs similarity index 84% rename from scripts/publish-skills.mjs rename to scripts/stage-web.mjs index edcf077..06716c2 100644 --- a/scripts/publish-skills.mjs +++ b/scripts/stage-web.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node /** - * Publishes web-served CLI files. Destination: the inflowcli.ai docroot in the sibling server repo — - * ../inflow-server/src/main/resources/static/cli/ (skipped silently when absent). + * Stages web-served CLI files when INFLOW_WEB_STAGING=1. Destination: the inflowcli.ai docroot in the sibling server + * repo — ../inflow-server/src/main/resources/static/cli/ (skipped when absent). * * 1. Hosted installers → /{cli,install.sh,install.ps1} * 2. Skills/skill.md → /skill.md (entry point) @@ -17,6 +17,8 @@ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, symlink import { dirname, join, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; +if (process.env.INFLOW_WEB_STAGING !== '1') process.exit(0); + const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..'); const skillsDir = resolve(repoRoot, 'skills'); const cliDist = resolve(repoRoot, 'packages/cli/dist/cli.js'); @@ -51,14 +53,14 @@ ${playbookLinks} `; if (!existsSync(dest)) { - process.stdout.write(`publish-skills: skipped (no ${dest})\n`); + process.stdout.write(`stage:web: skipped (no ${dest})\n`); process.exit(0); } for (const [name, source] of hostedFiles) { copyFileSync(source, resolve(dest, name)); } -process.stdout.write(`publish-skills: [${[...hostedFiles.keys()].join(', ')}] → ${dest}\n`); +process.stdout.write(`stage:web: [${[...hostedFiles.keys()].join(', ')}] → ${dest}\n`); /** Remove the `allowed-tools` key (scalar, inline list, or block list) from YAML frontmatter. */ function stripAllowedTools(markdown) { @@ -87,7 +89,7 @@ for (const name of playbooks) { const body = readFileSync(resolve(skillsDir, name, 'SKILL.md'), 'utf8'); writeFileSync(resolve(dest, 'skills', `${name}.md`), stripAllowedTools(body)); } -process.stdout.write(`publish-skills: [${playbooks.join(', ')}] → ${dest}/skills\n`); +process.stdout.write(`stage:web: [${playbooks.join(', ')}] → ${dest}/skills\n`); const sitemapFile = resolve(dest, 'sitemap.xml'); if (existsSync(sitemapFile)) { @@ -101,7 +103,7 @@ if (existsSync(sitemapFile)) { '', ); const rewritten = withoutSkillUrls.replace(entryPoint, `${entryPoint}${skillUrls}\n`); - if (rewritten === withoutSkillUrls) throw new Error('publish-skills: sitemap is missing the skill.md entry'); + if (rewritten === withoutSkillUrls) throw new Error('stage:web: sitemap is missing the skill.md entry'); writeFileSync(sitemapFile, rewritten); } @@ -113,7 +115,7 @@ if (existsSync(pluginSkillsDir)) { const link = join(pluginSkillsDir, name); if (!existsSync(link)) { symlinkSync(join('..', '..', '..', 'skills', name), link); - process.stdout.write(`publish-skills: plugin symlink created for skill '${name}'\n`); + process.stdout.write(`stage:web: plugin symlink created for skill '${name}'\n`); } } } @@ -124,18 +126,18 @@ if (existsSync(cliDist)) { try { return execFileSync(process.execPath, [cliDist, flag], { encoding: 'utf8' }); } catch (error) { - process.stderr.write(`publish-skills: dist/cli.js failed on ${flag}\n`); + process.stderr.write(`stage:web: dist/cli.js failed on ${flag}\n`); throw error; } }; writeFileSync(resolve(dest, 'skill.md'), run('--bootstrap')); writeFileSync(resolve(dest, 'llms.txt'), LLMS_HEADER + run('--llms')); writeFileSync(resolve(dest, 'llms-full.txt'), LLMS_HEADER + run('--llms-full')); - process.stdout.write(`publish-skills: skill.md, llms.txt, llms-full.txt projected from ${cliDist}\n`); + process.stdout.write(`stage:web: skill.md, llms.txt, llms-full.txt projected from ${cliDist}\n`); } else { // Pre-build fallback: skill.md straight from source; llms files need the binary. writeFileSync(resolve(dest, 'skill.md'), readFileSync(resolve(skillsDir, 'skill.md'), 'utf8')); process.stdout.write( - 'publish-skills: no dist/cli.js — skill.md copied from source; llms.txt/llms-full.txt not generated\n', + 'stage:web: no dist/cli.js — skill.md copied from source; llms.txt/llms-full.txt not generated\n', ); }