yg-team-cli 2.3.4 → 2.3.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/dist/cli.js CHANGED
@@ -1998,7 +1998,7 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
1998
1998
  const templateRepo = process.env.TEMPLATE_REPO || "git@gitlab.yungu-inc.org:yungu-app/java-scaffold-template.git";
1999
1999
  const backendPath = path7.join(projectPath, "backend");
2000
2000
  try {
2001
- const { execaCommand } = await import("execa");
2001
+ const { execa: e } = await import("execa");
2002
2002
  const tempDir = path7.join(projectPath, ".template-temp");
2003
2003
  if (versionOptions?.tag || versionOptions?.branch) {
2004
2004
  const { userConfigManager: userConfigManager2 } = await Promise.resolve().then(() => (init_user_config(), user_config_exports));
@@ -2027,12 +2027,16 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
2027
2027
  logger.warn("\u672A\u914D\u7F6E GitLab Token\uFF0C\u8DF3\u8FC7\u7248\u672C\u9A8C\u8BC1");
2028
2028
  }
2029
2029
  }
2030
- const ref = versionOptions?.tag || versionOptions?.branch || "HEAD";
2031
- await execaCommand(`git clone --depth=1 --branch ${ref} ${templateRepo} ${tempDir}`, {
2030
+ logger.info(`\u6B63\u5728\u514B\u9686\u540E\u7AEF\u6A21\u677F (${versionOptions?.tag || versionOptions?.branch || "latest"})...`);
2031
+ const cloneArgs = ["clone", "--depth=1"];
2032
+ if (versionOptions?.tag || versionOptions?.branch) {
2033
+ cloneArgs.push("--branch", versionOptions.tag || versionOptions.branch);
2034
+ }
2035
+ cloneArgs.push(templateRepo, tempDir);
2036
+ await e("git", cloneArgs, {
2032
2037
  stdio: "inherit",
2033
2038
  timeout: 6e4
2034
2039
  });
2035
- const { execa: e } = await import("execa");
2036
2040
  const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], {
2037
2041
  cwd: tempDir,
2038
2042
  stdio: "pipe"
@@ -2067,7 +2071,7 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
2067
2071
  const templates = getDefaultTemplates();
2068
2072
  const repository = templates.frontend.repository;
2069
2073
  try {
2070
- const { execaCommand } = await import("execa");
2074
+ const { execa: e } = await import("execa");
2071
2075
  let latestTag = "";
2072
2076
  if (!versionOptions.tag && !versionOptions.branch) {
2073
2077
  latestTag = await getLatestTag(repository);
@@ -2076,9 +2080,13 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
2076
2080
  logger.info(`\u6B63\u5728\u514B\u9686\u524D\u7AEF\u6A21\u677F (${targetVersion || "HEAD"})...`);
2077
2081
  const tempDir = path7.join(os3.tmpdir(), `team-cli-fe-${Date.now()}`);
2078
2082
  await FileUtils.ensureDir(tempDir);
2079
- const cloneCmd = targetVersion ? `git clone --depth 1 --branch ${targetVersion} ${repository} ${tempDir}` : `git clone --depth 1 ${repository} ${tempDir}`;
2080
- await execaCommand(cloneCmd);
2081
- const { stdout: commit } = await execaCommand("git rev-parse HEAD", { cwd: tempDir });
2083
+ const cloneArgs = ["clone", "--depth", "1"];
2084
+ if (targetVersion) {
2085
+ cloneArgs.push("--branch", targetVersion);
2086
+ }
2087
+ cloneArgs.push(repository, tempDir);
2088
+ await e("git", cloneArgs);
2089
+ const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], { cwd: tempDir });
2082
2090
  await fs4.copy(tempDir, frontendPath, {
2083
2091
  filter: (src) => !src.includes(".git")
2084
2092
  });
@@ -2099,11 +2107,12 @@ async function generateDockerFiles() {
2099
2107
  }
2100
2108
  async function initGit(projectPath, projectName) {
2101
2109
  try {
2102
- const { execaCommand } = await import("execa");
2103
- await execaCommand("git init", { cwd: projectPath, stdio: "pipe" });
2104
- await execaCommand("git add .", { cwd: projectPath, stdio: "pipe" });
2105
- await execaCommand(
2106
- `git commit -m "feat: initialize ${projectName} project with team-cli"`,
2110
+ const { execa: e } = await import("execa");
2111
+ await e("git", ["init"], { cwd: projectPath, stdio: "pipe" });
2112
+ await e("git", ["add", "."], { cwd: projectPath, stdio: "pipe" });
2113
+ await e(
2114
+ "git",
2115
+ ["commit", "-m", `feat: initialize ${projectName} project with team-cli`],
2107
2116
  { cwd: projectPath, stdio: "pipe" }
2108
2117
  );
2109
2118
  logger.success("Git \u4ED3\u5E93\u521D\u59CB\u5316\u5B8C\u6210");
@@ -2236,22 +2245,6 @@ var init_init = __esm({
2236
2245
  });
2237
2246
  }
2238
2247
  },
2239
- ...options.docker ? [
2240
- {
2241
- title: "\u751F\u6210 Docker \u914D\u7F6E",
2242
- task: async () => {
2243
- await generateDockerFiles();
2244
- }
2245
- }
2246
- ] : [],
2247
- ...options.git ? [
2248
- {
2249
- title: "\u521D\u59CB\u5316 Git",
2250
- task: async () => {
2251
- await initGit(projectPath, projectName);
2252
- }
2253
- }
2254
- ] : [],
2255
2248
  {
2256
2249
  title: "\u6CE8\u518C\u8FDC\u7A0B MCP \u670D\u52A1",
2257
2250
  task: async () => {
@@ -2259,10 +2252,19 @@ var init_init = __esm({
2259
2252
  (id) => ModuleManager.getModuleById(id)?.type === "remote"
2260
2253
  );
2261
2254
  if (hasRemoteModule) {
2262
- const mcpCmd = 'claude_m2 mcp add --transport sse --header "Authorization: Bearer mcp_00557dabb71297b4f9ac5fe748395f2c" -- api-metadata https://api-metadata.yungu.org/sse';
2263
- const { execaCommand } = await import("execa");
2255
+ const { execa: e } = await import("execa");
2264
2256
  try {
2265
- await execaCommand(mcpCmd);
2257
+ await e("claude", [
2258
+ "mcp",
2259
+ "add",
2260
+ "--transport",
2261
+ "sse",
2262
+ "--header",
2263
+ "Authorization: Bearer mcp_00557dabb71297b4f9ac5fe748395f2c",
2264
+ "--",
2265
+ "api-metadata",
2266
+ "https://api-metadata.yungu.org/sse"
2267
+ ]);
2266
2268
  logger.info("\u8FDC\u7A0B MCP \u670D\u52A1 api-metadata \u5DF2\u6CE8\u518C");
2267
2269
  } catch (err) {
2268
2270
  logger.warn("\u8FDC\u7A0B MCP \u670D\u52A1\u6CE8\u518C\u5931\u8D25\uFF0C\u53EF\u80FD\u5DF2\u5B58\u5728\u6216\u6743\u9650\u4E0D\u8DB3");
@@ -2286,7 +2288,7 @@ var init_init = __esm({
2286
2288
  task: async () => {
2287
2289
  const remoteModules = selectedModules.map((id) => ModuleManager.getModuleById(id)).filter((m) => m?.type === "remote");
2288
2290
  if (remoteModules.length === 0) return;
2289
- const { execaCommand } = await import("execa");
2291
+ const { execa: e } = await import("execa");
2290
2292
  for (const module of remoteModules) {
2291
2293
  if (!module) continue;
2292
2294
  logger.info(`\u6B63\u5728\u4E3A\u60A8\u751F\u6210 ${module.name} \u7684\u8FDC\u7A0B\u8C03\u7528\u4EE3\u7801...`);
@@ -2295,17 +2297,32 @@ var init_init = __esm({
2295
2297
  \u8BF7\u786E\u4FDD\u4EE3\u7801\u7B26\u5408 \`CONVENTIONS.md\` \u4E2D\u7684\u89C4\u8303\u3002
2296
2298
  \u751F\u6210\u5B8C\u6210\u540E\uFF0C\u8BF7\u7B80\u8981\u5217\u51FA\u751F\u6210\u7684\u6587\u4EF6\u3002`;
2297
2299
  try {
2298
- await execaCommand(`claude_m2 -p "${prompt}" --add-dir ${projectPath}`, {
2300
+ await e("claude", ["-p", prompt, "--add-dir", projectPath], {
2299
2301
  stdio: "inherit",
2300
2302
  timeout: 3e5
2301
- // 5分钟超时
2302
2303
  });
2303
2304
  } catch (err) {
2304
2305
  logger.error(`${module.name} \u4EE3\u7801\u751F\u6210\u5931\u8D25\uFF0C\u60A8\u53EF\u4EE5\u7A0D\u540E\u5728\u5F00\u53D1\u6A21\u5F0F\u4E0B\u624B\u52A8\u8FD0\u884C\u3002`);
2305
2306
  }
2306
2307
  }
2307
2308
  }
2308
- }
2309
+ },
2310
+ ...options.docker ? [
2311
+ {
2312
+ title: "\u751F\u6210 Docker \u914D\u7F6E",
2313
+ task: async () => {
2314
+ await generateDockerFiles();
2315
+ }
2316
+ }
2317
+ ] : [],
2318
+ ...options.git ? [
2319
+ {
2320
+ title: "\u521D\u59CB\u5316 Git",
2321
+ task: async () => {
2322
+ await initGit(projectPath, projectName);
2323
+ }
2324
+ }
2325
+ ] : []
2309
2326
  ],
2310
2327
  {
2311
2328
  concurrent: false,