coaia-visualizer 1.6.2 → 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.
Files changed (43) hide show
  1. package/package.json +30 -1
  2. package/.dockerignore +0 -9
  3. package/COMPLETE_IMPLEMENTATION_REPORT.md +0 -215
  4. package/Dockerfile +0 -61
  5. package/Dockerfile.app +0 -50
  6. package/QUICK_START_MCP_TESTING.md +0 -236
  7. package/STC.md +0 -24
  8. package/STCGOAL.md +0 -0
  9. package/STCISSUE.md +0 -48
  10. package/STCKIN.md +0 -0
  11. package/STCMASTERY.md +0 -0
  12. package/STUDY_REPORT.md +0 -510
  13. package/direct-test.sh +0 -180
  14. package/docker-build-push.sh +0 -20
  15. package/docker-compose.test.yml +0 -69
  16. package/docker-entrypoint.sh +0 -27
  17. package/jgwill.coaia-visualizer-8--496dca71-d476-4ac9-ba9f-376add118dd8--260208.txt +0 -2612
  18. package/mcp/test_mcp/.gemini/settings.json +0 -18
  19. package/rispecs/README.md +0 -170
  20. package/rispecs/accountability-responsibility.rispec.md +0 -110
  21. package/rispecs/api-mcp-interface.spec.md +0 -287
  22. package/rispecs/app.spec.md +0 -364
  23. package/rispecs/chart-editing-workflow.spec.md +0 -297
  24. package/rispecs/chart-visualization-hierarchy.spec.md +0 -235
  25. package/rispecs/cli-mode.spec.md +0 -224
  26. package/rispecs/github-project-runtime-memory-integration.spec.md +0 -381
  27. package/rispecs/jsonl-parsing-data-types.spec.md +0 -243
  28. package/rispecs/narrative-beats-display.spec.md +0 -189
  29. package/rispecs/pde-integration.spec.md +0 -280
  30. package/rispecs/planning-integration.spec.md +0 -329
  31. package/rispecs/relation-graph-visualization.spec.md +0 -171
  32. package/rispecs/relation-to-mcp-structural-thinking.kin.md +0 -65
  33. package/rispecs/ui-component-library.spec.md +0 -258
  34. package/test-data/test-master.jsonl +0 -11
  35. package/test-results/.last-run.json +0 -4
  36. package/test-scripts/README.md +0 -325
  37. package/test-scripts/rich-jsonl-preservation.spec.ts +0 -118
  38. package/test-scripts/run-all-tests.sh +0 -38
  39. package/test-scripts/test-01-basic-operations.sh +0 -87
  40. package/test-scripts/test-02-telescope-creation.sh +0 -91
  41. package/test-scripts/test-03-navigation.sh +0 -87
  42. package/test-scripts/test-global-cli.spec.ts +0 -220
  43. package/test-scripts/verify-global-cli.sh +0 -87
@@ -1,118 +0,0 @@
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
- })
@@ -1,38 +0,0 @@
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
@@ -1,87 +0,0 @@
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
@@ -1,91 +0,0 @@
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 ""
@@ -1,87 +0,0 @@
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
@@ -1,220 +0,0 @@
1
- /**
2
- * Test globally installed CLI with Playwright
3
- * Tests the fix for Turbopack file watching issue
4
- */
5
-
6
- import { test, expect } from '@playwright/test';
7
- import { spawn, ChildProcess } from 'child_process';
8
- import { promises as fs } from 'fs';
9
- import path from 'path';
10
-
11
- let cliProcess: ChildProcess | null = null;
12
- const CLI_PORT = 3099;
13
- const TEST_TIMEOUT = 60000; // 60 seconds for server startup
14
-
15
- test.describe('Global CLI Installation Tests', () => {
16
- test.beforeEach(async () => {
17
- // Kill any existing process on the port
18
- try {
19
- await new Promise<void>((resolve) => {
20
- const kill = spawn('fuser', ['-k', `${CLI_PORT}/tcp`]);
21
- kill.on('close', () => resolve());
22
- setTimeout(resolve, 1000);
23
- });
24
- } catch (e) {
25
- // Port might not be in use
26
- }
27
- });
28
-
29
- test.afterEach(async () => {
30
- // Clean up CLI process
31
- if (cliProcess) {
32
- cliProcess.kill('SIGTERM');
33
- await new Promise(resolve => setTimeout(resolve, 2000));
34
- if (!cliProcess.killed) {
35
- cliProcess.kill('SIGKILL');
36
- }
37
- cliProcess = null;
38
- }
39
- });
40
-
41
- test('should launch CLI without file watch errors', async ({ page }) => {
42
- test.setTimeout(TEST_TIMEOUT);
43
-
44
- const sampleFile = path.join(__dirname, '../samples/tradingchart.jsonl');
45
-
46
- // Verify sample file exists
47
- await fs.access(sampleFile);
48
-
49
- // Launch CLI with sample file
50
- let cliOutput = '';
51
- let cliError = '';
52
- let hasFileWatchError = false;
53
- let serverReady = false;
54
-
55
- cliProcess = spawn(
56
- 'coaia-visualizer',
57
- ['-M', sampleFile, '--port', CLI_PORT.toString(), '--no-open'],
58
- {
59
- stdio: ['ignore', 'pipe', 'pipe'],
60
- env: { ...process.env },
61
- }
62
- );
63
-
64
- // Monitor output
65
- cliProcess.stdout?.on('data', (data) => {
66
- const output = data.toString();
67
- cliOutput += output;
68
- console.log('[CLI stdout]', output);
69
-
70
- if (output.includes('Local:') || output.includes('localhost')) {
71
- serverReady = true;
72
- }
73
- });
74
-
75
- cliProcess.stderr?.on('data', (data) => {
76
- const error = data.toString();
77
- cliError += error;
78
- console.log('[CLI stderr]', error);
79
-
80
- // Check for file watch errors
81
- if (
82
- error.includes('OS file watch limit reached') ||
83
- error.includes('TurbopackInternalError') ||
84
- error.includes('about ["/home/') ||
85
- error.includes('ENOSPC')
86
- ) {
87
- hasFileWatchError = true;
88
- }
89
- });
90
-
91
- // Wait for server to be ready (max 45 seconds)
92
- const startTime = Date.now();
93
- while (!serverReady && Date.now() - startTime < 45000) {
94
- await new Promise(resolve => setTimeout(resolve, 500));
95
-
96
- // Fail fast if file watch error detected
97
- if (hasFileWatchError) {
98
- break;
99
- }
100
- }
101
-
102
- // Verify no file watch errors
103
- expect(hasFileWatchError, 'Should not have file watch errors').toBe(false);
104
- expect(serverReady, 'Server should be ready').toBe(true);
105
-
106
- // Navigate to the app
107
- await page.goto(`http://localhost:${CLI_PORT}`, {
108
- waitUntil: 'networkidle',
109
- timeout: 15000
110
- });
111
-
112
- // Verify page loaded successfully
113
- await expect(page.locator('body')).toBeVisible();
114
-
115
- // Check that it's the visualizer app (should have charts or similar content)
116
- const title = await page.title();
117
- console.log('Page title:', title);
118
-
119
- // Take a screenshot for verification
120
- await page.screenshot({
121
- path: path.join(__dirname, '../test-data/global-cli-test.png'),
122
- fullPage: true
123
- });
124
-
125
- console.log('✅ CLI launched successfully without file watch errors');
126
- });
127
-
128
- test('should load sample chart data correctly', async ({ page }) => {
129
- test.setTimeout(TEST_TIMEOUT);
130
-
131
- const sampleFile = path.join(__dirname, '../samples/tradingchart.jsonl');
132
-
133
- // Launch CLI
134
- let serverReady = false;
135
- cliProcess = spawn(
136
- 'coaia-visualizer',
137
- ['-M', sampleFile, '--port', CLI_PORT.toString(), '--no-open'],
138
- {
139
- stdio: ['ignore', 'pipe', 'pipe'],
140
- env: { ...process.env },
141
- }
142
- );
143
-
144
- cliProcess.stdout?.on('data', (data) => {
145
- const output = data.toString();
146
- if (output.includes('Local:') || output.includes('localhost')) {
147
- serverReady = true;
148
- }
149
- });
150
-
151
- // Wait for server
152
- const startTime = Date.now();
153
- while (!serverReady && Date.now() - startTime < 45000) {
154
- await new Promise(resolve => setTimeout(resolve, 500));
155
- }
156
-
157
- expect(serverReady).toBe(true);
158
-
159
- // Navigate and test the UI
160
- await page.goto(`http://localhost:${CLI_PORT}`, {
161
- waitUntil: 'networkidle',
162
- timeout: 15000
163
- });
164
-
165
- // Wait for content to load
166
- await page.waitForTimeout(2000);
167
-
168
- // Check for chart elements (adjust selectors based on your UI)
169
- const snapshot = await page.locator('body').textContent();
170
- console.log('Page content includes:', snapshot?.substring(0, 500));
171
-
172
- // Verify the app is functional
173
- await expect(page.locator('body')).toBeVisible();
174
-
175
- console.log('✅ Sample chart data loaded successfully');
176
- });
177
-
178
- test('should handle different ports correctly', async ({ page }) => {
179
- test.setTimeout(TEST_TIMEOUT);
180
-
181
- const alternatePort = 3098;
182
- const sampleFile = path.join(__dirname, '../samples/tradingchart.jsonl');
183
-
184
- // Launch on alternate port
185
- let serverReady = false;
186
- cliProcess = spawn(
187
- 'coaia-visualizer',
188
- ['-M', sampleFile, '-p', alternatePort.toString(), '--no-open'],
189
- {
190
- stdio: ['ignore', 'pipe', 'pipe'],
191
- env: { ...process.env },
192
- }
193
- );
194
-
195
- cliProcess.stdout?.on('data', (data) => {
196
- const output = data.toString();
197
- if (output.includes(`${alternatePort}`)) {
198
- serverReady = true;
199
- }
200
- });
201
-
202
- // Wait for server
203
- const startTime = Date.now();
204
- while (!serverReady && Date.now() - startTime < 45000) {
205
- await new Promise(resolve => setTimeout(resolve, 500));
206
- }
207
-
208
- expect(serverReady).toBe(true);
209
-
210
- // Verify server is on alternate port
211
- await page.goto(`http://localhost:${alternatePort}`, {
212
- waitUntil: 'networkidle',
213
- timeout: 15000
214
- });
215
-
216
- await expect(page.locator('body')).toBeVisible();
217
-
218
- console.log('✅ Alternate port configuration works');
219
- });
220
- });