@buzzni/saycode-cli 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/channel-extension-host.mjs +22 -2
- package/index.mjs +437 -107
- package/package.json +1 -1
|
@@ -240,6 +240,23 @@ const EXTENSION_PANEL_SURFACE_SIZES = ["compact", "standard", "wide"];
|
|
|
240
240
|
function isExtensionPanelSurfaceSize(value) {
|
|
241
241
|
return EXTENSION_PANEL_SURFACE_SIZES.some((size) => size === value);
|
|
242
242
|
}
|
|
243
|
+
function parseExtensionProjectTools(value, apiVersion) {
|
|
244
|
+
if (apiVersion < 3) fail$5("manifest.contributes.projectTools", "requires Extension API version 3");
|
|
245
|
+
return contributionList(value, "manifest.contributes.projectTools", ["id", "title", "command"], (entry, path2) => ({
|
|
246
|
+
id: id(entry.id, `${path2}.id`),
|
|
247
|
+
title: string(entry.title, `${path2}.title`),
|
|
248
|
+
command: id(entry.command, `${path2}.command`)
|
|
249
|
+
}));
|
|
250
|
+
}
|
|
251
|
+
function assertExtensionProjectToolTargets(extensionId2, tools, commands) {
|
|
252
|
+
for (const [index, tool] of tools.entries()) {
|
|
253
|
+
const path2 = `manifest.contributes.projectTools[${index}]`;
|
|
254
|
+
if (!tool.id.startsWith(`${extensionId2}.`)) fail$5(`${path2}.id`, "expected an id declared by the same extension");
|
|
255
|
+
const command = tool.command.startsWith(`${extensionId2}.`) ? commands.find((candidate) => candidate.id === tool.command) : void 0;
|
|
256
|
+
if (!command) fail$5(`${path2}.command`, "expected a command declared by the same extension");
|
|
257
|
+
if (!command.panelId) fail$5(`${path2}.command`, "expected a command that opens a panel");
|
|
258
|
+
}
|
|
259
|
+
}
|
|
243
260
|
const EXTENSION_ARTIFACT_ACTION_OPERATIONS = ["publishPublic"];
|
|
244
261
|
const EXTENSION_ARTIFACT_SOURCE_TYPES = ["project-file", "personal-chat-file"];
|
|
245
262
|
const ID_PATTERN$1 = /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/;
|
|
@@ -501,7 +518,7 @@ const EXTENSION_PERMISSIONS = [
|
|
|
501
518
|
const SAYCODE_EXTENSION_API_VERSION = 3;
|
|
502
519
|
const SAYCODE_EXTENSION_MINIMUM_API_VERSION = 2;
|
|
503
520
|
const MAX_EXTENSION_API_WINDOW_WIDTH = 2;
|
|
504
|
-
const SAYCODE_EXTENSION_ENGINE_VERSION = "1.
|
|
521
|
+
const SAYCODE_EXTENSION_ENGINE_VERSION = "1.2.0";
|
|
505
522
|
const SAYCODE_CHANNEL_API_VERSION = CHANNEL_API_VERSION;
|
|
506
523
|
const SAYCODE_CHANNEL_MINIMUM_API_VERSION = CHANNEL_MINIMUM_API_VERSION;
|
|
507
524
|
class UnsupportedChannelApiVersionError extends Error {
|
|
@@ -524,7 +541,7 @@ const SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$
|
|
|
524
541
|
const ENGINE_RANGE_PATTERN = /^(?:\^|~|>=|<=|>|<)?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
525
542
|
const ENTRYPOINT_PATTERN = /\.(?:cjs|mjs|js)$/;
|
|
526
543
|
const LOCALE_PATTERN = /^[a-z]{2,3}(?:-[A-Z]{2})?$/;
|
|
527
|
-
const CONTRIBUTION_KEYS = /* @__PURE__ */ new Set(["commands", "settings", "panels", "projectTemplates", "machineActions", "artifactActions", "channels"]);
|
|
544
|
+
const CONTRIBUTION_KEYS = /* @__PURE__ */ new Set(["commands", "settings", "panels", "projectTemplates", "machineActions", "projectTools", "artifactActions", "channels"]);
|
|
528
545
|
const V2_PERMISSIONS = /* @__PURE__ */ new Set([
|
|
529
546
|
"browserViewer.open",
|
|
530
547
|
"browserViewer.install",
|
|
@@ -731,6 +748,7 @@ function parseContributions(value, apiVersion, channelApiVersion) {
|
|
|
731
748
|
}
|
|
732
749
|
);
|
|
733
750
|
}
|
|
751
|
+
if (parsed.projectTools !== void 0) result.projectTools = parseExtensionProjectTools(parsed.projectTools, apiVersion);
|
|
734
752
|
if (parsed.artifactActions !== void 0) {
|
|
735
753
|
result.artifactActions = parseExtensionArtifactActions(parsed.artifactActions);
|
|
736
754
|
}
|
|
@@ -743,6 +761,7 @@ function parseContributions(value, apiVersion, channelApiVersion) {
|
|
|
743
761
|
...result.panels ?? [],
|
|
744
762
|
...result.projectTemplates ?? [],
|
|
745
763
|
...result.machineActions ?? [],
|
|
764
|
+
...result.projectTools ?? [],
|
|
746
765
|
...result.artifactActions ?? [],
|
|
747
766
|
...result.channels ?? []
|
|
748
767
|
].map((entry) => entry.id);
|
|
@@ -846,6 +865,7 @@ function parseExtensionManifest(value, options) {
|
|
|
846
865
|
);
|
|
847
866
|
}
|
|
848
867
|
}
|
|
868
|
+
assertExtensionProjectToolTargets(parsedId, contributes.projectTools ?? [], contributes.commands ?? []);
|
|
849
869
|
return {
|
|
850
870
|
id: parsedId,
|
|
851
871
|
version,
|