@kora-platform/cli 0.8.0-rc1 → 0.8.0-rc2

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.
@@ -870,7 +870,7 @@ const RAW_CLI_COMMANDS = [
870
870
  requiresActiveOrg: true
871
871
  }),
872
872
  command(["extensions", "validate"], "Validate an extension package directory or archive-expanded root.", {
873
- labels: ["read", "extension"],
873
+ labels: ["read", "chat-read", "extension"],
874
874
  args: [arg("path", "Path to an extension package directory.")],
875
875
  flags: [
876
876
  flag("subdir", "Validate a subdirectory from a zip archive.", {
@@ -913,7 +913,7 @@ const RAW_CLI_COMMANDS = [
913
913
  requiresActiveOrg: true
914
914
  }),
915
915
  command(["extensions", "publish"], "Publish a validated extension package revision.", {
916
- labels: ["write", "extension"],
916
+ labels: ["write", "chat-write", "extension"],
917
917
  args: [arg("path", "Path to an extension package directory.")],
918
918
  flags: [
919
919
  flag("subdir", "Publish a subdirectory from a zip archive.", {
@@ -54,7 +54,7 @@ export async function executeExtensions(parsed, context, api, resolveOrgScope) {
54
54
  ? await api.validateExtensionPackageArchive(session, org.id, await readArchiveBytes(path, parsed.definition.id), {
55
55
  ...(subdir ? { subdir } : {})
56
56
  })
57
- : await api.validateExtensionPackage(session, org.id, { files: await readPackageFileEntries(path) });
57
+ : await api.validateExtensionPackage(session, org.id, { files: await readPackageFileEntries(path, parsed.definition.id) });
58
58
  return {
59
59
  data,
60
60
  exitCode: data.ok ? 0 : 1,
@@ -70,7 +70,7 @@ export async function executeExtensions(parsed, context, api, resolveOrgScope) {
70
70
  ? await api.publishExtensionPackageArchive(session, org.id, await readArchiveBytes(path, parsed.definition.id), {
71
71
  ...(subdir ? { subdir } : {})
72
72
  })
73
- : await api.publishExtensionPackage(session, org.id, { files: await readPackageFileEntries(path) });
73
+ : await api.publishExtensionPackage(session, org.id, { files: await readPackageFileEntries(path, parsed.definition.id) });
74
74
  return {
75
75
  data,
76
76
  human: renderSuccess(`Published extension ${data.package.name} revision ${data.revision.id}.`),
package/dist/files.d.ts CHANGED
@@ -34,7 +34,7 @@ export declare function writePackageExport(outPath: string, envelope: {
34
34
  }>;
35
35
  metadata: Record<string, unknown>;
36
36
  }): Promise<void>;
37
- export declare function readPackageFileEntries(pathValue: string): Promise<Array<{
37
+ export declare function readPackageFileEntries(pathValue: string, instance: string): Promise<Array<{
38
38
  contentBase64: string;
39
39
  path: string;
40
40
  }>>;
package/dist/files.js CHANGED
@@ -146,17 +146,17 @@ export async function writePackageExport(outPath, envelope) {
146
146
  await mkdir(dirname(metadataPath), { recursive: true });
147
147
  await writeFile(metadataPath, `${JSON.stringify(envelope.metadata, null, 2)}\n`, "utf8");
148
148
  }
149
- export async function readPackageFileEntries(pathValue) {
149
+ export async function readPackageFileEntries(pathValue, instance) {
150
150
  const absolutePath = resolve(pathValue);
151
151
  const pathStat = await lstat(absolutePath);
152
152
  if (pathStat.isSymbolicLink()) {
153
- throw usageProblem("Package path must be a regular file or directory, not a symbolic link.", "extensions.publish");
153
+ throw usageProblem("Package path must be a regular file or directory, not a symbolic link.", instance);
154
154
  }
155
155
  if (pathStat.isFile()) {
156
156
  assertPackageFileCanBeRead(pathStat.size, basename(absolutePath), {
157
157
  fileCount: 0,
158
158
  totalBytes: 0
159
- });
159
+ }, instance);
160
160
  return [{
161
161
  contentBase64: (await readFile(absolutePath)).toString("base64"),
162
162
  path: basename(absolutePath)
@@ -166,7 +166,7 @@ export async function readPackageFileEntries(pathValue) {
166
166
  await walkPackageDirectory(absolutePath, absolutePath, entries, {
167
167
  fileCount: 0,
168
168
  totalBytes: 0
169
- });
169
+ }, instance);
170
170
  entries.sort((left, right) => left.path.localeCompare(right.path));
171
171
  return entries;
172
172
  }
@@ -220,7 +220,7 @@ async function walkImportDirectory(root, current, entries, counters, options) {
220
220
  });
221
221
  }
222
222
  }
223
- async function walkPackageDirectory(root, current, entries, counters) {
223
+ async function walkPackageDirectory(root, current, entries, counters, instance) {
224
224
  const children = await readdir(current, { withFileTypes: true });
225
225
  children.sort((left, right) => left.name.localeCompare(right.name));
226
226
  for (const child of children) {
@@ -230,14 +230,14 @@ async function walkPackageDirectory(root, current, entries, counters) {
230
230
  continue;
231
231
  }
232
232
  if (child.isDirectory()) {
233
- await walkPackageDirectory(root, childPath, entries, counters);
233
+ await walkPackageDirectory(root, childPath, entries, counters, instance);
234
234
  continue;
235
235
  }
236
236
  if (!child.isFile()) {
237
237
  continue;
238
238
  }
239
239
  const childStat = await lstat(childPath);
240
- assertPackageFileCanBeRead(childStat.size, relativePath, counters);
240
+ assertPackageFileCanBeRead(childStat.size, relativePath, counters, instance);
241
241
  entries.push({
242
242
  contentBase64: (await readFile(childPath)).toString("base64"),
243
243
  path: relativePath
@@ -299,15 +299,15 @@ async function readLimitedUtf8File(filePath, displayPath, counters, options) {
299
299
  counters.totalBytes += bytes;
300
300
  return { content };
301
301
  }
302
- function assertPackageFileCanBeRead(bytes, displayPath, counters) {
302
+ function assertPackageFileCanBeRead(bytes, displayPath, counters, instance) {
303
303
  if (counters.fileCount >= MAX_IMPORT_FILE_COUNT) {
304
- throw usageProblem(`Package has more than ${String(MAX_IMPORT_FILE_COUNT)} files.`, "extensions.publish");
304
+ throw usageProblem(`Package has more than ${String(MAX_IMPORT_FILE_COUNT)} files.`, instance);
305
305
  }
306
306
  if (bytes > MAX_PACKAGE_FILE_BYTES) {
307
- throw usageProblem(`Package file ${displayPath} exceeds the per-file byte limit.`, "extensions.publish");
307
+ throw usageProblem(`Package file ${displayPath} exceeds the per-file byte limit.`, instance);
308
308
  }
309
309
  if (counters.totalBytes + bytes > MAX_IMPORT_TOTAL_BYTES) {
310
- throw usageProblem(`Package exceeds the ${String(MAX_IMPORT_TOTAL_BYTES)} byte limit.`, "extensions.publish");
310
+ throw usageProblem(`Package exceeds the ${String(MAX_IMPORT_TOTAL_BYTES)} byte limit.`, instance);
311
311
  }
312
312
  counters.fileCount += 1;
313
313
  counters.totalBytes += bytes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kora-platform/cli",
3
- "version": "0.8.0-rc1",
3
+ "version": "0.8.0-rc2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/library.js",