@openmnemo/sync 0.1.0 → 0.2.1
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.
- package/LICENSE +21 -21
- package/dist/index.d.ts +8 -5
- package/dist/index.js +45 -10
- package/package.json +17 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 openmnemo
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 openmnemo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ interface Config {
|
|
|
14
14
|
readonly projects: readonly ProjectEntry[];
|
|
15
15
|
readonly auto_push: boolean;
|
|
16
16
|
readonly log_level: string;
|
|
17
|
+
readonly generate_report: boolean;
|
|
18
|
+
readonly locale: string;
|
|
19
|
+
readonly ai_summary_model: string;
|
|
20
|
+
readonly gh_pages_branch: string;
|
|
21
|
+
readonly cname: string;
|
|
22
|
+
readonly webhook_url: string;
|
|
23
|
+
readonly report_base_url: string;
|
|
17
24
|
}
|
|
18
25
|
declare function memorytreeRoot(): string;
|
|
19
26
|
declare function configPath(): string;
|
|
@@ -104,9 +111,5 @@ declare function setupLogging(logLevel?: LogLevel): Logger;
|
|
|
104
111
|
* the logger is auto-created with default settings (`info` level).
|
|
105
112
|
*/
|
|
106
113
|
declare function getLogger(): Logger;
|
|
107
|
-
/**
|
|
108
|
-
* Reset the singleton — primarily useful for tests.
|
|
109
|
-
*/
|
|
110
|
-
declare function _resetLogger(): void;
|
|
111
114
|
|
|
112
|
-
export { ALERT_TYPES, type Alert, FAILURE_THRESHOLD, type LogLevel, type Logger, MAX_ALERTS,
|
|
115
|
+
export { ALERT_TYPES, type Alert, FAILURE_THRESHOLD, type LogLevel, type Logger, MAX_ALERTS, acquireLock, alertsPath, clearAlerts, configPath, formatAlertsForDisplay, getLogger, gitCommitAndPush, main as heartbeatMain, intervalToSeconds, isProcessAlive, loadConfig, lockPath, memorytreeRoot, processProject, readAlerts, readLockPid, registerProject, releaseLock, resetFailureCount, runHeartbeat, saveConfig, scanSensitive, setupLogging, tryPush, writeAlert, writeAlertWithThreshold };
|
package/dist/index.js
CHANGED
|
@@ -85,7 +85,14 @@ function defaultConfig() {
|
|
|
85
85
|
watch_dirs: [],
|
|
86
86
|
projects: [],
|
|
87
87
|
auto_push: DEFAULT_AUTO_PUSH,
|
|
88
|
-
log_level: DEFAULT_LOG_LEVEL
|
|
88
|
+
log_level: DEFAULT_LOG_LEVEL,
|
|
89
|
+
generate_report: false,
|
|
90
|
+
locale: "en",
|
|
91
|
+
ai_summary_model: "claude-haiku-4-5-20251001",
|
|
92
|
+
gh_pages_branch: "",
|
|
93
|
+
cname: "",
|
|
94
|
+
webhook_url: "",
|
|
95
|
+
report_base_url: ""
|
|
89
96
|
};
|
|
90
97
|
}
|
|
91
98
|
function parseRaw(raw) {
|
|
@@ -129,7 +136,14 @@ function parseRaw(raw) {
|
|
|
129
136
|
watch_dirs: watchDirs,
|
|
130
137
|
projects,
|
|
131
138
|
auto_push: autoPush,
|
|
132
|
-
log_level: logLevel
|
|
139
|
+
log_level: logLevel,
|
|
140
|
+
generate_report: typeof raw["generate_report"] === "boolean" ? raw["generate_report"] : false,
|
|
141
|
+
locale: typeof raw["locale"] === "string" ? raw["locale"] : "en",
|
|
142
|
+
ai_summary_model: typeof raw["ai_summary_model"] === "string" ? raw["ai_summary_model"] : "claude-haiku-4-5-20251001",
|
|
143
|
+
gh_pages_branch: typeof raw["gh_pages_branch"] === "string" ? raw["gh_pages_branch"] : "",
|
|
144
|
+
cname: typeof raw["cname"] === "string" ? raw["cname"] : "",
|
|
145
|
+
webhook_url: typeof raw["webhook_url"] === "string" ? raw["webhook_url"] : "",
|
|
146
|
+
report_base_url: typeof raw["report_base_url"] === "string" ? raw["report_base_url"] : ""
|
|
133
147
|
};
|
|
134
148
|
}
|
|
135
149
|
function isValidInterval(value) {
|
|
@@ -486,9 +500,6 @@ function getLogger() {
|
|
|
486
500
|
}
|
|
487
501
|
return singleton;
|
|
488
502
|
}
|
|
489
|
-
function _resetLogger() {
|
|
490
|
-
singleton = void 0;
|
|
491
|
-
}
|
|
492
503
|
function resolveLevel(level) {
|
|
493
504
|
const lower = level.toLowerCase();
|
|
494
505
|
const mapping = {
|
|
@@ -518,8 +529,30 @@ function timestamp() {
|
|
|
518
529
|
// src/heartbeat.ts
|
|
519
530
|
import { git } from "@openmnemo/core";
|
|
520
531
|
import { toPosixPath as toPosixPath2 } from "@openmnemo/core";
|
|
521
|
-
import { resolve as resolve5 } from "path";
|
|
532
|
+
import { join, resolve as resolve5 } from "path";
|
|
522
533
|
import { existsSync as existsSync4 } from "fs";
|
|
534
|
+
async function runBuildReport(config, projectPath, projectName) {
|
|
535
|
+
const logger = getLogger();
|
|
536
|
+
const output = join(projectPath, "Memory", "07_reports");
|
|
537
|
+
try {
|
|
538
|
+
const { buildReport } = await import("@openmnemo/report");
|
|
539
|
+
await buildReport({
|
|
540
|
+
root: projectPath,
|
|
541
|
+
output,
|
|
542
|
+
noAi: !process.env["ANTHROPIC_API_KEY"],
|
|
543
|
+
model: config.ai_summary_model,
|
|
544
|
+
locale: config.locale,
|
|
545
|
+
ghPagesBranch: config.gh_pages_branch,
|
|
546
|
+
cname: config.cname,
|
|
547
|
+
webhookUrl: config.webhook_url,
|
|
548
|
+
reportBaseUrl: config.report_base_url
|
|
549
|
+
});
|
|
550
|
+
logger.info(`[${projectName}] Report generated at ${output}.`);
|
|
551
|
+
} catch (err) {
|
|
552
|
+
logger.error(`[${projectName}] Report generation failed: ${String(err)}`);
|
|
553
|
+
writeAlert(toPosixPath2(projectPath), "report_failed", `Report generation failed for ${projectName}: ${String(err)}`);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
523
556
|
var SENSITIVE_PATTERNS = [
|
|
524
557
|
/(?:api[_-]?key|apikey)\s*[:=]\s*\S+/i,
|
|
525
558
|
/(?:password|passwd|pwd)\s*[:=]\s*\S+/i,
|
|
@@ -595,10 +628,13 @@ async function processProject(config, projectPath, projectName) {
|
|
|
595
628
|
}
|
|
596
629
|
if (importedCount === 0) {
|
|
597
630
|
logger.info(`[${projectName}] No new transcripts to import.`);
|
|
598
|
-
|
|
631
|
+
} else {
|
|
632
|
+
logger.info(`[${projectName}] Imported ${importedCount} transcript(s).`);
|
|
633
|
+
gitCommitAndPush(config, projectPath, projectName, importedCount);
|
|
634
|
+
}
|
|
635
|
+
if (config.generate_report) {
|
|
636
|
+
await runBuildReport(config, projectPath, projectName);
|
|
599
637
|
}
|
|
600
|
-
logger.info(`[${projectName}] Imported ${importedCount} transcript(s).`);
|
|
601
|
-
gitCommitAndPush(config, projectPath, projectName, importedCount);
|
|
602
638
|
}
|
|
603
639
|
function scanSensitive(parsed, projectPath) {
|
|
604
640
|
const logger = getLogger();
|
|
@@ -661,7 +697,6 @@ export {
|
|
|
661
697
|
ALERT_TYPES,
|
|
662
698
|
FAILURE_THRESHOLD,
|
|
663
699
|
MAX_ALERTS,
|
|
664
|
-
_resetLogger,
|
|
665
700
|
acquireLock,
|
|
666
701
|
alertsPath,
|
|
667
702
|
clearAlerts,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmnemo/sync",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Heartbeat daemon, config management, and background sync for OpenMnemo",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"smol-toml": "^1.3.1",
|
|
25
|
-
"@openmnemo/core": "0.1
|
|
26
|
-
"@openmnemo/
|
|
25
|
+
"@openmnemo/core": "0.2.1",
|
|
26
|
+
"@openmnemo/report": "0.2.1",
|
|
27
|
+
"@openmnemo/types": "0.2.1"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@types/node": "^
|
|
30
|
+
"@types/node": "^20.0.0",
|
|
30
31
|
"tsup": "^8.4.0",
|
|
31
32
|
"typescript": "^5.7.3",
|
|
32
33
|
"vitest": "^3.1.1"
|
|
@@ -34,6 +35,18 @@
|
|
|
34
35
|
"files": [
|
|
35
36
|
"dist"
|
|
36
37
|
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20"
|
|
43
|
+
},
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
47
|
+
"import": "./dist/index.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
37
50
|
"scripts": {
|
|
38
51
|
"build": "tsup src/index.ts --format esm --dts",
|
|
39
52
|
"test": "vitest run",
|