@crazyhappyone/dsh-tui 0.1.0-alpha.6 → 0.1.0-alpha.7

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 (3) hide show
  1. package/dist/index.js +21730 -1674
  2. package/dist/startup.js +65 -26
  3. package/package.json +1 -1
package/dist/startup.js CHANGED
@@ -153,7 +153,7 @@ import { EventEmitter } from "node:events";
153
153
  import childProcess from "node:child_process";
154
154
  import path from "node:path";
155
155
  import fs from "node:fs";
156
- import process from "node:process";
156
+ import process2 from "node:process";
157
157
  import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
158
158
 
159
159
  // ../deepseek-harness/node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/help.js
@@ -1171,13 +1171,13 @@ var Command = class _Command extends EventEmitter {
1171
1171
  this._showSuggestionAfterError = true;
1172
1172
  this._savedState = null;
1173
1173
  this._outputConfiguration = {
1174
- writeOut: (str) => process.stdout.write(str),
1175
- writeErr: (str) => process.stderr.write(str),
1174
+ writeOut: (str) => process2.stdout.write(str),
1175
+ writeErr: (str) => process2.stderr.write(str),
1176
1176
  outputError: (str, write) => write(str),
1177
- getOutHelpWidth: () => process.stdout.isTTY ? process.stdout.columns : void 0,
1178
- getErrHelpWidth: () => process.stderr.isTTY ? process.stderr.columns : void 0,
1179
- getOutHasColors: () => useColor() ?? (process.stdout.isTTY && process.stdout.hasColors?.()),
1180
- getErrHasColors: () => useColor() ?? (process.stderr.isTTY && process.stderr.hasColors?.()),
1177
+ getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : void 0,
1178
+ getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : void 0,
1179
+ getOutHasColors: () => useColor() ?? (process2.stdout.isTTY && process2.stdout.hasColors?.()),
1180
+ getErrHasColors: () => useColor() ?? (process2.stderr.isTTY && process2.stderr.hasColors?.()),
1181
1181
  stripColor: (str) => stripVTControlCharacters2(str)
1182
1182
  };
1183
1183
  this._hidden = false;
@@ -1571,7 +1571,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1571
1571
  if (this._exitCallback) {
1572
1572
  this._exitCallback(new CommanderError(exitCode, code, message));
1573
1573
  }
1574
- process.exit(exitCode);
1574
+ process2.exit(exitCode);
1575
1575
  }
1576
1576
  /**
1577
1577
  * Register callback `fn` for the command.
@@ -1962,16 +1962,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
1962
1962
  }
1963
1963
  parseOptions = parseOptions || {};
1964
1964
  if (argv === void 0 && parseOptions.from === void 0) {
1965
- if (process.versions?.electron) {
1965
+ if (process2.versions?.electron) {
1966
1966
  parseOptions.from = "electron";
1967
1967
  }
1968
- const execArgv = process.execArgv ?? [];
1968
+ const execArgv = process2.execArgv ?? [];
1969
1969
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
1970
1970
  parseOptions.from = "eval";
1971
1971
  }
1972
1972
  }
1973
1973
  if (argv === void 0) {
1974
- argv = process.argv;
1974
+ argv = process2.argv;
1975
1975
  }
1976
1976
  this.rawArgs = argv.slice();
1977
1977
  let userArgs;
@@ -1982,7 +1982,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1982
1982
  userArgs = argv.slice(2);
1983
1983
  break;
1984
1984
  case "electron":
1985
- if (process.defaultApp) {
1985
+ if (process2.defaultApp) {
1986
1986
  this._scriptPath = argv[1];
1987
1987
  userArgs = argv.slice(2);
1988
1988
  } else {
@@ -2180,11 +2180,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2180
2180
  }
2181
2181
  const launchWithNode = sourceExt.includes(path.extname(executableFile));
2182
2182
  let proc;
2183
- if (process.platform !== "win32") {
2183
+ if (process2.platform !== "win32") {
2184
2184
  if (launchWithNode) {
2185
2185
  args.unshift(executableFile);
2186
- args = incrementNodeInspectorPort(process.execArgv).concat(args);
2187
- proc = childProcess.spawn(process.argv[0], args, { stdio: "inherit" });
2186
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
2187
+ proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
2188
2188
  } else {
2189
2189
  proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
2190
2190
  }
@@ -2195,13 +2195,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2195
2195
  subcommand._name
2196
2196
  );
2197
2197
  args.unshift(executableFile);
2198
- args = incrementNodeInspectorPort(process.execArgv).concat(args);
2199
- proc = childProcess.spawn(process.execPath, args, { stdio: "inherit" });
2198
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
2199
+ proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
2200
2200
  }
2201
2201
  if (!proc.killed) {
2202
2202
  const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
2203
2203
  signals.forEach((signal) => {
2204
- process.on(signal, () => {
2204
+ process2.on(signal, () => {
2205
2205
  if (proc.killed === false && proc.exitCode === null) {
2206
2206
  proc.kill(signal);
2207
2207
  }
@@ -2212,7 +2212,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2212
2212
  proc.on("close", (code) => {
2213
2213
  code = code ?? 1;
2214
2214
  if (!exitCallback) {
2215
- process.exit(code);
2215
+ process2.exit(code);
2216
2216
  } else {
2217
2217
  exitCallback(
2218
2218
  new CommanderError(
@@ -2234,7 +2234,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2234
2234
  throw new Error(`'${executableFile}' not executable`);
2235
2235
  }
2236
2236
  if (!exitCallback) {
2237
- process.exit(1);
2237
+ process2.exit(1);
2238
2238
  } else {
2239
2239
  const wrappedError = new CommanderError(
2240
2240
  1,
@@ -2734,13 +2734,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2734
2734
  */
2735
2735
  _parseOptionsEnv() {
2736
2736
  this.options.forEach((option) => {
2737
- if (option.envVar && option.envVar in process.env) {
2737
+ if (option.envVar && option.envVar in process2.env) {
2738
2738
  const optionKey = option.attributeName();
2739
2739
  if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
2740
2740
  this.getOptionValueSource(optionKey)
2741
2741
  )) {
2742
2742
  if (option.required || option.optional) {
2743
- this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);
2743
+ this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
2744
2744
  } else {
2745
2745
  this.emit(`optionEnv:${option.name()}`);
2746
2746
  }
@@ -3266,7 +3266,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3266
3266
  */
3267
3267
  help(contextOptions) {
3268
3268
  this.outputHelp(contextOptions);
3269
- let exitCode = Number(process.exitCode ?? 0);
3269
+ let exitCode = Number(process2.exitCode ?? 0);
3270
3270
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
3271
3271
  exitCode = 1;
3272
3272
  }
@@ -3356,9 +3356,9 @@ function incrementNodeInspectorPort(args) {
3356
3356
  });
3357
3357
  }
3358
3358
  function useColor() {
3359
- if (process.env.NO_COLOR || process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false")
3359
+ if (process2.env.NO_COLOR || process2.env.FORCE_COLOR === "0" || process2.env.FORCE_COLOR === "false")
3360
3360
  return false;
3361
- if (process.env.FORCE_COLOR || process.env.CLICOLOR_FORCE !== void 0)
3361
+ if (process2.env.FORCE_COLOR || process2.env.CLICOLOR_FORCE !== void 0)
3362
3362
  return true;
3363
3363
  return void 0;
3364
3364
  }
@@ -3366,8 +3366,47 @@ function useColor() {
3366
3366
  // ../deepseek-harness/node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
3367
3367
  var program = new Command();
3368
3368
 
3369
+ // ../deepseek-harness/packages/boot/cmdline/src/index.ts
3370
+ var internals = {
3371
+ stdin: process.stdin,
3372
+ stdout: process.stdout,
3373
+ stderr: process.stderr
3374
+ };
3375
+ function parseCmdline(ctx, program2) {
3376
+ const args = ctx.get("cmdlineArgs");
3377
+ const exit = ctx.get("appExit");
3378
+ if (args === void 0 || exit === void 0) {
3379
+ throw new Error(`${program2.name()}: the launcher must provide ctx.cmdlineArgs and ctx.appExit before the tree mounts`);
3380
+ }
3381
+ if (!hasAction(program2)) {
3382
+ throw new Error(`${program2.name()}: no command in the program declares an action; parseCmdline runs the invoked command's action on a successful parse, and app code there publishes its service`);
3383
+ }
3384
+ configureExitAndOutput(program2);
3385
+ try {
3386
+ program2.parse(args.get(), { from: "user" });
3387
+ } catch (error) {
3388
+ if (!isCommanderError(error)) throw error;
3389
+ exit(error.exitCode);
3390
+ }
3391
+ }
3392
+ function hasAction(command) {
3393
+ if (typeof command._actionHandler === "function") return true;
3394
+ return command.commands.some(hasAction);
3395
+ }
3396
+ function configureExitAndOutput(command) {
3397
+ command.exitOverride().configureOutput({
3398
+ writeOut: (text) => void internals.stdout.write(text),
3399
+ writeErr: (text) => void internals.stderr.write(text)
3400
+ });
3401
+ for (const child of command.commands) configureExitAndOutput(child);
3402
+ }
3403
+ function isCommanderError(error) {
3404
+ if (typeof error !== "object" || error === null) return false;
3405
+ const candidate = error;
3406
+ return typeof candidate.code === "string" && candidate.code.startsWith("commander.") && typeof candidate.exitCode === "number";
3407
+ }
3408
+
3369
3409
  // ../deepseek-harness/packages/tui/tui/src/startup.ts
3370
- import { parseCmdline } from "@deepseek-ai/dsh-cmdline";
3371
3410
  var name = "tui-startup";
3372
3411
  var inject = ["cmdlineArgs"];
3373
3412
  var TUI_STARTUP_SERVICE = "tuiStartup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crazyhappyone/dsh-tui",
3
- "version": "0.1.0-alpha.6",
3
+ "version": "0.1.0-alpha.7",
4
4
  "description": "Source-runtime launcher for the DeepSeek Harness terminal interface",
5
5
  "type": "module",
6
6
  "license": "MIT",