Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
22 changes: 12 additions & 10 deletions scripts/publish-skills.mjs → scripts/stage-web.mjs
Original file line number Diff line number Diff line change
@@ -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 → <dest>/{cli,install.sh,install.ps1}
* 2. Skills/skill.md → <dest>/skill.md (entry point)
Expand All @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)) {
Expand All @@ -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);
}

Expand All @@ -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`);
}
}
}
Expand All @@ -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',
);
}
Loading