aw-ecc 1.4.32 → 1.4.47

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 (258) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex/hooks/aw-post-tool-use.sh +8 -2
  3. package/.codex/hooks/aw-session-start.sh +11 -4
  4. package/.codex/hooks/aw-stop.sh +8 -2
  5. package/.codex/hooks/aw-user-prompt-submit.sh +10 -2
  6. package/.codex/hooks.json +8 -8
  7. package/.cursor/INSTALL.md +7 -5
  8. package/.cursor/hooks/adapter.js +41 -4
  9. package/.cursor/hooks/after-agent-response.js +62 -0
  10. package/.cursor/hooks/before-submit-prompt.js +7 -1
  11. package/.cursor/hooks/post-tool-use-failure.js +21 -0
  12. package/.cursor/hooks/post-tool-use.js +39 -0
  13. package/.cursor/hooks/shared/aw-phase-definitions.js +53 -0
  14. package/.cursor/hooks/shared/aw-phase-runner.js +3 -1
  15. package/.cursor/hooks/subagent-start.js +22 -4
  16. package/.cursor/hooks/subagent-stop.js +18 -1
  17. package/.cursor/hooks.json +23 -2
  18. package/.opencode/package.json +1 -1
  19. package/AGENTS.md +3 -3
  20. package/README.md +5 -5
  21. package/commands/adk.md +52 -0
  22. package/commands/build.md +22 -9
  23. package/commands/deploy.md +12 -0
  24. package/commands/execute.md +9 -0
  25. package/commands/feature.md +333 -0
  26. package/commands/investigate.md +18 -5
  27. package/commands/plan.md +23 -9
  28. package/commands/publish.md +65 -0
  29. package/commands/review.md +12 -0
  30. package/commands/ship.md +12 -0
  31. package/commands/test.md +12 -0
  32. package/commands/verify.md +9 -0
  33. package/hooks/hooks.json +36 -0
  34. package/manifests/install-components.json +8 -0
  35. package/manifests/install-modules.json +83 -0
  36. package/manifests/install-profiles.json +7 -0
  37. package/package.json +1 -1
  38. package/scripts/ci/validate-rules.js +51 -0
  39. package/scripts/cursor-aw-home/hooks.json +23 -2
  40. package/scripts/cursor-aw-hooks/adapter.js +41 -4
  41. package/scripts/cursor-aw-hooks/before-submit-prompt.js +7 -1
  42. package/scripts/hooks/aw-usage-commit-created.js +32 -0
  43. package/scripts/hooks/aw-usage-post-tool-use-failure.js +56 -0
  44. package/scripts/hooks/aw-usage-post-tool-use.js +242 -0
  45. package/scripts/hooks/aw-usage-prompt-submit.js +112 -0
  46. package/scripts/hooks/aw-usage-session-start.js +48 -0
  47. package/scripts/hooks/aw-usage-stop.js +182 -0
  48. package/scripts/hooks/aw-usage-telemetry-send.js +84 -0
  49. package/scripts/hooks/cost-tracker.js +3 -23
  50. package/scripts/hooks/shared/aw-phase-definitions.js +53 -0
  51. package/scripts/hooks/shared/aw-phase-runner.js +3 -1
  52. package/scripts/lib/aw-hook-contract.js +2 -2
  53. package/scripts/lib/aw-pricing.js +306 -0
  54. package/scripts/lib/aw-usage-telemetry.js +472 -0
  55. package/scripts/lib/codex-hook-config.js +8 -8
  56. package/scripts/lib/cursor-hook-config.js +25 -10
  57. package/scripts/lib/install-targets/cursor-project.js +3 -0
  58. package/scripts/lib/install-targets/helpers.js +20 -3
  59. package/skills/aw-adk/SKILL.md +317 -0
  60. package/skills/aw-adk/agents/analyzer.md +113 -0
  61. package/skills/aw-adk/agents/comparator.md +113 -0
  62. package/skills/aw-adk/agents/grader.md +115 -0
  63. package/skills/aw-adk/assets/eval_review.html +76 -0
  64. package/skills/aw-adk/eval-viewer/generate_review.py +164 -0
  65. package/skills/aw-adk/eval-viewer/viewer.html +181 -0
  66. package/skills/aw-adk/evals/eval-colocated-placement.md +84 -0
  67. package/skills/aw-adk/evals/eval-create-agent.md +90 -0
  68. package/skills/aw-adk/evals/eval-create-command.md +98 -0
  69. package/skills/aw-adk/evals/eval-create-eval.md +89 -0
  70. package/skills/aw-adk/evals/eval-create-rule.md +99 -0
  71. package/skills/aw-adk/evals/eval-create-skill.md +97 -0
  72. package/skills/aw-adk/evals/eval-delete-agent.md +79 -0
  73. package/skills/aw-adk/evals/eval-delete-command.md +89 -0
  74. package/skills/aw-adk/evals/eval-delete-rule.md +86 -0
  75. package/skills/aw-adk/evals/eval-delete-skill.md +90 -0
  76. package/skills/aw-adk/evals/eval-meta-eval-coverage.md +78 -0
  77. package/skills/aw-adk/evals/eval-meta-eval-determinism.md +81 -0
  78. package/skills/aw-adk/evals/eval-meta-eval-false-pass.md +81 -0
  79. package/skills/aw-adk/evals/eval-score-accuracy.md +95 -0
  80. package/skills/aw-adk/evals/eval-type-redirect.md +68 -0
  81. package/skills/aw-adk/evals/evals.json +96 -0
  82. package/skills/aw-adk/references/artifact-wiring.md +162 -0
  83. package/skills/aw-adk/references/cross-ide-mapping.md +71 -0
  84. package/skills/aw-adk/references/eval-placement-guide.md +183 -0
  85. package/skills/aw-adk/references/external-resources.md +75 -0
  86. package/skills/aw-adk/references/getting-started.md +66 -0
  87. package/skills/aw-adk/references/registry-structure.md +152 -0
  88. package/skills/aw-adk/references/rubric-agent.md +36 -0
  89. package/skills/aw-adk/references/rubric-command.md +36 -0
  90. package/skills/aw-adk/references/rubric-eval.md +36 -0
  91. package/skills/aw-adk/references/rubric-meta-eval.md +132 -0
  92. package/skills/aw-adk/references/rubric-rule.md +36 -0
  93. package/skills/aw-adk/references/rubric-skill.md +36 -0
  94. package/skills/aw-adk/references/schemas.md +222 -0
  95. package/skills/aw-adk/references/template-agent.md +251 -0
  96. package/skills/aw-adk/references/template-command.md +279 -0
  97. package/skills/aw-adk/references/template-eval.md +176 -0
  98. package/skills/aw-adk/references/template-rule.md +119 -0
  99. package/skills/aw-adk/references/template-skill.md +123 -0
  100. package/skills/aw-adk/references/type-classifier.md +98 -0
  101. package/skills/aw-adk/references/writing-good-agents.md +227 -0
  102. package/skills/aw-adk/references/writing-good-commands.md +258 -0
  103. package/skills/aw-adk/references/writing-good-evals.md +271 -0
  104. package/skills/aw-adk/references/writing-good-rules.md +214 -0
  105. package/skills/aw-adk/references/writing-good-skills.md +159 -0
  106. package/skills/aw-adk/scripts/aggregate-benchmark.py +190 -0
  107. package/skills/aw-adk/scripts/lint-artifact.sh +211 -0
  108. package/skills/aw-adk/scripts/score-artifact.sh +179 -0
  109. package/skills/aw-adk/scripts/trigger-eval.py +192 -0
  110. package/skills/aw-build/SKILL.md +19 -2
  111. package/skills/aw-deploy/SKILL.md +65 -3
  112. package/skills/aw-design/SKILL.md +156 -0
  113. package/skills/aw-design/references/highrise-tokens.md +394 -0
  114. package/skills/aw-design/references/micro-interactions.md +76 -0
  115. package/skills/aw-design/references/prompt-template.md +160 -0
  116. package/skills/aw-design/references/quality-checklist.md +70 -0
  117. package/skills/aw-design/references/self-review.md +497 -0
  118. package/skills/aw-design/references/stitch-workflow.md +127 -0
  119. package/skills/aw-feature/SKILL.md +293 -0
  120. package/skills/aw-investigate/SKILL.md +17 -0
  121. package/skills/aw-plan/SKILL.md +34 -3
  122. package/skills/aw-publish/SKILL.md +300 -0
  123. package/skills/aw-publish/evals/eval-confirmation-gate.md +60 -0
  124. package/skills/aw-publish/evals/eval-intent-detection.md +111 -0
  125. package/skills/aw-publish/evals/eval-push-modes.md +67 -0
  126. package/skills/aw-publish/evals/eval-rules-push.md +60 -0
  127. package/skills/aw-publish/evals/evals.json +29 -0
  128. package/skills/aw-publish/references/push-modes.md +38 -0
  129. package/skills/aw-review/SKILL.md +88 -9
  130. package/skills/aw-rules-review/SKILL.md +124 -0
  131. package/skills/aw-rules-review/agents/openai.yaml +3 -0
  132. package/skills/aw-rules-review/scripts/generate-review-template.mjs +323 -0
  133. package/skills/aw-ship/SKILL.md +16 -0
  134. package/skills/aw-spec/SKILL.md +15 -0
  135. package/skills/aw-tasks/SKILL.md +15 -0
  136. package/skills/aw-test/SKILL.md +16 -0
  137. package/skills/aw-yolo/SKILL.md +4 -0
  138. package/skills/diagnose/SKILL.md +121 -0
  139. package/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
  140. package/skills/finish-only-when-green/SKILL.md +265 -0
  141. package/skills/grill-me/SKILL.md +24 -0
  142. package/skills/grill-with-docs/SKILL.md +92 -0
  143. package/skills/grill-with-docs/adr-format.md +47 -0
  144. package/skills/grill-with-docs/context-format.md +67 -0
  145. package/skills/improve-codebase-architecture/SKILL.md +75 -0
  146. package/skills/improve-codebase-architecture/deepening.md +37 -0
  147. package/skills/improve-codebase-architecture/interface-design.md +44 -0
  148. package/skills/improve-codebase-architecture/language.md +53 -0
  149. package/skills/local-ghl-setup-from-screenshot/SKILL.md +538 -0
  150. package/skills/tdd/SKILL.md +115 -0
  151. package/skills/tdd/deep-modules.md +33 -0
  152. package/skills/tdd/interface-design.md +31 -0
  153. package/skills/tdd/mocking.md +59 -0
  154. package/skills/tdd/refactoring.md +10 -0
  155. package/skills/tdd/tests.md +61 -0
  156. package/skills/to-issues/SKILL.md +62 -0
  157. package/skills/to-prd/SKILL.md +75 -0
  158. package/skills/using-aw-skills/SKILL.md +170 -237
  159. package/skills/using-aw-skills/hooks/session-start.sh +11 -41
  160. package/skills/zoom-out/SKILL.md +24 -0
  161. package/.cursor/rules/common-agents.md +0 -53
  162. package/.cursor/rules/common-aw-routing.md +0 -43
  163. package/.cursor/rules/common-coding-style.md +0 -52
  164. package/.cursor/rules/common-development-workflow.md +0 -33
  165. package/.cursor/rules/common-git-workflow.md +0 -28
  166. package/.cursor/rules/common-hooks.md +0 -34
  167. package/.cursor/rules/common-patterns.md +0 -35
  168. package/.cursor/rules/common-performance.md +0 -59
  169. package/.cursor/rules/common-security.md +0 -33
  170. package/.cursor/rules/common-testing.md +0 -33
  171. package/.cursor/skills/api-and-interface-design/SKILL.md +0 -75
  172. package/.cursor/skills/article-writing/SKILL.md +0 -85
  173. package/.cursor/skills/aw-brainstorm/SKILL.md +0 -115
  174. package/.cursor/skills/aw-build/SKILL.md +0 -152
  175. package/.cursor/skills/aw-build/evals/build-stage-cases.json +0 -28
  176. package/.cursor/skills/aw-debug/SKILL.md +0 -49
  177. package/.cursor/skills/aw-deploy/SKILL.md +0 -101
  178. package/.cursor/skills/aw-deploy/evals/deploy-stage-cases.json +0 -32
  179. package/.cursor/skills/aw-execute/SKILL.md +0 -47
  180. package/.cursor/skills/aw-execute/references/mode-code.md +0 -47
  181. package/.cursor/skills/aw-execute/references/mode-docs.md +0 -28
  182. package/.cursor/skills/aw-execute/references/mode-infra.md +0 -44
  183. package/.cursor/skills/aw-execute/references/mode-migration.md +0 -58
  184. package/.cursor/skills/aw-execute/references/worker-implementer.md +0 -26
  185. package/.cursor/skills/aw-execute/references/worker-parallel-worker.md +0 -23
  186. package/.cursor/skills/aw-execute/references/worker-quality-reviewer.md +0 -23
  187. package/.cursor/skills/aw-execute/references/worker-spec-reviewer.md +0 -23
  188. package/.cursor/skills/aw-execute/scripts/build-worker-bundle.js +0 -229
  189. package/.cursor/skills/aw-finish/SKILL.md +0 -111
  190. package/.cursor/skills/aw-investigate/SKILL.md +0 -109
  191. package/.cursor/skills/aw-plan/SKILL.md +0 -368
  192. package/.cursor/skills/aw-prepare/SKILL.md +0 -118
  193. package/.cursor/skills/aw-review/SKILL.md +0 -118
  194. package/.cursor/skills/aw-ship/SKILL.md +0 -115
  195. package/.cursor/skills/aw-spec/SKILL.md +0 -104
  196. package/.cursor/skills/aw-tasks/SKILL.md +0 -138
  197. package/.cursor/skills/aw-test/SKILL.md +0 -118
  198. package/.cursor/skills/aw-verify/SKILL.md +0 -51
  199. package/.cursor/skills/aw-yolo/SKILL.md +0 -111
  200. package/.cursor/skills/browser-testing-with-devtools/SKILL.md +0 -81
  201. package/.cursor/skills/bun-runtime/SKILL.md +0 -84
  202. package/.cursor/skills/ci-cd-and-automation/SKILL.md +0 -71
  203. package/.cursor/skills/code-simplification/SKILL.md +0 -74
  204. package/.cursor/skills/content-engine/SKILL.md +0 -88
  205. package/.cursor/skills/context-engineering/SKILL.md +0 -74
  206. package/.cursor/skills/deprecation-and-migration/SKILL.md +0 -75
  207. package/.cursor/skills/documentation-and-adrs/SKILL.md +0 -75
  208. package/.cursor/skills/documentation-lookup/SKILL.md +0 -90
  209. package/.cursor/skills/frontend-slides/SKILL.md +0 -184
  210. package/.cursor/skills/frontend-slides/STYLE_PRESETS.md +0 -330
  211. package/.cursor/skills/frontend-ui-engineering/SKILL.md +0 -68
  212. package/.cursor/skills/git-workflow-and-versioning/SKILL.md +0 -75
  213. package/.cursor/skills/idea-refine/SKILL.md +0 -84
  214. package/.cursor/skills/incremental-implementation/SKILL.md +0 -75
  215. package/.cursor/skills/investor-materials/SKILL.md +0 -96
  216. package/.cursor/skills/investor-outreach/SKILL.md +0 -76
  217. package/.cursor/skills/market-research/SKILL.md +0 -75
  218. package/.cursor/skills/mcp-server-patterns/SKILL.md +0 -67
  219. package/.cursor/skills/nextjs-turbopack/SKILL.md +0 -44
  220. package/.cursor/skills/performance-optimization/SKILL.md +0 -77
  221. package/.cursor/skills/security-and-hardening/SKILL.md +0 -70
  222. package/.cursor/skills/using-aw-skills/SKILL.md +0 -290
  223. package/.cursor/skills/using-aw-skills/evals/skill-trigger-cases.tsv +0 -25
  224. package/.cursor/skills/using-aw-skills/evals/test-skill-triggers.sh +0 -171
  225. package/.cursor/skills/using-aw-skills/hooks/hooks.json +0 -9
  226. package/.cursor/skills/using-aw-skills/hooks/session-start.sh +0 -67
  227. package/.cursor/skills/using-platform-skills/SKILL.md +0 -163
  228. package/.cursor/skills/using-platform-skills/evals/platform-selection-cases.json +0 -52
  229. /package/.cursor/rules/{golang-coding-style.md → golang-coding-style.mdc} +0 -0
  230. /package/.cursor/rules/{golang-hooks.md → golang-hooks.mdc} +0 -0
  231. /package/.cursor/rules/{golang-patterns.md → golang-patterns.mdc} +0 -0
  232. /package/.cursor/rules/{golang-security.md → golang-security.mdc} +0 -0
  233. /package/.cursor/rules/{golang-testing.md → golang-testing.mdc} +0 -0
  234. /package/.cursor/rules/{kotlin-coding-style.md → kotlin-coding-style.mdc} +0 -0
  235. /package/.cursor/rules/{kotlin-hooks.md → kotlin-hooks.mdc} +0 -0
  236. /package/.cursor/rules/{kotlin-patterns.md → kotlin-patterns.mdc} +0 -0
  237. /package/.cursor/rules/{kotlin-security.md → kotlin-security.mdc} +0 -0
  238. /package/.cursor/rules/{kotlin-testing.md → kotlin-testing.mdc} +0 -0
  239. /package/.cursor/rules/{php-coding-style.md → php-coding-style.mdc} +0 -0
  240. /package/.cursor/rules/{php-hooks.md → php-hooks.mdc} +0 -0
  241. /package/.cursor/rules/{php-patterns.md → php-patterns.mdc} +0 -0
  242. /package/.cursor/rules/{php-security.md → php-security.mdc} +0 -0
  243. /package/.cursor/rules/{php-testing.md → php-testing.mdc} +0 -0
  244. /package/.cursor/rules/{python-coding-style.md → python-coding-style.mdc} +0 -0
  245. /package/.cursor/rules/{python-hooks.md → python-hooks.mdc} +0 -0
  246. /package/.cursor/rules/{python-patterns.md → python-patterns.mdc} +0 -0
  247. /package/.cursor/rules/{python-security.md → python-security.mdc} +0 -0
  248. /package/.cursor/rules/{python-testing.md → python-testing.mdc} +0 -0
  249. /package/.cursor/rules/{swift-coding-style.md → swift-coding-style.mdc} +0 -0
  250. /package/.cursor/rules/{swift-hooks.md → swift-hooks.mdc} +0 -0
  251. /package/.cursor/rules/{swift-patterns.md → swift-patterns.mdc} +0 -0
  252. /package/.cursor/rules/{swift-security.md → swift-security.mdc} +0 -0
  253. /package/.cursor/rules/{swift-testing.md → swift-testing.mdc} +0 -0
  254. /package/.cursor/rules/{typescript-coding-style.md → typescript-coding-style.mdc} +0 -0
  255. /package/.cursor/rules/{typescript-hooks.md → typescript-hooks.mdc} +0 -0
  256. /package/.cursor/rules/{typescript-patterns.md → typescript-patterns.mdc} +0 -0
  257. /package/.cursor/rules/{typescript-security.md → typescript-security.mdc} +0 -0
  258. /package/.cursor/rules/{typescript-testing.md → typescript-testing.mdc} +0 -0
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: aw:publish
3
+ description: "Publish locally created/modified CASRE artifacts to the remote platform-docs registry via PR. Intent-based — triggers on 'push', 'publish', 'sync to registry', 'send upstream'. Always confirms before pushing."
4
+ argument-hint: "[path] [--dry-run] — e.g., '.aw_registry/platform/data/', '--dry-run', 'rules'"
5
+ status: active
6
+ stage: deploy
7
+ internal_skill: aw-publish
8
+ ---
9
+
10
+ # Publish — Registry Push
11
+
12
+ Push local registry artifacts to the remote platform-docs registry via PR.
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ /aw:publish → auto-detect all changes, dry-run first
18
+ /aw:publish .aw_registry/platform/data/ → push changes in a namespace
19
+ /aw:publish .aw_registry/platform/data/agents/my-agent.md → push one file
20
+ /aw:publish --dry-run → preview only, no push
21
+ /aw:publish rules → push platform rules (.aw_rules/)
22
+ ```
23
+
24
+ ## Natural Language (no command needed)
25
+
26
+ You don't need to type `/aw:publish` — the LLM detects intent automatically when the context is about **registry artifacts** (.aw_registry/ or .aw_rules/):
27
+
28
+ - "push this agent to the registry"
29
+ - "publish my registry changes"
30
+ - "sync platform/data to platform-docs"
31
+ - "I'm done testing this skill, publish it"
32
+ - "what would get pushed to the registry?"
33
+ - "push the rules"
34
+
35
+ **Note:** Regular git push, code PRs, and deploys do NOT trigger this skill.
36
+
37
+ ## Arguments
38
+
39
+ | Argument | Values | Default |
40
+ |---|---|---|
41
+ | path | `.aw_registry/...` path, namespace folder, or `rules` | auto-detect all changes |
42
+ | `--dry-run` | flag | off (but skill always does dry-run first as confirmation) |
43
+ | `--repo` | override target repository | `GoHighLevel/platform-docs` |
44
+
45
+ ## Execution
46
+
47
+ **Step 1: Read the skill file.** Open and read `skills/aw-publish/SKILL.md` before doing anything else.
48
+
49
+ **Step 2: Follow the confirmation gate.** Every publish must:
50
+ 1. Run `aw push --dry-run` to preview changes
51
+ 2. Show the user what will be pushed
52
+ 3. Ask "Do you want to publish?"
53
+ 4. Only push after explicit user confirmation
54
+
55
+ **Step 3: Choose the right command.**
56
+ - Registry artifacts (agents, skills, commands, evals, references) → `aw push`
57
+ - Platform rules (.aw_rules/) → `aw push-rules`
58
+ - Never combine both in one action
59
+
60
+ ## When No Arguments
61
+
62
+ If invoked without arguments:
63
+ 1. Run `aw push --dry-run` to see all pending changes
64
+ 2. If rules changes detected, mention them and suggest `aw push-rules` separately
65
+ 3. Show the full list and ask for confirmation
@@ -28,8 +28,18 @@ This stage may request or rerun targeted tests when existing evidence is stale,
28
28
 
29
29
  - `.aw_docs/features/<feature_slug>/verification.md`
30
30
  - updated `.aw_docs/features/<feature_slug>/state.json`
31
+ - `.aw_docs/features/<feature_slug>/verification.html` when docs output mode is `dual` or `html`
31
32
  - explicit overall status: `PASS`, `PASS_WITH_NOTES`, or `FAIL`
32
33
 
34
+ ## Human HTML Companion
35
+
36
+ Markdown `verification.md` remains canonical for agents.
37
+ When `/aw:review` writes or materially updates findings, governance, or readiness evidence, delegate to the `aw:echo` subagent with the `pr-one-pager` profile. Markdown-only is allowed only when the user explicitly requests it for this run.
38
+ Subagent authorization: invoking `/aw:review` in `dual` or `html` output mode is an explicit user request to delegate the human-facing HTML companion to exactly one background `aw:echo` subagent. This authorization is scoped only to HTML companion generation; do not spawn unrelated subagents.
39
+ HTML sidecars are required before the final handoff. Spawn exactly one `aw:echo` subagent and wait for the colocated `.html` sidecar unless the user explicitly asks not to wait. If the harness still cannot spawn `aw:echo`, create a conservative self-contained fallback HTML sidecar in the same turn, record `generated_fallback` with the blocker, and keep Markdown canonical.
40
+
41
+ Record `html_companion_artifacts` in `state.json` with `source_path`, `html_path`, profile, status, `run_ref` when available, publish status, and any explicit Markdown-only skip or fallback reason.
42
+
33
43
  ## Review Rules
34
44
 
35
45
  1. Review tests and validation evidence first.
@@ -39,6 +49,7 @@ This stage may request or rerun targeted tests when existing evidence is stale,
39
49
  5. Continue until the requested findings, governance, and readiness scope is covered or explicitly blocked.
40
50
  6. Route back to `/aw:build` when repair is needed.
41
51
  7. Do not clear findings on stale evidence.
52
+ 8. Generate or explicitly record the HTML companion status before handoff.
42
53
 
43
54
  ## Must Not Do
44
55
 
@@ -61,4 +72,5 @@ Always end with:
61
72
  - `Governance`
62
73
  - `Readiness`
63
74
  - `Outcome`
75
+ - `HTML Companion`
64
76
  - `Next`
package/commands/ship.md CHANGED
@@ -34,8 +34,18 @@ Confirm the release is ready to launch, roll it out safely, document rollback re
34
34
 
35
35
  - `.aw_docs/features/<feature_slug>/release.md`
36
36
  - updated `.aw_docs/features/<feature_slug>/state.json`
37
+ - `.aw_docs/features/<feature_slug>/release.html` when docs output mode is `dual` or `html`
37
38
  - launch recommendation, rollout checkpoints, rollback path, and closeout notes
38
39
 
40
+ ## Human HTML Companion
41
+
42
+ Markdown `release.md` remains canonical for agents.
43
+ When `/aw:ship` writes or materially updates launch, rollout, rollback, or closeout evidence, delegate to the `aw:echo` subagent with the `release-report` profile. Markdown-only is allowed only when the user explicitly requests it for this run.
44
+ Subagent authorization: invoking `/aw:ship` in `dual` or `html` output mode is an explicit user request to delegate the human-facing HTML companion to exactly one background `aw:echo` subagent. This authorization is scoped only to HTML companion generation; do not spawn unrelated subagents.
45
+ HTML sidecars are required before the final handoff. Spawn exactly one `aw:echo` subagent and wait for the colocated `.html` sidecar unless the user explicitly asks not to wait. If the harness still cannot spawn `aw:echo`, create a conservative self-contained fallback HTML sidecar in the same turn, record `generated_fallback` with the blocker, and keep Markdown canonical.
46
+
47
+ Record `html_companion_artifacts` in `state.json` with `source_path`, `html_path`, profile, status, `run_ref` when available, publish status, and any explicit Markdown-only skip or fallback reason.
48
+
39
49
  ## Shipping Rules
40
50
 
41
51
  1. Treat rollout safety as its own stage.
@@ -45,6 +55,7 @@ Confirm the release is ready to launch, roll it out safely, document rollback re
45
55
  5. Capture post-deploy evidence, monitoring links, and known risks.
46
56
  6. For frontend releases, include versioned entry, smoke, and accessibility or design-signoff notes when relevant.
47
57
  7. Do not use `ship` as a synonym for composite orchestration.
58
+ 8. Generate or explicitly record the HTML companion status before handoff.
48
59
 
49
60
  ## Internal Phase Routing
50
61
 
@@ -74,4 +85,5 @@ Always end with:
74
85
  - `Rollback Path`
75
86
  - `Evidence`
76
87
  - `Outcome`
88
+ - `HTML Companion`
77
89
  - `Next`
package/commands/test.md CHANGED
@@ -28,8 +28,18 @@ Run the smallest correct QA scope for the requested feature, fix, or release and
28
28
 
29
29
  - `.aw_docs/features/<feature_slug>/verification.md`
30
30
  - updated `.aw_docs/features/<feature_slug>/state.json`
31
+ - `.aw_docs/features/<feature_slug>/verification.html` when docs output mode is `dual` or `html`
31
32
  - fresh evidence for local validation, E2E, external validation, or targeted runtime checks
32
33
 
34
+ ## Human HTML Companion
35
+
36
+ Markdown `verification.md` remains canonical for agents.
37
+ When `/aw:test` writes or materially updates QA evidence, delegate to the `aw:echo` subagent with the `verification-report` profile. Markdown-only is allowed only when the user explicitly requests it for this run.
38
+ Subagent authorization: invoking `/aw:test` in `dual` or `html` output mode is an explicit user request to delegate the human-facing HTML companion to exactly one background `aw:echo` subagent. This authorization is scoped only to HTML companion generation; do not spawn unrelated subagents.
39
+ HTML sidecars are required before the final handoff. Spawn exactly one `aw:echo` subagent and wait for the colocated `.html` sidecar unless the user explicitly asks not to wait. If the harness still cannot spawn `aw:echo`, create a conservative self-contained fallback HTML sidecar in the same turn, record `generated_fallback` with the blocker, and keep Markdown canonical.
40
+
41
+ Record `html_companion_artifacts` in `state.json` with `source_path`, `html_path`, profile, status, `run_ref` when available, publish status, and any explicit Markdown-only skip or fallback reason.
42
+
33
43
  ## QA Rules
34
44
 
35
45
  1. Select the smallest correct test scope, not the loudest available suite.
@@ -39,6 +49,7 @@ Run the smallest correct QA scope for the requested feature, fix, or release and
39
49
  5. Continue until the requested QA scope is covered or explicitly blocked.
40
50
  6. Mark unavailable checks as unavailable instead of inventing a pass.
41
51
  7. Hand off to `/aw:review` when findings, governance, or readiness still need a decision.
52
+ 8. Generate or explicitly record the HTML companion status before handoff.
42
53
 
43
54
  ## Must Not Do
44
55
 
@@ -61,4 +72,5 @@ Always end with:
61
72
  - `Evidence`
62
73
  - `Failures`
63
74
  - `Unavailable`
75
+ - `HTML Companion`
64
76
  - `Next`
@@ -32,6 +32,14 @@ This entrypoint inherits the same rule that the selected test or review scope sh
32
32
 
33
33
  - `.aw_docs/features/<feature_slug>/verification.md`
34
34
  - updated `.aw_docs/features/<feature_slug>/state.json`
35
+ - `.aw_docs/features/<feature_slug>/verification.html` and/or `.aw_docs/features/<feature_slug>/verification.html` when the routed stage writes an HTML companion
36
+
37
+ ## Human HTML Companion
38
+
39
+ `/aw:verify` inherits the `/aw:test` and `/aw:review` HTML companion contracts.
40
+ Markdown remains canonical for agents, and the `aw:echo` subagent produces the human review companion when output mode is `dual` or `html`.
41
+ Subagent authorization: invoking `/aw:verify` in `dual` or `html` output mode is an explicit user request to delegate the human-facing HTML companion to exactly one background `aw:echo` subagent. This authorization is scoped only to HTML companion generation; do not spawn unrelated subagents.
42
+ HTML sidecars are required before the final handoff. Spawn exactly one `aw:echo` subagent and wait for the colocated `.html` sidecar unless the user explicitly asks not to wait. If the harness still cannot spawn `aw:echo`, create a conservative self-contained fallback HTML sidecar in the same turn, record `generated_fallback` with the blocker, and keep Markdown canonical.
35
43
 
36
44
  ## Must Not Do
37
45
 
@@ -52,4 +60,5 @@ Always end with:
52
60
  - `Canonical Flow`
53
61
  - `Evidence`
54
62
  - `Outcome`
63
+ - `HTML Companion`
55
64
  - `Next`
package/hooks/hooks.json CHANGED
@@ -240,6 +240,18 @@
240
240
  }
241
241
  ],
242
242
  "description": "Capture tool use results for continuous learning"
243
+ },
244
+ {
245
+ "matcher": "*",
246
+ "hooks": [
247
+ {
248
+ "type": "command",
249
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/aw-usage-post-tool-use.js\"",
250
+ "async": true,
251
+ "timeout": 10
252
+ }
253
+ ],
254
+ "description": "Usage telemetry: skill_invoked, agent_spawned, tool_error events"
243
255
  }
244
256
  ],
245
257
  "PostToolUseFailure": [
@@ -252,6 +264,18 @@
252
264
  }
253
265
  ],
254
266
  "description": "Track failed MCP tool calls, mark unhealthy servers, and attempt reconnect"
267
+ },
268
+ {
269
+ "matcher": "*",
270
+ "hooks": [
271
+ {
272
+ "type": "command",
273
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/aw-usage-post-tool-use-failure.js\"",
274
+ "async": true,
275
+ "timeout": 10
276
+ }
277
+ ],
278
+ "description": "Usage telemetry: tool_error event on tool failure"
255
279
  }
256
280
  ],
257
281
  "Stop": [
@@ -300,6 +324,18 @@
300
324
  }
301
325
  ],
302
326
  "description": "Track token and cost metrics per session"
327
+ },
328
+ {
329
+ "matcher": "*",
330
+ "hooks": [
331
+ {
332
+ "type": "command",
333
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/aw-usage-stop.js\"",
334
+ "async": true,
335
+ "timeout": 10
336
+ }
337
+ ],
338
+ "description": "Usage telemetry: response_completed and session_ended events"
303
339
  }
304
340
  ],
305
341
  "SessionEnd": [
@@ -17,6 +17,14 @@
17
17
  "agents-core"
18
18
  ]
19
19
  },
20
+ {
21
+ "id": "baseline:aw-stages",
22
+ "family": "baseline",
23
+ "description": "Canonical AW SDLC stage skills and the using-aw-skills router. Ships single source of truth to all harnesses.",
24
+ "modules": [
25
+ "aw-stages"
26
+ ]
27
+ },
20
28
  {
21
29
  "id": "baseline:commands",
22
30
  "family": "baseline",
@@ -39,6 +39,88 @@
39
39
  "cost": "light",
40
40
  "stability": "stable"
41
41
  },
42
+ {
43
+ "id": "aw-stages",
44
+ "kind": "skills",
45
+ "description": "Canonical AW SDLC stage skills (aw-plan, aw-build, aw-investigate, aw-test, aw-review, aw-deploy, aw-ship, aw-feature) and supporting internal helpers. Shipped from the single canonical skills/ source; install pipeline transforms /aw: \u2192 /aw- for Cursor targets.",
46
+ "paths": [
47
+ "skills/aw-brainstorm",
48
+ "skills/aw-build",
49
+ "skills/aw-debug",
50
+ "skills/aw-deploy",
51
+ "skills/aw-design",
52
+ "skills/aw-execute",
53
+ "skills/aw-feature",
54
+ "skills/aw-finish",
55
+ "skills/aw-investigate",
56
+ "skills/aw-plan",
57
+ "skills/aw-prepare",
58
+ "skills/aw-review",
59
+ "skills/aw-rules",
60
+ "skills/aw-ship",
61
+ "skills/aw-spec",
62
+ "skills/aw-tasks",
63
+ "skills/aw-test",
64
+ "skills/aw-verify",
65
+ "skills/aw-yolo",
66
+ "skills/using-aw-skills"
67
+ ],
68
+ "targets": [
69
+ "claude",
70
+ "cursor",
71
+ "antigravity",
72
+ "codex",
73
+ "opencode"
74
+ ],
75
+ "dependencies": [],
76
+ "defaultInstall": true,
77
+ "cost": "light",
78
+ "stability": "stable"
79
+ },
80
+ {
81
+ "id": "aw-adk",
82
+ "kind": "skills",
83
+ "description": "Agent Development Kit \u2014 centralized CASRE (Command, Agent, Skill, Rule, Eval) authoring with lint, scoring, eval creation, and cross-IDE sync.",
84
+ "paths": [
85
+ "skills/aw-adk",
86
+ "commands/adk.md"
87
+ ],
88
+ "targets": [
89
+ "claude",
90
+ "cursor",
91
+ "antigravity",
92
+ "codex",
93
+ "opencode"
94
+ ],
95
+ "dependencies": [
96
+ "aw-stages"
97
+ ],
98
+ "defaultInstall": true,
99
+ "cost": "light",
100
+ "stability": "stable"
101
+ },
102
+ {
103
+ "id": "aw-publish",
104
+ "kind": "skills",
105
+ "description": "Registry publish skill \u2014 guides pushing locally created/modified CASRE artifacts to the remote platform-docs registry via PR. Intent-based with mandatory confirmation gate.",
106
+ "paths": [
107
+ "skills/aw-publish",
108
+ "commands/publish.md"
109
+ ],
110
+ "targets": [
111
+ "claude",
112
+ "cursor",
113
+ "antigravity",
114
+ "codex",
115
+ "opencode"
116
+ ],
117
+ "dependencies": [
118
+ "aw-stages"
119
+ ],
120
+ "defaultInstall": true,
121
+ "cost": "light",
122
+ "stability": "stable"
123
+ },
42
124
  {
43
125
  "id": "commands-core",
44
126
  "kind": "commands",
@@ -191,6 +273,7 @@
191
273
  "skills/continuous-learning-v2",
192
274
  "skills/e2e-testing",
193
275
  "skills/eval-harness",
276
+ "skills/finish-only-when-green",
194
277
  "skills/iterative-retrieval",
195
278
  "skills/plankton-code-quality",
196
279
  "skills/project-guidelines-example",
@@ -6,6 +6,7 @@
6
6
  "modules": [
7
7
  "rules-core",
8
8
  "agents-core",
9
+ "aw-stages",
9
10
  "commands-core",
10
11
  "hooks-runtime",
11
12
  "platform-configs",
@@ -17,6 +18,7 @@
17
18
  "modules": [
18
19
  "rules-core",
19
20
  "agents-core",
21
+ "aw-stages",
20
22
  "commands-core",
21
23
  "hooks-runtime",
22
24
  "platform-configs",
@@ -31,6 +33,7 @@
31
33
  "modules": [
32
34
  "rules-core",
33
35
  "agents-core",
36
+ "aw-stages",
34
37
  "commands-core",
35
38
  "hooks-runtime",
36
39
  "platform-configs",
@@ -43,6 +46,7 @@
43
46
  "modules": [
44
47
  "rules-core",
45
48
  "agents-core",
49
+ "aw-stages",
46
50
  "commands-core",
47
51
  "hooks-runtime",
48
52
  "platform-configs",
@@ -57,6 +61,9 @@
57
61
  "modules": [
58
62
  "rules-core",
59
63
  "agents-core",
64
+ "aw-stages",
65
+ "aw-adk",
66
+ "aw-publish",
60
67
  "commands-core",
61
68
  "hooks-runtime",
62
69
  "platform-configs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aw-ecc",
3
- "version": "1.4.32",
3
+ "version": "1.4.47",
4
4
  "description": "GoHighLevel Agentic Workspace Engine — forked from Everything Claude Code (ecc-universal)",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -42,6 +42,53 @@ function collectRuleFiles(dir) {
42
42
  return files;
43
43
  }
44
44
 
45
+ /**
46
+ * Validate that .mdc files (Cursor rule format) have frontmatter at byte 0.
47
+ * Anything before the opening `---` — including HTML comments — makes Cursor
48
+ * treat the file as having no frontmatter, silently breaking alwaysApply/globs.
49
+ */
50
+ function validateCursorMdcFrontmatter() {
51
+ const repoRoot = path.join(__dirname, '../..');
52
+ const errors = [];
53
+
54
+ function scan(dir) {
55
+ let entries;
56
+ try {
57
+ entries = fs.readdirSync(dir, { withFileTypes: true });
58
+ } catch {
59
+ return;
60
+ }
61
+ for (const entry of entries) {
62
+ if (entry.name === 'node_modules' || entry.name.startsWith('.git')) continue;
63
+ const abs = path.join(dir, entry.name);
64
+ if (entry.isDirectory()) {
65
+ scan(abs);
66
+ continue;
67
+ }
68
+ if (!entry.name.endsWith('.mdc')) continue;
69
+ const content = fs.readFileSync(abs, 'utf-8');
70
+ // Only flag files that HAVE frontmatter but in the wrong position.
71
+ // Files with no frontmatter at all are valid "plain content" Cursor rules.
72
+ const hasFrontmatter = /^---\s*$/m.test(content);
73
+ if (hasFrontmatter && !content.startsWith('---')) {
74
+ const firstLine = content.split('\n', 1)[0].slice(0, 80);
75
+ errors.push(`${path.relative(repoRoot, abs)}: frontmatter exists but is not at byte 0 (first line: ${firstLine})`);
76
+ }
77
+ }
78
+ }
79
+
80
+ scan(repoRoot);
81
+
82
+ if (errors.length > 0) {
83
+ console.error('ERROR: .mdc files with content before frontmatter (breaks Cursor alwaysApply/globs):');
84
+ for (const err of errors) {
85
+ console.error(` - ${err}`);
86
+ }
87
+ return false;
88
+ }
89
+ return true;
90
+ }
91
+
45
92
  function validateRules() {
46
93
  if (!fs.existsSync(RULES_DIR)) {
47
94
  console.log('No rules directory found, skipping validation');
@@ -71,6 +118,10 @@ function validateRules() {
71
118
  }
72
119
  }
73
120
 
121
+ if (!validateCursorMdcFrontmatter()) {
122
+ hasErrors = true;
123
+ }
124
+
74
125
  if (hasErrors) {
75
126
  process.exit(1);
76
127
  }
@@ -3,7 +3,7 @@
3
3
  "hooks": {
4
4
  "sessionStart": [
5
5
  {
6
- "command": "bash -lc \"for candidate in \\\"$PWD/.cursor/hooks/session-start.sh\\\" \\\"$HOME/.cursor/hooks/session-start.sh\\\"; do if [ -f \\\"$candidate\\\" ]; then exec bash \\\"$candidate\\\"; fi; done; exit 0\"",
6
+ "command": "bash -c 'f=\"$PWD/.cursor/hooks/session-start.sh\"; [ -f \"$f\" ] || f=\"$HOME/.cursor/hooks/session-start.sh\"; exec bash \"$f\"'",
7
7
  "event": "sessionStart",
8
8
  "description": "Load previous context and detect environment"
9
9
  }
@@ -64,7 +64,7 @@
64
64
  ],
65
65
  "beforeSubmitPrompt": [
66
66
  {
67
- "command": "bash -lc \"for candidate in \\\"$PWD/.cursor/hooks/before-submit-prompt.sh\\\" \\\"$HOME/.cursor/hooks/before-submit-prompt.sh\\\"; do if [ -f \\\"$candidate\\\" ]; then exec bash \\\"$candidate\\\"; fi; done; exit 0\"",
67
+ "command": "bash -c 'f=\"$PWD/.cursor/hooks/before-submit-prompt.sh\"; [ -f \"$f\" ] || f=\"$HOME/.cursor/hooks/before-submit-prompt.sh\"; exec bash \"$f\"'",
68
68
  "event": "beforeSubmitPrompt",
69
69
  "description": "Detect secrets in prompts (sk-, ghp_, AKIA patterns)"
70
70
  }
@@ -83,6 +83,20 @@
83
83
  "description": "Log agent completion"
84
84
  }
85
85
  ],
86
+ "postToolUse": [
87
+ {
88
+ "command": "node -e \"const fs=require('fs');const path=require('path');const os=require('os');const scriptName=\\\"post-tool-use.js\\\";const candidates=[path.join(process.cwd(), '.cursor', 'hooks', scriptName),path.join(os.homedir(), '.cursor', 'hooks', scriptName)];const target=candidates.find(candidate => fs.existsSync(candidate));if(!target) process.exit(0);require(target)\"",
89
+ "event": "postToolUse",
90
+ "description": "Telemetry: skill_invoked detection for Read tool and other non-shell/edit/MCP tools"
91
+ }
92
+ ],
93
+ "postToolUseFailure": [
94
+ {
95
+ "command": "node -e \"const fs=require('fs');const path=require('path');const os=require('os');const scriptName=\\\"post-tool-use-failure.js\\\";const candidates=[path.join(process.cwd(), '.cursor', 'hooks', scriptName),path.join(os.homedir(), '.cursor', 'hooks', scriptName)];const target=candidates.find(candidate => fs.existsSync(candidate));if(!target) process.exit(0);require(target)\"",
96
+ "event": "postToolUseFailure",
97
+ "description": "Telemetry: tool_error detection on tool failure/timeout/denial"
98
+ }
99
+ ],
86
100
  "beforeTabFileRead": [
87
101
  {
88
102
  "command": "node -e \"const fs=require('fs');const path=require('path');const os=require('os');const scriptName=\\\"before-tab-file-read.js\\\";const candidates=[path.join(process.cwd(), '.cursor', 'hooks', scriptName),path.join(os.homedir(), '.cursor', 'hooks', scriptName)];const target=candidates.find(candidate => fs.existsSync(candidate));if(!target) process.exit(0);require(target)\"",
@@ -104,6 +118,13 @@
104
118
  "description": "Save state before context compaction"
105
119
  }
106
120
  ],
121
+ "afterAgentResponse": [
122
+ {
123
+ "command": "node -e \"const fs=require('fs');const path=require('path');const os=require('os');const scriptName=\\\"after-agent-response.js\\\";const candidates=[path.join(process.cwd(), '.cursor', 'hooks', scriptName),path.join(os.homedir(), '.cursor', 'hooks', scriptName)];const target=candidates.find(candidate => fs.existsSync(candidate));if(!target) process.exit(0);require(target)\"",
124
+ "event": "afterAgentResponse",
125
+ "description": "Telemetry: response_completed with tokens and cost per turn"
126
+ }
127
+ ],
107
128
  "stop": [
108
129
  {
109
130
  "command": "node -e \"const fs=require('fs');const path=require('path');const os=require('os');const scriptName=\\\"stop.js\\\";const candidates=[path.join(process.cwd(), '.cursor', 'hooks', scriptName),path.join(os.homedir(), '.cursor', 'hooks', scriptName)];const target=candidates.find(candidate => fs.existsSync(candidate));if(!target) process.exit(0);require(target)\"",
@@ -23,8 +23,9 @@ function readStdin() {
23
23
  }
24
24
 
25
25
  function getPluginRoot() {
26
- const homeStyleRoot = path.resolve(__dirname, '..');
26
+ const os = require('os');
27
27
  const repoStyleRoot = path.resolve(__dirname, '..', '..');
28
+ const awEccHome = path.join(os.homedir(), '.aw-ecc');
28
29
 
29
30
  if (
30
31
  fs.existsSync(path.join(repoStyleRoot, 'package.json'))
@@ -34,7 +35,11 @@ function getPluginRoot() {
34
35
  return repoStyleRoot;
35
36
  }
36
37
 
37
- return homeStyleRoot;
38
+ if (fs.existsSync(path.join(awEccHome, 'scripts', 'lib', 'aw-usage-telemetry.js'))) {
39
+ return awEccHome;
40
+ }
41
+
42
+ return path.resolve(__dirname, '..');
38
43
  }
39
44
 
40
45
  function transformToClaude(cursorInput, overrides = {}) {
@@ -43,12 +48,17 @@ function transformToClaude(cursorInput, overrides = {}) {
43
48
  const inferredToolName = cursorInput.tool_name
44
49
  || (server && tool ? `mcp__${server}__${tool}` : '');
45
50
 
51
+ // Preserve original tool_input fields (skill, subagent_type, description, etc.)
52
+ const originalToolInput = cursorInput.tool_input || {};
53
+
46
54
  return {
47
55
  tool_name: inferredToolName,
48
56
  server,
49
57
  tool,
58
+ exit_code: cursorInput.exit_code,
50
59
  tool_input: {
51
- command: cursorInput.command || cursorInput.args?.command || '',
60
+ ...originalToolInput,
61
+ command: cursorInput.command || cursorInput.args?.command || originalToolInput.command || '',
52
62
  file_path: cursorInput.path || cursorInput.file || cursorInput.args?.filePath || '',
53
63
  server,
54
64
  mcp_server: server,
@@ -60,7 +70,28 @@ function transformToClaude(cursorInput, overrides = {}) {
60
70
  output: cursorInput.output || cursorInput.result || '',
61
71
  ...overrides.tool_output,
62
72
  },
73
+ tool_response: {
74
+ exit_code: cursorInput.exit_code,
75
+ output: cursorInput.output || cursorInput.result || '',
76
+ },
63
77
  transcript_path: cursorInput.transcript_path || cursorInput.transcriptPath || cursorInput.session?.transcript_path || '',
78
+ // Cursor common schema fields surfaced at top level for buildEvent()
79
+ generation_id: cursorInput.generation_id,
80
+ conversation_id: cursorInput.conversation_id,
81
+ workspace_roots: cursorInput.workspace_roots,
82
+ model: cursorInput.model,
83
+ user_email: cursorInput.user_email,
84
+ cursor_version: cursorInput.cursor_version,
85
+ status: cursorInput.status,
86
+ reason: cursorInput.reason,
87
+ // Token fields — Cursor sends these on afterAgentResponse and stop hooks
88
+ input_tokens: cursorInput.input_tokens,
89
+ output_tokens: cursorInput.output_tokens,
90
+ cache_read_tokens: cursorInput.cache_read_tokens,
91
+ cache_write_tokens: cursorInput.cache_write_tokens,
92
+ // Subagent fields
93
+ task: cursorInput.task,
94
+ description: cursorInput.description,
64
95
  _cursor: {
65
96
  conversation_id: cursorInput.conversation_id,
66
97
  hook_event_name: cursorInput.hook_event_name,
@@ -100,7 +131,13 @@ function runExistingHook(scriptName, stdinData) {
100
131
  path.join(root, 'scripts', 'hooks', scriptName),
101
132
  path.join(root, 'hooks', scriptName),
102
133
  ];
103
- const scriptPath = candidates.find(candidate => fs.existsSync(candidate)) || candidates[0];
134
+ const scriptPath = candidates.find(candidate => fs.existsSync(candidate));
135
+ if (!scriptPath) {
136
+ if (process.env.AW_HOOK_DEBUG === '1') {
137
+ process.stderr.write(`[aw] Cannot find hook script: ${scriptName}\n`);
138
+ }
139
+ return undefined;
140
+ }
104
141
  return runManagedCommand('node', [scriptPath], stdinData);
105
142
  }
106
143
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const { readStdin, runManagedShellHook } = require('./adapter');
2
+ const { readStdin, runManagedShellHook, runExistingHook, transformToClaude } = require('./adapter');
3
3
 
4
4
  function emitAwPromptReminder(raw) {
5
5
  const result = runManagedShellHook('scripts/hooks/shared/user-prompt-submit.sh', raw);
@@ -37,5 +37,11 @@ readStdin().then(raw => {
37
37
  } catch (_error) {
38
38
  // Reminder emission is advisory and should not break the prompt flow.
39
39
  }
40
+ try {
41
+ const claudePayload = transformToClaude(JSON.parse(raw));
42
+ runExistingHook('aw-usage-prompt-submit.js', JSON.stringify(claudePayload));
43
+ } catch (_error) {
44
+ // Telemetry is best-effort and should not block prompt submission.
45
+ }
40
46
  process.stdout.write(raw);
41
47
  }).catch(() => process.exit(0));
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Usage telemetry — commit_created event.
4
+ *
5
+ * Called from the post-commit git hook when the commit has an AW
6
+ * Co-Authored-By trailer. Works for all harnesses (Claude, Cursor, Codex)
7
+ * since it fires from a git-level hook, not a harness-specific one.
8
+ *
9
+ * Usage: node aw-usage-commit-created.js <commit_hash> <branch>
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ const { buildEvent, sendAsync, isDisabled } = require('../lib/aw-usage-telemetry');
15
+
16
+ if (isDisabled()) process.exit(0);
17
+
18
+ const commitHash = process.argv[2] || 'unknown';
19
+ const branch = process.argv[3] || 'unknown';
20
+
21
+ // Minimal input — no harness session context in a git hook.
22
+ // detectHarness() will return 'claude' (default) but the event
23
+ // payload makes it clear this is harness-agnostic.
24
+ const event = buildEvent({}, 'commit_created', {
25
+ commit_hash: commitHash,
26
+ branch,
27
+ });
28
+
29
+ // Override harness to 'git' since this fires from a git hook, not a harness
30
+ event.harness = 'git';
31
+
32
+ sendAsync(event);