@cortexkit/opencode-magic-context 0.49.48 → 0.49.49

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.
Files changed (153) hide show
  1. package/dist/{announcement-g789dmt6.js → announcement-9pr71hd5.js} +3 -2
  2. package/dist/auto-search-worker.js +5 -5
  3. package/dist/chunk-embedding-write-worker.js +14 -15
  4. package/dist/{compaction-marker-candidates-dkfp1q9j.js → compaction-marker-candidates-8hazqfvj.js} +2 -3
  5. package/dist/compaction-marker-candidates-worker.js +1 -1
  6. package/dist/{compartment-chunk-embedding-snj51nmg.js → compartment-chunk-embedding-gfd093f8.js} +7 -8
  7. package/dist/{conflict-warning-hook-w1aw6w5t.js → conflict-warning-hook-56qpq7ws.js} +7 -8
  8. package/dist/{context-8r125qv3.js → context-bwf57gnh.js} +41 -43
  9. package/dist/{derive-budgets-nkw09vq7.js → derive-budgets-z53424qx.js} +2 -3
  10. package/dist/{embedding-backfill-kpy5shsa.js → embedding-backfill-d9x9q2e2.js} +12 -13
  11. package/dist/embedding-worker-process.js +2 -3
  12. package/dist/embedding-worker.js +5 -6
  13. package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
  14. package/dist/{history-owner-0z620wgz.js → history-owner-n50e0e8y.js} +2 -3
  15. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  16. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  17. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +5 -3
  18. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  19. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  21. package/dist/{index-txs8tce6.js → index-0k283v27.js} +2 -4
  22. package/dist/{index-s79g172v.js → index-0mdh2cke.js} +10 -10
  23. package/dist/{index-ak11t3gm.js → index-0tz2fzpq.js} +1 -1
  24. package/dist/{index-2qbtqg1w.js → index-25tm250q.js} +1 -1
  25. package/dist/{index-h9m41624.js → index-2ny9xwdn.js} +2 -2
  26. package/dist/{index-xa9mmq6c.js → index-36wseasx.js} +1 -1
  27. package/dist/{index-sd2s4t4p.js → index-3n9ee4jh.js} +2 -2
  28. package/dist/{index-vk6srk5r.js → index-5850zme4.js} +3 -3
  29. package/dist/{index-qsyx931k.js → index-5bksfv58.js} +13 -15
  30. package/dist/{index-cgzpbz78.js → index-7n2n3v92.js} +5 -5
  31. package/dist/{index-jrfre9ah.js → index-82dfe8en.js} +146 -5
  32. package/dist/{index-gn6gfz4y.js → index-90z05d0p.js} +1 -1
  33. package/dist/{index-9wnbnx8f.js → index-a6aqpfp6.js} +1 -1
  34. package/dist/{index-q6pjqm49.js → index-agfh931z.js} +11 -13
  35. package/dist/{index-d4qw2h43.js → index-arxg51bj.js} +4 -4
  36. package/dist/{index-4wpfbzks.js → index-bkg4hdyh.js} +3 -3
  37. package/dist/{index-gp3kcpc4.js → index-cd3vp8xa.js} +1 -1
  38. package/dist/{index-cgsmttyj.js → index-cs7pmwt6.js} +4 -4
  39. package/dist/{index-brj6was5.js → index-em92bp7f.js} +2 -2
  40. package/dist/{index-2p37txes.js → index-ga5q492k.js} +1 -1
  41. package/dist/{index-8cfnaagj.js → index-gapnh6tk.js} +2 -4
  42. package/dist/{index-fw42ms3m.js → index-gz001bx7.js} +1 -1
  43. package/dist/{index-t6s0tsp7.js → index-h3p558ec.js} +3 -3
  44. package/dist/{index-qcz1fy7h.js → index-hexdee98.js} +4 -4
  45. package/dist/{index-smtbdmc3.js → index-hsv31e69.js} +2 -2
  46. package/dist/{index-dj2p8653.js → index-hsyczpn7.js} +2 -2
  47. package/dist/{index-q41sm60t.js → index-j7verehm.js} +71 -54
  48. package/dist/{index-fgft4qjn.js → index-jedbxq6n.js} +4 -4
  49. package/dist/{index-xh3jyejb.js → index-k47v0tmk.js} +16 -18
  50. package/dist/{index-1hwn96x1.js → index-kn1bx21r.js} +3 -3
  51. package/dist/{index-nj360hcs.js → index-pb8ysnq2.js} +4 -4
  52. package/dist/{index-rvmhyk89.js → index-qb75tv9j.js} +8 -8
  53. package/dist/{index-jz5bk7xd.js → index-qperbvjn.js} +2 -2
  54. package/dist/{index-25ka1jza.js → index-r9agn061.js} +4 -4
  55. package/dist/{index-hacf2tyx.js → index-reyws9fy.js} +1 -1
  56. package/dist/{index-fxbk7gk3.js → index-tad3can2.js} +1 -1
  57. package/dist/{index-hkh8x221.js → index-tj5gz396.js} +3 -5
  58. package/dist/{index-zetm0ayn.js → index-va9x7y48.js} +35 -31
  59. package/dist/{index-8ka0ne8t.js → index-vbmh68fb.js} +6 -6
  60. package/dist/{index-ta87fpfs.js → index-vyv4tame.js} +12 -14
  61. package/dist/{index-trkxkgmd.js → index-wdmfnmv1.js} +5 -5
  62. package/dist/index.js +53 -55
  63. package/dist/{logger-qwnbcfj9.js → logger-sw7z6sjz.js} +1 -2
  64. package/dist/{message-fts-rowid-map-msffhkve.js → message-fts-rowid-map-kx1bsdyg.js} +4 -5
  65. package/dist/{message-index-bounded-0q7sy04w.js → message-index-bounded-2shxmht9.js} +11 -12
  66. package/dist/{message-time-backfill-39bm498k.js → message-time-backfill-hp2jgn49.js} +2 -3
  67. package/dist/migration-worker.js +12 -13
  68. package/dist/{project-embedding-registry-r6xfsrbe.js → project-embedding-registry-nzgkq61z.js} +11 -12
  69. package/dist/raw-ordinal-warmup-worker.js +8 -8
  70. package/dist/{read-session-chunk-7fmg9p5m.js → read-session-chunk-c15y8yg6.js} +9 -10
  71. package/dist/{read-session-raw-x7a9b3jm.js → read-session-raw-04ger9zt.js} +2 -3
  72. package/dist/{recomp-orchestrator-jqa5z4ar.js → recomp-orchestrator-gfxqqpph.js} +30 -31
  73. package/dist/{render-mnqc74ar.js → render-5tx8r0me.js} +20 -21
  74. package/dist/{safe-notification-target-wztd7bgk.js → safe-notification-target-mx5khyxf.js} +2 -3
  75. package/dist/{search-archive-df09r8qn.js → search-archive-6tgh88xp.js} +11 -12
  76. package/dist/{search-kt764afk.js → search-k2n5bvsk.js} +23 -24
  77. package/dist/{send-session-notification-j93pn2hn.js → send-session-notification-gamjee2f.js} +5 -6
  78. package/dist/shared/data-path.d.ts +7 -13
  79. package/dist/shared/data-path.d.ts.map +1 -1
  80. package/dist/{storage-tags-96vyd6ra.js → storage-tags-kdb4qsyq.js} +4 -5
  81. package/dist/{transform-postprocess-phase-a7ety10n.js → transform-postprocess-phase-36dw4kxb.js} +31 -32
  82. package/dist/v2/auto-search-worker.js +5 -5
  83. package/dist/v2/chunk-embedding-write-worker.js +14 -14
  84. package/dist/v2/{compaction-marker-candidates-y737qb1v.js → compaction-marker-candidates-re14353a.js} +2 -2
  85. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  86. package/dist/v2/{compartment-chunk-embedding-nj5nrnbj.js → compartment-chunk-embedding-0pxsrzrt.js} +7 -7
  87. package/dist/v2/{context-9x7mnb7x.js → context-td3jyze3.js} +68 -49
  88. package/dist/v2/{derive-budgets-b5cgrtp8.js → derive-budgets-w0815q82.js} +3 -3
  89. package/dist/v2/{embedding-backfill-360efh1t.js → embedding-backfill-5dqdm3ff.js} +12 -12
  90. package/dist/v2/embedding-worker-process.js +1 -1
  91. package/dist/v2/embedding-worker.js +4 -4
  92. package/dist/v2/{history-owner-fpka43cn.js → history-owner-ep91wgqj.js} +2 -2
  93. package/dist/v2/{logger-4cj6d03m.js → logger-xnscpj6w.js} +1 -1
  94. package/dist/v2/{message-fts-rowid-map-qe7cpksd.js → message-fts-rowid-map-57jh6xpb.js} +4 -4
  95. package/dist/v2/{message-index-bounded-hctgp22r.js → message-index-bounded-j1jskn8a.js} +11 -11
  96. package/dist/v2/{message-time-backfill-0c4h7sg6.js → message-time-backfill-baxebka0.js} +2 -2
  97. package/dist/v2/migration-worker.js +11 -11
  98. package/dist/v2/{project-embedding-registry-ek0cy0d5.js → project-embedding-registry-swm4mw1t.js} +11 -11
  99. package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
  100. package/dist/v2/{read-session-chunk-zknadvjr.js → read-session-chunk-carzw3m8.js} +9 -9
  101. package/dist/v2/{read-session-raw-yss2ev98.js → read-session-raw-3e482h3c.js} +2 -2
  102. package/dist/v2/{recomp-orchestrator-m5w0eqke.js → recomp-orchestrator-e7vrs932.js} +31 -31
  103. package/dist/v2/{render-89asy54r.js → render-e9mh9y1d.js} +20 -20
  104. package/dist/v2/{safe-notification-target-gphhast7.js → safe-notification-target-9r79xnbt.js} +2 -2
  105. package/dist/v2/{search-archive-axz2gbdb.js → search-archive-j3kb9ggd.js} +11 -11
  106. package/dist/v2/{search-kdtja5rx.js → search-sr23g316.js} +22 -22
  107. package/dist/v2/{send-session-notification-na3q825m.js → send-session-notification-95p89k7q.js} +5 -5
  108. package/dist/v2/{server-pej5rnye.js → server-0qxb8r8q.js} +2 -2
  109. package/dist/v2/{server-sg2qjkrb.js → server-1ppcpsdw.js} +2 -2
  110. package/dist/v2/{server-nn4hbymt.js → server-2qxt6qv0.js} +8 -8
  111. package/dist/v2/{server-7vb38e51.js → server-3jc6qmdz.js} +1 -1
  112. package/dist/v2/{server-69m30b21.js → server-3yk44ddz.js} +1 -1
  113. package/dist/v2/{server-z3tyd1mx.js → server-4y2pcckw.js} +3 -3
  114. package/dist/v2/{server-3schkz95.js → server-58h6rrnx.js} +4 -4
  115. package/dist/v2/{server-af1rmkyn.js → server-5kgesxck.js} +2 -2
  116. package/dist/v2/{server-mfn1yf9d.js → server-7vrtk78d.js} +1 -1
  117. package/dist/v2/{server-f0j864ma.js → server-91gb0vh8.js} +1 -1
  118. package/dist/v2/{server-131h608x.js → server-966dq3pd.js} +2 -2
  119. package/dist/v2/{server-jb6tjyeb.js → server-bb6kf05j.js} +23 -20
  120. package/dist/v2/{server-e3m10ds0.js → server-c5kq8d5n.js} +4 -4
  121. package/dist/v2/{server-gwxys0d0.js → server-c8z2grq0.js} +1 -1
  122. package/dist/v2/{server-4x7n5qz7.js → server-e14c3hd6.js} +10 -10
  123. package/dist/v2/{server-jra7awr5.js → server-e20kfytm.js} +11 -11
  124. package/dist/v2/{server-2gjqhmn9.js → server-fw49gc57.js} +8 -8
  125. package/dist/v2/{server-y8n33d9j.js → server-g61hgy1y.js} +4 -4
  126. package/dist/v2/{server-2j87594q.js → server-kgq2e2hh.js} +2 -2
  127. package/dist/v2/{server-ddw42d76.js → server-mxsy9h1d.js} +2 -2
  128. package/dist/v2/{server-qmmkhz2z.js → server-np27dgyt.js} +1 -1
  129. package/dist/v2/{server-dcws5831.js → server-qp5sj6n5.js} +2 -2
  130. package/dist/v2/{server-sr8tf5dt.js → server-r7y35vm9.js} +4 -4
  131. package/dist/v2/{server-7be0ersd.js → server-rcchadw0.js} +3 -3
  132. package/dist/v2/{server-b3r080cm.js → server-rz5jnhnv.js} +1 -1
  133. package/dist/v2/{server-zt1m5rwj.js → server-sa1fdt41.js} +1 -1
  134. package/dist/v2/{server-jqn7q7tm.js → server-t5cgb15n.js} +5 -5
  135. package/dist/v2/{server-ypf1ap0v.js → server-t8n27rbt.js} +1 -1
  136. package/dist/v2/{server-sefxj8k1.js → server-tmf0ayqp.js} +1 -1
  137. package/dist/v2/{server-wa4qhryh.js → server-ttrrh27h.js} +2 -2
  138. package/dist/v2/{server-bez34e60.js → server-vqq3g1t7.js} +4 -4
  139. package/dist/v2/{server-tpt7bwq8.js → server-ww7xbxxf.js} +1 -1
  140. package/dist/v2/{server-zahgxer8.js → server-y7q8cds3.js} +3 -3
  141. package/dist/v2/{server-27kccwe7.js → server-yxe0gh3v.js} +11 -11
  142. package/dist/v2/{server-yyqmvbvv.js → server-z7n3n1ra.js} +34 -28
  143. package/dist/v2/server.js +5 -5
  144. package/dist/v2/{storage-tags-xq8hjqkf.js → storage-tags-rzv7y0n3.js} +4 -4
  145. package/dist/v2/{v2-archive-reader-ky1wqcws.js → v2-archive-reader-jnzjavzr.js} +1 -1
  146. package/dist/v2/{wrapup-orchestrator-6wt67saz.js → wrapup-orchestrator-jw4nre49.js} +31 -31
  147. package/dist/{v2-archive-reader-665x2x4d.js → v2-archive-reader-b76tfeje.js} +1 -1
  148. package/dist/wrapup-orchestrator-fhfazjkq.js +55 -0
  149. package/package.json +1 -1
  150. package/src/shared/data-path.test.ts +104 -56
  151. package/src/shared/data-path.ts +30 -30
  152. package/dist/index-g2q4htwp.js +0 -146
  153. package/dist/wrapup-orchestrator-7kmb3jf9.js +0 -56
@@ -5,11 +5,13 @@ import {
5
5
  readFileSync,
6
6
  readlinkSync,
7
7
  realpathSync,
8
+ unlinkSync,
8
9
  writeFileSync,
9
10
  } from "node:fs";
10
11
  import * as os from "node:os";
11
12
  import * as path from "node:path";
12
13
  import { getHarness, type HarnessId } from "./harness";
14
+ import { log } from "./logger";
13
15
  import { createTestTempDir } from "./test-temp-dir";
14
16
 
15
17
  export function getDataDir(): string {
@@ -90,8 +92,8 @@ export function getMagicContextHistorianDir(harness: HarnessId = getHarness()):
90
92
  *
91
93
  * `.cortexkit/` is the shared CortexKit per-project dir (also holds the
92
94
  * project config `magic-context.jsonc`). Because these artifacts are transient
93
- * debug dumps that shouldn't dirty the user's repo, the first write also drops
94
- * a fenced-block `.gitignore` entry ignoring this subdir (see
95
+ * debug dumps that shouldn't dirty the user's repo, each writer ensures a
96
+ * self-ignoring `.gitignore` inside this subdir (see
95
97
  * ensureCortexKitArtifactGitignore) while leaving `*.jsonc` config tracked.
96
98
  *
97
99
  * Migration note: artifacts used to live under `.opencode/magic-context/`. We
@@ -106,47 +108,45 @@ export function getProjectMagicContextDir(directory: string): string {
106
108
  return path.join(directory, ".cortexkit", "magic-context");
107
109
  }
108
110
 
109
- const GITIGNORE_GUARD_OPEN = "# >>> cortexkit:magic-context";
110
- const GITIGNORE_GUARD_CLOSE = "# <<< cortexkit:magic-context";
111
-
112
111
  /**
113
- * Ensure `<project>/.cortexkit/.gitignore` ignores Magic Context's transient
114
- * artifact subdir (`magic-context/`) without touching anything else in the
115
- * shared `.cortexkit/` dir — the project config `magic-context.jsonc` stays
116
- * tracked, and any sibling module's (e.g. AFT's) entries are preserved.
117
- *
118
- * Uses the shared CortexKit fenced-block convention: each module owns exactly
119
- * its `# >>> cortexkit:<module>` … `# <<< cortexkit:<module>` block and appends
120
- * it idempotently (no-op when its own guard line is already present). This lets
121
- * multiple cortexkit modules coexist in one `.gitignore` without clobbering.
112
+ * Hide artifacts and their ignore file without hiding the sibling project
113
+ * config. Retire our old shared-file block only after the nested rule is ready,
114
+ * preserving all bytes outside our complete fences.
122
115
  *
123
116
  * Best-effort: a write failure never blocks an artifact write (the caller
124
117
  * already degrades gracefully on its own write failures).
125
118
  */
126
119
  export function ensureCortexKitArtifactGitignore(directory: string): void {
127
120
  try {
128
- const cortexKitDir = path.join(directory, ".cortexkit");
129
- const gitignorePath = path.join(cortexKitDir, ".gitignore");
130
- let existing = "";
131
- if (existsSync(gitignorePath)) {
132
- existing = readFileSync(gitignorePath, "utf8");
133
- // Already fenced by us — nothing to do.
134
- if (existing.includes(GITIGNORE_GUARD_OPEN)) return;
121
+ const artifactDir = getProjectMagicContextDir(directory);
122
+ const gitignorePath = path.join(artifactDir, ".gitignore");
123
+ mkdirSync(artifactDir, { recursive: true });
124
+ if (!existsSync(gitignorePath) || readFileSync(gitignorePath, "utf8") !== "*\n") {
125
+ writeFileSync(gitignorePath, "*\n", "utf8");
135
126
  }
136
- const block = `${GITIGNORE_GUARD_OPEN}\nmagic-context/\n${GITIGNORE_GUARD_CLOSE}\n`;
137
- const needsLeadingNewline = existing.length > 0 && !existing.endsWith("\n");
138
- const next = existing + (needsLeadingNewline ? "\n" : "") + block;
139
- mkdirSync(cortexKitDir, { recursive: true });
140
- writeFileSync(gitignorePath, next, "utf8");
141
- } catch {
142
- // best-effort — never block an artifact write on the gitignore.
127
+
128
+ const sharedPath = path.join(directory, ".cortexkit", ".gitignore");
129
+ if (!existsSync(sharedPath)) return;
130
+ // A byte-preserving encoding keeps even non-UTF8 sibling entries intact.
131
+ const existing = readFileSync(sharedPath).toString("latin1");
132
+ // Do not cross another module's fence if an old block is incomplete.
133
+ const next = existing.replace(
134
+ /^# >>> cortexkit:magic-context\r?\n(?:(?!^# (?:>>>|<<<) cortexkit:)[\s\S])*?^# <<< cortexkit:magic-context(?:\r?\n|$)/gm,
135
+ "",
136
+ );
137
+ if (next === existing) return;
138
+ const remaining = Buffer.from(next, "latin1");
139
+ if (remaining.toString("utf8").trim() === "") unlinkSync(sharedPath);
140
+ else writeFileSync(sharedPath, remaining);
141
+ } catch (error) {
142
+ log("Failed to ensure project artifact gitignore", { directory, error: String(error) });
143
143
  }
144
144
  }
145
145
 
146
146
  /**
147
147
  * Project-local historian artifact directory.
148
148
  *
149
- * Layout: `<project-directory>/.opencode/magic-context/historian/`
149
+ * Layout: `<project-directory>/.cortexkit/magic-context/historian/`
150
150
  *
151
151
  * Used for:
152
152
  * - existing-state offload XMLs that long historian/recomp passes write
@@ -154,7 +154,7 @@ export function ensureCortexKitArtifactGitignore(directory: string): void {
154
154
  * - validation-failure dump XMLs preserved for debugging
155
155
  *
156
156
  * Callers must `mkdirSync(dir, { recursive: true })` before writing — the
157
- * `.opencode/` parent may not exist on a fresh project, and write failures
157
+ * `.cortexkit/` parent may not exist on a fresh project, and write failures
158
158
  * here must degrade gracefully (e.g. historian falls back to inline state).
159
159
  */
160
160
  export function getProjectMagicContextHistorianDir(directory: string): string {
@@ -1,146 +0,0 @@
1
- import {
2
- getHarness2
3
- } from "./index-pavzsdc6.js";
4
-
5
- // src/shared/data-path.ts
6
- import {
7
- existsSync,
8
- lstatSync,
9
- mkdirSync,
10
- readFileSync,
11
- readlinkSync,
12
- realpathSync,
13
- writeFileSync
14
- } from "node:fs";
15
- import * as os from "node:os";
16
- import * as path from "node:path";
17
-
18
- // src/shared/test-temp-dir.ts
19
- var STALE_TEMP_DIR_AGE_MS = 60 * 60 * 1000;
20
- var registeredTempDirs = new Set;
21
-
22
- // src/shared/data-path.ts
23
- function getDataDir() {
24
- return process.env.XDG_DATA_HOME ?? path.join(os.homedir(), ".local", "share");
25
- }
26
- function getMagicContextTempDir(harness = getHarness2()) {
27
- return path.join(os.tmpdir(), harness, "magic-context");
28
- }
29
- function getMagicContextLogPath(harness = getHarness2()) {
30
- const envPath = process.env.MAGIC_CONTEXT_LOG_PATH?.trim();
31
- if (envPath)
32
- return envPath;
33
- return path.join(getMagicContextTempDir(harness), "magic-context.log");
34
- }
35
- function getProjectMagicContextDir(directory) {
36
- return path.join(directory, ".cortexkit", "magic-context");
37
- }
38
- var GITIGNORE_GUARD_OPEN = "# >>> cortexkit:magic-context";
39
- var GITIGNORE_GUARD_CLOSE = "# <<< cortexkit:magic-context";
40
- function ensureCortexKitArtifactGitignore(directory) {
41
- try {
42
- const cortexKitDir = path.join(directory, ".cortexkit");
43
- const gitignorePath = path.join(cortexKitDir, ".gitignore");
44
- let existing = "";
45
- if (existsSync(gitignorePath)) {
46
- existing = readFileSync(gitignorePath, "utf8");
47
- if (existing.includes(GITIGNORE_GUARD_OPEN))
48
- return;
49
- }
50
- const block = `${GITIGNORE_GUARD_OPEN}
51
- magic-context/
52
- ${GITIGNORE_GUARD_CLOSE}
53
- `;
54
- const needsLeadingNewline = existing.length > 0 && !existing.endsWith(`
55
- `);
56
- const next = existing + (needsLeadingNewline ? `
57
- ` : "") + block;
58
- mkdirSync(cortexKitDir, { recursive: true });
59
- writeFileSync(gitignorePath, next, "utf8");
60
- } catch {}
61
- }
62
- function getProjectMagicContextHistorianDir(directory) {
63
- return path.join(getProjectMagicContextDir(directory), "historian");
64
- }
65
- function getOpenCodeStorageDir() {
66
- return path.join(getDataDir(), "opencode", "storage");
67
- }
68
- function getMagicContextStorageResolution() {
69
- const testDataDir = process.env.MAGIC_CONTEXT_TEST_DATA_DIR?.trim();
70
- if (testDataDir) {
71
- const perTestDataHome = process.env.XDG_DATA_HOME?.trim();
72
- if (perTestDataHome && path.resolve(perTestDataHome) !== path.resolve(testDataDir)) {
73
- return {
74
- path: path.join(perTestDataHome, "cortexkit", "magic-context"),
75
- source: "test isolation"
76
- };
77
- }
78
- return {
79
- path: path.join(testDataDir, "cortexkit", "magic-context"),
80
- source: "test isolation"
81
- };
82
- }
83
- if (false) {}
84
- const explicitStorageDir = process.env.MAGIC_CONTEXT_STORAGE_DIR?.trim();
85
- if (explicitStorageDir) {
86
- if (!path.isAbsolute(explicitStorageDir)) {
87
- throw new Error("MAGIC_CONTEXT_STORAGE_DIR must be an absolute path");
88
- }
89
- return { path: explicitStorageDir, source: "environment override" };
90
- }
91
- const xdgDataHome = process.env.XDG_DATA_HOME?.trim();
92
- if (xdgDataHome) {
93
- return {
94
- path: path.join(xdgDataHome, "cortexkit", "magic-context"),
95
- source: "XDG_DATA_HOME"
96
- };
97
- }
98
- return {
99
- path: path.join(os.homedir(), ".local", "share", "cortexkit", "magic-context"),
100
- source: "platform default"
101
- };
102
- }
103
- function getMagicContextStorageDir() {
104
- return getMagicContextStorageResolution().path;
105
- }
106
- function canonicalizeStoragePath(value, seen = new Set) {
107
- const absolute = path.resolve(value);
108
- if (seen.has(absolute))
109
- return absolute;
110
- seen.add(absolute);
111
- try {
112
- return realpathSync.native(absolute);
113
- } catch {
114
- try {
115
- if (lstatSync(absolute).isSymbolicLink()) {
116
- const target = readlinkSync(absolute);
117
- const resolvedTarget = path.isAbsolute(target) ? target : path.resolve(path.dirname(absolute), target);
118
- return canonicalizeStoragePath(resolvedTarget, seen);
119
- }
120
- } catch {}
121
- const parent = path.dirname(absolute);
122
- if (parent === absolute)
123
- return absolute;
124
- const resolvedParent = canonicalizeStoragePath(parent, seen);
125
- return path.resolve(resolvedParent, path.basename(absolute));
126
- }
127
- }
128
- function isMagicContextStorageOutsideEngram(storageDir = getMagicContextStorageDir(), backupDir = path.join(os.homedir(), ".local", "share", "cortexkit", "magic-context")) {
129
- const resolvedStorageDir = canonicalizeStoragePath(storageDir);
130
- const resolvedBackupDir = canonicalizeStoragePath(backupDir);
131
- const relative2 = path.relative(resolvedBackupDir, resolvedStorageDir);
132
- return path.isAbsolute(relative2) || relative2 === ".." || relative2.startsWith(`..${path.sep}`);
133
- }
134
- var STORAGE_BACKUP_WARNING_CHECKED = Symbol.for("magic-context.storage-backup-warning-checked");
135
- function claimStorageBackupWarningCheck() {
136
- const processState = globalThis;
137
- if (processState[STORAGE_BACKUP_WARNING_CHECKED])
138
- return false;
139
- processState[STORAGE_BACKUP_WARNING_CHECKED] = true;
140
- return true;
141
- }
142
- function getLegacyOpenCodeMagicContextStorageDir() {
143
- return path.join(getOpenCodeStorageDir(), "plugin", "magic-context");
144
- }
145
-
146
- export { getDataDir, getMagicContextLogPath, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getOpenCodeStorageDir, getMagicContextStorageResolution, getMagicContextStorageDir, isMagicContextStorageOutsideEngram, claimStorageBackupWarningCheck, getLegacyOpenCodeMagicContextStorageDir };
@@ -1,56 +0,0 @@
1
- import {
2
- runManagedWrapup2
3
- } from "./index-8ka0ne8t.js";
4
- import"./index-trkxkgmd.js";
5
- import"./index-zetm0ayn.js";
6
- import"./index-gn6gfz4y.js";
7
- import"./index-sd3egckz.js";
8
- import"./index-sd2s4t4p.js";
9
- import"./index-d4qw2h43.js";
10
- import"./index-jjvbk92s.js";
11
- import"./index-s79g172v.js";
12
- import"./index-4dhv7mqz.js";
13
- import"./index-ta87fpfs.js";
14
- import"./index-2qbtqg1w.js";
15
- import"./index-fgft4qjn.js";
16
- import"./index-2amn2s73.js";
17
- import"./index-6athgjba.js";
18
- import"./index-8cfnaagj.js";
19
- import"./index-25ka1jza.js";
20
- import"./index-qt1qqasc.js";
21
- import"./index-rvmhyk89.js";
22
- import"./index-4wpfbzks.js";
23
- import"./index-1zx87sdm.js";
24
- import"./index-brj6was5.js";
25
- import"./index-x8a7jmkh.js";
26
- import"./index-fw42ms3m.js";
27
- import"./index-hkh8x221.js";
28
- import"./index-4dpvnp8k.js";
29
- import"./index-jz5bk7xd.js";
30
- import"./index-qcz1fy7h.js";
31
- import"./index-dj2p8653.js";
32
- import"./index-q6pjqm49.js";
33
- import"./index-fb3zxn06.js";
34
- import"./index-nj360hcs.js";
35
- import"./index-fr0wbhdn.js";
36
- import"./index-txs8tce6.js";
37
- import"./index-h9m41624.js";
38
- import"./index-wh9fxds5.js";
39
- import"./index-2p37txes.js";
40
- import"./index-smtbdmc3.js";
41
- import"./index-9wnbnx8f.js";
42
- import"./index-xa9mmq6c.js";
43
- import"./index-96ztjvkn.js";
44
- import"./index-v0p37hm2.js";
45
- import"./index-58e3y90n.js";
46
- import"./index-fxbk7gk3.js";
47
- import"./index-ak11t3gm.js";
48
- import"./index-gzy5w8ya.js";
49
- import"./index-jrfre9ah.js";
50
- import"./index-g2q4htwp.js";
51
- import"./index-pavzsdc6.js";
52
- import"./index-z4p0ry94.js";
53
- import"./index-1d042x6w.js";
54
- export {
55
- runManagedWrapup2 as runManagedWrapup
56
- };