api2cli-publish-to-github
Publish to GitHub
Push an api2cli-generated CLI (from ~/.cli/<app>-cli/) to a new GitHub repository.
Phase 1: Pre-flight
Auth
Run gh auth status. If not logged in, tell the user to run gh auth login first. Stop and wait.
Note the GitHub username from the output (e.g. Logged in to github.com account <username>).
Resolve the CLI
If the user didn't specify which CLI, check ~/.cli/ and ask which one. Read package.json to get the package name.
Phase 2: Prepare the repo
From the CLI directory (~/.cli/<app>-cli/):
-
Ensure
.gitignoreexists with at least:node_modules/ dist/ -
Init or check git:
- If no
.git/: rungit init && git add -A && git commit -m "Initial commit: <app>-cli" - If already a git repo: stage and commit any uncommitted changes.
- If no
-
Never commit
node_modules/ordist/. If already tracked,git rm -r --cachedthem and rewrite history so secrets in dependencies don't trigger GitHub push protection.
Phase 3: Create the repo and push
gh repo create <app>-cli --public --source=. --push --description "<description from package.json>"
- If
gh repo createsucceeds but push fails (e.g. push protection), fix the issue per Phase 2 and rungit push -u origin <branch> --force. - If
gh repo createsays "unable to add remote" (remote already exists), just push:git push -u origin <branch>. - If the repo name is taken, ask the user for an alternative name.
Phase 4: Done
Report:
- Repo URL:
https://github.com/<username>/<app>-cli - What was pushed (file count, branch name)
Do NOT
- Do not commit
node_modules/,dist/,.env, or token files. - Do not force-push to an existing repo with other contributors without asking.
- Do not change the git user config.
More from melvynx/api2cli
api2cli
Generate or discover a CLI + AgentSkill for any REST API. Use when: user says 'create a CLI for X', 'wrap this API', 'search if a CLI exists', 'install an existing CLI', 'make a skill for X', 'publish my CLI', 'publish to npm', 'push to github'. Handles registry search, install, discovery, scaffolding, resource implementation, building, linking, skill generation, npm publishing, and GitHub publishing.
103api2cli-publish-to-npm
Publishes an api2cli-generated CLI package to the npm registry. Handles package.json validation, version bumping, building, and npm publish. Use when user asks to "publish to npm", "release to npm", "publish this CLI", "npm publish", "make this installable via npx", "publish a new version", or "update npm".
4