Skip to content

Commit 87d8a71

Browse files
committed
cli loads in client
1 parent b72b518 commit 87d8a71

File tree

7 files changed

+24
-35
lines changed

7 files changed

+24
-35
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,6 @@ packages/*/dist/*
9191
**/.docusaurus/**
9292
**/docs/build/**
9393

94-
**lock**
94+
**lock**
95+
96+
lerna-debug.log

lerna.json

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
{
2-
"version": "1.0.0-alpha.3",
3-
"packages": [
4-
"packages/*"
5-
],
6-
"npmClient": "bun",
7-
"command": {
8-
"publish": {
9-
"ignoreChanges": [
10-
"packages/docs",
11-
"packages/client"
12-
]
13-
}
14-
}
15-
}
2+
"version": "1.0.0-alpha.3",
3+
"packages": ["packages/*"],
4+
"npmClient": "bun",
5+
"command": {
6+
"publish": {
7+
"ignoreChanges": ["packages/docs", "packages/client"]
8+
}
9+
}
10+
}

packages/cli/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
"@babel/parser": "^7.22.6",
4343
"@babel/plugin-transform-typescript": "^7.22.5",
4444
"@elizaos/core": "workspace:*",
45-
"@elizaos/plugin-sql": "*:workspace",
46-
"@elizaos/client": "*:workspace",
47-
"@elizaos/plugin-starter": "*:workspace",
48-
"@elizaos/project-starter": "*:workspace",
45+
"@elizaos/plugin-sql": "workspace:*",
46+
"@elizaos/client": "workspace:*",
47+
"@elizaos/plugin-starter": "workspace:*",
48+
"@elizaos/project-starter": "workspace:*",
4949
"@noble/curves": "^1.8.1",
5050
"axios": "^1.7.9",
5151
"chalk": "5.2.0",

packages/cli/src/server/api/index.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ export function createApiRouter(
3636
limit: getEnvVariable("EXPRESS_MAX_PAYLOAD") || "100kb",
3737
}),
3838
);
39-
40-
// Base routes
41-
router.get("/", (_req, res) => {
42-
res.send("Welcome, this is the REST API!");
43-
});
44-
39+
4540
router.get("/hello", (_req, res) => {
4641
res.json({ message: "Hello World!" });
4742
});

packages/cli/src/server/index.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,9 @@ export class AgentServer {
102102

103103
// Serve client application
104104
// First try to find it in the CLI package dist/client directory
105-
let clientPath = path.join(__dirname, "../client");
105+
const clientPath = path.join(__dirname, "./client");
106106

107-
// If not found, fall back to the old relative path for development
108-
if (!fs.existsSync(clientPath)) {
109-
clientPath = path.join(__dirname, "../../..", "packages/client/dist");
110-
}
107+
console.log("clientPath", clientPath);
111108

112109
if (fs.existsSync(clientPath)) {
113110
logger.debug(
@@ -132,10 +129,10 @@ export class AgentServer {
132129
this.app.use(express.static(clientPath, staticOptions));
133130

134131
// Serve the same files at /client path for consistency
135-
this.app.use("/client", express.static(clientPath, staticOptions));
132+
this.app.use("/", express.static(clientPath, staticOptions));
136133

137134
// Serve index.html for client root path
138-
this.app.get("/client", (_req, res) => {
135+
this.app.get("/", (_req, res) => {
139136
res.setHeader("Content-Type", "text/html");
140137
res.sendFile(path.join(clientPath, "index.html"));
141138
});

packages/cli/src/utils/copy-template.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ export async function copyClientDist() {
132132
logger.info("Copying client dist files to CLI package");
133133

134134
// Determine source and destination paths
135-
const srcClientDist = path.resolve(process.cwd(), "packages/client/dist");
135+
const srcClientDist = path.resolve(process.cwd(), "../client/dist");
136136
const destClientDist = path.resolve(
137137
process.cwd(),
138-
"packages/cli/dist/client",
138+
"./dist/client",
139139
);
140140

141141
// Create destination directory

packages/client/src/lib/info.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "version": "1.0.0-alpha.3" }
1+
{"version": "1.0.0-alpha.3"}

0 commit comments

Comments
 (0)