theokit 0.77.0 → 0.77.2
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/dist/{add-DOR7HORT.js → add-NFDL4OJ7.js} +2 -2
- package/dist/{agent-MJWQRSJ2.js → agent-WE4WOLKC.js} +2 -2
- package/dist/{build-QDZEOCJ3.js → build-DSVLRDZ6.js} +9 -62
- package/dist/build-DSVLRDZ6.js.map +1 -0
- package/dist/{chunk-35OI2TKT.js → chunk-5UJRZC4J.js} +37 -19
- package/dist/chunk-5UJRZC4J.js.map +1 -0
- package/dist/{chunk-HNALEGOL.js → chunk-7IPWHWYV.js} +2 -2
- package/dist/{chunk-OKFRGAYZ.js → chunk-ESSUFQ3H.js} +37 -19
- package/dist/chunk-ESSUFQ3H.js.map +1 -0
- package/dist/{chunk-JVXDEIT4.js → chunk-I2IDWM26.js} +33 -9
- package/dist/chunk-I2IDWM26.js.map +1 -0
- package/dist/{chunk-OSSNCUS6.js → chunk-SEDZI7JF.js} +4 -4
- package/dist/chunk-V3LMUQSB.js +98 -0
- package/dist/chunk-V3LMUQSB.js.map +1 -0
- package/dist/cli/index.js +13 -13
- package/dist/{db-5WOK6HA2.js → db-72T47G5S.js} +2 -2
- package/dist/{dev-N5LQFLBR.js → dev-F4ZY7TZX.js} +3 -3
- package/dist/docker-3ARABEZ2.js +130 -0
- package/dist/docker-3ARABEZ2.js.map +1 -0
- package/dist/{generate-OA5ARO3P.js → generate-DAVXE5RV.js} +3 -3
- package/dist/index.js +1 -1
- package/dist/{info-ELSPSCXK.js → info-AYTNH6YT.js} +2 -2
- package/dist/{load-config-SKLFH7YL.js → load-config-YU5E76DL.js} +2 -2
- package/dist/{mcp-3ENI2IPS.js → mcp-H3TNO6YV.js} +3 -3
- package/dist/{openapi-OVXYHZ2S.js → openapi-ICJB2RBE.js} +2 -2
- package/dist/{preview-GP6J6IGJ.js → preview-RYN7UI45.js} +3 -3
- package/dist/{routes-UNJ77IQU.js → routes-XYXXR72Z.js} +2 -2
- package/dist/{start-EJFYT7ZU.js → start-Y7VVCK6Q.js} +2 -2
- package/dist/vite-plugin/index.js +1 -1
- package/dist/{vite-plugin-MNZHNOM4.js → vite-plugin-LDZJRFKT.js} +3 -3
- package/package.json +3 -3
- package/dist/build-QDZEOCJ3.js.map +0 -1
- package/dist/chunk-35OI2TKT.js.map +0 -1
- package/dist/chunk-JVXDEIT4.js.map +0 -1
- package/dist/chunk-OKFRGAYZ.js.map +0 -1
- package/dist/docker-LZZB4D5E.js +0 -102
- package/dist/docker-LZZB4D5E.js.map +0 -1
- /package/dist/{add-DOR7HORT.js.map → add-NFDL4OJ7.js.map} +0 -0
- /package/dist/{agent-MJWQRSJ2.js.map → agent-WE4WOLKC.js.map} +0 -0
- /package/dist/{chunk-HNALEGOL.js.map → chunk-7IPWHWYV.js.map} +0 -0
- /package/dist/{chunk-OSSNCUS6.js.map → chunk-SEDZI7JF.js.map} +0 -0
- /package/dist/{db-5WOK6HA2.js.map → db-72T47G5S.js.map} +0 -0
- /package/dist/{dev-N5LQFLBR.js.map → dev-F4ZY7TZX.js.map} +0 -0
- /package/dist/{generate-OA5ARO3P.js.map → generate-DAVXE5RV.js.map} +0 -0
- /package/dist/{info-ELSPSCXK.js.map → info-AYTNH6YT.js.map} +0 -0
- /package/dist/{load-config-SKLFH7YL.js.map → load-config-YU5E76DL.js.map} +0 -0
- /package/dist/{mcp-3ENI2IPS.js.map → mcp-H3TNO6YV.js.map} +0 -0
- /package/dist/{openapi-OVXYHZ2S.js.map → openapi-ICJB2RBE.js.map} +0 -0
- /package/dist/{preview-GP6J6IGJ.js.map → preview-RYN7UI45.js.map} +0 -0
- /package/dist/{routes-UNJ77IQU.js.map → routes-XYXXR72Z.js.map} +0 -0
- /package/dist/{start-EJFYT7ZU.js.map → start-Y7VVCK6Q.js.map} +0 -0
- /package/dist/{vite-plugin-MNZHNOM4.js.map → vite-plugin-LDZJRFKT.js.map} +0 -0
|
@@ -19,13 +19,17 @@ var UnknownPackageError = class extends Error {
|
|
|
19
19
|
this.name = "UnknownPackageError";
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var FIRST_PARTY_SCOPE = "@theokit/";
|
|
23
|
+
var PACKAGE_NAME_REGEX = /^(@theokit\/)?[a-z0-9][a-z0-9-]*$/;
|
|
23
24
|
function validatePackageInput(input) {
|
|
24
25
|
if (typeof input !== "string" || input.length === 0) {
|
|
25
26
|
throw new InvalidPackageNameError(input, "must be a non-empty string");
|
|
26
27
|
}
|
|
27
28
|
if (!PACKAGE_NAME_REGEX.test(input)) {
|
|
28
|
-
throw new InvalidPackageNameError(
|
|
29
|
+
throw new InvalidPackageNameError(
|
|
30
|
+
input,
|
|
31
|
+
"allowed: lowercase letters, digits, hyphens, and an optional @theokit/ scope"
|
|
32
|
+
);
|
|
29
33
|
}
|
|
30
34
|
return true;
|
|
31
35
|
}
|
|
@@ -64,8 +68,27 @@ var KNOWN_PACKAGES = {
|
|
|
64
68
|
static: {
|
|
65
69
|
kind: "bundled",
|
|
66
70
|
usage: "theokit build --target=static"
|
|
67
|
-
}
|
|
71
|
+
},
|
|
72
|
+
// #1076 — the first-party plugins published under @theokit. Install by short or scoped name.
|
|
73
|
+
...firstPartyPlugins([
|
|
74
|
+
"plugin-canvas",
|
|
75
|
+
"plugin-copilot",
|
|
76
|
+
"plugin-db-drizzle",
|
|
77
|
+
"plugin-email",
|
|
78
|
+
"plugin-forms",
|
|
79
|
+
"plugin-payments",
|
|
80
|
+
"plugin-realtime",
|
|
81
|
+
"plugin-voice"
|
|
82
|
+
])
|
|
68
83
|
};
|
|
84
|
+
function firstPartyPlugins(names) {
|
|
85
|
+
return Object.fromEntries(
|
|
86
|
+
names.map((name) => {
|
|
87
|
+
const npm = `${FIRST_PARTY_SCOPE}${name}`;
|
|
88
|
+
return [name, { kind: "external", npm, usage: `import { ... } from '${npm}'` }];
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}
|
|
69
92
|
function levenshtein(a, b) {
|
|
70
93
|
const m = a.length;
|
|
71
94
|
const n = b.length;
|
|
@@ -97,14 +120,15 @@ function findSuggestion(input, candidates) {
|
|
|
97
120
|
async function runAdd(deps) {
|
|
98
121
|
validatePackageInput(deps.input);
|
|
99
122
|
const registry = deps.registry ?? KNOWN_PACKAGES;
|
|
100
|
-
|
|
101
|
-
|
|
123
|
+
const name = deps.input.startsWith(FIRST_PARTY_SCOPE) ? deps.input.slice(FIRST_PARTY_SCOPE.length) : deps.input;
|
|
124
|
+
if (!Object.hasOwn(registry, name)) {
|
|
125
|
+
const suggestion = findSuggestion(name, Object.keys(registry));
|
|
102
126
|
throw new UnknownPackageError(deps.input, suggestion);
|
|
103
127
|
}
|
|
104
|
-
const entry = registry[
|
|
128
|
+
const entry = registry[name];
|
|
105
129
|
if (entry.kind === "bundled") {
|
|
106
130
|
return {
|
|
107
|
-
packageInstalled: `${
|
|
131
|
+
packageInstalled: `${name} (bundled inside theokit)`,
|
|
108
132
|
packageManager: "bundled",
|
|
109
133
|
usage: entry.usage,
|
|
110
134
|
exitCode: 0
|
|
@@ -144,7 +168,7 @@ async function addCommand(input) {
|
|
|
144
168
|
console.log(`
|
|
145
169
|
\u2713 Installed ${result.packageInstalled} via ${result.packageManager}
|
|
146
170
|
`);
|
|
147
|
-
console.log(` Next:
|
|
171
|
+
console.log(` Next: ${result.usage}
|
|
148
172
|
`);
|
|
149
173
|
} catch (err) {
|
|
150
174
|
console.error(`
|
|
@@ -164,4 +188,4 @@ export {
|
|
|
164
188
|
runAdd,
|
|
165
189
|
addCommand
|
|
166
190
|
};
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
191
|
+
//# sourceMappingURL=chunk-I2IDWM26.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/add.ts"],"sourcesContent":["import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport class InvalidPackageNameError extends Error {\n constructor(input: string, reason: string) {\n super(`Invalid package name \"${input}\": ${reason}`)\n this.name = 'InvalidPackageNameError'\n }\n}\n\nexport class UnknownPackageError extends Error {\n constructor(input: string, suggestion?: string) {\n super(\n suggestion\n ? `Unknown package: ${input}. Did you mean: ${suggestion}?`\n : `Unknown package: ${input}.`,\n )\n this.name = 'UnknownPackageError'\n }\n}\n\n/**\n * EC-4 — strict whitelist of characters allowed in package input.\n * Lowercase ASCII letters, digits, hyphens. Must start with letter/digit.\n * Rejects: shell metacharacters, path traversal, uppercase, and every scope but `@theokit/`.\n *\n * The `@theokit/` scope is accepted because the help text and the Plugins page document\n * `theokit add @theokit/plugin-payments` (#1076). The scope is stripped before the whitelist\n * lookup, so it only ever names an entry already in `KNOWN_PACKAGES`.\n */\nconst FIRST_PARTY_SCOPE = '@theokit/'\nconst PACKAGE_NAME_REGEX = /^(@theokit\\/)?[a-z0-9][a-z0-9-]*$/\n\nexport function validatePackageInput(input: string): true {\n if (typeof input !== 'string' || input.length === 0) {\n throw new InvalidPackageNameError(input, 'must be a non-empty string')\n }\n if (!PACKAGE_NAME_REGEX.test(input)) {\n throw new InvalidPackageNameError(\n input,\n 'allowed: lowercase letters, digits, hyphens, and an optional @theokit/ scope',\n )\n }\n return true\n}\n\nexport type PackageManager = 'pnpm' | 'bun' | 'yarn' | 'npm'\n\nexport function detectPackageManager(lockfiles: Record<string, boolean>): PackageManager {\n if (lockfiles['pnpm-lock.yaml']) return 'pnpm'\n if (lockfiles['bun.lockb']) return 'bun'\n if (lockfiles['yarn.lock']) return 'yarn'\n if (lockfiles['package-lock.json']) return 'npm'\n return 'npm'\n}\n\n/** The package manager whose lockfile sits in `cwd`; npm when there is none. */\nexport function detectProjectPackageManager(\n cwd: string,\n existsFn: (path: string) => boolean = existsSync,\n): PackageManager {\n return detectPackageManager({\n 'pnpm-lock.yaml': existsFn(resolve(cwd, 'pnpm-lock.yaml')),\n 'bun.lockb': existsFn(resolve(cwd, 'bun.lockb')),\n 'yarn.lock': existsFn(resolve(cwd, 'yarn.lock')),\n 'package-lock.json': existsFn(resolve(cwd, 'package-lock.json')),\n })\n}\n\ninterface PackageRegistryEntry {\n /** 'bundled' = adapter already shipped inside theokit; no npm install needed.\n * 'external' = adapter/plugin lives as a separate npm package. */\n kind: 'bundled' | 'external'\n /** Required when kind === 'external'. */\n npm?: string\n /** Usage hint printed to the user (e.g. `theokit build --target=bun`). */\n usage: string\n}\n\nexport const KNOWN_PACKAGES: Record<string, PackageRegistryEntry> = {\n bun: {\n kind: 'bundled',\n usage: 'theokit build --target=bun',\n },\n deno: {\n kind: 'bundled',\n usage: 'theokit build --target=deno-deploy',\n },\n netlify: {\n kind: 'bundled',\n usage: 'theokit build --target=netlify',\n },\n 'aws-lambda': {\n kind: 'bundled',\n usage: 'theokit build --target=aws-lambda',\n },\n static: {\n kind: 'bundled',\n usage: 'theokit build --target=static',\n },\n // #1076 — the first-party plugins published under @theokit. Install by short or scoped name.\n ...firstPartyPlugins([\n 'plugin-canvas',\n 'plugin-copilot',\n 'plugin-db-drizzle',\n 'plugin-email',\n 'plugin-forms',\n 'plugin-payments',\n 'plugin-realtime',\n 'plugin-voice',\n ]),\n}\n\nfunction firstPartyPlugins(names: readonly string[]): Record<string, PackageRegistryEntry> {\n return Object.fromEntries(\n names.map((name) => {\n const npm = `${FIRST_PARTY_SCOPE}${name}`\n return [name, { kind: 'external', npm, usage: `import { ... } from '${npm}'` }]\n }),\n )\n}\n\nfunction levenshtein(a: string, b: string): number {\n const m = a.length\n const n = b.length\n if (m === 0) return n\n if (n === 0) return m\n const dp: number[][] = Array.from({ length: m + 1 }, () =>\n Array.from<number>({ length: n + 1 }).fill(0),\n )\n for (let i = 0; i <= m; i++) dp[i][0] = i\n for (let j = 0; j <= n; j++) dp[0][j] = j\n for (let i = 1; i <= m; i++) {\n for (let j = 1; j <= n; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1\n dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost)\n }\n }\n return dp[m][n]\n}\n\nfunction findSuggestion(input: string, candidates: string[]): string | undefined {\n let best: { name: string; d: number } | null = null\n for (const c of candidates) {\n const d = levenshtein(input, c)\n if (best === null || d < best.d) best = { name: c, d }\n }\n if (best && best.d <= 3) return best.name\n return undefined\n}\n\ninterface RunAddDeps {\n input: string\n cwd: string\n existsSync?: (path: string) => boolean\n spawnPm?: (\n cmd: string,\n args: string[],\n opts: { cwd: string; shell: boolean },\n ) => Promise<{ ok: boolean; code: number }>\n registry?: Record<string, PackageRegistryEntry>\n}\n\ninterface AddResult {\n packageInstalled: string\n packageManager: PackageManager | 'bundled'\n usage: string\n exitCode: 0\n}\n\nexport async function runAdd(deps: RunAddDeps): Promise<AddResult> {\n validatePackageInput(deps.input)\n\n const registry = deps.registry ?? KNOWN_PACKAGES\n const name = deps.input.startsWith(FIRST_PARTY_SCOPE)\n ? deps.input.slice(FIRST_PARTY_SCOPE.length)\n : deps.input\n if (!Object.hasOwn(registry, name)) {\n const suggestion = findSuggestion(name, Object.keys(registry))\n throw new UnknownPackageError(deps.input, suggestion)\n }\n const entry = registry[name]\n\n // T6.1 — bundled adapters need no install\n if (entry.kind === 'bundled') {\n return {\n packageInstalled: `${name} (bundled inside theokit)`,\n packageManager: 'bundled',\n usage: entry.usage,\n exitCode: 0,\n }\n }\n\n if (!entry.npm) {\n throw new Error(`External package \"${deps.input}\" missing npm field in registry`)\n }\n\n const pm = detectProjectPackageManager(deps.cwd, deps.existsSync)\n\n const args = pm === 'npm' ? ['install', entry.npm] : ['add', entry.npm]\n const spawnFn = deps.spawnPm ?? defaultSpawnPm\n const result = await spawnFn(pm, args, { cwd: deps.cwd, shell: false })\n\n if (!result.ok) {\n throw new Error(`Package manager exited with non-zero exit code ${result.code}`)\n }\n\n return {\n packageInstalled: entry.npm,\n packageManager: pm,\n usage: entry.usage,\n exitCode: 0,\n }\n}\n\nfunction defaultSpawnPm(\n cmd: string,\n args: string[],\n opts: { cwd: string; shell: boolean },\n): Promise<{ ok: boolean; code: number }> {\n return new Promise((resolve) => {\n const proc = spawn(cmd, args, { cwd: opts.cwd, shell: opts.shell, stdio: 'inherit' })\n proc.on('close', (code) => {\n resolve({ ok: code === 0, code: code ?? 1 })\n })\n proc.on('error', () => {\n resolve({ ok: false, code: 1 })\n })\n })\n}\n\nexport async function addCommand(input: string): Promise<void> {\n try {\n const result = await runAdd({ input, cwd: process.cwd() })\n console.log(`\\n ✓ Installed ${result.packageInstalled} via ${result.packageManager}\\n`)\n console.log(` Next: ${result.usage}\\n`)\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`)\n process.exit(1)\n }\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AAEjB,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACjD,YAAY,OAAe,QAAgB;AACzC,UAAM,yBAAyB,KAAK,MAAM,MAAM,EAAE;AAClD,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAC7C,YAAY,OAAe,YAAqB;AAC9C;AAAA,MACE,aACI,oBAAoB,KAAK,mBAAmB,UAAU,MACtD,oBAAoB,KAAK;AAAA,IAC/B;AACA,SAAK,OAAO;AAAA,EACd;AACF;AAWA,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB;AAEpB,SAAS,qBAAqB,OAAqB;AACxD,MAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAAG;AACnD,UAAM,IAAI,wBAAwB,OAAO,4BAA4B;AAAA,EACvE;AACA,MAAI,CAAC,mBAAmB,KAAK,KAAK,GAAG;AACnC,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAIO,SAAS,qBAAqB,WAAoD;AACvF,MAAI,UAAU,gBAAgB,EAAG,QAAO;AACxC,MAAI,UAAU,WAAW,EAAG,QAAO;AACnC,MAA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;AAEA,eAAsB,WAAW,OAA8B;AAC7D,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,EAAE,OAAO,KAAK,QAAQ,IAAI,EAAE,CAAC;AACzD,YAAQ,IAAI;AAAA,qBAAmB,OAAO,gBAAgB,QAAQ,OAAO,cAAc;AAAA,CAAI;AACvF,YAAQ,IAAI,WAAW,OAAO,KAAK;AAAA,CAAI;AAAA,EACzC,SAAS,KAAK;AACZ,YAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":["resolve"]}
|
|
@@ -145,7 +145,7 @@ async function agentCommand(name, message, deps = {}) {
|
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
const projectRoot = deps.projectRoot ?? process.cwd();
|
|
148
|
-
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-
|
|
148
|
+
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-YU5E76DL.js")).loadConfig(projectRoot)).agentsDir;
|
|
149
149
|
const agents = scanAgents(projectRoot, agentsDir);
|
|
150
150
|
const agent = agents.find((a) => a.name === name);
|
|
151
151
|
if (!agent) {
|
|
@@ -178,8 +178,8 @@ async function agentCommand(name, message, deps = {}) {
|
|
|
178
178
|
async function createAgentSsrLoader(projectRoot) {
|
|
179
179
|
const { createServer } = await import("vite");
|
|
180
180
|
const react = (await import("@vitejs/plugin-react")).default;
|
|
181
|
-
const { theoPluginAsync } = await import("./vite-plugin-
|
|
182
|
-
const { loadConfig } = await import("./load-config-
|
|
181
|
+
const { theoPluginAsync } = await import("./vite-plugin-LDZJRFKT.js");
|
|
182
|
+
const { loadConfig } = await import("./load-config-YU5E76DL.js");
|
|
183
183
|
const config = await loadConfig(projectRoot);
|
|
184
184
|
const theoPlugins = await theoPluginAsync({
|
|
185
185
|
root: projectRoot,
|
|
@@ -212,4 +212,4 @@ export {
|
|
|
212
212
|
agentCommand,
|
|
213
213
|
createAgentSsrLoader
|
|
214
214
|
};
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
215
|
+
//# sourceMappingURL=chunk-SEDZI7JF.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "tsx/esm";
|
|
3
|
+
|
|
4
|
+
// src/cli/cleanup/cleanup.ts
|
|
5
|
+
import { promises as fs } from "fs";
|
|
6
|
+
import { basename, resolve as resolvePath, sep } from "path";
|
|
7
|
+
var DEFAULT_SKIP = [".git", ".gitkeep", ".gitignore"];
|
|
8
|
+
var AUTHORED_AGENT_CONTEXT = [
|
|
9
|
+
"THEO.md",
|
|
10
|
+
"rules",
|
|
11
|
+
"personalities",
|
|
12
|
+
"skills",
|
|
13
|
+
"agents",
|
|
14
|
+
"commands",
|
|
15
|
+
"hooks.json"
|
|
16
|
+
];
|
|
17
|
+
var LOCAL_AGENT_STATE = [
|
|
18
|
+
"THEO.local.md",
|
|
19
|
+
"AGENTS.local.md",
|
|
20
|
+
"memory",
|
|
21
|
+
"context",
|
|
22
|
+
"context.json",
|
|
23
|
+
"config.json",
|
|
24
|
+
"settings.json",
|
|
25
|
+
"mcp.json",
|
|
26
|
+
"hooks",
|
|
27
|
+
"plugins",
|
|
28
|
+
"cron",
|
|
29
|
+
"profiles",
|
|
30
|
+
"auth.json",
|
|
31
|
+
"mcp-tokens.json",
|
|
32
|
+
"credential-pool.json",
|
|
33
|
+
"tool-permissions.json",
|
|
34
|
+
"hook-approvals.json"
|
|
35
|
+
];
|
|
36
|
+
function normalizeSkipName(name) {
|
|
37
|
+
return basename(name.replace(/\/$/, ""));
|
|
38
|
+
}
|
|
39
|
+
async function cleanOutDir(opts) {
|
|
40
|
+
const resolvedDir = resolvePath(opts.dir);
|
|
41
|
+
const resolvedCwd = resolvePath(process.cwd());
|
|
42
|
+
if (resolvedDir === resolvedCwd) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`cleanOutDir refused to wipe ${resolvedDir} \u2014 must be a child of cwd, not cwd itself`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (!resolvedDir.startsWith(resolvedCwd + sep)) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`cleanOutDir refused to wipe ${resolvedDir} \u2014 must be inside cwd (${resolvedCwd})`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
const skip = new Set((opts.skip ?? DEFAULT_SKIP).map(normalizeSkipName));
|
|
53
|
+
let entries;
|
|
54
|
+
try {
|
|
55
|
+
entries = await fs.readdir(resolvedDir, { withFileTypes: true });
|
|
56
|
+
} catch (err) {
|
|
57
|
+
const code = err.code;
|
|
58
|
+
if (code === "ENOENT") return { deleted: 0, kept: 0 };
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
let deleted = 0;
|
|
62
|
+
let kept = 0;
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
const name = entry.name;
|
|
65
|
+
if (skip.has(name)) {
|
|
66
|
+
kept++;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const fullPath = resolvePath(resolvedDir, name);
|
|
70
|
+
try {
|
|
71
|
+
await fs.rm(fullPath, { recursive: true, force: true, maxRetries: 3 });
|
|
72
|
+
deleted++;
|
|
73
|
+
} catch (err) {
|
|
74
|
+
const code = err.code;
|
|
75
|
+
if (code === "ENOENT") {
|
|
76
|
+
deleted++;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
console.warn(
|
|
80
|
+
`[theokit] cleanOutDir could not remove ${fullPath} (${code ?? "unknown"}); skipping`
|
|
81
|
+
);
|
|
82
|
+
kept++;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { deleted, kept };
|
|
86
|
+
}
|
|
87
|
+
async function cleanBuildOutput(distDir) {
|
|
88
|
+
return cleanOutDir({
|
|
89
|
+
dir: distDir,
|
|
90
|
+
skip: [...DEFAULT_SKIP, ...AUTHORED_AGENT_CONTEXT, ...LOCAL_AGENT_STATE]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
AUTHORED_AGENT_CONTEXT,
|
|
96
|
+
cleanBuildOutput
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=chunk-V3LMUQSB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/cleanup/cleanup.ts"],"sourcesContent":["/**\n * State cleanup utilities (Phase 2 of\n *\n * - `cleanOutDir` — Astro pattern: empty a directory except a skip list,\n * used at `theokit build` start.\n * - `gcAgentRegistry` — Nuxt LRU pattern: delete oldest agent dirs when\n * count exceeds cap, used at `theokit dev` startup.\n *\n * EC-3 (MUST FIX, CRITICAL): cleanOutDir refuses to wipe anything outside\n * the current cwd. Prevents catastrophic `distDir: '/'` data loss.\n * EC-9 (SHOULD TEST): gcAgentRegistry handles dirs with mtime=0 (Docker overlay).\n * EC-11 (SHOULD TEST): cleanOutDir normalizes trailing-slash in skip basenames.\n * EC-12 (SHOULD TEST): cleanOutDir catches EROFS and continues.\n */\n\nimport { promises as fs } from 'node:fs'\nimport { basename, resolve as resolvePath, sep } from 'node:path'\n\nimport type {\n CleanOutDirOptions,\n CleanOutDirResult,\n GcAgentRegistryOptions,\n GcAgentRegistryResult,\n} from './cleanup-types.js'\n\nconst DEFAULT_SKIP = ['.git', '.gitkeep', '.gitignore']\n// DEFAULT_MAX_AGENTS removed in Phase 7 — gcAgentRegistry is a tombstone.\n\n/**\n * `.theokit/` holds two unrelated things: what `theokit build` writes (the default `distDir`), and\n * the agent context the framework and `@theokit/sdk` read at runtime. These lists name the second\n * kind so the build stops deleting it (#1079) and the generated ignore files can tell the two apart\n * (#1075, #1069).\n */\n\n/**\n * Entries a person writes and the project versions and ships: the instruction file, rules,\n * personalities, skills, sub-agents, slash commands and hooks.\n *\n * `packages/create-theokit/templates/default/_gitignore` un-ignores the same names; a test keeps\n * the two in step, because create-theokit cannot import from this package.\n */\nexport const AUTHORED_AGENT_CONTEXT = [\n 'THEO.md',\n 'rules',\n 'personalities',\n 'skills',\n 'agents',\n 'commands',\n 'hooks.json',\n] as const\n\n/**\n * Entries the agent runtime or a single developer writes: memory, local overrides, credentials,\n * trust and approval records, plugin bundles. A build keeps them; git and the image leave them out,\n * since several hold tokens.\n */\nconst LOCAL_AGENT_STATE = [\n 'THEO.local.md',\n 'AGENTS.local.md',\n 'memory',\n 'context',\n 'context.json',\n 'config.json',\n 'settings.json',\n 'mcp.json',\n 'hooks',\n 'plugins',\n 'cron',\n 'profiles',\n 'auth.json',\n 'mcp-tokens.json',\n 'credential-pool.json',\n 'tool-permissions.json',\n 'hook-approvals.json',\n] as const\n\nfunction normalizeSkipName(name: string): string {\n // EC-11 — strip trailing slash + leading `./`\n return basename(name.replace(/\\/$/, ''))\n}\n\n/**\n * Empty a directory, preserving entries in the skip list.\n *\n * Throws if `opts.dir` is not inside `process.cwd()` (EC-3 path safety).\n * Returns `{deleted:0, kept:0}` when the directory does not exist.\n */\nexport async function cleanOutDir(opts: CleanOutDirOptions): Promise<CleanOutDirResult> {\n const resolvedDir = resolvePath(opts.dir)\n const resolvedCwd = resolvePath(process.cwd())\n\n // EC-3 — path safety guard. CRITICAL.\n if (resolvedDir === resolvedCwd) {\n throw new Error(\n `cleanOutDir refused to wipe ${resolvedDir} — must be a child of cwd, not cwd itself`,\n )\n }\n if (!resolvedDir.startsWith(resolvedCwd + sep)) {\n throw new Error(\n `cleanOutDir refused to wipe ${resolvedDir} — must be inside cwd (${resolvedCwd})`,\n )\n }\n\n const skip = new Set((opts.skip ?? DEFAULT_SKIP).map(normalizeSkipName))\n\n let entries: { name: string }[]\n try {\n entries = await fs.readdir(resolvedDir, { withFileTypes: true })\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'ENOENT') return { deleted: 0, kept: 0 }\n throw err\n }\n\n let deleted = 0\n let kept = 0\n for (const entry of entries) {\n const name = entry.name\n if (skip.has(name)) {\n kept++\n continue\n }\n const fullPath = resolvePath(resolvedDir, name)\n try {\n await fs.rm(fullPath, { recursive: true, force: true, maxRetries: 3 })\n deleted++\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'ENOENT') {\n deleted++ // already gone\n continue\n }\n // EC-12 — EROFS or other rm failure: warn + continue, don't crash.\n console.warn(\n `[theokit] cleanOutDir could not remove ${fullPath} (${code ?? 'unknown'}); skipping`,\n )\n kept++\n }\n }\n\n return { deleted, kept }\n}\n\n/**\n * Phase 7 — TOMBSTONE for backward-compat. The SDK v1.1.0's `Agent.registry`\n * handles GC natively; this function is a no-op + emits a deprecation warning\n * ONCE per process (EC-10).\n *\n * Will be deleted entirely in TheoKit 0.4.0. Marked deprecated via runtime\n * warning rather than `@deprecated` JSDoc tag to avoid the eslint\n * sonarjs/deprecation flagging our own internal symbols.\n */\nlet warnedOnce = false\nexport async function gcAgentRegistry(\n _opts: GcAgentRegistryOptions,\n): Promise<GcAgentRegistryResult> {\n if (!warnedOnce) {\n warnedOnce = true\n console.warn(\n '[theokit] gcAgentRegistry is deprecated; SDK Agent.registry handles GC natively (configure via theo.config.ts > agents.registry)',\n )\n }\n return Promise.resolve({ deleted: 0, kept: 0 })\n}\n\n/**\n * @internal — testing helper. Resets the module-scoped warnedOnce flag.\n */\nexport function __resetGcDeprecationWarnedForTests(): void {\n warnedOnce = false\n}\n\n/**\n * Empty the build output directory before `theokit build` writes into it, keeping the agent context\n * and local agent state that share `.theokit/` with the build output. Emptying it whole deleted the\n * scaffold's THEO.md, rules and personalities on the first build (#1079).\n */\nexport async function cleanBuildOutput(distDir: string): Promise<CleanOutDirResult> {\n return cleanOutDir({\n dir: distDir,\n skip: [...DEFAULT_SKIP, ...AUTHORED_AGENT_CONTEXT, ...LOCAL_AGENT_STATE],\n })\n}\n"],"mappings":";;;;AAeA,SAAS,YAAY,UAAU;AAC/B,SAAS,UAAU,WAAW,aAAa,WAAW;AAStD,IAAM,eAAe,CAAC,QAAQ,YAAY,YAAY;AAiB/C,IAAM,yBAAyB;AAAA,E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MAAM,YAAY,EAAE,CAAC;AACrE;AAAA,IACF,SAAS,KAAK;AACZ,YAAM,OAAQ,IAA8B;AAC5C,UAAI,SAAS,UAAU;AACrB;AACA;AAAA,MACF;AAEA,cAAQ;AAAA,QACN,0CAA0C,QAAQ,KAAK,QAAQ,SAAS;AAAA,MAC1E;AACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,SAAS,KAAK;AACzB;AAoCA,eAAsB,iBAAiB,SAA6C;AAClF,SAAO,YAAY;AAAA,IACjB,KAAK;AAAA,IACL,MAAM,CAAC,GAAG,cAAc,GAAG,wBAAwB,GAAG,iBAAiB;AAAA,EACzE,CAAC;AACH;","names":[]}
|
package/dist/cli/index.js
CHANGED
|
@@ -15,7 +15,7 @@ function cliVersion() {
|
|
|
15
15
|
// src/cli/index.ts
|
|
16
16
|
var cli = cac("theokit");
|
|
17
17
|
cli.command("dev", "Start development server").option("--port <port>", "Port number").option("--crons", "Schedule the crons in dev too (off by default)").action(async (options) => {
|
|
18
|
-
const { devCommand } = await import("../dev-
|
|
18
|
+
const { devCommand } = await import("../dev-F4ZY7TZX.js");
|
|
19
19
|
await devCommand({
|
|
20
20
|
port: options.port ? Number(options.port) : void 0,
|
|
21
21
|
crons: options.crons === true
|
|
@@ -23,7 +23,7 @@ cli.command("dev", "Start development server").option("--port <port>", "Port num
|
|
|
23
23
|
});
|
|
24
24
|
cli.command("build", "Build for production").option("--target <target>", "Deploy target (node, vercel, cloudflare)").action(async (options) => {
|
|
25
25
|
try {
|
|
26
|
-
const { buildCommand } = await import("../build-
|
|
26
|
+
const { buildCommand } = await import("../build-DSVLRDZ6.js");
|
|
27
27
|
await buildCommand({ target: options.target });
|
|
28
28
|
} catch (err) {
|
|
29
29
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -35,7 +35,7 @@ cli.command("build", "Build for production").option("--target <target>", "Deploy
|
|
|
35
35
|
});
|
|
36
36
|
cli.command("start", "Start production server").option("--port <port>", "Port number").action(async (options) => {
|
|
37
37
|
try {
|
|
38
|
-
const { startCommand } = await import("../start-
|
|
38
|
+
const { startCommand } = await import("../start-Y7VVCK6Q.js");
|
|
39
39
|
await startCommand({ port: options.port ? Number(options.port) : void 0 });
|
|
40
40
|
} catch (err) {
|
|
41
41
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -47,7 +47,7 @@ cli.command("start", "Start production server").option("--port <port>", "Port nu
|
|
|
47
47
|
});
|
|
48
48
|
cli.command("preview", "Build for production, then serve it \u2014 one step (B-030)").option("--port <port>", "Port number").option("--target <target>", "Deploy target (node, vercel, cloudflare)").action(async (options) => {
|
|
49
49
|
try {
|
|
50
|
-
const { previewCommand } = await import("../preview-
|
|
50
|
+
const { previewCommand } = await import("../preview-RYN7UI45.js");
|
|
51
51
|
await previewCommand({
|
|
52
52
|
port: options.port ? Number(options.port) : void 0,
|
|
53
53
|
target: options.target
|
|
@@ -65,7 +65,7 @@ cli.command(
|
|
|
65
65
|
"Scaffold a route, action, page, ws, controller, agent, toolbox, workflow, eval, sandbox, schedule, memory, or resource (resource accepts field:type args)"
|
|
66
66
|
).action(async (type, name, fields) => {
|
|
67
67
|
try {
|
|
68
|
-
const { generateCommand } = await import("../generate-
|
|
68
|
+
const { generateCommand } = await import("../generate-DAVXE5RV.js");
|
|
69
69
|
await generateCommand(type, name, fields.length > 0 ? fields : void 0);
|
|
70
70
|
} catch (err) {
|
|
71
71
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -80,7 +80,7 @@ cli.command(
|
|
|
80
80
|
"Run an agent in the terminal (stream + tool calls + approval)"
|
|
81
81
|
).action(async (name, message) => {
|
|
82
82
|
try {
|
|
83
|
-
const { agentCommand } = await import("../agent-
|
|
83
|
+
const { agentCommand } = await import("../agent-WE4WOLKC.js");
|
|
84
84
|
const { sawError } = await agentCommand(name, message);
|
|
85
85
|
if (sawError) process.exit(1);
|
|
86
86
|
} catch (err) {
|
|
@@ -111,7 +111,7 @@ cli.command("agent sessions gc", "Collect old transcripts for this project (dry
|
|
|
111
111
|
});
|
|
112
112
|
cli.command("mcp <agent>", "Serve an agent as an MCP server over stdio (for desktop MCP clients)").action(async (agent) => {
|
|
113
113
|
try {
|
|
114
|
-
const { mcpCommand } = await import("../mcp-
|
|
114
|
+
const { mcpCommand } = await import("../mcp-H3TNO6YV.js");
|
|
115
115
|
await mcpCommand(agent);
|
|
116
116
|
} catch (err) {
|
|
117
117
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -123,7 +123,7 @@ cli.command("mcp <agent>", "Serve an agent as an MCP server over stdio (for desk
|
|
|
123
123
|
});
|
|
124
124
|
cli.command("routes", "List all routes, actions, and WebSocket endpoints").action(async () => {
|
|
125
125
|
try {
|
|
126
|
-
const { routesCommand } = await import("../routes-
|
|
126
|
+
const { routesCommand } = await import("../routes-XYXXR72Z.js");
|
|
127
127
|
await routesCommand();
|
|
128
128
|
} catch (err) {
|
|
129
129
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -160,11 +160,11 @@ cli.command("check", "Run typecheck + scan + (optional) eslint").option(
|
|
|
160
160
|
await checkCommand();
|
|
161
161
|
});
|
|
162
162
|
cli.command("add <package>", "Install a known TheoKit adapter or plugin (whitelist-only)").action(async (pkg) => {
|
|
163
|
-
const { addCommand } = await import("../add-
|
|
163
|
+
const { addCommand } = await import("../add-NFDL4OJ7.js");
|
|
164
164
|
await addCommand(pkg);
|
|
165
165
|
});
|
|
166
166
|
cli.command("info", "Print environment info (runtime, config, routes)").action(async () => {
|
|
167
|
-
const { infoCommand } = await import("../info-
|
|
167
|
+
const { infoCommand } = await import("../info-AYTNH6YT.js");
|
|
168
168
|
await infoCommand();
|
|
169
169
|
});
|
|
170
170
|
cli.command("doctor", "Report the RESOLVED state of this installation (never prints a secret)").action(async () => {
|
|
@@ -176,7 +176,7 @@ cli.command(
|
|
|
176
176
|
"Generate <distDir>/openapi.json from route schemas (opt-in via config.openapi)"
|
|
177
177
|
).option("--dry-run", "Print the document to stdout without writing to disk (EC-3)").action(async (options) => {
|
|
178
178
|
try {
|
|
179
|
-
const { openapiCommand } = await import("../openapi-
|
|
179
|
+
const { openapiCommand } = await import("../openapi-ICJB2RBE.js");
|
|
180
180
|
await openapiCommand({ dryRun: Boolean(options.dryRun) });
|
|
181
181
|
} catch (err) {
|
|
182
182
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -223,7 +223,7 @@ cli.command(
|
|
|
223
223
|
});
|
|
224
224
|
cli.command("docker", "Generate Dockerfile for production").option("--force", "Overwrite existing Dockerfile").action(async (options) => {
|
|
225
225
|
try {
|
|
226
|
-
const { dockerCommand } = await import("../docker-
|
|
226
|
+
const { dockerCommand } = await import("../docker-3ARABEZ2.js");
|
|
227
227
|
await dockerCommand({ force: options.force });
|
|
228
228
|
} catch (err) {
|
|
229
229
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -238,7 +238,7 @@ cli.command(
|
|
|
238
238
|
"Database commands: generate (write SQL migration files), migrate (apply them), push (diff the schema into the database, no files), seed"
|
|
239
239
|
).action(async (action) => {
|
|
240
240
|
try {
|
|
241
|
-
const { dbCommandCli } = await import("../db-
|
|
241
|
+
const { dbCommandCli } = await import("../db-72T47G5S.js");
|
|
242
242
|
await dbCommandCli(action);
|
|
243
243
|
} catch (err) {
|
|
244
244
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5UJRZC4J.js";
|
|
6
6
|
import "./chunk-3QPVEJ7D.js";
|
|
7
7
|
import "./chunk-O5JZ6ROY.js";
|
|
8
8
|
import "./chunk-PQWVT6JC.js";
|
|
@@ -83,4 +83,4 @@ export {
|
|
|
83
83
|
dbCommand,
|
|
84
84
|
dbCommandCli
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=db-
|
|
86
|
+
//# sourceMappingURL=db-72T47G5S.js.map
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./chunk-KTMQUYED.js";
|
|
25
25
|
import {
|
|
26
26
|
theoPluginAsync
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-7IPWHWYV.js";
|
|
28
28
|
import "./chunk-HZAXFD55.js";
|
|
29
29
|
import "./chunk-BDH5GKFZ.js";
|
|
30
30
|
import "./chunk-3PWQQWT6.js";
|
|
@@ -43,7 +43,7 @@ import "./chunk-4WP7A7RX.js";
|
|
|
43
43
|
import "./chunk-Z7CJHDLS.js";
|
|
44
44
|
import {
|
|
45
45
|
loadConfig
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-5UJRZC4J.js";
|
|
47
47
|
import {
|
|
48
48
|
loadEnv
|
|
49
49
|
} from "./chunk-3QPVEJ7D.js";
|
|
@@ -179,4 +179,4 @@ export {
|
|
|
179
179
|
devCommand,
|
|
180
180
|
startDevServer
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=dev-
|
|
182
|
+
//# sourceMappingURL=dev-F4ZY7TZX.js.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "tsx/esm";
|
|
3
|
+
import {
|
|
4
|
+
AUTHORED_AGENT_CONTEXT
|
|
5
|
+
} from "./chunk-V3LMUQSB.js";
|
|
6
|
+
import {
|
|
7
|
+
loadConfig
|
|
8
|
+
} from "./chunk-5UJRZC4J.js";
|
|
9
|
+
import "./chunk-3QPVEJ7D.js";
|
|
10
|
+
import "./chunk-O5JZ6ROY.js";
|
|
11
|
+
import "./chunk-PQWVT6JC.js";
|
|
12
|
+
import "./chunk-L4V5V2TI.js";
|
|
13
|
+
import "./chunk-MAJZ2L3A.js";
|
|
14
|
+
|
|
15
|
+
// src/cli/commands/docker.ts
|
|
16
|
+
import { existsSync, writeFileSync } from "fs";
|
|
17
|
+
import { resolve } from "path";
|
|
18
|
+
function detectPkgManager(cwd) {
|
|
19
|
+
if (existsSync(resolve(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
20
|
+
if (existsSync(resolve(cwd, "yarn.lock"))) return "yarn";
|
|
21
|
+
return "npm";
|
|
22
|
+
}
|
|
23
|
+
var THEOKIT_BIN = "./node_modules/.bin/theokit";
|
|
24
|
+
function topLevelDir(path) {
|
|
25
|
+
return path.replace(/^\.\//, "").split("/")[0];
|
|
26
|
+
}
|
|
27
|
+
function generateDockerfile(input) {
|
|
28
|
+
const { pkgManager, distDir } = input;
|
|
29
|
+
const installCmd = {
|
|
30
|
+
pnpm: "RUN corepack enable && pnpm install --frozen-lockfile",
|
|
31
|
+
npm: "RUN npm ci",
|
|
32
|
+
yarn: "RUN yarn install --frozen-lockfile"
|
|
33
|
+
}[pkgManager];
|
|
34
|
+
const lockfile = {
|
|
35
|
+
pnpm: "pnpm-lock.yaml",
|
|
36
|
+
npm: "package-lock.json",
|
|
37
|
+
yarn: "yarn.lock"
|
|
38
|
+
}[pkgManager];
|
|
39
|
+
const manifests = [
|
|
40
|
+
"package.json",
|
|
41
|
+
lockfile,
|
|
42
|
+
...pkgManager === "pnpm" && input.hasPnpmWorkspace ? ["pnpm-workspace.yaml"] : []
|
|
43
|
+
];
|
|
44
|
+
const copySources = [...new Set(input.sourceRoots)].map(
|
|
45
|
+
(root) => `COPY --from=builder /app/${root} ./${root}`
|
|
46
|
+
);
|
|
47
|
+
return [
|
|
48
|
+
"# Generated by TheoKit",
|
|
49
|
+
"# Multi-stage build for production",
|
|
50
|
+
"",
|
|
51
|
+
"# Stage 1: Build",
|
|
52
|
+
"FROM node:22-alpine AS builder",
|
|
53
|
+
"WORKDIR /app",
|
|
54
|
+
`COPY ${manifests.join(" ")} ./`,
|
|
55
|
+
installCmd,
|
|
56
|
+
"COPY . .",
|
|
57
|
+
`RUN ${THEOKIT_BIN} build`,
|
|
58
|
+
"",
|
|
59
|
+
"# Stage 2: Production",
|
|
60
|
+
"FROM node:22-alpine AS runner",
|
|
61
|
+
"WORKDIR /app",
|
|
62
|
+
"ENV NODE_ENV=production",
|
|
63
|
+
// Inside a container `localhost` answers nobody, the image's own health check included (#402).
|
|
64
|
+
"ENV HOST=0.0.0.0",
|
|
65
|
+
"ENV PORT=3000",
|
|
66
|
+
`COPY --from=builder /app/${distDir} ./${distDir}`,
|
|
67
|
+
...copySources,
|
|
68
|
+
...input.hasConfigFile ? ["COPY --from=builder /app/theo.config.ts ./theo.config.ts"] : [],
|
|
69
|
+
...manifests.map((file) => `COPY --from=builder /app/${file} ./${file}`),
|
|
70
|
+
"COPY --from=builder /app/node_modules ./node_modules",
|
|
71
|
+
"",
|
|
72
|
+
"EXPOSE 3000",
|
|
73
|
+
`CMD ["${THEOKIT_BIN}", "start"]`,
|
|
74
|
+
""
|
|
75
|
+
].join("\n");
|
|
76
|
+
}
|
|
77
|
+
function generateDockerignore(distDir = ".theokit") {
|
|
78
|
+
return [
|
|
79
|
+
"node_modules",
|
|
80
|
+
".git",
|
|
81
|
+
`${distDir}/*`,
|
|
82
|
+
// A re-included directory brings its contents: Docker matches a pattern against every parent.
|
|
83
|
+
...AUTHORED_AGENT_CONTEXT.map((entry) => `!${distDir}/${entry}`),
|
|
84
|
+
"dist",
|
|
85
|
+
".env",
|
|
86
|
+
".env.*",
|
|
87
|
+
"!.env.example",
|
|
88
|
+
"*.log",
|
|
89
|
+
".DS_Store",
|
|
90
|
+
".vscode",
|
|
91
|
+
".idea",
|
|
92
|
+
"Dockerfile",
|
|
93
|
+
".dockerignore",
|
|
94
|
+
""
|
|
95
|
+
].join("\n");
|
|
96
|
+
}
|
|
97
|
+
async function dockerCommand(options) {
|
|
98
|
+
const cwd = process.cwd();
|
|
99
|
+
const dockerfilePath = resolve(cwd, "Dockerfile");
|
|
100
|
+
const dockerignorePath = resolve(cwd, ".dockerignore");
|
|
101
|
+
const pkgManager = detectPkgManager(cwd);
|
|
102
|
+
const { serverDir, agentsDir, distDir } = await loadConfig(cwd);
|
|
103
|
+
const dockerfile = generateDockerfile({
|
|
104
|
+
pkgManager,
|
|
105
|
+
sourceRoots: [topLevelDir(serverDir), topLevelDir(agentsDir)],
|
|
106
|
+
distDir,
|
|
107
|
+
hasConfigFile: existsSync(resolve(cwd, "theo.config.ts")),
|
|
108
|
+
hasPnpmWorkspace: existsSync(resolve(cwd, "pnpm-workspace.yaml"))
|
|
109
|
+
});
|
|
110
|
+
try {
|
|
111
|
+
writeFileSync(dockerfilePath, dockerfile, { flag: options?.force ? "w" : "wx" });
|
|
112
|
+
} catch (err) {
|
|
113
|
+
if (err.code !== "EEXIST") throw err;
|
|
114
|
+
console.log("\n \u26A0 Dockerfile already exists. Use --force to overwrite.\n");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
writeFileSync(dockerignorePath, generateDockerignore(distDir));
|
|
118
|
+
console.log(`
|
|
119
|
+
\u2713 Generated Dockerfile (${pkgManager})`);
|
|
120
|
+
console.log(` \u2713 Generated .dockerignore`);
|
|
121
|
+
console.log(`
|
|
122
|
+
Next steps:`);
|
|
123
|
+
console.log(` docker build -t my-app .`);
|
|
124
|
+
console.log(` docker run -p 3000:3000 my-app
|
|
125
|
+
`);
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
dockerCommand
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=docker-3ARABEZ2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/docker.ts"],"sourcesContent":["import { existsSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nimport { loadConfig } from '../../config/load-config.js'\nimport { AUTHORED_AGENT_CONTEXT } from '../cleanup/cleanup.js'\n\nfunction detectPkgManager(cwd: string): PkgManager {\n if (existsSync(resolve(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n if (existsSync(resolve(cwd, 'yarn.lock'))) return 'yarn'\n return 'npm'\n}\n\ntype PkgManager = 'pnpm' | 'npm' | 'yarn'\n\ninterface DockerfileInput {\n readonly pkgManager: PkgManager\n /** Top-level directories holding the server and agent sources, e.g. `['src']` for the scaffold. */\n readonly sourceRoots: readonly string[]\n /** The configured build output directory, `.theokit` by default. */\n readonly distDir: string\n readonly hasConfigFile: boolean\n readonly hasPnpmWorkspace: boolean\n}\n\n/**\n * The installed CLI, by path. `npx theo build` asked the registry for a package named `theo`, an\n * unrelated design-tokens tool, then installed and ran it inside the image build (#1069). A path\n * into `node_modules/.bin` cannot fall back to the registry under any package manager.\n */\nconst THEOKIT_BIN = './node_modules/.bin/theokit'\n\n/**\n * The top-level directory a configured path lives in. The runner copies whole roots: the scaffold's\n * `src/server` imports `src/shared`, so copying only `serverDir` would leave an import dangling.\n */\nfunction topLevelDir(path: string): string {\n return path.replace(/^\\.\\//, '').split('/')[0]\n}\n\nfunction generateDockerfile(input: DockerfileInput): string {\n const { pkgManager, distDir } = input\n const installCmd = {\n pnpm: 'RUN corepack enable && pnpm install --frozen-lockfile',\n npm: 'RUN npm ci',\n yarn: 'RUN yarn install --frozen-lockfile',\n }[pkgManager]\n\n const lockfile = {\n pnpm: 'pnpm-lock.yaml',\n npm: 'package-lock.json',\n yarn: 'yarn.lock',\n }[pkgManager]\n\n // pnpm 10 reads `allowBuilds` from pnpm-workspace.yaml; installing without it leaves esbuild unbuilt.\n const manifests = [\n 'package.json',\n lockfile,\n ...(pkgManager === 'pnpm' && input.hasPnpmWorkspace ? ['pnpm-workspace.yaml'] : []),\n ]\n\n const copySources = [...new Set(input.sourceRoots)].map(\n (root) => `COPY --from=builder /app/${root} ./${root}`,\n )\n\n return [\n '# Generated by TheoKit',\n '# Multi-stage build for production',\n '',\n '# Stage 1: Build',\n 'FROM node:22-alpine AS builder',\n 'WORKDIR /app',\n `COPY ${manifests.join(' ')} ./`,\n installCmd,\n 'COPY . .',\n `RUN ${THEOKIT_BIN} build`,\n '',\n '# Stage 2: Production',\n 'FROM node:22-alpine AS runner',\n 'WORKDIR /app',\n 'ENV NODE_ENV=production',\n // Inside a container `localhost` answers nobody, the image's own health check included (#402).\n 'ENV HOST=0.0.0.0',\n 'ENV PORT=3000',\n `COPY --from=builder /app/${distDir} ./${distDir}`,\n ...copySources,\n ...(input.hasConfigFile ? ['COPY --from=builder /app/theo.config.ts ./theo.config.ts'] : []),\n ...manifests.map((file) => `COPY --from=builder /app/${file} ./${file}`),\n 'COPY --from=builder /app/node_modules ./node_modules',\n '',\n 'EXPOSE 3000',\n `CMD [\"${THEOKIT_BIN}\", \"start\"]`,\n '',\n ].join('\\n')\n}\n\n/**\n * `.theokit` is both the build output and the agent context (#1079). The context a person writes\n * (THEO.md, rules, personalities ...) goes into the image; local agent state such as memory and MCP\n * tokens stays out, and so does a stale local build, which the image rebuilds anyway.\n */\nfunction generateDockerignore(distDir = '.theokit'): string {\n return [\n 'node_modules',\n '.git',\n `${distDir}/*`,\n // A re-included directory brings its contents: Docker matches a pattern against every parent.\n ...AUTHORED_AGENT_CONTEXT.map((entry) => `!${distDir}/${entry}`),\n 'dist',\n '.env',\n '.env.*',\n '!.env.example',\n '*.log',\n '.DS_Store',\n '.vscode',\n '.idea',\n 'Dockerfile',\n '.dockerignore',\n '',\n ].join('\\n')\n}\n\nexport async function dockerCommand(options?: { force?: boolean }): Promise<void> {\n const cwd = process.cwd()\n const dockerfilePath = resolve(cwd, 'Dockerfile')\n const dockerignorePath = resolve(cwd, '.dockerignore')\n\n const pkgManager = detectPkgManager(cwd)\n const { serverDir, agentsDir, distDir } = await loadConfig(cwd)\n const dockerfile = generateDockerfile({\n pkgManager,\n sourceRoots: [topLevelDir(serverDir), topLevelDir(agentsDir)],\n distDir,\n hasConfigFile: existsSync(resolve(cwd, 'theo.config.ts')),\n hasPnpmWorkspace: existsSync(resolve(cwd, 'pnpm-workspace.yaml')),\n })\n\n // `wx` refuses an existing file in the same call that creates it. A separate exists check\n // followed by a write leaves a window, wider now that the config load sits between them.\n try {\n writeFileSync(dockerfilePath, dockerfile, { flag: options?.force ? 'w' : 'wx' })\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'EEXIST') throw err\n console.log('\\n ⚠ Dockerfile already exists. Use --force to overwrite.\\n')\n return\n }\n writeFileSync(dockerignorePath, generateDockerignore(distDir))\n\n console.log(`\\n ✓ Generated Dockerfile (${pkgManager})`)\n console.log(` ✓ Generated .dockerignore`)\n console.log(`\\n Next steps:`)\n console.log(` docker build -t my-app .`)\n console.log(` docker run -p 3000:3000 my-app\\n`)\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,YAAY,qBAAqB;AAC1C,SAAS,eAAe;AAKxB,SAAS,iBAAiB,KAAyB;AACjD,MAAI,WAAW,QAAQ,KAAK,gBAAgB,CAAC,EAAG,QAAO;AACvD,MAAI,WAAW,QAAQ,KAAK,WAAW,CAAC,EAAG,QAAO;AAClD,SAAO;AACT;AAmBA,IAAM,cAAc;AAMpB,SAAS,YAAY,MAAsB;AACzC,SAAO,KAAK,QAAQ,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AAC/C;AAEA,SAAS,mBAAmB,OAAgC;AAC1D,QAAM,EAAE,YAAY,QAAQ,IAAI;AAChC,QAAM,aAAa;AAAA,IACjB,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,EACR,EAAE,UAAU;AAEZ,QAAM,WAAW;AAAA,IACf,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,EACR,EAAE,UAAU;AAGZ,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,IACA,GAAI,eAAe,UAAU,MAAM,mBAAmB,CAAC,qBAAqB,IAAI,CAAC;AAAA,EACnF;AAEA,QAAM,cAAc,CAAC,GAAG,IAAI,IAAI,MAAM,WAAW,CAAC,EAAE;AAAA,IAClD,CAAC,SAAS,4BAA4B,IAAI,MAAM,IAAI;AAAA,EACtD;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,UAAU,KAAK,GAAG,CAAC;A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AAc,gBAAgB,YAAY,EAAE,MAAM,SAAS,QAAQ,MAAM,KAAK,CAAC;AAAA,EACjF,SAAS,KAAK;AACZ,QAAK,IAA8B,SAAS,SAAU,OAAM;AAC5D,YAAQ,IAAI,mEAA8D;AAC1E;AAAA,EACF;AACA,gBAAc,kBAAkB,qBAAqB,OAAO,CAAC;AAE7D,UAAQ,IAAI;AAAA,iCAA+B,UAAU,GAAG;AACxD,UAAQ,IAAI,kCAA6B;AACzC,UAAQ,IAAI;AAAA,cAAiB;AAC7B,UAAQ,IAAI,8BAA8B;AAC1C,UAAQ,IAAI;AAAA,CAAsC;AACpD;","names":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
detectProjectPackageManager
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-I2IDWM26.js";
|
|
6
6
|
import {
|
|
7
7
|
cronScanDirs,
|
|
8
8
|
isDiscoverableCronFile,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import "./chunk-Z7CJHDLS.js";
|
|
15
15
|
import {
|
|
16
16
|
loadConfig
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5UJRZC4J.js";
|
|
18
18
|
import "./chunk-3QPVEJ7D.js";
|
|
19
19
|
import "./chunk-O5JZ6ROY.js";
|
|
20
20
|
import "./chunk-PQWVT6JC.js";
|
|
@@ -1068,4 +1068,4 @@ export {
|
|
|
1068
1068
|
generate,
|
|
1069
1069
|
generateCommand
|
|
1070
1070
|
};
|
|
1071
|
-
//# sourceMappingURL=generate-
|
|
1071
|
+
//# sourceMappingURL=generate-DAVXE5RV.js.map
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-47MM2JUK.js";
|
|
6
6
|
import {
|
|
7
7
|
loadConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5UJRZC4J.js";
|
|
9
9
|
import "./chunk-3QPVEJ7D.js";
|
|
10
10
|
import "./chunk-O5JZ6ROY.js";
|
|
11
11
|
import "./chunk-PQWVT6JC.js";
|
|
@@ -103,4 +103,4 @@ export {
|
|
|
103
103
|
buildInfo,
|
|
104
104
|
infoCommand
|
|
105
105
|
};
|
|
106
|
-
//# sourceMappingURL=info-
|
|
106
|
+
//# sourceMappingURL=info-AYTNH6YT.js.map
|
|
@@ -3,7 +3,7 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
deepMerge,
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5UJRZC4J.js";
|
|
7
7
|
import "./chunk-3QPVEJ7D.js";
|
|
8
8
|
import "./chunk-O5JZ6ROY.js";
|
|
9
9
|
import "./chunk-PQWVT6JC.js";
|
|
@@ -13,4 +13,4 @@ export {
|
|
|
13
13
|
deepMerge,
|
|
14
14
|
loadConfig
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=load-config-
|
|
16
|
+
//# sourceMappingURL=load-config-YU5E76DL.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
createAgentSsrLoader
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SEDZI7JF.js";
|
|
6
6
|
import {
|
|
7
7
|
extractAppResources,
|
|
8
8
|
handleMcpJsonRpc
|
|
@@ -47,7 +47,7 @@ async function serveMcpStdio(mod, name, appResources, streams) {
|
|
|
47
47
|
// src/cli/commands/mcp.ts
|
|
48
48
|
async function mcpCommand(name, deps = {}) {
|
|
49
49
|
const projectRoot = deps.projectRoot ?? process.cwd();
|
|
50
|
-
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-
|
|
50
|
+
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-YU5E76DL.js")).loadConfig(projectRoot)).agentsDir;
|
|
51
51
|
const agent = scanAgents(projectRoot, agentsDir).find((a) => a.name === name);
|
|
52
52
|
if (!agent) {
|
|
53
53
|
const names = scanAgents(projectRoot, agentsDir).map((a) => a.name).join(", ");
|
|
@@ -76,4 +76,4 @@ async function mcpCommand(name, deps = {}) {
|
|
|
76
76
|
export {
|
|
77
77
|
mcpCommand
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=mcp-
|
|
79
|
+
//# sourceMappingURL=mcp-H3TNO6YV.js.map
|