mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
feat: Update command validation tools and improve README documentation
This commit is contained in:
@@ -40,6 +40,6 @@
|
|||||||
| phases/orchestrator.md | 编排逻辑 |
|
| phases/orchestrator.md | 编排逻辑 |
|
||||||
| phases/state-schema.md | 状态定义 |
|
| phases/state-schema.md | 状态定义 |
|
||||||
| phases/actions/*.md | 动作实现 |
|
| phases/actions/*.md | 动作实现 |
|
||||||
| specs/chain-registry.json | 命令元数据 |
|
| specs/specs.md | 命令库、验证规则、注册表 |
|
||||||
| specs/chain-validation-rules.md | 验证规则 |
|
| tools/chain-validate.cjs | 验证工具 |
|
||||||
| tools/chain-validate.js | 验证工具 |
|
| tools/command-registry.cjs | 命令注册表工具 |
|
||||||
|
|||||||
@@ -224,10 +224,9 @@ Bash(`mkdir -p "${workDir}/logs"`);
|
|||||||
| [phases/actions/action-command-execute.md](phases/actions/action-command-execute.md) | 命令执行动作 |
|
| [phases/actions/action-command-execute.md](phases/actions/action-command-execute.md) | 命令执行动作 |
|
||||||
| [phases/actions/action-complete.md](phases/actions/action-complete.md) | 完成动作 |
|
| [phases/actions/action-complete.md](phases/actions/action-complete.md) | 完成动作 |
|
||||||
| [phases/actions/action-abort.md](phases/actions/action-abort.md) | 中止动作 |
|
| [phases/actions/action-abort.md](phases/actions/action-abort.md) | 中止动作 |
|
||||||
| [specs/command-library.md](specs/command-library.md) | 命令库 |
|
| [specs/specs.md](specs/specs.md) | 命令库、验证规则、注册表 |
|
||||||
| [specs/chain-registry.json](specs/chain-registry.json) | 命令元数据 |
|
| [tools/chain-validate.cjs](tools/chain-validate.cjs) | 验证工具 |
|
||||||
| [specs/chain-validation-rules.md](specs/chain-validation-rules.md) | 验证规则 |
|
| [tools/command-registry.cjs](tools/command-registry.cjs) | 命令注册表工具 |
|
||||||
| [tools/chain-validate.js](tools/chain-validate.js) | 验证工具 |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ const state = {
|
|||||||
session_id: `coord-${timestamp}`,
|
session_id: `coord-${timestamp}`,
|
||||||
status: 'running',
|
status: 'running',
|
||||||
started_at: new Date().toISOString(),
|
started_at: new Date().toISOString(),
|
||||||
|
task_description: '',
|
||||||
command_chain: [],
|
command_chain: [],
|
||||||
current_command_index: 0,
|
current_command_index: 0,
|
||||||
execution_results: [],
|
execution_results: [],
|
||||||
|
|||||||
@@ -276,14 +276,14 @@ tdd-plan → lite-execute
|
|||||||
|
|
||||||
## 验证工具
|
## 验证工具
|
||||||
|
|
||||||
### chain-validate.js
|
### chain-validate.cjs
|
||||||
|
|
||||||
位置: `tools/chain-validate.js`
|
位置: `tools/chain-validate.cjs`
|
||||||
|
|
||||||
验证命令链合法性:
|
验证命令链合法性:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node tools/chain-validate.js plan execute test-cycle-execute
|
node tools/chain-validate.cjs plan execute test-cycle-execute
|
||||||
```
|
```
|
||||||
|
|
||||||
输出:
|
输出:
|
||||||
|
|||||||
@@ -14,9 +14,16 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
// Load registry
|
// Optional registry loading - gracefully degrade if not found
|
||||||
const registryPath = path.join(__dirname, '..', 'specs', 'chain-registry.json');
|
let registry = null;
|
||||||
const registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
|
try {
|
||||||
|
const registryPath = path.join(__dirname, '..', 'specs', 'chain-registry.json');
|
||||||
|
if (fs.existsSync(registryPath)) {
|
||||||
|
registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Registry not available - dependency validation will be skipped
|
||||||
|
}
|
||||||
|
|
||||||
class ChainValidator {
|
class ChainValidator {
|
||||||
constructor(registry) {
|
constructor(registry) {
|
||||||
@@ -161,10 +168,15 @@ class ChainValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validateDependencies(chain) {
|
validateDependencies(chain) {
|
||||||
|
// Skip if registry not available
|
||||||
|
if (!this.registry || !this.registry.commands) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < chain.length; i++) {
|
for (let i = 0; i < chain.length; i++) {
|
||||||
const cmd = chain[i];
|
const cmd = chain[i];
|
||||||
const cmdMeta = this.registry.commands[cmd];
|
const cmdMeta = this.registry.commands[cmd];
|
||||||
|
|
||||||
if (!cmdMeta) continue;
|
if (!cmdMeta) continue;
|
||||||
|
|
||||||
const deps = cmdMeta.dependencies || [];
|
const deps = cmdMeta.dependencies || [];
|
||||||
@@ -208,6 +220,11 @@ class ChainValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validateCommandExistence(chain) {
|
validateCommandExistence(chain) {
|
||||||
|
// Skip if registry not available
|
||||||
|
if (!this.registry || !this.registry.commands) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (const cmd of chain) {
|
for (const cmd of chain) {
|
||||||
if (!this.registry.commands[cmd]) {
|
if (!this.registry.commands[cmd]) {
|
||||||
this.errors.push({
|
this.errors.push({
|
||||||
Reference in New Issue
Block a user