@feltdb/feltkit 0.3.12 → 0.3.13

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.
Files changed (97) hide show
  1. package/README.md +4 -3
  2. package/dist/app.d.ts +18 -0
  3. package/dist/app.js +22 -0
  4. package/dist/app.js.map +1 -1
  5. package/dist/appboundry/build.js +10 -2
  6. package/dist/appboundry/build.js.map +1 -1
  7. package/dist/appboundry/host.js +2 -2
  8. package/dist/appboundry/host.js.map +1 -1
  9. package/dist/cli/main.d.ts +5 -0
  10. package/dist/cli/main.js +139 -40
  11. package/dist/cli/main.js.map +1 -1
  12. package/dist/client/index.d.ts +3 -0
  13. package/dist/client/index.js +3 -0
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/dashboard/assets/index-BSnW2DC-.js +15 -0
  16. package/dist/dashboard/assets/{index-91I1zDK-.css → index-BXTNQAg1.css} +1 -1
  17. package/dist/dashboard/index.html +3 -3
  18. package/dist/docs.d.ts +12 -0
  19. package/dist/docs.js +42 -0
  20. package/dist/docs.js.map +1 -0
  21. package/dist/errors.d.ts +15 -0
  22. package/dist/errors.js +9 -0
  23. package/dist/errors.js.map +1 -1
  24. package/dist/platform/changes.js +4 -2
  25. package/dist/platform/changes.js.map +1 -1
  26. package/dist/platform/deployments.js +8 -6
  27. package/dist/platform/deployments.js.map +1 -1
  28. package/dist/runtime/activity.d.ts +25 -0
  29. package/dist/runtime/activity.js +38 -12
  30. package/dist/runtime/activity.js.map +1 -1
  31. package/dist/runtime/agent.d.ts +16 -0
  32. package/dist/runtime/agent.js +92 -28
  33. package/dist/runtime/agent.js.map +1 -1
  34. package/dist/runtime/backup-environment.d.ts +8 -1
  35. package/dist/runtime/backup-environment.js +44 -12
  36. package/dist/runtime/backup-environment.js.map +1 -1
  37. package/dist/runtime/backup.d.ts +45 -3
  38. package/dist/runtime/backup.js +237 -68
  39. package/dist/runtime/backup.js.map +1 -1
  40. package/dist/runtime/capabilities.js +4 -2
  41. package/dist/runtime/capabilities.js.map +1 -1
  42. package/dist/runtime/changes.js +2 -2
  43. package/dist/runtime/changes.js.map +1 -1
  44. package/dist/runtime/data.d.ts +30 -3
  45. package/dist/runtime/data.js +136 -32
  46. package/dist/runtime/data.js.map +1 -1
  47. package/dist/runtime/decisions.js +2 -1
  48. package/dist/runtime/decisions.js.map +1 -1
  49. package/dist/runtime/integrations.js +14 -6
  50. package/dist/runtime/integrations.js.map +1 -1
  51. package/dist/runtime/loader.js +22 -2
  52. package/dist/runtime/loader.js.map +1 -1
  53. package/dist/runtime/readiness.js +6 -1
  54. package/dist/runtime/readiness.js.map +1 -1
  55. package/dist/runtime/runtime.d.ts +24 -6
  56. package/dist/runtime/runtime.js +75 -19
  57. package/dist/runtime/runtime.js.map +1 -1
  58. package/dist/runtime/services.d.ts +19 -5
  59. package/dist/runtime/services.js +14 -4
  60. package/dist/runtime/services.js.map +1 -1
  61. package/dist/runtime/sessions.js +4 -3
  62. package/dist/runtime/sessions.js.map +1 -1
  63. package/dist/runtime/state-contract.js +3 -3
  64. package/dist/runtime/state-contract.js.map +1 -1
  65. package/dist/server/admin.d.ts +2 -2
  66. package/dist/server/admin.js +37 -12
  67. package/dist/server/admin.js.map +1 -1
  68. package/dist/server/index.d.ts +2 -1
  69. package/dist/server/index.js +45 -8
  70. package/dist/server/index.js.map +1 -1
  71. package/dist/server/mcp.js +1 -1
  72. package/dist/server/mcp.js.map +1 -1
  73. package/dist/testing/index.d.ts +6 -2
  74. package/dist/testing/index.js +28 -4
  75. package/dist/testing/index.js.map +1 -1
  76. package/docs/AGENT-OPERATIONS.md +515 -0
  77. package/docs/APPBOUNDRY.md +240 -0
  78. package/docs/ARCHITECTURE.md +126 -0
  79. package/docs/BACKUP.md +115 -0
  80. package/docs/GUARANTEES.md +457 -0
  81. package/docs/PATH-TO-PRODUCTION.md +117 -0
  82. package/docs/README.md +15 -0
  83. package/docs/SECURITY.md +182 -0
  84. package/docs/TRANSACTIONS.md +216 -0
  85. package/docs/UPSTREAM-GAPS.md +270 -0
  86. package/docs/WHY-FELTKIT.md +64 -0
  87. package/docs/assets/feltkit-logo-dark.png +0 -0
  88. package/docs/assets/feltkit-logo.png +0 -0
  89. package/package.json +9 -7
  90. package/skills/.claude-plugin/marketplace.json +1 -1
  91. package/skills/.claude-plugin/plugin.json +3 -3
  92. package/skills/feltkit-agent/SKILL.md +9 -5
  93. package/skills/feltkit-build/SKILL.md +10 -1
  94. package/skills/feltkit-data/SKILL.md +9 -3
  95. package/skills/feltkit-services/SKILL.md +7 -3
  96. package/dist/dashboard/assets/index-BhFOquA7.js +0 -15
  97. package/dist/dashboard/theme.js +0 -11
package/dist/cli/main.js CHANGED
@@ -2,9 +2,9 @@
2
2
  * The `feltkit` command.
3
3
  */
4
4
  import { spawn } from "node:child_process";
5
- import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
+ import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
6
6
  import { dirname, extname, join, relative, resolve } from "node:path";
7
- import { createHash } from "node:crypto";
7
+ import { createHash, randomUUID } from "node:crypto";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { FeltKitError, isFeltKitError } from "../errors.js";
10
10
  import { resolveEnvironment } from "../runtime/environment.js";
@@ -14,8 +14,8 @@ import { deploymentArtifact, productionEnv, readDeployment, writeDeployment } fr
14
14
  import { readAdminToken, readRuntimeRecord } from "../runtime/projects.js";
15
15
  import { chooseRoles, defaultOwnerId, issueProductionSession, loadProjectFor, studioLink } from "../server/production.js";
16
16
  import { blockedHint, describePlan } from "../runtime/state-contract.js";
17
- import { verifyBackup } from "../runtime/backup.js";
18
- import { backupEnvironment, restoreEnvironment } from "../runtime/backup-environment.js";
17
+ import { fileSink, verifyBackupFile } from "../runtime/backup.js";
18
+ import { backupEnvironmentTo, restoreEnvironmentFile } from "../runtime/backup-environment.js";
19
19
  import { createGrant, operatorKey } from "../server/operators.js";
20
20
  import { assessReadiness } from "../runtime/readiness.js";
21
21
  import { EnvironmentCredentials, looksLikeSecret, toCredentialRef } from "../runtime/credentials.js";
@@ -26,12 +26,27 @@ import { BUILD_DIR, SDK_VERSION, artifactEnv, build, codegen, doctor, startDev,
26
26
  import { scaffold, ScaffoldError } from "create-feltkit";
27
27
  import { DEPLOY_TARGETS, deploy, lower } from "./deploy.js";
28
28
  import { createInterface } from "node:readline/promises";
29
+ import { createInterface as createLineReader } from "node:readline";
30
+ import { Readable } from "node:stream";
29
31
  import { feltdbContract, formatContract } from "../runtime/contract.js";
30
32
  import { checkSkills, installSkills, shippedSkills, skillsTarget } from "./skills.js";
31
33
  import { c, line, printInspect, symbols } from "./output.js";
34
+ import { PACKAGE_PAGE, SHIPPED_DOCS, docFile, docUrl } from "../docs.js";
35
+ /** Flags that may be given more than once; their values are joined with commas (`--role a --role b` = `a,b`). */
36
+ const REPEATABLE = new Set(["role"]);
32
37
  export function parseArgs(argv) {
33
38
  const positional = [];
34
39
  const flags = {};
40
+ const set = (key, value) => {
41
+ const previous = flags[key];
42
+ if (previous !== undefined && typeof value === "string" && typeof previous === "string") {
43
+ if (!REPEATABLE.has(key))
44
+ throw new FeltKitError("INVALID_ARGUMENT", `--${key} was given more than once ("${previous}" and "${value}"); give it once.`);
45
+ flags[key] = `${previous},${value}`;
46
+ return;
47
+ }
48
+ flags[key] = value;
49
+ };
35
50
  for (let i = 0; i < argv.length; i++) {
36
51
  const arg = argv[i];
37
52
  if (arg === "--") {
@@ -41,13 +56,13 @@ export function parseArgs(argv) {
41
56
  if (arg.startsWith("--")) {
42
57
  const [key, inline] = arg.slice(2).split("=", 2);
43
58
  if (key.startsWith("no-"))
44
- flags[key.slice(3)] = false;
59
+ set(key.slice(3), false);
45
60
  else if (inline !== undefined)
46
- flags[key] = inline;
61
+ set(key, inline);
47
62
  else if (argv[i + 1] && !argv[i + 1].startsWith("-"))
48
- flags[key] = argv[++i];
63
+ set(key, argv[++i]);
49
64
  else
50
- flags[key] = true;
65
+ set(key, true);
51
66
  }
52
67
  else if (arg.startsWith("-") && arg.length > 1) {
53
68
  flags[arg.slice(1)] = true;
@@ -88,6 +103,7 @@ ${c.bold("Commands")}
88
103
  contract Write the FeltDB application contract (for Managed FeltDB)
89
104
  doctor Check the project and installation for problems
90
105
  skills <action> Install, update, or check the FeltKit skills for coding agents
106
+ docs [<name>] List FeltKit's documentation (shipped in the package), or print one document
91
107
 
92
108
  ${c.bold("Options")}
93
109
  --port <n> Port for dev/start (default 3000)
@@ -95,13 +111,36 @@ ${c.bold("Options")}
95
111
  --json Machine-readable output (inspect, session, doctor)
96
112
  --help Show help for a command
97
113
 
98
- Docs: https://github.com/rkendel1/concave#readme`;
114
+ Docs: \`feltkit docs\` (shipped in node_modules/@feltdb/feltkit/docs) · ${PACKAGE_PAGE}`;
115
+ /**
116
+ * Help for `feltkit <command> [<action>] --help`: with an action the command's help documents
117
+ * (`feltkit credential remove …`), only that action's lines; otherwise the whole command.
118
+ */
119
+ export function helpFor(command, action) {
120
+ const text = COMMAND_HELP[command];
121
+ if (!text)
122
+ return HELP;
123
+ if (!action)
124
+ return text;
125
+ const blocks = [];
126
+ for (const row of text.split("\n")) {
127
+ if (row.startsWith("feltkit ") || !blocks.length)
128
+ blocks.push([row]);
129
+ else
130
+ blocks.at(-1).push(row);
131
+ }
132
+ const own = blocks.filter((b) => b[0].startsWith(`feltkit ${command} ${action}`));
133
+ return own.length ? own.map((b) => b.join("\n")).join("\n") : text;
134
+ }
99
135
  const COMMAND_HELP = {
136
+ docs: "feltkit docs List the documentation shipped with this install\n" +
137
+ "feltkit docs <name> Print one document (e.g. feltkit docs guarantees)\n" +
138
+ " Offline: the files are in node_modules/@feltdb/feltkit/docs. --json lists name, file and public URL.",
100
139
  backup: "feltkit backup create [--env development] [--out <file>]\n" +
101
140
  "feltkit backup verify <file>\n" +
102
141
  "feltkit backup list [--dir .feltkit/backups]\n" +
103
142
  "feltkit backup restore <file> --env <env>\n" +
104
- " One application's state (feltkit.backup/1, docs/BACKUP.md): its contract, migration history, records,\n" +
143
+ " One application's state (feltkit.backup/1; `feltkit docs backup`): its contract, migration history, records,\n" +
105
144
  " AppPort Services records and outbox; never sessions. `create` reads a running development server through\n" +
106
145
  " its admin API (calls pause while it reads), else the stopped environment directly. `restore` writes only\n" +
107
146
  " into a new, empty environment, after verifying the whole backup; an interrupted restore is refused at start.\n" +
@@ -207,7 +246,7 @@ const COMMAND_HELP = {
207
246
  " deployment, .env.local; else .feltkit/<env>/operator-key). With a recorded deployment it prints a link that signs\n" +
208
247
  " in with it; otherwise paste it into Studio. It becomes an operator session holding exactly these declared roles.",
209
248
  op: "feltkit op [list] [--json]\n" +
210
- " FeltKit's development and operations capabilities (application dev.feltkit.platform, docs/AGENT-OPERATIONS.md):\n" +
249
+ " FeltKit's development and operations capabilities (application dev.feltkit.platform; `feltkit docs agent-operations`):\n" +
211
250
  " each with its typed input, effect and the permission it requires.\n" +
212
251
  "feltkit op <capability> --input '<json>' [--project <dir>] [--root <dir>] [--json]\n" +
213
252
  " Invokes one as the workspace owner, through the same AppPort application agents use over /appport and /mcp\n" +
@@ -235,6 +274,30 @@ async function adminRequest(record, token, path, init = {}) {
235
274
  throw new FeltKitError(body?.error?.code ?? "INTERNAL", body?.error?.message ?? `Admin API answered ${response.status}`);
236
275
  return body;
237
276
  }
277
+ /** A running server's backup (POST /backup, NDJSON), passed line by line to `sink`. Returns its header. */
278
+ async function adminBackup(record, token, sink) {
279
+ const response = await fetch(`${record.url}/_feltkit/api/backup`, { method: "POST", headers: { "x-feltkit-admin": token, "Content-Type": "application/json" } });
280
+ if (!response.ok || !response.body) {
281
+ const body = (await response.json().catch(() => null));
282
+ throw new FeltKitError(body?.error?.code ?? "INTERNAL", body?.error?.message ?? `Admin API answered ${response.status}`);
283
+ }
284
+ let header = null;
285
+ const lines = createLineReader({ input: Readable.fromWeb(response.body), crlfDelay: Infinity });
286
+ for await (const text of lines) {
287
+ if (!text)
288
+ continue;
289
+ if (header === null)
290
+ header = JSON.parse(text);
291
+ else if (text.startsWith('{"error":')) {
292
+ const { error } = JSON.parse(text);
293
+ throw new FeltKitError((error?.code ?? "INTERNAL"), `The server stopped the backup: ${error?.message ?? "unknown error"}`);
294
+ }
295
+ await sink(text);
296
+ }
297
+ if (header === null)
298
+ throw new FeltKitError("INTERNAL", "The server's backup was empty.");
299
+ return header;
300
+ }
238
301
  /** Use the running server for an environment if there is one; otherwise open the environment directly. */
239
302
  async function withEnvironment(projectDir, envName, remote, local) {
240
303
  const runtimeDir = join(projectDir, ".feltkit", envName);
@@ -356,7 +419,7 @@ export async function main(argv = process.argv.slice(2), deps = {}) {
356
419
  return 0;
357
420
  }
358
421
  if (flags.help || flags.h) {
359
- line(COMMAND_HELP[command] ?? HELP);
422
+ line(helpFor(command, positional[0]));
360
423
  return 0;
361
424
  }
362
425
  if (command === "--version" || command === "version" || flags.version) {
@@ -411,6 +474,28 @@ export async function main(argv = process.argv.slice(2), deps = {}) {
411
474
  line(c.dim("Publish it to Managed FeltDB with `npx feltdb publish --contract " + (flags.out ?? "feltdb.contract.json") + " --yes`."));
412
475
  return 0;
413
476
  }
477
+ case "docs": {
478
+ const wanted = positional[0]?.toUpperCase().replace(/\.MD$/, "");
479
+ if (!wanted) {
480
+ if (json)
481
+ line(JSON.stringify(SHIPPED_DOCS.map(([name, what]) => ({ name, what, file: docFile(name), url: docUrl(name) })), null, 2));
482
+ else {
483
+ line(`${c.bold("FeltKit documentation")} ${c.dim(SDK_VERSION)}, shipped in this install. \`feltkit docs <name>\` prints one.\n`);
484
+ for (const [name, what] of SHIPPED_DOCS)
485
+ line(` ${name.replace(/\.md$/, "").toLowerCase().padEnd(20)} ${what}`);
486
+ line(`\n${c.dim(`Files: ${dirname(docFile(SHIPPED_DOCS[0][0]))}`)}\n${c.dim(`Public: ${docUrl()} · ${PACKAGE_PAGE}`)}`);
487
+ }
488
+ return 0;
489
+ }
490
+ const doc = SHIPPED_DOCS.find(([name]) => name.replace(/\.md$/, "") === wanted);
491
+ if (!doc)
492
+ throw new FeltKitError("NOT_FOUND", `No document called "${positional[0]}".`, { hint: `Run \`feltkit docs\` for the list: ${SHIPPED_DOCS.map(([n]) => n.replace(/\.md$/, "").toLowerCase()).join(", ")}.` });
493
+ const file = docFile(doc[0]);
494
+ if (!existsSync(file))
495
+ throw new FeltKitError("CONFIGURATION", `${doc[0]} is not in this install (${file}).`, { hint: `Read it at ${docUrl(doc[0])}.` });
496
+ line(readFileSync(file, "utf8").replace(/\n$/, ""));
497
+ return 0;
498
+ }
414
499
  case "codegen": {
415
500
  const changed = codegen(projectDir);
416
501
  line(`${symbols.ok} feltkit/_generated/api.ts ${changed ? "updated" : "already up to date"}`);
@@ -670,30 +755,44 @@ export async function main(argv = process.argv.slice(2), deps = {}) {
670
755
  if (action === "create") {
671
756
  const runtimeDir = join(projectDir, ".feltkit", envName);
672
757
  const record = readRuntimeRecord(runtimeDir);
673
- let lines;
758
+ // Written line by line to a partial file beside its destination, verified from disk, then renamed.
759
+ const explicit = typeof flags.out === "string" ? resolve(flags.out) : null;
760
+ if (explicit && existsSync(explicit))
761
+ throw new FeltKitError("CONFLICT", `${explicit} exists; a backup never overwrites a file.`);
762
+ const partial = explicit ? `${explicit}.partial` : join(projectDir, ".feltkit", "backups", envName, `.backup-${randomUUID()}.partial`);
763
+ mkdirSync(dirname(partial), { recursive: true });
764
+ let header;
674
765
  let source;
675
- if (record) {
676
- if (envName === "production")
677
- throw new FeltKitError("CONFIGURATION", `A production server is running (pid ${record.pid}); its admin API answers verified operators only. Stop it to back up its state directly.`);
678
- const token = readAdminToken(runtimeDir);
679
- if (!token)
680
- throw new FeltKitError("CONFIGURATION", `A ${envName} server is running (pid ${record.pid}) but its admin token is missing.`);
681
- lines = (await adminRequest(record, token, "/backup", { method: "POST" })).lines;
682
- source = `running server (pid ${record.pid}; calls paused while it read)`;
766
+ const file = fileSink(partial);
767
+ try {
768
+ if (record) {
769
+ if (envName === "production")
770
+ throw new FeltKitError("CONFIGURATION", `A production server is running (pid ${record.pid}); its admin API answers verified operators only. Stop it to back up its state directly.`);
771
+ const token = readAdminToken(runtimeDir);
772
+ if (!token)
773
+ throw new FeltKitError("CONFIGURATION", `A ${envName} server is running (pid ${record.pid}) but its admin token is missing.`);
774
+ header = await adminBackup(record, token, file.sink);
775
+ source = `running server (pid ${record.pid}; calls paused while it read)`;
776
+ }
777
+ else {
778
+ const { app, environment } = await environmentFor();
779
+ header = await backupEnvironmentTo(environment, app, file.sink);
780
+ source = "the stopped environment, directly";
781
+ }
782
+ await file.close();
783
+ await verifyBackupFile(partial);
683
784
  }
684
- else {
685
- const { app, environment } = await environmentFor();
686
- lines = await backupEnvironment(environment, app);
687
- source = "the stopped environment, directly";
785
+ catch (error) {
786
+ await file.close().catch(() => undefined);
787
+ rmSync(partial, { force: true });
788
+ throw error;
688
789
  }
689
- const header = JSON.parse(lines[0]);
690
- const out = resolve(typeof flags.out === "string" ? flags.out : join(projectDir, ".feltkit", "backups", envName, `${header.application.name}-${header.createdAt.replace(/[:.]/g, "-")}.ndjson`));
691
- mkdirSync(dirname(out), { recursive: true });
692
- if (existsSync(out))
790
+ const out = explicit ?? join(dirname(partial), `${header.application.name}-${header.createdAt.replace(/[:.]/g, "-")}.ndjson`);
791
+ if (existsSync(out)) {
792
+ rmSync(partial, { force: true });
693
793
  throw new FeltKitError("CONFLICT", `${out} exists; a backup never overwrites a file.`);
694
- writeFileSync(`${out}.partial`, `${lines.join("\n")}\n`);
695
- verifyBackup(readFileSync(`${out}.partial`, "utf8"));
696
- renameSync(`${out}.partial`, out);
794
+ }
795
+ renameSync(partial, out);
697
796
  if (json)
698
797
  line(JSON.stringify({ path: out, source, header }, null, 2));
699
798
  else
@@ -704,25 +803,25 @@ export async function main(argv = process.argv.slice(2), deps = {}) {
704
803
  const file = positional[1];
705
804
  if (!file)
706
805
  throw new FeltKitError("INVALID_ARGUMENT", "Usage: feltkit backup verify <file>");
707
- const { header, records } = verifyBackup(readFileSync(resolve(file), "utf8"));
806
+ const { header, records } = await verifyBackupFile(resolve(file));
708
807
  if (json)
709
- line(JSON.stringify({ ok: true, header, records: records.length }, null, 2));
808
+ line(JSON.stringify({ ok: true, header, records }, null, 2));
710
809
  else
711
- line(`${symbols.ok} ${file}: ${header.application.name} ${header.application.version} (${header.environment}, ${header.createdAt}); ${records.length} records; contract ${header.contract ? `${header.contract.name} v${header.contract.version} ${header.contract.hash.slice(0, 19)}…` : "none"}; FeltKit ${header.feltkit}, FeltDB ${header.feltdb}.`);
810
+ line(`${symbols.ok} ${file}: ${header.application.name} ${header.application.version} (${header.environment}, ${header.createdAt}); ${records} records; contract ${header.contract ? `${header.contract.name} v${header.contract.version} ${header.contract.hash.slice(0, 19)}…` : "none"}; FeltKit ${header.feltkit}, FeltDB ${header.feltdb}.`);
712
811
  return 0;
713
812
  }
714
813
  if (action === "list") {
715
814
  const dir = resolve(typeof flags.dir === "string" ? flags.dir : join(projectDir, ".feltkit", "backups"));
716
815
  const files = existsSync(dir) ? readdirSync(dir, { recursive: true, withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".ndjson")).map((e) => join(e.parentPath ?? e.path ?? dir, e.name)).sort() : [];
717
- const items = files.map((path) => {
816
+ const items = await Promise.all(files.map(async (path) => {
718
817
  try {
719
- const { header, records } = verifyBackup(readFileSync(path, "utf8"));
720
- return { path, ok: true, application: header.application, environment: header.environment, createdAt: header.createdAt, contract: header.contract ? { version: header.contract.version, hash: header.contract.hash } : null, records: records.length };
818
+ const { header, records } = await verifyBackupFile(path);
819
+ return { path, ok: true, application: header.application, environment: header.environment, createdAt: header.createdAt, contract: header.contract ? { version: header.contract.version, hash: header.contract.hash } : null, records };
721
820
  }
722
821
  catch (error) {
723
822
  return { path, ok: false, error: error.message };
724
823
  }
725
- });
824
+ }));
726
825
  if (json)
727
826
  line(JSON.stringify({ dir, items }, null, 2));
728
827
  else if (!items.length)
@@ -739,7 +838,7 @@ export async function main(argv = process.argv.slice(2), deps = {}) {
739
838
  if (readRuntimeRecord(join(projectDir, ".feltkit", envName)))
740
839
  throw new FeltKitError("CONFLICT", `A ${envName} server is running; a restore writes only into a new, empty environment. Nothing was written.`);
741
840
  const { app, environment } = await environmentFor();
742
- const { header, records } = await restoreEnvironment(readFileSync(resolve(file), "utf8"), environment, app);
841
+ const { header, records } = await restoreEnvironmentFile(resolve(file), environment, app);
743
842
  if (json)
744
843
  line(JSON.stringify({ restored: true, environment: envName, header, records }, null, 2));
745
844
  else