@oh-my-pi/pi-coding-agent 13.12.9 → 13.12.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [13.12.10] - 2026-03-17
6
+ ### Added
7
+
8
+ - Added `args` field to ShellResult to capture the executed command
9
+ - Added `exit_code` property to ShellResult as an alias for `returncode`
10
+ - Added `check_returncode()` method to ShellResult to raise CalledProcessError on non-zero exit codes
11
+
12
+ ### Changed
13
+
14
+ - Renamed `code` field to `returncode` in ShellResult (accessible via `code` property for backward compatibility)
15
+ - Updated `run()` command documentation to clarify available ShellResult fields
16
+
5
17
  ## [13.12.9] - 2026-03-17
6
18
  ### Added
7
19
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-coding-agent",
4
- "version": "13.12.9",
4
+ "version": "13.12.10",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -41,12 +41,12 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@mozilla/readability": "^0.6",
44
- "@oh-my-pi/omp-stats": "13.12.9",
45
- "@oh-my-pi/pi-agent-core": "13.12.9",
46
- "@oh-my-pi/pi-ai": "13.12.9",
47
- "@oh-my-pi/pi-natives": "13.12.9",
48
- "@oh-my-pi/pi-tui": "13.12.9",
49
- "@oh-my-pi/pi-utils": "13.12.9",
44
+ "@oh-my-pi/omp-stats": "13.12.10",
45
+ "@oh-my-pi/pi-agent-core": "13.12.10",
46
+ "@oh-my-pi/pi-ai": "13.12.10",
47
+ "@oh-my-pi/pi-natives": "13.12.10",
48
+ "@oh-my-pi/pi-tui": "13.12.10",
49
+ "@oh-my-pi/pi-utils": "13.12.10",
50
50
  "@sinclair/typebox": "^0.34",
51
51
  "@xterm/headless": "^6.0",
52
52
  "ajv": "^8.18",
@@ -305,23 +305,40 @@ if "__omp_prelude_loaded__" not in globals():
305
305
 
306
306
  class ShellResult:
307
307
  """Result from shell command execution."""
308
- __slots__ = ("stdout", "stderr", "code")
309
- def __init__(self, stdout: str, stderr: str, code: int):
308
+ __slots__ = ("args", "stdout", "stderr", "returncode")
309
+ def __init__(self, args: str, stdout: str, stderr: str, returncode: int):
310
+ self.args = args
310
311
  self.stdout = stdout
311
312
  self.stderr = stderr
312
- self.code = code
313
+ self.returncode = returncode
314
+
315
+ @property
316
+ def code(self) -> int:
317
+ return self.returncode
318
+
319
+ @property
320
+ def exit_code(self) -> int:
321
+ return self.returncode
322
+
323
+ def check_returncode(self) -> None:
324
+ if self.returncode != 0:
325
+ raise subprocess.CalledProcessError(
326
+ self.returncode, self.args, output=self.stdout, stderr=self.stderr
327
+ )
328
+
313
329
  def __repr__(self):
314
- if self.code == 0:
330
+ if self.returncode == 0:
315
331
  return ""
316
- return f"exit code {self.code}"
332
+ return f"exit code {self.returncode}"
333
+
317
334
  def __bool__(self):
318
- return self.code == 0
335
+ return self.returncode == 0
319
336
 
320
337
  def _make_shell_result(proc: subprocess.CompletedProcess[str], cmd: str) -> ShellResult:
321
338
  """Create ShellResult and emit status."""
322
339
  output = proc.stdout + proc.stderr if proc.stderr else proc.stdout
323
340
  _emit_status("sh", cmd=cmd[:80], code=proc.returncode, output=output[:500])
324
- return ShellResult(proc.stdout, proc.stderr, proc.returncode)
341
+ return ShellResult(cmd, proc.stdout, proc.stderr, proc.returncode)
325
342
 
326
343
  import signal as _signal
327
344
 
@@ -356,7 +373,7 @@ if "__omp_prelude_loaded__" not in globals():
356
373
 
357
374
  @_category("Shell")
358
375
  def run(cmd: str, *, cwd: str | Path | None = None, timeout: int | None = None) -> ShellResult:
359
- """Run a shell command."""
376
+ """Run a shell command. Returns ShellResult with stdout/stderr and returncode/exit_code fields."""
360
377
  shell_path = shutil.which("bash") or shutil.which("sh") or "/bin/sh"
361
378
  args = [shell_path, "-c", cmd]
362
379
  return _run_with_interrupt(args, str(cwd) if cwd else None, timeout, cmd)