@fairfox/polly 0.1.3 → 0.1.4

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 (68) hide show
  1. package/{cli/polly.ts → dist/cli/polly.js} +100 -206
  2. package/dist/cli/polly.js.map +10 -0
  3. package/dist/scripts/build-extension.js +137 -0
  4. package/dist/scripts/build-extension.js.map +10 -0
  5. package/dist/vendor/verify/src/cli.js +2089 -0
  6. package/dist/vendor/verify/src/cli.js.map +16 -0
  7. package/dist/vendor/visualize/src/cli.js +2204 -0
  8. package/dist/vendor/visualize/src/cli.js.map +19 -0
  9. package/package.json +12 -12
  10. package/vendor/analysis/src/extract/adr.ts +0 -212
  11. package/vendor/analysis/src/extract/architecture.ts +0 -160
  12. package/vendor/analysis/src/extract/contexts.ts +0 -298
  13. package/vendor/analysis/src/extract/flows.ts +0 -309
  14. package/vendor/analysis/src/extract/handlers.ts +0 -321
  15. package/vendor/analysis/src/extract/index.ts +0 -9
  16. package/vendor/analysis/src/extract/integrations.ts +0 -329
  17. package/vendor/analysis/src/extract/manifest.ts +0 -298
  18. package/vendor/analysis/src/extract/types.ts +0 -389
  19. package/vendor/analysis/src/index.ts +0 -7
  20. package/vendor/analysis/src/types/adr.ts +0 -53
  21. package/vendor/analysis/src/types/architecture.ts +0 -245
  22. package/vendor/analysis/src/types/core.ts +0 -210
  23. package/vendor/analysis/src/types/index.ts +0 -18
  24. package/vendor/verify/src/adapters/base.ts +0 -164
  25. package/vendor/verify/src/adapters/detection.ts +0 -281
  26. package/vendor/verify/src/adapters/event-bus/index.ts +0 -480
  27. package/vendor/verify/src/adapters/web-extension/index.ts +0 -508
  28. package/vendor/verify/src/adapters/websocket/index.ts +0 -486
  29. package/vendor/verify/src/cli.ts +0 -430
  30. package/vendor/verify/src/codegen/config.ts +0 -354
  31. package/vendor/verify/src/codegen/tla.ts +0 -719
  32. package/vendor/verify/src/config/parser.ts +0 -303
  33. package/vendor/verify/src/config/types.ts +0 -113
  34. package/vendor/verify/src/core/model.ts +0 -267
  35. package/vendor/verify/src/core/primitives.ts +0 -106
  36. package/vendor/verify/src/extract/handlers.ts +0 -2
  37. package/vendor/verify/src/extract/types.ts +0 -2
  38. package/vendor/verify/src/index.ts +0 -150
  39. package/vendor/verify/src/primitives/index.ts +0 -102
  40. package/vendor/verify/src/runner/docker.ts +0 -283
  41. package/vendor/verify/src/types.ts +0 -51
  42. package/vendor/visualize/src/cli.ts +0 -365
  43. package/vendor/visualize/src/codegen/structurizr.ts +0 -770
  44. package/vendor/visualize/src/index.ts +0 -13
  45. package/vendor/visualize/src/runner/export.ts +0 -235
  46. package/vendor/visualize/src/viewer/server.ts +0 -485
  47. /package/dist/{background → src/background}/index.js +0 -0
  48. /package/dist/{background → src/background}/index.js.map +0 -0
  49. /package/dist/{background → src/background}/message-router.js +0 -0
  50. /package/dist/{background → src/background}/message-router.js.map +0 -0
  51. /package/dist/{index.js → src/index.js} +0 -0
  52. /package/dist/{index.js.map → src/index.js.map} +0 -0
  53. /package/dist/{shared → src/shared}/adapters/index.js +0 -0
  54. /package/dist/{shared → src/shared}/adapters/index.js.map +0 -0
  55. /package/dist/{shared → src/shared}/lib/context-helpers.js +0 -0
  56. /package/dist/{shared → src/shared}/lib/context-helpers.js.map +0 -0
  57. /package/dist/{shared → src/shared}/lib/errors.js +0 -0
  58. /package/dist/{shared → src/shared}/lib/errors.js.map +0 -0
  59. /package/dist/{shared → src/shared}/lib/message-bus.js +0 -0
  60. /package/dist/{shared → src/shared}/lib/message-bus.js.map +0 -0
  61. /package/dist/{shared → src/shared}/lib/state.js +0 -0
  62. /package/dist/{shared → src/shared}/lib/state.js.map +0 -0
  63. /package/dist/{shared → src/shared}/lib/test-helpers.js +0 -0
  64. /package/dist/{shared → src/shared}/lib/test-helpers.js.map +0 -0
  65. /package/dist/{shared → src/shared}/state/app-state.js +0 -0
  66. /package/dist/{shared → src/shared}/state/app-state.js.map +0 -0
  67. /package/dist/{shared → src/shared}/types/messages.js +0 -0
  68. /package/dist/{shared → src/shared}/types/messages.js.map +0 -0
@@ -1,13 +0,0 @@
1
- // Main entry point for @fairfox/polly-visualize
2
-
3
- // Export DSL generator
4
- export * from "./codegen/structurizr";
5
-
6
- // Export diagram exporter
7
- export * from "./runner/export";
8
-
9
- // Export interactive viewer
10
- export * from "./viewer/server";
11
-
12
- // Re-export analysis functionality for convenience
13
- export { analyzeArchitecture, type ArchitectureAnalysis } from "../../analysis/src";
@@ -1,235 +0,0 @@
1
- // Export static site using Structurizr CLI
2
- // Uses Docker to run Structurizr CLI for generating a static HTML site
3
-
4
- import * as fs from "node:fs";
5
- import * as path from "node:path";
6
- import { spawn } from "node:child_process";
7
-
8
- export interface ExportOptions {
9
- /** DSL file path */
10
- dslPath: string;
11
-
12
- /** Output directory for static site */
13
- outputDir: string;
14
-
15
- /** Timeout in milliseconds */
16
- timeout?: number;
17
-
18
- /** Callback for progress updates */
19
- onProgress?: (message: string) => void;
20
- }
21
-
22
- export interface ExportResult {
23
- success: boolean;
24
- siteDir: string;
25
- error?: string;
26
- }
27
-
28
- export class DiagramExporter {
29
- private static readonly DOCKER_IMAGE = "structurizr/cli:latest";
30
- private static readonly DEFAULT_TIMEOUT = 120000; // 2 minutes
31
-
32
- /**
33
- * Export static site using Structurizr CLI via Docker
34
- */
35
- async export(options: ExportOptions): Promise<ExportResult> {
36
- const { dslPath, outputDir, timeout = DiagramExporter.DEFAULT_TIMEOUT } = options;
37
-
38
- // Validate DSL file exists
39
- if (!fs.existsSync(dslPath)) {
40
- return {
41
- success: false,
42
- siteDir: "",
43
- error: `DSL file not found: ${dslPath}`,
44
- };
45
- }
46
-
47
- // Ensure output directory exists
48
- if (!fs.existsSync(outputDir)) {
49
- fs.mkdirSync(outputDir, { recursive: true });
50
- }
51
-
52
- // Check if Docker is available
53
- const dockerAvailable = await this.isDockerAvailable();
54
- if (!dockerAvailable) {
55
- return {
56
- success: false,
57
- siteDir: "",
58
- error: "Docker is not available. Please install Docker to export the site.",
59
- };
60
- }
61
-
62
- // Pull image if needed
63
- options.onProgress?.("Checking Structurizr CLI image...");
64
- const hasImage = await this.hasImage();
65
- if (!hasImage) {
66
- options.onProgress?.("Pulling Structurizr CLI image (this may take a moment)...");
67
- await this.pullImage((line) => options.onProgress?.(line));
68
- }
69
-
70
- // Export static site
71
- options.onProgress?.("Generating static site...");
72
-
73
- try {
74
- await this.exportStaticSite(dslPath, outputDir, timeout);
75
- options.onProgress?.("✓ Static site generated successfully");
76
-
77
- return {
78
- success: true,
79
- siteDir: outputDir,
80
- };
81
- } catch (error) {
82
- return {
83
- success: false,
84
- siteDir: "",
85
- error: `Failed to export static site: ${error}`,
86
- };
87
- }
88
- }
89
-
90
- /**
91
- * Export static HTML site using Structurizr CLI
92
- */
93
- private async exportStaticSite(
94
- dslPath: string,
95
- outputDir: string,
96
- timeout: number
97
- ): Promise<void> {
98
- const dslDir = path.dirname(dslPath);
99
- const dslFileName = path.basename(dslPath);
100
-
101
- // Docker volume mounts
102
- const workspaceMount = `${dslDir}:/usr/local/structurizr`;
103
- const outputMount = `${outputDir}:/output`;
104
-
105
- // Structurizr CLI command for static site export
106
- const args = [
107
- "run",
108
- "--rm",
109
- "-v",
110
- workspaceMount,
111
- "-v",
112
- outputMount,
113
- DiagramExporter.DOCKER_IMAGE,
114
- "export",
115
- "-workspace",
116
- `/usr/local/structurizr/${dslFileName}`,
117
- "-format",
118
- "static",
119
- "-output",
120
- "/output",
121
- ];
122
-
123
- await this.runDocker(args, timeout);
124
- }
125
-
126
- /**
127
- * Check if Docker is available
128
- */
129
- async isDockerAvailable(): Promise<boolean> {
130
- try {
131
- await this.runCommand("docker", ["--version"], 5000);
132
- return true;
133
- } catch {
134
- return false;
135
- }
136
- }
137
-
138
- /**
139
- * Check if Structurizr CLI image is available
140
- */
141
- async hasImage(): Promise<boolean> {
142
- try {
143
- const output = await this.runCommand(
144
- "docker",
145
- ["images", "-q", DiagramExporter.DOCKER_IMAGE],
146
- 5000
147
- );
148
- return output.trim().length > 0;
149
- } catch {
150
- return false;
151
- }
152
- }
153
-
154
- /**
155
- * Pull Structurizr CLI image
156
- */
157
- async pullImage(onProgress?: (line: string) => void): Promise<void> {
158
- return new Promise((resolve, reject) => {
159
- const proc = spawn("docker", ["pull", DiagramExporter.DOCKER_IMAGE]);
160
-
161
- proc.stdout.on("data", (data) => {
162
- onProgress?.(data.toString().trim());
163
- });
164
-
165
- proc.stderr.on("data", (data) => {
166
- onProgress?.(data.toString().trim());
167
- });
168
-
169
- proc.on("close", (code) => {
170
- if (code === 0) {
171
- resolve();
172
- } else {
173
- reject(new Error(`Failed to pull image, exit code: ${code}`));
174
- }
175
- });
176
-
177
- proc.on("error", (error) => {
178
- reject(error);
179
- });
180
- });
181
- }
182
-
183
- /**
184
- * Run Docker command
185
- */
186
- private async runDocker(args: string[], timeout: number): Promise<string> {
187
- return this.runCommand("docker", args, timeout);
188
- }
189
-
190
- /**
191
- * Run shell command
192
- */
193
- private async runCommand(command: string, args: string[], timeout: number): Promise<string> {
194
- return new Promise((resolve, reject) => {
195
- const proc = spawn(command, args);
196
- let stdout = "";
197
- let stderr = "";
198
-
199
- const timer = setTimeout(() => {
200
- proc.kill();
201
- reject(new Error(`Command timed out after ${timeout}ms`));
202
- }, timeout);
203
-
204
- proc.stdout.on("data", (data) => {
205
- stdout += data.toString();
206
- });
207
-
208
- proc.stderr.on("data", (data) => {
209
- stderr += data.toString();
210
- });
211
-
212
- proc.on("close", (code) => {
213
- clearTimeout(timer);
214
- if (code === 0) {
215
- resolve(stdout);
216
- } else {
217
- reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
218
- }
219
- });
220
-
221
- proc.on("error", (error) => {
222
- clearTimeout(timer);
223
- reject(error);
224
- });
225
- });
226
- }
227
- }
228
-
229
- /**
230
- * Export diagrams
231
- */
232
- export async function exportDiagrams(options: ExportOptions): Promise<ExportResult> {
233
- const exporter = new DiagramExporter();
234
- return exporter.export(options);
235
- }