@rashidee/co2 1.3.9 → 1.3.10
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/.co2-dat/app.db-shm +0 -0
- package/dist/.co2-dat/app.db-wal +0 -0
- package/dist/index.js +113 -74
- package/package.json +1 -1
- package/static/assets/{abnfDiagram-VRR7QNED-C0CrqPXX.js → abnfDiagram-VRR7QNED-ChoWkBm-.js} +1 -1
- package/static/assets/{arc-BFSRYIcI.js → arc-BOiutWhq.js} +1 -1
- package/static/assets/{architectureDiagram-ZJ3FMSHR-DuwTK2W9.js → architectureDiagram-ZJ3FMSHR-Dn4YKYfM.js} +1 -1
- package/static/assets/{blockDiagram-677ZJIJ3-Bn9tAB0n.js → blockDiagram-677ZJIJ3-BrXEfs29.js} +1 -1
- package/static/assets/{c4Diagram-LMCZKHZV-CDiCEjY7.js → c4Diagram-LMCZKHZV-ChaIzrlx.js} +1 -1
- package/static/assets/channel-CKovdojM.js +1 -0
- package/static/assets/{chunk-2Q5K7J3B-BMwS7NgW.js → chunk-2Q5K7J3B-BOlnmyI2.js} +1 -1
- package/static/assets/{chunk-32BRIVSS-8l0XBCjq.js → chunk-32BRIVSS-BYtO1gsq.js} +1 -1
- package/static/assets/{chunk-5VM5RSS4-C6Cv-67E.js → chunk-5VM5RSS4-Cmx4Morj.js} +1 -1
- package/static/assets/{chunk-EX3LRPZG-DjWs4lB9.js → chunk-EX3LRPZG-BcgUofmA.js} +1 -1
- package/static/assets/{chunk-JWPE2WC7-DuK_Mu9c.js → chunk-JWPE2WC7-CnNRXdvN.js} +1 -1
- package/static/assets/{chunk-MOJQB5TN-K-bFFmpr.js → chunk-MOJQB5TN-DGG6Q3Wn.js} +1 -1
- package/static/assets/{chunk-RYQCIY6F-B-b4TyDb.js → chunk-RYQCIY6F-C8erKHls.js} +1 -1
- package/static/assets/{chunk-V7JOEXUC-BZRKjyVr.js → chunk-V7JOEXUC-BNkIJqzu.js} +1 -1
- package/static/assets/{chunk-VR4S4FIN-BcvbM_n3.js → chunk-VR4S4FIN-CGq-RseS.js} +1 -1
- package/static/assets/{chunk-XXDRQBXY-Z2nhcpRg.js → chunk-XXDRQBXY-DOVfEC7j.js} +1 -1
- package/static/assets/classDiagram-OUVF2IWQ-BRxqfb0_.js +1 -0
- package/static/assets/classDiagram-v2-EOCWNBFH-BRxqfb0_.js +1 -0
- package/static/assets/{cose-bilkent-JH36ORCC-CPBw8Z2X.js → cose-bilkent-JH36ORCC-BrK3gCzK.js} +1 -1
- package/static/assets/{cynefin-VYW2F7L2-DeJ1X-1F.js → cynefin-VYW2F7L2-BTMYzKLg.js} +1 -1
- package/static/assets/{cynefinDiagram-TSTJHNR4-BPs3jIZR.js → cynefinDiagram-TSTJHNR4-Df4k0_Hb.js} +1 -1
- package/static/assets/{dagre-VKFMJZFB-Bn5Xp63O.js → dagre-VKFMJZFB-0LnYnEqq.js} +1 -1
- package/static/assets/{diagram-FQU43EPY-DWIlVMUR.js → diagram-FQU43EPY-B5nIVD5g.js} +1 -1
- package/static/assets/{diagram-G47NLZAW-BWxpunVI.js → diagram-G47NLZAW-B2YLBzdb.js} +1 -1
- package/static/assets/{diagram-NH7WQ7WH-CpoAYUis.js → diagram-NH7WQ7WH-DPVumXIF.js} +1 -1
- package/static/assets/{diagram-OA4YK3LP-Dv1XfQGK.js → diagram-OA4YK3LP-Da20vcLJ.js} +1 -1
- package/static/assets/{diagram-WEI45ONY-DSk6wZtO.js → diagram-WEI45ONY-DQbTpuRZ.js} +1 -1
- package/static/assets/{ebnfDiagram-CCIWWBDH-DIDhI2dD.js → ebnfDiagram-CCIWWBDH-BEn1vEyb.js} +1 -1
- package/static/assets/{erDiagram-Q63AITRT-CGO6ep6G.js → erDiagram-Q63AITRT-Ccg0DVBG.js} +1 -1
- package/static/assets/{flowDiagram-23GEKE2U-D8nzLjfG.js → flowDiagram-23GEKE2U-B2dMjEpa.js} +1 -1
- package/static/assets/{ganttDiagram-NO4QXBWP-Usz8f26d.js → ganttDiagram-NO4QXBWP-Kp1UsG59.js} +1 -1
- package/static/assets/{gitGraphDiagram-IHSO6WYX-WEJUXa7P.js → gitGraphDiagram-IHSO6WYX-D6RB8sPf.js} +1 -1
- package/static/assets/{index-j3pCmOym.js → index-GEUFVo96.js} +57 -57
- package/static/assets/{infoDiagram-FWYZ7A6U-BRPwqRvz.js → infoDiagram-FWYZ7A6U-C4ILACOF.js} +1 -1
- package/static/assets/{ishikawaDiagram-FXEZZL3T-CrntEiqz.js → ishikawaDiagram-FXEZZL3T-Q2Ef9fW7.js} +1 -1
- package/static/assets/{journeyDiagram-5HDEW3XC-BmhRsz4F.js → journeyDiagram-5HDEW3XC-B7ZV1i0L.js} +1 -1
- package/static/assets/{kanban-definition-HUTT4EX6-CWxUXdc3.js → kanban-definition-HUTT4EX6-CjaPV_vw.js} +1 -1
- package/static/assets/{linear-BGjzqzT6.js → linear-BELpVz92.js} +1 -1
- package/static/assets/{mindmap-definition-LN4V7U3C-CoVNmO4b.js → mindmap-definition-LN4V7U3C-COhl-GrE.js} +1 -1
- package/static/assets/{pegDiagram-2B236MQR-hBHOzL7x.js → pegDiagram-2B236MQR-3FlTtWva.js} +1 -1
- package/static/assets/{pieDiagram-ENE6RG2P-Cpv7VZPG.js → pieDiagram-ENE6RG2P-CLeOh_sh.js} +1 -1
- package/static/assets/{quadrantDiagram-ABIIQ3AL-BIQAB21D.js → quadrantDiagram-ABIIQ3AL-D2MnobFS.js} +1 -1
- package/static/assets/{railroadDiagram-RFXS5EU6-DX6hST3S.js → railroadDiagram-RFXS5EU6-FjtL4fEj.js} +1 -1
- package/static/assets/{requirementDiagram-TGXJPOKE-Gas2cE_l.js → requirementDiagram-TGXJPOKE-C5Y2uWRV.js} +1 -1
- package/static/assets/{sankeyDiagram-HTMAVEWB-BpwoyJDe.js → sankeyDiagram-HTMAVEWB-ITj9bISn.js} +1 -1
- package/static/assets/{sequenceDiagram-DBY2YBRQ-CzBxna5k.js → sequenceDiagram-DBY2YBRQ-Ct2xTSbI.js} +1 -1
- package/static/assets/{sizeCapture-X5ZJPWSS-Cn-5NsLr.js → sizeCapture-X5ZJPWSS-w9hGRpov.js} +1 -1
- package/static/assets/{stateDiagram-2N3HPSRC-BiW03iCW.js → stateDiagram-2N3HPSRC-BlxDF1qr.js} +1 -1
- package/static/assets/stateDiagram-v2-6OUMAXLB-CQVgnOlz.js +1 -0
- package/static/assets/{swimlanes-5IMT3BWC-3jPuufWt.js → swimlanes-5IMT3BWC-DFYm_SCW.js} +2 -2
- package/static/assets/swimlanesDiagram-G3AALYLV-DubMPSZe.js +8 -0
- package/static/assets/{timeline-definition-FHXFAJF6-CzThWt1O.js → timeline-definition-FHXFAJF6-johIMUxt.js} +1 -1
- package/static/assets/{vennDiagram-L72KCM5P-D1Axj0CM.js → vennDiagram-L72KCM5P-BFk2-H5y.js} +1 -1
- package/static/assets/{wardleyDiagram-EHGQE667-mKj7UT6Q.js → wardleyDiagram-EHGQE667-T7509MWq.js} +1 -1
- package/static/assets/{xychartDiagram-FW5EYKEG-CSAkvAer.js → xychartDiagram-FW5EYKEG-DskgQ7uq.js} +1 -1
- package/static/index.html +1 -1
- package/static/assets/channel-CZGeGYqv.js +0 -1
- package/static/assets/classDiagram-OUVF2IWQ-DV5beYlE.js +0 -1
- package/static/assets/classDiagram-v2-EOCWNBFH-DV5beYlE.js +0 -1
- package/static/assets/stateDiagram-v2-6OUMAXLB-CmQ_Kjkj.js +0 -1
- package/static/assets/swimlanesDiagram-G3AALYLV-OaMW2HRF.js +0 -8
package/dist/.co2-dat/app.db-shm
CHANGED
|
Binary file
|
package/dist/.co2-dat/app.db-wal
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -6809,7 +6809,7 @@ var {
|
|
|
6809
6809
|
// package.json
|
|
6810
6810
|
var package_default = {
|
|
6811
6811
|
name: "@rashidee/co2",
|
|
6812
|
-
version: "1.3.
|
|
6812
|
+
version: "1.3.10",
|
|
6813
6813
|
description: "Compound Context Studio \u2014 self-hosted team context authoring for CO2 projects",
|
|
6814
6814
|
type: "module",
|
|
6815
6815
|
license: "MIT",
|
|
@@ -6937,7 +6937,7 @@ ${install.output}`));
|
|
|
6937
6937
|
}
|
|
6938
6938
|
|
|
6939
6939
|
// src/commands/start.ts
|
|
6940
|
-
import { existsSync as
|
|
6940
|
+
import { existsSync as existsSync26 } from "fs";
|
|
6941
6941
|
import { networkInterfaces } from "os";
|
|
6942
6942
|
import { dirname as dirname3, join as join29 } from "path";
|
|
6943
6943
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -22666,11 +22666,11 @@ function cicdGuardRoutes(db, workspacePath) {
|
|
|
22666
22666
|
}
|
|
22667
22667
|
|
|
22668
22668
|
// ../server/src/features/project/service.ts
|
|
22669
|
-
import { existsSync as
|
|
22669
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
22670
22670
|
import { join as join16 } from "path";
|
|
22671
22671
|
|
|
22672
22672
|
// ../server/src/features/project-config/service.ts
|
|
22673
|
-
import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
22673
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
|
|
22674
22674
|
import { join as join15 } from "path";
|
|
22675
22675
|
function svcError9(code, status) {
|
|
22676
22676
|
return Object.assign(new Error(code), { code, status });
|
|
@@ -22742,6 +22742,27 @@ function importProjectDevtool(db, workspacePath, projectId, content, importedBy)
|
|
|
22742
22742
|
writeProjectFile(workspacePath, folder, "DEVTOOL.md", content);
|
|
22743
22743
|
return toDto5(db, updated, "devtoolMd");
|
|
22744
22744
|
}
|
|
22745
|
+
function reloadProjectConfigFromFile(db, workspacePath, projectId, fileName, field) {
|
|
22746
|
+
const { folder } = requireProject2(db, projectId);
|
|
22747
|
+
const filePath = join15(workspacePath, folder, fileName);
|
|
22748
|
+
if (!existsSync14(filePath)) throw svcError9("FILE_NOT_FOUND", 404);
|
|
22749
|
+
const content = readFileSync9(filePath, "utf8");
|
|
22750
|
+
const row = getOrCreate(db, projectId);
|
|
22751
|
+
const updated = db.update(projectConfigs).set({ [field]: content, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq(projectConfigs.id, row.id)).returning().get();
|
|
22752
|
+
return toDto5(db, updated, field);
|
|
22753
|
+
}
|
|
22754
|
+
function reloadProjectEnvironment(db, workspacePath, projectId) {
|
|
22755
|
+
return reloadProjectConfigFromFile(
|
|
22756
|
+
db,
|
|
22757
|
+
workspacePath,
|
|
22758
|
+
projectId,
|
|
22759
|
+
"ENVIRONMENT.md",
|
|
22760
|
+
"environmentMd"
|
|
22761
|
+
);
|
|
22762
|
+
}
|
|
22763
|
+
function reloadProjectDevtool(db, workspacePath, projectId) {
|
|
22764
|
+
return reloadProjectConfigFromFile(db, workspacePath, projectId, "DEVTOOL.md", "devtoolMd");
|
|
22765
|
+
}
|
|
22745
22766
|
function adoptProjectConfig(db, projectId, content, importedBy) {
|
|
22746
22767
|
if (content.environmentMd === void 0 && content.devtoolMd === void 0) return;
|
|
22747
22768
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -22868,8 +22889,8 @@ function getBrainstormMd(db, workspacePath, projectId) {
|
|
|
22868
22889
|
project.workspaceFolderName,
|
|
22869
22890
|
`${project.workspaceFolderName}.brainstorm.md`
|
|
22870
22891
|
);
|
|
22871
|
-
if (!
|
|
22872
|
-
return { content:
|
|
22892
|
+
if (!existsSync15(filePath)) throw svcError10("BRAINSTORM_MD_MISSING", 404);
|
|
22893
|
+
return { content: readFileSync10(filePath, "utf8"), filePath };
|
|
22873
22894
|
}
|
|
22874
22895
|
function updateBrainstormMd(db, workspacePath, projectId, content) {
|
|
22875
22896
|
const project = db.select().from(projects).where(eq(projects.id, projectId)).limit(1).get();
|
|
@@ -22922,7 +22943,7 @@ function getProjectDetail(db, workspacePath, projectId) {
|
|
|
22922
22943
|
project.workspaceFolderName,
|
|
22923
22944
|
`${project.workspaceFolderName}.brainstorm.md`
|
|
22924
22945
|
);
|
|
22925
|
-
if (
|
|
22946
|
+
if (existsSync15(brainstormMdPath) && isBrainstormSessionCompleted(readFileSync10(brainstormMdPath, "utf8"))) {
|
|
22926
22947
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
22927
22948
|
db.update(projects).set({ creationStatus: "fully_created", updatedAt: now }).where(eq(projects.id, projectId)).run();
|
|
22928
22949
|
creationStatus = "fully_created";
|
|
@@ -23078,9 +23099,9 @@ function rescanClaudeMd(db, workspacePath, projectId) {
|
|
|
23078
23099
|
const claudeMdPath = [
|
|
23079
23100
|
join16(projectDir2, "CLAUDE.md"),
|
|
23080
23101
|
join16(projectDir2, "source", "CLAUDE.md")
|
|
23081
|
-
].find((p) =>
|
|
23102
|
+
].find((p) => existsSync15(p));
|
|
23082
23103
|
if (!claudeMdPath) throw svcError10("CLAUDE_MD_MISSING", 404);
|
|
23083
|
-
const content =
|
|
23104
|
+
const content = readFileSync10(claudeMdPath, "utf8");
|
|
23084
23105
|
const names = parseApplicationNames(content);
|
|
23085
23106
|
const known = new Set(
|
|
23086
23107
|
db.select({ name: applications.name }).from(applications).where(eq(applications.projectId, projectId)).all().map((r) => toKebabCase(r.name))
|
|
@@ -23412,7 +23433,7 @@ function dashboardRoutes(db) {
|
|
|
23412
23433
|
}
|
|
23413
23434
|
|
|
23414
23435
|
// ../server/src/features/defect/service.ts
|
|
23415
|
-
import { existsSync as
|
|
23436
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync7, readFileSync as readFileSync11, writeFileSync as writeFileSync9 } from "fs";
|
|
23416
23437
|
import { join as join17 } from "path";
|
|
23417
23438
|
|
|
23418
23439
|
// ../server/src/features/project-import/bug-md.ts
|
|
@@ -23848,10 +23869,10 @@ function writeBugMdFile(db, workspacePath, app, projectFolderName) {
|
|
|
23848
23869
|
return { content, bugCount: bugs.length };
|
|
23849
23870
|
}
|
|
23850
23871
|
function syncBugStatusesFromMaster(db, trackingFilePath, applicationId) {
|
|
23851
|
-
if (!
|
|
23872
|
+
if (!existsSync16(trackingFilePath)) return 0;
|
|
23852
23873
|
let entries;
|
|
23853
23874
|
try {
|
|
23854
|
-
entries = parseBugMaster(
|
|
23875
|
+
entries = parseBugMaster(readFileSync11(trackingFilePath, "utf8"));
|
|
23855
23876
|
} catch {
|
|
23856
23877
|
return 0;
|
|
23857
23878
|
}
|
|
@@ -23879,14 +23900,14 @@ function syncBugMdToDisk(db, workspacePath, applicationId, bugId, mode = "replac
|
|
|
23879
23900
|
if (bugId !== void 0) {
|
|
23880
23901
|
const projectDir2 = join17(workspacePath, project.workspaceFolderName);
|
|
23881
23902
|
const file = join17(projectDir2, resolveAppFolderName(projectDir2, app.name), "context", "BUG.md");
|
|
23882
|
-
if (
|
|
23903
|
+
if (existsSync16(file)) {
|
|
23883
23904
|
const bug = db.select().from(bugReports).where(and(eq(bugReports.id, bugId), eq(bugReports.isDeleted, 0))).get();
|
|
23884
23905
|
if (bug) {
|
|
23885
23906
|
const semver = (bug.prdVersionId !== null ? db.select({ semver: prdVersions.semver }).from(prdVersions).where(eq(prdVersions.id, bug.prdVersionId)).get()?.semver : void 0) ?? "v1.0.0";
|
|
23886
23907
|
const category = (bug.module ? db.select({ name: projectModules.name, category: projectModules.category }).from(projectModules).where(
|
|
23887
23908
|
and(eq(projectModules.applicationId, app.id), eq(projectModules.isDeleted, 0))
|
|
23888
23909
|
).all().find((m) => m.name.toLowerCase() === bug.module?.toLowerCase())?.category : void 0) ?? null;
|
|
23889
|
-
const merged = mergeBugIntoBugMd(
|
|
23910
|
+
const merged = mergeBugIntoBugMd(readFileSync11(file, "utf8"), bug, semver, category, mode);
|
|
23890
23911
|
if (merged !== null) {
|
|
23891
23912
|
writeFileSync9(file, merged, "utf8");
|
|
23892
23913
|
return;
|
|
@@ -24022,7 +24043,7 @@ function defectRoutes(db, workspacePath) {
|
|
|
24022
24043
|
}
|
|
24023
24044
|
|
|
24024
24045
|
// ../server/src/features/document/service.ts
|
|
24025
|
-
import { existsSync as
|
|
24046
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync8, readFileSync as readFileSync12, writeFileSync as writeFileSync10 } from "fs";
|
|
24026
24047
|
import { join as join18 } from "path";
|
|
24027
24048
|
function svcError12(code, status) {
|
|
24028
24049
|
return Object.assign(new Error(code), { code, status });
|
|
@@ -24053,8 +24074,8 @@ function getDocumentContent(db, dataDir, documentId) {
|
|
|
24053
24074
|
const doc = db.select().from(documents).where(and(eq(documents.id, documentId), eq(documents.isDeleted, 0))).limit(1).get();
|
|
24054
24075
|
if (!doc) throw svcError12("NOT_FOUND", 404);
|
|
24055
24076
|
const fullPath = join18(dataDir, "files", doc.relativePath);
|
|
24056
|
-
if (!
|
|
24057
|
-
return { mimeType: doc.mimeType, bytes:
|
|
24077
|
+
if (!existsSync17(fullPath)) throw svcError12("FILE_MISSING", 404);
|
|
24078
|
+
return { mimeType: doc.mimeType, bytes: readFileSync12(fullPath), name: doc.name };
|
|
24058
24079
|
}
|
|
24059
24080
|
function listProjectDocuments(db, projectId) {
|
|
24060
24081
|
return db.select({
|
|
@@ -24122,7 +24143,7 @@ function documentRoutes(db, dataDir) {
|
|
|
24122
24143
|
|
|
24123
24144
|
// ../server/src/features/git/service.ts
|
|
24124
24145
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
24125
|
-
import { existsSync as
|
|
24146
|
+
import { existsSync as existsSync18, readFileSync as readFileSync13, rmSync, writeFileSync as writeFileSync11 } from "fs";
|
|
24126
24147
|
import { join as join19 } from "path";
|
|
24127
24148
|
var GitServiceError = class extends Error {
|
|
24128
24149
|
code;
|
|
@@ -24161,7 +24182,7 @@ function projectDir(db, workspacePath, projectId) {
|
|
|
24161
24182
|
return join19(workspacePath, project.folder);
|
|
24162
24183
|
}
|
|
24163
24184
|
function isGitRepo(dir) {
|
|
24164
|
-
return
|
|
24185
|
+
return existsSync18(join19(dir, ".git"));
|
|
24165
24186
|
}
|
|
24166
24187
|
function classifyStatus(x, y) {
|
|
24167
24188
|
const conflictPairs = /* @__PURE__ */ new Set(["DD", "AU", "UD", "UA", "DU", "AA", "UU"]);
|
|
@@ -24225,7 +24246,7 @@ function getGitStatus(db, workspacePath, projectId) {
|
|
|
24225
24246
|
files: [],
|
|
24226
24247
|
changedCount: 0
|
|
24227
24248
|
};
|
|
24228
|
-
if (!
|
|
24249
|
+
if (!existsSync18(dir) || !isGitRepo(dir)) return empty;
|
|
24229
24250
|
let raw2;
|
|
24230
24251
|
try {
|
|
24231
24252
|
raw2 = execFileSync3("git", ["status", "--porcelain=v1", "-b", "-z"], {
|
|
@@ -24256,7 +24277,7 @@ function looksBinary(s) {
|
|
|
24256
24277
|
}
|
|
24257
24278
|
function getFileDiff(db, workspacePath, projectId, path) {
|
|
24258
24279
|
const dir = projectDir(db, workspacePath, projectId);
|
|
24259
|
-
if (!
|
|
24280
|
+
if (!existsSync18(dir) || !isGitRepo(dir)) {
|
|
24260
24281
|
throw new GitServiceError("NO_GIT_REPO", 404, "No git repository for this project");
|
|
24261
24282
|
}
|
|
24262
24283
|
const status = getGitStatus(db, workspacePath, projectId);
|
|
@@ -24299,9 +24320,9 @@ function getFileDiff(db, workspacePath, projectId, path) {
|
|
|
24299
24320
|
}
|
|
24300
24321
|
function readWorking(dir, path) {
|
|
24301
24322
|
const abs = join19(dir, path);
|
|
24302
|
-
if (!
|
|
24323
|
+
if (!existsSync18(abs)) return null;
|
|
24303
24324
|
try {
|
|
24304
|
-
return
|
|
24325
|
+
return readFileSync13(abs, "utf8");
|
|
24305
24326
|
} catch {
|
|
24306
24327
|
return null;
|
|
24307
24328
|
}
|
|
@@ -24319,7 +24340,7 @@ function withIdentityHint(message) {
|
|
|
24319
24340
|
}
|
|
24320
24341
|
function commitChanges(db, workspacePath, projectId, input, userId) {
|
|
24321
24342
|
const dir = projectDir(db, workspacePath, projectId);
|
|
24322
|
-
if (!
|
|
24343
|
+
if (!existsSync18(dir) || !isGitRepo(dir)) {
|
|
24323
24344
|
throw new GitServiceError("NO_GIT_REPO", 404, "No git repository for this project");
|
|
24324
24345
|
}
|
|
24325
24346
|
try {
|
|
@@ -24345,7 +24366,7 @@ function commitChanges(db, workspacePath, projectId, input, userId) {
|
|
|
24345
24366
|
}
|
|
24346
24367
|
function discardChanges(db, workspacePath, projectId, paths) {
|
|
24347
24368
|
const dir = projectDir(db, workspacePath, projectId);
|
|
24348
|
-
if (!
|
|
24369
|
+
if (!existsSync18(dir) || !isGitRepo(dir)) {
|
|
24349
24370
|
throw new GitServiceError("NO_GIT_REPO", 404, "No git repository for this project");
|
|
24350
24371
|
}
|
|
24351
24372
|
for (const path of paths) {
|
|
@@ -24359,13 +24380,13 @@ function discardChanges(db, workspacePath, projectId, paths) {
|
|
|
24359
24380
|
}
|
|
24360
24381
|
} else {
|
|
24361
24382
|
const abs = join19(dir, path);
|
|
24362
|
-
if (
|
|
24383
|
+
if (existsSync18(abs)) rmSync(abs, { force: true });
|
|
24363
24384
|
}
|
|
24364
24385
|
}
|
|
24365
24386
|
}
|
|
24366
24387
|
function resolveConflict(db, workspacePath, projectId, input) {
|
|
24367
24388
|
const dir = projectDir(db, workspacePath, projectId);
|
|
24368
|
-
if (!
|
|
24389
|
+
if (!existsSync18(dir) || !isGitRepo(dir)) {
|
|
24369
24390
|
throw new GitServiceError("NO_GIT_REPO", 404, "No git repository for this project");
|
|
24370
24391
|
}
|
|
24371
24392
|
try {
|
|
@@ -24590,6 +24611,15 @@ function projectConfigRoutes(db, workspacePath) {
|
|
|
24590
24611
|
}
|
|
24591
24612
|
}
|
|
24592
24613
|
);
|
|
24614
|
+
app.post("/:projectId/environment/reload", (c) => {
|
|
24615
|
+
const projectId = parseProjectId2(c);
|
|
24616
|
+
if (projectId === null) return c.json({ code: "INVALID_ID" }, 400);
|
|
24617
|
+
try {
|
|
24618
|
+
return c.json(reloadProjectEnvironment(db, workspacePath, projectId));
|
|
24619
|
+
} catch (e) {
|
|
24620
|
+
return errorResponse9(c, e);
|
|
24621
|
+
}
|
|
24622
|
+
});
|
|
24593
24623
|
app.get("/:projectId/devtool", (c) => {
|
|
24594
24624
|
const projectId = parseProjectId2(c);
|
|
24595
24625
|
if (projectId === null) return c.json({ code: "INVALID_ID" }, 400);
|
|
@@ -24626,11 +24656,20 @@ function projectConfigRoutes(db, workspacePath) {
|
|
|
24626
24656
|
}
|
|
24627
24657
|
}
|
|
24628
24658
|
);
|
|
24659
|
+
app.post("/:projectId/devtool/reload", (c) => {
|
|
24660
|
+
const projectId = parseProjectId2(c);
|
|
24661
|
+
if (projectId === null) return c.json({ code: "INVALID_ID" }, 400);
|
|
24662
|
+
try {
|
|
24663
|
+
return c.json(reloadProjectDevtool(db, workspacePath, projectId));
|
|
24664
|
+
} catch (e) {
|
|
24665
|
+
return errorResponse9(c, e);
|
|
24666
|
+
}
|
|
24667
|
+
});
|
|
24629
24668
|
return app;
|
|
24630
24669
|
}
|
|
24631
24670
|
|
|
24632
24671
|
// ../server/src/features/project-import/scanner.ts
|
|
24633
|
-
import { existsSync as
|
|
24672
|
+
import { existsSync as existsSync19, readFileSync as readFileSync14, readdirSync as readdirSync3, statSync as statSync5 } from "fs";
|
|
24634
24673
|
import { join as join20 } from "path";
|
|
24635
24674
|
|
|
24636
24675
|
// ../server/src/features/project-import/changelog-md.ts
|
|
@@ -24779,7 +24818,7 @@ function svcError13(code, status) {
|
|
|
24779
24818
|
return Object.assign(new Error(code), { code, status });
|
|
24780
24819
|
}
|
|
24781
24820
|
function readIfExists(path) {
|
|
24782
|
-
return
|
|
24821
|
+
return existsSync19(path) ? readFileSync14(path, "utf8") : null;
|
|
24783
24822
|
}
|
|
24784
24823
|
function emptyArtifactCounts() {
|
|
24785
24824
|
return { erd: 0, data_model: 0, mockup: 0, technical_spec: 0, test_spec: 0, source_code: 0 };
|
|
@@ -24788,18 +24827,18 @@ function countArtifacts(appDir) {
|
|
|
24788
24827
|
const counts = emptyArtifactCounts();
|
|
24789
24828
|
const contextDir = join20(appDir, "context");
|
|
24790
24829
|
const modelDir = join20(contextDir, "model");
|
|
24791
|
-
if (
|
|
24830
|
+
if (existsSync19(modelDir)) {
|
|
24792
24831
|
for (const slug of readdirSync3(modelDir)) {
|
|
24793
24832
|
try {
|
|
24794
24833
|
if (!statSync5(join20(modelDir, slug)).isDirectory()) continue;
|
|
24795
24834
|
} catch {
|
|
24796
24835
|
continue;
|
|
24797
24836
|
}
|
|
24798
|
-
if (
|
|
24837
|
+
if (existsSync19(join20(modelDir, slug, "erd.mermaid")) || existsSync19(join20(modelDir, slug, "document-model.mermaid")))
|
|
24799
24838
|
counts.erd++;
|
|
24800
|
-
if (
|
|
24801
|
-
if (
|
|
24802
|
-
if (
|
|
24839
|
+
if (existsSync19(join20(modelDir, slug, "model.md"))) counts.data_model++;
|
|
24840
|
+
if (existsSync19(join20(contextDir, "specification", slug, "SPEC.md"))) counts.technical_spec++;
|
|
24841
|
+
if (existsSync19(join20(contextDir, "test", slug, "TEST_SPEC.md"))) counts.test_spec++;
|
|
24803
24842
|
}
|
|
24804
24843
|
}
|
|
24805
24844
|
for (const [sub, key, file] of [
|
|
@@ -24807,29 +24846,29 @@ function countArtifacts(appDir) {
|
|
|
24807
24846
|
["test", "test_spec", "TEST_SPEC.md"]
|
|
24808
24847
|
]) {
|
|
24809
24848
|
const dir = join20(contextDir, sub);
|
|
24810
|
-
if (!
|
|
24849
|
+
if (!existsSync19(dir)) continue;
|
|
24811
24850
|
let total = 0;
|
|
24812
24851
|
for (const slug of readdirSync3(dir)) {
|
|
24813
24852
|
try {
|
|
24814
|
-
if (statSync5(join20(dir, slug)).isDirectory() &&
|
|
24853
|
+
if (statSync5(join20(dir, slug)).isDirectory() && existsSync19(join20(dir, slug, file))) total++;
|
|
24815
24854
|
} catch {
|
|
24816
24855
|
}
|
|
24817
24856
|
}
|
|
24818
24857
|
counts[key] = Math.max(counts[key], total);
|
|
24819
24858
|
}
|
|
24820
|
-
if (
|
|
24859
|
+
if (existsSync19(join20(contextDir, "mockup", "MOCKUP.html")) || existsSync19(join20(contextDir, "mockup", "index.html")))
|
|
24821
24860
|
counts.mockup = 1;
|
|
24822
24861
|
counts.source_code = sweepSourceFiles(appDir).length;
|
|
24823
24862
|
return counts;
|
|
24824
24863
|
}
|
|
24825
24864
|
function findClaudeMd(folderDir) {
|
|
24826
|
-
if (
|
|
24827
|
-
if (
|
|
24865
|
+
if (existsSync19(join20(folderDir, "CLAUDE.md"))) return { relPath: "CLAUDE.md", prefix: "" };
|
|
24866
|
+
if (existsSync19(join20(folderDir, "source", "CLAUDE.md")))
|
|
24828
24867
|
return { relPath: "source/CLAUDE.md", prefix: "source" };
|
|
24829
24868
|
return null;
|
|
24830
24869
|
}
|
|
24831
24870
|
function listImportCandidates(db, workspacePath) {
|
|
24832
|
-
if (!
|
|
24871
|
+
if (!existsSync19(workspacePath)) return [];
|
|
24833
24872
|
const registered = new Set(
|
|
24834
24873
|
db.select({ folder: projects.workspaceFolderName }).from(projects).all().map((r) => r.folder)
|
|
24835
24874
|
);
|
|
@@ -24845,7 +24884,7 @@ function listImportCandidates(db, workspacePath) {
|
|
|
24845
24884
|
const found = findClaudeMd(dir);
|
|
24846
24885
|
if (!found) continue;
|
|
24847
24886
|
const detail2 = parseProjectDetail(
|
|
24848
|
-
|
|
24887
|
+
readFileSync14(join20(workspacePath, entry, found.relPath), "utf8")
|
|
24849
24888
|
);
|
|
24850
24889
|
candidates.push({
|
|
24851
24890
|
folderName: entry,
|
|
@@ -24860,10 +24899,10 @@ function scanRepo(db, workspacePath, folderName) {
|
|
|
24860
24899
|
const registered = db.select({ id: projects.id }).from(projects).where(eq(projects.workspaceFolderName, folderName)).limit(1).get();
|
|
24861
24900
|
if (registered) throw svcError13("FOLDER_ALREADY_IMPORTED", 409);
|
|
24862
24901
|
const folderDir = join20(workspacePath, folderName);
|
|
24863
|
-
const found =
|
|
24902
|
+
const found = existsSync19(folderDir) ? findClaudeMd(folderDir) : null;
|
|
24864
24903
|
if (!found) throw svcError13("CLAUDE_MD_MISSING", 404);
|
|
24865
24904
|
const repoRoot = found.prefix ? join20(folderDir, found.prefix) : folderDir;
|
|
24866
|
-
const claudeMdRaw =
|
|
24905
|
+
const claudeMdRaw = readFileSync14(join20(folderDir, found.relPath), "utf8");
|
|
24867
24906
|
const detail2 = parseProjectDetail(claudeMdRaw);
|
|
24868
24907
|
const claudeApps = parseClaudeMdApplications(claudeMdRaw);
|
|
24869
24908
|
const claudeModules = new Set(parseModuleNames(claudeMdRaw).map((m) => m.name));
|
|
@@ -24886,7 +24925,7 @@ function scanRepo(db, workspacePath, folderName) {
|
|
|
24886
24925
|
for (const claude of claudeApps) {
|
|
24887
24926
|
const name = toKebabCase(claude.heading);
|
|
24888
24927
|
const resolvedInRoot = resolveAppFolderName(repoRoot, name);
|
|
24889
|
-
const folderExists =
|
|
24928
|
+
const folderExists = existsSync19(join20(repoRoot, resolvedInRoot));
|
|
24890
24929
|
const folderRel = folderExists ? found.prefix ? `${found.prefix}/${resolvedInRoot}` : resolvedInRoot : null;
|
|
24891
24930
|
const appDir = folderRel ? join20(folderDir, folderRel) : null;
|
|
24892
24931
|
const prdRaw = appDir ? readIfExists(join20(appDir, "context", "PRD.md")) : null;
|
|
@@ -24908,8 +24947,8 @@ function scanRepo(db, workspacePath, folderName) {
|
|
|
24908
24947
|
for (const [, m] of bugMaster) if (m.semver) semverUnion.add(m.semver);
|
|
24909
24948
|
const preparePath = appDir ? join20(appDir, "context", "prepare", "PREPARE_MASTER.md") : "";
|
|
24910
24949
|
const developPath = appDir ? join20(appDir, "context", "develop", "IMPLEMENTATION_MASTER.md") : "";
|
|
24911
|
-
const prepareMasterExists = !!appDir &&
|
|
24912
|
-
const developMasterExists = !!appDir &&
|
|
24950
|
+
const prepareMasterExists = !!appDir && existsSync19(preparePath);
|
|
24951
|
+
const developMasterExists = !!appDir && existsSync19(developPath);
|
|
24913
24952
|
const prepareCompleted = prepareMasterExists && parseTrackingStatus(preparePath) === "COMPLETED";
|
|
24914
24953
|
const developCompleted = developMasterExists && parseTrackingStatus(developPath) === "COMPLETED";
|
|
24915
24954
|
const changelogRaw = appDir ? readIfExists(join20(appDir, "CHANGELOG.md")) : null;
|
|
@@ -24998,7 +25037,7 @@ function scanRepo(db, workspacePath, folderName) {
|
|
|
24998
25037
|
const devtoolMd = readIfExists(join20(repoRoot, "DEVTOOL.md")) ?? readIfExists(join20(folderDir, "DEVTOOL.md"));
|
|
24999
25038
|
const origin = readOriginUrl(folderDir);
|
|
25000
25039
|
const gitRemoteUrl = origin ? stripHttpsCredentials(origin) : origin;
|
|
25001
|
-
const defaultBranch =
|
|
25040
|
+
const defaultBranch = existsSync19(join20(folderDir, ".git")) ? detectTrunkBranch(folderDir, readCurrentBranch(folderDir)) : "main";
|
|
25002
25041
|
const gitProvider = /gitlab/i.test(gitRemoteUrl ?? "") ? "gitlab" : "github";
|
|
25003
25042
|
return {
|
|
25004
25043
|
folderName,
|
|
@@ -25057,7 +25096,7 @@ function scanProject(db, workspacePath, folderName) {
|
|
|
25057
25096
|
import { join as join22, relative as relative2 } from "path";
|
|
25058
25097
|
|
|
25059
25098
|
// ../server/src/features/workflow/service.ts
|
|
25060
|
-
import { existsSync as
|
|
25099
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync12 } from "fs";
|
|
25061
25100
|
import { join as join21, relative, resolve as resolve2, sep } from "path";
|
|
25062
25101
|
var ACTIVE_RUN_STATUSES = ["pending", "in_progress"];
|
|
25063
25102
|
function svcError14(code, status) {
|
|
@@ -25368,8 +25407,8 @@ function backfillWorkflowHistoryFromChangelogs(db, workspacePath, projectId) {
|
|
|
25368
25407
|
for (const app of apps) {
|
|
25369
25408
|
const appRel = resolveAppFolderName(projectDir2, app.name);
|
|
25370
25409
|
const changelogPath = join21(projectDir2, appRel, "CHANGELOG.md");
|
|
25371
|
-
if (!
|
|
25372
|
-
for (const entry of parseChangelogConductorEntries(
|
|
25410
|
+
if (!existsSync20(changelogPath)) continue;
|
|
25411
|
+
for (const entry of parseChangelogConductorEntries(readFileSync15(changelogPath, "utf8"))) {
|
|
25373
25412
|
collected.push({ appName: app.name, appRel, entry });
|
|
25374
25413
|
}
|
|
25375
25414
|
}
|
|
@@ -25530,8 +25569,8 @@ function getWorkflowRunFileContent(db, workspacePath, workflowMarkdownId) {
|
|
|
25530
25569
|
const absolute = resolve2(projectDir2, wfm.filePath);
|
|
25531
25570
|
if (absolute !== projectDir2 && !absolute.startsWith(projectDir2 + sep))
|
|
25532
25571
|
throw svcError14("INVALID_PATH", 400);
|
|
25533
|
-
if (!
|
|
25534
|
-
return { filePath: wfm.filePath, content:
|
|
25572
|
+
if (!existsSync20(absolute)) throw svcError14("FILE_NOT_FOUND", 404);
|
|
25573
|
+
return { filePath: wfm.filePath, content: readFileSync15(absolute, "utf-8") };
|
|
25535
25574
|
}
|
|
25536
25575
|
function getRunApplicationChangelog(db, workspacePath, workflowMarkdownId, appName) {
|
|
25537
25576
|
const wfm = db.select().from(workflowMarkdowns).where(eq(workflowMarkdowns.id, workflowMarkdownId)).get();
|
|
@@ -25551,11 +25590,11 @@ function getRunApplicationChangelog(db, workspacePath, workflowMarkdownId, appNa
|
|
|
25551
25590
|
const absolute = resolve2(projectDir2, appFolder, "CHANGELOG.md");
|
|
25552
25591
|
if (absolute !== projectDir2 && !absolute.startsWith(projectDir2 + sep))
|
|
25553
25592
|
throw svcError14("INVALID_PATH", 400);
|
|
25554
|
-
if (!
|
|
25593
|
+
if (!existsSync20(absolute)) throw svcError14("CHANGELOG_NOT_FOUND", 404);
|
|
25555
25594
|
return {
|
|
25556
25595
|
applicationName: appName,
|
|
25557
25596
|
filePath: relative(workspacePath, absolute).replace(/\\/g, "/"),
|
|
25558
|
-
content:
|
|
25597
|
+
content: readFileSync15(absolute, "utf-8")
|
|
25559
25598
|
};
|
|
25560
25599
|
}
|
|
25561
25600
|
function toDetail(db, projectFolder, wfm, workspacePath) {
|
|
@@ -25597,7 +25636,7 @@ function toDetail(db, projectFolder, wfm, workspacePath) {
|
|
|
25597
25636
|
return {
|
|
25598
25637
|
applicationName: appName,
|
|
25599
25638
|
status: r.status,
|
|
25600
|
-
trackingFileExists:
|
|
25639
|
+
trackingFileExists: existsSync20(trackingPath),
|
|
25601
25640
|
trackingFilePath: relative(workspacePath, trackingPath).replace(/\\/g, "/")
|
|
25602
25641
|
};
|
|
25603
25642
|
});
|
|
@@ -26128,7 +26167,7 @@ function projectRoutes(db, workspacePath) {
|
|
|
26128
26167
|
}
|
|
26129
26168
|
|
|
26130
26169
|
// ../server/src/features/shared-context/service.ts
|
|
26131
|
-
import { existsSync as
|
|
26170
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync10, readFileSync as readFileSync16, readdirSync as readdirSync4, statSync as statSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
26132
26171
|
import { join as join23, resolve as resolve3, sep as sep2 } from "path";
|
|
26133
26172
|
function svcError16(code, status) {
|
|
26134
26173
|
return Object.assign(new Error(code), { code, status });
|
|
@@ -26217,7 +26256,7 @@ function uploadFile(db, workspacePath, projectId, folder, file) {
|
|
|
26217
26256
|
if (file.bytes.length > MAX_DOCUMENT_BYTES) throw svcError16("FILE_TOO_LARGE", 413);
|
|
26218
26257
|
const root = resolveSharedRoot(db, workspacePath, projectId);
|
|
26219
26258
|
const dir = folder ? safeResolve(root, folder) : root;
|
|
26220
|
-
if (folder && !
|
|
26259
|
+
if (folder && !existsSync21(dir)) throw svcError16("FOLDER_NOT_FOUND", 404);
|
|
26221
26260
|
const safeName = sanitizeSegment(file.name);
|
|
26222
26261
|
writeFileSync13(join23(dir, safeName), file.bytes);
|
|
26223
26262
|
return { path: folder ? `${folder}/${safeName}` : safeName };
|
|
@@ -26225,15 +26264,15 @@ function uploadFile(db, workspacePath, projectId, folder, file) {
|
|
|
26225
26264
|
function getFileContent(db, workspacePath, projectId, relPath) {
|
|
26226
26265
|
const root = resolveSharedRoot(db, workspacePath, projectId);
|
|
26227
26266
|
const full = safeResolve(root, relPath);
|
|
26228
|
-
if (!
|
|
26267
|
+
if (!existsSync21(full) || !statSync6(full).isFile()) throw svcError16("NOT_FOUND", 404);
|
|
26229
26268
|
const name = relPath.split("/").pop() ?? relPath;
|
|
26230
|
-
return { mimeType: mimeForName(name), bytes:
|
|
26269
|
+
return { mimeType: mimeForName(name), bytes: readFileSync16(full), name };
|
|
26231
26270
|
}
|
|
26232
26271
|
function saveMarkdown(db, workspacePath, projectId, relPath, content) {
|
|
26233
26272
|
if (mimeForName(relPath) !== "text/markdown") throw svcError16("NOT_MARKDOWN", 400);
|
|
26234
26273
|
const root = resolveSharedRoot(db, workspacePath, projectId);
|
|
26235
26274
|
const full = safeResolve(root, relPath);
|
|
26236
|
-
if (!
|
|
26275
|
+
if (!existsSync21(full) || !statSync6(full).isFile()) throw svcError16("NOT_FOUND", 404);
|
|
26237
26276
|
writeFileSync13(full, content, "utf8");
|
|
26238
26277
|
}
|
|
26239
26278
|
|
|
@@ -27147,7 +27186,7 @@ function terminalRoutes(db) {
|
|
|
27147
27186
|
import { execSync } from "child_process";
|
|
27148
27187
|
|
|
27149
27188
|
// ../server/src/lib/claude-plugin.ts
|
|
27150
|
-
import { existsSync as
|
|
27189
|
+
import { existsSync as existsSync22, readFileSync as readFileSync17, readdirSync as readdirSync5 } from "fs";
|
|
27151
27190
|
import { homedir } from "os";
|
|
27152
27191
|
import { join as join24 } from "path";
|
|
27153
27192
|
var PLUGIN_NAME = "co2-skills";
|
|
@@ -27156,7 +27195,7 @@ function detectCo2SkillsPlugin(claudeDir = join24(homedir(), ".claude")) {
|
|
|
27156
27195
|
}
|
|
27157
27196
|
function readRegistry(claudeDir) {
|
|
27158
27197
|
try {
|
|
27159
|
-
const raw2 =
|
|
27198
|
+
const raw2 = readFileSync17(join24(claudeDir, "plugins", "installed_plugins.json"), "utf8");
|
|
27160
27199
|
const json = JSON.parse(raw2);
|
|
27161
27200
|
for (const [key, entries] of Object.entries(json.plugins ?? {})) {
|
|
27162
27201
|
if (!key.startsWith(`${PLUGIN_NAME}@`)) continue;
|
|
@@ -27170,7 +27209,7 @@ function readRegistry(claudeDir) {
|
|
|
27170
27209
|
}
|
|
27171
27210
|
function readCacheDir(claudeDir) {
|
|
27172
27211
|
const base = join24(claudeDir, "plugins", "cache", "co2", PLUGIN_NAME);
|
|
27173
|
-
if (!
|
|
27212
|
+
if (!existsSync22(base)) return { installed: false };
|
|
27174
27213
|
try {
|
|
27175
27214
|
const versions = readdirSync5(base).filter((d) => /^\d+\.\d+/.test(d)).sort();
|
|
27176
27215
|
return { installed: true, version: versions.at(-1) };
|
|
@@ -27224,7 +27263,7 @@ function workspaceRoutes(_db, config, port, host, workspacePath) {
|
|
|
27224
27263
|
}
|
|
27225
27264
|
|
|
27226
27265
|
// ../server/src/lib/config.ts
|
|
27227
|
-
import { existsSync as
|
|
27266
|
+
import { existsSync as existsSync23, readFileSync as readFileSync18, writeFileSync as writeFileSync14 } from "fs";
|
|
27228
27267
|
import { join as join25 } from "path";
|
|
27229
27268
|
var configSchema = external_exports.object({
|
|
27230
27269
|
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
@@ -27234,9 +27273,9 @@ var configSchema = external_exports.object({
|
|
|
27234
27273
|
});
|
|
27235
27274
|
function loadConfig(dataDir) {
|
|
27236
27275
|
const file = join25(dataDir, "config.json");
|
|
27237
|
-
if (!
|
|
27276
|
+
if (!existsSync23(file)) return {};
|
|
27238
27277
|
try {
|
|
27239
|
-
return configSchema.parse(JSON.parse(
|
|
27278
|
+
return configSchema.parse(JSON.parse(readFileSync18(file, "utf8")));
|
|
27240
27279
|
} catch {
|
|
27241
27280
|
return {};
|
|
27242
27281
|
}
|
|
@@ -27289,7 +27328,7 @@ function loggerMiddleware() {
|
|
|
27289
27328
|
}
|
|
27290
27329
|
|
|
27291
27330
|
// ../server/src/lib/static.ts
|
|
27292
|
-
import { existsSync as
|
|
27331
|
+
import { existsSync as existsSync24, readFileSync as readFileSync19, statSync as statSync7 } from "fs";
|
|
27293
27332
|
import { extname, join as join26, normalize, resolve as resolve4, sep as sep3 } from "path";
|
|
27294
27333
|
var MIME = {
|
|
27295
27334
|
".html": "text/html; charset=utf-8",
|
|
@@ -27327,14 +27366,14 @@ function serveSpa(staticDir) {
|
|
|
27327
27366
|
}
|
|
27328
27367
|
const rel = path === "/" ? "/index.html" : decodeURIComponent(path);
|
|
27329
27368
|
const filePath = safeResolve2(staticDir, rel);
|
|
27330
|
-
if (filePath &&
|
|
27331
|
-
const body =
|
|
27369
|
+
if (filePath && existsSync24(filePath) && statSync7(filePath).isFile()) {
|
|
27370
|
+
const body = readFileSync19(filePath);
|
|
27332
27371
|
return c.body(body, 200, {
|
|
27333
27372
|
"Content-Type": MIME[extname(filePath)] ?? "application/octet-stream"
|
|
27334
27373
|
});
|
|
27335
27374
|
}
|
|
27336
|
-
if (
|
|
27337
|
-
return c.body(
|
|
27375
|
+
if (existsSync24(indexPath)) {
|
|
27376
|
+
return c.body(readFileSync19(indexPath), 200, { "Content-Type": "text/html; charset=utf-8" });
|
|
27338
27377
|
}
|
|
27339
27378
|
await next();
|
|
27340
27379
|
};
|
|
@@ -27387,7 +27426,7 @@ function createApp(db, opts) {
|
|
|
27387
27426
|
}
|
|
27388
27427
|
|
|
27389
27428
|
// ../server/src/db/index.ts
|
|
27390
|
-
import { existsSync as
|
|
27429
|
+
import { existsSync as existsSync25 } from "fs";
|
|
27391
27430
|
import { dirname as dirname2, join as join27 } from "path";
|
|
27392
27431
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
27393
27432
|
import Database from "better-sqlite3";
|
|
@@ -27599,7 +27638,7 @@ function resolveMigrationsFolder() {
|
|
|
27599
27638
|
join27(here, "drizzle")
|
|
27600
27639
|
].filter((c) => Boolean(c));
|
|
27601
27640
|
for (const c of candidates) {
|
|
27602
|
-
if (
|
|
27641
|
+
if (existsSync25(join27(c, "meta", "_journal.json"))) return c;
|
|
27603
27642
|
}
|
|
27604
27643
|
return join27(here, "../../drizzle");
|
|
27605
27644
|
}
|
|
@@ -28303,7 +28342,7 @@ var startOptionsSchema = external_exports.object({
|
|
|
28303
28342
|
});
|
|
28304
28343
|
function resolveStaticDir() {
|
|
28305
28344
|
const dir = join29(dirname3(fileURLToPath3(import.meta.url)), "../static");
|
|
28306
|
-
return
|
|
28345
|
+
return existsSync26(join29(dir, "index.html")) ? dir : void 0;
|
|
28307
28346
|
}
|
|
28308
28347
|
function registerStart(program3, version2) {
|
|
28309
28348
|
program3.command("start").description("Start the co2-cli web application (foreground)").option("-p, --port <n>", "Listen port (default: 3001)").option("-H, --host <addr>", "Listen host (default: 0.0.0.0 for LAN access)").option("-d, --data-dir <path>", "Override the data directory").option("-w, --workspace-path <path>", "Override the Workspace root folder").action(async (rawOpts) => {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-DGG6Q3Wn.js";import{p as f}from"./chunk-JWPE2WC7-CnNRXdvN.js";import{_ as n,l as o}from"./index-GEUFVo96.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-BTMYzKLg.js";var v=d().RailroadAbnf.parser.LangiumParser,l=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),i=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:i,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return l(e.element);case"AbnfOptionalGroup":return{type:"optional",element:l(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:l(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},w={parser:R,db:a,renderer:u,styles:p};export{w as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Y as ln,$ as an,a0 as y,a1 as tn,a2 as F,a3 as q,a4 as _,a5 as un,a6 as rn,a7 as J,a8 as o,a9 as j,aa as sn,ab as on,ac as fn}from"./index-
|
|
1
|
+
import{Y as ln,$ as an,a0 as y,a1 as tn,a2 as F,a3 as q,a4 as _,a5 as un,a6 as rn,a7 as J,a8 as o,a9 as j,aa as sn,ab as on,ac as fn}from"./index-GEUFVo96.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(fn(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,B=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<rn)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(on((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|