agentp 0.8.0 → 0.10.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/bin/ocmux CHANGED
@@ -192,6 +192,7 @@ function printHelp() {
192
192
  console.error(' --git Use the nearest parent with a .git entry (file or dir).');
193
193
  console.error(' --GIT Use the nearest parent with a .git directory only.');
194
194
  console.error(' Refuses to create above an existing .ocmux.json found while searching.');
195
+ console.error(' --print-logs Pass --print-logs to opencode serve (prints server logs to stderr).');
195
196
  console.error(' kill Kill the server found upward from <directory>.');
196
197
  console.error(' Removes its tmux window and state file.');
197
198
  console.error(' list List all running servers with their directories and URLs.');
@@ -201,6 +202,7 @@ function printHelp() {
201
202
  console.error('');
202
203
  console.error('Options:');
203
204
  console.error(' -l Long output: append " → <dir>" after the URL (serve/default).');
205
+ console.error(' --print-logs Pass --print-logs to opencode serve (prints server logs to stderr).');
204
206
  console.error(' --version Show version');
205
207
  console.error(' -h Show this help');
206
208
  console.error('');
@@ -290,7 +292,7 @@ function cmdList() {
290
292
  // Subcommand: new
291
293
  // ---------------------------------------------------------------------------
292
294
 
293
- function cmdNew(targetDir, longMode) {
295
+ function cmdNew(targetDir, longMode, printLogs) {
294
296
  const sf = path.join(targetDir, '.ocmux.json');
295
297
  if (fs.existsSync(sf)) {
296
298
  console.error(`Error: a server already exists in ${targetDir}.`);
@@ -311,14 +313,14 @@ function cmdNew(targetDir, longMode) {
311
313
  console.error('Cancelled.');
312
314
  process.exit(0);
313
315
  }
314
- doNew(targetDir, longMode);
316
+ doNew(targetDir, longMode, printLogs);
315
317
  });
316
318
  } else {
317
- doNew(targetDir, longMode);
319
+ doNew(targetDir, longMode, printLogs);
318
320
  }
319
321
  }
320
322
 
321
- function doNew(targetDir, longMode) {
323
+ function doNew(targetDir, longMode, printLogs) {
322
324
  ensureSession();
323
325
  const lf = logfileFor(targetDir);
324
326
 
@@ -343,8 +345,9 @@ function doNew(targetDir, longMode) {
343
345
  try { fs.truncateSync(lf); } catch { /* may not exist yet */ }
344
346
 
345
347
  // Send the command to the interactive shell (like typing it manually)
348
+ const serveFlags = printLogs ? '--port 0 --print-logs' : '--port 0';
346
349
  tmux(['send-keys', '-t', `${SESSION}:${winIdx}.0`,
347
- `opencode serve --port 0 2>&1 | tee '${lf}'`, 'Enter']);
350
+ `opencode serve ${serveFlags} 2>&1 | tee '${lf}'`, 'Enter']);
348
351
 
349
352
  // Wait up to 10s for the URL in the logfile.
350
353
  // Don't break on first match — keep polling so url ends up holding the
@@ -432,12 +435,15 @@ function cmdKill(statefile) {
432
435
  function main() {
433
436
  let longMode = false;
434
437
  let gitMode = null;
438
+ let printLogs = false;
435
439
  const positional = [];
436
440
  let dirIsForced = false;
437
441
 
438
442
  for (const arg of process.argv.slice(2)) {
439
443
  if (arg === '-l') {
440
444
  longMode = true;
445
+ } else if (arg === '--print-logs') {
446
+ printLogs = true;
441
447
  } else if (arg === '--git') {
442
448
  if (gitMode && gitMode !== 'nearest') {
443
449
  console.error("Error: cannot combine '--git' with '--GIT'.");
@@ -506,6 +512,10 @@ function main() {
506
512
  console.error("Error: '--git' and '--GIT' are only valid with 'serve'.");
507
513
  process.exit(1);
508
514
  }
515
+ if (printLogs) {
516
+ console.error("Error: '--print-logs' is only valid with 'serve'.");
517
+ process.exit(1);
518
+ }
509
519
  if (targetDir !== process.cwd()) {
510
520
  console.error("Error: 'list' does not accept a directory path.");
511
521
  process.exit(1);
@@ -516,6 +526,10 @@ function main() {
516
526
  console.error("Error: '--git' and '--GIT' are only valid with 'serve'.");
517
527
  process.exit(1);
518
528
  }
529
+ if (printLogs) {
530
+ console.error("Error: '--print-logs' is only valid with 'serve'.");
531
+ process.exit(1);
532
+ }
519
533
  const sf = findParentStatefile(targetDir);
520
534
  if (!sf) {
521
535
  console.error(`Error: no opencode server found in ${targetDir} or any of its parents.`);
@@ -528,12 +542,16 @@ function main() {
528
542
  const flagLabel = gitMode === 'root' ? '--GIT' : '--git';
529
543
  targetDir = resolveGitDir(targetDir, gitMode === 'root', flagLabel);
530
544
  }
531
- cmdNew(targetDir, longMode);
545
+ cmdNew(targetDir, longMode, printLogs);
532
546
  } else {
533
547
  if (gitMode) {
534
548
  console.error("Error: '--git' and '--GIT' are only valid with 'serve'.");
535
549
  process.exit(1);
536
550
  }
551
+ if (printLogs) {
552
+ console.error("Error: '--print-logs' is only valid with 'serve'.");
553
+ process.exit(1);
554
+ }
537
555
  // Default mode
538
556
  const sf = findParentStatefile(targetDir);
539
557
  if (!sf) {