@feltdb/feltkit 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +22 -2
- package/bin/feltkit.js +3 -0
- package/dist/app.d.ts +247 -0
- package/dist/app.js +181 -0
- package/dist/app.js.map +1 -0
- package/dist/cli/deploy.d.ts +8 -0
- package/dist/cli/deploy.js +125 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/main.d.ts +9 -0
- package/dist/cli/main.js +581 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/output.d.ts +18 -0
- package/dist/cli/output.js +87 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/skills.d.ts +39 -0
- package/dist/cli/skills.js +125 -0
- package/dist/cli/skills.js.map +1 -0
- package/dist/client/index.d.ts +125 -0
- package/dist/client/index.js +306 -0
- package/dist/client/index.js.map +1 -0
- package/dist/dashboard/assets/index--1Tqbv_A.css +1 -0
- package/dist/dashboard/assets/index-Bm4qCYpv.js +15 -0
- package/dist/dashboard/index.html +16 -0
- package/dist/errors.d.ts +33 -0
- package/dist/errors.js +56 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +40 -0
- package/dist/react/index.js +85 -0
- package/dist/react/index.js.map +1 -0
- package/dist/runtime/activity.d.ts +110 -0
- package/dist/runtime/activity.js +113 -0
- package/dist/runtime/activity.js.map +1 -0
- package/dist/runtime/agent.d.ts +353 -0
- package/dist/runtime/agent.js +1345 -0
- package/dist/runtime/agent.js.map +1 -0
- package/dist/runtime/authority.d.ts +98 -0
- package/dist/runtime/authority.js +240 -0
- package/dist/runtime/authority.js.map +1 -0
- package/dist/runtime/changes.d.ts +42 -0
- package/dist/runtime/changes.js +85 -0
- package/dist/runtime/changes.js.map +1 -0
- package/dist/runtime/content.d.ts +33 -0
- package/dist/runtime/content.js +46 -0
- package/dist/runtime/content.js.map +1 -0
- package/dist/runtime/context.d.ts +76 -0
- package/dist/runtime/context.js +2 -0
- package/dist/runtime/context.js.map +1 -0
- package/dist/runtime/credentials.d.ts +42 -0
- package/dist/runtime/credentials.js +32 -0
- package/dist/runtime/credentials.js.map +1 -0
- package/dist/runtime/data.d.ts +145 -0
- package/dist/runtime/data.js +439 -0
- package/dist/runtime/data.js.map +1 -0
- package/dist/runtime/decisions.d.ts +131 -0
- package/dist/runtime/decisions.js +301 -0
- package/dist/runtime/decisions.js.map +1 -0
- package/dist/runtime/environment.d.ts +36 -0
- package/dist/runtime/environment.js +73 -0
- package/dist/runtime/environment.js.map +1 -0
- package/dist/runtime/idempotency.d.ts +37 -0
- package/dist/runtime/idempotency.js +88 -0
- package/dist/runtime/idempotency.js.map +1 -0
- package/dist/runtime/instance.d.ts +82 -0
- package/dist/runtime/instance.js +253 -0
- package/dist/runtime/instance.js.map +1 -0
- package/dist/runtime/integrations.d.ts +120 -0
- package/dist/runtime/integrations.js +412 -0
- package/dist/runtime/integrations.js.map +1 -0
- package/dist/runtime/loader.d.ts +15 -0
- package/dist/runtime/loader.js +121 -0
- package/dist/runtime/loader.js.map +1 -0
- package/dist/runtime/projects.d.ts +52 -0
- package/dist/runtime/projects.js +141 -0
- package/dist/runtime/projects.js.map +1 -0
- package/dist/runtime/readiness.d.ts +29 -0
- package/dist/runtime/readiness.js +154 -0
- package/dist/runtime/readiness.js.map +1 -0
- package/dist/runtime/runtime.d.ts +227 -0
- package/dist/runtime/runtime.js +664 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/runtime/services.d.ts +327 -0
- package/dist/runtime/services.js +686 -0
- package/dist/runtime/services.js.map +1 -0
- package/dist/runtime/sessions.d.ts +44 -0
- package/dist/runtime/sessions.js +109 -0
- package/dist/runtime/sessions.js.map +1 -0
- package/dist/schema.d.ts +56 -0
- package/dist/schema.js +44 -0
- package/dist/schema.js.map +1 -0
- package/dist/server/admin.d.ts +141 -0
- package/dist/server/admin.js +828 -0
- package/dist/server/admin.js.map +1 -0
- package/dist/server/http.d.ts +19 -0
- package/dist/server/http.js +99 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/index.d.ts +54 -0
- package/dist/server/index.js +305 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/management.d.ts +12 -0
- package/dist/server/management.js +177 -0
- package/dist/server/management.js.map +1 -0
- package/dist/server/mcp.d.ts +214 -0
- package/dist/server/mcp.js +135 -0
- package/dist/server/mcp.js.map +1 -0
- package/dist/server/operators.d.ts +77 -0
- package/dist/server/operators.js +162 -0
- package/dist/server/operators.js.map +1 -0
- package/dist/server/project.d.ts +60 -0
- package/dist/server/project.js +344 -0
- package/dist/server/project.js.map +1 -0
- package/dist/server/public.d.ts +14 -0
- package/dist/server/public.js +15 -0
- package/dist/server/public.js.map +1 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +65 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +91 -4
- package/skills/.claude-plugin/marketplace.json +16 -0
- package/skills/.claude-plugin/plugin.json +24 -0
- package/skills/README.md +44 -0
- package/skills/feltkit-agent/SKILL.md +84 -0
- package/skills/feltkit-build/SKILL.md +143 -0
- package/skills/feltkit-data/SKILL.md +79 -0
- package/skills/feltkit-operations/SKILL.md +72 -0
- package/skills/feltkit-services/SKILL.md +102 -0
package/dist/cli/main.js
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `feltkit` command.
|
|
3
|
+
*/
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
import { FeltKitError, isFeltKitError } from "../errors.js";
|
|
8
|
+
import { resolveEnvironment } from "../runtime/environment.js";
|
|
9
|
+
import { loadSources } from "../runtime/loader.js";
|
|
10
|
+
import { readAdminToken, readRuntimeRecord } from "../runtime/projects.js";
|
|
11
|
+
import { loadBundle } from "../runtime/loader.js";
|
|
12
|
+
import { createGrant, operatorKey } from "../server/operators.js";
|
|
13
|
+
import { assessReadiness } from "../runtime/readiness.js";
|
|
14
|
+
import { EnvironmentCredentials } from "../runtime/credentials.js";
|
|
15
|
+
import { selectModel } from "../server/admin.js";
|
|
16
|
+
import { FeltKitRuntime, silentLogger } from "../runtime/runtime.js";
|
|
17
|
+
import { overviewPayload } from "../server/admin.js";
|
|
18
|
+
import { SDK_VERSION, build, codegen, doctor, startDev, startProduction } from "../server/project.js";
|
|
19
|
+
import { scaffold, ScaffoldError } from "create-feltkit";
|
|
20
|
+
import { deploy } from "./deploy.js";
|
|
21
|
+
import { checkSkills, installSkills, shippedSkills, skillsTarget } from "./skills.js";
|
|
22
|
+
import { c, line, printInspect, symbols } from "./output.js";
|
|
23
|
+
export function parseArgs(argv) {
|
|
24
|
+
const positional = [];
|
|
25
|
+
const flags = {};
|
|
26
|
+
for (let i = 0; i < argv.length; i++) {
|
|
27
|
+
const arg = argv[i];
|
|
28
|
+
if (arg === "--") {
|
|
29
|
+
positional.push(...argv.slice(i + 1));
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
if (arg.startsWith("--")) {
|
|
33
|
+
const [key, inline] = arg.slice(2).split("=", 2);
|
|
34
|
+
if (key.startsWith("no-"))
|
|
35
|
+
flags[key.slice(3)] = false;
|
|
36
|
+
else if (inline !== undefined)
|
|
37
|
+
flags[key] = inline;
|
|
38
|
+
else if (argv[i + 1] && !argv[i + 1].startsWith("-"))
|
|
39
|
+
flags[key] = argv[++i];
|
|
40
|
+
else
|
|
41
|
+
flags[key] = true;
|
|
42
|
+
}
|
|
43
|
+
else if (arg.startsWith("-") && arg.length > 1) {
|
|
44
|
+
flags[arg.slice(1)] = true;
|
|
45
|
+
}
|
|
46
|
+
else
|
|
47
|
+
positional.push(arg);
|
|
48
|
+
}
|
|
49
|
+
return { command: positional.shift(), positional, flags };
|
|
50
|
+
}
|
|
51
|
+
const HELP = `${c.bold("feltkit")} ${c.dim(SDK_VERSION)} — one application, one FeltDB instance.
|
|
52
|
+
|
|
53
|
+
${c.bold("Usage")} feltkit <command> [options]
|
|
54
|
+
|
|
55
|
+
${c.bold("Commands")}
|
|
56
|
+
create <dir> Create a new application (the task-manager starter)
|
|
57
|
+
dev Run the development environment: backend, frontend, dashboard, hot reload
|
|
58
|
+
build Bundle the backend, build the frontend, and verify the result
|
|
59
|
+
start Run the production build (environment: production)
|
|
60
|
+
test Run the project's tests against an isolated test environment
|
|
61
|
+
inspect Show what the application is, where its state lives, and what it's doing
|
|
62
|
+
deploy Build a verified, self-contained deployment artifact
|
|
63
|
+
session <action> Create, list, or revoke sessions (agents, service accounts)
|
|
64
|
+
operator grant Sign a one-time production Studio sign-in for an operator
|
|
65
|
+
readiness Check what this environment has and lacks before production
|
|
66
|
+
model <action> Show or select the model that makes agent decisions
|
|
67
|
+
config <action> Export or import non-secret configuration between environments
|
|
68
|
+
codegen Regenerate feltkit/_generated/api.ts
|
|
69
|
+
doctor Check the project and installation for problems
|
|
70
|
+
skills <action> Install, update, or check the FeltKit skills for coding agents
|
|
71
|
+
|
|
72
|
+
${c.bold("Options")}
|
|
73
|
+
--port <n> Port for dev/start (default 3000)
|
|
74
|
+
--host <h> Interface for dev/start (dev default 127.0.0.1)
|
|
75
|
+
--json Machine-readable output (inspect, session, doctor)
|
|
76
|
+
--help Show help for a command
|
|
77
|
+
|
|
78
|
+
Docs: https://github.com/rkendel1/concave#readme`;
|
|
79
|
+
const COMMAND_HELP = {
|
|
80
|
+
create: "feltkit create <dir> [--name <app-name>]\n Copies the starter into <dir>. Refuses to write into a non-empty directory.",
|
|
81
|
+
dev: "feltkit dev [--port 3000] [--host 127.0.0.1] [--no-frontend]\n Development environment: state in .feltkit/development/state.",
|
|
82
|
+
build: "feltkit build\n Writes .feltkit/build/functions.mjs and dist/client, then loads the bundle to verify it.",
|
|
83
|
+
start: "feltkit start [--port $PORT] [--host 0.0.0.0] [--env production]\n Uses FELTDB_URL + FELTDB_TOKEN when set, else FELTKIT_STATE_DIR or .feltkit/production/state.",
|
|
84
|
+
test: "feltkit test [files…]\n Runs node --test on tests/**/*.test.ts with FELTKIT_ENV=test.",
|
|
85
|
+
inspect: "feltkit inspect [--json] [--env development]\n Reads from the running server when there is one; otherwise opens the environment directly.",
|
|
86
|
+
deploy: "feltkit deploy [--out <dir>]\n Builds, verifies the build boots, and writes a deployable directory with a Dockerfile.",
|
|
87
|
+
skills: "feltkit skills install [--user] [--dir <path>] [--force]\n" +
|
|
88
|
+
" Copies the FeltKit skills into .claude/skills/ (or ~/.claude/skills/ with --user). Run again to update.\n" +
|
|
89
|
+
"feltkit skills check [--user] [--dir <path>] [--json]\n" +
|
|
90
|
+
" Validates the installed skills: present, well-formed, this SDK's version, unmodified.\n" +
|
|
91
|
+
"feltkit skills list\n" +
|
|
92
|
+
" The skills this package ships.",
|
|
93
|
+
readiness: "feltkit readiness [--env development|production] [--json]\n" +
|
|
94
|
+
" Real checks of the environment: storage, credentials, identity, roles, model, integrations, open uncertain\n" +
|
|
95
|
+
" outcomes, background work, the build; plus the operational requirements FeltKit does not provide.\n" +
|
|
96
|
+
" Exit code 1 when any check fails.",
|
|
97
|
+
model: "feltkit model show [--env development] [--json]\n" +
|
|
98
|
+
"feltkit model set --provider <id> --model <model> [--endpoint <url>] [--credential credential-ref:<id>] [--env production]\n" +
|
|
99
|
+
" Selects the environment's provider in AppPort Services Intelligence. Providers: openai, anthropic, opencode,\n" +
|
|
100
|
+
" ollama, custom (any OpenAI-compatible endpoint). The credential is a reference; its value goes in\n" +
|
|
101
|
+
" FELTKIT_CREDENTIAL_<ID> in that environment. Run it on the host, with the server stopped, for production.",
|
|
102
|
+
config: "feltkit config export [--env development] [--out <file>]\n" +
|
|
103
|
+
" Writes the environment's non-secret configuration as AppPort Services' versioned document\n" +
|
|
104
|
+
" (appport.configuration-export): variables, credential binding names and references, active webhook\n" +
|
|
105
|
+
" endpoints, enabled schedules. Secret values are never in it.\n" +
|
|
106
|
+
"feltkit config import <file> [--env production] [--dry-run] [--overwrite] [--json]\n" +
|
|
107
|
+
" Plans (--dry-run) or applies the document through AppPort Services' import. Credential bindings are never\n" +
|
|
108
|
+
" created: attach each listed one in the target and set its FELTKIT_CREDENTIAL_<ID>. Schedules are not imported\n" +
|
|
109
|
+
" (they run as their creator). Run it on the host, with the server stopped, for production. Exit code 1 on\n" +
|
|
110
|
+
" conflicts or failures.",
|
|
111
|
+
operator: "feltkit operator grant --id <id> --role <role>[,<role>] [--name <display name>] [--ttl <minutes>] [--env production] [--json]\n" +
|
|
112
|
+
" Signs a one-time grant with this environment's operator key (FELTKIT_OPERATOR_KEY, else .feltkit/<env>/operator-key).\n" +
|
|
113
|
+
" Paste it into Studio's sign-in; it becomes an operator session holding exactly these declared roles. Run it on the host.",
|
|
114
|
+
session: "feltkit session create --id <id> --role <role> [--type agent|user|service] [--label <text>] [--ttl <hours>] [--env development]\n" +
|
|
115
|
+
"feltkit session list [--env development]\n" +
|
|
116
|
+
"feltkit session revoke <ref> [--env development]",
|
|
117
|
+
};
|
|
118
|
+
async function adminRequest(record, token, path, init = {}) {
|
|
119
|
+
const response = await fetch(`${record.url}/_feltkit/api${path}`, { ...init, headers: { "x-feltkit-admin": token, "Content-Type": "application/json", ...(init.headers ?? {}) } });
|
|
120
|
+
const body = (await response.json());
|
|
121
|
+
if (!response.ok)
|
|
122
|
+
throw new FeltKitError(body?.error?.code ?? "INTERNAL", body?.error?.message ?? `Admin API answered ${response.status}`);
|
|
123
|
+
return body;
|
|
124
|
+
}
|
|
125
|
+
/** Use the running server for an environment if there is one; otherwise open the environment directly. */
|
|
126
|
+
async function withEnvironment(projectDir, envName, remote, local) {
|
|
127
|
+
const runtimeDir = join(projectDir, ".feltkit", envName);
|
|
128
|
+
const record = readRuntimeRecord(runtimeDir);
|
|
129
|
+
if (record) {
|
|
130
|
+
if (envName === "production") {
|
|
131
|
+
throw new FeltKitError("CONFIGURATION", `A production server is running (pid ${record.pid}). Its admin API answers verified operators only, not the admin token.`, {
|
|
132
|
+
hint: "Sign in to Studio with `feltkit operator grant --id <you> --role <role>`, or stop the server to inspect its state directly.",
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const token = readAdminToken(runtimeDir);
|
|
136
|
+
if (!token)
|
|
137
|
+
throw new FeltKitError("CONFIGURATION", `A ${envName} server is running (pid ${record.pid}) but its admin token is missing.`);
|
|
138
|
+
return { value: await remote(record, token), source: `running server (pid ${record.pid}, ${record.url})` };
|
|
139
|
+
}
|
|
140
|
+
const project = await loadSources(projectDir);
|
|
141
|
+
const environment = resolveEnvironment({ projectDir, appName: project.app.name, name: envName });
|
|
142
|
+
const runtime = await FeltKitRuntime.start({ project, environment, logger: silentLogger });
|
|
143
|
+
try {
|
|
144
|
+
return { value: await local(runtime), source: "opened directly (no server running)" };
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
await runtime.close();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function waitForShutdown(close) {
|
|
151
|
+
return new Promise((done) => {
|
|
152
|
+
let closing = false;
|
|
153
|
+
const stop = async (signal) => {
|
|
154
|
+
if (closing)
|
|
155
|
+
return;
|
|
156
|
+
closing = true;
|
|
157
|
+
line(`\n${c.dim(`${signal} received — shutting down…`)}`);
|
|
158
|
+
const timer = setTimeout(() => {
|
|
159
|
+
line(c.red("Shutdown took longer than 10s; exiting."));
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}, 10_000);
|
|
162
|
+
timer.unref();
|
|
163
|
+
try {
|
|
164
|
+
await close();
|
|
165
|
+
line(`${symbols.ok} Stopped cleanly. State is in place for next time.`);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
line(`${symbols.fail} Shutdown error: ${error.message}`);
|
|
169
|
+
process.exitCode = 1;
|
|
170
|
+
}
|
|
171
|
+
done();
|
|
172
|
+
};
|
|
173
|
+
process.once("SIGINT", () => void stop("SIGINT"));
|
|
174
|
+
process.once("SIGTERM", () => void stop("SIGTERM"));
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
178
|
+
const { command, positional, flags } = parseArgs(argv);
|
|
179
|
+
const projectDir = resolve(String(flags.cwd ?? process.cwd()));
|
|
180
|
+
if (!command || command === "help" || (flags.help && !command)) {
|
|
181
|
+
line(HELP);
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
if (flags.help || flags.h) {
|
|
185
|
+
line(COMMAND_HELP[command] ?? HELP);
|
|
186
|
+
return 0;
|
|
187
|
+
}
|
|
188
|
+
if (command === "--version" || command === "version" || flags.version) {
|
|
189
|
+
line(SDK_VERSION);
|
|
190
|
+
return 0;
|
|
191
|
+
}
|
|
192
|
+
const json = flags.json === true;
|
|
193
|
+
const envName = String(flags.env ?? (command === "start" ? "production" : "development"));
|
|
194
|
+
switch (command) {
|
|
195
|
+
case "create": {
|
|
196
|
+
const dir = positional[0];
|
|
197
|
+
if (!dir)
|
|
198
|
+
throw new FeltKitError("INVALID_ARGUMENT", "Tell me where to create the app: feltkit create my-app");
|
|
199
|
+
let result;
|
|
200
|
+
try {
|
|
201
|
+
result = scaffold({ target: resolve(process.cwd(), dir), ...(flags.name ? { name: String(flags.name) } : {}) });
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
if (error instanceof ScaffoldError)
|
|
205
|
+
throw new FeltKitError("CONFIGURATION", error.message, error.hint ? { hint: error.hint } : {});
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
line(`${symbols.ok} Created ${c.bold(result.name)} in ${result.dir}\n`);
|
|
209
|
+
line(` cd ${dir}\n npm install\n npm run dev\n`);
|
|
210
|
+
line(c.dim("The dev server prints your app URL and a dashboard link. State lives in .feltkit/development/state."));
|
|
211
|
+
line(c.dim("Using a coding agent? `npx feltkit skills install` (after npm install) adds the FeltKit skills for Claude Code."));
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
case "codegen": {
|
|
215
|
+
const changed = codegen(projectDir);
|
|
216
|
+
line(`${symbols.ok} feltkit/_generated/api.ts ${changed ? "updated" : "already up to date"}`);
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
case "doctor": {
|
|
220
|
+
const checks = doctor(projectDir);
|
|
221
|
+
if (json)
|
|
222
|
+
line(JSON.stringify(checks, null, 2));
|
|
223
|
+
else
|
|
224
|
+
for (const check of checks)
|
|
225
|
+
line(`${check.ok ? symbols.ok : symbols.fail} ${check.name.padEnd(24)} ${check.detail}${!check.ok && check.fix ? `\n ${c.yellow("fix:")} ${check.fix}` : ""}`);
|
|
226
|
+
return checks.every((check) => check.ok) ? 0 : 1;
|
|
227
|
+
}
|
|
228
|
+
case "dev": {
|
|
229
|
+
const failing = doctor(projectDir).filter((check) => !check.ok);
|
|
230
|
+
if (failing.length) {
|
|
231
|
+
for (const check of failing)
|
|
232
|
+
line(`${symbols.fail} ${check.name}: ${check.detail}${check.fix ? `\n ${c.yellow("fix:")} ${check.fix}` : ""}`);
|
|
233
|
+
return 1;
|
|
234
|
+
}
|
|
235
|
+
line(`${c.bold("feltkit dev")} ${c.dim(SDK_VERSION)} ${c.dim("environment:")} ${c.cyan("development")}`);
|
|
236
|
+
const started = Date.now();
|
|
237
|
+
const dev = await startDev({
|
|
238
|
+
projectDir,
|
|
239
|
+
...(flags.port ? { port: Number(flags.port) } : {}),
|
|
240
|
+
...(flags.host ? { host: String(flags.host) } : {}),
|
|
241
|
+
...(flags.frontend === false ? { noFrontend: true } : {}),
|
|
242
|
+
onReload: ({ ok, error }) => {
|
|
243
|
+
if (ok)
|
|
244
|
+
line(`${symbols.ok} ${c.dim(new Date().toLocaleTimeString())} Reloaded functions ${c.dim("(state and sessions kept)")}`);
|
|
245
|
+
else
|
|
246
|
+
line(`${symbols.fail} ${c.dim(new Date().toLocaleTimeString())} Reload failed; still serving the previous version.\n ${error?.message}`);
|
|
247
|
+
},
|
|
248
|
+
logger: {
|
|
249
|
+
info: (m) => line(c.dim(m)),
|
|
250
|
+
warn: (m) => line(`${c.yellow("warn")} ${m}`),
|
|
251
|
+
error: (m) => line(`${c.red("error")} ${m}`),
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
const overview = dev.runtime.overview();
|
|
255
|
+
line("");
|
|
256
|
+
line(` ${c.bold("App")} ${c.cyan(dev.server.url)}`);
|
|
257
|
+
if (dev.server.dashboardUrl)
|
|
258
|
+
line(` ${c.bold("Dashboard")} ${c.cyan(dev.server.dashboardUrl)}`);
|
|
259
|
+
line(` ${c.bold("AppPort")} ${dev.server.url}/appport ${c.dim(`(${overview.functions.filter((f) => f.capability).length + [...dev.runtime.app.integrations.values()].reduce((n, i) => n + Object.keys(i.operations).length, 0)} capabilities)`)}`);
|
|
260
|
+
line(` ${c.bold("MCP")} ${dev.server.url}/mcp ${c.dim("(agents; needs a session from `feltkit session create --type agent`)")}`);
|
|
261
|
+
line(` ${c.bold("State")} ${overview.instance.location} ${c.dim(`(FeltDB ${overview.instance.feltdbVersion}, ${overview.instance.mode})`)}`);
|
|
262
|
+
line(` ${c.bold("Functions")} ${overview.functions.length} from feltkit/${overview.collections.length ? ` ${c.dim("collections:")} ${overview.collections.map((x) => x.name).join(", ")}` : ""}`);
|
|
263
|
+
line(c.dim(`\n Ready in ${Date.now() - started}ms. Edit feltkit/*.ts to reload. Ctrl+C to stop.\n`));
|
|
264
|
+
await waitForShutdown(() => dev.close());
|
|
265
|
+
return 0;
|
|
266
|
+
}
|
|
267
|
+
case "build": {
|
|
268
|
+
line(`${c.bold("feltkit build")} ${c.dim(SDK_VERSION)}`);
|
|
269
|
+
const result = await build(projectDir);
|
|
270
|
+
line(`${symbols.ok} Backend ${result.bundle.replace(projectDir + "/", "")} ${c.dim(`(${result.functions} functions, ${result.capabilities} capabilities, verified by loading the bundle)`)}`);
|
|
271
|
+
line(result.client ? `${symbols.ok} Frontend ${result.client.replace(projectDir + "/", "")} ${c.dim("(scanned: no server-only values)")}` : `${symbols.info} No frontend (no index.html)`);
|
|
272
|
+
line(c.dim("\nRun it with `feltkit start`, or package it with `feltkit deploy`."));
|
|
273
|
+
return 0;
|
|
274
|
+
}
|
|
275
|
+
case "start": {
|
|
276
|
+
const server = await startProduction({
|
|
277
|
+
projectDir,
|
|
278
|
+
environment: envName,
|
|
279
|
+
...(flags.port ? { port: Number(flags.port) } : {}),
|
|
280
|
+
...(flags.host ? { host: String(flags.host) } : {}),
|
|
281
|
+
});
|
|
282
|
+
const identity = server.runtime.instance.identity;
|
|
283
|
+
line(`${symbols.ok} ${c.bold(server.runtime.app.name)} serving ${c.cyan(server.server.url)} ${c.dim(`environment: ${server.environment.name}`)}`);
|
|
284
|
+
line(` ${c.bold("State")} ${identity.mode} ${identity.location}`);
|
|
285
|
+
line(server.server.dashboardUrl ? ` ${c.yellow("Dashboard enabled in production (FELTKIT_DASHBOARD=1); data edits remain disabled.")}` : c.dim(" Dashboard not served in production."));
|
|
286
|
+
await waitForShutdown(() => server.close());
|
|
287
|
+
return 0;
|
|
288
|
+
}
|
|
289
|
+
case "test": {
|
|
290
|
+
codegen(projectDir);
|
|
291
|
+
const files = positional.length ? positional : findTests(projectDir);
|
|
292
|
+
if (files.length === 0) {
|
|
293
|
+
line(`${symbols.info} No tests found (looked for tests/**/*.test.ts and feltkit/**/*.test.ts).`);
|
|
294
|
+
return 0;
|
|
295
|
+
}
|
|
296
|
+
const tsx = import.meta.resolve("tsx");
|
|
297
|
+
const code = await new Promise((done) => {
|
|
298
|
+
const child = spawn(process.execPath, ["--import", tsx, "--test", "--test-concurrency=1", ...files], {
|
|
299
|
+
cwd: projectDir,
|
|
300
|
+
stdio: "inherit",
|
|
301
|
+
// NODE_TEST_CONTEXT would switch the child runner to a parent's machine protocol (when feltkit test is itself run under node --test).
|
|
302
|
+
env: { ...Object.fromEntries(Object.entries(process.env).filter(([k]) => k !== "NODE_TEST_CONTEXT")), FELTKIT_ENV: "test", FELTKIT_NO_REGISTRY: "1" },
|
|
303
|
+
});
|
|
304
|
+
child.on("exit", (status) => done(status ?? 1));
|
|
305
|
+
});
|
|
306
|
+
return code;
|
|
307
|
+
}
|
|
308
|
+
case "inspect": {
|
|
309
|
+
const { value, source } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/overview"), async (runtime) => overviewPayload(runtime));
|
|
310
|
+
if (json)
|
|
311
|
+
line(JSON.stringify({ source, ...value }, null, 2));
|
|
312
|
+
else
|
|
313
|
+
printInspect(value, source);
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
case "deploy": {
|
|
317
|
+
const result = await deploy({ projectDir, ...(flags.out ? { out: String(flags.out) } : {}) });
|
|
318
|
+
line(`${symbols.ok} Built and verified: the production build booted against a temporary state directory and answered health and capability checks.`);
|
|
319
|
+
line(`${symbols.ok} Artifact: ${c.bold(result.dir)}`);
|
|
320
|
+
line(`\n${c.bold("Next")} — FeltKit does not host applications. Run the artifact on any Node 20+ host or container:`);
|
|
321
|
+
line(` cd ${result.dir} && npm ci --omit=dev && PORT=3000 npm start`);
|
|
322
|
+
line(` ${c.dim("or")} docker build -t ${result.application} ${result.dir}`);
|
|
323
|
+
line(c.dim(`\nProduction state: set FELTDB_URL and FELTDB_TOKEN for a FeltDB server, or FELTKIT_STATE_DIR for a local volume. See ${join(result.dir, "DEPLOY.md")}.`));
|
|
324
|
+
return 0;
|
|
325
|
+
}
|
|
326
|
+
case "session": {
|
|
327
|
+
const action = positional[0];
|
|
328
|
+
if (action === "create") {
|
|
329
|
+
if (!flags.id || !flags.role)
|
|
330
|
+
throw new FeltKitError("INVALID_ARGUMENT", "Usage: feltkit session create --id <id> --role <role> [--type agent]");
|
|
331
|
+
const principal = { id: String(flags.id), type: String(flags.type ?? "agent"), roles: String(flags.role).split(","), ...(flags.name ? { displayName: String(flags.name) } : {}) };
|
|
332
|
+
const ttlMs = flags.ttl ? Number(flags.ttl) * 3_600_000 : undefined;
|
|
333
|
+
const { value, source } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/sessions", { method: "POST", body: JSON.stringify({ principal, kind: "cli", label: flags.label ?? "created with feltkit session", ...(ttlMs ? { ttlMs } : {}) }) }), (runtime) => runtime.issueSession(principal, { kind: "cli", label: String(flags.label ?? "created with feltkit session"), ...(ttlMs ? { ttlMs } : {}), via: "cli" }));
|
|
334
|
+
if (json)
|
|
335
|
+
line(JSON.stringify(value, null, 2));
|
|
336
|
+
else {
|
|
337
|
+
line(`${symbols.ok} Session for ${c.bold(principal.id)} (${principal.type}, roles: ${principal.roles.join(", ")}) in ${envName} ${c.dim(`— ${source}`)}`);
|
|
338
|
+
line(`\n ${value.token}\n`);
|
|
339
|
+
line(c.dim("Shown once. Use it as `Authorization: Bearer <token>` against /appport, /mcp, or /api. Revoke with `feltkit session revoke`."));
|
|
340
|
+
}
|
|
341
|
+
return 0;
|
|
342
|
+
}
|
|
343
|
+
if (action === "list") {
|
|
344
|
+
const { value } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/sessions").then((b) => b.sessions), (runtime) => runtime.sessions.list());
|
|
345
|
+
if (json)
|
|
346
|
+
line(JSON.stringify(value, null, 2));
|
|
347
|
+
else if (!value.length)
|
|
348
|
+
line(`${symbols.info} No active sessions in ${envName}.`);
|
|
349
|
+
else
|
|
350
|
+
for (const s of value)
|
|
351
|
+
line(` ${c.dim(s.ref)} ${String(s.principal?.id ?? "?").padEnd(16)} ${String(s.principal?.type ?? "").padEnd(8)} ${(s.principal?.roles ?? []).join(",").padEnd(16)} ${c.dim(s.kind)} ${c.dim(s.expiresAt ? `expires ${s.expiresAt}` : "no expiry")}`);
|
|
352
|
+
return 0;
|
|
353
|
+
}
|
|
354
|
+
if (action === "revoke") {
|
|
355
|
+
const ref = positional[1];
|
|
356
|
+
if (!ref)
|
|
357
|
+
throw new FeltKitError("INVALID_ARGUMENT", "Usage: feltkit session revoke <ref> (see `feltkit session list`)");
|
|
358
|
+
const { value } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, `/sessions/${ref}`, { method: "DELETE" }).then((b) => b.revoked), (runtime) => runtime.sessions.revoke(ref));
|
|
359
|
+
line(value ? `${symbols.ok} Revoked ${ref}` : `${symbols.fail} No single session matches ${ref}`);
|
|
360
|
+
return value ? 0 : 1;
|
|
361
|
+
}
|
|
362
|
+
line(COMMAND_HELP.session);
|
|
363
|
+
return 1;
|
|
364
|
+
}
|
|
365
|
+
case "readiness": {
|
|
366
|
+
const { value, source } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/readiness"), (runtime) => assessReadiness(runtime, { projectDir, dashboard: process.env.FELTKIT_DASHBOARD === "1" }));
|
|
367
|
+
if (json)
|
|
368
|
+
line(JSON.stringify(value, null, 2));
|
|
369
|
+
else {
|
|
370
|
+
const mark = { pass: symbols.ok, fail: symbols.fail, warn: c.yellow("!"), external: c.dim("○") };
|
|
371
|
+
line(`${c.bold(`Readiness: ${value.application} (${value.environment.name})`)} ${c.dim(`— ${source}`)}\n`);
|
|
372
|
+
for (const area of [...new Set(value.checks.map((x) => x.area))]) {
|
|
373
|
+
line(c.bold(area));
|
|
374
|
+
for (const check of value.checks.filter((x) => x.area === area)) {
|
|
375
|
+
line(` ${mark[check.status]} ${check.title}: ${check.detail}`);
|
|
376
|
+
if (check.fix && check.status !== "pass")
|
|
377
|
+
line(c.dim(` → ${check.fix}`));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
line(`\n${value.summary}`);
|
|
381
|
+
}
|
|
382
|
+
return value.counts.fail > 0 ? 1 : 0;
|
|
383
|
+
}
|
|
384
|
+
case "model": {
|
|
385
|
+
const action = positional[0];
|
|
386
|
+
if (action === "set") {
|
|
387
|
+
if (!flags.provider || !flags.model) {
|
|
388
|
+
line(COMMAND_HELP.model);
|
|
389
|
+
return 1;
|
|
390
|
+
}
|
|
391
|
+
const body = { provider: String(flags.provider), model: String(flags.model), ...(flags.endpoint ? { endpoint: String(flags.endpoint) } : {}), ...(flags.credential ? { credentialRef: String(flags.credential) } : {}) };
|
|
392
|
+
const { value, source } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/models", { method: "POST", body: JSON.stringify(body) }).then((b) => b.status), async (runtime) => (await selectModel(runtime, body), runtime.models.status()));
|
|
393
|
+
if (json)
|
|
394
|
+
line(JSON.stringify(value, null, 2));
|
|
395
|
+
else {
|
|
396
|
+
line(`${symbols.ok} ${envName}: ${value.provider} / ${value.model}${value.endpoint ? ` at ${value.endpoint}` : ""} ${c.dim(`— ${source}`)}`);
|
|
397
|
+
for (const p of value.problems)
|
|
398
|
+
line(` ${symbols.fail} ${p.message}\n ${c.dim(`→ ${p.fix}`)}`);
|
|
399
|
+
}
|
|
400
|
+
return 0;
|
|
401
|
+
}
|
|
402
|
+
if (action === "show" || action === undefined) {
|
|
403
|
+
const { value } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/models").then((b) => b.status), (runtime) => runtime.models.status());
|
|
404
|
+
if (json)
|
|
405
|
+
line(JSON.stringify(value, null, 2));
|
|
406
|
+
else {
|
|
407
|
+
line(value.ready ? `${symbols.ok} ${envName}: ${value.provider}${value.model ? ` / ${value.model}` : ""} (${value.source})` : `${symbols.fail} ${envName}: no usable model`);
|
|
408
|
+
for (const p of value.problems)
|
|
409
|
+
line(` ${p.message}\n ${c.dim(`→ ${p.fix}`)}`);
|
|
410
|
+
}
|
|
411
|
+
return value.ready ? 0 : 1;
|
|
412
|
+
}
|
|
413
|
+
line(COMMAND_HELP.model);
|
|
414
|
+
return 1;
|
|
415
|
+
}
|
|
416
|
+
case "config": {
|
|
417
|
+
const action = positional[0];
|
|
418
|
+
if (action === "export") {
|
|
419
|
+
const { value, source } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/configuration/export"), (runtime) => runtime.services.exportConfiguration());
|
|
420
|
+
const text = `${JSON.stringify(value, null, 2)}\n`;
|
|
421
|
+
if (typeof flags.out === "string") {
|
|
422
|
+
writeFileSync(resolve(projectDir, flags.out), text);
|
|
423
|
+
line(`${symbols.ok} ${envName}: ${value.variables.length} variable(s), ${value.secrets.length} credential reference(s), ${value.webhookEndpoints.length} endpoint(s), ${value.schedules.length} schedule(s) → ${c.bold(flags.out)} ${c.dim(`— ${source}`)}`);
|
|
424
|
+
}
|
|
425
|
+
else
|
|
426
|
+
process.stdout.write(text);
|
|
427
|
+
return 0;
|
|
428
|
+
}
|
|
429
|
+
if (action === "import") {
|
|
430
|
+
// `--dry-run <file>` parses the file as the flag's value; accept either order.
|
|
431
|
+
const file = positional[1] ?? [flags["dry-run"], flags.overwrite].find((v) => typeof v === "string");
|
|
432
|
+
if (!file) {
|
|
433
|
+
line(COMMAND_HELP.config);
|
|
434
|
+
return 1;
|
|
435
|
+
}
|
|
436
|
+
let document;
|
|
437
|
+
try {
|
|
438
|
+
document = JSON.parse(readFileSync(resolve(projectDir, file), "utf8"));
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
throw new FeltKitError("INVALID_ARGUMENT", `Could not read ${file} as JSON: ${error.message}`);
|
|
442
|
+
}
|
|
443
|
+
const options = { dryRun: flags["dry-run"] !== undefined && flags["dry-run"] !== false, overwrite: flags.overwrite !== undefined && flags.overwrite !== false };
|
|
444
|
+
const { value, source } = await withEnvironment(projectDir, envName, (record, token) => adminRequest(record, token, "/configuration/import", { method: "POST", body: JSON.stringify({ document, ...options }) }), (runtime) => runtime.services.importConfiguration(document, options));
|
|
445
|
+
if (json)
|
|
446
|
+
line(JSON.stringify(value, null, 2));
|
|
447
|
+
else {
|
|
448
|
+
line(`${c.bold(`${value.dryRun ? "Plan" : "Imported"}: ${envName}`)} ${c.dim(`(${value.environment}) — ${source}`)}`);
|
|
449
|
+
for (const item of value.items) {
|
|
450
|
+
const mark = item.error || item.action === "conflict" ? symbols.fail : item.action === "missing" || item.action === "skip" ? c.yellow("!") : symbols.ok;
|
|
451
|
+
line(` ${mark} ${item.kind} ${item.key}: ${item.action}${item.applied ? " (applied)" : ""}${item.reason ? c.dim(` — ${item.reason}`) : ""}${item.error ? ` — ${item.error.code}: ${item.error.message}` : ""}`);
|
|
452
|
+
}
|
|
453
|
+
const custody = new EnvironmentCredentials();
|
|
454
|
+
for (const missing of value.missingSecrets) {
|
|
455
|
+
const variable = custody.describe(missing.sourceCredentialRef).variable;
|
|
456
|
+
line(` ${c.yellow("!")} attach credential ${missing.name}${missing.required ? " (required)" : ""} in ${envName}; the source used ${missing.sourceCredentialRef}${variable ? ` (${variable})` : ""}`);
|
|
457
|
+
}
|
|
458
|
+
line(c.dim(`\n${Object.entries(value.summary).map(([k, n]) => `${k} ${n}`).join(" · ")}${value.dryRun ? " · nothing was written" : ""}`));
|
|
459
|
+
}
|
|
460
|
+
return value.summary.failed > 0 || value.summary.conflict > 0 ? 1 : 0;
|
|
461
|
+
}
|
|
462
|
+
line(COMMAND_HELP.config);
|
|
463
|
+
return 1;
|
|
464
|
+
}
|
|
465
|
+
case "operator": {
|
|
466
|
+
if (positional[0] !== "grant" || !flags.id || !flags.role) {
|
|
467
|
+
line(COMMAND_HELP.operator);
|
|
468
|
+
return 1;
|
|
469
|
+
}
|
|
470
|
+
const env = String(flags.env ?? "production");
|
|
471
|
+
// The application's declared roles: from the production build when there is one, else the sources.
|
|
472
|
+
const bundle = join(projectDir, ".feltkit", "build", "functions.mjs");
|
|
473
|
+
const project = existsSync(bundle) ? await loadBundle(bundle) : await loadSources(projectDir);
|
|
474
|
+
const roles = String(flags.role).split(",").map((r) => r.trim()).filter(Boolean);
|
|
475
|
+
const declared = project.app.options.roles ?? {};
|
|
476
|
+
const unknown = roles.filter((r) => !declared[r]);
|
|
477
|
+
if (unknown.length)
|
|
478
|
+
throw new FeltKitError("INVALID_ARGUMENT", `Unknown role(s) ${unknown.join(", ")}. Declared roles: ${Object.keys(declared).join(", ") || "(none)"}.`);
|
|
479
|
+
const environment = resolveEnvironment({ projectDir, appName: project.app.name, name: env });
|
|
480
|
+
const ttlMs = flags.ttl ? Number(flags.ttl) * 60_000 : undefined;
|
|
481
|
+
const grant = createGrant(operatorKey(environment.runtimeDir), {
|
|
482
|
+
application: project.app.name,
|
|
483
|
+
environment: environment.name,
|
|
484
|
+
subject: String(flags.id),
|
|
485
|
+
roles,
|
|
486
|
+
...(flags.name ? { name: String(flags.name) } : {}),
|
|
487
|
+
...(ttlMs ? { ttlMs } : {}),
|
|
488
|
+
});
|
|
489
|
+
if (json)
|
|
490
|
+
line(JSON.stringify({ grant, subject: String(flags.id), roles, environment: environment.name }, null, 2));
|
|
491
|
+
else {
|
|
492
|
+
line(`${symbols.ok} One-time Studio sign-in for ${c.bold(String(flags.id))} (roles: ${roles.join(", ")}) in ${environment.name}`);
|
|
493
|
+
line(`\n ${grant}\n`);
|
|
494
|
+
line(c.dim(`Paste it into Studio (/_feltkit/) within ${Math.round((ttlMs ?? 600_000) / 60_000)} minutes. It works once. Anyone holding it can sign in as this operator: send it privately.`));
|
|
495
|
+
}
|
|
496
|
+
return 0;
|
|
497
|
+
}
|
|
498
|
+
case "skills": {
|
|
499
|
+
const action = positional[0];
|
|
500
|
+
const target = skillsTarget({ projectDir, user: flags.user === true, ...(flags.dir ? { dir: String(flags.dir) } : {}) });
|
|
501
|
+
if (action === "install" || action === "update") {
|
|
502
|
+
const result = installSkills(target, { force: flags.force === true });
|
|
503
|
+
if (json)
|
|
504
|
+
line(JSON.stringify(result, null, 2));
|
|
505
|
+
else {
|
|
506
|
+
for (const skill of result.installed)
|
|
507
|
+
line(`${symbols.ok} ${skill} ${c.dim(`${result.version} → ${join(target, skill)}`)}`);
|
|
508
|
+
for (const skip of result.skipped)
|
|
509
|
+
line(`${symbols.fail} ${skip.skill}: ${skip.reason}`);
|
|
510
|
+
line(c.dim("\nGuidance for coding agents; they grant no permission. Check with `feltkit skills check`."));
|
|
511
|
+
}
|
|
512
|
+
return result.skipped.length ? 1 : 0;
|
|
513
|
+
}
|
|
514
|
+
if (action === "check") {
|
|
515
|
+
const result = checkSkills(target);
|
|
516
|
+
if (json)
|
|
517
|
+
line(JSON.stringify(result, null, 2));
|
|
518
|
+
else if (result.ok)
|
|
519
|
+
line(`${symbols.ok} ${result.skills.length} FeltKit skills installed in ${target} for ${result.version}`);
|
|
520
|
+
else
|
|
521
|
+
for (const p of result.problems)
|
|
522
|
+
line(`${symbols.fail} ${p.skill}: ${p.problem}`);
|
|
523
|
+
return result.ok ? 0 : 1;
|
|
524
|
+
}
|
|
525
|
+
if (action === "list") {
|
|
526
|
+
const { version, skills } = shippedSkills();
|
|
527
|
+
if (json)
|
|
528
|
+
line(JSON.stringify({ version, skills }, null, 2));
|
|
529
|
+
else
|
|
530
|
+
for (const skill of skills)
|
|
531
|
+
line(` ${skill} ${c.dim(version)}`);
|
|
532
|
+
return 0;
|
|
533
|
+
}
|
|
534
|
+
line(COMMAND_HELP.skills);
|
|
535
|
+
return 1;
|
|
536
|
+
}
|
|
537
|
+
default:
|
|
538
|
+
line(`${symbols.fail} Unknown command "${command}".\n`);
|
|
539
|
+
line(HELP);
|
|
540
|
+
return 1;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
function findTests(projectDir) {
|
|
544
|
+
const out = [];
|
|
545
|
+
const walk = (dir) => {
|
|
546
|
+
if (!existsSync(dir))
|
|
547
|
+
return;
|
|
548
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
549
|
+
if (entry.name === "node_modules" || entry.name.startsWith("."))
|
|
550
|
+
continue;
|
|
551
|
+
const path = join(dir, entry.name);
|
|
552
|
+
if (entry.isDirectory())
|
|
553
|
+
walk(path);
|
|
554
|
+
else if (/\.test\.[mc]?[jt]sx?$/.test(entry.name))
|
|
555
|
+
out.push(path);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
walk(join(projectDir, "tests"));
|
|
559
|
+
walk(join(projectDir, "feltkit"));
|
|
560
|
+
return out.sort();
|
|
561
|
+
}
|
|
562
|
+
export async function run() {
|
|
563
|
+
try {
|
|
564
|
+
process.exitCode = await main();
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
if (isFeltKitError(error)) {
|
|
568
|
+
line(`${symbols.fail} ${error.message}`);
|
|
569
|
+
if (error.hint)
|
|
570
|
+
line(` ${c.yellow("hint:")} ${error.hint}`);
|
|
571
|
+
const details = error.details;
|
|
572
|
+
if (details?.stack && process.env.FELTKIT_DEBUG)
|
|
573
|
+
line(c.dim(details.stack));
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
line(`${symbols.fail} ${error.stack ?? String(error)}`);
|
|
577
|
+
}
|
|
578
|
+
process.exitCode = 1;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
//# sourceMappingURL=main.js.map
|