@riconext/hermes-repo 1.2.0 → 1.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/CHANGELOG.md +6 -0
- package/dist/cli.js +28 -34
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
-
}) : x)(function(x) {
|
|
5
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
2
|
|
|
9
3
|
// src/cli.ts
|
|
10
4
|
import { Command } from "commander";
|
|
@@ -1541,7 +1535,7 @@ function isSkippedEntry(raw) {
|
|
|
1541
1535
|
}
|
|
1542
1536
|
|
|
1543
1537
|
// src/consolidate/writeKnowledge.ts
|
|
1544
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
1538
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
|
|
1545
1539
|
import { dirname as dirname4 } from "path";
|
|
1546
1540
|
function writeKnowledgeFiles(repoRoot, files) {
|
|
1547
1541
|
const result = {
|
|
@@ -1576,7 +1570,7 @@ function writeKnowledgeFiles(repoRoot, files) {
|
|
|
1576
1570
|
function writeMemoryMd(repoRoot, memoryMd) {
|
|
1577
1571
|
const memoryPathAbs = memoryPath(repoRoot, "MEMORY.md");
|
|
1578
1572
|
if (existsSync7(memoryPathAbs)) {
|
|
1579
|
-
const existing =
|
|
1573
|
+
const existing = readFileSync10(memoryPathAbs, "utf8");
|
|
1580
1574
|
const preserved = extractUserEditedSections(existing);
|
|
1581
1575
|
if (preserved.length > 0) {
|
|
1582
1576
|
memoryMd = injectUserSections(memoryMd, preserved);
|
|
@@ -1976,7 +1970,7 @@ async function commitCapture(opts) {
|
|
|
1976
1970
|
}
|
|
1977
1971
|
|
|
1978
1972
|
// src/capture/claude-code/resolveSession.ts
|
|
1979
|
-
import { existsSync as existsSync9, readdirSync as readdirSync4, readFileSync as
|
|
1973
|
+
import { existsSync as existsSync9, readdirSync as readdirSync4, readFileSync as readFileSync12, statSync } from "fs";
|
|
1980
1974
|
import { homedir } from "os";
|
|
1981
1975
|
import { basename as basename2, join as join12, resolve as resolve3 } from "path";
|
|
1982
1976
|
function encodeClaudeProjectDir(absPath) {
|
|
@@ -2480,7 +2474,7 @@ async function runFlushCommandCli(opts) {
|
|
|
2480
2474
|
}
|
|
2481
2475
|
|
|
2482
2476
|
// src/inject/runInject.ts
|
|
2483
|
-
import { existsSync as existsSync12, readdirSync as readdirSync7, readFileSync as
|
|
2477
|
+
import { existsSync as existsSync12, readdirSync as readdirSync7, readFileSync as readFileSync13 } from "fs";
|
|
2484
2478
|
import { join as join15 } from "path";
|
|
2485
2479
|
|
|
2486
2480
|
// src/inject/constants.ts
|
|
@@ -2543,7 +2537,7 @@ function readMemoryMd(repoRoot) {
|
|
|
2543
2537
|
const path = memoryPathOnDisk(repoRoot);
|
|
2544
2538
|
if (!existsSync12(path)) return null;
|
|
2545
2539
|
try {
|
|
2546
|
-
const content =
|
|
2540
|
+
const content = readFileSync13(path, "utf8");
|
|
2547
2541
|
return content.trim() || null;
|
|
2548
2542
|
} catch {
|
|
2549
2543
|
return null;
|
|
@@ -2562,7 +2556,7 @@ function readAllRules(repoRoot) {
|
|
|
2562
2556
|
for (const file of files) {
|
|
2563
2557
|
try {
|
|
2564
2558
|
const filePath = join15(rulesDir, file);
|
|
2565
|
-
const content =
|
|
2559
|
+
const content = readFileSync13(filePath, "utf8").trim();
|
|
2566
2560
|
if (!content) continue;
|
|
2567
2561
|
parts.push(`### ${file}`, "", content, "");
|
|
2568
2562
|
} catch {
|
|
@@ -2592,23 +2586,23 @@ import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
|
2592
2586
|
import { join as join19 } from "path";
|
|
2593
2587
|
|
|
2594
2588
|
// src/init/mergeClaudeSettings.ts
|
|
2595
|
-
import { existsSync as existsSync14, readFileSync as
|
|
2589
|
+
import { existsSync as existsSync14, readFileSync as readFileSync16 } from "fs";
|
|
2596
2590
|
import { join as join18 } from "path";
|
|
2597
2591
|
|
|
2598
2592
|
// src/init/templateDir.ts
|
|
2599
|
-
import { existsSync as existsSync13, readFileSync as
|
|
2593
|
+
import { existsSync as existsSync13, readFileSync as readFileSync15 } from "fs";
|
|
2600
2594
|
import { dirname as dirname7, join as join17 } from "path";
|
|
2601
2595
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
2602
2596
|
|
|
2603
2597
|
// src/index.ts
|
|
2604
|
-
import { readFileSync as
|
|
2598
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
2605
2599
|
import { dirname as dirname6, join as join16 } from "path";
|
|
2606
2600
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2607
2601
|
var PACKAGE_NAME = "@riconext/hermes-repo";
|
|
2608
2602
|
var __dirname = dirname6(fileURLToPath3(import.meta.url));
|
|
2609
2603
|
function readPkgVersion() {
|
|
2610
2604
|
const pkgPath = join16(__dirname, "..", "package.json");
|
|
2611
|
-
const pkg = JSON.parse(
|
|
2605
|
+
const pkg = JSON.parse(readFileSync14(pkgPath, "utf8"));
|
|
2612
2606
|
return pkg.version;
|
|
2613
2607
|
}
|
|
2614
2608
|
|
|
@@ -2631,7 +2625,7 @@ function resolveTemplatePath(name) {
|
|
|
2631
2625
|
return join17(templateDir, name);
|
|
2632
2626
|
}
|
|
2633
2627
|
function readTemplate(name) {
|
|
2634
|
-
return
|
|
2628
|
+
return readFileSync15(resolveTemplatePath(name), "utf8");
|
|
2635
2629
|
}
|
|
2636
2630
|
function renderTemplate(name) {
|
|
2637
2631
|
const raw = readTemplate(name);
|
|
@@ -2650,7 +2644,7 @@ function mergeClaudeLocalSettings(repoRoot) {
|
|
|
2650
2644
|
let existing = {};
|
|
2651
2645
|
if (existed) {
|
|
2652
2646
|
try {
|
|
2653
|
-
existing = JSON.parse(
|
|
2647
|
+
existing = JSON.parse(readFileSync16(settingsPath, "utf8"));
|
|
2654
2648
|
} catch {
|
|
2655
2649
|
existing = {};
|
|
2656
2650
|
}
|
|
@@ -2690,7 +2684,7 @@ import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
|
2690
2684
|
import { join as join21 } from "path";
|
|
2691
2685
|
|
|
2692
2686
|
// src/init/mergeCodexConfig.ts
|
|
2693
|
-
import { existsSync as existsSync15, readFileSync as
|
|
2687
|
+
import { existsSync as existsSync15, readFileSync as readFileSync17 } from "fs";
|
|
2694
2688
|
import { join as join20 } from "path";
|
|
2695
2689
|
var CODEX_CONFIG_REL = ".codex/config.toml";
|
|
2696
2690
|
var CODEX_HERMES_START_MARKER = "# >>> hermes-repo codex (do not edit this block manually)";
|
|
@@ -2737,7 +2731,7 @@ function mergeCodexConfig(repoRoot) {
|
|
|
2737
2731
|
action: "created"
|
|
2738
2732
|
};
|
|
2739
2733
|
}
|
|
2740
|
-
const existing =
|
|
2734
|
+
const existing = readFileSync17(configPath, "utf8");
|
|
2741
2735
|
const hasBlock = existing.includes(CODEX_HERMES_START_MARKER) && existing.includes(CODEX_HERMES_END_MARKER);
|
|
2742
2736
|
return {
|
|
2743
2737
|
content: spliceHermesBlock(existing, block),
|
|
@@ -2764,7 +2758,7 @@ import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync8 } from "fs";
|
|
|
2764
2758
|
import { join as join23 } from "path";
|
|
2765
2759
|
|
|
2766
2760
|
// src/init/mergeCodebuddySettings.ts
|
|
2767
|
-
import { existsSync as existsSync16, readFileSync as
|
|
2761
|
+
import { existsSync as existsSync16, readFileSync as readFileSync18 } from "fs";
|
|
2768
2762
|
import { join as join22 } from "path";
|
|
2769
2763
|
var CODEBUDDY_SETTINGS_LOCAL_REL = ".codebuddy/settings.local.json";
|
|
2770
2764
|
function codebuddySettingsLocalPath(repoRoot) {
|
|
@@ -2779,7 +2773,7 @@ function mergeCodebuddyLocalSettings(repoRoot) {
|
|
|
2779
2773
|
let existing = {};
|
|
2780
2774
|
if (existed) {
|
|
2781
2775
|
try {
|
|
2782
|
-
existing = JSON.parse(
|
|
2776
|
+
existing = JSON.parse(readFileSync18(settingsPath, "utf8"));
|
|
2783
2777
|
} catch {
|
|
2784
2778
|
existing = {};
|
|
2785
2779
|
}
|
|
@@ -2819,7 +2813,7 @@ import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync9 } from "fs";
|
|
|
2819
2813
|
import { join as join25 } from "path";
|
|
2820
2814
|
|
|
2821
2815
|
// src/init/mergeCursorHooks.ts
|
|
2822
|
-
import { existsSync as existsSync17, readFileSync as
|
|
2816
|
+
import { existsSync as existsSync17, readFileSync as readFileSync19 } from "fs";
|
|
2823
2817
|
import { join as join24 } from "path";
|
|
2824
2818
|
var CURSOR_HOOKS_REL = ".cursor/hooks.json";
|
|
2825
2819
|
function cursorHooksPath(repoRoot) {
|
|
@@ -2832,7 +2826,7 @@ function mergeCursorHooks(repoRoot) {
|
|
|
2832
2826
|
let existing = {};
|
|
2833
2827
|
if (existed) {
|
|
2834
2828
|
try {
|
|
2835
|
-
existing = JSON.parse(
|
|
2829
|
+
existing = JSON.parse(readFileSync19(hooksPath, "utf8"));
|
|
2836
2830
|
} catch {
|
|
2837
2831
|
existing = {};
|
|
2838
2832
|
}
|
|
@@ -2939,14 +2933,14 @@ function ensureMemoryTree(repoRoot) {
|
|
|
2939
2933
|
}
|
|
2940
2934
|
|
|
2941
2935
|
// src/init/mergeAssistants.ts
|
|
2942
|
-
import { existsSync as existsSync18, readFileSync as
|
|
2936
|
+
import { existsSync as existsSync18, readFileSync as readFileSync20 } from "fs";
|
|
2943
2937
|
function readExistingAssistants(repoRoot) {
|
|
2944
2938
|
const configPath = memoryPath(repoRoot, "config.json");
|
|
2945
2939
|
if (!existsSync18(configPath)) {
|
|
2946
2940
|
return [];
|
|
2947
2941
|
}
|
|
2948
2942
|
try {
|
|
2949
|
-
const config = JSON.parse(
|
|
2943
|
+
const config = JSON.parse(readFileSync20(configPath, "utf8"));
|
|
2950
2944
|
if (!Array.isArray(config.assistants)) {
|
|
2951
2945
|
return [];
|
|
2952
2946
|
}
|
|
@@ -2961,14 +2955,14 @@ function mergeAssistants(repoRoot, selected) {
|
|
|
2961
2955
|
}
|
|
2962
2956
|
|
|
2963
2957
|
// src/init/mergeGitignore.ts
|
|
2964
|
-
import { existsSync as existsSync19, readFileSync as
|
|
2958
|
+
import { existsSync as existsSync19, readFileSync as readFileSync21, writeFileSync as writeFileSync11 } from "fs";
|
|
2965
2959
|
import { join as join27 } from "path";
|
|
2966
2960
|
var START_MARKER = "# >>> hermes-repo memory (do not edit this block manually)";
|
|
2967
2961
|
var END_MARKER = "# <<< hermes-repo memory";
|
|
2968
2962
|
function mergeHermesGitignore(repoRoot) {
|
|
2969
2963
|
const block = readTemplate("gitignore-block.txt").trimEnd() + "\n";
|
|
2970
2964
|
const gitignorePath = join27(repoRoot, ".gitignore");
|
|
2971
|
-
const contentBefore = existsSync19(gitignorePath) ?
|
|
2965
|
+
const contentBefore = existsSync19(gitignorePath) ? readFileSync21(gitignorePath, "utf8") : "";
|
|
2972
2966
|
const warnBroadMemoryIgnore = contentBefore.length > 0 && !contentBefore.includes(START_MARKER) && /(^|\n)\.memory\/\s*$/m.test(contentBefore);
|
|
2973
2967
|
if (!existsSync19(gitignorePath)) {
|
|
2974
2968
|
writeFileSync11(gitignorePath, `${block}
|
|
@@ -3002,7 +2996,7 @@ function mergeHermesGitignore(repoRoot) {
|
|
|
3002
2996
|
import { copyFileSync, mkdirSync as mkdirSync12, writeFileSync as writeFileSync14 } from "fs";
|
|
3003
2997
|
|
|
3004
2998
|
// src/init/mergeConfig.ts
|
|
3005
|
-
import { existsSync as existsSync20, readFileSync as
|
|
2999
|
+
import { existsSync as existsSync20, readFileSync as readFileSync22 } from "fs";
|
|
3006
3000
|
var DEFAULT_LLM = {
|
|
3007
3001
|
enabled: false,
|
|
3008
3002
|
provider: "openai",
|
|
@@ -3028,7 +3022,7 @@ function mergeConfigForInit(repoRoot, assistants) {
|
|
|
3028
3022
|
let existing = {};
|
|
3029
3023
|
if (existed) {
|
|
3030
3024
|
try {
|
|
3031
|
-
existing = JSON.parse(
|
|
3025
|
+
existing = JSON.parse(readFileSync22(configPath, "utf8"));
|
|
3032
3026
|
} catch {
|
|
3033
3027
|
existing = {};
|
|
3034
3028
|
}
|
|
@@ -3064,7 +3058,7 @@ function mergeConfigForInit(repoRoot, assistants) {
|
|
|
3064
3058
|
}
|
|
3065
3059
|
|
|
3066
3060
|
// src/init/mergeAgentsMd.ts
|
|
3067
|
-
import { existsSync as existsSync21, readFileSync as
|
|
3061
|
+
import { existsSync as existsSync21, readFileSync as readFileSync23, writeFileSync as writeFileSync12 } from "fs";
|
|
3068
3062
|
import { join as join28 } from "path";
|
|
3069
3063
|
var HERMES_AGENTS_START_MARKER = "<!-- >>> hermes-repo agents (do not edit this block manually) -->";
|
|
3070
3064
|
var HERMES_AGENTS_END_MARKER = "<!-- <<< hermes-repo agents -->";
|
|
@@ -3127,7 +3121,7 @@ function mergeAgentsMd(repoRoot, force) {
|
|
|
3127
3121
|
writeFileSync12(agentsPath, buildNewAgentsMd(), "utf8");
|
|
3128
3122
|
return "created";
|
|
3129
3123
|
}
|
|
3130
|
-
const content =
|
|
3124
|
+
const content = readFileSync23(agentsPath, "utf8");
|
|
3131
3125
|
if (agentsMdHasHermesBlock(content)) {
|
|
3132
3126
|
if (!force) {
|
|
3133
3127
|
return "skipped";
|
|
@@ -3235,7 +3229,7 @@ function writeScaffoldFiles(repoRoot, opts, report) {
|
|
|
3235
3229
|
|
|
3236
3230
|
// src/init/prompts.ts
|
|
3237
3231
|
import { checkbox, confirm, input } from "@inquirer/prompts";
|
|
3238
|
-
import { existsSync as existsSync23, readFileSync as
|
|
3232
|
+
import { existsSync as existsSync23, readFileSync as readFileSync24 } from "fs";
|
|
3239
3233
|
import { resolve as resolve6 } from "path";
|
|
3240
3234
|
function isInitialized(targetDir) {
|
|
3241
3235
|
const configPath = memoryPath(targetDir, "config.json");
|
|
@@ -3243,7 +3237,7 @@ function isInitialized(targetDir) {
|
|
|
3243
3237
|
return false;
|
|
3244
3238
|
}
|
|
3245
3239
|
try {
|
|
3246
|
-
const config = JSON.parse(
|
|
3240
|
+
const config = JSON.parse(readFileSync24(configPath, "utf8"));
|
|
3247
3241
|
return typeof config.version === "number" && config.version >= 1;
|
|
3248
3242
|
} catch {
|
|
3249
3243
|
return false;
|