loki-mode 6.75.3 → 6.76.1

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 (76) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/autonomy/loki +659 -0
  4. package/autonomy/run.sh +115 -4
  5. package/dashboard/__init__.py +1 -1
  6. package/docs/INSTALLATION.md +1 -1
  7. package/mcp/__init__.py +1 -1
  8. package/mcp/magic_tools.py +471 -0
  9. package/mcp/server.py +13 -0
  10. package/package.json +1 -1
  11. package/references/magic-modules-patterns.md +634 -0
  12. package/references/magic-rarv-integration.md +87 -0
  13. package/skills/00-index.md +2 -0
  14. package/skills/magic-modules.md +205 -0
  15. package/web-app/dist/assets/{AdminPage-D4QSV6Zi.js → AdminPage-DwVUK4v9.js} +1 -1
  16. package/web-app/dist/assets/{Avatar-88MlpLO5.js → Avatar-B7gqhcg3.js} +1 -1
  17. package/web-app/dist/assets/{Badge-DbGjLr4i.js → Badge-DA3xNJAS.js} +1 -1
  18. package/web-app/dist/assets/{Button-sp_FVGZj.js → Button-BPXURLaK.js} +1 -1
  19. package/web-app/dist/assets/{ComparePage-p2ENnfa7.js → ComparePage-B0JQMhKG.js} +1 -1
  20. package/web-app/dist/assets/GitHubIssuesPanel-D38-fy29.js +12 -0
  21. package/web-app/dist/assets/{GitHubPRsPanel-Bi_yrcAE.js → GitHubPRsPanel-DLPcW3N0.js} +2 -2
  22. package/web-app/dist/assets/{HomePage-BB83YPiX.js → HomePage-CzeoS2V_.js} +3 -3
  23. package/web-app/dist/assets/{LoginPage-BXUudCJ9.js → LoginPage-DqCzxsfx.js} +1 -1
  24. package/web-app/dist/assets/MagicPage-CBLqpa55.js +31 -0
  25. package/web-app/dist/assets/{MetricsPage-CX0Ahy-_.js → MetricsPage-CPYQR0zr.js} +1 -1
  26. package/web-app/dist/assets/{NotFoundPage-C4JqatEk.js → NotFoundPage-B62u4iCs.js} +1 -1
  27. package/web-app/dist/assets/{ProjectPage-t5J2XAJT.js → ProjectPage-DNujSl6j.js} +67 -72
  28. package/web-app/dist/assets/{ProjectsPage-Bzpz1clk.js → ProjectsPage-uHG7kxB-.js} +1 -1
  29. package/web-app/dist/assets/{SettingsPage-y_yl8FvH.js → SettingsPage-BaQJbOgL.js} +1 -1
  30. package/web-app/dist/assets/{ShowcasePage-B7d6pzMq.js → ShowcasePage-DQR_e-kg.js} +1 -1
  31. package/web-app/dist/assets/{SystemSettingsPage-C4tR33KU.js → SystemSettingsPage-C_Q_1WK4.js} +1 -1
  32. package/web-app/dist/assets/{TeamsPage-DIOCfZIP.js → TeamsPage-DOFErDqX.js} +1 -1
  33. package/web-app/dist/assets/{TemplatesPage-DlKyapXX.js → TemplatesPage-Ty72hILN.js} +1 -1
  34. package/web-app/dist/assets/{TerminalOutput-Czg-ZC2k.js → TerminalOutput-DqOVnR1p.js} +7 -12
  35. package/web-app/dist/assets/{activity-h1wU9a0L.js → activity-BgBZ4s4c.js} +1 -1
  36. package/web-app/dist/assets/{bell-Bu8lsWOp.js → bell-C-UezVWi.js} +1 -1
  37. package/web-app/dist/assets/{bot-rWO7KjkQ.js → bot-D70fEnm5.js} +1 -1
  38. package/web-app/dist/assets/{check-BWp8L5Cy.js → check-CBohulxQ.js} +1 -1
  39. package/web-app/dist/assets/{chevron-left-Bw4I1yGm.js → chevron-left-C-emzUhB.js} +1 -1
  40. package/web-app/dist/assets/{circle-alert-C37PKXiC.js → circle-alert-8SRY0_GX.js} +1 -1
  41. package/web-app/dist/assets/{clock-DDScLol4.js → clock-mfq4XnPQ.js} +1 -1
  42. package/web-app/dist/assets/{cloud-DaYKPLaM.js → cloud-DpRM7T8t.js} +1 -1
  43. package/web-app/dist/assets/code-xml-1N2Ui-4c.js +6 -0
  44. package/web-app/dist/assets/{copy-DKIRv0VK.js → copy-LXquTgzI.js} +1 -1
  45. package/web-app/dist/assets/{database-CYZBHz51.js → database-S1dyXnuT.js} +1 -1
  46. package/web-app/dist/assets/{dollar-sign-CydJu0kl.js → dollar-sign-CRqk0dW5.js} +1 -1
  47. package/web-app/dist/assets/{file-code-corner-DqZ9gpdv.js → file-code-corner-B99CwY_6.js} +1 -1
  48. package/web-app/dist/assets/{file-plus-CzeFJWp3.js → file-plus-DZ5qnz5b.js} +1 -1
  49. package/web-app/dist/assets/{folder-open-4YWk08dP.js → folder-open-DBCm7yuF.js} +1 -1
  50. package/web-app/dist/assets/{git-commit-horizontal-wbqFPNID.js → git-commit-horizontal-DM1ERuNd.js} +1 -1
  51. package/web-app/dist/assets/{globe-Cby-g5Yb.js → globe-B7xEJSL_.js} +1 -1
  52. package/web-app/dist/assets/{hammer-BNScgGdp.js → hammer-Cgi3LTuS.js} +1 -1
  53. package/web-app/dist/assets/{index-6Z4B0I6r.js → index-BN52-GQT.js} +22 -17
  54. package/web-app/dist/assets/index-BfZSDej1.css +1 -0
  55. package/web-app/dist/assets/{layers-XfssQc5V.js → layers-Bi8RPIBC.js} +1 -1
  56. package/web-app/dist/assets/{lightbulb-EhnzRw7M.js → lightbulb-Doc_n8JX.js} +1 -1
  57. package/web-app/dist/assets/{loader-circle-BA0QIVGA.js → loader-circle-BB932A7A.js} +1 -1
  58. package/web-app/dist/assets/{lock-BABtHe6K.js → lock-Bt6gpMrs.js} +1 -1
  59. package/web-app/dist/assets/{mail-Dokiey5S.js → mail-BuzAu1IP.js} +1 -1
  60. package/web-app/dist/assets/{package-DbJyS1Ft.js → package-BE5FHxQ8.js} +1 -1
  61. package/web-app/dist/assets/{plus-BcAN8Kaj.js → plus-CNqABexN.js} +1 -1
  62. package/web-app/dist/assets/{refresh-cw-B3dG1-Sb.js → refresh-cw-34B13ztx.js} +1 -1
  63. package/web-app/dist/assets/{rotate-ccw-Cs1Phctm.js → rotate-ccw-CrD2QB29.js} +1 -1
  64. package/web-app/dist/assets/{save-DsrNCZrP.js → save-DsJcqdnI.js} +1 -1
  65. package/web-app/dist/assets/{server-CpN2GX4G.js → server-BcgRMArA.js} +1 -1
  66. package/web-app/dist/assets/{shield-alert-CKJ1pzCz.js → shield-alert-DLYLdVJ0.js} +1 -1
  67. package/web-app/dist/assets/{trash-2-C9vZqTqw.js → trash-2-Cc-VTvzt.js} +1 -1
  68. package/web-app/dist/assets/{trending-down-BNLTrF5P.js → trending-down-CrDpO2a_.js} +1 -1
  69. package/web-app/dist/assets/{trending-up-DmFIdVOc.js → trending-up-CNVsmM3G.js} +1 -1
  70. package/web-app/dist/assets/upload-LuDuB7Wc.js +6 -0
  71. package/web-app/dist/assets/{usePolling-vUlY-o6P.js → usePolling-C8rvc-CG.js} +1 -1
  72. package/web-app/dist/assets/{user-Dh00W8De.js → user-BT79cI-o.js} +1 -1
  73. package/web-app/dist/index.html +2 -2
  74. package/web-app/server.py +120 -0
  75. package/web-app/dist/assets/GitHubIssuesPanel-DBbBTG9w.js +0 -17
  76. package/web-app/dist/assets/index-CVM4A1Fw.css +0 -1
@@ -0,0 +1,87 @@
1
+ # Magic Modules in the RARV-C cycle
2
+
3
+ Magic Modules is embedded in the autonomous orchestrator. Users do not
4
+ run `loki magic` commands directly unless they want manual override.
5
+ Agents invoke component generation, debate, and memory capture as part of
6
+ normal RARV-C phase execution.
7
+
8
+ This reference describes which phase does what.
9
+
10
+ ## BOOTSTRAP (before iteration 1)
11
+ - `analyze_git_intelligence()` runs (from v6.75.0).
12
+ - Magic-specific bootstrap:
13
+ - `magic.core.design_tokens.DesignTokens.extract_from_codebase(save=True)`
14
+ scans existing React and Web Components to learn the project's design
15
+ language. Result is stored at `.loki/magic/tokens.json`.
16
+ - Token extraction runs once per project; subsequent iterations read from
17
+ the saved file. Force re-extract with `rm .loki/magic/tokens.json`.
18
+ - PRD scanner (`magic.core.prd_scanner.scan_and_seed`) reads the PRD and
19
+ seeds stub specs at `.loki/magic/specs/<Name>.md` for every UI component
20
+ the PRD mentions with high or medium confidence. Agents refine these
21
+ stubs during REASON and ACT phases.
22
+
23
+ ## REASON (start of each iteration)
24
+ - Agents read existing specs from `.loki/magic/specs/` as part of the
25
+ context injected by `build_prompt()`.
26
+ - `magic.core.memory_bridge.recall_similar_components()` surfaces prior
27
+ successful patterns for components with matching tags. Agents reuse these
28
+ patterns rather than designing from scratch.
29
+
30
+ ## ACT (the agent does work)
31
+ - Agents do NOT need to invoke `loki magic generate` manually. The build
32
+ prompt tells them: write or update the markdown spec at
33
+ `.loki/magic/specs/<Name>.md` and the orchestrator regenerates
34
+ implementations during VERIFY.
35
+ - If an agent needs to create a component not yet in the PRD, it writes
36
+ the spec and the next VERIFY pass picks it up.
37
+
38
+ ## VERIFY (end of each iteration)
39
+ - `run_magic_debate_gate()` runs as Gate 12 (after Gate 11 documentation).
40
+ - Sequence:
41
+ 1. `loki magic update` regenerates any components whose specs are newer
42
+ than their implementations (SHA256 freshness check).
43
+ 2. `loki magic debate <latest>` runs 2 rounds of the 4-persona debate
44
+ (Creative, Conservative, A11y, Performance).
45
+ 3. If any persona returns `severity: block`, Gate 12 fails and the
46
+ iteration does not close. Agent receives the block reasons in the
47
+ next REASON phase and refines the spec.
48
+ - Controllable via `LOKI_GATE_MAGIC_DEBATE=false` for prototyping.
49
+
50
+ ## COMPOUND (after iteration or run completes)
51
+ - `_magic_compound_capture()` calls
52
+ `magic.core.memory_bridge.capture_iteration_compound()`.
53
+ - Memory writes:
54
+ - Episodic: each generated component with its debate result and timing
55
+ - Semantic: tag clusters that consistently pass debate (3+ components,
56
+ >=80% pass rate) become "stable patterns" future iterations reuse
57
+ - Procedural: refinements to design tokens that survived multiple
58
+ iterations become promoted defaults
59
+
60
+ ## Human in the loop escalation
61
+ Only one path requires human attention: when Gate 12 returns a block and
62
+ the agent's spec refinement does not resolve it after 2 additional
63
+ iterations. Orchestrator writes `.loki/signals/MAGIC_HITL_NEEDED` with
64
+ the component name and block reasons; dashboard surfaces this in the
65
+ Magic Page review queue.
66
+
67
+ ## End-to-end example
68
+ PRD says: "Add a login form with email, password, and submit button."
69
+
70
+ 1. BOOTSTRAP: design tokens extracted (primary=#553DE9, etc.).
71
+ PRD scanner seeds `LoginForm.md`, `SubmitButton.md`.
72
+ 2. Iteration 1 REASON: agent reads both stubs, sees they are placeholders.
73
+ 3. Iteration 1 ACT: agent writes full props, behavior, a11y into the specs.
74
+ 4. Iteration 1 VERIFY: Gate 12 runs update (generates React + WC variants)
75
+ and debate. A11y persona blocks `SubmitButton` ("missing aria-disabled
76
+ when submitting"). Gate 12 fails.
77
+ 5. Iteration 2 REASON: agent reads block reason from `.loki/signals/` and
78
+ updates the spec's Accessibility section.
79
+ 6. Iteration 2 VERIFY: debate passes. Gate 12 passes. Iteration closes.
80
+ 7. COMPOUND: episode stored ("LoginForm generated, debate passed rounds=2,
81
+ 12.4s"). Tag cluster `[form, auth]` now tracked with 2/2 pass rate.
82
+
83
+ ## Related
84
+ - `skills/magic-modules.md` -- skill module for agents
85
+ - `references/magic-modules-patterns.md` -- full API and pattern reference
86
+ - `references/memory-system.md` -- memory engine details
87
+ - `skills/quality-gates.md` -- all 12 gates documented
@@ -10,6 +10,7 @@
10
10
  > - `references/memory-system.md` - Episodic/semantic/procedural memory
11
11
  > - `references/tool-orchestration.md` - NVIDIA ToolOrchestra efficiency metrics
12
12
  > - `references/quality-control.md` - Code review and guardrails
13
+ > - `references/magic-rarv-integration.md` - Autonomous magic generation in RARV-C cycle
13
14
 
14
15
  ## Module Selection Rules
15
16
 
@@ -30,6 +31,7 @@
30
31
  | OpenSpec delta context, brownfield modifications | `openspec-integration.md` |
31
32
  | MiroFish market validation, `--mirofish` flag | `mirofish-integration.md` |
32
33
  | Writing/updating documentation, `loki docs` | `documentation.md` |
34
+ | UI components, design tokens, .loki/magic/, Gate 12 | `magic-modules.md` |
33
35
  | Legacy healing, modernization, archaeology | `healing.md` |
34
36
  | Plan deepening, knowledge extraction | `compound-learning.md` |
35
37
 
@@ -0,0 +1,205 @@
1
+ # Magic Modules Skill
2
+
3
+ ## Research Foundation
4
+
5
+ | Source | Key Contribution | Citation |
6
+ |--------|-----------------|----------|
7
+ | Roman Nurik (Google Labs) | Spec-first component generation, spec as source of truth, freshness hash | [MagicModules](https://github.com/romannurik/MagicModules) |
8
+ | Reto Meier (Google Labs) | Multi-persona debate, conflicting expert critique, consensus-with-escalation | [MoMoA](https://github.com/retomeier/momoa) |
9
+ | Loki Mode (this adaptation) | Integration with RARV cycle, design tokens, dual-target generation | Internal |
10
+
11
+ This module is an adaptation of the two Google Labs experiments listed above. It is not a port or a fork -- the spec format, debate protocol, and registry schema are re-implemented to fit Loki Mode's architecture.
12
+
13
+ ---
14
+
15
+ ## When to Load This Module
16
+
17
+ - User mentions `loki magic` or component generation
18
+ - Task involves building new UI components from specs or descriptions
19
+ - PRD describes UI components that don't exist yet
20
+ - User provides a screenshot or wireframe and wants code
21
+ - A build phase needs to scaffold a component library
22
+ - Regenerating components whose specs have drifted from their implementation
23
+
24
+ ---
25
+
26
+ ## Core Concept
27
+
28
+ Magic Modules implements a spec-driven component generation workflow with multi-persona debate for quality. It combines two patterns:
29
+
30
+ ### 1. Spec-First Generation (MagicModules -- Roman Nurik)
31
+
32
+ - User writes or describes a desired component
33
+ - System generates a markdown spec describing props, behavior, a11y, visual style
34
+ - Spec becomes the source of truth
35
+ - Implementation regenerates when the spec changes (SHA freshness check)
36
+ - Generated files carry a `LOKI-MAGIC-HASH` marker so the system knows which implementation belongs to which spec revision
37
+
38
+ ### 2. Multi-Persona Debate (MoMoA -- Reto Meier)
39
+
40
+ - Generated code is reviewed by conflicting expert personas
41
+ - Creative Developer, Conservative Engineer, A11y Advocate, Performance Engineer
42
+ - Three rounds of debate produce refined code or escalate to human (HITL)
43
+ - Consensus resolves to merged diff; deadlock escalates
44
+
45
+ The combination means: specs drive generation, debate drives quality, and the registry keeps them coherent.
46
+
47
+ ---
48
+
49
+ ## Commands
50
+
51
+ | Command | Purpose |
52
+ |---------|---------|
53
+ | `loki magic generate <name>` | Create a new component from a description or a screenshot |
54
+ | `loki magic update` | Regenerate components whose specs changed since the last build |
55
+ | `loki magic list` | Browse the component registry (filterable by tag, target, freshness) |
56
+ | `loki magic debate <name>` | Run a multi-persona debate on an existing component |
57
+ | `loki magic registry stats` | Registry overview (count by target, stale count, recent edits) |
58
+ | `loki magic tokens extract` | Observe the codebase and extract design tokens into `.loki/magic/tokens.json` |
59
+ | `loki magic snapshot <name>` | Capture a visual regression snapshot for a component |
60
+ | `loki magic diff <name>` | Show the diff between the current implementation and what would be regenerated |
61
+
62
+ ---
63
+
64
+ ## Workflow Integration
65
+
66
+ ### With RARV Cycle
67
+
68
+ - **Reason** phase reads the spec to understand intent before generation
69
+ - **Act** phase calls `loki magic generate` or `loki magic update` to produce code
70
+ - **Reflect** phase examines debate transcripts for unresolved persona concerns
71
+ - **Verify** phase runs `loki magic debate` on newly-generated components and fails the gate if any persona returns `severity=block`
72
+
73
+ ### With Documentation System (`loki docs`)
74
+
75
+ - Component specs auto-populate the COMPONENTS.md section of project docs
76
+ - Registry metadata flows into the ARCHITECTURE.md component diagram
77
+ - Freshness hashes appear in CHANGELOG entries when components are regenerated
78
+
79
+ ### With Git Intelligence
80
+
81
+ - Hotspot components (frequently regenerated) get prioritized debate rounds and additional personas
82
+ - Co-change analysis: when a spec changes, debate considers downstream consumers identified by import graph
83
+ - Stale-spec detection runs on every `loki docs update`
84
+
85
+ ### With Quality Gates
86
+
87
+ - Gate 11 (documentation coverage) now includes component docs -- each spec becomes part of COMPONENTS.md
88
+ - Gate 5 (test coverage) applies to generated tests in `.loki/magic/generated/tests/`
89
+ - A new healing-style hook blocks merging when a component's spec has been manually edited but the implementation was not regenerated
90
+
91
+ ---
92
+
93
+ ## File Layout
94
+
95
+ ```
96
+ .loki/magic/
97
+ specs/ # User-editable markdown specs (source of truth)
98
+ generated/
99
+ react/ # Generated *.tsx (TypeScript + Tailwind)
100
+ webcomponent/ # Generated *.js (LokiElement base class, Shadow DOM)
101
+ tests/ # Generated *.test.* (Vitest for React, Playwright for WC)
102
+ registry.json # Component registry (versions, tags, hashes, targets)
103
+ snapshots/ # Visual regression snapshots (PNG per component variant)
104
+ tokens.json # Project design token overrides
105
+ debates/ # Persisted debate transcripts per component revision
106
+ ```
107
+
108
+ All files under `.loki/magic/generated/` carry a `LOKI-MAGIC-HASH: <sha>` header comment matching the hash stored in `registry.json` for the corresponding spec.
109
+
110
+ ---
111
+
112
+ ## Design Tokens
113
+
114
+ All generated components use design tokens (colors, spacing, typography, motion) so they match Loki Mode's design language. Defaults come from observing existing components in `web-app/src/` and `dashboard-ui/`. Override with:
115
+
116
+ - `loki magic tokens extract` -- scan the codebase, update `.loki/magic/tokens.json`
117
+ - Manual edit of `.loki/magic/tokens.json` -- takes precedence over extraction
118
+
119
+ Tokens resolve in the following order:
120
+ 1. Explicit tokens in the component spec
121
+ 2. Project overrides in `.loki/magic/tokens.json`
122
+ 3. Extracted defaults from existing codebase
123
+ 4. Built-in Loki defaults
124
+
125
+ ---
126
+
127
+ ## Generation Targets
128
+
129
+ | Target | Stack | Test Framework | Used By |
130
+ |--------|-------|---------------|---------|
131
+ | `react` | TypeScript + React 18 + Tailwind | Vitest + Testing Library | Dashboard UI, web app |
132
+ | `webcomponent` | LokiElement base class + Shadow DOM | Playwright | Purple Lab, embeddable widgets |
133
+ | `both` | Parallel generation of both variants | Both | Components shared across surfaces |
134
+
135
+ `both` is the recommended default for any component used in more than one Loki surface. The debate runs once on the shared spec and the resulting changes are applied to both outputs.
136
+
137
+ ---
138
+
139
+ ## Debate Personas
140
+
141
+ | Persona | Focus | Block-severity triggers |
142
+ |---------|-------|------------------------|
143
+ | **Creative Developer** | UX polish, delight, modern patterns, animation | Jarring transitions, misaligned visual rhythm |
144
+ | **Conservative Engineer** | Stability, conventions, edge cases, backwards compat | Untyped props, missing error boundaries, hidden state |
145
+ | **A11y Advocate** | WCAG 2.1 AA, assistive tech, keyboard, focus order | Missing aria labels, color contrast <4.5, focus traps |
146
+ | **Performance Engineer** | Bundle size, render cost, reflows, network | Unbounded lists, sync layout thrash, unnecessary re-renders |
147
+
148
+ If any persona returns `severity=block`, generation is paused and a HITL request is opened via the dashboard notification system. See `references/magic-modules-patterns.md` for the full debate protocol.
149
+
150
+ ---
151
+
152
+ ## Anti-Patterns
153
+
154
+ - Do NOT edit generated files directly -- edit the spec instead. Direct edits are overwritten on the next `loki magic update`.
155
+ - Do NOT skip debate for "simple" components. Debate catches subtle a11y and performance bugs that look fine to a single reviewer.
156
+ - Do NOT hardcode colors, spacing, or font sizes. Always reference design tokens.
157
+ - Do NOT remove the `LOKI-MAGIC-HASH` header. The freshness protocol depends on it.
158
+ - Do NOT commit generated files without their corresponding spec. The registry will report them as orphans.
159
+ - Do NOT run debates with only one persona. Consensus-of-one is not consensus.
160
+
161
+ ---
162
+
163
+ ## Quick Reference
164
+
165
+ ```bash
166
+ # Generate a Button component for both targets
167
+ loki magic generate Button --target both --description "Primary action button with loading state"
168
+
169
+ # Generate from a screenshot (Claude Vision path)
170
+ loki magic generate PricingCard --target react --from-image ./mockups/pricing.png
171
+
172
+ # Regenerate everything whose spec has changed
173
+ loki magic update
174
+
175
+ # Run a debate on an existing component (3 rounds by default)
176
+ loki magic debate Button
177
+
178
+ # Show registry health
179
+ loki magic registry stats
180
+
181
+ # Preview the diff between current implementation and regenerated output
182
+ loki magic diff Button
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Integration with Other Skills
188
+
189
+ | Skill | Interaction |
190
+ |-------|-------------|
191
+ | `skills/healing.md` | Healing-style hooks protect spec edits; friction-map tracks manually edited generated files |
192
+ | `skills/documentation.md` | Component specs feed COMPONENTS.md; registry feeds ARCHITECTURE.md |
193
+ | `skills/quality-gates.md` | Gate 11 includes component doc coverage; debate block = gate failure |
194
+ | `skills/agents.md` | `component-designer`, `a11y-auditor` agent types map to personas |
195
+ | `skills/testing.md` | Generated Vitest and Playwright tests execute under the normal test gates |
196
+ | `skills/artifacts.md` | Generated components count as artifacts and flow through the artifact pipeline |
197
+
198
+ ---
199
+
200
+ ## See Also
201
+
202
+ - `references/magic-modules-patterns.md` -- detailed patterns, spec format, debate protocol, MCP tool reference, and worked examples
203
+ - `references/memory-system.md` -- how debate transcripts are stored as episodic memory
204
+ - MagicModules by Roman Nurik (Google Labs) -- original spec-first generation concept
205
+ - MoMoA by Reto Meier (Google Labs) -- original multi-persona debate concept
@@ -1,4 +1,4 @@
1
- import{c as L,j as e,r as m,v as _,Z as Q,m as X,h as ee,b as R,F as ge,U as z,X as te,L as se,w as je,M as fe,T as G,S as be,l as ae,k as ne,x as ve,E as Ee,Q as Ne,Y as re}from"./index-6Z4B0I6r.js";import{B as w}from"./Button-sp_FVGZj.js";import{T as ye}from"./trending-up-DmFIdVOc.js";import{C as I}from"./clock-DDScLol4.js";import{A as ke,U as ie}from"./Avatar-88MlpLO5.js";import{A as H}from"./activity-h1wU9a0L.js";import{R as le}from"./refresh-cw-B3dG1-Sb.js";import{G as Ae}from"./globe-Cby-g5Yb.js";import{C as we}from"./chevron-left-Bw4I1yGm.js";import{M as Ce}from"./mail-Dokiey5S.js";import{C as ce}from"./check-BWp8L5Cy.js";import{D as W}from"./dollar-sign-CydJu0kl.js";import{U as Se}from"./user-Dh00W8De.js";import{D as De}from"./database-CYZBHz51.js";import{L as Fe}from"./lock-BABtHe6K.js";import{H as Me}from"./hammer-BNScgGdp.js";import{S as Be}from"./shield-alert-CKJ1pzCz.js";import{S as $e}from"./server-CpN2GX4G.js";/**
1
+ import{c as L,j as e,r as m,v as _,Z as Q,m as X,h as ee,b as R,F as ge,U as z,X as te,L as se,w as je,M as fe,T as G,S as be,l as ae,k as ne,x as ve,E as Ee,Q as Ne,Y as re}from"./index-BN52-GQT.js";import{B as w}from"./Button-BPXURLaK.js";import{T as ye}from"./trending-up-CNVsmM3G.js";import{C as I}from"./clock-mfq4XnPQ.js";import{A as ke,U as ie}from"./Avatar-B7gqhcg3.js";import{A as H}from"./activity-BgBZ4s4c.js";import{R as le}from"./refresh-cw-34B13ztx.js";import{G as Ae}from"./globe-B7xEJSL_.js";import{C as we}from"./chevron-left-C-emzUhB.js";import{M as Ce}from"./mail-BuzAu1IP.js";import{C as ce}from"./check-CBohulxQ.js";import{D as W}from"./dollar-sign-CRqk0dW5.js";import{U as Se}from"./user-BT79cI-o.js";import{D as De}from"./database-S1dyXnuT.js";import{L as Fe}from"./lock-Bt6gpMrs.js";import{H as Me}from"./hammer-Cgi3LTuS.js";import{S as Be}from"./shield-alert-DLYLdVJ0.js";import{S as $e}from"./server-BcgRMArA.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as h,j as s}from"./index-6Z4B0I6r.js";/**
1
+ import{c as h,j as s}from"./index-BN52-GQT.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e}from"./index-6Z4B0I6r.js";import{C as r}from"./clock-DDScLol4.js";import{C as a}from"./circle-alert-C37PKXiC.js";import{C as l}from"./check-BWp8L5Cy.js";const i={completed:"bg-[#1FC5A8]/10 text-[#1FC5A8]",running:"bg-[#553DE9]/10 text-[#553DE9]",failed:"bg-[#C45B5B]/10 text-[#C45B5B]",started:"bg-[#D4A03C]/10 text-[#D4A03C]",empty:"bg-[#F8F4F0] text-[#6B6960]",version:"bg-[#553DE9]/10 text-[#553DE9]"};function o({status:t}){switch(t){case"completed":return e.jsx(l,{size:12});case"running":return e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping motion-reduce:animate-none absolute inline-flex h-full w-full rounded-full bg-current opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-current"})]});case"failed":return e.jsx(a,{size:12});case"started":return e.jsx(r,{size:12});default:return null}}function f({status:t,children:n,className:s=""}){return e.jsxs("span",{className:["inline-flex items-center gap-1 rounded-btn px-2.5 py-0.5 text-xs font-semibold",i[t],s].filter(Boolean).join(" "),children:[e.jsx(o,{status:t}),n]})}export{f as B};
1
+ import{j as e}from"./index-BN52-GQT.js";import{C as r}from"./clock-mfq4XnPQ.js";import{C as a}from"./circle-alert-8SRY0_GX.js";import{C as l}from"./check-CBohulxQ.js";const i={completed:"bg-[#1FC5A8]/10 text-[#1FC5A8]",running:"bg-[#553DE9]/10 text-[#553DE9]",failed:"bg-[#C45B5B]/10 text-[#C45B5B]",started:"bg-[#D4A03C]/10 text-[#D4A03C]",empty:"bg-[#F8F4F0] text-[#6B6960]",version:"bg-[#553DE9]/10 text-[#553DE9]"};function o({status:t}){switch(t){case"completed":return e.jsx(l,{size:12});case"running":return e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping motion-reduce:animate-none absolute inline-flex h-full w-full rounded-full bg-current opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-current"})]});case"failed":return e.jsx(a,{size:12});case"started":return e.jsx(r,{size:12});default:return null}}function f({status:t,children:n,className:s=""}){return e.jsxs("span",{className:["inline-flex items-center gap-1 rounded-btn px-2.5 py-0.5 text-xs font-semibold",i[t],s].filter(Boolean).join(" "),children:[e.jsx(o,{status:t}),n]})}export{f as B};
@@ -1 +1 @@
1
- import{r as p,j as t}from"./index-6Z4B0I6r.js";const m={primary:"bg-[#553DE9] text-white hover:bg-[#4432c4] shadow-button rounded-btn",secondary:"border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] bg-transparent rounded-btn",ghost:"text-[#36342E] hover:bg-[#F8F4F0] rounded-btn",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border border-[#C45B5B]/20 hover:bg-[#C45B5B]/20 rounded-btn"},b={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u={sm:14,md:16,lg:18};function h({size:e}){return t.jsxs("svg",{className:"animate-spin",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}const B=p.forwardRef(({variant:e="primary",size:o="md",icon:n,iconRight:i,loading:r=!1,disabled:a,className:c="",children:l,...x},d)=>{const s=u[o];return t.jsxs("button",{ref:d,disabled:a||r,className:["inline-flex items-center justify-center gap-2 font-medium transition-colors",m[e],b[o],(a||r)&&"opacity-60 cursor-not-allowed",c].filter(Boolean).join(" "),...x,children:[r?t.jsx(h,{size:s}):n?t.jsx(n,{size:s}):null,l,i&&!r&&t.jsx(i,{size:s})]})});B.displayName="Button";export{B};
1
+ import{r as p,j as t}from"./index-BN52-GQT.js";const m={primary:"bg-[#553DE9] text-white hover:bg-[#4432c4] shadow-button rounded-btn",secondary:"border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] bg-transparent rounded-btn",ghost:"text-[#36342E] hover:bg-[#F8F4F0] rounded-btn",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border border-[#C45B5B]/20 hover:bg-[#C45B5B]/20 rounded-btn"},b={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u={sm:14,md:16,lg:18};function h({size:e}){return t.jsxs("svg",{className:"animate-spin",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}const B=p.forwardRef(({variant:e="primary",size:o="md",icon:n,iconRight:i,loading:r=!1,disabled:a,className:c="",children:l,...x},d)=>{const s=u[o];return t.jsxs("button",{ref:d,disabled:a||r,className:["inline-flex items-center justify-center gap-2 font-medium transition-colors",m[e],b[o],(a||r)&&"opacity-60 cursor-not-allowed",c].filter(Boolean).join(" "),...x,children:[r?t.jsx(h,{size:s}):n?t.jsx(n,{size:s}):null,l,i&&!r&&t.jsx(i,{size:s})]})});B.displayName="Button";export{B};
@@ -1 +1 @@
1
- import{r as n,j as e}from"./index-6Z4B0I6r.js";function p({value:r,prefix:t="",suffix:s=""}){const[i,l]=n.useState(0),o=n.useRef(0);return n.useEffect(()=>{const c=o.current,d=r-c;if(d===0)return;const x=600,h=performance.now();function u(a){const b=a-h,f=Math.min(b/x,1),g=1-Math.pow(1-f,3),j=Math.round(c+d*g);l(j),o.current=j,f<1&&requestAnimationFrame(u)}requestAnimationFrame(u)},[r]),e.jsxs("span",{className:"tabular-nums",children:[t,i.toLocaleString(),s]})}function N(){const[r,t]=n.useState(5),[s,i]=n.useState(30),[l,o]=n.useState(75),x=Math.round(r*s*.4*4.33),h=Math.round(x*l),u=1/0;return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 shadow-sm",children:[e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1",children:"ROI Calculator"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6",children:"Estimate how much your team could save with autonomous development."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Team size"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[r," developers"]})]}),e.jsx("input",{type:"range",min:1,max:50,value:r,onChange:a=>t(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"50"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Hours coding per week"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[s,"h"]})]}),e.jsx("input",{type:"range",min:5,max:60,value:s,onChange:a=>i(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"5h"}),e.jsx("span",{children:"60h"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Average hourly rate"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:["$",l,"/hr"]})]}),e.jsx("input",{type:"range",min:25,max:250,step:5,value:l,onChange:a=>o(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"$25"}),e.jsx("span",{children:"$250"})]})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-[#ECEAE3]",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#553DE9]",children:e.jsx(p,{value:x,suffix:"h"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Hours saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#1FC5A8]",children:e.jsx(p,{value:h,prefix:"$"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Cost saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#36342E]",children:u===1/0?"Free":e.jsx(p,{value:u,suffix:"%"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"ROI (open source)"})]})]}),e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-[#553DE9]/5 border border-[#553DE9]/10",children:e.jsxs("p",{className:"text-sm text-[#36342E] text-center",children:["With Loki Mode, your team could save"," ",e.jsxs("span",{className:"font-bold text-[#553DE9]",children:[x.toLocaleString()," hours"]})," ","and"," ",e.jsxs("span",{className:"font-bold text-[#1FC5A8]",children:["$",h.toLocaleString()]})," ","per month."]})})]})]})}function y({count:r=5}){return e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:r}).map((t,s)=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#553DE9",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})},s))})}function w(){return e.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#553DE9]/15",children:e.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zm12 0c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",fill:"currentColor"})})}function k({quote:r,name:t,role:s,company:i,avatar:l,rating:o=5}){const c=t.split(" ").map(d=>d[0]).join("").toUpperCase().slice(0,2);return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 flex flex-col gap-4 shadow-sm hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(w,{}),e.jsx(y,{count:o})]}),e.jsxs("p",{className:"text-[#36342E] text-sm leading-relaxed flex-1",children:['"',r,'"']}),e.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-[#ECEAE3]",children:[l?e.jsx("img",{src:l,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-[#553DE9] to-[#7B6BEF] flex items-center justify-center text-white text-sm font-bold flex-shrink-0",children:c}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#36342E]",children:t}),e.jsxs("p",{className:"text-xs text-[#6B6960]",children:[s,", ",i]})]})]})]})}const E=[{quote:"Loki Mode turned a weekend project into a production app in 45 minutes. The RARV cycle caught bugs I would have shipped. Easily 10x faster than writing everything by hand.",name:"Sarah Chen",role:"Full-Stack Developer",company:"Nimbus Labs"},{quote:"The quality gates are what sold me. Three blind reviewers, anti-sycophancy checks, severity blocking -- it catches issues that even our senior engineers miss in code review.",name:"Marcus Rivera",role:"CTO",company:"Forgepoint Systems"},{quote:"As a solo founder, Loki Mode is like having a senior engineering team on demand. I shipped our MVP in a day instead of two weeks. The autonomous iteration is the real game changer.",name:"Priya Sharma",role:"Founder",company:"Seedcraft"},{quote:"Self-hosted, no data leaves our network, and the multi-provider failover means we never hit rate limits. Exactly what our compliance team needed. Enterprise-ready out of the box.",name:"Daniel Okafor",role:"DevOps Lead",company:"Vaultline Security"}],v=[{feature:"Claude (Opus/Sonnet/Haiku)",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!0},{feature:"GPT-4o / Codex",category:"AI Models",lokiMode:!0,boltNew:!0,replit:!0,lovable:!1},{feature:"Gemini",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"5-provider auto-failover",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"9 automated quality gates",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Blind 3-reviewer code review",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Anti-sycophancy checks",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Automated test generation",category:"Quality",lokiMode:!0,boltNew:!1,replit:"Partial",lovable:!1},{feature:"Docker container generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"CI/CD pipeline generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"One-click cloud deploy",category:"Deployment",lokiMode:"Planned",boltNew:!0,replit:!0,lovable:!0},{feature:"Self-hosted (your keys)",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Free tier available",category:"Cost",lokiMode:"Open source",boltNew:!0,replit:!0,lovable:!0},{feature:"No vendor lock-in",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"SSO / OIDC authentication",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"RBAC access control",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Audit logging",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Air-gapped deployment",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1}];function C(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function M(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#C45B5B]/40",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function m({value:r}){return typeof r=="string"?e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:r}):r?e.jsx(C,{}):e.jsx(M,{})}const A=[{title:"Full Autonomy",description:"Describe what you want. Loki Mode handles planning, coding, testing, and verification automatically.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#553DE9]",children:e.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Production Quality",description:"9 quality gates, blind code review, and anti-sycophancy checks ensure code that actually works.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Your Infrastructure",description:"Self-hosted, open source, no data leaves your network. Use your own API keys across 5 providers.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#2F71E3]",children:[e.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor"})]})},{title:"Built for Teams",description:"Enterprise auth, RBAC, audit logs, and parallel workflows for teams of any size.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#E93D82]",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"9",cy:"7",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}];function D(){const r=[...new Set(v.map(t=>t.category))];return e.jsx("div",{className:"min-h-screen bg-[#FAF9F6]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#36342E]",children:"Compare"}),e.jsx("p",{className:"text-[#6B6960] mt-1",children:"See how Loki Mode stacks up against other AI development platforms."})]}),e.jsx("div",{className:"bg-white border border-[#ECEAE3] rounded-xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[#ECEAE3]",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium text-[#6B6960] w-[240px]",children:"Feature"}),e.jsx("th",{className:"text-center px-4 py-3 font-bold text-[#553DE9] bg-[#553DE9]/5 w-[130px]",children:"Loki Mode"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"bolt.new"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Replit"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Lovable"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-[#FAF9F6]",children:e.jsx("td",{colSpan:5,className:"px-4 py-2 text-xs font-bold text-[#939084] uppercase tracking-wider",children:t})},`cat-${t}`),v.filter(s=>s.category===t).map(s=>e.jsxs("tr",{className:"border-b border-[#ECEAE3] last:border-b-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-[#36342E]",children:s.feature}),e.jsx("td",{className:"px-4 py-2.5 text-center bg-[#553DE9]/5",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lokiMode})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.boltNew})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.replit})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lovable})})})]},s.feature))]}))})]})})}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"Why developers choose Loki Mode"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:A.map(t=>e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow",children:[e.jsx("div",{className:"mb-3",children:t.icon}),e.jsx("h3",{className:"text-base font-bold text-[#36342E] mb-1",children:t.title}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:t.description})]},t.title))})]}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"What developers are saying"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:E.map(t=>e.jsx(k,{...t},t.name))})]}),e.jsx("div",{className:"mt-12 max-w-xl mx-auto",children:e.jsx(N,{})})]})})}export{D as default};
1
+ import{r as n,j as e}from"./index-BN52-GQT.js";function p({value:r,prefix:t="",suffix:s=""}){const[i,l]=n.useState(0),o=n.useRef(0);return n.useEffect(()=>{const c=o.current,d=r-c;if(d===0)return;const x=600,h=performance.now();function u(a){const b=a-h,f=Math.min(b/x,1),g=1-Math.pow(1-f,3),j=Math.round(c+d*g);l(j),o.current=j,f<1&&requestAnimationFrame(u)}requestAnimationFrame(u)},[r]),e.jsxs("span",{className:"tabular-nums",children:[t,i.toLocaleString(),s]})}function N(){const[r,t]=n.useState(5),[s,i]=n.useState(30),[l,o]=n.useState(75),x=Math.round(r*s*.4*4.33),h=Math.round(x*l),u=1/0;return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 shadow-sm",children:[e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1",children:"ROI Calculator"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6",children:"Estimate how much your team could save with autonomous development."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Team size"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[r," developers"]})]}),e.jsx("input",{type:"range",min:1,max:50,value:r,onChange:a=>t(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"50"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Hours coding per week"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[s,"h"]})]}),e.jsx("input",{type:"range",min:5,max:60,value:s,onChange:a=>i(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"5h"}),e.jsx("span",{children:"60h"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Average hourly rate"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:["$",l,"/hr"]})]}),e.jsx("input",{type:"range",min:25,max:250,step:5,value:l,onChange:a=>o(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"$25"}),e.jsx("span",{children:"$250"})]})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-[#ECEAE3]",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#553DE9]",children:e.jsx(p,{value:x,suffix:"h"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Hours saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#1FC5A8]",children:e.jsx(p,{value:h,prefix:"$"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Cost saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#36342E]",children:u===1/0?"Free":e.jsx(p,{value:u,suffix:"%"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"ROI (open source)"})]})]}),e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-[#553DE9]/5 border border-[#553DE9]/10",children:e.jsxs("p",{className:"text-sm text-[#36342E] text-center",children:["With Loki Mode, your team could save"," ",e.jsxs("span",{className:"font-bold text-[#553DE9]",children:[x.toLocaleString()," hours"]})," ","and"," ",e.jsxs("span",{className:"font-bold text-[#1FC5A8]",children:["$",h.toLocaleString()]})," ","per month."]})})]})]})}function y({count:r=5}){return e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:r}).map((t,s)=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#553DE9",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})},s))})}function w(){return e.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#553DE9]/15",children:e.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zm12 0c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",fill:"currentColor"})})}function k({quote:r,name:t,role:s,company:i,avatar:l,rating:o=5}){const c=t.split(" ").map(d=>d[0]).join("").toUpperCase().slice(0,2);return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 flex flex-col gap-4 shadow-sm hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(w,{}),e.jsx(y,{count:o})]}),e.jsxs("p",{className:"text-[#36342E] text-sm leading-relaxed flex-1",children:['"',r,'"']}),e.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-[#ECEAE3]",children:[l?e.jsx("img",{src:l,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-[#553DE9] to-[#7B6BEF] flex items-center justify-center text-white text-sm font-bold flex-shrink-0",children:c}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#36342E]",children:t}),e.jsxs("p",{className:"text-xs text-[#6B6960]",children:[s,", ",i]})]})]})]})}const E=[{quote:"Loki Mode turned a weekend project into a production app in 45 minutes. The RARV cycle caught bugs I would have shipped. Easily 10x faster than writing everything by hand.",name:"Sarah Chen",role:"Full-Stack Developer",company:"Nimbus Labs"},{quote:"The quality gates are what sold me. Three blind reviewers, anti-sycophancy checks, severity blocking -- it catches issues that even our senior engineers miss in code review.",name:"Marcus Rivera",role:"CTO",company:"Forgepoint Systems"},{quote:"As a solo founder, Loki Mode is like having a senior engineering team on demand. I shipped our MVP in a day instead of two weeks. The autonomous iteration is the real game changer.",name:"Priya Sharma",role:"Founder",company:"Seedcraft"},{quote:"Self-hosted, no data leaves our network, and the multi-provider failover means we never hit rate limits. Exactly what our compliance team needed. Enterprise-ready out of the box.",name:"Daniel Okafor",role:"DevOps Lead",company:"Vaultline Security"}],v=[{feature:"Claude (Opus/Sonnet/Haiku)",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!0},{feature:"GPT-4o / Codex",category:"AI Models",lokiMode:!0,boltNew:!0,replit:!0,lovable:!1},{feature:"Gemini",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"5-provider auto-failover",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"9 automated quality gates",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Blind 3-reviewer code review",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Anti-sycophancy checks",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Automated test generation",category:"Quality",lokiMode:!0,boltNew:!1,replit:"Partial",lovable:!1},{feature:"Docker container generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"CI/CD pipeline generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"One-click cloud deploy",category:"Deployment",lokiMode:"Planned",boltNew:!0,replit:!0,lovable:!0},{feature:"Self-hosted (your keys)",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Free tier available",category:"Cost",lokiMode:"Open source",boltNew:!0,replit:!0,lovable:!0},{feature:"No vendor lock-in",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"SSO / OIDC authentication",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"RBAC access control",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Audit logging",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Air-gapped deployment",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1}];function C(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function M(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#C45B5B]/40",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function m({value:r}){return typeof r=="string"?e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:r}):r?e.jsx(C,{}):e.jsx(M,{})}const A=[{title:"Full Autonomy",description:"Describe what you want. Loki Mode handles planning, coding, testing, and verification automatically.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#553DE9]",children:e.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Production Quality",description:"9 quality gates, blind code review, and anti-sycophancy checks ensure code that actually works.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Your Infrastructure",description:"Self-hosted, open source, no data leaves your network. Use your own API keys across 5 providers.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#2F71E3]",children:[e.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor"})]})},{title:"Built for Teams",description:"Enterprise auth, RBAC, audit logs, and parallel workflows for teams of any size.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#E93D82]",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"9",cy:"7",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}];function D(){const r=[...new Set(v.map(t=>t.category))];return e.jsx("div",{className:"min-h-screen bg-[#FAF9F6]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#36342E]",children:"Compare"}),e.jsx("p",{className:"text-[#6B6960] mt-1",children:"See how Loki Mode stacks up against other AI development platforms."})]}),e.jsx("div",{className:"bg-white border border-[#ECEAE3] rounded-xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[#ECEAE3]",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium text-[#6B6960] w-[240px]",children:"Feature"}),e.jsx("th",{className:"text-center px-4 py-3 font-bold text-[#553DE9] bg-[#553DE9]/5 w-[130px]",children:"Loki Mode"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"bolt.new"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Replit"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Lovable"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-[#FAF9F6]",children:e.jsx("td",{colSpan:5,className:"px-4 py-2 text-xs font-bold text-[#939084] uppercase tracking-wider",children:t})},`cat-${t}`),v.filter(s=>s.category===t).map(s=>e.jsxs("tr",{className:"border-b border-[#ECEAE3] last:border-b-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-[#36342E]",children:s.feature}),e.jsx("td",{className:"px-4 py-2.5 text-center bg-[#553DE9]/5",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lokiMode})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.boltNew})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.replit})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lovable})})})]},s.feature))]}))})]})})}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"Why developers choose Loki Mode"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:A.map(t=>e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow",children:[e.jsx("div",{className:"mb-3",children:t.icon}),e.jsx("h3",{className:"text-base font-bold text-[#36342E] mb-1",children:t.title}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:t.description})]},t.title))})]}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"What developers are saying"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:E.map(t=>e.jsx(k,{...t},t.name))})]}),e.jsx("div",{className:"mt-12 max-w-xl mx-auto",children:e.jsx(N,{})})]})})}export{D as default};
@@ -0,0 +1,12 @@
1
+ import{c as M,r as o,a as C,j as e,m as H,H as w,J as f,a1 as P,M as R,l as A,E as B}from"./index-BN52-GQT.js";import{B as v}from"./Button-BPXURLaK.js";import{C as k,G as q}from"./ProjectPage-DNujSl6j.js";import{R as F}from"./refresh-cw-34B13ztx.js";import{C as S}from"./circle-alert-8SRY0_GX.js";import{U as D}from"./user-BT79cI-o.js";import{R as T}from"./rotate-ccw-CrD2QB29.js";import{L as U}from"./loader-circle-BB932A7A.js";import"./TerminalOutput-DqOVnR1p.js";import"./lock-Bt6gpMrs.js";import"./package-BE5FHxQ8.js";import"./file-code-corner-B99CwY_6.js";import"./file-plus-DZ5qnz5b.js";import"./clock-mfq4XnPQ.js";import"./activity-BgBZ4s4c.js";import"./bot-D70fEnm5.js";import"./check-CBohulxQ.js";import"./hammer-Cgi3LTuS.js";import"./dollar-sign-CRqk0dW5.js";import"./globe-B7xEJSL_.js";import"./copy-LXquTgzI.js";import"./git-commit-horizontal-DM1ERuNd.js";import"./upload-LuDuB7Wc.js";import"./plus-CNqABexN.js";import"./trash-2-Cc-VTvzt.js";import"./trending-down-CrDpO2a_.js";import"./save-DsJcqdnI.js";import"./code-xml-1N2Ui-4c.js";import"./trending-up-CNVsmM3G.js";import"./layers-Bi8RPIBC.js";import"./folder-open-DBCm7yuF.js";import"./server-BcgRMArA.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const W=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]],O=M("circle-off",W);/**
7
+ * @license lucide-react v0.577.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Q=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],V=M("tag",Q),X={"creating-branch":"Creating branch...",analyzing:"Analyzing issue...","writing-fix":"Writing fix...","running-tests":"Running tests...","creating-pr":"Creating PR..."},E=["creating-branch","analyzing","writing-fix","running-tests","creating-pr"];function z(s){const r=Date.now(),n=new Date(s).getTime(),t=r-n,a=Math.floor(t/1e3),i=Math.floor(a/60),m=Math.floor(i/60),x=Math.floor(m/24);return x>30?`${Math.floor(x/30)}mo ago`:x>0?`${x}d ago`:m>0?`${m}h ago`:i>0?`${i}m ago`:"just now"}function J(s){return s.slice(0,2).toUpperCase()}function K(s){const r=parseInt(s.slice(0,2),16),n=parseInt(s.slice(2,4),16),t=parseInt(s.slice(4,6),16);return(.299*r+.587*n+.114*t)/255>.5?"#1a1a1a":"#ffffff"}function _(s){if(!s)return[];const r=s.split(`
12
+ `),n=[];for(let t=0;t<r.length;t++){const a=r[t];if(/^\s*[-*]\s/.test(a)){const i=a.replace(/^\s*[-*]\s/,"");n.push(e.jsx("li",{className:"ml-4 list-disc text-xs text-secondary leading-relaxed",children:L(i)},t));continue}if(a.trim()===""){n.push(e.jsx("br",{},t));continue}n.push(e.jsx("p",{className:"text-xs text-secondary leading-relaxed",children:L(a)},t))}return n}function L(s){const r=[],n=/(\*\*[^*]+\*\*|`[^`]+`)/g;let t=0,a;for(;(a=n.exec(s))!==null;){a.index>t&&r.push(s.slice(t,a.index));const i=a[0];i.startsWith("**")?r.push(e.jsx("strong",{className:"font-semibold text-ink",children:i.slice(2,-2)},a.index)):i.startsWith("`")&&r.push(e.jsx("code",{className:"px-1 py-0.5 rounded bg-hover text-xs font-mono text-primary",children:i.slice(1,-1)},a.index)),t=a.index+i.length}return t<s.length&&r.push(s.slice(t)),r}function $({label:s}){const r=`#${s.color}`,n=K(s.color);return e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-btn px-2 py-0.5 text-[11px] font-medium leading-none",style:{backgroundColor:r,color:n},children:[e.jsx(V,{size:10}),s.name]})}function I({login:s}){return e.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-primary/10 text-primary text-[10px] font-bold flex-shrink-0",title:s,children:J(s)})}function N(){return e.jsxs("div",{className:"px-4 py-3 border border-border rounded-card space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"2.5rem",height:"0.625rem"}),e.jsx(f,{variant:"text",width:"60%",height:"0.75rem"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"}),e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"})]})]})}function Y({issue:s,onClick:r}){return e.jsx("button",{onClick:r,className:"w-full text-left px-4 py-3 border border-border rounded-card hover:bg-hover transition-colors cursor-pointer group",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:16,className:`mt-0.5 flex-shrink-0 ${s.state==="open"?"text-success":"text-primary"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-xs font-mono text-muted flex-shrink-0",children:["#",s.number]}),e.jsx("span",{className:"text-sm font-medium text-ink truncate group-hover:text-primary transition-colors",children:s.title})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-1.5 mt-1.5",children:s.labels.map(n=>e.jsx($,{label:n},n.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:s.author.login}),s.author.login]}),e.jsx("span",{children:z(s.createdAt)}),s.comments>0&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(R,{size:11}),s.comments]})]})]})]})})}function Z({fixState:s,onRetry:r}){if(s.status==="idle")return null;if(s.status==="success"&&s.result)return e.jsxs("div",{className:"rounded-card border border-success/30 bg-success/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-success",children:[e.jsx(A,{size:16}),"Pull request created"]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted",children:[e.jsx(q,{size:14,className:"text-success"}),e.jsxs("span",{className:"font-mono",children:["PR #",s.result.pr_number]}),e.jsx("span",{className:"text-secondary",children:"on branch"}),e.jsx("span",{className:"font-mono bg-hover px-1.5 py-0.5 rounded-btn",children:s.result.branch})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("a",{href:s.result.pr_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline",children:[e.jsx(B,{size:12}),"View on GitHub"]})})]});if(s.status==="error")return e.jsxs("div",{className:"rounded-card border border-danger/30 bg-danger/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-danger",children:[e.jsx(S,{size:16}),"Fix failed"]}),e.jsx("p",{className:"text-xs text-muted font-mono bg-danger/5 border border-danger/10 rounded px-2 py-1.5",children:s.error||"Unknown error"}),e.jsx(v,{variant:"secondary",size:"sm",icon:T,onClick:r,children:"Retry"})]});const n=E.indexOf(s.status);return e.jsx("div",{className:"rounded-card border border-primary/20 bg-primary/5 p-4 space-y-2",children:E.map((t,a)=>{const i=a===n,m=a<n;return e.jsxs("div",{className:`flex items-center gap-2 text-xs ${m?"text-success":i?"text-primary font-medium":"text-muted"}`,children:[m?e.jsx(A,{size:14}):i?e.jsx(U,{size:14,className:"animate-spin"}):e.jsx(O,{size:14,className:"opacity-40"}),X[t]]},t)})})}function ee({sessionId:s,issueNumber:r,onBack:n}){const[t,a]=o.useState(null),[i,m]=o.useState(!0),[x,g]=o.useState(null),[u,p]=o.useState({status:"idle"});o.useEffect(()=>{let l=!1;return m(!0),(async()=>{try{const d=await C.getGitHubIssue(s,r);l||(a(d),g(null))}catch(d){l||g(d instanceof Error?d.message:"Failed to load issue")}finally{l||m(!1)}})(),()=>{l=!0}},[s,r]);const j=o.useCallback(async()=>{const l=["creating-branch","analyzing","writing-fix","running-tests","creating-pr"];let d=0;p({status:l[0]});const y=setInterval(()=>{d++,d<l.length&&p({status:l[d]})},2e3);try{const h=await C.fixGitHubIssue(s,r);clearInterval(y),p({status:"success",result:h})}catch(h){clearInterval(y),p({status:"error",error:h instanceof Error?h.message:"Fix failed"})}},[s,r]);return i?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsx(f,{variant:"text",width:"70%",height:"1rem"}),e.jsx(f,{variant:"block",width:"100%",height:"6rem"}),e.jsx(f,{variant:"text",width:"40%",height:"0.75rem"})]}):x||!t?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-danger",children:[e.jsx(S,{size:16}),x||"Issue not found"]})]}):e.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto terminal-scroll h-full",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:18,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-success":"text-primary"}`}),e.jsxs("h3",{className:"text-base font-semibold text-ink leading-snug",children:[e.jsxs("span",{className:"text-muted font-mono mr-1.5",children:["#",t.number]}),t.title]})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-2 mt-2 ml-6",children:t.labels.map(l=>e.jsx($,{label:l},l.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 ml-6 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:t.author.login}),t.author.login]}),e.jsx("span",{children:z(t.createdAt)})]}),t.assignees.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 ml-6 text-[11px] text-muted",children:[e.jsx(D,{size:11}),"Assigned to:"," ",t.assignees.map(l=>l.login).join(", ")]})]}),t.body&&e.jsx("div",{className:"ml-6 border-l-2 border-border pl-4 space-y-1",children:_(t.body)}),e.jsx("div",{className:"ml-6",children:u.status==="idle"?e.jsx(v,{variant:"primary",size:"md",icon:P,onClick:j,children:"Fix with AI"}):e.jsx(Z,{fixState:u,onRetry:j})}),t.comments_data&&t.comments_data.length>0&&e.jsxs("div",{className:"ml-6 space-y-3",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(R,{size:12}),"Comments (",t.comments_data.length,")"]}),t.comments_data.map((l,d)=>e.jsxs("div",{className:"border border-border rounded-card p-3 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted",children:[e.jsx(I,{login:l.author.login}),e.jsx("span",{className:"font-medium text-ink",children:l.author.login}),e.jsx("span",{children:z(l.createdAt)})]}),e.jsx("div",{className:"mt-1 space-y-1",children:_(l.body)})]},d))]})]})}function Le({sessionId:s}){const[r,n]=o.useState("open"),[t,a]=o.useState(""),[i,m]=o.useState(null),[x,g]=o.useState(!0),[u,p]=o.useState(null),[j,l]=o.useState(null),d=o.useCallback(async()=>{g(!0),p(null);try{const c=r==="all"?"all":r,b=await C.getGitHubIssues(s,c);m(b)}catch(c){p(c instanceof Error?c.message:"Failed to load issues")}finally{g(!1)}},[s,r]);o.useEffect(()=>{d()},[d]);const y=o.useCallback(c=>{n(c),l(null)},[]),h=o.useMemo(()=>{if(!i)return[];if(!t.trim())return i;const c=t.toLowerCase();return i.filter(b=>b.title.toLowerCase().includes(c)||String(b.number).includes(c)||b.labels.some(G=>G.name.toLowerCase().includes(c)))},[i,t]);return j!==null?e.jsx(ee,{sessionId:s,issueNumber:j,onBack:()=>l(null)}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-border space-y-3 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold text-ink flex items-center gap-2",children:[e.jsx(k,{size:16,className:"text-primary"}),"GitHub Issues"]}),e.jsx(v,{variant:"ghost",size:"sm",icon:F,onClick:d,loading:x,children:"Refresh"})]}),e.jsx("div",{className:"flex items-center gap-1 bg-hover rounded-btn p-0.5",children:["open","closed","all"].map(c=>e.jsx("button",{onClick:()=>y(c),className:`flex-1 text-xs font-medium py-1.5 px-3 rounded-btn transition-colors capitalize ${r===c?"bg-white text-ink shadow-sm":"text-muted hover:text-secondary"}`,children:c},c))}),e.jsxs("div",{className:"relative",children:[e.jsx(H,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted pointer-events-none"}),e.jsx("input",{type:"text",placeholder:"Filter issues...",value:t,onChange:c=>a(c.target.value),className:"w-full pl-8 pr-3 py-2 text-xs border border-border rounded-btn bg-white text-ink placeholder:text-muted focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/10"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll p-3 space-y-2",children:[x&&!i&&e.jsxs(e.Fragment,{children:[e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{})]}),u&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(S,{size:24,className:"text-danger mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"Failed to load issues"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:u}),e.jsx(v,{variant:"secondary",size:"sm",icon:F,onClick:d,className:"mt-3",children:"Retry"})]}),!x&&!u&&h.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(k,{size:24,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"No issues found"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:t?"Try adjusting your search query":`No ${r==="all"?"":r} issues in this repository`})]}),!u&&h.map(c=>e.jsx(Y,{issue:c,onClick:()=>l(c.number)},c.number))]})]})}export{Le as GitHubIssuesPanel};
@@ -1,4 +1,4 @@
1
- import{c as I,r as c,a as b,j as e,G as xe,A as me,S as Z,k as ee,m as ue,h as pe,b as he,X as te,M as fe}from"./index-6Z4B0I6r.js";import{B as y}from"./Button-sp_FVGZj.js";import{C as be}from"./chevron-left-Bw4I1yGm.js";import{G as P,L as V,S as ge}from"./ProjectPage-t5J2XAJT.js";import{R as L}from"./refresh-cw-B3dG1-Sb.js";import{C as Ne}from"./circle-alert-C37PKXiC.js";import{S as se}from"./shield-alert-CKJ1pzCz.js";import{F as je}from"./file-code-corner-DqZ9gpdv.js";import{C as H}from"./clock-DDScLol4.js";import{C as re}from"./check-BWp8L5Cy.js";import"./TerminalOutput-Czg-ZC2k.js";import"./lock-BABtHe6K.js";import"./package-DbJyS1Ft.js";import"./file-plus-CzeFJWp3.js";import"./activity-h1wU9a0L.js";import"./bot-rWO7KjkQ.js";import"./loader-circle-BA0QIVGA.js";import"./hammer-BNScgGdp.js";import"./dollar-sign-CydJu0kl.js";import"./globe-Cby-g5Yb.js";import"./copy-DKIRv0VK.js";import"./git-commit-horizontal-wbqFPNID.js";import"./plus-BcAN8Kaj.js";import"./trash-2-C9vZqTqw.js";import"./rotate-ccw-Cs1Phctm.js";import"./trending-down-BNLTrF5P.js";import"./save-DsrNCZrP.js";import"./trending-up-DmFIdVOc.js";import"./layers-XfssQc5V.js";import"./folder-open-4YWk08dP.js";import"./server-CpN2GX4G.js";/**
1
+ import{c as I,r as c,a as b,j as e,G as xe,A as me,S as Z,k as ee,m as ue,h as pe,b as he,X as te,M as fe}from"./index-BN52-GQT.js";import{B as y}from"./Button-BPXURLaK.js";import{C as be}from"./chevron-left-C-emzUhB.js";import{G as P,L as V,S as ge}from"./ProjectPage-DNujSl6j.js";import{R as L}from"./refresh-cw-34B13ztx.js";import{C as Ne}from"./circle-alert-8SRY0_GX.js";import{S as se}from"./shield-alert-DLYLdVJ0.js";import{F as je}from"./file-code-corner-B99CwY_6.js";import{C as H}from"./clock-mfq4XnPQ.js";import{C as re}from"./check-CBohulxQ.js";import"./TerminalOutput-DqOVnR1p.js";import"./lock-Bt6gpMrs.js";import"./package-BE5FHxQ8.js";import"./file-plus-DZ5qnz5b.js";import"./activity-BgBZ4s4c.js";import"./bot-D70fEnm5.js";import"./loader-circle-BB932A7A.js";import"./hammer-Cgi3LTuS.js";import"./dollar-sign-CRqk0dW5.js";import"./globe-B7xEJSL_.js";import"./copy-LXquTgzI.js";import"./git-commit-horizontal-DM1ERuNd.js";import"./upload-LuDuB7Wc.js";import"./plus-CNqABexN.js";import"./trash-2-Cc-VTvzt.js";import"./rotate-ccw-CrD2QB29.js";import"./trending-down-CrDpO2a_.js";import"./save-DsJcqdnI.js";import"./code-xml-1N2Ui-4c.js";import"./trending-up-CNVsmM3G.js";import"./layers-Bi8RPIBC.js";import"./folder-open-DBCm7yuF.js";import"./server-BcgRMArA.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -14,4 +14,4 @@ import{c as I,r as c,a as b,j as e,G as xe,A as me,S as Z,k as ee,m as ue,h as p
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
16
  */const we=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ce=I("shield-question-mark",we);function Re(t){const n=Date.now(),i=new Date(t).getTime(),a=Math.floor((n-i)/1e3);if(a<60)return"just now";const o=Math.floor(a/60);if(o<60)return`${o}m ago`;const l=Math.floor(o/60);if(l<24)return`${l}h ago`;const x=Math.floor(l/24);return x<30?`${x}d ago`:`${Math.floor(x/30)}mo ago`}function Se(t){switch(t==null?void 0:t.toUpperCase()){case"APPROVED":return{className:"bg-green-500/10 text-green-500 border-green-500/20",label:"Approved"};case"CHANGES_REQUESTED":return{className:"bg-red-400/10 text-red-400 border-red-400/20",label:"Changes Requested"};case"REVIEW_REQUIRED":return{className:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20",label:"Review Required"};default:return{className:"bg-muted/10 text-muted border-muted/20",label:t}}}function ze(t){switch(t==null?void 0:t.toUpperCase()){case"APPROVED":return{className:"text-green-500",label:"Approved",Icon:Z};case"CHANGES_REQUESTED":return{className:"text-red-400",label:"Changes Requested",Icon:se};case"COMMENTED":return{className:"text-muted",label:"Commented",Icon:fe};case"DISMISSED":return{className:"text-muted/60",label:"Dismissed",Icon:ee};default:return{className:"text-muted",label:t||"Pending",Icon:Ce}}}function Pe(t){switch(t==null?void 0:t.toLowerCase()){case"success":return e.jsx(re,{size:12,className:"text-green-500"});case"failure":case"error":return e.jsx(te,{size:12,className:"text-red-400"});case"pending":case"in_progress":case"queued":return e.jsx(V,{size:12,className:"text-yellow-500 animate-spin"});case"neutral":case"skipped":return e.jsx(H,{size:12,className:"text-muted"});default:return e.jsx(H,{size:12,className:"text-muted"})}}function Me(t){if(!t||t.length===0)return{label:"No checks",className:"text-muted"};const n=t.every(a=>a.conclusion==="success"),i=t.some(a=>a.conclusion==="failure"||a.conclusion==="error");return n?{label:"All passing",className:"text-green-500"}:i?{label:"Some failing",className:"text-red-400"}:{label:"In progress",className:"text-yellow-500"}}function Ee(t){var a;const n=[];if(!t)return n;const i=t.split(/^diff --git /m).filter(Boolean);for(const o of i){const l=o.split(`
17
- `),x=(a=l[0])==null?void 0:a.match(/a\/(.+?) b\/(.+)/),g=x?x[2]:"unknown";let w=0,v=0;const C=[];let s=null,u=0,h=0;for(let k=1;k<l.length;k++){const m=l[k],N=m.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)/);if(N){s={header:m,lines:[]},C.push(s),u=parseInt(N[1],10),h=parseInt(N[2],10),s.lines.push({type:"header",content:m});continue}s&&(m.startsWith("+")?(w++,s.lines.push({type:"add",content:m.slice(1),newLine:h}),h++):m.startsWith("-")?(v++,s.lines.push({type:"delete",content:m.slice(1),oldLine:u}),u++):m.startsWith(" ")&&(s.lines.push({type:"context",content:m.slice(1),oldLine:u,newLine:h}),u++,h++))}n.push({path:g,additions:w,deletions:v,hunks:C})}return n}function De({pr:t}){var o;const n=((o=t.statusCheckRollup)==null?void 0:o.contexts)||[];if(!n||n.length===0)return e.jsx("span",{title:"No status checks",children:e.jsx(H,{size:13,className:"text-muted"})});const i=n.every(l=>l.conclusion==="success"),a=n.some(l=>l.conclusion==="failure"||l.conclusion==="error");return i?e.jsx("span",{title:"All checks passing",children:e.jsx(re,{size:13,className:"text-green-500"})}):a?e.jsx("span",{title:"Some checks failing",children:e.jsx(te,{size:13,className:"text-red-400"})}):e.jsx("span",{title:"Checks in progress",children:e.jsx(V,{size:13,className:"text-yellow-500 animate-spin"})})}function Le({pr:t,onClick:n}){var a;const i=Se(t.reviewDecision||"PENDING");return e.jsx("button",{onClick:n,className:"w-full text-left px-3 py-2.5 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(P,{size:14,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-green-500":t.state==="merged"?"text-purple-500":"text-red-400"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-ink truncate",children:t.title}),e.jsxs("span",{className:"text-[10px] font-mono text-muted flex-shrink-0",children:["#",t.number]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx("span",{className:"text-[10px] text-muted",children:(a=t.author)==null?void 0:a.login}),e.jsx("span",{className:"text-[10px] font-mono text-primary/60 truncate max-w-[120px]",title:t.headRefName,children:t.headRefName}),e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:e.jsx(De,{pr:t})}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0 text-[9px] font-medium rounded border ${i.className}`,children:i.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto flex-shrink-0 flex items-center gap-1",children:[e.jsxs("span",{className:"text-green-500",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400",children:["-",t.deletions]})]}),e.jsx("span",{className:"text-[10px] text-muted flex-shrink-0",children:Re(t.createdAt)})]})]})]})})}function $e({checks:t}){const[n,i]=c.useState(!1),a=Me(t);return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"No status checks configured."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-hover transition-colors",children:[n?e.jsx(pe,{size:12}):e.jsx(he,{size:12}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Status Checks"}),e.jsx("span",{className:`text-[10px] font-medium ${a.className}`,children:a.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[t.length," checks"]})]}),n&&e.jsx("div",{className:"px-3 pb-2 space-y-1",children:t.map((o,l)=>e.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs",children:[Pe(o.conclusion),e.jsx("span",{className:"text-ink flex-1 truncate",children:o.name}),e.jsx("span",{className:"text-[10px] text-muted capitalize",children:o.conclusion||"pending"})]},l))})]})}function qe({reviews:t}){return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted border-b border-border",children:"No reviews yet."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Reviews (",t.length,")"]}),t.map((n,i)=>{var o;const a=ze(n.state);return e.jsxs("div",{className:"px-3 py-2 border-b border-border last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.Icon,{size:13,className:a.className}),e.jsx("span",{className:"text-xs font-medium text-ink",children:(o=n.author)==null?void 0:o.login}),e.jsx("span",{className:`text-[10px] ${a.className}`,children:a.label})]}),n.body&&e.jsx("p",{className:"mt-1 text-xs text-muted leading-relaxed pl-5",children:n.body})]},i)})]})}function Ae({file:t,isSelected:n,onClick:i}){return e.jsxs("button",{onClick:i,className:`w-full text-left flex items-center gap-2 px-3 py-1.5 text-xs transition-colors ${n?"bg-primary/10 text-primary":"hover:bg-hover text-ink"}`,children:[e.jsx(je,{size:12,className:n?"text-primary":"text-muted"}),e.jsx("span",{className:"font-mono truncate flex-1",children:t.path}),e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("span",{className:"text-green-500 text-[10px]",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400 text-[10px]",children:["-",t.deletions]})]})]})}function Fe({diffFiles:t,selectedFile:n}){const i=t.find(a=>a.path===n);return i?e.jsx("div",{className:"overflow-x-auto terminal-scroll",children:i.hunks.map((a,o)=>e.jsx("div",{className:"mb-2",children:a.lines.map((l,x)=>{if(l.type==="header")return e.jsx("div",{className:"px-3 py-1 bg-primary/5 text-primary text-[11px] font-mono border-y border-border",children:l.content},x);const g=l.type==="add"?"bg-green-500/8 text-ink":l.type==="delete"?"bg-red-400/8 text-ink":"text-ink";return e.jsxs("div",{className:`flex text-[11px] font-mono leading-5 ${g}`,children:[e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.oldLine??""}),e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.newLine??""}),e.jsx("span",{className:`w-4 flex-shrink-0 text-center select-none ${l.type==="add"?"text-green-500":l.type==="delete"?"text-red-400":"text-transparent"}`,children:l.type==="add"?"+":l.type==="delete"?"-":" "}),e.jsx("span",{className:"flex-1 px-2 whitespace-pre",children:l.content})]},x)})},o))}):e.jsx("div",{className:"flex items-center justify-center py-8 text-xs text-muted",children:"Select a file to view its diff."})}function Ge({onSubmit:t,loading:n,action:i}){const[a,o]=c.useState(""),l=()=>{t(a),o("")};return e.jsxs("div",{className:"p-3 space-y-2 border-t border-border bg-hover",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-ink capitalize",children:[i.replace("_"," ")," Review"]}),e.jsx("textarea",{value:a,onChange:x=>o(x.target.value),placeholder:"Review comment (optional for approve, required for request changes)...",rows:3,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors resize-none font-mono"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," characters"]}),e.jsx(y,{size:"sm",icon:ge,onClick:l,disabled:n||i==="request_changes"&&!a.trim(),loading:n,children:"Submit"})]})]})}function bt({sessionId:t}){var X,J,K;const[n,i]=c.useState([]),[a,o]=c.useState("open"),[l,x]=c.useState(""),[g,w]=c.useState(!0),[v,C]=c.useState(null),[s,u]=c.useState(null),[h,k]=c.useState(!1),[m,N]=c.useState(null),[R,$]=c.useState([]),[ae,_e]=c.useState(!1),[q,M]=c.useState(null),[f,S]=c.useState(null),[ne,Q]=c.useState(!1),[E,le]=c.useState("squash"),[A,D]=c.useState(!1),[B,U]=c.useState(!1),[O,T]=c.useState(!1),[F,p]=c.useState(null),z=c.useCallback(async()=>{w(!0),C(null);try{const r=await b.getGitHubPRs(t,a==="all"?void 0:a);i(r)}catch(r){C(r instanceof Error?r.message:"Failed to load pull requests")}w(!1)},[t,a]);c.useEffect(()=>{z()},[z]);const W=c.useCallback(async r=>{k(!0),N(null),$([]),M(null),p(null),S(null),D(!1);try{const[d,j]=await Promise.all([b.getGitHubPR(t,r),b.getGitHubPRDiff(t,r)]);u(d);const _=Ee(j);$(_),_.length>0&&M(_[0].path)}catch(d){N(d instanceof Error?d.message:"Failed to load PR details")}k(!1)},[t]),ie=()=>{u(null),N(null),$([]),M(null),p(null),S(null),D(!1)},ce=async r=>{if(!(!s||!f)){Q(!0),p(null);try{await b.reviewGitHubPR(t,s.number,f,r),p({type:"success",text:`Review submitted: ${f.replace("_"," ")}`}),S(null);const d=await b.getGitHubPR(t,s.number);u(d)}catch(d){p({type:"error",text:d instanceof Error?d.message:"Review failed"})}Q(!1)}},oe=async()=>{if(s){U(!0),p(null);try{await b.mergeGitHubPR(t,s.number,E),p({type:"success",text:`PR #${s.number} merged via ${E}`}),D(!1),z();const r=await b.getGitHubPR(t,s.number);u(r)}catch(r){p({type:"error",text:r instanceof Error?r.message:"Merge failed"})}U(!1)}},de=async()=>{if(s){T(!0),p(null);try{await b.reviewGitHubPR(t,s.number,"comment","Closed via Purple Lab"),p({type:"success",text:`PR #${s.number} closed`}),z();const r=await b.getGitHubPR(t,s.number);u(r)}catch(r){p({type:"error",text:r instanceof Error?r.message:"Close failed"})}T(!1)}},G=c.useMemo(()=>{if(!l.trim())return n;const r=l.toLowerCase();return n.filter(d=>{var j;return d.title.toLowerCase().includes(r)||((j=d.author)==null?void 0:j.login.toLowerCase().includes(r))||d.headRefName.toLowerCase().includes(r)||`#${d.number}`.includes(r)})},[n,l]);return s||h||m?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx("button",{onClick:ie,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Back to list",children:e.jsx(be,{size:14})}),e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink truncate",children:s?`#${s.number} ${s.title}`:"Loading..."})]}),h&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading PR details..."})]})}),m&&!h&&e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(Ne,{size:32,className:"text-muted/40"}),e.jsx("p",{className:"text-sm text-muted",children:m}),e.jsx(y,{size:"sm",variant:"secondary",icon:L,onClick:()=>s&&W(s.number),children:"Retry"})]})}),s&&!h&&e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border space-y-1.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded capitalize ${s.state==="open"?"bg-green-500/10 text-green-500":s.state==="merged"?"bg-purple-500/10 text-purple-500":"bg-red-400/10 text-red-400"}`,children:[e.jsx(P,{size:10}),s.state]}),e.jsx("span",{className:"text-[10px] text-muted",children:(X=s.author)==null?void 0:X.login}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-mono text-primary/60",children:[e.jsx(xe,{size:10}),s.headRefName,e.jsx(me,{size:10,className:"text-muted"}),s.baseRefName]}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[s.changedFiles," files, +",s.additions," -",s.deletions]})]}),s.body&&e.jsx("div",{className:"mt-2 text-xs text-ink/80 leading-relaxed whitespace-pre-wrap bg-hover p-2 rounded-btn border border-border",children:s.body})]}),F&&e.jsx("div",{className:`px-3 py-2 text-xs border-b ${F.type==="success"?"bg-green-500/5 border-green-500/20 text-green-500":"bg-red-400/5 border-red-400/20 text-red-400"}`,children:F.text}),e.jsx($e,{checks:((J=s.statusCheckRollup)==null?void 0:J.contexts)||[]}),e.jsx(qe,{reviews:s.reviews||[]}),e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border flex items-center gap-1",children:[e.jsx(ve,{size:11}),"Changed Files (",R.length||((K=s.files)==null?void 0:K.length)||0,")"]}),(R.length>0?R:s.files||[]).map((r,d)=>e.jsx(Ae,{file:r,isSelected:q===r.path,onClick:()=>M(r.path)},d)),ae&&e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx(V,{size:14,className:"text-muted animate-spin mx-auto"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading diff..."})]}),R.length>0&&q&&e.jsx("div",{className:"border-t border-border",children:e.jsx(Fe,{diffFiles:R,selectedFile:q})})]}),s.state==="open"&&e.jsxs("div",{className:"p-3 space-y-2 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(y,{size:"sm",variant:"secondary",icon:Z,onClick:()=>S(f==="approve"?null:"approve"),className:f==="approve"?"ring-1 ring-green-500":"",children:"Approve"}),e.jsx(y,{size:"sm",variant:"danger",icon:se,onClick:()=>S(f==="request_changes"?null:"request_changes"),className:f==="request_changes"?"ring-1 ring-red-400":"",children:"Request Changes"}),e.jsx(y,{size:"sm",icon:Y,onClick:()=>D(!A),className:A?"ring-1 ring-primary":"",children:"Merge"}),e.jsx(y,{size:"sm",variant:"ghost",icon:ee,onClick:de,loading:O,disabled:O,children:"Close"})]}),f&&e.jsx(Ge,{onSubmit:ce,loading:ne,action:f}),A&&e.jsxs("div",{className:"p-3 border border-border rounded-btn bg-hover space-y-2",children:[e.jsx("p",{className:"text-[11px] font-semibold text-ink",children:"Merge Method"}),e.jsx("div",{className:"flex items-center gap-2",children:["merge","squash","rebase"].map(r=>e.jsx("button",{onClick:()=>le(r),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn border transition-colors capitalize ${E===r?"border-primary bg-primary/10 text-primary":"border-border text-muted hover:text-ink"}`,children:r},r))}),e.jsxs(y,{size:"sm",icon:Y,onClick:oe,loading:B,disabled:B,children:["Confirm Merge (",E,")"]})]})]}),s.commits&&s.commits.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Commits (",s.commits.length,")"]}),s.commits.map((r,d)=>{var j;return e.jsx("div",{className:"px-3 py-2 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary/40 mt-1.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs text-ink truncate",children:r.message}),e.jsx("span",{className:"text-[10px] font-mono text-muted",children:(j=r.sha)==null?void 0:j.slice(0,7)})]})]})},d)})]})]})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Pull Requests"}),e.jsx("span",{className:"text-[10px] text-muted font-mono",children:G.length}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:z,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:e.jsx(L,{size:13,className:g?"animate-spin":""})})]}),e.jsx("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border flex-shrink-0",children:[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"merged",label:"Merged"},{id:"all",label:"All"}].map(r=>e.jsx("button",{onClick:()=>o(r.id),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${a===r.id?"bg-primary/10 text-primary":"text-muted hover:text-ink"}`,children:r.label},r.id))}),e.jsx("div",{className:"px-2 py-1.5 border-b border-border flex-shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(ue,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{value:l,onChange:r=>x(r.target.value),placeholder:"Search PRs...",className:"w-full pl-7 pr-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors"})]})}),v&&e.jsx("div",{className:"px-3 py-2 bg-red-500/5 border-b border-red-500/20 text-xs text-red-400",children:v}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[g&&n.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted mt-2",children:"Loading pull requests..."})]}),!g&&G.length===0&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(P,{size:28,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs text-muted",children:l?"No PRs match your search.":`No ${a==="all"?"":a+" "}pull requests.`}),!l&&a!=="all"&&e.jsx("button",{onClick:()=>o("all"),className:"text-[11px] text-primary hover:text-primary/80 mt-1",children:"Show all PRs"})]}),G.map(r=>e.jsx(Le,{pr:r,onClick:()=>W(r.number)},r.number))]})]})}export{bt as GitHubPRsPanel};
17
+ `),x=(a=l[0])==null?void 0:a.match(/a\/(.+?) b\/(.+)/),g=x?x[2]:"unknown";let w=0,v=0;const C=[];let s=null,u=0,h=0;for(let k=1;k<l.length;k++){const m=l[k],N=m.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)/);if(N){s={header:m,lines:[]},C.push(s),u=parseInt(N[1],10),h=parseInt(N[2],10),s.lines.push({type:"header",content:m});continue}s&&(m.startsWith("+")?(w++,s.lines.push({type:"add",content:m.slice(1),newLine:h}),h++):m.startsWith("-")?(v++,s.lines.push({type:"delete",content:m.slice(1),oldLine:u}),u++):m.startsWith(" ")&&(s.lines.push({type:"context",content:m.slice(1),oldLine:u,newLine:h}),u++,h++))}n.push({path:g,additions:w,deletions:v,hunks:C})}return n}function De({pr:t}){var o;const n=((o=t.statusCheckRollup)==null?void 0:o.contexts)||[];if(!n||n.length===0)return e.jsx("span",{title:"No status checks",children:e.jsx(H,{size:13,className:"text-muted"})});const i=n.every(l=>l.conclusion==="success"),a=n.some(l=>l.conclusion==="failure"||l.conclusion==="error");return i?e.jsx("span",{title:"All checks passing",children:e.jsx(re,{size:13,className:"text-green-500"})}):a?e.jsx("span",{title:"Some checks failing",children:e.jsx(te,{size:13,className:"text-red-400"})}):e.jsx("span",{title:"Checks in progress",children:e.jsx(V,{size:13,className:"text-yellow-500 animate-spin"})})}function Le({pr:t,onClick:n}){var a;const i=Se(t.reviewDecision||"PENDING");return e.jsx("button",{onClick:n,className:"w-full text-left px-3 py-2.5 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(P,{size:14,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-green-500":t.state==="merged"?"text-purple-500":"text-red-400"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-ink truncate",children:t.title}),e.jsxs("span",{className:"text-[10px] font-mono text-muted flex-shrink-0",children:["#",t.number]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx("span",{className:"text-[10px] text-muted",children:(a=t.author)==null?void 0:a.login}),e.jsx("span",{className:"text-[10px] font-mono text-primary/60 truncate max-w-[120px]",title:t.headRefName,children:t.headRefName}),e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:e.jsx(De,{pr:t})}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0 text-[9px] font-medium rounded border ${i.className}`,children:i.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto flex-shrink-0 flex items-center gap-1",children:[e.jsxs("span",{className:"text-green-500",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400",children:["-",t.deletions]})]}),e.jsx("span",{className:"text-[10px] text-muted flex-shrink-0",children:Re(t.createdAt)})]})]})]})})}function $e({checks:t}){const[n,i]=c.useState(!1),a=Me(t);return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"No status checks configured."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-hover transition-colors",children:[n?e.jsx(pe,{size:12}):e.jsx(he,{size:12}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Status Checks"}),e.jsx("span",{className:`text-[10px] font-medium ${a.className}`,children:a.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[t.length," checks"]})]}),n&&e.jsx("div",{className:"px-3 pb-2 space-y-1",children:t.map((o,l)=>e.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs",children:[Pe(o.conclusion),e.jsx("span",{className:"text-ink flex-1 truncate",children:o.name}),e.jsx("span",{className:"text-[10px] text-muted capitalize",children:o.conclusion||"pending"})]},l))})]})}function qe({reviews:t}){return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted border-b border-border",children:"No reviews yet."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Reviews (",t.length,")"]}),t.map((n,i)=>{var o;const a=ze(n.state);return e.jsxs("div",{className:"px-3 py-2 border-b border-border last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.Icon,{size:13,className:a.className}),e.jsx("span",{className:"text-xs font-medium text-ink",children:(o=n.author)==null?void 0:o.login}),e.jsx("span",{className:`text-[10px] ${a.className}`,children:a.label})]}),n.body&&e.jsx("p",{className:"mt-1 text-xs text-muted leading-relaxed pl-5",children:n.body})]},i)})]})}function Ae({file:t,isSelected:n,onClick:i}){return e.jsxs("button",{onClick:i,className:`w-full text-left flex items-center gap-2 px-3 py-1.5 text-xs transition-colors ${n?"bg-primary/10 text-primary":"hover:bg-hover text-ink"}`,children:[e.jsx(je,{size:12,className:n?"text-primary":"text-muted"}),e.jsx("span",{className:"font-mono truncate flex-1",children:t.path}),e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("span",{className:"text-green-500 text-[10px]",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400 text-[10px]",children:["-",t.deletions]})]})]})}function Fe({diffFiles:t,selectedFile:n}){const i=t.find(a=>a.path===n);return i?e.jsx("div",{className:"overflow-x-auto terminal-scroll",children:i.hunks.map((a,o)=>e.jsx("div",{className:"mb-2",children:a.lines.map((l,x)=>{if(l.type==="header")return e.jsx("div",{className:"px-3 py-1 bg-primary/5 text-primary text-[11px] font-mono border-y border-border",children:l.content},x);const g=l.type==="add"?"bg-green-500/8 text-ink":l.type==="delete"?"bg-red-400/8 text-ink":"text-ink";return e.jsxs("div",{className:`flex text-[11px] font-mono leading-5 ${g}`,children:[e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.oldLine??""}),e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.newLine??""}),e.jsx("span",{className:`w-4 flex-shrink-0 text-center select-none ${l.type==="add"?"text-green-500":l.type==="delete"?"text-red-400":"text-transparent"}`,children:l.type==="add"?"+":l.type==="delete"?"-":" "}),e.jsx("span",{className:"flex-1 px-2 whitespace-pre",children:l.content})]},x)})},o))}):e.jsx("div",{className:"flex items-center justify-center py-8 text-xs text-muted",children:"Select a file to view its diff."})}function Ge({onSubmit:t,loading:n,action:i}){const[a,o]=c.useState(""),l=()=>{t(a),o("")};return e.jsxs("div",{className:"p-3 space-y-2 border-t border-border bg-hover",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-ink capitalize",children:[i.replace("_"," ")," Review"]}),e.jsx("textarea",{value:a,onChange:x=>o(x.target.value),placeholder:"Review comment (optional for approve, required for request changes)...",rows:3,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors resize-none font-mono"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," characters"]}),e.jsx(y,{size:"sm",icon:ge,onClick:l,disabled:n||i==="request_changes"&&!a.trim(),loading:n,children:"Submit"})]})]})}function Nt({sessionId:t}){var X,J,K;const[n,i]=c.useState([]),[a,o]=c.useState("open"),[l,x]=c.useState(""),[g,w]=c.useState(!0),[v,C]=c.useState(null),[s,u]=c.useState(null),[h,k]=c.useState(!1),[m,N]=c.useState(null),[R,$]=c.useState([]),[ae,_e]=c.useState(!1),[q,M]=c.useState(null),[f,S]=c.useState(null),[ne,Q]=c.useState(!1),[E,le]=c.useState("squash"),[A,D]=c.useState(!1),[B,U]=c.useState(!1),[O,T]=c.useState(!1),[F,p]=c.useState(null),z=c.useCallback(async()=>{w(!0),C(null);try{const r=await b.getGitHubPRs(t,a==="all"?void 0:a);i(r)}catch(r){C(r instanceof Error?r.message:"Failed to load pull requests")}w(!1)},[t,a]);c.useEffect(()=>{z()},[z]);const W=c.useCallback(async r=>{k(!0),N(null),$([]),M(null),p(null),S(null),D(!1);try{const[d,j]=await Promise.all([b.getGitHubPR(t,r),b.getGitHubPRDiff(t,r)]);u(d);const _=Ee(j);$(_),_.length>0&&M(_[0].path)}catch(d){N(d instanceof Error?d.message:"Failed to load PR details")}k(!1)},[t]),ie=()=>{u(null),N(null),$([]),M(null),p(null),S(null),D(!1)},ce=async r=>{if(!(!s||!f)){Q(!0),p(null);try{await b.reviewGitHubPR(t,s.number,f,r),p({type:"success",text:`Review submitted: ${f.replace("_"," ")}`}),S(null);const d=await b.getGitHubPR(t,s.number);u(d)}catch(d){p({type:"error",text:d instanceof Error?d.message:"Review failed"})}Q(!1)}},oe=async()=>{if(s){U(!0),p(null);try{await b.mergeGitHubPR(t,s.number,E),p({type:"success",text:`PR #${s.number} merged via ${E}`}),D(!1),z();const r=await b.getGitHubPR(t,s.number);u(r)}catch(r){p({type:"error",text:r instanceof Error?r.message:"Merge failed"})}U(!1)}},de=async()=>{if(s){T(!0),p(null);try{await b.reviewGitHubPR(t,s.number,"comment","Closed via Purple Lab"),p({type:"success",text:`PR #${s.number} closed`}),z();const r=await b.getGitHubPR(t,s.number);u(r)}catch(r){p({type:"error",text:r instanceof Error?r.message:"Close failed"})}T(!1)}},G=c.useMemo(()=>{if(!l.trim())return n;const r=l.toLowerCase();return n.filter(d=>{var j;return d.title.toLowerCase().includes(r)||((j=d.author)==null?void 0:j.login.toLowerCase().includes(r))||d.headRefName.toLowerCase().includes(r)||`#${d.number}`.includes(r)})},[n,l]);return s||h||m?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx("button",{onClick:ie,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Back to list",children:e.jsx(be,{size:14})}),e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink truncate",children:s?`#${s.number} ${s.title}`:"Loading..."})]}),h&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading PR details..."})]})}),m&&!h&&e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(Ne,{size:32,className:"text-muted/40"}),e.jsx("p",{className:"text-sm text-muted",children:m}),e.jsx(y,{size:"sm",variant:"secondary",icon:L,onClick:()=>s&&W(s.number),children:"Retry"})]})}),s&&!h&&e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border space-y-1.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded capitalize ${s.state==="open"?"bg-green-500/10 text-green-500":s.state==="merged"?"bg-purple-500/10 text-purple-500":"bg-red-400/10 text-red-400"}`,children:[e.jsx(P,{size:10}),s.state]}),e.jsx("span",{className:"text-[10px] text-muted",children:(X=s.author)==null?void 0:X.login}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-mono text-primary/60",children:[e.jsx(xe,{size:10}),s.headRefName,e.jsx(me,{size:10,className:"text-muted"}),s.baseRefName]}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[s.changedFiles," files, +",s.additions," -",s.deletions]})]}),s.body&&e.jsx("div",{className:"mt-2 text-xs text-ink/80 leading-relaxed whitespace-pre-wrap bg-hover p-2 rounded-btn border border-border",children:s.body})]}),F&&e.jsx("div",{className:`px-3 py-2 text-xs border-b ${F.type==="success"?"bg-green-500/5 border-green-500/20 text-green-500":"bg-red-400/5 border-red-400/20 text-red-400"}`,children:F.text}),e.jsx($e,{checks:((J=s.statusCheckRollup)==null?void 0:J.contexts)||[]}),e.jsx(qe,{reviews:s.reviews||[]}),e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border flex items-center gap-1",children:[e.jsx(ve,{size:11}),"Changed Files (",R.length||((K=s.files)==null?void 0:K.length)||0,")"]}),(R.length>0?R:s.files||[]).map((r,d)=>e.jsx(Ae,{file:r,isSelected:q===r.path,onClick:()=>M(r.path)},d)),ae&&e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx(V,{size:14,className:"text-muted animate-spin mx-auto"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading diff..."})]}),R.length>0&&q&&e.jsx("div",{className:"border-t border-border",children:e.jsx(Fe,{diffFiles:R,selectedFile:q})})]}),s.state==="open"&&e.jsxs("div",{className:"p-3 space-y-2 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(y,{size:"sm",variant:"secondary",icon:Z,onClick:()=>S(f==="approve"?null:"approve"),className:f==="approve"?"ring-1 ring-green-500":"",children:"Approve"}),e.jsx(y,{size:"sm",variant:"danger",icon:se,onClick:()=>S(f==="request_changes"?null:"request_changes"),className:f==="request_changes"?"ring-1 ring-red-400":"",children:"Request Changes"}),e.jsx(y,{size:"sm",icon:Y,onClick:()=>D(!A),className:A?"ring-1 ring-primary":"",children:"Merge"}),e.jsx(y,{size:"sm",variant:"ghost",icon:ee,onClick:de,loading:O,disabled:O,children:"Close"})]}),f&&e.jsx(Ge,{onSubmit:ce,loading:ne,action:f}),A&&e.jsxs("div",{className:"p-3 border border-border rounded-btn bg-hover space-y-2",children:[e.jsx("p",{className:"text-[11px] font-semibold text-ink",children:"Merge Method"}),e.jsx("div",{className:"flex items-center gap-2",children:["merge","squash","rebase"].map(r=>e.jsx("button",{onClick:()=>le(r),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn border transition-colors capitalize ${E===r?"border-primary bg-primary/10 text-primary":"border-border text-muted hover:text-ink"}`,children:r},r))}),e.jsxs(y,{size:"sm",icon:Y,onClick:oe,loading:B,disabled:B,children:["Confirm Merge (",E,")"]})]})]}),s.commits&&s.commits.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Commits (",s.commits.length,")"]}),s.commits.map((r,d)=>{var j;return e.jsx("div",{className:"px-3 py-2 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary/40 mt-1.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs text-ink truncate",children:r.message}),e.jsx("span",{className:"text-[10px] font-mono text-muted",children:(j=r.sha)==null?void 0:j.slice(0,7)})]})]})},d)})]})]})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Pull Requests"}),e.jsx("span",{className:"text-[10px] text-muted font-mono",children:G.length}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:z,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:e.jsx(L,{size:13,className:g?"animate-spin":""})})]}),e.jsx("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border flex-shrink-0",children:[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"merged",label:"Merged"},{id:"all",label:"All"}].map(r=>e.jsx("button",{onClick:()=>o(r.id),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${a===r.id?"bg-primary/10 text-primary":"text-muted hover:text-ink"}`,children:r.label},r.id))}),e.jsx("div",{className:"px-2 py-1.5 border-b border-border flex-shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(ue,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{value:l,onChange:r=>x(r.target.value),placeholder:"Search PRs...",className:"w-full pl-7 pr-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors"})]})}),v&&e.jsx("div",{className:"px-3 py-2 bg-red-500/5 border-b border-red-500/20 text-xs text-red-400",children:v}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[g&&n.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted mt-2",children:"Loading pull requests..."})]}),!g&&G.length===0&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(P,{size:28,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs text-muted",children:l?"No PRs match your search.":`No ${a==="all"?"":a+" "}pull requests.`}),!l&&a!=="all"&&e.jsx("button",{onClick:()=>o("all"),className:"text-[11px] text-primary hover:text-primary/80 mt-1",children:"Show all PRs"})]}),G.map(r=>e.jsx(Le,{pr:r,onClick:()=>W(r.number)},r.number))]})]})}export{Nt as GitHubPRsPanel};