Commit Graph

66 Commits

Author SHA1 Message Date
mcfn 143ba43e8b [packages/cli]fix: send mouseMoved before mousePressed in dispatch_click (#220)
SPA frameworks (React Router, Vue Router, Next.js) require a prior
mouseMoved event to establish pointer hover state before the click
event synthesizes correctly. Without it, the router's click listener
never fires and the URL remains unchanged (url_changed: false).

Add a single mouseMoved dispatch at (x, y) with button=none before
the existing mousePressed/mouseReleased loop — matches Playwright's
standard click implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 13:04:30 +08:00
mcfn f6946d12d9 [packages/cli]test: add click_spa_navigation E2E test (#220)
Injects a SPA-style fixture (history.pushState on click with
preventDefault) into about:blank and verifies that browser click
triggers the router handler and returns url_changed=true.

Tests the mouseMoved fix — will fail until dispatch_click sends
mouseMoved before mousePressed in click.rs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 13:03:31 +08:00
mcfn.feng fc8a3300ad [packages/cli]fix: set-based inflight tracking + stale eviction for network-idle
Replace simple i64 counter with HashMap<requestId, Instant> per session
(Playwright-style set tracking). Requests whose loadingFinished fires on
a different CDP session (cross-origin iframes) are automatically evicted
after 3 seconds, preventing permanent counter inflation.

Key changes:
- TabNetPending: HashMap<String, i64> → HashMap<String, HashMap<String, Instant>>
- network_pending() evicts entries older than 3s before counting
- Exclude WebSocket, EventSource, favicon, data: from tracking
- Redirect requests don't double-count (requestId reuse)
- Comprehensive unit test for skip/undercount scenarios

Results:
- flightaware.com: 30s timeout → 4s (was stuck on WebSocket)
- costcotravel.com: 30s timeout → 2.6s
- healthline.com: still times out (needs per-frame tracking — follow-up)

TODO: Implement Playwright-style per-frame idle tracking to handle
sites with heavy cross-origin iframe tracking (Facebook pixel, etc.)
2026-04-02 12:52:47 +08:00
mcfn.feng df258b8194 [packages/cli]fix: track skipped requestIds to prevent undercount + handle redirects
Address Codex bot P1 review finding: skipping favicon/data: URLs on
requestWillBeSent without also skipping their loadingFinished would
undercount active requests, causing premature network-idle.

Changes:
- Maintain `skipped_request_ids` HashSet to track suppressed requests
- loadingFinished/loadingFailed checks the set and suppresses delta
- Add EventSource exclusion (persistent like WebSocket)
- Handle redirect double-counting (redirectResponse → don't re-increment)
- Add comprehensive unit test covering all skip/undercount scenarios
2026-04-02 12:21:32 +08:00
mcfn.feng a7a61d7e4d [packages/cli]fix: exclude WebSocket/favicon/data: from network-idle pending count
WebSocket upgrade requests fire `Network.requestWillBeSent` but never
`Network.loadingFinished`, leaving the pending counter stuck at ≥1
and causing `wait network-idle` to always time out on sites with
persistent WebSocket connections (analytics, real-time features).

Align with Playwright's behaviour by excluding:
- WebSocket upgrades (type == "WebSocket")
- Favicon requests (url ends with /favicon.ico)
- data: URLs (not intercepted by Network Service)

Before: healthline.com 30s timeout, flightaware.com ~25s
After:  healthline.com 523ms, flightaware.com 514ms
2026-04-02 11:58:46 +08:00
mcfn.feng 5e7a636721 [feat] update version. 2026-04-02 02:53:23 +08:00
mcfn.feng 7a6a240715 [packages/cli]chore: relocate api and commands modules from cli-v2 to cli
Move new files added in upstream release/1.0.0 from the old
packages/cli-v2/ path to packages/cli/ after merge.
2026-04-02 02:21:04 +08:00
mcfn.feng 4d4a437a40 Merge remote-tracking branch 'origin/release/1.0.0' into feat/update-repo 2026-04-02 02:20:01 +08:00
mcfn.feng ebd0f6f416 [doc] remove useless doc. 2026-04-02 01:14:35 +08:00
mcfn.feng 22fd6b2ebc [root]docs: update actionbook-rs references in dify-plugin and cli docs
Fix P1 from review: dify-plugin comments referenced deleted
actionbook-rs paths. Also remove "v2" from IFRAME_DESIGN.md.
2026-04-02 00:55:21 +08:00
mcfn.feng 58545129de [root]refactor: remove actionbook-rs, promote cli-v2 to packages/cli
- Delete packages/actionbook-rs/ (legacy 0.x CLI)
- Delete old packages/cli/ (JS npm wrapper for 0.x)
- Rename packages/cli-v2/ → packages/cli/ (git mv)
- Merge npm wrapper files (bin/actionbook.js, scripts/postinstall.js) into new cli/
- Update package.json: name → @actionbookdev/cli, private → false, add npm distribution fields
- Update sync-versions.js: point Cargo.toml/Cargo.lock sync at packages/cli/
- Update release.yml: build from packages/cli/ instead of packages/actionbook-rs/
- Update test.yml: paths and working-directory from cli-v2 → cli
- Update CLAUDE.md, CONTRIBUTING.md, docs, issue templates
- Delete stale changeset (fix-screenshot-timeout.md)
- Keep 6 platform binary packages unchanged
2026-04-02 00:46:12 +08:00
github-actions[bot] 5861678cf5 chore: version packages (#245)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-21 19:40:19 +08:00
github-actions[bot] 3a70f09344 chore: version packages (#243)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-21 16:02:10 +08:00
github-actions[bot] e0591a6d63 chore: version packages (#239)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 03:24:42 +08:00
github-actions[bot] a07e698083 chore: version packages (#236)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 02:53:21 +08:00
github-actions[bot] 40b965b782 chore: version packages (#233)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 00:32:56 +08:00
github-actions[bot] ed6ef7dac8 chore: version packages 2026-03-19 11:49:09 +00:00
Adcent dbc26047a9 chore: version packages 2026-03-19 15:42:29 +08:00
github-actions[bot] 1ca43bc593 chore: version packages 2026-03-17 09:43:21 +00:00
github-actions[bot] e412976ade chore: version packages (#198)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-12 22:19:01 +08:00
github-actions[bot] a8c40f628b chore: version packages 2026-03-11 13:54:38 +00:00
github-actions[bot] a2b21ca129 chore: version packages 2026-03-09 05:28:54 +00:00
Junliang Feng 115233d7f8 docs: migrate install guides to brew/script-first (CUE-504) (#184)
* docs: migrate install guides to brew/script-first, keep npm (CUE-504)

* docs: keep README install simple (npm only), link to full guide

* docs: use script install in README (no Node.js dependency)

* docs: split Installation into sub-headings per platform
2026-03-04 06:06:02 +08:00
Junliang Feng 15fda06727 chore(release): bump CLI version to 0.8.4 (#183) 2026-03-03 22:16:03 +08:00
github-actions[bot] 7298d2f994 chore: version packages 2026-03-02 16:51:07 +00:00
adcentury aea805b320 [root]fix: sync CLI Rust version and bump to v0.8.2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 18:44:33 +08:00
github-actions[bot] 47deeb0650 chore: version packages 2026-02-28 04:46:40 +00:00
github-actions[bot] 5fda9fc3bf chore: version packages 2026-02-27 09:34:57 +00:00
s1mba 893315f4aa [CLI]tests: Improve CLI E2E test coverage (TypeScript 93% + Rust 123 tests) (#167)
* [packages/cli]test: improve CLI E2E test coverage to 93%

Add 56 new test cases covering previously untested commands, subcommands,
and parameter combinations. New test files for setup, extension, help,
and global options. Enhanced existing browser, config, search, and get
tests with parameter-level coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [packages/cli]test: add real assertions to browser E2E tests

Replace exit-code-only checks with actual value assertions:
- scroll tests verify window.scrollY changes before/after
- select/focus verify element value and activeElement
- type verifies input field value contains typed text
- cookies delete/clear verify cookie is actually removed
- navigate goto verifies location.href
- inspect verifies output contains element info
Move restart/close tests to end to prevent cascade failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [packages/actionbook-rs]test: expand Rust CLI integration tests to match TypeScript E2E coverage

Add ~70 new tests bringing total to 123, covering all CLI commands and options:
help, browser (57 tests), config, profile, extension, setup, search, get,
sources, and global flags. Mirrors the TypeScript E2E test suite structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [packages/cli]fix: relax assertions for offline/extension-mode-only tests

- extension install: accept exit code 0 or 1 (network failures in CI)
- cookies set --domain: tolerate graceful failure outside extension mode

Addresses PR #167 review feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [packages/actionbook-rs]test: add browser E2E tests mirroring TypeScript cli-browser-e2e.test.ts

57 individual #[test] functions covering navigation, page content, form
interaction, screenshot/pdf, cookies, scroll, type, select/hover/focus/press,
inspect, tab management, and restart/close. Shares browser session via OnceLock,
gated by RUN_BROWSER_TESTS=true, runs with --test-threads=1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [packages/cli]fix: address PR #167 review comments from Codex

- cli_test.rs: fail setup tests explicitly when process is killed by
  signal (timeout) instead of silently passing
- cli_test.rs: isolate extension stop test with temp HOME/XDG dirs to
  avoid killing real user bridge processes
- cli-browser-e2e.test.ts: clarify that cookie --dry-run/--domain
  tests require extension mode and rename describe block

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 17:17:51 +08:00
github-actions[bot] e7b0d1e01a chore: version packages (#160)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-24 11:56:17 +08:00
github-actions[bot] 998c60cc35 chore: version packages 2026-02-23 07:17:41 +00:00
github-actions[bot] b64fd33dc9 chore: version packages (#139)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-14 01:43:57 +08:00
s1mba fef4152fb7 fix: add CHANGELOG.md to platform packages (#137)
* [root]chore: add changeset for CLI patch to test release workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [root]fix: align CLI and platform package versions to npm (0.7.2)

Local versions were 0.3.1 while npm had 0.7.2 (CI used to overwrite
versions at publish time without committing back). Align to 0.7.2 so
changeset can manage versions going forward.

Also revert pnpm-workspace.yaml to keep platform packages in workspace
(avoids npm resolution failures) and let them pass changeset validation
by not being in the ignore list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [root]fix: add CHANGELOG.md to platform packages for changesets/action

changesets/action reads CHANGELOG.md of all modified packages when
composing the Version PR. Platform packages are modified by
sync-versions.js but lacked CHANGELOG.md files, causing ENOENT.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [root]fix: update lockfile after sync-versions to prevent frozen-lockfile failure

sync-versions.js rewrites CLI optionalDependencies versions, making
the lockfile stale. Add pnpm install after sync to keep it in sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [root]fix: use workspace:* for CLI platform deps to avoid lockfile staleness

- CLI optionalDependencies changed from exact versions to workspace:*
  so pnpm resolves locally instead of from npm registry
- Remove optionalDependencies sync from sync-versions.js (no longer needed)
- Add workspace:* → actual version replacement step in publish-cli job
  before npm publish
- Remove pnpm install from version-packages (lockfile stays stable with
  workspace links)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:35:28 +08:00
s1mba e011dfae5e fix: align CLI versions to npm and fix changeset config (#136)
* [root]chore: add changeset for CLI patch to test release workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [root]fix: align CLI and platform package versions to npm (0.7.2)

Local versions were 0.3.1 while npm had 0.7.2 (CI used to overwrite
versions at publish time without committing back). Align to 0.7.2 so
changeset can manage versions going forward.

Also revert pnpm-workspace.yaml to keep platform packages in workspace
(avoids npm resolution failures) and let them pass changeset validation
by not being in the ignore list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 19:37:43 +08:00
s1mba 731cc340d8 [packages/cli] Add comprehensive CLI test suite (#128)
* [packages/cli]test: add comprehensive CLI test suite with E2E browser tests

- Add unit tests for wrapper (actionbook.js), postinstall, config, profile,
  search, get, and sources commands
- Add Tier 1 browser tests (arg validation, help output, defaults)
- Add Tier 2 browser E2E tests (navigation, interaction, screenshots,
  cookies, tabs, error handling, JSON output)
- Fix E2E test reliability: add --wait for element readiness after navigation,
  use eval-based form submit for login flow, match actual CLI exit codes
- Suppress macOS Keychain dialogs in tests via --use-mock-keychain config
- Set testTimeout to 60s for browser E2E operations
- Export modules from actionbook.js and postinstall.js for testability

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [packages/cli]fix: resolve Windows .exe suffix when locating test CLI binary

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [packages/cli]fix: skip shell-script mock tests on Windows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:36:15 +08:00
Adcent ad2d621b3f fix(cli): move config file to ~/.actionbook 2026-02-11 11:23:53 +08:00
Adcent 125d703407 Remove legacy actionbook-rs npm packaging assets 2026-02-06 21:20:17 +08:00
Adcent 86170e3132 Address PR feedback on package resolution and workflow paths 2026-02-06 21:11:11 +08:00
Adcent f5ae0ea7ed Split CLI distribution into platform-specific npm packages 2026-02-06 21:05:30 +08:00
Adcent 07242f14e7 fix(cli): show npm package version for --version 2026-02-06 20:03:31 +08:00
4bmis 3a719a3666 [packages/cli]refactor: simplify postinstall to only fix permissions
Remove GitHub Releases download fallback from postinstall script.
The binary is always bundled in the npm package, so download logic is unnecessary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 13:45:43 +08:00
4bmis 4715896e2e [packages/cli]refactor: replace TypeScript CLI with Rust binary wrapper
Replace the TypeScript CLI implementation with a thin JS wrapper that
executes the native Rust binary. The npm package now ships all platform
binaries directly, with a postinstall fallback to download from GitHub
Releases if needed.

- Add bin/actionbook.js: platform detection + binary execution
- Add scripts/postinstall.js: fallback download from GitHub Releases
- Remove all TypeScript source, build config, and dependencies
- Update CI workflow to build, package, and publish with binaries
- Update README with full Rust CLI command documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 12:44:19 +08:00
4bmis 1b6fdad69c [packages/cli]release: v0.3.0 2026-02-04 17:13:10 +08:00
4bmis bb4ae30281 [packages/*]feat: migrate to new text-based API
- Replace old JSON API with new text-based API using area_id format
- Add get_action_by_area_id tool to MCP server
- Update search_actions with new parameters (domain, url, page, page_size)
- Remove --json option from CLI commands (output is now plain text)
- Disable sources command temporarily in CLI
- Update README documentation for CLI and MCP

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:29:38 +08:00
junliang.feng 6e12801e59 [packages/cli]chore: bump version to 0.2.3 2026-01-28 17:03:45 +08:00
junliang.feng e3d2ebc7bb [packages/cli]chore: bump version to 0.2.3-alpha 2026-01-28 16:53:58 +08:00
junliang.feng 666a75150d [packages/cli]chore: bump version to 0.2.3 2026-01-28 16:48:12 +08:00
junliang.feng 18e9e6732d [packages/cli]refactor: use direct playwright-core CLI instead of npx for browser installation
Replace npx playwright@{version} with direct node execution of playwright-core CLI.
Find CLI path by checking multiple node_modules structures (pnpm .pnpm/*, npm flat, npm nested).
Search both package dir and workspace root to support pnpm workspaces.

Benefits:
- Eliminates npx overhead and potential version mismatches
- Works reliably with both npm and pnpm package managers
- No need to parse agent-browser's
2026-01-28 16:40:50 +08:00
junliang.feng fe0ae37c72 [packages/cli]chore: bump version to 0.2.2 2026-01-28 16:18:55 +08:00
junliang.feng 5befdfbe01 [packages/cli]feat: forward help to agent-browser for complete documentation
Remove custom help text and disable Commander.js help option.
Now 'actionbook browser -h' displays full agent-browser help with all
commands, options, and examples instead of minimal Commander help.

Benefits:
- Users see complete command reference without extra steps
- Automatically stays up-to-date with agent-browser changes
- Consistent help across -h, --help, and no-args invocations
2026-01-28 16:01:06 +08:00