@tellet/create 0.9.0 → 0.12.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/README.md +151 -135
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +54 -0
- package/dist/commands/agent.d.ts +1 -0
- package/dist/commands/agent.js +156 -0
- package/dist/commands/build.d.ts +1 -0
- package/dist/commands/build.js +14 -0
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.js +117 -0
- package/dist/commands/dev.d.ts +1 -0
- package/dist/commands/dev.js +15 -0
- package/dist/commands/mcp.d.ts +1 -0
- package/dist/commands/mcp.js +4 -0
- package/dist/commands/shared.d.ts +69 -0
- package/dist/commands/shared.js +73 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +53 -0
- package/dist/index.js +8 -336
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +25 -0
- package/dist/mcp/tools.d.ts +2 -0
- package/dist/mcp/tools.js +264 -0
- package/dist/scaffold/project.js +1 -1
- package/dist/scaffold-flow.d.ts +1 -0
- package/dist/scaffold-flow.js +402 -0
- package/dist/setup/deps.d.ts +4 -0
- package/dist/setup/deps.js +24 -0
- package/dist/setup/env.d.ts +12 -0
- package/dist/setup/env.js +26 -0
- package/dist/setup/supabase.d.ts +36 -0
- package/dist/setup/supabase.js +207 -0
- package/package.json +5 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { spawnSync } from "child_process";
|
|
2
|
+
import * as p from "@clack/prompts";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { loadConfigOrExit } from "./shared.js";
|
|
5
|
+
export default async function deploy(_args) {
|
|
6
|
+
const config = await loadConfigOrExit();
|
|
7
|
+
console.log();
|
|
8
|
+
console.log(chalk.bold(` ${chalk.white("tel")}${chalk.yellow("let")} ${chalk.dim("deploy")} — ${config.company.name}`));
|
|
9
|
+
console.log();
|
|
10
|
+
// Detect tier from project structure
|
|
11
|
+
const fs = await import("fs-extra");
|
|
12
|
+
const path = await import("path");
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
const hasInfra = await fs.default.pathExists(path.default.join(cwd, "infra"));
|
|
15
|
+
const hasDockerCompose = await fs.default.pathExists(path.default.join(cwd, "docker-compose.yml"));
|
|
16
|
+
const hasRailwayToml = await fs.default.pathExists(path.default.join(cwd, "railway.toml"));
|
|
17
|
+
const targets = [];
|
|
18
|
+
targets.push({
|
|
19
|
+
value: "vercel",
|
|
20
|
+
label: "Vercel",
|
|
21
|
+
hint: "Recommended for Quick Start — free, instant",
|
|
22
|
+
});
|
|
23
|
+
if (hasRailwayToml || hasDockerCompose) {
|
|
24
|
+
targets.push({
|
|
25
|
+
value: "railway",
|
|
26
|
+
label: "Railway",
|
|
27
|
+
hint: "Docker-based, $5-20/mo",
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (hasDockerCompose) {
|
|
31
|
+
targets.push({
|
|
32
|
+
value: "docker",
|
|
33
|
+
label: "Docker (manual)",
|
|
34
|
+
hint: "Any Docker host — Render, Fly.io, etc.",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (hasInfra) {
|
|
38
|
+
targets.push({
|
|
39
|
+
value: "aws",
|
|
40
|
+
label: "AWS CDK",
|
|
41
|
+
hint: "Lambda + RDS + CloudFront",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const choice = await p.select({
|
|
45
|
+
message: "Deploy target:",
|
|
46
|
+
options: targets,
|
|
47
|
+
});
|
|
48
|
+
if (p.isCancel(choice)) {
|
|
49
|
+
p.cancel("Cancelled.");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const target = choice;
|
|
53
|
+
switch (target) {
|
|
54
|
+
case "vercel":
|
|
55
|
+
return deployVercel();
|
|
56
|
+
case "railway":
|
|
57
|
+
return deployRailway();
|
|
58
|
+
case "docker":
|
|
59
|
+
return deployDocker();
|
|
60
|
+
case "aws":
|
|
61
|
+
return deployAws(cwd);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function deployVercel() {
|
|
65
|
+
console.log(chalk.dim(" Launching Vercel deploy..."));
|
|
66
|
+
console.log();
|
|
67
|
+
const result = spawnSync("npx", ["vercel"], {
|
|
68
|
+
cwd: process.cwd(),
|
|
69
|
+
stdio: "inherit",
|
|
70
|
+
});
|
|
71
|
+
if (result.status !== 0) {
|
|
72
|
+
console.log();
|
|
73
|
+
console.log(chalk.dim(" If Vercel CLI is not installed:"));
|
|
74
|
+
console.log(chalk.cyan(" npm i -g vercel && vercel"));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function deployRailway() {
|
|
78
|
+
console.log();
|
|
79
|
+
console.log(chalk.bold(" Railway deployment:"));
|
|
80
|
+
console.log();
|
|
81
|
+
console.log(` ${chalk.dim("1.")} ${chalk.cyan("railway login")}`);
|
|
82
|
+
console.log(` ${chalk.dim("2.")} ${chalk.cyan("railway init")}`);
|
|
83
|
+
console.log(` ${chalk.dim("3.")} ${chalk.cyan("railway add --plugin postgresql")}`);
|
|
84
|
+
console.log(` ${chalk.dim("4.")} ${chalk.cyan("railway up")}`);
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(chalk.dim(" Set environment variables in Railway dashboard after deploy."));
|
|
87
|
+
console.log();
|
|
88
|
+
}
|
|
89
|
+
function deployDocker() {
|
|
90
|
+
console.log();
|
|
91
|
+
console.log(chalk.bold(" Docker deployment:"));
|
|
92
|
+
console.log();
|
|
93
|
+
console.log(` ${chalk.dim("Build:")} ${chalk.cyan("docker build -t tellet .")}`);
|
|
94
|
+
console.log(` ${chalk.dim("Run:")} ${chalk.cyan("docker compose up -d")}`);
|
|
95
|
+
console.log();
|
|
96
|
+
console.log(chalk.dim(" Works with Render, Fly.io, DigitalOcean, or any Docker host."));
|
|
97
|
+
console.log();
|
|
98
|
+
console.log(chalk.bold(" Fly.io:"));
|
|
99
|
+
console.log(` ${chalk.cyan(" fly launch && fly deploy")}`);
|
|
100
|
+
console.log();
|
|
101
|
+
console.log(chalk.bold(" Render:"));
|
|
102
|
+
console.log(chalk.dim(" Connect your GitHub repo at render.com → New Web Service → Docker"));
|
|
103
|
+
console.log();
|
|
104
|
+
}
|
|
105
|
+
function deployAws(cwd) {
|
|
106
|
+
console.log();
|
|
107
|
+
console.log(chalk.bold(" AWS CDK deployment:"));
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(` ${chalk.cyan("cd infra")}`);
|
|
110
|
+
console.log(` ${chalk.cyan("npm install")}`);
|
|
111
|
+
console.log(` ${chalk.cyan("npx cdk bootstrap")} ${chalk.dim("(first time only)")}`);
|
|
112
|
+
console.log(` ${chalk.cyan("npx cdk deploy")}`);
|
|
113
|
+
console.log();
|
|
114
|
+
console.log(chalk.dim(" CloudFront URL will be in the output."));
|
|
115
|
+
console.log(chalk.dim(" API keys are stored in AWS Secrets Manager."));
|
|
116
|
+
console.log();
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function dev(_args: string[]): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { spawnSync } from "child_process";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { loadConfigOrExit } from "./shared.js";
|
|
4
|
+
export default async function dev(_args) {
|
|
5
|
+
const config = await loadConfigOrExit();
|
|
6
|
+
console.log();
|
|
7
|
+
console.log(chalk.bold(` ${chalk.white("tel")}${chalk.yellow("let")} ${chalk.dim("dev")} — ${config.company.name}`));
|
|
8
|
+
console.log(chalk.dim(` ${config.agents.length} agents · ${config.llm.provider} · ${config.storage}`));
|
|
9
|
+
console.log();
|
|
10
|
+
const result = spawnSync("npx", ["next", "dev"], {
|
|
11
|
+
cwd: process.cwd(),
|
|
12
|
+
stdio: "inherit",
|
|
13
|
+
});
|
|
14
|
+
process.exit(result.status ?? 1);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function mcp(_args: string[]): Promise<void>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface TelletConfig {
|
|
2
|
+
version: string;
|
|
3
|
+
company: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
industry: string;
|
|
7
|
+
};
|
|
8
|
+
engine: string;
|
|
9
|
+
llm: {
|
|
10
|
+
provider: string;
|
|
11
|
+
defaultModel: string;
|
|
12
|
+
fallback: string | null;
|
|
13
|
+
};
|
|
14
|
+
agents: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
role: string;
|
|
18
|
+
model: string;
|
|
19
|
+
channels: string[];
|
|
20
|
+
tools: string[];
|
|
21
|
+
}[];
|
|
22
|
+
tools: Record<string, {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}>;
|
|
26
|
+
channels: Record<string, {
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
mode: string;
|
|
30
|
+
storage: string;
|
|
31
|
+
integrations: string[];
|
|
32
|
+
websiteUrl?: string;
|
|
33
|
+
site?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Load tellet.json from CWD. Throws if not found.
|
|
37
|
+
*/
|
|
38
|
+
export declare function loadConfig(): Promise<TelletConfig>;
|
|
39
|
+
/**
|
|
40
|
+
* Load tellet.json from CWD with pretty error + exit (for CLI commands only).
|
|
41
|
+
*/
|
|
42
|
+
export declare function loadConfigOrExit(): Promise<TelletConfig>;
|
|
43
|
+
/**
|
|
44
|
+
* Save tellet.json back to CWD.
|
|
45
|
+
*/
|
|
46
|
+
export declare function saveConfig(config: TelletConfig): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Normalize a display name to a safe identifier.
|
|
49
|
+
* Returns empty string if input has no alphanumeric characters.
|
|
50
|
+
*/
|
|
51
|
+
export declare function nameToId(name: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Generate an agent .ts file with properly escaped values.
|
|
54
|
+
*/
|
|
55
|
+
export declare function generateAgentFile(agent: {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
role: string;
|
|
59
|
+
model: string;
|
|
60
|
+
systemPrompt: string;
|
|
61
|
+
}): string;
|
|
62
|
+
/**
|
|
63
|
+
* Rewrite agents/index.ts registry to match config.
|
|
64
|
+
*/
|
|
65
|
+
export declare function updateAgentRegistry(config: {
|
|
66
|
+
agents: {
|
|
67
|
+
id: string;
|
|
68
|
+
}[];
|
|
69
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
/**
|
|
5
|
+
* Load tellet.json from CWD. Throws if not found.
|
|
6
|
+
*/
|
|
7
|
+
export async function loadConfig() {
|
|
8
|
+
const configPath = path.resolve(process.cwd(), "tellet.json");
|
|
9
|
+
if (!(await fs.pathExists(configPath))) {
|
|
10
|
+
throw new Error("No tellet.json found in current directory.");
|
|
11
|
+
}
|
|
12
|
+
return fs.readJSON(configPath);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Load tellet.json from CWD with pretty error + exit (for CLI commands only).
|
|
16
|
+
*/
|
|
17
|
+
export async function loadConfigOrExit() {
|
|
18
|
+
try {
|
|
19
|
+
return await loadConfig();
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
console.error(chalk.red(" No tellet.json found in current directory.\n") +
|
|
23
|
+
chalk.dim(" Run this command from inside a tellet project, or create one:\n") +
|
|
24
|
+
chalk.cyan(" npx @tellet/create"));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Save tellet.json back to CWD.
|
|
30
|
+
*/
|
|
31
|
+
export async function saveConfig(config) {
|
|
32
|
+
const configPath = path.resolve(process.cwd(), "tellet.json");
|
|
33
|
+
await fs.writeJSON(configPath, config, { spaces: 2 });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalize a display name to a safe identifier.
|
|
37
|
+
* Returns empty string if input has no alphanumeric characters.
|
|
38
|
+
*/
|
|
39
|
+
export function nameToId(name) {
|
|
40
|
+
return name
|
|
41
|
+
.toLowerCase()
|
|
42
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
43
|
+
.replace(/^_|_$/g, "");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generate an agent .ts file with properly escaped values.
|
|
47
|
+
*/
|
|
48
|
+
export function generateAgentFile(agent) {
|
|
49
|
+
return `import { defineAgent } from "@/lib/engine";
|
|
50
|
+
|
|
51
|
+
export default defineAgent({
|
|
52
|
+
id: ${JSON.stringify(agent.id)},
|
|
53
|
+
name: ${JSON.stringify(agent.name)},
|
|
54
|
+
role: ${JSON.stringify(agent.role)},
|
|
55
|
+
model: ${JSON.stringify(agent.model)},
|
|
56
|
+
systemPrompt: ${JSON.stringify(agent.systemPrompt)},
|
|
57
|
+
channels: ["web_chat"],
|
|
58
|
+
tools: [],
|
|
59
|
+
});
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Rewrite agents/index.ts registry to match config.
|
|
64
|
+
*/
|
|
65
|
+
export async function updateAgentRegistry(config) {
|
|
66
|
+
const agentsDir = path.resolve(process.cwd(), "agents");
|
|
67
|
+
const indexPath = path.join(agentsDir, "index.ts");
|
|
68
|
+
const imports = config.agents
|
|
69
|
+
.map((a) => `import ${a.id} from "./${a.id}.js";`)
|
|
70
|
+
.join("\n");
|
|
71
|
+
const exports = config.agents.map((a) => ` ${a.id}`).join(",\n");
|
|
72
|
+
await fs.writeFile(indexPath, `${imports}\n\nexport const agents = {\n${exports},\n};\n`);
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function status(_args: string[]): Promise<void>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { loadConfigOrExit } from "./shared.js";
|
|
5
|
+
export default async function status(_args) {
|
|
6
|
+
const config = await loadConfigOrExit();
|
|
7
|
+
console.log();
|
|
8
|
+
console.log(chalk.bold(` ${chalk.white("tel")}${chalk.yellow("let")} ${chalk.dim("status")}`));
|
|
9
|
+
console.log();
|
|
10
|
+
// Company
|
|
11
|
+
console.log(chalk.bold(" Company"));
|
|
12
|
+
console.log(` Name: ${chalk.white(config.company.name)}`);
|
|
13
|
+
console.log(` Industry: ${chalk.dim(config.company.industry)}`);
|
|
14
|
+
console.log(` Mode: ${chalk.dim(config.mode)}`);
|
|
15
|
+
console.log();
|
|
16
|
+
// LLM
|
|
17
|
+
console.log(chalk.bold(" LLM"));
|
|
18
|
+
console.log(` Provider: ${chalk.white(config.llm.provider)}`);
|
|
19
|
+
console.log(` Model: ${chalk.dim(config.llm.defaultModel)}`);
|
|
20
|
+
console.log();
|
|
21
|
+
// Agents
|
|
22
|
+
console.log(chalk.bold(` Agents (${config.agents.length})`));
|
|
23
|
+
for (const agent of config.agents) {
|
|
24
|
+
const tools = agent.tools.length > 0 ? chalk.dim(` [${agent.tools.join(", ")}]`) : "";
|
|
25
|
+
console.log(` ${chalk.hex("#8b5cf6")(agent.name)} ${chalk.dim(`(${agent.role})`)}${tools}`);
|
|
26
|
+
}
|
|
27
|
+
console.log();
|
|
28
|
+
// Channels
|
|
29
|
+
const enabledChannels = Object.entries(config.channels)
|
|
30
|
+
.filter(([, v]) => v.enabled)
|
|
31
|
+
.map(([k]) => k);
|
|
32
|
+
const disabledChannels = Object.entries(config.channels)
|
|
33
|
+
.filter(([, v]) => !v.enabled)
|
|
34
|
+
.map(([k]) => k);
|
|
35
|
+
console.log(chalk.bold(" Channels"));
|
|
36
|
+
if (enabledChannels.length > 0) {
|
|
37
|
+
console.log(` Enabled: ${chalk.green(enabledChannels.join(", "))}`);
|
|
38
|
+
}
|
|
39
|
+
if (disabledChannels.length > 0) {
|
|
40
|
+
console.log(` Disabled: ${chalk.dim(disabledChannels.join(", "))}`);
|
|
41
|
+
}
|
|
42
|
+
console.log();
|
|
43
|
+
// Environment check
|
|
44
|
+
console.log(chalk.bold(" Environment"));
|
|
45
|
+
const envPath = path.resolve(process.cwd(), ".env.local");
|
|
46
|
+
const envExists = await fs.pathExists(envPath);
|
|
47
|
+
console.log(` .env.local: ${envExists ? chalk.green("found") : chalk.red("missing")}`);
|
|
48
|
+
const nodeModules = await fs.pathExists(path.resolve(process.cwd(), "node_modules"));
|
|
49
|
+
console.log(` node_modules: ${nodeModules ? chalk.green("installed") : chalk.yellow("not installed — run npm install")}`);
|
|
50
|
+
const hasPackageLock = await fs.pathExists(path.resolve(process.cwd(), "package-lock.json"));
|
|
51
|
+
console.log(` lock file: ${hasPackageLock ? chalk.green("found") : chalk.dim("none")}`);
|
|
52
|
+
console.log();
|
|
53
|
+
}
|