Feat/add page url - #430
Conversation
Allows commands (tab/window/popup/sidePanel/pageAction) to embed the current page URL in their searchUrl via a %pageUrl token, alongside the existing %s selection-text placeholder. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Previously injected via OptionSettings as an immutable, always-present menu item. Move it into defaultSettings.ts so it behaves like any other user command (editable openMode, deletable, etc.), and add a settings migration so existing users receive it too, not just fresh installs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
コードレビュー: #430 Feat/add page url現在選択中のページURL( 🔴 重要な指摘1. バックグラウンド(Service Worker)経由の実行パスで
2.
3.
🟡 確認したい点4. デフォルトコマンド「Search Commands on Hub」の
🟢 軽微な指摘5. 変数名の衝突による可読性の低下
6.
✅ 良い点
このレビューはPRの差分とリポジトリの現在のコードを確認した上でClaudeが作成しました。 |
…xecution path location.href inside action modules (tab/popup/window/backgroundTab/pageAction/aiPrompt) resolved to the service worker's own URL, not the visited page, when invoked via the shortcut-key fallback path in background_script.ts. Thread pageUrl explicitly through ExecuteCommandParams instead: content script callers supply location.href, and the background fallback supplies the already-queried tab.url. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… guards
Previously only aiPrompt checked for selectedText/clipboard placeholders,
so search commands with a fixed URL were incorrectly flagged in SidePanel
mode, and pageAction steps using {{SelectedText}} were never flagged even
though selection can't be substituted by the clipboard fallback.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e selection showNoSel was based solely on !isTextSelectionOnly, so commands that don't reference selected text or clipboard at all (e.g. a fixed searchUrl with no %s) still showed the dropdown, even though the setting has no effect on them. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…and showNoSel logic isTextSelectionOnly now delegates its clipboard/selectedText placeholder detection to willUseClipboard, and gates the pageAction branch on PAGE_ACTION_OPEN_MODE.CURRENT_TAB. The no-selection-behavior field visibility now uses a dedicated referencesSelection helper that checks for the selectedText placeholder specifically. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #430 +/- ##
==========================================
+ Coverage 29.93% 30.11% +0.17%
==========================================
Files 322 322
Lines 33274 33435 +161
Branches 1943 1955 +12
==========================================
+ Hits 9962 10070 +108
- Misses 23312 23365 +53 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
レビュー結果
1.
|
…n-extension build contexts yarn build:e2e runs generate-e2e-urls.ts via vite-node, which imports defaultSettings.ts outside a Chrome extension runtime, causing ReferenceError: chrome is not defined when constructing the "Search Commands on Hub" default command. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…dePanel action - action/background.ts: execute() destructured params without pageUrl and never forwarded it to executeAction, so commands run via the background-direct fallback (e.g. chrome:// tabs) always got an empty pageUrl, defeating %pageUrl/srcUrl interpolation. - action/sidePanel.ts: accept pageUrl like every other action instead of reading location.href directly, for consistency and to avoid the same class of bug if SidePanel is ever invoked from a background context. - ShortcutList.tsx: deduplicate willUseClipboard/referencesSelection into a shared referencesPlaceholder helper parameterized by the placeholder predicate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Test comment from review tool - checking gh pr comment with stdin |
|
レビュー概要 このPRは「Hub上でコマンドを検索する」デフォルトコマンドを追加し、そのための 以下、気になった点を挙げます。 潜在的な不具合
テストカバレッジ
軽微な指摘(Nits)
良い点
以上、大きな設計上の問題は見当たりませんでした。上記の |
… assertions migrate1_1_0 (settings.ts) backfills the "Search Commands on Hub" default command into any imported settings older than v1.1.0, so post-import command counts in e2e fixtures are off by one. Update OptionsPage's import-wait to expect the extra command when absent from the fixture, fix the hardcoded 100+-commands count, and correct an inconsistent openMode in the link-preview fixture. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
レビュー概要「Search Commands on Hub」のデフォルトコマンド追加(#429対応)と、それに伴う 👍 良い点
🔍 気になる点・提案
セキュリティ・パフォーマンス
総評設計意図が一貫しており、テストカバレッジも良好です。上記の指摘は軽微なものが中心なので、必須のブロッカーではなく、余裕があれば対応をご検討いただければと思います。 |
page.waitForLoadState("domcontentloaded") resolves immediately when the
page is already in that state, so it silently failed to wait for the
reload triggered by import — the test could close the options page
before Settings.set() finished writing, leaving stale/default data in
storage. This was the actual cause of the E2E-81 (linkCommand reverting
to defaults) and E2E-26 (folder-resolution crash) failures, not the
migrate1_1_0 backfill or SettingForm's autosave. Wait for a genuine
"framenavigated" event instead.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The data-id selector matched both the download and star buttons on the live Hub page, and the trailing toBeVisible() assertion was missing its await, so it raced against the async install-status re-render and intermittently failed with "Received: undefined". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…t page URL Covers COMMAND_SEARCH_ID end-to-end: navigating to a real page, clicking the "Search Commands on Hub" menu item opens selection-command.com/ja with the visited page's URL as the q param, and that the results include multiple Hub commands (Google, Google Image) rather than just a single match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
レビュー概要 「Search Commands on Hub」デフォルトコマンドの追加と、選択テキストだけでなく現在のページURL(%pageUrl)をコマンドの検索URL/プロンプトに渡せるようにする機能追加です。ExecuteCommandParams/UrlParamへのpageUrlの伝播、toUrl()での%pageUrl置換、設定マイグレーション(migrate1_1_0)、多言語のデフォルトコマンド定義、e2eテストまで一貫して実装されており、全体的に丁寧な実装だと感じました。いくつか気になった点を挙げます。 良い点
気になった点
テストカバレッジ
セキュリティ
全体として実装の正確性は高く、既存の潜在バグ(location.hrefのコンテキスト誤り)も副次的に修正されている良いPRだと思います。上記はいずれもブロッカーではなく、次のイテレーションで検討いただければ十分です。 |
CI hit Cloudflare's bot-protection JS challenge on selection-command.com, which appends a "__cf_chl_rt_tk" query param after it passes. Compare origin/pathname/q individually instead of the full URL string, and give the download-btn locator more time to account for the challenge's rendering delay. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
レビュー結果
1. 2. 3. 検索URLの入力欄の説明文(ヘルプテキスト)が その他(軽微) 以上、全体的には堅牢な実装です。上記の指摘は必須の修正というよりは品質向上のための提案としてご検討ください。 |
…duction The command's searchUrl is hardcoded to the production Hub domain (selection-command.com), which triggers Cloudflare's bot-protection challenge in CI and made the test flaky/unreliable there. Import the test settings as an object with the domain patched to NEW_HUB_URL (the staging Hub already used by the other tests in this file) instead of importing a static JSON file, since the file can't reference a test-time constant. OptionsPage.importSettings now accepts either a file path or a settings object to support this. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
コードレビュー: Feat/add-page-url (#430)「Search Commands on Hub」デフォルトコマンドの追加と、 全体的な評価
気になった点
良かった点
セキュリティ
以上、大きな欠陥はなく、上記の指摘は主に保守性・テストカバレッジに関する提案です。 |
close #429