@cleocode/mcp-server 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +306 -0
- package/dist/domains/index.d.ts +16 -0
- package/dist/domains/index.d.ts.map +1 -0
- package/dist/domains/index.js +16 -0
- package/dist/domains/index.js.map +1 -0
- package/dist/domains/lifecycle.d.ts +147 -0
- package/dist/domains/lifecycle.d.ts.map +1 -0
- package/dist/domains/lifecycle.js +452 -0
- package/dist/domains/lifecycle.js.map +1 -0
- package/dist/domains/orchestrate.d.ts +133 -0
- package/dist/domains/orchestrate.d.ts.map +1 -0
- package/dist/domains/orchestrate.js +465 -0
- package/dist/domains/orchestrate.js.map +1 -0
- package/dist/domains/release.d.ts +109 -0
- package/dist/domains/release.d.ts.map +1 -0
- package/dist/domains/release.js +400 -0
- package/dist/domains/release.js.map +1 -0
- package/dist/domains/research.d.ts +139 -0
- package/dist/domains/research.d.ts.map +1 -0
- package/dist/domains/research.js +606 -0
- package/dist/domains/research.js.map +1 -0
- package/dist/domains/session.d.ts +129 -0
- package/dist/domains/session.d.ts.map +1 -0
- package/dist/domains/session.js +433 -0
- package/dist/domains/session.js.map +1 -0
- package/dist/domains/system.d.ts +92 -0
- package/dist/domains/system.d.ts.map +1 -0
- package/dist/domains/system.js +473 -0
- package/dist/domains/system.js.map +1 -0
- package/dist/domains/tasks.d.ts +180 -0
- package/dist/domains/tasks.d.ts.map +1 -0
- package/dist/domains/tasks.js +704 -0
- package/dist/domains/tasks.js.map +1 -0
- package/dist/domains/validate.d.ts +150 -0
- package/dist/domains/validate.d.ts.map +1 -0
- package/dist/domains/validate.js +568 -0
- package/dist/domains/validate.js.map +1 -0
- package/dist/gateways/mutate.d.ts +100 -0
- package/dist/gateways/mutate.d.ts.map +1 -0
- package/dist/gateways/mutate.js +937 -0
- package/dist/gateways/mutate.js.map +1 -0
- package/dist/gateways/query.d.ts +91 -0
- package/dist/gateways/query.d.ts.map +1 -0
- package/dist/gateways/query.js +245 -0
- package/dist/gateways/query.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +299 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/audit.d.ts +118 -0
- package/dist/lib/audit.d.ts.map +1 -0
- package/dist/lib/audit.js +311 -0
- package/dist/lib/audit.js.map +1 -0
- package/dist/lib/background-jobs.d.ts +86 -0
- package/dist/lib/background-jobs.d.ts.map +1 -0
- package/dist/lib/background-jobs.js +183 -0
- package/dist/lib/background-jobs.js.map +1 -0
- package/dist/lib/cache.d.ts +78 -0
- package/dist/lib/cache.d.ts.map +1 -0
- package/dist/lib/cache.js +204 -0
- package/dist/lib/cache.js.map +1 -0
- package/dist/lib/command-builder.d.ts +52 -0
- package/dist/lib/command-builder.d.ts.map +1 -0
- package/dist/lib/command-builder.js +280 -0
- package/dist/lib/command-builder.js.map +1 -0
- package/dist/lib/config.d.ts +42 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +248 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/defaults.d.ts +115 -0
- package/dist/lib/defaults.d.ts.map +1 -0
- package/dist/lib/defaults.js +61 -0
- package/dist/lib/defaults.js.map +1 -0
- package/dist/lib/error-handler.d.ts +101 -0
- package/dist/lib/error-handler.d.ts.map +1 -0
- package/dist/lib/error-handler.js +277 -0
- package/dist/lib/error-handler.js.map +1 -0
- package/dist/lib/executor.d.ts +110 -0
- package/dist/lib/executor.d.ts.map +1 -0
- package/dist/lib/executor.js +362 -0
- package/dist/lib/executor.js.map +1 -0
- package/dist/lib/exit-codes.d.ts +190 -0
- package/dist/lib/exit-codes.d.ts.map +1 -0
- package/dist/lib/exit-codes.js +1027 -0
- package/dist/lib/exit-codes.js.map +1 -0
- package/dist/lib/formatter.d.ts +196 -0
- package/dist/lib/formatter.d.ts.map +1 -0
- package/dist/lib/formatter.js +260 -0
- package/dist/lib/formatter.js.map +1 -0
- package/dist/lib/gate-validators.d.ts +103 -0
- package/dist/lib/gate-validators.d.ts.map +1 -0
- package/dist/lib/gate-validators.js +689 -0
- package/dist/lib/gate-validators.js.map +1 -0
- package/dist/lib/manifest-parser.d.ts +61 -0
- package/dist/lib/manifest-parser.d.ts.map +1 -0
- package/dist/lib/manifest-parser.js +338 -0
- package/dist/lib/manifest-parser.js.map +1 -0
- package/dist/lib/manifest.d.ts +177 -0
- package/dist/lib/manifest.d.ts.map +1 -0
- package/dist/lib/manifest.js +301 -0
- package/dist/lib/manifest.js.map +1 -0
- package/dist/lib/protocol-enforcement.d.ts +105 -0
- package/dist/lib/protocol-enforcement.d.ts.map +1 -0
- package/dist/lib/protocol-enforcement.js +331 -0
- package/dist/lib/protocol-enforcement.js.map +1 -0
- package/dist/lib/protocol-rules.d.ts +55 -0
- package/dist/lib/protocol-rules.d.ts.map +1 -0
- package/dist/lib/protocol-rules.js +760 -0
- package/dist/lib/protocol-rules.js.map +1 -0
- package/dist/lib/rate-limiter.d.ts +110 -0
- package/dist/lib/rate-limiter.d.ts.map +1 -0
- package/dist/lib/rate-limiter.js +208 -0
- package/dist/lib/rate-limiter.js.map +1 -0
- package/dist/lib/router.d.ts +126 -0
- package/dist/lib/router.d.ts.map +1 -0
- package/dist/lib/router.js +276 -0
- package/dist/lib/router.js.map +1 -0
- package/dist/lib/schema.d.ts +55 -0
- package/dist/lib/schema.d.ts.map +1 -0
- package/dist/lib/schema.js +70 -0
- package/dist/lib/schema.js.map +1 -0
- package/dist/lib/security.d.ts +156 -0
- package/dist/lib/security.d.ts.map +1 -0
- package/dist/lib/security.js +347 -0
- package/dist/lib/security.js.map +1 -0
- package/dist/lib/verification-gates.d.ts +287 -0
- package/dist/lib/verification-gates.d.ts.map +1 -0
- package/dist/lib/verification-gates.js +548 -0
- package/dist/lib/verification-gates.js.map +1 -0
- package/dist/types/domain.d.ts +29 -0
- package/dist/types/domain.d.ts.map +1 -0
- package/dist/types/domain.js +7 -0
- package/dist/types/domain.js.map +1 -0
- package/dist/types/error.d.ts +101 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/error.js +61 -0
- package/dist/types/error.js.map +1 -0
- package/dist/types/gateway.d.ts +78 -0
- package/dist/types/gateway.d.ts.map +1 -0
- package/dist/types/gateway.js +7 -0
- package/dist/types/gateway.js.map +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/operations/lifecycle.d.ts +140 -0
- package/dist/types/operations/lifecycle.d.ts.map +1 -0
- package/dist/types/operations/lifecycle.js +8 -0
- package/dist/types/operations/lifecycle.js.map +1 -0
- package/dist/types/operations/orchestrate.d.ts +140 -0
- package/dist/types/operations/orchestrate.d.ts.map +1 -0
- package/dist/types/operations/orchestrate.js +8 -0
- package/dist/types/operations/orchestrate.js.map +1 -0
- package/dist/types/operations/release.d.ts +97 -0
- package/dist/types/operations/release.d.ts.map +1 -0
- package/dist/types/operations/release.js +7 -0
- package/dist/types/operations/release.js.map +1 -0
- package/dist/types/operations/research.d.ts +122 -0
- package/dist/types/operations/research.d.ts.map +1 -0
- package/dist/types/operations/research.js +8 -0
- package/dist/types/operations/research.js.map +1 -0
- package/dist/types/operations/session.d.ts +108 -0
- package/dist/types/operations/session.d.ts.map +1 -0
- package/dist/types/operations/session.js +8 -0
- package/dist/types/operations/session.js.map +1 -0
- package/dist/types/operations/system.d.ts +147 -0
- package/dist/types/operations/system.d.ts.map +1 -0
- package/dist/types/operations/system.js +8 -0
- package/dist/types/operations/system.js.map +1 -0
- package/dist/types/operations/tasks.d.ts +186 -0
- package/dist/types/operations/tasks.d.ts.map +1 -0
- package/dist/types/operations/tasks.js +8 -0
- package/dist/types/operations/tasks.js.map +1 -0
- package/dist/types/operations/validate.d.ts +170 -0
- package/dist/types/operations/validate.d.ts.map +1 -0
- package/dist/types/operations/validate.js +8 -0
- package/dist/types/operations/validate.js.map +1 -0
- package/package.json +67 -0
- package/schemas/IMPLEMENTATION-SUMMARY.md +250 -0
- package/schemas/README.md +284 -0
- package/schemas/common/error.schema.json +54 -0
- package/schemas/common/meta.schema.json +39 -0
- package/schemas/common/pagination.schema.json +32 -0
- package/schemas/index.json +159 -0
- package/schemas/requests/lifecycle/check.schema.json +20 -0
- package/schemas/requests/lifecycle/gate.fail.schema.json +25 -0
- package/schemas/requests/lifecycle/gate.pass.schema.json +28 -0
- package/schemas/requests/lifecycle/gates.schema.json +15 -0
- package/schemas/requests/lifecycle/history.schema.json +15 -0
- package/schemas/requests/lifecycle/prerequisites.schema.json +15 -0
- package/schemas/requests/lifecycle/progress.schema.json +29 -0
- package/schemas/requests/lifecycle/reset.schema.json +25 -0
- package/schemas/requests/lifecycle/skip.schema.json +25 -0
- package/schemas/requests/lifecycle/status.schema.json +23 -0
- package/schemas/requests/orchestrate/analyze.schema.json +15 -0
- package/schemas/requests/orchestrate/context.schema.json +13 -0
- package/schemas/requests/orchestrate/next.schema.json +15 -0
- package/schemas/requests/orchestrate/parallel.end.schema.json +20 -0
- package/schemas/requests/orchestrate/parallel.start.schema.json +20 -0
- package/schemas/requests/orchestrate/ready.schema.json +15 -0
- package/schemas/requests/orchestrate/skill.list.schema.json +13 -0
- package/schemas/requests/orchestrate/spawn.schema.json +25 -0
- package/schemas/requests/orchestrate/startup.schema.json +15 -0
- package/schemas/requests/orchestrate/status.schema.json +15 -0
- package/schemas/requests/orchestrate/validate.schema.json +15 -0
- package/schemas/requests/orchestrate/waves.schema.json +15 -0
- package/schemas/requests/release/changelog.schema.json +23 -0
- package/schemas/requests/release/commit.schema.json +22 -0
- package/schemas/requests/release/gates.run.schema.json +17 -0
- package/schemas/requests/release/prepare.schema.json +20 -0
- package/schemas/requests/release/push.schema.json +20 -0
- package/schemas/requests/release/rollback.schema.json +20 -0
- package/schemas/requests/release/tag.schema.json +19 -0
- package/schemas/requests/research/inject.schema.json +24 -0
- package/schemas/requests/research/link.schema.json +25 -0
- package/schemas/requests/research/list.schema.json +19 -0
- package/schemas/requests/research/manifest.append.schema.json +20 -0
- package/schemas/requests/research/manifest.archive.schema.json +19 -0
- package/schemas/requests/research/manifest.read.schema.json +21 -0
- package/schemas/requests/research/pending.schema.json +14 -0
- package/schemas/requests/research/query.schema.json +21 -0
- package/schemas/requests/research/show.schema.json +14 -0
- package/schemas/requests/research/stats.schema.json +14 -0
- package/schemas/requests/session/end.schema.json +13 -0
- package/schemas/requests/session/focus.clear.schema.json +7 -0
- package/schemas/requests/session/focus.get.schema.json +7 -0
- package/schemas/requests/session/focus.set.schema.json +15 -0
- package/schemas/requests/session/gc.schema.json +14 -0
- package/schemas/requests/session/history.schema.json +16 -0
- package/schemas/requests/session/list.schema.json +13 -0
- package/schemas/requests/session/resume.schema.json +14 -0
- package/schemas/requests/session/show.schema.json +14 -0
- package/schemas/requests/session/start.schema.json +23 -0
- package/schemas/requests/session/status.schema.json +7 -0
- package/schemas/requests/session/suspend.schema.json +13 -0
- package/schemas/requests/system/backup.schema.json +19 -0
- package/schemas/requests/system/cleanup.schema.json +20 -0
- package/schemas/requests/system/config.get.schema.json +14 -0
- package/schemas/requests/system/config.set.schema.json +24 -0
- package/schemas/requests/system/context.schema.json +7 -0
- package/schemas/requests/system/doctor.schema.json +7 -0
- package/schemas/requests/system/init.schema.json +18 -0
- package/schemas/requests/system/migrate.schema.json +19 -0
- package/schemas/requests/system/restore.schema.json +14 -0
- package/schemas/requests/system/stats.schema.json +7 -0
- package/schemas/requests/system/sync.schema.json +15 -0
- package/schemas/requests/system/version.schema.json +7 -0
- package/schemas/requests/tasks/analyze.schema.json +14 -0
- package/schemas/requests/tasks/archive.schema.json +19 -0
- package/schemas/requests/tasks/blockers.schema.json +15 -0
- package/schemas/requests/tasks/complete.schema.json +24 -0
- package/schemas/requests/tasks/create.schema.json +48 -0
- package/schemas/requests/tasks/delete.schema.json +20 -0
- package/schemas/requests/tasks/deps.schema.json +21 -0
- package/schemas/requests/tasks/exists.schema.json +15 -0
- package/schemas/requests/tasks/find.schema.json +22 -0
- package/schemas/requests/tasks/get.schema.json +15 -0
- package/schemas/requests/tasks/list.schema.json +26 -0
- package/schemas/requests/tasks/next.schema.json +21 -0
- package/schemas/requests/tasks/promote.schema.json +15 -0
- package/schemas/requests/tasks/reopen.schema.json +15 -0
- package/schemas/requests/tasks/reorder.schema.json +20 -0
- package/schemas/requests/tasks/reparent.schema.json +20 -0
- package/schemas/requests/tasks/tree.schema.json +21 -0
- package/schemas/requests/tasks/unarchive.schema.json +15 -0
- package/schemas/requests/tasks/update.schema.json +41 -0
- package/schemas/requests/validate/compliance.record.schema.json +20 -0
- package/schemas/requests/validate/compliance.summary.schema.json +18 -0
- package/schemas/requests/validate/compliance.violations.schema.json +19 -0
- package/schemas/requests/validate/manifest.schema.json +23 -0
- package/schemas/requests/validate/output.schema.json +19 -0
- package/schemas/requests/validate/protocol.schema.json +20 -0
- package/schemas/requests/validate/schema.schema.json +19 -0
- package/schemas/requests/validate/task.schema.json +21 -0
- package/schemas/requests/validate/test.coverage.schema.json +14 -0
- package/schemas/requests/validate/test.run.schema.json +22 -0
- package/schemas/requests/validate/test.status.schema.json +14 -0
- package/schemas/responses/common-error.schema.json +20 -0
- package/schemas/responses/common-success.schema.json +21 -0
- package/schemas/responses/lifecycle/check.schema.json +18 -0
- package/schemas/responses/lifecycle/gate.fail.schema.json +18 -0
- package/schemas/responses/lifecycle/gate.pass.schema.json +18 -0
- package/schemas/responses/lifecycle/gates.schema.json +18 -0
- package/schemas/responses/lifecycle/history.schema.json +18 -0
- package/schemas/responses/lifecycle/prerequisites.schema.json +18 -0
- package/schemas/responses/lifecycle/progress.schema.json +18 -0
- package/schemas/responses/lifecycle/reset.schema.json +18 -0
- package/schemas/responses/lifecycle/skip.schema.json +18 -0
- package/schemas/responses/lifecycle/status.schema.json +18 -0
- package/schemas/responses/orchestrate/analyze.schema.json +18 -0
- package/schemas/responses/orchestrate/context.schema.json +18 -0
- package/schemas/responses/orchestrate/next.schema.json +18 -0
- package/schemas/responses/orchestrate/parallel.end.schema.json +18 -0
- package/schemas/responses/orchestrate/parallel.start.schema.json +18 -0
- package/schemas/responses/orchestrate/ready.schema.json +18 -0
- package/schemas/responses/orchestrate/skill.list.schema.json +18 -0
- package/schemas/responses/orchestrate/spawn.schema.json +18 -0
- package/schemas/responses/orchestrate/startup.schema.json +18 -0
- package/schemas/responses/orchestrate/status.schema.json +18 -0
- package/schemas/responses/orchestrate/validate.schema.json +18 -0
- package/schemas/responses/orchestrate/waves.schema.json +18 -0
- package/schemas/responses/release/changelog.schema.json +18 -0
- package/schemas/responses/release/commit.schema.json +18 -0
- package/schemas/responses/release/gates.run.schema.json +18 -0
- package/schemas/responses/release/prepare.schema.json +18 -0
- package/schemas/responses/release/push.schema.json +18 -0
- package/schemas/responses/release/rollback.schema.json +18 -0
- package/schemas/responses/release/tag.schema.json +18 -0
- package/schemas/responses/research/inject.schema.json +18 -0
- package/schemas/responses/research/link.schema.json +18 -0
- package/schemas/responses/research/list.schema.json +18 -0
- package/schemas/responses/research/manifest.append.schema.json +18 -0
- package/schemas/responses/research/manifest.archive.schema.json +18 -0
- package/schemas/responses/research/manifest.read.schema.json +18 -0
- package/schemas/responses/research/pending.schema.json +18 -0
- package/schemas/responses/research/query.schema.json +18 -0
- package/schemas/responses/research/show.schema.json +18 -0
- package/schemas/responses/research/stats.schema.json +18 -0
- package/schemas/responses/session/end.schema.json +18 -0
- package/schemas/responses/session/focus.clear.schema.json +18 -0
- package/schemas/responses/session/focus.get.schema.json +18 -0
- package/schemas/responses/session/focus.set.schema.json +18 -0
- package/schemas/responses/session/gc.schema.json +18 -0
- package/schemas/responses/session/history.schema.json +18 -0
- package/schemas/responses/session/list.schema.json +18 -0
- package/schemas/responses/session/resume.schema.json +18 -0
- package/schemas/responses/session/show.schema.json +18 -0
- package/schemas/responses/session/start.schema.json +18 -0
- package/schemas/responses/session/status.schema.json +18 -0
- package/schemas/responses/session/suspend.schema.json +18 -0
- package/schemas/responses/system/backup.schema.json +18 -0
- package/schemas/responses/system/cleanup.schema.json +18 -0
- package/schemas/responses/system/config.get.schema.json +18 -0
- package/schemas/responses/system/config.set.schema.json +18 -0
- package/schemas/responses/system/context.schema.json +18 -0
- package/schemas/responses/system/doctor.schema.json +18 -0
- package/schemas/responses/system/init.schema.json +18 -0
- package/schemas/responses/system/migrate.schema.json +18 -0
- package/schemas/responses/system/restore.schema.json +18 -0
- package/schemas/responses/system/stats.schema.json +18 -0
- package/schemas/responses/system/sync.schema.json +18 -0
- package/schemas/responses/system/version.schema.json +18 -0
- package/schemas/responses/tasks/analyze.schema.json +18 -0
- package/schemas/responses/tasks/archive.schema.json +18 -0
- package/schemas/responses/tasks/blockers.schema.json +18 -0
- package/schemas/responses/tasks/complete.schema.json +18 -0
- package/schemas/responses/tasks/create.schema.json +18 -0
- package/schemas/responses/tasks/delete.schema.json +18 -0
- package/schemas/responses/tasks/deps.schema.json +18 -0
- package/schemas/responses/tasks/exists.schema.json +18 -0
- package/schemas/responses/tasks/find.schema.json +18 -0
- package/schemas/responses/tasks/get.schema.json +87 -0
- package/schemas/responses/tasks/list.schema.json +18 -0
- package/schemas/responses/tasks/next.schema.json +18 -0
- package/schemas/responses/tasks/promote.schema.json +18 -0
- package/schemas/responses/tasks/reopen.schema.json +18 -0
- package/schemas/responses/tasks/reorder.schema.json +18 -0
- package/schemas/responses/tasks/reparent.schema.json +18 -0
- package/schemas/responses/tasks/tree.schema.json +18 -0
- package/schemas/responses/tasks/unarchive.schema.json +18 -0
- package/schemas/responses/tasks/update.schema.json +18 -0
- package/schemas/responses/validate/compliance.record.schema.json +18 -0
- package/schemas/responses/validate/compliance.summary.schema.json +18 -0
- package/schemas/responses/validate/compliance.violations.schema.json +18 -0
- package/schemas/responses/validate/manifest.schema.json +18 -0
- package/schemas/responses/validate/output.schema.json +18 -0
- package/schemas/responses/validate/protocol.schema.json +18 -0
- package/schemas/responses/validate/schema.schema.json +18 -0
- package/schemas/responses/validate/task.schema.json +18 -0
- package/schemas/responses/validate/test.coverage.schema.json +18 -0
- package/schemas/responses/validate/test.run.schema.json +18 -0
- package/schemas/responses/validate/test.status.schema.json +18 -0
- package/server.json +53 -0
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tasks Domain Handler
|
|
3
|
+
*
|
|
4
|
+
* Implements all 30 task operations for CLEO MCP server:
|
|
5
|
+
* - Query (16): show, get, list, find, exists, next, depends, deps, stats, export, history, lint, batch-validate, manifest, tree, blockers, analyze
|
|
6
|
+
* - Mutate (13): add, create, update, complete, delete, archive, restore, unarchive, import, reorder, reparent, promote, reopen
|
|
7
|
+
*
|
|
8
|
+
* Each operation maps to corresponding CLEO CLI commands with proper
|
|
9
|
+
* parameter validation and error handling.
|
|
10
|
+
*
|
|
11
|
+
* @task T2916
|
|
12
|
+
*/
|
|
13
|
+
import { ManifestReader } from '../lib/manifest.js';
|
|
14
|
+
/**
|
|
15
|
+
* Tasks domain handler implementation
|
|
16
|
+
*/
|
|
17
|
+
export class TasksHandler {
|
|
18
|
+
executor;
|
|
19
|
+
manifestReader;
|
|
20
|
+
constructor(executor, manifestPath = 'claudedocs/agent-outputs/MANIFEST.jsonl') {
|
|
21
|
+
this.executor = executor;
|
|
22
|
+
this.manifestReader = new ManifestReader(manifestPath);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Query operations (read-only)
|
|
26
|
+
*/
|
|
27
|
+
async query(operation, params) {
|
|
28
|
+
const startTime = Date.now();
|
|
29
|
+
try {
|
|
30
|
+
switch (operation) {
|
|
31
|
+
case 'show':
|
|
32
|
+
return await this.queryShow(params);
|
|
33
|
+
case 'list':
|
|
34
|
+
return await this.queryList(params);
|
|
35
|
+
case 'find':
|
|
36
|
+
return await this.queryFind(params);
|
|
37
|
+
case 'exists':
|
|
38
|
+
return await this.queryExists(params);
|
|
39
|
+
case 'next':
|
|
40
|
+
return await this.queryNext(params);
|
|
41
|
+
case 'depends':
|
|
42
|
+
return await this.queryDepends(params);
|
|
43
|
+
case 'stats':
|
|
44
|
+
return await this.queryStats(params);
|
|
45
|
+
case 'export':
|
|
46
|
+
return await this.queryExport(params);
|
|
47
|
+
case 'history':
|
|
48
|
+
return await this.queryHistory(params);
|
|
49
|
+
case 'lint':
|
|
50
|
+
return await this.queryLint(params);
|
|
51
|
+
case 'batch-validate':
|
|
52
|
+
return await this.queryBatchValidate(params);
|
|
53
|
+
case 'manifest':
|
|
54
|
+
return await this.queryManifest(params);
|
|
55
|
+
case 'tree':
|
|
56
|
+
return await this.queryTree(params);
|
|
57
|
+
case 'blockers':
|
|
58
|
+
return await this.queryBlockers(params);
|
|
59
|
+
case 'analyze':
|
|
60
|
+
return await this.queryAnalyze(params);
|
|
61
|
+
case 'get':
|
|
62
|
+
return await this.queryShow(params);
|
|
63
|
+
case 'deps':
|
|
64
|
+
return await this.queryDepends(params);
|
|
65
|
+
default:
|
|
66
|
+
return this.createErrorResponse('cleo_query', 'tasks', operation, 'E_INVALID_OPERATION', `Unknown query operation: ${operation}`, startTime);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return this.handleError('cleo_query', 'tasks', operation, error, startTime);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Mutate operations (write)
|
|
75
|
+
*/
|
|
76
|
+
async mutate(operation, params) {
|
|
77
|
+
const startTime = Date.now();
|
|
78
|
+
try {
|
|
79
|
+
switch (operation) {
|
|
80
|
+
case 'add':
|
|
81
|
+
return await this.mutateAdd(params);
|
|
82
|
+
case 'update':
|
|
83
|
+
return await this.mutateUpdate(params);
|
|
84
|
+
case 'complete':
|
|
85
|
+
return await this.mutateComplete(params);
|
|
86
|
+
case 'delete':
|
|
87
|
+
return await this.mutateDelete(params);
|
|
88
|
+
case 'archive':
|
|
89
|
+
return await this.mutateArchive(params);
|
|
90
|
+
case 'restore':
|
|
91
|
+
return await this.mutateRestore(params);
|
|
92
|
+
case 'import':
|
|
93
|
+
return await this.mutateImport(params);
|
|
94
|
+
case 'reorder':
|
|
95
|
+
return await this.mutateReorder(params);
|
|
96
|
+
case 'reparent':
|
|
97
|
+
return await this.mutateReparent(params);
|
|
98
|
+
case 'promote':
|
|
99
|
+
return await this.mutatePromote(params);
|
|
100
|
+
case 'reopen':
|
|
101
|
+
return await this.mutateReopen(params);
|
|
102
|
+
case 'create':
|
|
103
|
+
return await this.mutateAdd(params);
|
|
104
|
+
case 'unarchive':
|
|
105
|
+
return await this.mutateRestore(params);
|
|
106
|
+
default:
|
|
107
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', operation, 'E_INVALID_OPERATION', `Unknown mutate operation: ${operation}`, startTime);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return this.handleError('cleo_mutate', 'tasks', operation, error, startTime);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get supported operations
|
|
116
|
+
*/
|
|
117
|
+
getSupportedOperations() {
|
|
118
|
+
return {
|
|
119
|
+
query: [
|
|
120
|
+
'show',
|
|
121
|
+
'get',
|
|
122
|
+
'list',
|
|
123
|
+
'find',
|
|
124
|
+
'exists',
|
|
125
|
+
'next',
|
|
126
|
+
'depends',
|
|
127
|
+
'deps',
|
|
128
|
+
'stats',
|
|
129
|
+
'export',
|
|
130
|
+
'history',
|
|
131
|
+
'lint',
|
|
132
|
+
'batch-validate',
|
|
133
|
+
'manifest',
|
|
134
|
+
'tree',
|
|
135
|
+
'blockers',
|
|
136
|
+
'analyze',
|
|
137
|
+
],
|
|
138
|
+
mutate: [
|
|
139
|
+
'add',
|
|
140
|
+
'create',
|
|
141
|
+
'update',
|
|
142
|
+
'complete',
|
|
143
|
+
'delete',
|
|
144
|
+
'archive',
|
|
145
|
+
'restore',
|
|
146
|
+
'unarchive',
|
|
147
|
+
'import',
|
|
148
|
+
'reorder',
|
|
149
|
+
'reparent',
|
|
150
|
+
'promote',
|
|
151
|
+
'reopen',
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
// ===== Query Operations =====
|
|
156
|
+
/**
|
|
157
|
+
* show - Get single task details
|
|
158
|
+
* CLI: cleo show <taskId>
|
|
159
|
+
*/
|
|
160
|
+
async queryShow(params) {
|
|
161
|
+
const startTime = Date.now();
|
|
162
|
+
if (!params?.taskId) {
|
|
163
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'show', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
164
|
+
}
|
|
165
|
+
const result = await this.executor.execute({
|
|
166
|
+
domain: 'show',
|
|
167
|
+
operation: params.taskId,
|
|
168
|
+
flags: { json: true },
|
|
169
|
+
});
|
|
170
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'show', startTime);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* list - List tasks with filters
|
|
174
|
+
* CLI: cleo list [--parent <id>] [--status <status>] [--limit <n>]
|
|
175
|
+
*/
|
|
176
|
+
async queryList(params) {
|
|
177
|
+
const startTime = Date.now();
|
|
178
|
+
const flags = { json: true };
|
|
179
|
+
if (params?.parent)
|
|
180
|
+
flags.parent = params.parent;
|
|
181
|
+
if (params?.status)
|
|
182
|
+
flags.status = params.status;
|
|
183
|
+
if (params?.limit)
|
|
184
|
+
flags.limit = params.limit;
|
|
185
|
+
const result = await this.executor.execute({
|
|
186
|
+
domain: 'list',
|
|
187
|
+
operation: '',
|
|
188
|
+
flags,
|
|
189
|
+
});
|
|
190
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'list', startTime);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* find - Fuzzy search tasks
|
|
194
|
+
* CLI: cleo find <query> [--limit <n>]
|
|
195
|
+
*/
|
|
196
|
+
async queryFind(params) {
|
|
197
|
+
const startTime = Date.now();
|
|
198
|
+
if (!params?.query) {
|
|
199
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'find', 'E_INVALID_INPUT', 'query is required', startTime);
|
|
200
|
+
}
|
|
201
|
+
const flags = { json: true };
|
|
202
|
+
if (params?.limit)
|
|
203
|
+
flags.limit = params.limit;
|
|
204
|
+
const result = await this.executor.execute({
|
|
205
|
+
domain: 'find',
|
|
206
|
+
operation: params.query,
|
|
207
|
+
flags,
|
|
208
|
+
});
|
|
209
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'find', startTime);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* exists - Check task existence
|
|
213
|
+
* CLI: cleo exists <taskId>
|
|
214
|
+
*/
|
|
215
|
+
async queryExists(params) {
|
|
216
|
+
const startTime = Date.now();
|
|
217
|
+
if (!params?.taskId) {
|
|
218
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'exists', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
219
|
+
}
|
|
220
|
+
const result = await this.executor.execute({
|
|
221
|
+
domain: 'exists',
|
|
222
|
+
operation: params.taskId,
|
|
223
|
+
flags: { json: true },
|
|
224
|
+
});
|
|
225
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'exists', startTime);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* next - Get next suggested task
|
|
229
|
+
* CLI: cleo next [--epic <id>] [--count <n>]
|
|
230
|
+
*/
|
|
231
|
+
async queryNext(params) {
|
|
232
|
+
const startTime = Date.now();
|
|
233
|
+
const flags = { json: true };
|
|
234
|
+
if (params?.epicId)
|
|
235
|
+
flags.epic = params.epicId;
|
|
236
|
+
if (params?.count)
|
|
237
|
+
flags.count = params.count;
|
|
238
|
+
const result = await this.executor.execute({
|
|
239
|
+
domain: 'next',
|
|
240
|
+
operation: '',
|
|
241
|
+
flags,
|
|
242
|
+
});
|
|
243
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'next', startTime);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* depends - Get task dependencies
|
|
247
|
+
* CLI: cleo depends <taskId> [--direction <dir>]
|
|
248
|
+
*/
|
|
249
|
+
async queryDepends(params) {
|
|
250
|
+
const startTime = Date.now();
|
|
251
|
+
if (!params?.taskId) {
|
|
252
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'depends', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
253
|
+
}
|
|
254
|
+
const flags = { json: true };
|
|
255
|
+
if (params?.direction)
|
|
256
|
+
flags.direction = params.direction;
|
|
257
|
+
const result = await this.executor.execute({
|
|
258
|
+
domain: 'depends',
|
|
259
|
+
operation: params.taskId,
|
|
260
|
+
flags,
|
|
261
|
+
});
|
|
262
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'depends', startTime);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* stats - Task statistics
|
|
266
|
+
* CLI: cleo stats [--epic <id>]
|
|
267
|
+
*/
|
|
268
|
+
async queryStats(params) {
|
|
269
|
+
const startTime = Date.now();
|
|
270
|
+
const flags = { json: true };
|
|
271
|
+
if (params?.epicId)
|
|
272
|
+
flags.epic = params.epicId;
|
|
273
|
+
const result = await this.executor.execute({
|
|
274
|
+
domain: 'stats',
|
|
275
|
+
operation: '',
|
|
276
|
+
flags,
|
|
277
|
+
});
|
|
278
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'stats', startTime);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* export - Export tasks to JSON
|
|
282
|
+
* CLI: cleo export [--format <fmt>] [--status <status>] [--parent <id>]
|
|
283
|
+
*/
|
|
284
|
+
async queryExport(params) {
|
|
285
|
+
const startTime = Date.now();
|
|
286
|
+
const flags = { json: true };
|
|
287
|
+
if (params?.format)
|
|
288
|
+
flags.format = params.format;
|
|
289
|
+
if (params?.filter?.status)
|
|
290
|
+
flags.status = params.filter.status;
|
|
291
|
+
if (params?.filter?.parent)
|
|
292
|
+
flags.parent = params.filter.parent;
|
|
293
|
+
const result = await this.executor.execute({
|
|
294
|
+
domain: 'export',
|
|
295
|
+
operation: '',
|
|
296
|
+
flags,
|
|
297
|
+
});
|
|
298
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'export', startTime);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* history - Task history
|
|
302
|
+
* CLI: cleo history <taskId> [--limit <n>]
|
|
303
|
+
*/
|
|
304
|
+
async queryHistory(params) {
|
|
305
|
+
const startTime = Date.now();
|
|
306
|
+
if (!params?.taskId) {
|
|
307
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'history', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
308
|
+
}
|
|
309
|
+
const flags = { json: true };
|
|
310
|
+
if (params?.limit)
|
|
311
|
+
flags.limit = params.limit;
|
|
312
|
+
const result = await this.executor.execute({
|
|
313
|
+
domain: 'history',
|
|
314
|
+
operation: params.taskId,
|
|
315
|
+
flags,
|
|
316
|
+
});
|
|
317
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'history', startTime);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* lint - Validate task data
|
|
321
|
+
* CLI: cleo lint [<taskId>]
|
|
322
|
+
*/
|
|
323
|
+
async queryLint(params) {
|
|
324
|
+
const startTime = Date.now();
|
|
325
|
+
const flags = { json: true };
|
|
326
|
+
const result = await this.executor.execute({
|
|
327
|
+
domain: 'lint',
|
|
328
|
+
operation: params?.taskId || '',
|
|
329
|
+
flags,
|
|
330
|
+
});
|
|
331
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'lint', startTime);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* batch-validate - Validate multiple tasks
|
|
335
|
+
* CLI: cleo validate <id1> <id2> ... [--mode <mode>]
|
|
336
|
+
*/
|
|
337
|
+
async queryBatchValidate(params) {
|
|
338
|
+
const startTime = Date.now();
|
|
339
|
+
if (!params?.taskIds || params.taskIds.length === 0) {
|
|
340
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'batch-validate', 'E_INVALID_INPUT', 'taskIds array is required', startTime);
|
|
341
|
+
}
|
|
342
|
+
const flags = { json: true };
|
|
343
|
+
if (params?.checkMode)
|
|
344
|
+
flags.mode = params.checkMode;
|
|
345
|
+
const result = await this.executor.execute({
|
|
346
|
+
domain: 'validate',
|
|
347
|
+
operation: '',
|
|
348
|
+
args: params.taskIds,
|
|
349
|
+
flags,
|
|
350
|
+
});
|
|
351
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'batch-validate', startTime);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* manifest - Get manifest entries for task
|
|
355
|
+
* Direct: ManifestReader (not CLI)
|
|
356
|
+
*/
|
|
357
|
+
async queryManifest(params) {
|
|
358
|
+
const startTime = Date.now();
|
|
359
|
+
if (!params?.taskId) {
|
|
360
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'manifest', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
361
|
+
}
|
|
362
|
+
try {
|
|
363
|
+
const entries = await this.manifestReader.getTaskEntries(params.taskId);
|
|
364
|
+
return {
|
|
365
|
+
_meta: {
|
|
366
|
+
gateway: 'cleo_query',
|
|
367
|
+
domain: 'tasks',
|
|
368
|
+
operation: 'manifest',
|
|
369
|
+
version: '1.0.0',
|
|
370
|
+
timestamp: new Date().toISOString(),
|
|
371
|
+
duration_ms: Date.now() - startTime,
|
|
372
|
+
},
|
|
373
|
+
success: true,
|
|
374
|
+
data: {
|
|
375
|
+
taskId: params.taskId,
|
|
376
|
+
entries,
|
|
377
|
+
total: entries.length,
|
|
378
|
+
},
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'manifest', 'E_MANIFEST_READ_FAILED', error instanceof Error ? error.message : String(error), startTime);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* tree - Hierarchical task view
|
|
387
|
+
* CLI: cleo tree [rootId] [--depth N]
|
|
388
|
+
*/
|
|
389
|
+
async queryTree(params) {
|
|
390
|
+
const startTime = Date.now();
|
|
391
|
+
const flags = { json: true };
|
|
392
|
+
if (params?.depth)
|
|
393
|
+
flags.depth = params.depth;
|
|
394
|
+
const result = await this.executor.execute({
|
|
395
|
+
domain: 'tree',
|
|
396
|
+
operation: params?.rootId || '',
|
|
397
|
+
flags,
|
|
398
|
+
});
|
|
399
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'tree', startTime);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* blockers - Get blocking tasks
|
|
403
|
+
* CLI: cleo blockers <taskId>
|
|
404
|
+
*/
|
|
405
|
+
async queryBlockers(params) {
|
|
406
|
+
const startTime = Date.now();
|
|
407
|
+
if (!params?.taskId) {
|
|
408
|
+
return this.createErrorResponse('cleo_query', 'tasks', 'blockers', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
409
|
+
}
|
|
410
|
+
const result = await this.executor.execute({
|
|
411
|
+
domain: 'blockers',
|
|
412
|
+
operation: params.taskId,
|
|
413
|
+
flags: { json: true },
|
|
414
|
+
});
|
|
415
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'blockers', startTime);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* analyze - Triage analysis
|
|
419
|
+
* CLI: cleo analyze [epicId]
|
|
420
|
+
*/
|
|
421
|
+
async queryAnalyze(params) {
|
|
422
|
+
const startTime = Date.now();
|
|
423
|
+
const flags = { json: true };
|
|
424
|
+
const result = await this.executor.execute({
|
|
425
|
+
domain: 'analyze',
|
|
426
|
+
operation: params?.epicId || '',
|
|
427
|
+
flags,
|
|
428
|
+
});
|
|
429
|
+
return this.wrapExecutorResult(result, 'cleo_query', 'tasks', 'analyze', startTime);
|
|
430
|
+
}
|
|
431
|
+
// ===== Mutate Operations =====
|
|
432
|
+
/**
|
|
433
|
+
* add - Create new task
|
|
434
|
+
* CLI: cleo add <title> --description <desc> [--parent <id>] [--depends <id>...] [--priority <p>] [--labels <l>...]
|
|
435
|
+
*/
|
|
436
|
+
async mutateAdd(params) {
|
|
437
|
+
const startTime = Date.now();
|
|
438
|
+
if (!params?.title || !params?.description) {
|
|
439
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'add', 'E_INVALID_INPUT', 'title and description are required', startTime);
|
|
440
|
+
}
|
|
441
|
+
const flags = {
|
|
442
|
+
json: true,
|
|
443
|
+
description: params.description,
|
|
444
|
+
};
|
|
445
|
+
if (params?.parent)
|
|
446
|
+
flags.parent = params.parent;
|
|
447
|
+
if (params?.depends)
|
|
448
|
+
flags.depends = params.depends;
|
|
449
|
+
if (params?.priority)
|
|
450
|
+
flags.priority = params.priority;
|
|
451
|
+
if (params?.labels)
|
|
452
|
+
flags.labels = params.labels;
|
|
453
|
+
const result = await this.executor.execute({
|
|
454
|
+
domain: 'add',
|
|
455
|
+
operation: params.title,
|
|
456
|
+
flags,
|
|
457
|
+
});
|
|
458
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'add', startTime);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* update - Update task fields
|
|
462
|
+
* CLI: cleo update <taskId> [--title <t>] [--description <d>] [--status <s>] [--priority <p>] [--notes <n>]
|
|
463
|
+
*/
|
|
464
|
+
async mutateUpdate(params) {
|
|
465
|
+
const startTime = Date.now();
|
|
466
|
+
if (!params?.taskId) {
|
|
467
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'update', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
468
|
+
}
|
|
469
|
+
const flags = { json: true };
|
|
470
|
+
if (params?.title)
|
|
471
|
+
flags.title = params.title;
|
|
472
|
+
if (params?.description)
|
|
473
|
+
flags.description = params.description;
|
|
474
|
+
if (params?.status)
|
|
475
|
+
flags.status = params.status;
|
|
476
|
+
if (params?.priority)
|
|
477
|
+
flags.priority = params.priority;
|
|
478
|
+
if (params?.notes)
|
|
479
|
+
flags.notes = params.notes;
|
|
480
|
+
const result = await this.executor.execute({
|
|
481
|
+
domain: 'update',
|
|
482
|
+
operation: params.taskId,
|
|
483
|
+
flags,
|
|
484
|
+
});
|
|
485
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'update', startTime);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* complete - Mark task done
|
|
489
|
+
* CLI: cleo complete <taskId> [--notes <n>] [--archive]
|
|
490
|
+
*/
|
|
491
|
+
async mutateComplete(params) {
|
|
492
|
+
const startTime = Date.now();
|
|
493
|
+
if (!params?.taskId) {
|
|
494
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'complete', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
495
|
+
}
|
|
496
|
+
const flags = { json: true };
|
|
497
|
+
if (params?.notes)
|
|
498
|
+
flags.notes = params.notes;
|
|
499
|
+
if (params?.archive)
|
|
500
|
+
flags.archive = true;
|
|
501
|
+
const result = await this.executor.execute({
|
|
502
|
+
domain: 'complete',
|
|
503
|
+
operation: params.taskId,
|
|
504
|
+
flags,
|
|
505
|
+
});
|
|
506
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'complete', startTime);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* delete - Delete task
|
|
510
|
+
* CLI: cleo delete <taskId> [--force]
|
|
511
|
+
*/
|
|
512
|
+
async mutateDelete(params) {
|
|
513
|
+
const startTime = Date.now();
|
|
514
|
+
if (!params?.taskId) {
|
|
515
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'delete', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
516
|
+
}
|
|
517
|
+
const flags = { json: true };
|
|
518
|
+
if (params?.force)
|
|
519
|
+
flags.force = true;
|
|
520
|
+
const result = await this.executor.execute({
|
|
521
|
+
domain: 'delete',
|
|
522
|
+
operation: params.taskId,
|
|
523
|
+
flags,
|
|
524
|
+
});
|
|
525
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'delete', startTime);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* archive - Archive completed tasks
|
|
529
|
+
* CLI: cleo archive [<taskId>] [--before <date>]
|
|
530
|
+
*/
|
|
531
|
+
async mutateArchive(params) {
|
|
532
|
+
const startTime = Date.now();
|
|
533
|
+
const flags = { json: true };
|
|
534
|
+
if (params?.before)
|
|
535
|
+
flags.before = params.before;
|
|
536
|
+
const result = await this.executor.execute({
|
|
537
|
+
domain: 'archive',
|
|
538
|
+
operation: params?.taskId || '',
|
|
539
|
+
flags,
|
|
540
|
+
});
|
|
541
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'archive', startTime);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* restore - Restore from archive
|
|
545
|
+
* CLI: cleo restore <taskId>
|
|
546
|
+
*/
|
|
547
|
+
async mutateRestore(params) {
|
|
548
|
+
const startTime = Date.now();
|
|
549
|
+
if (!params?.taskId) {
|
|
550
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'restore', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
551
|
+
}
|
|
552
|
+
const result = await this.executor.execute({
|
|
553
|
+
domain: 'restore',
|
|
554
|
+
operation: params.taskId,
|
|
555
|
+
flags: { json: true },
|
|
556
|
+
});
|
|
557
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'restore', startTime);
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* import - Import tasks from JSON
|
|
561
|
+
* CLI: cleo import <source> [--overwrite]
|
|
562
|
+
*/
|
|
563
|
+
async mutateImport(params) {
|
|
564
|
+
const startTime = Date.now();
|
|
565
|
+
if (!params?.source) {
|
|
566
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'import', 'E_INVALID_INPUT', 'source is required', startTime);
|
|
567
|
+
}
|
|
568
|
+
const flags = { json: true };
|
|
569
|
+
if (params?.overwrite)
|
|
570
|
+
flags.overwrite = true;
|
|
571
|
+
const result = await this.executor.execute({
|
|
572
|
+
domain: 'import',
|
|
573
|
+
operation: params.source,
|
|
574
|
+
flags,
|
|
575
|
+
});
|
|
576
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'import', startTime);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* reorder - Change task order
|
|
580
|
+
* CLI: cleo reorder <taskId> <position>
|
|
581
|
+
*/
|
|
582
|
+
async mutateReorder(params) {
|
|
583
|
+
const startTime = Date.now();
|
|
584
|
+
if (!params?.taskId || params?.position === undefined) {
|
|
585
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'reorder', 'E_INVALID_INPUT', 'taskId and position are required', startTime);
|
|
586
|
+
}
|
|
587
|
+
const result = await this.executor.execute({
|
|
588
|
+
domain: 'reorder',
|
|
589
|
+
operation: params.taskId,
|
|
590
|
+
args: [params.position],
|
|
591
|
+
flags: { json: true },
|
|
592
|
+
});
|
|
593
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'reorder', startTime);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* reparent - Change task parent
|
|
597
|
+
* CLI: cleo reparent <taskId> <newParent>
|
|
598
|
+
*/
|
|
599
|
+
async mutateReparent(params) {
|
|
600
|
+
const startTime = Date.now();
|
|
601
|
+
if (!params?.taskId || !params?.newParent) {
|
|
602
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'reparent', 'E_INVALID_INPUT', 'taskId and newParent are required', startTime);
|
|
603
|
+
}
|
|
604
|
+
const result = await this.executor.execute({
|
|
605
|
+
domain: 'reparent',
|
|
606
|
+
operation: params.taskId,
|
|
607
|
+
args: [params.newParent],
|
|
608
|
+
flags: { json: true },
|
|
609
|
+
});
|
|
610
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'reparent', startTime);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* promote - Promote subtask to task
|
|
614
|
+
* CLI: cleo promote <taskId>
|
|
615
|
+
*/
|
|
616
|
+
async mutatePromote(params) {
|
|
617
|
+
const startTime = Date.now();
|
|
618
|
+
if (!params?.taskId) {
|
|
619
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'promote', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
620
|
+
}
|
|
621
|
+
const result = await this.executor.execute({
|
|
622
|
+
domain: 'promote',
|
|
623
|
+
operation: params.taskId,
|
|
624
|
+
flags: { json: true },
|
|
625
|
+
});
|
|
626
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'promote', startTime);
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* reopen - Reopen completed task
|
|
630
|
+
* CLI: cleo reopen <taskId>
|
|
631
|
+
*/
|
|
632
|
+
async mutateReopen(params) {
|
|
633
|
+
const startTime = Date.now();
|
|
634
|
+
if (!params?.taskId) {
|
|
635
|
+
return this.createErrorResponse('cleo_mutate', 'tasks', 'reopen', 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
636
|
+
}
|
|
637
|
+
const result = await this.executor.execute({
|
|
638
|
+
domain: 'reopen',
|
|
639
|
+
operation: params.taskId,
|
|
640
|
+
flags: { json: true },
|
|
641
|
+
});
|
|
642
|
+
return this.wrapExecutorResult(result, 'cleo_mutate', 'tasks', 'reopen', startTime);
|
|
643
|
+
}
|
|
644
|
+
// ===== Helper Methods =====
|
|
645
|
+
/**
|
|
646
|
+
* Wrap executor result in DomainResponse format
|
|
647
|
+
*/
|
|
648
|
+
wrapExecutorResult(result, gateway, domain, operation, startTime) {
|
|
649
|
+
const duration_ms = Date.now() - startTime;
|
|
650
|
+
if (result.success) {
|
|
651
|
+
return {
|
|
652
|
+
_meta: {
|
|
653
|
+
gateway,
|
|
654
|
+
domain,
|
|
655
|
+
operation,
|
|
656
|
+
version: '1.0.0',
|
|
657
|
+
timestamp: new Date().toISOString(),
|
|
658
|
+
duration_ms,
|
|
659
|
+
},
|
|
660
|
+
success: true,
|
|
661
|
+
data: result.data,
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
return {
|
|
665
|
+
_meta: {
|
|
666
|
+
gateway,
|
|
667
|
+
domain,
|
|
668
|
+
operation,
|
|
669
|
+
version: '1.0.0',
|
|
670
|
+
timestamp: new Date().toISOString(),
|
|
671
|
+
duration_ms,
|
|
672
|
+
},
|
|
673
|
+
success: false,
|
|
674
|
+
error: result.error,
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Create error response
|
|
679
|
+
*/
|
|
680
|
+
createErrorResponse(gateway, domain, operation, code, message, startTime) {
|
|
681
|
+
return {
|
|
682
|
+
_meta: {
|
|
683
|
+
gateway,
|
|
684
|
+
domain,
|
|
685
|
+
operation,
|
|
686
|
+
version: '1.0.0',
|
|
687
|
+
timestamp: new Date().toISOString(),
|
|
688
|
+
duration_ms: Date.now() - startTime,
|
|
689
|
+
},
|
|
690
|
+
success: false,
|
|
691
|
+
error: {
|
|
692
|
+
code,
|
|
693
|
+
message,
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Handle unexpected errors
|
|
699
|
+
*/
|
|
700
|
+
handleError(gateway, domain, operation, error, startTime) {
|
|
701
|
+
return this.createErrorResponse(gateway, domain, operation, 'E_INTERNAL_ERROR', error instanceof Error ? error.message : String(error), startTime);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
//# sourceMappingURL=tasks.js.map
|