coaia-visualizer 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/page.tsx +4 -23
- package/components/chart-detail-editable.tsx +3 -0
- package/components/metadata-projections.tsx +208 -0
- package/lib/chart-editor.ts +13 -13
- package/lib/jsonl-parser.ts +55 -8
- package/lib/jsonl-preservation.ts +405 -0
- package/lib/types.ts +30 -0
- package/package.json +31 -1
- package/.dockerignore +0 -9
- package/COMPLETE_IMPLEMENTATION_REPORT.md +0 -215
- package/Dockerfile +0 -61
- package/Dockerfile.app +0 -50
- package/QUICK_START_MCP_TESTING.md +0 -236
- package/STC.md +0 -18
- package/STCGOAL.md +0 -0
- package/STCISSUE.md +0 -36
- package/STCKIN.md +0 -0
- package/STCMASTERY.md +0 -0
- package/STUDY_REPORT.md +0 -510
- package/direct-test.sh +0 -180
- package/docker-build-push.sh +0 -20
- package/docker-compose.test.yml +0 -69
- package/docker-entrypoint.sh +0 -27
- package/jgwill.coaia-visualizer-8--496dca71-d476-4ac9-ba9f-376add118dd8--260208.txt +0 -2612
- package/mcp/test_mcp/.gemini/settings.json +0 -18
- package/rispecs/README.md +0 -170
- package/rispecs/accountability-responsibility.rispec.md +0 -110
- package/rispecs/api-mcp-interface.spec.md +0 -287
- package/rispecs/app.spec.md +0 -364
- package/rispecs/chart-editing-workflow.spec.md +0 -297
- package/rispecs/chart-visualization-hierarchy.spec.md +0 -235
- package/rispecs/cli-mode.spec.md +0 -224
- package/rispecs/github-project-runtime-memory-integration.spec.md +0 -381
- package/rispecs/jsonl-parsing-data-types.spec.md +0 -243
- package/rispecs/narrative-beats-display.spec.md +0 -189
- package/rispecs/pde-integration.spec.md +0 -280
- package/rispecs/planning-integration.spec.md +0 -329
- package/rispecs/relation-graph-visualization.spec.md +0 -171
- package/rispecs/relation-to-mcp-structural-thinking.kin.md +0 -65
- package/rispecs/ui-component-library.spec.md +0 -258
- package/test-data/test-master.jsonl +0 -11
- package/test-scripts/README.md +0 -325
- package/test-scripts/run-all-tests.sh +0 -38
- package/test-scripts/test-01-basic-operations.sh +0 -87
- package/test-scripts/test-02-telescope-creation.sh +0 -91
- package/test-scripts/test-03-navigation.sh +0 -87
- package/test-scripts/test-global-cli.spec.ts +0 -220
- package/test-scripts/verify-global-cli.sh +0 -87
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
# Chart Visualization & Hierarchy
|
|
2
|
-
## RISE Specification for Chart Display, Navigation, and Structural Tension Rendering
|
|
3
|
-
|
|
4
|
-
**Component Purpose**: Render structural tension charts in navigable hierarchy and list views, enabling users to see the creative gap between desired outcomes and current reality at every level of depth.
|
|
5
|
-
|
|
6
|
-
**Source Files**: `components/chart-list.tsx`, `components/chart-detail.tsx`, `components/chart-detail-editable.tsx`
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 🎯 What This Component Enables Users to Create
|
|
11
|
-
|
|
12
|
-
- Visual maps of structural tension across hierarchical chart trees
|
|
13
|
-
- Navigable depth — drilling from root charts through telescoped sub-charts
|
|
14
|
-
- At-a-glance progress awareness through progress bars and completion counts
|
|
15
|
-
- Contextual detail views showing the full picture of any chart
|
|
16
|
-
- Breadcrumb-style navigation that maintains context while exploring depth
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 🌊 Structural Tension Dynamics
|
|
21
|
-
|
|
22
|
-
### Current Reality
|
|
23
|
-
Charts in coaia-narrative exist as flat JSONL records. A root chart with 3 levels of telescoped sub-charts is just 20+ entity records and 15+ relation records in a text file. There is no visual hierarchy, no at-a-glance progress, no way to "see" the structural tension.
|
|
24
|
-
|
|
25
|
-
### Desired Result
|
|
26
|
-
A two-pane interface where:
|
|
27
|
-
- Left pane shows all charts in either hierarchy (tree) or flat list mode
|
|
28
|
-
- Right pane shows full detail of the selected chart
|
|
29
|
-
- Navigation stack enables drilling into sub-charts with back navigation
|
|
30
|
-
- Every chart visually renders the tension between desired outcome and current reality
|
|
31
|
-
- Progress bars show advancement toward completion
|
|
32
|
-
|
|
33
|
-
### Natural Resolution
|
|
34
|
-
The `ChartList` component transforms `ParsedData.rootCharts` into a navigable tree (via recursive `ChartTree` sub-component), while `ChartDetailEditable` renders the selected chart's full structure with inline editing. Stack-based navigation tracks the user's path through the hierarchy.
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## 📋 ChartList Component
|
|
39
|
-
|
|
40
|
-
### Props
|
|
41
|
-
```typescript
|
|
42
|
-
interface ChartListProps {
|
|
43
|
-
data: ParsedData
|
|
44
|
-
selectedChart: Chart | null
|
|
45
|
-
onSelectChart: (chart: Chart) => void
|
|
46
|
-
mode: "hierarchy" | "list"
|
|
47
|
-
onDataUpdate?: (updatedData: ParsedData) => void
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Two Display Modes
|
|
52
|
-
|
|
53
|
-
**Hierarchy Mode** (default):
|
|
54
|
-
- Renders `ChartTree` — a recursive component that displays root charts with expandable sub-charts
|
|
55
|
-
- Each level is indented with left padding and vertical border
|
|
56
|
-
- Chevron icons toggle expand/collapse state
|
|
57
|
-
- Sub-charts nested within parent nodes
|
|
58
|
-
|
|
59
|
-
**List Mode**:
|
|
60
|
-
- Flat `ScrollArea` listing all charts regardless of level
|
|
61
|
-
- Each chart rendered as `ChartItem`
|
|
62
|
-
- No indentation or hierarchy
|
|
63
|
-
|
|
64
|
-
### ChartItem Sub-Component
|
|
65
|
-
Each chart item displays:
|
|
66
|
-
- **Chart ID**: Badge with chart identifier (e.g., "chart_1")
|
|
67
|
-
- **Level Badge**: Shows depth level (0 = root)
|
|
68
|
-
- **Summary**: First 100 chars of desired outcome via `getChartSummary()`
|
|
69
|
-
- **Narrative Beat Indicators**: If beats exist, shows first beat description snippet
|
|
70
|
-
- **Action Count**: Number of action steps
|
|
71
|
-
- **Progress Bar**: Visual bar showing `getChartProgress()` percentage
|
|
72
|
-
- **Selected State**: Primary border highlight when this chart is selected
|
|
73
|
-
|
|
74
|
-
### ChartTree Sub-Component
|
|
75
|
-
```
|
|
76
|
-
▼ chart_1 — "Build structural tension framework" [Level 0] [3 actions] [66%]
|
|
77
|
-
▶ chart_4 — "Design entity type system" [Level 1] [2 actions] [50%]
|
|
78
|
-
▼ chart_5 — "Implement parsing algorithm" [Level 1] [4 actions] [25%]
|
|
79
|
-
▶ chart_8 — "Handle malformed input" [Level 2] [1 action] [0%]
|
|
80
|
-
chart_2 — "Create UI component library" [Level 0] [5 actions] [80%]
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### AddMasterChart Integration
|
|
84
|
-
When `onDataUpdate` prop is provided, an "Add Chart" button appears at the bottom of the list, triggering the `AddMasterChart` dialog for creating new root-level charts.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## 📋 ChartDetail Component (Read-Only)
|
|
89
|
-
|
|
90
|
-
> ⚠️ **Note**: This component exists in the codebase but is NOT rendered by `page.tsx`. The application exclusively uses `ChartDetailEditable` for all chart display. ChartDetail is retained for potential future read-only embedding scenarios.
|
|
91
|
-
|
|
92
|
-
### Props
|
|
93
|
-
```typescript
|
|
94
|
-
interface ChartDetailProps {
|
|
95
|
-
chart: Chart
|
|
96
|
-
data: ParsedData
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Renders (Top to Bottom)
|
|
101
|
-
1. **Header Card**: Chart title (from desired outcome), level badge, creation date, due date
|
|
102
|
-
2. **Structural Tension Card** (section order is critical — maintains the creative tension visual):
|
|
103
|
-
- **Desired Outcome** in teal-colored box (chart-1 theme) — the vision
|
|
104
|
-
- **Action Steps** with completion indicators and due dates — the path
|
|
105
|
-
- **Current Reality** observations in amber-colored box (chart-2 theme) — where you are now
|
|
106
|
-
3. **Narrative Beats Section**: If beats exist, renders `NarrativeBeats` component
|
|
107
|
-
4. **Sub-Charts List**: Child charts listed at bottom
|
|
108
|
-
|
|
109
|
-
### ActionItem Sub-Component
|
|
110
|
-
```
|
|
111
|
-
┌──────────────────────────────────────────────┐
|
|
112
|
-
│ ○ Action Step Title │
|
|
113
|
-
│ Due: 2024-03-15 │
|
|
114
|
-
│ ──────────────────────────────────────────── │
|
|
115
|
-
│ ✓ Completed Action (strikethrough text) │
|
|
116
|
-
│ Completed: 2024-03-10 │
|
|
117
|
-
└──────────────────────────────────────────────┘
|
|
118
|
-
```
|
|
119
|
-
- Circle icon (`○`) for incomplete, check icon (`✓`) for complete
|
|
120
|
-
- Strikethrough styling applied to completed actions
|
|
121
|
-
- Due date displayed below action text when present
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## 📋 ChartDetailEditable Component
|
|
126
|
-
|
|
127
|
-
### Props
|
|
128
|
-
```typescript
|
|
129
|
-
interface ChartDetailEditableProps {
|
|
130
|
-
chart: Chart
|
|
131
|
-
data: ParsedData
|
|
132
|
-
onUpdate: (updatedData: ParsedData) => void
|
|
133
|
-
onNavigateToSubChart?: (subChart: Chart) => void
|
|
134
|
-
onNavigateBack?: () => void
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Additional Features (Beyond Read-Only)
|
|
139
|
-
- **Back Button**: Appears when navigation stack has entries (i.e., `chartNavigationStack.length > 0`), calls `onNavigateBack()`
|
|
140
|
-
- **Inline Editing**: Uses `EditDesiredOutcome`, `EditCurrentReality`, `EditActionStep` components
|
|
141
|
-
- **Due Date Editor**: `EditChartDueDate` component on header card
|
|
142
|
-
- **Add Action Step**: `AddActionStep` form at bottom of actions list
|
|
143
|
-
- **Telescope Actions**: Each action has telescope icon to create/navigate to sub-chart
|
|
144
|
-
- **Completion Toggle**: Checkbox-style toggle on each action
|
|
145
|
-
|
|
146
|
-
### Structural Tension Card Section Order
|
|
147
|
-
The Structural Tension card renders three sections top-to-bottom, separated by `<Separator>` elements:
|
|
148
|
-
1. **Desired Outcome** (Target icon, chart-1 color) — `EditDesiredOutcome`
|
|
149
|
-
2. **Action Steps** (ListChecks icon, chart-3 color) — `EditActionStep` list + `AddActionStep` form
|
|
150
|
-
3. **Current Reality** (MapPin icon, chart-2 color) — `EditCurrentReality`
|
|
151
|
-
|
|
152
|
-
> ⚠️ This order is intentional. Action Steps sit between outcome and reality to represent the bridge across the structural tension gap.
|
|
153
|
-
|
|
154
|
-
### applyEdit Pattern
|
|
155
|
-
All edits follow a consistent pattern:
|
|
156
|
-
```
|
|
157
|
-
1. Create ChartEditor instance from current ParsedData
|
|
158
|
-
2. Call appropriate editor method (e.g., updateDesiredOutcome)
|
|
159
|
-
3. Get updated ParsedData via editor.getUpdatedData()
|
|
160
|
-
4. Pass to onUpdate() callback → parent state updates → re-render
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Telescoping Flow
|
|
164
|
-
```
|
|
165
|
-
User clicks telescope icon on action
|
|
166
|
-
│
|
|
167
|
-
├─ If action already has telescoped chart:
|
|
168
|
-
│ → onNavigateToSubChart(existingSubChart)
|
|
169
|
-
│
|
|
170
|
-
└─ If action has no telescoped chart:
|
|
171
|
-
→ ChartEditor.createTelescopedChartFromAction()
|
|
172
|
-
→ New sub-chart created with action as desired outcome
|
|
173
|
-
→ onUpdate(newData)
|
|
174
|
-
→ onNavigateToSubChart(newSubChart)
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## 📋 Navigation Stack
|
|
180
|
-
|
|
181
|
-
The main page (`app/page.tsx`) maintains a `chartNavigationStack: Chart[]` array:
|
|
182
|
-
|
|
183
|
-
```typescript
|
|
184
|
-
handleNavigateToSubChart(subChart: Chart):
|
|
185
|
-
1. Push current selectedChart onto stack
|
|
186
|
-
2. Set selectedChart = subChart
|
|
187
|
-
|
|
188
|
-
handleNavigateBack():
|
|
189
|
-
1. Pop last chart from stack
|
|
190
|
-
2. Set selectedChart = popped chart (or null if stack empty)
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
This enables unlimited depth navigation with consistent back-button behavior.
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## 📋 View Mode Toggle
|
|
198
|
-
|
|
199
|
-
The main page offers a `viewMode` toggle between "hierarchy" and "list":
|
|
200
|
-
- **Hierarchy**: Shows `ChartList` in tree mode with expand/collapse
|
|
201
|
-
- **List**: Shows `ChartList` in flat mode — useful for searching or quick overview
|
|
202
|
-
|
|
203
|
-
Toggle rendered as `Tabs` component at the top of the left pane.
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
## ✅ Quality Criteria
|
|
208
|
-
|
|
209
|
-
✅ **Structural Tension Visible**
|
|
210
|
-
- Every chart clearly displays desired outcome and current reality in contrasting color boxes
|
|
211
|
-
- The gap between them is the structural tension — always visible, never hidden
|
|
212
|
-
|
|
213
|
-
✅ **Navigation Integrity**
|
|
214
|
-
- Back button always returns to correct parent chart
|
|
215
|
-
- Stack correctly tracks multi-level depth navigation
|
|
216
|
-
- Sub-charts display in both hierarchy tree and detail view
|
|
217
|
-
|
|
218
|
-
✅ **Progress Awareness**
|
|
219
|
-
- Progress bars calculate from action completion status
|
|
220
|
-
- Summary text truncated consistently at 100 characters
|
|
221
|
-
- Level badges distinguish root charts from sub-charts at a glance
|
|
222
|
-
|
|
223
|
-
✅ **Responsive Layout**
|
|
224
|
-
- Two-pane layout with scrollable chart list and detail view
|
|
225
|
-
- Responsive typography (md: breakpoints for text sizing)
|
|
226
|
-
- Hover-triggered toolbars for editing actions
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## 🔗 Related Components
|
|
231
|
-
|
|
232
|
-
- [jsonl-parsing-data-types.spec.md](./jsonl-parsing-data-types.spec.md) — provides ParsedData consumed by these components
|
|
233
|
-
- [chart-editing-workflow.spec.md](./chart-editing-workflow.spec.md) — editing components used within ChartDetailEditable
|
|
234
|
-
- [narrative-beats-display.spec.md](./narrative-beats-display.spec.md) — NarrativeBeats rendered within chart detail
|
|
235
|
-
- [relation-graph-visualization.spec.md](./relation-graph-visualization.spec.md) — RelationGraph rendered in relations tab
|
package/rispecs/cli-mode.spec.md
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
# CLI Mode
|
|
2
|
-
## RISE Specification for Command-Line Interface and Deployment
|
|
3
|
-
|
|
4
|
-
**Component Purpose**: Launch the coaia-visualizer from the terminal with a single command, supporting both local Next.js development and Docker containerized deployment, configurable via flags and environment variables.
|
|
5
|
-
|
|
6
|
-
**Source Files**: `cli.ts`, `Dockerfile`, `package.json` (bin field)
|
|
7
|
-
|
|
8
|
-
**Key Dependencies**: `minimist` (argument parsing), `dotenv` (env file loading)
|
|
9
|
-
|
|
10
|
-
> **Note**: The CLI uses ESM (`import` syntax). The compiled output targets ES modules.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## 🎯 What This Component Enables Users to Create
|
|
15
|
-
|
|
16
|
-
- Instant visualization of any local JSONL memory file via `coaia-visualizer --memory-path ./file.jsonl`
|
|
17
|
-
- Containerized deployments with volume-mounted memory files
|
|
18
|
-
- Configurable live-polling sessions with auto-reload
|
|
19
|
-
- Audio-enabled sessions with auto-play capability
|
|
20
|
-
- Zero-configuration startup with sensible defaults
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 🌊 Structural Tension Dynamics
|
|
25
|
-
|
|
26
|
-
### Current Reality
|
|
27
|
-
JSONL memory files sit on the filesystem. Opening them requires a running web server, environment variables, and browser navigation. Docker deployment needs image management, port mapping, and volume mounting. These steps are manual without the CLI.
|
|
28
|
-
|
|
29
|
-
### Desired Result
|
|
30
|
-
A single `coaia-visualizer` command that:
|
|
31
|
-
1. Resolves the memory file path (from flag, env var, or default)
|
|
32
|
-
2. Starts the appropriate server (Next.js local or Docker container)
|
|
33
|
-
3. Opens the browser automatically
|
|
34
|
-
4. Handles graceful shutdown on SIGINT
|
|
35
|
-
|
|
36
|
-
### Natural Resolution
|
|
37
|
-
The CLI script (`cli.ts`) compiles to `dist/cli.js` and is registered as the `coaia-visualizer` npm binary. It resolves configuration from three layers (args > env > defaults), then spawns either a Docker container or a local Next.js dev server.
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## 📋 Command-Line Flags
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
coaia-visualizer [options]
|
|
45
|
-
|
|
46
|
-
Options:
|
|
47
|
-
--memory-path, -M PATH Path to JSONL memory file (default: ./memory.jsonl)
|
|
48
|
-
--port, -p PORT Server port (default: 4321)
|
|
49
|
-
--docker, -d Run in Docker container
|
|
50
|
-
--docker-image IMAGE Custom Docker image (default: jgwill/coaia:visualizer)
|
|
51
|
-
--pull Pull Docker image before running
|
|
52
|
-
--live Enable live file polling
|
|
53
|
-
--poll-interval MS Polling frequency in milliseconds (default: 2000)
|
|
54
|
-
--auto-play Auto-play audio files
|
|
55
|
-
--audio-dir PATH Directory for audio files
|
|
56
|
-
--no-open Don't auto-open browser
|
|
57
|
-
--help, -h Show help text
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## 📋 Environment Variables
|
|
63
|
-
|
|
64
|
-
| Variable | Flag Equivalent | Default | Purpose |
|
|
65
|
-
|:---|:---|:---|:---|
|
|
66
|
-
| `COAIAN_MF` | `--memory-path` | `./memory.jsonl` | Memory file path |
|
|
67
|
-
| `COAIAV_MEMORY_PATH` | *(internal)* | — | Resolved absolute path (set by CLI from `COAIAN_MF`). API routes read this variable. |
|
|
68
|
-
| `COAIAV_MEMORY_DISPLAY_NAME` | *(internal)* | — | Original filename for UI display. Set by CLI to preserve the actual filename when Docker remaps to `/data/memory.jsonl`. Falls back to `path.basename(COAIAV_MEMORY_PATH)` if unset. |
|
|
69
|
-
| `COAIAV_PORT` | `--port` | `4321` | Server port |
|
|
70
|
-
| `COAIAV_LIVE` | `--live` | `false` | Enable live polling |
|
|
71
|
-
| `COAIAV_POLL_INTERVAL` | `--poll-interval` | `2000` | Polling interval (ms) |
|
|
72
|
-
| `COAIAV_AUTO_PLAY` | `--auto-play` | `false` | Auto-play audio |
|
|
73
|
-
| `COAIAV_AUDIO_DIR` | `--audio-dir` | — | Audio directory path |
|
|
74
|
-
| `COAIAN_API_TOKEN` | — | auto-generated | API authentication token |
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 📋 Configuration Priority
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
1. Command-line flags (highest priority)
|
|
82
|
-
2. Environment variables
|
|
83
|
-
3. .env file values
|
|
84
|
-
4. Default values (lowest priority)
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## 📋 Execution Modes
|
|
90
|
-
|
|
91
|
-
### Local Mode (Default)
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
coaia-visualizer --memory-path ./memory.jsonl --port 3000
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**Process**:
|
|
98
|
-
1. Resolve absolute path to memory file
|
|
99
|
-
2. Set environment variables: `COAIAV_MEMORY_PATH`, `COAIAV_MEMORY_DISPLAY_NAME`, `PORT`, `NEXT_PUBLIC_LIVE_MODE`, `NEXT_PUBLIC_POLL_INTERVAL`, `COAIAV_AUTO_PLAY`, `COAIAV_AUDIO_DIR`
|
|
100
|
-
3. Spawn `npm run dev` in the coaia-visualizer package directory
|
|
101
|
-
4. Inherit stdio for visible server output
|
|
102
|
-
5. Wait 3 seconds, then auto-open browser at `http://localhost:{port}`
|
|
103
|
-
6. Listen for SIGINT → gracefully terminate child process
|
|
104
|
-
|
|
105
|
-
### Docker Mode
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
coaia-visualizer --docker --memory-path ./memory.jsonl --pull
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
**Process**:
|
|
112
|
-
1. If `--pull` flag → execute `docker pull {image}` first
|
|
113
|
-
2. Resolve absolute path to memory file
|
|
114
|
-
3. Execute Docker run:
|
|
115
|
-
```
|
|
116
|
-
docker run --rm
|
|
117
|
-
-p {hostPort}:{containerPort}
|
|
118
|
-
-v {absPath}:/data/memory.jsonl
|
|
119
|
-
-e COAIAV_MEMORY_PATH=/data/memory.jsonl
|
|
120
|
-
-e COAIAV_MEMORY_DISPLAY_NAME={originalFilename}
|
|
121
|
-
-e PORT={containerPort}
|
|
122
|
-
-e NEXT_PUBLIC_LIVE_MODE={live}
|
|
123
|
-
-e NEXT_PUBLIC_POLL_INTERVAL={interval}
|
|
124
|
-
{image}
|
|
125
|
-
```
|
|
126
|
-
4. Container port: always 4321 internally
|
|
127
|
-
5. Auto-open browser at `http://localhost:{hostPort}`
|
|
128
|
-
|
|
129
|
-
### Docker Constants
|
|
130
|
-
```typescript
|
|
131
|
-
const DOCKER_IMAGE = 'jgwill/coaia:visualizer'
|
|
132
|
-
const CONTAINER_PORT = 4321
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## 📋 Dockerfile (Production)
|
|
138
|
-
|
|
139
|
-
**Base**: `node:22-alpine` (two-stage build)
|
|
140
|
-
|
|
141
|
-
### Builder Stage
|
|
142
|
-
1. Install pnpm via corepack
|
|
143
|
-
2. Copy `package.json` + `pnpm-lock.yaml`
|
|
144
|
-
3. Install dependencies (skip prepare hook)
|
|
145
|
-
4. Copy source files
|
|
146
|
-
5. Build: `pnpm prepare && pnpm build` (CLI + Next.js)
|
|
147
|
-
|
|
148
|
-
### Runner Stage
|
|
149
|
-
1. Copy dependencies from builder
|
|
150
|
-
2. Prune dev dependencies
|
|
151
|
-
3. Copy built `.next/`, `public/`, `next.config.mjs`
|
|
152
|
-
4. Copy `docker-entrypoint.sh`
|
|
153
|
-
5. **VOLUME**: `/data` (mount point for JSONL files)
|
|
154
|
-
6. **ENV**: `PORT=4321`, `COAIAV_MEMORY_PATH=/data/memory.jsonl`
|
|
155
|
-
7. **ENTRYPOINT**: `docker-entrypoint.sh`
|
|
156
|
-
8. **EXPOSE**: 4321
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## 📋 npm Package Entry
|
|
161
|
-
|
|
162
|
-
```json
|
|
163
|
-
{
|
|
164
|
-
"bin": {
|
|
165
|
-
"coaia-visualizer": "dist/cli.js"
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**Build CLI**: `npm run build:cli` → `tsc` compiles `cli.ts` → `dist/cli.js`
|
|
171
|
-
**Prepare hook**: `npm run build:cli` runs automatically on `npm install`
|
|
172
|
-
|
|
173
|
-
### Global Installation
|
|
174
|
-
```bash
|
|
175
|
-
npm install -g coaia-visualizer
|
|
176
|
-
coaia-visualizer --memory-path /path/to/memory.jsonl
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## 📋 Creative Advancement Scenario
|
|
182
|
-
|
|
183
|
-
### Scenario: Quick Visualization of Agent Session
|
|
184
|
-
**User Intent**: See the structural tension charts my AI agent created during a session
|
|
185
|
-
**Current Structural Reality**: Agent wrote to `./memory.jsonl` via coaia-narrative MCP, but the file is raw JSONL
|
|
186
|
-
|
|
187
|
-
**Natural Progression**:
|
|
188
|
-
1. User runs: `coaia-visualizer -M ./memory.jsonl --live`
|
|
189
|
-
2. CLI resolves absolute path, sets env vars
|
|
190
|
-
3. Next.js dev server starts with live polling enabled
|
|
191
|
-
4. Browser opens to `http://localhost:4321`
|
|
192
|
-
5. Charts load from filesystem automatically
|
|
193
|
-
6. Live polling detects agent writes → UI auto-refreshes
|
|
194
|
-
7. User navigates charts while agent continues working
|
|
195
|
-
8. SIGINT → graceful shutdown
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## ✅ Quality Criteria
|
|
200
|
-
|
|
201
|
-
✅ **Zero-Config Startup**
|
|
202
|
-
- Sensible defaults for all settings (port 4321, ./memory.jsonl, no live mode)
|
|
203
|
-
- Works with just `coaia-visualizer` in a directory with `memory.jsonl`
|
|
204
|
-
|
|
205
|
-
✅ **Configuration Flexibility**
|
|
206
|
-
- Three-layer configuration (flags > env > defaults)
|
|
207
|
-
- All settings available as both flags and environment variables
|
|
208
|
-
|
|
209
|
-
✅ **Docker Parity**
|
|
210
|
-
- Docker mode produces identical user experience to local mode
|
|
211
|
-
- Volume mounting correctly maps host file into container
|
|
212
|
-
- Environment variables pass through to container
|
|
213
|
-
|
|
214
|
-
✅ **Graceful Lifecycle**
|
|
215
|
-
- Auto-open browser after startup delay
|
|
216
|
-
- SIGINT terminates child process cleanly
|
|
217
|
-
- Docker `--rm` flag cleans up containers
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## 🔗 Related Components
|
|
222
|
-
|
|
223
|
-
- [api-mcp-interface.spec.md](./api-mcp-interface.spec.md) — API routes served by the server CLI starts
|
|
224
|
-
- [app.spec.md](./app.spec.md) — full application that CLI launches
|