@localsummer/incspec 0.2.5 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localsummer/incspec",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "面向 AI 编程助手的增量规范驱动开发工具",
5
5
  "bin": {
6
6
  "incspec": "src/index.mjs"
@@ -87,6 +87,23 @@ export async function analyzeCommand(ctx) {
87
87
  // Ensure initialized
88
88
  const projectRoot = ensureInitialized(cwd);
89
89
 
90
+ // Handle --complete flag as independent mode (skip all interactive flows)
91
+ if (options.complete) {
92
+ const workflow = readWorkflow(projectRoot);
93
+ if (!workflow?.currentWorkflow) {
94
+ printError('没有活跃的工作流,无法标记完成。');
95
+ process.exit(1);
96
+ }
97
+ const output = typeof options.output === 'string' ? options.output : null;
98
+ if (!output) {
99
+ printError('请通过 --output 指定输出文件名。');
100
+ process.exit(1);
101
+ }
102
+ updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, output);
103
+ printSuccess(`步骤 ${STEP_NUMBER} 已标记为完成: ${output}`);
104
+ return;
105
+ }
106
+
90
107
  // Handle --baseline option: use existing baseline report
91
108
  if (options.baseline) {
92
109
  const baselineFile = typeof options.baseline === 'string' ? options.baseline : '';
@@ -234,11 +251,4 @@ export async function analyzeCommand(ctx) {
234
251
  print(colorize('完成分析后,运行以下命令标记完成:', colors.dim));
235
252
  print(colorize(` incspec analyze --complete --output=${outputFile}`, colors.dim));
236
253
  print('');
237
-
238
- // Handle --complete flag
239
- if (options.complete) {
240
- const output = typeof options.output === 'string' ? options.output : outputFile;
241
- updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, output);
242
- printSuccess(`步骤 1 已标记为完成: ${output}`);
243
- }
244
254
  }
@@ -57,6 +57,17 @@ export async function applyCommand(ctx) {
57
57
  // Get workflow state
58
58
  const workflow = readWorkflow(projectRoot);
59
59
 
60
+ // Handle --complete flag as independent mode (skip all checks)
61
+ if (options.complete) {
62
+ if (!workflow?.currentWorkflow) {
63
+ printWarning('没有活跃的工作流,无法标记完成。');
64
+ return;
65
+ }
66
+ updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, '代码已应用');
67
+ printSuccess(`步骤 ${STEP_NUMBER} 已标记为完成`);
68
+ return;
69
+ }
70
+
60
71
  if (!workflow?.currentWorkflow) {
61
72
  printWarning('没有活跃的工作流。请先运行 incspec analyze 开始新工作流。');
62
73
  return;
@@ -176,9 +187,8 @@ export async function applyCommand(ctx) {
176
187
  printInfo(`完成后运行 'incspec status' 查看进度`);
177
188
  print('');
178
189
 
179
- // Handle --complete flag
180
- if (options.complete) {
181
- updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, '代码已应用');
182
- printSuccess(`步骤 5 已标记为完成`);
183
- }
190
+ // Provide command to mark as complete
191
+ print(colorize('完成代码应用后,运行以下命令标记完成:', colors.dim));
192
+ print(colorize(` incspec apply --complete`, colors.dim));
193
+ print('');
184
194
  }
@@ -40,6 +40,21 @@ export async function collectDepCommand(ctx) {
40
40
  // Get workflow state
41
41
  const workflow = readWorkflow(projectRoot);
42
42
 
43
+ // Handle --complete flag as independent mode (skip all checks)
44
+ if (options.complete) {
45
+ if (!workflow?.currentWorkflow) {
46
+ printWarning('没有活跃的工作流,无法标记完成。');
47
+ return;
48
+ }
49
+ if (!isStepAllowed(STEP_NUMBER, workflow.mode)) {
50
+ printWarning('当前工作流为快速模式,步骤 3 已跳过,无需标记完成。');
51
+ return;
52
+ }
53
+ updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, OUTPUT_FILE);
54
+ printSuccess(`步骤 ${STEP_NUMBER} 已标记为完成: ${OUTPUT_FILE}`);
55
+ return;
56
+ }
57
+
43
58
  if (!workflow?.currentWorkflow) {
44
59
  printWarning('没有活跃的工作流。请先运行 incspec analyze 开始新工作流。');
45
60
  return;
@@ -91,9 +106,8 @@ export async function collectDepCommand(ctx) {
91
106
  printInfo(`完成后运行 'incspec status' 查看进度`);
92
107
  print('');
93
108
 
94
- // Handle --complete flag
95
- if (options.complete) {
96
- updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, OUTPUT_FILE);
97
- printSuccess(`步骤 3 已标记为完成: ${OUTPUT_FILE}`);
98
- }
109
+ // Provide command to mark as complete
110
+ print(colorize('完成依赖采集后,运行以下命令标记完成:', colors.dim));
111
+ print(colorize(` incspec collect-dep --complete`, colors.dim));
112
+ print('');
99
113
  }
@@ -40,6 +40,24 @@ export async function collectReqCommand(ctx) {
40
40
  // Get workflow state
41
41
  const workflow = readWorkflow(projectRoot);
42
42
 
43
+ // Handle --complete flag as independent mode (skip all checks)
44
+ if (options.complete) {
45
+ if (!workflow?.currentWorkflow) {
46
+ printWarning('没有活跃的工作流,无法标记完成。');
47
+ return;
48
+ }
49
+ updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, OUTPUT_FILE);
50
+ printSuccess(`步骤 ${STEP_NUMBER} 已标记为完成: ${OUTPUT_FILE}`);
51
+
52
+ // Quick mode hint
53
+ if (isQuickMode(workflow)) {
54
+ print('');
55
+ printInfo('快速模式: 跳过步骤 3、4,直接进入步骤 5');
56
+ print(colorize(" 运行 'incspec apply' 继续", colors.cyan));
57
+ }
58
+ return;
59
+ }
60
+
43
61
  if (!workflow?.currentWorkflow) {
44
62
  printWarning('没有活跃的工作流。请先运行 incspec analyze 开始新工作流。');
45
63
  return;
@@ -81,16 +99,8 @@ export async function collectReqCommand(ctx) {
81
99
  printInfo(`完成后运行 'incspec status' 查看进度`);
82
100
  print('');
83
101
 
84
- // Handle --complete flag
85
- if (options.complete) {
86
- updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, OUTPUT_FILE);
87
- printSuccess(`步骤 2 已标记为完成: ${OUTPUT_FILE}`);
88
-
89
- // Quick mode hint
90
- if (isQuickMode(workflow)) {
91
- print('');
92
- printInfo('快速模式: 跳过步骤 3、4,直接进入步骤 5');
93
- print(colorize(" 运行 'incspec apply' 继续", colors.cyan));
94
- }
95
- }
102
+ // Provide command to mark as complete
103
+ print(colorize('完成需求收集后,运行以下命令标记完成:', colors.dim));
104
+ print(colorize(` incspec collect-req --complete`, colors.dim));
105
+ print('');
96
106
  }
@@ -42,6 +42,26 @@ export async function designCommand(ctx) {
42
42
  // Get workflow state
43
43
  const workflow = readWorkflow(projectRoot);
44
44
 
45
+ // Handle --complete flag as independent mode (skip all checks)
46
+ if (options.complete) {
47
+ if (!workflow?.currentWorkflow) {
48
+ printWarning('没有活跃的工作流,无法标记完成。');
49
+ return;
50
+ }
51
+ if (!isStepAllowed(STEP_NUMBER, workflow.mode)) {
52
+ printWarning('当前工作流为快速模式,步骤 4 已跳过,无需标记完成。');
53
+ return;
54
+ }
55
+ const output = typeof options.output === 'string' ? options.output : null;
56
+ if (!output) {
57
+ printWarning('请通过 --output 指定输出文件名。');
58
+ return;
59
+ }
60
+ updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, output);
61
+ printSuccess(`步骤 ${STEP_NUMBER} 已标记为完成: ${output}`);
62
+ return;
63
+ }
64
+
45
65
  if (!workflow?.currentWorkflow) {
46
66
  printWarning('没有活跃的工作流。请先运行 incspec analyze 开始新工作流。');
47
67
  return;
@@ -132,10 +152,8 @@ export async function designCommand(ctx) {
132
152
  printInfo(`完成后运行 'incspec status' 查看进度`);
133
153
  print('');
134
154
 
135
- // Handle --complete flag
136
- if (options.complete) {
137
- const output = typeof options.output === 'string' ? options.output : outputFile;
138
- updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, output);
139
- printSuccess(`步骤 4 已标记为完成: ${output}`);
140
- }
155
+ // Provide command to mark as complete
156
+ print(colorize('完成增量设计后,运行以下命令标记完成:', colors.dim));
157
+ print(colorize(` incspec design --complete --output=${outputFile}`, colors.dim));
158
+ print('');
141
159
  }
@@ -55,6 +55,22 @@ export async function mergeCommand(ctx) {
55
55
  // Get workflow state
56
56
  const workflow = readWorkflow(projectRoot);
57
57
 
58
+ // Handle --complete flag as independent mode (skip all checks)
59
+ if (options.complete) {
60
+ if (!workflow?.currentWorkflow) {
61
+ printWarning('没有活跃的工作流,无法标记完成。');
62
+ return;
63
+ }
64
+ const output = typeof options.output === 'string' ? options.output : null;
65
+ if (!output) {
66
+ printWarning('请通过 --output 指定输出文件名。');
67
+ return;
68
+ }
69
+ updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, output);
70
+ printSuccess(`步骤 ${STEP_NUMBER} 已标记为完成: ${output}`);
71
+ return;
72
+ }
73
+
58
74
  if (!workflow?.currentWorkflow) {
59
75
  printWarning('没有活跃的工作流。请先运行 incspec analyze 开始新工作流。');
60
76
  return;
@@ -163,9 +179,8 @@ export async function mergeCommand(ctx) {
163
179
  printInfo(`完成后运行 'incspec status' 查看进度`);
164
180
  print('');
165
181
 
166
- // Handle --complete flag
167
- if (options.complete) {
168
- updateStep(projectRoot, STEP_NUMBER, STATUS.COMPLETED, outputFile);
169
- printSuccess(`步骤 6 已标记为完成: ${outputFile}`);
170
- }
182
+ // Provide command to mark as complete
183
+ print(colorize('完成基线合并后,运行以下命令标记完成:', colors.dim));
184
+ print(colorize(` incspec merge --complete --output=${outputFile}`, colors.dim));
185
+ print('');
171
186
  }