@akanjs/devkit 3.3.0-rc.2 → 3.3.0-rc.20
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/CHANGELOG.md +284 -20
- package/DEV_RUNTIME_KNOBS.md +1 -1
- package/README.ko.md +3 -2
- package/README.md +3 -3
- package/akanApp/akanApp.host.test.ts +1 -1
- package/akanConfig/akanConfig.test.ts +57 -8
- package/akanConfig/akanConfig.ts +16 -69
- package/akanConfig/dockerImage.ts +17 -0
- package/akanConfig/nativeKeys.ts +52 -0
- package/app/applicationBuildRunner.test.ts +321 -1
- package/app/applicationBuildRunner.ts +90 -3
- package/artifact/implicitRootLayoutRender.test.tsx +4 -1
- package/codeAgent/agent/CodeAgent.ts +36 -16
- package/codeAgent/agent/CodeAgentAllowed.ts +35 -0
- package/codeAgent/agent/CodeAgentCommandLine.ts +372 -0
- package/codeAgent/agent/CodeAgentGate.ts +23 -4
- package/codeAgent/agent/CodeAgentRpcHost.ts +1 -1
- package/codeAgent/agent/codeAgent.test.ts +62 -0
- package/codeAgent/agent/codeAgentCommandLine.test.ts +212 -0
- package/codeAgent/agent/codeAgentContract.test.ts +117 -5
- package/codeAgent/skills/akan-agent/SKILL.md +8 -1
- package/codeAgent/skills/akan-code/SKILL.md +38 -3
- package/codeAgent/skills/akan-err/SKILL.md +11 -2
- package/codeAgent/skills/akan-page/SKILL.md +21 -26
- package/codeAgent/skills/akan-runtime/SKILL.md +41 -16
- package/codeAgent/skills/akan-service/SKILL.md +2 -2
- package/docs/apiReference.test.ts +14 -0
- package/docs/apiReference.ts +21 -3
- package/docs/declarationReader.ts +28 -1
- package/executors/appExecutor.ts +16 -7
- package/executors/workspaceExecutor.ts +7 -4
- package/frontendBuild/buildRouteClient.test.ts +2 -7
- package/frontendBuild/clientEntryDiscovery.test.ts +35 -0
- package/frontendBuild/clientEntryDiscovery.ts +16 -3
- package/frontendBuild/cssCompiler.test.ts +112 -0
- package/frontendBuild/cssCompiler.ts +41 -21
- package/frontendBuild/devBarrelImports.test.ts +30 -0
- package/frontendBuild/devBarrelImports.ts +2 -2
- package/frontendBuild/pagesBundleBuilder.ts +3 -1
- package/frontendBuild/plainStylesheet.test.ts +155 -0
- package/frontendBuild/plainStylesheet.ts +197 -0
- package/frontendBuild/rscServerRendererGuard.test.ts +60 -0
- package/frontendBuild/rscServerRendererGuard.ts +68 -0
- package/guideline/agentAssets.test.ts +10 -0
- package/guideline/agentAssets.ts +52 -11
- package/incrementalBuilder/buildBatch.proc.ts +9 -9
- package/incrementalBuilder/buildBatchProtocol.ts +1 -1
- package/incrementalBuilder/builderBoot.ts +5 -5
- package/incrementalBuilder/builderGraphPayloads.ts +4 -4
- package/incrementalBuilder/builderLanes.ts +2 -2
- package/incrementalBuilder/builderWatch.ts +8 -8
- package/incrementalBuilder/csrRegistry.ts +4 -4
- package/incrementalBuilder/incrementalBuilder.proc.ts +8 -8
- package/incrementalBuilder/ssrRegistry.ts +6 -6
- package/index.ts +1 -1
- package/integration/renderAdmissionSoak.test.ts +99 -0
- package/integration/renderAdmissionSoak.ts +609 -0
- package/lint/__fixtures__/no-arbitrary-color/every-color-function/bad.tsx +11 -0
- package/lint/__fixtures__/no-arbitrary-color/every-color-function/good.tsx +2 -0
- package/lint/__fixtures__/no-daisyui-legacy-class/every-class/bad.tsx +34 -0
- package/lint/__fixtures__/no-daisyui-legacy-class/every-class/good.tsx +2 -0
- package/lint/__fixtures__/no-inline-color/every-color-function/bad.tsx +10 -0
- package/lint/__fixtures__/no-inline-color/every-color-function/good.tsx +2 -0
- package/lint/__fixtures__/no-raw-palette-class/every-palette/bad.tsx +22 -0
- package/lint/__fixtures__/no-raw-palette-class/every-palette/good.tsx +2 -0
- package/lint/biomeCheck.test.ts +145 -0
- package/lint/biomeCheck.ts +131 -0
- package/lint/no-arbitrary-color.grit +5 -0
- package/lint/no-conditional-st-hook.grit +5 -1
- package/lint/no-daisyui-legacy-class.grit +8 -0
- package/lint/no-document-cookie.grit +3 -0
- package/lint/no-inline-color.grit +10 -2
- package/lint/no-oversized-list-limit.grit +2 -0
- package/lint/no-raw-palette-class.grit +7 -0
- package/lint/no-unpublished-form-setter.grit +2 -0
- package/lint/no-web-only-api-outside-webkit.grit +5 -0
- package/lint/no-web-storage.grit +3 -0
- package/lint/withheldEnvFile.ts +17 -0
- package/mobile/nativeApp.test.ts +7 -5
- package/mobile/nativeApp.ts +2 -2
- package/mobile/nativeConfig.test.ts +117 -1
- package/mobile/nativeConfig.ts +66 -22
- package/mobile/serverBundleSecrets.ts +43 -0
- package/package.json +14 -169
- package/packageExports.test.ts +38 -24
- package/test/secretEnvFixture.ts +134 -0
- package/transforms/barrelAnalyzer.ts +2 -2
- package/transforms/secretEnvDeclaration.test.ts +208 -0
- package/transforms/secretEnvDeclaration.ts +213 -0
- package/transforms/secretEnvFile.test.ts +117 -0
- package/transforms/secretEnvFile.ts +113 -0
- package/transforms/secretEnvName.test.ts +54 -0
- package/transforms/secretEnvName.ts +29 -0
- package/transforms/secretEnvSource.test.ts +148 -0
- package/transforms/secretEnvSource.ts +166 -0
- package/transforms/serverEnvEvaluationError.ts +11 -0
- package/transforms/serverEnvPlugin.test.ts +2 -1
- package/transforms/serverEnvPlugin.ts +13 -0
- package/transforms/serverEnvProfile.test.ts +115 -2
- package/transforms/serverEnvProfile.ts +117 -40
- package/transforms/serverEnvSecrets.test.ts +292 -0
- package/transforms/transforms.test.ts +3 -3
- package/tunnel/createTunnel.test.ts +29 -8
- package/tunnel/createTunnel.ts +18 -11
- package/typecheck/projectTypecheck.test.ts +29 -0
- package/typecheck/typeChecker.test.ts +49 -0
- package/typecheck/typeChecker.ts +9 -7
- package/typecheck/withheldDiagnostics.ts +41 -0
- package/util/fileEditor.ts +1 -0
- package/util/selectModel.ts +1 -0
- package/workspace/getRelatedCnsts.ts +7 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { SecretEnv } from "akanjs/server/lifecycle/secretEnv";
|
|
4
|
+
import { ServerBundleSecrets } from "../mobile/serverBundleSecrets";
|
|
5
|
+
import {
|
|
6
|
+
computedSecretKeys,
|
|
7
|
+
computedSecrets,
|
|
8
|
+
holdsSentinel,
|
|
9
|
+
secretEnvFixtureNames,
|
|
10
|
+
secretEnvPlain,
|
|
11
|
+
secretEnvSentinels,
|
|
12
|
+
twinSecretEnv,
|
|
13
|
+
twinSecrets,
|
|
14
|
+
writeComputedSecretFixture,
|
|
15
|
+
writeSecretEnvFixture,
|
|
16
|
+
} from "../test/secretEnvFixture";
|
|
17
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
18
|
+
import { SecretEnvDeclaration } from "./secretEnvDeclaration";
|
|
19
|
+
import { createServerEnvPlugin } from "./serverEnvPlugin";
|
|
20
|
+
import { ServerEnvProfile } from "./serverEnvProfile";
|
|
21
|
+
|
|
22
|
+
const makeTempRoot = tempDirs("akan-devkit-server-env-secrets-");
|
|
23
|
+
const environments = ["local", "main"];
|
|
24
|
+
const secretEnvModule = Bun.resolveSync("akanjs/server/lifecycle/secretEnv", import.meta.dir);
|
|
25
|
+
|
|
26
|
+
interface Built {
|
|
27
|
+
root: string;
|
|
28
|
+
appDir: string;
|
|
29
|
+
envDir: string;
|
|
30
|
+
outDir: string;
|
|
31
|
+
file: string;
|
|
32
|
+
text: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const build = async (
|
|
36
|
+
root: string,
|
|
37
|
+
secrets?: "read" | "inline",
|
|
38
|
+
{ mainExtra = "", overSwitch = false } = {},
|
|
39
|
+
): Promise<Built> => {
|
|
40
|
+
const { appDir, envDir } = await writeSecretEnvFixture(root, { mainExtra });
|
|
41
|
+
if (overSwitch)
|
|
42
|
+
await writeText(path.join(envDir, "env.server.ts"), await Bun.file(path.join(envDir, "env.server.main.ts")).text());
|
|
43
|
+
const entry = path.join(appDir, "server.ts");
|
|
44
|
+
await writeText(
|
|
45
|
+
entry,
|
|
46
|
+
[
|
|
47
|
+
`import { SecretEnv } from ${JSON.stringify(secretEnvModule)};`,
|
|
48
|
+
'import { env } from "./env/env.server";',
|
|
49
|
+
"SecretEnv.check({ warn: (message) => console.error(message) });",
|
|
50
|
+
"console.info(JSON.stringify(env));",
|
|
51
|
+
"",
|
|
52
|
+
].join("\n"),
|
|
53
|
+
);
|
|
54
|
+
const outDir = path.join(root, "dist/apps/demo");
|
|
55
|
+
const result = await Bun.build({
|
|
56
|
+
entrypoints: [entry],
|
|
57
|
+
outdir: outDir,
|
|
58
|
+
target: "bun",
|
|
59
|
+
plugins: [createServerEnvPlugin({ envDir, environment: "main", environments, secrets })],
|
|
60
|
+
});
|
|
61
|
+
const output = result.outputs.find((artifact) => artifact.kind === "entry-point");
|
|
62
|
+
if (!output) throw new Error("no entry output");
|
|
63
|
+
return { root, appDir, envDir, outDir, file: output.path, text: await output.text() };
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const declare = async ({ envDir }: Built) => {
|
|
67
|
+
const { variables } = await SecretEnvDeclaration.of(envDir, "main");
|
|
68
|
+
return {
|
|
69
|
+
list: SecretEnv.format(variables),
|
|
70
|
+
values: Object.fromEntries(variables.map((each) => [each.name, each.value])),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const boot = (file: string, env: { [name: string]: string }) => {
|
|
75
|
+
const proc = Bun.spawnSync([process.execPath, file], {
|
|
76
|
+
env: { PATH: process.env.PATH ?? "", AKAN_PUBLIC_ENV: "main", ...env },
|
|
77
|
+
});
|
|
78
|
+
const stdout = proc.stdout.toString();
|
|
79
|
+
return {
|
|
80
|
+
exitCode: proc.exitCode,
|
|
81
|
+
env: stdout ? (JSON.parse(stdout) as { [key: string]: unknown }) : null,
|
|
82
|
+
warnings: proc.stderr.toString().split("\n").filter(Boolean),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const evaluated = ({ envDir, appDir }: Built) =>
|
|
87
|
+
ServerEnvProfile.evaluate(path.join(envDir, "env.server.ts"), appDir, undefined, { environment: "main" });
|
|
88
|
+
|
|
89
|
+
describe("createServerEnvPlugin for an image", () => {
|
|
90
|
+
test("the built server holds no secret of the workspace's env files, a lib's defaults included, and every plain value", async () => {
|
|
91
|
+
const built = await build(await makeTempRoot(), "read");
|
|
92
|
+
expect(holdsSentinel(built.text)).toBe(false);
|
|
93
|
+
for (const plain of Object.values(secretEnvPlain)) expect(built.text).toContain(plain);
|
|
94
|
+
expect(built.text).toContain("noreply@example.test");
|
|
95
|
+
expect(await new ServerBundleSecrets(built.root, built.appDir).assertClean(built.outDir)).toEqual([]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("started with the variables its env file maps to, it runs on the env that file evaluates to, and warns of nothing", async () => {
|
|
99
|
+
const built = await build(await makeTempRoot(), "read");
|
|
100
|
+
const { list, values } = await declare(built);
|
|
101
|
+
const booted = boot(built.file, { AKAN_ENV_NAMES: list, ...values });
|
|
102
|
+
expect(booted.exitCode).toBe(0);
|
|
103
|
+
expect(booted.warnings).toEqual([]);
|
|
104
|
+
expect(booted.env).toEqual((await evaluated(built)) as { [key: string]: unknown });
|
|
105
|
+
expect(booted.env).toMatchObject({
|
|
106
|
+
security: { jwtSecret: secretEnvSentinels.jwt },
|
|
107
|
+
mailer: { auth: { pass: secretEnvSentinels.libPass } },
|
|
108
|
+
discord: { tokens: secretEnvSentinels.bots },
|
|
109
|
+
pushNoti: { firebase: { private_key: secretEnvSentinels.pem } },
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("the developer's own variable still outranks the one the build reads", async () => {
|
|
114
|
+
const built = await build(await makeTempRoot(), "read");
|
|
115
|
+
const { list, values } = await declare(built);
|
|
116
|
+
const booted = boot(built.file, {
|
|
117
|
+
AKAN_ENV_NAMES: list,
|
|
118
|
+
...values,
|
|
119
|
+
DATABASE_URL: "postgres://own.example.test/app",
|
|
120
|
+
});
|
|
121
|
+
expect(booted.env).toMatchObject({ database: { postgres: { url: "postgres://own.example.test/app" } } });
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test("started without its variables, it names each one in a single warning and runs without them", async () => {
|
|
125
|
+
const built = await build(await makeTempRoot(), "read");
|
|
126
|
+
const { list, values } = await declare(built);
|
|
127
|
+
const { MAILER__AUTH__PASS: _pass, DISCORD__TOKENS: _tokens, ...set } = values;
|
|
128
|
+
const booted = boot(built.file, { AKAN_ENV_NAMES: list, ...set });
|
|
129
|
+
expect(booted.exitCode).toBe(0);
|
|
130
|
+
expect(booted.warnings).toEqual([
|
|
131
|
+
"2 secret env values this server declares are not set: MAILER__AUTH__PASS, DISCORD__TOKENS. The framework does not stop for them yet, though whatever reads them may, and akanjs 3.5.0 will refuse to boot. Set them in the deployment's environment; `akan secret-env <app> --env main` lists every name.",
|
|
132
|
+
]);
|
|
133
|
+
expect(booted.env).toMatchObject({ mailer: { address: "noreply@example.test", auth: { user: "mailer" } } });
|
|
134
|
+
expect((booted.env?.mailer as { auth: object } | undefined)?.auth).not.toHaveProperty("pass");
|
|
135
|
+
expect(booted.env?.discord).not.toHaveProperty("tokens");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("after a key is renamed in the env file, a deployment still setting the old variable is told the new name", async () => {
|
|
139
|
+
const before = await build(await makeTempRoot(), "read", {
|
|
140
|
+
mainExtra: '\n llm: { apiKey: "sentinel-llm-1c95" },',
|
|
141
|
+
});
|
|
142
|
+
const old = await declare(before);
|
|
143
|
+
expect(old.values.LLM__API_KEY).toBe("sentinel-llm-1c95");
|
|
144
|
+
const renamed = await build(await makeTempRoot(), "read", {
|
|
145
|
+
mainExtra: '\n llm: { accessKey: "sentinel-llm-1c95" },',
|
|
146
|
+
});
|
|
147
|
+
const { list } = await declare(renamed);
|
|
148
|
+
const booted = boot(renamed.file, { AKAN_ENV_NAMES: list, ...old.values });
|
|
149
|
+
expect(booted.warnings).toEqual([
|
|
150
|
+
"1 secret env value this server declares is not set: LLM__ACCESS_KEY. The framework does not stop for it yet, though whatever reads it may, and akanjs 3.5.0 will refuse to boot. Set it in the deployment's environment; `akan secret-env <app> --env main` lists every name.",
|
|
151
|
+
]);
|
|
152
|
+
expect(booted.env?.llm).toEqual({});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("an --inline-secrets build keeps the values as what an unset variable falls back to, and a set one wins", async () => {
|
|
156
|
+
const built = await build(await makeTempRoot(), "inline");
|
|
157
|
+
expect(built.text).toContain(secretEnvSentinels.jwt);
|
|
158
|
+
const { list } = await declare(built);
|
|
159
|
+
const fallback = boot(built.file, { AKAN_ENV_NAMES: list, AKAN_ENV_FALLBACK: "image" });
|
|
160
|
+
expect(fallback.env).toEqual((await evaluated(built)) as { [key: string]: unknown });
|
|
161
|
+
expect(fallback.warnings).toHaveLength(1);
|
|
162
|
+
expect(fallback.warnings[0]).toStartWith(
|
|
163
|
+
"10 secret env values this server declares are not set, so it uses the values built into this image (akan build --inline-secrets): JWT_SECRET, ",
|
|
164
|
+
);
|
|
165
|
+
const overridden = boot(built.file, {
|
|
166
|
+
AKAN_ENV_NAMES: list,
|
|
167
|
+
AKAN_ENV_FALLBACK: "image",
|
|
168
|
+
JWT_SECRET: "set-by-the-deployment",
|
|
169
|
+
DISCORD__TOKENS: '["set-by-the-deployment"]',
|
|
170
|
+
});
|
|
171
|
+
expect(overridden.env).toMatchObject({
|
|
172
|
+
security: { jwtSecret: "set-by-the-deployment", sso: { google: { clientSecret: secretEnvSentinels.google } } },
|
|
173
|
+
discord: { tokens: ["set-by-the-deployment"], webhook: secretEnvSentinels.webhook },
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test("the env file a pipeline copies over the switch is read the same way", async () => {
|
|
178
|
+
const built = await build(await makeTempRoot(), "read", { overSwitch: true });
|
|
179
|
+
expect(holdsSentinel(built.text)).toBe(false);
|
|
180
|
+
const { list, values } = await declare(built);
|
|
181
|
+
expect(Object.keys(values)).toEqual(secretEnvFixtureNames);
|
|
182
|
+
const booted = boot(built.file, { AKAN_ENV_NAMES: list, ...values });
|
|
183
|
+
expect(booted.warnings).toEqual([]);
|
|
184
|
+
expect(booted.env).toEqual((await evaluated(built)) as { [key: string]: unknown });
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("a secret the env file imports or computes stays in the built server, and the declaration names its key whatever the value's length", async () => {
|
|
188
|
+
const root = await makeTempRoot();
|
|
189
|
+
const { appDir, envDir } = await writeComputedSecretFixture(root);
|
|
190
|
+
const entry = path.join(appDir, "server.ts");
|
|
191
|
+
await writeText(entry, 'import { env } from "./env/env.server";\nconsole.info(JSON.stringify(env));\n');
|
|
192
|
+
const result = await Bun.build({
|
|
193
|
+
entrypoints: [entry],
|
|
194
|
+
outdir: path.join(root, "dist/apps/demo"),
|
|
195
|
+
target: "bun",
|
|
196
|
+
plugins: [createServerEnvPlugin({ envDir, environment: "main", environments, secrets: "read" })],
|
|
197
|
+
});
|
|
198
|
+
const text = (await result.outputs.find((artifact) => artifact.kind === "entry-point")?.text()) ?? "";
|
|
199
|
+
expect(text).toContain(computedSecrets.password);
|
|
200
|
+
expect(text).toContain(computedSecrets.passphrase);
|
|
201
|
+
expect(text).toContain(computedSecrets.user);
|
|
202
|
+
expect(text).not.toContain(secretEnvSentinels.jwt);
|
|
203
|
+
const declared = await SecretEnvDeclaration.of(envDir, "main");
|
|
204
|
+
expect(declared.unmoved).toEqual(computedSecretKeys);
|
|
205
|
+
expect(declared.variables.map(({ name }) => name)).toEqual(secretEnvFixtureNames);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
test("a secret string a plain key holds as well stays in the built server: a long mixed one stops the image check by both keys, a short one is a warning, and neither names the value", async () => {
|
|
209
|
+
const built = await build(await makeTempRoot(), "read", { mainExtra: twinSecretEnv });
|
|
210
|
+
for (const value of Object.values(twinSecrets)) expect(built.text).toContain(value);
|
|
211
|
+
const { moved } = await SecretEnvDeclaration.of(built.envDir, "main");
|
|
212
|
+
expect(moved.filter(({ twins }) => twins.length).map(({ path: at, name, twins }) => ({ at, name, twins }))).toEqual(
|
|
213
|
+
[
|
|
214
|
+
{ at: "audit.password", name: "AUDIT__PASSWORD", twins: ["audit.label"] },
|
|
215
|
+
{ at: "cache.password", name: "CACHE__PASSWORD", twins: ["cache.name"] },
|
|
216
|
+
{ at: "door.secret", name: "DOOR__SECRET", twins: ["door.hint"] },
|
|
217
|
+
],
|
|
218
|
+
);
|
|
219
|
+
const secrets = new ServerBundleSecrets(built.root, built.appDir);
|
|
220
|
+
const failure = await secrets.assertImageClean(built.outDir, moved).then(
|
|
221
|
+
() => "",
|
|
222
|
+
(error: Error) => error.message,
|
|
223
|
+
);
|
|
224
|
+
expect(failure).toStartWith(
|
|
225
|
+
"The build holds secret values the server reads from its process env, so it stops here:\n server.js holds the value of audit.password (AUDIT__PASSWORD), which the env's audit.label holds as well\nThe build left each out",
|
|
226
|
+
);
|
|
227
|
+
expect(holdsSentinel(failure)).toBe(false);
|
|
228
|
+
const note = await secrets.assertImageClean(
|
|
229
|
+
built.outDir,
|
|
230
|
+
moved.filter(({ path: at }) => at !== "audit.password"),
|
|
231
|
+
);
|
|
232
|
+
expect(note).toBe(
|
|
233
|
+
[
|
|
234
|
+
"2 secret values the server reads from its process env are also in what this build wrote, short or plain enough to be there for another reason, so the build goes on:",
|
|
235
|
+
" cache.password (CACHE__PASSWORD): server.js; the env's cache.name holds the same string",
|
|
236
|
+
" door.secret (DOOR__SECRET): the env's door.hint holds the same string",
|
|
237
|
+
"Where another key of the env or the app's code holds a secret's own string, the image holds it too: change one of the two.",
|
|
238
|
+
].join("\n"),
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const clean = await build(await makeTempRoot(), "read");
|
|
242
|
+
const declared = await SecretEnvDeclaration.of(clean.envDir, "main");
|
|
243
|
+
expect(declared.moved.map(({ name }) => name)).toEqual([
|
|
244
|
+
"JWT_SECRET",
|
|
245
|
+
"SECURITY__SSO__GOOGLE__CLIENT_SECRET",
|
|
246
|
+
"MAILER__AUTH__PASS",
|
|
247
|
+
"OBJECT_STORAGE__ENDPOINT",
|
|
248
|
+
"OBJECT_STORAGE__ENDPOINT",
|
|
249
|
+
"DISCORD__TOKENS",
|
|
250
|
+
"DISCORD__TOKENS",
|
|
251
|
+
"DISCORD__WEBHOOK",
|
|
252
|
+
"PUSH_NOTI__FIREBASE__PRIVATE_KEY",
|
|
253
|
+
"MESSAGE__API_SECRET",
|
|
254
|
+
"MESSAGE__SENDER_PASSWORD",
|
|
255
|
+
"POSTGRES_URL",
|
|
256
|
+
"POSTGRES_URL",
|
|
257
|
+
]);
|
|
258
|
+
expect(await new ServerBundleSecrets(clean.root, clean.appDir).assertImageClean(clean.outDir, declared.moved)).toBe(
|
|
259
|
+
null,
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
test("a secret the env file reads from the process env itself stays that read in the built server, which holds no value the build's shell gave it", async () => {
|
|
264
|
+
const shell = process.env.ZQ_API_KEY;
|
|
265
|
+
process.env.ZQ_API_KEY = "shell-api-key-1d20";
|
|
266
|
+
try {
|
|
267
|
+
const built = await build(await makeTempRoot(), "read", {
|
|
268
|
+
mainExtra: '\n own: { apiKey: process.env.ZQ_API_KEY, hosts: process.env.ZQ_API_KEY!.split("-") },',
|
|
269
|
+
});
|
|
270
|
+
expect(built.text).toContain("apiKey: process.env.ZQ_API_KEY");
|
|
271
|
+
expect(built.text).not.toContain("shell-api-key-1d20");
|
|
272
|
+
const { list, values } = await declare(built);
|
|
273
|
+
expect(list).not.toContain("OWN__");
|
|
274
|
+
const booted = boot(built.file, { AKAN_ENV_NAMES: list, ...values, ZQ_API_KEY: "deployed-api-key" });
|
|
275
|
+
expect(booted.warnings).toEqual([]);
|
|
276
|
+
expect(booted.env?.own).toEqual({ apiKey: "deployed-api-key", hosts: ["deployed", "api", "key"] });
|
|
277
|
+
} finally {
|
|
278
|
+
if (shell === undefined) delete process.env.ZQ_API_KEY;
|
|
279
|
+
else process.env.ZQ_API_KEY = shell;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test("without the setting, as for the server a desktop app carries, the env files are bundled as written", async () => {
|
|
284
|
+
const built = await build(await makeTempRoot());
|
|
285
|
+
expect(built.text).toContain(secretEnvSentinels.jwt);
|
|
286
|
+
expect(built.text).toContain(secretEnvSentinels.libPass);
|
|
287
|
+
expect(built.text).not.toContain("SecretEnv.read(");
|
|
288
|
+
const booted = boot(built.file, {});
|
|
289
|
+
expect(booted.warnings).toEqual([]);
|
|
290
|
+
expect(booted.env).toEqual((await evaluated(built)) as { [key: string]: unknown });
|
|
291
|
+
});
|
|
292
|
+
});
|
|
@@ -517,7 +517,7 @@ describe("BarrelAnalyzer and rewriteBarrelImports", () => {
|
|
|
517
517
|
expect(rewritten).toBe('import { BottomInset } from "akanjs/ui/Layout/BottomInset";\n');
|
|
518
518
|
});
|
|
519
519
|
|
|
520
|
-
test("
|
|
520
|
+
test("writes an installed package's targets as files, which its exports map does not have to reach", async () => {
|
|
521
521
|
const root = await makeTempRoot();
|
|
522
522
|
await write(
|
|
523
523
|
path.join(root, "node_modules/akanjs/ui/index.ts"),
|
|
@@ -543,8 +543,8 @@ describe("BarrelAnalyzer and rewriteBarrelImports", () => {
|
|
|
543
543
|
|
|
544
544
|
expect(rewritten).toBe(
|
|
545
545
|
`${[
|
|
546
|
-
|
|
547
|
-
|
|
546
|
+
`import { Link } from ${JSON.stringify(path.join(root, "node_modules/akanjs/ui/Link/index.tsx"))};`,
|
|
547
|
+
`import { System } from ${JSON.stringify(path.join(root, "node_modules/akanjs/ui/System/index.tsx"))};`,
|
|
548
548
|
].join("\n")}\n`,
|
|
549
549
|
);
|
|
550
550
|
});
|
|
@@ -90,7 +90,7 @@ describe("createTunnel", () => {
|
|
|
90
90
|
const listener = Bun.listen({ hostname: "127.0.0.1", port: 0, socket: { data() {} } });
|
|
91
91
|
const port = listener.port;
|
|
92
92
|
listener.stop(true);
|
|
93
|
-
process.env
|
|
93
|
+
Object.assign(process.env, { SSH_TUNNEL_PORT: String(port), SSH_TUNNEL_PASSWORD: "test-password" });
|
|
94
94
|
|
|
95
95
|
let originalError: Error | undefined;
|
|
96
96
|
const connect = Client.prototype.connect;
|
|
@@ -193,7 +193,7 @@ describe("createTunnel", () => {
|
|
|
193
193
|
expect(ssh.methods.filter((method) => method !== "none")).toEqual(["password"]);
|
|
194
194
|
});
|
|
195
195
|
|
|
196
|
-
test("
|
|
196
|
+
test("a tunnel needs a configured credential and names the settings that provide one", async () => {
|
|
197
197
|
const { root, app } = track(await createTempApp("demo"));
|
|
198
198
|
const ssh = await startSshServer();
|
|
199
199
|
Object.assign(process.env, {
|
|
@@ -203,13 +203,34 @@ describe("createTunnel", () => {
|
|
|
203
203
|
//? `akan test` runs from the workspace root, whose dotenv may name a password; this case is the one with none.
|
|
204
204
|
delete process.env.SSH_TUNNEL_PASSWORD;
|
|
205
205
|
delete process.env.SSH_TUNNEL_PRIVATE_KEY_PATH;
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
const connect = spyOn(Client.prototype, "connect");
|
|
207
|
+
try {
|
|
208
|
+
await expect(createTunnel("redis", { app, environment: "testing", port: freePort() })).rejects.toThrow(
|
|
209
|
+
"The redis tunnel for demo-testing needs an SSH credential: export SSH_TUNNEL_PRIVATE_KEY_PATH",
|
|
210
|
+
);
|
|
211
|
+
await expect(createTunnel("postgres", { app, environment: "testing", port: freePort() })).rejects.toThrow(
|
|
212
|
+
"or set SSH_TUNNEL_PASSWORD",
|
|
213
|
+
);
|
|
214
|
+
expect(connect).not.toHaveBeenCalled();
|
|
215
|
+
} finally {
|
|
216
|
+
connect.mockRestore();
|
|
217
|
+
}
|
|
218
|
+
expect(ssh.methods).toEqual([]);
|
|
219
|
+
});
|
|
209
220
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
);
|
|
221
|
+
test("a key file the tunnel cannot read fails naming the tunnel, the setting and the path", async () => {
|
|
222
|
+
const { root, app } = track(await createTempApp("demo"));
|
|
223
|
+
const keyPath = path.join(root, "missing_key");
|
|
224
|
+
process.env.SSH_TUNNEL_PRIVATE_KEY_PATH = keyPath;
|
|
225
|
+
const connect = spyOn(Client.prototype, "connect");
|
|
226
|
+
try {
|
|
227
|
+
await expect(createTunnel("redis", { app, environment: "testing", port: freePort() })).rejects.toThrow(
|
|
228
|
+
`The redis tunnel for demo-testing could not read the key SSH_TUNNEL_PRIVATE_KEY_PATH names, ${keyPath} (ENOENT)`,
|
|
229
|
+
);
|
|
230
|
+
expect(connect).not.toHaveBeenCalled();
|
|
231
|
+
} finally {
|
|
232
|
+
connect.mockRestore();
|
|
233
|
+
}
|
|
213
234
|
});
|
|
214
235
|
|
|
215
236
|
test("listens where SSH_TUNNEL_BIND_HOST says and warns when that is not loopback", async () => {
|
package/tunnel/createTunnel.ts
CHANGED
|
@@ -20,19 +20,25 @@ interface TunnelOption {
|
|
|
20
20
|
port?: number;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const readTunnelKey = (purpose: string, keyPath: string) => {
|
|
24
|
+
try {
|
|
25
|
+
return readFileSync(keyPath);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
const reason = (error as NodeJS.ErrnoException).code ?? (error instanceof Error ? error.message : String(error));
|
|
28
|
+
throw new Error(`${purpose} could not read the key SSH_TUNNEL_PRIVATE_KEY_PATH names, ${keyPath} (${reason}).`, {
|
|
29
|
+
cause: error,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const tunnelAuth = (purpose: string): Pick<ConnectConfig, "privateKey" | "passphrase" | "password"> => {
|
|
27
35
|
const keyPath = tunnelEnv.get("SSH_TUNNEL_PRIVATE_KEY_PATH");
|
|
28
36
|
const passphrase = tunnelEnv.get("SSH_TUNNEL_PASSPHRASE");
|
|
29
|
-
if (keyPath) return { privateKey:
|
|
37
|
+
if (keyPath) return { privateKey: readTunnelKey(purpose, keyPath), ...(passphrase ? { passphrase } : {}) };
|
|
30
38
|
if (process.env.SSH_TUNNEL_PASSWORD) return { password: process.env.SSH_TUNNEL_PASSWORD };
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"Set SSH_TUNNEL_PRIVATE_KEY_PATH to a key (or SSH_TUNNEL_PASSWORD) once the cluster's tunnel endpoint accepts it.",
|
|
39
|
+
throw new Error(
|
|
40
|
+
`${purpose} needs an SSH credential: export SSH_TUNNEL_PRIVATE_KEY_PATH (with SSH_TUNNEL_PASSPHRASE if the key has one) in the shell, or set SSH_TUNNEL_PASSWORD.`,
|
|
34
41
|
);
|
|
35
|
-
return { password: repoName };
|
|
36
42
|
};
|
|
37
43
|
|
|
38
44
|
const tunnelHostVerifier = (app: AppExecutor, hostId: string, onRefusal: (reason: string) => void) => {
|
|
@@ -75,7 +81,8 @@ export const createTunnel = async (
|
|
|
75
81
|
const baseDevEnv = WorkspaceExecutor.getBaseDevEnv();
|
|
76
82
|
WorkspaceExecutor.assertDeployableEnv(baseDevEnv, environment, `The ${service} tunnel`);
|
|
77
83
|
for (const line of tunnelEnv.ignored()) app.logger.warn(line);
|
|
78
|
-
const
|
|
84
|
+
const auth = tunnelAuth(`The ${service} tunnel for ${app.name}-${environment}`);
|
|
85
|
+
const { serveDomain } = baseDevEnv;
|
|
79
86
|
const host = `${app.name}-${environment}.${serveDomain}`;
|
|
80
87
|
//? RFC 6761 makes *.localhost loopback, but only macOS resolves it; glibc without systemd-resolved and Windows answer ENOTFOUND
|
|
81
88
|
const sshHost = host.endsWith(".localhost") ? "localhost" : host;
|
|
@@ -101,7 +108,7 @@ export const createTunnel = async (
|
|
|
101
108
|
host: sshHost,
|
|
102
109
|
port: sshPort,
|
|
103
110
|
username: process.env.SSH_TUNNEL_USERNAME ?? "root",
|
|
104
|
-
...
|
|
111
|
+
...auth,
|
|
105
112
|
hostVerifier: tunnelHostVerifier(app, `${sshHost}:${sshPort}`, (reason) => {
|
|
106
113
|
refusal = reason;
|
|
107
114
|
}),
|
|
@@ -69,4 +69,33 @@ describe("ProjectTypecheck", () => {
|
|
|
69
69
|
severity: "error",
|
|
70
70
|
});
|
|
71
71
|
}, 60_000);
|
|
72
|
+
|
|
73
|
+
test.each(["pretty", "records"] as const)(
|
|
74
|
+
"reports a type error in an env file by position and code alone, in the %p report",
|
|
75
|
+
async (report) => {
|
|
76
|
+
const root = await makeTempRoot();
|
|
77
|
+
const dir = path.join(root, "apps/demo");
|
|
78
|
+
const sentinel = "SENTINEL_JWT_SECRET_4f9c2a71e0b3";
|
|
79
|
+
await write(
|
|
80
|
+
path.join(dir, "tsconfig.json"),
|
|
81
|
+
JSON.stringify({
|
|
82
|
+
compilerOptions: { strict: true, types: [], target: "esnext", module: "esnext", noEmit: true },
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
85
|
+
await write(path.join(dir, "env/env.server.main.ts"), `export const jwtSecret: "other" = "${sentinel}";\n`);
|
|
86
|
+
await write(path.join(dir, "server.ts"), 'export { jwtSecret } from "./env/env.server.main";\n');
|
|
87
|
+
|
|
88
|
+
const error = await new ProjectTypecheck(dir, root, { ...process.env })
|
|
89
|
+
.run(["../../server.ts"], { report })
|
|
90
|
+
.catch((e: unknown) => e);
|
|
91
|
+
|
|
92
|
+
const printed = (error as Error).message;
|
|
93
|
+
expect(printed).toContain("env/env.server.main.ts");
|
|
94
|
+
expect(printed).toContain("TS2322");
|
|
95
|
+
expect(printed).toContain(report === "records" ? ":1:14" : "1:14");
|
|
96
|
+
expect(printed).not.toContain(sentinel);
|
|
97
|
+
expect(printed).not.toContain("jwtSecret:");
|
|
98
|
+
},
|
|
99
|
+
60_000,
|
|
100
|
+
);
|
|
72
101
|
});
|
|
@@ -98,3 +98,52 @@ describe("TypeChecker.checkProject", () => {
|
|
|
98
98
|
expect(nextFileToCheck(configPath)).toBeUndefined();
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
|
+
|
|
102
|
+
describe("an env file's diagnostics", () => {
|
|
103
|
+
const sentinel = "SENTINEL_DB_PASSWORD_4f9c2a71e0b3";
|
|
104
|
+
|
|
105
|
+
const envProject = async () => {
|
|
106
|
+
const { root, configPath } = await project(false);
|
|
107
|
+
const file = path.join(root, "src/env/env.server.main.ts");
|
|
108
|
+
await writeText(file, `export const password: "other" = "${sentinel}";\n`);
|
|
109
|
+
const checker = new TypeChecker({ cwdPath: root } as never);
|
|
110
|
+
return { root, configPath, file, checker };
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
test("never print the source line or a message that quotes it, in any report", async () => {
|
|
114
|
+
const { root, configPath, file, checker } = await envProject();
|
|
115
|
+
const project = TypeChecker.checkProject(configPath);
|
|
116
|
+
const inFile = project.errors.filter((diagnostic) => diagnostic.file?.fileName === file);
|
|
117
|
+
expect(inFile.map((diagnostic) => diagnostic.code)).toEqual([2322]);
|
|
118
|
+
expect(ts.flattenDiagnosticMessageText(inFile[0]?.messageText ?? "", "\n")).toContain(sentinel);
|
|
119
|
+
|
|
120
|
+
const { diagnostics, fileDiagnostics } = checker.check(file);
|
|
121
|
+
const detailed = checker.getDetailedDiagnostics(file);
|
|
122
|
+
const reports = [
|
|
123
|
+
project.message,
|
|
124
|
+
checker.formatDiagnostics(fileDiagnostics),
|
|
125
|
+
JSON.stringify(TypeChecker.toRecords(diagnostics, root)),
|
|
126
|
+
JSON.stringify(detailed.details),
|
|
127
|
+
];
|
|
128
|
+
for (const report of reports) {
|
|
129
|
+
expect(report).not.toContain(sentinel);
|
|
130
|
+
expect(report).not.toContain("password:");
|
|
131
|
+
}
|
|
132
|
+
expect(project.message).toContain("env.server.main.ts:1:14 - error TS2322");
|
|
133
|
+
expect(project.message).toContain("withheld");
|
|
134
|
+
expect(TypeChecker.toRecords(inFile, root)[0]).toMatchObject({
|
|
135
|
+
file: "src/env/env.server.main.ts",
|
|
136
|
+
line: 1,
|
|
137
|
+
col: 14,
|
|
138
|
+
code: "TS2322",
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test("leave another file's report as TypeScript prints it", async () => {
|
|
143
|
+
const { configPath } = await envProject();
|
|
144
|
+
const { message } = TypeChecker.checkProject(configPath);
|
|
145
|
+
expect(message).toContain("semantic.ts");
|
|
146
|
+
expect(message).toContain("Type 'string' is not assignable to type 'number'");
|
|
147
|
+
expect(message).toContain('export const name: number = "akan";');
|
|
148
|
+
});
|
|
149
|
+
});
|
package/typecheck/typeChecker.ts
CHANGED
|
@@ -4,6 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import * as ts from "typescript";
|
|
5
5
|
|
|
6
6
|
import type { Executor } from "../executors";
|
|
7
|
+
import { WithheldDiagnostics } from "./withheldDiagnostics";
|
|
7
8
|
|
|
8
9
|
export interface ProjectTypecheckResult {
|
|
9
10
|
configPath: string;
|
|
@@ -93,7 +94,7 @@ export class TypeChecker {
|
|
|
93
94
|
: diagnostic.category === ts.DiagnosticCategory.Warning
|
|
94
95
|
? (["warning", chalk.yellow, "⚠️"] as const)
|
|
95
96
|
: (["suggestion", chalk.blue, "💡"] as const);
|
|
96
|
-
const message =
|
|
97
|
+
const message = WithheldDiagnostics.message(diagnostic);
|
|
97
98
|
const tsCode = chalk.dim(`(TS${diagnostic.code})`);
|
|
98
99
|
|
|
99
100
|
if (diagnostic.file && diagnostic.start !== undefined) {
|
|
@@ -103,7 +104,7 @@ export class TypeChecker {
|
|
|
103
104
|
output.push(` ${chalk.gray("at")} ${fileName}:${chalk.bold(`${line + 1}:${character + 1}`)}`);
|
|
104
105
|
|
|
105
106
|
const sourceLines = diagnostic.file.text.split("\n");
|
|
106
|
-
if (line < sourceLines.length) {
|
|
107
|
+
if (!WithheldDiagnostics.applies(diagnostic) && line < sourceLines.length) {
|
|
107
108
|
const sourceLine = sourceLines[line];
|
|
108
109
|
const lineNumber = (line + 1).toString().padStart(5, " ");
|
|
109
110
|
|
|
@@ -139,10 +140,10 @@ export class TypeChecker {
|
|
|
139
140
|
const details = diagnostics.map((diagnostic) => {
|
|
140
141
|
if (diagnostic.file && diagnostic.start !== undefined) {
|
|
141
142
|
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
142
|
-
const message =
|
|
143
|
+
const message = WithheldDiagnostics.message(diagnostic);
|
|
143
144
|
|
|
144
145
|
const lines = sourceFile.text.split("\n");
|
|
145
|
-
const codeSnippet = line < lines.length ? lines[line] : undefined;
|
|
146
|
+
const codeSnippet = line < lines.length && !WithheldDiagnostics.applies(diagnostic) ? lines[line] : undefined;
|
|
146
147
|
return { line: line + 1, column: character + 1, message, code: diagnostic.code, codeSnippet };
|
|
147
148
|
}
|
|
148
149
|
|
|
@@ -238,16 +239,17 @@ export class TypeChecker {
|
|
|
238
239
|
col: position ? position.character + 1 : 0,
|
|
239
240
|
code: `TS${diagnostic.code}`,
|
|
240
241
|
severity: diagnostic.category === ts.DiagnosticCategory.Error ? "error" : "warning",
|
|
241
|
-
message:
|
|
242
|
+
message: WithheldDiagnostics.message(diagnostic),
|
|
242
243
|
};
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
static formatDiagnosticMessages(diagnostics: ts.Diagnostic[]): string {
|
|
247
|
-
|
|
248
|
+
const host: ts.FormatDiagnosticsHost = {
|
|
248
249
|
getCanonicalFileName: (fileName) => fileName,
|
|
249
250
|
getCurrentDirectory: () => process.cwd(),
|
|
250
251
|
getNewLine: () => ts.sys.newLine,
|
|
251
|
-
}
|
|
252
|
+
};
|
|
253
|
+
return diagnostics.map((diagnostic) => WithheldDiagnostics.format(diagnostic, host)).join("");
|
|
252
254
|
}
|
|
253
255
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import * as ts from "typescript";
|
|
3
|
+
import { WithheldEnvFile } from "../lint/withheldEnvFile";
|
|
4
|
+
|
|
5
|
+
//? A TypeScript message quotes the literal too: `Type '"abc"' is not assignable`.
|
|
6
|
+
export class WithheldDiagnostics {
|
|
7
|
+
static readonly note = WithheldEnvFile.note;
|
|
8
|
+
|
|
9
|
+
static isWithheld(fileName: string | undefined) {
|
|
10
|
+
return WithheldEnvFile.isEnvFile(fileName);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static applies(diagnostic: ts.Diagnostic) {
|
|
14
|
+
return WithheldDiagnostics.isWithheld(diagnostic.file?.fileName);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static message(diagnostic: ts.Diagnostic) {
|
|
18
|
+
return WithheldDiagnostics.applies(diagnostic)
|
|
19
|
+
? WithheldDiagnostics.note
|
|
20
|
+
: ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static format(diagnostic: ts.Diagnostic, host: ts.FormatDiagnosticsHost) {
|
|
24
|
+
const related = diagnostic.relatedInformation?.filter(
|
|
25
|
+
({ file }) => !WithheldDiagnostics.isWithheld(file?.fileName),
|
|
26
|
+
);
|
|
27
|
+
if (!WithheldDiagnostics.applies(diagnostic))
|
|
28
|
+
return ts.formatDiagnosticsWithColorAndContext(
|
|
29
|
+
[
|
|
30
|
+
related?.length === diagnostic.relatedInformation?.length
|
|
31
|
+
? diagnostic
|
|
32
|
+
: { ...diagnostic, relatedInformation: related },
|
|
33
|
+
],
|
|
34
|
+
host,
|
|
35
|
+
);
|
|
36
|
+
const { file, start } = diagnostic;
|
|
37
|
+
const at = file && start !== undefined ? file.getLineAndCharacterOfPosition(start) : { line: -1, character: -1 };
|
|
38
|
+
const name = path.relative(host.getCurrentDirectory(), file?.fileName ?? "");
|
|
39
|
+
return `${name}:${at.line + 1}:${at.character + 1} - error TS${diagnostic.code}: ${WithheldDiagnostics.note}${host.getNewLine()}`;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/util/fileEditor.ts
CHANGED
package/util/selectModel.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readdirSync } from "node:fs";
|
|
2
2
|
import { select } from "@inquirer/prompts";
|
|
3
3
|
|
|
4
|
+
/** @deprecated Nothing in akanjs uses it; removed in a later minor. */
|
|
4
5
|
export const selectModel = async (modulePath: string) => {
|
|
5
6
|
const modelNames = readdirSync(`${modulePath}/lib`).filter((dir) => !dir.includes(".") && !dir.startsWith("_"));
|
|
6
7
|
return await select({
|