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

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.
@@ -84,14 +84,6 @@ export declare function createPlatformApiClient(input: PlatformApiClientInput):
84
84
  }): Promise<{
85
85
  variables: RuntimeVariableRecord[];
86
86
  }>;
87
- importRuntimeVariables(session: CliSessionState, orgId: string, inputData: {
88
- content: string;
89
- environment: string;
90
- fileName?: string | null;
91
- }): Promise<{
92
- importedCount: number;
93
- variables: RuntimeVariableRecord[];
94
- }>;
95
87
  listOrgSecrets(session: CliSessionState, orgId: string, inputData?: {
96
88
  environment?: string;
97
89
  }): Promise<{
@@ -96,15 +96,6 @@ export function createPlatformApiClient(input) {
96
96
  session
97
97
  });
98
98
  },
99
- async importRuntimeVariables(session, orgId, inputData) {
100
- const { environment, ...body } = inputData;
101
- return transport.requestJson({
102
- body,
103
- method: "POST",
104
- path: withQuery(`/api/v1/orgs/${encodeURIComponent(orgId)}/runtime-variables/import`, { environment }),
105
- session
106
- });
107
- },
108
99
  async listOrgSecrets(session, orgId, inputData = {}) {
109
100
  return transport.requestJson({
110
101
  path: withQuery(`/api/v1/orgs/${encodeURIComponent(orgId)}/secrets`, inputData),
@@ -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.", {
@@ -1119,16 +1119,6 @@ const RAW_CLI_COMMANDS = [
1119
1119
  ],
1120
1120
  requiresActiveOrg: true
1121
1121
  }),
1122
- command(["env", "import"], "Import runtime variables from a .env file.", {
1123
- labels: ["write", "env"],
1124
- args: [arg("path-to-.env", "Path to a .env file.")],
1125
- flags: [flag("environment", "Target environment.", {
1126
- acceptsValue: true,
1127
- required: true,
1128
- valueType: "string"
1129
- })],
1130
- requiresActiveOrg: true
1131
- }),
1132
1122
  command(["secrets", "list"], "List organization secret names without values.", {
1133
1123
  labels: ["read", "secret"],
1134
1124
  flags: [flag("environment", "Target environment.", {
package/dist/commands.js CHANGED
@@ -6,7 +6,7 @@ import { authProblem, genericProblem, notFoundProblem, usageProblem } from "./cl
6
6
  import { readOptionalNumberFlag, readOptionalStringFlag, readRequiredStringFlag } from "./command-flags.js";
7
7
  import { executeArtifactDownload, executeArtifactArchive, executeArtifactInspect, executeArtifactInventory, executeArtifactList, executeArtifactPurge, executeArtifactRead, executeArtifactRestore, executeArtifactUpload } from "./artifact-commands.js";
8
8
  import { executeAudit } from "./audit-commands.js";
9
- import { isZipArchivePath, readArchiveBytes, readImportEntries, readJsonInputSpecifier, readWorkspaceTestEntries, readTextInputSpecifier, parseEnvFile, writeReleaseSourceFiles } from "./files.js";
9
+ import { isZipArchivePath, readArchiveBytes, readImportEntries, readJsonInputSpecifier, readWorkspaceTestEntries, readTextInputSpecifier, writeReleaseSourceFiles } from "./files.js";
10
10
  import { renderDiffSummary, renderKeyValue, renderPrettyJson, renderSuccess, renderTable } from "./format.js";
11
11
  import { buildTaskDetailPresentation } from "./task-detail.js";
12
12
  import { confirmDestructive } from "./interaction.js";
@@ -165,7 +165,6 @@ export async function executeParsedCommand(parsed, context) {
165
165
  case "env.list":
166
166
  case "env.get":
167
167
  case "env.replace":
168
- case "env.import":
169
168
  return executeEnv(parsed, context, api);
170
169
  case "secrets.list":
171
170
  case "secrets.set":
@@ -1224,24 +1223,6 @@ async function executeEnv(parsed, context, api) {
1224
1223
  meta: { command: parsed.definition.path.join(" "), environment, orgId: org.id }
1225
1224
  };
1226
1225
  }
1227
- case "env.import": {
1228
- const environment = readRequiredCliEnvironmentFlag(parsed);
1229
- const filePath = readRequiredArg(parsed, "path-to-.env");
1230
- const content = await readTextInputSpecifier(`@${filePath}`, context.stdin, parsed.definition.id);
1231
- const preview = await parseEnvFile(filePath);
1232
- announceResolvedEnvironment(parsed, context, environment);
1233
- const data = await api.importRuntimeVariables(session, org.id, {
1234
- content,
1235
- environment,
1236
- fileName: filePath
1237
- });
1238
- return {
1239
- data,
1240
- human: renderSuccess(`Imported ${data.importedCount} variables from ${filePath} into ${environment}. Parsed ${preview.length}.`),
1241
- kind: "authoring_env_import",
1242
- meta: { command: parsed.definition.path.join(" "), environment, orgId: org.id }
1243
- };
1244
- }
1245
1226
  default:
1246
1227
  throw genericProblem(`Unhandled env command ${parsed.definition.id}.`, parsed.definition.id);
1247
1228
  }
@@ -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,11 +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
  }>>;
41
- export declare function parseEnvFile(pathValue: string): Promise<Array<{
42
- name: string;
43
- value: string;
44
- }>>;
package/dist/files.js CHANGED
@@ -2,7 +2,6 @@ import { Buffer } from "node:buffer";
2
2
  import { lstat, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
3
3
  import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
4
4
  import { usageProblem } from "./cli-errors.js";
5
- import { parseDotEnv } from "./dotenv.js";
6
5
  import { shouldIgnoreWorkspacePath } from "./workspace-source.js";
7
6
  const MAX_IMPORT_FILE_COUNT = 500;
8
7
  const MAX_IMPORT_FILE_BYTES = 1_000_000;
@@ -56,7 +55,11 @@ async function readUtf8Entries(pathValue, options) {
56
55
  throw usageProblem("Import path must be a regular file or directory, not a symbolic link.", options.instance);
57
56
  }
58
57
  if (pathStat.isFile()) {
59
- const content = await readLimitedUtf8File(absolutePath, basename(absolutePath), {
58
+ const pathName = basename(absolutePath);
59
+ if (shouldIgnoreSourceImportPath(pathName)) {
60
+ return [];
61
+ }
62
+ const content = await readLimitedUtf8File(absolutePath, pathName, {
60
63
  fileCount: 0,
61
64
  totalBytes: 0
62
65
  }, options);
@@ -146,17 +149,17 @@ export async function writePackageExport(outPath, envelope) {
146
149
  await mkdir(dirname(metadataPath), { recursive: true });
147
150
  await writeFile(metadataPath, `${JSON.stringify(envelope.metadata, null, 2)}\n`, "utf8");
148
151
  }
149
- export async function readPackageFileEntries(pathValue) {
152
+ export async function readPackageFileEntries(pathValue, instance) {
150
153
  const absolutePath = resolve(pathValue);
151
154
  const pathStat = await lstat(absolutePath);
152
155
  if (pathStat.isSymbolicLink()) {
153
- throw usageProblem("Package path must be a regular file or directory, not a symbolic link.", "extensions.publish");
156
+ throw usageProblem("Package path must be a regular file or directory, not a symbolic link.", instance);
154
157
  }
155
158
  if (pathStat.isFile()) {
156
159
  assertPackageFileCanBeRead(pathStat.size, basename(absolutePath), {
157
160
  fileCount: 0,
158
161
  totalBytes: 0
159
- });
162
+ }, instance);
160
163
  return [{
161
164
  contentBase64: (await readFile(absolutePath)).toString("base64"),
162
165
  path: basename(absolutePath)
@@ -166,17 +169,10 @@ export async function readPackageFileEntries(pathValue) {
166
169
  await walkPackageDirectory(absolutePath, absolutePath, entries, {
167
170
  fileCount: 0,
168
171
  totalBytes: 0
169
- });
172
+ }, instance);
170
173
  entries.sort((left, right) => left.path.localeCompare(right.path));
171
174
  return entries;
172
175
  }
173
- export async function parseEnvFile(pathValue) {
174
- const content = await readFile(pathValue, "utf8");
175
- return Object.entries(parseDotEnv(content)).map(([name, value]) => ({
176
- name,
177
- value
178
- }));
179
- }
180
176
  function readJsonObject(source, instance) {
181
177
  let parsed;
182
178
  try {
@@ -203,7 +199,7 @@ async function walkImportDirectory(root, current, entries, counters, options) {
203
199
  for (const child of children) {
204
200
  const childPath = join(current, child.name);
205
201
  const relativePath = relative(root, childPath).replaceAll("\\", "/");
206
- if (shouldIgnoreImportPath(relativePath)) {
202
+ if (shouldIgnoreSourceImportPath(relativePath)) {
207
203
  continue;
208
204
  }
209
205
  if (child.isDirectory()) {
@@ -220,7 +216,7 @@ async function walkImportDirectory(root, current, entries, counters, options) {
220
216
  });
221
217
  }
222
218
  }
223
- async function walkPackageDirectory(root, current, entries, counters) {
219
+ async function walkPackageDirectory(root, current, entries, counters, instance) {
224
220
  const children = await readdir(current, { withFileTypes: true });
225
221
  children.sort((left, right) => left.name.localeCompare(right.name));
226
222
  for (const child of children) {
@@ -230,14 +226,14 @@ async function walkPackageDirectory(root, current, entries, counters) {
230
226
  continue;
231
227
  }
232
228
  if (child.isDirectory()) {
233
- await walkPackageDirectory(root, childPath, entries, counters);
229
+ await walkPackageDirectory(root, childPath, entries, counters, instance);
234
230
  continue;
235
231
  }
236
232
  if (!child.isFile()) {
237
233
  continue;
238
234
  }
239
235
  const childStat = await lstat(childPath);
240
- assertPackageFileCanBeRead(childStat.size, relativePath, counters);
236
+ assertPackageFileCanBeRead(childStat.size, relativePath, counters, instance);
241
237
  entries.push({
242
238
  contentBase64: (await readFile(childPath)).toString("base64"),
243
239
  path: relativePath
@@ -247,6 +243,12 @@ async function walkPackageDirectory(root, current, entries, counters) {
247
243
  function shouldIgnoreImportPath(pathValue) {
248
244
  return shouldIgnoreWorkspacePath(pathValue);
249
245
  }
246
+ function shouldIgnoreSourceImportPath(pathValue) {
247
+ return shouldIgnoreImportPath(pathValue) || isRemovedRuntimeEnvironmentPath(pathValue);
248
+ }
249
+ function isRemovedRuntimeEnvironmentPath(pathValue) {
250
+ return pathValue === ".env" || pathValue === ".env.example";
251
+ }
250
252
  async function assertExportOutputIsEmpty(absolutePath, instance, outputLabel = "Export") {
251
253
  try {
252
254
  const pathStat = await lstat(absolutePath);
@@ -299,15 +301,15 @@ async function readLimitedUtf8File(filePath, displayPath, counters, options) {
299
301
  counters.totalBytes += bytes;
300
302
  return { content };
301
303
  }
302
- function assertPackageFileCanBeRead(bytes, displayPath, counters) {
304
+ function assertPackageFileCanBeRead(bytes, displayPath, counters, instance) {
303
305
  if (counters.fileCount >= MAX_IMPORT_FILE_COUNT) {
304
- throw usageProblem(`Package has more than ${String(MAX_IMPORT_FILE_COUNT)} files.`, "extensions.publish");
306
+ throw usageProblem(`Package has more than ${String(MAX_IMPORT_FILE_COUNT)} files.`, instance);
305
307
  }
306
308
  if (bytes > MAX_PACKAGE_FILE_BYTES) {
307
- throw usageProblem(`Package file ${displayPath} exceeds the per-file byte limit.`, "extensions.publish");
309
+ throw usageProblem(`Package file ${displayPath} exceeds the per-file byte limit.`, instance);
308
310
  }
309
311
  if (counters.totalBytes + bytes > MAX_IMPORT_TOTAL_BYTES) {
310
- throw usageProblem(`Package exceeds the ${String(MAX_IMPORT_TOTAL_BYTES)} byte limit.`, "extensions.publish");
312
+ throw usageProblem(`Package exceeds the ${String(MAX_IMPORT_TOTAL_BYTES)} byte limit.`, instance);
311
313
  }
312
314
  counters.fileCount += 1;
313
315
  counters.totalBytes += bytes;
@@ -2943,14 +2943,6 @@ export declare const CLI_SCHEMA_REGISTRY_DATA: readonly [{
2943
2943
  readonly maxLength: 4096;
2944
2944
  readonly type: "string";
2945
2945
  };
2946
- readonly env: {
2947
- readonly type: "object";
2948
- readonly patternProperties: {
2949
- readonly "^(.*)$": {
2950
- readonly type: "string";
2951
- };
2952
- };
2953
- };
2954
2946
  readonly parseStdoutAsJson: {
2955
2947
  readonly type: "boolean";
2956
2948
  };
@@ -2964,39 +2956,91 @@ export declare const CLI_SCHEMA_REGISTRY_DATA: readonly [{
2964
2956
  };
2965
2957
  };
2966
2958
  };
2967
- readonly runtimeSdk: {
2968
- readonly additionalProperties: true;
2969
- readonly type: "object";
2970
- readonly properties: {};
2971
- };
2972
- readonly credentials: {
2959
+ readonly bindings: {
2960
+ readonly additionalProperties: false;
2973
2961
  readonly type: "object";
2974
- readonly patternProperties: {
2975
- readonly "^(.*)$": {
2976
- readonly additionalProperties: false;
2977
- readonly type: "object";
2978
- readonly required: readonly ["bindingKind", "connectionRef", "inject"];
2979
- readonly properties: {
2980
- readonly bindingKind: {
2962
+ readonly properties: {
2963
+ readonly env: {
2964
+ readonly type: "array";
2965
+ readonly items: {
2966
+ readonly anyOf: readonly [{
2981
2967
  readonly minLength: 1;
2982
2968
  readonly maxLength: 128;
2969
+ readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
2983
2970
  readonly type: "string";
2984
- };
2985
- readonly connectionRef: {
2971
+ }, {
2972
+ readonly additionalProperties: false;
2973
+ readonly type: "object";
2974
+ readonly required: readonly ["name"];
2975
+ readonly properties: {
2976
+ readonly name: {
2977
+ readonly minLength: 1;
2978
+ readonly maxLength: 128;
2979
+ readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
2980
+ readonly type: "string";
2981
+ };
2982
+ readonly as: {
2983
+ readonly minLength: 1;
2984
+ readonly maxLength: 128;
2985
+ readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
2986
+ readonly type: "string";
2987
+ };
2988
+ };
2989
+ }];
2990
+ };
2991
+ };
2992
+ readonly secrets: {
2993
+ readonly type: "array";
2994
+ readonly items: {
2995
+ readonly anyOf: readonly [{
2986
2996
  readonly minLength: 1;
2987
2997
  readonly maxLength: 128;
2998
+ readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
2988
2999
  readonly type: "string";
2989
- };
2990
- readonly inject: {
3000
+ }, {
2991
3001
  readonly additionalProperties: false;
2992
3002
  readonly type: "object";
2993
- readonly required: readonly ["env"];
3003
+ readonly required: readonly ["name"];
2994
3004
  readonly properties: {
2995
- readonly env: {
3005
+ readonly name: {
2996
3006
  readonly minLength: 1;
2997
3007
  readonly maxLength: 128;
3008
+ readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
2998
3009
  readonly type: "string";
2999
3010
  };
3011
+ readonly as: {
3012
+ readonly minLength: 1;
3013
+ readonly maxLength: 128;
3014
+ readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
3015
+ readonly type: "string";
3016
+ };
3017
+ };
3018
+ }];
3019
+ };
3020
+ };
3021
+ readonly extensions: {
3022
+ readonly type: "object";
3023
+ readonly patternProperties: {
3024
+ readonly "^(.*)$": {
3025
+ readonly additionalProperties: false;
3026
+ readonly type: "object";
3027
+ readonly required: readonly ["install", "functions"];
3028
+ readonly properties: {
3029
+ readonly install: {
3030
+ readonly minLength: 1;
3031
+ readonly maxLength: 128;
3032
+ readonly type: "string";
3033
+ };
3034
+ readonly functions: {
3035
+ readonly minItems: 1;
3036
+ readonly uniqueItems: true;
3037
+ readonly type: "array";
3038
+ readonly items: {
3039
+ readonly minLength: 1;
3040
+ readonly maxLength: 128;
3041
+ readonly type: "string";
3042
+ };
3043
+ };
3000
3044
  };
3001
3045
  };
3002
3046
  };
@@ -3486,14 +3486,6 @@ export const CLI_SCHEMA_REGISTRY_DATA = [
3486
3486
  "maxLength": 4096,
3487
3487
  "type": "string"
3488
3488
  },
3489
- "env": {
3490
- "type": "object",
3491
- "patternProperties": {
3492
- "^(.*)$": {
3493
- "type": "string"
3494
- }
3495
- }
3496
- },
3497
3489
  "parseStdoutAsJson": {
3498
3490
  "type": "boolean"
3499
3491
  },
@@ -3507,44 +3499,103 @@ export const CLI_SCHEMA_REGISTRY_DATA = [
3507
3499
  }
3508
3500
  }
3509
3501
  },
3510
- "runtimeSdk": {
3511
- "additionalProperties": true,
3512
- "type": "object",
3513
- "properties": {}
3514
- },
3515
- "credentials": {
3502
+ "bindings": {
3503
+ "additionalProperties": false,
3516
3504
  "type": "object",
3517
- "patternProperties": {
3518
- "^(.*)$": {
3519
- "additionalProperties": false,
3505
+ "properties": {
3506
+ "env": {
3507
+ "type": "array",
3508
+ "items": {
3509
+ "anyOf": [
3510
+ {
3511
+ "minLength": 1,
3512
+ "maxLength": 128,
3513
+ "pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
3514
+ "type": "string"
3515
+ },
3516
+ {
3517
+ "additionalProperties": false,
3518
+ "type": "object",
3519
+ "required": [
3520
+ "name"
3521
+ ],
3522
+ "properties": {
3523
+ "name": {
3524
+ "minLength": 1,
3525
+ "maxLength": 128,
3526
+ "pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
3527
+ "type": "string"
3528
+ },
3529
+ "as": {
3530
+ "minLength": 1,
3531
+ "maxLength": 128,
3532
+ "pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
3533
+ "type": "string"
3534
+ }
3535
+ }
3536
+ }
3537
+ ]
3538
+ }
3539
+ },
3540
+ "secrets": {
3541
+ "type": "array",
3542
+ "items": {
3543
+ "anyOf": [
3544
+ {
3545
+ "minLength": 1,
3546
+ "maxLength": 128,
3547
+ "pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
3548
+ "type": "string"
3549
+ },
3550
+ {
3551
+ "additionalProperties": false,
3552
+ "type": "object",
3553
+ "required": [
3554
+ "name"
3555
+ ],
3556
+ "properties": {
3557
+ "name": {
3558
+ "minLength": 1,
3559
+ "maxLength": 128,
3560
+ "pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
3561
+ "type": "string"
3562
+ },
3563
+ "as": {
3564
+ "minLength": 1,
3565
+ "maxLength": 128,
3566
+ "pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
3567
+ "type": "string"
3568
+ }
3569
+ }
3570
+ }
3571
+ ]
3572
+ }
3573
+ },
3574
+ "extensions": {
3520
3575
  "type": "object",
3521
- "required": [
3522
- "bindingKind",
3523
- "connectionRef",
3524
- "inject"
3525
- ],
3526
- "properties": {
3527
- "bindingKind": {
3528
- "minLength": 1,
3529
- "maxLength": 128,
3530
- "type": "string"
3531
- },
3532
- "connectionRef": {
3533
- "minLength": 1,
3534
- "maxLength": 128,
3535
- "type": "string"
3536
- },
3537
- "inject": {
3576
+ "patternProperties": {
3577
+ "^(.*)$": {
3538
3578
  "additionalProperties": false,
3539
3579
  "type": "object",
3540
3580
  "required": [
3541
- "env"
3581
+ "install",
3582
+ "functions"
3542
3583
  ],
3543
3584
  "properties": {
3544
- "env": {
3585
+ "install": {
3545
3586
  "minLength": 1,
3546
3587
  "maxLength": 128,
3547
3588
  "type": "string"
3589
+ },
3590
+ "functions": {
3591
+ "minItems": 1,
3592
+ "uniqueItems": true,
3593
+ "type": "array",
3594
+ "items": {
3595
+ "minLength": 1,
3596
+ "maxLength": 128,
3597
+ "type": "string"
3598
+ }
3548
3599
  }
3549
3600
  }
3550
3601
  }
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-rc3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/library.js",
package/dist/dotenv.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function parseDotEnv(source: string): Record<string, string>;
package/dist/dotenv.js DELETED
@@ -1,26 +0,0 @@
1
- const ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/u;
2
- export function parseDotEnv(source) {
3
- const parsed = {};
4
- const lines = source.split(/\r?\n/u);
5
- for (const rawLine of lines) {
6
- const line = rawLine.trim();
7
- if (line.length === 0 || line.startsWith("#")) {
8
- continue;
9
- }
10
- const separatorIndex = line.indexOf("=");
11
- if (separatorIndex <= 0) {
12
- continue;
13
- }
14
- const rawName = line.slice(0, separatorIndex).trim();
15
- if (!ENV_NAME_PATTERN.test(rawName)) {
16
- continue;
17
- }
18
- let value = line.slice(separatorIndex + 1).trim();
19
- if ((value.startsWith("\"") && value.endsWith("\"")) ||
20
- (value.startsWith("'") && value.endsWith("'"))) {
21
- value = value.slice(1, -1);
22
- }
23
- parsed[rawName] = value;
24
- }
25
- return parsed;
26
- }