capt-hook 12.77.2__tar.gz → 12.78.0__tar.gz

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 (232) hide show
  1. {capt_hook-12.77.2 → capt_hook-12.78.0}/PKG-INFO +1 -1
  2. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/.claude-plugin/plugin.json +1 -1
  3. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/cli.py +9 -1
  4. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/context.py +50 -15
  5. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/guard_literal.py +109 -0
  6. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/llm.py +5 -1
  7. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/testing/helpers.py +7 -0
  8. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/testing/types.py +14 -6
  9. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/transcripts.py +8 -0
  10. {capt_hook-12.77.2 → capt_hook-12.78.0}/hatch_build.py +92 -1
  11. {capt_hook-12.77.2 → capt_hook-12.78.0}/internal/wireproto/guard.json +1 -0
  12. {capt_hook-12.77.2 → capt_hook-12.78.0}/pyproject.toml +1 -1
  13. {capt_hook-12.77.2 → capt_hook-12.78.0}/.gitignore +0 -0
  14. {capt_hook-12.77.2 → capt_hook-12.78.0}/LICENSE +0 -0
  15. {capt_hook-12.77.2 → capt_hook-12.78.0}/README.md +0 -0
  16. {capt_hook-12.77.2 → capt_hook-12.78.0}/capt_hook_client/__init__.py +0 -0
  17. {capt_hook-12.77.2 → capt_hook-12.78.0}/capt_hook_client/__main__.py +0 -0
  18. {capt_hook-12.77.2 → capt_hook-12.78.0}/capt_hook_client/client.py +0 -0
  19. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/.mcp.json +0 -0
  20. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/__init__.py +0 -0
  21. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/__init__.pyi +0 -0
  22. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/__main__.py +0 -0
  23. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/annotations.py +0 -0
  24. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/app.py +0 -0
  25. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/ast_grep.py +0 -0
  26. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/bindings.py +0 -0
  27. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/__init__.py +0 -0
  28. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/fixes/__init__.py +0 -0
  29. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/fixes/hooks/__init__.py +0 -0
  30. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/fixes/hooks/_lib.py +0 -0
  31. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/fixes/hooks/scratch_writes.py +0 -0
  32. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/fixes/hooks/teammate_permissions.py +0 -0
  33. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/__init__.py +0 -0
  34. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/__init__.py +0 -0
  35. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/_lib.py +0 -0
  36. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/_sessions.py +0 -0
  37. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/commands.py +0 -0
  38. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/comments.py +0 -0
  39. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/deletions.py +0 -0
  40. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/detours.py +0 -0
  41. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/docs.py +0 -0
  42. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/hook_files.py +0 -0
  43. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/models.py +0 -0
  44. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/plain_english.py +0 -0
  45. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/plans.py +0 -0
  46. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/fragments/deliverable_rubric.md +0 -0
  47. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/fragments/workflow_script_header.md +0 -0
  48. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/browser_delegation_nudge.md +0 -0
  49. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/implementation_spawn_nudge.md +0 -0
  50. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/inline_edit_nudge.md +0 -0
  51. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/prose_spawn_gate.md +0 -0
  52. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/prose_workflow_nudge.md +0 -0
  53. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/review_routing_spawn_nudge.md +0 -0
  54. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/review_routing_workflow_nudge.md +0 -0
  55. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/writing_docs_spawn_nudge.md +0 -0
  56. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/models/writing_docs_workflow_nudge.md +0 -0
  57. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/plain_english_rules.md +0 -0
  58. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts/tools/preload_nudge.md +0 -0
  59. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/prompts.py +0 -0
  60. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/questions.py +0 -0
  61. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/review.py +0 -0
  62. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/sessions.py +0 -0
  63. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/tasks.py +0 -0
  64. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/tombstones.py +0 -0
  65. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/tooling.py +0 -0
  66. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/hooks/tools.py +0 -0
  67. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/general/pack.toml +0 -0
  68. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/go/__init__.py +0 -0
  69. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/go/hooks/__init__.py +0 -0
  70. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/go/hooks/testing.py +0 -0
  71. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/go/hooks/toolchain.py +0 -0
  72. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/graphite/__init__.py +0 -0
  73. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/graphite/gitdir/.graphite_repo_config +0 -0
  74. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/graphite/hooks/__init__.py +0 -0
  75. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/graphite/hooks/_lib.py +0 -0
  76. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/graphite/hooks/queue.py +0 -0
  77. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/graphite/hooks/vcs.py +0 -0
  78. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/performance/__init__.py +0 -0
  79. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/performance/hooks/__init__.py +0 -0
  80. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/performance/hooks/filesystem.py +0 -0
  81. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/performance/hooks/pipelining.py +0 -0
  82. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/python/__init__.py +0 -0
  83. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/python/hooks/__init__.py +0 -0
  84. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/python/hooks/style.py +0 -0
  85. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/python/hooks/testing.py +0 -0
  86. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/python/hooks/toolchain.py +0 -0
  87. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/steering/__init__.py +0 -0
  88. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/steering/hooks/__init__.py +0 -0
  89. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/steering/hooks/steering.py +0 -0
  90. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/steering/hooks/teammates.py +0 -0
  91. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/steering/hooks/workarounds.py +0 -0
  92. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/builtin_packs/steering/pack.toml +0 -0
  93. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/classifiers/__init__.py +0 -0
  94. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/classifiers/conductor.py +0 -0
  95. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/classifiers/droid.py +0 -0
  96. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/classifiers/lane.py +0 -0
  97. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/classifiers/native.py +0 -0
  98. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/cmd.py +0 -0
  99. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/command_schema.py +0 -0
  100. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/command_schemas.py +0 -0
  101. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/conditions.py +0 -0
  102. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/confirm.py +0 -0
  103. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/contexts.py +0 -0
  104. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/daemon/__init__.py +0 -0
  105. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/daemon/context.py +0 -0
  106. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/daemon/decision_writer.py +0 -0
  107. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/daemon/logsink.py +0 -0
  108. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/daemon/registry.py +0 -0
  109. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/daemon/tree.py +0 -0
  110. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/decisions.py +0 -0
  111. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/desktop/__init__.py +0 -0
  112. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/desktop/cli.py +0 -0
  113. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/desktop/client.py +0 -0
  114. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/dispatch.py +0 -0
  115. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/doc_conventions.py +0 -0
  116. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/durable.py +0 -0
  117. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/events.py +0 -0
  118. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/faults.py +0 -0
  119. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/fields.py +0 -0
  120. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/file.py +0 -0
  121. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/guard_literal.sh +0 -0
  122. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/heartbeat.py +0 -0
  123. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/hook_lint.py +0 -0
  124. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/hooks/hooks.json +0 -0
  125. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/loader.py +0 -0
  126. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/log.py +0 -0
  127. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/mcp_server.py +0 -0
  128. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/packs/__init__.py +0 -0
  129. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/packs/manager.py +0 -0
  130. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/packs/plugins.py +0 -0
  131. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/__init__.py +0 -0
  132. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/commands.py +0 -0
  133. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/lint.py +0 -0
  134. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/nudge.py +0 -0
  135. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/permissions.py +0 -0
  136. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/provision.py +0 -0
  137. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/rewrite.py +0 -0
  138. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/primitives/workflow.py +0 -0
  139. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/prompt.py +0 -0
  140. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/py.typed +0 -0
  141. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/__init__.py +0 -0
  142. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/announce.py +0 -0
  143. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/cli.py +0 -0
  144. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/dashboard.py +0 -0
  145. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/fix.py +0 -0
  146. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/formats.py +0 -0
  147. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/judge.py +0 -0
  148. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/notify.py +0 -0
  149. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/pipeline.py +0 -0
  150. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/prompts.py +0 -0
  151. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/repo.py +0 -0
  152. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/routing.py +0 -0
  153. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/scan.py +0 -0
  154. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/settings.py +0 -0
  155. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/snapshot.py +0 -0
  156. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/status.py +0 -0
  157. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/store.py +0 -0
  158. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/sync.py +0 -0
  159. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/review/triage.py +0 -0
  160. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/scripts/install-binary.sh +0 -0
  161. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/scripts/install-mcp.sh +0 -0
  162. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/session.py +0 -0
  163. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/settings.py +0 -0
  164. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/signals/__init__.py +0 -0
  165. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/signals/nlp.py +0 -0
  166. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/authoring-hooks/SKILL.md +0 -0
  167. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/authoring-hooks/references/capt-hook-api.md +0 -0
  168. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/authoring-hooks/references/pattern-catalog.md +0 -0
  169. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/authoring-hooks/references/pitfalls.md +0 -0
  170. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/authoring-hooks/references/testing-hooks.md +0 -0
  171. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/bootstrapping-hooks/SKILL.md +0 -0
  172. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/scanning-sessions/SKILL.md +0 -0
  173. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/scanning-sessions/references/pr-workflow.md +0 -0
  174. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/scanning-sessions/references/review-cli.md +0 -0
  175. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/translating-styleguides/SKILL.md +0 -0
  176. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/translating-styleguides/references/llm-rule-patterns.md +0 -0
  177. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/translating-styleguides/references/matcher-reference.md +0 -0
  178. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/skills/translating-styleguides/references/tier-rubric.md +0 -0
  179. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/__init__.py +0 -0
  180. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/client.py +0 -0
  181. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/contracts.py +0 -0
  182. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/review.py +0 -0
  183. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schema.py +0 -0
  184. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schemas/config.schema.json +0 -0
  185. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schemas/context.schema.json +0 -0
  186. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schemas/host-request.schema.json +0 -0
  187. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schemas/host-response.schema.json +0 -0
  188. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schemas/request.schema.json +0 -0
  189. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schemas/response.schema.json +0 -0
  190. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/schemas/tool_registry.schema.json +0 -0
  191. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/validation.py +0 -0
  192. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/snapshots/worker.py +0 -0
  193. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/state.py +0 -0
  194. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/style/__init__.py +0 -0
  195. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/style/ast_grep.py +0 -0
  196. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/style/matchers.py +0 -0
  197. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/style/scope.py +0 -0
  198. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/style/types.py +0 -0
  199. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/tasks.py +0 -0
  200. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/templates/example_hook.py.tmpl +0 -0
  201. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/testing/__init__.py +0 -0
  202. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/testing/fixtures.py +0 -0
  203. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/testing/session_cache.py +0 -0
  204. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/testing/snapshots.py +0 -0
  205. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/turn.py +0 -0
  206. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/types.py +0 -0
  207. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/update/__init__.py +0 -0
  208. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/update/cli.py +0 -0
  209. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/update/settings.py +0 -0
  210. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/update/updater.py +0 -0
  211. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/__init__.py +0 -0
  212. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/automode.py +0 -0
  213. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/caching.py +0 -0
  214. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/fs.py +0 -0
  215. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/globbing.py +0 -0
  216. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/http.py +0 -0
  217. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/model_cache.py +0 -0
  218. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/paths.py +0 -0
  219. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/payload.py +0 -0
  220. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/proc.py +0 -0
  221. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/reqenv.py +0 -0
  222. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/scratch.py +0 -0
  223. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/shell.py +0 -0
  224. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/text.py +0 -0
  225. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/userpath.py +0 -0
  226. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/util/vcs.py +0 -0
  227. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/worker/__init__.py +0 -0
  228. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/worker/__main__.py +0 -0
  229. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/worker/fail_open.py +0 -0
  230. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/worker/protocol.py +0 -0
  231. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/worker/runtime.py +0 -0
  232. {capt_hook-12.77.2 → capt_hook-12.78.0}/captain_hook/worker/service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: capt-hook
3
- Version: 12.77.2
3
+ Version: 12.78.0
4
4
  Summary: Stop repeating yourself to Claude.
5
5
  Project-URL: Homepage, https://github.com/yasyf/captain-hook
6
6
  Project-URL: Documentation, https://yasyf.github.io/captain-hook/
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "captain-hook",
3
- "version": "12.77.0",
3
+ "version": "12.77.1",
4
4
  "displayName": "Captain Hook",
5
5
  "description": "Skills for the capt-hook declarative hook framework: bootstrap gates and nudges from a repo's conventions, and translate style guides into enforced StyleRules.",
6
6
  "author": {
@@ -278,7 +278,13 @@ def dispatch_event(
278
278
  """
279
279
  from captain_hook.context import HookContext
280
280
  from captain_hook.heartbeat import record_heartbeat
281
- from captain_hook.transcripts import lane_transcript_path, lazy_transcript, registered_sources
281
+ from captain_hook.transcripts import (
282
+ ROOT_TAIL_EVENTS,
283
+ lane_transcript_path,
284
+ lazy_transcript,
285
+ registered_sources,
286
+ root_transcript,
287
+ )
282
288
  from captain_hook.util import reqenv
283
289
 
284
290
  record_heartbeat(event, raw)
@@ -293,11 +299,13 @@ def dispatch_event(
293
299
  attach=lambda: registered_sources(session_dir),
294
300
  )
295
301
  background_transcript = transcript.fork()
302
+ parent = raw.get("transcript_path")
296
303
  ctx = HookContext(
297
304
  session=SessionStore(session_dir),
298
305
  transcript=transcript,
299
306
  settings=_state.settings,
300
307
  project_root=root,
308
+ root_transcript=root_transcript(parent, ROOT_TAIL_EVENTS) if parent and resolved_path != parent else None,
301
309
  )
302
310
  evt = event.event_class(_raw=raw, ctx=ctx)
303
311
  within_margin = reqenv.deadline_within(SYNC_DEADLINE_MARGIN_SECONDS)
@@ -94,6 +94,21 @@ def transcript_window(transcript: bool | int | Literal["recent", "full"]) -> int
94
94
  return events
95
95
 
96
96
 
97
+ def render_window(
98
+ transcript: Session | RemoteSession, *, window: int | None, tool_results: bool, budget: Budget | None
99
+ ) -> str:
100
+ from cc_transcript.render import Budget, render_turn
101
+
102
+ src = transcript if window is None else transcript.recent_messages(window)
103
+ if isinstance(src, RemoteSession):
104
+ return src.render(budget=budget or Budget(), tool_results=tool_results)
105
+ return "\n\n".join(
106
+ rendered
107
+ for turn in src.turns
108
+ if (rendered := render_turn(turn, budget=budget or Budget(), tool_results=tool_results))
109
+ )
110
+
111
+
97
112
  @dataclass(frozen=True)
98
113
  class HookEvidence:
99
114
  source_ref: str | None
@@ -109,13 +124,16 @@ class HookEvidence:
109
124
  class HookContext:
110
125
  """Runtime context injected into every hook event.
111
126
 
112
- Holds session state, the transcript ``Session``, settings, and LLM/CLI helpers.
127
+ Holds session state, the transcript ``Session``, settings, and LLM/CLI helpers. Inside a
128
+ subagent or teammate lane, ``transcript`` is the lane's own and ``root_transcript`` tails the
129
+ session that spawned it, where the user's own words live; it is ``None`` everywhere else.
113
130
  """
114
131
 
115
132
  session: SessionStore
116
133
  transcript: Session | RemoteSession | LazyTranscript
117
134
  settings: HooksSettings | None
118
135
  project_root: Path | None = None
136
+ root_transcript: Session | RemoteSession | LazyTranscript | None = None
119
137
  signal_evidence: dict[tuple[int | Literal["turn"], str, bool], tuple[str, ...]] = field(
120
138
  default_factory=dict, init=False
121
139
  )
@@ -238,16 +256,7 @@ class HookContext:
238
256
  tool_results: Render each tool result after its call, as ``result:`` or ``failed:``.
239
257
  budget: Character budgets for prose, tool calls and answer previews; ``None`` is cc-transcript's default.
240
258
  """
241
- from cc_transcript.render import Budget, render_turn
242
-
243
- src = self.t if window is None else self.t.recent_messages(window)
244
- if isinstance(src, RemoteSession):
245
- return src.render(budget=budget or Budget(), tool_results=tool_results)
246
- return "\n\n".join(
247
- rendered
248
- for turn in src.turns
249
- if (rendered := render_turn(turn, budget=budget or Budget(), tool_results=tool_results))
250
- )
259
+ return render_window(self.t, window=window, tool_results=tool_results, budget=budget)
251
260
 
252
261
  def transcript_block(
253
262
  self, *, window: int | None = RECENT_WINDOW, tool_results: bool = False, budget: Budget | None = None
@@ -257,6 +266,19 @@ class HookContext:
257
266
  return f'<transcript evidence="{self.t.evidence_ref}">\n{rendered}\n</transcript>'
258
267
  return f"<transcript>\n{rendered}\n</transcript>"
259
268
 
269
+ def root_transcript_block(
270
+ self, *, window: int | None = RECENT_WINDOW, tool_results: bool = False, budget: Budget | None = None
271
+ ) -> str:
272
+ """The lane's root session rendered like ``transcript_block`` as ``<root_transcript>``; empty outside a lane."""
273
+ from captain_hook.transcripts import LazyTranscript
274
+
275
+ if self.root_transcript is None:
276
+ return ""
277
+ root = self.root_transcript
278
+ src = root.resolve() if isinstance(root, LazyTranscript) else root
279
+ rendered = render_window(src, window=window, tool_results=tool_results, budget=budget)
280
+ return f"<root_transcript>\n{rendered}\n</root_transcript>"
281
+
260
282
  def call_cli(
261
283
  self,
262
284
  args: list[str],
@@ -453,16 +475,29 @@ class HookContext:
453
475
  tool_results: bool,
454
476
  budget: Budget | None = None,
455
477
  diff_text: str | None,
478
+ root_transcript: bool | int | Literal["recent", "full"] = False,
456
479
  ) -> str:
457
- window = transcript_window(transcript) if transcript else None
458
- block = self.transcript_block(window=window, tool_results=tool_results, budget=budget) if transcript else ""
480
+ block = "\n\n".join(
481
+ rendered
482
+ for rendered in (
483
+ self.root_transcript_block(
484
+ window=transcript_window(root_transcript), tool_results=tool_results, budget=budget
485
+ )
486
+ if root_transcript
487
+ else "",
488
+ self.transcript_block(window=transcript_window(transcript), tool_results=tool_results, budget=budget)
489
+ if transcript
490
+ else "",
491
+ )
492
+ if rendered
493
+ )
459
494
  match template:
460
495
  case Prompt():
461
496
  prompt = str(template.context("diff", diff_text))
462
- if not transcript:
497
+ if not block:
463
498
  return prompt
464
499
  return f"{block}\n\n<task>\n{prompt}\n</task>"
465
500
  case str():
466
- wrapped = f"{{transcript}}\n\n<task>\n{template}\n</task>" if transcript else template
501
+ wrapped = f"{{transcript}}\n\n<task>\n{template}\n</task>" if block else template
467
502
  body = wrapped.format(*args, **kwargs, transcript=block)
468
503
  return f"<diff>\n{diff_text}\n</diff>\n\n{body}" if diff_text is not None else body
@@ -15,6 +15,20 @@ GUARDED: str = (
15
15
  "|halt|poweroff|renice|tmux|softwareupdate|pmset|caffeinate|setsid|builtin|noglob|stdbuf|unbuffer|scr"
16
16
  "ipt|watch|parallel|chrt|ionice|taskset|arch|su|chroot|find)\\b"
17
17
  )
18
+ EXEMPT_HEADS: tuple[str, ...] = (
19
+ "cc-slack",
20
+ "ccn",
21
+ "cc-notes",
22
+ "cc-present",
23
+ "cc-transcript",
24
+ "cat",
25
+ "echo",
26
+ "grep",
27
+ "head",
28
+ "jq",
29
+ "tail",
30
+ "wc",
31
+ )
18
32
  FOLDS: dict[str, str] = {"\u0130": "i", "\u0131": "i", "\u017f": "s", "\u212a": "k"}
19
33
  KINDS: tuple[str, ...] = (
20
34
  "host-unavailable",
@@ -36,6 +50,11 @@ PASS_EXIT: int = 3
36
50
  GUARDED_WORD: re.Pattern[str] = re.compile(GUARDED, re.IGNORECASE | re.ASCII)
37
51
  QUOTING_CHARS: re.Pattern[str] = re.compile(QUOTING)
38
52
  FOLD_TABLE: dict[int, str] = str.maketrans(FOLDS)
53
+ ASSIGNMENT: re.Pattern[str] = re.compile("^[A-Za-z_][A-Za-z0-9_]*=")
54
+ LITERAL_HEAD: re.Pattern[str] = re.compile("[A-Za-z0-9_./~+-]+")
55
+ OPAQUE_SHELL: tuple[str, ...] = ("$(", "`", "<(", ">(")
56
+ SEGMENT_BREAKS: frozenset[str] = frozenset(";\n|()")
57
+ QUOTED_ESCAPES: frozenset[str] = frozenset('$`"\\\n')
39
58
 
40
59
 
41
60
  def names_guarded(text: str) -> bool:
@@ -57,6 +76,94 @@ def names_guarded_value(value: object) -> bool:
57
76
  return False
58
77
 
59
78
 
79
+ def first_party_command(tool_input: object) -> bool:
80
+ if not isinstance(tool_input, dict):
81
+ return False
82
+ command = cast(dict[object, object], tool_input).get("command")
83
+ if not isinstance(command, str):
84
+ return False
85
+ joined = command.replace("\\\n", "")
86
+ if any(opaque in joined for opaque in OPAQUE_SHELL):
87
+ return False
88
+ segments = shell_segments(command)
89
+ return segments is not None and all(exempt_segment(words) for words in segments)
90
+
91
+
92
+ def exempt_segment(words: list[tuple[str, str, bool]]) -> bool:
93
+ for raw, cooked, redirect in words:
94
+ if redirect:
95
+ return False
96
+ if ASSIGNMENT.match(raw) is None:
97
+ return LITERAL_HEAD.fullmatch(cooked) is not None and cooked.rpartition("/")[2] in EXEMPT_HEADS
98
+ return True
99
+
100
+
101
+ def shell_segments(command: str) -> list[list[tuple[str, str, bool]]] | None:
102
+ segments: list[list[tuple[str, str, bool]]] = [[]]
103
+ raw: list[str] = []
104
+ cooked: list[str] = []
105
+ started = redirect = after_redirect = False
106
+
107
+ def end_word() -> None:
108
+ nonlocal started, redirect
109
+ if started:
110
+ segments[-1].append(("".join(raw), "".join(cooked), redirect))
111
+ raw.clear()
112
+ cooked.clear()
113
+ started = redirect = False
114
+
115
+ index = 0
116
+ while index < len(command):
117
+ char = command[index]
118
+ redirecting = False
119
+ if char == "\\" and index + 1 == len(command):
120
+ raw.append(char)
121
+ cooked.append(char)
122
+ started = True
123
+ elif char == "\\":
124
+ index += 1
125
+ if command[index] != "\n":
126
+ raw.append(command[index - 1 : index + 1])
127
+ cooked.append(command[index])
128
+ started = True
129
+ elif char == "'":
130
+ end = command.find("'", index + 1)
131
+ if end < 0:
132
+ return None
133
+ raw.append(command[index : end + 1])
134
+ cooked.append(command[index + 1 : end])
135
+ started = True
136
+ index = end
137
+ elif char == '"':
138
+ end = index + 1
139
+ while end < len(command) and command[end] != '"':
140
+ escaped = command[end] == "\\" and end + 1 < len(command) and command[end + 1] in QUOTED_ESCAPES
141
+ end += escaped
142
+ if not (escaped and command[end] == "\n"):
143
+ cooked.append(command[end])
144
+ end += 1
145
+ if end == len(command):
146
+ return None
147
+ raw.append(command[index : end + 1])
148
+ started = True
149
+ index = end
150
+ elif char in " \t":
151
+ end_word()
152
+ elif char in SEGMENT_BREAKS or (char == "&" and not after_redirect and command[index + 1 : index + 2] != ">"):
153
+ end_word()
154
+ segments.append([])
155
+ else:
156
+ raw.append(char)
157
+ cooked.append(char)
158
+ started = True
159
+ redirecting = char in "<>"
160
+ redirect = redirect or redirecting
161
+ after_redirect = redirecting
162
+ index += 1
163
+ end_word()
164
+ return segments
165
+
166
+
60
167
  def mandatory(event: str, payload: bytes) -> bool:
61
168
  if event not in EVENTS:
62
169
  return False
@@ -67,6 +174,8 @@ def mandatory(event: str, payload: bytes) -> bool:
67
174
  if not isinstance(fields, dict):
68
175
  return False
69
176
  payload_fields = cast(dict[object, object], fields)
177
+ if payload_fields.get("tool_name") == "Bash" and first_party_command(payload_fields.get("tool_input")):
178
+ return False
70
179
  return names_guarded_value(payload_fields.get("tool_name")) or names_guarded_value(payload_fields.get("tool_input"))
71
180
 
72
181
 
@@ -87,6 +87,7 @@ def llm_evaluate[M: BaseModel](
87
87
  model: TModel = "small",
88
88
  agent: bool = False,
89
89
  transcript: bool | int | Literal["recent", "full"] = False,
90
+ root_transcript: bool | int | Literal["recent", "full"] = False,
90
91
  tool_results: bool = False,
91
92
  budget: Budget | None = None,
92
93
  diff: bool | str = False,
@@ -100,7 +101,9 @@ def llm_evaluate[M: BaseModel](
100
101
  attaches the transcript window and optional diff, then calls the backend — retrying up
101
102
  to ``retries`` times, feeding a schema validation failure back to the model on re-ask. Returns
102
103
  ``None`` on a skip; raises when the call still fails after the final retry, and at once when the
103
- backend rejects the model itself.
104
+ backend rejects the model itself. ``root_transcript`` takes a window like ``transcript`` and, when
105
+ the event fires inside a subagent or teammate lane, adds that window of the root session that
106
+ spawned the lane as ``<root_transcript>``, so a judge can read the user's words a lane never saw.
104
107
  """
105
108
  from cc_transcript.render import clip
106
109
 
@@ -144,6 +147,7 @@ def llm_evaluate[M: BaseModel](
144
147
  tool_results=tool_results,
145
148
  budget=budget,
146
149
  diff_text=None,
150
+ root_transcript=root_transcript,
147
151
  )
148
152
  asked = dispatched
149
153
  for attempt in count():
@@ -94,6 +94,7 @@ class StubbedContext(HookContext):
94
94
  transcript=ctx.transcript,
95
95
  settings=ctx.settings,
96
96
  project_root=ctx.project_root,
97
+ root_transcript=ctx.root_transcript,
97
98
  llm=llm or {},
98
99
  )
99
100
 
@@ -574,6 +575,12 @@ def input_to_event(
574
575
 
575
576
  evt.__dict__["disallowed_tools"] = frozenset(inp.disallowed_tools or ())
576
577
 
578
+ match inp.root_transcript:
579
+ case TranscriptFixture() as tf:
580
+ evt.ctx.root_transcript = fixture_session(tf.messages)
581
+ case Path() as p:
582
+ evt.ctx.root_transcript = fixture_transcript(p)
583
+
577
584
  evt.ctx = StubbedContext.wrapping(evt.ctx, inp.llm)
578
585
 
579
586
  return evt
@@ -180,6 +180,8 @@ class Input:
180
180
  transcript: Session history for transcript conditions — a path, a
181
181
  ``TranscriptFixture``, or a raw list of transcript-line dicts. A path
182
182
  also lands in the payload as ``evt.transcript_path``, on every event.
183
+ root_transcript: The root session a lane's event reads as ``evt.ctx.root_transcript``,
184
+ in any form ``transcript`` takes; pair it with ``agent_id``.
183
185
  tasks: The native task list read via ``evt.tasks``.
184
186
  background_tasks: Background-task mappings for the ``Stop``/``SubagentStop``
185
187
  payload, surfaced as ``evt.background_tasks`` — the shape that makes a
@@ -227,6 +229,7 @@ class Input:
227
229
  offset: int | None = None
228
230
  limit: int | None = None
229
231
  transcript: Path | TranscriptFixture | list[dict[str, Any]] | None = None
232
+ root_transcript: Path | TranscriptFixture | list[dict[str, Any]] | None = None
230
233
  tasks: list[dict[str, Any]] | None = None
231
234
  background_tasks: list[dict[str, Any]] | None = None
232
235
  llm: dict[str, Any] | None = None
@@ -236,12 +239,17 @@ class Input:
236
239
  env: dict[str, str] | None = None
237
240
 
238
241
  def __post_init__(self) -> None:
239
- match self.transcript:
240
- case list():
241
- object.__setattr__(self, "transcript", TranscriptFixture(self.transcript))
242
- case str():
243
- object.__setattr__(self, "transcript", Path(self.transcript))
244
- checks = FIELD_TYPES | {"file": (str, FileFixture), "transcript": (Path, TranscriptFixture)}
242
+ for name in ("transcript", "root_transcript"):
243
+ match getattr(self, name):
244
+ case list() as messages:
245
+ object.__setattr__(self, name, TranscriptFixture(messages))
246
+ case str() as path:
247
+ object.__setattr__(self, name, Path(path))
248
+ checks = FIELD_TYPES | {
249
+ "file": (str, FileFixture),
250
+ "transcript": (Path, TranscriptFixture),
251
+ "root_transcript": (Path, TranscriptFixture),
252
+ }
245
253
  for name, types in checks.items():
246
254
  if (value := getattr(self, name)) is not None and not isinstance(value, types):
247
255
  raise TypeError(
@@ -28,6 +28,7 @@ if TYPE_CHECKING:
28
28
  # A session id becomes a filesystem path component via ``ensure_session``; external callers (CLI, MCP)
29
29
  # must not smuggle path separators or traversal past that trust boundary.
30
30
  INVALID_SESSION_ID = re.compile(r"[/\\]|\x00|^\.\.?$")
31
+ ROOT_TAIL_EVENTS = 256
31
32
 
32
33
 
33
34
  def user_classifier(events: Sequence[TranscriptEvent], *, path: Path | None = None) -> UserClassifier:
@@ -316,6 +317,13 @@ def lazy_transcript(
316
317
  return LazyTranscript(TranscriptPins(load, partial(tail, path) if path else None), seed=True)
317
318
 
318
319
 
320
+ def root_transcript(path: str | Path, events: int) -> LazyTranscript:
321
+ """The newest ``events`` events of a lane's root session transcript, tailed on first touch."""
322
+ return LazyTranscript(
323
+ TranscriptPins(partial(guarded_load, path, lambda source: tail_transcript(source, events))), seed=True
324
+ )
325
+
326
+
319
327
  def guarded_load[S: Session | RemoteSession](path: str | Path | None, read: Callable[[str | Path | None], S]) -> S:
320
328
  from captain_hook.snapshots.client import EvidenceIncomplete
321
329
 
@@ -312,6 +312,7 @@ def render_guard_literal(definition: dict[str, Any]) -> str:
312
312
  events = ", ".join(literal(event) for event in definition["events"])
313
313
  folds = ", ".join(f"{rune_literal(source)}: {literal(target)}" for source, target in definition["folds"].items())
314
314
  kinds = "".join(f" {literal(kind)},\n" for kind in definition["kinds"])
315
+ exempt_heads = "".join(f" {literal(head)},\n" for head in definition["exempt_heads"])
315
316
  return (
316
317
  f"{GUARD_HEADER}\n"
317
318
  "from __future__ import annotations\n\n"
@@ -323,6 +324,7 @@ def render_guard_literal(definition: dict[str, Any]) -> str:
323
324
  f"EVENTS: frozenset[str] = frozenset({{{events}}})\n"
324
325
  f"QUOTING: str = {wrapped_literal(definition['quoting'])}\n"
325
326
  f"GUARDED: str = {wrapped_literal(definition['guarded'])}\n"
327
+ f"EXEMPT_HEADS: tuple[str, ...] = (\n{exempt_heads})\n"
326
328
  f"FOLDS: dict[str, str] = {{{folds}}}\n"
327
329
  f"KINDS: tuple[str, ...] = (\n{kinds})\n"
328
330
  f"REASON: str = {wrapped_literal(definition['reason'])}\n"
@@ -330,7 +332,12 @@ def render_guard_literal(definition: dict[str, Any]) -> str:
330
332
  f"PASS_EXIT: int = {definition['pass_exit']}\n"
331
333
  "GUARDED_WORD: re.Pattern[str] = re.compile(GUARDED, re.IGNORECASE | re.ASCII)\n"
332
334
  "QUOTING_CHARS: re.Pattern[str] = re.compile(QUOTING)\n"
333
- "FOLD_TABLE: dict[int, str] = str.maketrans(FOLDS)\n\n\n"
335
+ "FOLD_TABLE: dict[int, str] = str.maketrans(FOLDS)\n"
336
+ 'ASSIGNMENT: re.Pattern[str] = re.compile("^[A-Za-z_][A-Za-z0-9_]*=")\n'
337
+ 'LITERAL_HEAD: re.Pattern[str] = re.compile("[A-Za-z0-9_./~+-]+")\n'
338
+ 'OPAQUE_SHELL: tuple[str, ...] = ("$(", "`", "<(", ">(")\n'
339
+ 'SEGMENT_BREAKS: frozenset[str] = frozenset(";\\n|()")\n'
340
+ "QUOTED_ESCAPES: frozenset[str] = frozenset('$`\"\\\\\\n')\n\n\n"
334
341
  "def names_guarded(text: str) -> bool:\n"
335
342
  ' return GUARDED_WORD.search(QUOTING_CHARS.sub("", text).translate(FOLD_TABLE)) is not None\n\n\n'
336
343
  "# isinstance, not match: the plugin's bin/hook runs this under the first python3 on PATH, stock macOS 3.9 "
@@ -347,6 +354,88 @@ def render_guard_literal(definition: dict[str, Any]) -> str:
347
354
  " if isinstance(value, dict):\n"
348
355
  " return any(names_guarded_value(item) for item in cast(dict[object, object], value).values())\n"
349
356
  " return False\n\n\n"
357
+ "def first_party_command(tool_input: object) -> bool:\n"
358
+ " if not isinstance(tool_input, dict):\n"
359
+ " return False\n"
360
+ ' command = cast(dict[object, object], tool_input).get("command")\n'
361
+ " if not isinstance(command, str):\n"
362
+ " return False\n"
363
+ ' joined = command.replace("\\\\\\n", "")\n'
364
+ " if any(opaque in joined for opaque in OPAQUE_SHELL):\n"
365
+ " return False\n"
366
+ " segments = shell_segments(command)\n"
367
+ " return segments is not None and all(exempt_segment(words) for words in segments)\n\n\n"
368
+ "def exempt_segment(words: list[tuple[str, str, bool]]) -> bool:\n"
369
+ " for raw, cooked, redirect in words:\n"
370
+ " if redirect:\n"
371
+ " return False\n"
372
+ " if ASSIGNMENT.match(raw) is None:\n"
373
+ ' return LITERAL_HEAD.fullmatch(cooked) is not None and cooked.rpartition("/")[2] in EXEMPT_HEADS\n'
374
+ " return True\n\n\n"
375
+ "def shell_segments(command: str) -> list[list[tuple[str, str, bool]]] | None:\n"
376
+ " segments: list[list[tuple[str, str, bool]]] = [[]]\n"
377
+ " raw: list[str] = []\n"
378
+ " cooked: list[str] = []\n"
379
+ " started = redirect = after_redirect = False\n\n"
380
+ " def end_word() -> None:\n"
381
+ " nonlocal started, redirect\n"
382
+ " if started:\n"
383
+ ' segments[-1].append(("".join(raw), "".join(cooked), redirect))\n'
384
+ " raw.clear()\n"
385
+ " cooked.clear()\n"
386
+ " started = redirect = False\n\n"
387
+ " index = 0\n"
388
+ " while index < len(command):\n"
389
+ " char = command[index]\n"
390
+ " redirecting = False\n"
391
+ ' if char == "\\\\" and index + 1 == len(command):\n'
392
+ " raw.append(char)\n"
393
+ " cooked.append(char)\n"
394
+ " started = True\n"
395
+ ' elif char == "\\\\":\n'
396
+ " index += 1\n"
397
+ ' if command[index] != "\\n":\n'
398
+ " raw.append(command[index - 1 : index + 1])\n"
399
+ " cooked.append(command[index])\n"
400
+ " started = True\n"
401
+ ' elif char == "\'":\n'
402
+ ' end = command.find("\'", index + 1)\n'
403
+ " if end < 0:\n"
404
+ " return None\n"
405
+ " raw.append(command[index : end + 1])\n"
406
+ " cooked.append(command[index + 1 : end])\n"
407
+ " started = True\n"
408
+ " index = end\n"
409
+ " elif char == '\"':\n"
410
+ " end = index + 1\n"
411
+ " while end < len(command) and command[end] != '\"':\n"
412
+ ' escaped = command[end] == "\\\\" and end + 1 < len(command) and '
413
+ "command[end + 1] in QUOTED_ESCAPES\n"
414
+ " end += escaped\n"
415
+ ' if not (escaped and command[end] == "\\n"):\n'
416
+ " cooked.append(command[end])\n"
417
+ " end += 1\n"
418
+ " if end == len(command):\n"
419
+ " return None\n"
420
+ " raw.append(command[index : end + 1])\n"
421
+ " started = True\n"
422
+ " index = end\n"
423
+ ' elif char in " \\t":\n'
424
+ " end_word()\n"
425
+ ' elif char in SEGMENT_BREAKS or (char == "&" and not after_redirect and '
426
+ 'command[index + 1 : index + 2] != ">"):\n'
427
+ " end_word()\n"
428
+ " segments.append([])\n"
429
+ " else:\n"
430
+ " raw.append(char)\n"
431
+ " cooked.append(char)\n"
432
+ " started = True\n"
433
+ ' redirecting = char in "<>"\n'
434
+ " redirect = redirect or redirecting\n"
435
+ " after_redirect = redirecting\n"
436
+ " index += 1\n"
437
+ " end_word()\n"
438
+ " return segments\n\n\n"
350
439
  "def mandatory(event: str, payload: bytes) -> bool:\n"
351
440
  " if event not in EVENTS:\n"
352
441
  " return False\n"
@@ -357,6 +446,8 @@ def render_guard_literal(definition: dict[str, Any]) -> str:
357
446
  " if not isinstance(fields, dict):\n"
358
447
  " return False\n"
359
448
  " payload_fields = cast(dict[object, object], fields)\n"
449
+ ' if payload_fields.get("tool_name") == "Bash" and first_party_command(payload_fields.get("tool_input")):\n'
450
+ " return False\n"
360
451
  ' return names_guarded_value(payload_fields.get("tool_name")) or '
361
452
  'names_guarded_value(payload_fields.get("tool_input"))\n\n\n'
362
453
  "def deny_envelope(event: str, kind: str) -> str:\n"
@@ -2,6 +2,7 @@
2
2
  "events": ["PreToolUse", "PermissionRequest"],
3
3
  "quoting": "[\\\\'\"\\[\\]]",
4
4
  "guarded": "\\b(kill|pkill|killall|killall5|fuser|skill|snice|kill-port|orca|launchctl|osascript|shutdown|reboot|halt|poweroff|renice|tmux|softwareupdate|pmset|caffeinate|setsid|builtin|noglob|stdbuf|unbuffer|script|watch|parallel|chrt|ionice|taskset|arch|su|chroot|find)\\b",
5
+ "exempt_heads": ["cc-slack", "ccn", "cc-notes", "cc-present", "cc-transcript", "cat", "echo", "grep", "head", "jq", "tail", "wc"],
5
6
  "folds": {
6
7
  "İ": "i",
7
8
  "ı": "i",
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "capt-hook"
3
3
  # Inert sentinel — the real version is stamped from the release tag (uv version --frozen).
4
- version = "12.77.2"
4
+ version = "12.78.0"
5
5
  description = "Stop repeating yourself to Claude."
6
6
  readme = "README.md"
7
7
  license = "PolyForm-Noncommercial-1.0.0"
File without changes
File without changes
File without changes