create-flamecast 0.1.1-alpha.1620e30
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/index.d.ts +2 -0
- package/dist/index.js +36 -0
- package/package.json +22 -0
- package/template/.env.example +1 -0
- package/template/package.json +23 -0
- package/template/src/index.ts +32 -0
- package/template/tsconfig.json +12 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { mkdirSync, cpSync, writeFileSync, readFileSync } from "node:fs";
|
|
3
|
+
import { resolve, join, basename } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import prompts from "prompts";
|
|
6
|
+
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
7
|
+
const templateDir = resolve(__dirname, "../template");
|
|
8
|
+
async function main() {
|
|
9
|
+
const targetDir = process.argv[2];
|
|
10
|
+
const response = await prompts([
|
|
11
|
+
{
|
|
12
|
+
type: targetDir ? null : "text",
|
|
13
|
+
name: "projectName",
|
|
14
|
+
message: "Project name:",
|
|
15
|
+
initial: "my-flamecast-server",
|
|
16
|
+
},
|
|
17
|
+
], { onCancel: () => process.exit(1) });
|
|
18
|
+
const projectName = targetDir ?? response.projectName;
|
|
19
|
+
const root = resolve(process.cwd(), projectName);
|
|
20
|
+
console.log(`\nScaffolding Flamecast server in ${root}...\n`);
|
|
21
|
+
mkdirSync(root, { recursive: true });
|
|
22
|
+
cpSync(templateDir, root, { recursive: true });
|
|
23
|
+
// Update package.json name
|
|
24
|
+
const pkgPath = join(root, "package.json");
|
|
25
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
26
|
+
pkg.name = basename(projectName);
|
|
27
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
28
|
+
console.log("Done! Now run:\n");
|
|
29
|
+
console.log(` cd ${projectName}`);
|
|
30
|
+
console.log(" npm install");
|
|
31
|
+
console.log(" npm run dev\n");
|
|
32
|
+
}
|
|
33
|
+
main().catch((err) => {
|
|
34
|
+
console.error(err);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-flamecast",
|
|
3
|
+
"version": "0.1.1-alpha.1620e30",
|
|
4
|
+
"bin": {
|
|
5
|
+
"create-flamecast": "./dist/index.js"
|
|
6
|
+
},
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"template"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"prompts": "^2.4.2"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/prompts": "^2.4.9"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"build:package": "tsc"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# DATABASE_URL=postgresql://localhost:5432/flamecast
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "flamecast-server",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"db:migrate": "flamecast db migrate",
|
|
7
|
+
"db:status": "flamecast db status",
|
|
8
|
+
"db:studio": "flamecast db studio",
|
|
9
|
+
"dev": "tsx watch src/index.ts",
|
|
10
|
+
"start": "tsx src/index.ts"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@agentclientprotocol/sdk": "^0.16.1",
|
|
14
|
+
"@flamecast/sdk": "latest",
|
|
15
|
+
"@flamecast/storage-psql": "latest",
|
|
16
|
+
"dotenv": "^17.3.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^20.11.17",
|
|
20
|
+
"tsx": "^4.7.1",
|
|
21
|
+
"typescript": "^5.8.3"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Flamecast, NodeRuntime, listen } from "@flamecast/sdk";
|
|
2
|
+
import { createPsqlStorage } from "@flamecast/storage-psql";
|
|
3
|
+
import dotenv from "dotenv";
|
|
4
|
+
|
|
5
|
+
dotenv.config();
|
|
6
|
+
const storage = await createPsqlStorage();
|
|
7
|
+
|
|
8
|
+
const flamecast = new Flamecast({
|
|
9
|
+
storage,
|
|
10
|
+
runtimes: {
|
|
11
|
+
default: new NodeRuntime(),
|
|
12
|
+
},
|
|
13
|
+
agentTemplates: [
|
|
14
|
+
{
|
|
15
|
+
id: "echo-agent",
|
|
16
|
+
name: "Echo Agent",
|
|
17
|
+
spawn: { command: "npx", args: ["tsx", "agent.ts"] },
|
|
18
|
+
runtime: { provider: "default" },
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
listen(flamecast, { port: 3001 }, (info) => {
|
|
24
|
+
console.log(`Flamecast running on http://localhost:${info.port}`);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
process.on("SIGINT", () => {
|
|
28
|
+
flamecast.close().then(() => process.exit(0));
|
|
29
|
+
});
|
|
30
|
+
process.on("SIGTERM", () => {
|
|
31
|
+
flamecast.close().then(() => process.exit(0));
|
|
32
|
+
});
|