snapfail 0.0.23 → 0.0.24

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/package.json +3 -9
  2. package/src/index.ts +0 -103
package/package.json CHANGED
@@ -1,19 +1,13 @@
1
1
  {
2
2
  "name": "snapfail",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "description": "CLI for snapfail — project setup, incident inspection and AI diagnostics",
6
6
  "license": "MIT",
7
7
  "bin": {
8
- "snapfail": "./src/index.ts"
9
- },
10
- "main": "./src/index.ts",
11
- "publishConfig": {
12
- "bin": {
13
- "snapfail": "./dist/index.js"
14
- },
15
- "main": "./dist/index.js"
8
+ "snapfail": "./dist/index.js"
16
9
  },
10
+ "main": "./dist/index.js",
17
11
  "files": ["dist"],
18
12
  "scripts": {
19
13
  "build": "bun build src/index.ts --outdir dist --target bun --format esm --sourcemap=none",
package/src/index.ts DELETED
@@ -1,103 +0,0 @@
1
- #!/usr/bin/env bun
2
- import { runIncidents } from "./commands/incidents.ts";
3
- import { runIncident } from "./commands/incident.ts";
4
- import { runInit } from "./commands/init.ts";
5
- import { runExplain } from "./commands/explain.ts";
6
- import { runSkill } from "./commands/skill.ts";
7
-
8
- function parseArgs(argv: string[]): {
9
- command: string;
10
- args: string[];
11
- flags: Record<string, string | boolean>;
12
- } {
13
- const [, , rawCommand = "incidents", ...rest] = argv;
14
- const command = rawCommand;
15
- const args: string[] = [];
16
- const flags: Record<string, string | boolean> = {};
17
-
18
- for (const token of rest) {
19
- if (token.startsWith("--")) {
20
- const eq = token.indexOf("=");
21
- if (eq !== -1) {
22
- flags[token.slice(2, eq)] = token.slice(eq + 1);
23
- } else {
24
- flags[token.slice(2)] = true;
25
- }
26
- } else {
27
- args.push(token);
28
- }
29
- }
30
-
31
- return { command, args, flags };
32
- }
33
-
34
- const VERSION = "0.0.18";
35
-
36
- async function main(): Promise<void> {
37
- const { command, args, flags } = parseArgs(process.argv);
38
- const json = flags["json"] === true;
39
- const pk = typeof flags["pk"] === "string" ? flags["pk"] : undefined;
40
-
41
- if (command === "--version" || command === "-v" || flags["version"] === true) {
42
- console.log(VERSION);
43
- return;
44
- }
45
-
46
- try {
47
- if (command === "init") {
48
- await runInit();
49
- return;
50
- }
51
-
52
- if (command === "skill") {
53
- await runSkill();
54
- return;
55
- }
56
-
57
- if (command === "incidents") {
58
- await runIncidents({
59
- json,
60
- pk,
61
- status: typeof flags["status"] === "string" ? flags["status"] : undefined,
62
- limit: typeof flags["limit"] === "string" ? parseInt(flags["limit"]) : undefined,
63
- offset: typeof flags["offset"] === "string" ? parseInt(flags["offset"]) : undefined,
64
- });
65
- return;
66
- }
67
-
68
- if (command === "incident") {
69
- const id = args[0];
70
- if (!id) {
71
- console.error("Usage: snapfail incident <id> [--sample <n>] [--json]");
72
- process.exit(1);
73
- }
74
- const sampleFlag = flags["sample"];
75
- const sample =
76
- typeof sampleFlag === "string" ? parseInt(sampleFlag) : undefined;
77
- await runIncident({ id, sample, json, pk, delete: flags["delete"] === true });
78
- return;
79
- }
80
-
81
- if (command === "explain") {
82
- const id = args[0];
83
- if (!id) {
84
- console.error("Usage: snapfail explain <id> [--force] [--json]");
85
- process.exit(1);
86
- }
87
- await runExplain({ id, json, pk });
88
- return;
89
- }
90
-
91
- console.error(`Unknown command: ${command}`);
92
- console.error(`snapfail v${VERSION} — Usage: snapfail [incidents|incident|init|explain|skill] [--version]`);
93
- process.exit(1);
94
- } catch (err) {
95
- const message = err instanceof Error ? err.message : String(err);
96
- console.error(`Error: ${message}`);
97
- process.exit(1);
98
- }
99
- }
100
-
101
- if (import.meta.main) {
102
- main();
103
- }