@hasna/hooks 0.2.9 → 0.2.11

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 (3) hide show
  1. package/bin/index.js +9036 -105
  2. package/dist/index.js +14 -5
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -28,9 +28,18 @@ __export(exports_profiles, {
28
28
  deleteProfile: () => deleteProfile,
29
29
  createProfile: () => createProfile
30
30
  });
31
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, readdirSync, rmSync } from "fs";
31
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, readdirSync, rmSync, cpSync } from "fs";
32
32
  import { join as join2 } from "path";
33
33
  import { homedir as homedir2 } from "os";
34
+ function resolveProfilesDir() {
35
+ const newDir = join2(homedir2(), ".hasna", "hooks", "profiles");
36
+ const oldDir = join2(homedir2(), ".hooks", "profiles");
37
+ if (!existsSync2(newDir) && existsSync2(oldDir)) {
38
+ mkdirSync2(join2(homedir2(), ".hasna", "hooks"), { recursive: true });
39
+ cpSync(oldDir, newDir, { recursive: true });
40
+ }
41
+ return newDir;
42
+ }
34
43
  function ensureProfilesDir() {
35
44
  if (!existsSync2(PROFILES_DIR)) {
36
45
  mkdirSync2(PROFILES_DIR, { recursive: true });
@@ -146,7 +155,7 @@ function importProfiles(profiles) {
146
155
  }
147
156
  var PROFILES_DIR;
148
157
  var init_profiles = __esm(() => {
149
- PROFILES_DIR = join2(homedir2(), ".hooks", "profiles");
158
+ PROFILES_DIR = resolveProfilesDir();
150
159
  });
151
160
 
152
161
  // src/lib/registry.ts
@@ -416,7 +425,7 @@ var HOOKS = [
416
425
  {
417
426
  name: "sessionlog",
418
427
  displayName: "Session Log",
419
- description: "Logs every tool call to SQLite (~/.hooks/hooks.db)",
428
+ description: "Logs every tool call to SQLite (~/.hasna/hooks/hooks.db)",
420
429
  version: "0.1.0",
421
430
  category: "Observability",
422
431
  event: "PostToolUse",
@@ -426,7 +435,7 @@ var HOOKS = [
426
435
  {
427
436
  name: "commandlog",
428
437
  displayName: "Command Log",
429
- description: "Logs every Bash command to SQLite (~/.hooks/hooks.db)",
438
+ description: "Logs every Bash command to SQLite (~/.hasna/hooks/hooks.db)",
430
439
  version: "0.1.0",
431
440
  category: "Observability",
432
441
  event: "PostToolUse",
@@ -446,7 +455,7 @@ var HOOKS = [
446
455
  {
447
456
  name: "errornotify",
448
457
  displayName: "Error Notify",
449
- description: "Detects tool failures and logs errors to SQLite (~/.hooks/hooks.db)",
458
+ description: "Detects tool failures and logs errors to SQLite (~/.hasna/hooks/hooks.db)",
450
459
  version: "0.1.0",
451
460
  category: "Observability",
452
461
  event: "PostToolUse",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/hooks",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Open source hooks library for AI coding agents - Install safety, quality, and automation hooks with a single command",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,6 +42,7 @@
42
42
  "typescript": "^5"
43
43
  },
44
44
  "dependencies": {
45
+ "@hasna/cloud": "^0.1.0",
45
46
  "@modelcontextprotocol/sdk": "^1.26.0",
46
47
  "chalk": "^5.3.0",
47
48
  "commander": "^12.1.0",