doukui 0.6.0 → 0.9.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.
Files changed (92) hide show
  1. package/README.en.md +85 -18
  2. package/README.md +32 -72
  3. package/bin/commands/help.js +2 -25
  4. package/bin/commands/plan-lint.js +105 -0
  5. package/bin/commands/verify.js +263 -0
  6. package/bin/doukui.js +3 -3
  7. package/package.json +2 -3
  8. package/plugins/core/hook-session-start/index.js +1 -1
  9. package/plugins/core/hook-skill-gate/index.js +64 -15
  10. package/plugins/core/hook-skill-gate/plugin.json +1 -1
  11. package/plugins/core/skill-agent-dispatcher/cleanup-reference.md +7 -28
  12. package/plugins/core/skill-agent-dispatcher/monitoring-reference.md +89 -0
  13. package/plugins/core/skill-agent-dispatcher/plugin.json +1 -1
  14. package/plugins/core/skill-agent-dispatcher/recovery-reference.md +132 -0
  15. package/plugins/core/skill-agent-dispatcher/roles-reference.md +9 -22
  16. package/plugins/core/skill-agent-dispatcher/skill.md +124 -796
  17. package/plugins/core/skill-agentic-loop/mirror-rules.md +95 -24
  18. package/plugins/core/skill-agentic-loop/plugin.json +2 -7
  19. package/plugins/core/skill-agentic-loop/skill.md +125 -354
  20. package/plugins/core/skill-batch-task-creator/plugin.json +1 -1
  21. package/plugins/core/skill-checklist/skill.md +15 -141
  22. package/plugins/core/skill-completion-report/plugin.json +1 -1
  23. package/plugins/core/skill-completion-report/skill.md +7 -1
  24. package/plugins/core/skill-doukui-plan/plugin.json +1 -1
  25. package/plugins/core/skill-doukui-plan/skill.md +24 -21
  26. package/plugins/core/skill-experience-logger/plugin.json +1 -1
  27. package/plugins/core/skill-human-checkpoint/skill.md +1 -0
  28. package/plugins/core/skill-split-work-package/plugin.json +1 -1
  29. package/plugins/core/skill-task-creator/plugin.json +1 -1
  30. package/plugins/core/skill-task-creator/skill.md +1 -139
  31. package/plugins/core/skill-workflow-orchestrator/plugin.json +1 -1
  32. package/plugins/plugin-registry.json +0 -48
  33. package/plugins/runtime/harness-build.js +5 -5
  34. package/plugins/runtime/plan-reader.js +54 -21
  35. package/plugins/runtime/resolve-plugin-path.js +2 -2
  36. package/templates/harness-config.yaml +0 -100
  37. package/bin/commands/loop-server.js +0 -357
  38. package/bin/commands/loop.js +0 -1508
  39. package/plugins/contracts/capabilities.js +0 -268
  40. package/plugins/contracts/checkresult-schema.json +0 -75
  41. package/plugins/core/provider-loop-engine/index.js +0 -1411
  42. package/plugins/core/provider-loop-engine/plugin.json +0 -15
  43. package/plugins/core/provider-memory-store/index.js +0 -510
  44. package/plugins/core/provider-memory-store/plugin.json +0 -9
  45. package/plugins/core/provider-state-store/index.js +0 -244
  46. package/plugins/core/provider-state-store/plugin.json +0 -9
  47. package/plugins/core/provider-watchdog/assets/daemon-config.template.json +0 -32
  48. package/plugins/core/provider-watchdog/assets/lib/watchdog-multi-window.js +0 -676
  49. package/plugins/core/provider-watchdog/assets/watchdog.js +0 -754
  50. package/plugins/core/provider-watchdog/index.js +0 -151
  51. package/plugins/core/provider-watchdog/plugin.json +0 -13
  52. package/plugins/core/skill-agent-dispatcher/daemon-helpers-reference.md +0 -249
  53. package/plugins/core/skill-watchdog-manager/plugin.json +0 -10
  54. package/plugins/core/skill-watchdog-manager/skill.md +0 -143
  55. package/plugins/core/validator-doc-sync/index.js +0 -248
  56. package/plugins/core/validator-doc-sync/plugin.json +0 -12
  57. package/plugins/core/validator-work-package/index.js +0 -300
  58. package/plugins/core/validator-work-package/plugin.json +0 -12
  59. package/plugins/runtime/audit-logger.js +0 -311
  60. package/plugins/runtime/build-cli.js +0 -89
  61. package/plugins/runtime/checkresult-validator.js +0 -131
  62. package/plugins/runtime/context-window.js +0 -81
  63. package/plugins/runtime/event-bus.js +0 -207
  64. package/plugins/runtime/executor-claude.js +0 -604
  65. package/plugins/runtime/executor-default.js +0 -448
  66. package/plugins/runtime/executor-local.js +0 -178
  67. package/plugins/runtime/executor-sdk.js +0 -415
  68. package/plugins/runtime/hook-dispatcher.js +0 -315
  69. package/plugins/runtime/loop-actuator.js +0 -292
  70. package/plugins/runtime/loop-coordinator.js +0 -347
  71. package/plugins/runtime/loop-defaults.js +0 -29
  72. package/plugins/runtime/loop-dispatch-batch.js +0 -351
  73. package/plugins/runtime/loop-executor.js +0 -120
  74. package/plugins/runtime/loop-report.js +0 -395
  75. package/plugins/runtime/loop-server-core.js +0 -750
  76. package/plugins/runtime/loop-snapshot.js +0 -581
  77. package/plugins/runtime/loop-trace.js +0 -242
  78. package/plugins/runtime/loop-worktree.js +0 -404
  79. package/plugins/runtime/multi-window-coordinator.js +0 -560
  80. package/plugins/runtime/objective-verifier.js +0 -136
  81. package/plugins/runtime/plan-lint.js +0 -106
  82. package/plugins/runtime/plugin-loader.js +0 -798
  83. package/plugins/runtime/plugin-trust.js +0 -182
  84. package/plugins/runtime/provider-failover.js +0 -114
  85. package/plugins/runtime/provider-resolver.js +0 -342
  86. package/plugins/runtime/reflection-evaluator.js +0 -545
  87. package/plugins/runtime/sandbox-context.js +0 -235
  88. package/plugins/runtime/sandbox-manager.js +0 -609
  89. package/plugins/runtime/sandbox-worker.js +0 -215
  90. package/plugins/runtime/self-rescue-ladder.js +0 -51
  91. package/plugins/runtime/text-tokenize.js +0 -25
  92. package/plugins/runtime/validator-pipeline.js +0 -475
@@ -1,244 +0,0 @@
1
- /**
2
- * Provider: State Store
3
- *
4
- * Wraps the StateStore runtime module to provide unified state and task data access.
5
- * Implements the ProviderPlugin interface from plugin-interface.js.
6
- *
7
- * Capabilities:
8
- * - get(key) read arbitrary state via dot-notation key
9
- * - getTasks() parse task.md into a structured task list
10
- * - set(key, value) write state
11
- * - delete(key) remove a state key
12
- * - keys() list all stored keys
13
- * - subscribe(key, cb) watch for changes on a key
14
- */
15
-
16
- 'use strict';
17
-
18
- var path = require('path');
19
- var fs = require('fs');
20
- var { ProviderPlugin } = require('../../contracts/plugin-interface');
21
- var { StateStore, FileSystemAdapter } = require('../../runtime/state-store');
22
-
23
- /**
24
- * Minimal YAML-like parser for task.md
25
- * Extracts the task table rows (WP-xxx entries) and status info.
26
- */
27
- function parseTaskMarkdown(content) {
28
- var lines = content.split('\n');
29
- var tasks = [];
30
- var stats = { total: 0, completed: 0, inProgress: 0, pending: 0 };
31
-
32
- // Find the table header row that starts with | WP |
33
- var tableStarted = false;
34
- var headerSkipped = false;
35
- var separatorSkipped = false;
36
-
37
- for (var i = 0; i < lines.length; i++) {
38
- var line = lines[i];
39
-
40
- if (!tableStarted) {
41
- if (line.indexOf('| WP ') === 0 || line.indexOf('| WP\t') === 0) {
42
- tableStarted = true;
43
- headerSkipped = true; // this line IS the header, already skipped by continue
44
- }
45
- continue;
46
- }
47
-
48
- // The first line after tableStarted is the header - skip it
49
- if (!headerSkipped) {
50
- headerSkipped = true;
51
- continue;
52
- }
53
-
54
- // The second line is the separator (|---|---|...) - skip it
55
- if (!separatorSkipped) {
56
- separatorSkipped = true;
57
- continue;
58
- }
59
-
60
- // Parse data rows
61
- var trimmed = line.trim();
62
- if (!trimmed || trimmed.indexOf('|') !== 0) {
63
- // End of table
64
- break;
65
- }
66
-
67
- var cells = trimmed.split('|').filter(function (c) { return c.trim() !== ''; });
68
- if (cells.length < 2) continue;
69
-
70
- var wpId = cells[0].trim();
71
- if (!wpId.match(/^WP-\d+$/)) continue;
72
-
73
- var title = cells.length > 1 ? cells[1].trim() : '';
74
- var statusCell = cells.length > 2 ? cells[2].trim() : '';
75
- var phase = cells.length > 3 ? cells[3].trim() : '';
76
- var priority = cells.length > 4 ? cells[4].trim() : '';
77
- var deps = cells.length > 5 ? cells[5].trim() : '';
78
- var estimate = cells.length > 6 ? cells[6].trim() : '';
79
-
80
- var status = 'pending';
81
- if (statusCell.indexOf('完成') !== -1 || statusCell.indexOf('Completed') !== -1) {
82
- status = 'completed';
83
- } else if (statusCell.indexOf('进行') !== -1 || statusCell.indexOf('In Progress') !== -1) {
84
- status = 'in_progress';
85
- } else if (statusCell.indexOf('待开始') !== -1 || statusCell.indexOf('Pending') !== -1) {
86
- status = 'pending';
87
- }
88
-
89
- stats.total++;
90
- if (status === 'completed') stats.completed++;
91
- else if (status === 'in_progress') stats.inProgress++;
92
- else stats.pending++;
93
-
94
- tasks.push({
95
- id: wpId,
96
- title: title,
97
- status: status,
98
- phase: phase,
99
- priority: priority,
100
- dependencies: deps ? deps.split(',').map(function (d) { return d.trim(); }) : [],
101
- estimate: estimate,
102
- });
103
- }
104
-
105
- return { tasks: tasks, stats: stats };
106
- }
107
-
108
- /**
109
- * StateStoreProvider - provides state access and task parsing
110
- */
111
- class StateStoreProvider extends ProviderPlugin {
112
- constructor() {
113
- super();
114
- this.name = 'provider-state-store';
115
- this.version = '1.0.0';
116
- this.description = 'State Store Provider';
117
- this.provides = 'provider:state-store';
118
- this.dependencies = {};
119
-
120
- /** @type {StateStore|null} */
121
- this._store = null;
122
- /** @type {string} */
123
- this._projectRoot = '';
124
- }
125
-
126
- /**
127
- * Called when the plugin is activated.
128
- * Initializes the StateStore with the project root path.
129
- *
130
- * @param {PluginContext} context
131
- */
132
- async onActivate(context) {
133
- this._projectRoot = this._resolveProjectRoot();
134
- var stateFilePath = path.join(this._projectRoot, '.claude-state');
135
- this._store = new StateStore({ filePath: stateFilePath });
136
- }
137
-
138
- /**
139
- * Factory method - returns the provider instance (this provider itself).
140
- *
141
- * @param {PluginContext} context
142
- * @returns {Promise<object>} the state store provider API
143
- */
144
- async factory(context) {
145
- var self = this;
146
-
147
- return {
148
- /**
149
- * Get a value by dot-notation key from the state store.
150
- * @param {string} key - e.g. 'harness.state'
151
- * @returns {Promise<*|undefined>}
152
- */
153
- get: function (key) {
154
- return self._store.get(key);
155
- },
156
-
157
- /**
158
- * Set a value by dot-notation key.
159
- * @param {string} key
160
- * @param {*} value
161
- * @returns {Promise<void>}
162
- */
163
- set: function (key, value) {
164
- return self._store.set(key, value);
165
- },
166
-
167
- /**
168
- * Delete a key from the state store.
169
- * @param {string} key
170
- * @returns {Promise<void>}
171
- */
172
- delete: function (key) {
173
- return self._store.delete(key);
174
- },
175
-
176
- /**
177
- * List all stored keys.
178
- * @returns {Promise<string[]>}
179
- */
180
- keys: function () {
181
- return self._store.keys();
182
- },
183
-
184
- /**
185
- * Subscribe to changes on a specific key.
186
- * @param {string} key
187
- * @param {Function} callback - callback(key, oldValue, newValue)
188
- * @returns {{ unsubscribe: Function }}
189
- */
190
- subscribe: function (key, callback) {
191
- return self._store.subscribe(key, callback);
192
- },
193
-
194
- /**
195
- * Parse task.md into a structured task list.
196
- * @returns {Promise<{ tasks: object[], stats: object }>}
197
- */
198
- getTasks: function () {
199
- return self._parseTasks();
200
- },
201
-
202
- /**
203
- * Get the raw state store instance for advanced usage.
204
- * @returns {StateStore}
205
- */
206
- getStore: function () {
207
- return self._store;
208
- },
209
- };
210
- }
211
-
212
- /**
213
- * Parse the task.md file.
214
- * @returns {Promise<{ tasks: object[], stats: object }>}
215
- */
216
- async _parseTasks() {
217
- var taskFile = path.join(this._projectRoot, 'task.md');
218
- try {
219
- var content = fs.readFileSync(taskFile, 'utf-8');
220
- return parseTaskMarkdown(content);
221
- } catch (err) {
222
- return { tasks: [], stats: { total: 0, completed: 0, inProgress: 0, pending: 0 } };
223
- }
224
- }
225
-
226
- /**
227
- * Resolve the project root directory.
228
- * Walks up from cwd to find a directory containing task.md or .claude/.
229
- * @returns {string}
230
- */
231
- _resolveProjectRoot() {
232
- var dir = process.cwd();
233
- for (var i = 0; i < 10; i++) {
234
- if (fs.existsSync(path.join(dir, 'task.md'))) return dir;
235
- if (fs.existsSync(path.join(dir, '.claude'))) return dir;
236
- var parent = path.dirname(dir);
237
- if (parent === dir) break;
238
- dir = parent;
239
- }
240
- return process.cwd();
241
- }
242
- }
243
-
244
- module.exports = StateStoreProvider;
@@ -1,9 +0,0 @@
1
- {
2
- "name": "provider-state-store",
3
- "version": "1.0.0",
4
- "type": "provider",
5
- "description": "状态存储 Provider - 包装 StateStore 运行时模块,提供统一的状态和任务数据访问接口",
6
- "dependencies": [],
7
- "provides": ["provider:state-store"],
8
- "config": {}
9
- }
@@ -1,32 +0,0 @@
1
- {
2
- "daemon": {
3
- "mode": "background"
4
- },
5
- "heartbeat_dir": ".claude-daemon",
6
- "check_interval_sec": 30,
7
- "timeouts": {
8
- "task_stalled_min": 20,
9
- "session_stalled_min": 30,
10
- "restart_cooldown_min": 2,
11
- "marker_window_min": 5
12
- },
13
- "retry": {
14
- "max_retries": 3,
15
- "timeout_scale": [1.0, 1.33, 2.0],
16
- "cooldown_min": [0, 2, 5]
17
- },
18
- "circuit_breaker": {
19
- "consecutive_failures_threshold": 3,
20
- "total_retries_multiplier": 2,
21
- "cooldown_after_break_min": 15
22
- },
23
- "process": {
24
- "kill_timeout_sec": 10,
25
- "restart_command": "claude --skill agent-dispatcher"
26
- },
27
- "logging": {
28
- "level": "info",
29
- "max_file_size_mb": 10,
30
- "max_files": 3
31
- }
32
- }