@aiderdesk/aiderdesk 0.79.0 → 0.80.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/out/renderer/assets/{AgentSettings-CszvCubk.js → AgentSettings-RjfqLZQG.js} +399 -358
- package/out/renderer/assets/{InfoIcon-CitcCe35.js → InfoIcon-CFgcz5mB.js} +1 -1
- package/out/renderer/assets/{Onboarding-C76MB4m2.js → Onboarding-C4nwN-kW.js} +4 -4
- package/out/renderer/assets/{ProviderHeader-D8Qbh28U.js → ProviderHeader-BOSi9xBn.js} +427 -64
- package/out/renderer/assets/{SettingsPage-BlzoIUMQ.js → SettingsPage-BRdecSVb.js} +436 -281
- package/out/renderer/assets/{UsageDashboard-CbhoXiPL.js → UsageDashboard-BgZL-dQY.js} +3 -3
- package/out/renderer/assets/{abnfDiagram-N423BO3Z-CZPdeX6B.js → abnfDiagram-N423BO3Z-hgpuOTGf.js} +4 -4
- package/out/renderer/assets/{arc-Bkalrz-a.js → arc-DQ5Ln5Ec.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-T3A2C74G-DRz1QqO-.js → architectureDiagram-T3A2C74G-BA40sSAy.js} +3 -3
- package/out/renderer/assets/{blockDiagram-VBNYF7ZC-ChyfuGgN.js → blockDiagram-VBNYF7ZC-DUxxZcAH.js} +4 -4
- package/out/renderer/assets/{c4Diagram-5PPSVZJV-cVQQcFY5.js → c4Diagram-5PPSVZJV-Q_66gIRD.js} +2 -2
- package/out/renderer/assets/{channel-JT6nJyaa.js → channel-_htilMz7.js} +1 -1
- package/out/renderer/assets/{chunk-2GRJ4B5K-J57iiDk9.js → chunk-2GRJ4B5K-BInTwfcl.js} +1 -1
- package/out/renderer/assets/{chunk-2Q5K7J3B-B1gn3lFx.js → chunk-2Q5K7J3B-Dmzf8-EI.js} +1 -1
- package/out/renderer/assets/{chunk-5RXB4S5H-D9R8uVKF.js → chunk-5RXB4S5H-DJM3NSZZ.js} +4 -4
- package/out/renderer/assets/{chunk-5VM5RSS4-BgMI8UGI.js → chunk-5VM5RSS4-CbTpT-mF.js} +1 -1
- package/out/renderer/assets/{chunk-6Q2QTUOP-Cf4SRUsg.js → chunk-6Q2QTUOP-m3hSoymD.js} +1 -1
- package/out/renderer/assets/{chunk-GF5L2VYU-BrPkeiRK.js → chunk-GF5L2VYU-Bb4ovOLO.js} +5 -5
- package/out/renderer/assets/{chunk-JWPE2WC7-BF4fubDx.js → chunk-JWPE2WC7-BnvIn2Wx.js} +1 -1
- package/out/renderer/assets/{chunk-KBJHAD2P-BrT2h0P-.js → chunk-KBJHAD2P-CDfqaLOK.js} +1 -1
- package/out/renderer/assets/{chunk-RYQCIY6F-nKwtNsyW.js → chunk-RYQCIY6F-CL9GnfZn.js} +3 -3
- package/out/renderer/assets/{chunk-XXDRQBXY-DOR8tcZA.js → chunk-XXDRQBXY-W8IA58aV.js} +1 -1
- package/out/renderer/assets/{classDiagram-JCYQIIEL-Ds-LjZkS.js → classDiagram-JCYQIIEL-CJOMvWBr.js} +6 -6
- package/out/renderer/assets/{classDiagram-v2-OCEON4UE-Ds-LjZkS.js → classDiagram-v2-OCEON4UE-CJOMvWBr.js} +6 -6
- package/out/renderer/assets/{cose-bilkent-JH36ORCC-D8MD1ldA.js → cose-bilkent-JH36ORCC-DZx8zB-p.js} +1 -1
- package/out/renderer/assets/{cynefin-VYW2F7L2-BWrc0sIz.js → cynefin-VYW2F7L2-B2g7If-Z.js} +1 -1
- package/out/renderer/assets/{cynefinDiagram-MW4NZA55-ajJaFM05.js → cynefinDiagram-MW4NZA55-C58XMelO.js} +3 -3
- package/out/renderer/assets/{dagre-VZM6K2ZE-B7P2-yI-.js → dagre-VZM6K2ZE-BQ2aOE4I.js} +5 -5
- package/out/renderer/assets/{diagram-7IWD3JNH-C9b2ycWt.js → diagram-7IWD3JNH-Fcr4bcbO.js} +4 -4
- package/out/renderer/assets/{diagram-B4RE2ZJO-BzexvLYA.js → diagram-B4RE2ZJO-D3yvQRyf.js} +3 -3
- package/out/renderer/assets/{diagram-LBJQPF4R-BW3cIhvw.js → diagram-LBJQPF4R-CwZ6wYZu.js} +3 -3
- package/out/renderer/assets/{diagram-Q27KOJAE-CrI04NBR.js → diagram-Q27KOJAE-BWQ6cHxk.js} +4 -4
- package/out/renderer/assets/{diagram-UB23O5K3-Cix1_1dv.js → diagram-UB23O5K3-DYvLjKje.js} +3 -3
- package/out/renderer/assets/{ebnfDiagram-BXEA7PRR-yn5BxQJj.js → ebnfDiagram-BXEA7PRR-DXgsYfPv.js} +4 -4
- package/out/renderer/assets/{erDiagram-JOGREHBK-CkQ8CtS_.js → erDiagram-JOGREHBK-p1b6UAmn.js} +4 -4
- package/out/renderer/assets/{flowDiagram-UKHOOZJN-08k0gH-d.js → flowDiagram-UKHOOZJN-CPc3hU6X.js} +6 -6
- package/out/renderer/assets/{ganttDiagram-PKOTCBZU-D5qJmakg.js → ganttDiagram-PKOTCBZU-AnoSI0H5.js} +3 -3
- package/out/renderer/assets/{gitGraphDiagram-DS77QQ5N-CPw_BIbi.js → gitGraphDiagram-DS77QQ5N-DUrmxtgn.js} +4 -4
- package/out/renderer/assets/{graph-vAJQKSey.js → graph-vYK0uWuK.js} +1 -1
- package/out/renderer/assets/{index-DeBIVVLg.js → index-2-UGHPQa.js} +1 -1
- package/out/renderer/assets/{index-DFijfgHK.js → index-5BVN9RK6.js} +1 -1
- package/out/renderer/assets/{index-Cb4iDr8_.js → index-7rQhuL56.js} +5 -5
- package/out/renderer/assets/{index-CmpSne4j.js → index-B1SEEb-0.js} +2 -2
- package/out/renderer/assets/{index-D8Zme_wD.js → index-B24wrWKi.js} +5 -5
- package/out/renderer/assets/{index-CNKnTVof.js → index-BGA5JZSf.js} +2 -2
- package/out/renderer/assets/{index-B9qhGo1c.js → index-BIgrNG0o.js} +4 -4
- package/out/renderer/assets/{index-BvQIBR-c.js → index-BVKpsNAU.js} +2 -2
- package/out/renderer/assets/{index-DH7BFHAa.css → index-BYUeztXU.css} +34 -7
- package/out/renderer/assets/{index-DA3SfNyd.js → index-BifPseZk.js} +5 -5
- package/out/renderer/assets/{index-ebosJEhW.js → index-BpkJELWc.js} +1 -1
- package/out/renderer/assets/{index-CJzzo9GN.js → index-BqRnRmje.js} +2 -2
- package/out/renderer/assets/{index-BGegEms-.js → index-C1NKfASK.js} +1 -1
- package/out/renderer/assets/{index-B0EFV-gL.js → index-C2-wYt7Y.js} +3 -3
- package/out/renderer/assets/{index-BAx8fHYJ.js → index-C_Fb5x1i.js} +2 -2
- package/out/renderer/assets/{index-05PndMzj.js → index-CdT3pUnY.js} +1587 -1079
- package/out/renderer/assets/{index-BR-RxTVt.js → index-Cf1CrkZj.js} +1 -1
- package/out/renderer/assets/{index-CmlXgnPK.js → index-CoNqogfR.js} +2 -2
- package/out/renderer/assets/{index-ZB0-IQ7z.js → index-Cqa6STOy.js} +96 -3
- package/out/renderer/assets/{index-BgaEN2Xk.js → index-CvO-4NeV.js} +5 -5
- package/out/renderer/assets/{index-BsVCwy_5.js → index-Czcs8fbp.js} +5 -5
- package/out/renderer/assets/{index-DSemwSW1.js → index-D44yGQ14.js} +2 -2
- package/out/renderer/assets/{index-BNYmBzYl.js → index-DMloO_bp.js} +1 -1
- package/out/renderer/assets/{index-D7uIEHLm.js → index-DSu0qPyw.js} +2 -2
- package/out/renderer/assets/{index-DSFW0jId.js → index-DVcmtW9G.js} +2 -2
- package/out/renderer/assets/{index-BYK8Oe9C.js → index-DaN69KHN.js} +1 -1
- package/out/renderer/assets/{index-BvlgP_C9.js → index-DfCyq42Y.js} +2 -2
- package/out/renderer/assets/{index-D3TXtQ08.js → index-Dr6JmYfP.js} +2 -2
- package/out/renderer/assets/{index-BGkJy1La.js → index-Dv3o3ivg.js} +2 -2
- package/out/renderer/assets/{index-CPxIrW_k.js → index-DvwUI0SE.js} +3 -3
- package/out/renderer/assets/{index-DKfAiLyn.js → index-Eyz2tQvi.js} +1 -1
- package/out/renderer/assets/{index-BLbSc28m.js → index-XMEQr7jT.js} +5 -5
- package/out/renderer/assets/{index-BzofAPMG.js → index-ZQnYDsOy.js} +1 -1
- package/out/renderer/assets/{infoDiagram-6WML65LV-C-C_195p.js → infoDiagram-6WML65LV-DNH3Ekcy.js} +2 -2
- package/out/renderer/assets/{ishikawaDiagram-WSZJBQD7-DdULOU9y.js → ishikawaDiagram-WSZJBQD7-K6TT3dje.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-NVQOT4AX-uqf_qJgk.js → journeyDiagram-NVQOT4AX-BYzsiNS3.js} +4 -4
- package/out/renderer/assets/{jsx-dev-runtime-BpVxbL7b.js → jsx-dev-runtime-1UHusS46.js} +1 -1
- package/out/renderer/assets/{kanban-definition-27J2QSJJ-Dky8Fg_n.js → kanban-definition-27J2QSJJ-IPlTS6oS.js} +2 -2
- package/out/renderer/assets/{layout-CmE2gzKL.js → layout-BHT9iWoc.js} +3 -3
- package/out/renderer/assets/{linear-KjDRVqMG.js → linear-2jv-chKc.js} +1 -1
- package/out/renderer/assets/{map-DYyl5K0n.js → map-D6nZDKFn.js} +2 -2
- package/out/renderer/assets/{mindmap-definition-FAOFIHXS-8dWcuWHV.js → mindmap-definition-FAOFIHXS-BHi7Irsm.js} +3 -3
- package/out/renderer/assets/{pegDiagram-VL7TDLO6-76hvriT-.js → pegDiagram-VL7TDLO6-C6Y77RxO.js} +4 -4
- package/out/renderer/assets/{pieDiagram-7S7Q4E2Y-CJ41-CdM.js → pieDiagram-7S7Q4E2Y-D-e8_L26.js} +4 -4
- package/out/renderer/assets/{quadrantDiagram-CIZ2JOQS-BahlXgAq.js → quadrantDiagram-CIZ2JOQS-CXhTLAqI.js} +2 -2
- package/out/renderer/assets/{railroadDiagram-AXF67PYL-PiU_czi3.js → railroadDiagram-AXF67PYL-reHXCR9j.js} +4 -4
- package/out/renderer/assets/{requirementDiagram-LRYGKXZP-C87pqMna.js → requirementDiagram-LRYGKXZP-tH6hF_PA.js} +3 -3
- package/out/renderer/assets/{sankeyDiagram-W5VNT64P-CdkZmeU5.js → sankeyDiagram-W5VNT64P-CGB88G5d.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-SI44F4Z6-CMXFNERX.js → sequenceDiagram-SI44F4Z6-fEt9jAut.js} +3 -3
- package/out/renderer/assets/{sizeCapture-X5ZJPWSS-BwMqCMc8.js → sizeCapture-X5ZJPWSS-B7-Ph8fH.js} +1 -1
- package/out/renderer/assets/{stateDiagram-OKZ733FA-DiSC7IgF.js → stateDiagram-OKZ733FA-DrhieY01.js} +8 -8
- package/out/renderer/assets/{stateDiagram-v2-UEYNNEHI-BQw7DwIi.js → stateDiagram-v2-UEYNNEHI-GzoBE3UI.js} +5 -5
- package/out/renderer/assets/{swimlanes-SLNWSIFB-Bhy-gBe5.js → swimlanes-SLNWSIFB-D4LJ6r4D.js} +6 -6
- package/out/renderer/assets/{swimlanesDiagram-ULZ7WXOC-DOMzSJ4k.js → swimlanesDiagram-ULZ7WXOC-CMk853Ts.js} +7 -7
- package/out/renderer/assets/{time-CTAUr2Xp.js → time-CANVWGKV.js} +1 -1
- package/out/renderer/assets/{timeline-definition-Z64GVDOM-vx5MLWSt.js → timeline-definition-Z64GVDOM-qmgoeW5e.js} +2 -2
- package/out/renderer/assets/{vennDiagram-T6HMQDX7-WFytj3Mr.js → vennDiagram-T6HMQDX7-DQ2_VNNg.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-T6FBY63Y-DyYJ0Jvz.js → wardleyDiagram-T6FBY63Y-B31yGaJC.js} +3 -3
- package/out/renderer/assets/{xychartDiagram-ELKLHX3M-Ddq7vrtC.js → xychartDiagram-ELKLHX3M-A0RHYdAg.js} +2 -2
- package/out/renderer/index.html +2 -2
- package/out/resources/connector/connector.py +49 -0
- package/out/resources/skills/extension-creator/SKILL.md +46 -0
- package/out/resources/skills/extension-creator/assets/scripts/validate-extension-ui.mjs +479 -0
- package/out/resources/skills/extension-creator/references/extension-interface.md +8 -0
- package/out/resources/skills/extension-creator/references/in-repo-flow.md +1 -0
- package/out/resources/skills/extension-creator/references/project-global-flow.md +2 -1
- package/out/resources/skills/extension-creator/references/ui-components.md +21 -0
- package/out/runner.js +792 -175
- package/package.json +54 -49
- package/scripts/generate-package.mjs +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as populateCommonDb } from "./chunk-JWPE2WC7-
|
|
2
|
-
import { a4 as setAccDescription, a5 as getAccDescription, ao as getDiagramTitle, an as setDiagramTitle, a6 as getAccTitle, a7 as setAccTitle, a8 as __name, aR as getThemeVariables3, aw as getConfig, ay as cleanAndMerge, ab as log, aB as selectSvgElement, ac as configureSvgSize, ap as clear, a9 as getConfig2 } from "./index-
|
|
3
|
-
import { p as parse } from "./cynefin-VYW2F7L2-
|
|
1
|
+
import { p as populateCommonDb } from "./chunk-JWPE2WC7-BnvIn2Wx.js";
|
|
2
|
+
import { a4 as setAccDescription, a5 as getAccDescription, ao as getDiagramTitle, an as setDiagramTitle, a6 as getAccTitle, a7 as setAccTitle, a8 as __name, aR as getThemeVariables3, aw as getConfig, ay as cleanAndMerge, ab as log, aB as selectSvgElement, ac as configureSvgSize, ap as clear, a9 as getConfig2 } from "./index-CdT3pUnY.js";
|
|
3
|
+
import { p as parse } from "./cynefin-VYW2F7L2-B2g7If-Z.js";
|
|
4
4
|
var toPercent = /* @__PURE__ */ __name((value, context) => {
|
|
5
5
|
const normalized = value <= 1 ? value * 100 : value;
|
|
6
6
|
if (normalized < 0 || normalized > 100) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a4 as setAccDescription, a5 as getAccDescription, ao as getDiagramTitle, an as setDiagramTitle, a6 as getAccTitle, a7 as setAccTitle, a8 as __name, ab as log, aB as selectSvgElement, ac as configureSvgSize, ap as clear, aw as getConfig, af as sanitizeText, ay as cleanAndMerge, az as defaultConfig_default, aR as getThemeVariables3, aS as computeDimensionOfText, aT as shapeLine } from "./index-
|
|
1
|
+
import { a4 as setAccDescription, a5 as getAccDescription, ao as getDiagramTitle, an as setDiagramTitle, a6 as getAccTitle, a7 as setAccTitle, a8 as __name, ab as log, aB as selectSvgElement, ac as configureSvgSize, ap as clear, aw as getConfig, af as sanitizeText, ay as cleanAndMerge, az as defaultConfig_default, aR as getThemeVariables3, aS as computeDimensionOfText, aT as shapeLine } from "./index-CdT3pUnY.js";
|
|
2
2
|
import { b as band } from "./band-zXq5o_Ib.js";
|
|
3
|
-
import { l as linear } from "./linear-
|
|
3
|
+
import { l as linear } from "./linear-2jv-chKc.js";
|
|
4
4
|
import "./init-CTO7spbL.js";
|
|
5
5
|
import "./ordinal-BD3Y6v77.js";
|
|
6
6
|
import "./defaultLocale-B2RvLBDe.js";
|
package/out/renderer/index.html
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
|
21
21
|
<meta name="apple-mobile-web-app-title" content="AiderDesk">
|
|
22
22
|
<link rel="apple-touch-icon" href="/icon-192.png">
|
|
23
|
-
<script type="module" crossorigin src="./assets/index-
|
|
24
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
23
|
+
<script type="module" crossorigin src="./assets/index-CdT3pUnY.js"></script>
|
|
24
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BYUeztXU.css">
|
|
25
25
|
</head>
|
|
26
26
|
|
|
27
27
|
<body>
|
|
@@ -22,6 +22,43 @@ from aider.main import main as cli_main
|
|
|
22
22
|
from aider.utils import is_image_file
|
|
23
23
|
from concurrent.futures import ThreadPoolExecutor, Future
|
|
24
24
|
import nest_asyncio
|
|
25
|
+
|
|
26
|
+
def apply_tls_overrides():
|
|
27
|
+
"""Apply AiderDesk TLS settings before litellm/httpx create their SSL contexts.
|
|
28
|
+
|
|
29
|
+
Must run before `import litellm` so module-level HTTP clients pick up the patched
|
|
30
|
+
`ssl.create_default_context`. Re-applying later only affects newly created contexts.
|
|
31
|
+
"""
|
|
32
|
+
import ssl
|
|
33
|
+
|
|
34
|
+
insecure = os.getenv("AIDER_DESK_INSECURE_TLS") == "1"
|
|
35
|
+
ca_bundle = os.getenv("AIDER_DESK_CA_BUNDLE_PATH")
|
|
36
|
+
|
|
37
|
+
if not insecure and not ca_bundle:
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
original_create_default_context = ssl.create_default_context
|
|
41
|
+
|
|
42
|
+
def patched_create_default_context(*args, **kwargs):
|
|
43
|
+
context = original_create_default_context(*args, **kwargs)
|
|
44
|
+
try:
|
|
45
|
+
if insecure:
|
|
46
|
+
context.check_hostname = False
|
|
47
|
+
context.verify_mode = ssl.CERT_NONE
|
|
48
|
+
elif ca_bundle:
|
|
49
|
+
context.load_verify_locations(cafile=ca_bundle)
|
|
50
|
+
except (OSError, ssl.SSLError):
|
|
51
|
+
pass
|
|
52
|
+
return context
|
|
53
|
+
|
|
54
|
+
ssl.create_default_context = patched_create_default_context
|
|
55
|
+
|
|
56
|
+
if ca_bundle:
|
|
57
|
+
os.environ.setdefault("SSL_CERT_FILE", ca_bundle)
|
|
58
|
+
os.environ.setdefault("REQUESTS_CA_BUNDLE", ca_bundle)
|
|
59
|
+
|
|
60
|
+
apply_tls_overrides()
|
|
61
|
+
|
|
25
62
|
import litellm
|
|
26
63
|
import types
|
|
27
64
|
import portalocker
|
|
@@ -1267,10 +1304,22 @@ class Connector:
|
|
|
1267
1304
|
async def update_environment_variables(self, environment_variables):
|
|
1268
1305
|
"""Update environment variables for the Aider process"""
|
|
1269
1306
|
try:
|
|
1307
|
+
tls_changed = any(
|
|
1308
|
+
key in ("AIDER_DESK_INSECURE_TLS", "AIDER_DESK_CA_BUNDLE_PATH")
|
|
1309
|
+
for key in environment_variables
|
|
1310
|
+
)
|
|
1311
|
+
|
|
1270
1312
|
# Update the environment variables in the current process
|
|
1271
1313
|
for key, value in environment_variables.items():
|
|
1272
1314
|
if value is not None:
|
|
1273
1315
|
os.environ[key] = str(value)
|
|
1316
|
+
|
|
1317
|
+
if tls_changed:
|
|
1318
|
+
apply_tls_overrides()
|
|
1319
|
+
await self.send_log_message(
|
|
1320
|
+
"warning",
|
|
1321
|
+
"TLS verification settings changed - already established LLM connections may require an Aider restart to pick them up.",
|
|
1322
|
+
)
|
|
1274
1323
|
except Exception as e:
|
|
1275
1324
|
await self.send_log_message("error", f"Failed to update environment variables: {str(e)}")
|
|
1276
1325
|
|
|
@@ -144,6 +144,24 @@ Do not use when:
|
|
|
144
144
|
|
|
145
145
|
**Never:** Use `'extension-settings'` placement — it was removed; use the dedicated config API instead
|
|
146
146
|
|
|
147
|
+
### Rule: Validate UI components after creation
|
|
148
|
+
|
|
149
|
+
**When:** Any UI or config component (.jsx file) was created or modified
|
|
150
|
+
|
|
151
|
+
**Then:** Run the validator script and fix all reported issues
|
|
152
|
+
|
|
153
|
+
**Must:** Run `node <skill-dir>/assets/scripts/validate-extension-ui.mjs <file-or-dir>` where `<skill-dir>` is this skill's directory
|
|
154
|
+
|
|
155
|
+
**Must:** Ensure every file passes — exit code 0, all lines say `PASS`
|
|
156
|
+
|
|
157
|
+
**Must:** Fix all `[SYNTAX]` issues (the component would crash at render time) and `[TYPE]` issues (typos in props, React API, or `ui.*` component names)
|
|
158
|
+
|
|
159
|
+
**If:** A file uses config-style props (`config`, `updateConfig`) but is not named `Config*.jsx`
|
|
160
|
+
|
|
161
|
+
**Then:** Add `--type=config` (conversely, `--type=ui` forces UI-component props)
|
|
162
|
+
|
|
163
|
+
**Note:** The script needs `sucrase`, `typescript`, and `@types/react` resolvable (they are, when the aider-desk repo is available); otherwise it degrades to whatever checks are possible and says so in a warning
|
|
164
|
+
|
|
147
165
|
### Rule: Update registry and docs (In-Repo only)
|
|
148
166
|
|
|
149
167
|
**When:** Target is In-Repo and extension file is created
|
|
@@ -196,6 +214,9 @@ Do not use when:
|
|
|
196
214
|
- If extension needs constants, create constants.ts
|
|
197
215
|
- If extension has placement-based UI components, create .jsx files for components (recommended for components > 20 lines)
|
|
198
216
|
|
|
217
|
+
**After any .jsx file is created:**
|
|
218
|
+
- Validate it: `node <skill-dir>/assets/scripts/validate-extension-ui.mjs <extension-dir>` — all files must pass
|
|
219
|
+
|
|
199
220
|
### For In-Repo target:
|
|
200
221
|
|
|
201
222
|
1. Confirm user wants In-Repo (only available in aider-desk project)
|
|
@@ -211,6 +232,9 @@ Do not use when:
|
|
|
211
232
|
**Between steps 3 and 5:**
|
|
212
233
|
- Same optional files as Project/Global flow above
|
|
213
234
|
|
|
235
|
+
**After any .jsx file is created:**
|
|
236
|
+
- Validate it: `node <skill-dir>/assets/scripts/validate-extension-ui.mjs <extension-dir>` — all files must pass
|
|
237
|
+
|
|
214
238
|
## Preconditions
|
|
215
239
|
|
|
216
240
|
Before using this skill, verify:
|
|
@@ -245,6 +269,7 @@ After completing this skill, verify:
|
|
|
245
269
|
- Static `metadata` property on the class includes all required fields (name, version)
|
|
246
270
|
- Default export is the extension class
|
|
247
271
|
- No `@/` imports used
|
|
272
|
+
- All UI/config .jsx components pass `assets/scripts/validate-extension-ui.mjs`
|
|
248
273
|
- **If In-Repo:** extensions.json updated correctly
|
|
249
274
|
- **If In-Repo:** docs-site/docs/extensions/extensions-gallery.md updated
|
|
250
275
|
- **If In-Repo:** Type checking passes
|
|
@@ -350,6 +375,26 @@ After completing this skill, verify:
|
|
|
350
375
|
- When ambiguous: If the user says "log", "show", "display", or "report" something, default to `addLogMessage` (user-visible). Use `context.log` only for internal diagnostics.
|
|
351
376
|
- Note: `context.log` is always available; `getTaskContext()` returns `null` outside a task, so always use optional chaining (`?.`)
|
|
352
377
|
|
|
378
|
+
**Situation:** Extension needs to manage resource cleanup (timers, watchers, child processes)
|
|
379
|
+
|
|
380
|
+
**Pattern:**
|
|
381
|
+
- When: Extension creates resources in `onLoad`, `onProjectStarted`, or event handlers that need cleanup
|
|
382
|
+
- Then: Use `context.addDisposable()` to co-locate setup and cleanup logic
|
|
383
|
+
- Setup runs immediately; if it returns a function, that function is called on unload (LIFO order). The cleanup may be sync or async (`Promise`) — async cleanups are awaited during unload
|
|
384
|
+
- Disposers run **before** `onUnload` is called, so both patterns work together
|
|
385
|
+
- Example:
|
|
386
|
+
```typescript
|
|
387
|
+
async onLoad(context: ExtensionContext) {
|
|
388
|
+
// Setup and cleanup are co-located — no need to track in onUnload
|
|
389
|
+
context.addDisposable(() => {
|
|
390
|
+
const timer = setInterval(() => doWork(), 1000);
|
|
391
|
+
return () => clearInterval(timer);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
// onUnload still works as a fallback for anything not registered via addDisposable
|
|
395
|
+
```
|
|
396
|
+
- If setup returns `void`, no cleanup is registered — useful for fire-and-forget side effects
|
|
397
|
+
|
|
353
398
|
**Situation:** Extension needs to store or retrieve memories
|
|
354
399
|
|
|
355
400
|
**Pattern:**
|
|
@@ -447,6 +492,7 @@ After completing this skill, verify:
|
|
|
447
492
|
|
|
448
493
|
## Assets
|
|
449
494
|
|
|
495
|
+
- [scripts/validate-extension-ui.mjs](assets/scripts/validate-extension-ui.mjs) - UI component validator (syntax + type check)
|
|
450
496
|
- [templates/single-file.ts.template](assets/templates/single-file.ts.template) - Single-file template
|
|
451
497
|
- [templates/folder-extension/](assets/templates/folder-extension/) - Folder template (basic)
|
|
452
498
|
- [templates/folder-extension-with-config/index.ts.template](assets/templates/folder-extension-with-config/index.ts.template) - Folder template with config component API
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* validate-extension-ui.mjs — validates AiderDesk extension UI components (.jsx files)
|
|
4
|
+
*
|
|
5
|
+
* Performs two checks per file:
|
|
6
|
+
* 1. SYNTAX — runs the exact Sucrase transform the app uses at runtime
|
|
7
|
+
* (packages/common/src/jsx-transpiler.ts), so anything that would fail
|
|
8
|
+
* to render is caught here.
|
|
9
|
+
* 2. TYPES — compiles the template with the TypeScript compiler API against
|
|
10
|
+
* the real runtime props contract (props, ui, icons, executeExtensionAction,
|
|
11
|
+
* config/updateConfig, ...), catching typos and bad prop usage statically.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* node validate-extension-ui.mjs <file-or-dir> [...] [options]
|
|
15
|
+
*
|
|
16
|
+
* Options:
|
|
17
|
+
* --type=ui|config|auto Component kind (default: auto — files named
|
|
18
|
+
* Config*.jsx/tsx are treated as config components)
|
|
19
|
+
* --no-types Skip the TypeScript check (syntax only)
|
|
20
|
+
* --no-sucrase Skip the runtime-transform syntax check
|
|
21
|
+
* -h, --help Show this help
|
|
22
|
+
*
|
|
23
|
+
* Exit codes: 0 = all files valid, 1 = at least one failure, 2 = usage/environment error
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import fs from 'node:fs';
|
|
27
|
+
import path from 'node:path';
|
|
28
|
+
import os from 'node:os';
|
|
29
|
+
import { fileURLToPath } from 'node:url';
|
|
30
|
+
import { createRequire } from 'node:module';
|
|
31
|
+
|
|
32
|
+
const require = createRequire(import.meta.url);
|
|
33
|
+
|
|
34
|
+
const SCRIPT_NAME = 'validate-extension-ui.mjs';
|
|
35
|
+
const JSX_EXTENSIONS = ['.jsx', '.tsx'];
|
|
36
|
+
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'out', '__tests__']);
|
|
37
|
+
|
|
38
|
+
const printHelp = () => {
|
|
39
|
+
console.log(`Usage: node ${SCRIPT_NAME} <file-or-dir> [...] [options]
|
|
40
|
+
|
|
41
|
+
Options:
|
|
42
|
+
--type=ui|config|auto Component kind (default: auto — files named
|
|
43
|
+
Config*.jsx/tsx are treated as config components)
|
|
44
|
+
--no-types Skip the TypeScript check (syntax only)
|
|
45
|
+
--no-sucrase Skip the runtime-transform syntax check
|
|
46
|
+
-h, --help Show this help`);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const parseArgs = (argv) => {
|
|
50
|
+
const targets = [];
|
|
51
|
+
let type = 'auto';
|
|
52
|
+
let runTypes = true;
|
|
53
|
+
let runSucrase = true;
|
|
54
|
+
|
|
55
|
+
for (const arg of argv) {
|
|
56
|
+
if (arg === '-h' || arg === '--help') {
|
|
57
|
+
printHelp();
|
|
58
|
+
process.exit(0);
|
|
59
|
+
} else if (arg.startsWith('--type=')) {
|
|
60
|
+
const value = arg.slice('--type='.length);
|
|
61
|
+
if (!['ui', 'config', 'auto'].includes(value)) {
|
|
62
|
+
console.error(`Error: invalid --type value '${value}' (expected ui, config or auto)`);
|
|
63
|
+
process.exit(2);
|
|
64
|
+
}
|
|
65
|
+
type = value;
|
|
66
|
+
} else if (arg === '--no-types') {
|
|
67
|
+
runTypes = false;
|
|
68
|
+
} else if (arg === '--no-sucrase') {
|
|
69
|
+
runSucrase = false;
|
|
70
|
+
} else if (arg.startsWith('-')) {
|
|
71
|
+
console.error(`Error: unknown option '${arg}'`);
|
|
72
|
+
printHelp();
|
|
73
|
+
process.exit(2);
|
|
74
|
+
} else {
|
|
75
|
+
targets.push(arg);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return { targets, type, runTypes, runSucrase };
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const loadOptional = (loader) => {
|
|
83
|
+
try {
|
|
84
|
+
return loader();
|
|
85
|
+
} catch {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const findRepoRoot = (startDir) => {
|
|
91
|
+
let dir = startDir;
|
|
92
|
+
while (true) {
|
|
93
|
+
if (fs.existsSync(path.join(dir, 'packages', 'common', 'src', 'types', 'common.ts'))) {
|
|
94
|
+
return dir;
|
|
95
|
+
}
|
|
96
|
+
const parent = path.dirname(dir);
|
|
97
|
+
if (parent === dir) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
dir = parent;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const resolveEnvironment = () => {
|
|
105
|
+
const sucrase = loadOptional(() => require('sucrase'));
|
|
106
|
+
const typescript = loadOptional(() => require('typescript'));
|
|
107
|
+
const reactTypesPkg = loadOptional(() => require.resolve('@types/react/package.json'));
|
|
108
|
+
const reactTypesDir = reactTypesPkg ? path.dirname(reactTypesPkg) : undefined;
|
|
109
|
+
const repoRoot = findRepoRoot(path.dirname(fileURLToPath(import.meta.url)));
|
|
110
|
+
const commonTypesAvailable = repoRoot !== undefined && reactTypesDir !== undefined;
|
|
111
|
+
return { sucrase, typescript, reactTypesDir, repoRoot, commonTypesAvailable };
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const collectFiles = (targets) => {
|
|
115
|
+
const files = [];
|
|
116
|
+
|
|
117
|
+
const walk = (dir) => {
|
|
118
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
119
|
+
const fullPath = path.join(dir, entry.name);
|
|
120
|
+
if (entry.isDirectory()) {
|
|
121
|
+
if (!SKIP_DIRS.has(entry.name)) {
|
|
122
|
+
walk(fullPath);
|
|
123
|
+
}
|
|
124
|
+
} else if (entry.isFile() && JSX_EXTENSIONS.includes(path.extname(entry.name))) {
|
|
125
|
+
files.push(fullPath);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
for (const target of targets) {
|
|
131
|
+
let stat;
|
|
132
|
+
try {
|
|
133
|
+
stat = fs.statSync(target);
|
|
134
|
+
} catch {
|
|
135
|
+
console.error(`Error: '${target}' does not exist`);
|
|
136
|
+
process.exit(2);
|
|
137
|
+
}
|
|
138
|
+
if (stat.isDirectory()) {
|
|
139
|
+
walk(target);
|
|
140
|
+
} else {
|
|
141
|
+
files.push(path.resolve(target));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return [...new Set(files)].sort();
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const detectKind = (filePath, typeOverride) => {
|
|
149
|
+
if (typeOverride === 'ui' || typeOverride === 'config') {
|
|
150
|
+
return typeOverride;
|
|
151
|
+
}
|
|
152
|
+
return /^config.*\.(jsx|tsx)$/i.test(path.basename(filePath)) ? 'config' : 'ui';
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// Mirrors packages/common/src/jsx-transpiler.ts exactly
|
|
156
|
+
const transpileLikeRuntime = (template, transform) => {
|
|
157
|
+
const REACT_IMPORT = 'import React from "react";';
|
|
158
|
+
const prepended = `${REACT_IMPORT}\nexport default ${template}`;
|
|
159
|
+
const result = transform(prepended, { transforms: ['jsx', 'typescript'], production: true });
|
|
160
|
+
if (result.diagnostics && result.diagnostics.length > 0) {
|
|
161
|
+
const diag = result.diagnostics[0];
|
|
162
|
+
const err = new Error(diag.message || 'Syntax error');
|
|
163
|
+
err.loc = diag.loc;
|
|
164
|
+
throw err;
|
|
165
|
+
}
|
|
166
|
+
return result.code;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const mapSucraseLocation = (loc) => {
|
|
170
|
+
if (!loc || typeof loc.line !== 'number') {
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
const templateLine = loc.line - 1;
|
|
174
|
+
if (templateLine < 1) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
let column = loc.column;
|
|
178
|
+
if (loc.line === 2) {
|
|
179
|
+
column = typeof column === 'number' ? Math.max(0, column - 'export default '.length) : column;
|
|
180
|
+
}
|
|
181
|
+
return { line: templateLine, column };
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const buildPropsType = (kind, commonTypesAvailable) => {
|
|
185
|
+
const typeImports = commonTypesAvailable
|
|
186
|
+
? `import type { AgentProfile, Message, Model, ProviderProfile, TaskData } from '@common/types';
|
|
187
|
+
import type { ApplicationAPI } from '@common/api';`
|
|
188
|
+
: `type AgentProfile = any;
|
|
189
|
+
type Message = any;
|
|
190
|
+
type Model = any;
|
|
191
|
+
type ProviderProfile = any;
|
|
192
|
+
type TaskData = any;
|
|
193
|
+
type ApplicationAPI = any;`;
|
|
194
|
+
|
|
195
|
+
const shared = `${typeImports}
|
|
196
|
+
|
|
197
|
+
type __AnyHandler = (...args: any[]) => any;
|
|
198
|
+
type __AnyComponentProps = {
|
|
199
|
+
children?: any;
|
|
200
|
+
onChange?: __AnyHandler;
|
|
201
|
+
onClick?: __AnyHandler;
|
|
202
|
+
onMouseEnter?: __AnyHandler;
|
|
203
|
+
onMouseLeave?: __AnyHandler;
|
|
204
|
+
onFocus?: __AnyHandler;
|
|
205
|
+
onBlur?: __AnyHandler;
|
|
206
|
+
onSubmit?: __AnyHandler;
|
|
207
|
+
onKeyDown?: __AnyHandler;
|
|
208
|
+
onKeyUp?: __AnyHandler;
|
|
209
|
+
onLoad?: __AnyHandler;
|
|
210
|
+
onError?: __AnyHandler;
|
|
211
|
+
renderItem?: __AnyHandler;
|
|
212
|
+
render?: __AnyHandler;
|
|
213
|
+
[key: string]: any;
|
|
214
|
+
};
|
|
215
|
+
type __AnyComponent = React.ComponentType<__AnyComponentProps>;
|
|
216
|
+
type __ExecuteExtensionAction = (action: string, ...args: unknown[]) => Promise<any>;
|
|
217
|
+
|
|
218
|
+
type __UIComponents = {
|
|
219
|
+
Button: __AnyComponent;
|
|
220
|
+
Checkbox: __AnyComponent;
|
|
221
|
+
Input: __AnyComponent;
|
|
222
|
+
Select: __AnyComponent;
|
|
223
|
+
TextArea: __AnyComponent;
|
|
224
|
+
IconButton: __AnyComponent;
|
|
225
|
+
RadioButton: __AnyComponent;
|
|
226
|
+
MultiSelect: __AnyComponent;
|
|
227
|
+
Slider: __AnyComponent;
|
|
228
|
+
DatePicker: __AnyComponent;
|
|
229
|
+
Chip: __AnyComponent;
|
|
230
|
+
ModelSelector: __AnyComponent;
|
|
231
|
+
Tooltip: __AnyComponent;
|
|
232
|
+
LoadingOverlay: __AnyComponent;
|
|
233
|
+
ConfirmDialog: __AnyComponent;
|
|
234
|
+
ModalOverlayLayout: __AnyComponent;
|
|
235
|
+
CodeBlock: __AnyComponent;
|
|
236
|
+
ExpandableMessageBlock: __AnyComponent;
|
|
237
|
+
};`;
|
|
238
|
+
|
|
239
|
+
const uiProps = `type __ComponentProps = {
|
|
240
|
+
projectDir?: string;
|
|
241
|
+
task?: TaskData;
|
|
242
|
+
agentProfile?: AgentProfile;
|
|
243
|
+
models: Model[];
|
|
244
|
+
providers: ProviderProfile[];
|
|
245
|
+
ui: __UIComponents;
|
|
246
|
+
icons: Record<string, Record<string, any>>;
|
|
247
|
+
libraries: Record<string, any>;
|
|
248
|
+
activateTask?: (taskId: string) => void;
|
|
249
|
+
executeExtensionAction: __ExecuteExtensionAction;
|
|
250
|
+
data: any;
|
|
251
|
+
api?: ApplicationAPI;
|
|
252
|
+
taskId?: string;
|
|
253
|
+
// index signature: extensions narrow with manual message.type checks, which TS cannot follow
|
|
254
|
+
message?: Message & Record<string, any>;
|
|
255
|
+
mode?: string;
|
|
256
|
+
onRunPrompt?: () => void;
|
|
257
|
+
onResumeTask?: () => void;
|
|
258
|
+
onDeleteTask?: () => void;
|
|
259
|
+
renderDefaultTaskActions?: () => React.ReactNode;
|
|
260
|
+
};`;
|
|
261
|
+
|
|
262
|
+
const configProps = `type __ComponentProps = {
|
|
263
|
+
extensionId: string;
|
|
264
|
+
config: Record<string, any> | null;
|
|
265
|
+
updateConfig: (newConfig: any) => void;
|
|
266
|
+
executeExtensionAction: __ExecuteExtensionAction;
|
|
267
|
+
ui: __UIComponents;
|
|
268
|
+
icons: Record<string, Record<string, any>>;
|
|
269
|
+
models: Model[];
|
|
270
|
+
providers: ProviderProfile[];
|
|
271
|
+
projectDir?: string;
|
|
272
|
+
task?: TaskData;
|
|
273
|
+
agentProfile?: AgentProfile;
|
|
274
|
+
api?: ApplicationAPI;
|
|
275
|
+
};`;
|
|
276
|
+
|
|
277
|
+
return `${shared}\n${kind === 'config' ? configProps : uiProps}\n`;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const typeCheckTemplate = (template, kind, env, sourceLines) => {
|
|
281
|
+
const header = `import * as React from 'react';\n${buildPropsType(kind, env.commonTypesAvailable)}`;
|
|
282
|
+
const footer = '\nconst __cmp: (props: __ComponentProps) => React.ReactNode = ';
|
|
283
|
+
const fileContent = `${header}${footer}${template};\n`;
|
|
284
|
+
|
|
285
|
+
const headerLineCount = header.split('\n').length + footer.split('\n').length - 1;
|
|
286
|
+
|
|
287
|
+
const tmpDir = env.repoRoot
|
|
288
|
+
? path.join(env.repoRoot, 'node_modules', '.cache', 'aiderdesk-ext-ui-check')
|
|
289
|
+
: path.join(os.tmpdir(), 'aiderdesk-ext-ui-check');
|
|
290
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
291
|
+
|
|
292
|
+
const hash = [...template].reduce((acc, ch) => (acc * 31 + ch.charCodeAt(0)) >>> 0, 7);
|
|
293
|
+
const tmpFile = path.join(tmpDir, `check-${kind}-${hash.toString(36)}.tsx`);
|
|
294
|
+
fs.writeFileSync(tmpFile, fileContent);
|
|
295
|
+
|
|
296
|
+
try {
|
|
297
|
+
const compilerOptions = {
|
|
298
|
+
// deliberately loose: extension JSX is JavaScript at runtime, so patterns like
|
|
299
|
+
// useState(null)/useState([]) must not be flagged; typos and unknown names still are
|
|
300
|
+
noEmit: true,
|
|
301
|
+
target: env.typescript.ScriptTarget.ES2022,
|
|
302
|
+
module: env.typescript.ModuleKind.ESNext,
|
|
303
|
+
moduleResolution: env.typescript.ModuleResolutionKind.Bundler,
|
|
304
|
+
jsx: env.typescript.JsxEmit.ReactJSX,
|
|
305
|
+
lib: ['lib.es2022.d.ts', 'lib.dom.d.ts', 'lib.dom.iterable.d.ts'],
|
|
306
|
+
skipLibCheck: true,
|
|
307
|
+
esModuleInterop: true,
|
|
308
|
+
forceConsistentCasingInFileNames: true,
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
if (env.repoRoot) {
|
|
312
|
+
compilerOptions.baseUrl = env.repoRoot;
|
|
313
|
+
compilerOptions.paths = {
|
|
314
|
+
'@common/*': [path.join(env.repoRoot, 'packages', 'common', 'src', '*')],
|
|
315
|
+
};
|
|
316
|
+
} else if (env.reactTypesDir) {
|
|
317
|
+
compilerOptions.baseUrl = os.tmpdir();
|
|
318
|
+
compilerOptions.paths = {
|
|
319
|
+
react: [path.join(env.reactTypesDir, 'index.d.ts')],
|
|
320
|
+
'react/jsx-runtime': [path.join(env.reactTypesDir, 'jsx-runtime.d.ts')],
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const program = env.typescript.createProgram([tmpFile], compilerOptions);
|
|
325
|
+
const sourceFile = program.getSourceFile(tmpFile);
|
|
326
|
+
if (!sourceFile) {
|
|
327
|
+
return [{ line: 0, column: 0, message: 'Internal error: could not create TypeScript source file' }];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const diagnostics = [
|
|
331
|
+
...env.typescript.getPreEmitDiagnostics(program).filter((d) => d.file === sourceFile),
|
|
332
|
+
].filter((d) => {
|
|
333
|
+
const message = env.typescript.flattenDiagnosticMessageText(d.messageText, ' ');
|
|
334
|
+
// skip "Property 'x' does not exist on type '{ ... }'" — anonymous object literals come from
|
|
335
|
+
// spreads of dynamic data and local JS-style objects; extension JSX is untyped at runtime
|
|
336
|
+
if (d.code === 2339 && /on type '\{.*\}'\.?\s*$/.test(message)) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
// skip "Expected 1 arguments, but got 0. Did you forget 'void' ... 'Promise'?" — calling
|
|
340
|
+
// resolve() with no arguments is idiomatic JavaScript and fine at runtime
|
|
341
|
+
if (d.code === 2794 && /Did you forget to include 'void' in your type argument to 'Promise'/.test(message)) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
return true;
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
return diagnostics.map((diag) => {
|
|
348
|
+
const pos = diag.file.getLineAndCharacterOfPosition(diag.start);
|
|
349
|
+
const line = pos.line + 2 - headerLineCount;
|
|
350
|
+
const column = pos.character + 1;
|
|
351
|
+
const message = env.typescript.flattenDiagnosticMessageText(diag.messageText, ' ');
|
|
352
|
+
const excerpt = line >= 1 && line <= sourceLines.length ? sourceLines[line - 1].trim() : undefined;
|
|
353
|
+
return { line, column, message, excerpt };
|
|
354
|
+
});
|
|
355
|
+
} finally {
|
|
356
|
+
try {
|
|
357
|
+
fs.unlinkSync(tmpFile);
|
|
358
|
+
} catch {
|
|
359
|
+
// best-effort cleanup
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
const formatIssue = (label, issue) => {
|
|
365
|
+
const location = issue.line >= 1 ? `${issue.line}:${issue.column}` : 'line ?';
|
|
366
|
+
const lines = [` [${label}] ${location} ${issue.message}`];
|
|
367
|
+
if (issue.excerpt) {
|
|
368
|
+
lines.push(` ${issue.excerpt}`);
|
|
369
|
+
}
|
|
370
|
+
return lines.join('\n');
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
const displayPath = (filePath) => {
|
|
374
|
+
const relative = path.relative(process.cwd(), filePath);
|
|
375
|
+
return relative && !relative.startsWith('..') && !path.isAbsolute(relative) ? relative : filePath;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
const cleanSucraseMessage = (message) => {
|
|
379
|
+
return message.split('\n')[0].replace(/\s*\(\d+:\d+\)\s*$/, '');
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
const validateFile = (filePath, kind, opts, env) => {
|
|
383
|
+
const relative = displayPath(filePath);
|
|
384
|
+
const template = fs.readFileSync(filePath, 'utf8');
|
|
385
|
+
const sourceLines = template.split('\n');
|
|
386
|
+
const issues = [];
|
|
387
|
+
const checksRun = [];
|
|
388
|
+
|
|
389
|
+
if (opts.runSucrase && env.sucrase) {
|
|
390
|
+
checksRun.push('syntax');
|
|
391
|
+
try {
|
|
392
|
+
transpileLikeRuntime(template, env.sucrase.transform);
|
|
393
|
+
} catch (error) {
|
|
394
|
+
const mapped = mapSucraseLocation(error.loc);
|
|
395
|
+
const line = mapped?.line ?? 0;
|
|
396
|
+
issues.push({
|
|
397
|
+
label: 'SYNTAX',
|
|
398
|
+
line,
|
|
399
|
+
column: mapped?.column ?? 0,
|
|
400
|
+
message: cleanSucraseMessage(error.message) || 'Syntax error',
|
|
401
|
+
excerpt: line >= 1 && line <= sourceLines.length ? sourceLines[line - 1].trim() : undefined,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (opts.runTypes && env.typescript && env.reactTypesDir) {
|
|
407
|
+
checksRun.push('types');
|
|
408
|
+
for (const issue of typeCheckTemplate(template, kind, env, sourceLines)) {
|
|
409
|
+
issues.push({ label: 'TYPE', ...issue });
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (issues.length === 0) {
|
|
414
|
+
console.log(`PASS ${relative} (${kind}) — ${checksRun.length > 0 ? checksRun.join(', ') : 'no checks'}`);
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
console.log(`FAIL ${relative} (${kind})`);
|
|
419
|
+
for (const issue of issues) {
|
|
420
|
+
console.log(formatIssue(issue.label, issue));
|
|
421
|
+
}
|
|
422
|
+
return false;
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const main = () => {
|
|
426
|
+
const opts = parseArgs(process.argv.slice(2));
|
|
427
|
+
|
|
428
|
+
if (opts.targets.length === 0) {
|
|
429
|
+
console.error('Error: no files or directories given');
|
|
430
|
+
printHelp();
|
|
431
|
+
process.exit(2);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const env = resolveEnvironment();
|
|
435
|
+
const warnings = [];
|
|
436
|
+
if (opts.runSucrase && !env.sucrase) {
|
|
437
|
+
warnings.push('sucrase not resolvable — runtime syntax check skipped (run from the aider-desk repo or install sucrase)');
|
|
438
|
+
}
|
|
439
|
+
if (opts.runTypes && (!env.typescript || !env.reactTypesDir)) {
|
|
440
|
+
warnings.push('typescript or @types/react not resolvable — type check skipped (run from the aider-desk repo or install them)');
|
|
441
|
+
}
|
|
442
|
+
if (opts.runTypes && env.typescript && env.reactTypesDir && !env.commonTypesAvailable) {
|
|
443
|
+
warnings.push('AiderDesk common types not found — checking with permissive (any) prop types');
|
|
444
|
+
}
|
|
445
|
+
for (const warning of warnings) {
|
|
446
|
+
console.log(`Warning: ${warning}`);
|
|
447
|
+
}
|
|
448
|
+
if (!opts.runTypes && !opts.runSucrase) {
|
|
449
|
+
console.error('Error: both checks disabled — nothing to validate');
|
|
450
|
+
process.exit(2);
|
|
451
|
+
}
|
|
452
|
+
if (warnings.length > 0 && !env.sucrase && (!env.typescript || !env.reactTypesDir)) {
|
|
453
|
+
console.error('Error: no validator dependencies available at all — cannot validate');
|
|
454
|
+
process.exit(2);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const files = collectFiles(opts.targets);
|
|
458
|
+
if (files.length === 0) {
|
|
459
|
+
console.error('Error: no .jsx/.tsx files found in the given targets');
|
|
460
|
+
process.exit(2);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
console.log(`Validating ${files.length} file(s)...\n`);
|
|
464
|
+
let passed = 0;
|
|
465
|
+
let failed = 0;
|
|
466
|
+
for (const file of files) {
|
|
467
|
+
const kind = detectKind(file, opts.type);
|
|
468
|
+
if (validateFile(file, kind, opts, env)) {
|
|
469
|
+
passed++;
|
|
470
|
+
} else {
|
|
471
|
+
failed++;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
console.log(`\nSummary: ${passed} passed, ${failed} failed`);
|
|
476
|
+
process.exit(failed > 0 ? 1 : 0);
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
main();
|
|
@@ -298,6 +298,14 @@ Context object passed to extension methods, providing access to AiderDesk APIs.
|
|
|
298
298
|
|
|
299
299
|
```typescript
|
|
300
300
|
interface ExtensionContext {
|
|
301
|
+
/** Register a setup function whose returned cleanup function will be called
|
|
302
|
+
* automatically when the extension is unloaded.
|
|
303
|
+
* Setup runs immediately. Cleanup runs in reverse order of registration (LIFO).
|
|
304
|
+
* Cleanup may return a Promise; async cleanups are awaited during unload and
|
|
305
|
+
* errors are logged without blocking other cleanups.
|
|
306
|
+
* If setup returns void, no cleanup is registered. */
|
|
307
|
+
addDisposable(setup: () => (() => void | Promise<void>) | void): void;
|
|
308
|
+
|
|
301
309
|
/** Log a message prefixed with the extension name. Type defaults to 'info'. */
|
|
302
310
|
log(message: string, type?: 'info' | 'error' | 'warn' | 'debug'): void;
|
|
303
311
|
|
|
@@ -120,6 +120,7 @@ npm install
|
|
|
120
120
|
### Step 7: Verify
|
|
121
121
|
|
|
122
122
|
- Run type checking: `npm run typecheck`
|
|
123
|
+
- Validate UI/config components (.jsx files) if any (see [ui-components.md](ui-components.md) → Validating components): `node <skill-dir>/assets/scripts/validate-extension-ui.mjs <extension-dir>` — all files must pass
|
|
123
124
|
- Run tests if applicable: `npm run test`
|
|
124
125
|
- Verify extension loads without errors
|
|
125
126
|
- Check that extension appears in extensions list
|