@kmlckj/licos-ai-cli 1.8.4 → 1.8.6
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/AGENTS.md +1 -1
- package/lib/__templates__/agent/DATABASE.md +1 -1
- package/lib/__templates__/agent/README.md +2 -3
- package/lib/__templates__/agent/UPGRADING.md +1 -1
- package/lib/__templates__/agent/config/agent_llm_config.json +3 -1
- package/lib/__templates__/agent/examples/README.md +2 -2
- package/lib/__templates__/agent/examples/experts.py +7 -4
- package/lib/__templates__/agent/examples/handoff.py +3 -2
- package/lib/__templates__/agent/pyproject.toml +3 -3
- package/lib/__templates__/agent/requirements.txt +3 -3
- package/lib/__templates__/agent/src/agents/agent.py +1 -1
- package/lib/__templates__/agent/template.config.js +0 -2
- package/lib/__templates__/expo/client/entry.js +24 -24
- package/lib/__templates__/expo/client/package.json +100 -100
- package/lib/__templates__/expo/package.json +34 -34
- package/lib/__templates__/expo/pnpm-lock.yaml +10 -10
- package/lib/__templates__/expo/server/package.json +2 -2
- package/lib/__templates__/expo/template.config.js +109 -109
- package/lib/__templates__/nextjs/AGENTS.md +1 -1
- package/lib/__templates__/nextjs/package.json +2 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +10 -10
- package/lib/__templates__/nextjs/template.config.js +123 -123
- package/lib/__templates__/nuxt-vue/AGENTS.md +1 -1
- package/lib/__templates__/nuxt-vue/package.json +2 -2
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +10 -10
- package/lib/__templates__/taro/package.json +120 -120
- package/lib/__templates__/taro/pnpm-lock.yaml +10 -10
- package/lib/__templates__/taro/server/package.json +2 -2
- package/lib/__templates__/templates.json +2 -2
- package/lib/__templates__/vite/AGENTS.md +1 -1
- package/lib/__templates__/vite/package.json +2 -2
- package/lib/__templates__/vite/pnpm-lock.yaml +10 -10
- package/lib/__templates__/vite/template.config.js +130 -130
- package/lib/__templates__/workflow/AGENTS.md +1 -1
- package/lib/__templates__/workflow/DATABASE.md +1 -1
- package/lib/__templates__/workflow/README.md +1 -2
- package/lib/__templates__/workflow/UPGRADING.md +1 -1
- package/lib/__templates__/workflow/examples/wait_signal.md +1 -1
- package/lib/__templates__/workflow/pyproject.toml +3 -3
- package/lib/__templates__/workflow/requirements.txt +3 -3
- package/lib/__templates__/workflow/template.config.js +0 -2
- package/package.json +1 -1
- package/lib/__templates__/agent/SDK.md +0 -43
- package/lib/__templates__/nextjs/SDK.md +0 -19
- package/lib/__templates__/nuxt-vue/SDK.md +0 -19
- package/lib/__templates__/vite/SDK.md +0 -19
- package/lib/__templates__/workflow/SDK.md +0 -43
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { spawn } from 'child_process';
|
|
4
|
-
import { resolve, join, basename, dirname } from 'path';
|
|
5
|
-
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const paramsSchema = {
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
appName: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
minLength: 1,
|
|
22
|
-
pattern: '^[a-z0-9-]+$',
|
|
23
|
-
description:
|
|
24
|
-
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
25
|
-
},
|
|
26
|
-
port: {
|
|
27
|
-
type: 'number',
|
|
28
|
-
default: 8081,
|
|
29
|
-
minimum: 1024,
|
|
30
|
-
maximum: 65535,
|
|
31
|
-
description: 'Metro bundler port',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
required: [],
|
|
35
|
-
additionalProperties: false,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const config = {
|
|
39
|
-
description: 'Expo template for React Native applications',
|
|
40
|
-
paramsSchema,
|
|
41
|
-
defaultParams: {
|
|
42
|
-
port: 9090,
|
|
43
|
-
appName: 'my-expo-app',
|
|
44
|
-
},
|
|
45
|
-
onBeforeRender: async context => {
|
|
46
|
-
console.log(`Creating Expo project: ${context.appName}`);
|
|
47
|
-
return context;
|
|
48
|
-
},
|
|
49
|
-
onAfterRender: async (context, outputPath) => {
|
|
50
|
-
console.log(`\nProject created at: ${outputPath}`);
|
|
51
|
-
console.log(`\nConfiguration:`);
|
|
52
|
-
console.log(` - Framework: Expo`);
|
|
53
|
-
console.log(` - Port: ${context.port}`);
|
|
54
|
-
},
|
|
55
|
-
onComplete: async (_context, outputPath) => {
|
|
56
|
-
if (process.env.NODE_ENV === 'test') {
|
|
57
|
-
console.log('⊘ Skipping dependency install in test environment');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (_context.options?.skipInstall) {
|
|
61
|
-
console.log('⊘ Skipping dependency install because --skip-install was provided');
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const cmd = 'bash';
|
|
66
|
-
const args = [
|
|
67
|
-
'-lc',
|
|
68
|
-
'pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only',
|
|
69
|
-
];
|
|
70
|
-
console.log(
|
|
71
|
-
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
const projectRoot = resolve(outputPath);
|
|
76
|
-
|
|
77
|
-
const logDir = process.env.LICOS_LOG_DIR || resolve(__dirname, '../.log');
|
|
78
|
-
mkdirSync(logDir, { recursive: true });
|
|
79
|
-
|
|
80
|
-
const projectName = basename(projectRoot);
|
|
81
|
-
const logFile = join(logDir, `${projectName}-init.log`);
|
|
82
|
-
|
|
83
|
-
const timestamp = new Date().toISOString();
|
|
84
|
-
appendFileSync(
|
|
85
|
-
logFile,
|
|
86
|
-
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const logFd = openSync(logFile, 'a');
|
|
90
|
-
|
|
91
|
-
const child = spawn(cmd, args, {
|
|
92
|
-
cwd: projectRoot,
|
|
93
|
-
detached: true,
|
|
94
|
-
stdio: ['ignore', logFd, logFd],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
child.unref();
|
|
98
|
-
closeSync(logFd);
|
|
99
|
-
|
|
100
|
-
console.log('✓ pnpm install triggered (running in background)');
|
|
101
|
-
console.log(` Log file: ${logFile}`);
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error('✗ Failed to trigger pnpm install:', error);
|
|
104
|
-
console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile');
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export default config;
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { resolve, join, basename, dirname } from 'path';
|
|
5
|
+
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const paramsSchema = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
appName: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
minLength: 1,
|
|
22
|
+
pattern: '^[a-z0-9-]+$',
|
|
23
|
+
description:
|
|
24
|
+
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
25
|
+
},
|
|
26
|
+
port: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
default: 8081,
|
|
29
|
+
minimum: 1024,
|
|
30
|
+
maximum: 65535,
|
|
31
|
+
description: 'Metro bundler port',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: [],
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const config = {
|
|
39
|
+
description: 'Expo template for React Native applications',
|
|
40
|
+
paramsSchema,
|
|
41
|
+
defaultParams: {
|
|
42
|
+
port: 9090,
|
|
43
|
+
appName: 'my-expo-app',
|
|
44
|
+
},
|
|
45
|
+
onBeforeRender: async context => {
|
|
46
|
+
console.log(`Creating Expo project: ${context.appName}`);
|
|
47
|
+
return context;
|
|
48
|
+
},
|
|
49
|
+
onAfterRender: async (context, outputPath) => {
|
|
50
|
+
console.log(`\nProject created at: ${outputPath}`);
|
|
51
|
+
console.log(`\nConfiguration:`);
|
|
52
|
+
console.log(` - Framework: Expo`);
|
|
53
|
+
console.log(` - Port: ${context.port}`);
|
|
54
|
+
},
|
|
55
|
+
onComplete: async (_context, outputPath) => {
|
|
56
|
+
if (process.env.NODE_ENV === 'test') {
|
|
57
|
+
console.log('⊘ Skipping dependency install in test environment');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (_context.options?.skipInstall) {
|
|
61
|
+
console.log('⊘ Skipping dependency install because --skip-install was provided');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cmd = 'bash';
|
|
66
|
+
const args = [
|
|
67
|
+
'-lc',
|
|
68
|
+
'pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only',
|
|
69
|
+
];
|
|
70
|
+
console.log(
|
|
71
|
+
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const projectRoot = resolve(outputPath);
|
|
76
|
+
|
|
77
|
+
const logDir = process.env.LICOS_LOG_DIR || resolve(__dirname, '../.log');
|
|
78
|
+
mkdirSync(logDir, { recursive: true });
|
|
79
|
+
|
|
80
|
+
const projectName = basename(projectRoot);
|
|
81
|
+
const logFile = join(logDir, `${projectName}-init.log`);
|
|
82
|
+
|
|
83
|
+
const timestamp = new Date().toISOString();
|
|
84
|
+
appendFileSync(
|
|
85
|
+
logFile,
|
|
86
|
+
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const logFd = openSync(logFile, 'a');
|
|
90
|
+
|
|
91
|
+
const child = spawn(cmd, args, {
|
|
92
|
+
cwd: projectRoot,
|
|
93
|
+
detached: true,
|
|
94
|
+
stdio: ['ignore', logFd, logFd],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
child.unref();
|
|
98
|
+
closeSync(logFd);
|
|
99
|
+
|
|
100
|
+
console.log('✓ pnpm install triggered (running in background)');
|
|
101
|
+
console.log(` Log file: ${logFile}`);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.error('✗ Failed to trigger pnpm install:', error);
|
|
104
|
+
console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile');
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export default config;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"ts-check": "tsc -p tsconfig.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@kmlckj/licos-dev-sdk": "0.5.
|
|
18
|
-
"@kmlckj/licos-platform-sdk": "0.15.
|
|
17
|
+
"@kmlckj/licos-dev-sdk": "0.5.1",
|
|
18
|
+
"@kmlckj/licos-platform-sdk": "0.15.6",
|
|
19
19
|
"@aws-sdk/client-s3": "^3.958.0",
|
|
20
20
|
"@aws-sdk/lib-storage": "^3.958.0",
|
|
21
21
|
"@hookform/resolvers": "^5.2.2",
|
|
@@ -18,11 +18,11 @@ importers:
|
|
|
18
18
|
specifier: ^5.2.2
|
|
19
19
|
version: 5.4.0(react-hook-form@7.77.0(react@19.2.3))
|
|
20
20
|
'@kmlckj/licos-dev-sdk':
|
|
21
|
-
specifier: 0.5.
|
|
22
|
-
version: 0.5.
|
|
21
|
+
specifier: 0.5.1
|
|
22
|
+
version: 0.5.1
|
|
23
23
|
'@kmlckj/licos-platform-sdk':
|
|
24
|
-
specifier: 0.15.
|
|
25
|
-
version: 0.15.
|
|
24
|
+
specifier: 0.15.6
|
|
25
|
+
version: 0.15.6
|
|
26
26
|
'@radix-ui/react-accordion':
|
|
27
27
|
specifier: ^1.2.12
|
|
28
28
|
version: 1.2.12(@types/react-dom@19.2.3(@types/react@19.2.16))(@types/react@19.2.16)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
|
|
@@ -1380,12 +1380,12 @@ packages:
|
|
|
1380
1380
|
'@jridgewell/trace-mapping@0.3.31':
|
|
1381
1381
|
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
|
1382
1382
|
|
|
1383
|
-
'@kmlckj/licos-dev-sdk@0.5.
|
|
1384
|
-
resolution: {tarball: https://registry.npmmirror.com/@kmlckj/licos-dev-sdk/-/licos-dev-sdk-0.5.
|
|
1383
|
+
'@kmlckj/licos-dev-sdk@0.5.1':
|
|
1384
|
+
resolution: {tarball: https://registry.npmmirror.com/@kmlckj/licos-dev-sdk/-/licos-dev-sdk-0.5.1.tgz}
|
|
1385
1385
|
engines: {node: '>=18.17'}
|
|
1386
1386
|
|
|
1387
|
-
'@kmlckj/licos-platform-sdk@0.15.
|
|
1388
|
-
resolution: {
|
|
1387
|
+
'@kmlckj/licos-platform-sdk@0.15.6':
|
|
1388
|
+
resolution: {tarball: https://registry.npmmirror.com/@kmlckj/licos-platform-sdk/-/licos-platform-sdk-0.15.6.tgz}
|
|
1389
1389
|
|
|
1390
1390
|
'@modelcontextprotocol/sdk@1.29.0':
|
|
1391
1391
|
resolution: {integrity: sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ==}
|
|
@@ -6713,9 +6713,9 @@ snapshots:
|
|
|
6713
6713
|
'@jridgewell/resolve-uri': 3.1.2
|
|
6714
6714
|
'@jridgewell/sourcemap-codec': 1.5.5
|
|
6715
6715
|
|
|
6716
|
-
'@kmlckj/licos-dev-sdk@0.5.
|
|
6716
|
+
'@kmlckj/licos-dev-sdk@0.5.1': {}
|
|
6717
6717
|
|
|
6718
|
-
'@kmlckj/licos-platform-sdk@0.15.
|
|
6718
|
+
'@kmlckj/licos-platform-sdk@0.15.6':
|
|
6719
6719
|
dependencies:
|
|
6720
6720
|
ajv: 8.17.1
|
|
6721
6721
|
ajv-formats: 3.0.1(ajv@8.17.1)
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { spawn } from 'child_process';
|
|
4
|
-
import { resolve, join, basename, dirname } from 'path';
|
|
5
|
-
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const description = `Next.js(复杂项目):\`licos init \${LICOS_PROJECT_PATH} --template nextjs\`
|
|
17
|
-
- 适用:全栈应用、复杂多页面等复杂项目
|
|
18
|
-
- 使用默认nextjs项目规范
|
|
19
|
-
- **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。
|
|
20
|
-
- **项目理解加速**:初始可以依赖项目下 \`package.json\` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。
|
|
21
|
-
- **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,\`shadcn/ui\`组件默认完整的预装在\`src/components/ui/\`目录下`;
|
|
22
|
-
|
|
23
|
-
export const paramsSchema = {
|
|
24
|
-
type: 'object',
|
|
25
|
-
properties: {
|
|
26
|
-
appName: {
|
|
27
|
-
type: 'string',
|
|
28
|
-
minLength: 1,
|
|
29
|
-
pattern: '^[a-z0-9-]+$',
|
|
30
|
-
description:
|
|
31
|
-
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
32
|
-
},
|
|
33
|
-
port: {
|
|
34
|
-
type: 'number',
|
|
35
|
-
default: 5000,
|
|
36
|
-
minimum: 1024,
|
|
37
|
-
maximum: 65535,
|
|
38
|
-
description: 'Development server port (for Next.js dev server)',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
required: [],
|
|
42
|
-
additionalProperties: false,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const config = {
|
|
46
|
-
description: description,
|
|
47
|
-
paramsSchema,
|
|
48
|
-
|
|
49
|
-
// 显式定义默认参数,确保在渲染时可用
|
|
50
|
-
defaultParams: {
|
|
51
|
-
port: 5000,
|
|
52
|
-
appName: 'projects',
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
onBeforeRender: async context => {
|
|
56
|
-
console.log(`Creating Next.js project: ${context.appName}`);
|
|
57
|
-
return context;
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
onAfterRender: async (_context, outputPath) => {
|
|
61
|
-
console.log(`\nProject created at: ${outputPath}`);
|
|
62
|
-
console.log('\nConfiguration:');
|
|
63
|
-
console.log(' - Framework: Next.js');
|
|
64
|
-
console.log(' - TypeScript: enabled');
|
|
65
|
-
console.log(' - App Router: enabled');
|
|
66
|
-
console.log(` - Port: ${_context.port}`);
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
onComplete: async (_context, outputPath) => {
|
|
70
|
-
if (process.env.NODE_ENV === 'test') {
|
|
71
|
-
console.log('⊘ Skipping dependency install in test environment');
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (_context.options?.skipInstall) {
|
|
75
|
-
console.log('⊘ Skipping dependency install because --skip-install was provided');
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const cmd = 'bash';
|
|
80
|
-
const args = [
|
|
81
|
-
'-lc',
|
|
82
|
-
'pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only',
|
|
83
|
-
];
|
|
84
|
-
console.log(
|
|
85
|
-
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
const projectRoot = resolve(outputPath);
|
|
90
|
-
|
|
91
|
-
const logDir = process.env.LICOS_LOG_DIR || resolve(__dirname, '../.log');
|
|
92
|
-
mkdirSync(logDir, { recursive: true });
|
|
93
|
-
|
|
94
|
-
const projectName = basename(projectRoot);
|
|
95
|
-
const logFile = join(logDir, `${projectName}-init.log`);
|
|
96
|
-
|
|
97
|
-
const timestamp = new Date().toISOString();
|
|
98
|
-
appendFileSync(
|
|
99
|
-
logFile,
|
|
100
|
-
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const logFd = openSync(logFile, 'a');
|
|
104
|
-
|
|
105
|
-
const child = spawn(cmd, args, {
|
|
106
|
-
cwd: projectRoot,
|
|
107
|
-
detached: true,
|
|
108
|
-
stdio: ['ignore', logFd, logFd],
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
child.unref();
|
|
112
|
-
closeSync(logFd);
|
|
113
|
-
|
|
114
|
-
console.log('✓ pnpm install triggered (running in background)');
|
|
115
|
-
console.log(` Log file: ${logFile}`);
|
|
116
|
-
} catch (error) {
|
|
117
|
-
console.error('✗ Failed to trigger pnpm install:', error);
|
|
118
|
-
console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile');
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export default config;
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { resolve, join, basename, dirname } from 'path';
|
|
5
|
+
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const description = `Next.js(复杂项目):\`licos init \${LICOS_PROJECT_PATH} --template nextjs\`
|
|
17
|
+
- 适用:全栈应用、复杂多页面等复杂项目
|
|
18
|
+
- 使用默认nextjs项目规范
|
|
19
|
+
- **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。
|
|
20
|
+
- **项目理解加速**:初始可以依赖项目下 \`package.json\` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。
|
|
21
|
+
- **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,\`shadcn/ui\`组件默认完整的预装在\`src/components/ui/\`目录下`;
|
|
22
|
+
|
|
23
|
+
export const paramsSchema = {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
appName: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
minLength: 1,
|
|
29
|
+
pattern: '^[a-z0-9-]+$',
|
|
30
|
+
description:
|
|
31
|
+
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
32
|
+
},
|
|
33
|
+
port: {
|
|
34
|
+
type: 'number',
|
|
35
|
+
default: 5000,
|
|
36
|
+
minimum: 1024,
|
|
37
|
+
maximum: 65535,
|
|
38
|
+
description: 'Development server port (for Next.js dev server)',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
required: [],
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const config = {
|
|
46
|
+
description: description,
|
|
47
|
+
paramsSchema,
|
|
48
|
+
|
|
49
|
+
// 显式定义默认参数,确保在渲染时可用
|
|
50
|
+
defaultParams: {
|
|
51
|
+
port: 5000,
|
|
52
|
+
appName: 'projects',
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
onBeforeRender: async context => {
|
|
56
|
+
console.log(`Creating Next.js project: ${context.appName}`);
|
|
57
|
+
return context;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
onAfterRender: async (_context, outputPath) => {
|
|
61
|
+
console.log(`\nProject created at: ${outputPath}`);
|
|
62
|
+
console.log('\nConfiguration:');
|
|
63
|
+
console.log(' - Framework: Next.js');
|
|
64
|
+
console.log(' - TypeScript: enabled');
|
|
65
|
+
console.log(' - App Router: enabled');
|
|
66
|
+
console.log(` - Port: ${_context.port}`);
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
onComplete: async (_context, outputPath) => {
|
|
70
|
+
if (process.env.NODE_ENV === 'test') {
|
|
71
|
+
console.log('⊘ Skipping dependency install in test environment');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (_context.options?.skipInstall) {
|
|
75
|
+
console.log('⊘ Skipping dependency install because --skip-install was provided');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const cmd = 'bash';
|
|
80
|
+
const args = [
|
|
81
|
+
'-lc',
|
|
82
|
+
'pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only',
|
|
83
|
+
];
|
|
84
|
+
console.log(
|
|
85
|
+
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
const projectRoot = resolve(outputPath);
|
|
90
|
+
|
|
91
|
+
const logDir = process.env.LICOS_LOG_DIR || resolve(__dirname, '../.log');
|
|
92
|
+
mkdirSync(logDir, { recursive: true });
|
|
93
|
+
|
|
94
|
+
const projectName = basename(projectRoot);
|
|
95
|
+
const logFile = join(logDir, `${projectName}-init.log`);
|
|
96
|
+
|
|
97
|
+
const timestamp = new Date().toISOString();
|
|
98
|
+
appendFileSync(
|
|
99
|
+
logFile,
|
|
100
|
+
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const logFd = openSync(logFile, 'a');
|
|
104
|
+
|
|
105
|
+
const child = spawn(cmd, args, {
|
|
106
|
+
cwd: projectRoot,
|
|
107
|
+
detached: true,
|
|
108
|
+
stdio: ['ignore', logFd, logFd],
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
child.unref();
|
|
112
|
+
closeSync(logFd);
|
|
113
|
+
|
|
114
|
+
console.log('✓ pnpm install triggered (running in background)');
|
|
115
|
+
console.log(` Log file: ${logFile}`);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('✗ Failed to trigger pnpm install:', error);
|
|
118
|
+
console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile');
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export default config;
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"start": "bash ./scripts/start.sh"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@kmlckj/licos-dev-sdk": "0.5.
|
|
21
|
-
"@kmlckj/licos-platform-sdk": "0.15.
|
|
20
|
+
"@kmlckj/licos-dev-sdk": "0.5.1",
|
|
21
|
+
"@kmlckj/licos-platform-sdk": "0.15.6",
|
|
22
22
|
"@nuxt/image": "2.0.0",
|
|
23
23
|
"nuxt": "4.3.1",
|
|
24
24
|
"tailwind-merge": "2.6.0",
|
|
@@ -13,11 +13,11 @@ importers:
|
|
|
13
13
|
.:
|
|
14
14
|
dependencies:
|
|
15
15
|
'@kmlckj/licos-dev-sdk':
|
|
16
|
-
specifier: 0.5.
|
|
17
|
-
version: 0.5.
|
|
16
|
+
specifier: 0.5.1
|
|
17
|
+
version: 0.5.1
|
|
18
18
|
'@kmlckj/licos-platform-sdk':
|
|
19
|
-
specifier: 0.15.
|
|
20
|
-
version: 0.15.
|
|
19
|
+
specifier: 0.15.6
|
|
20
|
+
version: 0.15.6
|
|
21
21
|
'@nuxt/image':
|
|
22
22
|
specifier: 2.0.0
|
|
23
23
|
version: 2.0.0(db0@0.3.4)(ioredis@5.11.0)(magicast@0.5.3)(srvx@0.11.16)
|
|
@@ -731,12 +731,12 @@ packages:
|
|
|
731
731
|
'@jridgewell/trace-mapping@0.3.31':
|
|
732
732
|
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
|
733
733
|
|
|
734
|
-
'@kmlckj/licos-dev-sdk@0.5.
|
|
735
|
-
resolution: {tarball: https://registry.npmmirror.com/@kmlckj/licos-dev-sdk/-/licos-dev-sdk-0.5.
|
|
734
|
+
'@kmlckj/licos-dev-sdk@0.5.1':
|
|
735
|
+
resolution: {tarball: https://registry.npmmirror.com/@kmlckj/licos-dev-sdk/-/licos-dev-sdk-0.5.1.tgz}
|
|
736
736
|
engines: {node: '>=18.17'}
|
|
737
737
|
|
|
738
|
-
'@kmlckj/licos-platform-sdk@0.15.
|
|
739
|
-
resolution: {
|
|
738
|
+
'@kmlckj/licos-platform-sdk@0.15.6':
|
|
739
|
+
resolution: {tarball: https://registry.npmmirror.com/@kmlckj/licos-platform-sdk/-/licos-platform-sdk-0.15.6.tgz}
|
|
740
740
|
|
|
741
741
|
'@koa/router@12.0.2':
|
|
742
742
|
resolution: {integrity: sha512-sYcHglGKTxGF+hQ6x67xDfkE9o+NhVlRHBqq6gLywaMc6CojK/5vFZByphdonKinYlMLkEkacm+HEse9HzwgTA==}
|
|
@@ -4765,9 +4765,9 @@ snapshots:
|
|
|
4765
4765
|
'@jridgewell/resolve-uri': 3.1.2
|
|
4766
4766
|
'@jridgewell/sourcemap-codec': 1.5.5
|
|
4767
4767
|
|
|
4768
|
-
'@kmlckj/licos-dev-sdk@0.5.
|
|
4768
|
+
'@kmlckj/licos-dev-sdk@0.5.1': {}
|
|
4769
4769
|
|
|
4770
|
-
'@kmlckj/licos-platform-sdk@0.15.
|
|
4770
|
+
'@kmlckj/licos-platform-sdk@0.15.6':
|
|
4771
4771
|
dependencies:
|
|
4772
4772
|
ajv: 8.17.1
|
|
4773
4773
|
ajv-formats: 3.0.1(ajv@8.17.1)
|