@lwelliott/cortex-cli 1.0.6 → 1.0.8
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 +53 -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/config.d.ts +8 -2
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +25 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/paths.d.ts +13 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +76 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/registry.d.ts +10 -12
- package/dist/config/registry.d.ts.map +1 -1
- package/dist/config/registry.js +50 -44
- package/dist/config/registry.js.map +1 -1
- package/dist/config/resolver.d.ts +5 -9
- package/dist/config/resolver.d.ts.map +1 -1
- package/dist/config/resolver.js +12 -46
- 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 +4 -6
- 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 +6 -30
- 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 +26 -55
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +73 -124
- 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/cli/entity.d.ts +0 -3
- package/dist/cli/entity.d.ts.map +0 -1
- package/dist/cli/entity.js +0 -135
- package/dist/cli/entity.js.map +0 -1
- package/dist/cli/schema.d.ts +0 -3
- package/dist/cli/schema.d.ts.map +0 -1
- package/dist/cli/schema.js +0 -94
- package/dist/cli/schema.js.map +0 -1
- package/dist/db/builtin-schema-constants.d.ts +0 -109
- package/dist/db/builtin-schema-constants.d.ts.map +0 -1
- package/dist/db/builtin-schema-constants.js +0 -32
- package/dist/db/builtin-schema-constants.js.map +0 -1
- package/dist/models/entity-model.d.ts +0 -30
- package/dist/models/entity-model.d.ts.map +0 -1
- package/dist/models/entity-model.js +0 -99
- package/dist/models/entity-model.js.map +0 -1
- package/dist/services/audit-checks/mapping-check.d.ts +0 -4
- package/dist/services/audit-checks/mapping-check.d.ts.map +0 -1
- package/dist/services/audit-checks/mapping-check.js +0 -74
- package/dist/services/audit-checks/mapping-check.js.map +0 -1
- package/dist/services/audit-checks/orphan-entities-check.d.ts +0 -4
- package/dist/services/audit-checks/orphan-entities-check.d.ts.map +0 -1
- package/dist/services/audit-checks/orphan-entities-check.js +0 -39
- package/dist/services/audit-checks/orphan-entities-check.js.map +0 -1
- package/dist/services/audit-checks/sprint-consistency-check.d.ts +0 -4
- package/dist/services/audit-checks/sprint-consistency-check.d.ts.map +0 -1
- package/dist/services/audit-checks/sprint-consistency-check.js +0 -80
- package/dist/services/audit-checks/sprint-consistency-check.js.map +0 -1
- package/dist/services/audit-checks/type-mismatch-check.d.ts +0 -4
- package/dist/services/audit-checks/type-mismatch-check.d.ts.map +0 -1
- package/dist/services/audit-checks/type-mismatch-check.js +0 -55
- package/dist/services/audit-checks/type-mismatch-check.js.map +0 -1
- package/dist/services/doc-entity-mapping.d.ts +0 -19
- package/dist/services/doc-entity-mapping.d.ts.map +0 -1
- package/dist/services/doc-entity-mapping.js +0 -35
- package/dist/services/doc-entity-mapping.js.map +0 -1
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
import type { RoleName
|
|
1
|
+
import type { RoleName } from '../models/common';
|
|
2
2
|
/** Valid role names */
|
|
3
3
|
export declare const VALID_ROLES: RoleName[];
|
|
4
4
|
/**
|
|
5
|
-
* Check if a given string is a valid role name.
|
|
5
|
+
* Check if a given string is a valid role name (case-insensitive).
|
|
6
6
|
*/
|
|
7
7
|
export declare function isValidRole(role: string): role is RoleName;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Normalize a role name to canonical case.
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeRole(role: string): RoleName | null;
|
|
12
|
+
/**
|
|
13
|
+
* Validate that an owner role string is a valid role name (case-insensitive).
|
|
10
14
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* - Other stages: any valid role is allowed
|
|
15
|
+
* v2: Basic role-name validation only — no stage-based captain-only rules.
|
|
16
|
+
* Returns the normalized role name on success.
|
|
14
17
|
*
|
|
15
|
-
* @param owner - The
|
|
16
|
-
* @
|
|
17
|
-
* @throws
|
|
18
|
-
* @throws TaskOwnerReleaseError if captain-only but owner is not captain
|
|
19
|
-
* @throws TaskInvalidOwnerError if the owner role is not a valid role name
|
|
18
|
+
* @param owner - The owner role to validate
|
|
19
|
+
* @returns The canonical role name
|
|
20
|
+
* @throws TaskInvalidOwnerError with closest-match suggestions if invalid
|
|
20
21
|
*/
|
|
21
|
-
export declare function
|
|
22
|
+
export declare function validateOwnerRole(owner: string): RoleName;
|
|
22
23
|
/**
|
|
23
|
-
* Validate that an owner
|
|
24
|
-
*
|
|
24
|
+
* Validate that an owner can own a task in a given stage.
|
|
25
|
+
*
|
|
26
|
+
* v2: No captain-only restrictions. Any valid role can own a task in any stage.
|
|
27
|
+
* Kept for API compatibility — delegates to validateOwnerRole.
|
|
25
28
|
*
|
|
26
|
-
* @
|
|
29
|
+
* @param owner - The task owner role
|
|
30
|
+
* @param _stage - The task stage (unused in v2)
|
|
27
31
|
*/
|
|
28
|
-
export declare function
|
|
32
|
+
export declare function validateOwnerForStage(owner: string, _stage?: unknown): void;
|
|
29
33
|
export { validateOwnerForStage as validateOwnerForState };
|
|
30
34
|
//# sourceMappingURL=owner-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner-validator.d.ts","sourceRoot":"","sources":["../../src/validators/owner-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"owner-validator.d.ts","sourceRoot":"","sources":["../../src/validators/owner-validator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD,uBAAuB;AACvB,eAAO,MAAM,WAAW,EAAE,QAAQ,EAOjC,CAAC;AAOF;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,QAAQ,CAE1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAE3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAQzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAE3E;AAGD,OAAO,EAAE,qBAAqB,IAAI,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Owner validator
|
|
3
|
-
//
|
|
4
|
-
// Implements AD-
|
|
5
|
-
//
|
|
6
|
-
// + FS-SS-005-0011 (captain-only
|
|
7
|
-
// Updated per URD-030: stage-based not state-based
|
|
3
|
+
// Basic role-name validation only (case-insensitive with closest-match suggestions)
|
|
4
|
+
// Implements AD-0031 v2: Consolidated Stage/Status Workflow Engine
|
|
5
|
+
// v2: No stage-based captain-only rules — basic role-name validation only
|
|
6
|
+
// + FS-SS-005-0010, FS-SS-005-0011 (captain-only removed in v2)
|
|
8
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
8
|
exports.VALID_ROLES = void 0;
|
|
10
9
|
exports.isValidRole = isValidRole;
|
|
10
|
+
exports.normalizeRole = normalizeRole;
|
|
11
|
+
exports.validateOwnerRole = validateOwnerRole;
|
|
11
12
|
exports.validateOwnerForStage = validateOwnerForStage;
|
|
12
13
|
exports.validateOwnerForState = validateOwnerForStage;
|
|
13
|
-
exports.validateOwnerRole = validateOwnerRole;
|
|
14
|
-
const task_state_1 = require("../state-machines/task-state");
|
|
15
14
|
const errors_1 = require("../utils/errors");
|
|
15
|
+
const levenshtein_1 = require("../utils/levenshtein");
|
|
16
16
|
/** Valid role names */
|
|
17
17
|
exports.VALID_ROLES = [
|
|
18
18
|
'analyst',
|
|
@@ -22,49 +22,48 @@ exports.VALID_ROLES = [
|
|
|
22
22
|
'master',
|
|
23
23
|
'captain',
|
|
24
24
|
];
|
|
25
|
+
/** Lowercase mapping for case-insensitive lookup */
|
|
26
|
+
const ROLE_LOWERCASE_MAP = new Map(exports.VALID_ROLES.map(r => [r.toLowerCase(), r]));
|
|
25
27
|
/**
|
|
26
|
-
* Check if a given string is a valid role name.
|
|
28
|
+
* Check if a given string is a valid role name (case-insensitive).
|
|
27
29
|
*/
|
|
28
30
|
function isValidRole(role) {
|
|
29
|
-
return
|
|
31
|
+
return ROLE_LOWERCASE_MAP.has(role.toLowerCase());
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
34
|
+
* Normalize a role name to canonical case.
|
|
35
|
+
*/
|
|
36
|
+
function normalizeRole(role) {
|
|
37
|
+
return ROLE_LOWERCASE_MAP.get(role.toLowerCase()) ?? null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate that an owner role string is a valid role name (case-insensitive).
|
|
33
41
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* - Other stages: any valid role is allowed
|
|
42
|
+
* v2: Basic role-name validation only — no stage-based captain-only rules.
|
|
43
|
+
* Returns the normalized role name on success.
|
|
37
44
|
*
|
|
38
|
-
* @param owner - The
|
|
39
|
-
* @
|
|
40
|
-
* @throws
|
|
41
|
-
* @throws TaskOwnerReleaseError if captain-only but owner is not captain
|
|
42
|
-
* @throws TaskInvalidOwnerError if the owner role is not a valid role name
|
|
45
|
+
* @param owner - The owner role to validate
|
|
46
|
+
* @returns The canonical role name
|
|
47
|
+
* @throws TaskInvalidOwnerError with closest-match suggestions if invalid
|
|
43
48
|
*/
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
// Captain-only stages: Planning and Release
|
|
50
|
-
if (task_state_1.CAPTAIN_ONLY_STAGES.includes(stage) && owner !== 'captain') {
|
|
51
|
-
if (stage === 'Planning') {
|
|
52
|
-
throw new errors_1.TaskOwnerPlanningError(owner);
|
|
53
|
-
}
|
|
54
|
-
if (stage === 'Release') {
|
|
55
|
-
throw new errors_1.TaskOwnerReleaseError(owner);
|
|
56
|
-
}
|
|
49
|
+
function validateOwnerRole(owner) {
|
|
50
|
+
const normalized = normalizeRole(owner);
|
|
51
|
+
if (normalized !== null) {
|
|
52
|
+
return normalized;
|
|
57
53
|
}
|
|
54
|
+
const suggestions = (0, levenshtein_1.getClosestMatches)(owner, exports.VALID_ROLES);
|
|
55
|
+
throw new errors_1.TaskInvalidOwnerError(owner, suggestions);
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
60
|
-
* Validate that an owner
|
|
61
|
-
*
|
|
58
|
+
* Validate that an owner can own a task in a given stage.
|
|
59
|
+
*
|
|
60
|
+
* v2: No captain-only restrictions. Any valid role can own a task in any stage.
|
|
61
|
+
* Kept for API compatibility — delegates to validateOwnerRole.
|
|
62
62
|
*
|
|
63
|
-
* @
|
|
63
|
+
* @param owner - The task owner role
|
|
64
|
+
* @param _stage - The task stage (unused in v2)
|
|
64
65
|
*/
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
throw new errors_1.TaskInvalidOwnerError(owner, exports.VALID_ROLES);
|
|
68
|
-
}
|
|
66
|
+
function validateOwnerForStage(owner, _stage) {
|
|
67
|
+
validateOwnerRole(owner);
|
|
69
68
|
}
|
|
70
69
|
//# sourceMappingURL=owner-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner-validator.js","sourceRoot":"","sources":["../../src/validators/owner-validator.ts"],"names":[],"mappings":";AAAA,kBAAkB;AAClB,
|
|
1
|
+
{"version":3,"file":"owner-validator.js","sourceRoot":"","sources":["../../src/validators/owner-validator.ts"],"names":[],"mappings":";AAAA,kBAAkB;AAClB,oFAAoF;AACpF,mEAAmE;AACnE,0EAA0E;AAC1E,gEAAgE;;;AAwBhE,kCAEC;AAKD,sCAEC;AAYD,8CAQC;AAWD,sDAEC;AAGiC,sDAAqB;AAlEvD,4CAAwD;AACxD,sDAAyD;AAEzD,uBAAuB;AACV,QAAA,WAAW,GAAe;IACrC,SAAS;IACT,WAAW;IACX,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;CACV,CAAC;AAEF,oDAAoD;AACpD,MAAM,kBAAkB,GAA0B,IAAI,GAAG,CACvD,mBAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAC3C,CAAC;AAEF;;GAEG;AACH,SAAgB,WAAW,CAAC,IAAY;IACtC,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;AAC5D,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,+BAAiB,EAAC,KAAK,EAAE,mBAAuB,CAAC,CAAC;IACtE,MAAM,IAAI,8BAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,KAAa,EAAE,MAAgB;IACnE,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwelliott/cortex-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "A TypeScript CLI for managing software project artifacts backed by SQLite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,14 @@
|
|
|
33
33
|
"README.md",
|
|
34
34
|
"LICENSE"
|
|
35
35
|
],
|
|
36
|
-
"keywords": [
|
|
36
|
+
"keywords": [
|
|
37
|
+
"cli",
|
|
38
|
+
"project-management",
|
|
39
|
+
"sprint",
|
|
40
|
+
"kanban",
|
|
41
|
+
"sqlite",
|
|
42
|
+
"typescript"
|
|
43
|
+
],
|
|
37
44
|
"author": "lwelliot",
|
|
38
45
|
"dependencies": {
|
|
39
46
|
"better-sqlite3": "^11.7.0",
|
package/dist/cli/entity.d.ts
DELETED
package/dist/cli/entity.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/cli/entity.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoBpC,wBAAgB,iBAAiB,IAAI,OAAO,CAuC3C"}
|
package/dist/cli/entity.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// CLI subcommands for entity group
|
|
3
|
-
// SAD-0003: MOD-009 Entity CRUD
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.createEntityGroup = createEntityGroup;
|
|
6
|
-
const commander_1 = require("commander");
|
|
7
|
-
const graph_service_1 = require("../services/graph-service");
|
|
8
|
-
const graph_service_2 = require("../services/graph-service");
|
|
9
|
-
const connection_1 = require("../db/connection");
|
|
10
|
-
const migration_1 = require("../db/migration");
|
|
11
|
-
const project_resolver_1 = require("./project-resolver");
|
|
12
|
-
const format_selector_1 = require("./format-selector");
|
|
13
|
-
function run(fn, optsOrCmd) {
|
|
14
|
-
try {
|
|
15
|
-
const opts = optsOrCmd instanceof commander_1.Command ? optsOrCmd.optsWithGlobals() : optsOrCmd;
|
|
16
|
-
console.log(fn(opts));
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
const opts = optsOrCmd instanceof commander_1.Command ? optsOrCmd.optsWithGlobals() : optsOrCmd;
|
|
20
|
-
const format = (0, format_selector_1.selectFormat)(opts);
|
|
21
|
-
console.error((0, format_selector_1.formatErrorOutput)(err instanceof Error ? err : new Error(String(err)), format));
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function createEntityGroup() {
|
|
26
|
-
const group = new commander_1.Command('entity').description('Graph entity CRUD');
|
|
27
|
-
// entity create
|
|
28
|
-
group.command('create')
|
|
29
|
-
.description('Create a new entity')
|
|
30
|
-
.argument('<id>', 'Entity ID')
|
|
31
|
-
.requiredOption('--type <type>', 'Entity type name')
|
|
32
|
-
.option('--props <json>', 'Properties as JSON')
|
|
33
|
-
.action((id, _opts, cmd) => run((o) => handleCreate(id, o), cmd));
|
|
34
|
-
// entity get
|
|
35
|
-
group.command('get')
|
|
36
|
-
.description('Get an entity by ID')
|
|
37
|
-
.argument('<id>', 'Entity ID')
|
|
38
|
-
.action((id, _opts, cmd) => run((o) => handleGet(id, o), cmd));
|
|
39
|
-
// entity query
|
|
40
|
-
group.command('query')
|
|
41
|
-
.description('Query entities with optional filters')
|
|
42
|
-
.option('--type <type>', 'Filter by entity type')
|
|
43
|
-
.option('--limit <n>', 'Max results', '100')
|
|
44
|
-
.option('--offset <n>', 'Offset', '0')
|
|
45
|
-
.action((_opts, cmd) => run(handleQuery, cmd));
|
|
46
|
-
// entity update
|
|
47
|
-
group.command('update')
|
|
48
|
-
.description('Update entity properties (merge)')
|
|
49
|
-
.argument('<id>', 'Entity ID')
|
|
50
|
-
.requiredOption('--props <json>', 'Properties to merge (JSON)')
|
|
51
|
-
.action((id, _opts, cmd) => run((o) => handleUpdate(id, o), cmd));
|
|
52
|
-
// entity delete
|
|
53
|
-
group.command('delete')
|
|
54
|
-
.description('Delete an entity (cascades to relations)')
|
|
55
|
-
.argument('<id>', 'Entity ID')
|
|
56
|
-
.action((id, _opts, cmd) => run((o) => handleDelete(id, o), cmd));
|
|
57
|
-
return group;
|
|
58
|
-
}
|
|
59
|
-
function handleCreate(id, opts) {
|
|
60
|
-
const typeName = opts.type;
|
|
61
|
-
const props = opts.props ? JSON.parse(opts.props) : undefined;
|
|
62
|
-
const format = (0, format_selector_1.selectFormat)(opts);
|
|
63
|
-
const resolved = (0, project_resolver_1.resolveFromCLI)(opts);
|
|
64
|
-
const db = (0, connection_1.openConnection)(resolved.dbPath);
|
|
65
|
-
try {
|
|
66
|
-
(0, migration_1.initializeSchema)(db);
|
|
67
|
-
(0, graph_service_2.ensureBuiltinSchemaInitialized)(db);
|
|
68
|
-
const entity = (0, graph_service_1.createEntity)(db, id, typeName, props);
|
|
69
|
-
return (0, format_selector_1.formatOutput)(entity, format);
|
|
70
|
-
}
|
|
71
|
-
finally {
|
|
72
|
-
db.close();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function handleGet(id, opts) {
|
|
76
|
-
const format = (0, format_selector_1.selectFormat)(opts);
|
|
77
|
-
const resolved = (0, project_resolver_1.resolveFromCLI)(opts);
|
|
78
|
-
const db = (0, connection_1.openConnection)(resolved.dbPath);
|
|
79
|
-
try {
|
|
80
|
-
(0, migration_1.initializeSchema)(db);
|
|
81
|
-
(0, graph_service_2.ensureBuiltinSchemaInitialized)(db);
|
|
82
|
-
const entity = (0, graph_service_1.getEntity)(db, id);
|
|
83
|
-
return (0, format_selector_1.formatOutput)(entity, format);
|
|
84
|
-
}
|
|
85
|
-
finally {
|
|
86
|
-
db.close();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function handleQuery(opts) {
|
|
90
|
-
const format = (0, format_selector_1.selectFormat)(opts);
|
|
91
|
-
const resolved = (0, project_resolver_1.resolveFromCLI)(opts);
|
|
92
|
-
const db = (0, connection_1.openConnection)(resolved.dbPath);
|
|
93
|
-
try {
|
|
94
|
-
(0, migration_1.initializeSchema)(db);
|
|
95
|
-
(0, graph_service_2.ensureBuiltinSchemaInitialized)(db);
|
|
96
|
-
const entities = (0, graph_service_1.queryEntities)(db, {
|
|
97
|
-
typeName: opts.type,
|
|
98
|
-
limit: parseInt(opts.limit, 10),
|
|
99
|
-
offset: parseInt(opts.offset, 10),
|
|
100
|
-
});
|
|
101
|
-
return (0, format_selector_1.formatOutput)(entities, format, 'entity');
|
|
102
|
-
}
|
|
103
|
-
finally {
|
|
104
|
-
db.close();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function handleUpdate(id, opts) {
|
|
108
|
-
const props = JSON.parse(opts.props);
|
|
109
|
-
const format = (0, format_selector_1.selectFormat)(opts);
|
|
110
|
-
const resolved = (0, project_resolver_1.resolveFromCLI)(opts);
|
|
111
|
-
const db = (0, connection_1.openConnection)(resolved.dbPath);
|
|
112
|
-
try {
|
|
113
|
-
(0, migration_1.initializeSchema)(db);
|
|
114
|
-
(0, graph_service_2.ensureBuiltinSchemaInitialized)(db);
|
|
115
|
-
const entity = (0, graph_service_1.updateEntity)(db, id, props);
|
|
116
|
-
return (0, format_selector_1.formatOutput)(entity, format);
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
db.close();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function handleDelete(id, opts) {
|
|
123
|
-
const resolved = (0, project_resolver_1.resolveFromCLI)(opts);
|
|
124
|
-
const db = (0, connection_1.openConnection)(resolved.dbPath);
|
|
125
|
-
try {
|
|
126
|
-
(0, migration_1.initializeSchema)(db);
|
|
127
|
-
(0, graph_service_2.ensureBuiltinSchemaInitialized)(db);
|
|
128
|
-
(0, graph_service_1.deleteEntity)(db, id);
|
|
129
|
-
return `Entity "${id}" deleted (cascaded to relations)`;
|
|
130
|
-
}
|
|
131
|
-
finally {
|
|
132
|
-
db.close();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=entity.js.map
|
package/dist/cli/entity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/cli/entity.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,gCAAgC;;AAsBhC,8CAuCC;AA3DD,yCAAoC;AACpC,6DAA+G;AAC/G,6DAA2E;AAC3E,iDAAkD;AAClD,+CAAmD;AACnD,yDAAoD;AACpD,uDAAkF;AAElF,SAAS,GAAG,CAAC,EAA6C,EAAE,SAA4C;IACtG,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,SAAS,YAAY,mBAAO,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAoC,CAAC;QAC/G,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,SAAS,YAAY,mBAAO,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAoC,CAAC;QAC/G,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC,IAAI,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,IAAA,mCAAiB,EAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB;IAC/B,MAAM,KAAK,GAAG,IAAI,mBAAO,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QACrB,OAAO,WAAW,EAAE,mCAAmC,CAAC;IAC1D,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
package/dist/cli/schema.d.ts
DELETED
package/dist/cli/schema.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/cli/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,wBAAgB,iBAAiB,IAAI,OAAO,CAsE3C"}
|
package/dist/cli/schema.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// CLI subcommands for schema group
|
|
3
|
-
// SAD-0012: Type System Overhaul — Migration Architecture
|
|
4
|
-
// MOD-022: Schema Migration Orchestrator
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createSchemaGroup = createSchemaGroup;
|
|
7
|
-
const commander_1 = require("commander");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const connection_1 = require("../db/connection");
|
|
10
|
-
const migration_1 = require("../db/migration");
|
|
11
|
-
const project_resolver_1 = require("./project-resolver");
|
|
12
|
-
const format_selector_1 = require("./format-selector");
|
|
13
|
-
const schema_migration_service_1 = require("../services/schema-migration-service");
|
|
14
|
-
function run(fn, optsOrCmd) {
|
|
15
|
-
try {
|
|
16
|
-
const opts = optsOrCmd instanceof commander_1.Command ? optsOrCmd.optsWithGlobals() : optsOrCmd;
|
|
17
|
-
const output = fn(opts);
|
|
18
|
-
if (output)
|
|
19
|
-
console.log(output);
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
const opts = optsOrCmd instanceof commander_1.Command ? optsOrCmd.optsWithGlobals() : optsOrCmd;
|
|
23
|
-
const format = (0, format_selector_1.selectFormat)({ quiet: opts.quiet, json: opts.json, format: opts.format });
|
|
24
|
-
console.error((0, format_selector_1.formatErrorOutput)(err instanceof Error ? err : new Error(String(err)), format));
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function createSchemaGroup() {
|
|
29
|
-
const group = new commander_1.Command('schema').description('Graph schema management and migration');
|
|
30
|
-
// schema migrate — run the 4-phase schema migration
|
|
31
|
-
group.command('migrate')
|
|
32
|
-
.description('Run schema migration (MOD-022: Type System Overhaul)')
|
|
33
|
-
.option('--phase <phase>', 'Run only a specific phase: entity-types, relation-types, doc-types, schema-sync')
|
|
34
|
-
.action((_opts, _cmd) => {
|
|
35
|
-
run((opts) => {
|
|
36
|
-
const format = (0, format_selector_1.selectFormat)(opts);
|
|
37
|
-
const resolved = (0, project_resolver_1.resolveFromCLI)(opts);
|
|
38
|
-
const db = (0, connection_1.openConnection)(resolved.dbPath);
|
|
39
|
-
try {
|
|
40
|
-
(0, migration_1.initializeSchema)(db, false, true); // skip builtin schema since we're running migration
|
|
41
|
-
const projectRoot = (0, path_1.resolve)(resolved.folder || process.cwd());
|
|
42
|
-
const result = (0, schema_migration_service_1.runMigration)(db, projectRoot);
|
|
43
|
-
// Also return JSON output regardless of format for structured info
|
|
44
|
-
const summary = {
|
|
45
|
-
success: result.success,
|
|
46
|
-
totalElapsedMs: result.totalElapsedMs,
|
|
47
|
-
phases: result.phases.map(p => ({
|
|
48
|
-
phase: p.phase,
|
|
49
|
-
elapsedMs: p.elapsedMs,
|
|
50
|
-
details: p.details,
|
|
51
|
-
...(p.error ? { error: p.error } : {}),
|
|
52
|
-
})),
|
|
53
|
-
...(result.errors.length > 0 ? { errors: result.errors } : {}),
|
|
54
|
-
};
|
|
55
|
-
return (0, format_selector_1.formatOutput)(summary, format, 'schema-migration');
|
|
56
|
-
}
|
|
57
|
-
finally {
|
|
58
|
-
db.close();
|
|
59
|
-
}
|
|
60
|
-
}, _cmd);
|
|
61
|
-
});
|
|
62
|
-
// schema validate — validate pre/post migration state
|
|
63
|
-
group.command('validate')
|
|
64
|
-
.description('Validate schema state')
|
|
65
|
-
.action((_opts, _cmd) => {
|
|
66
|
-
run((opts) => {
|
|
67
|
-
const format = (0, format_selector_1.selectFormat)(opts);
|
|
68
|
-
const resolved = (0, project_resolver_1.resolveFromCLI)(opts);
|
|
69
|
-
const db = (0, connection_1.openConnection)(resolved.dbPath);
|
|
70
|
-
try {
|
|
71
|
-
(0, migration_1.initializeSchema)(db, false, true);
|
|
72
|
-
let state;
|
|
73
|
-
try {
|
|
74
|
-
(0, schema_migration_service_1.validatePostMigration)(db);
|
|
75
|
-
state = 'POST-MIGRATION (16 entity types, 27 relation types)';
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
// Check pre-migration state
|
|
79
|
-
const entityTypeCount = db.prepare('SELECT COUNT(*) as cnt FROM entity_types').get().cnt;
|
|
80
|
-
const relationTypeCount = db.prepare('SELECT COUNT(*) as cnt FROM relation_types').get().cnt;
|
|
81
|
-
state = entityTypeCount === 20 && relationTypeCount === 31
|
|
82
|
-
? 'PRE-MIGRATION (20 entity types, 31 relation types)'
|
|
83
|
-
: `INTERMEDIATE (${entityTypeCount} entity types, ${relationTypeCount} relation types)`;
|
|
84
|
-
}
|
|
85
|
-
return (0, format_selector_1.formatOutput)({ state, valid: state.startsWith('POST'), details: { entityTypeCount: 0, relationTypeCount: 0 } }, format, 'schema-validate');
|
|
86
|
-
}
|
|
87
|
-
finally {
|
|
88
|
-
db.close();
|
|
89
|
-
}
|
|
90
|
-
}, _cmd);
|
|
91
|
-
});
|
|
92
|
-
return group;
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=schema.js.map
|
package/dist/cli/schema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/cli/schema.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,0DAA0D;AAC1D,yCAAyC;;AAuBzC,8CAsEC;AA3FD,yCAAoC;AACpC,+BAA+B;AAC/B,iD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EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;YACpJ,CAAC;oBAAS,CAAC;gBACT,EAAE,CAAC,KAAK,EAAE,CAAC;YACb,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEL,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export declare const ENTITY_TYPES: readonly [{
|
|
2
|
-
readonly name: "Person";
|
|
3
|
-
readonly description: "A human agent (analyst, architect, coder, tester, captain)";
|
|
4
|
-
readonly required_fields: {};
|
|
5
|
-
}, {
|
|
6
|
-
readonly name: "Project";
|
|
7
|
-
readonly description: "A cortex-cli project workspace";
|
|
8
|
-
readonly required_fields: {};
|
|
9
|
-
}, {
|
|
10
|
-
readonly name: "Sprint";
|
|
11
|
-
readonly description: "A named sprint with a status lifecycle";
|
|
12
|
-
readonly required_fields: {};
|
|
13
|
-
}, {
|
|
14
|
-
readonly name: "Task";
|
|
15
|
-
readonly description: "A work item belonging to a sprint";
|
|
16
|
-
readonly required_fields: {};
|
|
17
|
-
}, {
|
|
18
|
-
readonly name: "Document";
|
|
19
|
-
readonly description: "A registered document artifact";
|
|
20
|
-
readonly required_fields: {};
|
|
21
|
-
}, {
|
|
22
|
-
readonly name: "Review";
|
|
23
|
-
readonly description: "A review record with verdict";
|
|
24
|
-
readonly required_fields: {};
|
|
25
|
-
}, {
|
|
26
|
-
readonly name: "TestReport";
|
|
27
|
-
readonly description: "A test execution report";
|
|
28
|
-
readonly required_fields: {};
|
|
29
|
-
}, {
|
|
30
|
-
readonly name: "Lesson";
|
|
31
|
-
readonly description: "A lessons-learned entry";
|
|
32
|
-
readonly required_fields: {};
|
|
33
|
-
}, {
|
|
34
|
-
readonly name: "Bug";
|
|
35
|
-
readonly description: "A tracked bug";
|
|
36
|
-
readonly required_fields: {};
|
|
37
|
-
}, {
|
|
38
|
-
readonly name: "SourceFile";
|
|
39
|
-
readonly description: "A source code file";
|
|
40
|
-
readonly required_fields: {};
|
|
41
|
-
}, {
|
|
42
|
-
readonly name: "Decision";
|
|
43
|
-
readonly description: "An architecture or design decision";
|
|
44
|
-
readonly required_fields: {};
|
|
45
|
-
}];
|
|
46
|
-
export declare const RELATION_TYPES: readonly [{
|
|
47
|
-
readonly name: "has_member";
|
|
48
|
-
readonly from_types: readonly ["Sprint"];
|
|
49
|
-
readonly to_types: readonly ["Task"];
|
|
50
|
-
readonly cardinality: "one_to_many";
|
|
51
|
-
readonly description: "Sprint contains tasks";
|
|
52
|
-
}, {
|
|
53
|
-
readonly name: "depends_on";
|
|
54
|
-
readonly from_types: readonly ["Task"];
|
|
55
|
-
readonly to_types: readonly ["Task"];
|
|
56
|
-
readonly cardinality: "many_to_many";
|
|
57
|
-
readonly description: "Task dependency";
|
|
58
|
-
}, {
|
|
59
|
-
readonly name: "relates_to";
|
|
60
|
-
readonly from_types: readonly ["Task"];
|
|
61
|
-
readonly to_types: readonly ["Task"];
|
|
62
|
-
readonly cardinality: "many_to_many";
|
|
63
|
-
readonly description: "Generic task relation";
|
|
64
|
-
}, {
|
|
65
|
-
readonly name: "written_by";
|
|
66
|
-
readonly from_types: readonly ["Document"];
|
|
67
|
-
readonly to_types: readonly ["Person"];
|
|
68
|
-
readonly cardinality: "many_to_one";
|
|
69
|
-
readonly description: "Document author";
|
|
70
|
-
}, {
|
|
71
|
-
readonly name: "reviewed_by";
|
|
72
|
-
readonly from_types: readonly ["Document"];
|
|
73
|
-
readonly to_types: readonly ["Review"];
|
|
74
|
-
readonly cardinality: "many_to_one";
|
|
75
|
-
readonly description: "Review of a document";
|
|
76
|
-
}, {
|
|
77
|
-
readonly name: "approved_by";
|
|
78
|
-
readonly from_types: readonly ["Review"];
|
|
79
|
-
readonly to_types: readonly ["Person"];
|
|
80
|
-
readonly cardinality: "many_to_one";
|
|
81
|
-
readonly description: "Reviewer who gave verdict";
|
|
82
|
-
}, {
|
|
83
|
-
readonly name: "tracks";
|
|
84
|
-
readonly from_types: readonly ["Bug"];
|
|
85
|
-
readonly to_types: readonly ["Task"];
|
|
86
|
-
readonly cardinality: "many_to_one";
|
|
87
|
-
readonly description: "Bug is tracked by a task";
|
|
88
|
-
}, {
|
|
89
|
-
readonly name: "implements";
|
|
90
|
-
readonly from_types: readonly ["SourceFile"];
|
|
91
|
-
readonly to_types: readonly ["Task"];
|
|
92
|
-
readonly cardinality: "many_to_one";
|
|
93
|
-
readonly description: "Source file implements a task";
|
|
94
|
-
}, {
|
|
95
|
-
readonly name: "decides";
|
|
96
|
-
readonly from_types: readonly ["Person"];
|
|
97
|
-
readonly to_types: readonly ["Decision"];
|
|
98
|
-
readonly cardinality: "many_to_one";
|
|
99
|
-
readonly description: "Person made a decision";
|
|
100
|
-
}, {
|
|
101
|
-
readonly name: "contains";
|
|
102
|
-
readonly from_types: readonly ["Project"];
|
|
103
|
-
readonly to_types: readonly ["Document"];
|
|
104
|
-
readonly cardinality: "one_to_many";
|
|
105
|
-
readonly description: "Project contains document";
|
|
106
|
-
}];
|
|
107
|
-
export type BuiltinEntityType = typeof ENTITY_TYPES[number];
|
|
108
|
-
export type BuiltinRelationType = typeof RELATION_TYPES[number];
|
|
109
|
-
//# sourceMappingURL=builtin-schema-constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-schema-constants.d.ts","sourceRoot":"","sources":["../../src/db/builtin-schema-constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYf,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWjB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Builtin graph schema constants
|
|
3
|
-
// URD-003 §4: Predefined entity types and relation types
|
|
4
|
-
// Used by initializeBuiltinSchema() in migration.ts
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RELATION_TYPES = exports.ENTITY_TYPES = void 0;
|
|
7
|
-
exports.ENTITY_TYPES = [
|
|
8
|
-
{ name: 'Person', description: 'A human agent (analyst, architect, coder, tester, captain)', required_fields: {} },
|
|
9
|
-
{ name: 'Project', description: 'A cortex-cli project workspace', required_fields: {} },
|
|
10
|
-
{ name: 'Sprint', description: 'A named sprint with a status lifecycle', required_fields: {} },
|
|
11
|
-
{ name: 'Task', description: 'A work item belonging to a sprint', required_fields: {} },
|
|
12
|
-
{ name: 'Document', description: 'A registered document artifact', required_fields: {} },
|
|
13
|
-
{ name: 'Review', description: 'A review record with verdict', required_fields: {} },
|
|
14
|
-
{ name: 'TestReport', description: 'A test execution report', required_fields: {} },
|
|
15
|
-
{ name: 'Lesson', description: 'A lessons-learned entry', required_fields: {} },
|
|
16
|
-
{ name: 'Bug', description: 'A tracked bug', required_fields: {} },
|
|
17
|
-
{ name: 'SourceFile', description: 'A source code file', required_fields: {} },
|
|
18
|
-
{ name: 'Decision', description: 'An architecture or design decision', required_fields: {} },
|
|
19
|
-
];
|
|
20
|
-
exports.RELATION_TYPES = [
|
|
21
|
-
{ name: 'has_member', from_types: ['Sprint'], to_types: ['Task'], cardinality: 'one_to_many', description: 'Sprint contains tasks' },
|
|
22
|
-
{ name: 'depends_on', from_types: ['Task'], to_types: ['Task'], cardinality: 'many_to_many', description: 'Task dependency' },
|
|
23
|
-
{ name: 'relates_to', from_types: ['Task'], to_types: ['Task'], cardinality: 'many_to_many', description: 'Generic task relation' },
|
|
24
|
-
{ name: 'written_by', from_types: ['Document'], to_types: ['Person'], cardinality: 'many_to_one', description: 'Document author' },
|
|
25
|
-
{ name: 'reviewed_by', from_types: ['Document'], to_types: ['Review'], cardinality: 'many_to_one', description: 'Review of a document' },
|
|
26
|
-
{ name: 'approved_by', from_types: ['Review'], to_types: ['Person'], cardinality: 'many_to_one', description: 'Reviewer who gave verdict' },
|
|
27
|
-
{ name: 'tracks', from_types: ['Bug'], to_types: ['Task'], cardinality: 'many_to_one', description: 'Bug is tracked by a task' },
|
|
28
|
-
{ name: 'implements', from_types: ['SourceFile'], to_types: ['Task'], cardinality: 'many_to_one', description: 'Source file implements a task' },
|
|
29
|
-
{ name: 'decides', from_types: ['Person'], to_types: ['Decision'], cardinality: 'many_to_one', description: 'Person made a decision' },
|
|
30
|
-
{ name: 'contains', from_types: ['Project'], to_types: ['Document'], cardinality: 'one_to_many', description: 'Project contains document' },
|
|
31
|
-
];
|
|
32
|
-
//# sourceMappingURL=builtin-schema-constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-schema-constants.js","sourceRoot":"","sources":["../../src/db/builtin-schema-constants.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,yDAAyD;AACzD,oDAAoD;;;AAEvC,QAAA,YAAY,GAAG;IAC1B,EAAE,IAAI,EAAE,QAAQ,EAAO,WAAW,EAAE,4DAA4D,EAAE,eAAe,EAAE,EAAE,EAAE;IACvH,EAAE,IAAI,EAAE,SAAS,EAAM,WAAW,EAAE,gCAAgC,EAAgC,eAAe,EAAE,EAAE,EAAE;IACzH,EAAE,IAAI,EAAE,QAAQ,EAAQ,WAAW,EAAE,wCAAwC,EAAuB,eAAe,EAAE,EAAE,EAAE;IACzH,EAAE,IAAI,EAAE,MAAM,EAAS,WAAW,EAAE,mCAAmC,EAA4B,eAAe,EAAE,EAAE,EAAE;IACxH,EAAE,IAAI,EAAE,UAAU,EAAK,WAAW,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