@ait-co/devtools 0.1.44 → 0.1.45

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/README.en.md CHANGED
@@ -946,13 +946,13 @@ AI coding agents (Claude Code, Cursor, etc.) can observe a running mini-app dire
946
946
 
947
947
  A local browser (env 1) and a phone Toss WebView (env 2/3) both speak CDP, so every tool works identically in both environments — the only difference is the attach strategy (`--target=relay` vs `--target=local`).
948
948
 
949
- | Mode + target | Invocation | Target | Tools |
950
- |---|---|---|---|
951
- | `--mode=debug --target=relay` (default) | `devtools-mcp` | Production bundle on a phone (CDP/Chii relay + cloudflared tunnel, env 2/3) | console/network/page + DOM/snapshot/screenshot + `AIT.*` |
952
- | `--mode=debug --target=local` | `devtools-mcp --target=local` | Local Chromium launched by the MCP server (CDP direct-attach, no relay needed, env 1) | same |
953
- | `--mode=dev` | `devtools-mcp --mode=dev` | Mock state from a running Vite dev server | `AIT.*` (+ `devtools_get_mock_state` alias) |
949
+ | Mode + target | Invocation | Env var | Target | Tools |
950
+ |---|---|---|---|---|
951
+ | `--mode=debug --target=relay` (default) | `MCP_ENV=relay devtools-mcp` | `MCP_ENV=relay` recommended | Dogfood bundle on a phone (CDP/Chii relay + cloudflared tunnel, env 2/3) | console/network/page + DOM/snapshot/screenshot + `AIT.*` |
952
+ | `--mode=debug --target=local` | `devtools-mcp --target=local` | `MCP_ENV=mock` (auto) | Local Chromium launched by the MCP server (CDP direct-attach, no relay needed, env 1) | same |
953
+ | `--mode=dev` | `devtools-mcp --mode=dev` | `MCP_ENV=mock` (auto) | Mock state from a running Vite dev server (AIT.* only, no CDP) | `AIT.*` (+ `devtools_get_mock_state` alias) |
954
954
 
955
- `--target=local` opens `AIT_DEVTOOLS_URL` (default `http://localhost:5173`) and attaches directly to a local Chromium — no relay or tunnel required. `--mode=dev` reads the mock-state HTTP endpoint of the Vite dev server. All three combinations expose the same `AIT.*` tool surface to the agent.
955
+ `--target=local` opens `AIT_DEVTOOLS_URL` (default `http://localhost:5173`) and attaches directly to a local Chromium — no relay or tunnel required. `--mode=dev` reads the mock-state HTTP endpoint of the Vite dev server and does not provide CDP tools. For on-device sessions (env 3/4), setting `MCP_ENV=relay` explicitly ensures the relay tool surface is visible even before the tunnel URL is auto-detected.
956
956
 
957
957
  ### Debug mode (CDP via Chii)
958
958
 
@@ -967,12 +967,17 @@ Running `devtools-mcp` as a stdio server starts a local Chii relay on an OS-assi
967
967
  "mcpServers": {
968
968
  "ait-debug": {
969
969
  "command": "pnpm",
970
- "args": ["exec", "devtools-mcp"]
970
+ "args": ["exec", "devtools-mcp"],
971
+ "env": {
972
+ "MCP_ENV": "relay"
973
+ }
971
974
  }
972
975
  }
973
976
  }
974
977
  ```
975
978
 
979
+ Setting `MCP_ENV=relay` explicitly ensures the relay tool surface is visible before the tunnel URL is auto-detected.
980
+
976
981
  | Tool | CDP / AIT backing | Description |
977
982
  |---|---|---|
978
983
  | `list_console_messages` | `Runtime.consoleAPICalled` | Recent console.log/warn/error messages (level, text, timestamp, args) |
package/README.md CHANGED
@@ -951,6 +951,24 @@ Turbopack은 unplugin을 지원하지 않으므로, `next.config.js`에서 `reso
951
951
  import '@ait-co/devtools/panel';
952
952
  ```
953
953
 
954
+ ### `devtools-mcp` — 이미 실행 중인 세션이 있을 때
955
+
956
+ 두 번째 `devtools-mcp` 실행 시 "기존 debug-mode 세션이 이미 실행 중" 메시지가 stderr에 출력됩니다. 기존 PID와 wssUrl이 함께 표시됩니다.
957
+
958
+ 회복 방법:
959
+
960
+ ```bash
961
+ # 기존 세션을 직접 종료
962
+ kill <PID>
963
+
964
+ # 또는 --force 플래그로 기존 세션을 종료하고 takeover
965
+ npx @ait-co/devtools devtools-mcp --force
966
+ # local 모드라면:
967
+ npx @ait-co/devtools devtools-mcp --target=local --force
968
+ ```
969
+
970
+ `--takeover`도 `--force`의 alias로 동일하게 동작합니다.
971
+
954
972
  ## MCP Server
955
973
 
956
974
  AI 코딩 에이전트(Claude Code, Cursor 등)가 [MCP(Model Context Protocol)](https://modelcontextprotocol.io/)를
@@ -958,13 +976,13 @@ AI 코딩 에이전트(Claude Code, Cursor 등)가 [MCP(Model Context Protocol)]
958
976
 
959
977
  로컬 브라우저(환경 1)와 폰 토스 앱 WebView(환경 2·3)는 둘 다 CDP를 말하므로 모든 tool이 두 환경에서 동일하게 동작합니다 — 갈라지는 건 attach 전략(`--target=relay` vs `--target=local`)뿐입니다.
960
978
 
961
- | 모드 + 타깃 | 호출 | 대상 | tool |
962
- |---|---|---|---|
963
- | `--mode=debug --target=relay` (기본값) | `devtools-mcp` | 폰 안 production 번들 (CDP/Chii relay + cloudflared 터널, 환경 2·3) | console/network/page + DOM/snapshot/screenshot + `AIT.*` |
964
- | `--mode=debug --target=local` | `devtools-mcp --target=local` | MCP가 직접 기동한 로컬 Chromium (CDP direct-attach, relay 불필요, 환경 1) | 동일 |
965
- | `--mode=dev` | `devtools-mcp --mode=dev` | 실행 중인 Vite dev server의 mock state | `AIT.*` (+ `devtools_get_mock_state` alias) |
979
+ | 모드 + 타깃 | 호출 | 환경 변수 | 대상 | tool |
980
+ |---|---|---|---|---|
981
+ | `--mode=debug --target=relay` (기본값) | `MCP_ENV=relay devtools-mcp` | `MCP_ENV=relay` 권장 | 폰 안 dogfood 번들 (CDP/Chii relay + cloudflared 터널, 환경 2·3) | console/network/page + DOM/snapshot/screenshot + `AIT.*` |
982
+ | `--mode=debug --target=local` | `devtools-mcp --target=local` | `MCP_ENV=mock` (자동) | MCP가 직접 기동한 로컬 Chromium (CDP direct-attach, relay 불필요, 환경 1) | 동일 |
983
+ | `--mode=dev` | `devtools-mcp --mode=dev` | `MCP_ENV=mock` (자동) | 실행 중인 Vite dev server의 mock state (AIT.* 전용, CDP 없음) | `AIT.*` (+ `devtools_get_mock_state` alias) |
966
984
 
967
- `--target=local`은 `AIT_DEVTOOLS_URL`(기본 `http://localhost:5173`)을 열고 로컬 Chromium에 CDP direct-attach합니다 — relay나 터널이 필요하지 않습니다. `--mode=dev`는 Vite dev server의 mock-state HTTP endpoint를 읽습니다. 조합 모두 에이전트에게 동일한 `AIT.*` tool surface를 노출합니다.
985
+ `--target=local`은 `AIT_DEVTOOLS_URL`(기본 `http://localhost:5173`)을 열고 로컬 Chromium에 CDP direct-attach합니다 — relay나 터널이 필요하지 않습니다. `--mode=dev`는 Vite dev server의 mock-state HTTP endpoint를 읽으며 CDP tool은 제공하지 않습니다. 실기기(환경 3·4) 진입 시 `MCP_ENV=relay`를 명시하면 터널 감지 전 bootstrap 단계에서도 relay tool 올바르게 노출됩니다.
968
986
 
969
987
  ### Debug 모드 (CDP via Chii)
970
988
 
@@ -987,12 +1005,17 @@ tunnel로 공개 `wss://*.trycloudflare.com` URL을 발급한 뒤 QR을 터미
987
1005
  "mcpServers": {
988
1006
  "ait-debug": {
989
1007
  "command": "pnpm",
990
- "args": ["exec", "devtools-mcp"]
1008
+ "args": ["exec", "devtools-mcp"],
1009
+ "env": {
1010
+ "MCP_ENV": "relay"
1011
+ }
991
1012
  }
992
1013
  }
993
1014
  }
994
1015
  ```
995
1016
 
1017
+ `MCP_ENV=relay`를 명시하면 터널 URL 자동 감지 전에도 relay tool surface가 올바르게 노출됩니다.
1018
+
996
1019
  | Tool | CDP / AIT 백킹 | 설명 |
997
1020
  |---|---|---|
998
1021
  | `list_console_messages` | `Runtime.consoleAPICalled` | 최근 console.log/warn/error 메시지 (level, text, timestamp, args) |
package/dist/mcp/cli.d.ts CHANGED
@@ -21,6 +21,13 @@
21
21
  */
22
22
  type Mode = 'debug' | 'dev';
23
23
  type Target = 'relay' | 'local';
24
+ /**
25
+ * Returns `true` when `--force` or `--takeover` is present in argv.
26
+ *
27
+ * Both flags are accepted as aliases — `--force` is the short form listed in
28
+ * the `--help` output; `--takeover` is a longer synonym.
29
+ */
30
+ declare function parseForce(argv: readonly string[]): boolean;
24
31
  /** Parses `--mode=<value>` / `--mode <value>` from argv; default `debug`. */
25
32
  declare function parseMode(argv: readonly string[]): Mode;
26
33
  /**
@@ -32,5 +39,5 @@ declare function parseMode(argv: readonly string[]): Mode;
32
39
  */
33
40
  declare function parseTarget(argv: readonly string[]): Target;
34
41
  //#endregion
35
- export { parseMode, parseTarget };
42
+ export { parseForce, parseMode, parseTarget };
36
43
  //# sourceMappingURL=cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/mcp/cli.ts"],"mappings":";;;;;;;;AA0BS;;;;;AAIT;;;;;AAyBA;;;KA7BK,IAAA;AAAA,KACA,MAAA;;iBAGW,SAAA,CAAU,IAAA,sBAA0B,IAAA;;;;;;;;iBAyBpC,WAAA,CAAY,IAAA,sBAA0B,MAAA"}
1
+ {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/mcp/cli.ts"],"mappings":";;;;;;;;AA0BS;;;;;AAST;;;;;AAKA;;;KAdK,IAAA;AAAA,KACA,MAAA;AAsCL;;;;;;AAAA,iBA9BgB,UAAA,CAAW,IAAA;;iBAKX,SAAA,CAAU,IAAA,sBAA0B,IAAA;;;;;;;;iBAyBpC,WAAA,CAAY,IAAA,sBAA0B,MAAA"}