dreamcontext 0.17.0 → 0.17.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/dist/dashboard/assets/{BrainCanvas3D-y35c1rJf.js → BrainCanvas3D-DyF_3yYD.js} +1 -1
- package/dist/dashboard/assets/{_baseUniq-g57aeE1L.js → _baseUniq-Do8VMBA0.js} +1 -1
- package/dist/dashboard/assets/{ar-SA-G6X2FPQ2-B7ybIFFt.js → ar-SA-G6X2FPQ2-DmbXDb2R.js} +1 -1
- package/dist/dashboard/assets/{arc-C5Y4eje1.js → arc-CwtUBQfU.js} +1 -1
- package/dist/dashboard/assets/{architectureDiagram-Q4EWVU46-DnxEKMQ-.js → architectureDiagram-Q4EWVU46-O9bOog_f.js} +1 -1
- package/dist/dashboard/assets/{az-AZ-76LH7QW2-DF75BEoV.js → az-AZ-76LH7QW2-c9Zk10vG.js} +1 -1
- package/dist/dashboard/assets/{bg-BG-XCXSNQG7-D_xX3Evl.js → bg-BG-XCXSNQG7-uMTg84lX.js} +1 -1
- package/dist/dashboard/assets/{blockDiagram-DXYQGD6D-DsFvaLns.js → blockDiagram-DXYQGD6D-BTENXCSO.js} +1 -1
- package/dist/dashboard/assets/{bn-BD-2XOGV67Q-DSRsGjwD.js → bn-BD-2XOGV67Q-DUFKHcua.js} +1 -1
- package/dist/dashboard/assets/{c4Diagram-AHTNJAMY-DXmGhsoH.js → c4Diagram-AHTNJAMY-DMXPWRiQ.js} +1 -1
- package/dist/dashboard/assets/{ca-ES-6MX7JW3Y-DXLsz3CU.js → ca-ES-6MX7JW3Y-BuYX1q89.js} +1 -1
- package/dist/dashboard/assets/channel-2YfRjala.js +1 -0
- package/dist/dashboard/assets/{chunk-4BX2VUAB-B1u0KwPb.js → chunk-4BX2VUAB-DgefvnWS.js} +1 -1
- package/dist/dashboard/assets/{chunk-4TB4RGXK-DCMNOaAV.js → chunk-4TB4RGXK-BnFO5G1t.js} +1 -1
- package/dist/dashboard/assets/{chunk-55IACEB6-ByleWNvl.js → chunk-55IACEB6-COm2TYEM.js} +1 -1
- package/dist/dashboard/assets/{chunk-EDXVE4YY-D1uIvY6z.js → chunk-EDXVE4YY-CtsGCwZp.js} +1 -1
- package/dist/dashboard/assets/{chunk-FMBD7UC4-gnrb7hoq.js → chunk-FMBD7UC4-cfSvx35j.js} +1 -1
- package/dist/dashboard/assets/{chunk-OYMX7WX6-DW6-cdV3.js → chunk-OYMX7WX6-DAhDKteL.js} +1 -1
- package/dist/dashboard/assets/{chunk-QZHKN3VN-CGHdGGkQ.js → chunk-QZHKN3VN-B5h4qML3.js} +1 -1
- package/dist/dashboard/assets/{chunk-YZCP3GAM-DDJQ7-hq.js → chunk-YZCP3GAM-CGp_NiRg.js} +1 -1
- package/dist/dashboard/assets/classDiagram-6PBFFD2Q-DB_UnN1h.js +1 -0
- package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-DB_UnN1h.js +1 -0
- package/dist/dashboard/assets/clone-DaDvB3N6.js +1 -0
- package/dist/dashboard/assets/{cose-bilkent-S5V4N54A-CTQIwiIq.js → cose-bilkent-S5V4N54A-Dk7CMFA4.js} +1 -1
- package/dist/dashboard/assets/{cs-CZ-2BRQDIVT-BKvVPsJS.js → cs-CZ-2BRQDIVT-zfUTiS_d.js} +1 -1
- package/dist/dashboard/assets/{da-DK-5WZEPLOC-D-GZqbdX.js → da-DK-5WZEPLOC-CU14f8NA.js} +1 -1
- package/dist/dashboard/assets/{dagre-KV5264BT-Jz3whjk4.js → dagre-KV5264BT-BiMVxC4Q.js} +1 -1
- package/dist/dashboard/assets/{de-DE-XR44H4JA-dN8Dh2tp.js → de-DE-XR44H4JA-CDOHAJGo.js} +1 -1
- package/dist/dashboard/assets/{diagram-5BDNPKRD-DtDbd2d1.js → diagram-5BDNPKRD-DfJEsVTA.js} +1 -1
- package/dist/dashboard/assets/{diagram-G4DWMVQ6-DFVSpltG.js → diagram-G4DWMVQ6-CztLHIcY.js} +1 -1
- package/dist/dashboard/assets/{diagram-MMDJMWI5-eBAtVrcR.js → diagram-MMDJMWI5-DqoQLlWK.js} +1 -1
- package/dist/dashboard/assets/{diagram-TYMM5635-BHjVr_FM.js → diagram-TYMM5635-DvyvQBCc.js} +1 -1
- package/dist/dashboard/assets/{el-GR-BZB4AONW-RPZfx5-x.js → el-GR-BZB4AONW-ChUphbcv.js} +1 -1
- package/dist/dashboard/assets/{erDiagram-SMLLAGMA-CXAkwxcx.js → erDiagram-SMLLAGMA-D_uSs2_2.js} +1 -1
- package/dist/dashboard/assets/{es-ES-U4NZUMDT-DQv-XgP6.js → es-ES-U4NZUMDT-BNalBEhb.js} +1 -1
- package/dist/dashboard/assets/{eu-ES-A7QVB2H4-CuWBCBqu.js → eu-ES-A7QVB2H4-BMiQyA2y.js} +1 -1
- package/dist/dashboard/assets/{fa-IR-HGAKTJCU-4FMGsomC.js → fa-IR-HGAKTJCU-Bd6ZnTSo.js} +1 -1
- package/dist/dashboard/assets/{fi-FI-Z5N7JZ37-C_7XKQ39.js → fi-FI-Z5N7JZ37-BWAfJadC.js} +1 -1
- package/dist/dashboard/assets/{flowDiagram-DWJPFMVM-BFdWnw5h.js → flowDiagram-DWJPFMVM-Bmsp6kyU.js} +1 -1
- package/dist/dashboard/assets/{fr-FR-RHASNOE6-pmcEtk8N.js → fr-FR-RHASNOE6-CspbYzOW.js} +1 -1
- package/dist/dashboard/assets/{ganttDiagram-T4ZO3ILL-DFf9_pss.js → ganttDiagram-T4ZO3ILL-wEdysXo_.js} +1 -1
- package/dist/dashboard/assets/{gitGraphDiagram-UUTBAWPF-DURiCXR8.js → gitGraphDiagram-UUTBAWPF-BEiGpPBj.js} +1 -1
- package/dist/dashboard/assets/{gl-ES-HMX3MZ6V-DB4ImOy_.js → gl-ES-HMX3MZ6V-CV76vsWr.js} +1 -1
- package/dist/dashboard/assets/{graph-DYtPayNd.js → graph-CZFIeNHZ.js} +1 -1
- package/dist/dashboard/assets/{he-IL-6SHJWFNN-CHIkZOP6.js → he-IL-6SHJWFNN-Y1VoXJ_H.js} +1 -1
- package/dist/dashboard/assets/{hi-IN-IWLTKZ5I-pVpeINen.js → hi-IN-IWLTKZ5I-Crh5S49o.js} +1 -1
- package/dist/dashboard/assets/{hu-HU-A5ZG7DT2-CAUlCsMQ.js → hu-HU-A5ZG7DT2-D4I3gCbp.js} +1 -1
- package/dist/dashboard/assets/{id-ID-SAP4L64H-BZJDBU66.js → id-ID-SAP4L64H-Chvzkuvi.js} +1 -1
- package/dist/dashboard/assets/{index-B8f3KGr5.js → index-BIfrbaFS.js} +8 -8
- package/dist/dashboard/assets/{index-DxIybLvS.js → index-C7Bo5AQH.js} +1 -1
- package/dist/dashboard/assets/{infoDiagram-42DDH7IO-BPiW3Ij4.js → infoDiagram-42DDH7IO-BzfuDHl4.js} +1 -1
- package/dist/dashboard/assets/{ishikawaDiagram-UXIWVN3A-Blkx8f3S.js → ishikawaDiagram-UXIWVN3A-BVoNJ9VS.js} +1 -1
- package/dist/dashboard/assets/{it-IT-JPQ66NNP-My2T4UwV.js → it-IT-JPQ66NNP-BH_gN5es.js} +1 -1
- package/dist/dashboard/assets/{ja-JP-DBVTYXUO-BPD5Unyr.js → ja-JP-DBVTYXUO-DU_WmLVa.js} +1 -1
- package/dist/dashboard/assets/{journeyDiagram-VCZTEJTY-BDsJYpXT.js → journeyDiagram-VCZTEJTY-DbwICa_a.js} +1 -1
- package/dist/dashboard/assets/{kaa-6HZHGXH3-ByIbhvgR.js → kaa-6HZHGXH3-KYU9qowM.js} +1 -1
- package/dist/dashboard/assets/{kab-KAB-ZGHBKWFO-eKUh9BOS.js → kab-KAB-ZGHBKWFO-bjhyiUq5.js} +1 -1
- package/dist/dashboard/assets/{kanban-definition-6JOO6SKY-C3viwNtJ.js → kanban-definition-6JOO6SKY-D9XucLs4.js} +1 -1
- package/dist/dashboard/assets/{kk-KZ-P5N5QNE5-CyZ_MOrV.js → kk-KZ-P5N5QNE5-CYTx_dAZ.js} +1 -1
- package/dist/dashboard/assets/{km-KH-HSX4SM5Z-D3FZvcLx.js → km-KH-HSX4SM5Z-DqsuY4Lf.js} +1 -1
- package/dist/dashboard/assets/{ko-KR-MTYHY66A-D8irDigM.js → ko-KR-MTYHY66A-BZe7NywF.js} +1 -1
- package/dist/dashboard/assets/{ku-TR-6OUDTVRD-B7P1RwAB.js → ku-TR-6OUDTVRD-F5d6HFWt.js} +1 -1
- package/dist/dashboard/assets/{layout-Bm4ekZW0.js → layout-CotqU0S9.js} +1 -1
- package/dist/dashboard/assets/{linear-CuMgtZOc.js → linear-Dqv87Scf.js} +1 -1
- package/dist/dashboard/assets/{lt-LT-XHIRWOB4-Ci1UvfZQ.js → lt-LT-XHIRWOB4-BCCuaPbS.js} +1 -1
- package/dist/dashboard/assets/{lv-LV-5QDEKY6T-Bo3huXeU.js → lv-LV-5QDEKY6T-NLGi-vJ6.js} +1 -1
- package/dist/dashboard/assets/{min-DbOs1vEh.js → min-BbJdnc3h.js} +1 -1
- package/dist/dashboard/assets/{mindmap-definition-QFDTVHPH-Bqzy1-O0.js → mindmap-definition-QFDTVHPH-Dk4QySu7.js} +1 -1
- package/dist/dashboard/assets/{mr-IN-CRQNXWMA-CqisPVEd.js → mr-IN-CRQNXWMA-BnGDIgVN.js} +1 -1
- package/dist/dashboard/assets/{my-MM-5M5IBNSE-BeBN5i_N.js → my-MM-5M5IBNSE-CspgYE9_.js} +1 -1
- package/dist/dashboard/assets/{nb-NO-T6EIAALU-D5dV1--A.js → nb-NO-T6EIAALU-BeRPw3hu.js} +1 -1
- package/dist/dashboard/assets/{nl-NL-IS3SIHDZ-D-0yJ8XR.js → nl-NL-IS3SIHDZ-C-G-bljM.js} +1 -1
- package/dist/dashboard/assets/{nn-NO-6E72VCQL-Vo96ITcp.js → nn-NO-6E72VCQL-Ct7VZY8D.js} +1 -1
- package/dist/dashboard/assets/{oc-FR-POXYY2M6-nsG4ZsrH.js → oc-FR-POXYY2M6-Cv5-C4Qq.js} +1 -1
- package/dist/dashboard/assets/{pa-IN-N4M65BXN-DxCDdJGd.js → pa-IN-N4M65BXN-DAgkIThL.js} +1 -1
- package/dist/dashboard/assets/{percentages-BXMCSKIN-BjW3QiBD.js → percentages-BXMCSKIN-vidRYabK.js} +7 -7
- package/dist/dashboard/assets/{pica-BbAsDbLn.js → pica-Cy-Xl-mi.js} +1 -1
- package/dist/dashboard/assets/{pieDiagram-DEJITSTG-CCVGHDYA.js → pieDiagram-DEJITSTG-BnP4-zwd.js} +1 -1
- package/dist/dashboard/assets/{pl-PL-T2D74RX3-BxKUkBW3.js → pl-PL-T2D74RX3-BuJQ3HD-.js} +1 -1
- package/dist/dashboard/assets/{pt-BR-5N22H2LF-B2rKoKHu.js → pt-BR-5N22H2LF-BbAqsvD6.js} +1 -1
- package/dist/dashboard/assets/{pt-PT-UZXXM6DQ-D2aDN9F3.js → pt-PT-UZXXM6DQ-DzFJedU3.js} +1 -1
- package/dist/dashboard/assets/{quadrantDiagram-34T5L4WZ-DPRv7LNW.js → quadrantDiagram-34T5L4WZ-BXN88cHy.js} +1 -1
- package/dist/dashboard/assets/{requirementDiagram-MS252O5E-6bTSQFfr.js → requirementDiagram-MS252O5E-D34hL42a.js} +1 -1
- package/dist/dashboard/assets/{ro-RO-JPDTUUEW-C1oY-qLb.js → ro-RO-JPDTUUEW-BV2-sOiv.js} +1 -1
- package/dist/dashboard/assets/{ru-RU-B4JR7IUQ-aHhtIKSv.js → ru-RU-B4JR7IUQ-BCL4N9Ej.js} +1 -1
- package/dist/dashboard/assets/{sankeyDiagram-XADWPNL6-BWSI8qsY.js → sankeyDiagram-XADWPNL6-0mFeok-3.js} +1 -1
- package/dist/dashboard/assets/{sequenceDiagram-FGHM5R23-DANhN4OD.js → sequenceDiagram-FGHM5R23-C-5nW5j6.js} +1 -1
- package/dist/dashboard/assets/{si-LK-N5RQ5JYF-D2d4DTQQ.js → si-LK-N5RQ5JYF-CNhaw4jx.js} +1 -1
- package/dist/dashboard/assets/{sk-SK-C5VTKIMK-Di1t95sR.js → sk-SK-C5VTKIMK-mHCphOXu.js} +1 -1
- package/dist/dashboard/assets/{sl-SI-NN7IZMDC-CQXx5B1D.js → sl-SI-NN7IZMDC--lzgHthQ.js} +1 -1
- package/dist/dashboard/assets/{stateDiagram-FHFEXIEX-CpuW4o5E.js → stateDiagram-FHFEXIEX-C50iDFqe.js} +1 -1
- package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-eW9-s0Sm.js +1 -0
- package/dist/dashboard/assets/{subset-shared.chunk-CZJii2rp.js → subset-shared.chunk-DNsjL37s.js} +1 -1
- package/dist/dashboard/assets/{subset-worker.chunk-CtJccz91.js → subset-worker.chunk-BaV3r-bl.js} +1 -1
- package/dist/dashboard/assets/{sv-SE-XGPEYMSR-BtJ_mbLr.js → sv-SE-XGPEYMSR-ckw8jfGN.js} +1 -1
- package/dist/dashboard/assets/{ta-IN-2NMHFXQM-Dq22XWgM.js → ta-IN-2NMHFXQM-CSeNmVhS.js} +1 -1
- package/dist/dashboard/assets/{th-TH-HPSO5L25-ChfIMa5w.js → th-TH-HPSO5L25-Cvn1sg_3.js} +1 -1
- package/dist/dashboard/assets/{timeline-definition-GMOUNBTQ-nUPbvtjj.js → timeline-definition-GMOUNBTQ-DRYfuqHT.js} +1 -1
- package/dist/dashboard/assets/{tr-TR-DEFEU3FU-Lon-b9uf.js → tr-TR-DEFEU3FU-CyhY22TB.js} +1 -1
- package/dist/dashboard/assets/{uk-UA-QMV73CPH-BmpXA4GS.js → uk-UA-QMV73CPH-BvvAEO6U.js} +1 -1
- package/dist/dashboard/assets/{vennDiagram-DHZGUBPP-Cfq6Ys0H.js → vennDiagram-DHZGUBPP-Crril7Cj.js} +1 -1
- package/dist/dashboard/assets/{vi-VN-M7AON7JQ-gUFADT8k.js → vi-VN-M7AON7JQ-c7AwSUZ8.js} +1 -1
- package/dist/dashboard/assets/{wardley-RL74JXVD-DbjyRI1F.js → wardley-RL74JXVD-Da5AhSWU.js} +1 -1
- package/dist/dashboard/assets/{wardleyDiagram-NUSXRM2D-D7kJ-35q.js → wardleyDiagram-NUSXRM2D-C4GeB_Df.js} +1 -1
- package/dist/dashboard/assets/{xychartDiagram-5P7HB3ND-Bt41FbXl.js → xychartDiagram-5P7HB3ND-BPCFKXqR.js} +1 -1
- package/dist/dashboard/assets/{zh-CN-LNUGB5OW-GEnnC6n4.js → zh-CN-LNUGB5OW-BvNiZwKU.js} +1 -1
- package/dist/dashboard/assets/{zh-HK-E62DVLB3-bQyXnsrh.js → zh-HK-E62DVLB3-CCFtoCWb.js} +1 -1
- package/dist/dashboard/assets/{zh-TW-RAJ6MFWO-Buauia8Y.js → zh-TW-RAJ6MFWO-bYBr-stu.js} +1 -1
- package/dist/dashboard/index.html +1 -1
- package/dist/index.js +297 -245
- package/package.json +1 -1
- package/dist/dashboard/assets/channel-8FAi-z4K.js +0 -1
- package/dist/dashboard/assets/classDiagram-6PBFFD2Q-Docm0aN-.js +0 -1
- package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-Docm0aN-.js +0 -1
- package/dist/dashboard/assets/clone-CxkSBJ3W.js +0 -1
- package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-hI3OGuUV.js +0 -1
package/dist/index.js
CHANGED
|
@@ -28253,8 +28253,8 @@ var require_excerpt = __commonJS({
|
|
|
28253
28253
|
if (sep18 == null && (opts.excerpt === false || opts.excerpt == null)) {
|
|
28254
28254
|
return file;
|
|
28255
28255
|
}
|
|
28256
|
-
const
|
|
28257
|
-
const idx = file.content.indexOf(
|
|
28256
|
+
const delimiter2 = typeof opts.excerpt === "string" ? opts.excerpt : sep18 || opts.delimiters[0];
|
|
28257
|
+
const idx = file.content.indexOf(delimiter2);
|
|
28258
28258
|
if (idx !== -1) {
|
|
28259
28259
|
file.excerpt = file.content.slice(0, idx);
|
|
28260
28260
|
}
|
|
@@ -38942,7 +38942,7 @@ var init_brain_repo = __esm({
|
|
|
38942
38942
|
|
|
38943
38943
|
// src/lib/git-sync/credentials.ts
|
|
38944
38944
|
import { accessSync, chmodSync as chmodSync4, constants, existsSync as existsSync47, unlinkSync as unlinkSync5, writeFileSync as writeFileSync34 } from "fs";
|
|
38945
|
-
import { join as join48 } from "path";
|
|
38945
|
+
import { delimiter, dirname as dirname24, join as join48 } from "path";
|
|
38946
38946
|
import { tmpdir as tmpdir2 } from "os";
|
|
38947
38947
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
38948
38948
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
@@ -38965,6 +38965,13 @@ function resolveAskpassPath() {
|
|
|
38965
38965
|
}
|
|
38966
38966
|
throw new Error("askpass.cjs not found \u2014 the dreamcontext installation may be corrupt or incomplete.");
|
|
38967
38967
|
}
|
|
38968
|
+
function withNodeDirOnPath(currentPath) {
|
|
38969
|
+
const nodeDir = dirname24(process.execPath);
|
|
38970
|
+
const base = currentPath ?? "";
|
|
38971
|
+
if (!nodeDir) return base;
|
|
38972
|
+
if (base.split(delimiter).includes(nodeDir)) return base;
|
|
38973
|
+
return base ? `${nodeDir}${delimiter}${base}` : nodeDir;
|
|
38974
|
+
}
|
|
38968
38975
|
async function withGitCredentials(token, fn) {
|
|
38969
38976
|
const tmpPath = join48(tmpdir2(), `dreamcontext-askpass-${randomUUID2()}`);
|
|
38970
38977
|
writeFileSync34(tmpPath, token, { mode: 384 });
|
|
@@ -38974,6 +38981,15 @@ async function withGitCredentials(token, fn) {
|
|
|
38974
38981
|
}
|
|
38975
38982
|
const env2 = {
|
|
38976
38983
|
...process.env,
|
|
38984
|
+
// git execs the askpass helper (`#!/usr/bin/env node`) DIRECTLY, so `node`
|
|
38985
|
+
// must be resolvable on PATH at that instant. The desktop app spawns the
|
|
38986
|
+
// dashboard server with a minimal GUI PATH (`/usr/bin:/bin:/usr/sbin:/sbin`)
|
|
38987
|
+
// that has NO node — git then can't launch the helper ("env: node: No such
|
|
38988
|
+
// file or directory" → "could not read Username … terminal prompts disabled"),
|
|
38989
|
+
// and that failure gets MISCLASSIFIED as an expired GitHub sign-in. Guarantee
|
|
38990
|
+
// the helper can find node by prepending the directory of the CURRENT node
|
|
38991
|
+
// binary (dreamcontext always runs under node, so process.execPath IS node).
|
|
38992
|
+
PATH: withNodeDirOnPath(process.env.PATH),
|
|
38977
38993
|
GIT_ASKPASS: resolveAskpassPath(),
|
|
38978
38994
|
DREAMCONTEXT_ASKPASS_TOKEN_FILE: tmpPath,
|
|
38979
38995
|
GIT_TERMINAL_PROMPT: "0"
|
|
@@ -38996,7 +39012,7 @@ var init_credentials = __esm({
|
|
|
38996
39012
|
});
|
|
38997
39013
|
|
|
38998
39014
|
// src/lib/git-sync/sync-engine.ts
|
|
38999
|
-
import { dirname as
|
|
39015
|
+
import { dirname as dirname25 } from "path";
|
|
39000
39016
|
function syncCommitMessage(ctx) {
|
|
39001
39017
|
return ctx.mode === "full-repo" ? "chore: sync project (dreamcontext)" : "chore(brain): sync";
|
|
39002
39018
|
}
|
|
@@ -39032,7 +39048,7 @@ function authorFor(ctx) {
|
|
|
39032
39048
|
async function runBrainSync(opts, depsOverride = {}) {
|
|
39033
39049
|
const d = { ...defaultDeps, ...depsOverride };
|
|
39034
39050
|
const contextRoot = opts.cwd;
|
|
39035
|
-
const projectRoot =
|
|
39051
|
+
const projectRoot = dirname25(contextRoot);
|
|
39036
39052
|
const config = readSetupConfig(projectRoot);
|
|
39037
39053
|
const enabledResolution = resolveBrainSyncEnabled(projectRoot, config, d.git);
|
|
39038
39054
|
if (!enabledResolution.enabled) {
|
|
@@ -39435,13 +39451,123 @@ var init_sync_engine = __esm({
|
|
|
39435
39451
|
}
|
|
39436
39452
|
});
|
|
39437
39453
|
|
|
39454
|
+
// src/lib/git-sync/failure.ts
|
|
39455
|
+
function githubSlug(s) {
|
|
39456
|
+
const m = s.match(/github\.com[/:]([^/\s]+\/[^/\s'".]+)/i);
|
|
39457
|
+
return m ? m[1].replace(/\.git$/, "") : void 0;
|
|
39458
|
+
}
|
|
39459
|
+
function extractRepo(message, fallbackRepo) {
|
|
39460
|
+
const perm = message.match(/Permission to ([^\s]+?)(?:\.git)? denied/i);
|
|
39461
|
+
if (perm) return perm[1];
|
|
39462
|
+
const fromMsg = githubSlug(message);
|
|
39463
|
+
if (fromMsg) return fromMsg;
|
|
39464
|
+
if (fallbackRepo) return githubSlug(fallbackRepo) ?? fallbackRepo;
|
|
39465
|
+
return void 0;
|
|
39466
|
+
}
|
|
39467
|
+
function classifySyncError(rawMessage, repoHint) {
|
|
39468
|
+
const m = rawMessage || "";
|
|
39469
|
+
const repo = extractRepo(m, repoHint);
|
|
39470
|
+
const named = repo ? ` on ${repo}` : "";
|
|
39471
|
+
if (/non-fast-forward.*twice|rejected.*non-fast-forward|Push rejected \(non-fast-forward\) twice/i.test(m)) {
|
|
39472
|
+
return {
|
|
39473
|
+
kind: "push-rejected",
|
|
39474
|
+
recovery: "retry",
|
|
39475
|
+
repo,
|
|
39476
|
+
message: "The team pushed while your sync was in flight. Retry \u2014 dreamcontext will merge their changes and push again."
|
|
39477
|
+
};
|
|
39478
|
+
}
|
|
39479
|
+
if (/Contents\b.*write|permission to .* denied|protected branch|not authorized|remote: Permission|must have push access|403\b/i.test(m)) {
|
|
39480
|
+
return {
|
|
39481
|
+
kind: "permission",
|
|
39482
|
+
recovery: "check-permissions",
|
|
39483
|
+
repo,
|
|
39484
|
+
message: `Your GitHub token can't write to${named || " this repo"}. Give it Contents (read & write) access${repo ? ` on ${repo}` : ""}, then retry.`
|
|
39485
|
+
};
|
|
39486
|
+
}
|
|
39487
|
+
if (/no github token found|no token found for the brain/i.test(m)) {
|
|
39488
|
+
return {
|
|
39489
|
+
kind: "no-token",
|
|
39490
|
+
recovery: "reconnect-github",
|
|
39491
|
+
repo,
|
|
39492
|
+
message: "Cloud sync needs a GitHub account. Connect GitHub to start syncing."
|
|
39493
|
+
};
|
|
39494
|
+
}
|
|
39495
|
+
if (/authentication failed|could not read Username|bad credentials|invalid credentials|401\b|terminal prompts disabled|Support for password authentication/i.test(m)) {
|
|
39496
|
+
return {
|
|
39497
|
+
kind: "auth",
|
|
39498
|
+
recovery: "reconnect-github",
|
|
39499
|
+
repo,
|
|
39500
|
+
message: "Your GitHub sign-in expired or is invalid. Reconnect GitHub to keep syncing."
|
|
39501
|
+
};
|
|
39502
|
+
}
|
|
39503
|
+
if (/could ?n[o']t resolve host|could not resolve host|connection timed out|failed to connect|network is unreachable|temporary failure in name resolution|unable to access .*(?:Could not resolve|timed out|Failed to connect)|getaddrinfo|ENOTFOUND|ETIMEDOUT/i.test(m)) {
|
|
39504
|
+
return {
|
|
39505
|
+
kind: "network",
|
|
39506
|
+
recovery: "wait-online",
|
|
39507
|
+
repo,
|
|
39508
|
+
message: "You're offline \u2014 sync will retry automatically when you're back online. Nothing was lost."
|
|
39509
|
+
};
|
|
39510
|
+
}
|
|
39511
|
+
if (/unrelated histories/i.test(m)) {
|
|
39512
|
+
return {
|
|
39513
|
+
kind: "unknown",
|
|
39514
|
+
recovery: "manual",
|
|
39515
|
+
repo,
|
|
39516
|
+
message: "The remote contains content that did not come from this brain (e.g. a README). Attach an empty repo or reconcile the histories manually."
|
|
39517
|
+
};
|
|
39518
|
+
}
|
|
39519
|
+
return {
|
|
39520
|
+
kind: "unknown",
|
|
39521
|
+
recovery: "retry",
|
|
39522
|
+
repo,
|
|
39523
|
+
message: rawMessage.trim() || "Sync failed. Retry, or check your connection and GitHub access."
|
|
39524
|
+
};
|
|
39525
|
+
}
|
|
39526
|
+
var init_failure = __esm({
|
|
39527
|
+
"src/lib/git-sync/failure.ts"() {
|
|
39528
|
+
"use strict";
|
|
39529
|
+
}
|
|
39530
|
+
});
|
|
39531
|
+
|
|
39532
|
+
// src/lib/git-sync/auth-reconcile.ts
|
|
39533
|
+
function reconcileBrainSyncSuccess(action) {
|
|
39534
|
+
if (AUTH_OK_ACTIONS.has(action)) setGlobalGitHubAuthValid(true);
|
|
39535
|
+
}
|
|
39536
|
+
function reconcileBrainSyncFailure(rawMessage, projectRoot, repoHint) {
|
|
39537
|
+
const failure = classifySyncError(rawMessage, repoHint);
|
|
39538
|
+
if (failure.kind === "permission") {
|
|
39539
|
+
setGlobalGitHubAuthValid(true);
|
|
39540
|
+
return;
|
|
39541
|
+
}
|
|
39542
|
+
if (failure.kind !== "auth") return;
|
|
39543
|
+
if (resolveBrainSyncToken(projectRoot)?.via === "global") setGlobalGitHubAuthValid(false);
|
|
39544
|
+
}
|
|
39545
|
+
var AUTH_OK_ACTIONS;
|
|
39546
|
+
var init_auth_reconcile = __esm({
|
|
39547
|
+
"src/lib/git-sync/auth-reconcile.ts"() {
|
|
39548
|
+
"use strict";
|
|
39549
|
+
init_auth_store();
|
|
39550
|
+
init_brain_repo();
|
|
39551
|
+
init_failure();
|
|
39552
|
+
AUTH_OK_ACTIONS = /* @__PURE__ */ new Set([
|
|
39553
|
+
"pulled",
|
|
39554
|
+
"pushed",
|
|
39555
|
+
"noop",
|
|
39556
|
+
"merged",
|
|
39557
|
+
"blocked-scrub",
|
|
39558
|
+
"awaiting-agent",
|
|
39559
|
+
"code-conflict"
|
|
39560
|
+
]);
|
|
39561
|
+
}
|
|
39562
|
+
});
|
|
39563
|
+
|
|
39438
39564
|
// src/cli/commands/brain.ts
|
|
39439
|
-
import { dirname as
|
|
39565
|
+
import { dirname as dirname26 } from "path";
|
|
39440
39566
|
function registerBrainCommand(program2) {
|
|
39441
39567
|
const brain = program2.command("brain").description("Cloud collaboration \u2014 sync the whole project (code + brain) to your GitHub origin");
|
|
39442
39568
|
brain.command("status").description("Show sync mode, remote, sync state, and the resolved cloud-sync switch").action(() => {
|
|
39443
39569
|
const contextRoot = ensureContextRoot();
|
|
39444
|
-
const projectRoot =
|
|
39570
|
+
const projectRoot = dirname26(contextRoot);
|
|
39445
39571
|
const config = readSetupConfig(projectRoot);
|
|
39446
39572
|
const mode = resolveMode2(config);
|
|
39447
39573
|
const enabledResolution = resolveBrainSyncEnabled(projectRoot, config);
|
|
@@ -39459,7 +39585,7 @@ function registerBrainCommand(program2) {
|
|
|
39459
39585
|
});
|
|
39460
39586
|
brain.command("enable").description("Turn cloud sync ON \u2014 sync the whole project (code + brain) to your GitHub origin").action(() => {
|
|
39461
39587
|
const contextRoot = ensureContextRoot();
|
|
39462
|
-
const projectRoot =
|
|
39588
|
+
const projectRoot = dirname26(contextRoot);
|
|
39463
39589
|
const config = readSetupConfig(projectRoot);
|
|
39464
39590
|
const origin = isGitRepo(projectRoot) ? getRemoteUrl(projectRoot, "origin") : null;
|
|
39465
39591
|
updateSetupConfig(projectRoot, {
|
|
@@ -39475,7 +39601,7 @@ function registerBrainCommand(program2) {
|
|
|
39475
39601
|
});
|
|
39476
39602
|
brain.command("disable").description("Turn cloud sync OFF \u2014 the brain is still committed in-tree locally, never pushed").action(() => {
|
|
39477
39603
|
const contextRoot = ensureContextRoot();
|
|
39478
|
-
const projectRoot =
|
|
39604
|
+
const projectRoot = dirname26(contextRoot);
|
|
39479
39605
|
const config = readSetupConfig(projectRoot);
|
|
39480
39606
|
updateSetupConfig(projectRoot, {
|
|
39481
39607
|
brainRepo: { ...config?.brainRepo ?? {}, mode: "in-tree", enabled: false }
|
|
@@ -39484,7 +39610,7 @@ function registerBrainCommand(program2) {
|
|
|
39484
39610
|
});
|
|
39485
39611
|
brain.command("scrub").description("Dry-run the scrub gate against the current staged tree").action(() => {
|
|
39486
39612
|
const contextRoot = ensureContextRoot();
|
|
39487
|
-
const projectRoot =
|
|
39613
|
+
const projectRoot = dirname26(contextRoot);
|
|
39488
39614
|
const hits = scrubStagedFiles(projectRoot);
|
|
39489
39615
|
const { blocks, warns } = summarizeScrub(hits);
|
|
39490
39616
|
if (blocks.length === 0 && warns.length === 0) {
|
|
@@ -39516,9 +39642,11 @@ function registerBrainCommand(program2) {
|
|
|
39516
39642
|
continue: opts.continue,
|
|
39517
39643
|
resume: opts.resume
|
|
39518
39644
|
});
|
|
39645
|
+
reconcileBrainSyncSuccess(result.action);
|
|
39519
39646
|
renderBrainSyncResult(result);
|
|
39520
39647
|
if (result.action === "invalid-flag" || result.action === "blocked-scrub") process.exitCode = 1;
|
|
39521
39648
|
} catch (err) {
|
|
39649
|
+
reconcileBrainSyncFailure(err.message, dirname26(contextRoot));
|
|
39522
39650
|
if (err instanceof GitSyncError) {
|
|
39523
39651
|
error(err.message);
|
|
39524
39652
|
} else {
|
|
@@ -39576,6 +39704,7 @@ var init_brain = __esm({
|
|
|
39576
39704
|
init_sync_engine();
|
|
39577
39705
|
init_brain_repo();
|
|
39578
39706
|
init_scrub();
|
|
39707
|
+
init_auth_reconcile();
|
|
39579
39708
|
init_git();
|
|
39580
39709
|
init_git();
|
|
39581
39710
|
}
|
|
@@ -39876,7 +40005,7 @@ var init_session_digest = __esm({
|
|
|
39876
40005
|
|
|
39877
40006
|
// src/lib/recall.ts
|
|
39878
40007
|
import { existsSync as existsSync49, readFileSync as readFileSync36 } from "fs";
|
|
39879
|
-
import { join as join50, basename as basename13, dirname as
|
|
40008
|
+
import { join as join50, basename as basename13, dirname as dirname27, relative as relative4 } from "path";
|
|
39880
40009
|
function isFederated(doc) {
|
|
39881
40010
|
return doc.federated === true;
|
|
39882
40011
|
}
|
|
@@ -40151,7 +40280,7 @@ function loadSkillDocs(skillsRoot) {
|
|
|
40151
40280
|
try {
|
|
40152
40281
|
const { data, content } = readFrontmatter(file);
|
|
40153
40282
|
if (data.alwaysApply === true) continue;
|
|
40154
|
-
const slug = typeof data.name === "string" && data.name ? data.name : basename13(
|
|
40283
|
+
const slug = typeof data.name === "string" && data.name ? data.name : basename13(dirname27(file));
|
|
40155
40284
|
const title = slug;
|
|
40156
40285
|
const description = typeof data.description === "string" ? data.description : "";
|
|
40157
40286
|
const tags = Array.isArray(data.tags) ? data.tags.map(String) : [];
|
|
@@ -41121,7 +41250,7 @@ var init_sleep_consolidation = __esm({
|
|
|
41121
41250
|
|
|
41122
41251
|
// src/cli/commands/sleep.ts
|
|
41123
41252
|
import { existsSync as existsSync52 } from "fs";
|
|
41124
|
-
import { join as join53, dirname as
|
|
41253
|
+
import { join as join53, dirname as dirname28 } from "path";
|
|
41125
41254
|
function getSleepPath(root) {
|
|
41126
41255
|
return join53(root, "state", ".sleep.json");
|
|
41127
41256
|
}
|
|
@@ -41317,7 +41446,7 @@ function registerSleepCommand(program2) {
|
|
|
41317
41446
|
const decision = consolidationDepth(state.debt, { userRequestedDeep: !!opts.deep });
|
|
41318
41447
|
state.consolidation_depth = decision.depth;
|
|
41319
41448
|
state.pendingMigrationNotices = [];
|
|
41320
|
-
const projectRoot =
|
|
41449
|
+
const projectRoot = dirname28(root);
|
|
41321
41450
|
const config = readSetupConfig(projectRoot);
|
|
41322
41451
|
const fromVersion = config?.setupVersion ?? "0.0.0";
|
|
41323
41452
|
const migResult = runMigrations(root, fromVersion, dreamcontextVersion());
|
|
@@ -41401,22 +41530,24 @@ function registerSleepCommand(program2) {
|
|
|
41401
41530
|
warn(`Task sync: skipped \u2014 ${err.message ?? err}`);
|
|
41402
41531
|
}
|
|
41403
41532
|
try {
|
|
41404
|
-
const cfg = readSetupConfig(
|
|
41533
|
+
const cfg = readSetupConfig(dirname28(root));
|
|
41405
41534
|
if (cfg?.brainRepo?.autoSync) {
|
|
41406
41535
|
const result2 = await runBrainSync({ cwd: root, mode: "auto" });
|
|
41536
|
+
reconcileBrainSyncSuccess(result2.action);
|
|
41407
41537
|
renderBrainSyncResult(result2);
|
|
41408
41538
|
if (result2.action === "awaiting-agent" || result2.action === "already-awaiting-agent") {
|
|
41409
41539
|
warn("Brain sync paused on a team merge \u2014 run /dream-sync to reconcile (it will resume or continue as needed).");
|
|
41410
41540
|
}
|
|
41411
|
-
if (result2.needsTaskSync || readBrainLocal(
|
|
41541
|
+
if (result2.needsTaskSync || readBrainLocal(dirname28(root)).needsTaskSync) {
|
|
41412
41542
|
const backend = getTaskBackend(root);
|
|
41413
41543
|
if (backend.name !== "local") {
|
|
41414
41544
|
await backend.sync("both");
|
|
41415
|
-
writeBrainLocal(
|
|
41545
|
+
writeBrainLocal(dirname28(root), { needsTaskSync: false });
|
|
41416
41546
|
}
|
|
41417
41547
|
}
|
|
41418
41548
|
}
|
|
41419
41549
|
} catch (err) {
|
|
41550
|
+
reconcileBrainSyncFailure(err.message ?? String(err), dirname28(root));
|
|
41420
41551
|
warn(`Brain sync: skipped \u2014 ${err.message ?? err}`);
|
|
41421
41552
|
}
|
|
41422
41553
|
try {
|
|
@@ -41520,6 +41651,7 @@ var init_sleep = __esm({
|
|
|
41520
41651
|
init_manifest();
|
|
41521
41652
|
init_file_lock();
|
|
41522
41653
|
init_sync_engine();
|
|
41654
|
+
init_auth_reconcile();
|
|
41523
41655
|
init_brain();
|
|
41524
41656
|
init_recall();
|
|
41525
41657
|
init_store();
|
|
@@ -41888,7 +42020,7 @@ import {
|
|
|
41888
42020
|
renameSync as renameSync11,
|
|
41889
42021
|
mkdirSync as mkdirSync31
|
|
41890
42022
|
} from "fs";
|
|
41891
|
-
import { join as join55, dirname as
|
|
42023
|
+
import { join as join55, dirname as dirname29, resolve as resolve12, sep as sep8 } from "path";
|
|
41892
42024
|
function normalizeSlug2(raw) {
|
|
41893
42025
|
return raw.trim().replace(/\\/g, "/").replace(/\.md$/i, "").replace(/^\/+|\/+$/g, "");
|
|
41894
42026
|
}
|
|
@@ -41981,7 +42113,7 @@ ${srcBody}
|
|
|
41981
42113
|
const newDstContent = import_gray_matter7.default.stringify(newDstBody, newDstData);
|
|
41982
42114
|
const tmpPath = dstAbsPath + ".km-tmp";
|
|
41983
42115
|
try {
|
|
41984
|
-
mkdirSync31(
|
|
42116
|
+
mkdirSync31(dirname29(tmpPath), { recursive: true });
|
|
41985
42117
|
writeFileSync38(tmpPath, newDstContent, "utf-8");
|
|
41986
42118
|
renameSync11(tmpPath, dstAbsPath);
|
|
41987
42119
|
} catch (e) {
|
|
@@ -42540,7 +42672,7 @@ var init_objectives_store = __esm({
|
|
|
42540
42672
|
});
|
|
42541
42673
|
|
|
42542
42674
|
// src/cli/commands/tasks.ts
|
|
42543
|
-
import { join as join58, basename as basename16, dirname as
|
|
42675
|
+
import { join as join58, basename as basename16, dirname as dirname30 } from "path";
|
|
42544
42676
|
function getStateDir() {
|
|
42545
42677
|
const root = ensureContextRoot();
|
|
42546
42678
|
return join58(root, "state");
|
|
@@ -42833,7 +42965,7 @@ function registerTasksCommand(program2) {
|
|
|
42833
42965
|
const description = opts.description || name;
|
|
42834
42966
|
const tags = opts.tags ? opts.tags.split(",").map((t) => t.trim()).filter(Boolean) : [];
|
|
42835
42967
|
if (opts.person && opts.person.trim()) {
|
|
42836
|
-
const projectRoot =
|
|
42968
|
+
const projectRoot = dirname30(ensureContextRoot());
|
|
42837
42969
|
if (isMultiPerson(readSetupConfig(projectRoot))) {
|
|
42838
42970
|
const resolved = await resolvePersonSlug(backend, opts.person);
|
|
42839
42971
|
if ("abort" in resolved) return;
|
|
@@ -43309,7 +43441,7 @@ function registerTasksCommand(program2) {
|
|
|
43309
43441
|
return;
|
|
43310
43442
|
}
|
|
43311
43443
|
if (report.skipped !== "locked") {
|
|
43312
|
-
writeBrainLocal(
|
|
43444
|
+
writeBrainLocal(dirname30(root), { needsTaskSync: false });
|
|
43313
43445
|
}
|
|
43314
43446
|
if (opts.json) {
|
|
43315
43447
|
console.log(JSON.stringify(report, null, 2));
|
|
@@ -43400,7 +43532,7 @@ function registerTasksCommand(program2) {
|
|
|
43400
43532
|
}
|
|
43401
43533
|
});
|
|
43402
43534
|
tasks.command("sync-hooks").argument("<action>", "install | uninstall").description("Install/uninstall best-effort git sync triggers (post-commit, pre-push)").action((action) => {
|
|
43403
|
-
const projectRoot =
|
|
43535
|
+
const projectRoot = dirname30(ensureContextRoot());
|
|
43404
43536
|
if (action === "install") {
|
|
43405
43537
|
const res = installTaskSyncHooks(projectRoot);
|
|
43406
43538
|
if (res.noGit) {
|
|
@@ -43802,7 +43934,7 @@ var init_roadmap_model = __esm({
|
|
|
43802
43934
|
|
|
43803
43935
|
// src/cli/commands/roadmap.ts
|
|
43804
43936
|
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync39 } from "fs";
|
|
43805
|
-
import { join as join60, dirname as
|
|
43937
|
+
import { join as join60, dirname as dirname31 } from "path";
|
|
43806
43938
|
function fmtDates(o) {
|
|
43807
43939
|
const parts = [];
|
|
43808
43940
|
if (o.target_date) parts.push(`target ${o.target_date}`);
|
|
@@ -43857,7 +43989,7 @@ function renderRoadmapBoard(model) {
|
|
|
43857
43989
|
}
|
|
43858
43990
|
function writeRoadmapBoard(contextRoot, model) {
|
|
43859
43991
|
const path2 = join60(contextRoot, "knowledge", "roadmap", "board.md");
|
|
43860
|
-
mkdirSync33(
|
|
43992
|
+
mkdirSync33(dirname31(path2), { recursive: true });
|
|
43861
43993
|
const slipping = model.objectives.filter((o) => o.slipping === true).map((o) => o.slug);
|
|
43862
43994
|
const content = [
|
|
43863
43995
|
"---",
|
|
@@ -43938,7 +44070,7 @@ function registerRoadmapCommand(program2) {
|
|
|
43938
44070
|
printBoard(model);
|
|
43939
44071
|
const path2 = writeRoadmapBoard(root, model);
|
|
43940
44072
|
console.log();
|
|
43941
|
-
success(`Board written: ${path2.replace(
|
|
44073
|
+
success(`Board written: ${path2.replace(dirname31(root) + "/", "")}`);
|
|
43942
44074
|
});
|
|
43943
44075
|
const objective = roadmap.command("objective").description("Manage objectives (create/list/show/edit/delete/depend)");
|
|
43944
44076
|
objective.command("create").argument("<slug>", "Kebab-case objective slug (e.g. increase-retention-20)").description("Create an objective in core/objectives/<slug>.md").requiredOption("--title <title>", "One-line outcome statement").option("--target <date>", "Target date the PO commits to (YYYY-MM-DD)").option("--depends-on <slugs>", "Comma-separated slugs this objective depends on").option("--feature <slug>", "Backing feature PRD slug (optional)").option("--metric <label>", 'Track by a Key Result metric instead of tasks (e.g. "MRR")').option("--metric-target <n>", "The metric value that means 100% done (required with --metric)").option("--metric-baseline <n>", "Where the metric started (default 0)").option("--metric-current <n>", "Current metric value (default = baseline)").option("--metric-unit <unit>", 'Metric display unit (e.g. "USD")').option("--why <text>", "Why this outcome matters (seeds the ## Why section)").action((slug, opts) => {
|
|
@@ -44637,14 +44769,14 @@ var init_generic_http = __esm({
|
|
|
44637
44769
|
});
|
|
44638
44770
|
|
|
44639
44771
|
// src/lib/lab/adapters/custom-script.ts
|
|
44640
|
-
import { dirname as
|
|
44772
|
+
import { dirname as dirname32, resolve as resolve13, sep as sep9 } from "path";
|
|
44641
44773
|
import { pathToFileURL } from "url";
|
|
44642
44774
|
function scriptFilePath(manifest) {
|
|
44643
44775
|
const source = manifest.source;
|
|
44644
44776
|
if (!source || source.adapter !== "script") {
|
|
44645
44777
|
throw new LabError("Custom-script adapter requires a `script` source.");
|
|
44646
44778
|
}
|
|
44647
|
-
const labRoot =
|
|
44779
|
+
const labRoot = dirname32(dirname32(manifest.path));
|
|
44648
44780
|
const abs = resolve13(labRoot, source.file);
|
|
44649
44781
|
if (abs !== labRoot && !abs.startsWith(labRoot + sep9)) {
|
|
44650
44782
|
throw new LabError(`Script path escapes lab/: ${source.file}`);
|
|
@@ -45064,9 +45196,9 @@ var init_sync = __esm({
|
|
|
45064
45196
|
});
|
|
45065
45197
|
|
|
45066
45198
|
// src/cli/commands/lab.ts
|
|
45067
|
-
import { dirname as
|
|
45199
|
+
import { dirname as dirname33 } from "path";
|
|
45068
45200
|
function projectRootFor(contextRoot) {
|
|
45069
|
-
return
|
|
45201
|
+
return dirname33(contextRoot);
|
|
45070
45202
|
}
|
|
45071
45203
|
function handleLabError(err) {
|
|
45072
45204
|
if (err instanceof LabError) {
|
|
@@ -45662,17 +45794,17 @@ import {
|
|
|
45662
45794
|
unlinkSync as unlinkSync8,
|
|
45663
45795
|
readdirSync as readdirSync12
|
|
45664
45796
|
} from "fs";
|
|
45665
|
-
import { dirname as
|
|
45797
|
+
import { dirname as dirname34, join as join67 } from "path";
|
|
45666
45798
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
45667
45799
|
function atomicWriteFile(path2, data) {
|
|
45668
|
-
mkdirSync37(
|
|
45800
|
+
mkdirSync37(dirname34(path2), { recursive: true });
|
|
45669
45801
|
const tmp = `${path2}.tmp.${process.pid}.${randomBytes2(4).toString("hex")}`;
|
|
45670
45802
|
writeFileSync43(tmp, data, "utf8");
|
|
45671
45803
|
renameSync13(tmp, path2);
|
|
45672
45804
|
}
|
|
45673
45805
|
function writeJsonWithBridge(jsonPath, bridgePath, jsonValue, bridgeMarkdown) {
|
|
45674
|
-
mkdirSync37(
|
|
45675
|
-
mkdirSync37(
|
|
45806
|
+
mkdirSync37(dirname34(jsonPath), { recursive: true });
|
|
45807
|
+
mkdirSync37(dirname34(bridgePath), { recursive: true });
|
|
45676
45808
|
const jsonStr = JSON.stringify(jsonValue, null, 2) + "\n";
|
|
45677
45809
|
const jsonTmp = `${jsonPath}.tmp.${process.pid}.${randomBytes2(4).toString("hex")}`;
|
|
45678
45810
|
const bridgeTmp = `${bridgePath}.tmp.${process.pid}.${randomBytes2(4).toString("hex")}`;
|
|
@@ -45801,7 +45933,7 @@ function beginRun(verb, inputs) {
|
|
|
45801
45933
|
}
|
|
45802
45934
|
function appendIndex(runId, verb, status) {
|
|
45803
45935
|
const path2 = MARKETING_PATHS.runsIndex();
|
|
45804
|
-
mkdirSync37(
|
|
45936
|
+
mkdirSync37(dirname34(path2), { recursive: true });
|
|
45805
45937
|
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
45806
45938
|
const line = `- \`${ts}\` **${verb}** (${status}) \u2014 [\`${runId}\`](./${runId}.json)
|
|
45807
45939
|
`;
|
|
@@ -45925,10 +46057,10 @@ import {
|
|
|
45925
46057
|
writeFileSync as writeFileSync44,
|
|
45926
46058
|
renameSync as renameSync14
|
|
45927
46059
|
} from "fs";
|
|
45928
|
-
import { dirname as
|
|
46060
|
+
import { dirname as dirname35 } from "path";
|
|
45929
46061
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
45930
46062
|
function atomicWriteFile2(path2, data) {
|
|
45931
|
-
mkdirSync38(
|
|
46063
|
+
mkdirSync38(dirname35(path2), { recursive: true });
|
|
45932
46064
|
const tmp = `${path2}.tmp.${process.pid}.${randomBytes3(4).toString("hex")}`;
|
|
45933
46065
|
writeFileSync44(tmp, data, "utf8");
|
|
45934
46066
|
renameSync14(tmp, path2);
|
|
@@ -46273,7 +46405,7 @@ var init_setup_drift = __esm({
|
|
|
46273
46405
|
|
|
46274
46406
|
// src/lib/asset-drift-cache.ts
|
|
46275
46407
|
import { existsSync as existsSync69, readFileSync as readFileSync47, writeFileSync as writeFileSync45, mkdirSync as mkdirSync39 } from "fs";
|
|
46276
|
-
import { join as join69, dirname as
|
|
46408
|
+
import { join as join69, dirname as dirname36 } from "path";
|
|
46277
46409
|
function assetDriftCachePath(contextRoot) {
|
|
46278
46410
|
return join69(contextRoot, "state", ".asset-drift.json");
|
|
46279
46411
|
}
|
|
@@ -46297,7 +46429,7 @@ function readAssetDriftCache(contextRoot) {
|
|
|
46297
46429
|
}
|
|
46298
46430
|
function writeAssetDriftCache(contextRoot, cache) {
|
|
46299
46431
|
const p = assetDriftCachePath(contextRoot);
|
|
46300
|
-
mkdirSync39(
|
|
46432
|
+
mkdirSync39(dirname36(p), { recursive: true });
|
|
46301
46433
|
writeFileSync45(p, JSON.stringify(cache, null, 2) + "\n", "utf-8");
|
|
46302
46434
|
}
|
|
46303
46435
|
function cacheConfidentlyClean(cache, cliVersion, setupVersion) {
|
|
@@ -46322,7 +46454,7 @@ var init_federation_config = __esm({
|
|
|
46322
46454
|
});
|
|
46323
46455
|
|
|
46324
46456
|
// src/lib/federation-recall.ts
|
|
46325
|
-
import { basename as basename20, dirname as
|
|
46457
|
+
import { basename as basename20, dirname as dirname37 } from "path";
|
|
46326
46458
|
function namespacedKey(vault, type, slug) {
|
|
46327
46459
|
return `${vault}::${type}/${slug}`;
|
|
46328
46460
|
}
|
|
@@ -46347,7 +46479,7 @@ function crossVaultRecall(query, opts) {
|
|
|
46347
46479
|
}
|
|
46348
46480
|
const isCurrent = target.current === true;
|
|
46349
46481
|
if (!isCurrent) {
|
|
46350
|
-
const projectRoot =
|
|
46482
|
+
const projectRoot = dirname37(contextRoot);
|
|
46351
46483
|
if (!isShareable(projectRoot)) continue;
|
|
46352
46484
|
}
|
|
46353
46485
|
const corpus = buildCorpus(contextRoot, opts.types ? { types: opts.types } : {}).filter((doc) => !isFederated(doc));
|
|
@@ -46421,7 +46553,7 @@ var init_federation_recall = __esm({
|
|
|
46421
46553
|
|
|
46422
46554
|
// src/lib/federation-peer-summary.ts
|
|
46423
46555
|
import { existsSync as existsSync70, mkdirSync as mkdirSync40, readFileSync as readFileSync48, writeFileSync as writeFileSync46 } from "fs";
|
|
46424
|
-
import { dirname as
|
|
46556
|
+
import { dirname as dirname38, join as join70 } from "path";
|
|
46425
46557
|
function peerSummaryCachePath(contextRoot) {
|
|
46426
46558
|
return join70(contextRoot, CACHE_REL_PATH2);
|
|
46427
46559
|
}
|
|
@@ -46578,7 +46710,7 @@ function readPinnedTitles(peerRoot) {
|
|
|
46578
46710
|
return Array.from(seen).sort((a, b) => a.localeCompare(b)).slice(0, MAX_PINNED);
|
|
46579
46711
|
}
|
|
46580
46712
|
function refreshPeerSummaries(contextRoot, home) {
|
|
46581
|
-
const { name, target } = currentVaultTarget(
|
|
46713
|
+
const { name, target } = currentVaultTarget(dirname38(contextRoot), home);
|
|
46582
46714
|
const targets = resolveConnectedVaults(target, contextRoot, home).filter(
|
|
46583
46715
|
(t) => t.current !== true && t.name !== name
|
|
46584
46716
|
);
|
|
@@ -46598,7 +46730,7 @@ function refreshPeerSummaries(contextRoot, home) {
|
|
|
46598
46730
|
}
|
|
46599
46731
|
function writePeerSummaryCache(contextRoot, cache) {
|
|
46600
46732
|
const path2 = peerSummaryCachePath(contextRoot);
|
|
46601
|
-
mkdirSync40(
|
|
46733
|
+
mkdirSync40(dirname38(path2), { recursive: true });
|
|
46602
46734
|
writeFileSync46(path2, JSON.stringify(cache, null, 2) + "\n", "utf-8");
|
|
46603
46735
|
}
|
|
46604
46736
|
var import_fast_glob18, CACHE_REL_PATH2, MAX_ACTIVITY, MAX_TAGS, MAX_PINNED, WHAT_IT_IS_CHARS;
|
|
@@ -46722,7 +46854,7 @@ var init_origin_setup = __esm({
|
|
|
46722
46854
|
|
|
46723
46855
|
// src/lib/linked-repos.ts
|
|
46724
46856
|
import { existsSync as existsSync71, mkdirSync as mkdirSync41, readFileSync as readFileSync49, renameSync as renameSync15, statSync as statSync10, writeFileSync as writeFileSync47 } from "fs";
|
|
46725
|
-
import { dirname as
|
|
46857
|
+
import { dirname as dirname39, isAbsolute as isAbsolute2, join as join71, resolve as resolve14, sep as sep10 } from "path";
|
|
46726
46858
|
import { homedir as homedir5 } from "os";
|
|
46727
46859
|
import { randomBytes as randomBytes4 } from "crypto";
|
|
46728
46860
|
function linkedReposFilePath(home = homedir5()) {
|
|
@@ -46750,7 +46882,7 @@ function readLinkedRepoRegistry(home) {
|
|
|
46750
46882
|
}
|
|
46751
46883
|
function writeLinkedRepoRegistry(repos, home) {
|
|
46752
46884
|
const filePath = linkedReposFilePath(home);
|
|
46753
|
-
mkdirSync41(
|
|
46885
|
+
mkdirSync41(dirname39(filePath), { recursive: true });
|
|
46754
46886
|
const registry = { repos };
|
|
46755
46887
|
const tmp = `${filePath}.${process.pid}.${randomBytes4(6).toString("hex")}.tmp`;
|
|
46756
46888
|
writeFileSync47(tmp, JSON.stringify(registry, null, 2) + "\n", "utf-8");
|
|
@@ -46842,7 +46974,7 @@ async function cloneLinkedRepo(projectRoot, name, opts = {}) {
|
|
|
46842
46974
|
}
|
|
46843
46975
|
const base = sanitizeRepoName(slug.repo);
|
|
46844
46976
|
if (!base) throw new LinkedRepoError(`Refusing to clone "${name}": no safe folder name.`);
|
|
46845
|
-
const parent = resolve14(opts.dir ??
|
|
46977
|
+
const parent = resolve14(opts.dir ?? dirname39(projectRoot));
|
|
46846
46978
|
const dest = join71(parent, base);
|
|
46847
46979
|
if (!resolve14(dest).startsWith(resolve14(parent) + sep10)) {
|
|
46848
46980
|
throw new LinkedRepoError(`Refusing to clone "${name}": destination escapes ${parent}.`);
|
|
@@ -46987,7 +47119,7 @@ var init_snapshot_budget = __esm({
|
|
|
46987
47119
|
|
|
46988
47120
|
// src/cli/commands/snapshot.ts
|
|
46989
47121
|
import { readFileSync as readFileSync50, existsSync as existsSync72, statSync as statSync11 } from "fs";
|
|
46990
|
-
import { join as join72, basename as basename21, dirname as
|
|
47122
|
+
import { join as join72, basename as basename21, dirname as dirname40 } from "path";
|
|
46991
47123
|
function extractFirstParagraph(content) {
|
|
46992
47124
|
const lines = content.split("\n");
|
|
46993
47125
|
const paragraphLines = [];
|
|
@@ -47108,7 +47240,7 @@ function resolveActiveTaskPath(root) {
|
|
|
47108
47240
|
return candidates[0].path;
|
|
47109
47241
|
}
|
|
47110
47242
|
function getActiveProductKnowledge(root) {
|
|
47111
|
-
const config = readSetupConfig(
|
|
47243
|
+
const config = readSetupConfig(dirname40(root));
|
|
47112
47244
|
if (!config || !Array.isArray(config.multiProduct) || config.multiProduct.length === 0) {
|
|
47113
47245
|
return [];
|
|
47114
47246
|
}
|
|
@@ -47164,7 +47296,7 @@ function getActiveProductKnowledge(root) {
|
|
|
47164
47296
|
}
|
|
47165
47297
|
function getVersionNudge(root) {
|
|
47166
47298
|
try {
|
|
47167
|
-
const projectRoot =
|
|
47299
|
+
const projectRoot = dirname40(root);
|
|
47168
47300
|
const cache = readVersionCache(projectRoot);
|
|
47169
47301
|
if (!cache || !isCacheFresh(cache)) return "";
|
|
47170
47302
|
const installedCli = dreamcontextVersion();
|
|
@@ -47200,7 +47332,7 @@ Migrations applied since last session: ${notices.join("; ")}`;
|
|
|
47200
47332
|
}
|
|
47201
47333
|
function getDriftDirective(root) {
|
|
47202
47334
|
try {
|
|
47203
|
-
const projectRoot =
|
|
47335
|
+
const projectRoot = dirname40(root);
|
|
47204
47336
|
const config = readSetupConfig(projectRoot);
|
|
47205
47337
|
if (!config) return "";
|
|
47206
47338
|
const cliVersion = dreamcontextVersion();
|
|
@@ -47483,7 +47615,7 @@ function generateSnapshot(rootOverride) {
|
|
|
47483
47615
|
const CHANGELOG_TIER2 = 10;
|
|
47484
47616
|
const TIER1_BODY_CHARS = 300;
|
|
47485
47617
|
const TIER2_LINE_CHARS = 140;
|
|
47486
|
-
const multiPerson = isMultiPerson(readSetupConfig(
|
|
47618
|
+
const multiPerson = isMultiPerson(readSetupConfig(dirname40(root)));
|
|
47487
47619
|
const authorSuffix = (e) => {
|
|
47488
47620
|
if (!multiPerson) return "";
|
|
47489
47621
|
const authors = Array.isArray(e.authors) ? e.authors.filter((a) => typeof a === "string") : [];
|
|
@@ -47832,7 +47964,7 @@ ${pendingFederation} legacy peer digest entr${pendingFederation === 1 ? "y" : "i
|
|
|
47832
47964
|
flush("connected-projects", { neverEvict: true });
|
|
47833
47965
|
}
|
|
47834
47966
|
try {
|
|
47835
|
-
const linked = resolveLinkedRepos(
|
|
47967
|
+
const linked = resolveLinkedRepos(dirname40(root));
|
|
47836
47968
|
if (linked.length > 0) {
|
|
47837
47969
|
const lines = ["## Linked repos\n"];
|
|
47838
47970
|
lines.push(
|
|
@@ -48372,7 +48504,7 @@ var init_salience = __esm({
|
|
|
48372
48504
|
|
|
48373
48505
|
// src/lib/marketing/path-guards.ts
|
|
48374
48506
|
import { existsSync as existsSync74, realpathSync } from "fs";
|
|
48375
|
-
import { basename as basename22, dirname as
|
|
48507
|
+
import { basename as basename22, dirname as dirname41, resolve as resolve15, sep as sep11 } from "path";
|
|
48376
48508
|
function isMarketingEnvPath(filePath, from) {
|
|
48377
48509
|
if (!filePath) return false;
|
|
48378
48510
|
const root = resolveContextRoot(from);
|
|
@@ -48396,7 +48528,7 @@ function realpathOfNearestAncestor(p) {
|
|
|
48396
48528
|
const tail = [];
|
|
48397
48529
|
while (current && current !== sep11 && !existsSync74(current)) {
|
|
48398
48530
|
tail.unshift(basename22(current));
|
|
48399
|
-
current =
|
|
48531
|
+
current = dirname41(current);
|
|
48400
48532
|
}
|
|
48401
48533
|
if (!current || current === sep11) return p;
|
|
48402
48534
|
try {
|
|
@@ -48691,7 +48823,7 @@ If pure greeting: {"skip":true}`;
|
|
|
48691
48823
|
// src/cli/commands/asset-drift.ts
|
|
48692
48824
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync8, existsSync as existsSync75, readFileSync as readFileSync52, readdirSync as readdirSync14 } from "fs";
|
|
48693
48825
|
import { tmpdir as tmpdir3 } from "os";
|
|
48694
|
-
import { join as join73, dirname as
|
|
48826
|
+
import { join as join73, dirname as dirname42 } from "path";
|
|
48695
48827
|
function walkFiles(dir, base, out) {
|
|
48696
48828
|
for (const entry of readdirSync14(dir, { withFileTypes: true })) {
|
|
48697
48829
|
const abs = join73(dir, entry.name);
|
|
@@ -48726,7 +48858,7 @@ async function computeUsedAssetsChanged(projectRoot, config) {
|
|
|
48726
48858
|
}
|
|
48727
48859
|
}
|
|
48728
48860
|
async function runAssetDriftRefresh(contextRoot) {
|
|
48729
|
-
const projectRoot =
|
|
48861
|
+
const projectRoot = dirname42(contextRoot);
|
|
48730
48862
|
const config = readSetupConfig(projectRoot);
|
|
48731
48863
|
if (!config) return;
|
|
48732
48864
|
const cliVersion = dreamcontextVersion();
|
|
@@ -48757,7 +48889,7 @@ var init_asset_drift = __esm({
|
|
|
48757
48889
|
|
|
48758
48890
|
// src/lib/initializer-detect.ts
|
|
48759
48891
|
import { existsSync as existsSync76, statSync as statSync13, readdirSync as readdirSync15, readFileSync as readFileSync53 } from "fs";
|
|
48760
|
-
import { join as join74, dirname as
|
|
48892
|
+
import { join as join74, dirname as dirname43, basename as basename23, extname as extname2, isAbsolute as isAbsolute3, resolve as resolve16, sep as sep12 } from "path";
|
|
48761
48893
|
import { homedir as homedir6 } from "os";
|
|
48762
48894
|
function isUntouchedTemplateCore(root) {
|
|
48763
48895
|
try {
|
|
@@ -48953,7 +49085,7 @@ function isOwnProject(absPath, contextRoot, cwd) {
|
|
|
48953
49085
|
if (norm2 === resolve16(cwd)) return true;
|
|
48954
49086
|
if (contextRoot) {
|
|
48955
49087
|
const cr = resolve16(contextRoot);
|
|
48956
|
-
const projectRoot =
|
|
49088
|
+
const projectRoot = dirname43(cr);
|
|
48957
49089
|
if (norm2 === cr || norm2 === projectRoot) return true;
|
|
48958
49090
|
if (norm2.startsWith(cr + sep12)) return true;
|
|
48959
49091
|
}
|
|
@@ -49140,7 +49272,7 @@ var init_initializer_detect = __esm({
|
|
|
49140
49272
|
|
|
49141
49273
|
// src/lib/agent-session-map.ts
|
|
49142
49274
|
import { existsSync as existsSync77, lstatSync as lstatSync2, mkdirSync as mkdirSync42, readFileSync as readFileSync54, writeFileSync as writeFileSync48, renameSync as renameSync16, readdirSync as readdirSync16, unlinkSync as unlinkSync9, statSync as statSync14 } from "fs";
|
|
49143
|
-
import { join as join75, dirname as
|
|
49275
|
+
import { join as join75, dirname as dirname44, basename as basename24 } from "path";
|
|
49144
49276
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
49145
49277
|
function mapDir(contextRoot) {
|
|
49146
49278
|
return join75(contextRoot, MAP_DIR_REL);
|
|
@@ -49174,7 +49306,7 @@ function ensureMapDir(contextRoot) {
|
|
|
49174
49306
|
if (existsSync77(dir) && !lstatSync2(dir).isDirectory()) return null;
|
|
49175
49307
|
if (!existsSync77(dir)) {
|
|
49176
49308
|
try {
|
|
49177
|
-
ensureGitignoreEntries(
|
|
49309
|
+
ensureGitignoreEntries(dirname44(contextRoot), ["_dream_context/state/.agent-session-map/"], {
|
|
49178
49310
|
comment: "dreamcontext: machine-local agent tab \u2192 live Claude session map"
|
|
49179
49311
|
});
|
|
49180
49312
|
} catch {
|
|
@@ -49288,7 +49420,7 @@ var init_agent_session_map = __esm({
|
|
|
49288
49420
|
import { readFileSync as readFileSync55, existsSync as existsSync78, statSync as statSync15 } from "fs";
|
|
49289
49421
|
import { execFileSync as execFileSync8, spawn as spawn3 } from "child_process";
|
|
49290
49422
|
import { get as httpGet, request as httpRequest } from "http";
|
|
49291
|
-
import { dirname as
|
|
49423
|
+
import { dirname as dirname45, resolve as resolve17, join as join76, extname as extname3, basename as basename25, relative as relative5 } from "path";
|
|
49292
49424
|
function readStdin() {
|
|
49293
49425
|
if (process.stdin.isTTY) return null;
|
|
49294
49426
|
try {
|
|
@@ -49402,7 +49534,7 @@ function isJsTsFile(filePath) {
|
|
|
49402
49534
|
return JS_TS_EXTENSIONS.has(extname3(filePath).toLowerCase());
|
|
49403
49535
|
}
|
|
49404
49536
|
function findProjectConfig(filePath) {
|
|
49405
|
-
let dir =
|
|
49537
|
+
let dir = dirname45(resolve17(filePath));
|
|
49406
49538
|
let formatter = null;
|
|
49407
49539
|
let tsconfig = null;
|
|
49408
49540
|
for (let i = 0; i <= MAX_WALK_LEVELS; i++) {
|
|
@@ -49426,7 +49558,7 @@ function findProjectConfig(filePath) {
|
|
|
49426
49558
|
tsconfig = join76(dir, "tsconfig.json");
|
|
49427
49559
|
}
|
|
49428
49560
|
if (formatter && tsconfig) break;
|
|
49429
|
-
const parent =
|
|
49561
|
+
const parent = dirname45(dir);
|
|
49430
49562
|
if (parent === dir) break;
|
|
49431
49563
|
dir = parent;
|
|
49432
49564
|
}
|
|
@@ -49476,7 +49608,7 @@ function runFormatter(detection, filePath) {
|
|
|
49476
49608
|
}
|
|
49477
49609
|
}
|
|
49478
49610
|
function runTscCheckWithConfig(filePath, tsconfigPath) {
|
|
49479
|
-
const projectRoot =
|
|
49611
|
+
const projectRoot = dirname45(tsconfigPath);
|
|
49480
49612
|
let tscOutput;
|
|
49481
49613
|
try {
|
|
49482
49614
|
const localBin = resolveLocalBin("tsc", projectRoot);
|
|
@@ -49911,7 +50043,7 @@ function registerHookCommand(program2) {
|
|
|
49911
50043
|
}
|
|
49912
50044
|
try {
|
|
49913
50045
|
if (process.env.DREAMCONTEXT_BRAIN_SYNC !== "0") {
|
|
49914
|
-
const projectRoot =
|
|
50046
|
+
const projectRoot = dirname45(root);
|
|
49915
50047
|
const cfg = readSetupConfig(projectRoot);
|
|
49916
50048
|
const enabledResolution = resolveBrainSyncEnabled(projectRoot, cfg);
|
|
49917
50049
|
if (enabledResolution.enabled && cfg?.brainRepo?.mode === "full-repo" && cfg?.brainRepo?.autoSync) {
|
|
@@ -50032,7 +50164,7 @@ function registerHookCommand(program2) {
|
|
|
50032
50164
|
}
|
|
50033
50165
|
if (process.env.DREAMCONTEXT_VERSION_CHECK !== "0") {
|
|
50034
50166
|
try {
|
|
50035
|
-
const projectRoot =
|
|
50167
|
+
const projectRoot = dirname45(root);
|
|
50036
50168
|
let vcache = readVersionCache(projectRoot);
|
|
50037
50169
|
if (!isCacheFresh(vcache)) {
|
|
50038
50170
|
const loaded = loadCatalog();
|
|
@@ -50103,7 +50235,7 @@ function registerHookCommand(program2) {
|
|
|
50103
50235
|
if (bumped) writeSleepState(root, state);
|
|
50104
50236
|
}
|
|
50105
50237
|
try {
|
|
50106
|
-
const { target: currentTarget } = currentVaultTarget(
|
|
50238
|
+
const { target: currentTarget } = currentVaultTarget(dirname45(root));
|
|
50107
50239
|
const peerTargets = resolveConnectedVaults(currentTarget, root).filter(
|
|
50108
50240
|
(t) => t.current !== true
|
|
50109
50241
|
);
|
|
@@ -50330,7 +50462,7 @@ var init_hook = __esm({
|
|
|
50330
50462
|
// src/cli/commands/doctor.ts
|
|
50331
50463
|
import { existsSync as existsSync79, readFileSync as readFileSync56, readdirSync as readdirSync17, statSync as statSync16 } from "fs";
|
|
50332
50464
|
import { join as join77 } from "path";
|
|
50333
|
-
import { dirname as
|
|
50465
|
+
import { dirname as dirname46 } from "path";
|
|
50334
50466
|
function stripDocumentedMentions(content) {
|
|
50335
50467
|
let result = content.replace(/```[\s\S]*?```/g, "");
|
|
50336
50468
|
result = result.replace(/`[^`]*`/g, "");
|
|
@@ -50565,7 +50697,7 @@ function checkLab(root) {
|
|
|
50565
50697
|
const insights = listInsights(root);
|
|
50566
50698
|
const credentialsPath2 = join77(root, "lab", "credentials.json");
|
|
50567
50699
|
if (existsSync79(credentialsPath2)) {
|
|
50568
|
-
const projectRoot =
|
|
50700
|
+
const projectRoot = dirname46(root);
|
|
50569
50701
|
const covered = gitignoreCovers(projectRoot, ["_dream_context/lab/credentials.json"]);
|
|
50570
50702
|
if (!covered) {
|
|
50571
50703
|
results.push({
|
|
@@ -51089,7 +51221,7 @@ var init_change_tracker2 = __esm({
|
|
|
51089
51221
|
});
|
|
51090
51222
|
|
|
51091
51223
|
// src/server/routes/tasks.ts
|
|
51092
|
-
import { dirname as
|
|
51224
|
+
import { dirname as dirname47 } from "path";
|
|
51093
51225
|
function toApiTask(task) {
|
|
51094
51226
|
const { raw: _raw, rawBody: _rawBody, ...api } = task;
|
|
51095
51227
|
return api;
|
|
@@ -51356,7 +51488,7 @@ function slugToName(slug) {
|
|
|
51356
51488
|
return slug.split("-").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
51357
51489
|
}
|
|
51358
51490
|
function rosterMembers(contextRoot) {
|
|
51359
|
-
const config = readSetupConfig(
|
|
51491
|
+
const config = readSetupConfig(dirname47(contextRoot));
|
|
51360
51492
|
const people = config?.people ?? [];
|
|
51361
51493
|
return people.map((slug) => ({
|
|
51362
51494
|
slug,
|
|
@@ -58660,7 +58792,7 @@ var require_lib4 = __commonJS({
|
|
|
58660
58792
|
|
|
58661
58793
|
// src/server/routes/knowledge.ts
|
|
58662
58794
|
import { existsSync as existsSync82, readFileSync as readFileSync58, statSync as statSync18 } from "fs";
|
|
58663
|
-
import { join as join80, dirname as
|
|
58795
|
+
import { join as join80, dirname as dirname48, basename as basename26, extname as extname5 } from "path";
|
|
58664
58796
|
function getKnowledgeDir2(contextRoot) {
|
|
58665
58797
|
return join80(contextRoot, "knowledge");
|
|
58666
58798
|
}
|
|
@@ -58776,8 +58908,8 @@ async function handleKnowledgeAssets(_req, res, params, contextRoot) {
|
|
|
58776
58908
|
}
|
|
58777
58909
|
const { content } = readFrontmatter(filePath);
|
|
58778
58910
|
const embedded = parseEmbeddedFiles(content);
|
|
58779
|
-
const vaultRoot2 =
|
|
58780
|
-
const boardDir =
|
|
58911
|
+
const vaultRoot2 = dirname48(contextRoot);
|
|
58912
|
+
const boardDir = dirname48(filePath);
|
|
58781
58913
|
const imageCount = embedded.filter((e) => IMAGE_MIME[extname5(e.path).toLowerCase()]).length;
|
|
58782
58914
|
const { maxDim, quality } = compressionFor(imageCount);
|
|
58783
58915
|
const files = {};
|
|
@@ -59921,9 +60053,9 @@ var init_council2 = __esm({
|
|
|
59921
60053
|
});
|
|
59922
60054
|
|
|
59923
60055
|
// src/server/routes/config.ts
|
|
59924
|
-
import { dirname as
|
|
60056
|
+
import { dirname as dirname49 } from "path";
|
|
59925
60057
|
async function handleConfigGet(_req, res, _params, contextRoot) {
|
|
59926
|
-
const config = readSetupConfig(
|
|
60058
|
+
const config = readSetupConfig(dirname49(contextRoot));
|
|
59927
60059
|
sendJson(res, 200, { config });
|
|
59928
60060
|
}
|
|
59929
60061
|
async function handleConfigUpdate(req, res, _params, contextRoot) {
|
|
@@ -60007,7 +60139,7 @@ async function handleConfigUpdate(req, res, _params, contextRoot) {
|
|
|
60007
60139
|
}
|
|
60008
60140
|
picked.changelogTarget = "comments";
|
|
60009
60141
|
}
|
|
60010
|
-
const existing = readSetupConfig(
|
|
60142
|
+
const existing = readSetupConfig(dirname49(contextRoot))?.clickup ?? {};
|
|
60011
60143
|
patch.clickup = { ...existing, ...picked };
|
|
60012
60144
|
}
|
|
60013
60145
|
if (body.github !== void 0) {
|
|
@@ -60033,14 +60165,14 @@ async function handleConfigUpdate(req, res, _params, contextRoot) {
|
|
|
60033
60165
|
}
|
|
60034
60166
|
picked.changelogTarget = "comments";
|
|
60035
60167
|
}
|
|
60036
|
-
const existing = readSetupConfig(
|
|
60168
|
+
const existing = readSetupConfig(dirname49(contextRoot))?.github ?? {};
|
|
60037
60169
|
patch.github = { ...existing, ...picked };
|
|
60038
60170
|
}
|
|
60039
60171
|
if (patch.platforms === void 0 && patch.packs === void 0 && patch.disableNativeMemory === void 0 && patch.taskBackend === void 0 && patch.cloudTaskManagement === void 0 && patch.clickup === void 0 && patch.github === void 0 && patch.shareable === void 0) {
|
|
60040
60172
|
sendError(res, 400, "no_changes", "Provide at least one of: platforms, packs, disableNativeMemory, taskBackend, cloudTaskManagement, clickup, github, shareable.");
|
|
60041
60173
|
return;
|
|
60042
60174
|
}
|
|
60043
|
-
const projectRoot =
|
|
60175
|
+
const projectRoot = dirname49(contextRoot);
|
|
60044
60176
|
if (patch.taskBackend === "clickup" || patch.taskBackend === "github") {
|
|
60045
60177
|
try {
|
|
60046
60178
|
ensureRemoteBackendGitignore(projectRoot);
|
|
@@ -60067,11 +60199,11 @@ var init_config = __esm({
|
|
|
60067
60199
|
});
|
|
60068
60200
|
|
|
60069
60201
|
// src/server/routes/vaults.ts
|
|
60070
|
-
import { dirname as
|
|
60202
|
+
import { dirname as dirname50, resolve as resolve21 } from "path";
|
|
60071
60203
|
import { existsSync as existsSync88 } from "fs";
|
|
60072
60204
|
async function handleVaultsGet(_req, res, _params, contextRoot) {
|
|
60073
60205
|
const vaults = listVaults().map((v) => ({ ...v, exists: existsSync88(resolve21(v.path)) }));
|
|
60074
|
-
const current = contextRoot ? vaults.find((v) => resolve21(v.path) === resolve21(
|
|
60206
|
+
const current = contextRoot ? vaults.find((v) => resolve21(v.path) === resolve21(dirname50(contextRoot)))?.name ?? null : null;
|
|
60075
60207
|
sendJson(res, 200, { vaults, current });
|
|
60076
60208
|
}
|
|
60077
60209
|
var init_vaults2 = __esm({
|
|
@@ -60083,7 +60215,7 @@ var init_vaults2 = __esm({
|
|
|
60083
60215
|
});
|
|
60084
60216
|
|
|
60085
60217
|
// src/lib/vault-discovery.ts
|
|
60086
|
-
import { dirname as
|
|
60218
|
+
import { dirname as dirname51 } from "path";
|
|
60087
60219
|
function discoverVaults(root) {
|
|
60088
60220
|
const matches = import_fast_glob21.default.sync("**/_dream_context", {
|
|
60089
60221
|
cwd: root,
|
|
@@ -60094,7 +60226,7 @@ function discoverVaults(root) {
|
|
|
60094
60226
|
suppressErrors: true
|
|
60095
60227
|
});
|
|
60096
60228
|
const projects = /* @__PURE__ */ new Set();
|
|
60097
|
-
for (const ctx of matches) projects.add(
|
|
60229
|
+
for (const ctx of matches) projects.add(dirname51(ctx));
|
|
60098
60230
|
return Array.from(projects).sort();
|
|
60099
60231
|
}
|
|
60100
60232
|
async function discoverVaultsAsync(root) {
|
|
@@ -60107,7 +60239,7 @@ async function discoverVaultsAsync(root) {
|
|
|
60107
60239
|
suppressErrors: true
|
|
60108
60240
|
});
|
|
60109
60241
|
const projects = /* @__PURE__ */ new Set();
|
|
60110
|
-
for (const ctx of matches) projects.add(
|
|
60242
|
+
for (const ctx of matches) projects.add(dirname51(ctx));
|
|
60111
60243
|
return Array.from(projects).sort();
|
|
60112
60244
|
}
|
|
60113
60245
|
var import_fast_glob21;
|
|
@@ -61063,7 +61195,7 @@ var init_launcher = __esm({
|
|
|
61063
61195
|
});
|
|
61064
61196
|
|
|
61065
61197
|
// src/server/routes/ui-settings.ts
|
|
61066
|
-
import { dirname as
|
|
61198
|
+
import { dirname as dirname52, join as join86 } from "path";
|
|
61067
61199
|
import { existsSync as existsSync90, mkdirSync as mkdirSync45, readFileSync as readFileSync63, writeFileSync as writeFileSync51 } from "fs";
|
|
61068
61200
|
function settingsPath(contextRoot) {
|
|
61069
61201
|
return join86(contextRoot, BRAIN_SETTINGS_REL_PATH);
|
|
@@ -61100,7 +61232,7 @@ async function handleBrainSettingsPut(req, res, _params, contextRoot) {
|
|
|
61100
61232
|
}
|
|
61101
61233
|
try {
|
|
61102
61234
|
const path2 = settingsPath(contextRoot);
|
|
61103
|
-
mkdirSync45(
|
|
61235
|
+
mkdirSync45(dirname52(path2), { recursive: true });
|
|
61104
61236
|
writeFileSync51(path2, serialized + "\n", "utf-8");
|
|
61105
61237
|
sendJson(res, 200, { ok: true });
|
|
61106
61238
|
} catch (err) {
|
|
@@ -61142,7 +61274,7 @@ function makeSettingsHandlers(relPath, logTag) {
|
|
|
61142
61274
|
}
|
|
61143
61275
|
try {
|
|
61144
61276
|
const path2 = pathFor(contextRoot);
|
|
61145
|
-
mkdirSync45(
|
|
61277
|
+
mkdirSync45(dirname52(path2), { recursive: true });
|
|
61146
61278
|
writeFileSync51(path2, serialized + "\n", "utf-8");
|
|
61147
61279
|
sendJson(res, 200, { ok: true });
|
|
61148
61280
|
} catch (err) {
|
|
@@ -61374,7 +61506,7 @@ var init_objectives = __esm({
|
|
|
61374
61506
|
});
|
|
61375
61507
|
|
|
61376
61508
|
// src/server/routes/lab.ts
|
|
61377
|
-
import { dirname as
|
|
61509
|
+
import { dirname as dirname53 } from "path";
|
|
61378
61510
|
function toPublicTweaks(m) {
|
|
61379
61511
|
return m.tweaks.map((t) => ({
|
|
61380
61512
|
key: t.key,
|
|
@@ -61552,7 +61684,7 @@ async function handleLabCredentialsSet(req, res, _params, contextRoot) {
|
|
|
61552
61684
|
return;
|
|
61553
61685
|
}
|
|
61554
61686
|
try {
|
|
61555
|
-
writeCredential(
|
|
61687
|
+
writeCredential(dirname53(contextRoot), contextRoot, key2, value);
|
|
61556
61688
|
sendJson(res, 200, { keys: credentialKeyStatuses(contextRoot) });
|
|
61557
61689
|
} catch (err) {
|
|
61558
61690
|
const message = redactSecrets(err.message ?? String(err), [value]);
|
|
@@ -61600,7 +61732,7 @@ var init_lab2 = __esm({
|
|
|
61600
61732
|
});
|
|
61601
61733
|
|
|
61602
61734
|
// src/server/routes/board.ts
|
|
61603
|
-
import { dirname as
|
|
61735
|
+
import { dirname as dirname54, join as join87 } from "path";
|
|
61604
61736
|
import { existsSync as existsSync91, mkdirSync as mkdirSync46, readFileSync as readFileSync64, writeFileSync as writeFileSync52 } from "fs";
|
|
61605
61737
|
function sharedPath(contextRoot) {
|
|
61606
61738
|
return join87(contextRoot, SHARED_REL_PATH);
|
|
@@ -61636,7 +61768,7 @@ function writeBlob(path2, board) {
|
|
|
61636
61768
|
if (Buffer.byteLength(serialized, "utf-8") > MAX_BYTES2) {
|
|
61637
61769
|
return "board payload is too large.";
|
|
61638
61770
|
}
|
|
61639
|
-
mkdirSync46(
|
|
61771
|
+
mkdirSync46(dirname54(path2), { recursive: true });
|
|
61640
61772
|
writeFileSync52(path2, serialized + "\n", "utf-8");
|
|
61641
61773
|
return null;
|
|
61642
61774
|
}
|
|
@@ -61689,7 +61821,7 @@ var init_board = __esm({
|
|
|
61689
61821
|
|
|
61690
61822
|
// src/server/routes/sleepy-chat.ts
|
|
61691
61823
|
import { spawn as spawn5 } from "child_process";
|
|
61692
|
-
import { dirname as
|
|
61824
|
+
import { dirname as dirname55, join as join88 } from "path";
|
|
61693
61825
|
import { existsSync as existsSync92, mkdirSync as mkdirSync47, readFileSync as readFileSync65, writeFileSync as writeFileSync53 } from "fs";
|
|
61694
61826
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
61695
61827
|
function modelFor(tier) {
|
|
@@ -61742,7 +61874,7 @@ function writeStore(contextRoot, store) {
|
|
|
61742
61874
|
}
|
|
61743
61875
|
}
|
|
61744
61876
|
function projectRootOf(contextRoot) {
|
|
61745
|
-
return contextRoot.endsWith("_dream_context") ?
|
|
61877
|
+
return contextRoot.endsWith("_dream_context") ? dirname55(contextRoot) : contextRoot;
|
|
61746
61878
|
}
|
|
61747
61879
|
function handleStreamLine(run3, obj) {
|
|
61748
61880
|
const type = obj.type;
|
|
@@ -65754,13 +65886,13 @@ var init_wrapper = __esm({
|
|
|
65754
65886
|
import { spawn as spawn6 } from "child_process";
|
|
65755
65887
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
65756
65888
|
import { createRequire as createRequire2 } from "module";
|
|
65757
|
-
import { basename as basename29, dirname as
|
|
65889
|
+
import { basename as basename29, dirname as dirname56, join as join89 } from "path";
|
|
65758
65890
|
import { existsSync as existsSync93, readdirSync as readdirSync20, statSync as statSync20, chmodSync as chmodSync6, readFileSync as readFileSync66 } from "fs";
|
|
65759
65891
|
import { homedir as homedir8 } from "os";
|
|
65760
65892
|
function ensurePtyHelperExecutable() {
|
|
65761
65893
|
try {
|
|
65762
65894
|
const require2 = createRequire2(import.meta.url);
|
|
65763
|
-
const root =
|
|
65895
|
+
const root = dirname56(dirname56(require2.resolve("node-pty")));
|
|
65764
65896
|
const candidates = [join89(root, "build", "Release", "spawn-helper")];
|
|
65765
65897
|
const prebuilds = join89(root, "prebuilds");
|
|
65766
65898
|
if (existsSync93(prebuilds)) {
|
|
@@ -65816,7 +65948,7 @@ function detectOnPath(cmd, timeoutMs = 8e3) {
|
|
|
65816
65948
|
});
|
|
65817
65949
|
}
|
|
65818
65950
|
function projectRootOf2(contextRoot) {
|
|
65819
|
-
return contextRoot.endsWith("_dream_context") ?
|
|
65951
|
+
return contextRoot.endsWith("_dream_context") ? dirname56(contextRoot) : contextRoot;
|
|
65820
65952
|
}
|
|
65821
65953
|
function resolveVaultProjectRoot(name) {
|
|
65822
65954
|
if (!name) return null;
|
|
@@ -65891,11 +66023,11 @@ function pruneInstallRuns() {
|
|
|
65891
66023
|
}
|
|
65892
66024
|
}
|
|
65893
66025
|
function cliPackageRoot() {
|
|
65894
|
-
let dir = process.argv[1] ?
|
|
66026
|
+
let dir = process.argv[1] ? dirname56(process.argv[1]) : "";
|
|
65895
66027
|
if (!dir) return null;
|
|
65896
66028
|
for (let i = 0; i < 8; i++) {
|
|
65897
66029
|
if (existsSync93(join89(dir, "package.json"))) return dir;
|
|
65898
|
-
const parent =
|
|
66030
|
+
const parent = dirname56(dir);
|
|
65899
66031
|
if (parent === dir) break;
|
|
65900
66032
|
dir = parent;
|
|
65901
66033
|
}
|
|
@@ -66615,7 +66747,7 @@ var init_agent_drop = __esm({
|
|
|
66615
66747
|
});
|
|
66616
66748
|
|
|
66617
66749
|
// src/server/routes/agent-sessions.ts
|
|
66618
|
-
import { join as join91, dirname as
|
|
66750
|
+
import { join as join91, dirname as dirname57 } from "path";
|
|
66619
66751
|
import { existsSync as existsSync94, mkdirSync as mkdirSync49, readFileSync as readFileSync67, writeFileSync as writeFileSync55, renameSync as renameSync17 } from "fs";
|
|
66620
66752
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
66621
66753
|
function storePath2(contextRoot) {
|
|
@@ -66650,7 +66782,7 @@ function readRoster(contextRoot) {
|
|
|
66650
66782
|
}
|
|
66651
66783
|
function writeRoster(contextRoot, sessions) {
|
|
66652
66784
|
try {
|
|
66653
|
-
ensureGitignoreEntries(
|
|
66785
|
+
ensureGitignoreEntries(dirname57(contextRoot), ["_dream_context/state/.agent-sessions.json"], {
|
|
66654
66786
|
comment: "dreamcontext: machine-local agent session roster (Claude resume ids)"
|
|
66655
66787
|
});
|
|
66656
66788
|
} catch {
|
|
@@ -66717,9 +66849,9 @@ var init_agent_sessions = __esm({
|
|
|
66717
66849
|
});
|
|
66718
66850
|
|
|
66719
66851
|
// src/server/routes/connections.ts
|
|
66720
|
-
import { dirname as
|
|
66852
|
+
import { dirname as dirname58 } from "path";
|
|
66721
66853
|
function currentVaultName(contextRoot) {
|
|
66722
|
-
return currentVaultTarget(
|
|
66854
|
+
return currentVaultTarget(dirname58(contextRoot)).name;
|
|
66723
66855
|
}
|
|
66724
66856
|
async function handleConnectionsList(_req, res, _params, contextRoot) {
|
|
66725
66857
|
sendJson(res, 200, { connections: listConnections(contextRoot) });
|
|
@@ -66916,7 +67048,7 @@ var init_federation_digest = __esm({
|
|
|
66916
67048
|
});
|
|
66917
67049
|
|
|
66918
67050
|
// src/server/routes/federation.ts
|
|
66919
|
-
import { dirname as
|
|
67051
|
+
import { dirname as dirname59 } from "path";
|
|
66920
67052
|
async function handleFederationInboxGet(_req, res, _params, contextRoot) {
|
|
66921
67053
|
const { entries, quarantined } = drainInbox(contextRoot);
|
|
66922
67054
|
const pending = entries.map((e) => e.entry);
|
|
@@ -66928,7 +67060,7 @@ async function handleFederationInboxGet(_req, res, _params, contextRoot) {
|
|
|
66928
67060
|
});
|
|
66929
67061
|
}
|
|
66930
67062
|
async function handleFederationSyncPost(_req, res, _params, contextRoot) {
|
|
66931
|
-
const senderName = currentVaultTarget(
|
|
67063
|
+
const senderName = currentVaultTarget(dirname59(contextRoot)).name;
|
|
66932
67064
|
const outbound = listConnections(contextRoot).filter(
|
|
66933
67065
|
(c) => (c.direction === "out" || c.direction === "both") && c.status !== "stale"
|
|
66934
67066
|
);
|
|
@@ -66976,14 +67108,14 @@ var init_federation = __esm({
|
|
|
66976
67108
|
});
|
|
66977
67109
|
|
|
66978
67110
|
// src/server/routes/packs.ts
|
|
66979
|
-
import { dirname as
|
|
67111
|
+
import { dirname as dirname60 } from "path";
|
|
66980
67112
|
async function handlePacksGet(_req, res, _params, contextRoot) {
|
|
66981
67113
|
const loaded = loadCatalog();
|
|
66982
67114
|
if (!loaded) {
|
|
66983
67115
|
sendJson(res, 200, { packs: [], standalone: [] });
|
|
66984
67116
|
return;
|
|
66985
67117
|
}
|
|
66986
|
-
const projectRoot =
|
|
67118
|
+
const projectRoot = dirname60(contextRoot);
|
|
66987
67119
|
const packs = loaded.catalog.packs.map((p) => ({ ...p, installed: isSkillInstalled(projectRoot, p.name) }));
|
|
66988
67120
|
const standalone = loaded.catalog.standalone.map((s) => ({ ...s, installed: isSkillInstalled(projectRoot, s.name) }));
|
|
66989
67121
|
sendJson(res, 200, { packs, standalone });
|
|
@@ -66997,7 +67129,7 @@ var init_packs = __esm({
|
|
|
66997
67129
|
});
|
|
66998
67130
|
|
|
66999
67131
|
// src/server/routes/packs-install.ts
|
|
67000
|
-
import { dirname as
|
|
67132
|
+
import { dirname as dirname61 } from "path";
|
|
67001
67133
|
function validatePackName(name, contextRoot) {
|
|
67002
67134
|
if (name.includes("/") || name.includes("\0") || safeChildPath2("/x", name) === null) {
|
|
67003
67135
|
return { ok: false, status: 400, code: "invalid_name", message: "Invalid pack name." };
|
|
@@ -67010,7 +67142,7 @@ function validatePackName(name, contextRoot) {
|
|
|
67010
67142
|
if (!known) {
|
|
67011
67143
|
return { ok: false, status: 404, code: "unknown_pack", message: `Pack "${name}" not found.` };
|
|
67012
67144
|
}
|
|
67013
|
-
const projectRoot =
|
|
67145
|
+
const projectRoot = dirname61(contextRoot);
|
|
67014
67146
|
const config = readSetupConfig(projectRoot);
|
|
67015
67147
|
const platforms = normalizePlatforms(config?.platforms ?? []);
|
|
67016
67148
|
const resolved = platforms.length > 0 ? platforms : [...DEFAULT_PLATFORMS];
|
|
@@ -67083,10 +67215,10 @@ var init_packs_install = __esm({
|
|
|
67083
67215
|
});
|
|
67084
67216
|
|
|
67085
67217
|
// src/server/routes/version-check.ts
|
|
67086
|
-
import { dirname as
|
|
67218
|
+
import { dirname as dirname62 } from "path";
|
|
67087
67219
|
async function handleVersionCheckGet(_req, res, _params, contextRoot) {
|
|
67088
67220
|
try {
|
|
67089
|
-
const projectRoot =
|
|
67221
|
+
const projectRoot = dirname62(contextRoot);
|
|
67090
67222
|
const cache = readVersionCache(projectRoot);
|
|
67091
67223
|
const fresh = isCacheFresh(cache);
|
|
67092
67224
|
const freshCli = readDreamcontextVersionFromDisk();
|
|
@@ -67552,86 +67684,8 @@ var init_team_fetch = __esm({
|
|
|
67552
67684
|
}
|
|
67553
67685
|
});
|
|
67554
67686
|
|
|
67555
|
-
// src/lib/git-sync/failure.ts
|
|
67556
|
-
function githubSlug(s) {
|
|
67557
|
-
const m = s.match(/github\.com[/:]([^/\s]+\/[^/\s'".]+)/i);
|
|
67558
|
-
return m ? m[1].replace(/\.git$/, "") : void 0;
|
|
67559
|
-
}
|
|
67560
|
-
function extractRepo(message, fallbackRepo) {
|
|
67561
|
-
const perm = message.match(/Permission to ([^\s]+?)(?:\.git)? denied/i);
|
|
67562
|
-
if (perm) return perm[1];
|
|
67563
|
-
const fromMsg = githubSlug(message);
|
|
67564
|
-
if (fromMsg) return fromMsg;
|
|
67565
|
-
if (fallbackRepo) return githubSlug(fallbackRepo) ?? fallbackRepo;
|
|
67566
|
-
return void 0;
|
|
67567
|
-
}
|
|
67568
|
-
function classifySyncError(rawMessage, repoHint) {
|
|
67569
|
-
const m = rawMessage || "";
|
|
67570
|
-
const repo = extractRepo(m, repoHint);
|
|
67571
|
-
const named = repo ? ` on ${repo}` : "";
|
|
67572
|
-
if (/non-fast-forward.*twice|rejected.*non-fast-forward|Push rejected \(non-fast-forward\) twice/i.test(m)) {
|
|
67573
|
-
return {
|
|
67574
|
-
kind: "push-rejected",
|
|
67575
|
-
recovery: "retry",
|
|
67576
|
-
repo,
|
|
67577
|
-
message: "The team pushed while your sync was in flight. Retry \u2014 dreamcontext will merge their changes and push again."
|
|
67578
|
-
};
|
|
67579
|
-
}
|
|
67580
|
-
if (/Contents\b.*write|permission to .* denied|protected branch|not authorized|remote: Permission|must have push access|403\b/i.test(m)) {
|
|
67581
|
-
return {
|
|
67582
|
-
kind: "permission",
|
|
67583
|
-
recovery: "check-permissions",
|
|
67584
|
-
repo,
|
|
67585
|
-
message: `Your GitHub token can't write to${named || " this repo"}. Give it Contents (read & write) access${repo ? ` on ${repo}` : ""}, then retry.`
|
|
67586
|
-
};
|
|
67587
|
-
}
|
|
67588
|
-
if (/no github token found|no token found for the brain/i.test(m)) {
|
|
67589
|
-
return {
|
|
67590
|
-
kind: "no-token",
|
|
67591
|
-
recovery: "reconnect-github",
|
|
67592
|
-
repo,
|
|
67593
|
-
message: "Cloud sync needs a GitHub account. Connect GitHub to start syncing."
|
|
67594
|
-
};
|
|
67595
|
-
}
|
|
67596
|
-
if (/authentication failed|could not read Username|bad credentials|invalid credentials|401\b|terminal prompts disabled|Support for password authentication/i.test(m)) {
|
|
67597
|
-
return {
|
|
67598
|
-
kind: "auth",
|
|
67599
|
-
recovery: "reconnect-github",
|
|
67600
|
-
repo,
|
|
67601
|
-
message: "Your GitHub sign-in expired or is invalid. Reconnect GitHub to keep syncing."
|
|
67602
|
-
};
|
|
67603
|
-
}
|
|
67604
|
-
if (/could ?n[o']t resolve host|could not resolve host|connection timed out|failed to connect|network is unreachable|temporary failure in name resolution|unable to access .*(?:Could not resolve|timed out|Failed to connect)|getaddrinfo|ENOTFOUND|ETIMEDOUT/i.test(m)) {
|
|
67605
|
-
return {
|
|
67606
|
-
kind: "network",
|
|
67607
|
-
recovery: "wait-online",
|
|
67608
|
-
repo,
|
|
67609
|
-
message: "You're offline \u2014 sync will retry automatically when you're back online. Nothing was lost."
|
|
67610
|
-
};
|
|
67611
|
-
}
|
|
67612
|
-
if (/unrelated histories/i.test(m)) {
|
|
67613
|
-
return {
|
|
67614
|
-
kind: "unknown",
|
|
67615
|
-
recovery: "manual",
|
|
67616
|
-
repo,
|
|
67617
|
-
message: "The remote contains content that did not come from this brain (e.g. a README). Attach an empty repo or reconcile the histories manually."
|
|
67618
|
-
};
|
|
67619
|
-
}
|
|
67620
|
-
return {
|
|
67621
|
-
kind: "unknown",
|
|
67622
|
-
recovery: "retry",
|
|
67623
|
-
repo,
|
|
67624
|
-
message: rawMessage.trim() || "Sync failed. Retry, or check your connection and GitHub access."
|
|
67625
|
-
};
|
|
67626
|
-
}
|
|
67627
|
-
var init_failure = __esm({
|
|
67628
|
-
"src/lib/git-sync/failure.ts"() {
|
|
67629
|
-
"use strict";
|
|
67630
|
-
}
|
|
67631
|
-
});
|
|
67632
|
-
|
|
67633
67687
|
// src/server/routes/brain.ts
|
|
67634
|
-
import { basename as basename31, dirname as
|
|
67688
|
+
import { basename as basename31, dirname as dirname63 } from "path";
|
|
67635
67689
|
function mergeKindFor(contextRoot, hasMergeHead2, pendingAgentMerge) {
|
|
67636
67690
|
if (hasMergeHead2) {
|
|
67637
67691
|
const report = readConflictReport(contextRoot);
|
|
@@ -67651,7 +67705,7 @@ function gate2(res) {
|
|
|
67651
67705
|
}
|
|
67652
67706
|
async function handleBrainStatus(_req, res, _params, contextRoot) {
|
|
67653
67707
|
if (!gate2(res)) return;
|
|
67654
|
-
const projectRoot =
|
|
67708
|
+
const projectRoot = dirname63(contextRoot);
|
|
67655
67709
|
const config = readSetupConfig(projectRoot);
|
|
67656
67710
|
const mode = resolveMode2(config);
|
|
67657
67711
|
const enabled = resolveBrainSyncEnabled(projectRoot, config);
|
|
@@ -67701,7 +67755,7 @@ async function handleBrainStatus(_req, res, _params, contextRoot) {
|
|
|
67701
67755
|
}
|
|
67702
67756
|
async function handleBrainSync(req, res, _params, contextRoot) {
|
|
67703
67757
|
if (!gate2(res)) return;
|
|
67704
|
-
const projectRoot =
|
|
67758
|
+
const projectRoot = dirname63(contextRoot);
|
|
67705
67759
|
const body = await parseJsonBody(req);
|
|
67706
67760
|
const mode = body?.mode === "auto" ? "auto" : "pull-only";
|
|
67707
67761
|
const foreground = body?.foreground !== false;
|
|
@@ -67711,7 +67765,7 @@ async function handleBrainSync(req, res, _params, contextRoot) {
|
|
|
67711
67765
|
async function runSyncPayload(projectRoot, contextRoot, opts) {
|
|
67712
67766
|
try {
|
|
67713
67767
|
const result = await runBrainSync({ cwd: contextRoot, mode: opts.mode, foreground: opts.foreground, noCheckpoint: opts.noCheckpoint });
|
|
67714
|
-
|
|
67768
|
+
reconcileBrainSyncSuccess(result.action);
|
|
67715
67769
|
let failure;
|
|
67716
67770
|
if (result.action === "no-remote" && /token/i.test(result.note ?? "")) {
|
|
67717
67771
|
failure = classifySyncError(result.note ?? "no github token found", syncRepoHint(projectRoot));
|
|
@@ -67728,8 +67782,7 @@ async function runSyncPayload(projectRoot, contextRoot, opts) {
|
|
|
67728
67782
|
};
|
|
67729
67783
|
} catch (err) {
|
|
67730
67784
|
const failure = classifySyncError(err.message, syncRepoHint(projectRoot));
|
|
67731
|
-
|
|
67732
|
-
else if (failure.kind === "permission") setGlobalGitHubAuthValid(true);
|
|
67785
|
+
reconcileBrainSyncFailure(err.message, projectRoot, syncRepoHint(projectRoot));
|
|
67733
67786
|
return {
|
|
67734
67787
|
action: "error",
|
|
67735
67788
|
pulledUpdates: 0,
|
|
@@ -67748,7 +67801,7 @@ function syncRepoHint(projectRoot, _result) {
|
|
|
67748
67801
|
}
|
|
67749
67802
|
async function handleBrainSettingsGet2(_req, res, _params, contextRoot) {
|
|
67750
67803
|
if (!gate2(res)) return;
|
|
67751
|
-
const projectRoot =
|
|
67804
|
+
const projectRoot = dirname63(contextRoot);
|
|
67752
67805
|
const config = readSetupConfig(projectRoot);
|
|
67753
67806
|
const enabled = resolveBrainSyncEnabled(projectRoot, config);
|
|
67754
67807
|
const mode = resolveMode2(config);
|
|
@@ -67763,7 +67816,7 @@ async function handleBrainSettingsGet2(_req, res, _params, contextRoot) {
|
|
|
67763
67816
|
}
|
|
67764
67817
|
async function handleBrainSettingsPost(req, res, _params, contextRoot) {
|
|
67765
67818
|
if (!gate2(res)) return;
|
|
67766
|
-
const projectRoot =
|
|
67819
|
+
const projectRoot = dirname63(contextRoot);
|
|
67767
67820
|
const body = await parseJsonBody(req);
|
|
67768
67821
|
if (typeof body?.enabled !== "boolean") {
|
|
67769
67822
|
sendError(res, 400, "invalid_body", "enabled (boolean) is required.");
|
|
@@ -67824,7 +67877,7 @@ function currentOrigin(projectRoot) {
|
|
|
67824
67877
|
}
|
|
67825
67878
|
async function handleBrainOriginCreate(req, res, _params, contextRoot) {
|
|
67826
67879
|
if (!gate2(res)) return;
|
|
67827
|
-
const projectRoot =
|
|
67880
|
+
const projectRoot = dirname63(contextRoot);
|
|
67828
67881
|
const body = await parseJsonBody(req);
|
|
67829
67882
|
if (!resolveBrainSyncToken(projectRoot)) {
|
|
67830
67883
|
sendError(res, 401, "no_token", "Sign in with GitHub before creating a repo.");
|
|
@@ -67848,7 +67901,7 @@ async function handleBrainOriginCreate(req, res, _params, contextRoot) {
|
|
|
67848
67901
|
}
|
|
67849
67902
|
async function handleBrainOriginPreview(req, res, _params, contextRoot) {
|
|
67850
67903
|
if (!gate2(res)) return;
|
|
67851
|
-
const projectRoot =
|
|
67904
|
+
const projectRoot = dirname63(contextRoot);
|
|
67852
67905
|
const body = await parseJsonBody(req);
|
|
67853
67906
|
const url = typeof body?.url === "string" ? body.url.trim() : "";
|
|
67854
67907
|
if (!url) {
|
|
@@ -67860,7 +67913,7 @@ async function handleBrainOriginPreview(req, res, _params, contextRoot) {
|
|
|
67860
67913
|
}
|
|
67861
67914
|
async function handleBrainOriginAttach(req, res, _params, contextRoot) {
|
|
67862
67915
|
if (!gate2(res)) return;
|
|
67863
|
-
const projectRoot =
|
|
67916
|
+
const projectRoot = dirname63(contextRoot);
|
|
67864
67917
|
const body = await parseJsonBody(req);
|
|
67865
67918
|
const url = typeof body?.url === "string" ? body.url.trim() : "";
|
|
67866
67919
|
if (!url) {
|
|
@@ -67891,7 +67944,7 @@ async function handleBrainOriginAttach(req, res, _params, contextRoot) {
|
|
|
67891
67944
|
}
|
|
67892
67945
|
async function handleBrainOriginUpdate(req, res, _params, contextRoot) {
|
|
67893
67946
|
if (!gate2(res)) return;
|
|
67894
|
-
const projectRoot =
|
|
67947
|
+
const projectRoot = dirname63(contextRoot);
|
|
67895
67948
|
const body = await parseJsonBody(req);
|
|
67896
67949
|
const url = typeof body?.url === "string" ? body.url.trim() : "";
|
|
67897
67950
|
if (!url) {
|
|
@@ -67926,7 +67979,7 @@ async function handleBrainOriginUpdate(req, res, _params, contextRoot) {
|
|
|
67926
67979
|
}
|
|
67927
67980
|
async function handleBrainOriginDetach(_req, res, _params, contextRoot) {
|
|
67928
67981
|
if (!gate2(res)) return;
|
|
67929
|
-
const projectRoot =
|
|
67982
|
+
const projectRoot = dirname63(contextRoot);
|
|
67930
67983
|
let mergeInProgress = false;
|
|
67931
67984
|
try {
|
|
67932
67985
|
mergeInProgress = isGitRepo(projectRoot) && hasMergeHead(projectRoot);
|
|
@@ -67954,7 +68007,7 @@ function isSafeToGitignore(relPath) {
|
|
|
67954
68007
|
}
|
|
67955
68008
|
async function handleBrainScrubIgnore(req, res, _params, contextRoot) {
|
|
67956
68009
|
if (!gate2(res)) return;
|
|
67957
|
-
const projectRoot =
|
|
68010
|
+
const projectRoot = dirname63(contextRoot);
|
|
67958
68011
|
const body = await parseJsonBody(req);
|
|
67959
68012
|
const rawPath = typeof body?.path === "string" ? body.path.trim() : "";
|
|
67960
68013
|
if (!rawPath) {
|
|
@@ -68007,7 +68060,7 @@ async function handleBrainTeamFetch(req, res) {
|
|
|
68007
68060
|
sendError(res, 502, "team_fetch_failed", err.message);
|
|
68008
68061
|
}
|
|
68009
68062
|
}
|
|
68010
|
-
var
|
|
68063
|
+
var SAFE_TO_GITIGNORE;
|
|
68011
68064
|
var init_brain2 = __esm({
|
|
68012
68065
|
"src/server/routes/brain.ts"() {
|
|
68013
68066
|
"use strict";
|
|
@@ -68021,16 +68074,15 @@ var init_brain2 = __esm({
|
|
|
68021
68074
|
init_team_fetch();
|
|
68022
68075
|
init_conflict_report();
|
|
68023
68076
|
init_failure();
|
|
68024
|
-
|
|
68077
|
+
init_auth_reconcile();
|
|
68025
68078
|
init_gitignore();
|
|
68026
68079
|
init_vaults();
|
|
68027
|
-
AUTH_OK_ACTIONS = /* @__PURE__ */ new Set(["pulled", "pushed", "noop", "merged", "blocked-scrub", "awaiting-agent", "code-conflict"]);
|
|
68028
68080
|
SAFE_TO_GITIGNORE = /(^|\/)([^/]*\.env(\.[^/]+)?|[^/]*\.local\.[^/]+|[^/]*secrets?[^/]*\.(json|ya?ml|toml|env)|credentials?[^/]*\.(json|ya?ml|toml|env)|[^/]*\.(pem|key|p12|pfx|keystore|jks)|id_rsa[^/]*|id_ed25519[^/]*)$/i;
|
|
68029
68081
|
}
|
|
68030
68082
|
});
|
|
68031
68083
|
|
|
68032
68084
|
// src/server/routes/linked-repos.ts
|
|
68033
|
-
import { dirname as
|
|
68085
|
+
import { dirname as dirname64 } from "path";
|
|
68034
68086
|
function gate3(res) {
|
|
68035
68087
|
if (!isDesktop()) {
|
|
68036
68088
|
sendError(res, 403, "desktop_only", "Linked repos are only available in the desktop app.");
|
|
@@ -68040,12 +68092,12 @@ function gate3(res) {
|
|
|
68040
68092
|
}
|
|
68041
68093
|
async function handleLinkedReposList(_req, res, _params, contextRoot) {
|
|
68042
68094
|
if (!gate3(res)) return;
|
|
68043
|
-
const projectRoot =
|
|
68095
|
+
const projectRoot = dirname64(contextRoot);
|
|
68044
68096
|
sendJson(res, 200, { repos: resolveLinkedRepos(projectRoot) });
|
|
68045
68097
|
}
|
|
68046
68098
|
async function handleLinkedReposLink(req, res, _params, contextRoot) {
|
|
68047
68099
|
if (!gate3(res)) return;
|
|
68048
|
-
const projectRoot =
|
|
68100
|
+
const projectRoot = dirname64(contextRoot);
|
|
68049
68101
|
const body = await parseJsonBody(req);
|
|
68050
68102
|
const name = typeof body?.name === "string" ? body.name.trim() : "";
|
|
68051
68103
|
const path2 = typeof body?.path === "string" ? body.path.trim() : "";
|
|
@@ -68067,7 +68119,7 @@ async function handleLinkedReposLink(req, res, _params, contextRoot) {
|
|
|
68067
68119
|
}
|
|
68068
68120
|
async function handleLinkedReposClone(req, res, _params, contextRoot) {
|
|
68069
68121
|
if (!gate3(res)) return;
|
|
68070
|
-
const projectRoot =
|
|
68122
|
+
const projectRoot = dirname64(contextRoot);
|
|
68071
68123
|
const body = await parseJsonBody(req);
|
|
68072
68124
|
const name = typeof body?.name === "string" ? body.name.trim() : "";
|
|
68073
68125
|
const dir = typeof body?.dir === "string" && body.dir.trim() ? body.dir.trim() : void 0;
|
|
@@ -68097,7 +68149,7 @@ async function handleLinkedReposClone(req, res, _params, contextRoot) {
|
|
|
68097
68149
|
}
|
|
68098
68150
|
async function handleLinkedReposUnlink(req, res, _params, contextRoot) {
|
|
68099
68151
|
if (!gate3(res)) return;
|
|
68100
|
-
const projectRoot =
|
|
68152
|
+
const projectRoot = dirname64(contextRoot);
|
|
68101
68153
|
const body = await parseJsonBody(req);
|
|
68102
68154
|
const name = typeof body?.name === "string" ? body.name.trim() : "";
|
|
68103
68155
|
if (!name) {
|
|
@@ -68623,7 +68675,7 @@ var init_trigger = __esm({
|
|
|
68623
68675
|
|
|
68624
68676
|
// src/lib/reflection.ts
|
|
68625
68677
|
import { existsSync as existsSync96, mkdirSync as mkdirSync50, writeFileSync as writeFileSync56 } from "fs";
|
|
68626
|
-
import { join as join95, dirname as
|
|
68678
|
+
import { join as join95, dirname as dirname65 } from "path";
|
|
68627
68679
|
function buildExclusionSet(corpus, excludedExtra) {
|
|
68628
68680
|
const excluded = new Set(excludedExtra);
|
|
68629
68681
|
for (const doc of corpus) {
|
|
@@ -68803,7 +68855,7 @@ function reflectionPath(root) {
|
|
|
68803
68855
|
}
|
|
68804
68856
|
function writeReflection(root, md) {
|
|
68805
68857
|
const outPath = reflectionPath(root);
|
|
68806
|
-
const dir =
|
|
68858
|
+
const dir = dirname65(outPath);
|
|
68807
68859
|
if (!existsSync96(dir)) {
|
|
68808
68860
|
mkdirSync50(dir, { recursive: true });
|
|
68809
68861
|
}
|
|
@@ -69880,7 +69932,7 @@ var init_env_loader = __esm({
|
|
|
69880
69932
|
|
|
69881
69933
|
// src/lib/marketing/config.ts
|
|
69882
69934
|
import { existsSync as existsSync99, readFileSync as readFileSync72, writeFileSync as writeFileSync58, mkdirSync as mkdirSync52 } from "fs";
|
|
69883
|
-
import { dirname as
|
|
69935
|
+
import { dirname as dirname66 } from "path";
|
|
69884
69936
|
function readEnvFile() {
|
|
69885
69937
|
const path2 = MARKETING_PATHS.envFile();
|
|
69886
69938
|
if (!existsSync99(path2)) return {};
|
|
@@ -69945,7 +69997,7 @@ function loadConfig() {
|
|
|
69945
69997
|
}
|
|
69946
69998
|
function writeConfig(cfg) {
|
|
69947
69999
|
const path2 = MARKETING_PATHS.configFile();
|
|
69948
|
-
mkdirSync52(
|
|
70000
|
+
mkdirSync52(dirname66(path2), { recursive: true });
|
|
69949
70001
|
writeFileSync58(path2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
69950
70002
|
}
|
|
69951
70003
|
function ensureConfigFile() {
|
|
@@ -70002,7 +70054,7 @@ REINFLUENCE_BIN= # optional override; default uses .venv
|
|
|
70002
70054
|
import { spawn as spawn7, spawnSync as spawnSync2 } from "child_process";
|
|
70003
70055
|
import { existsSync as existsSync100, mkdirSync as mkdirSync53, cpSync as cpSync3 } from "fs";
|
|
70004
70056
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
70005
|
-
import { dirname as
|
|
70057
|
+
import { dirname as dirname67, resolve as resolve24, join as join98 } from "path";
|
|
70006
70058
|
function findBundledReinfluence() {
|
|
70007
70059
|
const candidates = [
|
|
70008
70060
|
// Installed npm package: dist/<chunk>.js -> ../tools/reinfluence
|
|
@@ -70133,7 +70185,7 @@ var init_bootstrap = __esm({
|
|
|
70133
70185
|
"use strict";
|
|
70134
70186
|
init_paths2();
|
|
70135
70187
|
__filename = fileURLToPath9(import.meta.url);
|
|
70136
|
-
__dirname7 =
|
|
70188
|
+
__dirname7 = dirname67(__filename);
|
|
70137
70189
|
}
|
|
70138
70190
|
});
|
|
70139
70191
|
|
|
@@ -70203,7 +70255,7 @@ var init_init2 = __esm({
|
|
|
70203
70255
|
|
|
70204
70256
|
// src/lib/marketing/vision.ts
|
|
70205
70257
|
import { existsSync as existsSync101, readFileSync as readFileSync73, writeFileSync as writeFileSync59 } from "fs";
|
|
70206
|
-
import { dirname as
|
|
70258
|
+
import { dirname as dirname68, join as join99 } from "path";
|
|
70207
70259
|
function pickVisionProvider(env2 = process.env) {
|
|
70208
70260
|
const oai = env2.OPENAI_VISION_API_KEY;
|
|
70209
70261
|
if (oai && oai.trim().length > 0) return { provider: "openai", apiKey: oai.trim() };
|
|
@@ -70338,7 +70390,7 @@ async function runVisionPassOnPost(postJsonPath, opts = {}) {
|
|
|
70338
70390
|
writeFileSync59(tmp, JSON.stringify(post, null, 2) + "\n", "utf-8");
|
|
70339
70391
|
const fs = await import("fs");
|
|
70340
70392
|
fs.renameSync(tmp, postJsonPath);
|
|
70341
|
-
const mdPath = join99(
|
|
70393
|
+
const mdPath = join99(dirname68(postJsonPath), `${shortcode}.md`);
|
|
70342
70394
|
if (existsSync101(mdPath)) {
|
|
70343
70395
|
try {
|
|
70344
70396
|
const md = readFileSync73(mdPath, "utf-8");
|
|
@@ -70419,7 +70471,7 @@ Example output: ["talking-head","prop-driven"]`;
|
|
|
70419
70471
|
import { spawn as spawn8 } from "child_process";
|
|
70420
70472
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
70421
70473
|
import { existsSync as existsSync102, mkdirSync as mkdirSync55, statfsSync } from "fs";
|
|
70422
|
-
import { dirname as
|
|
70474
|
+
import { dirname as dirname69, join as join100, basename as basename32, extname as extname6 } from "path";
|
|
70423
70475
|
function which(cmd) {
|
|
70424
70476
|
const r = spawnSync3(process.platform === "win32" ? "where" : "which", [cmd], { encoding: "utf8" });
|
|
70425
70477
|
if (r.status === 0) return (r.stdout || "").trim().split("\n")[0] || null;
|
|
@@ -70650,7 +70702,7 @@ First seen: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
|
70650
70702
|
}
|
|
70651
70703
|
function moveAsset(src, dest) {
|
|
70652
70704
|
if (!existsSync102(src)) return dest;
|
|
70653
|
-
mkdirSync55(
|
|
70705
|
+
mkdirSync55(dirname69(dest), { recursive: true });
|
|
70654
70706
|
const fs = __require("fs");
|
|
70655
70707
|
try {
|
|
70656
70708
|
fs.renameSync(src, dest);
|
|
@@ -70893,7 +70945,7 @@ var init_competitor = __esm({
|
|
|
70893
70945
|
|
|
70894
70946
|
// src/lib/marketing/meta-fetch.ts
|
|
70895
70947
|
import { existsSync as existsSync104, mkdirSync as mkdirSync56, readFileSync as readFileSync74, writeFileSync as writeFileSync60, statSync as statSync23, openSync as openSync2, readSync, closeSync as closeSync2 } from "fs";
|
|
70896
|
-
import { dirname as
|
|
70948
|
+
import { dirname as dirname70, basename as basename33 } from "path";
|
|
70897
70949
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
70898
70950
|
function getQueue(accountId) {
|
|
70899
70951
|
let q = writeQueues.get(accountId);
|
|
@@ -70952,7 +71004,7 @@ function readIdem(key2) {
|
|
|
70952
71004
|
}
|
|
70953
71005
|
function writeIdem(rec) {
|
|
70954
71006
|
const p = idemCachePath(rec.key);
|
|
70955
|
-
mkdirSync56(
|
|
71007
|
+
mkdirSync56(dirname70(p), { recursive: true });
|
|
70956
71008
|
writeFileSync60(p, JSON.stringify(rec, null, 2) + "\n", "utf8");
|
|
70957
71009
|
}
|
|
70958
71010
|
function backoffMs(attempt, hintSec) {
|
|
@@ -73503,7 +73555,7 @@ var init_ad = __esm({
|
|
|
73503
73555
|
|
|
73504
73556
|
// src/lib/marketing/launch.ts
|
|
73505
73557
|
import { existsSync as existsSync111, readFileSync as readFileSync80, writeFileSync as writeFileSync62, mkdirSync as mkdirSync58, renameSync as renameSync18, readdirSync as readdirSync26 } from "fs";
|
|
73506
|
-
import { dirname as
|
|
73558
|
+
import { dirname as dirname71, join as join105, basename as basename34 } from "path";
|
|
73507
73559
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
73508
73560
|
function buildLaunchSummary(cohortId) {
|
|
73509
73561
|
const cohort = loadCohort(cohortId);
|
|
@@ -73547,7 +73599,7 @@ function isoTs2() {
|
|
|
73547
73599
|
return (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
73548
73600
|
}
|
|
73549
73601
|
function atomicWriteFile3(path2, data) {
|
|
73550
|
-
mkdirSync58(
|
|
73602
|
+
mkdirSync58(dirname71(path2), { recursive: true });
|
|
73551
73603
|
const tmp = `${path2}.tmp.${process.pid}.${randomBytes6(4).toString("hex")}`;
|
|
73552
73604
|
writeFileSync62(tmp, data, "utf8");
|
|
73553
73605
|
renameSync18(tmp, path2);
|
|
@@ -74025,10 +74077,10 @@ import {
|
|
|
74025
74077
|
unlinkSync as unlinkSync11,
|
|
74026
74078
|
renameSync as renameSync19
|
|
74027
74079
|
} from "fs";
|
|
74028
|
-
import { dirname as
|
|
74080
|
+
import { dirname as dirname72, join as join106 } from "path";
|
|
74029
74081
|
import { randomBytes as randomBytes7 } from "crypto";
|
|
74030
74082
|
function atomicWriteFile4(path2, data) {
|
|
74031
|
-
mkdirSync59(
|
|
74083
|
+
mkdirSync59(dirname72(path2), { recursive: true });
|
|
74032
74084
|
const tmp = `${path2}.tmp.${process.pid}.${randomBytes7(4).toString("hex")}`;
|
|
74033
74085
|
writeFileSync63(tmp, data, "utf8");
|
|
74034
74086
|
renameSync19(tmp, path2);
|
|
@@ -74433,7 +74485,7 @@ exec dreamcontext mk hooks check-staged
|
|
|
74433
74485
|
// src/lib/marketing/council-personas.ts
|
|
74434
74486
|
import { existsSync as existsSync115, readFileSync as readFileSync84, readdirSync as readdirSync28 } from "fs";
|
|
74435
74487
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
74436
|
-
import { join as join108, dirname as
|
|
74488
|
+
import { join as join108, dirname as dirname73 } from "path";
|
|
74437
74489
|
function findPersonasDir() {
|
|
74438
74490
|
const candidates = [
|
|
74439
74491
|
// dev: src/lib/marketing/council-personas.ts → ../../../skill-packs/...
|
|
@@ -74491,7 +74543,7 @@ var init_council_personas = __esm({
|
|
|
74491
74543
|
import_gray_matter8 = __toESM(require_gray_matter(), 1);
|
|
74492
74544
|
__dirname_local = (() => {
|
|
74493
74545
|
try {
|
|
74494
|
-
return
|
|
74546
|
+
return dirname73(fileURLToPath10(import.meta.url));
|
|
74495
74547
|
} catch {
|
|
74496
74548
|
return process.cwd();
|
|
74497
74549
|
}
|
|
@@ -74680,7 +74732,7 @@ var init_marketing = __esm({
|
|
|
74680
74732
|
|
|
74681
74733
|
// src/cli/commands/memory.ts
|
|
74682
74734
|
import { existsSync as existsSync117, unlinkSync as unlinkSync12 } from "fs";
|
|
74683
|
-
import { join as join109, dirname as
|
|
74735
|
+
import { join as join109, dirname as dirname74 } from "path";
|
|
74684
74736
|
function collectVault(value, previous) {
|
|
74685
74737
|
return [...previous, value];
|
|
74686
74738
|
}
|
|
@@ -74692,7 +74744,7 @@ function parseTypes2(value) {
|
|
|
74692
74744
|
return filtered.length > 0 ? filtered : void 0;
|
|
74693
74745
|
}
|
|
74694
74746
|
function recallFederated(contextRoot, query, topK, types, opts) {
|
|
74695
|
-
const projectRoot =
|
|
74747
|
+
const projectRoot = dirname74(contextRoot);
|
|
74696
74748
|
const { target: currentTarget } = currentVaultTarget(projectRoot);
|
|
74697
74749
|
const byName = /* @__PURE__ */ new Map();
|
|
74698
74750
|
const add = (t) => {
|
|
@@ -74784,7 +74836,7 @@ function registerMemoryCommand(program2) {
|
|
|
74784
74836
|
recallFederated(root, query, topK, types, opts);
|
|
74785
74837
|
return;
|
|
74786
74838
|
}
|
|
74787
|
-
const projectRoot =
|
|
74839
|
+
const projectRoot = dirname74(root);
|
|
74788
74840
|
const { target: currentTarget } = currentVaultTarget(projectRoot);
|
|
74789
74841
|
const connectedTargets = resolveConnectedVaults(currentTarget, root);
|
|
74790
74842
|
if (connectedTargets.length > 1) {
|
|
@@ -75110,7 +75162,7 @@ var init_embed = __esm({
|
|
|
75110
75162
|
|
|
75111
75163
|
// src/cli/commands/upgrade.ts
|
|
75112
75164
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
75113
|
-
import { dirname as
|
|
75165
|
+
import { dirname as dirname75 } from "path";
|
|
75114
75166
|
import { existsSync as existsSync119 } from "fs";
|
|
75115
75167
|
function defaultInstaller(args) {
|
|
75116
75168
|
execFileSync11("npm", args, { stdio: "inherit" });
|
|
@@ -75145,7 +75197,7 @@ function defaultAppUpdater() {
|
|
|
75145
75197
|
}
|
|
75146
75198
|
function projectRootForCache() {
|
|
75147
75199
|
const contextDir = resolveContextRoot();
|
|
75148
|
-
return contextDir ?
|
|
75200
|
+
return contextDir ? dirname75(contextDir) : process.cwd();
|
|
75149
75201
|
}
|
|
75150
75202
|
function defaultLiveLatest() {
|
|
75151
75203
|
let latest = null;
|
|
@@ -75608,7 +75660,7 @@ var init_vaults3 = __esm({
|
|
|
75608
75660
|
});
|
|
75609
75661
|
|
|
75610
75662
|
// src/cli/commands/connections.ts
|
|
75611
|
-
import { dirname as
|
|
75663
|
+
import { dirname as dirname76 } from "path";
|
|
75612
75664
|
function refreshPeerSummariesQuietly(contextRoot) {
|
|
75613
75665
|
try {
|
|
75614
75666
|
refreshPeerSummaries(contextRoot);
|
|
@@ -75616,7 +75668,7 @@ function refreshPeerSummariesQuietly(contextRoot) {
|
|
|
75616
75668
|
}
|
|
75617
75669
|
}
|
|
75618
75670
|
function currentVaultName2(contextRoot) {
|
|
75619
|
-
return currentVaultTarget(
|
|
75671
|
+
return currentVaultTarget(dirname76(contextRoot)).name;
|
|
75620
75672
|
}
|
|
75621
75673
|
function registerConnectionsCommand(program2) {
|
|
75622
75674
|
program2.command("connect <vault>").description("Connect this vault to read a peer (live reference; out is a read edge)").option("-d, --direction <direction>", "Connection direction: out | in | both (out = read)", "out").option("--topics <list>", "Comma-separated topic filter (default: all topics)").action((vault, opts) => {
|
|
@@ -75910,12 +75962,12 @@ var init_people = __esm({
|
|
|
75910
75962
|
});
|
|
75911
75963
|
|
|
75912
75964
|
// src/cli/commands/config.ts
|
|
75913
|
-
import { dirname as
|
|
75965
|
+
import { dirname as dirname77 } from "path";
|
|
75914
75966
|
import { existsSync as existsSync120, readFileSync as readFileSync87, writeFileSync as writeFileSync66 } from "fs";
|
|
75915
75967
|
import { join as join112 } from "path";
|
|
75916
75968
|
function resolveProjectRoot() {
|
|
75917
75969
|
const contextRoot = resolveContextRoot();
|
|
75918
|
-
return contextRoot ?
|
|
75970
|
+
return contextRoot ? dirname77(contextRoot) : null;
|
|
75919
75971
|
}
|
|
75920
75972
|
function requireProjectRoot() {
|
|
75921
75973
|
const projectRoot = resolveProjectRoot();
|
|
@@ -76783,12 +76835,12 @@ var init_feedback2 = __esm({
|
|
|
76783
76835
|
});
|
|
76784
76836
|
|
|
76785
76837
|
// src/cli/commands/migrations.ts
|
|
76786
|
-
import { dirname as
|
|
76838
|
+
import { dirname as dirname78 } from "path";
|
|
76787
76839
|
function registerMigrationsCommand(program2) {
|
|
76788
76840
|
const migrations = program2.command("migrations").description("Inspect and record brain structure migrations");
|
|
76789
76841
|
migrations.command("pending").description("Print pending agent task instructions for any unfinished migrations").action(() => {
|
|
76790
76842
|
const root = ensureContextRoot();
|
|
76791
|
-
const projectRoot =
|
|
76843
|
+
const projectRoot = dirname78(root);
|
|
76792
76844
|
const config = readSetupConfig(projectRoot);
|
|
76793
76845
|
const fromVersion = config?.setupVersion ?? "0.0.0";
|
|
76794
76846
|
const toVersion = dreamcontextVersion();
|
|
@@ -76904,9 +76956,9 @@ var init_migrations2 = __esm({
|
|
|
76904
76956
|
});
|
|
76905
76957
|
|
|
76906
76958
|
// src/cli/commands/link.ts
|
|
76907
|
-
import { dirname as
|
|
76959
|
+
import { dirname as dirname79 } from "path";
|
|
76908
76960
|
function runLinkLs() {
|
|
76909
|
-
const projectRoot =
|
|
76961
|
+
const projectRoot = dirname79(ensureContextRoot());
|
|
76910
76962
|
const repos = resolveLinkedRepos(projectRoot);
|
|
76911
76963
|
if (repos.length === 0) {
|
|
76912
76964
|
console.log(source_default.dim("(no linked repos)"));
|
|
@@ -76923,7 +76975,7 @@ function runLinkLs() {
|
|
|
76923
76975
|
console.log(formatTable(["Name", "URL", "Status", "Local path"], rows, { statusCol: 2 }));
|
|
76924
76976
|
}
|
|
76925
76977
|
function runLinkRm(name) {
|
|
76926
|
-
const projectRoot =
|
|
76978
|
+
const projectRoot = dirname79(ensureContextRoot());
|
|
76927
76979
|
if (unlinkRepo(projectRoot, name)) {
|
|
76928
76980
|
success(`Unlinked "${name}" (the local path stays registered on this machine).`);
|
|
76929
76981
|
} else {
|
|
@@ -76934,7 +76986,7 @@ function runLinkRm(name) {
|
|
|
76934
76986
|
function registerLinkCommand(program2) {
|
|
76935
76987
|
const link = program2.command("link").description("Govern bare code repos: bind, clone, list, and unlink linked repos");
|
|
76936
76988
|
link.command("add <name> <path>").description("Bind a local checkout of a linked repo (records name+URL shared, path machine-local)").option("--url <url>", "Explicit GitHub URL (required when the repo has no origin)").action((name, path2, opts) => {
|
|
76937
|
-
const projectRoot =
|
|
76989
|
+
const projectRoot = dirname79(ensureContextRoot());
|
|
76938
76990
|
try {
|
|
76939
76991
|
const entry = linkRepo(projectRoot, name, path2, { url: opts.url });
|
|
76940
76992
|
success(`Linked "${entry.name}" \u2192 ${entry.gitRemoteUrl}`);
|
|
@@ -76946,7 +76998,7 @@ function registerLinkCommand(program2) {
|
|
|
76946
76998
|
}
|
|
76947
76999
|
});
|
|
76948
77000
|
link.command("clone <name>").description("Clone a MISSING linked repo (trust-gated \u2014 the URL is team-writable)").option("--dir <dir>", "Parent directory for the clone (default: alongside the project)").option("--yes", "Confirm the clone (required \u2014 see the trust warning)").action(async (name, opts) => {
|
|
76949
|
-
const projectRoot =
|
|
77001
|
+
const projectRoot = dirname79(ensureContextRoot());
|
|
76950
77002
|
warn("This URL comes from the shared config and could have been set by any teammate.");
|
|
76951
77003
|
info("dreamcontext clones it over HTTPS with transport hardening (ext:: refused, options terminated).");
|
|
76952
77004
|
if (!opts.yes) {
|