@kmlckj/licos-ai-cli 1.0.27 → 1.1.1
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/pyproject.toml +1 -1
- package/lib/__templates__/expo/pnpm-lock.yaml +12942 -12942
- package/lib/__templates__/expo/server/package.json +2 -2
- package/lib/__templates__/nextjs/package.json +2 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +11253 -11549
- package/lib/__templates__/nuxt-vue/package.json +2 -2
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8645 -8586
- package/lib/__templates__/taro/config/index.ts +11 -11
- package/lib/__templates__/taro/pnpm-lock.yaml +20880 -20848
- package/lib/__templates__/taro/server/package.json +2 -2
- package/lib/__templates__/taro/src/network.ts +64 -64
- package/lib/__templates__/taro/types/global.d.ts +31 -31
- package/lib/__templates__/vite/package.json +2 -2
- package/lib/__templates__/vite/pnpm-lock.yaml +2974 -2973
- package/lib/__templates__/workflow/pyproject.toml +1 -1
- package/lib/cli.js +83 -83
- package/package.json +1 -1
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 = "1.
|
|
2112
|
+
var version = "1.1.1";
|
|
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";
|
|
@@ -8970,8 +8970,8 @@ const runPnpmInstall = (projectPath) => {
|
|
|
8970
8970
|
/**
|
|
8971
8971
|
* 运行 git 命令的辅助函数
|
|
8972
8972
|
*/
|
|
8973
|
-
const runGitCommand = (command, projectPath) => {
|
|
8974
|
-
logger.info(`Executing: ${command}`);
|
|
8973
|
+
const runGitCommand = (command, projectPath) => {
|
|
8974
|
+
logger.info(`Executing: ${command}`);
|
|
8975
8975
|
|
|
8976
8976
|
const result = shelljs.exec(command, {
|
|
8977
8977
|
cwd: projectPath,
|
|
@@ -8997,80 +8997,80 @@ const runGitCommand = (command, projectPath) => {
|
|
|
8997
8997
|
.join('');
|
|
8998
8998
|
|
|
8999
8999
|
throw new Error(errorMessage);
|
|
9000
|
-
}
|
|
9001
|
-
};
|
|
9002
|
-
|
|
9003
|
-
const runGitCommandArgs = (args, projectPath, options = {}) => {
|
|
9004
|
-
const command = ['git', ...args]
|
|
9005
|
-
.map(arg => (/\s/.test(arg) ? `"${arg}"` : arg))
|
|
9006
|
-
.join(' ');
|
|
9007
|
-
if (options.log !== false) {
|
|
9008
|
-
logger.info(`Executing: ${command}`);
|
|
9009
|
-
}
|
|
9010
|
-
|
|
9011
|
-
const result = child_process.spawnSync('git', args, {
|
|
9012
|
-
cwd: projectPath,
|
|
9013
|
-
encoding: 'utf-8',
|
|
9014
|
-
});
|
|
9015
|
-
|
|
9016
|
-
if (result.stdout) {
|
|
9017
|
-
process.stdout.write(result.stdout);
|
|
9018
|
-
}
|
|
9019
|
-
|
|
9020
|
-
if (result.stderr) {
|
|
9021
|
-
process.stderr.write(result.stderr);
|
|
9022
|
-
}
|
|
9023
|
-
|
|
9024
|
-
if (result.status !== 0) {
|
|
9025
|
-
const errorMessage = [
|
|
9026
|
-
`${command} failed with exit code ${result.status}`,
|
|
9027
|
-
result.stderr ? `\nStderr:\n${result.stderr}` : '',
|
|
9028
|
-
result.stdout ? `\nStdout:\n${result.stdout}` : '',
|
|
9029
|
-
]
|
|
9030
|
-
.filter(Boolean)
|
|
9031
|
-
.join('');
|
|
9032
|
-
|
|
9033
|
-
throw new Error(errorMessage);
|
|
9034
|
-
}
|
|
9035
|
-
|
|
9036
|
-
return result.stdout ? result.stdout.trim() : '';
|
|
9037
|
-
};
|
|
9038
|
-
|
|
9039
|
-
const readGitConfig = (projectPath, key) => {
|
|
9040
|
-
const result = child_process.spawnSync('git', ['config', '--get', key], {
|
|
9041
|
-
cwd: projectPath,
|
|
9042
|
-
encoding: 'utf-8',
|
|
9043
|
-
});
|
|
9044
|
-
return result.status === 0 && result.stdout ? result.stdout.trim() : '';
|
|
9045
|
-
};
|
|
9046
|
-
|
|
9047
|
-
const ensureGitCommitIdentity = (projectPath) => {
|
|
9048
|
-
const existingName = readGitConfig(projectPath, 'user.name');
|
|
9049
|
-
const existingEmail = readGitConfig(projectPath, 'user.email');
|
|
9050
|
-
const userId = (process.env.AGENT_USER_ID || process.env.LICOS_USER_ID || '').trim();
|
|
9051
|
-
const desiredName = userId || process.env.LICOS_GIT_USER_NAME || process.env.GIT_AUTHOR_NAME || '';
|
|
9052
|
-
const desiredEmail = userId
|
|
9053
|
-
? `${userId}@aios.licos.com`
|
|
9054
|
-
: process.env.LICOS_GIT_USER_EMAIL || process.env.GIT_AUTHOR_EMAIL || '';
|
|
9055
|
-
const shouldSetName = desiredName && existingName !== desiredName;
|
|
9056
|
-
const shouldSetEmail = desiredEmail && existingEmail !== desiredEmail;
|
|
9057
|
-
|
|
9058
|
-
if (!shouldSetName && !shouldSetEmail) {
|
|
9059
|
-
return;
|
|
9060
|
-
}
|
|
9061
|
-
|
|
9062
|
-
logger.info('Configuring local git commit identity...');
|
|
9063
|
-
if (shouldSetName) {
|
|
9064
|
-
runGitCommandArgs(['config', '--local', 'user.name', desiredName], projectPath);
|
|
9065
|
-
}
|
|
9066
|
-
if (shouldSetEmail) {
|
|
9067
|
-
runGitCommandArgs(['config', '--local', 'user.email', desiredEmail], projectPath);
|
|
9068
|
-
}
|
|
9069
|
-
};
|
|
9070
|
-
|
|
9071
|
-
/**
|
|
9072
|
-
* 初始化 git 仓库
|
|
9073
|
-
* 如果目录中已存在 .git,则跳过初始化
|
|
9000
|
+
}
|
|
9001
|
+
};
|
|
9002
|
+
|
|
9003
|
+
const runGitCommandArgs = (args, projectPath, options = {}) => {
|
|
9004
|
+
const command = ['git', ...args]
|
|
9005
|
+
.map(arg => (/\s/.test(arg) ? `"${arg}"` : arg))
|
|
9006
|
+
.join(' ');
|
|
9007
|
+
if (options.log !== false) {
|
|
9008
|
+
logger.info(`Executing: ${command}`);
|
|
9009
|
+
}
|
|
9010
|
+
|
|
9011
|
+
const result = child_process.spawnSync('git', args, {
|
|
9012
|
+
cwd: projectPath,
|
|
9013
|
+
encoding: 'utf-8',
|
|
9014
|
+
});
|
|
9015
|
+
|
|
9016
|
+
if (result.stdout) {
|
|
9017
|
+
process.stdout.write(result.stdout);
|
|
9018
|
+
}
|
|
9019
|
+
|
|
9020
|
+
if (result.stderr) {
|
|
9021
|
+
process.stderr.write(result.stderr);
|
|
9022
|
+
}
|
|
9023
|
+
|
|
9024
|
+
if (result.status !== 0) {
|
|
9025
|
+
const errorMessage = [
|
|
9026
|
+
`${command} failed with exit code ${result.status}`,
|
|
9027
|
+
result.stderr ? `\nStderr:\n${result.stderr}` : '',
|
|
9028
|
+
result.stdout ? `\nStdout:\n${result.stdout}` : '',
|
|
9029
|
+
]
|
|
9030
|
+
.filter(Boolean)
|
|
9031
|
+
.join('');
|
|
9032
|
+
|
|
9033
|
+
throw new Error(errorMessage);
|
|
9034
|
+
}
|
|
9035
|
+
|
|
9036
|
+
return result.stdout ? result.stdout.trim() : '';
|
|
9037
|
+
};
|
|
9038
|
+
|
|
9039
|
+
const readGitConfig = (projectPath, key) => {
|
|
9040
|
+
const result = child_process.spawnSync('git', ['config', '--get', key], {
|
|
9041
|
+
cwd: projectPath,
|
|
9042
|
+
encoding: 'utf-8',
|
|
9043
|
+
});
|
|
9044
|
+
return result.status === 0 && result.stdout ? result.stdout.trim() : '';
|
|
9045
|
+
};
|
|
9046
|
+
|
|
9047
|
+
const ensureGitCommitIdentity = (projectPath) => {
|
|
9048
|
+
const existingName = readGitConfig(projectPath, 'user.name');
|
|
9049
|
+
const existingEmail = readGitConfig(projectPath, 'user.email');
|
|
9050
|
+
const userId = (process.env.AGENT_USER_ID || process.env.LICOS_USER_ID || '').trim();
|
|
9051
|
+
const desiredName = userId || process.env.LICOS_GIT_USER_NAME || process.env.GIT_AUTHOR_NAME || '';
|
|
9052
|
+
const desiredEmail = userId
|
|
9053
|
+
? `${userId}@aios.licos.com`
|
|
9054
|
+
: process.env.LICOS_GIT_USER_EMAIL || process.env.GIT_AUTHOR_EMAIL || '';
|
|
9055
|
+
const shouldSetName = desiredName && existingName !== desiredName;
|
|
9056
|
+
const shouldSetEmail = desiredEmail && existingEmail !== desiredEmail;
|
|
9057
|
+
|
|
9058
|
+
if (!shouldSetName && !shouldSetEmail) {
|
|
9059
|
+
return;
|
|
9060
|
+
}
|
|
9061
|
+
|
|
9062
|
+
logger.info('Configuring local git commit identity...');
|
|
9063
|
+
if (shouldSetName) {
|
|
9064
|
+
runGitCommandArgs(['config', '--local', 'user.name', desiredName], projectPath);
|
|
9065
|
+
}
|
|
9066
|
+
if (shouldSetEmail) {
|
|
9067
|
+
runGitCommandArgs(['config', '--local', 'user.email', desiredEmail], projectPath);
|
|
9068
|
+
}
|
|
9069
|
+
};
|
|
9070
|
+
|
|
9071
|
+
/**
|
|
9072
|
+
* 初始化 git 仓库
|
|
9073
|
+
* 如果目录中已存在 .git,则跳过初始化
|
|
9074
9074
|
*/
|
|
9075
9075
|
const runGitInit = (projectPath) => {
|
|
9076
9076
|
// 检查是否已存在 .git 目录
|
|
@@ -9108,12 +9108,12 @@ const commitChanges = (projectPath) => {
|
|
|
9108
9108
|
return;
|
|
9109
9109
|
}
|
|
9110
9110
|
|
|
9111
|
-
try {
|
|
9112
|
-
logger.info('\nCommitting initialized files...');
|
|
9113
|
-
ensureGitCommitIdentity(projectPath);
|
|
9114
|
-
runGitCommand('git add --all', projectPath);
|
|
9115
|
-
runGitCommand('git commit -m "chore: init env"', projectPath);
|
|
9116
|
-
logger.success('Changes committed successfully!');
|
|
9111
|
+
try {
|
|
9112
|
+
logger.info('\nCommitting initialized files...');
|
|
9113
|
+
ensureGitCommitIdentity(projectPath);
|
|
9114
|
+
runGitCommand('git add --all', projectPath);
|
|
9115
|
+
runGitCommand('git commit -m "chore: init env"', projectPath);
|
|
9116
|
+
logger.success('Changes committed successfully!');
|
|
9117
9117
|
} catch (error) {
|
|
9118
9118
|
// Commit 失败不应该导致整个流程失败
|
|
9119
9119
|
const errorMessage = error instanceof Error ? error.message : String(error);
|