@creatoria/miniapp-mcp 0.1.3 → 0.2.2
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.md +131 -66
- package/dist/app/cli/index.d.ts +6 -0
- package/dist/app/cli/index.d.ts.map +1 -0
- package/dist/app/cli/index.js +6 -0
- package/dist/app/cli/index.js.map +1 -0
- package/dist/app/index.d.ts +6 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +6 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/server/index.d.ts +7 -0
- package/dist/app/server/index.d.ts.map +1 -0
- package/dist/app/server/index.js +6 -0
- package/dist/app/server/index.js.map +1 -0
- package/dist/capabilities/assert/handlers/assert-handlers.d.ts +98 -0
- package/dist/capabilities/assert/handlers/assert-handlers.d.ts.map +1 -0
- package/dist/capabilities/assert/handlers/assert-handlers.js +179 -0
- package/dist/capabilities/assert/handlers/assert-handlers.js.map +1 -0
- package/dist/capabilities/assert/handlers/index.d.ts +7 -0
- package/dist/capabilities/assert/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/assert/handlers/index.js +7 -0
- package/dist/capabilities/assert/handlers/index.js.map +1 -0
- package/dist/capabilities/assert/index.d.ts +15 -0
- package/dist/capabilities/assert/index.d.ts.map +1 -0
- package/dist/capabilities/assert/index.js +90 -0
- package/dist/capabilities/assert/index.js.map +1 -0
- package/dist/capabilities/assert/schemas/index.d.ts +101 -0
- package/dist/capabilities/assert/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/assert/schemas/index.js +62 -0
- package/dist/capabilities/assert/schemas/index.js.map +1 -0
- package/dist/capabilities/automator/handlers/close.d.ts +18 -0
- package/dist/capabilities/automator/handlers/close.d.ts.map +1 -0
- package/dist/capabilities/automator/handlers/close.js +45 -0
- package/dist/capabilities/automator/handlers/close.js.map +1 -0
- package/dist/capabilities/automator/handlers/connect.d.ts +24 -0
- package/dist/capabilities/automator/handlers/connect.d.ts.map +1 -0
- package/dist/capabilities/automator/handlers/connect.js +51 -0
- package/dist/capabilities/automator/handlers/connect.js.map +1 -0
- package/dist/capabilities/automator/handlers/disconnect.d.ts +16 -0
- package/dist/capabilities/automator/handlers/disconnect.d.ts.map +1 -0
- package/dist/capabilities/automator/handlers/disconnect.js +44 -0
- package/dist/capabilities/automator/handlers/disconnect.js.map +1 -0
- package/dist/capabilities/automator/handlers/index.d.ts +8 -0
- package/dist/capabilities/automator/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/automator/handlers/index.js +8 -0
- package/dist/capabilities/automator/handlers/index.js.map +1 -0
- package/dist/capabilities/automator/handlers/launch.d.ts +25 -0
- package/dist/capabilities/automator/handlers/launch.d.ts.map +1 -0
- package/dist/capabilities/automator/handlers/launch.js +61 -0
- package/dist/capabilities/automator/handlers/launch.js.map +1 -0
- package/dist/capabilities/automator/index.d.ts +15 -0
- package/dist/capabilities/automator/index.d.ts.map +1 -0
- package/dist/capabilities/automator/index.js +55 -0
- package/dist/capabilities/automator/index.js.map +1 -0
- package/dist/capabilities/automator/schemas/close.d.ts +5 -0
- package/dist/capabilities/automator/schemas/close.d.ts.map +1 -0
- package/dist/capabilities/automator/schemas/close.js +11 -0
- package/dist/capabilities/automator/schemas/close.js.map +1 -0
- package/dist/capabilities/automator/schemas/connect.d.ts +11 -0
- package/dist/capabilities/automator/schemas/connect.d.ts.map +1 -0
- package/dist/capabilities/automator/schemas/connect.js +19 -0
- package/dist/capabilities/automator/schemas/connect.js.map +1 -0
- package/dist/capabilities/automator/schemas/disconnect.d.ts +5 -0
- package/dist/capabilities/automator/schemas/disconnect.d.ts.map +1 -0
- package/dist/capabilities/automator/schemas/disconnect.js +11 -0
- package/dist/capabilities/automator/schemas/disconnect.js.map +1 -0
- package/dist/capabilities/automator/schemas/index.d.ts +9 -0
- package/dist/capabilities/automator/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/automator/schemas/index.js +14 -0
- package/dist/capabilities/automator/schemas/index.js.map +1 -0
- package/dist/capabilities/automator/schemas/launch.d.ts +17 -0
- package/dist/capabilities/automator/schemas/launch.d.ts.map +1 -0
- package/dist/capabilities/automator/schemas/launch.js +26 -0
- package/dist/capabilities/automator/schemas/launch.js.map +1 -0
- package/dist/capabilities/element/handlers/element-handlers.d.ts +212 -0
- package/dist/capabilities/element/handlers/element-handlers.d.ts.map +1 -0
- package/dist/capabilities/element/handlers/element-handlers.js +383 -0
- package/dist/capabilities/element/handlers/element-handlers.js.map +1 -0
- package/dist/capabilities/element/handlers/index.d.ts +7 -0
- package/dist/capabilities/element/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/element/handlers/index.js +27 -0
- package/dist/capabilities/element/handlers/index.js.map +1 -0
- package/dist/capabilities/element/index.d.ts +20 -0
- package/dist/capabilities/element/index.d.ts.map +1 -0
- package/dist/capabilities/element/index.js +199 -0
- package/dist/capabilities/element/index.js.map +1 -0
- package/dist/capabilities/element/schemas/index.d.ts +325 -0
- package/dist/capabilities/element/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/element/schemas/index.js +168 -0
- package/dist/capabilities/element/schemas/index.js.map +1 -0
- package/dist/capabilities/index.d.ts +34 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +40 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/loader.d.ts +61 -0
- package/dist/capabilities/loader.d.ts.map +1 -0
- package/dist/capabilities/loader.js +164 -0
- package/dist/capabilities/loader.js.map +1 -0
- package/dist/capabilities/miniprogram/handlers/call-wx.d.ts +24 -0
- package/dist/capabilities/miniprogram/handlers/call-wx.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/handlers/call-wx.js +37 -0
- package/dist/capabilities/miniprogram/handlers/call-wx.js.map +1 -0
- package/dist/capabilities/miniprogram/handlers/evaluate.d.ts +32 -0
- package/dist/capabilities/miniprogram/handlers/evaluate.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/handlers/evaluate.js +51 -0
- package/dist/capabilities/miniprogram/handlers/evaluate.js.map +1 -0
- package/dist/capabilities/miniprogram/handlers/index.d.ts +12 -0
- package/dist/capabilities/miniprogram/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/handlers/index.js +12 -0
- package/dist/capabilities/miniprogram/handlers/index.js.map +1 -0
- package/dist/capabilities/miniprogram/handlers/navigate.d.ts +26 -0
- package/dist/capabilities/miniprogram/handlers/navigate.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/handlers/navigate.js +56 -0
- package/dist/capabilities/miniprogram/handlers/navigate.js.map +1 -0
- package/dist/capabilities/miniprogram/handlers/page-stack.d.ts +20 -0
- package/dist/capabilities/miniprogram/handlers/page-stack.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/handlers/page-stack.js +37 -0
- package/dist/capabilities/miniprogram/handlers/page-stack.js.map +1 -0
- package/dist/capabilities/miniprogram/handlers/screenshot.d.ts +33 -0
- package/dist/capabilities/miniprogram/handlers/screenshot.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/handlers/screenshot.js +132 -0
- package/dist/capabilities/miniprogram/handlers/screenshot.js.map +1 -0
- package/dist/capabilities/miniprogram/handlers/system-info.d.ts +17 -0
- package/dist/capabilities/miniprogram/handlers/system-info.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/handlers/system-info.js +31 -0
- package/dist/capabilities/miniprogram/handlers/system-info.js.map +1 -0
- package/dist/capabilities/miniprogram/index.d.ts +15 -0
- package/dist/capabilities/miniprogram/index.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/index.js +69 -0
- package/dist/capabilities/miniprogram/index.js.map +1 -0
- package/dist/capabilities/miniprogram/schemas/call-wx.d.ts +15 -0
- package/dist/capabilities/miniprogram/schemas/call-wx.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/schemas/call-wx.js +11 -0
- package/dist/capabilities/miniprogram/schemas/call-wx.js.map +1 -0
- package/dist/capabilities/miniprogram/schemas/evaluate.d.ts +15 -0
- package/dist/capabilities/miniprogram/schemas/evaluate.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/schemas/evaluate.js +11 -0
- package/dist/capabilities/miniprogram/schemas/evaluate.js.map +1 -0
- package/dist/capabilities/miniprogram/schemas/index.d.ts +10 -0
- package/dist/capabilities/miniprogram/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/schemas/index.js +10 -0
- package/dist/capabilities/miniprogram/schemas/index.js.map +1 -0
- package/dist/capabilities/miniprogram/schemas/navigate.d.ts +18 -0
- package/dist/capabilities/miniprogram/schemas/navigate.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/schemas/navigate.js +22 -0
- package/dist/capabilities/miniprogram/schemas/navigate.js.map +1 -0
- package/dist/capabilities/miniprogram/schemas/page-stack.d.ts +6 -0
- package/dist/capabilities/miniprogram/schemas/page-stack.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/schemas/page-stack.js +6 -0
- package/dist/capabilities/miniprogram/schemas/page-stack.js.map +1 -0
- package/dist/capabilities/miniprogram/schemas/screenshot.d.ts +18 -0
- package/dist/capabilities/miniprogram/schemas/screenshot.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/schemas/screenshot.js +21 -0
- package/dist/capabilities/miniprogram/schemas/screenshot.js.map +1 -0
- package/dist/capabilities/miniprogram/schemas/system-info.d.ts +6 -0
- package/dist/capabilities/miniprogram/schemas/system-info.d.ts.map +1 -0
- package/dist/capabilities/miniprogram/schemas/system-info.js +6 -0
- package/dist/capabilities/miniprogram/schemas/system-info.js.map +1 -0
- package/dist/capabilities/network/handlers/index.d.ts +7 -0
- package/dist/capabilities/network/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/network/handlers/index.js +7 -0
- package/dist/capabilities/network/handlers/index.js.map +1 -0
- package/dist/capabilities/network/handlers/network-handlers.d.ts +53 -0
- package/dist/capabilities/network/handlers/network-handlers.d.ts.map +1 -0
- package/dist/capabilities/network/handlers/network-handlers.js +127 -0
- package/dist/capabilities/network/handlers/network-handlers.js.map +1 -0
- package/dist/capabilities/network/index.d.ts +15 -0
- package/dist/capabilities/network/index.d.ts.map +1 -0
- package/dist/capabilities/network/index.js +69 -0
- package/dist/capabilities/network/index.js.map +1 -0
- package/dist/capabilities/network/schemas/index.d.ts +53 -0
- package/dist/capabilities/network/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/network/schemas/index.js +33 -0
- package/dist/capabilities/network/schemas/index.js.map +1 -0
- package/dist/capabilities/page/handlers/index.d.ts +7 -0
- package/dist/capabilities/page/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/page/handlers/index.js +7 -0
- package/dist/capabilities/page/handlers/index.js.map +1 -0
- package/dist/capabilities/page/handlers/page-handlers.d.ts +165 -0
- package/dist/capabilities/page/handlers/page-handlers.d.ts.map +1 -0
- package/dist/capabilities/page/handlers/page-handlers.js +258 -0
- package/dist/capabilities/page/handlers/page-handlers.js.map +1 -0
- package/dist/capabilities/page/index.d.ts +15 -0
- package/dist/capabilities/page/index.d.ts.map +1 -0
- package/dist/capabilities/page/index.js +83 -0
- package/dist/capabilities/page/index.js.map +1 -0
- package/dist/capabilities/page/schemas/index.d.ts +91 -0
- package/dist/capabilities/page/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/page/schemas/index.js +55 -0
- package/dist/capabilities/page/schemas/index.js.map +1 -0
- package/dist/capabilities/record/handlers/index.d.ts +7 -0
- package/dist/capabilities/record/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/record/handlers/index.js +7 -0
- package/dist/capabilities/record/handlers/index.js.map +1 -0
- package/dist/capabilities/record/handlers/record-handlers.d.ts +76 -0
- package/dist/capabilities/record/handlers/record-handlers.d.ts.map +1 -0
- package/dist/capabilities/record/handlers/record-handlers.js +255 -0
- package/dist/capabilities/record/handlers/record-handlers.js.map +1 -0
- package/dist/capabilities/record/index.d.ts +15 -0
- package/dist/capabilities/record/index.d.ts.map +1 -0
- package/dist/capabilities/record/index.js +69 -0
- package/dist/capabilities/record/index.js.map +1 -0
- package/dist/capabilities/record/schemas/index.d.ts +47 -0
- package/dist/capabilities/record/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/record/schemas/index.js +33 -0
- package/dist/capabilities/record/schemas/index.js.map +1 -0
- package/dist/capabilities/registry.d.ts +138 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +261 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/capabilities/schema-registry.d.ts +4 -0
- package/dist/capabilities/schema-registry.d.ts.map +1 -0
- package/dist/capabilities/schema-registry.js +18 -0
- package/dist/capabilities/schema-registry.js.map +1 -0
- package/dist/capabilities/schema-types.d.ts +22 -0
- package/dist/capabilities/schema-types.d.ts.map +1 -0
- package/dist/capabilities/schema-types.js +2 -0
- package/dist/capabilities/schema-types.js.map +1 -0
- package/dist/capabilities/snapshot/handlers/index.d.ts +7 -0
- package/dist/capabilities/snapshot/handlers/index.d.ts.map +1 -0
- package/dist/capabilities/snapshot/handlers/index.js +7 -0
- package/dist/capabilities/snapshot/handlers/index.js.map +1 -0
- package/dist/capabilities/snapshot/handlers/snapshot-handlers.d.ts +75 -0
- package/dist/capabilities/snapshot/handlers/snapshot-handlers.d.ts.map +1 -0
- package/dist/capabilities/snapshot/handlers/snapshot-handlers.js +201 -0
- package/dist/capabilities/snapshot/handlers/snapshot-handlers.js.map +1 -0
- package/dist/capabilities/snapshot/index.d.ts +15 -0
- package/dist/capabilities/snapshot/index.d.ts.map +1 -0
- package/dist/capabilities/snapshot/index.js +48 -0
- package/dist/capabilities/snapshot/index.js.map +1 -0
- package/dist/capabilities/snapshot/schemas/index.d.ts +47 -0
- package/dist/capabilities/snapshot/schemas/index.d.ts.map +1 -0
- package/dist/capabilities/snapshot/schemas/index.js +28 -0
- package/dist/capabilities/snapshot/schemas/index.js.map +1 -0
- package/dist/config/loader.js +1 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/core/element-ref.d.ts +1 -43
- package/dist/core/element-ref.d.ts.map +1 -1
- package/dist/core/element-ref.js +1 -212
- package/dist/core/element-ref.js.map +1 -1
- package/dist/core/logger.d.ts +1 -54
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +1 -377
- package/dist/core/logger.js.map +1 -1
- package/dist/core/output.d.ts +1 -20
- package/dist/core/output.d.ts.map +1 -1
- package/dist/core/output.js +1 -55
- package/dist/core/output.js.map +1 -1
- package/dist/core/report-generator.d.ts +1 -23
- package/dist/core/report-generator.d.ts.map +1 -1
- package/dist/core/report-generator.js +1 -211
- package/dist/core/report-generator.js.map +1 -1
- package/dist/core/session.d.ts +2 -82
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +2 -305
- package/dist/core/session.js.map +1 -1
- package/dist/core/timeout.d.ts +1 -48
- package/dist/core/timeout.d.ts.map +1 -1
- package/dist/core/timeout.js +1 -66
- package/dist/core/timeout.js.map +1 -1
- package/dist/core/tool-logger.d.ts +1 -82
- package/dist/core/tool-logger.d.ts.map +1 -1
- package/dist/core/tool-logger.js +1 -452
- package/dist/core/tool-logger.js.map +1 -1
- package/dist/core/validation.d.ts +1 -38
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +1 -92
- package/dist/core/validation.js.map +1 -1
- package/dist/runtime/element/element-ref.d.ts +44 -0
- package/dist/runtime/element/element-ref.d.ts.map +1 -0
- package/dist/runtime/element/element-ref.js +214 -0
- package/dist/runtime/element/element-ref.js.map +1 -0
- package/dist/runtime/element/index.d.ts +2 -0
- package/dist/runtime/element/index.d.ts.map +1 -0
- package/dist/runtime/element/index.js +2 -0
- package/dist/runtime/element/index.js.map +1 -0
- package/dist/runtime/index.d.ts +11 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +11 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/logging/index.d.ts +3 -0
- package/dist/runtime/logging/index.d.ts.map +1 -0
- package/dist/runtime/logging/index.js +3 -0
- package/dist/runtime/logging/index.js.map +1 -0
- package/dist/runtime/logging/logger.d.ts +55 -0
- package/dist/runtime/logging/logger.d.ts.map +1 -0
- package/dist/runtime/logging/logger.js +379 -0
- package/dist/runtime/logging/logger.js.map +1 -0
- package/dist/runtime/logging/tool-logger.d.ts +83 -0
- package/dist/runtime/logging/tool-logger.d.ts.map +1 -0
- package/dist/runtime/logging/tool-logger.js +454 -0
- package/dist/runtime/logging/tool-logger.js.map +1 -0
- package/dist/runtime/outputs/index.d.ts +3 -0
- package/dist/runtime/outputs/index.d.ts.map +1 -0
- package/dist/runtime/outputs/index.js +3 -0
- package/dist/runtime/outputs/index.js.map +1 -0
- package/dist/runtime/outputs/output-manager.d.ts +12 -0
- package/dist/runtime/outputs/output-manager.d.ts.map +1 -0
- package/dist/runtime/outputs/output-manager.js +39 -0
- package/dist/runtime/outputs/output-manager.js.map +1 -0
- package/dist/runtime/outputs/report-generator.d.ts +5 -0
- package/dist/runtime/outputs/report-generator.d.ts.map +1 -0
- package/dist/runtime/outputs/report-generator.js +175 -0
- package/dist/runtime/outputs/report-generator.js.map +1 -0
- package/dist/runtime/retry/index.d.ts +5 -0
- package/dist/runtime/retry/index.d.ts.map +1 -0
- package/dist/runtime/retry/index.js +5 -0
- package/dist/runtime/retry/index.js.map +1 -0
- package/dist/runtime/retry/retry.d.ts +61 -0
- package/dist/runtime/retry/retry.d.ts.map +1 -0
- package/dist/runtime/retry/retry.js +90 -0
- package/dist/runtime/retry/retry.js.map +1 -0
- package/dist/runtime/session/index.d.ts +3 -0
- package/dist/runtime/session/index.d.ts.map +1 -0
- package/dist/runtime/session/index.js +3 -0
- package/dist/runtime/session/index.js.map +1 -0
- package/dist/runtime/session/store.d.ts +28 -0
- package/dist/runtime/session/store.d.ts.map +1 -0
- package/dist/runtime/session/store.js +154 -0
- package/dist/runtime/session/store.js.map +1 -0
- package/dist/runtime/session/utils/cleanup.d.ts +3 -0
- package/dist/runtime/session/utils/cleanup.d.ts.map +1 -0
- package/dist/runtime/session/utils/cleanup.js +78 -0
- package/dist/runtime/session/utils/cleanup.js.map +1 -0
- package/dist/runtime/timeout/index.d.ts +2 -0
- package/dist/runtime/timeout/index.d.ts.map +1 -0
- package/dist/runtime/timeout/index.js +2 -0
- package/dist/runtime/timeout/index.js.map +1 -0
- package/dist/runtime/timeout/timeout.d.ts +59 -0
- package/dist/runtime/timeout/timeout.d.ts.map +1 -0
- package/dist/runtime/timeout/timeout.js +77 -0
- package/dist/runtime/timeout/timeout.js.map +1 -0
- package/dist/runtime/validation/index.d.ts +2 -0
- package/dist/runtime/validation/index.d.ts.map +1 -0
- package/dist/runtime/validation/index.js +2 -0
- package/dist/runtime/validation/index.js.map +1 -0
- package/dist/runtime/validation/validation.d.ts +39 -0
- package/dist/runtime/validation/validation.d.ts.map +1 -0
- package/dist/runtime/validation/validation.js +93 -0
- package/dist/runtime/validation/validation.js.map +1 -0
- package/dist/schemas/automator/miniprogram_close.json +12 -0
- package/dist/schemas/automator/miniprogram_connect.json +19 -0
- package/dist/schemas/automator/miniprogram_disconnect.json +12 -0
- package/dist/schemas/automator/miniprogram_launch.json +30 -0
- package/dist/server.js +5 -5
- package/dist/server.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +8 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/miniprogram.d.ts +11 -2
- package/dist/tools/miniprogram.d.ts.map +1 -1
- package/dist/tools/miniprogram.js +111 -41
- package/dist/tools/miniprogram.js.map +1 -1
- package/dist/tools/page.js +2 -2
- package/dist/tools/page.js.map +1 -1
- package/docs/current/01-architecture-migration.md +337 -0
- package/docs/current/02-screenshot-timeout-fix.md +589 -0
- package/docs/current/README.md +226 -0
- package/docs/directory-structure-and-code-style-best-practices.md +91 -0
- package/docs/migration/README.md +34 -0
- package/docs/migration/TC-ALIGN-01-notes.md +35 -0
- package/docs/migration/runtime-skeleton.md +50 -0
- package/docs/migration/tool-schema-strategy.md +75 -0
- package/docs//345/256/214/346/225/264/345/256/236/347/216/260/346/226/271/346/241/210.md +14 -14
- package/docs//347/254/254/344/270/200/347/211/210/346/234/254/346/226/271/346/241/210.md +7 -7
- package/package.json +4 -2
- package/docs/SIMPLE_USAGE.md +0 -210
- package/docs/architecture.E-Docs.md +0 -1359
- package/docs/architecture.F1.md +0 -720
- package/docs/architecture.F2.md +0 -871
- package/docs/architecture.F3.md +0 -905
- package/docs/architecture.md +0 -90
- package/docs/charter.A1.align.yaml +0 -170
- package/docs/charter.A2.align.yaml +0 -199
- package/docs/charter.A3.align.yaml +0 -242
- package/docs/charter.A4.align.yaml +0 -227
- package/docs/charter.B1.align.yaml +0 -179
- package/docs/charter.B2.align.yaml +0 -200
- package/docs/charter.B3.align.yaml +0 -200
- package/docs/charter.B4.align.yaml +0 -188
- package/docs/charter.C1.align.yaml +0 -190
- package/docs/charter.C2.align.yaml +0 -202
- package/docs/charter.C3.align.yaml +0 -211
- package/docs/charter.C4.align.yaml +0 -263
- package/docs/charter.C5.align.yaml +0 -220
- package/docs/charter.D1.align.yaml +0 -190
- package/docs/charter.D2.align.yaml +0 -234
- package/docs/charter.D3.align.yaml +0 -206
- package/docs/charter.E-Docs.align.yaml +0 -294
- package/docs/charter.F1.align.yaml +0 -193
- package/docs/charter.F2.align.yaml +0 -248
- package/docs/charter.F3.align.yaml +0 -287
- package/docs/charter.G.align.yaml +0 -174
- package/docs/charter.align.yaml +0 -111
- package/docs/maintenance.md +0 -682
- package/docs/playwright-mcp/350/260/203/347/240/224.md +0 -53
- package/docs/setup-guide.md +0 -775
- package/docs/tasks.A1.atomize.md +0 -296
- package/docs/tasks.A2.atomize.md +0 -408
- package/docs/tasks.A3.atomize.md +0 -564
- package/docs/tasks.A4.atomize.md +0 -496
- package/docs/tasks.B1.atomize.md +0 -352
- package/docs/tasks.B2.atomize.md +0 -561
- package/docs/tasks.B3.atomize.md +0 -508
- package/docs/tasks.B4.atomize.md +0 -504
- package/docs/tasks.C1.atomize.md +0 -540
- package/docs/tasks.C2.atomize.md +0 -665
- package/docs/tasks.C3.atomize.md +0 -745
- package/docs/tasks.C4.atomize.md +0 -908
- package/docs/tasks.C5.atomize.md +0 -755
- package/docs/tasks.D1.atomize.md +0 -547
- package/docs/tasks.D2.atomize.md +0 -619
- package/docs/tasks.D3.atomize.md +0 -790
- package/docs/tasks.E-Docs.atomize.md +0 -1204
- package/docs/tasks.atomize.md +0 -189
package/docs/architecture.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# System Architecture - creatoria-miniapp-mcp
|
|
2
|
-
|
|
3
|
-
> 🏗️ **Purpose**: Enable AI assistants to orchestrate WeChat Mini Program testing through a Model Context Protocol (MCP) server
|
|
4
|
-
|
|
5
|
-
This document describes the high-level architecture, core components, design decisions, and data flows of the `creatoria-miniapp-mcp` project.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## System Overview
|
|
10
|
-
|
|
11
|
-
### High-Level Architecture
|
|
12
|
-
|
|
13
|
-
**Architecture Flow**:
|
|
14
|
-
```
|
|
15
|
-
AI Assistant (Claude) → MCP Client → stdio → MCP Server (this project)
|
|
16
|
-
→ miniprogram-automator SDK → WeChat DevTools (port 9420)
|
|
17
|
-
→ Mini Program Instance
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
**Key Characteristics**:
|
|
21
|
-
- Protocol: Model Context Protocol (MCP) 1.0 via stdio
|
|
22
|
-
- Language: TypeScript (ESNext + ESM)
|
|
23
|
-
- Tools: 65 tools across 8 categories
|
|
24
|
-
- Sessions: Multi-session isolation, 30-min auto-cleanup
|
|
25
|
-
- Backend: WeChat official `miniprogram-automator` v0.12.1
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Core Components
|
|
30
|
-
|
|
31
|
-
### 1. MCP Server Layer
|
|
32
|
-
**Files**: `src/server.ts`, `src/cli.ts`
|
|
33
|
-
|
|
34
|
-
Handles MCP protocol communication, tool registration, and lifecycle management.
|
|
35
|
-
|
|
36
|
-
### 2. Session Management
|
|
37
|
-
**File**: `src/core/session.ts`
|
|
38
|
-
|
|
39
|
-
Multi-session isolation with automatic cleanup. Each session maintains:
|
|
40
|
-
- Automator/MiniProgram handles
|
|
41
|
-
- Element cache (refId → Element)
|
|
42
|
-
- Output directory
|
|
43
|
-
- Activity timestamp
|
|
44
|
-
|
|
45
|
-
### 3. Element Resolution
|
|
46
|
-
**File**: `src/core/element-ref.ts`
|
|
47
|
-
|
|
48
|
-
Unified element location supporting refId, selector, xpath, with caching and invalidation.
|
|
49
|
-
|
|
50
|
-
### 4. Tool Layer
|
|
51
|
-
**Files**: `src/tools/*.ts`
|
|
52
|
-
|
|
53
|
-
65 tools across 8 categories with Zod validation and modular capabilities loading.
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Design Decisions
|
|
58
|
-
|
|
59
|
-
### ADR-001: stdio Transport Only
|
|
60
|
-
- **Why**: Simplicity, security, MCP client compatibility
|
|
61
|
-
- **Trade-off**: No remote access (acceptable for local testing)
|
|
62
|
-
|
|
63
|
-
### ADR-002: Session-Based State
|
|
64
|
-
- **Why**: Isolation, resource management, concurrent workflows
|
|
65
|
-
- **Trade-off**: 30-min timeout (configurable)
|
|
66
|
-
|
|
67
|
-
### ADR-003: ElementRef Protocol
|
|
68
|
-
- **Why**: Unified API, performance caching, LLM ergonomics
|
|
69
|
-
- **Trade-off**: Cache invalidation on page change
|
|
70
|
-
|
|
71
|
-
### ADR-004: Capabilities System
|
|
72
|
-
- **Why**: Modular loading, smaller tool lists, extensibility
|
|
73
|
-
- **Trade-off**: Requires documentation
|
|
74
|
-
|
|
75
|
-
### ADR-005: Zod Validation
|
|
76
|
-
- **Why**: Runtime safety, clear errors, type inference
|
|
77
|
-
- **Trade-off**: Slight overhead (negligible)
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Extension Points
|
|
82
|
-
|
|
83
|
-
1. **New Tools**: Add to `src/tools/`, register in `index.ts`
|
|
84
|
-
2. **Custom Transports**: HTTP/WebSocket support (future)
|
|
85
|
-
3. **Session Storage**: Redis/database backends (future)
|
|
86
|
-
4. **Output Backends**: S3/cloud storage (future)
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
**Version**: 1.0 | **Updated**: 2025-10-02 | **Status**: Complete (E1.3)
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# Charter: A1 - 环境与基础设施准备
|
|
2
|
-
# Task ID: TASK-2025-001-A1
|
|
3
|
-
# Stage: Align (对齐阶段)
|
|
4
|
-
# Status: RETROSPECTIVE (追溯补齐)
|
|
5
|
-
# Created: 2025-10-02 (追溯)
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Goal (目标)
|
|
10
|
-
|
|
11
|
-
建立完整的微信小程序 MCP 自动化开发环境,确保团队成员能够快速配置并验证环境的可用性,为后续 MCP Server 开发提供稳定的基础设施。
|
|
12
|
-
|
|
13
|
-
## Background (背景)
|
|
14
|
-
|
|
15
|
-
本项目旨在为微信小程序自动化测试提供 MCP (Model Context Protocol) 服务器实现,基于 `miniprogram-automator` SDK。A1 作为项目的第一个任务,需要确保所有开发人员能够:
|
|
16
|
-
|
|
17
|
-
1. 安装并配置正确版本的 Node.js 运行时
|
|
18
|
-
2. 使用统一的包管理器(pnpm)管理依赖
|
|
19
|
-
3. 安装并配置微信开发者工具的自动化端口
|
|
20
|
-
4. 理解环境要求并能够独立完成配置
|
|
21
|
-
|
|
22
|
-
## Scope (范围)
|
|
23
|
-
|
|
24
|
-
### In Scope (范围内)
|
|
25
|
-
|
|
26
|
-
- ✅ 定义 Node.js 最低版本要求(>= 18.0.0)
|
|
27
|
-
- ✅ 定义 pnpm 包管理器版本(9.0.0)
|
|
28
|
-
- ✅ 添加 `miniprogram-automator` 依赖(0.12.1)
|
|
29
|
-
- ✅ 编写完整的环境配置文档(setup-guide.md)
|
|
30
|
-
- ✅ 提供 Node.js、pnpm、微信开发者工具的安装步骤
|
|
31
|
-
- ✅ 提供环境验证命令和测试方法
|
|
32
|
-
- ✅ 提供常见问题排查指南(Troubleshooting)
|
|
33
|
-
- ✅ 说明环境变量配置选项
|
|
34
|
-
|
|
35
|
-
### Out of Scope (范围外)
|
|
36
|
-
|
|
37
|
-
- ❌ 微信小程序项目的创建(用户使用自己的项目)
|
|
38
|
-
- ❌ MCP 客户端(如 Claude Desktop)的配置说明
|
|
39
|
-
- ❌ 生产环境部署指南(属于 Stage H)
|
|
40
|
-
- ❌ CI/CD 环境配置(属于 Stage H)
|
|
41
|
-
- ❌ Windows/Linux 详细配置说明(优先 macOS,其他系统提供基本指引)
|
|
42
|
-
|
|
43
|
-
## Constraints (约束条件)
|
|
44
|
-
|
|
45
|
-
### Technical Constraints (技术约束)
|
|
46
|
-
|
|
47
|
-
- **Node.js 版本**: 必须 >= 18.0.0
|
|
48
|
-
- 理由: `@modelcontextprotocol/sdk` 依赖 Node 18+ 特性
|
|
49
|
-
- 验证: `package.json` engines 字段强制要求
|
|
50
|
-
|
|
51
|
-
- **包管理器**: 必须使用 pnpm 9.0.0
|
|
52
|
-
- 理由: 性能优势,支持 workspace 特性,依赖管理更严格
|
|
53
|
-
- 验证: `package.json` packageManager 字段锁定版本
|
|
54
|
-
|
|
55
|
-
- **miniprogram-automator 版本**: 使用 0.12.1
|
|
56
|
-
- 理由: 最新稳定版,支持所有自动化 API
|
|
57
|
-
- 验证: `package.json` dependencies 字段
|
|
58
|
-
|
|
59
|
-
- **微信开发者工具**: 必须支持自动化端口
|
|
60
|
-
- 理由: `miniprogram-automator` 通过 WebSocket 连接工具
|
|
61
|
-
- 验证: 需要手动在工具中启用"服务端口"
|
|
62
|
-
|
|
63
|
-
### Business Constraints (业务约束)
|
|
64
|
-
|
|
65
|
-
- 文档必须清晰易懂,适合不同技术水平的开发者
|
|
66
|
-
- 命令必须可以直接复制执行,避免手动修改
|
|
67
|
-
- 必须覆盖常见错误场景和解决方案
|
|
68
|
-
|
|
69
|
-
## Success Criteria (完成标准 / DoD)
|
|
70
|
-
|
|
71
|
-
### Deliverables (交付物)
|
|
72
|
-
|
|
73
|
-
1. ✅ **package.json 配置完成**
|
|
74
|
-
- engines.node: ">=18.0.0"
|
|
75
|
-
- packageManager: "pnpm@9.0.0"
|
|
76
|
-
- dependencies.miniprogram-automator: "^0.12.1"
|
|
77
|
-
|
|
78
|
-
2. ✅ **环境配置文档 (docs/setup-guide.md)**
|
|
79
|
-
- A1 章节:Node.js、pnpm、微信开发者工具安装步骤
|
|
80
|
-
- 包含版本检查命令
|
|
81
|
-
- 包含环境验证方法
|
|
82
|
-
- 包含 Troubleshooting 常见问题
|
|
83
|
-
|
|
84
|
-
3. ✅ **可执行性验证**
|
|
85
|
-
- 所有命令可以直接复制执行
|
|
86
|
-
- 验证命令能够测试环境配置是否成功
|
|
87
|
-
- 提供清晰的成功/失败反馈
|
|
88
|
-
|
|
89
|
-
4. ✅ **完整性检查**
|
|
90
|
-
- 覆盖安装、配置、验证、故障排除全流程
|
|
91
|
-
- 说明各组件的作用和必要性
|
|
92
|
-
- 提供参考链接到官方文档
|
|
93
|
-
|
|
94
|
-
### Quality Standards (质量标准)
|
|
95
|
-
|
|
96
|
-
- **文档清晰度**: 每个步骤都有代码示例或截图说明
|
|
97
|
-
- **完整性**: 从零开始能够完成环境配置
|
|
98
|
-
- **可维护性**: 版本号集中管理,便于后续更新
|
|
99
|
-
- **跨平台**: 优先 macOS,但提供其他系统的基本指引
|
|
100
|
-
|
|
101
|
-
## Open Questions (开放问题)
|
|
102
|
-
|
|
103
|
-
以下问题在实施过程中已经决议:
|
|
104
|
-
|
|
105
|
-
1. **Q**: Node.js 最低版本要求?
|
|
106
|
-
- **决议**: >= 18.0.0
|
|
107
|
-
- **理由**: MCP SDK 依赖 Node 18+ 的 Fetch API 等特性
|
|
108
|
-
- **来源**: `@modelcontextprotocol/sdk` 要求
|
|
109
|
-
|
|
110
|
-
2. **Q**: 选择哪个包管理器?
|
|
111
|
-
- **决议**: pnpm 9.0.0
|
|
112
|
-
- **理由**: 性能好、磁盘占用少、支持 workspace
|
|
113
|
-
- **来源**: 项目最佳实践
|
|
114
|
-
|
|
115
|
-
3. **Q**: miniprogram-automator 使用哪个版本?
|
|
116
|
-
- **决议**: 0.12.1(最新稳定版)
|
|
117
|
-
- **理由**: 支持所有自动化 API,修复了已知问题
|
|
118
|
-
- **来源**: npm 官方仓库
|
|
119
|
-
|
|
120
|
-
4. **Q**: 默认自动化端口号?
|
|
121
|
-
- **决议**: 9420
|
|
122
|
-
- **理由**: `miniprogram-automator` 官方示例默认值
|
|
123
|
-
- **来源**: 官方文档示例
|
|
124
|
-
|
|
125
|
-
5. **Q**: 是否提供示例小程序项目?
|
|
126
|
-
- **决议**: 否
|
|
127
|
-
- **理由**: 用户使用自己的小程序项目进行测试
|
|
128
|
-
- **来源**: 项目定位为 MCP 工具,不包含示例应用
|
|
129
|
-
|
|
130
|
-
6. **Q**: 文档是否需要覆盖 Windows/Linux?
|
|
131
|
-
- **决议**: 优先 macOS,其他系统提供基本指引
|
|
132
|
-
- **理由**: 开发团队主要使用 macOS,避免维护成本
|
|
133
|
-
- **来源**: 项目资源约束
|
|
134
|
-
|
|
135
|
-
## Risks (风险)
|
|
136
|
-
|
|
137
|
-
### Technical Risks (技术风险)
|
|
138
|
-
|
|
139
|
-
- ⚠️ **微信开发者工具 CLI 路径因系统而异**
|
|
140
|
-
- 影响: 用户可能找不到 CLI 路径
|
|
141
|
-
- 缓解: 文档中提供 macOS 默认路径,并说明如何自定义
|
|
142
|
-
|
|
143
|
-
- ⚠️ **miniprogram-automator 版本更新可能引入 Breaking Changes**
|
|
144
|
-
- 影响: 未来版本可能需要调整代码
|
|
145
|
-
- 缓解: 使用 `^0.12.1` 语义化版本,锁定主版本
|
|
146
|
-
|
|
147
|
-
- ⚠️ **微信开发者工具自动化端口配置容易被忽略**
|
|
148
|
-
- 影响: 用户连接失败
|
|
149
|
-
- 缓解: 文档中突出说明,提供验证命令
|
|
150
|
-
|
|
151
|
-
### Process Risks (流程风险)
|
|
152
|
-
|
|
153
|
-
- ⚠️ **追溯补齐文档**
|
|
154
|
-
- 影响: 本文档为追溯性创建,非正常 6A 流程
|
|
155
|
-
- 缓解: 明确标注 RETROSPECTIVE,等待用户批准
|
|
156
|
-
|
|
157
|
-
## Dependencies (依赖)
|
|
158
|
-
|
|
159
|
-
- **前置任务**: 无(这是第一个任务)
|
|
160
|
-
- **后续任务**: A2(配置 IDE 自动化端口)
|
|
161
|
-
|
|
162
|
-
## Approval (批准)
|
|
163
|
-
|
|
164
|
-
- **Status**: ⏳ 等待用户批准追溯补齐文档
|
|
165
|
-
- **Technical Implementation**: ✅ 已完成(package.json + setup-guide.md)
|
|
166
|
-
- **Process Compliance**: ❌ 流程违规(跳过 Align/Approve),通过追溯补齐修正
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
**注**: 本文档为追溯性创建,用于补齐 A1 任务的流程文档。技术实现已完成并验证通过,现等待用户批准追溯补齐的合理性。
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
# Charter: A2 - 配置 IDE 自动化端口并编写启动脚本
|
|
2
|
-
# Task ID: TASK-2025-001-A2
|
|
3
|
-
# Stage: Align (对齐阶段)
|
|
4
|
-
# Status: RETROSPECTIVE (追溯补齐)
|
|
5
|
-
# Created: 2025-10-02 (追溯)
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Goal (目标)
|
|
10
|
-
|
|
11
|
-
提供自动化和手动两种方式配置微信开发者工具的自动化端口,并开发启动脚本简化 DevTools 的启动流程,确保开发者能够快速启用自动化 API 访问,为后续 MCP Server 工具调用提供稳定的连接基础。
|
|
12
|
-
|
|
13
|
-
## Background (背景)
|
|
14
|
-
|
|
15
|
-
微信开发者工具默认不开启自动化 API 端口,需要手动在 GUI 中配置"服务端口"。对于频繁使用自动化测试的开发者,每次手动配置效率低下。A2 任务旨在:
|
|
16
|
-
|
|
17
|
-
1. 提供自动化脚本直接修改配置文件(`.ide`)
|
|
18
|
-
2. 提供启动脚本集成端口配置和 DevTools 启动
|
|
19
|
-
3. 支持自定义端口号(默认 9420)
|
|
20
|
-
4. 提供验证方法确保配置成功
|
|
21
|
-
|
|
22
|
-
## Scope (范围)
|
|
23
|
-
|
|
24
|
-
### In Scope (范围内)
|
|
25
|
-
|
|
26
|
-
- ✅ 开发 `scripts/setup-devtools-port.sh` 端口配置脚本
|
|
27
|
-
- 创建/更新 `.ide` 配置文件
|
|
28
|
-
- 设置 `automationPort` 和 `automationEnabled`
|
|
29
|
-
- 支持自定义端口号参数
|
|
30
|
-
- 验证 DevTools 安装和配置目录
|
|
31
|
-
|
|
32
|
-
- ✅ 开发 `scripts/launch-wx-devtools.sh` 启动脚本
|
|
33
|
-
- 自动配置端口(如未配置)
|
|
34
|
-
- 启动微信开发者工具
|
|
35
|
-
- 支持可选的项目路径参数
|
|
36
|
-
- 处理已运行实例的情况
|
|
37
|
-
|
|
38
|
-
- ✅ 编写文档 `docs/setup-guide.md` A2 章节
|
|
39
|
-
- 自动化配置方法(脚本使用)
|
|
40
|
-
- 手动配置方法(GUI 步骤)
|
|
41
|
-
- 验证配置的测试命令
|
|
42
|
-
- 常见问题排查
|
|
43
|
-
|
|
44
|
-
### Out of Scope (范围外)
|
|
45
|
-
|
|
46
|
-
- ❌ Windows/Linux 脚本支持(仅 macOS)
|
|
47
|
-
- ❌ 跨平台路径兼容性(CLI 路径硬编码)
|
|
48
|
-
- ❌ 图形化配置工具
|
|
49
|
-
- ❌ 端口冲突自动解决(用户手动选择端口)
|
|
50
|
-
- ❌ DevTools 自动安装
|
|
51
|
-
- ❌ 小程序项目创建
|
|
52
|
-
|
|
53
|
-
## Constraints (约束条件)
|
|
54
|
-
|
|
55
|
-
### Technical Constraints (技术约束)
|
|
56
|
-
|
|
57
|
-
- **操作系统**: 仅支持 macOS
|
|
58
|
-
- 理由: DevTools CLI 路径和配置文件路径特定于 macOS
|
|
59
|
-
- 路径: `/Applications/wechatwebdevtools.app/Contents/MacOS/cli`
|
|
60
|
-
- 配置: `~/Library/Application Support/微信开发者工具/Default/.ide`
|
|
61
|
-
|
|
62
|
-
- **前置条件**: 微信开发者工具必须已安装
|
|
63
|
-
- 脚本会检查 `/Applications/wechatwebdevtools.app` 是否存在
|
|
64
|
-
- 配置目录需要 DevTools 至少启动过一次才会创建
|
|
65
|
-
|
|
66
|
-
- **Shell 环境**: 依赖 Bash shell
|
|
67
|
-
- 理由: 使用 Bash 特性(heredoc、数组等)
|
|
68
|
-
- 验证: `#!/bin/bash` shebang
|
|
69
|
-
|
|
70
|
-
- **默认端口**: 9420
|
|
71
|
-
- 理由: `miniprogram-automator` 官方示例默认值
|
|
72
|
-
- 可配置: 两个脚本都支持自定义端口参数
|
|
73
|
-
|
|
74
|
-
- **配置文件格式**: JSON
|
|
75
|
-
- 必须包含 `automationPort` 和 `automationEnabled` 字段
|
|
76
|
-
- 其他字段为 DevTools 标准配置
|
|
77
|
-
|
|
78
|
-
### Business Constraints (业务约束)
|
|
79
|
-
|
|
80
|
-
- 脚本必须有清晰的使用说明和错误提示
|
|
81
|
-
- 必须提供手动配置的备选方案(不依赖脚本)
|
|
82
|
-
- 验证命令必须简单可执行
|
|
83
|
-
- 文档必须覆盖自动化和手动两种方式
|
|
84
|
-
|
|
85
|
-
## Success Criteria (完成标准 / DoD)
|
|
86
|
-
|
|
87
|
-
### Deliverables (交付物)
|
|
88
|
-
|
|
89
|
-
1. ✅ **端口配置脚本 (scripts/setup-devtools-port.sh)**
|
|
90
|
-
- 创建/更新 `.ide` 配置文件
|
|
91
|
-
- 包含 `automationPort` 和 `automationEnabled: true`
|
|
92
|
-
- 支持端口参数:`./setup-devtools-port.sh [port]`
|
|
93
|
-
- 检查 DevTools 安装和配置目录
|
|
94
|
-
- 提供清晰的成功/失败反馈
|
|
95
|
-
|
|
96
|
-
2. ✅ **启动脚本 (scripts/launch-wx-devtools.sh)**
|
|
97
|
-
- 自动配置端口(如需要)
|
|
98
|
-
- 启动微信开发者工具
|
|
99
|
-
- 支持项目路径参数:`./launch-wx-devtools.sh [project_path] [port]`
|
|
100
|
-
- 处理已运行实例(提示用户选择关闭或保留)
|
|
101
|
-
- 使用 CLI 启动(支持项目路径)或 `open -a`(无项目)
|
|
102
|
-
|
|
103
|
-
3. ✅ **文档 (docs/setup-guide.md A2 章节)**
|
|
104
|
-
- 自动化配置方法(脚本使用示例)
|
|
105
|
-
- 手动配置方法(GUI 操作步骤)
|
|
106
|
-
- 验证配置的测试命令
|
|
107
|
-
- 预期输出说明
|
|
108
|
-
|
|
109
|
-
4. ✅ **可执行性验证**
|
|
110
|
-
- 脚本有可执行权限(`chmod +x`)
|
|
111
|
-
- 所有命令可以直接复制执行
|
|
112
|
-
- 验证命令能够测试端口连接
|
|
113
|
-
|
|
114
|
-
### Quality Standards (质量标准)
|
|
115
|
-
|
|
116
|
-
- **脚本健壮性**: 完整的错误处理和用户提示
|
|
117
|
-
- **文档清晰度**: 每个步骤都有代码示例或明确说明
|
|
118
|
-
- **可维护性**: CLI 路径和配置路径集中定义为变量
|
|
119
|
-
- **用户体验**: 提供自动化和手动两种方式,用户可选择
|
|
120
|
-
|
|
121
|
-
## Open Questions (开放问题)
|
|
122
|
-
|
|
123
|
-
以下问题在实施过程中已经决议:
|
|
124
|
-
|
|
125
|
-
1. **Q**: 配置文件 `.ide` 的格式和必需字段?
|
|
126
|
-
- **决议**: JSON 格式,必须包含 `automationPort` 和 `automationEnabled`
|
|
127
|
-
- **理由**: 通过实际测试微信开发者工具的配置文件格式确定
|
|
128
|
-
- **来源**: 实际调试和官方文档
|
|
129
|
-
|
|
130
|
-
2. **Q**: 是否支持 Windows/Linux?
|
|
131
|
-
- **决议**: 仅支持 macOS
|
|
132
|
-
- **理由**: 不同操作系统的 CLI 路径和配置路径差异大,维护成本高
|
|
133
|
-
- **来源**: 项目资源约束,团队主要使用 macOS
|
|
134
|
-
|
|
135
|
-
3. **Q**: 启动脚本是否需要支持项目路径参数?
|
|
136
|
-
- **决议**: 支持可选的项目路径参数
|
|
137
|
-
- **理由**: 提高灵活性,用户可以直接打开特定项目
|
|
138
|
-
- **来源**: 用户体验优化
|
|
139
|
-
|
|
140
|
-
4. **Q**: 如何处理 DevTools 已运行的情况?
|
|
141
|
-
- **决议**: 提示用户选择关闭重启或保留现有实例
|
|
142
|
-
- **理由**: 避免强制关闭导致用户数据丢失
|
|
143
|
-
- **来源**: 最佳实践和用户体验
|
|
144
|
-
|
|
145
|
-
5. **Q**: 验证命令应该如何实现?
|
|
146
|
-
- **决议**: 使用 Node.js 单行命令 + `miniprogram-automator.connect()`
|
|
147
|
-
- **理由**: 简单直接,用户可以快速测试连接
|
|
148
|
-
- **来源**: `miniprogram-automator` 官方示例
|
|
149
|
-
|
|
150
|
-
6. **Q**: 默认端口号选择?
|
|
151
|
-
- **决议**: 9420
|
|
152
|
-
- **理由**: `miniprogram-automator` 官方示例和文档中的默认值
|
|
153
|
-
- **来源**: 官方文档
|
|
154
|
-
|
|
155
|
-
## Risks (风险)
|
|
156
|
-
|
|
157
|
-
### Technical Risks (技术风险)
|
|
158
|
-
|
|
159
|
-
- ⚠️ **配置文件格式可能因 DevTools 版本而变化**
|
|
160
|
-
- 影响: 脚本可能失效或导致配置文件损坏
|
|
161
|
-
- 缓解: 使用保守的配置字段,仅修改必要的 `automationPort` 和 `automationEnabled`
|
|
162
|
-
|
|
163
|
-
- ⚠️ **CLI 路径可能因 DevTools 版本而变化**
|
|
164
|
-
- 影响: 启动脚本无法找到 CLI
|
|
165
|
-
- 缓解: 在脚本中检查 CLI 是否存在,提供明确错误提示
|
|
166
|
-
|
|
167
|
-
- ⚠️ **端口冲突问题**
|
|
168
|
-
- 影响: 默认端口 9420 可能被其他服务占用
|
|
169
|
-
- 缓解: 支持自定义端口参数,文档中说明如何选择端口
|
|
170
|
-
|
|
171
|
-
- ⚠️ **权限问题**
|
|
172
|
-
- 影响: 脚本可能没有可执行权限
|
|
173
|
-
- 缓解: 文档中说明 `chmod +x` 命令
|
|
174
|
-
|
|
175
|
-
### Process Risks (流程风险)
|
|
176
|
-
|
|
177
|
-
- ⚠️ **追溯补齐文档**
|
|
178
|
-
- 影响: 本文档为追溯性创建,非正常 6A 流程
|
|
179
|
-
- 缓解: 明确标注 RETROSPECTIVE,等待用户批准
|
|
180
|
-
|
|
181
|
-
## Dependencies (依赖)
|
|
182
|
-
|
|
183
|
-
- **前置任务**: A1(环境与基础设施准备)
|
|
184
|
-
- 需要 Node.js、pnpm、miniprogram-automator 已安装
|
|
185
|
-
- 需要微信开发者工具已安装
|
|
186
|
-
|
|
187
|
-
- **后续任务**: A3(初始化项目)
|
|
188
|
-
- A3 依赖 A2 配置的自动化端口
|
|
189
|
-
- 后续所有 MCP 工具都需要通过此端口连接
|
|
190
|
-
|
|
191
|
-
## Approval (批准)
|
|
192
|
-
|
|
193
|
-
- **Status**: ⏳ 等待用户批准追溯补齐文档
|
|
194
|
-
- **Technical Implementation**: ✅ 已完成(2 个脚本 + 文档)
|
|
195
|
-
- **Process Compliance**: ❌ 流程违规(跳过 Align/Approve),通过追溯补齐修正
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
**注**: 本文档为追溯性创建,用于补齐 A2 任务的流程文档。技术实现已完成并验证通过,现等待用户批准追溯补齐的合理性。
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
# Charter: A3 - 建立基础目录结构与 TypeScript 工程
|
|
2
|
-
# Task ID: TASK-2025-001-A3
|
|
3
|
-
# Stage: Align (对齐阶段)
|
|
4
|
-
# Status: RETROSPECTIVE (追溯补齐)
|
|
5
|
-
# Created: 2025-10-02 (追溯)
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Goal (目标)
|
|
10
|
-
|
|
11
|
-
建立完整的 TypeScript 项目结构,包括源代码目录、文档目录、测试目录和示例目录,配置现代化的 TypeScript 编译环境,为后续 MCP Server 开发提供坚实的工程基础。
|
|
12
|
-
|
|
13
|
-
## Background (背景)
|
|
14
|
-
|
|
15
|
-
作为 MCP Server 项目的基础设施准备阶段的最后一步,A3 任务需要建立标准的 TypeScript 项目结构。这个结构将支持:
|
|
16
|
-
|
|
17
|
-
1. 清晰的代码组织(源代码、测试、文档、示例分离)
|
|
18
|
-
2. TypeScript 严格类型检查和现代化特性
|
|
19
|
-
3. 声明文件生成(支持其他项目引用)
|
|
20
|
-
4. 测试框架集成(Jest)
|
|
21
|
-
5. 版本控制配置(Git)
|
|
22
|
-
|
|
23
|
-
## Scope (范围)
|
|
24
|
-
|
|
25
|
-
### In Scope (范围内)
|
|
26
|
-
|
|
27
|
-
- ✅ 创建 4 个核心目录结构
|
|
28
|
-
- `src/` - 源代码目录(包含子目录 tools/, core/, config/)
|
|
29
|
-
- `docs/` - 文档目录(任务卡、指南、API 文档等)
|
|
30
|
-
- `tests/` - 测试目录(unit/, integration/ 子目录)
|
|
31
|
-
- `examples/` - 示例目录(使用示例和脚本)
|
|
32
|
-
|
|
33
|
-
- ✅ 配置 TypeScript 工程
|
|
34
|
-
- `tsconfig.json` - TypeScript 编译配置
|
|
35
|
-
- 严格模式(strict: true)
|
|
36
|
-
- ESNext 目标和模块系统
|
|
37
|
-
- 声明文件生成(declaration: true)
|
|
38
|
-
- Source Map 支持(sourceMap: true)
|
|
39
|
-
- Path 别名配置(@/* 映射到 src/*)
|
|
40
|
-
|
|
41
|
-
- ✅ 配置 package.json
|
|
42
|
-
- TypeScript 依赖(typescript ^5.5.2)
|
|
43
|
-
- 类型定义(@types/node, @types/jest)
|
|
44
|
-
- 构建脚本(build, dev, typecheck)
|
|
45
|
-
- 模块类型("type": "module" for ESM)
|
|
46
|
-
|
|
47
|
-
- ✅ 配置测试框架
|
|
48
|
-
- `jest.config.js` - Jest 测试配置
|
|
49
|
-
- ts-jest 转换器
|
|
50
|
-
- 测试环境配置
|
|
51
|
-
|
|
52
|
-
- ✅ 配置版本控制
|
|
53
|
-
- `.gitignore` - Git 忽略规则
|
|
54
|
-
- 排除 node_modules/, dist/, *.log 等
|
|
55
|
-
|
|
56
|
-
### Out of Scope (范围外)
|
|
57
|
-
|
|
58
|
-
- ❌ ESLint/Prettier 配置(属于 A4 任务)
|
|
59
|
-
- ❌ Husky/Git Hooks(属于 A4 任务)
|
|
60
|
-
- ❌ 实际业务代码实现(属于 Stage B-G)
|
|
61
|
-
- ❌ 示例小程序项目(用户使用自己的项目)
|
|
62
|
-
- ❌ CI/CD 配置(属于 Stage H)
|
|
63
|
-
|
|
64
|
-
## Constraints (约束条件)
|
|
65
|
-
|
|
66
|
-
### Technical Constraints (技术约束)
|
|
67
|
-
|
|
68
|
-
- **TypeScript 版本**: 5.5.2
|
|
69
|
-
- 理由: 最新稳定版,支持最新语言特性
|
|
70
|
-
- 验证: package.json devDependencies
|
|
71
|
-
|
|
72
|
-
- **模块系统**: ESNext (ES Modules)
|
|
73
|
-
- 理由: 现代化模块系统,Node.js 18+ 原生支持
|
|
74
|
-
- 验证: tsconfig.json module: "ESNext", package.json type: "module"
|
|
75
|
-
|
|
76
|
-
- **编译目标**: ESNext
|
|
77
|
-
- 理由: Node.js 18+ 支持最新 ECMAScript 特性
|
|
78
|
-
- 验证: tsconfig.json target: "ESNext"
|
|
79
|
-
|
|
80
|
-
- **严格模式**: 必须启用
|
|
81
|
-
- 理由: 确保类型安全,减少运行时错误
|
|
82
|
-
- 验证: tsconfig.json strict: true
|
|
83
|
-
|
|
84
|
-
- **声明文件**: 必须生成
|
|
85
|
-
- 理由: 支持其他项目引用,提供类型提示
|
|
86
|
-
- 验证: tsconfig.json declaration: true
|
|
87
|
-
|
|
88
|
-
- **测试框架**: Jest 29.7.0
|
|
89
|
-
- 理由: TypeScript 友好,社区成熟,功能完整
|
|
90
|
-
- 验证: package.json devDependencies
|
|
91
|
-
|
|
92
|
-
### Business Constraints (业务约束)
|
|
93
|
-
|
|
94
|
-
- 目录结构必须清晰,便于团队协作
|
|
95
|
-
- 配置必须符合 TypeScript 最佳实践
|
|
96
|
-
- 必须支持增量编译(watch 模式)
|
|
97
|
-
- 必须支持类型检查而不生成文件(typecheck)
|
|
98
|
-
|
|
99
|
-
## Success Criteria (完成标准 / DoD)
|
|
100
|
-
|
|
101
|
-
### Deliverables (交付物)
|
|
102
|
-
|
|
103
|
-
1. ✅ **目录结构**
|
|
104
|
-
- `src/` 目录存在,包含子目录(tools/, core/, config/)
|
|
105
|
-
- `docs/` 目录存在,包含文档文件
|
|
106
|
-
- `tests/` 目录存在,包含子目录(unit/, integration/)
|
|
107
|
-
- `examples/` 目录存在,包含示例文件
|
|
108
|
-
|
|
109
|
-
2. ✅ **TypeScript 配置 (tsconfig.json)**
|
|
110
|
-
- compilerOptions.target: "ESNext"
|
|
111
|
-
- compilerOptions.module: "ESNext"
|
|
112
|
-
- compilerOptions.strict: true
|
|
113
|
-
- compilerOptions.declaration: true
|
|
114
|
-
- compilerOptions.sourceMap: true
|
|
115
|
-
- compilerOptions.rootDir: "./src"
|
|
116
|
-
- compilerOptions.outDir: "./dist"
|
|
117
|
-
- paths: {"@/*": ["src/*"]}
|
|
118
|
-
- include: ["src/**/*"]
|
|
119
|
-
- exclude: ["node_modules", "dist", "tests"]
|
|
120
|
-
|
|
121
|
-
3. ✅ **Package.json 配置**
|
|
122
|
-
- dependencies: MCP SDK, commander, zod 等运行时依赖
|
|
123
|
-
- devDependencies: TypeScript, @types/node, @types/jest
|
|
124
|
-
- scripts.build: "tsc"
|
|
125
|
-
- scripts.dev: "tsc --watch"
|
|
126
|
-
- scripts.typecheck: "tsc --noEmit"
|
|
127
|
-
- type: "module"
|
|
128
|
-
- main: "dist/index.js"
|
|
129
|
-
- bin: {"miniprogram-mcp": "dist/cli.js"}
|
|
130
|
-
|
|
131
|
-
4. ✅ **Jest 配置 (jest.config.js)**
|
|
132
|
-
- preset: "ts-jest"
|
|
133
|
-
- testEnvironment: "node"
|
|
134
|
-
- 支持 TypeScript 测试文件
|
|
135
|
-
|
|
136
|
-
5. ✅ **Git 配置 (.gitignore)**
|
|
137
|
-
- 排除 node_modules/
|
|
138
|
-
- 排除 dist/
|
|
139
|
-
- 排除 *.log
|
|
140
|
-
- 排除 .env
|
|
141
|
-
|
|
142
|
-
6. ✅ **可执行性验证**
|
|
143
|
-
- `pnpm build` 成功编译,生成 dist/ 目录
|
|
144
|
-
- `pnpm typecheck` 通过类型检查,无错误
|
|
145
|
-
- dist/ 包含 .js, .d.ts, .js.map 文件
|
|
146
|
-
|
|
147
|
-
### Quality Standards (质量标准)
|
|
148
|
-
|
|
149
|
-
- **代码组织**: 源代码、测试、文档、示例清晰分离
|
|
150
|
-
- **类型安全**: 严格模式启用,所有代码类型完整
|
|
151
|
-
- **可维护性**: 配置文件简洁,注释清晰
|
|
152
|
-
- **开发体验**: 支持 watch 模式,快速迭代
|
|
153
|
-
|
|
154
|
-
## Open Questions (开放问题)
|
|
155
|
-
|
|
156
|
-
以下问题在实施过程中已经决议:
|
|
157
|
-
|
|
158
|
-
1. **Q**: TypeScript 编译目标选择?
|
|
159
|
-
- **决议**: ESNext
|
|
160
|
-
- **理由**: Node.js 18+ 支持最新 ECMAScript 特性,无需降级编译
|
|
161
|
-
- **来源**: A1 环境要求 Node.js >= 18.0.0
|
|
162
|
-
|
|
163
|
-
2. **Q**: 模块系统选择 CommonJS 还是 ES Modules?
|
|
164
|
-
- **决议**: ES Modules (ESNext)
|
|
165
|
-
- **理由**: 现代化标准,Node.js 18+ 原生支持,MCP SDK 也使用 ESM
|
|
166
|
-
- **来源**: package.json type: "module"
|
|
167
|
-
|
|
168
|
-
3. **Q**: 是否启用 TypeScript 严格模式?
|
|
169
|
-
- **决议**: 启用(strict: true)
|
|
170
|
-
- **理由**: 提高类型安全,减少运行时错误,符合最佳实践
|
|
171
|
-
- **来源**: 项目质量要求
|
|
172
|
-
|
|
173
|
-
4. **Q**: 是否生成声明文件?
|
|
174
|
-
- **决议**: 生成(declaration: true)
|
|
175
|
-
- **理由**: 支持其他项目引用,提供类型提示,专业项目标准
|
|
176
|
-
- **来源**: package.json main 字段指向 dist/index.js
|
|
177
|
-
|
|
178
|
-
5. **Q**: 测试框架选择?
|
|
179
|
-
- **决议**: Jest
|
|
180
|
-
- **理由**: TypeScript 友好(ts-jest),社区成熟,功能完整
|
|
181
|
-
- **来源**: 业界标准实践
|
|
182
|
-
|
|
183
|
-
6. **Q**: Path 别名是否需要?
|
|
184
|
-
- **决议**: 需要(@/* 映射到 src/*)
|
|
185
|
-
- **理由**: 简化 import 路径,避免 ../../.. 相对路径
|
|
186
|
-
- **来源**: 开发体验优化
|
|
187
|
-
|
|
188
|
-
7. **Q**: 是否需要 Source Map?
|
|
189
|
-
- **决议**: 需要(sourceMap: true, declarationMap: true)
|
|
190
|
-
- **理由**: 支持调试,错误堆栈指向源代码
|
|
191
|
-
- **来源**: 开发体验和调试需求
|
|
192
|
-
|
|
193
|
-
8. **Q**: dist/ 目录是否提交到 Git?
|
|
194
|
-
- **决议**: 不提交(.gitignore 排除)
|
|
195
|
-
- **理由**: 编译产物,由 CI/CD 或用户构建生成
|
|
196
|
-
- **来源**: Git 最佳实践
|
|
197
|
-
|
|
198
|
-
## Risks (风险)
|
|
199
|
-
|
|
200
|
-
### Technical Risks (技术风险)
|
|
201
|
-
|
|
202
|
-
- ⚠️ **TypeScript 版本兼容性**
|
|
203
|
-
- 影响: 未来版本可能引入 Breaking Changes
|
|
204
|
-
- 缓解: 锁定主版本号(^5.5.2),定期测试更新
|
|
205
|
-
|
|
206
|
-
- ⚠️ **ESM 模块系统兼容性**
|
|
207
|
-
- 影响: 某些老旧依赖可能不支持 ESM
|
|
208
|
-
- 缓解: 优先选择支持 ESM 的依赖,必要时使用动态 import
|
|
209
|
-
|
|
210
|
-
- ⚠️ **Path 别名在测试中的支持**
|
|
211
|
-
- 影响: Jest 需要额外配置才能识别 @/* 别名
|
|
212
|
-
- 缓解: jest.config.js 配置 moduleNameMapper
|
|
213
|
-
|
|
214
|
-
- ⚠️ **声明文件生成可能失败**
|
|
215
|
-
- 影响: 类型不完整时声明文件生成失败
|
|
216
|
-
- 缓解: 严格模式强制类型完整性
|
|
217
|
-
|
|
218
|
-
### Process Risks (流程风险)
|
|
219
|
-
|
|
220
|
-
- ⚠️ **追溯补齐文档**
|
|
221
|
-
- 影响: 本文档为追溯性创建,非正常 6A 流程
|
|
222
|
-
- 缓解: 明确标注 RETROSPECTIVE,等待用户批准
|
|
223
|
-
|
|
224
|
-
## Dependencies (依赖)
|
|
225
|
-
|
|
226
|
-
- **前置任务**:
|
|
227
|
-
- A1(环境与基础设施准备)- Node.js, pnpm 已安装
|
|
228
|
-
- A2(配置 IDE 自动化端口)- DevTools 已配置
|
|
229
|
-
|
|
230
|
-
- **后续任务**:
|
|
231
|
-
- A4(Lint/Format/Commit Hooks)- 依赖 A3 的项目结构
|
|
232
|
-
- B1-B5(核心框架搭建)- 依赖 A3 的 TypeScript 配置
|
|
233
|
-
|
|
234
|
-
## Approval (批准)
|
|
235
|
-
|
|
236
|
-
- **Status**: ⏳ 等待用户批准追溯补齐文档
|
|
237
|
-
- **Technical Implementation**: ✅ 已完成(目录结构 + TS 配置 + 测试配置)
|
|
238
|
-
- **Process Compliance**: ❌ 流程违规(跳过 Align/Approve),通过追溯补齐修正
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
**注**: 本文档为追溯性创建,用于补齐 A3 任务的流程文档。技术实现已完成并验证通过(build ✓, typecheck ✓),现等待用户批准追溯补齐的合理性。
|