@sentientui/cli 0.2.5 → 0.3.0

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.
package/README.md CHANGED
@@ -18,12 +18,23 @@ npx @sentientui/cli init
18
18
 
19
19
  `init` **never edits your layout or any existing file.** Nothing adapts until you do the wrap-and-mount step it prints — add the provider snippet to your root layout and mount the example component yourself.
20
20
 
21
- ## Flags
21
+ ## Commands and flags
22
+
23
+ ```bash
24
+ npx @sentientui/cli init # set up SentientUI in this app
25
+ npx @sentientui/cli --help # full usage
26
+ npx @sentientui/cli --version # the installed version, on stdout
27
+ ```
22
28
 
23
29
  | Flag | Description |
24
30
  |------|-------------|
25
31
  | `--key pk_...` | Your public API key, written into `.env.local`. Omit it to leave the value empty — the SDK then runs in keyless local mode (decisions simulated on-device, nothing sent), so you can build and style before creating an account. |
26
32
  | `--yes` / `-y` | Accepted for npx muscle memory; `init` has no prompts, so this is already the default behavior. |
33
+ | `--help` / `-h` | Print usage and exit 0. |
34
+ | `--version` / `-v` | Print the version and exit 0. |
35
+
36
+ `--help` and `--version` print to stdout and exit 0, so they are safe to pipe.
37
+ An unknown command prints usage to stderr and exits 1.
27
38
 
28
39
  ## After init
29
40
 
@@ -31,6 +42,11 @@ Run your dev server and preview personas locally with `?sentient_persona=buyer`
31
42
 
32
43
  Full component and hook reference: the [`@sentientui/react` README](https://www.npmjs.com/package/@sentientui/react).
33
44
 
45
+ ## More
46
+
47
+ - [Developer resources](https://sentient-ui.com/docs/developers) — REST API, OpenAPI spec, MCP server, webhooks
48
+ - [CLI reference](https://sentient-ui.com/docs/developers#cli)
49
+
34
50
  ## License
35
51
 
36
52
  MIT
package/dist/index.cjs CHANGED
@@ -308,10 +308,41 @@ function runInit(opts) {
308
308
 
309
309
  // src/index.ts
310
310
  var import_meta = {};
311
+ var VERSION = true ? "0.3.0" : "0.0.0-dev";
312
+ var USAGE = `SentientUI CLI \u2014 adaptive UI personalization for the web
313
+
314
+ Usage
315
+ npx @sentientui/cli <command> [options]
316
+
317
+ Commands
318
+ init Set up SentientUI in an existing React app: detect the
319
+ framework (Next.js App/Pages Router, Vite, Remix, CRA),
320
+ install @sentientui/react, write .env.local, and scaffold
321
+ an example component.
322
+
323
+ Options
324
+ --key <pk_...> Publishable API key to write into .env.local. Omit it to
325
+ use keyless local mode, which returns deterministic
326
+ simulated decisions and needs no account.
327
+ --yes, -y Accept defaults without prompting (the default today).
328
+ --help, -h Show this help.
329
+ --version, -v Print the CLI version.
330
+
331
+ Notes
332
+ init does NOT edit your layout. It prints the snippet \u2014 you must wrap your app
333
+ in <AdaptiveRoot> yourself, or nothing adapts and nothing is tracked.
334
+
335
+ Verify an install by loading the app with ?sentient_persona=buyer and then
336
+ ?sentient_persona=deal_seeker; the two should render differently.
337
+
338
+ Docs https://sentient-ui.com/docs/developers#cli
339
+ API https://api.sentient-ui.com/openapi.json`;
311
340
  function parseArgs(argv) {
312
341
  const args = [...argv];
313
342
  const command = args.shift();
314
343
  let key;
344
+ let help = command === "--help" || command === "-h";
345
+ let version = command === "--version" || command === "-v";
315
346
  for (let i = 0; i < args.length; i++) {
316
347
  const arg = args[i];
317
348
  if (arg === "--key") {
@@ -319,12 +350,24 @@ function parseArgs(argv) {
319
350
  i++;
320
351
  } else if (arg.startsWith("--key=")) {
321
352
  key = arg.slice("--key=".length);
353
+ } else if (arg === "--help" || arg === "-h") {
354
+ help = true;
355
+ } else if (arg === "--version" || arg === "-v") {
356
+ version = true;
322
357
  }
323
358
  }
324
- return { command, key };
359
+ return { command, key, help, version };
325
360
  }
326
361
  function main(argv) {
327
- const { command, key } = parseArgs(argv);
362
+ const { command, key, help, version } = parseArgs(argv);
363
+ if (version) {
364
+ console.log(VERSION);
365
+ return;
366
+ }
367
+ if (help) {
368
+ console.log(USAGE);
369
+ return;
370
+ }
328
371
  if (command === "init") {
329
372
  try {
330
373
  runInit({ cwd: process.cwd(), key });
@@ -333,8 +376,13 @@ function main(argv) {
333
376
  process.exit(1);
334
377
  }
335
378
  } else {
336
- console.log("Usage: npx @sentientui/cli init [--key pk_...] [--yes]");
337
- process.exit(command ? 1 : 0);
379
+ if (command) {
380
+ console.error(`[sentientui] unknown command: ${command}
381
+ `);
382
+ console.error(USAGE);
383
+ process.exit(1);
384
+ }
385
+ console.log(USAGE);
338
386
  }
339
387
  }
340
388
  function isRunAsScript() {
package/dist/index.js CHANGED
@@ -273,10 +273,41 @@ function runInit(opts) {
273
273
  }
274
274
 
275
275
  // src/index.ts
276
+ var VERSION = true ? "0.3.0" : "0.0.0-dev";
277
+ var USAGE = `SentientUI CLI \u2014 adaptive UI personalization for the web
278
+
279
+ Usage
280
+ npx @sentientui/cli <command> [options]
281
+
282
+ Commands
283
+ init Set up SentientUI in an existing React app: detect the
284
+ framework (Next.js App/Pages Router, Vite, Remix, CRA),
285
+ install @sentientui/react, write .env.local, and scaffold
286
+ an example component.
287
+
288
+ Options
289
+ --key <pk_...> Publishable API key to write into .env.local. Omit it to
290
+ use keyless local mode, which returns deterministic
291
+ simulated decisions and needs no account.
292
+ --yes, -y Accept defaults without prompting (the default today).
293
+ --help, -h Show this help.
294
+ --version, -v Print the CLI version.
295
+
296
+ Notes
297
+ init does NOT edit your layout. It prints the snippet \u2014 you must wrap your app
298
+ in <AdaptiveRoot> yourself, or nothing adapts and nothing is tracked.
299
+
300
+ Verify an install by loading the app with ?sentient_persona=buyer and then
301
+ ?sentient_persona=deal_seeker; the two should render differently.
302
+
303
+ Docs https://sentient-ui.com/docs/developers#cli
304
+ API https://api.sentient-ui.com/openapi.json`;
276
305
  function parseArgs(argv) {
277
306
  const args = [...argv];
278
307
  const command = args.shift();
279
308
  let key;
309
+ let help = command === "--help" || command === "-h";
310
+ let version = command === "--version" || command === "-v";
280
311
  for (let i = 0; i < args.length; i++) {
281
312
  const arg = args[i];
282
313
  if (arg === "--key") {
@@ -284,12 +315,24 @@ function parseArgs(argv) {
284
315
  i++;
285
316
  } else if (arg.startsWith("--key=")) {
286
317
  key = arg.slice("--key=".length);
318
+ } else if (arg === "--help" || arg === "-h") {
319
+ help = true;
320
+ } else if (arg === "--version" || arg === "-v") {
321
+ version = true;
287
322
  }
288
323
  }
289
- return { command, key };
324
+ return { command, key, help, version };
290
325
  }
291
326
  function main(argv) {
292
- const { command, key } = parseArgs(argv);
327
+ const { command, key, help, version } = parseArgs(argv);
328
+ if (version) {
329
+ console.log(VERSION);
330
+ return;
331
+ }
332
+ if (help) {
333
+ console.log(USAGE);
334
+ return;
335
+ }
293
336
  if (command === "init") {
294
337
  try {
295
338
  runInit({ cwd: process.cwd(), key });
@@ -298,8 +341,13 @@ function main(argv) {
298
341
  process.exit(1);
299
342
  }
300
343
  } else {
301
- console.log("Usage: npx @sentientui/cli init [--key pk_...] [--yes]");
302
- process.exit(command ? 1 : 0);
344
+ if (command) {
345
+ console.error(`[sentientui] unknown command: ${command}
346
+ `);
347
+ console.error(USAGE);
348
+ process.exit(1);
349
+ }
350
+ console.log(USAGE);
303
351
  }
304
352
  }
305
353
  function isRunAsScript() {
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@sentientui/cli",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "SentientUI CLI — `npx @sentientui/cli init` sets up adaptive UI in an existing React app (installs the SDK, writes env config, scaffolds an example, and prints the wrap instructions)",
5
5
  "license": "MIT",
6
6
  "homepage": "https://sentient-ui.com",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/casancam/SentientUI.git",
9
+ "url": "git+https://github.com/SentientUI/sdk.git",
10
10
  "directory": "packages/cli"
11
11
  },
12
+ "bugs": "https://github.com/SentientUI/sdk/issues",
12
13
  "keywords": [
13
14
  "cli",
14
15
  "sentientui",