orbital-command 0.1.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 +396 -0
- package/bin/orbital.js +362 -0
- package/dist/assets/WorkflowVisualizer-BZ21PIIF.js +84 -0
- package/dist/assets/WorkflowVisualizer-BZV40eAE.css +1 -0
- package/dist/assets/charts-D__PA1zp.js +72 -0
- package/dist/assets/index-D1G6i0nS.css +1 -0
- package/dist/assets/index-DpItvKpf.js +419 -0
- package/dist/assets/ui-BvF022GT.js +53 -0
- package/dist/assets/vendor-Dzv9lrRc.js +59 -0
- package/dist/index.html +19 -0
- package/dist/scanner-sweep.png +0 -0
- package/dist/server/server/adapters/index.js +34 -0
- package/dist/server/server/adapters/iterm2-adapter.js +29 -0
- package/dist/server/server/adapters/subprocess-adapter.js +21 -0
- package/dist/server/server/adapters/terminal-adapter.js +1 -0
- package/dist/server/server/config.js +156 -0
- package/dist/server/server/database.js +90 -0
- package/dist/server/server/index.js +372 -0
- package/dist/server/server/init.js +811 -0
- package/dist/server/server/parsers/event-parser.js +64 -0
- package/dist/server/server/parsers/scope-parser.js +188 -0
- package/dist/server/server/routes/config-routes.js +163 -0
- package/dist/server/server/routes/data-routes.js +461 -0
- package/dist/server/server/routes/dispatch-routes.js +215 -0
- package/dist/server/server/routes/git-routes.js +92 -0
- package/dist/server/server/routes/scope-routes.js +215 -0
- package/dist/server/server/routes/sprint-routes.js +116 -0
- package/dist/server/server/routes/version-routes.js +130 -0
- package/dist/server/server/routes/workflow-routes.js +185 -0
- package/dist/server/server/schema.js +90 -0
- package/dist/server/server/services/batch-orchestrator.js +253 -0
- package/dist/server/server/services/claude-session-service.js +352 -0
- package/dist/server/server/services/config-service.js +132 -0
- package/dist/server/server/services/deploy-service.js +51 -0
- package/dist/server/server/services/event-service.js +63 -0
- package/dist/server/server/services/gate-service.js +83 -0
- package/dist/server/server/services/git-service.js +309 -0
- package/dist/server/server/services/github-service.js +145 -0
- package/dist/server/server/services/readiness-service.js +184 -0
- package/dist/server/server/services/scope-cache.js +72 -0
- package/dist/server/server/services/scope-service.js +424 -0
- package/dist/server/server/services/sprint-orchestrator.js +312 -0
- package/dist/server/server/services/sprint-service.js +293 -0
- package/dist/server/server/services/workflow-service.js +397 -0
- package/dist/server/server/utils/cc-hooks-parser.js +49 -0
- package/dist/server/server/utils/dispatch-utils.js +305 -0
- package/dist/server/server/utils/logger.js +86 -0
- package/dist/server/server/utils/terminal-launcher.js +388 -0
- package/dist/server/server/utils/worktree-manager.js +98 -0
- package/dist/server/server/watchers/event-watcher.js +81 -0
- package/dist/server/server/watchers/scope-watcher.js +33 -0
- package/dist/server/shared/api-types.js +5 -0
- package/dist/server/shared/default-workflow.json +616 -0
- package/dist/server/shared/workflow-config.js +44 -0
- package/dist/server/shared/workflow-engine.js +353 -0
- package/index.html +15 -0
- package/package.json +110 -0
- package/postcss.config.js +6 -0
- package/schemas/orbital.config.schema.json +83 -0
- package/scripts/postinstall.js +24 -0
- package/scripts/start.sh +20 -0
- package/server/adapters/index.ts +41 -0
- package/server/adapters/iterm2-adapter.ts +37 -0
- package/server/adapters/subprocess-adapter.ts +25 -0
- package/server/adapters/terminal-adapter.ts +24 -0
- package/server/config.ts +234 -0
- package/server/database.ts +107 -0
- package/server/index.ts +452 -0
- package/server/init.ts +891 -0
- package/server/parsers/event-parser.ts +74 -0
- package/server/parsers/scope-parser.ts +240 -0
- package/server/routes/config-routes.ts +182 -0
- package/server/routes/data-routes.ts +548 -0
- package/server/routes/dispatch-routes.ts +275 -0
- package/server/routes/git-routes.ts +112 -0
- package/server/routes/scope-routes.ts +262 -0
- package/server/routes/sprint-routes.ts +142 -0
- package/server/routes/version-routes.ts +156 -0
- package/server/routes/workflow-routes.ts +198 -0
- package/server/schema.ts +90 -0
- package/server/services/batch-orchestrator.ts +286 -0
- package/server/services/claude-session-service.ts +441 -0
- package/server/services/config-service.ts +151 -0
- package/server/services/deploy-service.ts +98 -0
- package/server/services/event-service.ts +98 -0
- package/server/services/gate-service.ts +126 -0
- package/server/services/git-service.ts +391 -0
- package/server/services/github-service.ts +183 -0
- package/server/services/readiness-service.ts +250 -0
- package/server/services/scope-cache.ts +81 -0
- package/server/services/scope-service.ts +476 -0
- package/server/services/sprint-orchestrator.ts +361 -0
- package/server/services/sprint-service.ts +415 -0
- package/server/services/workflow-service.ts +461 -0
- package/server/utils/cc-hooks-parser.ts +70 -0
- package/server/utils/dispatch-utils.ts +395 -0
- package/server/utils/logger.ts +109 -0
- package/server/utils/terminal-launcher.ts +462 -0
- package/server/utils/worktree-manager.ts +104 -0
- package/server/watchers/event-watcher.ts +100 -0
- package/server/watchers/scope-watcher.ts +38 -0
- package/shared/api-types.ts +20 -0
- package/shared/default-workflow.json +616 -0
- package/shared/workflow-config.ts +170 -0
- package/shared/workflow-engine.ts +427 -0
- package/src/App.tsx +33 -0
- package/src/components/AgentBadge.tsx +40 -0
- package/src/components/BatchPreflightModal.tsx +115 -0
- package/src/components/CardDisplayToggle.tsx +74 -0
- package/src/components/ColumnHeaderActions.tsx +55 -0
- package/src/components/ColumnMenu.tsx +99 -0
- package/src/components/DeployHistory.tsx +141 -0
- package/src/components/DispatchModal.tsx +164 -0
- package/src/components/DispatchPopover.tsx +139 -0
- package/src/components/DragOverlay.tsx +25 -0
- package/src/components/DriftSidebar.tsx +140 -0
- package/src/components/EnvironmentStrip.tsx +88 -0
- package/src/components/ErrorBoundary.tsx +62 -0
- package/src/components/FilterChip.tsx +105 -0
- package/src/components/GateIndicator.tsx +33 -0
- package/src/components/IdeaDetailModal.tsx +190 -0
- package/src/components/IdeaFormDialog.tsx +113 -0
- package/src/components/KanbanColumn.tsx +201 -0
- package/src/components/MarkdownRenderer.tsx +114 -0
- package/src/components/NeonGrid.tsx +128 -0
- package/src/components/PromotionQueue.tsx +89 -0
- package/src/components/ScopeCard.tsx +234 -0
- package/src/components/ScopeDetailModal.tsx +255 -0
- package/src/components/ScopeFilterBar.tsx +152 -0
- package/src/components/SearchInput.tsx +102 -0
- package/src/components/SessionPanel.tsx +335 -0
- package/src/components/SprintContainer.tsx +303 -0
- package/src/components/SprintDependencyDialog.tsx +78 -0
- package/src/components/SprintPreflightModal.tsx +138 -0
- package/src/components/StatusBar.tsx +168 -0
- package/src/components/SwimCell.tsx +67 -0
- package/src/components/SwimLaneRow.tsx +94 -0
- package/src/components/SwimlaneBoardView.tsx +108 -0
- package/src/components/VersionBadge.tsx +139 -0
- package/src/components/ViewModeSelector.tsx +114 -0
- package/src/components/config/AgentChip.tsx +53 -0
- package/src/components/config/AgentCreateDialog.tsx +321 -0
- package/src/components/config/AgentEditor.tsx +175 -0
- package/src/components/config/DirectoryTree.tsx +582 -0
- package/src/components/config/FileEditor.tsx +550 -0
- package/src/components/config/HookChip.tsx +50 -0
- package/src/components/config/StageCard.tsx +198 -0
- package/src/components/config/TransitionZone.tsx +173 -0
- package/src/components/config/UnifiedWorkflowPipeline.tsx +216 -0
- package/src/components/config/WorkflowPipeline.tsx +161 -0
- package/src/components/source-control/BranchList.tsx +93 -0
- package/src/components/source-control/BranchPanel.tsx +105 -0
- package/src/components/source-control/CommitLog.tsx +100 -0
- package/src/components/source-control/CommitRow.tsx +47 -0
- package/src/components/source-control/GitHubPanel.tsx +110 -0
- package/src/components/source-control/GitHubSetupGuide.tsx +52 -0
- package/src/components/source-control/GitOverviewBar.tsx +101 -0
- package/src/components/source-control/PullRequestList.tsx +69 -0
- package/src/components/source-control/WorktreeList.tsx +80 -0
- package/src/components/ui/badge.tsx +41 -0
- package/src/components/ui/button.tsx +55 -0
- package/src/components/ui/card.tsx +78 -0
- package/src/components/ui/dialog.tsx +94 -0
- package/src/components/ui/popover.tsx +33 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/tabs.tsx +52 -0
- package/src/components/ui/toggle-switch.tsx +35 -0
- package/src/components/ui/tooltip.tsx +27 -0
- package/src/components/workflow/AddEdgeDialog.tsx +217 -0
- package/src/components/workflow/AddListDialog.tsx +201 -0
- package/src/components/workflow/ChecklistEditor.tsx +239 -0
- package/src/components/workflow/CommandPrefixManager.tsx +118 -0
- package/src/components/workflow/ConfigSettingsPanel.tsx +189 -0
- package/src/components/workflow/DirectionSelector.tsx +133 -0
- package/src/components/workflow/DispatchConfigPanel.tsx +180 -0
- package/src/components/workflow/EdgeDetailPanel.tsx +236 -0
- package/src/components/workflow/EdgePropertyEditor.tsx +251 -0
- package/src/components/workflow/EditToolbar.tsx +138 -0
- package/src/components/workflow/HookDetailPanel.tsx +250 -0
- package/src/components/workflow/HookExecutionLog.tsx +24 -0
- package/src/components/workflow/HookSourceModal.tsx +129 -0
- package/src/components/workflow/HooksDashboard.tsx +363 -0
- package/src/components/workflow/ListPropertyEditor.tsx +251 -0
- package/src/components/workflow/MigrationPreviewDialog.tsx +237 -0
- package/src/components/workflow/MovementRulesPanel.tsx +188 -0
- package/src/components/workflow/NodeDetailPanel.tsx +245 -0
- package/src/components/workflow/PresetSelector.tsx +414 -0
- package/src/components/workflow/SkillCommandBuilder.tsx +174 -0
- package/src/components/workflow/WorkflowEdgeComponent.tsx +145 -0
- package/src/components/workflow/WorkflowNode.tsx +147 -0
- package/src/components/workflow/graphLayout.ts +186 -0
- package/src/components/workflow/mergeHooks.ts +85 -0
- package/src/components/workflow/useEditHistory.ts +88 -0
- package/src/components/workflow/useWorkflowEditor.ts +262 -0
- package/src/components/workflow/validateConfig.ts +70 -0
- package/src/hooks/useActiveDispatches.ts +198 -0
- package/src/hooks/useBoardSettings.ts +170 -0
- package/src/hooks/useCardDisplay.ts +57 -0
- package/src/hooks/useCcHooks.ts +24 -0
- package/src/hooks/useConfigTree.ts +51 -0
- package/src/hooks/useEnforcementRules.ts +46 -0
- package/src/hooks/useEvents.ts +59 -0
- package/src/hooks/useFileEditor.ts +165 -0
- package/src/hooks/useGates.ts +57 -0
- package/src/hooks/useIdeaActions.ts +53 -0
- package/src/hooks/useKanbanDnd.ts +410 -0
- package/src/hooks/useOrbitalConfig.ts +54 -0
- package/src/hooks/usePipeline.ts +47 -0
- package/src/hooks/usePipelineData.ts +338 -0
- package/src/hooks/useReconnect.ts +25 -0
- package/src/hooks/useScopeFilters.ts +125 -0
- package/src/hooks/useScopeSessions.ts +44 -0
- package/src/hooks/useScopes.ts +67 -0
- package/src/hooks/useSearch.ts +67 -0
- package/src/hooks/useSettings.tsx +187 -0
- package/src/hooks/useSocket.ts +25 -0
- package/src/hooks/useSourceControl.ts +105 -0
- package/src/hooks/useSprintPreflight.ts +55 -0
- package/src/hooks/useSprints.ts +154 -0
- package/src/hooks/useStatusBarHighlight.ts +18 -0
- package/src/hooks/useSwimlaneBoardSettings.ts +104 -0
- package/src/hooks/useTheme.ts +9 -0
- package/src/hooks/useTransitionReadiness.ts +53 -0
- package/src/hooks/useVersion.ts +155 -0
- package/src/hooks/useViolations.ts +65 -0
- package/src/hooks/useWorkflow.tsx +125 -0
- package/src/hooks/useZoomModifier.ts +19 -0
- package/src/index.css +797 -0
- package/src/layouts/DashboardLayout.tsx +113 -0
- package/src/lib/collisionDetection.ts +20 -0
- package/src/lib/scope-fields.ts +61 -0
- package/src/lib/swimlane.ts +146 -0
- package/src/lib/utils.ts +15 -0
- package/src/main.tsx +19 -0
- package/src/socket.ts +11 -0
- package/src/types/index.ts +497 -0
- package/src/views/AgentFeed.tsx +339 -0
- package/src/views/DeployPipeline.tsx +59 -0
- package/src/views/EnforcementView.tsx +378 -0
- package/src/views/PrimitivesConfig.tsx +500 -0
- package/src/views/QualityGates.tsx +1012 -0
- package/src/views/ScopeBoard.tsx +454 -0
- package/src/views/SessionTimeline.tsx +516 -0
- package/src/views/Settings.tsx +183 -0
- package/src/views/SourceControl.tsx +95 -0
- package/src/views/WorkflowVisualizer.tsx +382 -0
- package/tailwind.config.js +161 -0
- package/templates/agents/AUTO-INVOKE.md +180 -0
- package/templates/agents/CONFLICT-RESOLUTION.md +128 -0
- package/templates/agents/QUICK-REFERENCE.md +122 -0
- package/templates/agents/README.md +188 -0
- package/templates/agents/SKILL-TRIGGERS.md +100 -0
- package/templates/agents/blue-team/frontend-designer.md +424 -0
- package/templates/agents/green-team/architect.md +526 -0
- package/templates/agents/green-team/rules-enforcer.md +131 -0
- package/templates/agents/red-team/attacker-learned.md +24 -0
- package/templates/agents/red-team/attacker.md +486 -0
- package/templates/agents/red-team/chaos.md +548 -0
- package/templates/agents/reference/component-registry.md +82 -0
- package/templates/agents/workflows/full-mode.md +218 -0
- package/templates/agents/workflows/quick-mode.md +118 -0
- package/templates/agents/workflows/security-mode.md +283 -0
- package/templates/anti-patterns/dangerous-shortcuts.md +427 -0
- package/templates/config/agent-triggers.json +92 -0
- package/templates/hooks/agent-team-gate.sh +31 -0
- package/templates/hooks/agent-trigger.sh +97 -0
- package/templates/hooks/block-push.sh +66 -0
- package/templates/hooks/block-workarounds.sh +61 -0
- package/templates/hooks/blocker-check.sh +28 -0
- package/templates/hooks/completion-checklist.sh +28 -0
- package/templates/hooks/decision-capture.sh +15 -0
- package/templates/hooks/dependency-check.sh +27 -0
- package/templates/hooks/end-session.sh +31 -0
- package/templates/hooks/exploration-logger.sh +37 -0
- package/templates/hooks/files-changed-summary.sh +37 -0
- package/templates/hooks/get-session-id.sh +49 -0
- package/templates/hooks/git-commit-guard.sh +34 -0
- package/templates/hooks/init-session.sh +93 -0
- package/templates/hooks/orbital-emit.sh +79 -0
- package/templates/hooks/orbital-report-deploy.sh +78 -0
- package/templates/hooks/orbital-report-gates.sh +40 -0
- package/templates/hooks/orbital-report-violation.sh +36 -0
- package/templates/hooks/orbital-scope-update.sh +53 -0
- package/templates/hooks/phase-verify-reminder.sh +26 -0
- package/templates/hooks/review-gate-check.sh +82 -0
- package/templates/hooks/scope-commit-logger.sh +37 -0
- package/templates/hooks/scope-create-cleanup.sh +36 -0
- package/templates/hooks/scope-create-gate.sh +80 -0
- package/templates/hooks/scope-create-tracker.sh +17 -0
- package/templates/hooks/scope-file-sync.sh +53 -0
- package/templates/hooks/scope-gate.sh +35 -0
- package/templates/hooks/scope-helpers.sh +188 -0
- package/templates/hooks/scope-lifecycle-gate.sh +139 -0
- package/templates/hooks/scope-prepare.sh +244 -0
- package/templates/hooks/scope-transition.sh +172 -0
- package/templates/hooks/session-enforcer.sh +143 -0
- package/templates/hooks/time-tracker.sh +33 -0
- package/templates/lessons-learned.md +15 -0
- package/templates/orbital.config.json +35 -0
- package/templates/presets/development.json +42 -0
- package/templates/presets/gitflow.json +712 -0
- package/templates/presets/minimal.json +23 -0
- package/templates/quick/rules.md +218 -0
- package/templates/scopes/_template.md +255 -0
- package/templates/settings-hooks.json +98 -0
- package/templates/skills/git-commit/SKILL.md +85 -0
- package/templates/skills/git-dev/SKILL.md +99 -0
- package/templates/skills/git-hotfix/SKILL.md +223 -0
- package/templates/skills/git-main/SKILL.md +84 -0
- package/templates/skills/git-production/SKILL.md +165 -0
- package/templates/skills/git-staging/SKILL.md +112 -0
- package/templates/skills/scope-create/SKILL.md +81 -0
- package/templates/skills/scope-fix-review/SKILL.md +168 -0
- package/templates/skills/scope-implement/SKILL.md +110 -0
- package/templates/skills/scope-post-review/SKILL.md +144 -0
- package/templates/skills/scope-pre-review/SKILL.md +211 -0
- package/templates/skills/scope-verify/SKILL.md +201 -0
- package/templates/skills/session-init/SKILL.md +62 -0
- package/templates/skills/session-resume/SKILL.md +201 -0
- package/templates/skills/test-checks/SKILL.md +171 -0
- package/templates/skills/test-code-review/SKILL.md +252 -0
- package/tsconfig.json +25 -0
- package/vite.config.ts +38 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
# Anti-Patterns: Dangerous Shortcuts
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
tokens: ~2.5K
|
|
5
|
+
load-when: Reviewing code, before committing
|
|
6
|
+
last-verified: YYYY-MM-DD
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
These shortcuts seem faster but cause real problems. Each includes the **actual cost** when they go wrong.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Anti-Pattern 1: Using `any` Type
|
|
14
|
+
|
|
15
|
+
### The Shortcut
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
const data: any = response;
|
|
19
|
+
const result: any = await processData(data);
|
|
20
|
+
function handler(input: any): any { }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Why It's Tempting
|
|
24
|
+
- Faster to write
|
|
25
|
+
- No TypeScript errors
|
|
26
|
+
- "I'll fix it later"
|
|
27
|
+
|
|
28
|
+
### Real Consequences
|
|
29
|
+
- **Runtime crashes**: `undefined is not a function` in production
|
|
30
|
+
- **Wrong data shape**: Passing incorrect objects without compile-time check
|
|
31
|
+
- **AI confusion**: Agent can't understand code structure, makes more mistakes
|
|
32
|
+
|
|
33
|
+
### The Right Way
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
interface ProcessedData {
|
|
37
|
+
id: string;
|
|
38
|
+
value: number;
|
|
39
|
+
status: 'pending' | 'complete';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const data: ApiResponse = response;
|
|
43
|
+
const result: ProcessedData = await processData(data);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Anti-Pattern 2: Business Logic in Controllers
|
|
49
|
+
|
|
50
|
+
### The Shortcut
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// In controller
|
|
54
|
+
export const getItems = async (req, res) => {
|
|
55
|
+
const items = await db.query('SELECT * FROM items');
|
|
56
|
+
const active = items.filter(i => i.status === 'active');
|
|
57
|
+
const formatted = active.map(i => ({
|
|
58
|
+
...i,
|
|
59
|
+
display: formatItem(i),
|
|
60
|
+
}));
|
|
61
|
+
res.json({ data: formatted });
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Why It's Tempting
|
|
66
|
+
- Quick to implement
|
|
67
|
+
- Everything in one place
|
|
68
|
+
|
|
69
|
+
### Real Consequences
|
|
70
|
+
- **Untestable**: Can't unit test business logic without HTTP
|
|
71
|
+
- **Code duplication**: Same logic copied to other endpoints
|
|
72
|
+
- **Architecture violation**: Breaks layer separation
|
|
73
|
+
|
|
74
|
+
### The Right Way
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// In service
|
|
78
|
+
export async function getActiveItems(): Promise<ItemDto[]> {
|
|
79
|
+
const items = await db.query('...');
|
|
80
|
+
return items
|
|
81
|
+
.filter(i => i.status === 'active')
|
|
82
|
+
.map(formatItem);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// In controller (HTTP only)
|
|
86
|
+
export const getItems = async (req, res) => {
|
|
87
|
+
const items = await itemService.getActiveItems();
|
|
88
|
+
res.json({ data: items });
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Anti-Pattern 3: Using console.log
|
|
95
|
+
|
|
96
|
+
### The Shortcut
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
console.log('Debug:', data);
|
|
100
|
+
console.error('Error:', error);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Why It's Tempting
|
|
104
|
+
- Everyone knows it
|
|
105
|
+
- Works immediately
|
|
106
|
+
|
|
107
|
+
### Real Consequences
|
|
108
|
+
- **No context**: No timestamps, no service name
|
|
109
|
+
- **Production leaks**: Sensitive data in console
|
|
110
|
+
- **Unstructured**: Can't search, filter, or aggregate
|
|
111
|
+
|
|
112
|
+
### The Right Way
|
|
113
|
+
|
|
114
|
+
Use a structured logger with levels, context, and proper formatting.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Anti-Pattern 4: Hardcoded Values
|
|
119
|
+
|
|
120
|
+
### The Shortcut
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
const timeout = 5000;
|
|
124
|
+
const apiUrl = 'https://api.example.com';
|
|
125
|
+
const maxRetries = 3;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Why It's Tempting
|
|
129
|
+
- Quick to implement
|
|
130
|
+
- Works for now
|
|
131
|
+
|
|
132
|
+
### Real Consequences
|
|
133
|
+
- **Environment issues**: Different values needed for dev/staging/prod
|
|
134
|
+
- **Tuning difficulty**: Can't adjust without code changes
|
|
135
|
+
- **Magic numbers**: Future devs don't understand why `5000`
|
|
136
|
+
|
|
137
|
+
### The Right Way
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// In config/constants.ts
|
|
141
|
+
export const CONSTANTS = {
|
|
142
|
+
TIMEOUT_MS: 5000,
|
|
143
|
+
MAX_RETRIES: 10,
|
|
144
|
+
} as const;
|
|
145
|
+
|
|
146
|
+
// In config/environment.ts (env vars)
|
|
147
|
+
API_URL: z.string().url()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Anti-Pattern 5: Placeholder/Stub Implementations
|
|
153
|
+
|
|
154
|
+
### The Shortcut
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
const result = 'PLACEHOLDER_NEEDS_IMPLEMENTATION';
|
|
158
|
+
const apiKey = 'TODO_REPLACE_WITH_REAL_KEY';
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Why It's Tempting
|
|
162
|
+
- Unblocks development
|
|
163
|
+
- "I'll come back to this later"
|
|
164
|
+
|
|
165
|
+
### Real Consequences
|
|
166
|
+
- **Production failures**: Code "works" but doesn't actually do anything
|
|
167
|
+
- **Silent breakage**: Downstream code tries to use placeholder data
|
|
168
|
+
- **Lost context**: Original developer may not be the one who finds it
|
|
169
|
+
|
|
170
|
+
### The Right Way
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// Option 1: Throw immediately if not implemented
|
|
174
|
+
throw new Error('Feature not implemented - see scope 015');
|
|
175
|
+
|
|
176
|
+
// Option 2: Return typed error response
|
|
177
|
+
return { success: false, error: 'FEATURE_NOT_CONFIGURED' };
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Rule**: Never commit a placeholder string that could reach production code paths.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Anti-Pattern 6: Mock Data in Production Code
|
|
185
|
+
|
|
186
|
+
### The Shortcut
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
const mockUser = { id: 'test-user-123', name: 'Mock User' };
|
|
190
|
+
const fakeSignature = `${Date.now()}-mock`;
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Why It's Tempting
|
|
194
|
+
- Makes UI development possible without backend
|
|
195
|
+
- Tests pass immediately
|
|
196
|
+
|
|
197
|
+
### Real Consequences
|
|
198
|
+
- **User confusion**: UI shows fake data as if real
|
|
199
|
+
- **Data corruption**: Fake IDs stored in database
|
|
200
|
+
- **Debugging nightmare**: Is this real data or mock?
|
|
201
|
+
|
|
202
|
+
### The Right Way
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
// Mock data lives in __tests__/ or __fixtures__/ directories ONLY
|
|
206
|
+
// In __tests__/fixtures/mockData.ts
|
|
207
|
+
export const mockUser = { id: 'test-user', name: 'Test' };
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Anti-Pattern 7: "For Now" Shortcuts
|
|
213
|
+
|
|
214
|
+
### The Shortcut
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
const result = { price: 0 }; // For now
|
|
218
|
+
const success = true; // For now, assume it works
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Why It's Tempting
|
|
222
|
+
- Unblocks development
|
|
223
|
+
- "I'll fix it in the next PR"
|
|
224
|
+
|
|
225
|
+
### Real Consequences
|
|
226
|
+
- **Technical debt accumulates**: "For now" becomes "forever"
|
|
227
|
+
- **Hidden bugs**: Assumptions baked into code never get verified
|
|
228
|
+
|
|
229
|
+
### The Right Way
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
// TODO(TICKET-123): Implement proper pricing
|
|
233
|
+
// This fallback is temporary until pricing service is integrated
|
|
234
|
+
if (!price) {
|
|
235
|
+
logger.warn('Price unavailable, using fallback', { itemId });
|
|
236
|
+
return DEFAULT_PRICE;
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Rule**: Every "for now" comment must have a linked ticket/scope and a plan for resolution.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Anti-Pattern 8: Default Secret Fallbacks
|
|
245
|
+
|
|
246
|
+
### The Shortcut
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
const JWT_SECRET = process.env.JWT_SECRET || 'your-secret-key-change-in-production';
|
|
250
|
+
const API_KEY = process.env.API_KEY || 'default-key-123';
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Why It's Tempting
|
|
254
|
+
- "Makes local development easier"
|
|
255
|
+
- Code works without .env file
|
|
256
|
+
|
|
257
|
+
### Real Consequences
|
|
258
|
+
- **Security catastrophe**: If env var isn't set in production, DEFAULT IS USED
|
|
259
|
+
- **Predictable secrets**: Attacker reads source code, knows the fallback
|
|
260
|
+
|
|
261
|
+
### The Right Way
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// Fail fast on missing secrets
|
|
265
|
+
const JWT_SECRET = process.env.JWT_SECRET;
|
|
266
|
+
if (!JWT_SECRET) {
|
|
267
|
+
throw new Error('JWT_SECRET environment variable is required.');
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Rule**: Production code must NEVER have hardcoded secret fallbacks. Fail loudly if missing.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Anti-Pattern 9: Bypassing Git Workflow
|
|
276
|
+
|
|
277
|
+
### The Shortcut
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
git add -A
|
|
281
|
+
git commit -m "changes"
|
|
282
|
+
git push origin main # Without running quality gates!
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Why It's Tempting
|
|
286
|
+
- Faster than running checks
|
|
287
|
+
- "It's just documentation/config"
|
|
288
|
+
|
|
289
|
+
### Real Consequences
|
|
290
|
+
- **No quality gates**: Bugs ship without type-check, lint, build, test
|
|
291
|
+
- **No rollback point**: Must revert manually
|
|
292
|
+
- **Bypasses all safeguards**: Orbital Command hooks and gates not invoked
|
|
293
|
+
|
|
294
|
+
### The Right Way
|
|
295
|
+
|
|
296
|
+
Use the configured git skills which run quality gates automatically:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# Use the skill — it handles branching mode (trunk vs worktree) for you
|
|
300
|
+
/git-commit # Commit with quality gates
|
|
301
|
+
/git-main # Push to main (adapts to your branching mode)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Anti-Pattern 10: Silent Failure via Return False/Empty
|
|
307
|
+
|
|
308
|
+
### The Shortcut
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
export async function pauseItem(id: string): Promise<boolean> {
|
|
312
|
+
try {
|
|
313
|
+
await updateStatus(id, 'PAUSED');
|
|
314
|
+
return true;
|
|
315
|
+
} catch (error) {
|
|
316
|
+
return false; // Silent failure - caller has no error details
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Why It's Tempting
|
|
322
|
+
- Makes caller code simpler
|
|
323
|
+
- "Graceful degradation"
|
|
324
|
+
|
|
325
|
+
### Real Consequences
|
|
326
|
+
- **Hidden critical failures**: DB down looks like "no data" to caller
|
|
327
|
+
- **No error details**: Caller knows something failed but not what
|
|
328
|
+
- **Silent data loss**: Empty arrays hide the fact that data exists but couldn't be read
|
|
329
|
+
|
|
330
|
+
### The Right Way
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
// Option 1: Let errors propagate (preferred)
|
|
334
|
+
export async function pauseItem(id: string): Promise<void> {
|
|
335
|
+
await updateStatus(id, 'PAUSED');
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Option 2: Discriminated union for typed errors
|
|
339
|
+
type Result<T> =
|
|
340
|
+
| { success: true; data: T }
|
|
341
|
+
| { success: false; error: string; code: string };
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Rule**: Never return `false`, `null`, or `[]` to indicate failure. Either throw or use a discriminated union.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Anti-Pattern 11: Empty Catch Blocks
|
|
349
|
+
|
|
350
|
+
### The Shortcut
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
try {
|
|
354
|
+
await saveMetrics();
|
|
355
|
+
} catch {
|
|
356
|
+
// Ignore
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Why It's Tempting
|
|
361
|
+
- "It's just logging, not critical"
|
|
362
|
+
- "The main operation succeeded"
|
|
363
|
+
|
|
364
|
+
### Real Consequences
|
|
365
|
+
- **Zero debugging trail**: No record of the error
|
|
366
|
+
- **Hidden failures**: "Expected" errors might mask unexpected ones
|
|
367
|
+
- **Frequency blindness**: No way to know if errors happen 1% or 99% of the time
|
|
368
|
+
|
|
369
|
+
### The Right Way
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
try {
|
|
373
|
+
await saveMetrics();
|
|
374
|
+
} catch (error) {
|
|
375
|
+
logger.warn('Metrics save failed (non-critical)', {
|
|
376
|
+
error: error instanceof Error ? error.message : String(error),
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Rule**: An empty catch block is always wrong. At minimum, log a warning.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Quick Reference: Shortcut → Fix
|
|
386
|
+
|
|
387
|
+
| Shortcut | Fix |
|
|
388
|
+
|----------|-----|
|
|
389
|
+
| `catch (e) { return null; }` | Let errors propagate or use Result type |
|
|
390
|
+
| `catch (e) { return false; }` | `Promise<void>` + throw |
|
|
391
|
+
| `catch (e) { return []; }` | Let query errors propagate |
|
|
392
|
+
| `: any` | Define proper interface |
|
|
393
|
+
| Logic in controller | Move to service |
|
|
394
|
+
| `console.log` | Use structured logger |
|
|
395
|
+
| Magic numbers | Constants or config |
|
|
396
|
+
| `'PLACEHOLDER_...'` strings | Throw error or feature flag |
|
|
397
|
+
| Mock data in production | Move to `__tests__/fixtures/` |
|
|
398
|
+
| `// for now` comments | Link to ticket + implement |
|
|
399
|
+
| `\|\| 'default-secret'` | Fail fast if missing |
|
|
400
|
+
| `git push origin main` (without gates) | Use `/git-commit` + `/git-main` |
|
|
401
|
+
| `catch { }` or `catch { // ignore }` | Log at warning level minimum |
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Verification Commands
|
|
406
|
+
|
|
407
|
+
Check for these anti-patterns:
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
# Any types
|
|
411
|
+
grep -r ": any" src --include="*.ts" --include="*.tsx" | grep -v justified | grep -v __tests__
|
|
412
|
+
|
|
413
|
+
# Console statements
|
|
414
|
+
grep -rE "console\.(log|error|warn)" src --include="*.ts" --include="*.tsx" | grep -v __tests__
|
|
415
|
+
|
|
416
|
+
# Placeholder strings
|
|
417
|
+
grep -rEi "PLACEHOLDER|STUB|DUMMY|FAKE_|MOCK_" src --include="*.ts" --include="*.tsx" | grep -v __tests__
|
|
418
|
+
|
|
419
|
+
# "For now" shortcuts
|
|
420
|
+
grep -rEi "for now|todo:|fixme:|hack:" src --include="*.ts" --include="*.tsx" | grep -v __tests__
|
|
421
|
+
|
|
422
|
+
# Default secret fallbacks
|
|
423
|
+
grep -rE "\|\| ['\"][^'\"]{5,}['\"]" src --include="*.ts" | grep -iE "secret|key|token|password"
|
|
424
|
+
|
|
425
|
+
# Empty catch blocks
|
|
426
|
+
grep -rE "catch\s*(\([^)]*\))?\s*\{\s*\}" src --include="*.ts" | grep -v __tests__
|
|
427
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"patterns": [
|
|
4
|
+
{
|
|
5
|
+
"pattern": "encrypt.*\\.ts$",
|
|
6
|
+
"agents": ["attacker"],
|
|
7
|
+
"mode": "SECURITY",
|
|
8
|
+
"keyPoints": [
|
|
9
|
+
"Secrets ONLY decrypted at moment of use?",
|
|
10
|
+
"No logging of decrypted material?",
|
|
11
|
+
"Memory cleared after use?"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"pattern": "auth.*\\.ts$",
|
|
16
|
+
"agents": ["attacker"],
|
|
17
|
+
"mode": "SECURITY",
|
|
18
|
+
"keyPoints": [
|
|
19
|
+
"Auth middleware applied?",
|
|
20
|
+
"User ownership verified (not just authenticated)?",
|
|
21
|
+
"All parameters validated with bounds?"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pattern": "controllers/.*\\.ts$",
|
|
26
|
+
"agents": ["attacker", "architect"],
|
|
27
|
+
"mode": "SECURITY",
|
|
28
|
+
"keyPoints": [
|
|
29
|
+
"Auth middleware applied?",
|
|
30
|
+
"User ownership verified for all resources?",
|
|
31
|
+
"All parameters validated (type, length, range)?"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"pattern": "frontend/src/.*\\.(tsx?|jsx?)$",
|
|
36
|
+
"agents": ["frontend-designer"],
|
|
37
|
+
"mode": "FULL",
|
|
38
|
+
"keyPoints": [
|
|
39
|
+
"Follows existing component patterns?",
|
|
40
|
+
"Proper loading/error states?",
|
|
41
|
+
"Consistent with design system?"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"pattern": "migrations/.*\\.(ts|sql)$",
|
|
46
|
+
"agents": ["architect"],
|
|
47
|
+
"mode": "FULL",
|
|
48
|
+
"keyPoints": [
|
|
49
|
+
"Backward compatible or versioned?",
|
|
50
|
+
"Rollback script provided?",
|
|
51
|
+
"Existing data migration path?"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"pattern": ".*\\.test\\.ts$",
|
|
56
|
+
"agents": ["rules-enforcer"],
|
|
57
|
+
"mode": "FULL",
|
|
58
|
+
"keyPoints": [
|
|
59
|
+
"Tests follow project conventions?",
|
|
60
|
+
"Adequate coverage for the change?",
|
|
61
|
+
"Edge cases covered?"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"pattern": "config/.*\\.ts$",
|
|
66
|
+
"agents": ["chaos"],
|
|
67
|
+
"mode": "FULL",
|
|
68
|
+
"keyPoints": [
|
|
69
|
+
"What happens if this config value is wrong?",
|
|
70
|
+
"Are there sensible defaults?",
|
|
71
|
+
"Migration needed for existing deployments?"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"pattern": "middleware/.*\\.ts$",
|
|
76
|
+
"agents": ["attacker", "architect"],
|
|
77
|
+
"mode": "SECURITY",
|
|
78
|
+
"keyPoints": [
|
|
79
|
+
"Security middleware correctly applied?",
|
|
80
|
+
"Error handling doesn't leak internals?",
|
|
81
|
+
"Middleware ordering correct?"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"agentEmojis": {
|
|
86
|
+
"attacker": "\ud83d\udde1\ufe0f",
|
|
87
|
+
"chaos": "\ud83d\udca5",
|
|
88
|
+
"frontend-designer": "\ud83c\udfa8",
|
|
89
|
+
"architect": "\ud83c\udfd7\ufe0f",
|
|
90
|
+
"rules-enforcer": "\ud83d\udccb"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# agent-team-gate.sh — Block skills requiring agent teams if not enabled
|
|
3
|
+
# Trigger: PreToolUse:Skill
|
|
4
|
+
# Checks CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS before allowing team-based skills
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
INPUT=$(cat)
|
|
8
|
+
echo "$INPUT" | jq empty 2>/dev/null || exit 0
|
|
9
|
+
|
|
10
|
+
SKILL=$(echo "$INPUT" | jq -r '.tool_input.skill // empty')
|
|
11
|
+
[ -z "$SKILL" ] && exit 0
|
|
12
|
+
|
|
13
|
+
# Only gate skills that require agent teams
|
|
14
|
+
case "$SKILL" in
|
|
15
|
+
scope-fix-review) ;;
|
|
16
|
+
*) exit 0 ;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# Check if agent teams are enabled
|
|
20
|
+
if [ "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-}" != "1" ]; then
|
|
21
|
+
echo "BLOCKED: /$SKILL requires Claude Code Agent Teams to be enabled."
|
|
22
|
+
echo ""
|
|
23
|
+
echo "Enable it now by adding to ~/.claude/settings.json:"
|
|
24
|
+
echo ' { "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }'
|
|
25
|
+
echo ""
|
|
26
|
+
echo "Read ~/.claude/settings.json, merge the env key above into it,"
|
|
27
|
+
echo "write it back, then re-run: /$SKILL"
|
|
28
|
+
exit 2
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
exit 0
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Agent Trigger Hook - Auto-invokes agent review points when editing sensitive files
|
|
3
|
+
#
|
|
4
|
+
# This PreToolUse hook detects when Edit/Write operations target files matching
|
|
5
|
+
# patterns in agent-triggers.json, then outputs relevant review points to guide
|
|
6
|
+
# the AI assistant during security-sensitive modifications.
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
INPUT=$(cat)
|
|
10
|
+
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
|
|
11
|
+
|
|
12
|
+
# Only process Edit and Write tools
|
|
13
|
+
if [ "$TOOL_NAME" != "Edit" ] && [ "$TOOL_NAME" != "Write" ]; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Require jq for JSON parsing and output
|
|
18
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
19
|
+
|
|
20
|
+
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
|
|
21
|
+
[ -z "$FILE_PATH" ] && exit 0
|
|
22
|
+
|
|
23
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
|
|
24
|
+
RELATIVE_PATH="${FILE_PATH#$PROJECT_DIR/}"
|
|
25
|
+
CONFIG_PATH="$PROJECT_DIR/.claude/config/agent-triggers.json"
|
|
26
|
+
[ ! -f "$CONFIG_PATH" ] && exit 0
|
|
27
|
+
|
|
28
|
+
# Find matching patterns
|
|
29
|
+
MATCHED_AGENTS=""
|
|
30
|
+
MATCHED_POINTS=""
|
|
31
|
+
MODE="FULL"
|
|
32
|
+
|
|
33
|
+
while IFS= read -r pattern_data; do
|
|
34
|
+
PATTERN=$(echo "$pattern_data" | jq -r '.pattern')
|
|
35
|
+
|
|
36
|
+
if echo "$RELATIVE_PATH" | grep -qE "$PATTERN"; then
|
|
37
|
+
# Collect agents (deduped)
|
|
38
|
+
for agent in $(echo "$pattern_data" | jq -r '.agents[]' 2>/dev/null); do
|
|
39
|
+
echo "$MATCHED_AGENTS" | grep -q "$agent" || MATCHED_AGENTS="$MATCHED_AGENTS $agent"
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
# SECURITY mode takes precedence
|
|
43
|
+
[ "$(echo "$pattern_data" | jq -r '.mode')" = "SECURITY" ] && MODE="SECURITY"
|
|
44
|
+
|
|
45
|
+
# Collect key points
|
|
46
|
+
MATCHED_POINTS="$MATCHED_POINTS$(echo "$pattern_data" | jq -r '.keyPoints[]' 2>/dev/null | sed 's/^/\n/')"
|
|
47
|
+
fi
|
|
48
|
+
done < <(jq -c '.patterns[]' "$CONFIG_PATH")
|
|
49
|
+
|
|
50
|
+
# No matches = silent pass
|
|
51
|
+
[ -z "$MATCHED_AGENTS" ] && exit 0
|
|
52
|
+
|
|
53
|
+
# Build emoji string
|
|
54
|
+
EMOJIS=""
|
|
55
|
+
for agent in $MATCHED_AGENTS; do
|
|
56
|
+
EMOJI=$(jq -r ".agentEmojis[\"$agent\"] // \"?\"" "$CONFIG_PATH")
|
|
57
|
+
EMOJIS="$EMOJIS$EMOJI "
|
|
58
|
+
done
|
|
59
|
+
|
|
60
|
+
# Truncate file path for display if too long
|
|
61
|
+
DISPLAY_PATH="$RELATIVE_PATH"
|
|
62
|
+
if [ ${#DISPLAY_PATH} -gt 55 ]; then
|
|
63
|
+
DISPLAY_PATH="...${DISPLAY_PATH: -52}"
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Output system message
|
|
67
|
+
echo ""
|
|
68
|
+
if [ "$MODE" = "SECURITY" ]; then
|
|
69
|
+
echo "╔══════════════════════════════════════════════════════════════════╗"
|
|
70
|
+
echo "║ 🔐 SECURITY MODE ACTIVATED ║"
|
|
71
|
+
else
|
|
72
|
+
echo "╔══════════════════════════════════════════════════════════════════╗"
|
|
73
|
+
echo "║ 🎯 AGENT REVIEW TRIGGERED ║"
|
|
74
|
+
fi
|
|
75
|
+
echo "╠══════════════════════════════════════════════════════════════════╣"
|
|
76
|
+
printf "║ File: %-58s ║\n" "$DISPLAY_PATH"
|
|
77
|
+
printf "║ Agents: %-56s ║\n" "$EMOJIS"
|
|
78
|
+
echo "╠══════════════════════════════════════════════════════════════════╣"
|
|
79
|
+
echo "║ 📋 KEY REVIEW POINTS: ║"
|
|
80
|
+
echo "$MATCHED_POINTS" | sort -u | while read -r point; do
|
|
81
|
+
if [ -n "$point" ]; then
|
|
82
|
+
# Truncate point if too long
|
|
83
|
+
if [ ${#point} -gt 60 ]; then
|
|
84
|
+
point="${point:0:57}..."
|
|
85
|
+
fi
|
|
86
|
+
printf "║ □ %-62s║\n" "$point"
|
|
87
|
+
fi
|
|
88
|
+
done
|
|
89
|
+
echo "╚══════════════════════════════════════════════════════════════════╝"
|
|
90
|
+
echo ""
|
|
91
|
+
|
|
92
|
+
# Emit agent trigger event to Orbital dashboard (non-blocking)
|
|
93
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
94
|
+
AGENTS_JSON=$(echo "$MATCHED_AGENTS" | xargs | tr ' ' '\n' | jq -R . | jq -s .)
|
|
95
|
+
"$SCRIPT_DIR/orbital-emit.sh" AGENT_STARTED "{\"agents\":$AGENTS_JSON,\"file\":\"$RELATIVE_PATH\",\"mode\":\"$MODE\"}" 2>/dev/null &
|
|
96
|
+
|
|
97
|
+
exit 0
|