coaia-visualizer 1.6.3 → 1.6.5
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/Dockerfile +61 -0
- package/Dockerfile.app +50 -0
- package/README.md +2 -1
- package/cli.ts +11 -5
- package/components/asterion-foundation-card.tsx +175 -0
- package/components/asterion-session-context-badge.tsx +122 -0
- package/components/asterion-session-lineage-card.tsx +119 -0
- package/components/chart-detail-editable.tsx +2 -0
- package/components/chart-detail.tsx +9 -1
- package/components/edit-action-step.tsx +2 -0
- package/components/github-provenance.tsx +226 -0
- package/components/metadata-projections.tsx +50 -16
- package/components/narrative-beats.tsx +16 -3
- package/components/relation-graph.tsx +91 -27
- package/dist/cli.js +9 -5
- package/docker-build-push.sh +20 -0
- package/docker-entrypoint.sh +27 -0
- package/index.tsx +39 -2
- package/lib/asterion-metadata.ts +673 -0
- package/lib/chart-editor.ts +8 -3
- package/lib/github-provenance.ts +316 -0
- package/lib/jsonl-parser.ts +7 -2
- package/lib/types.ts +112 -2
- package/mcp/test_mcp/.gemini/settings.json +18 -0
- package/next-env.d.ts +1 -1
- package/package.json +14 -13
- package/rispecs/README.md +170 -0
- package/rispecs/accountability-responsibility.rispec.md +110 -0
- package/rispecs/api-mcp-interface.spec.md +287 -0
- package/rispecs/app.spec.md +364 -0
- package/rispecs/chart-editing-workflow.spec.md +297 -0
- package/rispecs/chart-visualization-hierarchy.spec.md +235 -0
- package/rispecs/cli-mode.spec.md +224 -0
- package/rispecs/github-project-runtime-memory-integration.spec.md +381 -0
- package/rispecs/jsonl-parsing-data-types.spec.md +243 -0
- package/rispecs/narrative-beats-display.spec.md +189 -0
- package/rispecs/pde-integration.spec.md +280 -0
- package/rispecs/planning-integration.spec.md +329 -0
- package/rispecs/relation-graph-visualization.spec.md +171 -0
- package/rispecs/relation-to-mcp-structural-thinking.kin.md +65 -0
- package/rispecs/ui-component-library.spec.md +258 -0
- package/mcp/dist/api-client.d.ts +0 -138
- package/mcp/dist/api-client.d.ts.map +0 -1
- package/mcp/dist/api-client.js +0 -115
- package/mcp/dist/api-client.js.map +0 -1
- package/mcp/dist/index.d.ts +0 -2
- package/mcp/dist/index.d.ts.map +0 -1
- package/mcp/dist/index.js +0 -286
- package/mcp/dist/index.js.map +0 -1
- package/mcp/dist/tools/index.d.ts +0 -18
- package/mcp/dist/tools/index.d.ts.map +0 -1
- package/mcp/dist/tools/index.js +0 -322
- package/mcp/dist/tools/index.js.map +0 -1
- package/mcp/package-lock.json +0 -210
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# COAIA Visualizer — Application Specification
|
|
2
|
+
## RISE Specification for the Complete Application
|
|
3
|
+
|
|
4
|
+
> Interactive web-based visualizer and editor that transforms coaia-narrative JSONL memory files into navigable structural tension chart hierarchies with full editing, API access, and AI agent integration.
|
|
5
|
+
|
|
6
|
+
**Document Version**: 1.0
|
|
7
|
+
**Framework**: RISE
|
|
8
|
+
**Component**: Application Root
|
|
9
|
+
**Target Audience**: LLM agents rebuilding or extending the visualizer, developers contributing to coaia-visualizer
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🎯 OVERVIEW: What COAIA Visualizer Enables Users to Create
|
|
14
|
+
|
|
15
|
+
COAIA Visualizer enables users to **create living, interactive maps of structural tension** — making visible the creative gap between Current Reality and Desired Outcome across any number of interconnected charts.
|
|
16
|
+
|
|
17
|
+
Users can:
|
|
18
|
+
- **Upload JSONL memory files** and see them transformed into hierarchical chart structures
|
|
19
|
+
- **Navigate structural tension charts** with telescoped sub-charts that fractal into deeper detail
|
|
20
|
+
- **Edit desired outcomes, current reality observations, and action steps** directly in the UI
|
|
21
|
+
- **Track creative advancement** through action completion, progress observations, and due dates
|
|
22
|
+
- **View narrative beats** that document the story of structural work across multi-universe perspectives
|
|
23
|
+
- **Explore relations** between charts, outcomes, realities, and actions
|
|
24
|
+
- **Access all capabilities programmatically** via REST API and MCP server for AI agent workflows
|
|
25
|
+
- **Deploy anywhere** via CLI, Docker, or Vercel
|
|
26
|
+
|
|
27
|
+
This is **not** a project management tool or issue tracker. It is a **ceremonial instrument** for practitioners of structural tension — Robert Fritz's creative orientation methodology — who need to see, hold, and advance the tension between what is and what they want to create.
|
|
28
|
+
|
|
29
|
+
### Distinction from Traditional Tools
|
|
30
|
+
|
|
31
|
+
| Traditional Dashboard | COAIA Visualizer |
|
|
32
|
+
|:---|:---|
|
|
33
|
+
| Tracks problems to solve | Holds tension between reality and vision |
|
|
34
|
+
| Status: open/closed/blocked | Status: advancing toward desired outcome |
|
|
35
|
+
| Hierarchy = organizational breakdown | Hierarchy = telescoped depth of inquiry |
|
|
36
|
+
| Completion = problem eliminated | Completion = structural tension resolved through creation |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📊 CORE FUNCTIONAL COMPONENTS
|
|
41
|
+
|
|
42
|
+
### 1. JSONL Parsing & Data Types Engine
|
|
43
|
+
**Purpose**: Transform flat JSONL lines into structured chart hierarchies
|
|
44
|
+
**Spec File**: [jsonl-parsing-data-types.spec.md](./jsonl-parsing-data-types.spec.md)
|
|
45
|
+
|
|
46
|
+
**What It Enables Users to Create**: Structured knowledge graphs from raw text memory files
|
|
47
|
+
**Natural Progression**:
|
|
48
|
+
1. User provides JSONL content (file upload, API, or filesystem)
|
|
49
|
+
2. `parseJSONL()` splits lines and parses JSON records
|
|
50
|
+
3. `organizeData()` runs 4-pass algorithm: separate → assemble → populate → hierarchy
|
|
51
|
+
4. Chart objects emerge with desired outcomes, current realities, actions, narrative beats
|
|
52
|
+
5. Telescoped sub-charts are recognized and linked to parent charts
|
|
53
|
+
6. Root charts (level 0) are identified for top-level navigation
|
|
54
|
+
|
|
55
|
+
**Key Structural Dynamics**:
|
|
56
|
+
- Entity/Relation model: EntityRecord (5 entity types) + RelationRecord (4 relation types)
|
|
57
|
+
- Chart assembly from entity name patterns: `chart_N_desired_outcome`, `chart_N_current_reality`
|
|
58
|
+
- Hierarchical linking via metadata.parentChart and level fields
|
|
59
|
+
- Resilient parsing: malformed lines silently skipped
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### 2. Chart Visualization & Hierarchy
|
|
64
|
+
**Purpose**: Render structural tension charts in navigable hierarchy and list views
|
|
65
|
+
**Spec File**: [chart-visualization-hierarchy.spec.md](./chart-visualization-hierarchy.spec.md)
|
|
66
|
+
|
|
67
|
+
**What It Enables Users to Create**: Visual maps of structural tension at any depth
|
|
68
|
+
**Natural Progression**:
|
|
69
|
+
1. ChartList renders root charts in hierarchy (tree) or flat list mode
|
|
70
|
+
2. Each chart shows summary, progress bar, level badge, narrative beat indicators
|
|
71
|
+
3. User selects a chart → ChartDetail or ChartDetailEditable appears
|
|
72
|
+
4. Detail view shows desired outcome, current reality, actions, beats, relations
|
|
73
|
+
5. User clicks telescope icon → navigates to sub-chart with back-button stack
|
|
74
|
+
6. Breadcrumb-style navigation maintains context across depth levels
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### 3. Chart Editing Workflow
|
|
79
|
+
**Purpose**: Enable direct manipulation of structural tension chart data
|
|
80
|
+
**Spec File**: [chart-editing-workflow.spec.md](./chart-editing-workflow.spec.md)
|
|
81
|
+
|
|
82
|
+
**What It Enables Users to Create**: Updated charts reflecting creative advancement
|
|
83
|
+
**Natural Progression**:
|
|
84
|
+
1. User hovers over desired outcome → edit button appears → click to edit
|
|
85
|
+
2. User modifies text → saves → ChartEditor applies mutation
|
|
86
|
+
3. Current reality observations can be added, edited, or removed individually
|
|
87
|
+
4. Action steps support add, edit, complete, toggle, delete, and date changes
|
|
88
|
+
5. Actions can telescope into full sub-charts (creating new chart hierarchies)
|
|
89
|
+
6. New master charts can be created via dialog form or inline create form
|
|
90
|
+
7. All changes tracked as unsaved until explicit save to filesystem/API
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 4. REST API & MCP Interface
|
|
95
|
+
**Purpose**: Provide programmatic access for AI agents and external tools
|
|
96
|
+
**Spec File**: [api-mcp-interface.spec.md](./api-mcp-interface.spec.md)
|
|
97
|
+
|
|
98
|
+
**What It Enables Users to Create**: AI-augmented structural tension workflows
|
|
99
|
+
**Key Structural Dynamics**:
|
|
100
|
+
- 6 REST API route groups: charts CRUD, search, JSONL I/O, watch, audio
|
|
101
|
+
- 15 MCP tools mapped 1:1 to chart operations
|
|
102
|
+
- Bearer token authentication via COAIAN_API_TOKEN
|
|
103
|
+
- Backup creation before every write operation
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### 5. CLI & Deployment
|
|
108
|
+
**Purpose**: Launch the visualizer from terminal with filesystem paths
|
|
109
|
+
**Spec File**: [cli-mode.spec.md](./cli-mode.spec.md)
|
|
110
|
+
|
|
111
|
+
**What It Enables Users to Create**: Instant visualization of any local memory file
|
|
112
|
+
**Key Structural Dynamics**:
|
|
113
|
+
- `coaia-visualizer --memory-path ./memory.jsonl` launches the full app
|
|
114
|
+
- Docker mode for containerized deployment
|
|
115
|
+
- Environment variable configuration for all settings
|
|
116
|
+
- Auto-open browser with graceful shutdown
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### 6. Narrative Beats Display
|
|
121
|
+
**Purpose**: Render the story layer of structural tension work
|
|
122
|
+
**Spec File**: [narrative-beats-display.spec.md](./narrative-beats-display.spec.md)
|
|
123
|
+
|
|
124
|
+
**What It Enables Users to Create**: Visible narrative context for structural work
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### 7. Relation Graph Visualization
|
|
129
|
+
**Purpose**: Display inter-entity connections
|
|
130
|
+
**Spec File**: [relation-graph-visualization.spec.md](./relation-graph-visualization.spec.md)
|
|
131
|
+
|
|
132
|
+
**What It Enables Users to Create**: Maps of kinship between charts, outcomes, and actions
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### 8. UI Component Library
|
|
137
|
+
**Purpose**: Provide consistent, themed UI primitives
|
|
138
|
+
**Spec File**: [ui-component-library.spec.md](./ui-component-library.spec.md)
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 🔧 HOW COMPONENTS INTERCONNECT
|
|
143
|
+
|
|
144
|
+
### Data Flow Architecture
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
┌──────────────────────┐
|
|
148
|
+
│ JSONL Source │
|
|
149
|
+
│ (File / API / CLI) │
|
|
150
|
+
└──────────┬───────────┘
|
|
151
|
+
│
|
|
152
|
+
┌──────────▼───────────┐
|
|
153
|
+
│ parseJSONL() │
|
|
154
|
+
│ organizeData() │
|
|
155
|
+
│ → ParsedData │
|
|
156
|
+
└──────────┬───────────┘
|
|
157
|
+
│
|
|
158
|
+
┌────────────────┼────────────────┐
|
|
159
|
+
│ │ │
|
|
160
|
+
┌────────▼────┐ ┌───────▼──────┐ ┌──────▼──────┐
|
|
161
|
+
│ ChartList │ │ ChartDetail │ │ DataStats │
|
|
162
|
+
│ (navigate) │ │ (view/edit) │ │ (summary) │
|
|
163
|
+
└─────────────┘ └──────┬───────┘ └─────────────┘
|
|
164
|
+
│
|
|
165
|
+
┌─────────────────┼───────────────────┐
|
|
166
|
+
│ │ │
|
|
167
|
+
┌───────▼───────┐ ┌──────▼──────┐ ┌─────────▼─────────┐
|
|
168
|
+
│ Edit* │ │ Narrative │ │ RelationGraph │
|
|
169
|
+
│ Components │ │ Beats │ │ (connections) │
|
|
170
|
+
└───────┬───────┘ └─────────────┘ └───────────────────┘
|
|
171
|
+
│
|
|
172
|
+
┌───────▼───────┐
|
|
173
|
+
│ ChartEditor │
|
|
174
|
+
│ (mutations) │
|
|
175
|
+
└───────┬───────┘
|
|
176
|
+
│
|
|
177
|
+
┌───────▼───────┐ ┌────────────────┐
|
|
178
|
+
│ exportToJSONL │────▶│ POST /api/jsonl│
|
|
179
|
+
└───────────────┘ └────────────────┘
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Structural Advancement Pattern
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
Upload JSONL → Parse → Organize → Display Charts
|
|
186
|
+
│ │
|
|
187
|
+
│ User Selects Chart
|
|
188
|
+
│ │
|
|
189
|
+
│ View Structural Tension
|
|
190
|
+
│ (Desired Outcome ↔ Current Reality)
|
|
191
|
+
│ │
|
|
192
|
+
│ Edit / Add Actions / Telescope
|
|
193
|
+
│ │
|
|
194
|
+
│ ChartEditor Mutates Entities
|
|
195
|
+
│ │
|
|
196
|
+
│ Mark Actions Complete
|
|
197
|
+
│ (auto-updates parent reality)
|
|
198
|
+
│ │
|
|
199
|
+
└──── Save to JSONL ◀───────── Export Changes
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 🎯 CREATIVE ADVANCEMENT SCENARIOS
|
|
205
|
+
|
|
206
|
+
### Scenario 1: First-Time Visualization
|
|
207
|
+
**User Intent**: See my coaia-narrative memory file as interactive charts
|
|
208
|
+
**Current Structural Reality**: Raw JSONL file with hundreds of lines, no visual structure
|
|
209
|
+
**Natural Progression**:
|
|
210
|
+
1. User opens coaia-visualizer in browser
|
|
211
|
+
2. Uploads `.jsonl` file via drag-drop or file picker
|
|
212
|
+
3. parseJSONL processes all lines, skipping malformed entries
|
|
213
|
+
4. organizeData assembles charts with telescoped hierarchy
|
|
214
|
+
5. ChartList shows root charts with summaries and progress bars
|
|
215
|
+
6. User selects first chart → sees desired outcome, current reality, actions
|
|
216
|
+
7. DataStats shows total charts, actions completed/total, entities, relations
|
|
217
|
+
**Supporting Features**: FileUpload (drag-drop), organizeData (4-pass), DataStats (summary cards)
|
|
218
|
+
|
|
219
|
+
### Scenario 2: Advancing Through Structural Tension
|
|
220
|
+
**User Intent**: Update my charts to reflect creative progress
|
|
221
|
+
**Current Structural Reality**: Charts exist but reality observations are outdated
|
|
222
|
+
**Natural Progression**:
|
|
223
|
+
1. User selects chart from hierarchy view
|
|
224
|
+
2. Hovers over current reality section → edit buttons appear
|
|
225
|
+
3. Adds new observation: "Completed initial prototype"
|
|
226
|
+
4. Marks action step as complete → parent current reality auto-updates
|
|
227
|
+
5. Creates new action step with specific current reality assessment
|
|
228
|
+
6. Telescopes complex action into sub-chart for detailed tracking
|
|
229
|
+
7. Saves all changes → backup created → JSONL persisted
|
|
230
|
+
**Supporting Features**: EditCurrentReality, EditActionStep, ChartEditor (mutations), API backup
|
|
231
|
+
|
|
232
|
+
### Scenario 3: AI Agent Workflow
|
|
233
|
+
**User Intent**: Let my AI agent manage structural tension charts programmatically
|
|
234
|
+
**Current Structural Reality**: Charts exist in JSONL but agent has no access
|
|
235
|
+
**Natural Progression**:
|
|
236
|
+
1. Start visualizer with `--memory-path` and `COAIAN_API_TOKEN`
|
|
237
|
+
2. Configure Claude Desktop with MCP server connection
|
|
238
|
+
3. Agent calls `list_charts` to survey existing charts
|
|
239
|
+
4. Agent calls `create_chart` with desired outcome and current reality
|
|
240
|
+
5. Agent calls `add_action_step` to create telescoped sub-charts
|
|
241
|
+
6. Agent calls `mark_action_complete` as work progresses
|
|
242
|
+
7. Agent calls `get_chart_progress` to assess advancement
|
|
243
|
+
**Supporting Features**: MCP server (15 tools), REST API, Bearer token auth
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 📋 Page State Management
|
|
248
|
+
|
|
249
|
+
The main page (`app/page.tsx`) serves as the primary orchestrator, managing all application state through React hooks:
|
|
250
|
+
|
|
251
|
+
### useState Hooks (7)
|
|
252
|
+
```typescript
|
|
253
|
+
const [data, setData] = useState<ParsedData | null>(null) // Parsed chart data
|
|
254
|
+
const [selectedChart, setSelectedChart] = useState<Chart | null>(null) // Currently viewed chart
|
|
255
|
+
const [chartNavigationStack, setChartNavigationStack] = useState<Chart[]>([]) // Back-nav stack
|
|
256
|
+
const [viewMode, setViewMode] = useState<"hierarchy" | "list">("hierarchy") // List display mode
|
|
257
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false) // Dirty flag for save prompt
|
|
258
|
+
const [activeTab, setActiveTab] = useState<string>("upload") // Upload/Create tab toggle
|
|
259
|
+
const [isLive, setIsLive] = useState(false) // Live polling flash state
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Auto-Load Behavior
|
|
263
|
+
On mount, the page checks for server-side JSONL data availability:
|
|
264
|
+
1. Fetches `/api/jsonl` to check if a memory file is configured
|
|
265
|
+
2. If content is returned → parses and sets data automatically (no upload needed)
|
|
266
|
+
3. If no content → shows Upload/Create tab interface
|
|
267
|
+
4. This enables the CLI `--memory-path` workflow to display charts immediately
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## 🛠️ IMPLEMENTATION REQUIREMENTS
|
|
272
|
+
|
|
273
|
+
### Technology Stack
|
|
274
|
+
- **Runtime**: Next.js 16.0.10 + React 19.2.0 + TypeScript
|
|
275
|
+
- **Styling**: Tailwind CSS 4.1.9 with dark/light theme via next-themes
|
|
276
|
+
- **UI Primitives**: Radix UI (20+ components) with shadcn patterns
|
|
277
|
+
- **Charts**: recharts 2.15.4
|
|
278
|
+
- **Forms**: react-hook-form + zod 3.25.76 validation
|
|
279
|
+
- **Icons**: lucide-react
|
|
280
|
+
- **Toast**: sonner
|
|
281
|
+
- **MCP**: @modelcontextprotocol/sdk 1.25.2
|
|
282
|
+
- **Deployment**: Vercel, Docker (node:22-alpine), CLI (npm global)
|
|
283
|
+
|
|
284
|
+
### Core Data Structures
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
interface EntityRecord {
|
|
288
|
+
type: "entity"
|
|
289
|
+
name: string
|
|
290
|
+
entityType: "structural_tension_chart" | "desired_outcome" |
|
|
291
|
+
"current_reality" | "action_step" | "narrative_beat"
|
|
292
|
+
observations: string[]
|
|
293
|
+
metadata: Record<string, any>
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
interface RelationRecord {
|
|
297
|
+
type: "relation"
|
|
298
|
+
from: string
|
|
299
|
+
to: string
|
|
300
|
+
relationType: "contains" | "creates_tension_with" |
|
|
301
|
+
"advances_toward" | "documents"
|
|
302
|
+
metadata: Record<string, any>
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
interface Chart {
|
|
306
|
+
id: string
|
|
307
|
+
chartEntity: EntityRecord
|
|
308
|
+
desiredOutcome?: EntityRecord
|
|
309
|
+
currentReality?: EntityRecord
|
|
310
|
+
actions: EntityRecord[]
|
|
311
|
+
narrativeBeats: EntityRecord[]
|
|
312
|
+
subCharts: Chart[]
|
|
313
|
+
level: number
|
|
314
|
+
parentChart?: string
|
|
315
|
+
relations: RelationRecord[]
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
interface ParsedData {
|
|
319
|
+
charts: Chart[]
|
|
320
|
+
entities: Map<string, EntityRecord>
|
|
321
|
+
relations: RelationRecord[]
|
|
322
|
+
rootCharts: Chart[]
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## ✅ QUALITY CRITERIA FOR IMPLEMENTATION
|
|
329
|
+
|
|
330
|
+
✅ **Structural Tension Preserved**
|
|
331
|
+
- Every chart displays the tension between desired outcome and current reality
|
|
332
|
+
- Creative language maintained throughout (create, build, establish — never fix, solve, eliminate)
|
|
333
|
+
- Action completion advances parent current reality automatically
|
|
334
|
+
|
|
335
|
+
✅ **Navigation Integrity**
|
|
336
|
+
- Telescoped hierarchies navigate correctly with back-button stack
|
|
337
|
+
- Sub-charts link bidirectionally to parents
|
|
338
|
+
- Root charts always accessible from top-level list
|
|
339
|
+
|
|
340
|
+
✅ **Data Fidelity**
|
|
341
|
+
- JSONL round-trip: upload → edit → export produces valid JSONL
|
|
342
|
+
- Malformed lines silently skipped, never corrupt valid data
|
|
343
|
+
- Backup created before every write operation
|
|
344
|
+
|
|
345
|
+
✅ **Agent Accessibility**
|
|
346
|
+
- All 15 MCP tools produce consistent JSON responses
|
|
347
|
+
- REST API returns proper HTTP status codes with error messages
|
|
348
|
+
- Token authentication protects all mutating endpoints
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## 🔗 Component Specification Files
|
|
353
|
+
|
|
354
|
+
| Spec File | Focus |
|
|
355
|
+
|:---|:---|
|
|
356
|
+
| [jsonl-parsing-data-types.spec.md](./jsonl-parsing-data-types.spec.md) | Parsing, types, data organization |
|
|
357
|
+
| [chart-visualization-hierarchy.spec.md](./chart-visualization-hierarchy.spec.md) | Chart display and navigation |
|
|
358
|
+
| [chart-editing-workflow.spec.md](./chart-editing-workflow.spec.md) | Edit operations and ChartEditor |
|
|
359
|
+
| [api-mcp-interface.spec.md](./api-mcp-interface.spec.md) | REST API and MCP server |
|
|
360
|
+
| [cli-mode.spec.md](./cli-mode.spec.md) | CLI launcher and Docker |
|
|
361
|
+
| [narrative-beats-display.spec.md](./narrative-beats-display.spec.md) | Narrative beat rendering |
|
|
362
|
+
| [relation-graph-visualization.spec.md](./relation-graph-visualization.spec.md) | Entity relation graphs |
|
|
363
|
+
| [ui-component-library.spec.md](./ui-component-library.spec.md) | UI primitives and theming |
|
|
364
|
+
| [accountability-responsibility.rispec.md](./accountability-responsibility.rispec.md) | Accountability/responsibility visual distinction |
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Chart Editing Workflow
|
|
2
|
+
## RISE Specification for Chart Mutations, Edit Components, and Creation Flows
|
|
3
|
+
|
|
4
|
+
**Component Purpose**: Enable direct manipulation of structural tension chart data — editing desired outcomes, current reality observations, action steps, due dates, and chart creation — all through a consistent ChartEditor mutation pattern.
|
|
5
|
+
|
|
6
|
+
**Source Files**: `lib/chart-editor.ts`, `components/edit-desired-outcome.tsx`, `components/edit-current-reality.tsx`, `components/edit-action-step.tsx`, `components/edit-chart-due-date.tsx`, `components/add-action-step.tsx`, `components/add-master-chart.tsx`, `components/create-chart-form.tsx`
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🎯 What This Component Enables Users to Create
|
|
11
|
+
|
|
12
|
+
- Updated desired outcomes reflecting refined creative vision
|
|
13
|
+
- New current reality observations documenting honest assessment of what is
|
|
14
|
+
- Action steps that advance toward desired outcomes
|
|
15
|
+
- Telescoped sub-charts from action steps for deeper structural exploration
|
|
16
|
+
- New master charts establishing fresh structural tension
|
|
17
|
+
- Due date targets for charts and individual action steps
|
|
18
|
+
- Completion tracking that automatically updates parent chart reality
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🌊 Structural Tension Dynamics
|
|
23
|
+
|
|
24
|
+
### Current Reality
|
|
25
|
+
JSONL files are flat text. Editing means manipulating entity records, maintaining referential integrity across relations, auto-incrementing chart IDs, and propagating completion status to parent charts. All mutations must be serializable back to valid JSONL.
|
|
26
|
+
|
|
27
|
+
### Desired Result
|
|
28
|
+
A unified editing experience where every structural tension element can be modified inline, with changes flowing through a single `ChartEditor` class that guarantees:
|
|
29
|
+
- Entity integrity (names, types, references preserved)
|
|
30
|
+
- Relation consistency (no orphaned references)
|
|
31
|
+
- Automatic side-effects (completion updates parent reality)
|
|
32
|
+
- Timestamp tracking on every mutation
|
|
33
|
+
- Serializable output for persistence
|
|
34
|
+
|
|
35
|
+
### Natural Resolution
|
|
36
|
+
The `ChartEditor` class encapsulates all mutation logic. Edit components provide UI for specific operations and delegate to ChartEditor via the `applyEdit()` pattern in `ChartDetailEditable`.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📋 ChartEditor Class
|
|
41
|
+
|
|
42
|
+
### Constructor
|
|
43
|
+
```typescript
|
|
44
|
+
constructor(parsedData: ParsedData)
|
|
45
|
+
```
|
|
46
|
+
Creates a new Map from entities and a new array from relations (SHALLOW copies — entity objects are shared references). Mutations to entity properties (observations, metadata) will affect the original ParsedData. This is a known design trade-off.
|
|
47
|
+
|
|
48
|
+
### ChartUpdate Interface
|
|
49
|
+
```typescript
|
|
50
|
+
interface ChartUpdate {
|
|
51
|
+
type: "update_desired_outcome" | "update_current_reality" | "add_observation"
|
|
52
|
+
| "update_action" | "add_action" | "delete_action"
|
|
53
|
+
| "toggle_action_completion" | "update_due_date" | "update_action_due_date"
|
|
54
|
+
chartId: string
|
|
55
|
+
data: any
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Mutation Methods
|
|
60
|
+
|
|
61
|
+
| Method | Signature | Side Effects |
|
|
62
|
+
|:---|:---|:---|
|
|
63
|
+
| `updateDesiredOutcome` | `(chartId, newText)` | Replaces observations[0], sets updatedAt |
|
|
64
|
+
| `addCurrentRealityObservation` | `(chartId, observation)` | Pushes to observations[], sets updatedAt |
|
|
65
|
+
| `updateCurrentReality` | `(chartId, newObservations[])` | Deduplicates and merges, sets updatedAt |
|
|
66
|
+
| `updateCurrentRealityObservation` | `(chartId, index, newText)` | Updates specific observation at index |
|
|
67
|
+
| `deleteCurrentRealityObservation` | `(chartId, index)` | Removes observation at index |
|
|
68
|
+
| `addActionStep` | `(parentChartId, title, reality, dueDate?)` | **Creates new telescoped chart** with desired_outcome, current_reality, 4 relations. Uses `chart.chartEntity.name` to find the parent chart entity. Auto-calculates dueDate as midpoint between now and parent dueDate |
|
|
69
|
+
| `updateActionStep` | `(chartId, actionName, description)` | Updates action observations |
|
|
70
|
+
| `markActionStepComplete` | `(actionStepName)` | Sets completionStatus=true, appends "Completed: ..." to parent current_reality |
|
|
71
|
+
| `updateActionProgress` | `(actionStepName, observation, updateReality?)` | Appends to action observations, optionally updates parent current_reality with "Progress on ..." |
|
|
72
|
+
| `toggleActionCompletion` | `(actionName)` | Toggles completionStatus, sets/deletes completedAt |
|
|
73
|
+
| `updateActionDueDate` | `(actionName, dueDate)` | Updates action entity dueDate metadata. **Note**: Only operates on entities with entityType `action_step`. |
|
|
74
|
+
| `deleteActionStep` | `(actionName)` | Removes entity and all connected relations |
|
|
75
|
+
| `createTelescopedChartFromAction` | `(parentChartId, actionName)` | Converts existing action to full sub-chart, marks original with isTelescopedChart flag. Default current reality: `"Starting work on this action step"` |
|
|
76
|
+
| `updateChartDueDate` | `(chartId, dueDate)` | Updates chart entity dueDate metadata |
|
|
77
|
+
|
|
78
|
+
### Output Methods
|
|
79
|
+
|
|
80
|
+
| Method | Returns | Purpose |
|
|
81
|
+
|:---|:---|:---|
|
|
82
|
+
| `exportToJSONL()` | `string` | Serializes all entities then relations as JSONL |
|
|
83
|
+
| `getUpdatedData()` | `ParsedData` | Rebuilds ParsedData from current entities/relations |
|
|
84
|
+
|
|
85
|
+
### Entity Naming Convention
|
|
86
|
+
All entities follow the pattern: `{chartId}_{entityType}`
|
|
87
|
+
- `chart_1_desired_outcome`
|
|
88
|
+
- `chart_1_current_reality`
|
|
89
|
+
- `chart_1_action_1`, `chart_1_action_2`, etc.
|
|
90
|
+
|
|
91
|
+
### Chart ID Auto-Increment
|
|
92
|
+
```
|
|
93
|
+
Find max N from all existing chart_N entities
|
|
94
|
+
New chart ID = chart_(N+1)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Timestamp Convention
|
|
98
|
+
All mutations set `metadata.updatedAt = new Date().toISOString()` (ISO 8601)
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 📋 Edit Components
|
|
103
|
+
|
|
104
|
+
### EditDesiredOutcome
|
|
105
|
+
```
|
|
106
|
+
┌────────────────────────────────────────┐
|
|
107
|
+
│ ✦ Desired Outcome [✏️ hover] │
|
|
108
|
+
│ │
|
|
109
|
+
│ "Build a structural tension visualizer │
|
|
110
|
+
│ that makes creative advancement │
|
|
111
|
+
│ visible and navigable" │
|
|
112
|
+
│ │
|
|
113
|
+
└────────────────────────────────────────┘
|
|
114
|
+
```
|
|
115
|
+
- **Display mode**: Teal-colored box with observation text and hover-triggered pencil icon
|
|
116
|
+
- **Edit mode**: Textarea with Save/Cancel buttons
|
|
117
|
+
- **Validation**: Non-empty text required
|
|
118
|
+
- **Callback**: `onSave(newText: string)`
|
|
119
|
+
|
|
120
|
+
### EditCurrentReality
|
|
121
|
+
```
|
|
122
|
+
┌────────────────────────────────────────┐
|
|
123
|
+
│ ◈ Current Reality │
|
|
124
|
+
│ │
|
|
125
|
+
│ • "JSONL parser handles all 5 entity │
|
|
126
|
+
│ types correctly" [✏️] [🗑️] │
|
|
127
|
+
│ │
|
|
128
|
+
│ • "Chart hierarchy displays 3 levels │
|
|
129
|
+
│ but navigation stack incomplete" │
|
|
130
|
+
│ [✏️] [🗑️] │
|
|
131
|
+
│ │
|
|
132
|
+
│ [+ Add Observation] │
|
|
133
|
+
└────────────────────────────────────────┘
|
|
134
|
+
```
|
|
135
|
+
- **Display mode**: List of observations in amber-colored boxes, each with hover edit/delete icons
|
|
136
|
+
- **Edit mode**: Per-observation textarea with Save/Cancel
|
|
137
|
+
- **Add mode**: Separate textarea for new observations
|
|
138
|
+
- **Callbacks**: `onUpdate(index, newText)`, `onAdd(observation)`, `onDelete(index)`
|
|
139
|
+
|
|
140
|
+
### EditActionStep
|
|
141
|
+
```
|
|
142
|
+
┌──────────────────────────────────────────────────────┐
|
|
143
|
+
│ [○] [🔭] 1. Design entity type system [✏️] [📅] [🗑️] │
|
|
144
|
+
│ (hover toolbar) │
|
|
145
|
+
│ Due: 2024-03-15 │
|
|
146
|
+
│ │
|
|
147
|
+
│ [✓] [🔭→] 2. Implement parsing (chart_4) ✦ Telescoped │
|
|
148
|
+
│ Due: 2024-03-20 ✓ Completed │
|
|
149
|
+
└───────────────────────────────────────────────────────────┘
|
|
150
|
+
```
|
|
151
|
+
- **Completion toggle**: Circle (incomplete) / Check (complete) button on left
|
|
152
|
+
- **Telescope button**: Creates or navigates to sub-chart
|
|
153
|
+
- Gradient background if already telescoped
|
|
154
|
+
- Different icon states for "create" vs "navigate"
|
|
155
|
+
- **Hover toolbar**: Edit, Date picker, Delete buttons appear on hover
|
|
156
|
+
- **Edit mode**: Textarea with Save/Cancel for description
|
|
157
|
+
- **Date picker**: Calendar popover with clear option
|
|
158
|
+
- **Callbacks**: `onUpdate`, `onToggleComplete`, `onMarkComplete`, `onUpdateDueDate`, `onDelete`, `onNavigateToChart`, `onCreateTelescopedChart`
|
|
159
|
+
|
|
160
|
+
### EditChartDueDate
|
|
161
|
+
- Popover trigger showing current date or "Set due date"
|
|
162
|
+
- Calendar picker with clear button
|
|
163
|
+
- **Callback**: `onUpdate(date: string | null)`
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 📋 Creation Components
|
|
168
|
+
|
|
169
|
+
### AddActionStep
|
|
170
|
+
```
|
|
171
|
+
[+ Add Action Step] ← collapsed state
|
|
172
|
+
|
|
173
|
+
┌────────────────────────────────┐
|
|
174
|
+
│ Action Title * │
|
|
175
|
+
│ ┌────────────────────────────┐ │
|
|
176
|
+
│ │ │ │
|
|
177
|
+
│ └────────────────────────────┘ │
|
|
178
|
+
│ │
|
|
179
|
+
│ Current Reality * │
|
|
180
|
+
│ ┌────────────────────────────┐ │
|
|
181
|
+
│ │ Honest assessment of where │ │
|
|
182
|
+
│ │ this action starts from │ │
|
|
183
|
+
│ └────────────────────────────┘ │
|
|
184
|
+
│ │
|
|
185
|
+
│ Due Date (optional) │
|
|
186
|
+
│ [📅 Pick date] │
|
|
187
|
+
│ │
|
|
188
|
+
│ [Save] [Cancel] │
|
|
189
|
+
└────────────────────────────────┘
|
|
190
|
+
```
|
|
191
|
+
- Collapsible: button toggles to form
|
|
192
|
+
- **Required**: Action title + Current reality (creative orientation enforced)
|
|
193
|
+
- **Optional**: Due date via calendar popover
|
|
194
|
+
- Calls `ChartEditor.addActionStep()` which creates a full telescoped sub-chart
|
|
195
|
+
|
|
196
|
+
### AddMasterChart (Dialog)
|
|
197
|
+
- Plus icon button triggers dialog
|
|
198
|
+
- Fields: Desired Outcome (textarea), Current Reality Observations (multiple textareas with add/remove), Due Date (date input)
|
|
199
|
+
- Creates 3 entities (chart, desired_outcome, current_reality) and 3 relations
|
|
200
|
+
- Generates next chart_N ID automatically
|
|
201
|
+
|
|
202
|
+
### CreateChartForm (Inline)
|
|
203
|
+
- Card-based form embedded in the main page's "Create" tab
|
|
204
|
+
- Same fields as AddMasterChart but inline instead of dialog
|
|
205
|
+
- Creates complete ParsedData structure for new chart
|
|
206
|
+
- Validates required fields (desired outcome + at least one observation)
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 📋 Edit Flow Integration
|
|
211
|
+
|
|
212
|
+
### applyEdit Pattern (in ChartDetailEditable)
|
|
213
|
+
```typescript
|
|
214
|
+
function applyEdit(editFn: (editor: ChartEditor) => void) {
|
|
215
|
+
const editor = new ChartEditor(data) // Clone current state
|
|
216
|
+
editFn(editor) // Apply mutation
|
|
217
|
+
const updatedData = editor.getUpdatedData() // Rebuild ParsedData
|
|
218
|
+
onUpdate(updatedData) // Propagate to parent
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Parent State Management (in Page)
|
|
223
|
+
```typescript
|
|
224
|
+
handleDataUpdate(updatedData: ParsedData):
|
|
225
|
+
1. Set data = updatedData
|
|
226
|
+
2. Set hasUnsavedChanges = true
|
|
227
|
+
3. Find selectedChart in updated data (maintain selection)
|
|
228
|
+
4. Update selectedChart reference
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Save Flow
|
|
232
|
+
```
|
|
233
|
+
User clicks Save
|
|
234
|
+
→ ChartEditor.exportToJSONL() produces JSONL string
|
|
235
|
+
→ POST /api/jsonl with content body
|
|
236
|
+
→ API creates timestamped backup
|
|
237
|
+
→ API writes new content to memory file
|
|
238
|
+
→ hasUnsavedChanges = false
|
|
239
|
+
→ Toast notification confirms save
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## 📋 Creative Advancement Scenario
|
|
245
|
+
|
|
246
|
+
### Scenario: Telescoping an Action Into Depth
|
|
247
|
+
**User Intent**: Break a complex action step into a full structural tension chart
|
|
248
|
+
**Current Structural Reality**: Action "Design authentication system" sits as a single line item
|
|
249
|
+
**Desired Outcome**: A sub-chart with its own desired outcome, current reality, and action steps
|
|
250
|
+
|
|
251
|
+
**Natural Progression**:
|
|
252
|
+
1. User hovers over the action → telescope icon appears
|
|
253
|
+
2. User clicks telescope → `ChartEditor.createTelescopedChartFromAction()` fires
|
|
254
|
+
3. New `chart_N` created with:
|
|
255
|
+
- level = parent.level + 1
|
|
256
|
+
- desired_outcome = action's description text
|
|
257
|
+
- current_reality = "Starting work on this action step"
|
|
258
|
+
- parentChart = parent's chart ID
|
|
259
|
+
- dueDate = midpoint between now and parent's dueDate
|
|
260
|
+
4. Original action marked with `isTelescopedChart: true` and `telescopedChartId`
|
|
261
|
+
5. New chart appears in parent's sub-charts list
|
|
262
|
+
6. UI navigates to new chart (pushed onto navigation stack)
|
|
263
|
+
7. User can now add actions, observations, and further telescope within the sub-chart
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## ✅ Quality Criteria
|
|
268
|
+
|
|
269
|
+
✅ **Mutation Integrity**
|
|
270
|
+
- ChartEditor clones data — no external state mutation
|
|
271
|
+
- Every mutation timestamps with ISO 8601 updatedAt
|
|
272
|
+
- Entity names and relation references always consistent
|
|
273
|
+
|
|
274
|
+
✅ **Completion Propagation**
|
|
275
|
+
- Marking action complete auto-updates parent current reality
|
|
276
|
+
- Completion status toggles cleanly between true/false
|
|
277
|
+
- CompletedAt timestamp set/cleared appropriately
|
|
278
|
+
|
|
279
|
+
✅ **Telescoping Correctness**
|
|
280
|
+
- New sub-charts always have level = parent.level + 1
|
|
281
|
+
- Parent-child relations created bidirectionally
|
|
282
|
+
- Original action flagged with telescoped metadata
|
|
283
|
+
- Due date auto-calculated as midpoint
|
|
284
|
+
|
|
285
|
+
✅ **Edit UX**
|
|
286
|
+
- All edit components require non-empty validation
|
|
287
|
+
- Hover-triggered toolbars prevent visual clutter
|
|
288
|
+
- Cancel always reverts to original value
|
|
289
|
+
- Add forms collapse to single button when not in use
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## 🔗 Related Components
|
|
294
|
+
|
|
295
|
+
- [jsonl-parsing-data-types.spec.md](./jsonl-parsing-data-types.spec.md) — type system consumed and produced by ChartEditor
|
|
296
|
+
- [chart-visualization-hierarchy.spec.md](./chart-visualization-hierarchy.spec.md) — display components that host edit components
|
|
297
|
+
- [api-mcp-interface.spec.md](./api-mcp-interface.spec.md) — API routes that invoke ChartEditor for server-side mutations
|