@verentis/cli 1.0.0 → 1.0.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/dist/index.js +87 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1641,6 +1641,8 @@ var THEME_ASSET_NAMES = [
|
|
|
1641
1641
|
"theme.css",
|
|
1642
1642
|
"background",
|
|
1643
1643
|
"background.dark",
|
|
1644
|
+
"hero",
|
|
1645
|
+
"hero.dark",
|
|
1644
1646
|
"logo",
|
|
1645
1647
|
"logo.dark",
|
|
1646
1648
|
"mark",
|
|
@@ -1812,7 +1814,7 @@ async function validateThemePayload(projectDir, manifest) {
|
|
|
1812
1814
|
else errors.push(...lintThemeCss(text).map((message) => `${at}: ${message}`));
|
|
1813
1815
|
continue;
|
|
1814
1816
|
}
|
|
1815
|
-
const limit =
|
|
1817
|
+
const limit = ["background", "background.dark", "hero", "hero.dark"].includes(name) ? THEME_LIMITS.background : THEME_LIMITS.image;
|
|
1816
1818
|
if (bytes.length > limit) errors.push(`${at} exceeds ${limit / (1024 * 1024)} MiB.`);
|
|
1817
1819
|
if (mime === "image/svg+xml") {
|
|
1818
1820
|
const text = decodeUtf8(bytes);
|
|
@@ -2011,6 +2013,7 @@ function validatePackageManifestRules(kind, manifest) {
|
|
|
2011
2013
|
...launchKindError ? [`${launchKindError}.`] : [],
|
|
2012
2014
|
...validateNativeCollaborationSection(kind, manifest.spec),
|
|
2013
2015
|
...validateMessageChannelsSection(kind, manifest.spec),
|
|
2016
|
+
...validateChatSection(kind, manifest.spec),
|
|
2014
2017
|
...validateActorSection(kind, manifest.spec),
|
|
2015
2018
|
...validateWopiOperationsSection(manifest.spec),
|
|
2016
2019
|
...validateApplicationSplashSection(kind, manifest.spec),
|
|
@@ -2049,6 +2052,10 @@ async function loadManifest(path) {
|
|
|
2049
2052
|
if (messageErrors.length > 0) {
|
|
2050
2053
|
throw new Error(`Invalid manifest at ${path}: ${messageErrors.join(" ")}`);
|
|
2051
2054
|
}
|
|
2055
|
+
const chatErrors = validateChatSection(kind, manifest.spec);
|
|
2056
|
+
if (chatErrors.length > 0) {
|
|
2057
|
+
throw new Error(`Invalid manifest at ${path}: ${chatErrors.join(" ")}`);
|
|
2058
|
+
}
|
|
2052
2059
|
const actorErrors = validateActorSection(kind, manifest.spec);
|
|
2053
2060
|
if (actorErrors.length > 0) {
|
|
2054
2061
|
throw new Error(`Invalid manifest at ${path}: ${actorErrors.join(" ")}`);
|
|
@@ -2163,6 +2170,80 @@ function validateMessageChannelsSection(kind, spec) {
|
|
|
2163
2170
|
});
|
|
2164
2171
|
return errors;
|
|
2165
2172
|
}
|
|
2173
|
+
var CHAT_KEY_PATTERN = /^[a-z][a-z0-9-]{1,31}$/;
|
|
2174
|
+
var CHAT_ARGUMENT_PATTERN = /^[a-z][a-z0-9_]{0,31}$/;
|
|
2175
|
+
var CHAT_RESERVED_ARGUMENT_PREFIX = "chat_";
|
|
2176
|
+
var MAX_CHAT_BOTS = 5;
|
|
2177
|
+
var MAX_CHAT_COMMANDS = 25;
|
|
2178
|
+
var MAX_CHAT_ARGUMENTS = 10;
|
|
2179
|
+
function validateChatSection(kind, spec) {
|
|
2180
|
+
if (!spec || typeof spec !== "object" || Array.isArray(spec) || !Object.prototype.hasOwnProperty.call(spec, "chat")) return [];
|
|
2181
|
+
if (!isApplicationProfile(kind)) return ["spec.chat is only supported for Application manifests."];
|
|
2182
|
+
const record = spec;
|
|
2183
|
+
const chat = record.chat;
|
|
2184
|
+
if (!chat || typeof chat !== "object" || Array.isArray(chat)) return ["spec.chat must be an object with bots and/or commands."];
|
|
2185
|
+
const { bots = [], commands = [] } = chat;
|
|
2186
|
+
const errors = [];
|
|
2187
|
+
const botKeys = /* @__PURE__ */ new Set();
|
|
2188
|
+
if (!Array.isArray(bots)) errors.push("spec.chat.bots must be a list.");
|
|
2189
|
+
else {
|
|
2190
|
+
if (bots.length > MAX_CHAT_BOTS) errors.push(`spec.chat.bots declares more than ${MAX_CHAT_BOTS} bots.`);
|
|
2191
|
+
bots.forEach((value, index) => {
|
|
2192
|
+
const path = `spec.chat.bots[${index}]`;
|
|
2193
|
+
const bot = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2194
|
+
if (typeof bot.key !== "string" || !CHAT_KEY_PATTERN.test(bot.key)) errors.push(`${path}.key must match ${CHAT_KEY_PATTERN.source}.`);
|
|
2195
|
+
else if (botKeys.has(bot.key)) errors.push(`${path}.key '${bot.key}' is declared more than once.`);
|
|
2196
|
+
else botKeys.add(bot.key);
|
|
2197
|
+
if (typeof bot["display-name"] !== "string" || !bot["display-name"].trim()) errors.push(`${path}.display-name is required.`);
|
|
2198
|
+
});
|
|
2199
|
+
const permissions = Array.isArray(record.permissions) ? record.permissions : [];
|
|
2200
|
+
if (bots.length > 0 && !permissions.includes("chat.write")) {
|
|
2201
|
+
errors.push("spec.permissions must include chat.write for the app to post as its bots.");
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
const scripts = (Array.isArray(record.scripts) ? record.scripts : []).filter((script) => typeof script === "string").map((script) => script.trim().replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
2205
|
+
const names = /* @__PURE__ */ new Set();
|
|
2206
|
+
if (!Array.isArray(commands)) errors.push("spec.chat.commands must be a list.");
|
|
2207
|
+
else {
|
|
2208
|
+
if (commands.length > MAX_CHAT_COMMANDS) errors.push(`spec.chat.commands declares more than ${MAX_CHAT_COMMANDS} commands.`);
|
|
2209
|
+
commands.forEach((value, index) => {
|
|
2210
|
+
const path = `spec.chat.commands[${index}]`;
|
|
2211
|
+
const command = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2212
|
+
if (typeof command.name !== "string" || !CHAT_KEY_PATTERN.test(command.name)) errors.push(`${path}.name must match ${CHAT_KEY_PATTERN.source}.`);
|
|
2213
|
+
else if (names.has(command.name)) errors.push(`${path}.name '${command.name}' is declared more than once.`);
|
|
2214
|
+
else names.add(command.name);
|
|
2215
|
+
const script = typeof command.script === "string" ? command.script.trim().replace(/^\.\//, "") : "";
|
|
2216
|
+
if (!script || script.split("/").some((segment) => segment === "" || segment === "." || segment === "..") || !scripts.some((program2) => script.startsWith(`${program2}/`))) {
|
|
2217
|
+
errors.push(`${path}.script must be the entry file of a program listed in spec.scripts (e.g. scripts/approve/main.mjs).`);
|
|
2218
|
+
}
|
|
2219
|
+
if (command.bot !== void 0 && (typeof command.bot !== "string" || !botKeys.has(command.bot))) {
|
|
2220
|
+
errors.push(`${path}.bot must name a bot declared in spec.chat.bots.`);
|
|
2221
|
+
}
|
|
2222
|
+
const args = command.arguments ?? [];
|
|
2223
|
+
if (!Array.isArray(args) || args.length > MAX_CHAT_ARGUMENTS) {
|
|
2224
|
+
errors.push(`${path}.arguments must be a list of at most ${MAX_CHAT_ARGUMENTS} arguments.`);
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2227
|
+
const argumentNames = /* @__PURE__ */ new Set();
|
|
2228
|
+
args.forEach((argumentValue, argumentIndex) => {
|
|
2229
|
+
const argumentPath = `${path}.arguments[${argumentIndex}]`;
|
|
2230
|
+
const argument = argumentValue && typeof argumentValue === "object" && !Array.isArray(argumentValue) ? argumentValue : {};
|
|
2231
|
+
if (typeof argument.name !== "string" || !CHAT_ARGUMENT_PATTERN.test(argument.name) || argumentNames.has(argument.name)) {
|
|
2232
|
+
errors.push(`${argumentPath}.name must be a unique name matching ${CHAT_ARGUMENT_PATTERN.source}.`);
|
|
2233
|
+
} else if (argument.name.startsWith(CHAT_RESERVED_ARGUMENT_PREFIX)) {
|
|
2234
|
+
errors.push(`${argumentPath}.name must not start with '${CHAT_RESERVED_ARGUMENT_PREFIX}': Chat reserves it for the context it passes to command scripts.`);
|
|
2235
|
+
} else argumentNames.add(argument.name);
|
|
2236
|
+
if (argument.type !== void 0 && !["string", "number", "boolean"].includes(argument.type)) {
|
|
2237
|
+
errors.push(`${argumentPath}.type must be string, number or boolean.`);
|
|
2238
|
+
}
|
|
2239
|
+
if (argument.required !== void 0 && typeof argument.required !== "boolean") {
|
|
2240
|
+
errors.push(`${argumentPath}.required must be true or false.`);
|
|
2241
|
+
}
|
|
2242
|
+
});
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
return errors;
|
|
2246
|
+
}
|
|
2166
2247
|
var ACTOR_SURFACE_KINDS = ["app-backend", "mcp", "native-collaboration", "document", "raw-file"];
|
|
2167
2248
|
var ACTOR_FILE_KINDS = /* @__PURE__ */ new Set(["native-collaboration", "document", "raw-file"]);
|
|
2168
2249
|
var MAX_ACTOR_SURFACES = 16;
|
|
@@ -2517,6 +2598,7 @@ function validateManifest(manifest) {
|
|
|
2517
2598
|
for (const message of validateDependencies(spec)) error(message);
|
|
2518
2599
|
for (const message of validateNativeCollaborationSection(kind, spec)) error(message);
|
|
2519
2600
|
for (const message of validateMessageChannelsSection(kind, spec)) error(message);
|
|
2601
|
+
for (const message of validateChatSection(kind, spec)) error(message);
|
|
2520
2602
|
for (const message of validateActorSection(kind, spec)) error(message);
|
|
2521
2603
|
for (const message of validateApplicationSplashSection(kind, spec)) error(message);
|
|
2522
2604
|
for (const message of validateTypeSpecFields(kind, spec)) error(message);
|
|
@@ -3999,8 +4081,8 @@ metadata:
|
|
|
3999
4081
|
# readme: ./README.md
|
|
4000
4082
|
|
|
4001
4083
|
# A theme replaces the workspace theme (/.theme). Map any of the theme assets to files in this package:
|
|
4002
|
-
# theme.css, background, background.dark, logo, logo.dark, mark, mark.dark, favicon,
|
|
4003
|
-
# apple-touch-icon (PNG only). Images may be SVG, PNG, JPEG or WebP (1 MiB each, backgrounds 2 MiB,
|
|
4084
|
+
# theme.css, background, background.dark, hero, hero.dark, logo, logo.dark, mark, mark.dark, favicon,
|
|
4085
|
+
# apple-touch-icon (PNG only). Images may be SVG, PNG, JPEG or WebP (1 MiB each, backgrounds and heroes 2 MiB,
|
|
4004
4086
|
# 4 MiB in total). \`verentis pack\` installs each one at /.theme/<asset>.
|
|
4005
4087
|
spec:
|
|
4006
4088
|
assets:
|
|
@@ -4012,6 +4094,8 @@ spec:
|
|
|
4012
4094
|
favicon: theme/favicon.svg
|
|
4013
4095
|
# background: theme/background.jpg
|
|
4014
4096
|
# background.dark: theme/background-dark.jpg
|
|
4097
|
+
# hero: theme/hero.jpg
|
|
4098
|
+
# hero.dark: theme/hero-dark.jpg
|
|
4015
4099
|
# apple-touch-icon: theme/apple-touch-icon.png # 180\xD7180 PNG
|
|
4016
4100
|
|
|
4017
4101
|
packaging:
|