Commit Graph

30 Commits

Author SHA1 Message Date
Mohamed Boudra
111b9d95f4 feat: carry archive UI label hard cut updates 2026-03-04 10:39:28 +07:00
Mohamed Boudra
a060ae1256 test: harden daemon lifecycle and e2e reliability across app/cli/server 2026-02-25 10:21:46 +07:00
Mohamed Boudra
3f06063b4b fix(cli): make agent wait unlimited by default 2026-02-23 20:51:42 +07:00
Mohamed Boudra
e26dcde2c8 fix(server): use parent pid for lock ownership when spawned as child process 2026-02-18 19:40:46 +07:00
Mohamed Boudra
ce5d9d6dc8 refactor: unify structured generation pipeline 2026-02-17 14:52:58 +07:00
Mohamed Boudra
34e35621f0 simplify speech bootstrap and clean daemon startup locking 2026-02-17 12:16:02 +07:00
Mohamed Boudra
d6f21b3568 refactor(cli): centralize worktree ls path resolution
What I changed:\n- Refactored worktree path handling in worktree ls into focused helpers: resolvePaseoHomePath, resolvePaseoWorktreesDir, and isAgentInManagedWorktree.\n- Switched worktree name extraction to node:path basename for clearer intent and path handling.\n- Added a focused regression test (20-worktree-ls-paths.test.ts) covering explicit PASEO_HOME and fallback home resolution behavior.\n\nReasoning:\n- The prior implementation repeated path derivation inline inside the agent loop, mixed decision logic with mapping, and relied on string concatenation for filesystem boundaries.\n- Extracting this logic reduces cognitive load, keeps policy in one place, and makes behavior directly testable without daemon dependencies.\n\nVerification:\n- npx tsx packages/cli/tests/20-worktree-ls-paths.test.ts\n- npx tsx packages/cli/tests/14-worktree.test.ts\n- npm run typecheck (all workspaces)\n\nNotes for next agent:\n- Similar inline PASEO_HOME/path derivation still exists in other CLI commands; these helpers can be reused to continue consistency work.\n- No behavior change intended for command output or error semantics; this was a structural-only refactor aligned with refactor-skill constraints.
2026-02-14 08:38:06 +07:00
Mohamed Boudra
86b291814b test(cli): deflake daemon command integration assertions
What changed:
- Updated packages/cli/tests/03-daemon.test.ts to match current daemon command semantics where  reports local state and exits successfully when stopped.
- Removed host-based failure assumptions from status/status --json checks and asserted deterministic  output for an isolated PASEO_HOME.
- Hardened restart coverage to use an isolated random port and explicit cleanup via .
- Added best-effort forced cleanup in  to avoid leaking a daemon process if assertions fail mid-test.

Reasoning:
- Recent CLI refactors switched  from connection-failure behavior to local PID/config introspection, so the old test expectation () became incorrect and flaky.
- The restart path can occasionally exceed graceful stop timeout immediately after spawn; forced cleanup makes the test reliable without changing product behavior.
- This is a behavior-preserving test hardening refactor aligned with the refactor skill contract.

Verification:
- npx tsx packages/cli/tests/03-daemon.test.ts
- npm run typecheck

Accomplishments for next agent:
-  now validates current status semantics and no longer depends on transient host connectivity assumptions.
- Restart coverage now cleans up deterministically, reducing local test pollution and follow-on failures.

Challenges / notes for next agent:
- Restart cleanup still depends on process management timing; this test now uses  cleanup intentionally to keep CI/dev runs stable.
- If you later tighten restart lifecycle behavior, consider adding a dedicated unit-level test around stop timeout + escalation in local daemon utilities.
2026-02-14 08:25:50 +07:00
Mohamed Boudra
004bb0ea33 refactor(cli): unify daemon start error message handling
What changed:
- Added a shared utility `getErrorMessage(error: unknown)` in `packages/cli/src/utils/errors.ts`.
- Refactored `packages/cli/src/commands/daemon/start.ts` to use `getErrorMessage` and a local `exitWithError` helper instead of repeating inline error-message extraction + exit logic in each catch block.
- Added `packages/cli/tests/19-errors-utils.test.ts` to lock utility behavior for Error and non-Error throw values.

Reasoning:
- `runStart` had repeated branching (`err instanceof Error ? err.message : String(err)`) across multiple catch sites.
- Centralizing this keeps behavior stable while reducing duplication and cognitive overhead, aligned with the refactor skill guidance to simplify structure without changing user-visible behavior.

Verification:
- Ran `npx tsx packages/cli/tests/18-local-daemon-utils.test.ts` (pass).
- Ran `npx tsx packages/cli/tests/19-errors-utils.test.ts` (pass).
- Ran `npm run -w @getpaseo/cli typecheck` (pass).

Notes for next agent:
- Existing `scripts/codex-refactor-loop.sh` was already modified before this change and is intentionally not included.
- `packages/cli/tests/03-daemon.test.ts` currently failed in this environment because Test 3 expected daemon status failure, but command exited successfully (likely environment state dependent). This refactor does not touch that path; worth deflakifying or isolating in a follow-up.
2026-02-14 01:51:36 +07:00
Mohamed Boudra
6ff1c42132 refactor(cli): simplify agent mode validation flow
What I changed:
- extracted a single missingModeError helper in agent/mode.ts so the command no longer duplicates the same command error payload in two branches
- flattened control flow by returning early for --list and using one set-mode path guarded by explicit missing-mode validation
- tightened tests/10-agent-mode.test.ts to assert the exact missing-mode error message instead of allowing a daemon-connection fallback

Reasoning:
- this keeps behavior the same while reducing branch duplication and making the validation contract explicit
- the hardened test protects the intended precedence: missing required mode should fail before any daemon interaction

Verification:
- npm run typecheck
- (cd packages/cli && npx tsx tests/10-agent-mode.test.ts)

Notes for next agent:
- repository had a pre-existing local modification in scripts/codex-refactor-loop.sh; I intentionally did not touch or stage it
- no blockers encountered for this refactor
2026-02-14 01:39:01 +07:00
Mohamed Boudra
80f0ca08f9 refactor(cli): centralize daemon errno parsing and add utility tests
What changed:
- extracted shared readNodeErrnoCode helper in local daemon process control code
- updated isProcessRunning and signalProcess to use the shared helper
- added packages/cli/tests/18-local-daemon-utils.test.ts covering resolveTcpHostFromListen cases (numeric, host:port, unix sockets, empty/non-host)

Why:
- removes duplicated low-level error-shape branching and keeps errno handling consistent in one place
- adds deterministic coverage for pure listen parsing logic without depending on daemon runtime state

Accomplishments for next agent:
- this area now has a focused utility test entry that runs fast and is independent of daemon availability
- full workspace typecheck is clean after this change

Challenges / notes for next agent:
- packages/cli/tests/03-daemon.test.ts can be environment-sensitive when a daemon is already running (baseline in this workspace did not reliably represent daemon not running)
- existing unstaged change remains in scripts/codex-refactor-loop.sh and was intentionally left untouched
2026-02-14 01:26:54 +07:00
Mohamed Boudra
cb2e4aacfe feat(cli): add --output-schema flag for structured agent output 2026-02-12 18:04:39 +07:00
Mohamed Boudra
018edef3bb feat: add onboarding command and migrate git diff to checkout API 2026-02-12 17:00:35 +07:00
Mohamed Boudra
fba7c73c8b feat(cli): add agent update command for name and labels 2026-02-12 14:15:33 +07:00
Mohamed Boudra
6053ee7c34 fix(cli): list all non-archived agents by default and drop ls --ui 2026-02-12 14:05:46 +07:00
Mohamed Boudra
f9ebf6b523 Add device pairing command and voice mute toggle
Introduce `paseo daemon pair` CLI command that generates a local pairing offer URL with QR code without requiring a running daemon. Update message input to support mute/unmute toggle during realtime voice sessions with visual feedback (MicOff icon). Fix android:prod build script to use prebuild + assembleRelease flow.
2026-02-07 15:56:14 +07:00
Mohamed Boudra
8d1d7b7603 chore: migrate PASEO_PORT to PASEO_LISTEN across codebase 2026-02-05 14:35:35 +07:00
Mohamed Boudra
a473302a9f refactor: use --json flag alias instead of --format json throughout CLI 2026-02-01 12:33:18 +07:00
Mohamed Boudra
dfda6daeed refactor(cli): rename ps to ls and add top-level agent commands 2026-01-29 10:41:19 +07:00
Mohamed Boudra
7d4636ecff feat(cli): add agent logs command
Add `paseo agent logs <id>` command to view agent activity/timeline.

Features:
- View agent timeline entries (messages, tool calls, errors)
- `-f, --follow` flag for real-time streaming
- `--tail <n>` to limit entries shown
- Proper formatting of different timeline item types
2026-01-28 23:46:13 +07:00
Mohamed Boudra
74fceed9b5 feat(cli): add agent inspect command
Add the `paseo agent inspect <id>` command that shows detailed
information about an agent:

- Id, name, provider, model, status, mode, cwd
- Creation timestamp
- Token usage (input, output, cached, cost)
- Capabilities (streaming, persistence, dynamic modes, MCP servers)
- Available modes
- Pending permissions count
- Parent agent ID

The default output is YAML-like key-value pairs. Use `--format json`
or `--format yaml` for machine-readable output with the full agent
snapshot.

Supports agent ID prefix matching.
2026-01-28 23:41:50 +07:00
Mohamed Boudra
f96a4ee3df feat(cli): add agent mode command
Add the `paseo agent mode` command for changing and listing agent
operational modes. Supports setting a mode or listing available modes
with the --list flag.

Usage:
  paseo agent mode <id> <mode>     # Set mode
  paseo agent mode --list <id>     # List available modes
2026-01-28 23:41:14 +07:00
Mohamed Boudra
d78c7d5e07 chore(cli): rename test files from .mts to .ts 2026-01-28 23:34:22 +07:00
Mohamed Boudra
b040e2fc6d feat(cli): add agent stop command
Implements the `agent stop` command for stopping agents.

Features:
- Stop a specific agent by ID (with prefix matching)
- --all flag to stop all running agents
- --cwd flag to stop all agents in a specific directory
- Cancels running agents before terminating them
- Graceful error handling for partially failed stops

Usage:
  paseo agent stop <id>
  paseo agent stop --all
  paseo agent stop --cwd ~/dev/paseo
2026-01-28 23:26:53 +07:00
Mohamed Boudra
851d5ef247 feat(cli): add agent send command
Implements the `agent send` command for sending messages to existing agents.

Features:
- Send follow-up tasks to running agents
- Support for ID prefix matching (e.g., "a1b2" matches "a1b2c3d4")
- --no-wait flag to return immediately without waiting for completion
- Default behavior waits for agent to become idle

Usage:
  paseo agent send <id> <prompt>
  paseo agent send --no-wait a1b2c3d "Run the linter"
2026-01-28 23:25:45 +07:00
Mohamed Boudra
dd514a4a67 feat(cli): add agent run command
Implements the `paseo agent run` command for creating and running agents:
- Creates agent with initial prompt
- `-d, --detach` flag for background execution
- `--name <name>` to assign a title
- `--provider <provider>` to select claude/codex/opencode
- `--mode <mode>` for provider-specific modes
- `--cwd <path>` for working directory
- Supports all output formats (table, json, yaml, quiet)
- Graceful error handling when daemon not running

Usage:
  paseo agent run "Fix the failing tests"
  paseo agent run -d --name "test-fixer" "Run the test suite"
  paseo agent run --mode bypass "Refactor the auth module"

Phase 4 of CLI implementation (TDD checklist 4.1-4.6)
2026-01-28 23:22:57 +07:00
Mohamed Boudra
59e6ab2bf5 feat(cli): add agent ps command
Implements the `paseo agent ps` command for listing agents:
- Lists running agents by default
- `-a, --all` flag to include archived agents
- `--status <status>` filter by agent status
- `--cwd <path>` filter by working directory
- Supports all output formats (table, json, yaml, quiet)
- Graceful error handling when daemon not running

Output format:
AGENT ID    NAME              PROVIDER  STATUS   CWD                    CREATED
a1b2c3d     🎭 Test fixer     claude    running  ~/dev/paseo            2 minutes ago

Phase 3 of CLI implementation (TDD checklist 3.1-3.5)
2026-01-28 23:13:38 +07:00
Mohamed Boudra
3ed4d4519f test(cli): add daemon command tests
Add tests for daemon commands (Phase 2 from TDD checklist):
- daemon --help shows subcommands
- daemon status fails gracefully when daemon not running
- daemon status --format json outputs JSON
- daemon stop handles daemon not running gracefully
- daemon restart fails when daemon not running

These tests focus on error cases and help output since daemon start
may not be fully implemented yet.
2026-01-28 23:02:45 +07:00
Mohamed Boudra
a7f39f79ba feat(cli): implement output abstraction layer 2026-01-28 22:57:15 +07:00
Mohamed Boudra
6fd4214466 test(cli): add zx TDD infrastructure and phase 1 tests
- Install zx as devDependency for E2E testing
- Create tests/ directory with setup utilities
- Add setup.ts with test context helpers:
  - Random port generation (never 6767)
  - Temp directory creation for PASEO_HOME and workDir
  - Daemon startup/waitForDaemon helper (WebSocket only)
  - Cleanup function
  - paseo() helper to run CLI commands against test daemon
- Add Phase 1 foundation tests (01-foundation.test.mts):
  - Test paseo --version outputs version
  - Test paseo --help shows commands
- Add test runner (run-all.mts) that discovers and runs all tests
- Add test:e2e script to package.json
2026-01-28 22:47:08 +07:00