snapfail 0.0.24 → 0.0.25

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 +44 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -152,6 +152,12 @@ function writeSession(session) {
152
152
  writeFileSync2(SESSION_FILE, JSON.stringify(session, null, 2) + `
153
153
  `, "utf-8");
154
154
  }
155
+ function clearSession() {
156
+ try {
157
+ if (existsSync2(SESSION_FILE))
158
+ rmSync(SESSION_FILE);
159
+ } catch {}
160
+ }
155
161
  function requireSession() {
156
162
  const session = readSession();
157
163
  if (!session) {
@@ -2420,6 +2426,38 @@ async function runSkill() {
2420
2426
  console.log(existed ? `Updated ${SKILL_FILE}` : `Created ${SKILL_FILE}`);
2421
2427
  }
2422
2428
 
2429
+ // src/commands/login.ts
2430
+ async function runLogin() {
2431
+ const existing = readSession();
2432
+ if (existing && existing.endpoint === DEFAULT_ENDPOINT) {
2433
+ clearSession();
2434
+ }
2435
+ const session = await ensureSession(DEFAULT_ENDPOINT);
2436
+ console.log(`
2437
+ Logged in as ${session.email}`);
2438
+ }
2439
+ // package.json
2440
+ var package_default = {
2441
+ name: "snapfail",
2442
+ version: "0.0.25",
2443
+ type: "module",
2444
+ description: "CLI for snapfail \u2014 project setup, incident inspection and AI diagnostics",
2445
+ license: "MIT",
2446
+ bin: {
2447
+ snapfail: "./dist/index.js"
2448
+ },
2449
+ main: "./dist/index.js",
2450
+ files: ["dist"],
2451
+ scripts: {
2452
+ build: "bun build src/index.ts --outdir dist --target bun --format esm --sourcemap=none",
2453
+ prepublishOnly: "bun run build"
2454
+ },
2455
+ dependencies: {
2456
+ "@clack/prompts": "^1.5.1",
2457
+ "@snapfail/protocol": "^0.0.1"
2458
+ }
2459
+ };
2460
+
2423
2461
  // src/index.ts
2424
2462
  function parseArgs(argv) {
2425
2463
  const [, , rawCommand = "incidents", ...rest] = argv;
@@ -2440,7 +2478,7 @@ function parseArgs(argv) {
2440
2478
  }
2441
2479
  return { command, args, flags };
2442
2480
  }
2443
- var VERSION = "0.0.18";
2481
+ var VERSION = package_default.version;
2444
2482
  async function main() {
2445
2483
  const { command, args, flags } = parseArgs(process.argv);
2446
2484
  const json = flags["json"] === true;
@@ -2454,6 +2492,10 @@ async function main() {
2454
2492
  await runInit();
2455
2493
  return;
2456
2494
  }
2495
+ if (command === "login") {
2496
+ await runLogin();
2497
+ return;
2498
+ }
2457
2499
  if (command === "skill") {
2458
2500
  await runSkill();
2459
2501
  return;
@@ -2489,7 +2531,7 @@ async function main() {
2489
2531
  return;
2490
2532
  }
2491
2533
  console.error(`Unknown command: ${command}`);
2492
- console.error(`snapfail v${VERSION} \u2014 Usage: snapfail [incidents|incident|init|explain|skill] [--version]`);
2534
+ console.error(`snapfail v${VERSION} \u2014 Usage: snapfail [init|login|incidents|incident|explain|skill] [--version]`);
2493
2535
  process.exit(1);
2494
2536
  } catch (err) {
2495
2537
  const message = err instanceof Error ? err.message : String(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snapfail",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "type": "module",
5
5
  "description": "CLI for snapfail — project setup, incident inspection and AI diagnostics",
6
6
  "license": "MIT",