@reshotdev/screenshot 0.0.1-beta.2 → 0.0.1-beta.20
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/LICENSE +1 -1
- package/README.md +138 -47
- package/package.json +27 -16
- package/src/commands/auth.js +159 -30
- package/src/commands/capture-dom.js +50 -0
- package/src/commands/certify.js +62 -0
- package/src/commands/compose.js +220 -0
- package/src/commands/doctor-release.js +74 -0
- package/src/commands/doctor-target.js +108 -0
- package/src/commands/drifts.js +16 -69
- package/src/commands/import-tests.js +13 -13
- package/src/commands/init.js +16 -277
- package/src/commands/publish.js +484 -257
- package/src/commands/pull.js +302 -35
- package/src/commands/refresh.js +166 -0
- package/src/commands/run.js +292 -12
- package/src/commands/setup-wizard.js +348 -496
- package/src/commands/status.js +334 -126
- package/src/commands/sync.js +28 -236
- package/src/commands/ui.js +1 -1
- package/src/commands/variation.js +194 -0
- package/src/commands/verify-publish.js +46 -0
- package/src/index.js +383 -118
- package/src/lib/api-client.js +172 -60
- package/src/lib/auto-update/refresh.js +598 -0
- package/src/lib/auto-update/scene-runtime.compose.tsx +73 -0
- package/src/lib/auto-update/spec.js +89 -0
- package/src/lib/capture-engine.js +179 -9
- package/src/lib/capture-script-runner.js +639 -214
- package/src/lib/certification.js +887 -0
- package/src/lib/compose-context.js +156 -0
- package/src/lib/compose-pack.js +42 -0
- package/src/lib/compose-runtime.js +34 -0
- package/src/lib/compose-upload.js +142 -0
- package/src/lib/config.js +186 -81
- package/src/lib/dom-capture.js +64 -0
- package/src/lib/ensure-browser.js +147 -0
- package/src/lib/output-path-template.js +3 -3
- package/src/lib/record-cdp.js +288 -16
- package/src/lib/record-clip.js +83 -3
- package/src/lib/record-config.js +1 -5
- package/src/lib/release-doctor.js +321 -0
- package/src/lib/resolve-targets.js +60 -0
- package/src/lib/run-manifest.js +148 -0
- package/src/lib/standalone-mode.js +1 -1
- package/src/lib/storage-providers.js +5 -5
- package/src/lib/style-engine.js +5 -5
- package/src/lib/target-contract.js +292 -0
- package/src/lib/ui-api-helpers.js +118 -0
- package/src/lib/ui-api.js +31 -824
- package/src/lib/ui-asset-cleanup.js +62 -0
- package/src/lib/ui-output-versions.js +165 -0
- package/src/lib/ui-recorder-routes.js +341 -0
- package/src/lib/ui-scenario-metadata.js +161 -0
- package/vendor/compose/dist/auto-update.cjs +5544 -0
- package/vendor/compose/dist/auto-update.mjs +5518 -0
- package/vendor/compose/dist/capture.cjs +1450 -0
- package/vendor/compose/dist/capture.mjs +1416 -0
- package/vendor/compose/dist/eligibility.cjs +5331 -0
- package/vendor/compose/dist/eligibility.mjs +5313 -0
- package/vendor/compose/dist/index.cjs +2046 -0
- package/vendor/compose/dist/index.mjs +1997 -0
- package/vendor/compose/dist/jsx-dev-runtime.cjs +55 -0
- package/vendor/compose/dist/jsx-dev-runtime.mjs +27 -0
- package/vendor/compose/dist/jsx-runtime.cjs +58 -0
- package/vendor/compose/dist/jsx-runtime.mjs +31 -0
- package/vendor/compose/dist/render.cjs +558 -0
- package/vendor/compose/dist/render.mjs +515 -0
- package/vendor/compose/dist/verify-cli.cjs +3806 -0
- package/vendor/compose/dist/verify-cli.mjs +3812 -0
- package/vendor/compose/dist/verify.cjs +3880 -0
- package/vendor/compose/dist/verify.mjs +3858 -0
- package/web/manager/dist/assets/index-D0S2otug.js +507 -0
- package/web/manager/dist/index.html +1 -1
- package/src/commands/ci-run.js +0 -123
- package/src/commands/ci-setup.js +0 -288
- package/src/commands/ingest.js +0 -458
- package/src/commands/setup.js +0 -137
- package/src/commands/validate-docs.js +0 -529
- package/src/lib/playwright-runner.js +0 -252
- package/web/manager/dist/assets/index--ZgioErz.js +0 -507
|
@@ -250,7 +250,7 @@ async function importTestsCommand(options = {}) {
|
|
|
250
250
|
{
|
|
251
251
|
type: "confirm",
|
|
252
252
|
name: "confirm",
|
|
253
|
-
message: "Save these mappings to
|
|
253
|
+
message: "Save these mappings to reshot.config.json?",
|
|
254
254
|
default: true,
|
|
255
255
|
},
|
|
256
256
|
]);
|
|
@@ -261,36 +261,36 @@ async function importTestsCommand(options = {}) {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
// Update
|
|
265
|
-
let
|
|
264
|
+
// Update reshot.config.json
|
|
265
|
+
let reshotConfig;
|
|
266
266
|
try {
|
|
267
|
-
// Try to read existing config (use
|
|
268
|
-
|
|
267
|
+
// Try to read existing config (use readConfigLenient which is less strict)
|
|
268
|
+
reshotConfig = config.readConfigLenient();
|
|
269
269
|
} catch {
|
|
270
270
|
// Create new config with minimal required fields
|
|
271
|
-
|
|
272
|
-
$schema: "https://reshot.dev/schemas/
|
|
271
|
+
reshotConfig = {
|
|
272
|
+
$schema: "https://reshot.dev/schemas/reshot-config.json",
|
|
273
273
|
version: "2.0",
|
|
274
274
|
scenarios: [],
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
// Add visuals section with trace mappings
|
|
279
|
-
|
|
280
|
-
...
|
|
279
|
+
reshotConfig.visuals = {
|
|
280
|
+
...reshotConfig.visuals,
|
|
281
281
|
traceDir: pwConfig.outputDir,
|
|
282
282
|
journeyMappings,
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
// Ensure scenarios array exists for config.readConfig() compatibility
|
|
286
|
-
if (!
|
|
287
|
-
|
|
286
|
+
if (!reshotConfig.scenarios) {
|
|
287
|
+
reshotConfig.scenarios = [];
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
config.writeConfig(
|
|
290
|
+
config.writeConfig(reshotConfig);
|
|
291
291
|
|
|
292
292
|
console.log(
|
|
293
|
-
chalk.green("\n✓ Updated
|
|
293
|
+
chalk.green("\n✓ Updated reshot.config.json with journey mappings"),
|
|
294
294
|
);
|
|
295
295
|
console.log(chalk.gray("\nNext steps:"));
|
|
296
296
|
console.log(
|
package/src/commands/init.js
CHANGED
|
@@ -14,123 +14,10 @@ const {
|
|
|
14
14
|
getConfigDefaults,
|
|
15
15
|
} = require("../lib/standalone-mode");
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Auto-detect documentation directories
|
|
19
|
-
*/
|
|
20
|
-
function detectDocumentationRoot() {
|
|
21
|
-
const commonPaths = [
|
|
22
|
-
"docs",
|
|
23
|
-
"documentation",
|
|
24
|
-
"content",
|
|
25
|
-
"doc",
|
|
26
|
-
"guides",
|
|
27
|
-
".vitepress/content",
|
|
28
|
-
".docusaurus/docs",
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
for (const dir of commonPaths) {
|
|
32
|
-
const fullPath = path.join(process.cwd(), dir);
|
|
33
|
-
if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) {
|
|
34
|
-
// Check if it has markdown files
|
|
35
|
-
const files = fs.readdirSync(fullPath);
|
|
36
|
-
if (files.some((f) => f.endsWith(".md") || f.endsWith(".mdx"))) {
|
|
37
|
-
return dir;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Generate documentation block configuration
|
|
47
|
-
*/
|
|
48
|
-
function generateDocumentationConfig(root = "./docs", strategy = "git_pr") {
|
|
49
|
-
return {
|
|
50
|
-
root,
|
|
51
|
-
include: ["**/*.md", "**/*.mdx"],
|
|
52
|
-
exclude: ["**/_*.mdx", "**/node_modules/**", "**/.next/**"],
|
|
53
|
-
strategy,
|
|
54
|
-
assetFormat: "markdown",
|
|
55
|
-
mappings: {},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Scaffold a basic documentation structure
|
|
61
|
-
*/
|
|
62
|
-
async function scaffoldDocumentation() {
|
|
63
|
-
const docsDir = path.join(process.cwd(), "docs");
|
|
64
|
-
|
|
65
|
-
// Create docs directory
|
|
66
|
-
fs.ensureDirSync(docsDir);
|
|
67
|
-
|
|
68
|
-
// Create README
|
|
69
|
-
const readmeContent = `# Documentation
|
|
70
|
-
|
|
71
|
-
This directory contains documentation for your project.
|
|
72
|
-
|
|
73
|
-
## Getting Started
|
|
74
|
-
|
|
75
|
-
Documentation files are automatically synced with your codebase using Reshot DocSync.
|
|
76
|
-
|
|
77
|
-
### Linking Docs to Visuals
|
|
78
|
-
|
|
79
|
-
Add frontmatter to your markdown files to link them to visual journeys:
|
|
80
|
-
|
|
81
|
-
\`\`\`markdown
|
|
82
|
-
---
|
|
83
|
-
title: "Feature Name"
|
|
84
|
-
reshot_journey: "feature/workflow-name"
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
# Feature Documentation
|
|
88
|
-
|
|
89
|
-
Your content here...
|
|
90
|
-
\`\`\`
|
|
91
|
-
|
|
92
|
-
## Commands
|
|
93
|
-
|
|
94
|
-
- \`reshot validate\` - Validate documentation configuration
|
|
95
|
-
- \`reshot ingest\` - Upload traces and documentation
|
|
96
|
-
- \`reshot drifts\` - View and manage documentation drifts
|
|
97
|
-
|
|
98
|
-
For more information, visit: https://docs.reshot.dev
|
|
99
|
-
`;
|
|
100
|
-
|
|
101
|
-
fs.writeFileSync(path.join(docsDir, "README.md"), readmeContent);
|
|
102
|
-
|
|
103
|
-
// Create example doc
|
|
104
|
-
const exampleContent = `---
|
|
105
|
-
title: "Getting Started"
|
|
106
|
-
reshot_journey: "onboarding/first-steps"
|
|
107
|
-
description: "Quick start guide for new users"
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
# Getting Started
|
|
111
|
-
|
|
112
|
-
Welcome! This is an example documentation file.
|
|
113
|
-
|
|
114
|
-
## Steps
|
|
115
|
-
|
|
116
|
-
1. **Step 1**: Description of first step
|
|
117
|
-
2. **Step 2**: Description of second step
|
|
118
|
-
3. **Step 3**: Description of third step
|
|
119
|
-
|
|
120
|
-
## Next Steps
|
|
121
|
-
|
|
122
|
-
Continue to the next guide...
|
|
123
|
-
`;
|
|
124
|
-
|
|
125
|
-
fs.writeFileSync(path.join(docsDir, "getting-started.md"), exampleContent);
|
|
126
|
-
|
|
127
|
-
return "docs";
|
|
128
|
-
}
|
|
129
|
-
|
|
130
17
|
async function initCommand() {
|
|
131
18
|
console.log(chalk.cyan("🚀 Initializing Reshot...\n"));
|
|
132
19
|
|
|
133
|
-
// Check if we already have a
|
|
20
|
+
// Check if we already have a reshot.config.json with BYOS storage config
|
|
134
21
|
let existingConfig = null;
|
|
135
22
|
let isBYOSMode = false;
|
|
136
23
|
|
|
@@ -272,7 +159,7 @@ async function initCommand() {
|
|
|
272
159
|
|
|
273
160
|
// Create a basic BYOS config with sane defaults
|
|
274
161
|
const byosConfig = {
|
|
275
|
-
$schema: "https://reshot.dev/schemas/
|
|
162
|
+
$schema: "https://reshot.dev/schemas/reshot-config.json",
|
|
276
163
|
version: "2.0",
|
|
277
164
|
baseUrl: "http://localhost:3000",
|
|
278
165
|
assetDir: ".reshot/output",
|
|
@@ -359,7 +246,7 @@ async function initCommand() {
|
|
|
359
246
|
|
|
360
247
|
console.log(
|
|
361
248
|
chalk.green(
|
|
362
|
-
"\n✔ Created
|
|
249
|
+
"\n✔ Created reshot.config.json with BYOS storage configuration"
|
|
363
250
|
)
|
|
364
251
|
);
|
|
365
252
|
console.log(chalk.cyan("\nNext steps:"));
|
|
@@ -396,13 +283,13 @@ async function initCommand() {
|
|
|
396
283
|
name: "overwrite",
|
|
397
284
|
default: false,
|
|
398
285
|
message:
|
|
399
|
-
"
|
|
286
|
+
"reshot.config.json already exists. Overwrite it with the latest blueprint?",
|
|
400
287
|
},
|
|
401
288
|
]);
|
|
402
289
|
overwrite = answer.overwrite;
|
|
403
290
|
|
|
404
291
|
if (!overwrite) {
|
|
405
|
-
console.log(chalk.yellow("⚠ Existing
|
|
292
|
+
console.log(chalk.yellow("⚠ Existing reshot.config.json preserved."));
|
|
406
293
|
return;
|
|
407
294
|
}
|
|
408
295
|
}
|
|
@@ -412,132 +299,8 @@ async function initCommand() {
|
|
|
412
299
|
overwrite,
|
|
413
300
|
});
|
|
414
301
|
|
|
415
|
-
// Auto-detect and configure documentation
|
|
416
|
-
console.log(chalk.cyan("\n📚 Configuring documentation sync..."));
|
|
417
|
-
|
|
418
|
-
let docsRoot = detectDocumentationRoot();
|
|
419
|
-
let shouldScaffold = false;
|
|
420
|
-
|
|
421
|
-
if (!docsRoot) {
|
|
422
|
-
console.log(chalk.yellow(" No documentation directory detected."));
|
|
423
|
-
|
|
424
|
-
const { action } = await inquirer.prompt([
|
|
425
|
-
{
|
|
426
|
-
type: "list",
|
|
427
|
-
name: "action",
|
|
428
|
-
message: "Would you like to:",
|
|
429
|
-
choices: [
|
|
430
|
-
{
|
|
431
|
-
name: "Create a new docs/ directory with examples",
|
|
432
|
-
value: "scaffold",
|
|
433
|
-
},
|
|
434
|
-
{ name: "Specify an existing directory", value: "specify" },
|
|
435
|
-
{ name: "Skip documentation setup (add later)", value: "skip" },
|
|
436
|
-
],
|
|
437
|
-
},
|
|
438
|
-
]);
|
|
439
|
-
|
|
440
|
-
if (action === "scaffold") {
|
|
441
|
-
console.log(chalk.cyan(" Creating docs/ directory..."));
|
|
442
|
-
docsRoot = await scaffoldDocumentation();
|
|
443
|
-
shouldScaffold = true;
|
|
444
|
-
console.log(chalk.green(" ✔ Created docs/ with example files"));
|
|
445
|
-
} else if (action === "specify") {
|
|
446
|
-
const { customPath } = await inquirer.prompt([
|
|
447
|
-
{
|
|
448
|
-
type: "input",
|
|
449
|
-
name: "customPath",
|
|
450
|
-
message: "Documentation directory path:",
|
|
451
|
-
default: "./docs",
|
|
452
|
-
validate: (input) => {
|
|
453
|
-
const fullPath = path.join(process.cwd(), input);
|
|
454
|
-
if (!fs.existsSync(fullPath)) {
|
|
455
|
-
return `Directory ${input} does not exist. Create it first or choose scaffold option.`;
|
|
456
|
-
}
|
|
457
|
-
return true;
|
|
458
|
-
},
|
|
459
|
-
},
|
|
460
|
-
]);
|
|
461
|
-
docsRoot = customPath;
|
|
462
|
-
}
|
|
463
|
-
} else {
|
|
464
|
-
console.log(chalk.green(` ✔ Detected documentation at: ${docsRoot}`));
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// Add documentation block to config
|
|
468
|
-
if (docsRoot) {
|
|
469
|
-
// Detect if this is a GitHub repo for strategy recommendation
|
|
470
|
-
const isGitRepo = fs.existsSync(path.join(process.cwd(), ".git"));
|
|
471
|
-
const hasGitHubRemote =
|
|
472
|
-
isGitRepo &&
|
|
473
|
-
(() => {
|
|
474
|
-
try {
|
|
475
|
-
const { execSync } = require("child_process");
|
|
476
|
-
const remote = execSync("git remote get-url origin", {
|
|
477
|
-
encoding: "utf-8",
|
|
478
|
-
});
|
|
479
|
-
return remote.includes("github.com");
|
|
480
|
-
} catch {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
})();
|
|
484
|
-
|
|
485
|
-
let strategy = "git_pr";
|
|
486
|
-
|
|
487
|
-
if (hasGitHubRemote) {
|
|
488
|
-
console.log(chalk.cyan(" ✔ Detected GitHub repository"));
|
|
489
|
-
const { useGitPR } = await inquirer.prompt([
|
|
490
|
-
{
|
|
491
|
-
type: "confirm",
|
|
492
|
-
name: "useGitPR",
|
|
493
|
-
message:
|
|
494
|
-
"Automatically create Pull Requests for documentation updates?",
|
|
495
|
-
default: true,
|
|
496
|
-
},
|
|
497
|
-
]);
|
|
498
|
-
strategy = useGitPR ? "git_pr" : "external_host";
|
|
499
|
-
} else {
|
|
500
|
-
const { strategyChoice } = await inquirer.prompt([
|
|
501
|
-
{
|
|
502
|
-
type: "list",
|
|
503
|
-
name: "strategyChoice",
|
|
504
|
-
message: "How should documentation updates be delivered?",
|
|
505
|
-
choices: [
|
|
506
|
-
{
|
|
507
|
-
name: "Git Pull Requests (recommended for GitHub/GitLab repos)",
|
|
508
|
-
value: "git_pr",
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: "Notifications only (for external CMS like ReadMe, GitBook)",
|
|
512
|
-
value: "external_host",
|
|
513
|
-
},
|
|
514
|
-
],
|
|
515
|
-
},
|
|
516
|
-
]);
|
|
517
|
-
strategy = strategyChoice;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
blueprint.documentation = generateDocumentationConfig(
|
|
521
|
-
docsRoot,
|
|
522
|
-
strategy
|
|
523
|
-
);
|
|
524
|
-
|
|
525
|
-
// Save updated config
|
|
526
|
-
config.writeConfig(blueprint);
|
|
527
|
-
|
|
528
|
-
console.log(chalk.green(" ✔ Documentation sync configured"));
|
|
529
|
-
console.log(chalk.gray(` Root: ${docsRoot}`));
|
|
530
|
-
console.log(chalk.gray(` Strategy: ${strategy}`));
|
|
531
|
-
|
|
532
|
-
if (shouldScaffold) {
|
|
533
|
-
console.log(chalk.cyan("\n 📝 Example files created:"));
|
|
534
|
-
console.log(chalk.gray(" - docs/README.md"));
|
|
535
|
-
console.log(chalk.gray(" - docs/getting-started.md"));
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
302
|
if (blueprint._metadata?.projectName) {
|
|
540
|
-
console.log(chalk.green("✔ Pulled
|
|
303
|
+
console.log(chalk.green("✔ Pulled reshot.config.json from Reshot"));
|
|
541
304
|
} else {
|
|
542
305
|
console.log(
|
|
543
306
|
chalk.yellow(
|
|
@@ -545,7 +308,7 @@ async function initCommand() {
|
|
|
545
308
|
)
|
|
546
309
|
);
|
|
547
310
|
}
|
|
548
|
-
console.log(chalk.green("✔ Saved
|
|
311
|
+
console.log(chalk.green("✔ Saved reshot.config.json"));
|
|
549
312
|
|
|
550
313
|
const updatedSettings = config.readSettings();
|
|
551
314
|
console.log("");
|
|
@@ -559,7 +322,7 @@ async function initCommand() {
|
|
|
559
322
|
console.log("\nNext steps:");
|
|
560
323
|
console.log(
|
|
561
324
|
` 1. Review ${chalk.bold(
|
|
562
|
-
"
|
|
325
|
+
"reshot.config.json"
|
|
563
326
|
)} and commit it to your repo.`
|
|
564
327
|
);
|
|
565
328
|
console.log(
|
|
@@ -568,38 +331,14 @@ async function initCommand() {
|
|
|
568
331
|
)}`
|
|
569
332
|
);
|
|
570
333
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
)
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
);
|
|
580
|
-
console.log(
|
|
581
|
-
` 3. Run ${chalk.bold(
|
|
582
|
-
"reshot validate"
|
|
583
|
-
)} to check your documentation setup.`
|
|
584
|
-
);
|
|
585
|
-
console.log(
|
|
586
|
-
` 4. Run Playwright tests to generate traces, then ${chalk.bold(
|
|
587
|
-
"reshot ingest"
|
|
588
|
-
)}`
|
|
589
|
-
);
|
|
590
|
-
console.log(
|
|
591
|
-
` 5. Push your branch - Reshot will detect drift and create PRs.`
|
|
592
|
-
);
|
|
593
|
-
} else {
|
|
594
|
-
console.log(
|
|
595
|
-
` 2. Run ${chalk.bold(
|
|
596
|
-
'reshot record "My Visual"'
|
|
597
|
-
)} to capture your first flow.`
|
|
598
|
-
);
|
|
599
|
-
console.log(
|
|
600
|
-
` 3. Push your branch and open a PR. Reshot will post visual changes as a PR comment.`
|
|
601
|
-
);
|
|
602
|
-
}
|
|
334
|
+
console.log(
|
|
335
|
+
` 2. Run ${chalk.bold(
|
|
336
|
+
'reshot record "My Visual"'
|
|
337
|
+
)} to capture your first flow.`
|
|
338
|
+
);
|
|
339
|
+
console.log(
|
|
340
|
+
` 3. Push your branch and open a PR. Reshot will post visual changes as a PR comment.`
|
|
341
|
+
);
|
|
603
342
|
console.log("");
|
|
604
343
|
} catch (error) {
|
|
605
344
|
console.error(chalk.red("Failed to initialize:"), error.message);
|