@prover-coder-ai/context-doc 1.0.7 → 1.0.8
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/dist/shell/codexSync.js +23 -27
- package/dist/shell/qwenSync.js +9 -7
- package/package.json +1 -1
- package/src/shell/codexSync.ts +27 -17
- package/src/shell/qwenSync.ts +38 -29
package/dist/shell/codexSync.js
CHANGED
|
@@ -28,31 +28,27 @@ const readRepositoryUrl = (cwd, repositoryUrlOverride) => Effect.try({
|
|
|
28
28
|
},
|
|
29
29
|
catch: () => syncError("package.json", "Cannot read repository url"),
|
|
30
30
|
});
|
|
31
|
-
const resolveSourceDir = (cwd, override, metaRoot) => Effect.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return existing;
|
|
53
|
-
},
|
|
54
|
-
catch: () => syncError(".codex", "Source .codex directory is missing"),
|
|
55
|
-
});
|
|
31
|
+
const resolveSourceDir = (cwd, override, metaRoot) => pipe(Effect.sync(() => {
|
|
32
|
+
const envSource = process.env.CODEX_SOURCE_DIR;
|
|
33
|
+
const metaCandidate = metaRoot === undefined
|
|
34
|
+
? undefined
|
|
35
|
+
: metaRoot.endsWith(".codex")
|
|
36
|
+
? metaRoot
|
|
37
|
+
: path.join(metaRoot, ".codex");
|
|
38
|
+
const localSource = path.join(cwd, ".codex");
|
|
39
|
+
const homeSource = path.join(os.homedir(), ".codex");
|
|
40
|
+
const candidates = [
|
|
41
|
+
override,
|
|
42
|
+
envSource,
|
|
43
|
+
metaCandidate,
|
|
44
|
+
localSource,
|
|
45
|
+
homeSource,
|
|
46
|
+
].filter((candidate) => candidate !== undefined);
|
|
47
|
+
const existing = candidates.find((candidate) => fs.existsSync(candidate));
|
|
48
|
+
return { existing, candidates };
|
|
49
|
+
}), Effect.flatMap(({ existing, candidates }) => existing === undefined
|
|
50
|
+
? Effect.fail(syncError(".codex", `Source .codex directory is missing; checked: ${candidates.join(", ")}`))
|
|
51
|
+
: Effect.succeed(existing)));
|
|
56
52
|
const collectJsonlFiles = (root) => Effect.try({
|
|
57
53
|
try: () => {
|
|
58
54
|
const collected = [];
|
|
@@ -115,5 +111,5 @@ export const syncCodex = (options) => Effect.gen(function* (_) {
|
|
|
115
111
|
const allJsonlFiles = yield* _(collectJsonlFiles(sourceDir));
|
|
116
112
|
const relevantFiles = yield* _(selectRelevantFiles(allJsonlFiles, locator));
|
|
117
113
|
yield* _(Effect.forEach(relevantFiles, (filePath) => copyRelevantFile(sourceDir, destinationDir, filePath)));
|
|
118
|
-
yield* _(Console.log(`Synced ${relevantFiles.length} dialog files into .knowledge/.codex`));
|
|
119
|
-
});
|
|
114
|
+
yield* _(Console.log(`Synced ${relevantFiles.length} dialog files into .knowledge/.codex from ${sourceDir}`));
|
|
115
|
+
}).pipe(Effect.catchAll((error) => Console.log(`Codex source not found; skipped syncing Codex dialog files (${error.reason})`)));
|
package/dist/shell/qwenSync.js
CHANGED
|
@@ -26,7 +26,7 @@ const copyDirectoryJsonOnly = (sourceRoot, destinationRoot) => Effect.try({
|
|
|
26
26
|
catch: () => syncError(sourceRoot, "Cannot traverse Qwen directory"),
|
|
27
27
|
});
|
|
28
28
|
const qwenHashFromPath = (projectPath) => createHash("sha256").update(projectPath).digest("hex");
|
|
29
|
-
const resolveQwenSourceDir = (cwd, override, metaRoot) =>
|
|
29
|
+
const resolveQwenSourceDir = (cwd, override, metaRoot) => Effect.gen(function* (_) {
|
|
30
30
|
const hash = qwenHashFromPath(cwd);
|
|
31
31
|
const envSource = process.env.QWEN_SOURCE_DIR;
|
|
32
32
|
const baseFromMeta = metaRoot === undefined
|
|
@@ -41,9 +41,11 @@ const resolveQwenSourceDir = (cwd, override, metaRoot) => pipe(Effect.sync(() =>
|
|
|
41
41
|
baseFromMeta ? path.join(baseFromMeta, "tmp", hash) : undefined,
|
|
42
42
|
path.join(cwd, ".qwen", "tmp", hash),
|
|
43
43
|
path.join(homeBase, "tmp", hash),
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
].filter((candidate) => candidate !== undefined);
|
|
45
|
+
const found = candidates.find((candidate) => fs.existsSync(candidate));
|
|
46
|
+
if (found === undefined) {
|
|
47
|
+
return yield* _(Effect.fail(syncError(".qwen", `Qwen source directory is missing; checked: ${candidates.join(", ")}`)));
|
|
48
|
+
}
|
|
49
|
+
return found;
|
|
50
|
+
});
|
|
51
|
+
export const syncQwen = (options) => pipe(resolveQwenSourceDir(options.cwd, options.qwenSourceDir, options.metaRoot), Effect.tap((qwenSource) => Console.log(`Qwen source resolved: ${qwenSource}`)), Effect.flatMap((qwenSource) => pipe(ensureDirectory(path.join(options.cwd, ".knowledge", ".qwen")), Effect.flatMap(() => copyDirectoryJsonOnly(qwenSource, path.join(options.cwd, ".knowledge", ".qwen"))), Effect.flatMap((copiedCount) => Console.log(`Synced ${copiedCount} Qwen dialog files into .knowledge/.qwen`)))), Effect.catchAll((error) => Console.log(`Qwen source not found; skipped syncing Qwen dialog files (${error.reason})`)));
|
package/package.json
CHANGED
package/src/shell/codexSync.ts
CHANGED
|
@@ -46,8 +46,8 @@ const resolveSourceDir = (
|
|
|
46
46
|
override?: string,
|
|
47
47
|
metaRoot?: string,
|
|
48
48
|
): Effect.Effect<string, SyncError> =>
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
pipe(
|
|
50
|
+
Effect.sync(() => {
|
|
51
51
|
const envSource = process.env.CODEX_SOURCE_DIR;
|
|
52
52
|
const metaCandidate =
|
|
53
53
|
metaRoot === undefined
|
|
@@ -63,19 +63,23 @@ const resolveSourceDir = (
|
|
|
63
63
|
metaCandidate,
|
|
64
64
|
localSource,
|
|
65
65
|
homeSource,
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
].filter((candidate): candidate is string => candidate !== undefined);
|
|
67
|
+
|
|
68
|
+
const existing = candidates.find((candidate) => fs.existsSync(candidate));
|
|
69
|
+
|
|
70
|
+
return { existing, candidates };
|
|
71
|
+
}),
|
|
72
|
+
Effect.flatMap(({ existing, candidates }) =>
|
|
73
|
+
existing === undefined
|
|
74
|
+
? Effect.fail(
|
|
75
|
+
syncError(
|
|
76
|
+
".codex",
|
|
77
|
+
`Source .codex directory is missing; checked: ${candidates.join(", ")}`,
|
|
78
|
+
),
|
|
79
|
+
)
|
|
80
|
+
: Effect.succeed(existing),
|
|
81
|
+
),
|
|
82
|
+
);
|
|
79
83
|
|
|
80
84
|
const collectJsonlFiles = (
|
|
81
85
|
root: string,
|
|
@@ -183,7 +187,13 @@ export const syncCodex = (
|
|
|
183
187
|
|
|
184
188
|
yield* _(
|
|
185
189
|
Console.log(
|
|
186
|
-
`Synced ${relevantFiles.length} dialog files into .knowledge/.codex`,
|
|
190
|
+
`Synced ${relevantFiles.length} dialog files into .knowledge/.codex from ${sourceDir}`,
|
|
187
191
|
),
|
|
188
192
|
);
|
|
189
|
-
})
|
|
193
|
+
}).pipe(
|
|
194
|
+
Effect.catchAll((error) =>
|
|
195
|
+
Console.log(
|
|
196
|
+
`Codex source not found; skipped syncing Codex dialog files (${error.reason})`,
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
);
|
package/src/shell/qwenSync.ts
CHANGED
|
@@ -40,42 +40,49 @@ const resolveQwenSourceDir = (
|
|
|
40
40
|
override?: string,
|
|
41
41
|
metaRoot?: string,
|
|
42
42
|
): Effect.Effect<string, SyncError> =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
Effect.gen(function* (_) {
|
|
44
|
+
const hash = qwenHashFromPath(cwd);
|
|
45
|
+
const envSource = process.env.QWEN_SOURCE_DIR;
|
|
46
|
+
const baseFromMeta =
|
|
47
|
+
metaRoot === undefined
|
|
48
|
+
? undefined
|
|
49
|
+
: metaRoot.endsWith(".qwen")
|
|
50
|
+
? metaRoot
|
|
51
|
+
: path.join(metaRoot, ".qwen");
|
|
52
|
+
const homeBase = path.join(os.homedir(), ".qwen");
|
|
53
|
+
|
|
54
|
+
const candidates = [
|
|
55
|
+
override,
|
|
56
|
+
envSource,
|
|
57
|
+
baseFromMeta ? path.join(baseFromMeta, "tmp", hash) : undefined,
|
|
58
|
+
path.join(cwd, ".qwen", "tmp", hash),
|
|
59
|
+
path.join(homeBase, "tmp", hash),
|
|
60
|
+
].filter((candidate): candidate is string => candidate !== undefined);
|
|
54
61
|
|
|
55
|
-
|
|
56
|
-
override,
|
|
57
|
-
envSource,
|
|
58
|
-
baseFromMeta ? path.join(baseFromMeta, "tmp", hash) : undefined,
|
|
59
|
-
path.join(cwd, ".qwen", "tmp", hash),
|
|
60
|
-
path.join(homeBase, "tmp", hash),
|
|
61
|
-
];
|
|
62
|
+
const found = candidates.find((candidate) => fs.existsSync(candidate));
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
if (found === undefined) {
|
|
65
|
+
return yield* _(
|
|
66
|
+
Effect.fail(
|
|
67
|
+
syncError(
|
|
68
|
+
".qwen",
|
|
69
|
+
`Qwen source directory is missing; checked: ${candidates.join(", ")}`,
|
|
70
|
+
),
|
|
71
|
+
),
|
|
65
72
|
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
: Effect.succeed(found),
|
|
71
|
-
),
|
|
72
|
-
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return found;
|
|
76
|
+
});
|
|
73
77
|
|
|
74
78
|
export const syncQwen = (
|
|
75
79
|
options: SyncOptions,
|
|
76
80
|
): Effect.Effect<void, SyncError> =>
|
|
77
81
|
pipe(
|
|
78
82
|
resolveQwenSourceDir(options.cwd, options.qwenSourceDir, options.metaRoot),
|
|
83
|
+
Effect.tap((qwenSource) =>
|
|
84
|
+
Console.log(`Qwen source resolved: ${qwenSource}`),
|
|
85
|
+
),
|
|
79
86
|
Effect.flatMap((qwenSource) =>
|
|
80
87
|
pipe(
|
|
81
88
|
ensureDirectory(path.join(options.cwd, ".knowledge", ".qwen")),
|
|
@@ -92,7 +99,9 @@ export const syncQwen = (
|
|
|
92
99
|
),
|
|
93
100
|
),
|
|
94
101
|
),
|
|
95
|
-
Effect.catchAll(() =>
|
|
96
|
-
Console.log(
|
|
102
|
+
Effect.catchAll((error) =>
|
|
103
|
+
Console.log(
|
|
104
|
+
`Qwen source not found; skipped syncing Qwen dialog files (${error.reason})`,
|
|
105
|
+
),
|
|
97
106
|
),
|
|
98
107
|
);
|