@kehto/cli 0.2.9 → 0.2.16

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/dist/index.d.ts CHANGED
@@ -1,7 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { RunPajaCliOptions, CliIo } from '@kehto/paja/cli';
3
3
 
4
+ /**
5
+ * Top-level Kehto command router.
6
+ *
7
+ * @module
8
+ */
9
+
10
+ /** Execution controls for the top-level Kehto CLI router. */
4
11
  interface RunKehtoCliOptions {
12
+ /** Options forwarded to the `kehto paja` subcommand. */
5
13
  readonly paja?: RunPajaCliOptions;
6
14
  }
7
15
  /**
@@ -18,6 +26,12 @@ interface RunKehtoCliOptions {
18
26
  * ```
19
27
  */
20
28
  declare function runKehtoCli(args?: readonly string[], io?: CliIo, options?: RunKehtoCliOptions): Promise<number>;
29
+ /**
30
+ * Detect whether the module is being executed as the CLI entrypoint.
31
+ *
32
+ * @param entryPath - Process entry path to inspect.
33
+ * @returns `true` when the path looks like the built Kehto CLI entry.
34
+ */
21
35
  declare function isDirectCli(entryPath?: string): boolean;
22
36
 
23
37
  export { type RunKehtoCliOptions, isDirectCli, runKehtoCli };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {\n runPajaCli,\n type CliIo,\n type RunPajaCliOptions,\n} from '@kehto/paja/cli';\n\nexport interface RunKehtoCliOptions {\n readonly paja?: RunPajaCliOptions;\n}\n\n/**\n * Run the top-level Kehto CLI command router.\n *\n * @param args - Argument vector without the node executable or script path.\n * @param io - Output streams used by the command.\n * @param options - Execution controls for embedded test runners.\n * @returns Process exit code.\n *\n * @example\n * ```ts\n * await runKehtoCli(['paja', '--target-url', 'http://127.0.0.1:5173']);\n * ```\n */\nexport async function runKehtoCli(\n args: readonly string[] = process.argv.slice(2),\n io: CliIo = defaultIo,\n options: RunKehtoCliOptions = {},\n): Promise<number> {\n const [command, ...rest] = args;\n\n if (!command || command === '--help' || command === '-h') {\n io.stdout.write(`${HELP_TEXT}\\n`);\n return 0;\n }\n\n if (command === 'paja') {\n return runPajaCli(rest, io, options.paja);\n }\n\n io.stderr.write(`kehto: unknown command \"${command}\". Run kehto --help for usage.\\n`);\n return 1;\n}\n\nconst HELP_TEXT = `Usage:\n kehto <command> [options]\n\nCommands:\n paja Run a napplet app inside the Paja local authoring workshop.\n\nExamples:\n kehto paja --target-url http://127.0.0.1:5173 -- pnpm vite --host 127.0.0.1\n kehto paja --config kehto.dev.json\n\nOptions:\n --help, -h Show this help.`;\n\nconst defaultIo: CliIo = {\n stdout: { write: (chunk) => process.stdout.write(chunk) },\n stderr: { write: (chunk) => process.stderr.write(chunk) },\n};\n\nif (isDirectCli()) {\n void runKehtoCli().then((code) => {\n process.exitCode = code;\n });\n}\n\nexport function isDirectCli(entryPath = process.argv[1]): boolean {\n if (!entryPath) return false;\n return entryPath.endsWith('/index.js') || entryPath.endsWith('/kehto');\n}\n\ndeclare const process: {\n argv: string[];\n exitCode?: number;\n stdout: { write(chunk: string): void };\n stderr: { write(chunk: string): void };\n};\n"],"mappings":";;;AACA;AAAA,EACE;AAAA,OAGK;AAmBP,eAAsB,YACpB,OAA0B,QAAQ,KAAK,MAAM,CAAC,GAC9C,KAAY,WACZ,UAA8B,CAAC,GACd;AACjB,QAAM,CAAC,SAAS,GAAG,IAAI,IAAI;AAE3B,MAAI,CAAC,WAAW,YAAY,YAAY,YAAY,MAAM;AACxD,OAAG,OAAO,MAAM,GAAG,SAAS;AAAA,CAAI;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,QAAQ;AACtB,WAAO,WAAW,MAAM,IAAI,QAAQ,IAAI;AAAA,EAC1C;AAEA,KAAG,OAAO,MAAM,2BAA2B,OAAO;AAAA,CAAkC;AACpF,SAAO;AACT;AAEA,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAalB,IAAM,YAAmB;AAAA,EACvB,QAAQ,EAAE,OAAO,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK,EAAE;AAAA,EACxD,QAAQ,EAAE,OAAO,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK,EAAE;AAC1D;AAEA,IAAI,YAAY,GAAG;AACjB,OAAK,YAAY,EAAE,KAAK,CAAC,SAAS;AAChC,YAAQ,WAAW;AAAA,EACrB,CAAC;AACH;AAEO,SAAS,YAAY,YAAY,QAAQ,KAAK,CAAC,GAAY;AAChE,MAAI,CAAC,UAAW,QAAO;AACvB,SAAO,UAAU,SAAS,WAAW,KAAK,UAAU,SAAS,QAAQ;AACvE;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Top-level Kehto command router.\n *\n * @module\n */\nimport {\n runPajaCli,\n type CliIo,\n type RunPajaCliOptions,\n} from '@kehto/paja/cli';\n\n/** Execution controls for the top-level Kehto CLI router. */\nexport interface RunKehtoCliOptions {\n /** Options forwarded to the `kehto paja` subcommand. */\n readonly paja?: RunPajaCliOptions;\n}\n\n/**\n * Run the top-level Kehto CLI command router.\n *\n * @param args - Argument vector without the node executable or script path.\n * @param io - Output streams used by the command.\n * @param options - Execution controls for embedded test runners.\n * @returns Process exit code.\n *\n * @example\n * ```ts\n * await runKehtoCli(['paja', '--target-url', 'http://127.0.0.1:5173']);\n * ```\n */\nexport async function runKehtoCli(\n args: readonly string[] = process.argv.slice(2),\n io: CliIo = defaultIo,\n options: RunKehtoCliOptions = {},\n): Promise<number> {\n const [command, ...rest] = args;\n\n if (!command || command === '--help' || command === '-h') {\n io.stdout.write(`${HELP_TEXT}\\n`);\n return 0;\n }\n\n if (command === 'paja') {\n return runPajaCli(rest, io, options.paja);\n }\n\n io.stderr.write(`kehto: unknown command \"${command}\". Run kehto --help for usage.\\n`);\n return 1;\n}\n\nconst HELP_TEXT = `Usage:\n kehto <command> [options]\n\nCommands:\n paja Run a napplet app inside the Paja local authoring workshop.\n\nExamples:\n kehto paja --target-url http://127.0.0.1:5173 -- pnpm vite --host 127.0.0.1\n kehto paja --config kehto.dev.json\n\nOptions:\n --help, -h Show this help.`;\n\nconst defaultIo: CliIo = {\n stdout: { write: (chunk) => process.stdout.write(chunk) },\n stderr: { write: (chunk) => process.stderr.write(chunk) },\n};\n\nif (isDirectCli()) {\n void runKehtoCli().then((code) => {\n process.exitCode = code;\n });\n}\n\n/**\n * Detect whether the module is being executed as the CLI entrypoint.\n *\n * @param entryPath - Process entry path to inspect.\n * @returns `true` when the path looks like the built Kehto CLI entry.\n */\nexport function isDirectCli(entryPath = process.argv[1]): boolean {\n if (!entryPath) return false;\n return entryPath.endsWith('/index.js') || entryPath.endsWith('/kehto');\n}\n\ndeclare const process: {\n argv: string[];\n exitCode?: number;\n stdout: { write(chunk: string): void };\n stderr: { write(chunk: string): void };\n};\n"],"mappings":";;;AAMA;AAAA,EACE;AAAA,OAGK;AAqBP,eAAsB,YACpB,OAA0B,QAAQ,KAAK,MAAM,CAAC,GAC9C,KAAY,WACZ,UAA8B,CAAC,GACd;AACjB,QAAM,CAAC,SAAS,GAAG,IAAI,IAAI;AAE3B,MAAI,CAAC,WAAW,YAAY,YAAY,YAAY,MAAM;AACxD,OAAG,OAAO,MAAM,GAAG,SAAS;AAAA,CAAI;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,QAAQ;AACtB,WAAO,WAAW,MAAM,IAAI,QAAQ,IAAI;AAAA,EAC1C;AAEA,KAAG,OAAO,MAAM,2BAA2B,OAAO;AAAA,CAAkC;AACpF,SAAO;AACT;AAEA,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAalB,IAAM,YAAmB;AAAA,EACvB,QAAQ,EAAE,OAAO,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK,EAAE;AAAA,EACxD,QAAQ,EAAE,OAAO,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK,EAAE;AAC1D;AAEA,IAAI,YAAY,GAAG;AACjB,OAAK,YAAY,EAAE,KAAK,CAAC,SAAS;AAChC,YAAQ,WAAW;AAAA,EACrB,CAAC;AACH;AAQO,SAAS,YAAY,YAAY,QAAQ,KAAK,CAAC,GAAY;AAChE,MAAI,CAAC,UAAW,QAAO;AACvB,SAAO,UAAU,SAAS,WAAW,KAAK,UAAU,SAAS,QAAQ;AACvE;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kehto/cli",
3
- "version": "0.2.9",
3
+ "version": "0.2.16",
4
4
  "description": "Top-level Kehto CLI for local napplet authoring and runtime tooling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,16 +24,16 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@kehto/paja": "^0.6.0"
27
+ "@kehto/paja": "^0.8.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@napplet/core": ">=0.23.0 <0.26.0",
31
- "@napplet/nap": ">=0.23.0 <0.26.0",
32
- "nostr-tools": ">=2.23.3 <3.0.0"
30
+ "@napplet/core": ">=0.23.0 <=0.28.x",
31
+ "@napplet/nap": ">=0.23.0 <=0.28.x",
32
+ "nostr-tools": ">=2.23.3 <=2.x"
33
33
  },
34
34
  "devDependencies": {
35
- "@napplet/core": ">=0.23.0 <0.26.0",
36
- "@napplet/nap": ">=0.23.0 <0.26.0",
35
+ "@napplet/core": ">=0.23.0 <=0.28.x",
36
+ "@napplet/nap": ">=0.23.0 <=0.28.x",
37
37
  "nostr-tools": "^2.23.3",
38
38
  "tsup": "^8.5.0",
39
39
  "typescript": "^5.9.3",