@hasna/hooks 0.2.20 → 0.3.0

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 (64) hide show
  1. package/README.md +45 -2
  2. package/bin/index.js +1157 -84
  3. package/dist/db/migrations/002_session_events.d.ts +10 -0
  4. package/dist/db/migrations/003_user_prompt_submit_event.d.ts +10 -0
  5. package/dist/db/pg-migrations.d.ts +1 -1
  6. package/dist/db/remote-storage.d.ts +9 -0
  7. package/dist/db/schema.d.ts +4 -3
  8. package/dist/db/storage-sync.d.ts +57 -0
  9. package/dist/index.d.ts +16 -3
  10. package/dist/index.js +1042 -58
  11. package/dist/lib/installer.d.ts +25 -5
  12. package/dist/lib/registry.d.ts +3 -1
  13. package/dist/storage.d.ts +4 -0
  14. package/dist/storage.js +696 -0
  15. package/hooks/codewith-native-common.test.ts +61 -0
  16. package/hooks/codewith-native-common.ts +478 -0
  17. package/hooks/hook-agent-rules-version-check/LICENSE +191 -0
  18. package/hooks/hook-agent-rules-version-check/README.md +50 -0
  19. package/hooks/hook-agent-rules-version-check/package.json +53 -0
  20. package/hooks/hook-agent-rules-version-check/src/hook.test.ts +104 -0
  21. package/hooks/hook-agent-rules-version-check/src/hook.ts +215 -0
  22. package/hooks/hook-agent-rules-version-check/tsconfig.json +25 -0
  23. package/hooks/hook-announce-start/README.md +7 -5
  24. package/hooks/hook-announce-start/package.json +2 -2
  25. package/hooks/hook-announce-start/src/hook.ts +33 -14
  26. package/hooks/hook-fleet-blockers-gate/LICENSE +191 -0
  27. package/hooks/hook-fleet-blockers-gate/README.md +39 -0
  28. package/hooks/hook-fleet-blockers-gate/package.json +52 -0
  29. package/hooks/hook-fleet-blockers-gate/src/hook.test.ts +106 -0
  30. package/hooks/hook-fleet-blockers-gate/src/hook.ts +242 -0
  31. package/hooks/hook-fleet-blockers-gate/tsconfig.json +25 -0
  32. package/hooks/hook-fleet-catchup/LICENSE +191 -0
  33. package/hooks/hook-fleet-catchup/README.md +40 -0
  34. package/hooks/hook-fleet-catchup/package.json +52 -0
  35. package/hooks/hook-fleet-catchup/src/hook.test.ts +156 -0
  36. package/hooks/hook-fleet-catchup/src/hook.ts +283 -0
  37. package/hooks/hook-fleet-catchup/tsconfig.json +25 -0
  38. package/hooks/pre-bash/README.md +17 -0
  39. package/hooks/pre-bash/package.json +12 -0
  40. package/hooks/pre-bash/src/hook.ts +103 -0
  41. package/hooks/prompt-guard/README.md +17 -0
  42. package/hooks/prompt-guard/package.json +12 -0
  43. package/hooks/prompt-guard/src/hook.ts +76 -0
  44. package/hooks/session-start/README.md +17 -0
  45. package/hooks/session-start/package.json +12 -0
  46. package/hooks/session-start/src/hook.ts +150 -0
  47. package/hooks/stop-sync/README.md +17 -0
  48. package/hooks/stop-sync/package.json +12 -0
  49. package/hooks/stop-sync/src/hook.ts +69 -0
  50. package/hooks/worktree-guard/README.md +17 -0
  51. package/hooks/worktree-guard/package.json +12 -0
  52. package/hooks/worktree-guard/src/hook.ts +88 -0
  53. package/package.json +14 -6
  54. package/dist/cli/components/App.d.ts +0 -7
  55. package/dist/cli/components/CategorySelect.d.ts +0 -7
  56. package/dist/cli/components/DataTable.d.ts +0 -11
  57. package/dist/cli/components/Header.d.ts +0 -7
  58. package/dist/cli/components/HookSelect.d.ts +0 -11
  59. package/dist/cli/components/InstallProgress.d.ts +0 -9
  60. package/dist/cli/components/SearchView.d.ts +0 -9
  61. package/dist/cli/index.d.ts +0 -2
  62. package/dist/lib/db-writer.d.ts +0 -9
  63. package/dist/mcp/http.d.ts +0 -16
  64. package/dist/mcp/server.d.ts +0 -17
package/README.md CHANGED
@@ -26,12 +26,55 @@ hooks --help
26
26
  - `hooks doctor`
27
27
  - `hooks run`
28
28
 
29
+ ## Codewith-native hooks
30
+
31
+ @hasna/hooks includes five unprefixed Codewith-native hook names:
32
+
33
+ - `session-start` — `SessionStart` digest and additional context.
34
+ - `prompt-guard` — `UserPromptSubmit` guard for pasted fake policy/freeze/run-this-now content.
35
+ - `pre-bash` — `PreToolUse` Bash gate for staged secrets scans and risky-op comms checks.
36
+ - `worktree-guard` — `PreToolUse` guard for managed repos worktree boundaries.
37
+ - `stop-sync` — `Stop` turn-end heartbeat/evidence best effort.
38
+
39
+ For Codewith, the installer is renderer-safe by default: it emits a TOML
40
+ fragment instead of mutating managed `~/.codewith/config.toml`.
41
+
42
+ ```bash
43
+ hooks install session-start prompt-guard pre-bash worktree-guard stop-sync --target codewith
44
+ ```
45
+
46
+ Apply that fragment through `open-configs` or the managed config renderer. A
47
+ direct write path exists only for explicit local/test use:
48
+
49
+ ```bash
50
+ hooks install session-start --target codewith --apply-codewith --codewith-config /tmp/codewith-config.toml
51
+ ```
52
+
29
53
  ## Storage
30
54
 
31
55
  Hooks stores data locally by default in `~/.hasna/hooks/` and uses SQLite
32
56
  directly for hook event history. The package owns its database schema and
33
- migrations; it does not depend on the deprecated shared runtime or its CLI. Use
34
- the `hooks log` commands to inspect local hook event data.
57
+ migrations; it does not depend on the deprecated shared runtime or its CLI.
58
+ The repo includes its own PostgreSQL migration definitions for optional remote
59
+ storage deployments. Use the `hooks log` commands to inspect local hook event
60
+ data.
61
+
62
+ ```bash
63
+ hooks storage status --json
64
+ HASNA_HOOKS_DATABASE_URL=postgres://... hooks storage push --tables hook_events,feedback --json
65
+ hooks storage pull --json
66
+ hooks storage sync --json
67
+ ```
68
+
69
+ Configure database storage with `HASNA_HOOKS_DATABASE_URL` or fallback
70
+ `HOOKS_DATABASE_URL`. Optional storage mode env vars are
71
+ `HASNA_HOOKS_STORAGE_MODE` and `HOOKS_STORAGE_MODE`, with `local`, `hybrid`, or
72
+ `remote` values.
73
+
74
+ ## Runtime model
75
+
76
+ This package is an npm/local CLI, MCP server, and static dashboard package. It
77
+ does not require a deployed cloud or self-hosted runtime to install or run hooks.
35
78
 
36
79
  ## Data Directory
37
80