@openmnemo/sync 0.1.0 → 0.2.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.
- package/LICENSE +21 -21
- package/dist/index.d.ts +7 -0
- package/dist/index.js +45 -6
- 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;
|
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) {
|
|
@@ -518,8 +532,30 @@ function timestamp() {
|
|
|
518
532
|
// src/heartbeat.ts
|
|
519
533
|
import { git } from "@openmnemo/core";
|
|
520
534
|
import { toPosixPath as toPosixPath2 } from "@openmnemo/core";
|
|
521
|
-
import { resolve as resolve5 } from "path";
|
|
535
|
+
import { join, resolve as resolve5 } from "path";
|
|
522
536
|
import { existsSync as existsSync4 } from "fs";
|
|
537
|
+
async function runBuildReport(config, projectPath, projectName) {
|
|
538
|
+
const logger = getLogger();
|
|
539
|
+
const output = join(projectPath, "Memory", "07_reports");
|
|
540
|
+
try {
|
|
541
|
+
const { buildReport } = await import("@openmnemo/report");
|
|
542
|
+
await buildReport({
|
|
543
|
+
root: projectPath,
|
|
544
|
+
output,
|
|
545
|
+
noAi: !process.env["ANTHROPIC_API_KEY"],
|
|
546
|
+
model: config.ai_summary_model,
|
|
547
|
+
locale: config.locale,
|
|
548
|
+
ghPagesBranch: config.gh_pages_branch,
|
|
549
|
+
cname: config.cname,
|
|
550
|
+
webhookUrl: config.webhook_url,
|
|
551
|
+
reportBaseUrl: config.report_base_url
|
|
552
|
+
});
|
|
553
|
+
logger.info(`[${projectName}] Report generated at ${output}.`);
|
|
554
|
+
} catch (err) {
|
|
555
|
+
logger.error(`[${projectName}] Report generation failed: ${String(err)}`);
|
|
556
|
+
writeAlert(toPosixPath2(projectPath), "report_failed", `Report generation failed for ${projectName}: ${String(err)}`);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
523
559
|
var SENSITIVE_PATTERNS = [
|
|
524
560
|
/(?:api[_-]?key|apikey)\s*[:=]\s*\S+/i,
|
|
525
561
|
/(?:password|passwd|pwd)\s*[:=]\s*\S+/i,
|
|
@@ -595,10 +631,13 @@ async function processProject(config, projectPath, projectName) {
|
|
|
595
631
|
}
|
|
596
632
|
if (importedCount === 0) {
|
|
597
633
|
logger.info(`[${projectName}] No new transcripts to import.`);
|
|
598
|
-
|
|
634
|
+
} else {
|
|
635
|
+
logger.info(`[${projectName}] Imported ${importedCount} transcript(s).`);
|
|
636
|
+
gitCommitAndPush(config, projectPath, projectName, importedCount);
|
|
637
|
+
}
|
|
638
|
+
if (config.generate_report) {
|
|
639
|
+
await runBuildReport(config, projectPath, projectName);
|
|
599
640
|
}
|
|
600
|
-
logger.info(`[${projectName}] Imported ${importedCount} transcript(s).`);
|
|
601
|
-
gitCommitAndPush(config, projectPath, projectName, importedCount);
|
|
602
641
|
}
|
|
603
642
|
function scanSensitive(parsed, projectPath) {
|
|
604
643
|
const logger = getLogger();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmnemo/sync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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/
|
|
26
|
-
"@openmnemo/types": "0.
|
|
25
|
+
"@openmnemo/report": "0.2.0",
|
|
26
|
+
"@openmnemo/types": "0.2.0",
|
|
27
|
+
"@openmnemo/core": "0.2.0"
|
|
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",
|