openfeel 1.5.24 → 1.6.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.en.md +7 -0
- package/README.zh-CN.md +7 -0
- package/dist/commands/flow.d.ts.map +1 -1
- package/dist/commands/flow.js +117 -23
- package/dist/commands/flow.js.map +1 -1
- package/dist/commands/lint.d.ts +3 -1
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +96 -0
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/req.d.ts.map +1 -1
- package/dist/commands/req.js +392 -17
- package/dist/commands/req.js.map +1 -1
- package/dist/commands/stage.d.ts.map +1 -1
- package/dist/commands/stage.js +19 -0
- package/dist/commands/stage.js.map +1 -1
- package/dist/core/dev-status.d.ts +25 -0
- package/dist/core/dev-status.d.ts.map +1 -1
- package/dist/core/dev-status.js +35 -0
- package/dist/core/dev-status.js.map +1 -1
- package/dist/core/errors.d.ts +13 -3
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +9 -3
- package/dist/core/errors.js.map +1 -1
- package/dist/core/flow-manager.d.ts +109 -3
- package/dist/core/flow-manager.d.ts.map +1 -1
- package/dist/core/flow-manager.js +326 -14
- package/dist/core/flow-manager.js.map +1 -1
- package/dist/core/i18n-data/en.d.ts.map +1 -1
- package/dist/core/i18n-data/en.js +56 -2
- package/dist/core/i18n-data/en.js.map +1 -1
- package/dist/core/i18n-data/zh-CN.d.ts.map +1 -1
- package/dist/core/i18n-data/zh-CN.js +56 -2
- package/dist/core/i18n-data/zh-CN.js.map +1 -1
- package/dist/core/lint-req.d.ts +17 -1
- package/dist/core/lint-req.d.ts.map +1 -1
- package/dist/core/lint-req.js +14 -2
- package/dist/core/lint-req.js.map +1 -1
- package/dist/core/plan/body-lint.d.ts +58 -0
- package/dist/core/plan/body-lint.d.ts.map +1 -0
- package/dist/core/plan/body-lint.js +197 -0
- package/dist/core/plan/body-lint.js.map +1 -0
- package/dist/core/plan/filled.d.ts +143 -0
- package/dist/core/plan/filled.d.ts.map +1 -0
- package/dist/core/plan/filled.js +244 -0
- package/dist/core/plan/filled.js.map +1 -0
- package/dist/core/plan/path.d.ts +24 -0
- package/dist/core/plan/path.d.ts.map +1 -1
- package/dist/core/plan/path.js +56 -0
- package/dist/core/plan/path.js.map +1 -1
- package/dist/core/req/aggregate.d.ts.map +1 -1
- package/dist/core/req/aggregate.js +5 -0
- package/dist/core/req/aggregate.js.map +1 -1
- package/dist/core/req/body-file.d.ts +66 -0
- package/dist/core/req/body-file.d.ts.map +1 -1
- package/dist/core/req/body-file.js +184 -2
- package/dist/core/req/body-file.js.map +1 -1
- package/dist/core/req/requirement-ops.d.ts +128 -14
- package/dist/core/req/requirement-ops.d.ts.map +1 -1
- package/dist/core/req/requirement-ops.js +341 -16
- package/dist/core/req/requirement-ops.js.map +1 -1
- package/dist/core/req/types.d.ts +55 -0
- package/dist/core/req/types.d.ts.map +1 -1
- package/dist/core/template-loader.d.ts.map +1 -1
- package/dist/core/template-loader.js +75 -0
- package/dist/core/template-loader.js.map +1 -1
- package/dsh/ACTION-GUIDE.md +41 -8
- package/dsh/ADAPTER.md +58 -13
- package/dsh/README.md +45 -24
- package/dsh/docs/compat/persistence.md +13 -0
- package/dsh/docs/compat/pipeline.md +12 -0
- package/dsh/docs/compat/req.md +14 -0
- package/dsh/docs/compat/stage.md +13 -0
- package/dsh/lib/adapters/dashboard.js +10 -0
- package/dsh/lib/adapters/dispatch-ledger.js +293 -0
- package/dsh/lib/adapters/dispatch.js +54 -6
- package/dsh/lib/adapters/next-action.js +336 -0
- package/dsh/lib/guard.js +9 -2
- package/dsh/lib/index.js +37 -0
- package/dsh/lib/surface/prompt.js +62 -173
- package/dsh/lib/tools/index.js +435 -9
- package/dsh/package.json +2 -2
- package/package.json +1 -1
package/dist/commands/req.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { existsSync, rmSync } from 'node:fs';
|
|
1
2
|
import { t, getCliLang } from '../core/i18n.js';
|
|
2
3
|
import { enforcePreflightOrFail } from './shared/preflight-gate.js';
|
|
3
4
|
import { FlowManager, isFlowConcurrentError } from '../core/flow-manager.js';
|
|
4
5
|
import { handleConcurrentConflict } from './shared/errors.js';
|
|
5
|
-
import { addRequirement, getRequirement, getRequirements, listRequirements, claimRequirement, releaseRequirement, updateRequirement, advanceRequirement, linkRequirement, getAllowedNextStatuses, splitRequirement, requirementDoneBlocker, recordRequirementReview, recordRequirementVerification, releaseCheckRequirements, rolloverRequirements, isTerminalRequirementStatus, waiveRequirement, revokeRequirementWaiver, markRequirementTrivial, clearRequirementTrivial, raiseRequirementSeqFloor, } from '../core/req/requirement-ops.js';
|
|
6
|
+
import { addRequirement, getRequirement, getRequirements, listRequirements, claimRequirement, releaseRequirement, updateRequirement, advanceRequirement, linkRequirement, getAllowedNextStatuses, splitRequirement, requirementDoneBlocker, recordRequirementReview, recordRequirementVerification, releaseCheckRequirements, rolloverRequirements, isTerminalRequirementStatus, waiveRequirement, revokeRequirementWaiver, markRequirementTrivial, clearRequirementTrivial, raiseRequirementSeqFloor, forceRequirementPlanDeviation, forceRequirementBodyWaiver, forceRequirementPlanWaiver, requirementBodyEmptySections, } from '../core/req/requirement-ops.js';
|
|
6
7
|
import { REQ_STATUSES, REQ_ID_PATTERN } from '../core/req/types.js';
|
|
7
|
-
import { writeRequirementBodySkeleton } from '../core/req/body-file.js';
|
|
8
|
+
import { writeRequirementBodySkeleton, updateRequirementBody, getRequirementBodyPath, RequirementBodyUpdateError } from '../core/req/body-file.js';
|
|
8
9
|
import { computeRequirementAggregate, listLinkedStages } from '../core/req/aggregate.js';
|
|
9
10
|
import { stageRequirementIds } from '../core/req/stage-links.js';
|
|
10
11
|
import { findArchivedRequirement, listArchivedRequirements, archivedRequirementMaxSeq } from '../core/flow-archive/archive-ops.js';
|
|
@@ -12,6 +13,7 @@ import { withSchemaVersion, emitJson } from './shared/json-output.js';
|
|
|
12
13
|
import { getUserName } from '../core/workspace/identity.js';
|
|
13
14
|
import { normalizeStageId } from '../core/plan/path.js';
|
|
14
15
|
import { getSessionId, resolveActorName } from '../core/session.js';
|
|
16
|
+
import { maybeSyncDevStatus } from '../core/dev-status.js';
|
|
15
17
|
/** 当前会话标识(写入审查/验证记录,用于人机区分与回溯;v1.5.24 / REQ-049) */
|
|
16
18
|
function currentSession() {
|
|
17
19
|
return getSessionId({ projectPath: process.cwd() });
|
|
@@ -92,6 +94,27 @@ function doneGateMessage(lang, data, id, current) {
|
|
|
92
94
|
}
|
|
93
95
|
return t('req.err.doneGateTmpl', lang, { id, current });
|
|
94
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* 正文门拒绝文案(v1.6.0 / stage-132 T4)。
|
|
99
|
+
* 判据单源 = `requirementBodyBlocker`(引擎);本层只把「未写实的小节名」拼进 i18n 模板,
|
|
100
|
+
* 并给出可复制的 `req body` 补写命令(A2 的「提示用 req body 补写」要求)。
|
|
101
|
+
*/
|
|
102
|
+
function bodyGateMessage(lang, data, id) {
|
|
103
|
+
const req = getRequirement(data, id);
|
|
104
|
+
const sections = req ? requirementBodyEmptySections(process.cwd(), req) : [];
|
|
105
|
+
return t('req.err.bodyEmptyTmpl', lang, {
|
|
106
|
+
id,
|
|
107
|
+
sections: sections.length > 0 ? sections.join('、') : '摘要、目标与验收',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 需求级计划门拒绝文案(v1.6.0 / stage-132 T7)。
|
|
112
|
+
* `openfeel req plan` 尚不存在,因此文案给出**按模板创建文件**的具体路径与必备小节
|
|
113
|
+
* (真实指引优于虚构命令)。
|
|
114
|
+
*/
|
|
115
|
+
function planGateMessage(lang, id) {
|
|
116
|
+
return t('req.err.planMissingTmpl', lang, { id });
|
|
117
|
+
}
|
|
95
118
|
/**
|
|
96
119
|
* 保存并收敛并发:成功返回 true;并发冲突 → 单点处理(JSON 置码 2 返回 / 非 JSON exit 2),
|
|
97
120
|
* 其他异常 → 通用文案 exit 1 并返回 false。返回 false 时调用方须早返回。
|
|
@@ -111,6 +134,17 @@ function saveOrFail(mgr, lang) {
|
|
|
111
134
|
return false;
|
|
112
135
|
}
|
|
113
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* v1.6.0 / REQ-059 T8:**写成功出口**自动同步开发账本(`.openfeel/dev/**` + `dev_last.md`)。
|
|
139
|
+
* 需求写操作已成功,因此同步失败**不改变退出码**,只输出一行 stderr(不再静默吞掉)。
|
|
140
|
+
* 调用点仅限写命令成功出口(advance / complete / review / verify / body),读命令不调。
|
|
141
|
+
*/
|
|
142
|
+
function syncDevAfterWrite(projectPath, lang) {
|
|
143
|
+
const sync = maybeSyncDevStatus(projectPath);
|
|
144
|
+
if (sync.error !== undefined) {
|
|
145
|
+
console.warn(t('flow.dev.syncFailedTmpl', lang, { err: sync.error }));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
114
148
|
/** `req` 命令组注册入口 */
|
|
115
149
|
export function registerReqCommand(program) {
|
|
116
150
|
const req = program
|
|
@@ -125,6 +159,12 @@ export function registerReqCommand(program) {
|
|
|
125
159
|
.option('--workflow-mode <mode>', '工作流模式(full / fast / general;缺省不设置)')
|
|
126
160
|
.option('--claim', '创建后立即认领(v1.5.23:一次开单+认领)')
|
|
127
161
|
.option('--stage <stageId>', '创建后立即关联到该阶段(v1.5.23:一次开单+关联)')
|
|
162
|
+
.option('--start', '创建后直接进入 in_progress(自动 scheduled → in_progress;v1.5.25 / REQ-053)')
|
|
163
|
+
.option('--summary <md>', '正文 ## 摘要 小节(v1.6.0:正文写实;与 --goal/--acceptance 配合即可一步写实)')
|
|
164
|
+
.option('--problem <md>', '正文 ## 问题 小节(v1.6.0:正文写实)')
|
|
165
|
+
.option('--goal <md>', '正文 ## 目标与验收 → 目标 子节(v1.6.0:正文写实)')
|
|
166
|
+
.option('--acceptance <md>', '正文 ## 目标与验收 → 验收 子节(v1.6.0:正文写实)')
|
|
167
|
+
.option('--plan <md>', '正文 ## 初步规划 小节(v1.6.0:正文写实)')
|
|
128
168
|
.action((title, options) => {
|
|
129
169
|
const lang = getCliLang(process.cwd());
|
|
130
170
|
const mgr = createManager();
|
|
@@ -149,10 +189,13 @@ export function registerReqCommand(program) {
|
|
|
149
189
|
workflow_mode: options.workflowMode,
|
|
150
190
|
});
|
|
151
191
|
// v1.5.23 / REQ-043(六期反馈 #1):一次开单 + 认领 + 关联
|
|
192
|
+
// v1.6.0 / REV-013:claim / advance 都**显式传项目根**(不靠 cwd 推导)——
|
|
193
|
+
// claim 自 REV-013 起不校验正文(认领 ≠ 开工),但传根保证调用面同形;
|
|
194
|
+
// advance 的正文门(scheduled / in_progress / done)必须能定位正文文件。
|
|
152
195
|
let claimedOwner;
|
|
153
196
|
if (options.claim === true) {
|
|
154
197
|
const owner = getUserName(process.cwd());
|
|
155
|
-
const c = claimRequirement(data, created.id, owner);
|
|
198
|
+
const c = claimRequirement(data, created.id, owner, { projectPath: process.cwd() });
|
|
156
199
|
if (!c.ok) {
|
|
157
200
|
failGeneric(lang, new Error(t('req.add.claimFailedTmpl', lang, { id: created.id })));
|
|
158
201
|
return;
|
|
@@ -179,8 +222,23 @@ export function registerReqCommand(program) {
|
|
|
179
222
|
}
|
|
180
223
|
linkedStage = stageKey;
|
|
181
224
|
}
|
|
182
|
-
//
|
|
225
|
+
// 正文骨架 + 可选业务小节:**先于** `--start` 落盘。
|
|
226
|
+
// 原因(REV-013):`add --start` 走真实状态流转,正文门必须判到「本轮写下的正文」
|
|
227
|
+
// 而不是「还没有正文文件 ⇒ 无正文可判 ⇒ 放行」的空档;同时 `--goal/--acceptance`
|
|
228
|
+
// 等先写入,带正文内容的 `--start` 不会被误拦。
|
|
183
229
|
let bodyPath;
|
|
230
|
+
const bodyFilePath = getRequirementBodyPath(process.cwd(), created.id);
|
|
231
|
+
const bodyExistedBefore = existsSync(bodyFilePath);
|
|
232
|
+
/** 失败路径清理本轮新建的正文文件(不把孤儿正文留给下一次同 ID 复用) */
|
|
233
|
+
const discardNewBody = () => {
|
|
234
|
+
if (bodyExistedBefore) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
rmSync(bodyFilePath, { force: true });
|
|
239
|
+
}
|
|
240
|
+
catch { /* 清理失败不掩盖主错误 */ }
|
|
241
|
+
};
|
|
184
242
|
try {
|
|
185
243
|
bodyPath = writeRequirementBodySkeleton(process.cwd(), created);
|
|
186
244
|
}
|
|
@@ -188,6 +246,68 @@ export function registerReqCommand(program) {
|
|
|
188
246
|
failGeneric(lang, err);
|
|
189
247
|
return;
|
|
190
248
|
}
|
|
249
|
+
// v1.6.0-stage-132 / T2:可选正文业务小节(未给的保持骨架占位;元信息小节不碰)
|
|
250
|
+
try {
|
|
251
|
+
const bodyActor = resolveActorName(process.cwd(), undefined);
|
|
252
|
+
const writeSection = (section, text) => {
|
|
253
|
+
updateRequirementBody(process.cwd(), created, {
|
|
254
|
+
section,
|
|
255
|
+
text,
|
|
256
|
+
createSectionIfMissing: true,
|
|
257
|
+
by: bodyActor,
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
if (options.summary !== undefined) {
|
|
261
|
+
// v1.6.0-stage-132 / T2(REQ-061):## 摘要 与 ## 目标与验收 都写实 ⇒ add --start 可一步过正文门
|
|
262
|
+
writeSection('摘要', options.summary);
|
|
263
|
+
}
|
|
264
|
+
if (options.problem !== undefined) {
|
|
265
|
+
writeSection('问题', options.problem);
|
|
266
|
+
}
|
|
267
|
+
if (options.goal !== undefined || options.acceptance !== undefined) {
|
|
268
|
+
// --goal 与 --acceptance 合并进 目标与验收 的两个子标题
|
|
269
|
+
const parts = [];
|
|
270
|
+
if (options.goal !== undefined) {
|
|
271
|
+
parts.push(`### 目标\n\n${options.goal.trim()}`);
|
|
272
|
+
}
|
|
273
|
+
if (options.acceptance !== undefined) {
|
|
274
|
+
parts.push(`### 验收\n\n${options.acceptance.trim()}`);
|
|
275
|
+
}
|
|
276
|
+
writeSection('目标与验收', parts.join('\n\n'));
|
|
277
|
+
}
|
|
278
|
+
if (options.plan !== undefined) {
|
|
279
|
+
writeSection('初步规划', options.plan);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (err) {
|
|
283
|
+
discardNewBody();
|
|
284
|
+
failGeneric(lang, err);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
// v1.5.25 / REQ-053:一次开单到 in_progress(scheduled → in_progress 属引擎流转,
|
|
288
|
+
// 命令层不另写判据;失败则整体不 save,并清掉本轮新建的正文文件)
|
|
289
|
+
// v1.6.0 / REV-013:显式传项目根 —— 空壳正文在 scheduled 步即被正文门拦下。
|
|
290
|
+
let startedStatus;
|
|
291
|
+
if (options.start === true) {
|
|
292
|
+
for (const step of ['scheduled', 'in_progress']) {
|
|
293
|
+
const moved = advanceRequirement(data, created.id, step, { projectPath: process.cwd() });
|
|
294
|
+
if (!moved.ok) {
|
|
295
|
+
discardNewBody();
|
|
296
|
+
failCode(lang, moved.code, {
|
|
297
|
+
not_found: t('req.err.notFoundTmpl', lang, { id: created.id }),
|
|
298
|
+
invalid_field: t('req.err.invalidFieldTmpl', lang, { id: created.id }),
|
|
299
|
+
invalid_status: t('req.err.invalidStatusTmpl', lang, {
|
|
300
|
+
id: created.id, to: step, current: created.status, targets: getAllowedNextStatuses(created.status).join(', '),
|
|
301
|
+
}),
|
|
302
|
+
general_mode_conflict: t('req.err.generalModeConflictTmpl', lang, { id: created.id }),
|
|
303
|
+
body_empty: bodyGateMessage(lang, data, created.id),
|
|
304
|
+
plan_missing: planGateMessage(lang, created.id),
|
|
305
|
+
});
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
startedStatus = 'in_progress';
|
|
310
|
+
}
|
|
191
311
|
if (!saveOrFail(mgr, lang)) {
|
|
192
312
|
return;
|
|
193
313
|
}
|
|
@@ -199,6 +319,9 @@ export function registerReqCommand(program) {
|
|
|
199
319
|
if (linkedStage !== undefined) {
|
|
200
320
|
console.log(t('req.add.linkedTmpl', lang, { stage: linkedStage }));
|
|
201
321
|
}
|
|
322
|
+
if (startedStatus !== undefined) {
|
|
323
|
+
console.log(t('req.add.startedTmpl', lang, { id: created.id, status: startedStatus }));
|
|
324
|
+
}
|
|
202
325
|
}
|
|
203
326
|
catch (err) {
|
|
204
327
|
// 唯一抛错路径(空 title / 非法 priority / 空 target_version)→ 通用模板 exit 1
|
|
@@ -402,11 +525,12 @@ export function registerReqCommand(program) {
|
|
|
402
525
|
// 关联阶段 = 原始只读枚举(零聚合计算 / 零阶段推进字段读取——归后续阶段);命令层输出面复用单点过滤(REV-97-006)
|
|
403
526
|
emitRequirement(active, listLinkedStages(data, id).map((l) => l.id), getRequirements(data).filter((r) => r.parent_id === id), null);
|
|
404
527
|
});
|
|
405
|
-
// ── req claim <id> [--owner <name>] ──
|
|
528
|
+
// ── req claim <id> [--owner <name>] [--force] ──
|
|
406
529
|
req
|
|
407
530
|
.command('claim <id>')
|
|
408
531
|
.description('认领需求(占用校验;已被他人认领则拒绝)')
|
|
409
532
|
.option('--owner <owner>', '认领人(缺省:.openfeel/.info.json user → git config user.name)')
|
|
533
|
+
.option('--force', '正文门留痕放行(写 body_waiver + 审计 requirement_body_forced;仍应先补写正文)')
|
|
410
534
|
.action((id, options) => {
|
|
411
535
|
const lang = getCliLang(process.cwd());
|
|
412
536
|
const mgr = createManager();
|
|
@@ -435,14 +559,34 @@ export function registerReqCommand(program) {
|
|
|
435
559
|
}
|
|
436
560
|
owner = resolved;
|
|
437
561
|
}
|
|
438
|
-
|
|
439
|
-
|
|
562
|
+
const projectPath = process.cwd();
|
|
563
|
+
// 返回码分流(命令层仅映射,零校验):占用 / 终态均由引擎单点判定。
|
|
564
|
+
// v1.6.0 / REV-013:claim **不再校验正文**(认领 ≠ 开工),因此 `body_empty` 分支
|
|
565
|
+
// 目前不可达——保留 `--force` 选项与分支只为兼容旧脚本(选项键仍在 help 锁内)。
|
|
566
|
+
let r = claimRequirement(data, id, owner, { projectPath });
|
|
567
|
+
let bodyForced = false;
|
|
568
|
+
if (!r.ok && r.code === 'body_empty' && options.force === true) {
|
|
569
|
+
// v1.6.0 / T4(A2c):--force = 留痕放行(body_waiver + 审计),随后用同一谓词重试
|
|
570
|
+
const forced = forceRequirementBodyWaiver(data, id, {
|
|
571
|
+
by: resolveActorName(projectPath), reason: 'claim-force', gate: 'claim',
|
|
572
|
+
});
|
|
573
|
+
if (!forced.ok) {
|
|
574
|
+
failCode(lang, forced.code, {
|
|
575
|
+
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
576
|
+
invalid_status: t('req.claim.terminalTmpl', lang, { id, status: getRequirement(data, id)?.status ?? '' }),
|
|
577
|
+
});
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
r = claimRequirement(data, id, owner, { projectPath });
|
|
581
|
+
bodyForced = r.ok;
|
|
582
|
+
}
|
|
440
583
|
if (!r.ok) {
|
|
441
584
|
failCode(lang, r.code, {
|
|
442
585
|
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
443
586
|
already_claimed: t('req.err.alreadyClaimedTmpl', lang, { id }),
|
|
444
587
|
invalid_field: t('req.err.invalidFieldTmpl', lang, { id }),
|
|
445
588
|
invalid_status: t('req.claim.terminalTmpl', lang, { id, status: getRequirement(data, id)?.status ?? '' }),
|
|
589
|
+
body_empty: bodyGateMessage(lang, data, id),
|
|
446
590
|
});
|
|
447
591
|
return;
|
|
448
592
|
}
|
|
@@ -454,7 +598,8 @@ export function registerReqCommand(program) {
|
|
|
454
598
|
if (!saveOrFail(mgr, lang)) {
|
|
455
599
|
return;
|
|
456
600
|
}
|
|
457
|
-
console.log(t('req.claim.doneTmpl', lang, { id, owner })
|
|
601
|
+
console.log(t('req.claim.doneTmpl', lang, { id, owner })
|
|
602
|
+
+ (bodyForced ? t('req.claim.bodyForcedSuffix', lang) : ''));
|
|
458
603
|
});
|
|
459
604
|
// ── req release <id> ──
|
|
460
605
|
req
|
|
@@ -531,7 +676,7 @@ export function registerReqCommand(program) {
|
|
|
531
676
|
target_version: options.targetVersion,
|
|
532
677
|
priority: options.priority,
|
|
533
678
|
workflow_mode: options.workflowMode,
|
|
534
|
-
});
|
|
679
|
+
}, { projectPath: process.cwd() });
|
|
535
680
|
if (!r.ok) {
|
|
536
681
|
const current = getRequirement(data, id)?.status ?? '';
|
|
537
682
|
// done 门专用文案(stage-93 BUG-002):静态表放行 done 而仍被拒 ⇒ 唯一可能是完成门
|
|
@@ -540,6 +685,11 @@ export function registerReqCommand(program) {
|
|
|
540
685
|
failCode(lang, r.code, {
|
|
541
686
|
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
542
687
|
invalid_field: t('req.err.invalidFieldTmpl', lang, { id }),
|
|
688
|
+
// v1.6.0 / REQ-056 T6:`set --status done` 与 advance 同判据(done 门通过后才可能到这)
|
|
689
|
+
plan_deviation: t('req.err.planDeviationTmpl', lang, { id }),
|
|
690
|
+
// v1.6.0 / stage-132 T4 · T7:正文门 / 需求级计划门(`set` 无 --force,文案指向 advance --force)
|
|
691
|
+
body_empty: bodyGateMessage(lang, data, id),
|
|
692
|
+
plan_missing: planGateMessage(lang, id),
|
|
543
693
|
invalid_status: doneGate
|
|
544
694
|
? doneGateMessage(lang, data, id, current)
|
|
545
695
|
: t('req.err.invalidStatusTmpl', lang, {
|
|
@@ -652,11 +802,12 @@ export function registerReqCommand(program) {
|
|
|
652
802
|
console.log(t('req.link.doneTmpl', lang, { stage: stageKey, id: requirementId ?? '' }));
|
|
653
803
|
}
|
|
654
804
|
});
|
|
655
|
-
// ── req advance <id> --to <status> ──
|
|
805
|
+
// ── req advance <id> --to <status> [--force] ──
|
|
656
806
|
req
|
|
657
807
|
.command('advance <id>')
|
|
658
808
|
.description('显式推进需求状态(合法目标由引擎流转表判定;done:零关联可直接完成,关联阶段进入 exec_running 及之后相位即可完成)')
|
|
659
809
|
.requiredOption('--to <status>', '目标状态(合法目标由引擎判定)')
|
|
810
|
+
.option('--force', '门留痕放行(正文/计划门写 waiver、计划偏差 +1;均留审计,文件仍须补写)')
|
|
660
811
|
.action((id, options) => {
|
|
661
812
|
const lang = getCliLang(process.cwd());
|
|
662
813
|
const mgr = createManager();
|
|
@@ -675,8 +826,48 @@ export function registerReqCommand(program) {
|
|
|
675
826
|
// v1.5.6-stage-114:写前 preflight(ID 校验已在门前)
|
|
676
827
|
if (!enforcePreflightOrFail(process.cwd(), lang))
|
|
677
828
|
return;
|
|
678
|
-
|
|
679
|
-
|
|
829
|
+
const projectPath = process.cwd();
|
|
830
|
+
// v1.6.0 / REQ-056 T6:未盖章历史需求(plan? 缺省)在 done 时**放行但提示**——
|
|
831
|
+
// 不阻塞存量,审计另记 `plan_unstamped:true`(在 requirement_status 条目里)。
|
|
832
|
+
const planUnstamped = options.to === 'done' && getRequirement(data, id)?.plan === undefined;
|
|
833
|
+
// 命令层零校验:合法目标 + 正文门 + 计划门 + done 门 + 计划偏差门均在引擎单点
|
|
834
|
+
let r = advanceRequirement(data, id, options.to, { projectPath });
|
|
835
|
+
let planDeviationForced = false;
|
|
836
|
+
let gateForced = false;
|
|
837
|
+
// v1.6.0 / stage-132 T4 · T7:正文门 / 计划门的 --force 通道——
|
|
838
|
+
// 写入 waiver(留痕)+ 审计后,用**同一谓词**重新求值(门本体不重写)。
|
|
839
|
+
// 同一次流转可能**连撞两门**(空壳正文 + 无计划):循环上限 = 门数(2),逐个留痕放行。
|
|
840
|
+
for (let i = 0; i < 2 && !r.ok && options.force === true
|
|
841
|
+
&& (r.code === 'body_empty' || r.code === 'plan_missing'); i += 1) {
|
|
842
|
+
const forced = r.code === 'body_empty'
|
|
843
|
+
? forceRequirementBodyWaiver(data, id, { by: resolveActorName(projectPath), reason: 'advance-force', gate: 'advance' })
|
|
844
|
+
: forceRequirementPlanWaiver(data, id, { by: resolveActorName(projectPath), reason: 'advance-force', gate: 'advance' });
|
|
845
|
+
if (!forced.ok) {
|
|
846
|
+
failCode(lang, forced.code, {
|
|
847
|
+
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
848
|
+
invalid_status: t('req.err.invalidStatusTmpl', lang, {
|
|
849
|
+
id, to: options.to, current: before ?? '',
|
|
850
|
+
targets: before !== undefined ? getAllowedNextStatuses(before).join(', ') : '',
|
|
851
|
+
}),
|
|
852
|
+
});
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
r = advanceRequirement(data, id, options.to, { projectPath });
|
|
856
|
+
gateForced = r.ok;
|
|
857
|
+
}
|
|
858
|
+
if (!r.ok && r.code === 'plan_deviation' && options.force === true) {
|
|
859
|
+
// 留痕放行:先记偏差次数 + 审计(判据本体不重写),再走同一门放行通道
|
|
860
|
+
const forced = forceRequirementPlanDeviation(data, id, { by: resolveActorName(projectPath) });
|
|
861
|
+
if (!forced.ok) {
|
|
862
|
+
failCode(lang, forced.code, {
|
|
863
|
+
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
864
|
+
invalid_status: t('req.advance.forceRequiresStampTmpl', lang, { id }),
|
|
865
|
+
});
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
r = advanceRequirement(data, id, options.to, { projectPath, allowPlanDeviation: true });
|
|
869
|
+
planDeviationForced = r.ok;
|
|
870
|
+
}
|
|
680
871
|
if (!r.ok) {
|
|
681
872
|
// done 门专用文案(stage-93 BUG-002):静态表放行 done 而仍被拒 ⇒ 唯一可能是完成门
|
|
682
873
|
const doneGate = options.to === 'done'
|
|
@@ -684,6 +875,11 @@ export function registerReqCommand(program) {
|
|
|
684
875
|
&& getAllowedNextStatuses(before).includes('done');
|
|
685
876
|
failCode(lang, r.code, {
|
|
686
877
|
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
878
|
+
// v1.6.0 / REQ-056 T6:计划被执行改动且 `## 偏差与回写` 未写实(done 门已通过后才可能到这)
|
|
879
|
+
plan_deviation: t('req.err.planDeviationTmpl', lang, { id }),
|
|
880
|
+
// v1.6.0 / stage-132 T4 · T7:正文门 / 需求级计划门(补写指引 + 可复制的命令)
|
|
881
|
+
body_empty: bodyGateMessage(lang, data, id),
|
|
882
|
+
plan_missing: planGateMessage(lang, id),
|
|
687
883
|
invalid_status: doneGate
|
|
688
884
|
? doneGateMessage(lang, data, id, before ?? '')
|
|
689
885
|
: t('req.err.invalidStatusTmpl', lang, {
|
|
@@ -702,7 +898,14 @@ export function registerReqCommand(program) {
|
|
|
702
898
|
if (!saveOrFail(mgr, lang)) {
|
|
703
899
|
return;
|
|
704
900
|
}
|
|
705
|
-
|
|
901
|
+
if (planUnstamped) {
|
|
902
|
+
console.warn(t('req.warn.planUnstampedTmpl', lang, { id }));
|
|
903
|
+
}
|
|
904
|
+
console.log(t('req.advance.doneTmpl', lang, { id, from: before ?? '', to: options.to })
|
|
905
|
+
+ (planDeviationForced ? t('req.advance.planDeviationForcedSuffix', lang) : '')
|
|
906
|
+
+ (gateForced ? t('req.advance.gateForcedSuffix', lang) : ''));
|
|
907
|
+
// v1.6.0 / REQ-059 T8:流转成功即自动同步开发账本
|
|
908
|
+
syncDevAfterWrite(projectPath, lang);
|
|
706
909
|
});
|
|
707
910
|
// ── req waive <id> --reason <text> [--by] [--revoke] ──(v1.5.23 / REQ-043 / 六期 #8)
|
|
708
911
|
req
|
|
@@ -790,7 +993,7 @@ export function registerReqCommand(program) {
|
|
|
790
993
|
? t('req.trivial.revokedTmpl', lang, { id })
|
|
791
994
|
: t('req.trivial.doneTmpl', lang, { id, reason: options.reason ?? '' }));
|
|
792
995
|
});
|
|
793
|
-
// ── req complete <id> --result pass --note <t> [--kind] [--evidence] [--by] [--independent|--self] ──
|
|
996
|
+
// ── req complete <id> --result pass --note <t> [--kind] [--evidence] [--by] [--independent|--self] [--force] ──
|
|
794
997
|
// v1.5.23 / REQ-043(六期反馈 #1):一次收口 = review + verify + advance(done)。
|
|
795
998
|
// 复用既有判据单点(recordRequirementReview / recordRequirementVerification / advanceRequirement
|
|
796
999
|
// → canCompleteRequirement);任一步失败即返回,**不 save ⇒ flow.json 零变更**。
|
|
@@ -804,6 +1007,7 @@ export function registerReqCommand(program) {
|
|
|
804
1007
|
.option('--evidence <path>', '证据(测试命令 / 报告路径 / 摘要)')
|
|
805
1008
|
.option('--independent', '独立审查(推荐)')
|
|
806
1009
|
.option('--self', '自我审查(非独立;归档摘要标注 self-review)')
|
|
1010
|
+
.option('--force', '门留痕放行(正文/计划门写 waiver + 审计;文件仍须补写)')
|
|
807
1011
|
.action((id, options) => {
|
|
808
1012
|
const lang = getCliLang(process.cwd());
|
|
809
1013
|
const mgr = createManager();
|
|
@@ -834,14 +1038,41 @@ export function registerReqCommand(program) {
|
|
|
834
1038
|
process.exitCode = 1;
|
|
835
1039
|
return;
|
|
836
1040
|
}
|
|
1041
|
+
const projectPath = process.cwd();
|
|
1042
|
+
/** 门的 --force 通道(T4 正文 / T7 计划):写 waiver + 审计后由调用方用同一谓词重试 */
|
|
1043
|
+
const forceGate = (code) => {
|
|
1044
|
+
const forced = code === 'body_empty'
|
|
1045
|
+
? forceRequirementBodyWaiver(data, id, { by, reason: 'complete-force', gate: 'complete' })
|
|
1046
|
+
: forceRequirementPlanWaiver(data, id, { by, reason: 'complete-force', gate: 'complete' });
|
|
1047
|
+
if (!forced.ok) {
|
|
1048
|
+
failCode(lang, forced.code, {
|
|
1049
|
+
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
1050
|
+
invalid_status: t('req.complete.statusTmpl', lang, { id, status: getRequirement(data, id)?.status ?? '' }),
|
|
1051
|
+
});
|
|
1052
|
+
return false;
|
|
1053
|
+
}
|
|
1054
|
+
return true;
|
|
1055
|
+
};
|
|
1056
|
+
let gateForced = false;
|
|
837
1057
|
for (const step of ['scheduled', 'in_progress']) {
|
|
838
1058
|
if (stateNow !== 'draft' && stateNow !== 'scheduled')
|
|
839
1059
|
break;
|
|
840
|
-
|
|
1060
|
+
let moved = advanceRequirement(data, id, step, { projectPath });
|
|
1061
|
+
// 同一流转可能连撞两门(正文 + 计划):循环上限 = 门数(2),逐个留痕放行
|
|
1062
|
+
for (let i = 0; i < 2 && !moved.ok && options.force === true
|
|
1063
|
+
&& (moved.code === 'body_empty' || moved.code === 'plan_missing'); i += 1) {
|
|
1064
|
+
if (!forceGate(moved.code))
|
|
1065
|
+
return;
|
|
1066
|
+
moved = advanceRequirement(data, id, step, { projectPath });
|
|
1067
|
+
gateForced = moved.ok;
|
|
1068
|
+
}
|
|
841
1069
|
if (!moved.ok) {
|
|
842
1070
|
failCode(lang, moved.code, {
|
|
843
1071
|
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
844
1072
|
invalid_field: t('req.err.invalidFieldTmpl', lang, { id }),
|
|
1073
|
+
// v1.6.0 / stage-132 T4 · T7:自动补链同样过正文门 / 计划门(不因「一条命令」而绕过)
|
|
1074
|
+
body_empty: bodyGateMessage(lang, data, id),
|
|
1075
|
+
plan_missing: planGateMessage(lang, id),
|
|
845
1076
|
invalid_status: t('req.err.invalidStatusTmpl', lang, {
|
|
846
1077
|
id, to: step, current: stateNow, targets: getAllowedNextStatuses(stateNow).join(', '),
|
|
847
1078
|
}),
|
|
@@ -877,12 +1108,24 @@ export function registerReqCommand(program) {
|
|
|
877
1108
|
return;
|
|
878
1109
|
}
|
|
879
1110
|
const current = getRequirement(data, id)?.status ?? '';
|
|
880
|
-
|
|
1111
|
+
let advanced = advanceRequirement(data, id, 'done', { projectPath });
|
|
1112
|
+
for (let i = 0; i < 2 && !advanced.ok && options.force === true
|
|
1113
|
+
&& (advanced.code === 'body_empty' || advanced.code === 'plan_missing'); i += 1) {
|
|
1114
|
+
if (!forceGate(advanced.code))
|
|
1115
|
+
return;
|
|
1116
|
+
advanced = advanceRequirement(data, id, 'done', { projectPath });
|
|
1117
|
+
gateForced = advanced.ok;
|
|
1118
|
+
}
|
|
881
1119
|
if (!advanced.ok) {
|
|
882
1120
|
// 走到这里 = 审验记录已写但状态没推进:不 save(零写盘),按 done 门文案说明缺什么
|
|
883
1121
|
failCode(lang, advanced.code, {
|
|
884
1122
|
not_found: t('req.err.notFoundTmpl', lang, { id }),
|
|
885
1123
|
invalid_field: t('req.err.invalidFieldTmpl', lang, { id }),
|
|
1124
|
+
// v1.6.0 / REQ-056 T6:计划偏差门(done 门通过后)
|
|
1125
|
+
plan_deviation: t('req.err.planDeviationTmpl', lang, { id }),
|
|
1126
|
+
// v1.6.0 / stage-132 T4 · T7:正文门 / 计划门(先于 done 门)
|
|
1127
|
+
body_empty: bodyGateMessage(lang, data, id),
|
|
1128
|
+
plan_missing: planGateMessage(lang, id),
|
|
886
1129
|
invalid_status: doneGateMessage(lang, data, id, current),
|
|
887
1130
|
general_mode_conflict: t('req.err.generalModeConflictTmpl', lang, { id }),
|
|
888
1131
|
});
|
|
@@ -894,7 +1137,9 @@ export function registerReqCommand(program) {
|
|
|
894
1137
|
const suffix = independent ? '' : t('req.review.selfSuffix', lang);
|
|
895
1138
|
console.log(t('req.complete.doneTmpl', lang, {
|
|
896
1139
|
id, result: options.result, kind: options.kind ?? 'manual',
|
|
897
|
-
}) + suffix);
|
|
1140
|
+
}) + suffix + (gateForced ? t('req.complete.gateForcedSuffix', lang) : ''));
|
|
1141
|
+
// v1.6.0 / REQ-059 T8:收口成功即自动同步开发账本
|
|
1142
|
+
syncDevAfterWrite(projectPath, lang);
|
|
898
1143
|
});
|
|
899
1144
|
// ── req review <id> --result pass|fail --by <who> --note <text> [--independent|--self] ──
|
|
900
1145
|
req
|
|
@@ -950,6 +1195,8 @@ export function registerReqCommand(program) {
|
|
|
950
1195
|
}
|
|
951
1196
|
const suffix = options.independent === true ? '' : t('req.review.selfSuffix', lang);
|
|
952
1197
|
console.log(t('req.review.doneTmpl', lang, { id, result: options.result, by }) + suffix);
|
|
1198
|
+
// v1.6.0 / REQ-059 T8:审查记录写入成功即自动同步开发账本
|
|
1199
|
+
syncDevAfterWrite(process.cwd(), lang);
|
|
953
1200
|
});
|
|
954
1201
|
// ── req verify <id> --result pass|fail --kind test|manual|build --by <who> --note <text> [--evidence <path>] ──
|
|
955
1202
|
req
|
|
@@ -999,6 +1246,8 @@ export function registerReqCommand(program) {
|
|
|
999
1246
|
return;
|
|
1000
1247
|
}
|
|
1001
1248
|
console.log(t('req.verify.doneTmpl', lang, { id, kind: options.kind, result: options.result, by }));
|
|
1249
|
+
// v1.6.0 / REQ-059 T8:验证记录写入成功即自动同步开发账本
|
|
1250
|
+
syncDevAfterWrite(process.cwd(), lang);
|
|
1002
1251
|
});
|
|
1003
1252
|
// ── req split <id> --into <title> [--into <title>...] [--json] ──
|
|
1004
1253
|
req
|
|
@@ -1343,5 +1592,131 @@ export function registerReqCommand(program) {
|
|
|
1343
1592
|
console.log(t('req.rollover.itemTmpl', lang, { id: moved.id, status: moved.status, title: moved.title }));
|
|
1344
1593
|
}
|
|
1345
1594
|
});
|
|
1595
|
+
// ── req body <id> --section <name> (--text <md> | --file <path>) [--append|--replace] [--json] ──
|
|
1596
|
+
// v1.6.0-stage-132 / T2:需求正文**唯一写入口**(元信息小节受保护;每次写入追加 `## 变更记录`)
|
|
1597
|
+
req
|
|
1598
|
+
.command('body <id>')
|
|
1599
|
+
.description('写入需求正文的业务小节(元信息小节受保护;每次写入追加变更记录)')
|
|
1600
|
+
.requiredOption('--section <name>', '小节名(如 摘要 / 目标与验收 / 问题 / 初步规划;元信息小节不可写)')
|
|
1601
|
+
.option('--text <md>', '小节正文(Markdown;与 --file 二选一)')
|
|
1602
|
+
.option('--file <path>', '从文件读取小节正文(与 --text 二选一;相对路径按项目根解析)')
|
|
1603
|
+
.option('--append', '追加到该小节末尾(缺省替换整节)')
|
|
1604
|
+
.option('--replace', '替换整节(缺省;与 --append 互斥)')
|
|
1605
|
+
.option('--json', '以 JSON 输出 { schemaVersion, id, section, path, lines, created }')
|
|
1606
|
+
.action((id, options, command) => {
|
|
1607
|
+
const lang = getCliLang(process.cwd());
|
|
1608
|
+
const asJson = asJsonOf(options, command);
|
|
1609
|
+
const mgr = createManager();
|
|
1610
|
+
if (!mgr.isLoaded()) {
|
|
1611
|
+
failNoInit(lang, asJson);
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
if (!isValidReqId(id)) {
|
|
1615
|
+
if (asJson) {
|
|
1616
|
+
failJson({ error: 'invalid-argument', field: 'id', value: id });
|
|
1617
|
+
}
|
|
1618
|
+
else {
|
|
1619
|
+
console.error(t('req.invalidIdTmpl', lang, { input: id }));
|
|
1620
|
+
process.exitCode = 1;
|
|
1621
|
+
}
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
const data = mgr.getData();
|
|
1625
|
+
const req_ = getRequirement(data, id);
|
|
1626
|
+
if (!req_) {
|
|
1627
|
+
if (asJson) {
|
|
1628
|
+
failJson({ error: 'not_found', id });
|
|
1629
|
+
}
|
|
1630
|
+
else {
|
|
1631
|
+
console.error(t('req.err.notFoundTmpl', lang, { id }));
|
|
1632
|
+
process.exitCode = 1;
|
|
1633
|
+
}
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
// argument-shape 守卫(非业务校验):--text / --file 恰一;--append / --replace 互斥
|
|
1637
|
+
const hasText = options.text !== undefined;
|
|
1638
|
+
const hasFile = options.file !== undefined;
|
|
1639
|
+
if (!hasText && !hasFile) {
|
|
1640
|
+
if (asJson) {
|
|
1641
|
+
failJson({ error: 'empty_text', id, section: options.section });
|
|
1642
|
+
}
|
|
1643
|
+
else {
|
|
1644
|
+
console.error(t('req.body.noTextTmpl', lang));
|
|
1645
|
+
process.exitCode = 1;
|
|
1646
|
+
}
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
if (hasText && hasFile) {
|
|
1650
|
+
if (asJson) {
|
|
1651
|
+
failJson({ error: 'invalid_field', id, section: options.section, field: 'file' });
|
|
1652
|
+
}
|
|
1653
|
+
else {
|
|
1654
|
+
console.error(t('req.body.exclusiveTmpl', lang));
|
|
1655
|
+
process.exitCode = 1;
|
|
1656
|
+
}
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
if (options.append === true && options.replace === true) {
|
|
1660
|
+
if (asJson) {
|
|
1661
|
+
failJson({ error: 'invalid_field', id, section: options.section, field: 'append' });
|
|
1662
|
+
}
|
|
1663
|
+
else {
|
|
1664
|
+
console.error(t('req.body.flagExclusiveTmpl', lang));
|
|
1665
|
+
process.exitCode = 1;
|
|
1666
|
+
}
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
// v1.5.6-stage-114:写前 preflight(参数 / ID 校验已在门前)
|
|
1670
|
+
if (!enforcePreflightOrFail(process.cwd(), lang))
|
|
1671
|
+
return;
|
|
1672
|
+
try {
|
|
1673
|
+
const result = updateRequirementBody(process.cwd(), req_, {
|
|
1674
|
+
section: options.section,
|
|
1675
|
+
...(options.text !== undefined ? { text: options.text } : {}),
|
|
1676
|
+
...(options.file !== undefined ? { file: options.file } : {}),
|
|
1677
|
+
append: options.append === true,
|
|
1678
|
+
replace: options.replace === true,
|
|
1679
|
+
createSectionIfMissing: true,
|
|
1680
|
+
by: resolveActorName(process.cwd(), undefined),
|
|
1681
|
+
});
|
|
1682
|
+
// v1.6.0 / REQ-059 T8:正文写入成功即自动同步开发账本(--json 的告警走 stderr,不污染 stdout)
|
|
1683
|
+
syncDevAfterWrite(process.cwd(), lang);
|
|
1684
|
+
if (asJson) {
|
|
1685
|
+
emitJson(withSchemaVersion({
|
|
1686
|
+
id: req_.id,
|
|
1687
|
+
section: result.section,
|
|
1688
|
+
path: result.path,
|
|
1689
|
+
lines: result.lines,
|
|
1690
|
+
created: result.created,
|
|
1691
|
+
}));
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
const actionKey = result.created
|
|
1695
|
+
? 'req.body.actionCreated'
|
|
1696
|
+
: (options.append === true ? 'req.body.actionAppended' : 'req.body.actionReplaced');
|
|
1697
|
+
console.log(t('req.body.doneTmpl', lang, {
|
|
1698
|
+
id: req_.id,
|
|
1699
|
+
section: result.section,
|
|
1700
|
+
lines: String(result.lines),
|
|
1701
|
+
path: result.path,
|
|
1702
|
+
action: t(actionKey, lang),
|
|
1703
|
+
}));
|
|
1704
|
+
}
|
|
1705
|
+
catch (err) {
|
|
1706
|
+
if (err instanceof RequirementBodyUpdateError) {
|
|
1707
|
+
if (asJson) {
|
|
1708
|
+
failJson({ error: err.code, id, section: options.section });
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
const key = err.code === 'protected_section'
|
|
1712
|
+
? 'req.body.protectedTmpl'
|
|
1713
|
+
: (err.code === 'empty_text' ? 'req.body.emptyTmpl' : 'req.body.invalidFieldTmpl');
|
|
1714
|
+
console.error(t(key, lang, { id, section: options.section }));
|
|
1715
|
+
process.exitCode = 1;
|
|
1716
|
+
return;
|
|
1717
|
+
}
|
|
1718
|
+
failGeneric(lang, err);
|
|
1719
|
+
}
|
|
1720
|
+
});
|
|
1346
1721
|
}
|
|
1347
1722
|
//# sourceMappingURL=req.js.map
|