@kmlckj/licos-ai-cli 0.0.31 → 0.0.34
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/lib/__templates__/agent/README.md +58 -5
- package/lib/__templates__/agent/pyproject.toml +1 -1
- package/lib/__templates__/agent/requirements.txt +1 -1
- package/lib/__templates__/expo/.licosproj/scripts/prod_build.sh +39 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
- package/lib/__templates__/expo/server/package.json +1 -1
- package/lib/__templates__/expo/server/src/index.ts +12 -0
- package/lib/__templates__/native-static/.licos +2 -2
- package/lib/__templates__/nextjs/next.config.ts +10 -0
- package/lib/__templates__/nextjs/package.json +1 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +5 -5
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +32 -22
- package/lib/__templates__/nuxt-vue/package.json +21 -15
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +456 -465
- package/lib/__templates__/nuxt-vue/scripts/build.sh +10 -0
- package/lib/__templates__/nuxt-vue/scripts/start.sh +10 -0
- package/lib/__templates__/taro/.licosproj/scripts/deploy_run.sh +1 -1
- package/lib/__templates__/taro/AGENTS.md +7 -0
- package/lib/__templates__/taro/README.md +4 -3
- package/lib/__templates__/taro/config/index.ts +1 -1
- package/lib/__templates__/taro/eslint.config.mjs +1 -1
- package/lib/__templates__/taro/package.json +2 -1
- package/lib/__templates__/taro/pnpm-lock.yaml +47 -1983
- package/lib/__templates__/taro/server/package.json +4 -13
- package/lib/__templates__/taro/server/src/main.ts +17 -0
- package/lib/__templates__/taro/src/presets/env.ts +1 -1
- package/lib/__templates__/taro/types/global.d.ts +1 -2
- package/lib/__templates__/vite/package.json +1 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +5 -5
- package/lib/__templates__/vite/scripts/build.sh +1 -0
- package/lib/__templates__/vite/server/vite.ts +5 -2
- package/lib/__templates__/vite/vite.config.ts +7 -0
- package/lib/__templates__/workflow/README.md +11 -1
- package/lib/__templates__/workflow/pyproject.toml +1 -1
- package/lib/__templates__/workflow/requirements.txt +1 -1
- package/lib/cli.js +20 -1
- package/package.json +1 -1
|
@@ -11,29 +11,20 @@
|
|
|
11
11
|
"start:prod": "node dist/main"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@kmlckj/licos-platform-sdk": "0.6.
|
|
15
|
-
"@aws-sdk/client-s3": "^3.958.0",
|
|
16
|
-
"@aws-sdk/lib-storage": "^3.958.0",
|
|
14
|
+
"@kmlckj/licos-platform-sdk": "0.6.3",
|
|
17
15
|
"@nestjs/common": "^10.4.15",
|
|
18
16
|
"@nestjs/core": "^10.4.15",
|
|
19
17
|
"@nestjs/platform-express": "^10.4.15",
|
|
20
|
-
"better-sqlite3": "^11.9.1",
|
|
21
18
|
"dotenv": "^17.2.3",
|
|
22
|
-
"
|
|
23
|
-
"drizzle-orm": "^0.45.1",
|
|
24
|
-
"drizzle-zod": "^0.8.3",
|
|
25
|
-
"express": "5.2.1",
|
|
26
|
-
"pg": "^8.16.3",
|
|
19
|
+
"express": "5.2.1",
|
|
27
20
|
"rxjs": "^7.8.1",
|
|
28
21
|
"zod": "^4.3.5"
|
|
29
22
|
},
|
|
30
23
|
"devDependencies": {
|
|
31
24
|
"@nestjs/cli": "^10.4.9",
|
|
32
25
|
"@nestjs/schematics": "^10.2.3",
|
|
33
|
-
"@types/
|
|
34
|
-
"@types/
|
|
35
|
-
"@types/node": "^22.10.2",
|
|
36
|
-
"drizzle-kit": "^0.31.8",
|
|
26
|
+
"@types/express": "5.0.6",
|
|
27
|
+
"@types/node": "^22.10.2",
|
|
37
28
|
"typescript": "^5.7.2"
|
|
38
29
|
}
|
|
39
30
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { NestFactory } from '@nestjs/core';
|
|
2
2
|
import { AppModule } from '@/app.module';
|
|
3
3
|
import * as express from 'express';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
4
6
|
import { HttpStatusInterceptor } from '@/interceptors/http-status.interceptor';
|
|
5
7
|
|
|
6
8
|
function parsePort(): number {
|
|
@@ -26,6 +28,21 @@ async function bootstrap() {
|
|
|
26
28
|
app.use(express.json({ limit: '50mb' }));
|
|
27
29
|
app.use(express.urlencoded({ limit: '50mb', extended: true }));
|
|
28
30
|
|
|
31
|
+
const staticDir = path.resolve(__dirname, '../../dist-web');
|
|
32
|
+
const indexHtml = path.join(staticDir, 'index.html');
|
|
33
|
+
if (fs.existsSync(indexHtml)) {
|
|
34
|
+
app.use(express.static(staticDir));
|
|
35
|
+
app.use((req, res, next) => {
|
|
36
|
+
if (req.path.startsWith('/api')) {
|
|
37
|
+
return next();
|
|
38
|
+
}
|
|
39
|
+
if (req.method === 'GET' && req.accepts('html')) {
|
|
40
|
+
return res.sendFile(indexHtml);
|
|
41
|
+
}
|
|
42
|
+
return next();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
29
46
|
// 全局拦截器:统一将 POST 请求的 201 状态码改为 200
|
|
30
47
|
app.useGlobalInterceptors(new HttpStatusInterceptor());
|
|
31
48
|
// 1. 开启优雅关闭 Hooks (关键!)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const IS_H5_ENV =
|
|
1
|
+
export const IS_H5_ENV = LICOS_TARO_ENV === 'h5';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@tarojs/taro" />
|
|
2
2
|
|
|
3
3
|
declare const PROJECT_DOMAIN: string | undefined;
|
|
4
|
-
declare const
|
|
4
|
+
declare const LICOS_TARO_ENV: "weapp" | "h5" | "tt" | string | undefined;
|
|
5
5
|
|
|
6
6
|
declare module '*.png';
|
|
7
7
|
declare module '*.gif';
|
|
@@ -29,4 +29,3 @@ declare namespace NodeJS {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
@@ -13,8 +13,8 @@ importers:
|
|
|
13
13
|
.:
|
|
14
14
|
dependencies:
|
|
15
15
|
'@kmlckj/licos-platform-sdk':
|
|
16
|
-
specifier: 0.6.
|
|
17
|
-
version: 0.6.
|
|
16
|
+
specifier: 0.6.3
|
|
17
|
+
version: 0.6.3
|
|
18
18
|
dotenv:
|
|
19
19
|
specifier: ^17.2.3
|
|
20
20
|
version: 17.2.4
|
|
@@ -288,8 +288,8 @@ packages:
|
|
|
288
288
|
'@jridgewell/trace-mapping@0.3.31':
|
|
289
289
|
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
|
290
290
|
|
|
291
|
-
'@kmlckj/licos-platform-sdk@0.6.
|
|
292
|
-
resolution: {integrity: sha512-
|
|
291
|
+
'@kmlckj/licos-platform-sdk@0.6.3':
|
|
292
|
+
resolution: {integrity: sha512-BzgGAa+ppt2e/LP6053GHpLVXrigyeAV0ZPt73Q6inaJay6tvEMxhSvQitg5wJ8V4uXCAYVCK4gFrGqTAoYODA==}
|
|
293
293
|
|
|
294
294
|
'@nodelib/fs.scandir@2.1.5':
|
|
295
295
|
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
|
@@ -1704,7 +1704,7 @@ snapshots:
|
|
|
1704
1704
|
'@jridgewell/resolve-uri': 3.1.2
|
|
1705
1705
|
'@jridgewell/sourcemap-codec': 1.5.5
|
|
1706
1706
|
|
|
1707
|
-
'@kmlckj/licos-platform-sdk@0.6.
|
|
1707
|
+
'@kmlckj/licos-platform-sdk@0.6.3': {}
|
|
1708
1708
|
|
|
1709
1709
|
'@nodelib/fs.scandir@2.1.5':
|
|
1710
1710
|
dependencies:
|
|
@@ -9,6 +9,7 @@ echo "Installing dependencies..."
|
|
|
9
9
|
pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
10
10
|
|
|
11
11
|
echo "Building frontend with Vite..."
|
|
12
|
+
export VITE_BASE_PATH="${VITE_BASE_PATH:-${BASE_PATH:-/}}"
|
|
12
13
|
pnpm vite build
|
|
13
14
|
|
|
14
15
|
echo "Bundling server with tsup..."
|
|
@@ -5,8 +5,6 @@ import type { Application, Request, Response } from 'express';
|
|
|
5
5
|
import express from 'express';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import fs from 'fs';
|
|
8
|
-
import { createServer as createViteServer } from 'vite';
|
|
9
|
-
import viteConfig from '../vite.config';
|
|
10
8
|
|
|
11
9
|
const isDev = process.env.LICOS_PROJECT_ENV !== 'PROD';
|
|
12
10
|
|
|
@@ -14,6 +12,11 @@ const isDev = process.env.LICOS_PROJECT_ENV !== 'PROD';
|
|
|
14
12
|
* 集成 Vite 开发服务器(中间件模式)
|
|
15
13
|
*/
|
|
16
14
|
export async function setupViteMiddleware(app: Application) {
|
|
15
|
+
const [{ createServer: createViteServer }, { default: viteConfig }] = await Promise.all([
|
|
16
|
+
import('vite'),
|
|
17
|
+
import('../vite.config'),
|
|
18
|
+
]);
|
|
19
|
+
|
|
17
20
|
const vite = await createViteServer({
|
|
18
21
|
...viteConfig,
|
|
19
22
|
server: {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
2
|
|
|
3
|
+
function normalizeBasePath(value?: string): string {
|
|
4
|
+
const trimmed = value?.trim();
|
|
5
|
+
if (!trimmed || trimmed === '/') return '/';
|
|
6
|
+
return `/${trimmed.replace(/^\/+|\/+$/g, '')}/`;
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
export default defineConfig({
|
|
10
|
+
base: process.env.LICOS_PROJECT_ENV === 'PROD' ? normalizeBasePath(process.env.BASE_PATH) : '/',
|
|
4
11
|
server: {
|
|
5
12
|
port: <%= port %>,
|
|
6
13
|
host: '0.0.0.0',
|
|
@@ -38,7 +38,17 @@ bash scripts/http_run.sh -p <%= port %>
|
|
|
38
38
|
- `POST /v1/api/project/{project_id}/agent/canvas`
|
|
39
39
|
- `POST /v1/api/project/{project_id}/agent/canvas_submit`
|
|
40
40
|
|
|
41
|
-
`POST /stream_run`
|
|
41
|
+
`POST /run` 和 `POST /stream_run` 的 Body 必须匹配工作流输入 schema。模板默认输入是:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"topic": "AI 新闻热点"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
工作流不会把智能体的 `messages` 或平台 `content.query.prompt` 自动转换成图输入;前端应先调用 `/graph_parameter` 获取 schema,再按 schema 组装 Body。
|
|
50
|
+
|
|
51
|
+
`POST /stream_run` 使用工作流流式协议,事件类型包括 `workflow_start`、`workflow_end`、`error`、`ping`;请求头 `X-Workflow-Stream-Mode: debug` 会额外输出 `node_start`、`node_end`。
|
|
42
52
|
|
|
43
53
|
`/agent/canvas` 返回工作流画布结构,`/agent/canvas_submit` 接收前端编辑后的 `after_canvas` 并生成给 Agent 执行源码修改的 `QueryDiff` 文本。
|
|
44
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
licos-agent-runtime>=0.2.
|
|
1
|
+
licos-agent-runtime>=0.2.10
|
package/lib/cli.js
CHANGED
|
@@ -2109,7 +2109,7 @@ const EventBuilder = {
|
|
|
2109
2109
|
};
|
|
2110
2110
|
|
|
2111
2111
|
var name = "@kmlckj/licos-ai-cli";
|
|
2112
|
-
var version = "0.0.
|
|
2112
|
+
var version = "0.0.34";
|
|
2113
2113
|
var description = "LICOS AI coding workspace CLI - project template engine and dev tools";
|
|
2114
2114
|
var license = "MIT";
|
|
2115
2115
|
var author = "kmlckj";
|
|
@@ -5940,6 +5940,10 @@ const getCommandConfig = (
|
|
|
5940
5940
|
throw new Error(`Unknown command: ${commandName}`);
|
|
5941
5941
|
}
|
|
5942
5942
|
|
|
5943
|
+
if (commandName === 'build' && Array.isArray(commandConfig)) {
|
|
5944
|
+
return commandConfig;
|
|
5945
|
+
}
|
|
5946
|
+
|
|
5943
5947
|
if (!commandConfig || commandConfig.length === 0) {
|
|
5944
5948
|
throw new Error(
|
|
5945
5949
|
`Command '${commandName}' is not configured in .licos file.\n` +
|
|
@@ -7003,6 +7007,21 @@ const executeRun = async (
|
|
|
7003
7007
|
const config = await loadLicosConfig();
|
|
7004
7008
|
const commandArgs = getCommandConfig(config, commandName);
|
|
7005
7009
|
|
|
7010
|
+
if (commandName === 'build' && commandArgs.length === 0) {
|
|
7011
|
+
const buildDuration = Date.now() - buildStartTime;
|
|
7012
|
+
logger.info('Build command is empty; skipping build step');
|
|
7013
|
+
reportCommandComplete(commandName, true, Date.now() - cmdStartTime, {
|
|
7014
|
+
args: JSON.stringify(options),
|
|
7015
|
+
categories: {
|
|
7016
|
+
fixDuration: String(fixDuration),
|
|
7017
|
+
buildDuration: String(buildDuration),
|
|
7018
|
+
exitCode: '0',
|
|
7019
|
+
projectType,
|
|
7020
|
+
},
|
|
7021
|
+
});
|
|
7022
|
+
return;
|
|
7023
|
+
}
|
|
7024
|
+
|
|
7006
7025
|
// 3. 准备日志
|
|
7007
7026
|
const logFilePath = resolveLogFilePath(options.logFile);
|
|
7008
7027
|
const logStream = createLogStream(logFilePath);
|