@cleocode/core 2026.3.57 → 2026.3.59
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/dist/agents/agent-registry.d.ts +206 -0
- package/dist/agents/agent-registry.d.ts.map +1 -0
- package/dist/agents/agent-schema.d.ts.map +1 -1
- package/dist/agents/execution-learning.d.ts +223 -0
- package/dist/agents/execution-learning.d.ts.map +1 -0
- package/dist/agents/health-monitor.d.ts +161 -0
- package/dist/agents/health-monitor.d.ts.map +1 -0
- package/dist/agents/index.d.ts +4 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/retry.d.ts +57 -4
- package/dist/agents/retry.d.ts.map +1 -1
- package/dist/backfill/index.d.ts +83 -0
- package/dist/backfill/index.d.ts.map +1 -0
- package/dist/bootstrap.d.ts +1 -1
- package/dist/config.d.ts +47 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6985 -5068
- package/dist/index.js.map +4 -4
- package/dist/intelligence/adaptive-validation.d.ts +151 -0
- package/dist/intelligence/adaptive-validation.d.ts.map +1 -0
- package/dist/intelligence/impact.d.ts +34 -1
- package/dist/intelligence/impact.d.ts.map +1 -1
- package/dist/intelligence/index.d.ts +7 -2
- package/dist/intelligence/index.d.ts.map +1 -1
- package/dist/intelligence/types.d.ts +60 -0
- package/dist/intelligence/types.d.ts.map +1 -1
- package/dist/internal.d.ts +8 -4
- package/dist/internal.d.ts.map +1 -1
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/retry.d.ts +128 -0
- package/dist/lib/retry.d.ts.map +1 -0
- package/dist/nexus/sharing/index.d.ts +48 -2
- package/dist/nexus/sharing/index.d.ts.map +1 -1
- package/dist/sessions/session-enforcement.d.ts.map +1 -1
- package/dist/stats/index.d.ts +1 -0
- package/dist/stats/index.d.ts.map +1 -1
- package/dist/stats/workflow-telemetry.d.ts +89 -0
- package/dist/stats/workflow-telemetry.d.ts.map +1 -0
- package/dist/store/brain-schema.d.ts.map +1 -1
- package/dist/store/converters.d.ts.map +1 -1
- package/dist/store/cross-db-cleanup.d.ts +93 -0
- package/dist/store/cross-db-cleanup.d.ts.map +1 -0
- package/dist/store/db-helpers.d.ts.map +1 -1
- package/dist/store/migration-sqlite.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/task-store.d.ts.map +1 -1
- package/dist/store/tasks-schema.d.ts +18 -3
- package/dist/store/tasks-schema.d.ts.map +1 -1
- package/dist/store/validation-schemas.d.ts +32 -0
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/tasks/add.d.ts +10 -1
- package/dist/tasks/add.d.ts.map +1 -1
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/enforcement.d.ts +22 -0
- package/dist/tasks/enforcement.d.ts.map +1 -0
- package/dist/tasks/epic-enforcement.d.ts +199 -0
- package/dist/tasks/epic-enforcement.d.ts.map +1 -0
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/pipeline-stage.d.ts +181 -0
- package/dist/tasks/pipeline-stage.d.ts.map +1 -0
- package/dist/tasks/update.d.ts +2 -0
- package/dist/tasks/update.d.ts.map +1 -1
- package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/migration.sql +12 -0
- package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/snapshot.json +1232 -0
- package/migrations/drizzle-tasks/20260321000000_t033-connection-health/migration.sql +518 -0
- package/migrations/drizzle-tasks/20260321000000_t033-connection-health/snapshot.json +4312 -0
- package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/migration.sql +82 -0
- package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/snapshot.json +9 -0
- package/package.json +5 -5
- package/schemas/config.schema.json +37 -1547
- package/src/__tests__/sharing.test.ts +24 -0
- package/src/agents/__tests__/agent-registry.test.ts +351 -0
- package/src/agents/__tests__/execution-learning.test.ts +684 -0
- package/src/agents/__tests__/health-monitor.test.ts +332 -0
- package/src/agents/__tests__/registry.test.ts +30 -2
- package/src/agents/agent-registry.ts +394 -0
- package/src/agents/agent-schema.ts +5 -0
- package/src/agents/execution-learning.ts +675 -0
- package/src/agents/health-monitor.ts +279 -0
- package/src/agents/index.ts +37 -1
- package/src/agents/retry.ts +57 -4
- package/src/backfill/index.ts +309 -0
- package/src/bootstrap.ts +1 -1
- package/src/config.ts +126 -0
- package/src/index.ts +8 -1
- package/src/intelligence/__tests__/adaptive-validation.test.ts +694 -0
- package/src/intelligence/__tests__/impact.test.ts +165 -1
- package/src/intelligence/adaptive-validation.ts +764 -0
- package/src/intelligence/impact.ts +203 -0
- package/src/intelligence/index.ts +19 -0
- package/src/intelligence/types.ts +76 -0
- package/src/internal.ts +39 -0
- package/src/lib/__tests__/retry.test.ts +321 -0
- package/src/lib/index.ts +16 -0
- package/src/lib/retry.ts +224 -0
- package/src/lifecycle/__tests__/chain-store.test.ts +7 -0
- package/src/lifecycle/__tests__/tessera-engine.test.ts +52 -0
- package/src/nexus/sharing/index.ts +142 -2
- package/src/sessions/__tests__/session-edge-cases.test.ts +24 -1
- package/src/sessions/session-enforcement.ts +13 -2
- package/src/stats/index.ts +7 -0
- package/src/stats/workflow-telemetry.ts +502 -0
- package/src/store/__tests__/migration-safety.test.ts +3 -0
- package/src/store/__tests__/session-store.test.ts +132 -1
- package/src/store/__tests__/task-store.test.ts +22 -1
- package/src/store/__tests__/test-db-helper.ts +29 -2
- package/src/store/brain-schema.ts +4 -1
- package/src/store/converters.ts +2 -0
- package/src/store/cross-db-cleanup.ts +192 -0
- package/src/store/db-helpers.ts +2 -0
- package/src/store/migration-sqlite.ts +6 -0
- package/src/store/sqlite-data-accessor.ts +20 -28
- package/src/store/sqlite.ts +14 -2
- package/src/store/task-store.ts +6 -0
- package/src/store/tasks-schema.ts +59 -20
- package/src/tasks/__tests__/add.test.ts +16 -0
- package/src/tasks/__tests__/complete-unblocks.test.ts +10 -1
- package/src/tasks/__tests__/complete.test.ts +11 -2
- package/src/tasks/__tests__/epic-enforcement.test.ts +909 -0
- package/src/tasks/__tests__/minimal-test.test.ts +28 -0
- package/src/tasks/__tests__/pipeline-stage.test.ts +403 -0
- package/src/tasks/__tests__/update.test.ts +40 -6
- package/src/tasks/add.ts +128 -2
- package/src/tasks/complete.ts +29 -17
- package/src/tasks/enforcement.ts +127 -0
- package/src/tasks/epic-enforcement.ts +364 -0
- package/src/tasks/index.ts +1 -0
- package/src/tasks/pipeline-stage.ts +293 -0
- package/src/tasks/update.ts +62 -0
- package/templates/config.template.json +34 -111
- package/templates/global-config.template.json +24 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../src/tasks/complete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAoB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../src/tasks/complete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAoB,MAAM,qBAAqB,CAAC;AAM3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,qCAAqC;AACrC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CACvD;AA+FD;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,EAC5B,GAAG,CAAC,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,YAAY,GACtB,OAAO,CAAC,kBAAkB,CAAC,CA2M7B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExitCode, type Task } from '@cleocode/contracts';
|
|
2
|
+
export interface ValidationResult {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
error?: string;
|
|
5
|
+
fix?: string;
|
|
6
|
+
exitCode?: ExitCode;
|
|
7
|
+
}
|
|
8
|
+
export interface AddTaskEnforcementOptions {
|
|
9
|
+
acceptance?: string[];
|
|
10
|
+
priority?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UpdateTaskEnforcementOptions {
|
|
13
|
+
acceptance?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface AcceptanceEnforcement {
|
|
16
|
+
validateCreation(options: AddTaskEnforcementOptions): ValidationResult;
|
|
17
|
+
validateUpdate(task: Task, updates: UpdateTaskEnforcementOptions): ValidationResult;
|
|
18
|
+
validateCompletion(task: Task): ValidationResult;
|
|
19
|
+
checkMinimumCriteria(criteria: string[], minCriteria: number): boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function createAcceptanceEnforcement(cwd?: string): Promise<AcceptanceEnforcement>;
|
|
22
|
+
//# sourceMappingURL=enforcement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforcement.d.ts","sourceRoot":"","sources":["../../src/tasks/enforcement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG1D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,CAAC;IACvE,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,4BAA4B,GAAG,gBAAgB,CAAC;IACpF,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB,CAAC;IACjD,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;CACxE;AAMD,wBAAsB,2BAA2B,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAgG9F"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Epic lifecycle pipeline enforcement (RCASD-IVTR+C).
|
|
3
|
+
*
|
|
4
|
+
* Enforces three constraints specific to tasks of type "epic":
|
|
5
|
+
*
|
|
6
|
+
* 1. **Creation requirements** (strict mode only):
|
|
7
|
+
* - Minimum 5 acceptance criteria (vs. 3 for regular tasks).
|
|
8
|
+
* - Completion criteria must be defined (non-empty description field).
|
|
9
|
+
* - Initial pipeline stage defaults to "research" (inherited from
|
|
10
|
+
* pipeline-stage.ts, not re-asserted here).
|
|
11
|
+
*
|
|
12
|
+
* 2. **Child stage ceiling**: A child task's pipeline stage cannot advance
|
|
13
|
+
* past the epic's current pipeline stage. This is checked on child task
|
|
14
|
+
* update (pipelineStage change) and on child task creation.
|
|
15
|
+
*
|
|
16
|
+
* 3. **Epic stage advancement gate**: An epic cannot advance its pipeline
|
|
17
|
+
* stage while it has children whose status is not "done" AND whose
|
|
18
|
+
* pipeline stage equals the epic's current stage. In other words, all
|
|
19
|
+
* in-flight children at the current stage must be completed before the
|
|
20
|
+
* epic may move forward.
|
|
21
|
+
*
|
|
22
|
+
* Enforcement is conditional on `lifecycle.mode`:
|
|
23
|
+
* - "strict" → block (throw CleoError on violation)
|
|
24
|
+
* - "advisory" → warn (return error string but do not throw)
|
|
25
|
+
* - "off" → skip (all checks are no-ops)
|
|
26
|
+
*
|
|
27
|
+
* @task T062
|
|
28
|
+
* @epic T056
|
|
29
|
+
*/
|
|
30
|
+
import type { DataAccessor, Task } from '@cleocode/contracts';
|
|
31
|
+
/** Minimum acceptance criteria count required for epic creation in strict mode. */
|
|
32
|
+
export declare const EPIC_MIN_AC = 5;
|
|
33
|
+
/** Minimum acceptance criteria count for regular tasks. */
|
|
34
|
+
export declare const TASK_MIN_AC = 3;
|
|
35
|
+
/** The resolved enforcement mode (from lifecycle.mode config key). */
|
|
36
|
+
export type LifecycleMode = 'strict' | 'advisory' | 'off';
|
|
37
|
+
/** Result of an enforcement check. `warning` is populated in advisory mode. */
|
|
38
|
+
export interface EpicEnforcementResult {
|
|
39
|
+
/** True unless a hard block was raised. */
|
|
40
|
+
valid: boolean;
|
|
41
|
+
/** Advisory message (non-blocking) or error message (blocked). */
|
|
42
|
+
warning?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Read `lifecycle.mode` from config. Falls back to "strict" when unset
|
|
46
|
+
* (matches the DEFAULTS in config.ts).
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* In VITEST environments, returns "off" to avoid blocking tests.
|
|
50
|
+
*
|
|
51
|
+
* @param cwd - Working directory for config resolution
|
|
52
|
+
* @returns The resolved lifecycle mode
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const mode = await getLifecycleMode();
|
|
57
|
+
* // => 'strict' | 'advisory' | 'off'
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @task T062
|
|
61
|
+
*/
|
|
62
|
+
export declare function getLifecycleMode(cwd?: string): Promise<LifecycleMode>;
|
|
63
|
+
/**
|
|
64
|
+
* Validate that a new epic satisfies creation requirements.
|
|
65
|
+
*
|
|
66
|
+
* In **strict** mode:
|
|
67
|
+
* - At least {@link EPIC_MIN_AC} acceptance criteria must be provided.
|
|
68
|
+
* - `description` must be non-empty (treated as completion criteria).
|
|
69
|
+
*
|
|
70
|
+
* In **advisory** mode the same checks are run but violations do not block —
|
|
71
|
+
* they are returned as `warning` text for the caller to surface.
|
|
72
|
+
*
|
|
73
|
+
* In **off** mode this function is a no-op.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* The description field serves as a proxy for completion criteria — epics
|
|
77
|
+
* without a description have no definition of "done" and should be blocked.
|
|
78
|
+
*
|
|
79
|
+
* @param options - Epic creation parameters
|
|
80
|
+
* @param options.acceptance - Acceptance criteria array supplied by the caller.
|
|
81
|
+
* @param options.description - Task description (used as completion criteria proxy).
|
|
82
|
+
* @param cwd - Working directory for config resolution.
|
|
83
|
+
* @returns EpicEnforcementResult — `valid: false` only in strict mode on error.
|
|
84
|
+
* @throws CleoError(VALIDATION_ERROR) in strict mode when constraints are violated.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* await validateEpicCreation({ acceptance: ['AC1','AC2','AC3','AC4','AC5'] });
|
|
89
|
+
* // => { valid: true }
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @task T062
|
|
93
|
+
*/
|
|
94
|
+
export declare function validateEpicCreation(options: {
|
|
95
|
+
acceptance?: string[];
|
|
96
|
+
description?: string;
|
|
97
|
+
}, cwd?: string): Promise<EpicEnforcementResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Validate that a child task's pipeline stage does not exceed its epic's stage.
|
|
100
|
+
*
|
|
101
|
+
* Call this when:
|
|
102
|
+
* - A child task is **created** under an epic parent.
|
|
103
|
+
* - A child task's `pipelineStage` is **updated** and it has an epic ancestor.
|
|
104
|
+
*
|
|
105
|
+
* The check walks the task's ancestor chain to find the nearest epic ancestor.
|
|
106
|
+
* If none exists, the check is skipped.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* Skips the check if the epic has no pipeline stage set, or if the child
|
|
110
|
+
* stage is not a recognised value (those are handled by separate validation).
|
|
111
|
+
*
|
|
112
|
+
* @param options - Ceiling check parameters
|
|
113
|
+
* @param options.childStage - The proposed pipeline stage for the child.
|
|
114
|
+
* @param options.epicId - ID of the epic ancestor to check against.
|
|
115
|
+
* @param accessor - DataAccessor for task lookups.
|
|
116
|
+
* @param cwd - Working directory for config resolution.
|
|
117
|
+
* @returns EpicEnforcementResult
|
|
118
|
+
* @throws CleoError(VALIDATION_ERROR) in strict mode when the child stage exceeds the epic.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* await validateChildStageCeiling(
|
|
123
|
+
* { childStage: 'testing', epicId: 'T001' },
|
|
124
|
+
* accessor,
|
|
125
|
+
* );
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @task T062
|
|
129
|
+
*/
|
|
130
|
+
export declare function validateChildStageCeiling(options: {
|
|
131
|
+
childStage: string;
|
|
132
|
+
epicId: string;
|
|
133
|
+
}, accessor: DataAccessor, cwd?: string): Promise<EpicEnforcementResult>;
|
|
134
|
+
/**
|
|
135
|
+
* Find the nearest epic ancestor for a given task.
|
|
136
|
+
*
|
|
137
|
+
* Walks the ancestor chain (root-first) and returns the first task whose
|
|
138
|
+
* type is "epic", or null if no epic ancestor exists.
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* Scans from closest ancestor to root so the *nearest* epic is returned,
|
|
142
|
+
* not the highest-level one.
|
|
143
|
+
*
|
|
144
|
+
* @param taskId - ID of the task whose ancestors to inspect.
|
|
145
|
+
* @param accessor - DataAccessor for the ancestor chain query.
|
|
146
|
+
* @returns The nearest epic ancestor, or null.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* const epic = await findEpicAncestor('T042', accessor);
|
|
151
|
+
* if (epic) console.log(epic.id); // e.g. 'T029'
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @task T062
|
|
155
|
+
*/
|
|
156
|
+
export declare function findEpicAncestor(taskId: string, accessor: DataAccessor): Promise<Task | null>;
|
|
157
|
+
/**
|
|
158
|
+
* Validate that an epic can advance its pipeline stage.
|
|
159
|
+
*
|
|
160
|
+
* An epic is **blocked** from advancing to a later stage when it has at least
|
|
161
|
+
* one child that:
|
|
162
|
+
* - Has a pipeline stage **equal to the epic's current stage**, AND
|
|
163
|
+
* - Has a status that is **not** "done" (i.e., is still in-flight).
|
|
164
|
+
*
|
|
165
|
+
* Rationale: the epic stage represents the stage the team is actively working
|
|
166
|
+
* in. Moving the epic forward while children are unfinished at the current
|
|
167
|
+
* stage violates the pipeline discipline.
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* Only fires on genuine forward advancement — same-stage updates and
|
|
171
|
+
* backward moves are handled by {@link validatePipelineTransition}.
|
|
172
|
+
* Children with status "done", "cancelled", or "archived" are excluded
|
|
173
|
+
* from the blocker check.
|
|
174
|
+
*
|
|
175
|
+
* @param options - Advancement check parameters
|
|
176
|
+
* @param options.epicId - ID of the epic being advanced.
|
|
177
|
+
* @param options.currentStage - Epic's current pipeline stage (before the update).
|
|
178
|
+
* @param options.newStage - Proposed new pipeline stage.
|
|
179
|
+
* @param accessor - DataAccessor for children lookup.
|
|
180
|
+
* @param cwd - Working directory for config resolution.
|
|
181
|
+
* @returns EpicEnforcementResult
|
|
182
|
+
* @throws CleoError(VALIDATION_ERROR) in strict mode when incomplete children exist.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* await validateEpicStageAdvancement(
|
|
187
|
+
* { epicId: 'T029', currentStage: 'research', newStage: 'consensus' },
|
|
188
|
+
* accessor,
|
|
189
|
+
* );
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @task T062
|
|
193
|
+
*/
|
|
194
|
+
export declare function validateEpicStageAdvancement(options: {
|
|
195
|
+
epicId: string;
|
|
196
|
+
currentStage: string;
|
|
197
|
+
newStage: string;
|
|
198
|
+
}, accessor: DataAccessor, cwd?: string): Promise<EpicEnforcementResult>;
|
|
199
|
+
//# sourceMappingURL=epic-enforcement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epic-enforcement.d.ts","sourceRoot":"","sources":["../../src/tasks/epic-enforcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAU9D,mFAAmF;AACnF,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,2DAA2D;AAC3D,eAAO,MAAM,WAAW,IAAI,CAAC;AAM7B,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;AAE1D,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAI3E;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE;IACP,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,CA8BhC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE;IACP,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,EACD,QAAQ,EAAE,YAAY,EACtB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,CA6BhC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAStB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE;IACP,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,EACD,QAAQ,EAAE,YAAY,EACtB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,CA0ChC"}
|
package/dist/tasks/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @task T4460
|
|
4
4
|
* @epic T4454
|
|
5
5
|
*/
|
|
6
|
-
export { type AddTaskOptions, type AddTaskResult, addTask, findRecentDuplicate, getNextPosition, getTaskDepth, inferTaskType, logOperation, normalizePriority, VALID_PRIORITIES, validateDepends, validateLabels, validateParent, validatePhaseFormat, validatePriority, validateSize, validateStatus, validateTaskType, validateTitle, } from './add.js';
|
|
6
|
+
export { type AddTaskOptions, type AddTaskResult, addTask, buildDefaultVerification, findRecentDuplicate, getNextPosition, getTaskDepth, inferTaskType, logOperation, normalizePriority, VALID_PRIORITIES, validateDepends, validateLabels, validateParent, validatePhaseFormat, validatePriority, validateSize, validateStatus, validateTaskType, validateTitle, } from './add.js';
|
|
7
7
|
export { type ArchiveTasksOptions, type ArchiveTasksResult, archiveTasks } from './archive.js';
|
|
8
8
|
export { type CompleteTaskOptions, type CompleteTaskResult, completeTask } from './complete.js';
|
|
9
9
|
export { type DeleteTaskOptions, type DeleteTaskResult, deleteTask } from './delete.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,SAAS,EACT,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,OAAO,EACP,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,SAAS,EACT,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline stage binding for tasks (RCASD-IVTR+C).
|
|
3
|
+
*
|
|
4
|
+
* Implements auto-assignment of pipeline stages on task creation and
|
|
5
|
+
* forward-only stage transition validation on task update.
|
|
6
|
+
*
|
|
7
|
+
* Stages (in order):
|
|
8
|
+
* 1. research
|
|
9
|
+
* 2. consensus
|
|
10
|
+
* 3. architecture_decision
|
|
11
|
+
* 4. specification
|
|
12
|
+
* 5. decomposition
|
|
13
|
+
* 6. implementation
|
|
14
|
+
* 7. validation
|
|
15
|
+
* 8. testing
|
|
16
|
+
* 9. release
|
|
17
|
+
* 10. contribution (cross-cutting, treated as terminal)
|
|
18
|
+
*
|
|
19
|
+
* @task T060
|
|
20
|
+
* @epic T056
|
|
21
|
+
*/
|
|
22
|
+
import type { TaskType } from '@cleocode/contracts';
|
|
23
|
+
/**
|
|
24
|
+
* Minimal parent task shape needed for pipeline stage resolution.
|
|
25
|
+
* @task T060
|
|
26
|
+
*/
|
|
27
|
+
export interface ResolvedParent {
|
|
28
|
+
pipelineStage?: string | null;
|
|
29
|
+
type?: TaskType | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Ordered pipeline stages (RCASD-IVTR+C).
|
|
33
|
+
* This matches lifecycle/stages.ts PIPELINE_STAGES but is kept local to avoid
|
|
34
|
+
* a circular dependency — tasks/ must not import from lifecycle/.
|
|
35
|
+
*
|
|
36
|
+
* @task T060
|
|
37
|
+
*/
|
|
38
|
+
export declare const TASK_PIPELINE_STAGES: readonly ["research", "consensus", "architecture_decision", "specification", "decomposition", "implementation", "validation", "testing", "release", "contribution"];
|
|
39
|
+
/** Union type of all valid pipeline stage names. */
|
|
40
|
+
export type TaskPipelineStage = (typeof TASK_PIPELINE_STAGES)[number];
|
|
41
|
+
/**
|
|
42
|
+
* Check whether a string is a valid pipeline stage name.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* Uses a type-narrowing signature so callers can safely use the value
|
|
46
|
+
* as {@link TaskPipelineStage} after a truthy check.
|
|
47
|
+
*
|
|
48
|
+
* @param stage - Raw string to test
|
|
49
|
+
* @returns True if it is a valid stage name
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* isValidPipelineStage('research'); // => true
|
|
54
|
+
* isValidPipelineStage('not_a_stage'); // => false
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @task T060
|
|
58
|
+
*/
|
|
59
|
+
export declare function isValidPipelineStage(stage: string): stage is TaskPipelineStage;
|
|
60
|
+
/**
|
|
61
|
+
* Validate a pipeline stage name and throw a CleoError on failure.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Uses an assertion signature — after a successful call the compiler
|
|
65
|
+
* narrows `stage` to {@link TaskPipelineStage}.
|
|
66
|
+
*
|
|
67
|
+
* @param stage - Stage name to validate
|
|
68
|
+
* @returns void (assertion function — narrows type on success)
|
|
69
|
+
* @throws CleoError(VALIDATION_ERROR) if invalid
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* validatePipelineStage('implementation'); // passes
|
|
74
|
+
* validatePipelineStage('invalid'); // throws CleoError
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @task T060
|
|
78
|
+
*/
|
|
79
|
+
export declare function validatePipelineStage(stage: string): asserts stage is TaskPipelineStage;
|
|
80
|
+
/**
|
|
81
|
+
* Determine the default pipeline stage for a new task.
|
|
82
|
+
*
|
|
83
|
+
* Rules (in priority order):
|
|
84
|
+
* 1. If an explicit stage is provided and valid, use it.
|
|
85
|
+
* 2. If the task has a parent, inherit the parent's pipelineStage.
|
|
86
|
+
* 3. If the task type is 'epic', default to 'research'.
|
|
87
|
+
* 4. Otherwise default to 'implementation'.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* Priority order ensures explicit caller intent wins, then parent
|
|
91
|
+
* inheritance, then type-based defaults. This avoids surprising
|
|
92
|
+
* overrides when parent stages differ from the default.
|
|
93
|
+
*
|
|
94
|
+
* @param options - Resolution inputs
|
|
95
|
+
* @param options.explicitStage - Stage explicitly provided by the caller
|
|
96
|
+
* @param options.taskType - Type of the task being created
|
|
97
|
+
* @param options.parentTask - Parent task (if any), for inheritance
|
|
98
|
+
* @returns The resolved pipeline stage name
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* resolveDefaultPipelineStage({ taskType: 'epic' });
|
|
103
|
+
* // => 'research'
|
|
104
|
+
*
|
|
105
|
+
* resolveDefaultPipelineStage({ taskType: 'task' });
|
|
106
|
+
* // => 'implementation'
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @task T060
|
|
110
|
+
*/
|
|
111
|
+
export declare function resolveDefaultPipelineStage(options: {
|
|
112
|
+
explicitStage?: string | null;
|
|
113
|
+
taskType?: TaskType | null;
|
|
114
|
+
parentTask?: ResolvedParent | null;
|
|
115
|
+
}): TaskPipelineStage;
|
|
116
|
+
/**
|
|
117
|
+
* Get the numeric order of a pipeline stage (1-based).
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* Returns -1 for unrecognised stage names so callers can distinguish
|
|
121
|
+
* "unknown" from a valid low-order stage.
|
|
122
|
+
*
|
|
123
|
+
* @param stage - Stage name (must be valid)
|
|
124
|
+
* @returns Numeric order (1–10), or -1 if not found
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* getPipelineStageOrder('research'); // => 1
|
|
129
|
+
* getPipelineStageOrder('implementation'); // => 6
|
|
130
|
+
* getPipelineStageOrder('unknown'); // => -1
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @task T060
|
|
134
|
+
*/
|
|
135
|
+
export declare function getPipelineStageOrder(stage: string): number;
|
|
136
|
+
/**
|
|
137
|
+
* Check whether transitioning from `currentStage` to `newStage` is forward-only.
|
|
138
|
+
*
|
|
139
|
+
* "Forward" means the new stage's order is greater than or equal to the current
|
|
140
|
+
* stage's order (same stage is a no-op and is considered valid).
|
|
141
|
+
*
|
|
142
|
+
* @remarks
|
|
143
|
+
* Unknown stages are treated as valid to avoid blocking tasks with
|
|
144
|
+
* legacy or custom stage names that predate the standard set.
|
|
145
|
+
*
|
|
146
|
+
* @param currentStage - The task's current pipeline stage
|
|
147
|
+
* @param newStage - The requested new pipeline stage
|
|
148
|
+
* @returns True if the transition is allowed (forward or same)
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* isPipelineTransitionForward('research', 'implementation'); // => true
|
|
153
|
+
* isPipelineTransitionForward('testing', 'research'); // => false
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @task T060
|
|
157
|
+
*/
|
|
158
|
+
export declare function isPipelineTransitionForward(currentStage: string, newStage: string): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Validate a pipeline stage transition and throw if it would move backward.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* Validates the new stage name first via {@link validatePipelineStage},
|
|
164
|
+
* then checks directionality. A null/undefined current stage accepts any
|
|
165
|
+
* valid new stage (first assignment).
|
|
166
|
+
*
|
|
167
|
+
* @param currentStage - The task's current pipeline stage (may be null/undefined)
|
|
168
|
+
* @param newStage - The new stage being requested
|
|
169
|
+
* @throws CleoError(VALIDATION_ERROR) if the transition is backward
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* validatePipelineTransition(null, 'research'); // passes (first assignment)
|
|
174
|
+
* validatePipelineTransition('research', 'implementation'); // passes (forward)
|
|
175
|
+
* validatePipelineTransition('testing', 'research'); // throws (backward)
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @task T060
|
|
179
|
+
*/
|
|
180
|
+
export declare function validatePipelineTransition(currentStage: string | null | undefined, newStage: string): void;
|
|
181
|
+
//# sourceMappingURL=pipeline-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-stage.d.ts","sourceRoot":"","sources":["../../src/tasks/pipeline-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACxB;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,qKAWvB,CAAC;AAEX,oDAAoD;AACpD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAoBtE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,iBAAiB,CAE9E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,iBAAiB,CAQvF;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE;IACnD,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CACpC,GAAG,iBAAiB,CAoBpB;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK3F;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACvC,QAAQ,EAAE,MAAM,GACf,IAAI,CAoBN"}
|
package/dist/tasks/update.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface UpdateTaskOptions {
|
|
|
27
27
|
blockedBy?: string;
|
|
28
28
|
parentId?: string | null;
|
|
29
29
|
noAutoComplete?: boolean;
|
|
30
|
+
/** RCASD-IVTR+C pipeline stage transition target. Must be >= current stage. @task T060 */
|
|
31
|
+
pipelineStage?: string;
|
|
30
32
|
}
|
|
31
33
|
/** Result of updating a task. */
|
|
32
34
|
export interface UpdateTaskResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/tasks/update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/tasks/update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAM9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA8C9D,mCAAmC;AACnC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,GAAG,CAAC,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,YAAY,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAuR3B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- T033: Connection Health Remediation — brain.db indexes (from T031 analysis)
|
|
2
|
+
-- INDEX 8: content_hash + created_at (dedup hot path in observeBrain)
|
|
3
|
+
-- Drop single-column content_hash index first; composite covers the prefix case.
|
|
4
|
+
DROP INDEX IF EXISTS `idx_brain_observations_content_hash`;
|
|
5
|
+
--> statement-breakpoint
|
|
6
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_content_hash_created_at`
|
|
7
|
+
ON `brain_observations` (`content_hash`, `created_at`);
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
|
|
10
|
+
-- INDEX 9: type + project (findObservations compound filter)
|
|
11
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_type_project`
|
|
12
|
+
ON `brain_observations` (`type`, `project`);
|