@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.
@@ -5,7 +5,7 @@ description = "LICOS LangGraph workflow project"
5
5
  requires-python = ">=3.12"
6
6
  dependencies = [
7
7
  "licos-agent-runtime>=0.2.25",
8
- "licos-dev-sdk>=0.2.5",
8
+ "licos-dev-sdk>=0.2.6",
9
9
  ]
10
10
 
11
11
  [tool.uv]
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.0.27";
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmlckj/licos-ai-cli",
3
- "version": "1.0.27",
3
+ "version": "1.1.1",
4
4
  "description": "LICOS AI coding workspace CLI - project template engine and dev tools",
5
5
  "license": "MIT",
6
6
  "author": "kmlckj",