@hizliemre/horse-code 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.
- package/LICENSE +21 -0
- package/README.md +150 -0
- package/dist/app-SB2L34JW.js +6217 -0
- package/dist/chunk-2DGO2BUB.js +4490 -0
- package/dist/chunk-2SVAHH5N.js +60 -0
- package/dist/chunk-3XVZXTB6.js +4469 -0
- package/dist/chunk-5UWA2UBM.js +69 -0
- package/dist/chunk-7TBYMFMG.js +147 -0
- package/dist/chunk-B67BK5GQ.js +34 -0
- package/dist/chunk-BY4DP7IE.js +20 -0
- package/dist/chunk-DKVIN43T.js +54 -0
- package/dist/chunk-DTWKSZXY.js +162 -0
- package/dist/chunk-F2IALVBU.js +212 -0
- package/dist/chunk-FFYBY2NA.js +392 -0
- package/dist/chunk-FGVJFMK5.js +123 -0
- package/dist/chunk-H2FDGPVW.js +42 -0
- package/dist/chunk-HBSC2HT2.js +85 -0
- package/dist/chunk-IW2KBAVZ.js +21 -0
- package/dist/chunk-JWAEW7AJ.js +121 -0
- package/dist/chunk-NNTIACT4.js +163 -0
- package/dist/chunk-O74BDQKS.js +28 -0
- package/dist/chunk-PGOYDOI4.js +426 -0
- package/dist/chunk-QF4MP6BS.js +69 -0
- package/dist/chunk-SSDLHWSF.js +35 -0
- package/dist/chunk-TOPZL5SU.js +1052 -0
- package/dist/chunk-YBWTCXUS.js +153 -0
- package/dist/chunk-YILDXPSI.js +1363 -0
- package/dist/clean-YOQATBMZ.js +18 -0
- package/dist/cli.js +1495 -0
- package/dist/discover-5URG7C4J.js +52 -0
- package/dist/fix-HBBOTUWM.js +34 -0
- package/dist/frontmatter-UNIPNLLO.js +6 -0
- package/dist/git-VTSZALSR.js +6 -0
- package/dist/install-O34KMWJB.js +113 -0
- package/dist/main-branch-KGWUINYQ.js +19 -0
- package/dist/ongoing-OV5XROTU.js +70 -0
- package/dist/project-graph-IOPCSZUA.js +56 -0
- package/dist/run-LQOZ5I7Z.js +610 -0
- package/dist/save-skills-OHYGVTQ4.js +13 -0
- package/dist/source-cache-XEK5WN7I.js +29 -0
- package/dist/trace-ZMB7LT7W.js +66 -0
- package/dist/trace-adopt-C6TUWFJL.js +79 -0
- package/dist/trace-run-F23MFTY4.js +24 -0
- package/dist/triage-2J3T5PVQ.js +30 -0
- package/dist/verify-WQ3GHION.js +479 -0
- package/dist/worktree-F7TWLWLN.js +87 -0
- package/package.json +64 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stateRoot
|
|
3
|
+
} from "./chunk-SSDLHWSF.js";
|
|
4
|
+
import {
|
|
5
|
+
writeAtomic
|
|
6
|
+
} from "./chunk-B67BK5GQ.js";
|
|
7
|
+
|
|
8
|
+
// src/migrate/migrated.ts
|
|
9
|
+
import { readFile, mkdir } from "fs/promises";
|
|
10
|
+
import { dirname, join } from "path";
|
|
11
|
+
var MIGRATED_FILE = join(".horsecode", "migrated.json");
|
|
12
|
+
var path = (cwd) => join(stateRoot(cwd), MIGRATED_FILE);
|
|
13
|
+
async function recordMigrated(cwd, files, now = Date.now()) {
|
|
14
|
+
const existing = await loadMigrated(cwd);
|
|
15
|
+
const merged = [.../* @__PURE__ */ new Set([...existing?.files ?? [], ...files])].sort();
|
|
16
|
+
if (!merged.length) return;
|
|
17
|
+
const p = path(cwd);
|
|
18
|
+
await mkdir(dirname(p), { recursive: true });
|
|
19
|
+
await writeAtomic(p, `${JSON.stringify({ version: 1, at: now, files: merged }, null, 2)}
|
|
20
|
+
`);
|
|
21
|
+
}
|
|
22
|
+
async function loadMigrated(cwd) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = JSON.parse(await readFile(path(cwd), "utf8"));
|
|
25
|
+
return raw?.version === 1 && Array.isArray(raw.files) ? raw : void 0;
|
|
26
|
+
} catch {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function loadMigratedSync(cwd, readSync) {
|
|
31
|
+
try {
|
|
32
|
+
const raw = JSON.parse(readSync(path(cwd)));
|
|
33
|
+
return raw?.version === 1 && Array.isArray(raw.files) ? raw : void 0;
|
|
34
|
+
} catch {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function isMigrated(rec, file) {
|
|
39
|
+
if (!rec?.files.length) return false;
|
|
40
|
+
const norm = (p) => p.replace(/\\/g, "/").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
41
|
+
const target = norm(file);
|
|
42
|
+
return rec.files.some((f) => {
|
|
43
|
+
const m = norm(f);
|
|
44
|
+
return m === target || target.endsWith(`/${m}`);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function migratedNotice(file, rec) {
|
|
48
|
+
const when = new Date(rec.at).toISOString().slice(0, 10);
|
|
49
|
+
return `\`${file}\` is not this project's source of rules any more. It belonged to another tool, and on ${when} its content was migrated into this project's memory \u2014 which you have already been given, above, as standing rules and facts.
|
|
50
|
+
|
|
51
|
+
Reading it would give you the rules AS THEY WERE on that date, and they have moved since. If you need a rule, use the memory you already carry. If the user has explicitly asked you to look at this file's text \u2014 to compare it, or to migrate something that was missed \u2014 say so and ask them to confirm.`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
recordMigrated,
|
|
56
|
+
loadMigrated,
|
|
57
|
+
loadMigratedSync,
|
|
58
|
+
isMigrated,
|
|
59
|
+
migratedNotice
|
|
60
|
+
};
|