@demicodes/shell 0.11.0 → 0.12.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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as HostProcess, c as HostSpawnHandle, i as HostFileSystem, l as HostSpawnParams, n as HostDirent, o as HostProcessOutputChunk, r as HostFileStat, s as HostSpawnExit, t as Host, u as HostStore } from "./host-DIg4RxcL.mjs";
2
2
  import { HostBackedFileSystem, VirtualFileSystemNode, VirtualFileSystemProvider, virtualDirectory, virtualFile } from "./host-fs.mjs";
3
- import { _ as runRegisteredCommand, a as CommandIO, c as CommandRegistry, d as CommandStdin, f as CommandStorage, g as renderCommandHelp, h as parseCommandInput, i as CommandExecutionContext, l as CommandRunContext, m as emptyStdin, n as COMMAND_HELP_DEFAULTS, o as CommandInputSpec, p as ParsedCommandInput, r as Command, s as CommandOutputSpec, t as AgentSessionCommandStorage, u as CommandRunResult } from "./storage-DB9hjZ2G.mjs";
3
+ import { _ as runRegisteredCommand, a as CommandIO, c as CommandRegistry, d as CommandStdin, f as CommandStorage, g as renderCommandHelp, h as parseCommandInput, i as CommandExecutionContext, l as CommandRunContext, m as emptyStdin, n as COMMAND_HELP_DEFAULTS, o as CommandInputSpec, p as ParsedCommandInput, r as Command, s as CommandOutputSpec, t as AgentSessionCommandStorage, u as CommandRunResult } from "./storage-ylShLr2v.mjs";
4
4
  import { CommandName } from "@demicodes/just-bash/commands";
5
5
  import { Interpreter, InterpreterState } from "@demicodes/just-bash/interpreter";
6
6
  import { CommandRegistry as CommandRegistry$1, ExecResult } from "@demicodes/just-bash/types";
package/dist/index.mjs CHANGED
@@ -121,8 +121,7 @@ const EXECUTION_ONLY_FIELDS = [
121
121
  "input",
122
122
  "positionals",
123
123
  "stdinField",
124
- "output",
125
- "examples"
124
+ "output"
126
125
  ];
127
126
  const COMMAND_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
128
127
  var CommandRegistry = class {
@@ -292,11 +291,6 @@ function renderCommandHelp(command, parentPath = "") {
292
291
  if (command.stdinField) lines.push(` stdin/heredoc: ${command.stdinField}`);
293
292
  if (command.output?.json) lines.push(" --json: emits machine-readable JSON for this command");
294
293
  else lines.push(" --json: accepted only when this command defines JSON output");
295
- const examples = command.examples ?? [];
296
- if (examples.length > 0) {
297
- lines.push(" Examples:");
298
- for (const example of examples) lines.push(indent(example, 6));
299
- }
300
294
  }
301
295
  const children = command.subcommands ?? [];
302
296
  if (children.length > 0) {
@@ -312,9 +306,9 @@ function validateCommandTree(command, path) {
312
306
  const hasRun = typeof command.run === "function";
313
307
  const children = command.subcommands ?? [];
314
308
  if (!hasRun && children.length === 0) throw new Error(`CommandRegistry: "${path}" must have run() and/or subcommands`);
315
- if (hasRun) {
316
- if (!Array.isArray(command.examples)) throw new Error(`CommandRegistry: "${path}" defines run() but is missing examples[]`);
317
- } else for (const field of EXECUTION_ONLY_FIELDS) if (command[field] !== void 0) throw new Error(`CommandRegistry: "${path}" sets ${field} without run()`);
309
+ if (!hasRun) {
310
+ for (const field of EXECUTION_ONLY_FIELDS) if (command[field] !== void 0) throw new Error(`CommandRegistry: "${path}" sets ${field} without run()`);
311
+ }
318
312
  if (hasRun) {
319
313
  const input = command.input ?? {};
320
314
  if (command.stdinField && !(command.stdinField in input)) throw new Error(`CommandRegistry: "${path}" stdinField "${command.stdinField}" is not in input`);
@@ -364,10 +358,6 @@ function coerceValue(schema, value) {
364
358
  function formatField(field, schema, positional, stdin) {
365
359
  return `${positional ? `<${field}>` : `--${field}`}${stdin ? " (from stdin/heredoc)" : ""}${schema.description ? ` - ${schema.description}` : ""}`;
366
360
  }
367
- function indent(text, spaces) {
368
- const prefix = " ".repeat(spaces);
369
- return text.split("\n").map((line) => `${prefix}${line}`).join("\n");
370
- }
371
361
  function isArraySchema(schema) {
372
362
  const unwrapped = unwrapSchema(schema);
373
363
  return zodTypeName(unwrapped) === "array" || zodTypeName(unwrapped) === "ZodArray";
@@ -26,8 +26,6 @@ interface Command {
26
26
  positionals?: string[];
27
27
  stdinField?: string;
28
28
  output?: CommandOutputSpec;
29
- /** Required when `run` is set; an empty array renders no examples section. */
30
- examples?: string[];
31
29
  }
32
30
  interface ParsedCommandInput {
33
31
  /**
@@ -1,2 +1,2 @@
1
- import { t as AgentSessionCommandStorage } from "./storage-DB9hjZ2G.mjs";
1
+ import { t as AgentSessionCommandStorage } from "./storage-ylShLr2v.mjs";
2
2
  export { AgentSessionCommandStorage };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demicodes/shell",
3
3
  "description": "Sandboxable bash engine and Host contract for Demi.",
4
- "version": "0.11.0",
4
+ "version": "0.12.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@demicodes/just-bash": "^3.0.1-demi.5",
23
- "@demicodes/utils": "^0.11.0",
23
+ "@demicodes/utils": "^0.12.0",
24
24
  "zod": "^4.0.0"
25
25
  },
26
26
  "license": "Apache-2.0",