@lwelliott/cortex-cli 1.0.6 → 1.0.7
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 +51 -26
- package/dist/cli/formatters/markdown.d.ts.map +1 -1
- package/dist/cli/formatters/markdown.js +0 -4
- package/dist/cli/formatters/markdown.js.map +1 -1
- package/dist/cli/formatters/quiet.d.ts.map +1 -1
- package/dist/cli/formatters/quiet.js +0 -2
- package/dist/cli/formatters/quiet.js.map +1 -1
- package/dist/cli/formatters/table.d.ts.map +1 -1
- package/dist/cli/formatters/table.js +0 -5
- package/dist/cli/formatters/table.js.map +1 -1
- package/dist/cli/project-resolver.js +1 -1
- package/dist/cli/project-resolver.js.map +1 -1
- package/dist/cli/project.d.ts +0 -1
- package/dist/cli/project.d.ts.map +1 -1
- package/dist/cli/project.js +2 -35
- package/dist/cli/project.js.map +1 -1
- package/dist/cli/task.d.ts.map +1 -1
- package/dist/cli/task.js +22 -7
- package/dist/cli/task.js.map +1 -1
- package/dist/config/registry.d.ts +0 -9
- package/dist/config/registry.d.ts.map +1 -1
- package/dist/config/registry.js +1 -31
- package/dist/config/registry.js.map +1 -1
- package/dist/config/resolver.d.ts +3 -4
- package/dist/config/resolver.d.ts.map +1 -1
- package/dist/config/resolver.js +7 -24
- package/dist/config/resolver.js.map +1 -1
- package/dist/db/schema.d.ts +1 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +70 -4
- package/dist/db/schema.js.map +1 -1
- package/dist/models/common.d.ts +2 -2
- package/dist/models/common.d.ts.map +1 -1
- package/dist/models/project.d.ts +2 -4
- package/dist/models/project.d.ts.map +1 -1
- package/dist/models/project.js +0 -1
- package/dist/models/project.js.map +1 -1
- package/dist/services/project.d.ts +0 -10
- package/dist/services/project.d.ts.map +1 -1
- package/dist/services/project.js +2 -26
- package/dist/services/project.js.map +1 -1
- package/dist/services/stage-validator.d.ts +19 -18
- package/dist/services/stage-validator.d.ts.map +1 -1
- package/dist/services/stage-validator.js +41 -42
- package/dist/services/stage-validator.js.map +1 -1
- package/dist/services/task.d.ts +18 -21
- package/dist/services/task.d.ts.map +1 -1
- package/dist/services/task.js +96 -86
- package/dist/services/task.js.map +1 -1
- package/dist/state-machines/task-state.d.ts +8 -8
- package/dist/state-machines/task-state.d.ts.map +1 -1
- package/dist/state-machines/task-state.js +33 -31
- package/dist/state-machines/task-state.js.map +1 -1
- package/dist/utils/errors.d.ts +21 -51
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +63 -114
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/format.d.ts +0 -11
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +1 -10
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/levenshtein.d.ts +10 -0
- package/dist/utils/levenshtein.d.ts.map +1 -0
- package/dist/utils/levenshtein.js +42 -0
- package/dist/utils/levenshtein.js.map +1 -0
- package/dist/validators/owner-validator.d.ts +20 -16
- package/dist/validators/owner-validator.d.ts.map +1 -1
- package/dist/validators/owner-validator.js +37 -38
- package/dist/validators/owner-validator.js.map +1 -1
- package/package.json +9 -2
package/dist/services/project.js
CHANGED
|
@@ -8,8 +8,6 @@ exports.createProject = createProject;
|
|
|
8
8
|
exports.registerProject = registerProject;
|
|
9
9
|
exports.removeProject = removeProject;
|
|
10
10
|
exports.listAllProjects = listAllProjects;
|
|
11
|
-
exports.setProjectDefault = setProjectDefault;
|
|
12
|
-
exports.getDefaultProjectName = getDefaultProjectName;
|
|
13
11
|
exports.getProjectInfo = getProjectInfo;
|
|
14
12
|
exports.resolveProjectForCommand = resolveProjectForCommand;
|
|
15
13
|
const fs_1 = require("fs");
|
|
@@ -109,14 +107,12 @@ function createProject(name, folder, opts) {
|
|
|
109
107
|
db.close();
|
|
110
108
|
}
|
|
111
109
|
// Register in global registry
|
|
112
|
-
|
|
113
|
-
const isDefault = registry.default === name;
|
|
110
|
+
(0, registry_1.addProject)(name, absoluteFolder, opts?.registryPath);
|
|
114
111
|
return {
|
|
115
112
|
name,
|
|
116
113
|
folder: absoluteFolder,
|
|
117
114
|
dbPath,
|
|
118
115
|
isNew: !dbExisted,
|
|
119
|
-
isDefault,
|
|
120
116
|
};
|
|
121
117
|
}
|
|
122
118
|
/**
|
|
@@ -159,14 +155,12 @@ function registerProject(name, folder, opts) {
|
|
|
159
155
|
db.close();
|
|
160
156
|
}
|
|
161
157
|
// Register in global registry
|
|
162
|
-
|
|
163
|
-
const isDefault = registry.default === name;
|
|
158
|
+
(0, registry_1.addProject)(name, absoluteFolder, opts?.registryPath);
|
|
164
159
|
return {
|
|
165
160
|
name,
|
|
166
161
|
folder: absoluteFolder,
|
|
167
162
|
dbPath,
|
|
168
163
|
isNew: !dbExisted,
|
|
169
|
-
isDefault,
|
|
170
164
|
};
|
|
171
165
|
}
|
|
172
166
|
/**
|
|
@@ -190,21 +184,6 @@ function removeProject(name, opts) {
|
|
|
190
184
|
function listAllProjects(opts) {
|
|
191
185
|
return (0, registry_1.listProjects)(opts?.registryPath);
|
|
192
186
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Set the default project.
|
|
195
|
-
*
|
|
196
|
-
* @throws ProjectNotFoundError (ERR-PROJ-007) if the project doesn't exist
|
|
197
|
-
*/
|
|
198
|
-
function setProjectDefault(name, opts) {
|
|
199
|
-
(0, registry_1.setDefaultProject)(name, opts?.registryPath);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Get the current default project name.
|
|
203
|
-
*/
|
|
204
|
-
function getDefaultProjectName(opts) {
|
|
205
|
-
const registry = (0, registry_1.loadRegistry)(opts?.registryPath);
|
|
206
|
-
return registry.default;
|
|
207
|
-
}
|
|
208
187
|
/**
|
|
209
188
|
* Show project details: folder, database path, sprint summary, entity counts.
|
|
210
189
|
*
|
|
@@ -212,9 +191,7 @@ function getDefaultProjectName(opts) {
|
|
|
212
191
|
*/
|
|
213
192
|
function getProjectInfo(name, opts) {
|
|
214
193
|
const entry = (0, registry_1.getProject)(name, opts?.registryPath);
|
|
215
|
-
const registry = (0, registry_1.loadRegistry)(opts?.registryPath);
|
|
216
194
|
const dbPath = `${entry.folder}/pmp/project.db`;
|
|
217
|
-
const isDefault = registry.default === name;
|
|
218
195
|
// Query the database for summary counts
|
|
219
196
|
let sprintCount = 0;
|
|
220
197
|
let activeSprintCount = 0;
|
|
@@ -236,7 +213,6 @@ function getProjectInfo(name, opts) {
|
|
|
236
213
|
name,
|
|
237
214
|
folder: entry.folder,
|
|
238
215
|
dbPath,
|
|
239
|
-
isDefault,
|
|
240
216
|
sprintCount,
|
|
241
217
|
activeSprintCount,
|
|
242
218
|
docCount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/services/project.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wEAAwE;AACxE,uDAAuD;;
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/services/project.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wEAAwE;AACxE,uDAAuD;;AA4CvD,kDA4BC;AAYD,sCAyDC;AAYD,0CAyCC;AAQD,sCASC;AAKD,0CAEC;AAOD,wCAgCC;AAMD,4DAKC;AA1QD,2BAAsD;AACtD,+BAA8C;AAE9C,iDAAkD;AAClD,+CAAmD;AACnD,iDAK4B;AAC5B,iDAAoD;AACpD,4CASyB;AAUzB;;;;;;;;;;GAUG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,8BAAqB,EAAE,CAAC;IACpC,CAAC;IAED,wDAAwD;IACxD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAuB,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B,QAAQ;QACR,SAAS;KACV,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,IAA4B;IACnE,OAAO,IAAA,yBAAc,EAAC;QACpB,YAAY,EAAE,IAAI,EAAE,YAAY;QAChC,GAAG,EAAE,IAAI,EAAE,GAAG;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import type { TaskStage } from '../models/common';
|
|
2
|
-
/** Canonical stage sequence
|
|
2
|
+
/** Canonical stage sequence — 6 consolidated stages */
|
|
3
3
|
export declare const CANONICAL_STAGES: TaskStage[];
|
|
4
4
|
/**
|
|
5
|
-
* Check if a given string is a valid stage value.
|
|
5
|
+
* Check if a given string is a valid stage value (case-insensitive).
|
|
6
6
|
*/
|
|
7
7
|
export declare function isValidStage(stage: string): stage is TaskStage;
|
|
8
|
+
/**
|
|
9
|
+
* Normalize a stage value to canonical case.
|
|
10
|
+
* Returns null if the value is not a valid stage.
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeStage(stage: string): TaskStage | null;
|
|
8
13
|
/**
|
|
9
14
|
* Return the canonical stage sequence.
|
|
10
15
|
*/
|
|
11
16
|
export declare function getValidStages(): TaskStage[];
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
18
|
+
* Validate a stage value case-insensitively with closest-match suggestions.
|
|
19
|
+
*
|
|
20
|
+
* @param stage - The stage value to validate
|
|
21
|
+
* @returns The canonical stage value if valid
|
|
22
|
+
* @throws StageInvalidError with closest-match suggestions if invalid
|
|
15
23
|
*/
|
|
16
|
-
export declare function
|
|
24
|
+
export declare function validateStage(stage: string): TaskStage;
|
|
17
25
|
/**
|
|
18
26
|
* Validate that a stage progression is valid.
|
|
19
27
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* - SR-002: Intermediate stages may be skipped
|
|
23
|
-
* - SR-003: Release is the final stage
|
|
24
|
-
* - SR-004: Dropped status locks the task — no stage changes
|
|
25
|
-
* - SR-005: Same-stage transitions are rejected
|
|
28
|
+
* v2: Free stage transitions. Forward, backward, and same-stage all allowed.
|
|
29
|
+
* No forward-only enforcement. No Dropped lock. No owner-for-stage check.
|
|
26
30
|
*
|
|
27
|
-
* @param currentStage - The task's current stage
|
|
31
|
+
* @param currentStage - The task's current stage (unused in v2, kept for API compatibility)
|
|
28
32
|
* @param targetStage - The desired target stage
|
|
29
|
-
* @param taskStatus - The task's current status (
|
|
30
|
-
* @throws StageInvalidError if target is not a valid stage
|
|
31
|
-
* @throws StageLockedError if task is Dropped
|
|
32
|
-
* @throws StageNoProgressError if target is same as current
|
|
33
|
-
* @throws StageBackwardError if target is backward of current
|
|
33
|
+
* @param taskStatus - The task's current status (unused in v2, kept for API compatibility)
|
|
34
34
|
*/
|
|
35
|
-
export declare function validateProgression(
|
|
35
|
+
export declare function validateProgression(_currentStage: TaskStage, _targetStage: TaskStage, _taskStatus: string): void;
|
|
36
|
+
export { validateStage as validateStageValue };
|
|
36
37
|
//# sourceMappingURL=stage-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage-validator.d.ts","sourceRoot":"","sources":["../../src/services/stage-validator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"stage-validator.d.ts","sourceRoot":"","sources":["../../src/services/stage-validator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,EAAE,SAAS,EAOvC,CAAC;AAOF;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAE9D;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,SAAS,EAAE,CAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAQtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,SAAS,EACxB,YAAY,EAAE,SAAS,EACvB,WAAW,EAAE,MAAM,GAClB,IAAI,CAIN;AAGD,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Stage progression validator
|
|
3
|
-
// Pure function module — validates
|
|
4
|
-
// Implements AD-0031: Stage
|
|
5
|
-
// + FS-SS-030-0001 (stage progression engine)
|
|
6
|
-
//
|
|
3
|
+
// Pure function module — validates stage values case-insensitively
|
|
4
|
+
// Implements AD-0031 v2: Consolidated Stage/Status Workflow Engine
|
|
5
|
+
// + FS-SS-030-0001 (stage progression engine v2)
|
|
6
|
+
// 6 consolidated stages, freely reversible, case-insensitive with closest-match suggestions
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.CANONICAL_STAGES = void 0;
|
|
9
9
|
exports.isValidStage = isValidStage;
|
|
10
|
+
exports.normalizeStage = normalizeStage;
|
|
10
11
|
exports.getValidStages = getValidStages;
|
|
11
|
-
exports.
|
|
12
|
+
exports.validateStage = validateStage;
|
|
13
|
+
exports.validateStageValue = validateStage;
|
|
12
14
|
exports.validateProgression = validateProgression;
|
|
13
15
|
const errors_1 = require("../utils/errors");
|
|
14
|
-
|
|
16
|
+
const levenshtein_1 = require("../utils/levenshtein");
|
|
17
|
+
/** Canonical stage sequence — 6 consolidated stages */
|
|
15
18
|
exports.CANONICAL_STAGES = [
|
|
16
19
|
'Planning',
|
|
17
|
-
'Requirement',
|
|
18
|
-
'Specification',
|
|
20
|
+
'Requirement+Specification',
|
|
19
21
|
'Design',
|
|
20
|
-
'Test Plan',
|
|
21
22
|
'Implementation',
|
|
22
23
|
'Testing',
|
|
23
24
|
'Release',
|
|
24
25
|
];
|
|
26
|
+
/** Lowercase mapping for case-insensitive lookup */
|
|
27
|
+
const STAGE_LOWERCASE_MAP = new Map(exports.CANONICAL_STAGES.map(s => [s.toLowerCase(), s]));
|
|
25
28
|
/**
|
|
26
|
-
* Check if a given string is a valid stage value.
|
|
29
|
+
* Check if a given string is a valid stage value (case-insensitive).
|
|
27
30
|
*/
|
|
28
31
|
function isValidStage(stage) {
|
|
29
|
-
return
|
|
32
|
+
return STAGE_LOWERCASE_MAP.has(stage.toLowerCase());
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Normalize a stage value to canonical case.
|
|
36
|
+
* Returns null if the value is not a valid stage.
|
|
37
|
+
*/
|
|
38
|
+
function normalizeStage(stage) {
|
|
39
|
+
return STAGE_LOWERCASE_MAP.get(stage.toLowerCase()) ?? null;
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
42
|
* Return the canonical stage sequence.
|
|
@@ -35,44 +45,33 @@ function getValidStages() {
|
|
|
35
45
|
return [...exports.CANONICAL_STAGES];
|
|
36
46
|
}
|
|
37
47
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
48
|
+
* Validate a stage value case-insensitively with closest-match suggestions.
|
|
49
|
+
*
|
|
50
|
+
* @param stage - The stage value to validate
|
|
51
|
+
* @returns The canonical stage value if valid
|
|
52
|
+
* @throws StageInvalidError with closest-match suggestions if invalid
|
|
40
53
|
*/
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
function validateStage(stage) {
|
|
55
|
+
const normalized = normalizeStage(stage);
|
|
56
|
+
if (normalized !== null) {
|
|
57
|
+
return normalized;
|
|
58
|
+
}
|
|
59
|
+
const suggestions = (0, levenshtein_1.getClosestMatches)(stage, exports.CANONICAL_STAGES);
|
|
60
|
+
throw new errors_1.StageInvalidError(stage, suggestions);
|
|
45
61
|
}
|
|
46
62
|
/**
|
|
47
63
|
* Validate that a stage progression is valid.
|
|
48
64
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* - SR-002: Intermediate stages may be skipped
|
|
52
|
-
* - SR-003: Release is the final stage
|
|
53
|
-
* - SR-004: Dropped status locks the task — no stage changes
|
|
54
|
-
* - SR-005: Same-stage transitions are rejected
|
|
65
|
+
* v2: Free stage transitions. Forward, backward, and same-stage all allowed.
|
|
66
|
+
* No forward-only enforcement. No Dropped lock. No owner-for-stage check.
|
|
55
67
|
*
|
|
56
|
-
* @param currentStage - The task's current stage
|
|
68
|
+
* @param currentStage - The task's current stage (unused in v2, kept for API compatibility)
|
|
57
69
|
* @param targetStage - The desired target stage
|
|
58
|
-
* @param taskStatus - The task's current status (
|
|
59
|
-
* @throws StageInvalidError if target is not a valid stage
|
|
60
|
-
* @throws StageLockedError if task is Dropped
|
|
61
|
-
* @throws StageNoProgressError if target is same as current
|
|
62
|
-
* @throws StageBackwardError if target is backward of current
|
|
70
|
+
* @param taskStatus - The task's current status (unused in v2, kept for API compatibility)
|
|
63
71
|
*/
|
|
64
|
-
function validateProgression(
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
// Check same-stage no-op
|
|
70
|
-
if (currentStage === targetStage) {
|
|
71
|
-
throw new errors_1.StageNoProgressError('(task)', currentStage);
|
|
72
|
-
}
|
|
73
|
-
// Check forward progression
|
|
74
|
-
if (!isForward(currentStage, targetStage)) {
|
|
75
|
-
throw new errors_1.StageBackwardError(currentStage, targetStage);
|
|
76
|
-
}
|
|
72
|
+
function validateProgression(_currentStage, _targetStage, _taskStatus) {
|
|
73
|
+
// v2: No validation restrictions. All stage transitions are freely allowed.
|
|
74
|
+
// No forward-only enforcement, no backward rejection, no same-stage rejection,
|
|
75
|
+
// no Dropped lock, no owner-for-stage check.
|
|
77
76
|
}
|
|
78
77
|
//# sourceMappingURL=stage-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage-validator.js","sourceRoot":"","sources":["../../src/services/stage-validator.ts"],"names":[],"mappings":";AAAA,8BAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"stage-validator.js","sourceRoot":"","sources":["../../src/services/stage-validator.ts"],"names":[],"mappings":";AAAA,8BAA8B;AAC9B,mEAAmE;AACnE,mEAAmE;AACnE,iDAAiD;AACjD,4FAA4F;;;AAwB5F,oCAEC;AAMD,wCAEC;AAKD,wCAEC;AASD,sCAQC;AAuByB,2CAAkB;AAX5C,kDAQC;AA3ED,4CAAoD;AACpD,sDAAyD;AAEzD,uDAAuD;AAC1C,QAAA,gBAAgB,GAAgB;IAC3C,UAAU;IACV,2BAA2B;IAC3B,QAAQ;IACR,gBAAgB;IAChB,SAAS;IACT,SAAS;CACV,CAAC;AAEF,oDAAoD;AACpD,MAAM,mBAAmB,GAA2B,IAAI,GAAG,CACzD,wBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAChD,CAAC;AAEF;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc;IAC5B,OAAO,CAAC,GAAG,wBAAgB,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,KAAa;IACzC,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACzC,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,+BAAiB,EAAC,KAAK,EAAE,wBAA4B,CAAC,CAAC;IAC3E,MAAM,IAAI,0BAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,mBAAmB,CACjC,aAAwB,EACxB,YAAuB,EACvB,WAAmB;IAEnB,4EAA4E;IAC5E,+EAA+E;IAC/E,6CAA6C;AAC/C,CAAC"}
|
package/dist/services/task.d.ts
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
import type Database from 'better-sqlite3';
|
|
2
2
|
import type { Task, TaskResult, TaskDetail, TaskAddOptions, TaskMoveContext, TaskUpdateFields } from '../models/task';
|
|
3
3
|
import type { TaskStatus } from '../models/common';
|
|
4
|
-
import { validateOwnerRole
|
|
4
|
+
import { validateOwnerRole } from '../validators/owner-validator';
|
|
5
5
|
/**
|
|
6
6
|
* Add a new task to a sprint.
|
|
7
7
|
*
|
|
8
|
+
* v2: No captain-only owner validation. Any valid role can own a task in any stage.
|
|
9
|
+
*
|
|
8
10
|
* @param db - Database connection
|
|
9
11
|
* @param sprintId - Sprint ID
|
|
10
12
|
* @param content - Task content (nullable; can be populated via --content-file)
|
|
11
|
-
* @param owner - Owner role (must be valid
|
|
13
|
+
* @param owner - Owner role (must be valid)
|
|
12
14
|
* @param opts - Optional task properties
|
|
13
15
|
* @returns The created task result
|
|
14
16
|
* @throws TaskBadSprintError if sprint doesn't exist or is closed
|
|
15
17
|
* @throws TaskOwnerRequiredError if owner is empty
|
|
16
|
-
* @throws various
|
|
18
|
+
* @throws various validation errors
|
|
17
19
|
*/
|
|
18
20
|
export declare function addTask(db: Database.Database, sprintId: string, content: string | null, owner: string, opts?: TaskAddOptions): TaskResult;
|
|
19
21
|
/**
|
|
20
|
-
* Move a task: status transition, stage transition, or combined.
|
|
22
|
+
* Move a task: status transition, stage transition, owner change, or combined.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* v2 per AD-0039 / AD-0031:
|
|
25
|
+
* - Case-insensitive validation for status, stage, owner
|
|
26
|
+
* - Closest-match suggestions via Levenshtein distance
|
|
27
|
+
* - Free stage transitions (forward, backward, same-stage all allowed)
|
|
28
|
+
* - Non-terminal Dropped (can recover to Backlog/To Do)
|
|
29
|
+
* - Dry-run mode: validate without persisting
|
|
30
|
+
* - Compulsory parameters: at least one of --to, --stage, --owner
|
|
31
|
+
* - No --sprint override; move always operates on active sprint
|
|
24
32
|
*
|
|
25
33
|
* @param db - Database connection
|
|
26
34
|
* @param taskId - Task ID (4-digit NNNN)
|
|
27
|
-
* @param opts - Move options: targetStatus, targetStage, context
|
|
35
|
+
* @param opts - Move options: targetStatus, targetStage, context, dryRun, sprintId
|
|
28
36
|
* @returns Updated task result
|
|
29
37
|
*/
|
|
30
38
|
export declare function moveTask(db: Database.Database, taskId: string, opts: {
|
|
@@ -32,32 +40,21 @@ export declare function moveTask(db: Database.Database, taskId: string, opts: {
|
|
|
32
40
|
targetStage?: string;
|
|
33
41
|
context?: TaskMoveContext;
|
|
34
42
|
sprintId?: string;
|
|
43
|
+
dryRun?: boolean;
|
|
35
44
|
}): TaskResult;
|
|
36
45
|
/**
|
|
37
46
|
* Update task metadata (content/type/priority/points/scope/acceptance).
|
|
38
47
|
* Does NOT change task status, stage, owner, or sprint — use moveTask for those.
|
|
39
48
|
*
|
|
40
49
|
* Per AD-0038: rejects stage, owner, sprint fields at the service layer.
|
|
41
|
-
*
|
|
42
|
-
* @throws TaskNotFoundError if task doesn't exist
|
|
43
|
-
* @throws TaskInvalidFieldError if prohibited fields are present
|
|
44
50
|
*/
|
|
45
51
|
export declare function updateTask(db: Database.Database, taskId: string, fields: TaskUpdateFields, sprintId?: string): TaskResult;
|
|
46
52
|
/**
|
|
47
|
-
* Remove a task (
|
|
48
|
-
*
|
|
49
|
-
* @param db - Database connection
|
|
50
|
-
* @param taskId - Task ID
|
|
51
|
-
* @throws TaskNotFoundError if task doesn't exist
|
|
53
|
+
* Remove a task (permanent delete).
|
|
52
54
|
*/
|
|
53
55
|
export declare function removeTask(db: Database.Database, taskId: string, sprintId?: string): void;
|
|
54
56
|
/**
|
|
55
57
|
* Show detailed task information including sprint name and parent content.
|
|
56
|
-
*
|
|
57
|
-
* @param db - Database connection
|
|
58
|
-
* @param taskId - Task ID
|
|
59
|
-
* @param sprintId - Sprint ID (required for sprint-scoped lookup per URD-026)
|
|
60
|
-
* @throws TaskNotFoundError if task doesn't exist or is not in the specified sprint
|
|
61
58
|
*/
|
|
62
59
|
export declare function showTask(db: Database.Database, taskId: string, sprintId?: string): TaskDetail;
|
|
63
60
|
/**
|
|
@@ -71,5 +68,5 @@ export declare function listTasks(db: Database.Database, sprintId: string, filte
|
|
|
71
68
|
* Get task status counts for a sprint.
|
|
72
69
|
*/
|
|
73
70
|
export declare function getTaskStatusCounts(db: Database.Database, sprintId: string): Record<string, number>;
|
|
74
|
-
export {
|
|
71
|
+
export { validateOwnerRole };
|
|
75
72
|
//# sourceMappingURL=task.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/services/task.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/services/task.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtH,OAAO,KAAK,EAAE,UAAU,EAA+C,MAAM,kBAAkB,CAAC;AAyBhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AA6DlE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CACrB,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAA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