@nikelyh/offscript 1.0.0 → 1.1.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.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" sizes="any" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>offscript</title>
8
- <script type="module" crossorigin src="/assets/index-uXpu7a13.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DVAKXfgp.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-Dh5KHl3J.css">
10
10
  </head>
11
11
  <body>
package/offscript.mjs CHANGED
@@ -12,34 +12,62 @@ function resolveCliScript() {
12
12
  try {
13
13
  if (statSync(dev).isFile()) return dev.href;
14
14
  } catch {}
15
- throw new Error("Distribution is missing. Run npm run build:local in the OFFSCRIPT checkout, or reinstall the archive.");
15
+ throw new Error("Distribution is missing. Run npm install -g @nikelyh/offscript, or run npm run build:local in the source repository.");
16
16
  }
17
17
 
18
- try {
19
- const { values, positionals } = parseArgs({ allowPositionals: true, options: {
20
- project: { type: "string" }, port: { type: "string" }, "data-directory": { type: "string" },
21
- "no-studio": { type: "boolean" }, "no-open": { type: "boolean" }, cancel: { type: "boolean" },
22
- help: { type: "boolean", short: "h" }, version: { type: "boolean", short: "v" },
23
- } });
24
- const command = positionals[0];
25
- const isResults = command === "results";
26
- const isRecover = command === "recover";
27
- const isTargeted = isResults || isRecover;
28
- const validCommands = ["studio", "serve", "list", "results", "recover"];
29
- if (
30
- (command !== undefined && !validCommands.includes(command)) ||
31
- (isTargeted && positionals.length !== 2) ||
32
- (!isTargeted && positionals.length > 1)
33
- ) {
34
- throw new Error("Expected studio, serve, list, results <simulation-id>, or recover <simulation-id>. Use --help for usage.");
35
- }
36
- if ((command === "studio" && values["no-studio"]) ||
37
- ((command === "serve" || values["no-studio"]) && values["no-open"]) ||
38
- ((command === "list" || isTargeted) && (values["no-studio"] || values["no-open"] || values.port))) {
39
- throw new Error("Conflicting options for command. Use --help for usage.");
40
- }
41
- if (values.help) {
42
- console.log(`Usage: offscript [command] [options]
18
+ const commandHelps = {
19
+ studio: `Usage: offscript studio [options]
20
+
21
+ Serve the local OFFSCRIPT Studio UI and API, and open the secure local entry in your default browser.
22
+
23
+ Options:
24
+ --project <directory> Target project path (default: current working directory).
25
+ --port <number> Loopback port to bind (default: 0 for automatic port selection).
26
+ --data-directory <dir> Storage directory relative to target project (default: .offscript).
27
+ --no-open Print the authenticated entry URL without launching a browser.`,
28
+
29
+ serve: `Usage: offscript serve [options]
30
+
31
+ Serve the headless local OFFSCRIPT API host without launching the Studio web UI.
32
+
33
+ Options:
34
+ --project <directory> Target project path (default: current working directory).
35
+ --port <number> Loopback port to bind (default: 0 for automatic port selection).
36
+ --data-directory <dir> Storage directory relative to target project (default: .offscript).`,
37
+
38
+ list: `Usage: offscript list [options]
39
+
40
+ List all saved simulations, configurations, and their current execution statuses in the target project.
41
+
42
+ Options:
43
+ --project <directory> Target project path (default: current working directory).
44
+ --data-directory <dir> Storage directory relative to target project (default: .offscript).`,
45
+
46
+ results: `Usage: offscript results <simulation-id> [options]
47
+
48
+ Inspect attributed observations, collaborative investigations, finding assessments, and visual evidence.
49
+
50
+ Arguments:
51
+ <simulation-id> Unique identifier of the simulation to inspect.
52
+
53
+ Options:
54
+ --project <directory> Target project path (default: current working directory).
55
+ --data-directory <dir> Storage directory relative to target project (default: .offscript).`,
56
+
57
+ recover: `Usage: offscript recover <simulation-id> [options]
58
+
59
+ Explicitly settle an interrupted or abandoned simulation to 'failed' (or 'cancelled' with --cancel).
60
+
61
+ Arguments:
62
+ <simulation-id> Unique identifier of the simulation to settle.
63
+
64
+ Options:
65
+ --project <directory> Target project path (default: current working directory).
66
+ --data-directory <dir> Storage directory relative to target project (default: .offscript).
67
+ --cancel Mark simulation status as 'cancelled' instead of 'failed'.`,
68
+ };
69
+
70
+ const generalHelp = `Usage: offscript [command] [options]
43
71
 
44
72
  Commands:
45
73
  studio Serve Studio/API and open the secure local entry (default).
@@ -47,6 +75,7 @@ Commands:
47
75
  list List saved simulations for the project.
48
76
  results <id> Inspect exploration results (findings, observations, investigations).
49
77
  recover <id> Explicitly settle an interrupted simulation to failed (or cancelled with --cancel).
78
+ help [command] Show help information for a command.
50
79
 
51
80
  Options:
52
81
  --project <directory> Target project (default: current directory).
@@ -58,8 +87,53 @@ Options:
58
87
  -h, --help Show help without starting the host.
59
88
  -v, --version Show the package version without starting the host.
60
89
 
90
+ Examples:
91
+ offscript studio Start Studio in the current project
92
+ offscript studio --project ./my-app Start Studio for a specific project
93
+ offscript list List all simulations in the project
94
+ offscript results sim-123 Inspect observations and findings
95
+ offscript help studio Show detailed help for the studio command
96
+
61
97
  Flags override OFFSCRIPT_PROJECT_ROOT, OFFSCRIPT_PORT, OFFSCRIPT_DATA_DIRECTORY.
62
- No agents or target services start automatically.`);
98
+ No agents or target services start automatically.`;
99
+
100
+ try {
101
+ const { values, positionals } = parseArgs({ allowPositionals: true, options: {
102
+ project: { type: "string" }, port: { type: "string" }, "data-directory": { type: "string" },
103
+ "no-studio": { type: "boolean" }, "no-open": { type: "boolean" }, cancel: { type: "boolean" },
104
+ help: { type: "boolean", short: "h" }, version: { type: "boolean", short: "v" },
105
+ } });
106
+ const command = positionals[0];
107
+ const isHelp = command === "help" || Boolean(values.help);
108
+ const helpTarget = command === "help" ? positionals[1] : undefined;
109
+ const isResults = command === "results";
110
+ const isRecover = command === "recover";
111
+ const isTargeted = isResults || isRecover;
112
+ const validCommands = ["studio", "serve", "list", "results", "recover", "help"];
113
+ if (
114
+ (command !== undefined && !validCommands.includes(command)) ||
115
+ (isTargeted && positionals.length !== 2) ||
116
+ (!isTargeted && command !== "help" && positionals.length > 1) ||
117
+ (command === "help" && positionals.length > 2)
118
+ ) {
119
+ throw new Error("Expected studio, serve, list, results <simulation-id>, recover <simulation-id>, or help [command]. Use --help for usage.");
120
+ }
121
+ if (!isHelp && ((command === "studio" && values["no-studio"]) ||
122
+ ((command === "serve" || values["no-studio"]) && values["no-open"]) ||
123
+ ((command === "list" || isTargeted) && (values["no-studio"] || values["no-open"] || values.port)))) {
124
+ throw new Error("Conflicting options for command. Use --help for usage.");
125
+ }
126
+ if (isHelp) {
127
+ if (helpTarget) {
128
+ const targetHelp = commandHelps[helpTarget];
129
+ if (targetHelp) {
130
+ console.log(targetHelp);
131
+ } else {
132
+ throw new Error(`Unknown command "${helpTarget}". Expected studio, serve, list, results, or recover.`);
133
+ }
134
+ } else {
135
+ console.log(generalHelp);
136
+ }
63
137
  } else if (values.version) {
64
138
  console.log(JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version);
65
139
  } else {
@@ -88,7 +162,7 @@ No agents or target services start automatically.`);
88
162
  try {
89
163
  if (!statSync(new URL("./dist/scripts/server/run.js", import.meta.url)).isFile()) throw new Error();
90
164
  if (studio && !statSync(new URL("./dist/studio/index.html", import.meta.url)).isFile()) throw new Error();
91
- } catch { throw new Error("Distribution is missing. Run npm run build:local in the OFFSCRIPT checkout, or reinstall the archive."); }
165
+ } catch { throw new Error("Distribution is missing. Run npm install -g @nikelyh/offscript, or run npm run build:local in the source repository."); }
92
166
  process.env.OFFSCRIPT_PROJECT_ROOT = project;
93
167
  process.env.OFFSCRIPT_PORT = port;
94
168
  if (dataDirectory !== undefined) process.env.OFFSCRIPT_DATA_DIRECTORY = dataDirectory;
package/package.json CHANGED
@@ -64,7 +64,7 @@
64
64
  "esbuild@0.25.12": true,
65
65
  "esbuild@0.28.2": true
66
66
  },
67
- "version": "1.0.0",
67
+ "version": "1.1.1",
68
68
  "bin": {
69
69
  "offscript": "offscript.mjs"
70
70
  },