@memextend/claude-code 0.1.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.
@@ -0,0 +1,5 @@
1
+ export declare const HOOKS: {
2
+ readonly sessionStart: "session-start.cjs";
3
+ readonly stop: "stop.cjs";
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,KAAK;;;CAGR,CAAC"}
@@ -0,0 +1,9 @@
1
+ // packages/adapters/claude-code/src/hooks/index.ts
2
+ // Copyright (c) 2026 ZodTTD LLC. MIT License.
3
+ // Hooks are standalone scripts, not library exports
4
+ // They are bundled and executed by Claude Code directly
5
+ export const HOOKS = {
6
+ sessionStart: 'session-start.cjs',
7
+ stop: 'stop.cjs',
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,8CAA8C;AAE9C,oDAAoD;AACpD,wDAAwD;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,YAAY,EAAE,mBAAmB;IACjC,IAAI,EAAE,UAAU;CACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function log(hook: string, message: string, data?: Record<string, unknown>): void;
2
+ export declare function logError(hook: string, error: unknown): void;
3
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/hooks/logger.ts"],"names":[],"mappings":"AAoCA,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAcvF;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAY3D"}
@@ -0,0 +1,62 @@
1
+ // packages/adapters/claude-code/src/hooks/logger.ts
2
+ // Copyright (c) 2026 ZodTTD LLC. MIT License.
3
+ import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'fs';
4
+ import { join } from 'path';
5
+ import { homedir } from 'os';
6
+ const MEMEXTEND_DIR = join(homedir(), '.memextend');
7
+ const LOGS_DIR = join(MEMEXTEND_DIR, 'logs');
8
+ const CONFIG_PATH = join(MEMEXTEND_DIR, 'config.json');
9
+ let debugEnabled = null;
10
+ function isDebugEnabled() {
11
+ if (debugEnabled !== null)
12
+ return debugEnabled;
13
+ try {
14
+ if (existsSync(CONFIG_PATH)) {
15
+ const config = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
16
+ debugEnabled = config.debug === true;
17
+ }
18
+ else {
19
+ debugEnabled = false;
20
+ }
21
+ }
22
+ catch {
23
+ debugEnabled = false;
24
+ }
25
+ return debugEnabled;
26
+ }
27
+ function ensureLogsDir() {
28
+ if (!existsSync(LOGS_DIR)) {
29
+ mkdirSync(LOGS_DIR, { recursive: true });
30
+ }
31
+ }
32
+ export function log(hook, message, data) {
33
+ if (!isDebugEnabled())
34
+ return;
35
+ try {
36
+ ensureLogsDir();
37
+ const timestamp = new Date().toISOString();
38
+ const logFile = join(LOGS_DIR, 'hooks.log');
39
+ const entry = data
40
+ ? `[${timestamp}] [${hook}] ${message} ${JSON.stringify(data)}\n`
41
+ : `[${timestamp}] [${hook}] ${message}\n`;
42
+ appendFileSync(logFile, entry);
43
+ }
44
+ catch {
45
+ // Silently ignore logging errors
46
+ }
47
+ }
48
+ export function logError(hook, error) {
49
+ // Always log errors, regardless of debug setting
50
+ try {
51
+ ensureLogsDir();
52
+ const timestamp = new Date().toISOString();
53
+ const logFile = join(LOGS_DIR, 'hooks.log');
54
+ const errorMsg = error instanceof Error ? error.message : String(error);
55
+ const entry = `[${timestamp}] [${hook}] ERROR: ${errorMsg}\n`;
56
+ appendFileSync(logFile, entry);
57
+ }
58
+ catch {
59
+ // Silently ignore logging errors
60
+ }
61
+ }
62
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/hooks/logger.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,8CAA8C;AAE9C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAEvD,IAAI,YAAY,GAAmB,IAAI,CAAC;AAExC,SAAS,cAAc;IACrB,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,YAAY,CAAC;IAE/C,IAAI,CAAC;QACH,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YAC9D,YAAY,GAAG,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,aAAa;IACpB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,SAAS,CAAC,QAAQ,EAAE,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