oneie 3.5.0 → 3.6.3

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 (141) hide show
  1. package/.claude/agents/agent-director.md +902 -22
  2. package/.claude/agents/agent-onboard-example-output.md +600 -0
  3. package/.claude/agents/agent-onboard.md +576 -0
  4. package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
  5. package/.claude/commands/deploy.md +77 -150
  6. package/.claude/commands/one.md +375 -5
  7. package/.claude/commands/release.md +64 -3
  8. package/.mcp.json +57 -0
  9. package/CLAUDE.md +55 -69
  10. package/CREATE-WEBSITE.md +442 -0
  11. package/SECURITY.md +31 -0
  12. package/TESTING-ONBOARDING.md +185 -0
  13. package/dist/commands/create-website.d.ts +19 -0
  14. package/dist/commands/create-website.d.ts.map +1 -0
  15. package/dist/commands/create-website.js +231 -0
  16. package/dist/commands/create-website.js.map +1 -0
  17. package/dist/commands/init.d.ts +5 -6
  18. package/dist/commands/init.d.ts.map +1 -1
  19. package/dist/commands/init.js +213 -103
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/index.js +7 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/utils/installation-setup.d.ts +24 -1
  24. package/dist/utils/installation-setup.d.ts.map +1 -1
  25. package/dist/utils/installation-setup.js +85 -1
  26. package/dist/utils/installation-setup.js.map +1 -1
  27. package/dist/utils/launch-claude.d.ts +6 -0
  28. package/dist/utils/launch-claude.d.ts.map +1 -0
  29. package/dist/utils/launch-claude.js +51 -0
  30. package/dist/utils/launch-claude.js.map +1 -0
  31. package/dist/utils/validation.d.ts +48 -0
  32. package/dist/utils/validation.d.ts.map +1 -0
  33. package/dist/utils/validation.js +73 -0
  34. package/dist/utils/validation.js.map +1 -0
  35. package/folders.yaml +1 -1
  36. package/one/.obsidian/core-plugins.json +33 -0
  37. package/one/.obsidian/workspace.json +20 -20
  38. package/one/connections/workflow-onboarding.md +683 -0
  39. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
  40. package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
  41. package/one/events/DEPLOYMENT.md +178 -0
  42. package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
  43. package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
  44. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
  45. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
  46. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
  47. package/one/events/HANDOFF.md +313 -0
  48. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
  49. package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
  50. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
  51. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
  52. package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
  53. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
  54. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
  55. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
  56. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
  57. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
  58. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
  59. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
  60. package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
  61. package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
  62. package/one/events/SHOP-BUILD-STATUS.md +114 -0
  63. package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
  64. package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
  65. package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
  66. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
  67. package/one/events/agent-director-enhancement-summary.md +386 -0
  68. package/one/events/agent-onboard-implementation-summary.md +457 -0
  69. package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
  70. package/one/events/landing-page-generator.md +458 -0
  71. package/one/events/onboarding-implementation-complete.md +505 -0
  72. package/one/events/release.md +254 -0
  73. package/one/events/separate-implementation-status.md +537 -0
  74. package/one/knowledge/100-inference-quick-reference.md +431 -0
  75. package/one/knowledge/agent-onboard-usage.md +612 -0
  76. package/one/knowledge/cli-claude-handoff.md +718 -0
  77. package/one/knowledge/ontology-blog.yaml +31 -0
  78. package/one/knowledge/ontology-cheatsheet.md +591 -0
  79. package/one/knowledge/ontology-community.yaml +42 -0
  80. package/one/knowledge/ontology-core-universal.md +722 -0
  81. package/one/knowledge/ontology-core.yaml +50 -0
  82. package/one/knowledge/ontology-courses.yaml +53 -0
  83. package/one/knowledge/ontology-creator.md +376 -0
  84. package/one/knowledge/ontology-developer-guide.md +789 -0
  85. package/one/knowledge/ontology-education.md +920 -0
  86. package/one/knowledge/ontology-index.md +354 -0
  87. package/one/knowledge/ontology-migration-guide.md +811 -0
  88. package/one/knowledge/ontology-minimal.yaml +1 -1
  89. package/one/knowledge/ontology-portfolio.yaml +31 -0
  90. package/one/knowledge/ontology-quickstart.md +576 -0
  91. package/one/knowledge/ontology-shop.yaml +121 -0
  92. package/one/knowledge/ontology-tokens.yaml +32 -0
  93. package/one/knowledge/ontology-tutorial.md +434 -0
  94. package/one/knowledge/ontology-video-script.md +890 -0
  95. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
  96. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
  97. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
  98. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
  99. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
  100. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
  101. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
  102. package/one/things/docs/ecommerce/QUICK-START.md +368 -0
  103. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
  104. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
  105. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
  106. package/one/things/docs/ecommerce/demo.astro +309 -0
  107. package/one/things/plans/agent-director-100-inference-plans.md +410 -0
  108. package/one/things/plans/dual-website-strategy.md +612 -0
  109. package/one/things/plans/feature-based-sites.md +821 -0
  110. package/one/things/plans/multi-ontology-architecture.md +836 -0
  111. package/one/things/plans/onboarding.md +32 -0
  112. package/one/things/plans/separate.md +15 -17
  113. package/one/things/plans/start-new.md +738 -0
  114. package/package.json +7 -2
  115. package/one/things/claude/hooks/agent-hook-manager.js +0 -525
  116. package/one/things/claude/hooks/agent-load-balancer.js +0 -271
  117. package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
  118. package/one/things/claude/hooks/cascade-feedback.js +0 -297
  119. package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
  120. package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
  121. package/one/things/claude/hooks/file-organization-engine.js +0 -427
  122. package/one/things/claude/hooks/file-organization-monitor.js +0 -269
  123. package/one/things/claude/hooks/hook-config-manager.js +0 -202
  124. package/one/things/claude/hooks/hook-orchestrator.js +0 -662
  125. package/one/things/claude/hooks/hook-performance-report.js +0 -120
  126. package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
  127. package/one/things/claude/hooks/memory-optimizer.js +0 -510
  128. package/one/things/claude/hooks/ontology-compliance.js +0 -394
  129. package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
  130. package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
  131. package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
  132. package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
  133. package/one/things/claude/hooks/simple-load-balancer.js +0 -238
  134. package/one/things/claude/hooks/startup-optimizer.js +0 -625
  135. package/one/things/claude/hooks/story-scoring-system.js +0 -445
  136. package/one/things/claude/hooks/story-validation-engine.js +0 -473
  137. package/one/things/claude/hooks/structure-synchronizer.js +0 -194
  138. package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
  139. package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
  140. package/one/things/claude/hooks/trinity-validation-system.js +0 -392
  141. package/one/things/plans/organizations-to-groups.md +0 -705
@@ -1,271 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Agent Load Balancer - Simple load detection and routing
5
- *
6
- * Monitors agent utilization and suggests alternatives for high-demand agents
7
- * Reduces wait times by 85% through intelligent routing
8
- */
9
-
10
- const fs = require('fs');
11
- const path = require('path');
12
- const yaml = require('js-yaml');
13
-
14
- class AgentLoadBalancer {
15
- constructor() {
16
- this.configPath = path.join(process.cwd(), 'one/config/agent-routing.yaml');
17
- this.usageLogPath = path.join(process.cwd(), 'one/cache/agent-usage.json');
18
- this.config = this.loadConfig();
19
- this.usageData = this.loadUsageData();
20
- }
21
-
22
- loadConfig() {
23
- try {
24
- if (fs.existsSync(this.configPath)) {
25
- const configFile = fs.readFileSync(this.configPath, 'utf8');
26
- return yaml.load(configFile);
27
- }
28
- } catch (error) {
29
- console.warn('⚠️ Could not load agent routing config, using defaults');
30
- }
31
-
32
- return {
33
- routing_config: { enabled: true, load_threshold: 70 },
34
- agent_alternatives: {},
35
- load_balancing_rules: { auto_suggest_threshold: 70 }
36
- };
37
- }
38
-
39
- loadUsageData() {
40
- try {
41
- if (fs.existsSync(this.usageLogPath)) {
42
- const data = fs.readFileSync(this.usageLogPath, 'utf8');
43
- return JSON.parse(data);
44
- }
45
- } catch (error) {
46
- console.warn('⚠️ Could not load usage data, starting fresh');
47
- }
48
-
49
- return {
50
- agents: {},
51
- last_updated: Date.now(),
52
- current_queues: {}
53
- };
54
- }
55
-
56
- saveUsageData() {
57
- try {
58
- fs.writeFileSync(this.usageLogPath, JSON.stringify(this.usageData, null, 2));
59
- } catch (error) {
60
- console.warn('⚠️ Could not save usage data:', error.message);
61
- }
62
- }
63
-
64
- /**
65
- * Track agent usage when invoked
66
- */
67
- trackAgentUsage(agentName) {
68
- const now = Date.now();
69
-
70
- if (!this.usageData.agents[agentName]) {
71
- this.usageData.agents[agentName] = {
72
- total_invocations: 0,
73
- current_load: 0,
74
- last_invoked: now,
75
- average_session_time: 5 * 60 * 1000, // 5 minutes default
76
- queue_length: 0
77
- };
78
- }
79
-
80
- const agent = this.usageData.agents[agentName];
81
- agent.total_invocations++;
82
- agent.last_invoked = now;
83
- agent.current_load = this.calculateCurrentLoad(agentName);
84
- agent.queue_length = this.getCurrentQueueLength(agentName);
85
-
86
- this.saveUsageData();
87
-
88
- return agent;
89
- }
90
-
91
- /**
92
- * Simple load calculation based on recent usage
93
- */
94
- calculateCurrentLoad(agentName) {
95
- const agent = this.usageData.agents[agentName];
96
- if (!agent) return 0;
97
-
98
- const now = Date.now();
99
- const fiveMinutesAgo = now - (5 * 60 * 1000);
100
-
101
- // Simple heuristic: if last invoked within 5 minutes, consider it loaded
102
- if (agent.last_invoked > fiveMinutesAgo) {
103
- return Math.min(90, 60 + (agent.queue_length * 10));
104
- }
105
-
106
- return Math.max(0, agent.queue_length * 20);
107
- }
108
-
109
- /**
110
- * Get current queue length for an agent
111
- */
112
- getCurrentQueueLength(agentName) {
113
- return this.usageData.current_queues[agentName] || 0;
114
- }
115
-
116
- /**
117
- * Check if agent needs load balancing
118
- */
119
- needsLoadBalancing(agentName) {
120
- const agent = this.trackAgentUsage(agentName);
121
- const threshold = this.config.load_balancing_rules?.auto_suggest_threshold || 70;
122
-
123
- return agent.current_load >= threshold;
124
- }
125
-
126
- /**
127
- * Get alternatives for a busy agent
128
- */
129
- getAlternatives(agentName) {
130
- const alternatives = this.config.agent_alternatives?.[agentName];
131
- if (!alternatives) return [];
132
-
133
- return alternatives.alternatives.map(alt => ({
134
- ...alt,
135
- current_load: this.calculateCurrentLoad(alt.agent),
136
- estimated_wait: this.getEstimatedWait(alt.agent)
137
- })).sort((a, b) => a.current_load - b.current_load);
138
- }
139
-
140
- /**
141
- * Get estimated wait time in minutes
142
- */
143
- getEstimatedWait(agentName) {
144
- const agent = this.usageData.agents[agentName];
145
- if (!agent) return 0;
146
-
147
- const baseWait = agent.queue_length * 3; // 3 minutes per queued request
148
- const loadFactor = agent.current_load / 100;
149
-
150
- return Math.round(baseWait * (1 + loadFactor));
151
- }
152
-
153
- /**
154
- * Suggest optimal agent routing
155
- */
156
- suggestRouting(requestedAgent) {
157
- if (!this.config.routing_config?.enabled) {
158
- return { route_to: requestedAgent, alternatives: [] };
159
- }
160
-
161
- const needsBalancing = this.needsLoadBalancing(requestedAgent);
162
-
163
- if (!needsBalancing) {
164
- return {
165
- route_to: requestedAgent,
166
- load_balanced: false,
167
- current_load: this.calculateCurrentLoad(requestedAgent),
168
- alternatives: []
169
- };
170
- }
171
-
172
- const alternatives = this.getAlternatives(requestedAgent);
173
- const bestAlternative = alternatives.find(alt => alt.current_load < 50);
174
-
175
- return {
176
- route_to: requestedAgent,
177
- load_balanced: true,
178
- current_load: this.calculateCurrentLoad(requestedAgent),
179
- estimated_wait: this.getEstimatedWait(requestedAgent),
180
- alternatives: alternatives,
181
- suggested_alternative: bestAlternative,
182
- message: this.formatLoadBalancingMessage(requestedAgent, alternatives)
183
- };
184
- }
185
-
186
- /**
187
- * Format user-friendly load balancing message
188
- */
189
- formatLoadBalancingMessage(agentName, alternatives) {
190
- const wait = this.getEstimatedWait(agentName);
191
- const messages = this.config.routing_messages || {};
192
-
193
- let message = messages.busy_primary?.replace('{agent}', agentName)?.replace('{wait_time}', wait)
194
- || `🔄 ${agentName} is busy (current wait: ${wait}min). Try these alternatives:`;
195
-
196
- if (alternatives.length > 0) {
197
- message += '\n\n';
198
- alternatives.slice(0, 3).forEach((alt, idx) => {
199
- const altMessage = messages.suggest_alternative
200
- ?.replace('{alternative}', alt.agent)
201
- ?.replace('{capability_match}', alt.capability_match) ||
202
- `⚡ ${alt.agent} available now - ${alt.capability_match}% capability match`;
203
-
204
- message += `${idx + 1}. ${altMessage}\n ${alt.description}\n`;
205
- });
206
- }
207
-
208
- return message;
209
- }
210
-
211
- /**
212
- * Main hook entry point
213
- */
214
- handleAgentRequest(agentName) {
215
- const routing = this.suggestRouting(agentName);
216
-
217
- if (routing.load_balanced) {
218
- console.log('\n📊 Load Balancer Active:');
219
- console.log(routing.message);
220
-
221
- if (routing.suggested_alternative) {
222
- console.log(`\n✨ Recommended: Use ${routing.suggested_alternative.agent} instead`);
223
- }
224
- }
225
-
226
- return routing;
227
- }
228
-
229
- /**
230
- * Get system-wide load statistics
231
- */
232
- getLoadStats() {
233
- const agents = Object.keys(this.usageData.agents);
234
- const highLoadAgents = agents.filter(name => this.calculateCurrentLoad(name) > 70);
235
- const totalLoad = agents.reduce((sum, name) => sum + this.calculateCurrentLoad(name), 0);
236
- const averageLoad = agents.length > 0 ? totalLoad / agents.length : 0;
237
-
238
- return {
239
- total_agents: agents.length,
240
- high_load_agents: highLoadAgents.length,
241
- average_load: Math.round(averageLoad),
242
- busiest_agents: agents
243
- .map(name => ({
244
- name,
245
- load: this.calculateCurrentLoad(name),
246
- queue: this.getCurrentQueueLength(name)
247
- }))
248
- .sort((a, b) => b.load - a.load)
249
- .slice(0, 5)
250
- };
251
- }
252
- }
253
-
254
- // Export for use in other hooks and commands
255
- module.exports = AgentLoadBalancer;
256
-
257
- // CLI usage
258
- if (require.main === module) {
259
- const balancer = new AgentLoadBalancer();
260
- const agentName = process.argv[2];
261
-
262
- if (agentName) {
263
- const result = balancer.handleAgentRequest(agentName);
264
- console.log('\nRouting Result:');
265
- console.log(JSON.stringify(result, null, 2));
266
- } else {
267
- const stats = balancer.getLoadStats();
268
- console.log('\n📊 Agent Load Statistics:');
269
- console.log(JSON.stringify(stats, null, 2));
270
- }
271
- }
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Agent Request Interceptor
5
- *
6
- * Automatically intercepts agent requests and applies load balancing
7
- * Integrates with Claude Code agent selection to show alternatives
8
- */
9
-
10
- const AgentLoadBalancer = require('./agent-load-balancer');
11
-
12
- /**
13
- * Intercept agent requests and apply load balancing
14
- */
15
- function interceptAgentRequest(agentName, context = {}) {
16
- const balancer = new AgentLoadBalancer();
17
-
18
- // Track the request and get routing suggestions
19
- const routing = balancer.handleAgentRequest(agentName);
20
-
21
- // If load balanced and we have alternatives, show them to the user
22
- if (routing.load_balanced && routing.alternatives.length > 0) {
23
- return {
24
- proceed: true,
25
- show_alternatives: true,
26
- message: routing.message,
27
- alternatives: routing.alternatives,
28
- estimated_wait: routing.estimated_wait,
29
- suggested_alternative: routing.suggested_alternative
30
- };
31
- }
32
-
33
- return {
34
- proceed: true,
35
- show_alternatives: false,
36
- current_load: routing.current_load
37
- };
38
- }
39
-
40
- /**
41
- * Get quick load status for dashboard/UI
42
- */
43
- function getQuickLoadStatus() {
44
- const balancer = new AgentLoadBalancer();
45
- return balancer.getLoadStats();
46
- }
47
-
48
- module.exports = {
49
- interceptAgentRequest,
50
- getQuickLoadStatus
51
- };
52
-
53
- // CLI usage
54
- if (require.main === module) {
55
- const command = process.argv[2];
56
- const agentName = process.argv[3];
57
-
58
- if (command === 'intercept' && agentName) {
59
- const result = interceptAgentRequest(agentName);
60
- console.log(JSON.stringify(result, null, 2));
61
- } else if (command === 'status') {
62
- const status = getQuickLoadStatus();
63
- console.log('📊 Quick Load Status:');
64
- console.log(JSON.stringify(status, null, 2));
65
- } else {
66
- console.log('Usage:');
67
- console.log(' node agent-request-interceptor.js intercept <agent-name>');
68
- console.log(' node agent-request-interceptor.js status');
69
- }
70
- }
@@ -1,297 +0,0 @@
1
- // cascade-feedback.js
2
- // Real-time feedback system for Mission→Story→Task→Agent workflows
3
-
4
- /**
5
- * Provides real-time status updates and progress tracking for cascade workflows
6
- * Reduces user uncertainty by 80% through clear progress indicators
7
- */
8
-
9
- class CascadeFeedbackSystem {
10
- constructor() {
11
- this.feedbackTemplates = null;
12
- this.statusCache = new Map();
13
- this.activeWorkflows = new Set();
14
- this.loadTemplates();
15
- }
16
-
17
- async loadTemplates() {
18
- try {
19
- const fs = require('fs');
20
- const yaml = require('yaml');
21
- const path = require('path');
22
-
23
- const templatePath = path.join(__dirname, '../../../one/config/feedback-templates.yaml');
24
- const templateContent = fs.readFileSync(templatePath, 'utf8');
25
- this.feedbackTemplates = yaml.parse(templateContent);
26
- } catch (error) {
27
- console.warn('Could not load feedback templates:', error.message);
28
- this.feedbackTemplates = this.getDefaultTemplates();
29
- }
30
- }
31
-
32
- getDefaultTemplates() {
33
- return {
34
- feedback_templates: {
35
- progress: {
36
- mission: {
37
- active: "🎯 Mission {current} of {total}: {title} | {percentage}% Complete"
38
- },
39
- story: {
40
- active: "📖 Story {current} of {total}: {title} | {tasks_complete} of {tasks_total} tasks"
41
- },
42
- task: {
43
- active: "🔄 Task Active: {title} | {agent} working | ETA {eta}"
44
- },
45
- agent: {
46
- working: "🟡 {agent}: Working | {task} | ETA {eta}"
47
- }
48
- },
49
- loading: {
50
- mission_creation: "🎯 Creating Mission... | Analyzing objectives and success criteria",
51
- story_generation: "📖 Generating Stories... | Breaking down mission into narratives",
52
- task_breakdown: "✅ Breaking Down Tasks... | Identifying implementation steps",
53
- agent_assignment: "🤖 Assigning Agents... | Matching expertise to tasks"
54
- },
55
- quality: {
56
- excellent: "🌟 Excellent Quality: {score}⭐ | Exceeds standards",
57
- good: "✅ Good Quality: {score}⭐ | Meets requirements",
58
- review_needed: "⚠️ Review Needed: {score}⭐ | Minor improvements suggested",
59
- rework_required: "❌ Rework Required: {score}⭐ | Below quality standards"
60
- }
61
- },
62
- status_icons: {
63
- mission: { active: "🔄", complete: "✅", blocked: "❌" },
64
- story: { active: "📖", complete: "✅", failed: "❌" },
65
- task: { active: "🔄", complete: "✅", failed: "❌" },
66
- agent: { working: "🟡", ready: "🟢", busy: "🔴" }
67
- }
68
- };
69
- }
70
-
71
- // Progress Indicators
72
- formatMissionProgress(mission) {
73
- const template = this.feedbackTemplates.feedback_templates.progress.mission.active;
74
- return this.interpolateTemplate(template, {
75
- current: mission.current || 1,
76
- total: mission.total || 1,
77
- title: mission.title || 'Untitled Mission',
78
- percentage: Math.round(mission.progress || 0)
79
- });
80
- }
81
-
82
- formatStoryProgress(story) {
83
- const template = this.feedbackTemplates.feedback_templates.progress.story.active;
84
- return this.interpolateTemplate(template, {
85
- current: story.current || 1,
86
- total: story.total || 1,
87
- title: story.title || 'Untitled Story',
88
- tasks_complete: story.tasksComplete || 0,
89
- tasks_total: story.tasksTotal || 0
90
- });
91
- }
92
-
93
- formatTaskProgress(task) {
94
- const template = this.feedbackTemplates.feedback_templates.progress.task.active;
95
- return this.interpolateTemplate(template, {
96
- title: task.title || 'Untitled Task',
97
- agent: task.agent || 'AI Agent',
98
- eta: task.eta || '5 min'
99
- });
100
- }
101
-
102
- formatAgentStatus(agent) {
103
- const template = this.feedbackTemplates.feedback_templates.progress.agent.working;
104
- return this.interpolateTemplate(template, {
105
- agent: agent.name || 'AI Agent',
106
- task: agent.currentTask || 'Processing',
107
- eta: agent.eta || '5 min'
108
- });
109
- }
110
-
111
- // Quality Score Tracking
112
- formatQualityScore(score) {
113
- let category;
114
- if (score >= 4.5) category = 'excellent';
115
- else if (score >= 4.0) category = 'good';
116
- else if (score >= 3.5) category = 'review_needed';
117
- else category = 'rework_required';
118
-
119
- const template = this.feedeedbackTemplates.feedback_templates.quality[category];
120
- return this.interpolateTemplate(template, { score: score.toFixed(1) });
121
- }
122
-
123
- // Loading States
124
- showLoadingState(type, context = {}) {
125
- const template = this.feedbackTemplates.feedback_templates.loading[type];
126
- if (template) {
127
- console.log(`🔄 ${this.interpolateTemplate(template, context)}`);
128
- }
129
- }
130
-
131
- // Real-time Status Dashboard
132
- generateStatusDashboard(cascadeData) {
133
- const { missions = [], stories = [], tasks = [], agents = [] } = cascadeData;
134
-
135
- let output = "📊 CASCADE STATUS DASHBOARD\n";
136
- output += "==========================\n\n";
137
-
138
- // Active missions summary
139
- if (missions.length > 0) {
140
- output += "🎯 Active Missions:\n";
141
- missions.forEach(mission => {
142
- output += ` ${this.formatMissionProgress(mission)}\n`;
143
- });
144
- output += "\n";
145
- }
146
-
147
- // Story progress
148
- if (stories.length > 0) {
149
- output += "📖 Stories Progress:\n";
150
- stories.forEach(story => {
151
- const icon = this.getStatusIcon('story', story.status);
152
- const quality = story.quality ? ` (${story.quality}⭐)` : '';
153
- output += ` ${icon} ${story.title}${quality} ${story.status}\n`;
154
- });
155
- output += "\n";
156
- }
157
-
158
- // Agent activity
159
- if (agents.length > 0) {
160
- output += "🤖 Agent Status:\n";
161
- agents.forEach(agent => {
162
- const icon = this.getStatusIcon('agent', agent.status);
163
- output += ` ${icon} ${agent.name}: ${agent.status}`;
164
- if (agent.currentTask) {
165
- output += ` | ${agent.currentTask}`;
166
- }
167
- if (agent.eta) {
168
- output += ` (ETA: ${agent.eta})`;
169
- }
170
- output += "\n";
171
- });
172
- output += "\n";
173
- }
174
-
175
- // Overall progress
176
- const overallProgress = this.calculateOverallProgress(cascadeData);
177
- output += `📈 Overall Progress: ${overallProgress}% Complete`;
178
-
179
- if (cascadeData.eta) {
180
- output += ` | ETA: ${cascadeData.eta}`;
181
- }
182
-
183
- return output;
184
- }
185
-
186
- // Utility methods
187
- interpolateTemplate(template, data) {
188
- return template.replace(/\{(\w+)\}/g, (match, key) => {
189
- return data[key] !== undefined ? data[key] : match;
190
- });
191
- }
192
-
193
- getStatusIcon(type, status) {
194
- return this.feedbackTemplates.status_icons[type]?.[status] || '⚪';
195
- }
196
-
197
- calculateOverallProgress(cascadeData) {
198
- const { missions = [], stories = [], tasks = [] } = cascadeData;
199
-
200
- let totalItems = missions.length + stories.length + tasks.length;
201
- let completedItems = 0;
202
-
203
- completedItems += missions.filter(m => m.status === 'complete').length;
204
- completedItems += stories.filter(s => s.status === 'complete').length;
205
- completedItems += tasks.filter(t => t.status === 'complete').length;
206
-
207
- return totalItems > 0 ? Math.round((completedItems / totalItems) * 100) : 0;
208
- }
209
-
210
- // Progress tracking methods
211
- trackMissionProgress(missionId, progressData) {
212
- this.statusCache.set(`mission-${missionId}`, {
213
- ...progressData,
214
- lastUpdated: Date.now()
215
- });
216
- this.emitProgressUpdate('mission', missionId, progressData);
217
- }
218
-
219
- trackStoryProgress(storyId, progressData) {
220
- this.statusCache.set(`story-${storyId}`, {
221
- ...progressData,
222
- lastUpdated: Date.now()
223
- });
224
- this.emitProgressUpdate('story', storyId, progressData);
225
- }
226
-
227
- trackTaskProgress(taskId, progressData) {
228
- this.statusCache.set(`task-${taskId}`, {
229
- ...progressData,
230
- lastUpdated: Date.now()
231
- });
232
- this.emitProgressUpdate('task', taskId, progressData);
233
- }
234
-
235
- trackAgentStatus(agentId, statusData) {
236
- this.statusCache.set(`agent-${agentId}`, {
237
- ...statusData,
238
- lastUpdated: Date.now()
239
- });
240
- this.emitProgressUpdate('agent', agentId, statusData);
241
- }
242
-
243
- emitProgressUpdate(type, id, data) {
244
- // Emit real-time updates to connected clients
245
- // This would integrate with Claude Code's hook system
246
- console.log(`📊 ${type.toUpperCase()} UPDATE: ${id}`, data);
247
- }
248
-
249
- // Quality gate integration
250
- checkQualityGate(item, score) {
251
- const threshold = 4.0;
252
- const passed = score >= threshold;
253
-
254
- const message = passed
255
- ? `✅ Quality Gate Passed: ${item} | ${score}⭐`
256
- : `❌ Quality Gate Failed: ${item} | ${score}⭐ | Rework needed`;
257
-
258
- console.log(message);
259
- return passed;
260
- }
261
-
262
- // Bottleneck detection
263
- detectBottlenecks(cascadeData) {
264
- const bottlenecks = [];
265
- const { tasks = [], agents = [] } = cascadeData;
266
-
267
- // Check for overloaded agents
268
- agents.forEach(agent => {
269
- if (agent.queuedTasks && agent.queuedTasks > 3) {
270
- bottlenecks.push({
271
- type: 'agent_overload',
272
- agent: agent.name,
273
- queuedTasks: agent.queuedTasks,
274
- message: `🔴 Agent Overloaded: ${agent.name} | ${agent.queuedTasks} tasks queued`
275
- });
276
- }
277
- });
278
-
279
- // Check for stuck tasks
280
- tasks.forEach(task => {
281
- const stuckTime = Date.now() - (task.startedAt || 0);
282
- if (task.status === 'active' && stuckTime > 30 * 60 * 1000) { // 30 minutes
283
- bottlenecks.push({
284
- type: 'stuck_task',
285
- task: task.title,
286
- duration: Math.round(stuckTime / (60 * 1000)),
287
- message: `⏰ Task Stuck: ${task.title} | ${Math.round(stuckTime / (60 * 1000))} minutes`
288
- });
289
- }
290
- });
291
-
292
- return bottlenecks;
293
- }
294
- }
295
-
296
- // Export singleton instance
297
- module.exports = new CascadeFeedbackSystem();