claude-flow-novice 1.6.1 → 1.6.2
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/.claude/agents/cfn-loop/product-owner.md +54 -4
- package/.claude/commands/cfn-claude-sync.md +303 -0
- package/.claude/commands/cfn-loop-epic.md +290 -0
- package/.claude/commands/cfn-loop-single.md +168 -0
- package/.claude/commands/cfn-loop-sprints.md +384 -0
- package/.claude/commands/cfn-loop.md +180 -0
- package/.claude/commands/metrics-summary.md +58 -0
- package/.claude/commands/parse-epic.md +357 -0
- package/.claude/settings.json +4 -4
- package/.claude/settings.local.json +9 -2
- package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
- package/.claude-flow-novice/dist/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
- package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
- package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
- package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
- package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
- package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
- package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
- package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
- package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
- package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
- package/.claude-flow-novice/metrics.db +0 -0
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/CLAUDE.md +29 -0
- package/README.md +27 -0
- package/config/hooks/post-edit-pipeline.js +36 -2
- package/examples/metrics-counter-demo.ts +106 -0
- package/examples/persistent-metrics-demo.ts +83 -0
- package/examples/phase-5-multi-level-control.ts +282 -0
- package/examples/session-pool-optimizer-example.ts +311 -0
- package/package.json +15 -3
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/test-provider-routing.cjs +228 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
- package/src/observability/metrics-counter.ts +347 -0
- package/src/observability/metrics-storage.ts +356 -0
- package/src/observability/telemetry.ts +658 -0
- package/src/slash-commands/cfn-claude-sync.js +533 -0
- package/src/slash-commands/index.js +5 -0
- package/src/slash-commands/metrics-summary-class.js +74 -0
- package/src/slash-commands/metrics-summary.js +335 -0
- package/src/slash-commands/register-all-commands.js +12 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CFN Claude Sync Slash Command
|
|
5
|
+
* Usage: /cfn-claude-sync [--dry-run] [--verbose]
|
|
6
|
+
*
|
|
7
|
+
* Synchronizes CFN Loop configuration from CLAUDE.md to slash command files.
|
|
8
|
+
* Ensures single source of truth (DRY principle) for CFN Loop rules.
|
|
9
|
+
*
|
|
10
|
+
* Extracts from CLAUDE.md:
|
|
11
|
+
* - Consensus threshold (≥90%)
|
|
12
|
+
* - Confidence gate (≥75%)
|
|
13
|
+
* - Loop 2/3 iteration limits
|
|
14
|
+
* - Complexity tiers and agent counts
|
|
15
|
+
* - GOAP decision types
|
|
16
|
+
* - Autonomous execution rules
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { SlashCommand } from "../core/slash-command.js";
|
|
20
|
+
import fs from "fs";
|
|
21
|
+
import path from "path";
|
|
22
|
+
|
|
23
|
+
export class CfnClaudeSyncCommand extends SlashCommand {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(
|
|
26
|
+
"cfn-claude-sync",
|
|
27
|
+
"Sync CFN Loop rules from CLAUDE.md to slash command files (DRY principle enforcement)",
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getUsage() {
|
|
32
|
+
return "/cfn-claude-sync [--dry-run] [--verbose]";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getExamples() {
|
|
36
|
+
return [
|
|
37
|
+
"/cfn-claude-sync",
|
|
38
|
+
"/cfn-claude-sync --dry-run",
|
|
39
|
+
"/cfn-claude-sync --verbose",
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async execute(args, context) {
|
|
44
|
+
const options = this.parseArgs(args);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const projectRoot = process.cwd();
|
|
48
|
+
const claudeMdPath = path.join(projectRoot, "CLAUDE.md");
|
|
49
|
+
|
|
50
|
+
// Step 1: Verify CLAUDE.md exists
|
|
51
|
+
if (!fs.existsSync(claudeMdPath)) {
|
|
52
|
+
return this.formatResponse({
|
|
53
|
+
success: false,
|
|
54
|
+
error: "CLAUDE.md not found in project root",
|
|
55
|
+
path: claudeMdPath,
|
|
56
|
+
suggestion:
|
|
57
|
+
"Please ensure CLAUDE.md exists before running sync command",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Step 2: Extract CFN Loop configuration from CLAUDE.md
|
|
62
|
+
const config = this.extractCfnConfig(claudeMdPath, options.verbose);
|
|
63
|
+
|
|
64
|
+
if (options.verbose) {
|
|
65
|
+
console.log("📋 Extracted Configuration:");
|
|
66
|
+
console.log(JSON.stringify(config, null, 2));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Step 3: Identify target files
|
|
70
|
+
const targetFiles = this.getTargetFiles(projectRoot);
|
|
71
|
+
|
|
72
|
+
if (options.verbose) {
|
|
73
|
+
console.log("\n📂 Target Files:");
|
|
74
|
+
console.log(
|
|
75
|
+
` Markdown templates: ${targetFiles.markdown.length} files`,
|
|
76
|
+
);
|
|
77
|
+
console.log(
|
|
78
|
+
` JavaScript generators: ${targetFiles.javascript.length} files`,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Step 4: Analyze required changes
|
|
83
|
+
const changes = this.analyzeChanges(targetFiles, config, options.verbose);
|
|
84
|
+
|
|
85
|
+
// Step 5: Dry run or apply changes
|
|
86
|
+
if (options.dryRun) {
|
|
87
|
+
return this.formatDryRunReport(config, changes);
|
|
88
|
+
} else {
|
|
89
|
+
const results = await this.applyChanges(
|
|
90
|
+
targetFiles,
|
|
91
|
+
config,
|
|
92
|
+
changes,
|
|
93
|
+
options.verbose,
|
|
94
|
+
);
|
|
95
|
+
return this.formatSyncReport(config, results);
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return this.formatResponse({
|
|
99
|
+
success: false,
|
|
100
|
+
error: error.message,
|
|
101
|
+
stack: options.verbose ? error.stack : undefined,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
parseArgs(args) {
|
|
107
|
+
const options = {
|
|
108
|
+
dryRun: false,
|
|
109
|
+
verbose: false,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
for (const arg of args) {
|
|
113
|
+
if (arg === "--dry-run") {
|
|
114
|
+
options.dryRun = true;
|
|
115
|
+
} else if (arg === "--verbose") {
|
|
116
|
+
options.verbose = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return options;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
extractCfnConfig(claudeMdPath, verbose) {
|
|
124
|
+
const content = fs.readFileSync(claudeMdPath, "utf-8");
|
|
125
|
+
|
|
126
|
+
// Extract CFN Loop section
|
|
127
|
+
const cfnSectionMatch = content.match(
|
|
128
|
+
/## 🔄 MANDATORY CFN LOOP[\s\S]*?(?=\n## [^#]|$)/,
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
if (!cfnSectionMatch) {
|
|
132
|
+
throw new Error(
|
|
133
|
+
"Could not find '## 🔄 MANDATORY CFN LOOP' section in CLAUDE.md",
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const cfnSection = cfnSectionMatch[0];
|
|
138
|
+
|
|
139
|
+
// Extract configuration values with robust regex patterns
|
|
140
|
+
const config = {
|
|
141
|
+
consensusThreshold: this.extractValue(
|
|
142
|
+
cfnSection,
|
|
143
|
+
/≥(\d+)%.*consensus/i,
|
|
144
|
+
"90",
|
|
145
|
+
),
|
|
146
|
+
confidenceGate: this.extractValue(
|
|
147
|
+
cfnSection,
|
|
148
|
+
/ALL agents ≥(\d+)%|≥(\d+)%.*confidence/i,
|
|
149
|
+
"75",
|
|
150
|
+
),
|
|
151
|
+
loop2MaxIterations: this.extractValue(
|
|
152
|
+
cfnSection,
|
|
153
|
+
/Loop 2.*[Mm]ax.*?(\d+)|Loop 2.*\(.*?(\d+).*iterations\)/i,
|
|
154
|
+
"10",
|
|
155
|
+
),
|
|
156
|
+
loop3MaxIterations: this.extractValue(
|
|
157
|
+
cfnSection,
|
|
158
|
+
/Loop 3.*[Mm]ax.*?(\d+)|Loop 3.*\(.*?(\d+).*iterations\)/i,
|
|
159
|
+
"10",
|
|
160
|
+
),
|
|
161
|
+
|
|
162
|
+
// Complexity tiers
|
|
163
|
+
complexityTiers: {
|
|
164
|
+
simple: this.extractComplexityTier(cfnSection, "Simple", "2-3", "mesh"),
|
|
165
|
+
medium: this.extractComplexityTier(cfnSection, "Medium", "4-6", "mesh"),
|
|
166
|
+
complex: this.extractComplexityTier(
|
|
167
|
+
cfnSection,
|
|
168
|
+
"Complex",
|
|
169
|
+
"8-12",
|
|
170
|
+
"hierarchical",
|
|
171
|
+
),
|
|
172
|
+
enterprise: this.extractComplexityTier(
|
|
173
|
+
cfnSection,
|
|
174
|
+
"Enterprise",
|
|
175
|
+
"15-20",
|
|
176
|
+
"hierarchical",
|
|
177
|
+
),
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
// GOAP decision types
|
|
181
|
+
goapDecisions: ["PROCEED", "DEFER", "ESCALATE"],
|
|
182
|
+
|
|
183
|
+
// Autonomous rules
|
|
184
|
+
autonomousRules: [
|
|
185
|
+
"NO approval needed for retries",
|
|
186
|
+
"IMMEDIATE relaunch on consensus failure",
|
|
187
|
+
"AUTO-TRANSITION on phase completion",
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
if (verbose) {
|
|
192
|
+
console.log("✅ Successfully extracted CFN Loop configuration");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return config;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
extractValue(text, pattern, fallback) {
|
|
199
|
+
const match = text.match(pattern);
|
|
200
|
+
if (match) {
|
|
201
|
+
// Return first captured group that's not undefined
|
|
202
|
+
for (let i = 1; i < match.length; i++) {
|
|
203
|
+
if (match[i] !== undefined) {
|
|
204
|
+
return match[i];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return fallback;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
extractComplexityTier(text, tierName, defaultAgents, defaultTopology) {
|
|
212
|
+
// Try to find agent count for this tier
|
|
213
|
+
const agentPattern = new RegExp(
|
|
214
|
+
`\\*\\*${tierName}\\*\\*.*?(\\d+-?\\d*)\\s+agents`,
|
|
215
|
+
"i",
|
|
216
|
+
);
|
|
217
|
+
const agentMatch = text.match(agentPattern);
|
|
218
|
+
|
|
219
|
+
// Try to find topology for this tier
|
|
220
|
+
const topologyPattern = new RegExp(
|
|
221
|
+
`${tierName}.*?(mesh|hierarchical)`,
|
|
222
|
+
"i",
|
|
223
|
+
);
|
|
224
|
+
const topologyMatch = text.match(topologyPattern);
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
agents: agentMatch ? agentMatch[1] : defaultAgents,
|
|
228
|
+
topology: topologyMatch
|
|
229
|
+
? topologyMatch[1].toLowerCase()
|
|
230
|
+
: defaultTopology,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
getTargetFiles(projectRoot) {
|
|
235
|
+
return {
|
|
236
|
+
markdown: [
|
|
237
|
+
".claude/commands/cfn-loop.md",
|
|
238
|
+
".claude/commands/cfn-loop-epic.md",
|
|
239
|
+
".claude/commands/cfn-loop-sprints.md",
|
|
240
|
+
".claude/commands/cfn-loop-single.md",
|
|
241
|
+
].map((f) => path.join(projectRoot, f)),
|
|
242
|
+
|
|
243
|
+
javascript: [
|
|
244
|
+
"src/slash-commands/cfn-loop.js",
|
|
245
|
+
"src/slash-commands/cfn-loop-epic.js",
|
|
246
|
+
"src/slash-commands/cfn-loop-sprints.js",
|
|
247
|
+
"src/slash-commands/cfn-loop-single.js",
|
|
248
|
+
].map((f) => path.join(projectRoot, f)),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
analyzeChanges(targetFiles, config, verbose) {
|
|
253
|
+
const changes = {
|
|
254
|
+
markdown: [],
|
|
255
|
+
javascript: [],
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// Analyze markdown files
|
|
259
|
+
for (const file of targetFiles.markdown) {
|
|
260
|
+
if (!fs.existsSync(file)) {
|
|
261
|
+
if (verbose) console.log(`⚠️ Skipping missing file: ${file}`);
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
266
|
+
const fileChanges = [];
|
|
267
|
+
|
|
268
|
+
// Check consensus threshold
|
|
269
|
+
const consensusPattern = /≥(\d+)%.*consensus/gi;
|
|
270
|
+
let match;
|
|
271
|
+
while ((match = consensusPattern.exec(content)) !== null) {
|
|
272
|
+
if (match[1] !== config.consensusThreshold) {
|
|
273
|
+
fileChanges.push({
|
|
274
|
+
line: this.getLineNumber(content, match.index),
|
|
275
|
+
type: "consensus_threshold",
|
|
276
|
+
current: match[1],
|
|
277
|
+
expected: config.consensusThreshold,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Check confidence gate
|
|
283
|
+
const confidencePattern = /ALL agents ≥(\d+)%/gi;
|
|
284
|
+
while ((match = confidencePattern.exec(content)) !== null) {
|
|
285
|
+
if (match[1] !== config.confidenceGate) {
|
|
286
|
+
fileChanges.push({
|
|
287
|
+
line: this.getLineNumber(content, match.index),
|
|
288
|
+
type: "confidence_gate",
|
|
289
|
+
current: match[1],
|
|
290
|
+
expected: config.confidenceGate,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (fileChanges.length > 0) {
|
|
296
|
+
changes.markdown.push({ file, changes: fileChanges });
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Analyze JavaScript files
|
|
301
|
+
for (const file of targetFiles.javascript) {
|
|
302
|
+
if (!fs.existsSync(file)) {
|
|
303
|
+
if (verbose) console.log(`⚠️ Skipping missing file: ${file}`);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
308
|
+
const fileChanges = [];
|
|
309
|
+
|
|
310
|
+
// Check maxLoop2 default
|
|
311
|
+
const loop2Pattern = /maxLoop2:\s*(\d+)/g;
|
|
312
|
+
let match;
|
|
313
|
+
while ((match = loop2Pattern.exec(content)) !== null) {
|
|
314
|
+
if (match[1] !== config.loop2MaxIterations) {
|
|
315
|
+
fileChanges.push({
|
|
316
|
+
line: this.getLineNumber(content, match.index),
|
|
317
|
+
type: "loop2_max",
|
|
318
|
+
current: match[1],
|
|
319
|
+
expected: config.loop2MaxIterations,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Check maxLoop3 default
|
|
325
|
+
const loop3Pattern = /maxLoop3:\s*(\d+)/g;
|
|
326
|
+
while ((match = loop3Pattern.exec(content)) !== null) {
|
|
327
|
+
if (match[1] !== config.loop3MaxIterations) {
|
|
328
|
+
fileChanges.push({
|
|
329
|
+
line: this.getLineNumber(content, match.index),
|
|
330
|
+
type: "loop3_max",
|
|
331
|
+
current: match[1],
|
|
332
|
+
expected: config.loop3MaxIterations,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (fileChanges.length > 0) {
|
|
338
|
+
changes.javascript.push({ file, changes: fileChanges });
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return changes;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
getLineNumber(content, charIndex) {
|
|
346
|
+
return content.substring(0, charIndex).split("\n").length;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
async applyChanges(targetFiles, config, changes, verbose) {
|
|
350
|
+
const results = {
|
|
351
|
+
updated: [],
|
|
352
|
+
errors: [],
|
|
353
|
+
skipped: [],
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// Create backup directory
|
|
357
|
+
const backupDir = path.join(
|
|
358
|
+
process.cwd(),
|
|
359
|
+
".claude",
|
|
360
|
+
"backups",
|
|
361
|
+
`cfn-sync-${Date.now()}`,
|
|
362
|
+
);
|
|
363
|
+
fs.mkdirSync(backupDir, { recursive: true });
|
|
364
|
+
|
|
365
|
+
// Apply markdown changes
|
|
366
|
+
for (const fileChange of changes.markdown) {
|
|
367
|
+
try {
|
|
368
|
+
const { file } = fileChange;
|
|
369
|
+
let content = fs.readFileSync(file, "utf-8");
|
|
370
|
+
|
|
371
|
+
// Backup original
|
|
372
|
+
const backupPath = path.join(backupDir, path.basename(file));
|
|
373
|
+
fs.writeFileSync(backupPath, content);
|
|
374
|
+
|
|
375
|
+
// Apply replacements
|
|
376
|
+
content = content.replace(
|
|
377
|
+
/≥(\d+)%(\s*.*?consensus)/gi,
|
|
378
|
+
`≥${config.consensusThreshold}%$2`,
|
|
379
|
+
);
|
|
380
|
+
content = content.replace(
|
|
381
|
+
/ALL agents ≥(\d+)%/gi,
|
|
382
|
+
`ALL agents ≥${config.confidenceGate}%`,
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
fs.writeFileSync(file, content);
|
|
386
|
+
results.updated.push({
|
|
387
|
+
file,
|
|
388
|
+
changes: fileChange.changes.length,
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
if (verbose) {
|
|
392
|
+
console.log(
|
|
393
|
+
`✅ Updated ${path.basename(file)} (${fileChange.changes.length} changes)`,
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
} catch (error) {
|
|
397
|
+
results.errors.push({ file: fileChange.file, error: error.message });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// Apply JavaScript changes
|
|
402
|
+
for (const fileChange of changes.javascript) {
|
|
403
|
+
try {
|
|
404
|
+
const { file } = fileChange;
|
|
405
|
+
let content = fs.readFileSync(file, "utf-8");
|
|
406
|
+
|
|
407
|
+
// Backup original
|
|
408
|
+
const backupPath = path.join(backupDir, path.basename(file));
|
|
409
|
+
fs.writeFileSync(backupPath, content);
|
|
410
|
+
|
|
411
|
+
// Apply replacements
|
|
412
|
+
content = content.replace(
|
|
413
|
+
/maxLoop2:\s*\d+/g,
|
|
414
|
+
`maxLoop2: ${config.loop2MaxIterations}`,
|
|
415
|
+
);
|
|
416
|
+
content = content.replace(
|
|
417
|
+
/maxLoop3:\s*\d+/g,
|
|
418
|
+
`maxLoop3: ${config.loop3MaxIterations}`,
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
fs.writeFileSync(file, content);
|
|
422
|
+
results.updated.push({
|
|
423
|
+
file,
|
|
424
|
+
changes: fileChange.changes.length,
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
if (verbose) {
|
|
428
|
+
console.log(
|
|
429
|
+
`✅ Updated ${path.basename(file)} (${fileChange.changes.length} changes)`,
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
} catch (error) {
|
|
433
|
+
results.errors.push({ file: fileChange.file, error: error.message });
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return results;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
formatDryRunReport(config, changes) {
|
|
441
|
+
const totalChanges =
|
|
442
|
+
changes.markdown.reduce((sum, f) => sum + f.changes.length, 0) +
|
|
443
|
+
changes.javascript.reduce((sum, f) => sum + f.changes.length, 0);
|
|
444
|
+
|
|
445
|
+
let report = `
|
|
446
|
+
🔍 **CFN Claude Sync (DRY RUN)**
|
|
447
|
+
|
|
448
|
+
**Extracted from CLAUDE.md:**
|
|
449
|
+
- Consensus threshold: ≥${config.consensusThreshold}%
|
|
450
|
+
- Confidence gate: ≥${config.confidenceGate}%
|
|
451
|
+
- Loop 2 max iterations: ${config.loop2MaxIterations}
|
|
452
|
+
- Loop 3 max iterations: ${config.loop3MaxIterations}
|
|
453
|
+
|
|
454
|
+
**Changes to be made:**
|
|
455
|
+
`;
|
|
456
|
+
|
|
457
|
+
for (const fileChange of changes.markdown) {
|
|
458
|
+
report += `\n ${path.basename(fileChange.file)}:\n`;
|
|
459
|
+
for (const change of fileChange.changes) {
|
|
460
|
+
report += ` Line ${change.line}: ${change.current}% → ${config.consensusThreshold}% (${change.type})\n`;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
for (const fileChange of changes.javascript) {
|
|
465
|
+
report += `\n ${path.basename(fileChange.file)}:\n`;
|
|
466
|
+
for (const change of fileChange.changes) {
|
|
467
|
+
report += ` Line ${change.line}: ${change.current} → ${change.expected} (${change.type})\n`;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
report += `\n**Total files to update:** ${changes.markdown.length + changes.javascript.length}`;
|
|
472
|
+
report += `\n**Total changes:** ${totalChanges}`;
|
|
473
|
+
report += `\n\nRun without --dry-run to apply changes.`;
|
|
474
|
+
|
|
475
|
+
return this.formatResponse({
|
|
476
|
+
success: true,
|
|
477
|
+
dryRun: true,
|
|
478
|
+
report: report,
|
|
479
|
+
config: config,
|
|
480
|
+
changes: changes,
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
formatSyncReport(config, results) {
|
|
485
|
+
let report = `
|
|
486
|
+
✅ **CFN Claude Sync Complete**
|
|
487
|
+
|
|
488
|
+
**Updated files:**
|
|
489
|
+
`;
|
|
490
|
+
|
|
491
|
+
for (const update of results.updated) {
|
|
492
|
+
report += ` ✅ ${path.basename(update.file)} (${update.changes} changes)\n`;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
if (results.errors.length > 0) {
|
|
496
|
+
report += `\n**Errors:**\n`;
|
|
497
|
+
for (const error of results.errors) {
|
|
498
|
+
report += ` ❌ ${path.basename(error.file)}: ${error.error}\n`;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (results.skipped.length > 0) {
|
|
503
|
+
report += `\n**Skipped:**\n`;
|
|
504
|
+
for (const skip of results.skipped) {
|
|
505
|
+
report += ` ⚠️ ${path.basename(skip)}\n`;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
report += `
|
|
510
|
+
**Configuration now synchronized:**
|
|
511
|
+
- Consensus threshold: ≥${config.consensusThreshold}%
|
|
512
|
+
- Confidence gate: ≥${config.confidenceGate}%
|
|
513
|
+
- Loop 2 max: ${config.loop2MaxIterations} iterations
|
|
514
|
+
- Loop 3 max: ${config.loop3MaxIterations} iterations
|
|
515
|
+
|
|
516
|
+
**Next steps:**
|
|
517
|
+
1. Review changes: git diff
|
|
518
|
+
2. Run tests: npm test
|
|
519
|
+
3. Validate: /cfn-loop "test task" --dry-run
|
|
520
|
+
4. Commit: git commit -m "chore: sync CFN Loop from CLAUDE.md"
|
|
521
|
+
`;
|
|
522
|
+
|
|
523
|
+
return this.formatResponse({
|
|
524
|
+
success: true,
|
|
525
|
+
report: report,
|
|
526
|
+
config: config,
|
|
527
|
+
results: results,
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// Register command
|
|
533
|
+
export default CfnClaudeSyncCommand;
|
|
@@ -23,6 +23,7 @@ export { CfnLoopSingleCommand } from "./cfn-loop-single.js";
|
|
|
23
23
|
export { CfnLoopSprintsCommand } from "./cfn-loop-sprints.js";
|
|
24
24
|
export { CfnLoopEpicCommand } from "./cfn-loop-epic.js";
|
|
25
25
|
export { ParseEpicCommand } from "./parse-epic.js";
|
|
26
|
+
export { CfnClaudeSyncCommand } from "./cfn-claude-sync.js";
|
|
26
27
|
|
|
27
28
|
// Command executors
|
|
28
29
|
export { executeClaudeSoulCommand } from "./claude-soul.js";
|
|
@@ -60,6 +61,7 @@ export const Commands = {
|
|
|
60
61
|
CFN_LOOP_SPRINTS: "cfn-loop-sprints",
|
|
61
62
|
CFN_LOOP_EPIC: "cfn-loop-epic",
|
|
62
63
|
PARSE_EPIC: "parse-epic",
|
|
64
|
+
CFN_CLAUDE_SYNC: "cfn-claude-sync",
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
/**
|
|
@@ -82,6 +84,8 @@ export const Aliases = {
|
|
|
82
84
|
"cfn-epic": "cfn-loop-epic",
|
|
83
85
|
parse: "parse-epic",
|
|
84
86
|
epic: "parse-epic",
|
|
87
|
+
sync: "cfn-claude-sync",
|
|
88
|
+
"cfn-sync": "cfn-claude-sync",
|
|
85
89
|
};
|
|
86
90
|
|
|
87
91
|
/**
|
|
@@ -110,6 +114,7 @@ export function getQuickHelp() {
|
|
|
110
114
|
**Essential Commands:**
|
|
111
115
|
- \`/cfn-loop "task description"\` - Autonomous self-correcting 3-loop workflow (IMMEDIATE retries)
|
|
112
116
|
- \`/fullstack "goal"\` - Autonomous full-stack team with CFN Loop (NO approvals)
|
|
117
|
+
- \`/cfn-claude-sync\` - Sync CFN Loop rules from CLAUDE.md to slash commands (DRY principle)
|
|
113
118
|
- \`/swarm init mesh 8\` - Initialize agent swarm
|
|
114
119
|
- \`/hooks enable\` - Enable automation hooks
|
|
115
120
|
- \`/sparc spec "task"\` - Run SPARC methodology
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Metrics Summary Slash Command Class
|
|
5
|
+
*
|
|
6
|
+
* Slash command wrapper for metrics-summary.js script.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
import { dirname, join } from 'path';
|
|
11
|
+
import { execSync } from 'child_process';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
|
|
16
|
+
export class MetricsSummaryCommand {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.name = 'metrics-summary';
|
|
19
|
+
this.description = 'Display aggregated metrics statistics with configurable time frame';
|
|
20
|
+
this.usage = '/metrics-summary [--minutes=60] [--provider=all] [--model=all]';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get command help
|
|
25
|
+
*/
|
|
26
|
+
getHelp() {
|
|
27
|
+
return {
|
|
28
|
+
name: this.name,
|
|
29
|
+
description: this.description,
|
|
30
|
+
usage: this.usage,
|
|
31
|
+
examples: [
|
|
32
|
+
'/metrics-summary',
|
|
33
|
+
'/metrics-summary --minutes=1440',
|
|
34
|
+
'/metrics-summary --minutes=60 --provider=z.ai',
|
|
35
|
+
'/metrics-summary --minutes=10080 --model=glm-4.6',
|
|
36
|
+
],
|
|
37
|
+
options: [
|
|
38
|
+
'--minutes=<N> Time frame in minutes (default: 60 = last hour)',
|
|
39
|
+
'--provider=<P> Filter by provider: all, anthropic, z.ai (default: all)',
|
|
40
|
+
'--model=<M> Filter by model name (default: all)',
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Execute command
|
|
47
|
+
*/
|
|
48
|
+
async execute(args, context = {}) {
|
|
49
|
+
try {
|
|
50
|
+
const scriptPath = join(__dirname, 'metrics-summary.js');
|
|
51
|
+
const nodeArgs = args.join(' ');
|
|
52
|
+
|
|
53
|
+
// Execute metrics-summary.js script
|
|
54
|
+
const output = execSync(`node "${scriptPath}" ${nodeArgs}`, {
|
|
55
|
+
encoding: 'utf8',
|
|
56
|
+
cwd: join(__dirname, '../..'),
|
|
57
|
+
stdio: 'pipe',
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
success: true,
|
|
62
|
+
output: output,
|
|
63
|
+
};
|
|
64
|
+
} catch (error) {
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
error: error.message,
|
|
68
|
+
stderr: error.stderr?.toString() || '',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default MetricsSummaryCommand;
|