@revturbine/cli 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +82 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -6716,6 +6716,48 @@ function validatePlaybook(config) {
6716
6716
  return { ok: blocking.length === 0, problems: blocking };
6717
6717
  }
6718
6718
 
6719
+ // src/lib/init-skills.ts
6720
+ var SKILLS_SOURCE = "revt-eng/revturbine-skills";
6721
+ var START_HERE_SKILL = "revturbine-start-here";
6722
+ function detectHarness(env) {
6723
+ if (env["CLAUDECODE"] || env["CLAUDE_CODE_SESSION_ID"] || env["CLAUDE_CODE_ENTRYPOINT"]) {
6724
+ return { label: "Claude Code", invocation: `Run the skill: /${START_HERE_SKILL}` };
6725
+ }
6726
+ if (env["CURSOR_TRACE_ID"] || env["CURSOR"]) {
6727
+ return { label: "Cursor", invocation: `Mention the skill: @${START_HERE_SKILL}` };
6728
+ }
6729
+ return {
6730
+ label: null,
6731
+ invocation: `Ask your coding agent to run the "${START_HERE_SKILL}" skill.`
6732
+ };
6733
+ }
6734
+ function skillsAddArgs(source = SKILLS_SOURCE) {
6735
+ return ["--yes", "skills", "add", source, "-y", "--copy"];
6736
+ }
6737
+ function finalOutputLines(params) {
6738
+ const lines = ["", "RevTurbine is set up.", ""];
6739
+ if (params.installedSdkAndCli) {
6740
+ lines.push(` \u2713 Installed the SDK and pinned the CLI (${params.cliVersion}) to this repo`);
6741
+ }
6742
+ if (params.playbookAdded) {
6743
+ lines.push(" \u2713 Added a starter playbook (local mode \u2014 no account needed)");
6744
+ }
6745
+ if (params.skills === "installed") {
6746
+ lines.push(" \u2713 Installed the Agent Skills");
6747
+ } else if (params.skills === "skipped") {
6748
+ lines.push(" \u2022 Skipped the Agent Skills (--no-skills)");
6749
+ } else {
6750
+ lines.push(" \u26A0 Agent Skills not installed \u2014 see above to add them by hand");
6751
+ }
6752
+ lines.push("", "Next step:");
6753
+ lines.push(` ${params.harness.invocation}`);
6754
+ if (params.harness.label) lines.push(` (detected ${params.harness.label})`);
6755
+ lines.push("", "Your setup path:");
6756
+ lines.push(" create playbook \u2192 billing \u2192 app wiring \u2192 verify \u2192 launch");
6757
+ lines.push("", "Docs: https://revturbine.com/docs", "");
6758
+ return lines;
6759
+ }
6760
+
6719
6761
  // src/lib/output.ts
6720
6762
  var EXIT = {
6721
6763
  OK: 0,
@@ -7080,7 +7122,7 @@ function renderShow(kind, config) {
7080
7122
  var pkgVersion = createRequire(import.meta.url)("../package.json").version ?? "0.0.0";
7081
7123
  var HELP_AFTER = `
7082
7124
  Command groups:
7083
- Set up init
7125
+ Set up init (alias: create)
7084
7126
  Auth & meta login, logout, signup, whoami, schema, docs
7085
7127
  Download download
7086
7128
  Check validate, diff, show
@@ -7143,7 +7185,7 @@ function runInstall(manager, args, cwd) {
7143
7185
  child.on("close", (code) => resolve(code ?? 1));
7144
7186
  });
7145
7187
  }
7146
- program.command("init").description("Scaffold RevTurbine into this app: detect the stack, install the SDK, and pin the CLI to the repo.").option("-d, --dir <path>", "Target directory (defaults to the current directory)").option("--dry-run", "Report what would be installed without running the package manager").option("--json", "Emit the scaffold plan as JSON").action(async (opts) => {
7188
+ program.command("init").alias("create").description("Scaffold RevTurbine into this app: detect the stack, install the SDK, pin the CLI, drop a starter Playbook, and install the Agent Skills.").option("-d, --dir <path>", "Target directory (defaults to the current directory)").option("--dry-run", "Report what would be installed without running the package manager").option("--no-skills", "Do not install the RevTurbine Agent Skills").option("--json", "Emit the scaffold plan as JSON").action(async (opts) => {
7147
7189
  const dir = path2.resolve(opts.dir ?? process.cwd());
7148
7190
  const manifestPath = path2.join(dir, "package.json");
7149
7191
  if (!existsSync2(manifestPath)) {
@@ -7172,6 +7214,7 @@ program.command("init").description("Scaffold RevTurbine into this app: detect t
7172
7214
  const playbookPath = path2.join(dir, STARTER_PLAYBOOK_FILENAME);
7173
7215
  const playbookExists = existsSync2(playbookPath);
7174
7216
  if (playbookExists) diag(`\u2022 ${STARTER_PLAYBOOK_FILENAME} already present \u2014 left as-is`);
7217
+ const installSkills = opts.skills !== false;
7175
7218
  if (opts.json) {
7176
7219
  emit(
7177
7220
  {
@@ -7180,7 +7223,8 @@ program.command("init").description("Scaffold RevTurbine into this app: detect t
7180
7223
  stack,
7181
7224
  install: plan.install,
7182
7225
  skipped: plan.skipped,
7183
- playbook: playbookExists ? "present" : STARTER_PLAYBOOK_FILENAME
7226
+ playbook: playbookExists ? "present" : STARTER_PLAYBOOK_FILENAME,
7227
+ skills: installSkills ? SKILLS_SOURCE : "skipped"
7184
7228
  },
7185
7229
  true
7186
7230
  );
@@ -7190,6 +7234,7 @@ program.command("init").description("Scaffold RevTurbine into this app: detect t
7190
7234
  diag(`would run: ${manager.name} ${installArgs(manager.name, step).join(" ")}`);
7191
7235
  }
7192
7236
  if (!playbookExists) diag(`would write: ${STARTER_PLAYBOOK_FILENAME}`);
7237
+ if (installSkills) diag(`would run: npx ${skillsAddArgs().join(" ")}`);
7193
7238
  if (plan.install.length === 0 && playbookExists) diag("\u2713 Already set up \u2014 nothing to do.");
7194
7239
  return;
7195
7240
  }
@@ -7207,7 +7252,8 @@ program.command("init").description("Scaffold RevTurbine into this app: detect t
7207
7252
  if (plan.install.length > 0) {
7208
7253
  diag(`\u2713 Installed the RevTurbine SDK and CLI (CLI pinned to ${pkgVersion})`);
7209
7254
  }
7210
- if (!playbookExists) {
7255
+ const playbookAdded = !playbookExists;
7256
+ if (playbookAdded) {
7211
7257
  const check = validatePlaybook(STARTER_PLAYBOOK);
7212
7258
  if (!check.ok) {
7213
7259
  fail(
@@ -7219,7 +7265,38 @@ program.command("init").description("Scaffold RevTurbine into this app: detect t
7219
7265
  `, "utf8");
7220
7266
  diag(`\u2713 Added a starter playbook (${STARTER_PLAYBOOK_FILENAME} \u2014 local mode, no account needed)`);
7221
7267
  }
7222
- if (plan.install.length === 0 && playbookExists) diag("\u2713 Already set up \u2014 nothing to do.");
7268
+ let skillsOutcome = installSkills ? "installed" : "skipped";
7269
+ if (installSkills) {
7270
+ diag("Installing the RevTurbine Agent Skills (npx skills)\u2026");
7271
+ const args = skillsAddArgs();
7272
+ let code;
7273
+ try {
7274
+ code = await runInstall("npx", args, dir);
7275
+ } catch {
7276
+ code = 1;
7277
+ }
7278
+ if (code === 0) {
7279
+ diag("\u2713 Installed the RevTurbine Agent Skills (some write app code \u2014 review before running them)");
7280
+ } else {
7281
+ skillsOutcome = "failed";
7282
+ diag("\u26A0 Could not install the Agent Skills automatically. Add them by hand:");
7283
+ diag(` npx ${args.join(" ")}`);
7284
+ }
7285
+ } else {
7286
+ diag("\u2022 Skipping the Agent Skills (--no-skills)");
7287
+ }
7288
+ if (!opts.json) {
7289
+ const lines = finalOutputLines({
7290
+ managerLabel: manager.name,
7291
+ installedSdkAndCli: plan.install.length > 0,
7292
+ cliVersion: pkgVersion,
7293
+ playbookAdded,
7294
+ skills: skillsOutcome,
7295
+ harness: detectHarness(process.env)
7296
+ });
7297
+ process.stdout.write(`${lines.join("\n")}
7298
+ `);
7299
+ }
7223
7300
  });
7224
7301
  program.command("login").description("Authorize this machine via the browser (device flow) and store a token for the instance (default: the production instance).").argument("[url]", `RevTurbine instance URL (default: ${DEFAULT_URL})`).action(async (url) => {
7225
7302
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revturbine/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "revturbine — verify RevTurbine ExportedConfig files and ship them to a RevTurbine instance through the Change Set lifecycle.",
5
5
  "license": "MIT",
6
6
  "repository": {