harnesstap 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/apply-SUNDXRJ3.js +54 -0
- package/dist/{approve-KQNCNH2R.js → approve-FBGYQGWN.js} +14 -15
- package/dist/{approve-KQNCNH2R.js.map → approve-FBGYQGWN.js.map} +1 -1
- package/dist/{audit-SLYOZCMI.js → audit-VI4QZ6X2.js} +30 -39
- package/dist/{audit-SLYOZCMI.js.map → audit-VI4QZ6X2.js.map} +1 -1
- package/dist/{auth-3IEVICFT.js → auth-4CQCDS2W.js} +17 -19
- package/dist/{auth-3IEVICFT.js.map → auth-4CQCDS2W.js.map} +1 -1
- package/dist/bin.js +3 -3
- package/dist/{chunk-KDDXZBMC.js → chunk-23XSG7LI.js} +7 -11
- package/dist/{chunk-KDDXZBMC.js.map → chunk-23XSG7LI.js.map} +1 -1
- package/dist/{chunk-YDD3ES2K.js → chunk-2A36HWDE.js} +63 -13
- package/dist/chunk-2A36HWDE.js.map +1 -0
- package/dist/{chunk-IK524ZDW.js → chunk-3FS775NP.js} +51 -4
- package/dist/chunk-3FS775NP.js.map +1 -0
- package/dist/{chunk-IBOABSIA.js → chunk-3P6BWL5F.js} +2 -2
- package/dist/{chunk-G26HZZDJ.js → chunk-43BDGVN3.js} +19 -6
- package/dist/chunk-43BDGVN3.js.map +1 -0
- package/dist/{chunk-TYULB6ZY.js → chunk-4ZQ2SCGY.js} +146 -78
- package/dist/chunk-4ZQ2SCGY.js.map +1 -0
- package/dist/{chunk-6BY4BV5G.js → chunk-6LTLYV5D.js} +353 -230
- package/dist/chunk-6LTLYV5D.js.map +1 -0
- package/dist/{chunk-GQKKX7OE.js → chunk-73OJQTBW.js} +6 -2
- package/dist/chunk-73OJQTBW.js.map +1 -0
- package/dist/{chunk-IRU7NBOT.js → chunk-7HP6AAI3.js} +2 -2
- package/dist/{chunk-MWXA4PFE.js → chunk-BPWFQKI5.js} +5 -7
- package/dist/{chunk-MWXA4PFE.js.map → chunk-BPWFQKI5.js.map} +1 -1
- package/dist/{chunk-3RBYT7QN.js → chunk-D432JAXV.js} +44 -19
- package/dist/chunk-D432JAXV.js.map +1 -0
- package/dist/chunk-DF4Z7LAD.js +3463 -0
- package/dist/chunk-DF4Z7LAD.js.map +1 -0
- package/dist/{chunk-J4CKQXQ6.js → chunk-EOPFER6N.js} +71 -318
- package/dist/chunk-EOPFER6N.js.map +1 -0
- package/dist/chunk-G6WKY2W4.js +389 -0
- package/dist/chunk-G6WKY2W4.js.map +1 -0
- package/dist/{chunk-JKGSJGCC.js → chunk-GRASK6M6.js} +5 -5
- package/dist/{chunk-63U7QWNY.js → chunk-IE7B6Q5K.js} +33 -39
- package/dist/chunk-IE7B6Q5K.js.map +1 -0
- package/dist/{chunk-VC6OKCJF.js → chunk-IMROMZ2K.js} +7 -4
- package/dist/{chunk-VC6OKCJF.js.map → chunk-IMROMZ2K.js.map} +1 -1
- package/dist/{chunk-DV74UZJI.js → chunk-L6YZE5MY.js} +3 -3
- package/dist/{chunk-SNVAMWB7.js → chunk-M2U3J7UX.js} +7 -1
- package/dist/chunk-M2U3J7UX.js.map +1 -0
- package/dist/{chunk-BSOBXLYI.js → chunk-M4KLHJ6U.js} +16 -13
- package/dist/chunk-M4KLHJ6U.js.map +1 -0
- package/dist/{chunk-VL7BGD47.js → chunk-MR7IOHSX.js} +16 -19
- package/dist/chunk-MR7IOHSX.js.map +1 -0
- package/dist/{chunk-4KNQZDZC.js → chunk-N3VGY3T3.js} +15 -15
- package/dist/chunk-N3VGY3T3.js.map +1 -0
- package/dist/{chunk-ZY2MZ2KQ.js → chunk-N3ZCH64F.js} +496 -10
- package/dist/chunk-N3ZCH64F.js.map +1 -0
- package/dist/{chunk-H6DVP2SI.js → chunk-OML4HXKT.js} +20 -22
- package/dist/chunk-OML4HXKT.js.map +1 -0
- package/dist/{chunk-NJ7WRKIQ.js → chunk-P2C7JPLD.js} +3 -3
- package/dist/{chunk-LNJ3WZZX.js → chunk-PCMON7Y2.js} +7 -7
- package/dist/{chunk-VL2NWCZV.js → chunk-PNGF5EV2.js} +2 -2
- package/dist/{chunk-SZNBUIDR.js → chunk-QA5U36JN.js} +199 -215
- package/dist/chunk-QA5U36JN.js.map +1 -0
- package/dist/{chunk-KDAV2GUT.js → chunk-R7ZOYVN3.js} +241 -126
- package/dist/chunk-R7ZOYVN3.js.map +1 -0
- package/dist/{chunk-QO4LBDVI.js → chunk-RDG5DT7S.js} +45 -49
- package/dist/{chunk-QO4LBDVI.js.map → chunk-RDG5DT7S.js.map} +1 -1
- package/dist/{chunk-VQVUJYYY.js → chunk-REHRUNBB.js} +8 -3
- package/dist/chunk-REHRUNBB.js.map +1 -0
- package/dist/{chunk-DXKAKKLP.js → chunk-RFQ3N7FB.js} +19 -29
- package/dist/chunk-RFQ3N7FB.js.map +1 -0
- package/dist/{chunk-C4QBVVEH.js → chunk-RVEXPMM3.js} +3 -3
- package/dist/{chunk-XFZQVYIN.js → chunk-TPEJFLV7.js} +13 -15
- package/dist/{chunk-XFZQVYIN.js.map → chunk-TPEJFLV7.js.map} +1 -1
- package/dist/{chunk-7LWH5SWH.js → chunk-U6DXASQP.js} +2 -2
- package/dist/{chunk-BIBUCC2E.js → chunk-ULCD6DJE.js} +30 -8
- package/dist/chunk-ULCD6DJE.js.map +1 -0
- package/dist/{chunk-KMWHZSEG.js → chunk-UVVZHWD2.js} +2 -2
- package/dist/{chunk-DWVAR4BP.js → chunk-WG5A6EAU.js} +270 -12
- package/dist/chunk-WG5A6EAU.js.map +1 -0
- package/dist/{chunk-QRZPQNLX.js → chunk-WGP4GUYZ.js} +10 -10
- package/dist/{chunk-F2L4VNQK.js → chunk-XTVGCVU4.js} +124 -83
- package/dist/chunk-XTVGCVU4.js.map +1 -0
- package/dist/{chunk-EIWXS4RM.js → chunk-XUJKZQZA.js} +8 -8
- package/dist/chunk-XUJKZQZA.js.map +1 -0
- package/dist/chunk-ZUASVASP.js +30317 -0
- package/dist/chunk-ZUASVASP.js.map +1 -0
- package/dist/{compile-57EEIUMB.js → compile-GXADKGH5.js} +37 -50
- package/dist/{compile-57EEIUMB.js.map → compile-GXADKGH5.js.map} +1 -1
- package/dist/{config-4EJ3D7QJ.js → config-JMHNA2U5.js} +22 -35
- package/dist/{config-4EJ3D7QJ.js.map → config-JMHNA2U5.js.map} +1 -1
- package/dist/cursor-local-install-46RWRBDT.js +98 -0
- package/dist/cursor-local-install-46RWRBDT.js.map +1 -0
- package/dist/{doctor-EEV6P5CH.js → doctor-N7ZULPOL.js} +18 -19
- package/dist/{doctor-EEV6P5CH.js.map → doctor-N7ZULPOL.js.map} +1 -1
- package/dist/{environment-WFEG4DAT.js → environment-OBB3WU5B.js} +60 -71
- package/dist/{environment-WFEG4DAT.js.map → environment-OBB3WU5B.js.map} +1 -1
- package/dist/{github-BSMQD72A.js → github-PBYBGOLH.js} +17 -17
- package/dist/{harness-VX3PNVQW.js → harness-7KYATIV6.js} +56 -67
- package/dist/{harness-VX3PNVQW.js.map → harness-7KYATIV6.js.map} +1 -1
- package/dist/{help-AW2HKX63.js → help-EE3AJQD4.js} +48 -52
- package/dist/help-EE3AJQD4.js.map +1 -0
- package/dist/{help-BVFOZD7E.js → help-VXWKLQ6A.js} +55 -15
- package/dist/help-VXWKLQ6A.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +16 -24
- package/dist/{init-SPN2GEZ4.js → init-LBTMPDVJ.js} +43 -56
- package/dist/init-LBTMPDVJ.js.map +1 -0
- package/dist/live-read-cache-TUSP7U3D.js +10 -0
- package/dist/{lock-K2LLUU7H.js → lock-WLJRXRVK.js} +16 -16
- package/dist/{marketplace-VEKSWGX3.js → marketplace-GXSV6QIY.js} +62 -28
- package/dist/marketplace-GXSV6QIY.js.map +1 -0
- package/dist/{mcp-T6DKIKSF.js → mcp-XPDWWU75.js} +35 -48
- package/dist/{mcp-T6DKIKSF.js.map → mcp-XPDWWU75.js.map} +1 -1
- package/dist/{migrate-OO37WSB2.js → migrate-SBUIWN3U.js} +79 -64
- package/dist/migrate-SBUIWN3U.js.map +1 -0
- package/dist/open-HDGLYYVU.js +24 -0
- package/dist/{pack-V32UPC7W.js → pack-A73LDVOX.js} +16 -22
- package/dist/{pack-V32UPC7W.js.map → pack-A73LDVOX.js.map} +1 -1
- package/dist/plugin-CEO6ZJM5.js +51 -0
- package/dist/plugin-from-project-UK7VJVUP.js +18 -0
- package/dist/{policy-F5MKZNOC.js → policy-6VY3CMSU.js} +13 -14
- package/dist/{policy-F5MKZNOC.js.map → policy-6VY3CMSU.js.map} +1 -1
- package/dist/{profile-H4PMH4XT.js → profile-YCKPMRRU.js} +96 -102
- package/dist/profile-YCKPMRRU.js.map +1 -0
- package/dist/{project-QVNEJJGH.js → project-KHPPBKPN.js} +63 -77
- package/dist/{project-QVNEJJGH.js.map → project-KHPPBKPN.js.map} +1 -1
- package/dist/{resource-GL4RLSGI.js → resource-IJU3FAN5.js} +42 -49
- package/dist/{resource-GL4RLSGI.js.map → resource-IJU3FAN5.js.map} +1 -1
- package/dist/{version-PBHZK44K.js → version-Z66FWWMQ.js} +2 -2
- package/dist/version-Z66FWWMQ.js.map +1 -0
- package/package.json +4 -1
- package/schemas/fixtures/confidence.ap.json +1 -1
- package/schemas/fixtures/context7.ap.json +1 -1
- package/schemas/fixtures/legacy-schema-v1.ap.json +13 -0
- package/schemas/fixtures/legacy-schemas-v1.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +1 -1
- package/schemas/fixtures/superpowers.ap.json +1 -1
- package/schemas/fixtures/third-party-skills.ap.json +1 -1
- package/dist/apply-2GRNKR5H.js +0 -67
- package/dist/chunk-2EIJYDNI.js +0 -10945
- package/dist/chunk-2EIJYDNI.js.map +0 -1
- package/dist/chunk-3IWTJCPA.js +0 -6448
- package/dist/chunk-3IWTJCPA.js.map +0 -1
- package/dist/chunk-3IZ7SEGT.js +0 -346
- package/dist/chunk-3IZ7SEGT.js.map +0 -1
- package/dist/chunk-3RBYT7QN.js.map +0 -1
- package/dist/chunk-4KNQZDZC.js.map +0 -1
- package/dist/chunk-63U7QWNY.js.map +0 -1
- package/dist/chunk-6BY4BV5G.js.map +0 -1
- package/dist/chunk-7L2K4N25.js +0 -610
- package/dist/chunk-7L2K4N25.js.map +0 -1
- package/dist/chunk-BIBUCC2E.js.map +0 -1
- package/dist/chunk-BSOBXLYI.js.map +0 -1
- package/dist/chunk-DWVAR4BP.js.map +0 -1
- package/dist/chunk-DXKAKKLP.js.map +0 -1
- package/dist/chunk-EIWXS4RM.js.map +0 -1
- package/dist/chunk-EWBCFAF3.js +0 -681
- package/dist/chunk-EWBCFAF3.js.map +0 -1
- package/dist/chunk-F2L4VNQK.js.map +0 -1
- package/dist/chunk-G26HZZDJ.js.map +0 -1
- package/dist/chunk-GQKKX7OE.js.map +0 -1
- package/dist/chunk-GRJY22U6.js +0 -691
- package/dist/chunk-GRJY22U6.js.map +0 -1
- package/dist/chunk-H6DVP2SI.js.map +0 -1
- package/dist/chunk-HVVPTCKR.js +0 -1173
- package/dist/chunk-HVVPTCKR.js.map +0 -1
- package/dist/chunk-IK524ZDW.js.map +0 -1
- package/dist/chunk-J4CKQXQ6.js.map +0 -1
- package/dist/chunk-JRFUTIEH.js +0 -426
- package/dist/chunk-JRFUTIEH.js.map +0 -1
- package/dist/chunk-K2BPYEH5.js +0 -491
- package/dist/chunk-K2BPYEH5.js.map +0 -1
- package/dist/chunk-KCQC7YBK.js +0 -7795
- package/dist/chunk-KCQC7YBK.js.map +0 -1
- package/dist/chunk-KDAV2GUT.js.map +0 -1
- package/dist/chunk-MY62SSKC.js +0 -183
- package/dist/chunk-MY62SSKC.js.map +0 -1
- package/dist/chunk-PXU2OS26.js +0 -238
- package/dist/chunk-PXU2OS26.js.map +0 -1
- package/dist/chunk-SNVAMWB7.js.map +0 -1
- package/dist/chunk-SPRVUATR.js +0 -430
- package/dist/chunk-SPRVUATR.js.map +0 -1
- package/dist/chunk-SY7G5QEI.js +0 -35
- package/dist/chunk-SY7G5QEI.js.map +0 -1
- package/dist/chunk-SZNBUIDR.js.map +0 -1
- package/dist/chunk-TYULB6ZY.js.map +0 -1
- package/dist/chunk-UJYFTXHV.js +0 -296
- package/dist/chunk-UJYFTXHV.js.map +0 -1
- package/dist/chunk-VL7BGD47.js.map +0 -1
- package/dist/chunk-VQVUJYYY.js.map +0 -1
- package/dist/chunk-XQFT4PEP.js +0 -60
- package/dist/chunk-XQFT4PEP.js.map +0 -1
- package/dist/chunk-YDD3ES2K.js.map +0 -1
- package/dist/chunk-ZY2MZ2KQ.js.map +0 -1
- package/dist/help-AW2HKX63.js.map +0 -1
- package/dist/help-BVFOZD7E.js.map +0 -1
- package/dist/init-SPN2GEZ4.js.map +0 -1
- package/dist/marketplace-VEKSWGX3.js.map +0 -1
- package/dist/migrate-OO37WSB2.js.map +0 -1
- package/dist/open-3V3QK5RK.js +0 -32
- package/dist/plugin-KOBNQ7GT.js +0 -64
- package/dist/plugin-from-project-X3VO3MB6.js +0 -16
- package/dist/profile-H4PMH4XT.js.map +0 -1
- /package/dist/{apply-2GRNKR5H.js.map → apply-SUNDXRJ3.js.map} +0 -0
- /package/dist/{chunk-IBOABSIA.js.map → chunk-3P6BWL5F.js.map} +0 -0
- /package/dist/{chunk-IRU7NBOT.js.map → chunk-7HP6AAI3.js.map} +0 -0
- /package/dist/{chunk-JKGSJGCC.js.map → chunk-GRASK6M6.js.map} +0 -0
- /package/dist/{chunk-DV74UZJI.js.map → chunk-L6YZE5MY.js.map} +0 -0
- /package/dist/{chunk-NJ7WRKIQ.js.map → chunk-P2C7JPLD.js.map} +0 -0
- /package/dist/{chunk-LNJ3WZZX.js.map → chunk-PCMON7Y2.js.map} +0 -0
- /package/dist/{chunk-VL2NWCZV.js.map → chunk-PNGF5EV2.js.map} +0 -0
- /package/dist/{chunk-C4QBVVEH.js.map → chunk-RVEXPMM3.js.map} +0 -0
- /package/dist/{chunk-7LWH5SWH.js.map → chunk-U6DXASQP.js.map} +0 -0
- /package/dist/{chunk-KMWHZSEG.js.map → chunk-UVVZHWD2.js.map} +0 -0
- /package/dist/{chunk-QRZPQNLX.js.map → chunk-WGP4GUYZ.js.map} +0 -0
- /package/dist/{github-BSMQD72A.js.map → github-PBYBGOLH.js.map} +0 -0
- /package/dist/{open-3V3QK5RK.js.map → live-read-cache-TUSP7U3D.js.map} +0 -0
- /package/dist/{lock-K2LLUU7H.js.map → lock-WLJRXRVK.js.map} +0 -0
- /package/dist/{plugin-KOBNQ7GT.js.map → open-HDGLYYVU.js.map} +0 -0
- /package/dist/{plugin-from-project-X3VO3MB6.js.map → plugin-CEO6ZJM5.js.map} +0 -0
- /package/dist/{version-PBHZK44K.js.map → plugin-from-project-UK7VJVUP.js.map} +0 -0
package/dist/chunk-UJYFTXHV.js
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
detectHomePlatforms
|
|
3
|
-
} from "./chunk-3IWTJCPA.js";
|
|
4
|
-
import {
|
|
5
|
-
getAllPlatforms,
|
|
6
|
-
resolveHomeRoot
|
|
7
|
-
} from "./chunk-2EIJYDNI.js";
|
|
8
|
-
import {
|
|
9
|
-
CliUsageError
|
|
10
|
-
} from "./chunk-DXKAKKLP.js";
|
|
11
|
-
import {
|
|
12
|
-
CLI_ERRORS,
|
|
13
|
-
CLI_HINTS,
|
|
14
|
-
getDb
|
|
15
|
-
} from "./chunk-DWVAR4BP.js";
|
|
16
|
-
|
|
17
|
-
// src/models/project.ts
|
|
18
|
-
import { resolve } from "path";
|
|
19
|
-
import { ulid } from "ulid";
|
|
20
|
-
function createProject(input) {
|
|
21
|
-
const db = getDb();
|
|
22
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
23
|
-
const id = ulid();
|
|
24
|
-
db.prepare(
|
|
25
|
-
`INSERT INTO projects (id, git_origin, name, local_path, created_at)
|
|
26
|
-
VALUES (?, ?, ?, ?, ?)`
|
|
27
|
-
).run(id, input.git_origin, input.name, input.local_path, now);
|
|
28
|
-
return { id, ...input, created_at: now };
|
|
29
|
-
}
|
|
30
|
-
function getProjectByOrigin(gitOrigin) {
|
|
31
|
-
const db = getDb();
|
|
32
|
-
return db.prepare("SELECT * FROM projects WHERE git_origin = ?").get(gitOrigin);
|
|
33
|
-
}
|
|
34
|
-
function getProject(id) {
|
|
35
|
-
const db = getDb();
|
|
36
|
-
return db.prepare("SELECT * FROM projects WHERE id = ?").get(id);
|
|
37
|
-
}
|
|
38
|
-
function upsertProject(input) {
|
|
39
|
-
const existing = getProjectByOrigin(input.git_origin);
|
|
40
|
-
if (existing) {
|
|
41
|
-
const db = getDb();
|
|
42
|
-
db.prepare("UPDATE projects SET local_path = ?, name = ? WHERE id = ?").run(
|
|
43
|
-
input.local_path,
|
|
44
|
-
input.name,
|
|
45
|
-
existing.id
|
|
46
|
-
);
|
|
47
|
-
return { ...existing, local_path: input.local_path, name: input.name };
|
|
48
|
-
}
|
|
49
|
-
return createProject(input);
|
|
50
|
-
}
|
|
51
|
-
function listProjects() {
|
|
52
|
-
const db = getDb();
|
|
53
|
-
return db.prepare("SELECT * FROM projects ORDER BY name").all();
|
|
54
|
-
}
|
|
55
|
-
function getProjectByLocalPath(localPath) {
|
|
56
|
-
const normalized = resolve(localPath);
|
|
57
|
-
return listProjects().find((project) => resolve(project.local_path) === normalized);
|
|
58
|
-
}
|
|
59
|
-
function applyPluginToProject(input) {
|
|
60
|
-
const db = getDb();
|
|
61
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
62
|
-
db.prepare(
|
|
63
|
-
`INSERT OR REPLACE INTO project_plugins (project_id, plugin_id, platforms, applied_at)
|
|
64
|
-
VALUES (?, ?, ?, ?)`
|
|
65
|
-
).run(input.project_id, input.plugin_id, JSON.stringify(input.platforms), now);
|
|
66
|
-
}
|
|
67
|
-
function applyConfiguredPluginToProject(input) {
|
|
68
|
-
applyPluginToProject({
|
|
69
|
-
project_id: input.project_id,
|
|
70
|
-
plugin_id: input.configured_plugin_id,
|
|
71
|
-
platforms: input.platforms
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function getProjectPlugins(projectId) {
|
|
75
|
-
const db = getDb();
|
|
76
|
-
const rows = db.prepare(
|
|
77
|
-
"SELECT * FROM project_plugins WHERE project_id = ? ORDER BY applied_at DESC"
|
|
78
|
-
).all(projectId);
|
|
79
|
-
return rows.map((row) => ({
|
|
80
|
-
...row,
|
|
81
|
-
platforms: JSON.parse(row.platforms)
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
function getProjectConfiguredPlugins(projectId) {
|
|
85
|
-
return getProjectPlugins(projectId);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/models/harness.ts
|
|
89
|
-
var CURSOR_SKILL_MODES = /* @__PURE__ */ new Set([
|
|
90
|
-
"agent-requested",
|
|
91
|
-
"always-on",
|
|
92
|
-
"agents-skills"
|
|
93
|
-
]);
|
|
94
|
-
function parseCursorSkillMode(value) {
|
|
95
|
-
if (!value) return void 0;
|
|
96
|
-
return CURSOR_SKILL_MODES.has(value) ? value : void 0;
|
|
97
|
-
}
|
|
98
|
-
function parseRegisteredJson(value) {
|
|
99
|
-
try {
|
|
100
|
-
const parsed = JSON.parse(value);
|
|
101
|
-
if (!Array.isArray(parsed)) return [];
|
|
102
|
-
return normalizeRegisteredHarnesses(
|
|
103
|
-
parsed.filter((entry) => typeof entry === "string")
|
|
104
|
-
);
|
|
105
|
-
} catch {
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function normalizeSelection(selection) {
|
|
110
|
-
return {
|
|
111
|
-
registered_harnesses: normalizeRegisteredHarnesses(selection.registered_harnesses)
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function rowToPreference(row) {
|
|
115
|
-
return {
|
|
116
|
-
registered_harnesses: parseRegisteredJson(row.registered_harnesses),
|
|
117
|
-
updated_at: row.updated_at
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function rowToProjectHarness(row) {
|
|
121
|
-
const cursor_skill_mode = parseCursorSkillMode(row.cursor_skill_mode);
|
|
122
|
-
return {
|
|
123
|
-
project_id: row.project_id,
|
|
124
|
-
registered_harnesses: parseRegisteredJson(row.registered_harnesses),
|
|
125
|
-
materialization_strategy: row.materialization_strategy === "copy" ? "copy" : "symlink-preferred",
|
|
126
|
-
...cursor_skill_mode ? { cursor_skill_mode } : {},
|
|
127
|
-
updated_at: row.updated_at
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function getHarnessPreference() {
|
|
131
|
-
const db = getDb();
|
|
132
|
-
const row = db.prepare("SELECT * FROM harness_preferences WHERE scope = 'default'").get();
|
|
133
|
-
return row ? rowToPreference(row) : void 0;
|
|
134
|
-
}
|
|
135
|
-
function setHarnessPreference(selection) {
|
|
136
|
-
const db = getDb();
|
|
137
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
138
|
-
const normalized = normalizeSelection(selection);
|
|
139
|
-
db.prepare(
|
|
140
|
-
`INSERT INTO harness_preferences (scope, registered_harnesses, updated_at)
|
|
141
|
-
VALUES ('default', ?, ?)
|
|
142
|
-
ON CONFLICT(scope) DO UPDATE SET
|
|
143
|
-
registered_harnesses = excluded.registered_harnesses,
|
|
144
|
-
updated_at = excluded.updated_at`
|
|
145
|
-
).run(
|
|
146
|
-
JSON.stringify(normalized.registered_harnesses),
|
|
147
|
-
now
|
|
148
|
-
);
|
|
149
|
-
return {
|
|
150
|
-
...normalized,
|
|
151
|
-
updated_at: now
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function getProjectHarnessConfig(projectId) {
|
|
155
|
-
const db = getDb();
|
|
156
|
-
const row = db.prepare("SELECT * FROM project_harnesses WHERE project_id = ?").get(projectId);
|
|
157
|
-
return row ? rowToProjectHarness(row) : void 0;
|
|
158
|
-
}
|
|
159
|
-
function setProjectHarnessConfig(input) {
|
|
160
|
-
const db = getDb();
|
|
161
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
162
|
-
const normalized = normalizeSelection({
|
|
163
|
-
registered_harnesses: input.registered_harnesses
|
|
164
|
-
});
|
|
165
|
-
const materialization_strategy = input.materialization_strategy ?? "symlink-preferred";
|
|
166
|
-
const existing = getProjectHarnessConfig(input.project_id);
|
|
167
|
-
const cursor_skill_mode = input.cursor_skill_mode ?? existing?.cursor_skill_mode;
|
|
168
|
-
db.prepare(
|
|
169
|
-
`INSERT INTO project_harnesses (
|
|
170
|
-
project_id, registered_harnesses, materialization_strategy,
|
|
171
|
-
cursor_skill_mode, updated_at
|
|
172
|
-
)
|
|
173
|
-
VALUES (?, ?, ?, ?, ?)
|
|
174
|
-
ON CONFLICT(project_id) DO UPDATE SET
|
|
175
|
-
registered_harnesses = excluded.registered_harnesses,
|
|
176
|
-
materialization_strategy = excluded.materialization_strategy,
|
|
177
|
-
cursor_skill_mode = excluded.cursor_skill_mode,
|
|
178
|
-
updated_at = excluded.updated_at`
|
|
179
|
-
).run(
|
|
180
|
-
input.project_id,
|
|
181
|
-
JSON.stringify(normalized.registered_harnesses),
|
|
182
|
-
materialization_strategy,
|
|
183
|
-
cursor_skill_mode ?? null,
|
|
184
|
-
now
|
|
185
|
-
);
|
|
186
|
-
return {
|
|
187
|
-
project_id: input.project_id,
|
|
188
|
-
...normalized,
|
|
189
|
-
materialization_strategy,
|
|
190
|
-
...cursor_skill_mode ? { cursor_skill_mode } : {},
|
|
191
|
-
updated_at: now
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// src/services/harness-targets.ts
|
|
196
|
-
function parsePlatformFilter(platform) {
|
|
197
|
-
return platform?.split(",").map((p) => p.trim()).filter(Boolean);
|
|
198
|
-
}
|
|
199
|
-
function uniqueHarnessTargets(harnesses) {
|
|
200
|
-
return [...new Set(harnesses.filter(Boolean))];
|
|
201
|
-
}
|
|
202
|
-
function normalizeRegisteredHarnesses(harnesses) {
|
|
203
|
-
return uniqueHarnessTargets(harnesses);
|
|
204
|
-
}
|
|
205
|
-
function registeredHarnessesOf(selection) {
|
|
206
|
-
if (!selection?.registered_harnesses) return [];
|
|
207
|
-
return normalizeRegisteredHarnesses(selection.registered_harnesses);
|
|
208
|
-
}
|
|
209
|
-
function registeredFromLegacyParts(main, aliases) {
|
|
210
|
-
return normalizeRegisteredHarnesses([
|
|
211
|
-
...main ? [main] : [],
|
|
212
|
-
...aliases ?? []
|
|
213
|
-
]);
|
|
214
|
-
}
|
|
215
|
-
function assertSupportedHarnessTargets(harnesses) {
|
|
216
|
-
const supported = new Set(getAllPlatforms().map((platform) => platform.id));
|
|
217
|
-
const invalid = harnesses.filter((harness) => !supported.has(harness));
|
|
218
|
-
if (invalid.length > 0) {
|
|
219
|
-
throw new Error(`Unsupported harness: ${invalid.join(", ")}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
function resolveRegisteredGlobalApplyHarnesses(harnessOption) {
|
|
223
|
-
const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);
|
|
224
|
-
if (explicitTargets.length > 0) {
|
|
225
|
-
assertSupportedHarnessTargets(explicitTargets);
|
|
226
|
-
return explicitTargets;
|
|
227
|
-
}
|
|
228
|
-
const preferredTargets = registeredHarnessesOf(getHarnessPreference());
|
|
229
|
-
if (preferredTargets.length > 0) {
|
|
230
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
231
|
-
return preferredTargets;
|
|
232
|
-
}
|
|
233
|
-
throw new CliUsageError(CLI_ERRORS.noHarnesses, [CLI_HINTS.harnessSetOrFlag]);
|
|
234
|
-
}
|
|
235
|
-
function resolveScanGlobalHarnessTargets(harnessOption, homeRoot = resolveHomeRoot()) {
|
|
236
|
-
const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);
|
|
237
|
-
if (explicitTargets.length > 0) {
|
|
238
|
-
assertSupportedHarnessTargets(explicitTargets);
|
|
239
|
-
return explicitTargets;
|
|
240
|
-
}
|
|
241
|
-
const preference = getHarnessPreference();
|
|
242
|
-
if (preference) {
|
|
243
|
-
const preferredTargets = registeredHarnessesOf(preference);
|
|
244
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
245
|
-
return preferredTargets;
|
|
246
|
-
}
|
|
247
|
-
const detectedTargets = uniqueHarnessTargets(
|
|
248
|
-
detectHomePlatforms(homeRoot).map((result) => result.platformId)
|
|
249
|
-
);
|
|
250
|
-
if (detectedTargets.length > 0) {
|
|
251
|
-
return detectedTargets;
|
|
252
|
-
}
|
|
253
|
-
throw new Error(
|
|
254
|
-
"No global harness targets configured. Run ht harness set or pass --harness <slugs>."
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
function collectApplyPreferenceHarnesses(projectRoot) {
|
|
258
|
-
const projectByPath = getProjectByLocalPath(projectRoot);
|
|
259
|
-
const projectConfig = projectByPath ? getProjectHarnessConfig(projectByPath.id) : void 0;
|
|
260
|
-
if (projectConfig) {
|
|
261
|
-
const preferredTargets = registeredHarnessesOf(projectConfig);
|
|
262
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
263
|
-
return preferredTargets;
|
|
264
|
-
}
|
|
265
|
-
const preference = getHarnessPreference();
|
|
266
|
-
if (preference) {
|
|
267
|
-
const preferredTargets = registeredHarnessesOf(preference);
|
|
268
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
269
|
-
return preferredTargets;
|
|
270
|
-
}
|
|
271
|
-
return [];
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
export {
|
|
275
|
-
getProjectByOrigin,
|
|
276
|
-
getProject,
|
|
277
|
-
upsertProject,
|
|
278
|
-
listProjects,
|
|
279
|
-
getProjectByLocalPath,
|
|
280
|
-
applyConfiguredPluginToProject,
|
|
281
|
-
getProjectConfiguredPlugins,
|
|
282
|
-
parsePlatformFilter,
|
|
283
|
-
uniqueHarnessTargets,
|
|
284
|
-
normalizeRegisteredHarnesses,
|
|
285
|
-
registeredHarnessesOf,
|
|
286
|
-
registeredFromLegacyParts,
|
|
287
|
-
assertSupportedHarnessTargets,
|
|
288
|
-
resolveRegisteredGlobalApplyHarnesses,
|
|
289
|
-
resolveScanGlobalHarnessTargets,
|
|
290
|
-
collectApplyPreferenceHarnesses,
|
|
291
|
-
getHarnessPreference,
|
|
292
|
-
setHarnessPreference,
|
|
293
|
-
getProjectHarnessConfig,
|
|
294
|
-
setProjectHarnessConfig
|
|
295
|
-
};
|
|
296
|
-
//# sourceMappingURL=chunk-UJYFTXHV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/models/project.ts","../src/models/harness.ts","../src/services/harness-targets.ts"],"sourcesContent":["import { getDb } from \"../db/connection.js\";\nimport { resolve } from \"node:path\";\nimport { ulid } from \"ulid\";\nimport type { Project, ProjectPlugin } from \"../types.js\";\n\nexport function createProject(input: {\n git_origin: string;\n name: string;\n local_path: string;\n}): Project {\n const db = getDb();\n const now = new Date().toISOString();\n const id = ulid();\n\n db.prepare(\n `INSERT INTO projects (id, git_origin, name, local_path, created_at)\n VALUES (?, ?, ?, ?, ?)`,\n ).run(id, input.git_origin, input.name, input.local_path, now);\n\n return { id, ...input, created_at: now };\n}\n\nexport function getProjectByOrigin(gitOrigin: string): Project | undefined {\n const db = getDb();\n return db\n .prepare(\"SELECT * FROM projects WHERE git_origin = ?\")\n .get(gitOrigin) as Project | undefined;\n}\n\nexport function getProject(id: string): Project | undefined {\n const db = getDb();\n return db.prepare(\"SELECT * FROM projects WHERE id = ?\").get(id) as\n | Project\n | undefined;\n}\n\nexport function upsertProject(input: {\n git_origin: string;\n name: string;\n local_path: string;\n}): Project {\n const existing = getProjectByOrigin(input.git_origin);\n if (existing) {\n const db = getDb();\n db.prepare(\"UPDATE projects SET local_path = ?, name = ? WHERE id = ?\").run(\n input.local_path,\n input.name,\n existing.id,\n );\n return { ...existing, local_path: input.local_path, name: input.name };\n }\n return createProject(input);\n}\n\nexport function listProjects(): Project[] {\n const db = getDb();\n return db.prepare(\"SELECT * FROM projects ORDER BY name\").all() as Project[];\n}\n\nexport function getProjectByLocalPath(localPath: string): Project | undefined {\n const normalized = resolve(localPath);\n return listProjects().find((project) => resolve(project.local_path) === normalized);\n}\n\nexport function applyPluginToProject(input: {\n project_id: string;\n plugin_id: string;\n platforms: string[];\n}): void {\n const db = getDb();\n const now = new Date().toISOString();\n\n db.prepare(\n `INSERT OR REPLACE INTO project_plugins (project_id, plugin_id, platforms, applied_at)\n VALUES (?, ?, ?, ?)`,\n ).run(input.project_id, input.plugin_id, JSON.stringify(input.platforms), now);\n}\n\n/** @deprecated Use applyPluginToProject */\nexport function applyConfiguredPluginToProject(input: {\n project_id: string;\n configured_plugin_id: string;\n platforms: string[];\n}): void {\n applyPluginToProject({\n project_id: input.project_id,\n plugin_id: input.configured_plugin_id,\n platforms: input.platforms,\n });\n}\n\nexport function getProjectPlugins(projectId: string): ProjectPlugin[] {\n const db = getDb();\n const rows = db\n .prepare(\n \"SELECT * FROM project_plugins WHERE project_id = ? ORDER BY applied_at DESC\",\n )\n .all(projectId) as Array<Omit<ProjectPlugin, \"platforms\"> & { platforms: string }>;\n\n return rows.map((row) => ({\n ...row,\n platforms: JSON.parse(row.platforms) as string[],\n }));\n}\n\n/** @deprecated Use getProjectPlugins */\nexport function getProjectConfiguredPlugins(projectId: string): ProjectPlugin[] {\n return getProjectPlugins(projectId);\n}\n\n/** @deprecated Use applyPluginToProject */\nexport const applyLayerToProject = applyPluginToProject;\n/** @deprecated Use applyConfiguredPluginToProject */\nexport const applyConfiguredLayerToProject = applyConfiguredPluginToProject;\n/** @deprecated Use getProjectPlugins */\nexport const getProjectLayers = getProjectPlugins;\n/** @deprecated Use getProjectConfiguredPlugins */\nexport const getProjectConfiguredLayers = getProjectConfiguredPlugins;\n","import { getDb } from \"../db/connection.js\";\nimport { normalizeRegisteredHarnesses } from \"../services/harness-targets.js\";\nimport type {\n CursorSkillMode,\n HarnessPreference,\n HarnessSelection,\n ProjectHarnessConfig,\n} from \"../types.js\";\n\ninterface HarnessPreferenceRow {\n scope: string;\n registered_harnesses: string;\n updated_at: string;\n}\n\ninterface ProjectHarnessRow {\n project_id: string;\n registered_harnesses: string;\n materialization_strategy: string;\n cursor_skill_mode: string | null;\n updated_at: string;\n}\n\nconst CURSOR_SKILL_MODES = new Set<CursorSkillMode>([\n \"agent-requested\",\n \"always-on\",\n \"agents-skills\",\n]);\n\nfunction parseCursorSkillMode(value: string | null | undefined): CursorSkillMode | undefined {\n if (!value) return undefined;\n return CURSOR_SKILL_MODES.has(value as CursorSkillMode)\n ? (value as CursorSkillMode)\n : undefined;\n}\n\nfunction parseRegisteredJson(value: string): string[] {\n try {\n const parsed = JSON.parse(value) as unknown;\n if (!Array.isArray(parsed)) return [];\n return normalizeRegisteredHarnesses(\n parsed.filter((entry): entry is string => typeof entry === \"string\"),\n );\n } catch {\n return [];\n }\n}\n\nfunction normalizeSelection(selection: HarnessSelection): HarnessSelection {\n return {\n registered_harnesses: normalizeRegisteredHarnesses(selection.registered_harnesses),\n };\n}\n\nfunction rowToPreference(row: HarnessPreferenceRow): HarnessPreference {\n return {\n registered_harnesses: parseRegisteredJson(row.registered_harnesses),\n updated_at: row.updated_at,\n };\n}\n\nfunction rowToProjectHarness(row: ProjectHarnessRow): ProjectHarnessConfig {\n const cursor_skill_mode = parseCursorSkillMode(row.cursor_skill_mode);\n return {\n project_id: row.project_id,\n registered_harnesses: parseRegisteredJson(row.registered_harnesses),\n materialization_strategy:\n row.materialization_strategy === \"copy\" ? \"copy\" : \"symlink-preferred\",\n ...(cursor_skill_mode ? { cursor_skill_mode } : {}),\n updated_at: row.updated_at,\n };\n}\n\nexport function getHarnessPreference(): HarnessPreference | undefined {\n const db = getDb();\n const row = db\n .prepare(\"SELECT * FROM harness_preferences WHERE scope = 'default'\")\n .get() as HarnessPreferenceRow | undefined;\n return row ? rowToPreference(row) : undefined;\n}\n\nexport function setHarnessPreference(\n selection: HarnessSelection,\n): HarnessPreference {\n const db = getDb();\n const now = new Date().toISOString();\n const normalized = normalizeSelection(selection);\n\n db.prepare(\n `INSERT INTO harness_preferences (scope, registered_harnesses, updated_at)\n VALUES ('default', ?, ?)\n ON CONFLICT(scope) DO UPDATE SET\n registered_harnesses = excluded.registered_harnesses,\n updated_at = excluded.updated_at`,\n ).run(\n JSON.stringify(normalized.registered_harnesses),\n now,\n );\n\n return {\n ...normalized,\n updated_at: now,\n };\n}\n\nexport function getProjectHarnessConfig(\n projectId: string,\n): ProjectHarnessConfig | undefined {\n const db = getDb();\n const row = db\n .prepare(\"SELECT * FROM project_harnesses WHERE project_id = ?\")\n .get(projectId) as ProjectHarnessRow | undefined;\n return row ? rowToProjectHarness(row) : undefined;\n}\n\nexport function setProjectHarnessConfig(input: {\n project_id: string;\n registered_harnesses: string[];\n materialization_strategy?: \"symlink-preferred\" | \"copy\";\n cursor_skill_mode?: CursorSkillMode;\n}): ProjectHarnessConfig {\n const db = getDb();\n const now = new Date().toISOString();\n const normalized = normalizeSelection({\n registered_harnesses: input.registered_harnesses,\n });\n const materialization_strategy =\n input.materialization_strategy ?? \"symlink-preferred\";\n const existing = getProjectHarnessConfig(input.project_id);\n const cursor_skill_mode =\n input.cursor_skill_mode ?? existing?.cursor_skill_mode;\n\n db.prepare(\n `INSERT INTO project_harnesses (\n project_id, registered_harnesses, materialization_strategy,\n cursor_skill_mode, updated_at\n )\n VALUES (?, ?, ?, ?, ?)\n ON CONFLICT(project_id) DO UPDATE SET\n registered_harnesses = excluded.registered_harnesses,\n materialization_strategy = excluded.materialization_strategy,\n cursor_skill_mode = excluded.cursor_skill_mode,\n updated_at = excluded.updated_at`,\n ).run(\n input.project_id,\n JSON.stringify(normalized.registered_harnesses),\n materialization_strategy,\n cursor_skill_mode ?? null,\n now,\n );\n\n return {\n project_id: input.project_id,\n ...normalized,\n materialization_strategy,\n ...(cursor_skill_mode ? { cursor_skill_mode } : {}),\n updated_at: now,\n };\n}\n\nexport function deleteProjectHarnessConfig(projectId: string): boolean {\n const db = getDb();\n const result = db\n .prepare(\"DELETE FROM project_harnesses WHERE project_id = ?\")\n .run(projectId);\n return result.changes > 0;\n}\n","import { CLI_ERRORS, CLI_HINTS } from \"../copy/cli.js\";\nimport { getHarnessPreference, getProjectHarnessConfig } from \"../models/harness.js\";\nimport { getProjectByLocalPath } from \"../models/project.js\";\nimport { getAllPlatforms } from \"../platforms/registry.js\";\nimport { CliUsageError } from \"./cli-errors.js\";\nimport { detectHomePlatforms } from \"./scanner.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\n\nexport function parsePlatformFilter(platform?: string): string[] | undefined {\n return platform?.split(\",\").map((p) => p.trim()).filter(Boolean);\n}\n\nexport function uniqueHarnessTargets(harnesses: readonly string[]): string[] {\n return [...new Set(harnesses.filter(Boolean))];\n}\n\n/** Ordered registered set. Drops empties and duplicates, first occurrence wins. */\nexport function normalizeRegisteredHarnesses(\n harnesses: readonly string[],\n): string[] {\n return uniqueHarnessTargets(harnesses);\n}\n\nexport function registeredHarnessesOf(\n selection:\n | { registered_harnesses?: readonly string[] }\n | null\n | undefined,\n): string[] {\n if (!selection?.registered_harnesses) return [];\n return normalizeRegisteredHarnesses(selection.registered_harnesses);\n}\n\n/** `--main`/`--aliases` and pre-v32 archive JSON. */\nexport function registeredFromLegacyParts(\n main?: string | null,\n aliases?: readonly string[] | null,\n): string[] {\n return normalizeRegisteredHarnesses([\n ...(main ? [main] : []),\n ...(aliases ?? []),\n ]);\n}\n\nexport function assertSupportedHarnessTargets(harnesses: string[]): void {\n const supported = new Set(getAllPlatforms().map((platform) => platform.id));\n const invalid = harnesses.filter((harness) => !supported.has(harness));\n if (invalid.length > 0) {\n throw new Error(`Unsupported harness: ${invalid.join(\", \")}`);\n }\n}\n\n/**\n * Global apply / profile use targets: explicit `--harness`, else the\n * registered set. Never falls back to filesystem detection of default\n * harnesses (claude-code, warp, jules, …) when none are registered.\n */\nexport function resolveRegisteredGlobalApplyHarnesses(harnessOption?: string): string[] {\n const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);\n if (explicitTargets.length > 0) {\n assertSupportedHarnessTargets(explicitTargets);\n return explicitTargets;\n }\n\n const preferredTargets = registeredHarnessesOf(getHarnessPreference());\n if (preferredTargets.length > 0) {\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n throw new CliUsageError(CLI_ERRORS.noHarnesses, [CLI_HINTS.harnessSetOrFlag]);\n}\n\nexport function resolveScanGlobalHarnessTargets(\n harnessOption?: string,\n homeRoot = resolveHomeRoot(),\n): string[] {\n const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);\n if (explicitTargets.length > 0) {\n assertSupportedHarnessTargets(explicitTargets);\n return explicitTargets;\n }\n\n const preference = getHarnessPreference();\n if (preference) {\n const preferredTargets = registeredHarnessesOf(preference);\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n const detectedTargets = uniqueHarnessTargets(\n detectHomePlatforms(homeRoot).map((result) => result.platformId),\n );\n if (detectedTargets.length > 0) {\n return detectedTargets;\n }\n\n throw new Error(\n \"No global harness targets configured. Run ht harness set or pass --harness <slugs>.\",\n );\n}\n\n/**\n * Project then global harness preference slugs. Filesystem detection is a\n * later step in `resolveCompileTargets` so declared `targets:` stay portable.\n */\nexport function collectApplyPreferenceHarnesses(projectRoot: string): string[] {\n const projectByPath = getProjectByLocalPath(projectRoot);\n const projectConfig = projectByPath\n ? getProjectHarnessConfig(projectByPath.id)\n : undefined;\n if (projectConfig) {\n const preferredTargets = registeredHarnessesOf(projectConfig);\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n const preference = getHarnessPreference();\n if (preference) {\n const preferredTargets = registeredHarnessesOf(preference);\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n return [];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,SAAS,eAAe;AACxB,SAAS,YAAY;AAGd,SAAS,cAAc,OAIlB;AACV,QAAM,KAAK,MAAM;AACjB,QAAM,O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AO;AAAA,EACT;AAEA,QAAM,IAAI,cAAc,WAAW,aAAa,CAAC,UAAU,gBAAgB,CAAC;AAC9E;AAEO,SAAS,gCACd,eACA,WAAW,gBAAgB,GACjB;AACV,QAAM,kBAAkB,qBAAqB,oBAAoB,aAAa,KAAK,CAAC,CAAC;AACrF,MAAI,gBAAgB,SAAS,GAAG;AAC9B,kCAA8B,eAAe;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,qBAAqB;AACxC,MAAI,YAAY;AACd,UAAM,mBAAmB,sBAAsB,UAAU;AACzD,kCAA8B,gBAAgB;AAC9C,WAAO;AAAA,EACT;AAEA,QAAM,kBAAkB;AAAA,IACtB,oBAAoB,QAAQ,EAAE,IAAI,CAAC,WAAW,OAAO,UAAU;AAAA,EACjE;AACA,MAAI,gBAAgB,SAAS,GAAG;AAC9B,WAAO;AAAA,EACT;AAEA,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;AAMO,SAAS,gCAAgC,aAA+B;AAC7E,QAAM,gBAAgB,sBAAsB,WAAW;AACvD,QAAM,gBAAgB,gBAClB,wBAAwB,cAAc,EAAE,IACxC;AACJ,MAAI,eAAe;AACjB,UAAM,mBAAmB,sBAAsB,aAAa;AAC5D,kCAA8B,gBAAgB;AAC9C,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,qBAAqB;AACxC,MAAI,YAAY;AACd,UAAM,mBAAmB,sBAAsB,UAAU;AACzD,kCAA8B,gBAAgB;AAC9C,WAAO;AAAA,EACT;AAEA,SAAO,CAAC;AACV;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/plugin-list-render.ts","../src/ui/plugin-origin-display.ts","../src/ui/version-render.ts","../src/services/wizards/adapters/plugin-table-browser.ts","../src/services/wizards/plugin-show.ts","../src/cli/handlers/resolve-plugin-mutation-target.ts"],"sourcesContent":["import semver from \"semver\";\nimport { isProfilePlugin } from \"../constants/profile.js\";\nimport type { CatalogPlugin } from \"../services/catalog-types.js\";\nimport { formatPluginVersionLabel } from \"../services/plugin-versioning.js\";\nimport type { Plugin } from \"../types.js\";\nimport {\n catalogPluginKey,\n formatCatalogScopePath,\n formatCatalogSelectionLabel,\n} from \"./catalog-list-render.js\";\nimport * as format from \"./format.js\";\nimport { matchesListSearchQuery, parseListSearchQuery } from \"./list-search.js\";\nimport {\n computeMaxVisibleTableRows,\n renderFoldedHintLine,\n resolveSectionViewport,\n type SectionViewport,\n VIEWPORT_CHROME_LINES,\n} from \"./list-viewport.js\";\nimport { formatPluginOriginDisplay } from \"./plugin-origin-display.js\";\nimport { type Column, renderTable, resolveTableMaxWidth } from \"./table.js\";\nimport { icons, theme } from \"./theme.js\";\nimport { formatVersionWithDrift } from \"./version-render.js\";\n\nexport function formatLocalPluginListName(\n plugin: Pick<Plugin, \"name\" | \"tags\">,\n opts?: { selected?: boolean; static?: boolean },\n): string {\n const kind = isProfilePlugin(plugin)\n ? `${theme.accent(icons.profile)} `\n : opts?.static\n ? \"\"\n : \" \";\n if (opts?.static) {\n return `${kind}${plugin.name}`;\n }\n const cursor = opts?.selected ? \">\" : \" \";\n return `${cursor}${kind}${plugin.name}`;\n}\n\nexport function formatCatalogPluginListSlug(\n plugin: Pick<CatalogPlugin, \"slug\" | \"tags\">,\n opts?: { selected?: boolean },\n): string {\n const slug = isProfilePlugin(plugin)\n ? `${theme.accent(icons.profile)} ${plugin.slug}`\n : plugin.slug;\n if (opts?.selected) {\n return `> ${slug}`;\n }\n return opts === undefined ? slug : ` ${slug}`;\n}\n\nexport function formatCatalogPluginListName(plugin: Pick<CatalogPlugin, \"name\" | \"tags\">): string {\n if (!isProfilePlugin(plugin)) {\n return plugin.name;\n }\n return `${theme.accent(icons.profile)} ${plugin.name}`;\n}\n\nexport function formatCatalogPluginListSelector(\n plugin: CatalogPlugin,\n opts?: { selected?: boolean },\n): string {\n const listDisplayName = formatCatalogSelectionLabel(plugin);\n if (!isProfilePlugin(plugin)) {\n return opts?.selected ? `> ${listDisplayName}` : listDisplayName;\n }\n const marked = `${theme.accent(icons.profile)} ${listDisplayName}`;\n return opts?.selected ? `> ${marked}` : marked;\n}\n\nexport const PLUGIN_LIST_SECTIONS = [\"local\", \"remote\"] as const;\nexport type PluginListSection = (typeof PLUGIN_LIST_SECTIONS)[number];\n\nexport type PluginListBrowseRow =\n | { section: \"local\"; plugin: Plugin }\n | { section: \"remote\"; catalogPlugin: CatalogPlugin };\n\nexport function pluginListBrowseRowKey(row: PluginListBrowseRow): string {\n return row.section === \"local\"\n ? `local:${row.plugin.id}`\n : `remote:${catalogPluginKey(row.catalogPlugin)}`;\n}\n\nexport function toLocalBrowseRows(plugins: Plugin[]): PluginListBrowseRow[] {\n return plugins.map((plugin) => ({ section: \"local\", plugin }));\n}\n\nexport function toRemoteBrowseRows(plugins: CatalogPlugin[]): PluginListBrowseRow[] {\n return plugins.map((catalogPlugin) => ({ section: \"remote\", catalogPlugin }));\n}\n\nexport function filterLocalBrowseRows(\n plugins: Plugin[],\n search: string,\n): PluginListBrowseRow[] {\n const parsed = parseListSearchQuery(search);\n if (parsed.raw.length === 0) {\n return toLocalBrowseRows(plugins);\n }\n\n const sectionIsLocal = parsed.section === \"local\";\n const textQuery = parsed.section !== undefined && parsed.section !== \"local\"\n ? { section: undefined, text: parsed.raw, raw: parsed.raw }\n : parsed;\n\n if (parsed.section !== undefined && parsed.section !== \"local\" && !sectionIsLocal) {\n return [];\n }\n\n const filtered = plugins.filter((plugin) => {\n const haystack = [plugin.name, plugin.description, ...plugin.tags].join(\" \");\n return matchesListSearchQuery(haystack, textQuery);\n });\n return toLocalBrowseRows(filtered);\n}\n\nexport function listNavigablePluginListBrowseRows(\n local: PluginListBrowseRow[],\n remote: PluginListBrowseRow[],\n): PluginListBrowseRow[] {\n return [\n ...local.filter((row) => row.section === \"local\"),\n ...remote.filter((row) => row.section === \"remote\"),\n ];\n}\n\nexport type PluginListBrowseActiveSectionContext = {\n section: PluginListSection;\n indexInSection: number;\n sectionRows: PluginListBrowseRow[];\n prevSection?: { section: PluginListSection; count: number };\n nextSection?: { section: PluginListSection; count: number };\n};\n\nfunction sectionCount(\n navigable: PluginListBrowseRow[],\n section: PluginListSection,\n): number {\n return navigable.filter((row) => row.section === section).length;\n}\n\nfunction sectionLabel(section: PluginListSection, profileMode: boolean): string {\n if (section === \"local\") {\n return profileMode ? \"Local profiles\" : \"Local plugins\";\n }\n return \"Remote catalog\";\n}\n\nexport function resolvePluginListActiveSectionContext(\n navigable: PluginListBrowseRow[],\n active: number,\n): PluginListBrowseActiveSectionContext {\n const selected = navigable[active];\n if (!selected) {\n return { section: \"local\", indexInSection: 0, sectionRows: [] };\n }\n\n const section = selected.section;\n const sectionRows = navigable.filter((row) => row.section === section);\n const indexInSection = sectionRows.indexOf(selected);\n\n const sectionIndex = PLUGIN_LIST_SECTIONS.indexOf(section);\n const prevSection = PLUGIN_LIST_SECTIONS.slice(0, sectionIndex)\n .reverse()\n .map((prev) => ({\n section: prev,\n count: sectionCount(navigable, prev),\n }))\n .find((entry) => entry.count > 0);\n const nextSection = PLUGIN_LIST_SECTIONS.slice(sectionIndex + 1)\n .map((next) => ({\n section: next,\n count: sectionCount(navigable, next),\n }))\n .find((entry) => entry.count > 0);\n\n return { section, indexInSection, sectionRows, prevSection, nextSection };\n}\n\nfunction renderSectionSubheader(\n section: PluginListSection,\n count: number,\n profileMode: boolean,\n scopeLabel?: string,\n): string {\n const label = sectionLabel(section, profileMode);\n const suffix = section === \"remote\" && scopeLabel\n ? theme.muted(` · ${scopeLabel} (${count})`)\n : theme.muted(` (${count})`);\n return `${theme.accent(label)}${suffix}`;\n}\n\nexport function buildPluginViewportHintSegments(\n ctx: PluginListBrowseActiveSectionContext,\n viewport: SectionViewport,\n profileMode: boolean,\n scopeLabel?: string,\n): string[] {\n const segments: string[] = [];\n const hiddenBelow = ctx.sectionRows.length - viewport.end;\n const hiddenAbove = viewport.start;\n if (hiddenAbove > 0) {\n segments.push(`↑ ${hiddenAbove} above`);\n }\n if (hiddenBelow > 0) {\n segments.push(\n `↓ ${hiddenBelow} more in ${sectionLabel(ctx.section, profileMode).toLowerCase()}`,\n );\n }\n if (ctx.nextSection) {\n segments.push(\n `${sectionLabel(ctx.nextSection.section, profileMode)} (${ctx.nextSection.count})`,\n );\n segments.push(\"↓ next section\");\n }\n if (viewport.start === 0 && ctx.prevSection) {\n segments.push(\n `${sectionLabel(ctx.prevSection.section, profileMode)} (${ctx.prevSection.count})`,\n );\n segments.push(\"↑ prev section\");\n }\n if (ctx.section === \"remote\" && scopeLabel && ctx.sectionRows.length === 0) {\n segments.push(`Catalog: ${scopeLabel}`);\n }\n return segments;\n}\n\nfunction renderViewportOverflowHints(\n ctx: PluginListBrowseActiveSectionContext,\n viewport: SectionViewport,\n profileMode: boolean,\n maxWidth: number,\n scopeLabel?: string,\n): string {\n const folded = renderFoldedHintLine(\n buildPluginViewportHintSegments(ctx, viewport, profileMode, scopeLabel),\n maxWidth,\n );\n return folded.length > 0 ? theme.muted(folded) : \"\";\n}\n\ntype LocalTableRow = {\n id?: string;\n name: string;\n origin: string;\n version: string;\n active?: string;\n description: string;\n};\n\nfunction formatOriginCell(origin: string): string {\n if (origin === \"upstream\" || origin === \"catalog\") {\n return theme.muted(origin);\n }\n return origin || \"authored\";\n}\n\nfunction makeLocalColumns(showId: boolean, profileMode: boolean): Column[] {\n const columns: Column[] = [];\n if (showId) {\n columns.push({\n key: \"id\",\n header: \"ID\",\n width: 12,\n transform: (value: string) => format.shortenId(String(value)),\n });\n }\n columns.push(\n {\n key: \"name\",\n header: \"NAME\",\n width: 26,\n style: (value) => (value.startsWith(\">\") ? theme.accent(value) : value),\n },\n {\n key: \"origin\",\n header: \"ORIGIN\",\n width: 12,\n style: (value) => formatOriginCell(String(value)),\n },\n { key: \"version\", header: \"VERSION\", width: 12 },\n );\n if (profileMode) {\n columns.push({ key: \"active\", header: \"ACTIVE\", width: 8 });\n }\n columns.push({\n key: \"description\",\n header: \"DESCRIPTION\",\n width: 44,\n truncate: true,\n transform: (value) => value || \": \",\n });\n return columns;\n}\n\nfunction makeRemoteColumns(highlightSelection: boolean): Column[] {\n return [\n {\n key: \"catalog\",\n header: \"CATALOG\",\n width: 28,\n },\n {\n key: \"slug\",\n header: \"PLUGIN\",\n width: 26,\n style: highlightSelection\n ? (value) => (value.startsWith(\">\") ? theme.accent(value) : value)\n : undefined,\n },\n {\n key: \"version\",\n header: \"VERSION\",\n width: 12,\n },\n {\n key: \"updatedAt\",\n header: \"UPDATED\",\n width: 16,\n fitContent: true,\n transform: (value) =>\n value ? format.formatRelativeTime(String(value)) : theme.muted(\": \"),\n },\n ];\n}\n\nfunction findInstalledLocalPlugin(\n catalogPlugin: CatalogPlugin,\n localPlugins: Plugin[],\n): Plugin | undefined {\n const publishedMatches = localPlugins.filter(\n (plugin) =>\n plugin.org_slug === catalogPlugin.orgSlug\n && plugin.catalog_slug === catalogPlugin.catalogSlug\n && plugin.name === catalogPlugin.slug,\n );\n if (publishedMatches.length === 0) {\n return undefined;\n }\n return [...publishedMatches].sort((left, right) => semver.rcompare(left.version, right.version))[0];\n}\n\nfunction formatRemoteCatalogVersion(\n catalogPlugin: CatalogPlugin,\n localPlugins: Plugin[],\n): string {\n const latestVersion = catalogPlugin.latestVersion;\n if (!latestVersion) {\n return theme.muted(\": \");\n }\n\n const installed = findInstalledLocalPlugin(catalogPlugin, localPlugins);\n const displayVersion = installed?.version ?? latestVersion;\n return formatVersionWithDrift(displayVersion, latestVersion);\n}\n\nfunction tableLayout(maxWidth?: number): { maxWidth: number; wordWrap: true } {\n return {\n maxWidth: resolveTableMaxWidth(maxWidth),\n wordWrap: true,\n };\n}\n\nfunction renderLocalSectionTable(\n rows: PluginListBrowseRow[],\n activeRow: PluginListBrowseRow | undefined,\n opts: {\n showId: boolean;\n profileMode: boolean;\n activeProfileName?: string | null;\n maxWidth?: number;\n },\n): string {\n const localRows = rows.filter((row): row is Extract<PluginListBrowseRow, { section: \"local\" }> =>\n row.section === \"local\",\n );\n if (localRows.length === 0) {\n return theme.muted(opts.profileMode ? \"No profile plugins found.\" : \"No plugins found.\");\n }\n\n const activePluginId = activeRow?.section === \"local\" ? activeRow.plugin.id : undefined;\n const tableRows: LocalTableRow[] = localRows.map((row) => ({\n ...(opts.showId ? { id: row.plugin.id } : {}),\n name: formatLocalPluginListName(row.plugin, {\n selected: row.plugin.id === activePluginId,\n }),\n origin: formatPluginOriginDisplay(\n row.plugin.origin || \"authored\",\n row.plugin.origin_locator,\n ),\n version: formatPluginVersionLabel(row.plugin.version, row.plugin.dirty),\n ...(opts.profileMode\n ? {\n active: opts.activeProfileName === row.plugin.name ? \"yes\" : \"\",\n }\n : {}),\n description: row.plugin.description ?? \"\",\n }));\n\n return renderTable({\n columns: makeLocalColumns(opts.showId, opts.profileMode),\n rows: tableRows,\n ...tableLayout(opts.maxWidth),\n });\n}\n\nfunction renderRemoteSectionTable(\n rows: PluginListBrowseRow[],\n activeRow: PluginListBrowseRow | undefined,\n opts: { maxWidth?: number; localPlugins?: Plugin[] },\n): string {\n const remoteRows = rows.filter((row): row is Extract<PluginListBrowseRow, { section: \"remote\" }> =>\n row.section === \"remote\",\n );\n if (remoteRows.length === 0) {\n return theme.muted(\"No matching plugins.\");\n }\n\n const activeKey = activeRow?.section === \"remote\"\n ? catalogPluginKey(activeRow.catalogPlugin)\n : undefined;\n const localPlugins = opts.localPlugins ?? [];\n const tableRows = remoteRows.map((row) => {\n const isSelected = catalogPluginKey(row.catalogPlugin) === activeKey;\n return {\n catalog: formatCatalogScopePath(row.catalogPlugin),\n slug: formatCatalogPluginListSlug(row.catalogPlugin, { selected: isSelected }),\n version: formatRemoteCatalogVersion(row.catalogPlugin, localPlugins),\n updatedAt: row.catalogPlugin.updatedAt ?? \"\",\n };\n });\n\n return renderTable({\n columns: makeRemoteColumns(true),\n rows: tableRows,\n ...tableLayout(opts.maxWidth),\n });\n}\n\nexport type PluginListBrowseViewportOptions = {\n activeIndex: number;\n navigable: PluginListBrowseRow[];\n terminalRows: number;\n maxWidth?: number;\n showId?: boolean;\n profileMode?: boolean;\n activeProfileName?: string | null;\n scopeLabel?: string;\n localPlugins?: Plugin[];\n};\n\nexport function renderGroupedPluginListBrowseViewport(\n opts: PluginListBrowseViewportOptions,\n): string {\n if (opts.navigable.length === 0) {\n return theme.muted(\"No matching plugins.\");\n }\n\n const ctx = resolvePluginListActiveSectionContext(opts.navigable, opts.activeIndex);\n if (ctx.sectionRows.length === 0) {\n return theme.muted(\"No matching plugins.\");\n }\n\n const profileMode = Boolean(opts.profileMode);\n const maxWidth = resolveTableMaxWidth(opts.maxWidth);\n const maxVisibleRows = computeMaxVisibleTableRows(\n opts.terminalRows,\n VIEWPORT_CHROME_LINES.pluginListBrowse,\n { sectionOverhead: 6 },\n );\n const viewport = resolveSectionViewport(\n ctx.sectionRows.length,\n ctx.indexInSection,\n maxVisibleRows,\n );\n const visibleRows = ctx.sectionRows.slice(viewport.start, viewport.end);\n const activeRow = opts.navigable[opts.activeIndex];\n const table = ctx.section === \"local\"\n ? renderLocalSectionTable(visibleRows, activeRow, {\n showId: Boolean(opts.showId),\n profileMode,\n activeProfileName: opts.activeProfileName,\n maxWidth: opts.maxWidth,\n })\n : renderRemoteSectionTable(visibleRows, activeRow, {\n maxWidth: opts.maxWidth,\n localPlugins: opts.localPlugins,\n });\n\n return [\n renderSectionSubheader(\n ctx.section,\n ctx.sectionRows.length,\n profileMode,\n opts.scopeLabel,\n ),\n table,\n renderViewportOverflowHints(ctx, viewport, profileMode, maxWidth, opts.scopeLabel),\n ]\n .filter((line) => line.length > 0)\n .join(\"\\n\");\n}\n\nexport function formatPluginListBrowseSelectionLabel(row: PluginListBrowseRow): string {\n if (row.section === \"local\") {\n return isProfilePlugin(row.plugin)\n ? `${icons.profile} ${row.plugin.name}`\n : row.plugin.name;\n }\n return isProfilePlugin(row.catalogPlugin)\n ? `${icons.profile} ${formatCatalogSelectionLabel(row.catalogPlugin)}`\n : formatCatalogSelectionLabel(row.catalogPlugin);\n}\n","import type { PluginOrigin } from \"../types.js\";\nimport { parseDependencyRef } from \"../utils/plugin-dependency-ref.js\";\nimport { parseOriginLocator } from \"../utils/plugin-origin-locator.js\";\n\n/**\n * Human origin label for plugin packages.\n * Marketplace imports show the marketplace name, not the storage enum.\n */\nexport function formatPluginOriginDisplay(\n origin: PluginOrigin,\n originLocator?: string | null,\n): string {\n if (origin === \"authored\") {\n return \"authored\";\n }\n const locator = originLocator?.trim()\n ? parseOriginLocator(originLocator)\n : null;\n if (!locator) {\n return origin;\n }\n switch (locator.kind) {\n case \"marketplace\": {\n const parsed = parseDependencyRef(locator.ref);\n return parsed.namespace || locator.ref;\n }\n case \"git\":\n return locator.url;\n case \"catalog\":\n return `${locator.org}/${locator.catalog}`;\n default: {\n const _exhaustive: never = locator;\n return _exhaustive;\n }\n }\n}\n","import semver from \"semver\";\nimport { theme } from \"./theme.js\";\n\nfunction normalizeVersion(version: string): string {\n return version.startsWith(\"v\") ? version.slice(1) : version;\n}\n\nfunction parseCoreParts(version: string): [number, number, number] | null {\n const parsed = semver.parse(normalizeVersion(version), { loose: true });\n if (!parsed) {\n return null;\n }\n return [parsed.major, parsed.minor, parsed.patch];\n}\n\nexport function formatVersionWithDrift(current: string, latest: string | null): string {\n if (!current) {\n return theme.muted(\": \");\n }\n if (!latest) {\n return current;\n }\n\n const normalizedCurrent = normalizeVersion(current);\n const normalizedLatest = normalizeVersion(latest);\n\n if (normalizedCurrent === normalizedLatest) {\n return theme.success(normalizedCurrent);\n }\n\n const currentParts = parseCoreParts(normalizedCurrent);\n const latestParts = parseCoreParts(normalizedLatest);\n if (!currentParts || !latestParts) {\n if (semver.valid(normalizedCurrent) && semver.valid(normalizedLatest)) {\n return semver.gte(normalizedCurrent, normalizedLatest)\n ? theme.success(normalizedCurrent)\n : theme.danger(normalizedCurrent);\n }\n return normalizedCurrent;\n }\n\n if (semver.gte(normalizedCurrent, normalizedLatest)) {\n return theme.success(normalizedCurrent);\n }\n\n let firstDivergentIndex = 3;\n for (let index = 0; index < currentParts.length; index += 1) {\n if (currentParts[index] !== latestParts[index]) {\n firstDivergentIndex = index;\n break;\n }\n }\n\n const segments = normalizedCurrent.split(\".\");\n let rendered = \"\";\n for (let index = 0; index < segments.length; index += 1) {\n if (index > 0) {\n rendered += \".\";\n }\n const segment = segments[index] ?? \"\";\n rendered += index < firstDivergentIndex\n ? theme.success(segment)\n : theme.danger(segment);\n }\n return rendered;\n}\n","import type { Plugin } from \"../../../types.js\";\nimport {\n filterLocalBrowseRows,\n renderGroupedPluginListBrowseViewport,\n toLocalBrowseRows,\n type PluginListBrowseRow,\n} from \"../../../ui/plugin-list-render.js\";\nimport type {\n TableBrowserAdapter,\n ViewportRenderArgs,\n} from \"../prompts/table-browser-types.js\";\n\nexport function createLocalPluginPickAdapter(config: {\n plugins: Plugin[];\n profileMode?: boolean;\n showId?: boolean;\n activeProfileName?: string | null;\n onPick?: (plugin: Plugin) => string;\n}): TableBrowserAdapter<PluginListBrowseRow, string> {\n return {\n resolveItems: (query) => {\n const navigable = filterLocalBrowseRows(config.plugins, query);\n return { filtered: navigable, navigable };\n },\n renderViewport: (args: ViewportRenderArgs<PluginListBrowseRow>) =>\n renderGroupedPluginListBrowseViewport({\n activeIndex: args.active,\n navigable: args.navigable,\n terminalRows: args.terminalRows,\n maxWidth: args.terminalWidth,\n showId: config.showId,\n profileMode: config.profileMode,\n activeProfileName: config.activeProfileName,\n }),\n renderShow: (row) =>\n row.section === \"local\"\n ? `${row.plugin.name}@${row.plugin.version}`\n : \"\",\n onPick: (row) => {\n if (row.section !== \"local\") {\n return \"\";\n }\n return config.onPick?.(row.plugin) ?? row.plugin.name;\n },\n helpActions: [\n [\"↑↓\", \"select\"],\n [\"type\", \"search\"],\n [\"⏎\", \"select\"],\n [\"esc\", \"cancel\"],\n ],\n };\n}\n\nexport function toLocalPluginPickRows(plugins: Plugin[]): PluginListBrowseRow[] {\n return toLocalBrowseRows(plugins);\n}\n","import { listPlugins } from \"../../models/plugin-model.js\";\nimport { getActiveProfileName } from \"../active-profile.js\";\nimport { isProfilePlugin } from \"../../constants/profile.js\";\nimport { createLocalPluginPickAdapter } from \"./adapters/plugin-table-browser.js\";\nimport { createTableBrowserPrompt } from \"./prompts/create-table-browser-prompt.js\";\n\nexport async function runPluginShowWizard(input?: {\n message?: string;\n search?: string;\n profileMode?: boolean;\n}): Promise<string | undefined> {\n const plugins = listPlugins().filter((plugin) =>\n input?.profileMode ? isProfilePlugin(plugin) : true,\n );\n if (plugins.length === 0) {\n return undefined;\n }\n\n const result = await createTableBrowserPrompt({\n message:\n input?.message\n ?? (input?.profileMode\n ? \"Which profile do you want to show?\"\n : \"Which plugin do you want to show?\"),\n initialQuery: input?.search,\n intent: { kind: \"pick-one\", action: \"show\" },\n adapter: createLocalPluginPickAdapter({\n plugins,\n profileMode: input?.profileMode,\n activeProfileName: input?.profileMode ? getActiveProfileName() : null,\n onPick: (plugin) => plugin.name,\n }),\n });\n\n if (result.kind === \"pick-one\") {\n return result.value;\n }\n\n return undefined;\n}\n","import { runPluginShowWizard } from \"../../services/wizards/plugin-show.js\";\nimport { resolveOrPrompt, shouldUseWizard } from \"../../services/wizards/shared.js\";\nimport { parseOutputFormat } from \"../../utils/output-format.js\";\n\nexport async function resolvePluginMutationTarget(input: {\n pluginName?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n message: string;\n profileMode?: boolean;\n}): Promise<string | undefined> {\n const format = parseOutputFormat(input.format);\n\n return resolveOrPrompt({\n value: input.pluginName,\n shouldPrompt: shouldUseWizard({\n interactive: input.interactive,\n noInteractive: input.noInteractive,\n format,\n missingRequiredArgs: !input.pluginName,\n }),\n prompt: async () =>\n runPluginShowWizard({ message: input.message, profileMode: input.profileMode }),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,aAAY;;;ACQZ,SAAS,0BACd,QACA,eACQ;AACR,MAAI,WAAW,YAAY;AACzB,WAAO;AAAA,EAC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BAAoB,EAAE,SAAS,MAAM,SAAS,aAAa,MAAM,YAAY,CAAC;AAAA,EAClF,CAAC;AACH;","names":["semver","semver"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/plugin-resource-mode.ts","../src/config/settings.ts"],"sourcesContent":["export const PLUGIN_RESOURCE_MODES = [\"symlink\", \"copy\", \"clone\"] as const;\n\nexport type PluginResourceMode = (typeof PLUGIN_RESOURCE_MODES)[number];\n\nexport const DEFAULT_PLUGIN_RESOURCE_MODE: PluginResourceMode = \"symlink\";\n\nexport function isPluginResourceMode(value: unknown): value is PluginResourceMode {\n return value === \"symlink\" || value === \"copy\" || value === \"clone\";\n}\n\nexport function parsePluginResourceMode(\n value: string | undefined,\n): PluginResourceMode {\n if (isPluginResourceMode(value)) return value;\n throw new Error(\n `Invalid plugin resource mode: ${value}. Use symlink, copy, or clone.`,\n );\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n DEFAULT_PLUGIN_RESOURCE_MODE,\n isPluginResourceMode,\n type PluginResourceMode,\n} from \"../services/plugin-resource-mode.js\";\n\nexport type PluginMarketplacePlatform =\n | \"claude-code\"\n | \"cursor\"\n | \"goose\"\n | \"copilot-cli\";\n\nexport interface PluginMarketplaceEntry {\n name: string;\n url: string;\n platforms: PluginMarketplacePlatform[];\n /** Extra git branches to catalog. Empty/omitted tracks only the default branch. */\n trackedBranches?: string[];\n}\n\nexport interface HarnesstapSettings {\n plugins: {\n refreshMaxAgeHours: number;\n marketplaceRefreshMaxAgeMinutes: number;\n marketplaces: PluginMarketplaceEntry[];\n };\n pluginVersionHistoryLimit: number;\n harnessSync: {\n pluginResources: PluginResourceMode;\n };\n}\n\nconst VALID_PLATFORMS = new Set<PluginMarketplacePlatform>([\n \"claude-code\",\n \"cursor\",\n \"goose\",\n \"copilot-cli\",\n]);\n\nexport const DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES = 60;\n\nexport function marketplaceRefreshMaxAgeMs(minutes: number): number {\n return minutes * 60 * 1000;\n}\n\nconst DEFAULTS: HarnesstapSettings = {\n plugins: {\n refreshMaxAgeHours: 24,\n marketplaceRefreshMaxAgeMinutes: DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES,\n marketplaces: [],\n },\n pluginVersionHistoryLimit: 10,\n harnessSync: { pluginResources: DEFAULT_PLUGIN_RESOURCE_MODE },\n};\n\nfunction isPluginMarketplacePlatform(\n value: unknown,\n): value is PluginMarketplacePlatform {\n return (\n typeof value === \"string\" &&\n VALID_PLATFORMS.has(value as PluginMarketplacePlatform)\n );\n}\n\nexport function parseTrackedBranches(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n\n const seen = new Set<string>();\n const branches: string[] = [];\n for (const item of value) {\n if (typeof item !== \"string\") continue;\n const trimmed = item.trim();\n if (!trimmed || seen.has(trimmed)) continue;\n seen.add(trimmed);\n branches.push(trimmed);\n }\n return branches;\n}\n\nexport function settingsPath(harnesstapDir: string): string {\n return existsSync(join(harnesstapDir, \"config.jsonc\"))\n ? join(harnesstapDir, \"config.jsonc\")\n : join(harnesstapDir, \"config.json\");\n}\n\nexport function parseMarketplaces(value: unknown): PluginMarketplaceEntry[] {\n if (!Array.isArray(value)) return [];\n\n const marketplaces: PluginMarketplaceEntry[] = [];\n for (const row of value) {\n if (typeof row !== \"object\" || row === null) continue;\n\n const record = row as Record<string, unknown>;\n const name = record.name;\n const url = record.url;\n const platforms = record.platforms;\n\n if (typeof name !== \"string\") continue;\n const trimmedName = name.trim();\n if (trimmedName.length === 0) continue;\n if (typeof url !== \"string\") continue;\n const trimmedUrl = url.trim();\n if (trimmedUrl.length === 0) continue;\n if (!Array.isArray(platforms)) continue;\n\n const parsedPlatforms = platforms.filter(isPluginMarketplacePlatform);\n if (parsedPlatforms.length === 0) continue;\n\n const trackedBranches = parseTrackedBranches(record.trackedBranches);\n marketplaces.push({\n name: trimmedName,\n url: trimmedUrl,\n platforms: parsedPlatforms,\n ...(trackedBranches.length > 0 ? { trackedBranches } : {}),\n });\n }\n\n return marketplaces;\n}\n\nexport function parseJsonc(content: string): unknown {\n let normalized = \"\";\n let inString = false;\n let stringQuote = '\"';\n let escaping = false;\n let inLineComment = false;\n let inBlockComment = false;\n\n for (let index = 0; index < content.length; index++) {\n const char = content[index];\n const nextChar = content[index + 1];\n\n if (inLineComment) {\n if (char === \"\\n\") {\n inLineComment = false;\n normalized += char;\n }\n continue;\n }\n\n if (inBlockComment) {\n if (char === \"*\" && nextChar === \"/\") {\n inBlockComment = false;\n index++;\n }\n continue;\n }\n\n if (inString) {\n normalized += char;\n if (escaping) {\n escaping = false;\n continue;\n }\n if (char === \"\\\\\") {\n escaping = true;\n continue;\n }\n if (char === stringQuote) {\n inString = false;\n }\n continue;\n }\n\n if ((char === '\"' || char === \"'\") && !inString) {\n inString = true;\n stringQuote = char;\n normalized += char;\n continue;\n }\n\n if (char === \"/\" && nextChar === \"/\") {\n inLineComment = true;\n index++;\n continue;\n }\n\n if (char === \"/\" && nextChar === \"*\") {\n inBlockComment = true;\n index++;\n continue;\n }\n\n if (char === \",\") {\n let lookahead = index + 1;\n while (lookahead < content.length) {\n const lookaheadChar = content[lookahead];\n const lookaheadNextChar = content[lookahead + 1];\n\n if (lookaheadChar !== undefined && /\\s/.test(lookaheadChar)) {\n lookahead++;\n continue;\n }\n\n if (lookaheadChar === \"/\" && lookaheadNextChar === \"/\") {\n lookahead += 2;\n while (lookahead < content.length && content[lookahead] !== \"\\n\") {\n lookahead++;\n }\n continue;\n }\n\n if (lookaheadChar === \"/\" && lookaheadNextChar === \"*\") {\n lookahead += 2;\n while (\n lookahead < content.length &&\n !(content[lookahead] === \"*\" && content[lookahead + 1] === \"/\")\n ) {\n lookahead++;\n }\n lookahead += 2;\n continue;\n }\n\n if (lookaheadChar === \"}\" || lookaheadChar === \"]\") {\n break;\n }\n\n normalized += char;\n break;\n }\n\n if (lookahead >= content.length) {\n normalized += char;\n }\n continue;\n }\n\n normalized += char;\n }\n\n return JSON.parse(normalized);\n}\n\nexport function loadSettings(harnesstapDir: string): HarnesstapSettings {\n const path = settingsPath(harnesstapDir);\n if (!existsSync(path)) return DEFAULTS;\n try {\n const raw = parseJsonc(readFileSync(path, \"utf-8\")) as Partial<HarnesstapSettings> & {\n harnessSync?: { pluginResources?: unknown };\n };\n const hours = raw.plugins?.refreshMaxAgeHours;\n const marketplaceMinutes = raw.plugins?.marketplaceRefreshMaxAgeMinutes;\n const limit = raw.pluginVersionHistoryLimit;\n const pluginResources = raw.harnessSync?.pluginResources;\n return {\n plugins: {\n refreshMaxAgeHours:\n typeof hours === \"number\" && hours > 0\n ? hours\n : DEFAULTS.plugins.refreshMaxAgeHours,\n marketplaceRefreshMaxAgeMinutes:\n typeof marketplaceMinutes === \"number\" && marketplaceMinutes > 0\n ? marketplaceMinutes\n : DEFAULTS.plugins.marketplaceRefreshMaxAgeMinutes,\n marketplaces: parseMarketplaces(raw.plugins?.marketplaces),\n },\n pluginVersionHistoryLimit:\n typeof limit === \"number\" && Number.isInteger(limit) && limit >= 1\n ? limit\n : DEFAULTS.pluginVersionHistoryLimit,\n harnessSync: {\n pluginResources: isPluginResourceMode(pluginResources)\n ? pluginResources\n : DEFAULTS.harnessSync.pluginResources,\n },\n };\n } catch {\n return DEFAULTS;\n }\n}\n\nexport function readToolkitConfigRecord(\n harnesstapDir: string,\n path = settingsPath(harnesstapDir),\n): Record<string, unknown> {\n if (!existsSync(path)) {\n return {};\n }\n try {\n const parsed = parseJsonc(readFileSync(path, \"utf-8\"));\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n return {};\n } catch {\n return {};\n }\n}\n\nexport function writeToolkitConfigRecord(\n harnesstapDir: string,\n record: Record<string, unknown>,\n path = settingsPath(harnesstapDir),\n): void {\n mkdirSync(harnesstapDir, { recursive: true });\n writeFileSync(path, `${JSON.stringify(record, null, 2)}\\n`, \"utf-8\");\n}\n\nexport function saveSettings(\n harnesstapDir: string,\n settings: HarnesstapSettings,\n): void {\n const path = settingsPath(harnesstapDir);\n const existing = readToolkitConfigRecord(harnesstapDir, path);\n writeToolkitConfigRecord(\n harnesstapDir,\n {\n ...existing,\n plugins: settings.plugins,\n pluginVersionHistoryLimit: settings.pluginVersionHistoryLimit,\n harnessSync: settings.harnessSync,\n },\n path,\n );\n}\n"],"mappings":";AAIO,IAAM,+BAAmD;AAEzD,SAAS,qBAAqB,OAA6C;AAChF,SAAO,UAAU,aAAa,UAAU,UAAU,UAAU;AAC9D;AAEO,SAAS,wBACd,OACoB;AACpB,MAAI,qBAAqB,KAAK,EAAG,QAAO;AACxC,QAAM,IAAI;AAAA,IACR,iCAAiC,KAAK;AAAA,EACxC;AACF;;;ACjBA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,YAAY;AAiCrB,IAAM,kBAAkB,oBAAI,IAA+B;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,8CAA8C;AAEpD,SAAS,2BAA2B,SAAyB;AAClE,SAAO,UAAU,KAAK;AACxB;AAEA,IAAM,WAA+B;AAAA,EACnC,SAAS;AAAA,IACP,oBAAoB;AAAA,IACpB,iCAAiC;AAAA,IACjC,cAAc,CAAC;AAAA,EACjB;AAAA,EACA,2BAA2B;AAAA,EAC3B,aAAa,EAAE,iBAAiB,6BAA6B;AAC/D;AAEA,SAAS,4BACP,OACoC;AACpC,SACE,OAAO,UAAU,YACjB,gBAAgB,IAAI,KAAkC;AAE1D;AAEO,SAAS,qBAAqB,OAA0B;AAC7D,MAAI,CAAC,MAAM,QAAQ,KAAK,EAAG,QAAO,CAAC;AAEnC,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,WAAqB,CAAC;AAC5B,aAAW,QAAQ,OAAO;AACxB,QAAI,OAAO,SAAS,SAAU;AAC9B,UAAM,UAAU,KAAK,KAAK;AAC1B,QAAI,CAAC,WAAW,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A,IACT;AACA,WAAO,CAAC;AAAA,EACV,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAEO,SAAS,yBACd,eACA,QACA,OAAO,aAAa,aAAa,GAC3B;AACN,YAAU,eAAe,EAAE,WAAW,KAAK,CAAC;AAC5C,gBAAc,MAAM,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,GAAM,OAAO;AACrE;AAEO,SAAS,aACd,eACA,UACM;AACN,QAAM,OAAO,aAAa,aAAa;AACvC,QAAM,WAAW,wBAAwB,eAAe,IAAI;AAC5D;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,SAAS,SAAS;AAAA,MAClB,2BAA2B,SAAS;AAAA,MACpC,aAAa,SAAS;AAAA,IACxB;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/dist/chunk-XQFT4PEP.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDb
|
|
3
|
-
} from "./chunk-DWVAR4BP.js";
|
|
4
|
-
|
|
5
|
-
// src/models/snapshot.ts
|
|
6
|
-
import { ulid } from "ulid";
|
|
7
|
-
function rowToSnapshot(row) {
|
|
8
|
-
return {
|
|
9
|
-
...row,
|
|
10
|
-
state: JSON.parse(row.state)
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function createSnapshot(input) {
|
|
14
|
-
const db = getDb();
|
|
15
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
16
|
-
const id = ulid();
|
|
17
|
-
db.prepare(
|
|
18
|
-
`INSERT INTO snapshots (id, project_id, label, state, created_at)
|
|
19
|
-
VALUES (?, ?, ?, ?, ?)`
|
|
20
|
-
).run(id, input.project_id, input.label, JSON.stringify(input.state), now);
|
|
21
|
-
return { id, ...input, created_at: now };
|
|
22
|
-
}
|
|
23
|
-
function getSnapshot(id) {
|
|
24
|
-
const db = getDb();
|
|
25
|
-
const row = db.prepare("SELECT * FROM snapshots WHERE id = ?").get(id);
|
|
26
|
-
return row ? rowToSnapshot(row) : void 0;
|
|
27
|
-
}
|
|
28
|
-
function findSnapshotById(id, minPrefix = 8) {
|
|
29
|
-
const exact = getSnapshot(id);
|
|
30
|
-
if (exact) {
|
|
31
|
-
return exact;
|
|
32
|
-
}
|
|
33
|
-
if (id.length < minPrefix) {
|
|
34
|
-
return void 0;
|
|
35
|
-
}
|
|
36
|
-
const db = getDb();
|
|
37
|
-
const rows = db.prepare("SELECT * FROM snapshots WHERE id LIKE ?").all(`${id}%`);
|
|
38
|
-
if (rows.length !== 1) {
|
|
39
|
-
return void 0;
|
|
40
|
-
}
|
|
41
|
-
const row = rows[0];
|
|
42
|
-
return row ? rowToSnapshot(row) : void 0;
|
|
43
|
-
}
|
|
44
|
-
function listSnapshots(projectId) {
|
|
45
|
-
const db = getDb();
|
|
46
|
-
const rows = db.prepare("SELECT * FROM snapshots WHERE project_id = ? ORDER BY created_at DESC").all(projectId);
|
|
47
|
-
return rows.map(rowToSnapshot);
|
|
48
|
-
}
|
|
49
|
-
function getLatestSnapshot(projectId) {
|
|
50
|
-
const snapshots = listSnapshots(projectId);
|
|
51
|
-
return snapshots[0];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export {
|
|
55
|
-
createSnapshot,
|
|
56
|
-
findSnapshotById,
|
|
57
|
-
listSnapshots,
|
|
58
|
-
getLatestSnapshot
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=chunk-XQFT4PEP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/models/snapshot.ts"],"sourcesContent":["import { getDb } from \"../db/connection.js\";\nimport { ulid } from \"ulid\";\nimport type { Snapshot, SnapshotState } from \"../types.js\";\n\ninterface SnapshotRow {\n id: string;\n project_id: string;\n label: string;\n state: string;\n created_at: string;\n}\n\nfunction rowToSnapshot(row: SnapshotRow): Snapshot {\n return {\n ...row,\n state: JSON.parse(row.state) as SnapshotState,\n };\n}\n\nexport function createSnapshot(input: {\n project_id: string;\n label: string;\n state: SnapshotState;\n}): Snapshot {\n const db = getDb();\n const now = new Date().toISOString();\n const id = ulid();\n\n db.prepare(\n `INSERT INTO snapshots (id, project_id, label, state, created_at)\n VALUES (?, ?, ?, ?, ?)`,\n ).run(id, input.project_id, input.label, JSON.stringify(input.state), now);\n\n return { id, ...input, created_at: now };\n}\n\nexport function getSnapshot(id: string): Snapshot | undefined {\n const db = getDb();\n const row = db.prepare(\"SELECT * FROM snapshots WHERE id = ?\").get(id) as\n | SnapshotRow\n | undefined;\n return row ? rowToSnapshot(row) : undefined;\n}\n\n/** Exact id, or a unique prefix of at least `minPrefix` characters. */\nexport function findSnapshotById(id: string, minPrefix = 8): Snapshot | undefined {\n const exact = getSnapshot(id);\n if (exact) {\n return exact;\n }\n if (id.length < minPrefix) {\n return undefined;\n }\n const db = getDb();\n const rows = db\n .prepare(\"SELECT * FROM snapshots WHERE id LIKE ?\")\n .all(`${id}%`) as SnapshotRow[];\n if (rows.length !== 1) {\n return undefined;\n }\n const row = rows[0];\n return row ? rowToSnapshot(row) : undefined;\n}\n\nexport function listSnapshots(projectId: string): Snapshot[] {\n const db = getDb();\n const rows = db\n .prepare(\"SELECT * FROM snapshots WHERE project_id = ? ORDER BY created_at DESC\")\n .all(projectId) as SnapshotRow[];\n return rows.map(rowToSnapshot);\n}\n\nexport function getLatestSnapshot(projectId: string): Snapshot | undefined {\n const snapshots = listSnapshots(projectId);\n return snapshots[0];\n}\n"],"mappings":";;;;;AACA,SAAS,YAAY;AAWrB,SAAS,cAAc,KAA4B;AACjD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,KAAK,MAAM,IAAI,KAAK;AAAA,EAC7B;AACF;AAEO,SAAS,eAAe,OAIlB;AACX,QAAM,KAAK,MAAM;AACjB,QAAM,OAAM,oBAAI,KAAK,GAAE,YAAY;AACnC,QAAM,KAAK,KAAK;AAEhB,KAAG;AAAA,IACD;AAAA;AAAA,EAEF,EAAE,IAAI,IAAI,MAAM,YAAY,MAAM,OAAO,KAAK,UAAU,MAAM,KAAK,GAAG,GAAG;AAEzE,SAAO,EAAE,IAAI,GAAG,OAAO,YAAY,IAAI;AACzC;AAEO,SAAS,YAAY,IAAkC;AAC5D,QAAM,KAAK,MAAM;AACjB,QAAM,MAAM,GAAG,QAAQ,sCAAsC,EAAE,IAAI,EAAE;AAGrE,SAAO,MAAM,cAAc,GAAG,IAAI;AACpC;AAGO,SAAS,iBAAiB,IAAY,YAAY,GAAyB;AAChF,QAAM,QAAQ,YAAY,EAAE;AAC5B,MAAI,OAAO;AACT,WAAO;AAAA,EACT;AACA,MAAI,GAAG,SAAS,WAAW;AACzB,WAAO;AAAA,EACT;AACA,QAAM,KAAK,MAAM;AACjB,QAAM,OAAO,GACV,QAAQ,yCAAyC,EACjD,IAAI,GAAG,EAAE,GAAG;AACf,MAAI,KAAK,WAAW,GAAG;AACrB,WAAO;AAAA,EACT;AACA,QAAM,MAAM,KAAK,CAAC;AAClB,SAAO,MAAM,cAAc,GAAG,IAAI;AACpC;AAEO,SAAS,cAAc,WAA+B;AAC3D,QAAM,KAAK,MAAM;AACjB,QAAM,OAAO,GACV,QAAQ,uEAAuE,EAC/E,IAAI,SAAS;AAChB,SAAO,KAAK,IAAI,aAAa;AAC/B;AAEO,SAAS,kBAAkB,WAAyC;AACzE,QAAM,YAAY,cAAc,SAAS;AACzC,SAAO,UAAU,CAAC;AACpB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/copy/plurals.ts","../src/ui/progress.ts","../src/ui/theme.ts","../src/ui/format.ts","../src/ui/kv.ts","../src/ui/table.ts","../src/ui/panel.ts","../src/ui/diff.ts","../src/ui/status.ts","../src/ui/section.ts","../src/ui/index.ts"],"sourcesContent":["/**\n * Shared count/plural helper for CLI and Desktop (W3-2).\n * Desktop can import this module or mirror `apps/desktop/src/lib/plurals.ts`.\n */\n\nexport function formatCount(count: number, noun: string, plural = `${noun}s`): string {\n return `${count} ${count === 1 ? noun : plural}`;\n}\n\nexport function pluralNoun(count: number, noun: string, plural = `${noun}s`): string {\n return count === 1 ? noun : plural;\n}\n","import ora, { type Ora } from \"ora\";\nimport { icons, isTty, theme } from \"./theme.js\";\n\nexport interface ProgressHandle {\n succeed: (message: string) => void;\n fail: (message: string) => void;\n stop: () => void;\n update: (message: string) => void;\n}\n\n/**\n * Create a per-instance progress handle. When stdout is a TTY, shows a spinner\n * while the operation is running. In non-TTY/test environments the spinner is\n * suppressed entirely: only the resolved verdict line is emitted.\n */\nexport function createProgress(message: string): ProgressHandle {\n let spinner: Ora | null = null;\n if (isTty() && process.env.NODE_ENV !== \"test\") {\n spinner = ora(message).start();\n }\n\n return {\n succeed(verdict: string) {\n if (spinner) {\n spinner.succeed(verdict);\n spinner = null;\n } else {\n console.log(theme.success(`${icons.success} ${verdict}`));\n }\n },\n fail(verdict: string) {\n if (spinner) {\n spinner.fail(verdict);\n spinner = null;\n } else {\n console.error(theme.danger(`${icons.danger} ${verdict}`));\n }\n },\n stop() {\n spinner?.stop();\n spinner = null;\n },\n update(message: string) {\n if (spinner) {\n spinner.text = message;\n }\n },\n };\n}\n\n// Backward-compatible singleton kept for any external usages via ui.spinner.\nexport const progress = {\n start: (message: string): ProgressHandle => createProgress(message),\n stop: (): void => {},\n succeed: (message: string): void => {\n console.log(theme.success(`${icons.success} ${message}`));\n },\n fail: (message: string): void => {\n console.error(theme.danger(`${icons.danger} ${message}`));\n },\n};\n","import chalk from \"chalk\";\n\n// Hexes match the Flow Split brand mark (violet #8b5cf6, blue #3b82f6, teal #14b8a6).\n// Keep CLI and Desktop in sync.\n\nexport type ThemeFn = (value: string) => string;\n\nfunction colorEnabled(): boolean {\n return !process.env.NO_COLOR && chalk.level > 0;\n}\n\nfunction maybe(style: ThemeFn): ThemeFn {\n return (value) => (colorEnabled() ? style(value) : value);\n}\n\nexport const icons = {\n success: \"✓\",\n warn: \"⚠\",\n danger: \"✗\",\n hint: \"→\",\n bullet: \"·\",\n profile: \"◎\",\n added: \"+\",\n removed: \"−\",\n modified: \"~\",\n} as const;\n\nconst resourceTypeStyles: Record<string, ThemeFn> = {\n instruction: maybe((value) => chalk.hex(\"#60a5fa\")(value)),\n skill: maybe((value) => chalk.hex(\"#34d399\")(value)),\n rule: maybe((value) => chalk.hex(\"#fbbf24\")(value)),\n mcp_server: maybe((value) => chalk.hex(\"#a78bfa\")(value)),\n permission: maybe((value) => chalk.hex(\"#f87171\")(value)),\n hook: maybe((value) => chalk.hex(\"#fb923c\")(value)),\n agent: maybe((value) => chalk.hex(\"#c084fc\")(value)),\n command: maybe((value) => chalk.hex(\"#2dd4bf\")(value)),\n env_var: maybe((value) => chalk.hex(\"#94a3b8\")(value)),\n model_config: maybe((value) => chalk.hex(\"#e879f9\")(value)),\n};\n\nconst mutedStyle = maybe((value) => chalk.hex(\"#6b7280\")(value));\n\nexport function styleResourceType(value: string): string {\n const style = resourceTypeStyles[value];\n return style ? style(value) : mutedStyle(value);\n}\n\nexport const theme = {\n // Existing tokens for backward compatibility\n primary: maybe((value) => chalk.bold(value)),\n accent: maybe((value) => chalk.hex(\"#3b82f6\")(value)),\n muted: mutedStyle,\n success: maybe((value) => chalk.hex(\"#14b8a6\")(value)),\n warn: maybe((value) => chalk.hex(\"#e6b84d\")(value)),\n danger: maybe((value) => chalk.hex(\"#ef4444\")(value)),\n badge: maybe((value) => chalk.bgHex(\"#3b82f6\").white.bold(` ${value} `)),\n\n // Role-based tokens\n heading: maybe((value) => chalk.bold.hex(\"#3b82f6\")(value)),\n label: maybe((value) => chalk.hex(\"#6b7280\")(value)),\n command: maybe((value) => chalk.hex(\"#14b8a6\")(value)),\n flag: maybe((value) => chalk.hex(\"#3b82f6\")(value)),\n entity: maybe((value) => chalk.hex(\"#e6b84d\")(value)),\n path: maybe((value) => chalk.hex(\"#8b5cf6\")(value)),\n info: maybe((value) => chalk.hex(\"#6b7280\")(value)),\n border: maybe((value) => chalk.hex(\"#374151\")(value)),\n resourceType: styleResourceType,\n};\n\nexport function disableColor(): void {\n process.env.NO_COLOR = \"1\";\n chalk.level = 0;\n}\n\nexport function isTty(): boolean {\n return process.stdout.isTTY === true;\n}\n\nexport function terminalColumns(): number {\n return process.stdout.columns ?? 80;\n}\n\nexport function terminalRows(): number {\n return process.stdout.rows ?? 24;\n}\n\nexport function getTableChars() {\n return isTty() && !process.env.NO_COLOR\n ? {}\n : {\n top: \"-\",\n \"top-mid\": \"+\",\n \"top-left\": \"+\",\n \"top-right\": \"+\",\n bottom: \"-\",\n \"bottom-mid\": \"+\",\n \"bottom-left\": \"+\",\n \"bottom-right\": \"+\",\n left: \"|\",\n \"left-mid\": \"+\",\n mid: \"-\",\n \"mid-mid\": \"+\",\n right: \"|\",\n \"right-mid\": \"+\",\n middle: \"|\",\n };\n}\n","import { formatCount } from \"../copy/plurals.js\";\n\nexport { formatCount } from \"../copy/plurals.js\";\n\nexport function truncate(value: string, width: number): string {\n if (value.length <= width) return value;\n if (width <= 3) return \".\".repeat(Math.max(1, width));\n return `${value.slice(0, width - 3)}...`;\n}\n\nexport function shortenId(value: string): string {\n if (value.length <= 10) return value;\n return `${value.slice(0, 4)}...${value.slice(-4)}`;\n}\n\nexport function formatAbsoluteTime(\n value: string | number | Date,\n options?: { includeTime?: boolean },\n): string {\n const date = value instanceof Date ? value : new Date(value);\n if (options?.includeTime) {\n return date.toISOString().slice(0, 19).replace(\"T\", \" \");\n }\n return date.toISOString().slice(0, 10);\n}\n\nexport function formatRelativeTime(value: string | number | Date): string {\n const date = value instanceof Date ? value : new Date(value);\n const diffMs = Date.now() - date.getTime();\n const minute = 60_000;\n const hour = 60 * minute;\n const day = 24 * hour;\n\n if (diffMs < minute) {\n return `${formatCount(Math.max(1, Math.floor(diffMs / 1000)), \"second\")} ago`;\n }\n if (diffMs < hour) {\n return `${formatCount(Math.floor(diffMs / minute), \"minute\")} ago`;\n }\n if (diffMs < day) {\n return `${formatCount(Math.floor(diffMs / hour), \"hour\")} ago`;\n }\n if (diffMs <= 30 * day) {\n return `${formatCount(Math.floor(diffMs / day), \"day\")} ago`;\n }\n return formatAbsoluteTime(date);\n}\n\nexport function formatRelativeTimeWithAbsolute(value: string | number | Date): string {\n const relative = formatRelativeTime(value);\n const absolute = formatAbsoluteTime(value, { includeTime: true });\n if (relative === absolute) return relative;\n return `${relative} (${absolute})`;\n}\n\n","import { theme } from \"./theme.js\";\n\nexport function renderKv(key: string, value: string, keyWidth = 20, indent = 2): string {\n const spaces = \" \".repeat(indent);\n return `${spaces}${theme.muted(key.padEnd(keyWidth))} ${value}`;\n}\n","import Table from \"cli-table3\";\nimport { getTableChars, isTty, terminalColumns, theme } from \"./theme.js\";\n\n/** Off-TTY default so piped output does not expand to unbounded description columns. */\nexport const OFF_TTY_TABLE_WIDTH = 100;\n\nexport interface Column {\n key: string;\n header: string;\n width: number;\n /** Floor used when distributing `widthShare` under `maxWidth`. */\n minWidth?: number;\n /** Fraction of available width when maxWidth is set (0-1). */\n widthShare?: number;\n /** Size to header/content and do not shrink when distributing leftover width. */\n fitContent?: boolean;\n /** Truncate with \"...\" instead of wrapping when the cell exceeds the column width. */\n truncate?: boolean;\n /** When false, hyphenated tokens may break mid-token during word wrap. */\n wrapOnWordBoundary?: boolean;\n /** Transform the raw value before display (affects content and width measurement). */\n transform?: (value: string) => string;\n /** Apply styling (e.g. ANSI colour) to the displayed value without affecting width. */\n style?: (value: string) => string;\n}\n\nexport interface TableOptions {\n columns: Column[];\n // biome-ignore lint/suspicious/noExplicitAny: table rows accept any typed record\n rows: Record<string, any>[];\n summary?: string;\n /** Message to show when rows is empty (instead of an empty table). */\n empty?: string;\n /** Cap total table width (including borders) to this value. */\n maxWidth?: number;\n /** Enable cli-table3 word wrap for fixed-width columns. */\n wordWrap?: boolean;\n /** Default wrapOnWordBoundary for all columns (overridden per column). */\n wrapOnWordBoundary?: boolean;\n}\n\nexport function resolveTableMaxWidth(explicit?: number): number {\n if (explicit !== undefined) {\n return explicit;\n }\n if (isTty() && typeof process.stdout.columns === \"number\" && process.stdout.columns > 0) {\n return process.stdout.columns;\n }\n if (isTty()) {\n return terminalColumns();\n }\n return OFF_TTY_TABLE_WIDTH;\n}\n\nexport function truncateTableCell(value: string, width: number): string {\n if (width <= 0) {\n return \"\";\n }\n if (value.length <= width) {\n return value;\n }\n if (width <= 3) {\n return value.slice(0, width);\n }\n return `${value.slice(0, width - 3)}...`;\n}\n\nfunction contentWidth(col: Column, rows: Record<string, unknown>[]): number {\n return Math.max(\n col.width,\n col.header.length,\n ...rows.map((row) => {\n const raw = String(row[col.key] ?? \"\");\n const transformed = col.transform ? col.transform(raw) : raw;\n return transformed.length;\n }),\n );\n}\n\nfunction tableBorderOverhead(columnCount: number): number {\n return columnCount + 1;\n}\n\nexport function computeColumnWidths(\n columns: Column[],\n // biome-ignore lint/suspicious/noExplicitAny: table rows accept any typed record\n rows: Record<string, any>[],\n maxWidth?: number,\n): number[] {\n const contentWidths = columns.map((col) => contentWidth(col, rows) + 2);\n\n if (maxWidth === undefined) {\n return contentWidths;\n }\n\n const overhead = tableBorderOverhead(columns.length);\n const available = Math.max(columns.length, maxWidth - overhead);\n const fitIndexes = columns\n .map((col, index) => (col.fitContent ? index : -1))\n .filter((index) => index >= 0);\n const flexibleIndexes = columns\n .map((col, index) => (col.fitContent ? -1 : index))\n .filter((index) => index >= 0);\n\n const widths = contentWidths.slice();\n if (fitIndexes.length > 0) {\n for (const index of fitIndexes) {\n widths[index] = contentWidths[index] ?? 0;\n }\n }\n\n const fitTotal = fitIndexes.reduce((sum, index) => sum + (widths[index] ?? 0), 0);\n const flexibleBudget = Math.max(flexibleIndexes.length, available - fitTotal);\n\n if (flexibleIndexes.length === 0) {\n return shrinkToAvailable(widths, columns, available);\n }\n\n const flexibleColumns = flexibleIndexes.map((index) => columns[index] as Column);\n const flexibleContent = flexibleIndexes.map((index) => contentWidths[index] ?? 0);\n const flexibleWidths = allocateFlexibleColumnWidths(\n flexibleColumns,\n flexibleContent,\n flexibleBudget,\n );\n flexibleIndexes.forEach((columnIndex, innerIndex) => {\n widths[columnIndex] = flexibleWidths[innerIndex] ?? widths[columnIndex] ?? 0;\n });\n return shrinkToAvailable(widths, columns, available);\n}\n\nfunction shrinkToAvailable(\n widths: number[],\n columns: Column[],\n available: number,\n): number[] {\n let allocated = widths.reduce((sum, width) => sum + width, 0);\n if (allocated <= available) {\n return widths;\n }\n let overflow = allocated - available;\n for (let index = widths.length - 1; index >= 0 && overflow > 0; index--) {\n if (columns[index]?.fitContent) {\n continue;\n }\n const floor = columns[index]?.minWidth ?? 1;\n const reducible = Math.max(0, (widths[index] ?? 0) - floor);\n if (reducible <= 0) {\n continue;\n }\n const take = Math.min(reducible, overflow);\n widths[index] = (widths[index] ?? 0) - take;\n overflow -= take;\n }\n for (let index = widths.length - 1; index >= 0 && overflow > 0; index--) {\n const floor = 1;\n const reducible = Math.max(0, (widths[index] ?? 0) - floor);\n if (reducible <= 0) {\n continue;\n }\n const take = Math.min(reducible, overflow);\n widths[index] = (widths[index] ?? 0) - take;\n overflow -= take;\n }\n return widths;\n}\n\nfunction allocateFlexibleColumnWidths(\n columns: Column[],\n contentWidths: number[],\n available: number,\n): number[] {\n if (columns.length === 0) {\n return [];\n }\n const hasWidthShare = columns.some((col) => col.widthShare !== undefined);\n\n if (hasWidthShare) {\n const floors = columns.map((col) => col.minWidth ?? 0);\n const shareSum = columns.reduce((sum, col) => sum + (col.widthShare ?? 0), 0);\n const widths = columns.map((col, index) => {\n const share = shareSum > 0 ? (col.widthShare ?? 0) / shareSum : 1 / columns.length;\n return Math.max(floors[index] ?? 0, Math.floor(available * share));\n });\n let allocated = widths.reduce((sum, width) => sum + width, 0);\n if (allocated > available) {\n let overflow = allocated - available;\n for (let index = widths.length - 1; index >= 0 && overflow > 0; index--) {\n const reducible = (widths[index] ?? 0) - (floors[index] ?? 0);\n if (reducible <= 0) {\n continue;\n }\n const take = Math.min(reducible, overflow);\n widths[index] = (widths[index] ?? 0) - take;\n overflow -= take;\n }\n allocated = widths.reduce((sum, width) => sum + width, 0);\n }\n if (widths.length > 0 && allocated < available) {\n widths[0] = (widths[0] ?? 0) + available - allocated;\n }\n return widths;\n }\n\n const total = contentWidths.reduce((sum, width) => sum + width, 0);\n if (total <= available) {\n return contentWidths;\n }\n\n const minWidths = columns.map((col, index) =>\n Math.min(col.width + 2, contentWidths[index] ?? col.width + 2),\n );\n const minTotal = minWidths.reduce((sum, width) => sum + width, 0);\n\n if (minTotal >= available) {\n let remaining = available;\n return minWidths.map((width, index) => {\n if (index === minWidths.length - 1) {\n return remaining;\n }\n const capped = Math.min(width, remaining);\n remaining -= capped;\n return capped;\n });\n }\n\n const extra = contentWidths.map((width, index) => width - (minWidths[index] ?? 0));\n const extraTotal = extra.reduce((sum, width) => sum + width, 0);\n const budget = available - minTotal;\n const widths = minWidths.map((min, index) => {\n if (extraTotal === 0) {\n return min;\n }\n return min + Math.floor((budget * (extra[index] ?? 0)) / extraTotal);\n });\n const allocated = widths.reduce((sum, width) => sum + width, 0);\n if (widths.length > 0) {\n widths[0] = (widths[0] ?? 0) + available - allocated;\n }\n return widths;\n}\n\nexport function renderTable({\n columns,\n rows,\n summary,\n empty,\n maxWidth,\n wordWrap,\n wrapOnWordBoundary,\n}: TableOptions): string {\n if (rows.length === 0 && empty) {\n return empty;\n }\n\n const resolvedMaxWidth = resolveTableMaxWidth(maxWidth);\n const colWidths = computeColumnWidths(columns, rows, resolvedMaxWidth);\n\n const t = new Table({\n head: columns.map((col) => theme.heading(col.header)),\n colWidths,\n chars: getTableChars(),\n style: { head: [], border: [] },\n ...(wordWrap !== undefined ? { wordWrap } : {}),\n ...(wrapOnWordBoundary !== undefined ? { wrapOnWordBoundary } : {}),\n });\n\n for (const row of rows) {\n t.push(\n columns.map((col, index) => {\n const raw = String(row[col.key] ?? \"\");\n const transformed = col.transform ? col.transform(raw) : raw;\n const innerWidth = Math.max(0, (colWidths[index] ?? col.width) - 2);\n const clipOverflow = Boolean(col.truncate) || Boolean(col.fitContent) || !wordWrap;\n const clipped = clipOverflow\n ? truncateTableCell(transformed, innerWidth)\n : transformed;\n const content = col.style ? col.style(clipped) : clipped;\n\n if (col.wrapOnWordBoundary === false) {\n return { content, wrapOnWordBoundary: false };\n }\n\n return content;\n }),\n );\n }\n\n const lines = [t.toString()];\n\n if (summary) {\n lines.push(\"\");\n lines.push(theme.info(summary));\n }\n\n return lines.join(\"\\n\");\n}\n\nexport const table = {\n render: renderTable,\n print: (opts: TableOptions) => console.log(renderTable(opts)),\n};\n","import { renderKv } from \"./kv.js\";\nimport { theme } from \"./theme.js\";\n\nexport interface KvRow {\n key: string;\n value: string;\n}\n\nexport interface PanelOptions {\n /** Title parts: first element is the section header, optional second is a subtitle. */\n title: string[];\n rows: [string, string][];\n}\n\nfunction renderPanelTitle(parts: string[]): string {\n const [head, ...rest] = parts;\n return rest.length === 0\n ? theme.primary(head ?? \"\")\n : `${theme.primary(head ?? \"\")} ${rest.map((p) => theme.muted(p)).join(\" \")}`;\n}\n\nexport function renderPanel(opts: PanelOptions): string {\n const lines: string[] = [renderPanelTitle(opts.title)];\n for (const [key, value] of opts.rows) {\n lines.push(renderKv(key, value));\n }\n return lines.join(\"\\n\");\n}\n\nexport function panel(opts: PanelOptions): void {\n console.log(renderPanel(opts));\n}\n\nexport function kvBlock(rows: KvRow[], opts?: { indent?: number; keyWidth?: number }): void {\n for (const row of rows) {\n console.log(renderKv(row.key, row.value, opts?.keyWidth, opts?.indent));\n }\n}\n","import { icons, theme } from \"./theme.js\";\n\nexport interface DiffRow {\n key: string;\n before: string;\n after: string;\n}\n\nexport interface DiffTableOptions {\n rows: DiffRow[];\n title?: string;\n}\n\nexport function renderDiffTable({ rows, title }: DiffTableOptions): string {\n const lines: string[] = [];\n if (title) {\n lines.push(theme.primary(title));\n }\n for (const row of rows) {\n lines.push(` ${theme.muted(row.key)}`);\n lines.push(` ${theme.danger(`${icons.removed} ${row.before}`)}`);\n lines.push(` ${theme.success(`${icons.added} ${row.after}`)}`);\n }\n return lines.join(\"\\n\");\n}\n\nexport const diffTable = {\n render: renderDiffTable,\n print: (opts: DiffTableOptions) => console.log(renderDiffTable(opts)),\n};\n\nexport interface ChangeEntry {\n kind: \"added\" | \"removed\" | \"modified\";\n scope: string;\n key: string;\n detail: string;\n}\n\nexport function renderChangeList(changes: ChangeEntry[]): string {\n return changes\n .map((change) => {\n const glyph =\n change.kind === \"added\"\n ? icons.added\n : change.kind === \"removed\"\n ? icons.removed\n : icons.modified;\n const style =\n change.kind === \"added\"\n ? theme.success\n : change.kind === \"removed\"\n ? theme.danger\n : theme.warn;\n return ` ${style(glyph)} ${change.scope.padEnd(10)} ${change.key.padEnd(28)} ${change.detail}`;\n })\n .join(\"\\n\");\n}\n","import { icons, theme } from \"./theme.js\";\n\nfunction line(icon: string, message: string): string {\n return `${icon} ${message}`;\n}\n\nexport function renderSuccess(message: string, opts?: { hint?: string }): string {\n return opts?.hint\n ? `${theme.success(line(icons.success, message))}\\n ${theme.info(`${icons.hint} ${opts.hint}`)}`\n : theme.success(line(icons.success, message));\n}\n\nexport function renderWarn(message: string, opts?: { hint?: string }): string {\n return opts?.hint\n ? `${theme.warn(line(icons.warn, message))}\\n ${theme.info(`${icons.hint} ${opts.hint}`)}`\n : theme.warn(line(icons.warn, message));\n}\n\nexport function renderDanger(\n message: string,\n opts?: { hint?: string; hints?: string[] },\n): string {\n const hints = opts?.hints ?? (opts?.hint ? [opts.hint] : []);\n const base = theme.danger(line(icons.danger, message));\n if (hints.length === 0) {\n return base;\n }\n return `${base}\\n${hints.map((hint) => ` ${theme.info(`${icons.hint} ${hint}`)}`).join(\"\\n\")}`;\n}\n\nexport const status = {\n success: (message: string, opts?: { hint?: string }) => console.log(renderSuccess(message, opts)),\n warn: (message: string, opts?: { hint?: string }) => console.log(renderWarn(message, opts)),\n danger: (message: string, opts?: { hint?: string; hints?: string[] }) =>\n console.error(renderDanger(message, opts)),\n info: (message: string) => console.log(theme.info(message)),\n dim: (message: string) => console.log(theme.info(message)),\n hint: (message: string) => console.log(` ${theme.info(`${icons.hint} ${message}`)}`),\n};\n","import { terminalColumns, theme } from \"./theme.js\";\n\nexport function renderHeader(title: string): string {\n return theme.heading(title);\n}\n\nexport function renderSubheader(title: string): string {\n return theme.label(title);\n}\n\nexport function renderRule(): string {\n return theme.border(\"─\".repeat(terminalColumns()));\n}\n\nexport function header(title: string): void {\n console.log(renderHeader(title));\n}\n\nexport function subheader(title: string): void {\n console.log(renderSubheader(title));\n}\n\nexport function rule(): void {\n console.log(renderRule());\n}\n","import * as format from \"./format.js\";\nimport { renderKv } from \"./kv.js\";\nimport { renderTable, table } from \"./table.js\";\nimport { renderPanel, panel, kvBlock } from \"./panel.js\";\nimport { renderDiffTable, diffTable, renderChangeList } from \"./diff.js\";\nimport { progress, createProgress } from \"./progress.js\";\nimport { status } from \"./status.js\";\nimport { icons, theme, disableColor } from \"./theme.js\";\nimport { header, renderHeader, subheader, renderSubheader, rule, renderRule } from \"./section.js\";\n\nexport const ui = {\n format,\n icons,\n theme,\n header,\n renderHeader,\n subheader,\n renderSubheader,\n rule,\n renderRule,\n table,\n renderTable,\n panel,\n renderPanel,\n kvBlock,\n renderKv,\n diffTable,\n renderDiffTable,\n renderChangeList,\n spinner: progress,\n createProgress,\n ...status,\n disableColor,\n};\n"],"mappings":";;;;;AAKO,SAAS,YAAY,OAAe,MAAc,SAAS,GAAG,IAAI,KAAa;AACpF,SAAO,GAAG,KAAK,IAAI,UAAU,IAAI,OAAO,MAAM;AAChD;;;ACPA,OAAO,SAAuB;;;ACA9B,OAAO,WAAW;AAOlB,SAAS,eAAwB;AAC/B,SAAO,CAAC,QAAQ,IAAI,YAAY,MAAM,QAAQ;AAChD;AAEA,SAAS,MAAM,OAAyB;AACtC,SAAO,CAAC,UAAW,aAAa,IAAI,MAAM,KAAK,IAAI;AACrD;AAEO,IAAM,QAAQ;AAAA,EACnB,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EAC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