yg-team-cli 2.1.8 → 2.2.0
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/README.md +147 -32
- package/dist/cli.js +89 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.js +89 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -177,6 +177,14 @@ var init_logger = __esm({
|
|
|
177
177
|
const coloredLabel = chalk[labelColor](`[${label}]`);
|
|
178
178
|
console.log(`${coloredLabel} ${text}`);
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* 打印调试信息(灰色,仅在 DEBUG 模式下显示)
|
|
182
|
+
*/
|
|
183
|
+
debug(text) {
|
|
184
|
+
if (process.env.DEBUG) {
|
|
185
|
+
console.debug(chalk.gray(`[DEBUG] ${text}`));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
180
188
|
};
|
|
181
189
|
logger = new Logger();
|
|
182
190
|
}
|
|
@@ -463,7 +471,7 @@ var init_user_config = __esm({
|
|
|
463
471
|
try {
|
|
464
472
|
const configDir = path5.dirname(this.configPath);
|
|
465
473
|
await FileUtils.ensureDir(configDir);
|
|
466
|
-
const configToSave =
|
|
474
|
+
const configToSave = JSON.parse(JSON.stringify(config));
|
|
467
475
|
if (configToSave.gitlab?.accessToken) {
|
|
468
476
|
configToSave.gitlab.accessToken = this.encrypt(configToSave.gitlab.accessToken);
|
|
469
477
|
}
|
|
@@ -783,11 +791,18 @@ var init_gitlab_api = __esm({
|
|
|
783
791
|
*/
|
|
784
792
|
static parseProjectPath(repository) {
|
|
785
793
|
let path18 = repository;
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
794
|
+
if (path18.startsWith("git@")) {
|
|
795
|
+
path18 = path18.replace(/^git@/, "");
|
|
796
|
+
const colonIndex = path18.indexOf(":");
|
|
797
|
+
if (colonIndex !== -1) {
|
|
798
|
+
path18 = path18.substring(colonIndex + 1);
|
|
799
|
+
}
|
|
800
|
+
} else {
|
|
801
|
+
path18 = path18.replace(/^https?:\/\//, "");
|
|
802
|
+
const parts = path18.split("/");
|
|
803
|
+
if (parts.length > 1) {
|
|
804
|
+
path18 = parts.slice(1).join("/");
|
|
805
|
+
}
|
|
791
806
|
}
|
|
792
807
|
path18 = path18.replace(/\.git$/, "");
|
|
793
808
|
return path18;
|
|
@@ -2473,6 +2488,7 @@ async function executeDevelopment(specFile, milestone, todo) {
|
|
|
2473
2488
|
logger.separator("\u2500", 60);
|
|
2474
2489
|
logger.newLine();
|
|
2475
2490
|
await generateSessionLog(specFile, milestone, todo, taskDescription, result);
|
|
2491
|
+
await askAndUpdateSpecStatus(specFile, milestone, todo);
|
|
2476
2492
|
logger.header("\u5F00\u53D1\u4EFB\u52A1\u5B8C\u6210!");
|
|
2477
2493
|
logger.success("\u4F1A\u8BDD\u65E5\u5FD7\u5DF2\u4FDD\u5B58");
|
|
2478
2494
|
logger.newLine();
|
|
@@ -2666,6 +2682,72 @@ ${result}
|
|
|
2666
2682
|
`;
|
|
2667
2683
|
await FileUtils.write(logFile, content);
|
|
2668
2684
|
}
|
|
2685
|
+
async function askAndUpdateSpecStatus(specFile, milestone, todo) {
|
|
2686
|
+
try {
|
|
2687
|
+
const { shouldUpdate } = await inquirer3.prompt([
|
|
2688
|
+
{
|
|
2689
|
+
type: "confirm",
|
|
2690
|
+
name: "shouldUpdate",
|
|
2691
|
+
message: "\u4EFB\u52A1\u662F\u5426\u5DF2\u5B8C\u6210\uFF1F\u662F\u5426\u66F4\u65B0 spec \u6587\u4EF6\u4E2D\u7684 todo \u72B6\u6001\uFF1F",
|
|
2692
|
+
default: true
|
|
2693
|
+
}
|
|
2694
|
+
]);
|
|
2695
|
+
if (!shouldUpdate) {
|
|
2696
|
+
logger.info("\u8DF3\u8FC7\u66F4\u65B0 spec \u6587\u4EF6");
|
|
2697
|
+
return;
|
|
2698
|
+
}
|
|
2699
|
+
const content = await FileUtils.read(specFile);
|
|
2700
|
+
const lines = content.split("\n");
|
|
2701
|
+
let inTargetMilestone = false;
|
|
2702
|
+
let targetTodoIndex = -1;
|
|
2703
|
+
let milestoneIndex = -1;
|
|
2704
|
+
for (let i = 0; i < lines.length; i++) {
|
|
2705
|
+
const line = lines[i];
|
|
2706
|
+
if (milestone !== "\u6574\u4E2A spec" && line.includes(milestone)) {
|
|
2707
|
+
inTargetMilestone = true;
|
|
2708
|
+
milestoneIndex = i;
|
|
2709
|
+
continue;
|
|
2710
|
+
}
|
|
2711
|
+
if (inTargetMilestone) {
|
|
2712
|
+
if (line.match(/^###\s+Milestone/)) {
|
|
2713
|
+
break;
|
|
2714
|
+
}
|
|
2715
|
+
if (todo !== "\u5168\u90E8\u529F\u80FD" && todo !== "\u5168\u90E8\u4EFB\u52A1") {
|
|
2716
|
+
const todoMatch = line.match(/^-\s+\[[ x ]\]\s*(.+)/);
|
|
2717
|
+
if (todoMatch && todoMatch[1].trim() === todo) {
|
|
2718
|
+
targetTodoIndex = i;
|
|
2719
|
+
break;
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
if (targetTodoIndex !== -1) {
|
|
2725
|
+
const line = lines[targetTodoIndex];
|
|
2726
|
+
lines[targetTodoIndex] = line.replace(/^-\s+\[ \]/, "- [x]");
|
|
2727
|
+
logger.success(`\u5DF2\u6807\u8BB0 todo \u4E3A\u5B8C\u6210: ${todo}`);
|
|
2728
|
+
} else if (todo === "\u5168\u90E8\u529F\u80FD" || todo === "\u5168\u90E8\u4EFB\u52A1") {
|
|
2729
|
+
let updatedCount = 0;
|
|
2730
|
+
for (let i = milestoneIndex + 1; i < lines.length; i++) {
|
|
2731
|
+
const line = lines[i];
|
|
2732
|
+
if (line.match(/^###\s+Milestone/)) {
|
|
2733
|
+
break;
|
|
2734
|
+
}
|
|
2735
|
+
if (line.match(/^-\s+\[ \]/)) {
|
|
2736
|
+
lines[i] = line.replace(/^-\s+\[ \]/, "- [x]");
|
|
2737
|
+
updatedCount++;
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
logger.success(`\u5DF2\u6807\u8BB0 ${updatedCount} \u4E2A todos \u4E3A\u5B8C\u6210`);
|
|
2741
|
+
} else {
|
|
2742
|
+
logger.warn("\u672A\u627E\u5230\u5BF9\u5E94\u7684 todo \u9879");
|
|
2743
|
+
return;
|
|
2744
|
+
}
|
|
2745
|
+
await FileUtils.write(specFile, lines.join("\n"));
|
|
2746
|
+
logger.success("Spec \u6587\u4EF6\u5DF2\u66F4\u65B0");
|
|
2747
|
+
} catch (error) {
|
|
2748
|
+
logger.warn(`\u66F4\u65B0 spec \u6587\u4EF6\u5931\u8D25: ${error}`);
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2669
2751
|
|
|
2670
2752
|
// src/commands/add-feature.ts
|
|
2671
2753
|
init_esm_shims();
|
|
@@ -5686,7 +5768,7 @@ var Table = class {
|
|
|
5686
5768
|
|
|
5687
5769
|
// src/index.ts
|
|
5688
5770
|
var program = new Command16();
|
|
5689
|
-
program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version("2.1.
|
|
5771
|
+
program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version("2.1.9");
|
|
5690
5772
|
program.option("-v, --verbose", "\u8BE6\u7EC6\u8F93\u51FA\u6A21\u5F0F").option("--debug", "\u8C03\u8BD5\u6A21\u5F0F");
|
|
5691
5773
|
program.addCommand(initCommand);
|
|
5692
5774
|
program.addCommand(splitPrdCommand);
|