From a9562f1e50912828569cc228bf929c37c9ba8d2b Mon Sep 17 00:00:00 2001 From: NiveditJain Date: Tue, 7 Apr 2026 18:08:07 +0000 Subject: [PATCH] [ef-33] feat: publish 14 alias packages for common failproofai misspellings + bump to 0.0.1-beta.8 Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/publish.yml | 5 +++ package.json | 2 +- scripts/alias-proxy.js | 18 ++++++++++ scripts/publish-aliases.mjs | 65 +++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 scripts/alias-proxy.js create mode 100644 scripts/publish-aliases.mjs diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 49501196..303af496 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,3 +39,8 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish alias packages + run: node scripts/publish-aliases.mjs + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 5615d12d..21cfd4bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "failproofai", - "version": "0.0.1-beta.7", + "version": "0.0.1-beta.8", "description": "Open-source hooks, policies, and project visualization for Claude Code & Agents SDK", "bin": { "failproofai": "./bin/failproofai.mjs" diff --git a/scripts/alias-proxy.js b/scripts/alias-proxy.js new file mode 100644 index 00000000..fe64dab2 --- /dev/null +++ b/scripts/alias-proxy.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node +'use strict'; +const { spawnSync } = require('child_process'); +const path = require('path'); +const isWin = process.platform === 'win32'; + +// Use the npm-generated bin wrapper so the bun shebang is handled correctly +// on all platforms (including the .cmd wrapper on Windows). +const binary = path.join( + __dirname, '..', 'node_modules', '.bin', + isWin ? 'failproofai.cmd' : 'failproofai' +); + +const result = spawnSync(binary, process.argv.slice(2), { + stdio: 'inherit', + shell: isWin, +}); +process.exit(result.status ?? 1); diff --git a/scripts/publish-aliases.mjs b/scripts/publish-aliases.mjs new file mode 100644 index 00000000..fa7947b3 --- /dev/null +++ b/scripts/publish-aliases.mjs @@ -0,0 +1,65 @@ +#!/usr/bin/env node +import { execSync } from 'child_process'; +import { readFileSync, writeFileSync, mkdirSync, rmSync, cpSync } from 'fs'; +import { join, dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const rootPkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8')); +const VERSION = rootPkg.version; +const DRY_RUN = process.argv.includes('--dry-run'); + +const ALIASES = [ + // Formatting variants — no "ai", or hyphen/underscore separators + 'failproof', + 'failproof-ai', + 'fail-proof-ai', + 'failproof_ai', + 'fail_proof_ai', + 'fail-proofai', + // Missing one 'o' from "proof" — common single-char slip + 'failprof', + 'failprof-ai', + 'failprofai', + 'fail-prof-ai', + 'failprof_ai', + // 'a'/'i' transposition — common keyboard slip + 'faliproof', + 'faliproof-ai', + 'faliproofai', +]; + +for (const name of ALIASES) { + const tmpDir = join('/tmp', `npm-alias-${name}-${Date.now()}`); + const binDir = join(tmpDir, 'bin'); + mkdirSync(binDir, { recursive: true }); + + const pkg = { + name, + version: VERSION, + description: `Alias for failproofai — installs if you typed '${name}' instead of 'failproofai'`, + bin: { [name]: './bin/proxy.js' }, + files: ['bin/'], + dependencies: { failproofai: VERSION }, + publishConfig: { access: 'public' }, + repository: rootPkg.repository, + homepage: rootPkg.homepage, + bugs: rootPkg.bugs, + license: rootPkg.license, + }; + + writeFileSync(join(tmpDir, 'package.json'), JSON.stringify(pkg, null, 2) + '\n'); + cpSync(join(__dirname, 'alias-proxy.js'), join(binDir, 'proxy.js')); + + if (DRY_RUN) { + console.log(`[dry-run] Would publish ${name}@${VERSION}`); + console.log(JSON.stringify(pkg, null, 2)); + console.log('---'); + } else { + console.log(`Publishing ${name}@${VERSION}...`); + execSync('npm publish', { cwd: tmpDir, stdio: 'inherit' }); + console.log(`Done: ${name}`); + } + + rmSync(tmpDir, { recursive: true, force: true }); +}