dominds 1.3.1 → 1.4.2
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/README.md +9 -2
- package/README.zh.md +9 -2
- package/dist/apps/app-lock-file.js +33 -57
- package/dist/apps/configuration-file.js +267 -0
- package/dist/apps/enabled-apps.js +217 -252
- package/dist/apps/manifest.js +132 -0
- package/dist/apps/resolution-file.js +80 -192
- package/dist/apps/workspace-app-state.js +8 -0
- package/dist/cli/disable.js +18 -22
- package/dist/cli/enable.js +20 -58
- package/dist/cli/install.js +74 -80
- package/dist/cli/uninstall.js +48 -25
- package/dist/cli/update.js +36 -80
- package/dist/docs/app-constitution.md +12 -7
- package/dist/docs/app-constitution.zh.md +13 -8
- package/dist/llm/kernel-driver/engine.js +10 -4
- package/dist/llm/kernel-driver/flow.js +93 -0
- package/dist/llm/kernel-driver/loop.js +4 -1
- package/dist/llm/kernel-driver/subdialog.js +5 -1
- package/dist/llm/kernel-driver/tellask-special.js +48 -6
- package/dist/server/server-core.js +19 -4
- package/dist/server/websocket-handler.js +26 -6
- package/dist/static/assets/{_basePickBy-CmziIRM9.js → _basePickBy-B2o4z1Hf.js} +3 -3
- package/dist/static/assets/{_basePickBy-CmziIRM9.js.map → _basePickBy-B2o4z1Hf.js.map} +1 -1
- package/dist/static/assets/{_baseUniq-CgDZxcD0.js → _baseUniq-CLmcxjdl.js} +2 -2
- package/dist/static/assets/{_baseUniq-CgDZxcD0.js.map → _baseUniq-CLmcxjdl.js.map} +1 -1
- package/dist/static/assets/{arc-Df9rjNNk.js → arc-CymD_KN7.js} +2 -2
- package/dist/static/assets/{arc-Df9rjNNk.js.map → arc-CymD_KN7.js.map} +1 -1
- package/dist/static/assets/{architectureDiagram-VXUJARFQ-Bif8topC.js → architectureDiagram-VXUJARFQ-DJQfSJUH.js} +7 -7
- package/dist/static/assets/{architectureDiagram-VXUJARFQ-Bif8topC.js.map → architectureDiagram-VXUJARFQ-DJQfSJUH.js.map} +1 -1
- package/dist/static/assets/{blockDiagram-VD42YOAC-D9Egoflr.js → blockDiagram-VD42YOAC-pHVz60D0.js} +7 -7
- package/dist/static/assets/{blockDiagram-VD42YOAC-D9Egoflr.js.map → blockDiagram-VD42YOAC-pHVz60D0.js.map} +1 -1
- package/dist/static/assets/{c4Diagram-YG6GDRKO-DBf1NeBf.js → c4Diagram-YG6GDRKO-B0WnCfAT.js} +3 -3
- package/dist/static/assets/{c4Diagram-YG6GDRKO-DBf1NeBf.js.map → c4Diagram-YG6GDRKO-B0WnCfAT.js.map} +1 -1
- package/dist/static/assets/{channel-Dc34yAJl.js → channel-CX9BlKil.js} +2 -2
- package/dist/static/assets/{channel-Dc34yAJl.js.map → channel-CX9BlKil.js.map} +1 -1
- package/dist/static/assets/{chunk-4BX2VUAB-B65G1dJI.js → chunk-4BX2VUAB-lXArRj3o.js} +2 -2
- package/dist/static/assets/{chunk-4BX2VUAB-B65G1dJI.js.map → chunk-4BX2VUAB-lXArRj3o.js.map} +1 -1
- package/dist/static/assets/{chunk-55IACEB6-CSDEOGl2.js → chunk-55IACEB6-CdqwynH9.js} +2 -2
- package/dist/static/assets/{chunk-55IACEB6-CSDEOGl2.js.map → chunk-55IACEB6-CdqwynH9.js.map} +1 -1
- package/dist/static/assets/{chunk-B4BG7PRW-Cb6W3QWJ.js → chunk-B4BG7PRW-Y-uXcJst.js} +5 -5
- package/dist/static/assets/{chunk-B4BG7PRW-Cb6W3QWJ.js.map → chunk-B4BG7PRW-Y-uXcJst.js.map} +1 -1
- package/dist/static/assets/{chunk-DI55MBZ5-ZAJWeVWH.js → chunk-DI55MBZ5-C5xSbRST.js} +4 -4
- package/dist/static/assets/{chunk-DI55MBZ5-ZAJWeVWH.js.map → chunk-DI55MBZ5-C5xSbRST.js.map} +1 -1
- package/dist/static/assets/{chunk-FMBD7UC4-DiwRlImb.js → chunk-FMBD7UC4-5uefwCjI.js} +2 -2
- package/dist/static/assets/{chunk-FMBD7UC4-DiwRlImb.js.map → chunk-FMBD7UC4-5uefwCjI.js.map} +1 -1
- package/dist/static/assets/{chunk-QN33PNHL-wilj7fb5.js → chunk-QN33PNHL-DzWVcvpI.js} +2 -2
- package/dist/static/assets/{chunk-QN33PNHL-wilj7fb5.js.map → chunk-QN33PNHL-DzWVcvpI.js.map} +1 -1
- package/dist/static/assets/{chunk-QZHKN3VN-DGmviJfR.js → chunk-QZHKN3VN-BrrvAZdP.js} +2 -2
- package/dist/static/assets/{chunk-QZHKN3VN-DGmviJfR.js.map → chunk-QZHKN3VN-BrrvAZdP.js.map} +1 -1
- package/dist/static/assets/{chunk-TZMSLE5B-Nm5wTXa_.js → chunk-TZMSLE5B-DyKOlPTY.js} +2 -2
- package/dist/static/assets/{chunk-TZMSLE5B-Nm5wTXa_.js.map → chunk-TZMSLE5B-DyKOlPTY.js.map} +1 -1
- package/dist/static/assets/{classDiagram-2ON5EDUG-BvUbXD6H.js → classDiagram-2ON5EDUG-FCrnlCWC.js} +6 -6
- package/dist/static/assets/{classDiagram-2ON5EDUG-BvUbXD6H.js.map → classDiagram-2ON5EDUG-FCrnlCWC.js.map} +1 -1
- package/dist/static/assets/{classDiagram-v2-WZHVMYZB-BvUbXD6H.js → classDiagram-v2-WZHVMYZB-FCrnlCWC.js} +6 -6
- package/dist/static/assets/{classDiagram-v2-WZHVMYZB-BvUbXD6H.js.map → classDiagram-v2-WZHVMYZB-FCrnlCWC.js.map} +1 -1
- package/dist/static/assets/{clone-0VLS7GaA.js → clone-BlI81KqZ.js} +2 -2
- package/dist/static/assets/{clone-0VLS7GaA.js.map → clone-BlI81KqZ.js.map} +1 -1
- package/dist/static/assets/{cose-bilkent-S5V4N54A-anaPs-75.js → cose-bilkent-S5V4N54A-yM7S2atz.js} +2 -2
- package/dist/static/assets/{cose-bilkent-S5V4N54A-anaPs-75.js.map → cose-bilkent-S5V4N54A-yM7S2atz.js.map} +1 -1
- package/dist/static/assets/{dagre-6UL2VRFP-YwdsZ11r.js → dagre-6UL2VRFP-BcweuZHt.js} +7 -7
- package/dist/static/assets/{dagre-6UL2VRFP-YwdsZ11r.js.map → dagre-6UL2VRFP-BcweuZHt.js.map} +1 -1
- package/dist/static/assets/{diagram-PSM6KHXK-5KQCf3h2.js → diagram-PSM6KHXK-D4-QwLW1.js} +8 -8
- package/dist/static/assets/{diagram-PSM6KHXK-5KQCf3h2.js.map → diagram-PSM6KHXK-D4-QwLW1.js.map} +1 -1
- package/dist/static/assets/{diagram-QEK2KX5R-Mf24XxZL.js → diagram-QEK2KX5R-BVbuejJn.js} +7 -7
- package/dist/static/assets/{diagram-QEK2KX5R-Mf24XxZL.js.map → diagram-QEK2KX5R-BVbuejJn.js.map} +1 -1
- package/dist/static/assets/{diagram-S2PKOQOG-DyQjD4D5.js → diagram-S2PKOQOG-pB6N6Tq_.js} +7 -7
- package/dist/static/assets/{diagram-S2PKOQOG-DyQjD4D5.js.map → diagram-S2PKOQOG-pB6N6Tq_.js.map} +1 -1
- package/dist/static/assets/{erDiagram-Q2GNP2WA-CEzTKw1u.js → erDiagram-Q2GNP2WA-DLKmthuw.js} +5 -5
- package/dist/static/assets/{erDiagram-Q2GNP2WA-CEzTKw1u.js.map → erDiagram-Q2GNP2WA-DLKmthuw.js.map} +1 -1
- package/dist/static/assets/{flowDiagram-NV44I4VS-DT821XSz.js → flowDiagram-NV44I4VS-BsBhWukh.js} +6 -6
- package/dist/static/assets/{flowDiagram-NV44I4VS-DT821XSz.js.map → flowDiagram-NV44I4VS-BsBhWukh.js.map} +1 -1
- package/dist/static/assets/{ganttDiagram-JELNMOA3-DlmeVsGg.js → ganttDiagram-JELNMOA3-Debz-J-C.js} +3 -3
- package/dist/static/assets/{ganttDiagram-JELNMOA3-DlmeVsGg.js.map → ganttDiagram-JELNMOA3-Debz-J-C.js.map} +1 -1
- package/dist/static/assets/{gitGraphDiagram-V2S2FVAM-yAfyBG_d.js → gitGraphDiagram-V2S2FVAM-BnAPFBGR.js} +8 -8
- package/dist/static/assets/{gitGraphDiagram-V2S2FVAM-yAfyBG_d.js.map → gitGraphDiagram-V2S2FVAM-BnAPFBGR.js.map} +1 -1
- package/dist/static/assets/{graph-BYv8vyWe.js → graph-DbzWiBNK.js} +3 -3
- package/dist/static/assets/{graph-BYv8vyWe.js.map → graph-DbzWiBNK.js.map} +1 -1
- package/dist/static/assets/{index-DMbwqOm6.js → index-B-8J28g7.js} +987 -1049
- package/dist/static/assets/index-B-8J28g7.js.map +1 -0
- package/dist/static/assets/{index-BiNcBn_U.css → index-CD5wtC_i.css} +1 -1
- package/dist/static/assets/{infoDiagram-HS3SLOUP-DaadramQ.js → infoDiagram-HS3SLOUP-CZ5hWoxV.js} +6 -6
- package/dist/static/assets/{infoDiagram-HS3SLOUP-DaadramQ.js.map → infoDiagram-HS3SLOUP-CZ5hWoxV.js.map} +1 -1
- package/dist/static/assets/{journeyDiagram-XKPGCS4Q-ftN8hxu3.js → journeyDiagram-XKPGCS4Q-CKN3oSxk.js} +5 -5
- package/dist/static/assets/{journeyDiagram-XKPGCS4Q-ftN8hxu3.js.map → journeyDiagram-XKPGCS4Q-CKN3oSxk.js.map} +1 -1
- package/dist/static/assets/{kanban-definition-3W4ZIXB7-BIXETQ-C.js → kanban-definition-3W4ZIXB7-BQCMklfJ.js} +3 -3
- package/dist/static/assets/{kanban-definition-3W4ZIXB7-BIXETQ-C.js.map → kanban-definition-3W4ZIXB7-BQCMklfJ.js.map} +1 -1
- package/dist/static/assets/{layout-OTbrj0Ye.js → layout-C5B58szc.js} +5 -5
- package/dist/static/assets/{layout-OTbrj0Ye.js.map → layout-C5B58szc.js.map} +1 -1
- package/dist/static/assets/{linear-CVfOC669.js → linear-_32fut6G.js} +2 -2
- package/dist/static/assets/{linear-CVfOC669.js.map → linear-_32fut6G.js.map} +1 -1
- package/dist/static/assets/{mindmap-definition-VGOIOE7T-D2zv5uI9.js → mindmap-definition-VGOIOE7T-C_goMzjx.js} +4 -4
- package/dist/static/assets/{mindmap-definition-VGOIOE7T-D2zv5uI9.js.map → mindmap-definition-VGOIOE7T-C_goMzjx.js.map} +1 -1
- package/dist/static/assets/{pieDiagram-ADFJNKIX-DaUXTsv7.js → pieDiagram-ADFJNKIX-BQ2n0cOB.js} +8 -8
- package/dist/static/assets/{pieDiagram-ADFJNKIX-DaUXTsv7.js.map → pieDiagram-ADFJNKIX-BQ2n0cOB.js.map} +1 -1
- package/dist/static/assets/{quadrantDiagram-AYHSOK5B-B7O2wPX9.js → quadrantDiagram-AYHSOK5B-BLg7_neg.js} +3 -3
- package/dist/static/assets/{quadrantDiagram-AYHSOK5B-B7O2wPX9.js.map → quadrantDiagram-AYHSOK5B-BLg7_neg.js.map} +1 -1
- package/dist/static/assets/{requirementDiagram-UZGBJVZJ-DpauVPY1.js → requirementDiagram-UZGBJVZJ-DwkJt0zi.js} +4 -4
- package/dist/static/assets/{requirementDiagram-UZGBJVZJ-DpauVPY1.js.map → requirementDiagram-UZGBJVZJ-DwkJt0zi.js.map} +1 -1
- package/dist/static/assets/{sankeyDiagram-TZEHDZUN-B3Hbfvad.js → sankeyDiagram-TZEHDZUN-DmxmatUB.js} +2 -2
- package/dist/static/assets/{sankeyDiagram-TZEHDZUN-B3Hbfvad.js.map → sankeyDiagram-TZEHDZUN-DmxmatUB.js.map} +1 -1
- package/dist/static/assets/{sequenceDiagram-WL72ISMW-KdbWByWT.js → sequenceDiagram-WL72ISMW-KHU_eApU.js} +4 -4
- package/dist/static/assets/{sequenceDiagram-WL72ISMW-KdbWByWT.js.map → sequenceDiagram-WL72ISMW-KHU_eApU.js.map} +1 -1
- package/dist/static/assets/{stateDiagram-FKZM4ZOC-yDOCVezC.js → stateDiagram-FKZM4ZOC-B3DBCxAL.js} +9 -9
- package/dist/static/assets/{stateDiagram-FKZM4ZOC-yDOCVezC.js.map → stateDiagram-FKZM4ZOC-B3DBCxAL.js.map} +1 -1
- package/dist/static/assets/{stateDiagram-v2-4FDKWEC3-CpCJhvQO.js → stateDiagram-v2-4FDKWEC3-C-uIk7gh.js} +5 -5
- package/dist/static/assets/{stateDiagram-v2-4FDKWEC3-CpCJhvQO.js.map → stateDiagram-v2-4FDKWEC3-C-uIk7gh.js.map} +1 -1
- package/dist/static/assets/{timeline-definition-IT6M3QCI-CHxuEjhV.js → timeline-definition-IT6M3QCI-SysEcQCC.js} +3 -3
- package/dist/static/assets/{timeline-definition-IT6M3QCI-CHxuEjhV.js.map → timeline-definition-IT6M3QCI-SysEcQCC.js.map} +1 -1
- package/dist/static/assets/{treemap-GDKQZRPO-Bsqu3wIy.js → treemap-GDKQZRPO-d0AbKEc4.js} +5 -5
- package/dist/static/assets/{treemap-GDKQZRPO-Bsqu3wIy.js.map → treemap-GDKQZRPO-d0AbKEc4.js.map} +1 -1
- package/dist/static/assets/{xychartDiagram-PRI3JC2R-RZy33lFF.js → xychartDiagram-PRI3JC2R-CmSQMxUh.js} +3 -3
- package/dist/static/assets/{xychartDiagram-PRI3JC2R-RZy33lFF.js.map → xychartDiagram-PRI3JC2R-CmSQMxUh.js.map} +1 -1
- package/dist/static/index.html +2 -2
- package/dist/tools/fs.js +1 -1
- package/package.json +9 -7
- package/dist/agent-priming.js +0 -2051
- package/dist/apps/installed-file.js +0 -207
- package/dist/apps/runtime-port.js +0 -91
- package/dist/docs/dominds-agent-priming.md +0 -218
- package/dist/docs/dominds-agent-priming.zh.md +0 -196
- package/dist/docs/drive-logic-context-refactor-plan.zh.md +0 -338
- package/dist/docs/keep-going.md +0 -176
- package/dist/docs/keep-going.zh.md +0 -162
- package/dist/docs/kernel-app-architecture.md +0 -286
- package/dist/docs/kernel-app-architecture.zh.md +0 -285
- package/dist/docs/showing-by-doing.md +0 -208
- package/dist/docs/showing-by-doing.zh.md +0 -177
- package/dist/docs/team-mgmt-toolset.md +0 -482
- package/dist/docs/team-mgmt-toolset.zh.md +0 -426
- package/dist/llm/driver-entry.js +0 -28
- package/dist/llm/driver-v2/context-health.js +0 -121
- package/dist/llm/driver-v2/context.js +0 -56
- package/dist/llm/driver-v2/core.js +0 -1545
- package/dist/llm/driver-v2/index.js +0 -26
- package/dist/llm/driver-v2/orchestrator.js +0 -158
- package/dist/llm/driver-v2/policy.js +0 -129
- package/dist/llm/driver-v2/restore-dialog-hierarchy.js +0 -73
- package/dist/llm/driver-v2/round.js +0 -366
- package/dist/llm/driver-v2/runtime-utils.js +0 -365
- package/dist/llm/driver-v2/saying-events.js +0 -20
- package/dist/llm/driver-v2/subdialog-txn.js +0 -42
- package/dist/llm/driver-v2/supdialog-response.js +0 -400
- package/dist/llm/driver-v2/tellask-bridge.js +0 -1148
- package/dist/llm/driver-v2/types.js +0 -10
- package/dist/llm/driver-v2-ref-only/context-health.js +0 -121
- package/dist/llm/driver-v2-ref-only/context.js +0 -17
- package/dist/llm/driver-v2-ref-only/core.js +0 -1710
- package/dist/llm/driver-v2-ref-only/index.js +0 -26
- package/dist/llm/driver-v2-ref-only/orchestrator.js +0 -158
- package/dist/llm/driver-v2-ref-only/policy.js +0 -129
- package/dist/llm/driver-v2-ref-only/restore-dialog-hierarchy.js +0 -73
- package/dist/llm/driver-v2-ref-only/round.js +0 -366
- package/dist/llm/driver-v2-ref-only/runtime-utils.js +0 -473
- package/dist/llm/driver-v2-ref-only/saying-events.js +0 -18
- package/dist/llm/driver-v2-ref-only/subdialog-txn.js +0 -42
- package/dist/llm/driver-v2-ref-only/supdialog-response.js +0 -453
- package/dist/llm/driver-v2-ref-only/tellask-bridge.js +0 -1178
- package/dist/llm/driver-v2-ref-only/types.js +0 -10
- package/dist/llm/driver.js +0 -4093
- package/dist/minds/promptdocs.js +0 -263
- package/dist/server/prompts-routes.js +0 -545
- package/dist/shared/team-mgmt-manual.js +0 -120
- package/dist/shared/types/prompts.js +0 -2
- package/dist/shared/types/tellask.js +0 -8
- package/dist/showing-by-doing.js +0 -1091
- package/dist/snippets/README.en.md +0 -3
- package/dist/snippets/README.md +0 -4
- package/dist/static/assets/index-DMbwqOm6.js.map +0 -1
- package/dist/tellask.js +0 -439
- package/dist/tools/context-health.js +0 -177
- package/dist/tools/diag.js +0 -583
- package/dist/tools/prompts/memory/en/errors.md +0 -155
- package/dist/tools/prompts/memory/en/index.md +0 -47
- package/dist/tools/prompts/memory/en/principles.md +0 -87
- package/dist/tools/prompts/memory/en/scenarios.md +0 -174
- package/dist/tools/prompts/memory/en/tools.md +0 -129
- package/dist/tools/prompts/memory/zh/errors.md +0 -155
- package/dist/tools/prompts/memory/zh/index.md +0 -47
- package/dist/tools/prompts/memory/zh/principles.md +0 -89
- package/dist/tools/prompts/memory/zh/scenarios.md +0 -174
- package/dist/tools/prompts/memory/zh/tools.md +0 -129
- package/dist/tools/team-mgmt.js +0 -3487
- package/dist/utils/task-doc.js +0 -236
package/dist/apps/manifest.js
CHANGED
|
@@ -3,12 +3,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_DOMINDS_APP_MANIFEST_REL_PATH = void 0;
|
|
7
|
+
exports.makeDefaultRtwsAppManifest = makeDefaultRtwsAppManifest;
|
|
6
8
|
exports.parseDomindsAppManifest = parseDomindsAppManifest;
|
|
7
9
|
exports.loadDomindsAppManifest = loadDomindsAppManifest;
|
|
10
|
+
exports.writeDomindsAppManifest = writeDomindsAppManifest;
|
|
11
|
+
exports.writeDomindsAppManifestIfChanged = writeDomindsAppManifestIfChanged;
|
|
12
|
+
exports.loadRtwsDeclaredAppDependencies = loadRtwsDeclaredAppDependencies;
|
|
13
|
+
exports.hasRtwsDeclaredAppDependency = hasRtwsDeclaredAppDependency;
|
|
14
|
+
exports.upsertManifestDependency = upsertManifestDependency;
|
|
15
|
+
exports.removeManifestDependency = removeManifestDependency;
|
|
8
16
|
exports.resolveAppContribPaths = resolveAppContribPaths;
|
|
9
17
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
18
|
const path_1 = __importDefault(require("path"));
|
|
11
19
|
const yaml_1 = __importDefault(require("yaml"));
|
|
20
|
+
exports.DEFAULT_DOMINDS_APP_MANIFEST_REL_PATH = '.minds/app.yaml';
|
|
21
|
+
function makeDefaultRtwsAppManifest(id = 'rtws_root') {
|
|
22
|
+
return {
|
|
23
|
+
apiVersion: 'dominds.io/v1alpha1',
|
|
24
|
+
kind: 'DomindsApp',
|
|
25
|
+
id,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async function fileExists(filePathAbs) {
|
|
29
|
+
try {
|
|
30
|
+
await promises_1.default.access(filePathAbs);
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
const isEnoent = typeof err === 'object' &&
|
|
35
|
+
err !== null &&
|
|
36
|
+
'code' in err &&
|
|
37
|
+
err.code === 'ENOENT';
|
|
38
|
+
if (isEnoent)
|
|
39
|
+
return false;
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
12
43
|
function isRecord(v) {
|
|
13
44
|
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
14
45
|
}
|
|
@@ -273,6 +304,107 @@ async function loadDomindsAppManifest(params) {
|
|
|
273
304
|
}
|
|
274
305
|
return { kind: 'ok', manifest: normalized.manifest, raw, filePathAbs };
|
|
275
306
|
}
|
|
307
|
+
function canonicalizeManifest(manifest) {
|
|
308
|
+
const dependencies = (() => {
|
|
309
|
+
if (!manifest.dependencies)
|
|
310
|
+
return undefined;
|
|
311
|
+
const byId = new Map();
|
|
312
|
+
for (const dep of manifest.dependencies) {
|
|
313
|
+
const id = dep.id.trim();
|
|
314
|
+
if (id === '')
|
|
315
|
+
continue;
|
|
316
|
+
byId.set(id, { id, optional: dep.optional === true ? true : undefined });
|
|
317
|
+
}
|
|
318
|
+
const normalized = [...byId.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
319
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
320
|
+
})();
|
|
321
|
+
return {
|
|
322
|
+
apiVersion: manifest.apiVersion,
|
|
323
|
+
kind: manifest.kind,
|
|
324
|
+
id: manifest.id,
|
|
325
|
+
dependencies: dependencies && dependencies.length > 0 ? dependencies : undefined,
|
|
326
|
+
name: manifest.name,
|
|
327
|
+
description: manifest.description,
|
|
328
|
+
contributes: manifest.contributes,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
async function writeDomindsAppManifest(params) {
|
|
332
|
+
const filePathAbs = path_1.default.resolve(params.packageRootAbs, params.manifestRelPath);
|
|
333
|
+
await promises_1.default.mkdir(path_1.default.dirname(filePathAbs), { recursive: true });
|
|
334
|
+
const yamlText = yaml_1.default.stringify(canonicalizeManifest(params.manifest));
|
|
335
|
+
await promises_1.default.writeFile(filePathAbs, yamlText, 'utf-8');
|
|
336
|
+
}
|
|
337
|
+
async function writeDomindsAppManifestIfChanged(params) {
|
|
338
|
+
const filePathAbs = path_1.default.resolve(params.packageRootAbs, params.manifestRelPath);
|
|
339
|
+
await promises_1.default.mkdir(path_1.default.dirname(filePathAbs), { recursive: true });
|
|
340
|
+
const yamlText = yaml_1.default.stringify(canonicalizeManifest(params.manifest));
|
|
341
|
+
try {
|
|
342
|
+
const prev = await promises_1.default.readFile(filePathAbs, 'utf-8');
|
|
343
|
+
if (prev === yamlText)
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
catch (err) {
|
|
347
|
+
const isEnoent = typeof err === 'object' &&
|
|
348
|
+
err !== null &&
|
|
349
|
+
'code' in err &&
|
|
350
|
+
err.code === 'ENOENT';
|
|
351
|
+
if (!isEnoent)
|
|
352
|
+
throw err;
|
|
353
|
+
}
|
|
354
|
+
await promises_1.default.writeFile(filePathAbs, yamlText, 'utf-8');
|
|
355
|
+
}
|
|
356
|
+
async function loadRtwsDeclaredAppDependencies(params) {
|
|
357
|
+
const filePathAbs = path_1.default.resolve(params.rtwsRootAbs, exports.DEFAULT_DOMINDS_APP_MANIFEST_REL_PATH);
|
|
358
|
+
if (!(await fileExists(filePathAbs)))
|
|
359
|
+
return [];
|
|
360
|
+
const loaded = await loadDomindsAppManifest({
|
|
361
|
+
packageRootAbs: params.rtwsRootAbs,
|
|
362
|
+
manifestRelPath: exports.DEFAULT_DOMINDS_APP_MANIFEST_REL_PATH,
|
|
363
|
+
});
|
|
364
|
+
if (loaded.kind === 'error') {
|
|
365
|
+
throw new Error(`Failed to load rtws app manifest: ${loaded.errorText} (${loaded.filePathAbs})`);
|
|
366
|
+
}
|
|
367
|
+
return loaded.manifest.dependencies ?? [];
|
|
368
|
+
}
|
|
369
|
+
async function hasRtwsDeclaredAppDependency(params) {
|
|
370
|
+
const appId = params.appId.trim();
|
|
371
|
+
if (appId === '')
|
|
372
|
+
return false;
|
|
373
|
+
const deps = await loadRtwsDeclaredAppDependencies({ rtwsRootAbs: params.rtwsRootAbs });
|
|
374
|
+
return deps.some((dep) => dep.id === appId);
|
|
375
|
+
}
|
|
376
|
+
function upsertManifestDependency(params) {
|
|
377
|
+
const nextDep = {
|
|
378
|
+
id: params.dependency.id.trim(),
|
|
379
|
+
optional: params.dependency.optional === true ? true : undefined,
|
|
380
|
+
};
|
|
381
|
+
if (nextDep.id === '')
|
|
382
|
+
return params.manifest;
|
|
383
|
+
const deps = [...(params.manifest.dependencies ?? [])];
|
|
384
|
+
const idx = deps.findIndex((dep) => dep.id === nextDep.id);
|
|
385
|
+
if (idx >= 0) {
|
|
386
|
+
const prev = deps[idx];
|
|
387
|
+
if (prev && prev.optional === nextDep.optional)
|
|
388
|
+
return params.manifest;
|
|
389
|
+
deps[idx] = nextDep;
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
deps.push(nextDep);
|
|
393
|
+
}
|
|
394
|
+
return canonicalizeManifest({ ...params.manifest, dependencies: deps });
|
|
395
|
+
}
|
|
396
|
+
function removeManifestDependency(params) {
|
|
397
|
+
const dependencyId = params.dependencyId.trim();
|
|
398
|
+
if (dependencyId === '')
|
|
399
|
+
return params.manifest;
|
|
400
|
+
const prevDeps = params.manifest.dependencies ?? [];
|
|
401
|
+
if (!prevDeps.some((dep) => dep.id === dependencyId))
|
|
402
|
+
return params.manifest;
|
|
403
|
+
return canonicalizeManifest({
|
|
404
|
+
...params.manifest,
|
|
405
|
+
dependencies: prevDeps.filter((dep) => dep.id !== dependencyId),
|
|
406
|
+
});
|
|
407
|
+
}
|
|
276
408
|
function resolveAppContribPaths(params) {
|
|
277
409
|
const c = params.manifest.contributes;
|
|
278
410
|
const webStaticDirAbs = c?.web?.staticDir
|
|
@@ -3,26 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.APPS_RESOLUTION_REL_PATH =
|
|
6
|
+
exports.APPS_RESOLUTION_REL_PATH = void 0;
|
|
7
7
|
exports.loadAppsResolutionFile = loadAppsResolutionFile;
|
|
8
8
|
exports.writeAppsResolutionFile = writeAppsResolutionFile;
|
|
9
9
|
exports.writeAppsResolutionFileIfChanged = writeAppsResolutionFileIfChanged;
|
|
10
10
|
exports.findResolvedApp = findResolvedApp;
|
|
11
11
|
exports.upsertResolvedApp = upsertResolvedApp;
|
|
12
12
|
exports.removeResolvedApp = removeResolvedApp;
|
|
13
|
-
exports.
|
|
13
|
+
exports.setResolvedAppEnabled = setResolvedAppEnabled;
|
|
14
14
|
exports.setResolvedAppAssignedPort = setResolvedAppAssignedPort;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
18
|
-
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
16
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
19
17
|
const yaml_1 = __importDefault(require("yaml"));
|
|
20
18
|
const app_json_1 = require("./app-json");
|
|
21
|
-
exports.
|
|
22
|
-
order: ['local'],
|
|
23
|
-
localRoots: ['dominds-apps'],
|
|
24
|
-
};
|
|
25
|
-
exports.APPS_RESOLUTION_REL_PATH = path_1.default.join('.apps', 'resolution.yaml');
|
|
19
|
+
exports.APPS_RESOLUTION_REL_PATH = node_path_1.default.join('.apps', 'resolution.yaml');
|
|
26
20
|
function isRecord(v) {
|
|
27
21
|
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
28
22
|
}
|
|
@@ -39,73 +33,6 @@ function asNullableNumber(v) {
|
|
|
39
33
|
return v;
|
|
40
34
|
return null;
|
|
41
35
|
}
|
|
42
|
-
function parseResolutionStrategy(v, at) {
|
|
43
|
-
if (!isRecord(v))
|
|
44
|
-
return { ok: false, errorText: `Invalid ${at}: expected object` };
|
|
45
|
-
const keys = Object.keys(v);
|
|
46
|
-
for (const k of keys) {
|
|
47
|
-
if (k !== 'order' && k !== 'localRoots') {
|
|
48
|
-
return { ok: false, errorText: `Invalid ${at}: unknown key '${k}'` };
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const orderRaw = v['order'];
|
|
52
|
-
const order = (() => {
|
|
53
|
-
if (orderRaw === undefined)
|
|
54
|
-
return undefined;
|
|
55
|
-
if (!Array.isArray(orderRaw)) {
|
|
56
|
-
return { ok: false, errorText: `Invalid ${at}.order: expected array` };
|
|
57
|
-
}
|
|
58
|
-
const out = [];
|
|
59
|
-
for (let i = 0; i < orderRaw.length; i += 1) {
|
|
60
|
-
const item = orderRaw[i];
|
|
61
|
-
if (item !== 'local' && item !== 'npx') {
|
|
62
|
-
return {
|
|
63
|
-
ok: false,
|
|
64
|
-
errorText: `Invalid ${at}.order[${i}]: expected 'local'|'npx'`,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
out.push(item);
|
|
68
|
-
}
|
|
69
|
-
if (out.length === 0) {
|
|
70
|
-
return { ok: false, errorText: `Invalid ${at}.order: must not be empty` };
|
|
71
|
-
}
|
|
72
|
-
return { ok: true, value: out };
|
|
73
|
-
})();
|
|
74
|
-
if (order && !order.ok)
|
|
75
|
-
return order;
|
|
76
|
-
const localRootsRaw = v['localRoots'];
|
|
77
|
-
const localRoots = (() => {
|
|
78
|
-
if (localRootsRaw === undefined)
|
|
79
|
-
return undefined;
|
|
80
|
-
if (!Array.isArray(localRootsRaw)) {
|
|
81
|
-
return { ok: false, errorText: `Invalid ${at}.localRoots: expected array` };
|
|
82
|
-
}
|
|
83
|
-
const out = [];
|
|
84
|
-
for (let i = 0; i < localRootsRaw.length; i += 1) {
|
|
85
|
-
const item = localRootsRaw[i];
|
|
86
|
-
if (typeof item !== 'string' || item.trim() === '') {
|
|
87
|
-
return {
|
|
88
|
-
ok: false,
|
|
89
|
-
errorText: `Invalid ${at}.localRoots[${i}]: expected non-empty string`,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
out.push(item.trim());
|
|
93
|
-
}
|
|
94
|
-
if (out.length === 0) {
|
|
95
|
-
return { ok: false, errorText: `Invalid ${at}.localRoots: must not be empty` };
|
|
96
|
-
}
|
|
97
|
-
return { ok: true, value: out };
|
|
98
|
-
})();
|
|
99
|
-
if (localRoots && !localRoots.ok)
|
|
100
|
-
return localRoots;
|
|
101
|
-
return {
|
|
102
|
-
ok: true,
|
|
103
|
-
strategy: {
|
|
104
|
-
order: order ? order.value : undefined,
|
|
105
|
-
localRoots: localRoots ? localRoots.value : undefined,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
36
|
function parseSource(v, at) {
|
|
110
37
|
if (!isRecord(v))
|
|
111
38
|
return { ok: false, errorText: `Invalid ${at}: expected object` };
|
|
@@ -115,13 +42,15 @@ function parseSource(v, at) {
|
|
|
115
42
|
}
|
|
116
43
|
if (kind === 'npx') {
|
|
117
44
|
const spec = asString(v['spec']);
|
|
118
|
-
if (!spec || spec.trim() === '')
|
|
45
|
+
if (!spec || spec.trim() === '') {
|
|
119
46
|
return { ok: false, errorText: `Invalid ${at}.spec: required` };
|
|
47
|
+
}
|
|
120
48
|
return { ok: true, source: { kind, spec } };
|
|
121
49
|
}
|
|
122
50
|
const pathAbs = asString(v['pathAbs']);
|
|
123
|
-
if (!pathAbs || pathAbs.trim() === '')
|
|
51
|
+
if (!pathAbs || pathAbs.trim() === '') {
|
|
124
52
|
return { ok: false, errorText: `Invalid ${at}.pathAbs: required` };
|
|
53
|
+
}
|
|
125
54
|
return { ok: true, source: { kind, pathAbs } };
|
|
126
55
|
}
|
|
127
56
|
function parseEntry(v, at) {
|
|
@@ -133,11 +62,6 @@ function parseEntry(v, at) {
|
|
|
133
62
|
const enabled = asBool(v['enabled']);
|
|
134
63
|
if (enabled === null)
|
|
135
64
|
return { ok: false, errorText: `Invalid ${at}.enabled: boolean required` };
|
|
136
|
-
const userEnabledRaw = v['userEnabled'];
|
|
137
|
-
const userEnabled = userEnabledRaw === undefined ? enabled : asBool(userEnabledRaw);
|
|
138
|
-
if (userEnabled === null) {
|
|
139
|
-
return { ok: false, errorText: `Invalid ${at}.userEnabled: expected boolean` };
|
|
140
|
-
}
|
|
141
65
|
const assignedPortRaw = v['assignedPort'] ?? null;
|
|
142
66
|
const assignedPort = asNullableNumber(assignedPortRaw);
|
|
143
67
|
if (assignedPort === null) {
|
|
@@ -145,33 +69,42 @@ function parseEntry(v, at) {
|
|
|
145
69
|
return { ok: false, errorText: `Invalid ${at}.assignedPort: expected number|null` };
|
|
146
70
|
}
|
|
147
71
|
}
|
|
148
|
-
else {
|
|
149
|
-
|
|
150
|
-
return { ok: false, errorText: `Invalid ${at}.assignedPort: expected positive integer|null` };
|
|
151
|
-
}
|
|
72
|
+
else if (!Number.isInteger(assignedPort) || assignedPort <= 0) {
|
|
73
|
+
return { ok: false, errorText: `Invalid ${at}.assignedPort: expected positive integer|null` };
|
|
152
74
|
}
|
|
153
75
|
const sourceParsed = parseSource(v['source'], `${at}.source`);
|
|
154
76
|
if (!sourceParsed.ok)
|
|
155
77
|
return sourceParsed;
|
|
156
|
-
const
|
|
157
|
-
const installJsonParsed = (0, app_json_1.parseDomindsAppInstallJson)(installJsonRaw);
|
|
78
|
+
const installJsonParsed = (0, app_json_1.parseDomindsAppInstallJson)(v['installJson']);
|
|
158
79
|
if (!installJsonParsed.ok) {
|
|
159
80
|
return { ok: false, errorText: `Invalid ${at}.installJson: ${installJsonParsed.errorText}` };
|
|
160
81
|
}
|
|
161
82
|
return {
|
|
162
83
|
ok: true,
|
|
163
84
|
entry: {
|
|
164
|
-
id,
|
|
85
|
+
id: id.trim(),
|
|
165
86
|
enabled,
|
|
166
|
-
userEnabled,
|
|
167
87
|
source: sourceParsed.source,
|
|
168
88
|
assignedPort,
|
|
169
89
|
installJson: installJsonParsed.json,
|
|
170
90
|
},
|
|
171
91
|
};
|
|
172
92
|
}
|
|
93
|
+
function canonicalizeResolutionFile(file) {
|
|
94
|
+
const byId = new Map();
|
|
95
|
+
for (const entry of file.apps) {
|
|
96
|
+
if (byId.has(entry.id)) {
|
|
97
|
+
throw new Error(`Invalid ${exports.APPS_RESOLUTION_REL_PATH}: duplicate app id '${entry.id}'`);
|
|
98
|
+
}
|
|
99
|
+
byId.set(entry.id, entry);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
schemaVersion: 1,
|
|
103
|
+
apps: [...byId.values()].sort((a, b) => a.id.localeCompare(b.id)),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
173
106
|
async function loadAppsResolutionFile(params) {
|
|
174
|
-
const filePathAbs =
|
|
107
|
+
const filePathAbs = node_path_1.default.resolve(params.rtwsRootAbs, exports.APPS_RESOLUTION_REL_PATH);
|
|
175
108
|
let raw;
|
|
176
109
|
try {
|
|
177
110
|
raw = await promises_1.default.readFile(filePathAbs, 'utf-8');
|
|
@@ -182,7 +115,7 @@ async function loadAppsResolutionFile(params) {
|
|
|
182
115
|
'code' in err &&
|
|
183
116
|
err.code === 'ENOENT';
|
|
184
117
|
if (isEnoent) {
|
|
185
|
-
return { kind: 'ok', filePathAbs, file: { schemaVersion: 1, apps: [] } };
|
|
118
|
+
return { kind: 'ok', filePathAbs, exists: false, file: { schemaVersion: 1, apps: [] } };
|
|
186
119
|
}
|
|
187
120
|
return {
|
|
188
121
|
kind: 'error',
|
|
@@ -204,6 +137,16 @@ async function loadAppsResolutionFile(params) {
|
|
|
204
137
|
if (!isRecord(parsed)) {
|
|
205
138
|
return { kind: 'error', filePathAbs, errorText: 'Invalid resolution.yaml: expected object' };
|
|
206
139
|
}
|
|
140
|
+
const keys = Object.keys(parsed);
|
|
141
|
+
for (const key of keys) {
|
|
142
|
+
if (key !== 'schemaVersion' && key !== 'apps') {
|
|
143
|
+
return {
|
|
144
|
+
kind: 'error',
|
|
145
|
+
filePathAbs,
|
|
146
|
+
errorText: `Invalid resolution.yaml: unknown key '${key}'`,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
207
150
|
const schemaVersion = parsed['schemaVersion'];
|
|
208
151
|
if (schemaVersion !== 1) {
|
|
209
152
|
return {
|
|
@@ -222,44 +165,39 @@ async function loadAppsResolutionFile(params) {
|
|
|
222
165
|
}
|
|
223
166
|
const apps = [];
|
|
224
167
|
for (let i = 0; i < appsRaw.length; i += 1) {
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
227
|
-
return { kind: 'error', filePathAbs, errorText:
|
|
228
|
-
apps.push(
|
|
168
|
+
const entryParsed = parseEntry(appsRaw[i], `apps[${i}]`);
|
|
169
|
+
if (!entryParsed.ok)
|
|
170
|
+
return { kind: 'error', filePathAbs, errorText: entryParsed.errorText };
|
|
171
|
+
apps.push(entryParsed.entry);
|
|
229
172
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
173
|
+
try {
|
|
174
|
+
return {
|
|
175
|
+
kind: 'ok',
|
|
176
|
+
filePathAbs,
|
|
177
|
+
exists: true,
|
|
178
|
+
file: canonicalizeResolutionFile({ schemaVersion: 1, apps }),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
return {
|
|
183
|
+
kind: 'error',
|
|
184
|
+
filePathAbs,
|
|
185
|
+
errorText: err instanceof Error ? err.message : String(err),
|
|
186
|
+
};
|
|
241
187
|
}
|
|
242
|
-
const file = resolutionStrategy
|
|
243
|
-
? {
|
|
244
|
-
schemaVersion: 1,
|
|
245
|
-
resolutionStrategy: resolutionStrategy.value,
|
|
246
|
-
apps,
|
|
247
|
-
}
|
|
248
|
-
: { schemaVersion: 1, apps };
|
|
249
|
-
return { kind: 'ok', filePathAbs, file };
|
|
250
188
|
}
|
|
251
189
|
async function writeAppsResolutionFile(params) {
|
|
252
|
-
const dirAbs =
|
|
190
|
+
const dirAbs = node_path_1.default.resolve(params.rtwsRootAbs, '.apps');
|
|
253
191
|
await promises_1.default.mkdir(dirAbs, { recursive: true });
|
|
254
|
-
const filePathAbs =
|
|
255
|
-
const yamlText = yaml_1.default.stringify(params.file);
|
|
192
|
+
const filePathAbs = node_path_1.default.resolve(params.rtwsRootAbs, exports.APPS_RESOLUTION_REL_PATH);
|
|
193
|
+
const yamlText = yaml_1.default.stringify(canonicalizeResolutionFile(params.file));
|
|
256
194
|
await promises_1.default.writeFile(filePathAbs, yamlText, 'utf-8');
|
|
257
195
|
}
|
|
258
196
|
async function writeAppsResolutionFileIfChanged(params) {
|
|
259
|
-
const dirAbs =
|
|
197
|
+
const dirAbs = node_path_1.default.resolve(params.rtwsRootAbs, '.apps');
|
|
260
198
|
await promises_1.default.mkdir(dirAbs, { recursive: true });
|
|
261
|
-
const filePathAbs =
|
|
262
|
-
const yamlText = yaml_1.default.stringify(params.file);
|
|
199
|
+
const filePathAbs = node_path_1.default.resolve(params.rtwsRootAbs, exports.APPS_RESOLUTION_REL_PATH);
|
|
200
|
+
const yamlText = yaml_1.default.stringify(canonicalizeResolutionFile(params.file));
|
|
263
201
|
try {
|
|
264
202
|
const prev = await promises_1.default.readFile(filePathAbs, 'utf-8');
|
|
265
203
|
if (prev === yamlText)
|
|
@@ -276,43 +214,33 @@ async function writeAppsResolutionFileIfChanged(params) {
|
|
|
276
214
|
await promises_1.default.writeFile(filePathAbs, yamlText, 'utf-8');
|
|
277
215
|
}
|
|
278
216
|
function findResolvedApp(file, appId) {
|
|
279
|
-
|
|
280
|
-
return found ?? null;
|
|
217
|
+
return file.apps.find((app) => app.id === appId) ?? null;
|
|
281
218
|
}
|
|
282
219
|
function upsertResolvedApp(params) {
|
|
283
220
|
const apps = [...params.existing.apps];
|
|
284
|
-
const idx = apps.findIndex((
|
|
221
|
+
const idx = apps.findIndex((app) => app.id === params.next.id);
|
|
285
222
|
if (idx >= 0)
|
|
286
223
|
apps[idx] = params.next;
|
|
287
224
|
else
|
|
288
225
|
apps.push(params.next);
|
|
289
|
-
|
|
290
|
-
return resolutionStrategy !== undefined
|
|
291
|
-
? { schemaVersion: 1, resolutionStrategy, apps }
|
|
292
|
-
: { schemaVersion: 1, apps };
|
|
226
|
+
return canonicalizeResolutionFile({ schemaVersion: 1, apps });
|
|
293
227
|
}
|
|
294
228
|
function removeResolvedApp(params) {
|
|
295
|
-
if (!params.existing.apps.some((
|
|
229
|
+
if (!params.existing.apps.some((app) => app.id === params.appId))
|
|
296
230
|
return params.existing;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
: { schemaVersion: 1, apps };
|
|
231
|
+
return canonicalizeResolutionFile({
|
|
232
|
+
schemaVersion: 1,
|
|
233
|
+
apps: params.existing.apps.filter((app) => app.id !== params.appId),
|
|
234
|
+
});
|
|
302
235
|
}
|
|
303
|
-
function
|
|
236
|
+
function setResolvedAppEnabled(params) {
|
|
304
237
|
const existingApp = findResolvedApp(params.existing, params.appId);
|
|
305
|
-
if (!existingApp)
|
|
238
|
+
if (!existingApp || existingApp.enabled === params.enabled)
|
|
306
239
|
return params.existing;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
: a);
|
|
312
|
-
const resolutionStrategy = params.existing.resolutionStrategy;
|
|
313
|
-
return resolutionStrategy !== undefined
|
|
314
|
-
? { schemaVersion: 1, resolutionStrategy, apps }
|
|
315
|
-
: { schemaVersion: 1, apps };
|
|
240
|
+
return canonicalizeResolutionFile({
|
|
241
|
+
schemaVersion: 1,
|
|
242
|
+
apps: params.existing.apps.map((app) => app.id === params.appId ? { ...app, enabled: params.enabled } : app),
|
|
243
|
+
});
|
|
316
244
|
}
|
|
317
245
|
function setResolvedAppAssignedPort(params) {
|
|
318
246
|
if (params.assignedPort !== null) {
|
|
@@ -321,50 +249,10 @@ function setResolvedAppAssignedPort(params) {
|
|
|
321
249
|
}
|
|
322
250
|
}
|
|
323
251
|
const existingApp = findResolvedApp(params.existing, params.appId);
|
|
324
|
-
if (!existingApp)
|
|
325
|
-
return params.existing;
|
|
326
|
-
if (existingApp.assignedPort === params.assignedPort)
|
|
252
|
+
if (!existingApp || existingApp.assignedPort === params.assignedPort)
|
|
327
253
|
return params.existing;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
? { schemaVersion: 1, resolutionStrategy, apps }
|
|
332
|
-
: { schemaVersion: 1, apps };
|
|
333
|
-
}
|
|
334
|
-
function applyEffectiveEnabledToResolvedApps(params) {
|
|
335
|
-
let changed = false;
|
|
336
|
-
const apps = params.existing.apps.map((a) => {
|
|
337
|
-
const effectiveEnabled = params.effectiveEnabledById.get(a.id);
|
|
338
|
-
if (effectiveEnabled === undefined || effectiveEnabled === a.enabled)
|
|
339
|
-
return a;
|
|
340
|
-
changed = true;
|
|
341
|
-
return { ...a, enabled: effectiveEnabled };
|
|
342
|
-
});
|
|
343
|
-
if (!changed)
|
|
344
|
-
return params.existing;
|
|
345
|
-
const resolutionStrategy = params.existing.resolutionStrategy;
|
|
346
|
-
return resolutionStrategy !== undefined
|
|
347
|
-
? { schemaVersion: 1, resolutionStrategy, apps }
|
|
348
|
-
: { schemaVersion: 1, apps };
|
|
349
|
-
}
|
|
350
|
-
function applyAssignedPortToResolvedApps(params) {
|
|
351
|
-
let changed = false;
|
|
352
|
-
const apps = params.existing.apps.map((a) => {
|
|
353
|
-
const assignedPort = params.assignedPortById.get(a.id);
|
|
354
|
-
if (assignedPort === undefined || assignedPort === a.assignedPort)
|
|
355
|
-
return a;
|
|
356
|
-
if (assignedPort !== null) {
|
|
357
|
-
if (!Number.isInteger(assignedPort) || assignedPort <= 0) {
|
|
358
|
-
throw new Error(`Invalid assignedPort writeback for '${a.id}': ${String(assignedPort)}`);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
changed = true;
|
|
362
|
-
return { ...a, assignedPort };
|
|
254
|
+
return canonicalizeResolutionFile({
|
|
255
|
+
schemaVersion: 1,
|
|
256
|
+
apps: params.existing.apps.map((app) => app.id === params.appId ? { ...app, assignedPort: params.assignedPort } : app),
|
|
363
257
|
});
|
|
364
|
-
if (!changed)
|
|
365
|
-
return params.existing;
|
|
366
|
-
const resolutionStrategy = params.existing.resolutionStrategy;
|
|
367
|
-
return resolutionStrategy !== undefined
|
|
368
|
-
? { schemaVersion: 1, resolutionStrategy, apps }
|
|
369
|
-
: { schemaVersion: 1, apps };
|
|
370
258
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refreshAppsDerivedState = refreshAppsDerivedState;
|
|
4
|
+
const enabled_apps_1 = require("./enabled-apps");
|
|
5
|
+
async function refreshAppsDerivedState(params) {
|
|
6
|
+
const resolved = await (0, enabled_apps_1.materializeAppsResolution)({ rtwsRootAbs: params.rtwsRootAbs });
|
|
7
|
+
return resolved.resolutionFile;
|
|
8
|
+
}
|
package/dist/cli/disable.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* disable subcommand for dominds CLI (Apps)
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* dominds disable <appId>
|
|
8
|
-
*/
|
|
9
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
4
|
exports.main = main;
|
|
11
|
-
const
|
|
5
|
+
const configuration_file_1 = require("../apps/configuration-file");
|
|
6
|
+
const manifest_1 = require("../apps/manifest");
|
|
7
|
+
const workspace_app_state_1 = require("../apps/workspace-app-state");
|
|
12
8
|
function printHelp() {
|
|
13
9
|
console.log(`Usage:
|
|
14
10
|
dominds disable <appId>
|
|
@@ -16,14 +12,14 @@ function printHelp() {
|
|
|
16
12
|
}
|
|
17
13
|
function parseArgs(argv) {
|
|
18
14
|
const positional = [];
|
|
19
|
-
for (const
|
|
20
|
-
if (
|
|
15
|
+
for (const arg of argv) {
|
|
16
|
+
if (arg === '--help' || arg === '-h') {
|
|
21
17
|
printHelp();
|
|
22
18
|
process.exit(0);
|
|
23
19
|
}
|
|
24
|
-
if (
|
|
25
|
-
throw new Error(`Unknown option: ${
|
|
26
|
-
positional.push(
|
|
20
|
+
if (arg.startsWith('-'))
|
|
21
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
22
|
+
positional.push(arg);
|
|
27
23
|
}
|
|
28
24
|
if (positional.length !== 1)
|
|
29
25
|
throw new Error('disable requires exactly one <appId>');
|
|
@@ -41,24 +37,24 @@ async function main() {
|
|
|
41
37
|
return;
|
|
42
38
|
}
|
|
43
39
|
const rtwsRootAbs = process.cwd();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
console.error(`Error: failed to read ${resolution_file_1.APPS_RESOLUTION_REL_PATH}: ${loaded.errorText}`);
|
|
40
|
+
if (!(await (0, manifest_1.hasRtwsDeclaredAppDependency)({ rtwsRootAbs, appId: args.appId }))) {
|
|
41
|
+
console.error(`Error: app '${args.appId}' is not declared in .minds/app.yaml dependencies`);
|
|
47
42
|
process.exit(1);
|
|
48
43
|
return;
|
|
49
44
|
}
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
console.error(`Error:
|
|
45
|
+
const loadedConfig = await (0, configuration_file_1.loadAppsConfigurationFile)({ rtwsRootAbs });
|
|
46
|
+
if (loadedConfig.kind === 'error') {
|
|
47
|
+
console.error(`Error: failed to read .apps/configuration.yaml: ${loadedConfig.errorText}`);
|
|
53
48
|
process.exit(1);
|
|
54
49
|
return;
|
|
55
50
|
}
|
|
56
|
-
const
|
|
57
|
-
existing:
|
|
51
|
+
const nextConfig = (0, configuration_file_1.setAppDisabledInConfiguration)({
|
|
52
|
+
existing: loadedConfig.file,
|
|
58
53
|
appId: args.appId,
|
|
59
|
-
|
|
54
|
+
disabled: true,
|
|
60
55
|
});
|
|
61
|
-
await (0,
|
|
56
|
+
await (0, configuration_file_1.writeAppsConfigurationFileIfChanged)({ rtwsRootAbs, file: nextConfig });
|
|
57
|
+
await (0, workspace_app_state_1.refreshAppsDerivedState)({ rtwsRootAbs });
|
|
62
58
|
console.log(`Disabled app '${args.appId}'`);
|
|
63
59
|
}
|
|
64
60
|
if (require.main === module) {
|