Skip to content

Add non-interactive CLI flags, tests, CI, and --version flag - #22

Merged
tomcardoso merged 2 commits into
masterfrom
feature/non-interactive-cli
Jul 26, 2026
Merged

Add non-interactive CLI flags, tests, CI, and --version flag#22
tomcardoso merged 2 commits into
masterfrom
feature/non-interactive-cli

Conversation

@tomcardoso

@tomcardoso tomcardoso commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds --project, --author, --email, --remote, --yes, --help, and --version flags (parsed with the built-in node:util parseArgs — no new dependency) so create-startr can run without a TTY.
  • When --project, --author, and --email are all supplied, the interactive prompts are skipped entirely; --yes skips the confirmation step. This is the intended entry point for Claude Code or other coding agents to scaffold a project directly.
  • In a non-interactive shell (no TTY): missing required flags now fail fast with a clear error instead of hanging forever on prompts() waiting for stdin that will never arrive. Similarly, the confirmation step refuses to block on input unless --yes is passed.
  • Fixes the catch block to call process.exit(1) on failure — previously the process always exited 0 even when scaffolding failed partway through, which breaks any script/agent relying on the exit code to detect success.
  • Interactive behavior (no flags passed, TTY attached) is unchanged.
  • README updated with a non-interactive usage section.

Added in a follow-up commit:

  • Test coverage for all the new CLI paths (--help, --version, missing/partial flags, validation errors, confirmation-refusal) using Node's built-in test runner (node --test, wired to npm test) — no new test-framework dependency.
  • A GitHub Actions CI workflow (.github/workflows/ci.yml) that runs the test suite and npm audit --audit-level=high on every push/PR, so dependency vulnerabilities like the simple-git critical RCE fixed in Fix npm audit vulnerabilities #21 get caught automatically going forward.
  • An engines: { node: ">=22" } field in package.json, formalizing the Node version requirement the README already documented.

Test plan

  • --help / --version print expected output and exit 0
  • Non-TTY with no/partial flags → fails fast with a clear "missing required flag(s)" error, exit 1
  • Invalid --project/--author/--email values → validation error, exit 1
  • All required flags but no --yes in non-TTY → refuses to hang, exit 1 with a clear message
  • Full non-interactive run (--project --author --email --yes) → clones, rewrites config.R/README.md, renames .Rproj, removes DESCRIPTION, exits 0 — verified end to end against a real clone
  • npm test → 8/8 passing
  • npm audit --audit-level=high → 0 vulnerabilities

🤖 Generated with Claude Code

tomcardoso and others added 2 commits July 26, 2026 14:15
Adds --project, --author, --email, --remote, --yes and --help flags
(parsed via node:util parseArgs, no new dependency) so create-startr
can be driven without a TTY, e.g. by Claude Code or other coding
agents. When --project/--author/--email are all supplied, prompts
are skipped entirely; --yes skips the confirmation step.

In a non-interactive shell, missing required flags now fail fast
with a clear error instead of hanging on stdin, and the confirmation
step refuses to wait for input unless --yes is passed. Also fixes
the catch block to exit 1 on failure — previously the process always
exited 0 even when scaffolding failed, which is wrong for anything
scripting against this CLI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds coverage for the non-interactive CLI paths added in the
previous commit (help/version output, missing-flag failures,
validation errors, and the confirmation-refusal-without-yes path)
using Node's built-in test runner via `npm test`, so this doesn't
add a test-framework dependency.

Adds a GitHub Actions workflow that runs those tests plus
`npm audit --audit-level=high` on every push/PR, so dependency
vulnerabilities like the simple-git RCE fixed in #21 get caught
automatically going forward instead of requiring a manual audit.

Also adds a --version/-v flag (reads package.json via
createRequire since this is an ESM module) and an explicit
"engines": { "node": ">=22" } in package.json, formalizing the
Node version requirement the README already documented.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tomcardoso tomcardoso changed the title Add non-interactive CLI flags for agent/script use Add non-interactive CLI flags, tests, CI, and --version flag Jul 26, 2026
@tomcardoso
tomcardoso merged commit ebb3e67 into master Jul 26, 2026
3 checks passed
@tomcardoso
tomcardoso deleted the feature/non-interactive-cli branch July 26, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant