@clawos-dev/clawd 0.2.112-beta.220.a78f1c0 → 0.2.112-beta.222.19584a4
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/cli.cjs +1157 -1264
- package/package.json +1 -1
- package/dist/persona-defaults/persona-app-builder/CLAUDE.md +0 -168
- package/dist/persona-defaults/persona-app-builder/extension-kit/README.md +0 -96
- package/dist/persona-defaults/persona-app-builder/extension-kit/config.env +0 -20
- package/dist/persona-defaults/persona-app-builder/extension-kit/contract/bootstrap +0 -22
- package/dist/persona-defaults/persona-app-builder/extension-kit/contract/s.yaml.tmpl +0 -54
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/.env.example +0 -3
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/.fcignore +0 -7
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/nest-cli.json +0 -8
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/package-lock.json +0 -4531
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/package.json +0 -28
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/app.module.ts +0 -10
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/main.ts +0 -49
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/messages/messages.controller.ts +0 -27
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/messages/messages.module.ts +0 -9
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/messages/messages.service.ts +0 -38
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/polyfill.ts +0 -8
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/tsconfig.json +0 -14
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/index.html +0 -12
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/package-lock.json +0 -1680
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/package.json +0 -18
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/src/App.jsx +0 -161
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/src/main.jsx +0 -5
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/vite.config.js +0 -30
- package/dist/persona-defaults/persona-app-builder/extension-kit/scripts/new-extension.sh +0 -49
- package/dist/persona-defaults/persona-app-builder/extension-kit/scripts/publish.sh +0 -78
- package/dist/persona-defaults/persona-app-builder/extension-kit/scripts/remove-extension.sh +0 -57
- package/dist/persona-defaults/persona-app-builder/extension-kit/scripts/verify.sh +0 -20
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "guestbook-server",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "nest build",
|
|
7
|
-
"start": "node --env-file=.env dist/main.js",
|
|
8
|
-
"start:dev": "nest start --watch",
|
|
9
|
-
"dev": "nest start --watch"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@nestjs/common": "^10.4.0",
|
|
13
|
-
"@nestjs/core": "^10.4.0",
|
|
14
|
-
"@nestjs/platform-express": "^10.4.0",
|
|
15
|
-
"@supabase/supabase-js": "^2.45.0",
|
|
16
|
-
"reflect-metadata": "^0.2.2",
|
|
17
|
-
"rxjs": "^7.8.1",
|
|
18
|
-
"ws": "^8.18.0"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@nestjs/cli": "^10.4.0",
|
|
22
|
-
"@nestjs/schematics": "^10.2.0",
|
|
23
|
-
"@types/node": "^22.0.0",
|
|
24
|
-
"@vitejs/plugin-react": "^4.3.0",
|
|
25
|
-
"typescript": "^5.5.0",
|
|
26
|
-
"vite": "^5.4.0"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { MessagesModule } from './messages/messages.module';
|
|
3
|
-
|
|
4
|
-
// dev 模式:main.ts mount vite middleware 处理非 /api 路径(含 HMR);
|
|
5
|
-
// prod 模式:main.ts express.static serve build 后的 web/dist。
|
|
6
|
-
// 两种模式都不用 ServeStaticModule(vite middleware 跟它会撞),就近在 main.ts 处理。
|
|
7
|
-
@Module({
|
|
8
|
-
imports: [MessagesModule],
|
|
9
|
-
})
|
|
10
|
-
export class AppModule {}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import './polyfill';
|
|
2
|
-
import { NestFactory } from '@nestjs/core';
|
|
3
|
-
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
4
|
-
import { AppModule } from './app.module';
|
|
5
|
-
import * as path from 'node:path';
|
|
6
|
-
|
|
7
|
-
// app-builder build 模式(spec 2026-06-01):
|
|
8
|
-
// - dev:nest 单进程 mount vite middleware,前端 HMR + /api 都从 CLAWD_PREVIEW_PORT 出
|
|
9
|
-
// - prod:nest 起来时 express.static serve build 后的 web/dist
|
|
10
|
-
// CLAWD_PREVIEW_PORT 由 daemon supervisor 启动时注入;FC_SERVER_PORT / PORT 是 FC 部署 / 本地脱离 clawd 调试的回退。
|
|
11
|
-
async function bootstrap() {
|
|
12
|
-
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
|
13
|
-
app.setGlobalPrefix('api', { exclude: ['/'] });
|
|
14
|
-
|
|
15
|
-
const isDev = process.env.NODE_ENV !== 'production';
|
|
16
|
-
const isClawdDev = !!process.env.CLAWD_PREVIEW_PORT;
|
|
17
|
-
const port =
|
|
18
|
-
Number(process.env.CLAWD_PREVIEW_PORT) ||
|
|
19
|
-
Number(process.env.FC_SERVER_PORT) ||
|
|
20
|
-
Number(process.env.PORT) ||
|
|
21
|
-
3000;
|
|
22
|
-
|
|
23
|
-
if (isDev && isClawdDev) {
|
|
24
|
-
// dev 模式 + 通过 clawd 启的 → mount vite middleware,root=../../web
|
|
25
|
-
const { createServer: createViteServer } = await import('vite');
|
|
26
|
-
const viteRoot = path.resolve(__dirname, '..', '..', 'web');
|
|
27
|
-
const vite = await createViteServer({
|
|
28
|
-
root: viteRoot,
|
|
29
|
-
server: {
|
|
30
|
-
middlewareMode: true,
|
|
31
|
-
// HMR WS 复用 nest 的 http.Server —— 跟 HTTP 共享同一个 fd / 同一个端口。
|
|
32
|
-
// 不设这个 vite 会 fallback standalone 用 24678,多 project 并发会撞。
|
|
33
|
-
hmr: { server: app.getHttpServer() },
|
|
34
|
-
},
|
|
35
|
-
appType: 'custom',
|
|
36
|
-
});
|
|
37
|
-
app.use(vite.middlewares);
|
|
38
|
-
console.log(`[clawd-dev] vite middleware mounted (root=${viteRoot})`);
|
|
39
|
-
} else {
|
|
40
|
-
// prod / 脱离 clawd 跑:直接 serve web/dist 静态资源(build 时拷贝过来)
|
|
41
|
-
const staticDir = path.resolve(__dirname, '..', '..', 'web', 'dist');
|
|
42
|
-
app.useStaticAssets(staticDir);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
await app.listen(port, '0.0.0.0');
|
|
46
|
-
console.log(`server listening on :${port} (${isDev ? 'dev' : 'prod'}${isClawdDev ? ' / clawd' : ''})`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
bootstrap();
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BadRequestException,
|
|
3
|
-
Body,
|
|
4
|
-
Controller,
|
|
5
|
-
Get,
|
|
6
|
-
Post,
|
|
7
|
-
} from '@nestjs/common';
|
|
8
|
-
import { MessagesService } from './messages.service';
|
|
9
|
-
|
|
10
|
-
@Controller('messages')
|
|
11
|
-
export class MessagesController {
|
|
12
|
-
constructor(private readonly messages: MessagesService) {}
|
|
13
|
-
|
|
14
|
-
@Get()
|
|
15
|
-
list() {
|
|
16
|
-
return this.messages.list();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Post()
|
|
20
|
-
create(@Body() body: { name?: string; content?: string }) {
|
|
21
|
-
const content = body?.content?.trim();
|
|
22
|
-
if (!content) {
|
|
23
|
-
throw new BadRequestException('content 不能为空');
|
|
24
|
-
}
|
|
25
|
-
return this.messages.create(body.name?.trim() ?? '', content);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { MessagesController } from './messages.controller';
|
|
3
|
-
import { MessagesService } from './messages.service';
|
|
4
|
-
|
|
5
|
-
@Module({
|
|
6
|
-
controllers: [MessagesController],
|
|
7
|
-
providers: [MessagesService],
|
|
8
|
-
})
|
|
9
|
-
export class MessagesModule {}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { createClient, SupabaseClient } from '@supabase/supabase-js';
|
|
3
|
-
|
|
4
|
-
const TABLE = 'guestbook_messages';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class MessagesService {
|
|
8
|
-
private readonly supabase: SupabaseClient;
|
|
9
|
-
|
|
10
|
-
constructor() {
|
|
11
|
-
const url = process.env.SUPABASE_URL;
|
|
12
|
-
const key = process.env.SUPABASE_KEY;
|
|
13
|
-
if (!url || !key) {
|
|
14
|
-
throw new Error('SUPABASE_URL / SUPABASE_KEY 未配置,请检查环境变量');
|
|
15
|
-
}
|
|
16
|
-
this.supabase = createClient(url, key);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async list() {
|
|
20
|
-
const { data, error } = await this.supabase
|
|
21
|
-
.from(TABLE)
|
|
22
|
-
.select('*')
|
|
23
|
-
.order('created_at', { ascending: false })
|
|
24
|
-
.limit(100);
|
|
25
|
-
if (error) throw new Error(`读取留言失败: ${error.message}`);
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async create(name: string, content: string) {
|
|
30
|
-
const { data, error } = await this.supabase
|
|
31
|
-
.from(TABLE)
|
|
32
|
-
.insert({ name: name || 'anonymous', content })
|
|
33
|
-
.select()
|
|
34
|
-
.single();
|
|
35
|
-
if (error) throw new Error(`写入留言失败: ${error.message}`);
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Node < 22 没有原生 WebSocket,而 @supabase/supabase-js 的 realtime 客户端
|
|
2
|
-
// 初始化时需要它。在应用启动前补一个全局 WebSocket,使任意 Node 版本
|
|
3
|
-
// (FC 运行时给的 node 可能是 18/20)下都能正常 createClient。
|
|
4
|
-
// 注意:不要用 `WebSocket` 作为局部变量名,会与 DOM lib 的全局类型重声明冲突。
|
|
5
|
-
const WsCtor = require('ws');
|
|
6
|
-
if (!(globalThis as any).WebSocket) {
|
|
7
|
-
(globalThis as any).WebSocket = WsCtor;
|
|
8
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"target": "ES2021",
|
|
5
|
-
"outDir": "./dist",
|
|
6
|
-
"rootDir": "./src",
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"emitDecoratorMetadata": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"sourceMap": false,
|
|
12
|
-
"declaration": false
|
|
13
|
-
}
|
|
14
|
-
}
|
package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/index.html
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="zh">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>留言板 · 全链路测试</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<div id="root"></div>
|
|
10
|
-
<script type="module" src="/src/main.jsx"></script>
|
|
11
|
-
</body>
|
|
12
|
-
</html>
|