@patrick-rodgers/cron-claude 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,11 @@
1
+ /**
2
+ * Cron-Claude - Scheduled Claude task execution
3
+ * Main entry point and exports
4
+ */
5
+ export * from './types.js';
6
+ export * from './config.js';
7
+ export * from './logger.js';
8
+ export * from './executor.js';
9
+ export * from './scheduler.js';
10
+ export * from './notifier.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * Cron-Claude - Scheduled Claude task execution
4
+ * Main entry point and exports
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ __exportStar(require("./types.js"), exports);
22
+ __exportStar(require("./config.js"), exports);
23
+ __exportStar(require("./logger.js"), exports);
24
+ __exportStar(require("./executor.js"), exports);
25
+ __exportStar(require("./scheduler.js"), exports);
26
+ __exportStar(require("./notifier.js"), exports);
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,gDAA8B;AAC9B,iDAA+B;AAC/B,gDAA8B"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Audit logger with HMAC-SHA256 signing
3
+ * Logs all task executions to odsp-memory skill with cryptographic signatures
4
+ */
5
+ import { TaskLog } from './types.js';
6
+ /**
7
+ * Create HMAC-SHA256 signature for content
8
+ */
9
+ export declare function signContent(content: string, secretKey?: string): string;
10
+ /**
11
+ * Verify HMAC-SHA256 signature
12
+ */
13
+ export declare function verifySignature(content: string, signature: string, secretKey?: string): boolean;
14
+ /**
15
+ * Format task log as markdown with frontmatter
16
+ */
17
+ export declare function formatTaskLog(log: TaskLog): string;
18
+ /**
19
+ * Save log to memory skill
20
+ */
21
+ export declare function saveLogToMemory(log: TaskLog): void;
22
+ /**
23
+ * Verify a log file's signature
24
+ */
25
+ export declare function verifyLogFile(markdown: string): {
26
+ valid: boolean;
27
+ log?: TaskLog;
28
+ error?: string;
29
+ };
30
+ /**
31
+ * Create a new log entry
32
+ */
33
+ export declare function createLog(taskId: string): TaskLog;
34
+ /**
35
+ * Add a step to the log
36
+ */
37
+ export declare function addLogStep(log: TaskLog, action: string, output?: string, error?: string): void;
38
+ /**
39
+ * Finalize and save log
40
+ */
41
+ export declare function finalizeLog(log: TaskLog, success: boolean): void;
42
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,OAAO,EAAW,MAAM,YAAY,CAAC;AAG9C;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAKvE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAGT;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAsClD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAkClD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG;IAC/C,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAiCA;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAQjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAO9F;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAGhE"}
package/dist/logger.js ADDED
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ /**
3
+ * Audit logger with HMAC-SHA256 signing
4
+ * Logs all task executions to odsp-memory skill with cryptographic signatures
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.signContent = signContent;
11
+ exports.verifySignature = verifySignature;
12
+ exports.formatTaskLog = formatTaskLog;
13
+ exports.saveLogToMemory = saveLogToMemory;
14
+ exports.verifyLogFile = verifyLogFile;
15
+ exports.createLog = createLog;
16
+ exports.addLogStep = addLogStep;
17
+ exports.finalizeLog = finalizeLog;
18
+ const crypto_1 = require("crypto");
19
+ const child_process_1 = require("child_process");
20
+ const gray_matter_1 = __importDefault(require("gray-matter"));
21
+ const config_js_1 = require("./config.js");
22
+ /**
23
+ * Create HMAC-SHA256 signature for content
24
+ */
25
+ function signContent(content, secretKey) {
26
+ const key = secretKey || (0, config_js_1.getSecretKey)();
27
+ const hmac = (0, crypto_1.createHmac)('sha256', key);
28
+ hmac.update(content);
29
+ return hmac.digest('hex');
30
+ }
31
+ /**
32
+ * Verify HMAC-SHA256 signature
33
+ */
34
+ function verifySignature(content, signature, secretKey) {
35
+ const expectedSignature = signContent(content, secretKey);
36
+ return signature === expectedSignature;
37
+ }
38
+ /**
39
+ * Format task log as markdown with frontmatter
40
+ */
41
+ function formatTaskLog(log) {
42
+ const content = `# Task Execution Log: ${log.taskId}
43
+
44
+ **Execution ID:** ${log.executionId}
45
+ **Status:** ${log.status}
46
+ **Started:** ${log.timestamp}
47
+
48
+ ## Execution Steps
49
+
50
+ ${log.steps
51
+ .map((step, idx) => `### Step ${idx + 1}: ${step.action}
52
+ **Time:** ${step.timestamp}
53
+ ${step.output ? `\n**Output:**\n\`\`\`\n${step.output}\n\`\`\`\n` : ''}
54
+ ${step.error ? `\n**Error:**\n\`\`\`\n${step.error}\n\`\`\`\n` : ''}`)
55
+ .join('\n\n')}
56
+
57
+ ## Summary
58
+ Total steps: ${log.steps.length}
59
+ Status: ${log.status}
60
+ `;
61
+ // Sign the content
62
+ const signature = signContent(content);
63
+ // Create frontmatter
64
+ const frontmatter = {
65
+ category: 'cron-task',
66
+ taskId: log.taskId,
67
+ executionId: log.executionId,
68
+ timestamp: log.timestamp,
69
+ status: log.status,
70
+ signature,
71
+ };
72
+ // Combine frontmatter and content
73
+ return gray_matter_1.default.stringify(content, frontmatter);
74
+ }
75
+ /**
76
+ * Save log to memory skill
77
+ */
78
+ function saveLogToMemory(log) {
79
+ const markdown = formatTaskLog(log);
80
+ const tempFile = `${process.env.TEMP || '/tmp'}/cron-claude-log-${log.executionId}.md`;
81
+ // Write to temp file
82
+ const fs = require('fs');
83
+ fs.writeFileSync(tempFile, markdown, 'utf-8');
84
+ try {
85
+ // Store in memory skill
86
+ const category = 'cron-task';
87
+ const content = `Task ${log.taskId} execution ${log.executionId}: ${log.status}`;
88
+ (0, child_process_1.execSync)(`odsp-memory remember ${category} "${content}"`, {
89
+ encoding: 'utf-8',
90
+ stdio: 'pipe',
91
+ });
92
+ console.log(`✓ Logged execution ${log.executionId} to memory skill`);
93
+ }
94
+ catch (error) {
95
+ console.error('Failed to save log to memory skill:', error);
96
+ // Fallback: save to local file
97
+ const fs = require('fs');
98
+ const fallbackPath = `./logs/${log.taskId}-${log.executionId}.md`;
99
+ fs.mkdirSync('./logs', { recursive: true });
100
+ fs.writeFileSync(fallbackPath, markdown, 'utf-8');
101
+ console.log(`✓ Saved log to fallback location: ${fallbackPath}`);
102
+ }
103
+ finally {
104
+ // Clean up temp file
105
+ try {
106
+ const fs = require('fs');
107
+ fs.unlinkSync(tempFile);
108
+ }
109
+ catch { }
110
+ }
111
+ }
112
+ /**
113
+ * Verify a log file's signature
114
+ */
115
+ function verifyLogFile(markdown) {
116
+ try {
117
+ const parsed = (0, gray_matter_1.default)(markdown);
118
+ const { signature, ...frontmatter } = parsed.data;
119
+ if (!signature) {
120
+ return { valid: false, error: 'No signature found in log file' };
121
+ }
122
+ // Verify signature
123
+ const isValid = verifySignature(parsed.content, signature);
124
+ if (isValid) {
125
+ return {
126
+ valid: true,
127
+ log: {
128
+ taskId: frontmatter.taskId,
129
+ executionId: frontmatter.executionId,
130
+ timestamp: frontmatter.timestamp,
131
+ status: frontmatter.status,
132
+ steps: [], // Would need to parse from content
133
+ signature,
134
+ },
135
+ };
136
+ }
137
+ else {
138
+ return { valid: false, error: 'Signature verification failed' };
139
+ }
140
+ }
141
+ catch (error) {
142
+ return {
143
+ valid: false,
144
+ error: `Failed to parse log: ${error}`,
145
+ };
146
+ }
147
+ }
148
+ /**
149
+ * Create a new log entry
150
+ */
151
+ function createLog(taskId) {
152
+ return {
153
+ taskId,
154
+ executionId: `exec-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
155
+ timestamp: new Date().toISOString(),
156
+ status: 'running',
157
+ steps: [],
158
+ };
159
+ }
160
+ /**
161
+ * Add a step to the log
162
+ */
163
+ function addLogStep(log, action, output, error) {
164
+ log.steps.push({
165
+ timestamp: new Date().toISOString(),
166
+ action,
167
+ output,
168
+ error,
169
+ });
170
+ }
171
+ /**
172
+ * Finalize and save log
173
+ */
174
+ function finalizeLog(log, success) {
175
+ log.status = success ? 'success' : 'failure';
176
+ saveLogToMemory(log);
177
+ }
178
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAWH,kCAKC;AAKD,0CAOC;AAKD,sCAsCC;AAKD,0CAkCC;AAKD,sCAqCC;AAKD,8BAQC;AAKD,gCAOC;AAKD,kCAGC;AAvLD,mCAAoC;AACpC,iDAAyC;AACzC,8DAAiC;AAEjC,2CAA2C;AAE3C;;GAEG;AACH,SAAgB,WAAW,CAAC,OAAe,EAAE,SAAkB;IAC7D,MAAM,GAAG,GAAG,SAAS,IAAI,IAAA,wBAAY,GAAE,CAAC;IACxC,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAC7B,OAAe,EACf,SAAiB,EACjB,SAAkB;IAElB,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,EAAE,SAAS,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E,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QAC5E,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,GAAY,EAAE,MAAc,EAAE,MAAe,EAAE,KAAc;IACtF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;QACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,MAAM;QACN,MAAM;QACN,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,GAAY,EAAE,OAAgB;IACxD,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7C,eAAe,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Cron-Claude MCP Server
4
+ * Exposes scheduled task management via Model Context Protocol
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=mcp-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;GAGG"}