taphound 0.2.0-dev.1

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.
Files changed (176) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +200 -0
  3. package/README.zh-CN.md +200 -0
  4. package/assets/brand/taphound-mark.svg +9 -0
  5. package/assets/skills/taphound-ai-journey/GUIDE.md +862 -0
  6. package/assets/skills/taphound-ai-journey/SKILL.md +377 -0
  7. package/assets/skills/taphound-ai-journey/prompts/analyze-project.md +526 -0
  8. package/assets/skills/taphound-ai-journey/prompts/check-completion.md +52 -0
  9. package/assets/skills/taphound-ai-journey/prompts/generate-step.md +109 -0
  10. package/assets/skills/taphound-ai-journey/schemas/observe-output.json +42 -0
  11. package/assets/skills/taphound-ai-journey/schemas/project-context.json +81 -0
  12. package/assets/skills/taphound-ai-journey/schemas/proposed-step-envelope.json +267 -0
  13. package/assets/skills/taphound-ai-journey/templates/project-context.example.json +49 -0
  14. package/dist/adapters/adb/adb-adapter.d.ts +23 -0
  15. package/dist/adapters/adb/adb-adapter.js +218 -0
  16. package/dist/adapters/android-cli/android-cli-adapter.d.ts +11 -0
  17. package/dist/adapters/android-cli/android-cli-adapter.js +64 -0
  18. package/dist/adapters/android-cli/layout-parser.d.ts +3 -0
  19. package/dist/adapters/android-cli/layout-parser.js +174 -0
  20. package/dist/adapters/clock/system-clock.d.ts +5 -0
  21. package/dist/adapters/clock/system-clock.js +13 -0
  22. package/dist/adapters/filesystem/artifact-store.d.ts +4 -0
  23. package/dist/adapters/filesystem/artifact-store.js +73 -0
  24. package/dist/adapters/filesystem/generation-meta-writer.d.ts +16 -0
  25. package/dist/adapters/filesystem/generation-meta-writer.js +34 -0
  26. package/dist/adapters/filesystem/generation-session-store.d.ts +68 -0
  27. package/dist/adapters/filesystem/generation-session-store.js +1603 -0
  28. package/dist/adapters/filesystem/journey-writer.d.ts +16 -0
  29. package/dist/adapters/filesystem/journey-writer.js +34 -0
  30. package/dist/adapters/filesystem/project-bound-file.d.ts +6 -0
  31. package/dist/adapters/filesystem/project-bound-file.js +240 -0
  32. package/dist/adapters/filesystem/project-file-inspector.d.ts +8 -0
  33. package/dist/adapters/filesystem/project-file-inspector.js +198 -0
  34. package/dist/adapters/filesystem/skill-installer.d.ts +10 -0
  35. package/dist/adapters/filesystem/skill-installer.js +39 -0
  36. package/dist/adapters/process/node-process-runner.d.ts +8 -0
  37. package/dist/adapters/process/node-process-runner.js +155 -0
  38. package/dist/adapters/prompt/inquirer-generation-prompt.d.ts +55 -0
  39. package/dist/adapters/prompt/inquirer-generation-prompt.js +213 -0
  40. package/dist/adapters/prompt/inquirer-init-prompt.d.ts +32 -0
  41. package/dist/adapters/prompt/inquirer-init-prompt.js +55 -0
  42. package/dist/adapters/prompt/inquirer-recorder-prompt.d.ts +47 -0
  43. package/dist/adapters/prompt/inquirer-recorder-prompt.js +157 -0
  44. package/dist/application/assertion/expectation-evaluator.d.ts +61 -0
  45. package/dist/application/assertion/expectation-evaluator.js +207 -0
  46. package/dist/application/collector/logcat-collector.d.ts +39 -0
  47. package/dist/application/collector/logcat-collector.js +107 -0
  48. package/dist/application/context/context-validator.d.ts +27 -0
  49. package/dist/application/context/context-validator.js +120 -0
  50. package/dist/application/doctor/doctor-service.d.ts +35 -0
  51. package/dist/application/doctor/doctor-service.js +178 -0
  52. package/dist/application/generation/focused-input.d.ts +2 -0
  53. package/dist/application/generation/focused-input.js +9 -0
  54. package/dist/application/generation/generation-confirmation-service.d.ts +76 -0
  55. package/dist/application/generation/generation-confirmation-service.js +383 -0
  56. package/dist/application/generation/generation-finalizer.d.ts +67 -0
  57. package/dist/application/generation/generation-finalizer.js +646 -0
  58. package/dist/application/generation/generation-publisher.d.ts +46 -0
  59. package/dist/application/generation/generation-publisher.js +178 -0
  60. package/dist/application/generation/generation-starter.d.ts +31 -0
  61. package/dist/application/generation/generation-starter.js +102 -0
  62. package/dist/application/generation/generation-step-executor.d.ts +52 -0
  63. package/dist/application/generation/generation-step-executor.js +668 -0
  64. package/dist/application/generation/proposed-step-validator.d.ts +11 -0
  65. package/dist/application/generation/proposed-step-validator.js +88 -0
  66. package/dist/application/generation/risk-evaluator.d.ts +9 -0
  67. package/dist/application/generation/risk-evaluator.js +14 -0
  68. package/dist/application/generation/runtime-observer.d.ts +39 -0
  69. package/dist/application/generation/runtime-observer.js +157 -0
  70. package/dist/application/init/init-service.d.ts +17 -0
  71. package/dist/application/init/init-service.js +44 -0
  72. package/dist/application/interaction/action-executor.d.ts +25 -0
  73. package/dist/application/interaction/action-executor.js +103 -0
  74. package/dist/application/interaction/fallback-resolver.d.ts +24 -0
  75. package/dist/application/interaction/fallback-resolver.js +48 -0
  76. package/dist/application/interaction/scroll-to-executor.d.ts +40 -0
  77. package/dist/application/interaction/scroll-to-executor.js +191 -0
  78. package/dist/application/locator/locator-resolver.d.ts +20 -0
  79. package/dist/application/locator/locator-resolver.js +89 -0
  80. package/dist/application/project/project-describer.d.ts +14 -0
  81. package/dist/application/project/project-describer.js +8 -0
  82. package/dist/application/recorder/locator-selector.d.ts +10 -0
  83. package/dist/application/recorder/locator-selector.js +80 -0
  84. package/dist/application/recorder/recorder-service.d.ts +41 -0
  85. package/dist/application/recorder/recorder-service.js +331 -0
  86. package/dist/application/report/report-writer.d.ts +10 -0
  87. package/dist/application/report/report-writer.js +39 -0
  88. package/dist/application/runtime/activity-waiter.d.ts +33 -0
  89. package/dist/application/runtime/activity-waiter.js +73 -0
  90. package/dist/application/runtime/launch-failure.d.ts +2 -0
  91. package/dist/application/runtime/launch-failure.js +20 -0
  92. package/dist/application/runtime/process-waiter.d.ts +27 -0
  93. package/dist/application/runtime/process-waiter.js +73 -0
  94. package/dist/application/runtime/step-runner.d.ts +50 -0
  95. package/dist/application/runtime/step-runner.js +429 -0
  96. package/dist/application/runtime/verify-runtime.d.ts +44 -0
  97. package/dist/application/runtime/verify-runtime.js +350 -0
  98. package/dist/application/wait/idle-waiter.d.ts +30 -0
  99. package/dist/application/wait/idle-waiter.js +90 -0
  100. package/dist/cli/commands/context.d.ts +3 -0
  101. package/dist/cli/commands/context.js +94 -0
  102. package/dist/cli/commands/doctor.d.ts +3 -0
  103. package/dist/cli/commands/doctor.js +51 -0
  104. package/dist/cli/commands/generation.d.ts +3 -0
  105. package/dist/cli/commands/generation.js +518 -0
  106. package/dist/cli/commands/init.d.ts +3 -0
  107. package/dist/cli/commands/init.js +104 -0
  108. package/dist/cli/commands/project.d.ts +3 -0
  109. package/dist/cli/commands/project.js +58 -0
  110. package/dist/cli/commands/record.d.ts +3 -0
  111. package/dist/cli/commands/record.js +88 -0
  112. package/dist/cli/commands/verify.d.ts +3 -0
  113. package/dist/cli/commands/verify.js +106 -0
  114. package/dist/cli/dependencies.d.ts +66 -0
  115. package/dist/cli/dependencies.js +204 -0
  116. package/dist/cli/main.d.ts +8 -0
  117. package/dist/cli/main.js +73 -0
  118. package/dist/cli/output.d.ts +16 -0
  119. package/dist/cli/output.js +22 -0
  120. package/dist/cli/program.d.ts +3 -0
  121. package/dist/cli/program.js +43 -0
  122. package/dist/domain/activity.d.ts +7 -0
  123. package/dist/domain/activity.js +65 -0
  124. package/dist/domain/app-process.d.ts +7 -0
  125. package/dist/domain/app-process.js +10 -0
  126. package/dist/domain/config.d.ts +15 -0
  127. package/dist/domain/config.js +17 -0
  128. package/dist/domain/failure.d.ts +4 -0
  129. package/dist/domain/failure.js +43 -0
  130. package/dist/domain/generation.d.ts +912 -0
  131. package/dist/domain/generation.js +342 -0
  132. package/dist/domain/init.d.ts +42 -0
  133. package/dist/domain/init.js +114 -0
  134. package/dist/domain/journey.d.ts +673 -0
  135. package/dist/domain/journey.js +109 -0
  136. package/dist/domain/layout.d.ts +35 -0
  137. package/dist/domain/layout.js +33 -0
  138. package/dist/domain/locator.d.ts +8 -0
  139. package/dist/domain/locator.js +5 -0
  140. package/dist/domain/project-context.d.ts +101 -0
  141. package/dist/domain/project-context.js +64 -0
  142. package/dist/domain/proposed-step.d.ts +341 -0
  143. package/dist/domain/proposed-step.js +87 -0
  144. package/dist/domain/report.d.ts +349 -0
  145. package/dist/domain/report.js +135 -0
  146. package/dist/domain/runtime-snapshot.d.ts +16 -0
  147. package/dist/domain/runtime-snapshot.js +46 -0
  148. package/dist/ports/adb.d.ts +42 -0
  149. package/dist/ports/adb.js +1 -0
  150. package/dist/ports/android-cli.d.ts +21 -0
  151. package/dist/ports/android-cli.js +1 -0
  152. package/dist/ports/artifact-store.d.ts +12 -0
  153. package/dist/ports/artifact-store.js +1 -0
  154. package/dist/ports/clock.d.ts +4 -0
  155. package/dist/ports/clock.js +1 -0
  156. package/dist/ports/generation-meta-writer.d.ts +10 -0
  157. package/dist/ports/generation-meta-writer.js +1 -0
  158. package/dist/ports/generation-prompt.d.ts +19 -0
  159. package/dist/ports/generation-prompt.js +6 -0
  160. package/dist/ports/generation-session-store.d.ts +32 -0
  161. package/dist/ports/generation-session-store.js +26 -0
  162. package/dist/ports/init-prompt.d.ts +8 -0
  163. package/dist/ports/init-prompt.js +6 -0
  164. package/dist/ports/journey-writer.d.ts +10 -0
  165. package/dist/ports/journey-writer.js +1 -0
  166. package/dist/ports/process-runner.d.ts +32 -0
  167. package/dist/ports/process-runner.js +1 -0
  168. package/dist/ports/project-bound-file.d.ts +8 -0
  169. package/dist/ports/project-bound-file.js +1 -0
  170. package/dist/ports/project-file-inspector.d.ts +33 -0
  171. package/dist/ports/project-file-inspector.js +1 -0
  172. package/dist/ports/recorder-prompt.d.ts +29 -0
  173. package/dist/ports/recorder-prompt.js +1 -0
  174. package/dist/ports/skill-installer.d.ts +8 -0
  175. package/dist/ports/skill-installer.js +1 -0
  176. package/package.json +64 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,200 @@
1
+ <p align="center">
2
+ <img src="assets/brand/taphound-mark.svg" width="128" alt="TapHound HoundMark">
3
+ </p>
4
+
5
+ # TapHound
6
+
7
+ English | [简体中文](./README.zh-CN.md)
8
+
9
+ > Follow every tap. Catch every regression.
10
+
11
+ TapHound is a TypeScript/Node.js CLI for recording, generating, and deterministically verifying app journeys. The current development release, TapHound for Android, supports recording native Android workflows and AI-agent-driven journey generation based on a Project Context and live device state.
12
+
13
+ The TapHound Journey is a purpose-built JSON protocol with its own recorder, generation, replay, and assertion model. It is distinct from and incompatible with the Android CLI's official Journey concept. TapHound Core never invokes AI models: external agents may analyze source code and propose actions, but state binding, risk confirmation, device execution, final replay, and assertions are all handled deterministically by TapHound.
14
+
15
+ TapHound only handles verification. Compiling and installing the APK are independent prerequisites, handled by the developer or AI agent in a separate loop:
16
+
17
+ ```
18
+ edit code → build APK → install to device → taphound verify → loop until passing
19
+ ```
20
+
21
+ ## Requirements
22
+
23
+ - Node.js 22 or newer
24
+ - Android SDK, ADB, and an online device or emulator
25
+ - Target APK already installed on the device (TapHound does not build or install)
26
+ - The `android` CLI available on PATH
27
+ - On macOS, grant Android CLI the required Accessibility and Screen Recording permissions
28
+
29
+ Run environment diagnostics first:
30
+
31
+ ```bash
32
+ taphound doctor --project /path/to/android-project
33
+ ```
34
+
35
+ When `--device` is omitted, exactly one device with status `device` must be connected; use `--device <serial>` to select among multiple devices.
36
+
37
+ ## Installation and Local Development
38
+
39
+ Install from source:
40
+
41
+ ```bash
42
+ npm ci
43
+ npm run build
44
+ npm link
45
+ taphound --help
46
+ ```
47
+
48
+ Full local quality gate:
49
+
50
+ ```bash
51
+ npm test
52
+ npm run typecheck
53
+ npm run lint
54
+ npm run build
55
+ npm run brand:render
56
+ git diff --exit-code -- assets/brand/png
57
+ ```
58
+
59
+ See the [local testing guide](docs/local-testing.md) for source, npm tarball, and Android device validation steps. When switching dev machines, follow the [machine handoff TODO](TODO.md) to track remaining acceptance and npm `dev` pre-release.
60
+
61
+ ## CLI Commands
62
+
63
+ - `doctor`: checks Node.js, ADB, Android CLI, app installation, permissions, and device.
64
+ - `record`: interactively execute actions and record a Journey.
65
+ - `verify`: deterministically replay a Journey and publish a report.
66
+ - `project describe`: output stable Android project facts.
67
+ - `context validate` / `context status`: validate or check a Project Context.
68
+ - `generation start` / `observe` / `step` / `confirm` / `manual` / `finalize`: manage deterministic Journey generation sessions.
69
+ - `init`: install the TapHound AI Journey Skill for AI agents.
70
+
71
+ ## Configuration
72
+
73
+ Create a `taphound.config.json` in the Android project. `run.packageName` is required and never guessed from APK filenames or activities; see [`examples/taphound.config.json`](examples/taphound.config.json) for a complete example.
74
+
75
+ ```json
76
+ {
77
+ "version": 1,
78
+ "run": {
79
+ "packageName": "com.example.app",
80
+ "activity": ".MainActivity"
81
+ },
82
+ "idle": {
83
+ "pollIntervalMs": 200,
84
+ "stablePolls": 2,
85
+ "timeoutMs": 5000
86
+ },
87
+ "artifactsDir": ".taphound/runs"
88
+ }
89
+ ```
90
+
91
+ ## Interactive Recording
92
+
93
+ The TapHound Recorder displays the current layout, lets you choose an action and target, and executes it through ADB. It does not listen for arbitrary touch events. Each successful step automatically records `activity.before` and `activity.after`; failed steps are not added to the Journey; the complete file is written atomically only after you choose Finish.
94
+
95
+ ```bash
96
+ taphound record \
97
+ --project /path/to/android-project \
98
+ --config taphound.config.json \
99
+ --name "Search flow" \
100
+ --output journeys/search.json
101
+ ```
102
+
103
+ The Recorder does not auto-generate business `expect` assertions. Activity, Element, or Logcat assertions should be added explicitly by developers or external agents. See [Journey Schema](docs/journey-schema.md) for protocol details.
104
+
105
+ Supported actions include `click`, `longClick`, `inputText`, `swipe`, `scrollTo`, `back`, and `wait`. `scrollTo` swipes within a deterministic `container` up to `maxSwipes` times, stopping once the target `locator` resolves uniquely without clicking it.
106
+
107
+ ## Agent-Driven Journey Generation
108
+
109
+ The repository ships a [`taphound-ai-journey` Skill](assets/skills/taphound-ai-journey/SKILL.md) that guides agents such as Droid, Claude Code, Copilot, and Cursor:
110
+
111
+ 1. Use `project describe` and the Android project source to generate a Project Context with evidence hashes.
112
+ 2. Use `context validate` / `context status` to check Context validity and freshness.
113
+ 3. Start a `generation` session, iteratively observe authoritative device state, propose strict steps, and let TapHound execute them.
114
+ 4. Use `generation finalize` to replay from the initial state and publish the Journey only after verification passes.
115
+
116
+ ```bash
117
+ taphound generation start \
118
+ --project /path/to/android-project \
119
+ --context .taphound/context/project-context.json \
120
+ --device emulator-5554 \
121
+ --json
122
+ ```
123
+
124
+ The device is bound at `generation start`; subsequent `observe`, `step`, `confirm`, and `manual` commands use that binding via the session. See the Skill's [`GUIDE.md`](assets/skills/taphound-ai-journey/GUIDE.md) for the full workflow.
125
+
126
+ ### Installing the Skill for Other AI Agents
127
+
128
+ `taphound init` copies the TapHound AI Journey Skill into each agent's Skill directory. Interactively select at least one agent:
129
+
130
+ ```bash
131
+ taphound init
132
+ ```
133
+
134
+ Non-interactive mode:
135
+
136
+ ```bash
137
+ taphound init --agent claude,codex,cursor,droid
138
+ ```
139
+
140
+ Global install (user-level directory):
141
+
142
+ ```bash
143
+ taphound init --agent claude --global
144
+ ```
145
+
146
+ Supported agents and paths:
147
+
148
+ | Agent | Project-level path | User-level path |
149
+ |---|---|---|
150
+ | Claude Code | `.claude/skills/` | `~/.claude/skills/` |
151
+ | Codex | `.agents/skills/` | `~/.agents/skills/` |
152
+ | Cursor | `.cursor/skills/` | `~/.cursor/skills/` |
153
+ | Droid | `.factory/skills/` | `~/.factory/skills/` |
154
+ | Other | `.agents/skills/` | `~/.agents/skills/` |
155
+
156
+ The Skill is published with the npm package; `taphound init` copies it from the package to the target directory. Re-running `init` overwrites existing Skill files.
157
+
158
+ ## Deterministic Verification
159
+
160
+ ```bash
161
+ taphound verify \
162
+ --project /path/to/android-project \
163
+ --config taphound.config.json \
164
+ --journey journeys/search.json
165
+ ```
166
+
167
+ Temporarily override package, activity, device, or report path:
168
+
169
+ ```bash
170
+ taphound verify \
171
+ --project /path/to/android-project \
172
+ --journey journeys/search.json \
173
+ --device emulator-5554 \
174
+ --package com.example.app \
175
+ --activity .MainActivity \
176
+ --reports /tmp/taphound-runs
177
+ ```
178
+
179
+ For agent invocations:
180
+
181
+ ```bash
182
+ taphound verify --project . --journey journeys/search.json --json
183
+ ```
184
+
185
+ `--json` mode guarantees exactly one final JSON value on stdout; progress and diagnostics go to stderr. See [Agent Integration](docs/agent-integration.md) and [Report Schema](docs/report-schema.md).
186
+
187
+ ## Reports
188
+
189
+ Each verification writes to an independent directory, always containing `report.json` and `summary.txt`, with step logs provided based on actual execution. A final screenshot and full Logcat are collected on a best-effort basis. The original verification failure is preserved in `primaryFailure`; screenshot or logcat collection issues go into `secondaryErrors` and never overwrite the original failure; corresponding optional artifacts may be missing.
190
+
191
+ ## Current Limitations
192
+
193
+ - Only Android is supported, with a single explicitly selected device.
194
+ - TapHound does not build or install the APK. It assumes the target app is already installed. Building and installing are done independently by the developer or AI agent in the verification loop.
195
+ - The Recorder is a TapHound-mediated interaction flow; it does not observe arbitrary user touches on the device.
196
+ - The Recorder only provides swipe for scrollable elements that have bounds from the Android CLI; Replay does not guess swipe regions for elements missing bounds.
197
+ - Annotated screenshot fallback applies only to `click` and `longClick`, and requires an explicitly saved `#label`.
198
+ - Replay, device operations, and assertions are fully deterministic, with no AI or visual inference.
199
+ - The repository provides an Agent Skill installable via `taphound init` for other agents, but there is no dedicated SubAgent wrapper yet.
200
+ - Regular tests do not require a real device; Replay and Generation device acceptance requires explicitly setting `TAPHOUND_ACCEPTANCE_DEVICE=1` and meeting external Android prerequisites.
@@ -0,0 +1,200 @@
1
+ <p align="center">
2
+ <img src="assets/brand/taphound-mark.svg" width="128" alt="TapHound HoundMark">
3
+ </p>
4
+
5
+ # TapHound
6
+
7
+ [English](./README.md) | 简体中文
8
+
9
+ > Follow every tap. Catch every regression.
10
+
11
+ TapHound 是一个用于 App Journey 录制、生成与确定性验证的 TypeScript/Node.js CLI。当前开发版本 TapHound for Android 支持录制原生 Android 工作流,也支持外部 Agent 基于 Project Context 和实时设备状态生成 Journey。
12
+
13
+ TapHound Journey 是本项目完全自研的 JSON 协议、Recorder、Generation、Replay 与断言模型,与 Android CLI 官方 Journey 概念不同且不兼容。TapHound Core 不调用模型:外部 Agent 可以分析源码并提出操作,但状态绑定、风险确认、设备执行、最终 Replay 与断言均由 TapHound 确定性完成。
14
+
15
+ TapHound 只负责验证。编译和安装 APK 是独立的前置步骤,由开发者或 AI Agent 在验证循环中完成:
16
+
17
+ ```
18
+ 修改代码 → 编译 APK → 安装到设备 → taphound verify → 循环直到符合预期
19
+ ```
20
+
21
+ ## 环境要求
22
+
23
+ - Node.js 22 或更高版本
24
+ - Android SDK、ADB 和一个在线设备或模拟器
25
+ - 目标 APK 已安装到设备(TapHound 不负责编译或安装)
26
+ - 可调用的 `android` CLI
27
+ - macOS 上授予 Android CLI 所需的辅助功能、屏幕录制等权限
28
+
29
+ 先执行环境诊断:
30
+
31
+ ```bash
32
+ taphound doctor --project /path/to/android-project
33
+ ```
34
+
35
+ 未指定 `--device` 时必须恰好有一个状态为 `device` 的设备;存在多个设备时用 `--device <serial>` 明确选择。
36
+
37
+ ## 安装与本地开发
38
+
39
+ 当前版本可从源码安装:
40
+
41
+ ```bash
42
+ npm ci
43
+ npm run build
44
+ npm link
45
+ taphound --help
46
+ ```
47
+
48
+ 完整本地质量门:
49
+
50
+ ```bash
51
+ npm test
52
+ npm run typecheck
53
+ npm run lint
54
+ npm run build
55
+ npm run brand:render
56
+ git diff --exit-code -- assets/brand/png
57
+ ```
58
+
59
+ 完整的源码、npm tarball 与 Android 设备验证步骤见[本地测试指南](docs/local-testing.md)。更换开发机器时按[换机后 TODO](TODO.md)继续跟踪剩余验收与 npm `dev` 预发布。
60
+
61
+ ## CLI 命令
62
+
63
+ - `doctor`:检查 Node.js、ADB、Android CLI、应用安装、权限和设备。
64
+ - `record`:交互式执行操作并录制 Journey。
65
+ - `verify`:确定性重放 Journey 并发布报告。
66
+ - `project describe`:输出稳定的 Android 项目事实。
67
+ - `context validate` / `context status`:校验或检查 Project Context。
68
+ - `generation start` / `observe` / `step` / `confirm` / `manual` / `finalize`:管理确定性 Journey 生成会话。
69
+ - `init`:为 AI Agent 安装 TapHound AI Journey Skill。
70
+
71
+ ## 配置
72
+
73
+ 在 Android 项目中创建 `taphound.config.json`。`run.packageName` 必填,不会从 APK 文件名或 Activity 猜测;完整示例见 [`examples/taphound.config.json`](examples/taphound.config.json)。
74
+
75
+ ```json
76
+ {
77
+ "version": 1,
78
+ "run": {
79
+ "packageName": "com.example.app",
80
+ "activity": ".MainActivity"
81
+ },
82
+ "idle": {
83
+ "pollIntervalMs": 200,
84
+ "stablePolls": 2,
85
+ "timeoutMs": 5000
86
+ },
87
+ "artifactsDir": ".taphound/runs"
88
+ }
89
+ ```
90
+
91
+ ## 交互式录制
92
+
93
+ TapHound Recorder 展示当前 Layout,让用户选择 Action 和目标,然后由 TapHound 自己通过 ADB 执行操作。它不监听任意触摸。每个成功步骤自动记录 `activity.before` 与 `activity.after`;失败步骤不会加入 Journey;只有选择 Finish 后才原子写入完整文件。
94
+
95
+ ```bash
96
+ taphound record \
97
+ --project /path/to/android-project \
98
+ --config taphound.config.json \
99
+ --name "Search flow" \
100
+ --output journeys/search.json
101
+ ```
102
+
103
+ Recorder 不自动生成业务 `expect`。Activity、Element 或 Logcat 断言应由开发者或外部 Agent 显式补充。协议细节见 [Journey Schema](docs/journey-schema.md)。
104
+
105
+ 支持的 Action 包括 `click`、`longClick`、`inputText`、`swipe`、`scrollTo`、`back` 和 `wait`。`scrollTo` 在确定的 `container` 中最多滑动 `maxSwipes` 次,目标 `locator` 唯一解析成功后停止,不会继续点击目标。
106
+
107
+ ## Agent 驱动的 Journey 生成
108
+
109
+ 源码仓库提供 [`taphound-ai-journey` Skill](assets/skills/taphound-ai-journey/SKILL.md),指导 Droid、Claude Code、Copilot、Cursor 等 Agent:
110
+
111
+ 1. 使用 `project describe` 和 Android 项目源码生成带证据哈希的 Project Context。
112
+ 2. 使用 `context validate` / `context status` 检查 Context 的有效性和时效性。
113
+ 3. 启动 `generation` 会话,循环观察权威设备状态、提出严格步骤并交由 TapHound 执行。
114
+ 4. 使用 `generation finalize` 从初始状态完整 Replay,并仅在验证通过后发布 Journey。
115
+
116
+ ```bash
117
+ taphound generation start \
118
+ --project /path/to/android-project \
119
+ --context .taphound/context/project-context.json \
120
+ --device emulator-5554 \
121
+ --json
122
+ ```
123
+
124
+ 设备在 `generation start` 时绑定,后续 `observe`、`step`、`confirm` 和 `manual` 命令通过 session 使用该绑定。完整流程见 Skill 的 [`GUIDE.md`](assets/skills/taphound-ai-journey/GUIDE.md)。
125
+
126
+ ### 为其他 AI Agent 安装 Skill
127
+
128
+ `taphound init` 将 TapHound AI Journey Skill 复制到各 Agent 的 Skill 目录。交互式多选至少选择一个 Agent:
129
+
130
+ ```bash
131
+ taphound init
132
+ ```
133
+
134
+ 非交互模式:
135
+
136
+ ```bash
137
+ taphound init --agent claude,codex,cursor,droid
138
+ ```
139
+
140
+ 全局安装(用户级目录):
141
+
142
+ ```bash
143
+ taphound init --agent claude --global
144
+ ```
145
+
146
+ 支持的 Agent 及路径:
147
+
148
+ | Agent | 项目级路径 | 用户级路径 |
149
+ |---|---|---|
150
+ | Claude Code | `.claude/skills/` | `~/.claude/skills/` |
151
+ | Codex | `.agents/skills/` | `~/.agents/skills/` |
152
+ | Cursor | `.cursor/skills/` | `~/.cursor/skills/` |
153
+ | Droid | `.factory/skills/` | `~/.factory/skills/` |
154
+ | Other | `.agents/skills/` | `~/.agents/skills/` |
155
+
156
+ Skill 随 npm 包发布,`taphound init` 从包内复制到目标目录。重新运行 `init` 会覆盖已有 Skill 文件。
157
+
158
+ ## 确定性验证
159
+
160
+ ```bash
161
+ taphound verify \
162
+ --project /path/to/android-project \
163
+ --config taphound.config.json \
164
+ --journey journeys/search.json
165
+ ```
166
+
167
+ 临时覆盖 Package、Activity、设备或报告路径:
168
+
169
+ ```bash
170
+ taphound verify \
171
+ --project /path/to/android-project \
172
+ --journey journeys/search.json \
173
+ --device emulator-5554 \
174
+ --package com.example.app \
175
+ --activity .MainActivity \
176
+ --reports /tmp/taphound-runs
177
+ ```
178
+
179
+ Agent 调用时使用:
180
+
181
+ ```bash
182
+ taphound verify --project . --journey journeys/search.json --json
183
+ ```
184
+
185
+ `--json` 模式保证 stdout 只有一个最终 JSON 值,进度和诊断写入 stderr。详见 [Agent 集成](docs/agent-integration.md) 与 [报告协议](docs/report-schema.md)。
186
+
187
+ ## 报告
188
+
189
+ 每次验证写入独立目录,固定包含 `report.json` 与 `summary.txt`,按实际执行结果提供步骤日志,并尽力采集最终截图和完整 Logcat。原始验证失败保存在 `primaryFailure`;截图或日志采集问题进入 `secondaryErrors`,不会覆盖原始失败,对应可选产物也可能缺失。
190
+
191
+ ## 当前限制
192
+
193
+ - 只支持 Android 与单个明确选择的设备。
194
+ - TapHound 不负责编译或安装 APK,假设目标应用已安装到设备。编译和安装由开发者或 AI Agent 在验证循环中独立完成。
195
+ - Recorder 是 TapHound 介导的交互流程,不观察用户在设备上的任意触摸。
196
+ - Recorder 只为 Android CLI 返回了 bounds 的 scrollable 元素提供 swipe;Replay 不会为缺失 bounds 的元素猜测滑动区域。
197
+ - 标注截图回退只适用于 click 与 longClick,且必须显式保存 `#编号`。
198
+ - Replay、设备操作和断言完全确定性,不包含 AI 或视觉推理。
199
+ - 源码仓库提供 Agent Skill,也可通过 `taphound init` 为其他 Agent 安装,但尚无专用 SubAgent 封装。
200
+ - 普通测试不要求真实设备;Replay 与 Generation 真机验收需要显式设置 `TAPHOUND_ACCEPTANCE_DEVICE=1` 并满足外部 Android 前提。
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg"
2
+ viewBox="0 0 1024 1024"
3
+ role="img"
4
+ aria-labelledby="title">
5
+ <title id="title">TapHound HoundMark</title>
6
+ <path fill="#1B1D21" fill-rule="evenodd" clip-rule="evenodd" d="M228 702 350 582c31-31 40-59 36-90-6-50-42-81-86-100 45-20 77-47 112-80 40 6 79 26 104 62 16 21 37 31 64 34l70 13c10 2 15 11 12 22-8 35-29 57-60 68l-49 16c-29 9-49 29-62 58l-56 121H228Zm165-355c28 22 48 50 48 80-1 34-19 60-49 72 14-30 16-60 7-87-9-28-19-45-6-65Z"/>
7
+ <circle cx="755" cy="443" r="24" fill="#FF5A1F"/>
8
+ <path fill="#FF5A1F" d="M760 359a84 84 0 0 1 84 84 84 84 0 0 1-84 84v-30a54 54 0 0 0 54-54 54 54 0 0 0-54-54v-30Z"/>
9
+ </svg>