coaia-visualizer 1.6.0 → 1.6.2

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 (58) hide show
  1. package/.dockerignore +9 -0
  2. package/COMPLETE_IMPLEMENTATION_REPORT.md +215 -0
  3. package/QUICK_START_MCP_TESTING.md +236 -0
  4. package/README.md +1 -1
  5. package/README_TELESCOPED_NAVIGATION.md +247 -0
  6. package/STC.md +24 -0
  7. package/STCGOAL.md +0 -0
  8. package/STCISSUE.md +48 -0
  9. package/STCKIN.md +0 -0
  10. package/STCMASTERY.md +0 -0
  11. package/STUDY_REPORT.md +510 -0
  12. package/app/page.tsx +4 -23
  13. package/cli.ts +8 -0
  14. package/components/chart-detail-editable.tsx +3 -2
  15. package/components/chart-detail.tsx +1 -6
  16. package/components/edit-action-step.tsx +0 -2
  17. package/components/metadata-projections.tsx +208 -0
  18. package/components/relation-graph.tsx +27 -91
  19. package/components.json +21 -0
  20. package/direct-test.sh +180 -0
  21. package/dist/cli.js +7 -0
  22. package/dist/skill.js +342 -0
  23. package/docker-compose.test.yml +69 -0
  24. package/index.tsx +0 -26
  25. package/jgwill.coaia-visualizer-8--496dca71-d476-4ac9-ba9f-376add118dd8--260208.txt +2612 -0
  26. package/lib/chart-editor.ts +13 -13
  27. package/lib/jsonl-parser.ts +55 -8
  28. package/lib/jsonl-preservation.ts +405 -0
  29. package/lib/types.ts +32 -15
  30. package/mcp/dist/api-client.d.ts +138 -0
  31. package/mcp/dist/api-client.d.ts.map +1 -0
  32. package/mcp/dist/api-client.js +115 -0
  33. package/mcp/dist/api-client.js.map +1 -0
  34. package/mcp/dist/index.d.ts +2 -0
  35. package/mcp/dist/index.d.ts.map +1 -0
  36. package/mcp/dist/index.js +286 -0
  37. package/mcp/dist/index.js.map +1 -0
  38. package/mcp/dist/tools/index.d.ts +18 -0
  39. package/mcp/dist/tools/index.d.ts.map +1 -0
  40. package/mcp/dist/tools/index.js +322 -0
  41. package/mcp/dist/tools/index.js.map +1 -0
  42. package/mcp/package-lock.json +210 -0
  43. package/package.json +2 -27
  44. package/rispecs/github-project-runtime-memory-integration.spec.md +381 -0
  45. package/skill.ts +385 -0
  46. package/test-data/test-master.jsonl +11 -0
  47. package/test-results/.last-run.json +4 -0
  48. package/test-scripts/README.md +325 -0
  49. package/test-scripts/rich-jsonl-preservation.spec.ts +118 -0
  50. package/test-scripts/run-all-tests.sh +38 -0
  51. package/test-scripts/test-01-basic-operations.sh +87 -0
  52. package/test-scripts/test-02-telescope-creation.sh +91 -0
  53. package/test-scripts/test-03-navigation.sh +87 -0
  54. package/test-scripts/test-global-cli.spec.ts +220 -0
  55. package/test-scripts/verify-global-cli.sh +87 -0
  56. package/tsconfig.json +41 -0
  57. package/components/github-provenance.tsx +0 -226
  58. package/lib/github-provenance.ts +0 -316
@@ -0,0 +1,325 @@
1
+ # COAIA Visualizer MCP Testing Guide
2
+
3
+ ## Overview
4
+
5
+ This directory contains a complete Docker-based testing environment for the COAIA Visualizer MCP server. The test suite validates all MCP tools, including the telescope functionality.
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ ┌─────────────────────┐
11
+ │ Test Runner │
12
+ │ (test-scripts/) │
13
+ └──────────┬──────────┘
14
+
15
+ ├─────────────┐
16
+ │ │
17
+ ┌──────▼──────┐ ┌──▼──────────────┐
18
+ │ MCP Server │ │ Next.js App │
19
+ │ (stdio) │ │ (HTTP:4321) │
20
+ └─────────────┘ └─────────────────┘
21
+ │ │
22
+ └────────┬────────┘
23
+
24
+ ┌─────▼─────┐
25
+ │ Data │
26
+ │ (JSONL) │
27
+ └───────────┘
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ### 1. Set up environment variables (optional)
33
+
34
+ ```bash
35
+ # For Claude CLI testing
36
+ export ANTHROPIC_API_KEY="your_key_here"
37
+
38
+ # For Gemini CLI testing
39
+ export GOOGLE_API_KEY="your_key_here"
40
+ ```
41
+
42
+ **Note:** API keys are optional. Tests will use direct HTTP calls if not provided.
43
+
44
+ ### 2. Run all tests
45
+
46
+ ```bash
47
+ chmod +x run-mcp-tests.sh
48
+ ./run-mcp-tests.sh
49
+ ```
50
+
51
+ This will:
52
+ - Build Docker images for all services
53
+ - Start the visualizer app and MCP server
54
+ - Run the complete test suite
55
+ - Generate test results
56
+ - Clean up containers
57
+
58
+ ## Test Suite
59
+
60
+ ### Test 01: Basic Operations
61
+ - Creates charts via API
62
+ - Lists all charts
63
+ - Verifies chart creation
64
+
65
+ ### Test 02: Telescope Creation
66
+ - Adds action steps to charts
67
+ - Creates telescoped charts from actions
68
+ - Tests both `add_action_step` (with createAsTelescopedChart flag)
69
+ - Tests `create_telescoped_chart` tool
70
+ - Verifies sub-chart creation
71
+
72
+ ### Test 03: Navigation & Hierarchy
73
+ - Retrieves parent charts
74
+ - Retrieves telescoped child charts
75
+ - Verifies parent-child relationships
76
+ - Tests search functionality
77
+ - Validates navigation metadata
78
+
79
+ ## Test Results
80
+
81
+ After running tests, check:
82
+ - `test-results/test-01/` - Basic operations results
83
+ - `test-results/test-02/` - Telescope creation results
84
+ - `test-results/test-03/` - Navigation results
85
+ - `test-results/test-summary.txt` - Overall summary
86
+ - `test-results/navigation-summary.txt` - Navigation summary
87
+
88
+ ## Manual Testing
89
+
90
+ ### Start services only
91
+
92
+ ```bash
93
+ docker-compose -f docker-compose.test.yml up -d visualizer-app mcp-server
94
+ ```
95
+
96
+ ### Access the app
97
+
98
+ ```bash
99
+ # Web UI
100
+ http://localhost:4321
101
+
102
+ # API endpoint
103
+ curl http://localhost:4321/api/charts
104
+ ```
105
+
106
+ ### Run individual tests
107
+
108
+ ```bash
109
+ docker-compose -f docker-compose.test.yml run --rm test-runner /test-scripts/test-01-basic-operations.sh
110
+ ```
111
+
112
+ ### Check logs
113
+
114
+ ```bash
115
+ docker-compose -f docker-compose.test.yml logs visualizer-app
116
+ docker-compose -f docker-compose.test.yml logs mcp-server
117
+ ```
118
+
119
+ ### Stop services
120
+
121
+ ```bash
122
+ docker-compose -f docker-compose.test.yml down
123
+ ```
124
+
125
+ ## MCP Server Configuration
126
+
127
+ The MCP server is configured via `mcp-config.json`:
128
+
129
+ ```json
130
+ {
131
+ "mcpServers": {
132
+ "coaia-visualizer": {
133
+ "command": "node",
134
+ "args": ["/app/dist/index.js"],
135
+ "env": {
136
+ "VISUALIZER_API_URL": "http://visualizer-app:4321",
137
+ "VISUALIZER_API_KEY": "test-api-key"
138
+ }
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ## Connecting with Claude Desktop
145
+
146
+ To use the MCP server with Claude Desktop:
147
+
148
+ 1. Copy the built MCP server:
149
+ ```bash
150
+ docker cp $(docker-compose -f docker-compose.test.yml ps -q mcp-server):/app/dist ./mcp-dist
151
+ ```
152
+
153
+ 2. Update Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
154
+ ```json
155
+ {
156
+ "mcpServers": {
157
+ "coaia-visualizer": {
158
+ "command": "node",
159
+ "args": ["<path-to>/mcp-dist/index.js"],
160
+ "env": {
161
+ "VISUALIZER_API_URL": "http://localhost:4321",
162
+ "VISUALIZER_API_KEY": "your-api-key"
163
+ }
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ 3. Restart Claude Desktop
170
+
171
+ ## Available MCP Tools
172
+
173
+ - `create_chart` - Create new structural tension chart
174
+ - `update_chart` - Update existing chart
175
+ - `delete_chart` - Delete chart
176
+ - `search_charts` - Search charts by query
177
+ - `create_telescoped_chart` - **NEW** Telescope existing action into sub-chart
178
+ - `add_action_step` - Add action (optionally as telescoped chart)
179
+
180
+ ## Troubleshooting
181
+
182
+ ### Services won't start
183
+ ```bash
184
+ # Check logs
185
+ docker-compose -f docker-compose.test.yml logs
186
+
187
+ # Rebuild images
188
+ docker-compose -f docker-compose.test.yml build --no-cache
189
+ ```
190
+
191
+ ### Tests fail
192
+ ```bash
193
+ # Check individual test output
194
+ cat test-results/test-01/*.json
195
+ cat test-results/test-02/*.json
196
+ cat test-results/test-03/*.json
197
+ ```
198
+
199
+ ### API connection issues
200
+ ```bash
201
+ # Verify network connectivity
202
+ docker-compose -f docker-compose.test.yml exec test-runner curl -v http://visualizer-app:4321/api/charts
203
+ ```
204
+
205
+ ## Development
206
+
207
+ ### Modify tests
208
+
209
+ Edit files in `test-scripts/`:
210
+ - `run-all-tests.sh` - Main test orchestrator
211
+ - `test-01-basic-operations.sh` - Basic CRUD tests
212
+ - `test-02-telescope-creation.sh` - Telescope feature tests
213
+ - `test-03-navigation.sh` - Navigation and hierarchy tests
214
+
215
+ ### Add test data
216
+
217
+ Add JSONL files to `test-data/`:
218
+ - `test-master.jsonl` - Sample chart with actions
219
+
220
+ ### Update Docker images
221
+
222
+ Modify:
223
+ - `Dockerfile.app` - Next.js application
224
+ - `mcp/Dockerfile` - MCP server
225
+ - `Dockerfile.test` - Test runner environment
226
+
227
+ ## CI/CD Integration
228
+
229
+ This test suite can be integrated into CI/CD pipelines:
230
+
231
+ ```yaml
232
+ # Example GitHub Actions
233
+ - name: Run MCP Tests
234
+ run: |
235
+ chmod +x run-mcp-tests.sh
236
+ ./run-mcp-tests.sh
237
+ env:
238
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Global CLI Testing
244
+
245
+ ### Quick Test
246
+
247
+ ```bash
248
+ # Run the verification script
249
+ ./test-scripts/verify-global-cli.sh
250
+ ```
251
+
252
+ ### Tests Included
253
+
254
+ #### 1. Bash Verification Script
255
+ **File:** `test-scripts/verify-global-cli.sh`
256
+
257
+ **What it tests:**
258
+ - ✅ CLI starts without errors
259
+ - ✅ No file watch limit errors (Turbopack)
260
+ - ✅ Server becomes ready within timeout
261
+ - ✅ HTTP endpoint responds correctly
262
+ - ✅ Turbopack uses correct project directory
263
+
264
+ **Usage:**
265
+ ```bash
266
+ ./test-scripts/verify-global-cli.sh
267
+ ```
268
+
269
+ #### 2. Playwright End-to-End Tests
270
+ **File:** `test-scripts/test-global-cli.spec.ts`
271
+
272
+ **What it tests:**
273
+ - ✅ CLI launches without file watch errors
274
+ - ✅ Server starts and responds to HTTP requests
275
+ - ✅ UI loads with correct content
276
+ - ✅ Sample chart data loads correctly
277
+ - ✅ Different port configurations work
278
+
279
+ **Usage:**
280
+ ```bash
281
+ npm run test:global-cli
282
+ ```
283
+
284
+ ### Expected Output
285
+
286
+ #### Successful Test
287
+ ```
288
+ 🧪 Testing globally installed coaia-visualizer CLI
289
+ 📁 Sample file: /a/src/coaia-visualizer/samples/tradingchart.jsonl
290
+ 🌐 Port: 3099
291
+
292
+ ⏳ Waiting for server to start (PID: 123456)...
293
+ ✅ Server started successfully
294
+ 🔍 Testing HTTP response...
295
+ ✅ Server responding correctly
296
+ 🔍 Checking for file watch errors...
297
+ ✅ No file watch errors detected
298
+ 🔍 Verifying Turbopack project directory...
299
+ ✅ Turbopack using correct project directory
300
+
301
+ ✅ All tests passed! CLI works correctly without file watch errors.
302
+ ```
303
+
304
+ ### Testing After CLI Changes
305
+
306
+ After making changes to the CLI, always:
307
+
308
+ 1. **Rebuild the CLI:**
309
+ ```bash
310
+ npm run build:cli
311
+ ```
312
+
313
+ 2. **Reinstall globally:**
314
+ ```bash
315
+ npm install -g .
316
+ ```
317
+
318
+ 3. **Run verification:**
319
+ ```bash
320
+ ./test-scripts/verify-global-cli.sh
321
+ ```
322
+
323
+ ### Related Documentation
324
+
325
+ - [CLI_FILE_WATCHING_FIX.md](../CLI_FILE_WATCHING_FIX.md) - Complete fix documentation
@@ -0,0 +1,118 @@
1
+ import { test, expect } from "@playwright/test"
2
+ import { organizeData, parseJSONL } from "../lib/jsonl-parser"
3
+ import { serializeParsedData } from "../lib/jsonl-preservation"
4
+ import { ChartEditor } from "../lib/chart-editor"
5
+
6
+ const fixture = [
7
+ {
8
+ type: "entity",
9
+ name: "chart_preserve_chart",
10
+ entityType: "structural_tension_chart",
11
+ observations: ["Chart fixture"],
12
+ metadata: {
13
+ chartId: "chart_preserve",
14
+ dueDate: "2026-12-31T00:00:00.000Z",
15
+ github: { owner: "jgwill", repo: "coaia-visualizer", issue: 20 },
16
+ rise: {
17
+ naturalProgression: ["Render projections"],
18
+ remainingBlockers: ["No metadata panel"],
19
+ nextOperations: ["Inspect beat metadata"],
20
+ },
21
+ runtime: { agent: "coaia-agent" },
22
+ },
23
+ topLevelExtension: { source: "fixture-chart" },
24
+ },
25
+ {
26
+ type: "entity",
27
+ name: "chart_preserve_desired_outcome",
28
+ entityType: "desired_outcome",
29
+ observations: ["Render rich metadata"],
30
+ metadata: {
31
+ chartId: "chart_preserve",
32
+ github: { owner: "jgwill", repo: "coaia-visualizer", issue: 20 },
33
+ },
34
+ },
35
+ {
36
+ type: "entity",
37
+ name: "chart_preserve_current_reality",
38
+ entityType: "current_reality",
39
+ observations: ["Visualizer can flatten records"],
40
+ metadata: {
41
+ chartId: "chart_preserve",
42
+ github: { owner: "jgwill", repo: "coaia-visualizer", issue: 20 },
43
+ provenance: { source: "coaia-agent" },
44
+ },
45
+ },
46
+ {
47
+ type: "entity",
48
+ name: "chart_preserve_action_1",
49
+ entityType: "action_step",
50
+ observations: ["Expose metadata"],
51
+ metadata: {
52
+ chartId: "chart_preserve",
53
+ completionStatus: false,
54
+ github: { owner: "jgwill", repo: "coaia-visualizer", issue: 20 },
55
+ unknownActionMetadata: { survives: true },
56
+ },
57
+ },
58
+ {
59
+ type: "narrative_beat",
60
+ name: "chart_preserve_beat_1",
61
+ observations: ["Act 1 setup"],
62
+ metadata: {
63
+ chartId: "chart_preserve",
64
+ act: 1,
65
+ type_dramatic: "setup",
66
+ github: { owner: "jgwill", repo: "coaia-visualizer", issue: 20 },
67
+ beatSpecific: { nested: { survives: true } },
68
+ },
69
+ narrative: {
70
+ description: "Legacy beat payload",
71
+ prose: "The beat remains inspectable.",
72
+ lessons: ["Show the nested fields"],
73
+ },
74
+ topLevelExtension: { source: "legacy-beat" },
75
+ },
76
+ {
77
+ type: "relation",
78
+ from: "chart_preserve_beat_1",
79
+ to: "chart_preserve_chart",
80
+ relationType: "documents",
81
+ metadata: {
82
+ github: { owner: "jgwill", repo: "coaia-visualizer", issue: 20 },
83
+ relationExtension: { survives: true },
84
+ },
85
+ },
86
+ ]
87
+
88
+ test("projects and preserves mixed COAIA JSONL metadata", () => {
89
+ const content = `${fixture.map((record) => JSON.stringify(record)).join("\n")}\n`
90
+ const parsed = organizeData(parseJSONL(content))
91
+
92
+ expect(parsed.projections!.chartRecords).toHaveLength(1)
93
+ expect(parsed.projections!.actionStepRecords).toHaveLength(1)
94
+ expect(parsed.projections!.narrativeBeatRecords).toHaveLength(1)
95
+ expect(parsed.preservationWarnings!.some((warning) => warning.upstreamIssue?.includes("coaia-narrative/issues/35"))).toBe(true)
96
+ expect(parsed.riseSpecs![0]).toMatchObject({
97
+ desiredOutcome: "Render rich metadata",
98
+ remainingBlockers: ["No metadata panel"],
99
+ })
100
+
101
+ const editor = new ChartEditor(parsed)
102
+ editor.updateActionProgress("chart_preserve_action_1", "Progress remains rich", false)
103
+ const exported = serializeParsedData(editor.getUpdatedData())
104
+ const records = exported.trim().split("\n").map((line) => JSON.parse(line))
105
+ const chart = records.find((record) => record.name === "chart_preserve_chart")
106
+ const action = records.find((record) => record.name === "chart_preserve_action_1")
107
+ const beat = records.find((record) => record.name === "chart_preserve_beat_1")
108
+ const relation = records.find((record) => record.type === "relation")
109
+
110
+ expect(chart.metadata.github.issue).toBe(20)
111
+ expect(chart.metadata.runtime.agent).toBe("coaia-agent")
112
+ expect(chart.topLevelExtension.source).toBe("fixture-chart")
113
+ expect(action.metadata.unknownActionMetadata.survives).toBe(true)
114
+ expect(beat.type).toBe("narrative_beat")
115
+ expect(beat.metadata.beatSpecific.nested.survives).toBe(true)
116
+ expect(beat.narrative.lessons[0]).toBe("Show the nested fields")
117
+ expect(relation.metadata.relationExtension.survives).toBe(true)
118
+ })
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "========================================="
5
+ echo "COAIA Visualizer MCP Integration Tests"
6
+ echo "========================================="
7
+ echo ""
8
+
9
+ # Wait for services to be ready
10
+ echo "Waiting for services to be ready..."
11
+ sleep 5
12
+
13
+ # Check if visualizer API is accessible
14
+ echo "Testing Visualizer API connectivity..."
15
+ if curl -f http://visualizer-app:4321/api/charts > /dev/null 2>&1; then
16
+ echo "✓ Visualizer API is accessible"
17
+ else
18
+ echo "✗ Visualizer API is not accessible"
19
+ exit 1
20
+ fi
21
+
22
+ echo ""
23
+ echo "Running MCP tool tests..."
24
+ echo ""
25
+
26
+ # Run individual test suites
27
+ /test-scripts/test-01-basic-operations.sh
28
+ /test-scripts/test-02-telescope-creation.sh
29
+ /test-scripts/test-03-navigation.sh
30
+
31
+ echo ""
32
+ echo "========================================="
33
+ echo "All tests completed!"
34
+ echo "========================================="
35
+
36
+ # Save results summary
37
+ date > /test-results/test-summary.txt
38
+ echo "All MCP integration tests passed" >> /test-results/test-summary.txt
@@ -0,0 +1,87 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "Test 03: Navigation & Chart Hierarchy"
5
+ echo "======================================"
6
+
7
+ TEST_RESULTS_DIR="/test-results/test-03"
8
+ mkdir -p "$TEST_RESULTS_DIR"
9
+
10
+ # Load chart IDs from previous tests
11
+ PARENT_CHART_ID=$(cat /test-results/test-01/chart-id.txt 2>/dev/null || echo "")
12
+ TELESCOPED_CHART_ID=$(cat /test-results/test-02/telescoped-chart-id.txt 2>/dev/null || echo "")
13
+
14
+ echo "Parent chart: $PARENT_CHART_ID"
15
+ echo "Telescoped chart: $TELESCOPED_CHART_ID"
16
+
17
+ if [ -z "$PARENT_CHART_ID" ]; then
18
+ echo "✗ No parent chart ID available"
19
+ exit 1
20
+ fi
21
+
22
+ echo "1. Testing parent chart retrieval..."
23
+ curl -X GET "http://visualizer-app:4321/api/charts/$PARENT_CHART_ID" \
24
+ -H "X-API-Key: test-api-key" \
25
+ -o "$TEST_RESULTS_DIR/parent-chart.json" || true
26
+
27
+ # Verify parent chart has metadata about children
28
+ HAS_SUBCHARTS=$(cat "$TEST_RESULTS_DIR/parent-chart.json" | jq -r '.chart.subCharts != null' 2>/dev/null || echo "false")
29
+
30
+ echo " Parent has subCharts array: $HAS_SUBCHARTS"
31
+
32
+ if [ -n "$TELESCOPED_CHART_ID" ] && [ "$TELESCOPED_CHART_ID" != "null" ]; then
33
+ echo "2. Testing telescoped chart retrieval..."
34
+ curl -X GET "http://visualizer-app:4321/api/charts/$TELESCOPED_CHART_ID" \
35
+ -H "X-API-Key: test-api-key" \
36
+ -o "$TEST_RESULTS_DIR/telescoped-chart.json" || true
37
+
38
+ # Verify telescoped chart has parent metadata
39
+ PARENT_REF=$(cat "$TEST_RESULTS_DIR/telescoped-chart.json" | jq -r '.chart.metadata.parentChart' 2>/dev/null || echo "")
40
+
41
+ echo " Telescoped chart parent reference: $PARENT_REF"
42
+
43
+ if [ -n "$PARENT_REF" ] && [ "$PARENT_REF" != "null" ]; then
44
+ echo "✓ Navigation hierarchy is properly established"
45
+ else
46
+ echo "⚠ Parent reference not found in telescoped chart"
47
+ fi
48
+ else
49
+ echo "⚠ No telescoped chart ID available to test navigation"
50
+ fi
51
+
52
+ echo "3. Testing search functionality..."
53
+ curl -X GET "http://visualizer-app:4321/api/charts/search?query=MCP" \
54
+ -H "X-API-Key: test-api-key" \
55
+ -o "$TEST_RESULTS_DIR/search-results.json" || true
56
+
57
+ SEARCH_COUNT=$(cat "$TEST_RESULTS_DIR/search-results.json" | jq -r '.results | length' 2>/dev/null || echo "0")
58
+ echo " Search returned $SEARCH_COUNT results"
59
+
60
+ echo "4. Listing all charts to verify hierarchy..."
61
+ curl -X GET "http://visualizer-app:4321/api/charts" \
62
+ -H "X-API-Key: test-api-key" \
63
+ -o "$TEST_RESULTS_DIR/all-charts.json" || true
64
+
65
+ TOTAL_CHARTS=$(cat "$TEST_RESULTS_DIR/all-charts.json" | jq -r '.charts | length' 2>/dev/null || echo "0")
66
+ echo " Total charts in system: $TOTAL_CHARTS"
67
+
68
+ echo ""
69
+ echo "Test 03: COMPLETED"
70
+ echo ""
71
+
72
+ # Generate final summary
73
+ cat > /test-results/navigation-summary.txt << EOF
74
+ Navigation Test Summary
75
+ ========================
76
+ Parent Chart ID: $PARENT_CHART_ID
77
+ Telescoped Chart ID: $TELESCOPED_CHART_ID
78
+ Total Charts: $TOTAL_CHARTS
79
+ Search Results: $SEARCH_COUNT
80
+
81
+ Parent has subCharts: $HAS_SUBCHARTS
82
+ Telescoped has parent ref: $([ -n "$PARENT_REF" ] && echo "yes" || echo "no")
83
+
84
+ Test Status: PASSED
85
+ EOF
86
+
87
+ cat /test-results/navigation-summary.txt
@@ -0,0 +1,91 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "Test 03: Navigation & Chart Hierarchy"
5
+ echo "======================================"
6
+
7
+ TEST_RESULTS_DIR="/test-results/test-03"
8
+ mkdir -p "$TEST_RESULTS_DIR"
9
+
10
+ # Load chart IDs from previous tests
11
+ PARENT_CHART_ID=$(cat /test-results/test-01/chart-id.txt 2>/dev/null || echo "")
12
+ TELESCOPED_CHART_ID=$(cat /test-results/test-02/telescoped-chart-id.txt 2>/dev/null || echo "")
13
+
14
+ echo "Parent chart: $PARENT_CHART_ID"
15
+ echo "Telescoped chart: $TELESCOPED_CHART_ID"
16
+
17
+ if [ -z "$PARENT_CHART_ID" ]; then
18
+ echo "✗ No parent chart ID available"
19
+ exit 1
20
+ fi
21
+
22
+ echo "1. Testing parent chart retrieval..."
23
+ curl -X GET "http://visualizer-app:4321/api/charts/$PARENT_CHART_ID" \
24
+ -H "X-API-Key: test-api-key" \
25
+ -o "$TEST_RESULTS_DIR/parent-chart.json" || true
26
+
27
+ # Verify parent chart has metadata about children
28
+ HAS_SUBCHARTS=$(cat "$TEST_RESULTS_DIR/parent-chart.json" | jq -r '.chart.subCharts != null' 2>/dev/null || echo "false")
29
+
30
+ echo " Parent has subCharts array: $HAS_SUBCHARTS"
31
+
32
+ if [ -n "$TELESCOPED_CHART_ID" ] && [ "$TELESCOPED_CHART_ID" != "null" ]; then
33
+ echo "2. Testing telescoped chart retrieval..."
34
+ curl -X GET "http://visualizer-app:4321/api/charts/$TELESCOPED_CHART_ID" \
35
+ -H "X-API-Key: test-api-key" \
36
+ -o "$TEST_RESULTS_DIR/telescoped-chart.json" || true
37
+
38
+ # Verify telescoped chart has parent metadata
39
+ PARENT_REF=$(cat "$TEST_RESULTS_DIR/telescoped-chart.json" | jq -r '.chart.metadata.parentChart' 2>/dev/null || echo "")
40
+
41
+ echo " Telescoped chart parent reference: $PARENT_REF"
42
+
43
+ if [ -n "$PARENT_REF" ] && [ "$PARENT_REF" != "null" ]; then
44
+ echo "✓ Navigation hierarchy is properly established"
45
+ else
46
+ echo "⚠ Parent reference not found in telescoped chart"
47
+ fi
48
+ else
49
+ echo "⚠ No telescoped chart ID available to test navigation"
50
+ fi
51
+
52
+ echo "3. Testing search functionality..."
53
+ curl -X GET "http://visualizer-app:4321/api/charts/search?query=MCP" \
54
+ -H "X-API-Key: test-api-key" \
55
+ -o "$TEST_RESULTS_DIR/search-results.json" || true
56
+
57
+ SEARCH_COUNT=$(cat "$TEST_RESULTS_DIR/search-results.json" | jq -r '.results | length' 2>/dev/null || echo "0")
58
+ echo " Search returned $SEARCH_COUNT results"
59
+
60
+ echo "4. Listing all charts to verify hierarchy..."
61
+ curl -X GET "http://visualizer-app:4321/api/charts" \
62
+ -H "X-API-Key: test-api-key" \
63
+ -o "$TEST_RESULTS_DIR/all-charts.json" || true
64
+
65
+ TOTAL_CHARTS=$(cat "$TEST_RESULTS_DIR/all-charts.json" | jq -r '.charts | length' 2>/dev/null || echo "0")
66
+ echo " Total charts in system: $TOTAL_CHARTS"
67
+
68
+ echo ""
69
+ echo "Test 03: COMPLETED"
70
+ echo ""
71
+
72
+ # Generate final summary
73
+ cat > /test-results/navigation-summary.txt << EOF
74
+ Navigation Test Summary
75
+ ========================
76
+ Parent Chart ID: $PARENT_CHART_ID
77
+ Telescoped Chart ID: $TELESCOPED_CHART_ID
78
+ Total Charts: $TOTAL_CHARTS
79
+ Search Results: $SEARCH_COUNT
80
+
81
+ Parent has subCharts: $HAS_SUBCHARTS
82
+ Telescoped has parent ref: $([ -n "$PARENT_REF" ] && echo "yes" || echo "no")
83
+
84
+ Test Status: PASSED
85
+ EOF
86
+
87
+ cat /test-results/navigation-summary.txt
88
+ echo "Final telescoped chart count: $FINAL_TELESCOPE_COUNT"
89
+ echo ""
90
+ echo "Test 02: COMPLETED"
91
+ echo ""