@shipwellapp/cli 0.2.0 → 0.2.2

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/index.js +69 -40
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -4,10 +4,6 @@
4
4
  import { Command } from "commander";
5
5
  import chalk7 from "chalk";
6
6
 
7
- // src/commands/analyze.ts
8
- import ora from "ora";
9
- import chalk from "chalk";
10
-
11
7
  // ../../packages/core/dist/models.js
12
8
  var AVAILABLE_MODELS = [
13
9
  { id: "claude-sonnet-4-5-20250929", label: "Claude Sonnet 4.5", contextWindow: 2e5, default: true },
@@ -736,6 +732,10 @@ function extractTag(text, tag) {
736
732
  return match ? match[1].trim() : null;
737
733
  }
738
734
 
735
+ // src/commands/analyze.ts
736
+ import ora from "ora";
737
+ import chalk from "chalk";
738
+
739
739
  // src/lib/store.ts
740
740
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
741
741
  import { join as join2 } from "path";
@@ -1186,48 +1186,77 @@ function modelsCommand() {
1186
1186
  }
1187
1187
 
1188
1188
  // src/index.ts
1189
- var VERSION = "0.2.0";
1189
+ var VERSION = "0.2.1";
1190
1190
  var accent7 = chalk7.hex("#6366f1");
1191
1191
  var dim5 = chalk7.dim;
1192
+ var bold2 = chalk7.bold;
1193
+ function stripAnsi(s) {
1194
+ return s.replace(/\x1b\[[0-9;]*m/g, "");
1195
+ }
1196
+ function visLen(s) {
1197
+ return stripAnsi(s).length;
1198
+ }
1199
+ function padR(s, w) {
1200
+ const gap = w - visLen(s);
1201
+ return gap > 0 ? s + " ".repeat(gap) : s;
1202
+ }
1203
+ function centerStr(s, w) {
1204
+ const gap = w - visLen(s);
1205
+ if (gap <= 0) return s;
1206
+ const l = Math.floor(gap / 2);
1207
+ return " ".repeat(l) + s + " ".repeat(gap - l);
1208
+ }
1192
1209
  function showBanner() {
1193
1210
  const user = getUser();
1194
1211
  const apiKey = getApiKey();
1195
- console.log();
1196
- console.log(` ${accent7("\u26F5")} ${chalk7.bold("Shipwell")} ${dim5(`v${VERSION}`)}`);
1197
- console.log(` ${dim5("Full Codebase Autopilot \u2014 powered by Claude")}`);
1198
- console.log();
1199
- if (!user) {
1200
- console.log(` ${chalk7.yellow("\u25CF")} Not logged in`);
1201
- console.log(` ${dim5("Get started:")} ${chalk7.cyan("shipwell login")}`);
1202
- console.log();
1203
- } else if (!apiKey) {
1204
- console.log(` ${chalk7.green("\u25CF")} ${user.name} ${dim5(`(${user.email})`)}`);
1205
- console.log(` ${chalk7.yellow("\u25CF")} API key not set`);
1206
- console.log(` ${dim5("Set it:")} ${chalk7.cyan("shipwell config set api-key")} ${dim5("sk-ant-...")}`);
1207
- console.log();
1212
+ const storedModel = getModel();
1213
+ const modelId = storedModel || DEFAULT_MODEL;
1214
+ const modelObj = AVAILABLE_MODELS.find((m) => m.id === modelId);
1215
+ const modelLabel = modelObj?.label || modelId;
1216
+ const termW = process.stdout.columns || 90;
1217
+ const W = Math.min(Math.max(termW, 80), 100);
1218
+ const LW = Math.floor((W - 7) / 2);
1219
+ const RW = W - 7 - LW;
1220
+ const g = dim5;
1221
+ const row = (l, r) => `${g("\u2502")} ${padR(l, LW)} ${g("\u2502")} ${padR(r, RW)} ${g("\u2502")}`;
1222
+ const empty = () => row("", "");
1223
+ const title = `${accent7("\u26F5 Shipwell")} ${g(`v${VERSION}`)}`;
1224
+ const titleVis = visLen(title);
1225
+ const dashes = W - 5 - titleVis;
1226
+ const top = `${g("\u256D\u2500")} ${title} ${g("\u2500".repeat(Math.max(0, dashes)))}${g("\u256E")}`;
1227
+ const bot = `${g("\u2570")}${g("\u2500".repeat(W - 2))}${g("\u256F")}`;
1228
+ const lines = [];
1229
+ lines.push("");
1230
+ lines.push(top);
1231
+ lines.push(empty());
1232
+ const welcome = user ? `Welcome back, ${accent7(user.name)}!` : `Welcome to ${accent7("Shipwell")}`;
1233
+ lines.push(row(centerStr(welcome, LW), bold2("Analysis")));
1234
+ lines.push(row("", `${chalk7.cyan("audit")} ${g("<path>")} ${g("Security audit")}`));
1235
+ lines.push(row(centerStr("\u26F5", LW), `${chalk7.cyan("migrate")} ${g("<path>")} ${g("Migration plan")}`));
1236
+ lines.push(row(centerStr(g("~^~^~^~^~"), LW), `${chalk7.cyan("refactor")} ${g("<path>")} ${g("Refactor analysis")}`));
1237
+ lines.push(row("", `${chalk7.cyan("docs")} ${g("<path>")} ${g("Documentation")}`));
1238
+ lines.push(row("", `${chalk7.cyan("upgrade")} ${g("<path>")} ${g("Dep upgrade plan")}`));
1239
+ const keyDot = apiKey ? chalk7.green("\u25CF") : chalk7.yellow("\u25CB");
1240
+ const keyText = apiKey ? g("API Key") : chalk7.yellow("No API Key");
1241
+ const info = `${accent7(modelLabel)} \xB7 ${keyDot} ${keyText}`;
1242
+ lines.push(row(centerStr(info, LW), g("\u2500".repeat(RW))));
1243
+ if (user) {
1244
+ lines.push(row(centerStr(g(user.email), LW), bold2("Account & Config")));
1208
1245
  } else {
1209
- console.log(` ${chalk7.green("\u25CF")} ${user.name} ${dim5(`(${user.email})`)}`);
1210
- console.log(` ${chalk7.green("\u25CF")} API key configured`);
1211
- console.log();
1246
+ lines.push(row(
1247
+ centerStr(`${g("Run")} ${chalk7.cyan("shipwell login")} ${g("to start")}`, LW),
1248
+ bold2("Account & Config")
1249
+ ));
1212
1250
  }
1213
- console.log(` ${chalk7.bold("Analysis Commands")}`);
1214
- console.log(` ${chalk7.cyan("shipwell audit")} ${dim5("<path>")} Security audit`);
1215
- console.log(` ${chalk7.cyan("shipwell migrate")} ${dim5("<path>")} Migration plan`);
1216
- console.log(` ${chalk7.cyan("shipwell refactor")} ${dim5("<path>")} Refactor analysis`);
1217
- console.log(` ${chalk7.cyan("shipwell docs")} ${dim5("<path>")} Generate documentation`);
1218
- console.log(` ${chalk7.cyan("shipwell upgrade")} ${dim5("<path>")} Dependency upgrade plan`);
1219
- console.log();
1220
- console.log(` ${chalk7.bold("Account & Config")}`);
1221
- console.log(` ${chalk7.cyan("shipwell login")} Sign in with Google`);
1222
- console.log(` ${chalk7.cyan("shipwell logout")} Sign out`);
1223
- console.log(` ${chalk7.cyan("shipwell whoami")} Show current user & config`);
1224
- console.log(` ${chalk7.cyan("shipwell config")} View configuration`);
1225
- console.log(` ${chalk7.cyan("shipwell config set")} ${dim5("<k> <v>")} Set a config value`);
1226
- console.log(` ${chalk7.cyan("shipwell models")} List available models`);
1227
- console.log(` ${chalk7.cyan("shipwell update")} Update to latest version`);
1228
- console.log();
1229
- console.log(` ${dim5("Docs: https://shipwell.app \xB7 v" + VERSION)}`);
1230
- console.log();
1251
+ lines.push(row("", `${chalk7.cyan("login")} ${g("Sign in with Google")}`));
1252
+ lines.push(row("", `${chalk7.cyan("logout")} ${g("Sign out")}`));
1253
+ lines.push(row("", `${chalk7.cyan("config")} ${g("View/set configuration")}`));
1254
+ lines.push(row("", `${chalk7.cyan("models")} ${g("Available Claude models")}`));
1255
+ lines.push(row("", `${chalk7.cyan("update")} ${g("Update to latest version")}`));
1256
+ lines.push(empty());
1257
+ lines.push(bot);
1258
+ lines.push("");
1259
+ console.log(lines.join("\n"));
1231
1260
  }
1232
1261
  var program = new Command();
1233
1262
  program.name("shipwell").description("Full Codebase Autopilot \u2014 deep cross-file analysis powered by Claude").version(VERSION).action(() => {
@@ -1280,7 +1309,7 @@ program.command("update").description("Update Shipwell CLI to the latest version
1280
1309
  execSync("npm install -g @shipwellapp/cli@latest", { stdio: "pipe" });
1281
1310
  spinner.succeed(`Updated to v${accent7(latest)} ${dim5(`(was v${VERSION})`)}`);
1282
1311
  }
1283
- } catch (err) {
1312
+ } catch {
1284
1313
  spinner.fail("Update failed. Try manually:");
1285
1314
  console.log(` ${chalk7.cyan("npm install -g @shipwellapp/cli@latest")}`);
1286
1315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipwellapp/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Full Codebase Autopilot — deep cross-file analysis powered by Claude",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,6 +51,7 @@
51
51
  "simple-git": "^3.27.0"
52
52
  },
53
53
  "devDependencies": {
54
+ "@shipwell/core": "workspace:*",
54
55
  "@types/node": "^22.10.0",
55
56
  "tsup": "^8.5.1",
56
57
  "typescript": "^5.7.0"