@reshotdev/screenshot 0.0.1-beta.4 → 0.0.1-beta.6

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.
@@ -390,13 +390,13 @@ function resolveProjectContext({ settings, docSyncConfig, storageMode }) {
390
390
  if (!apiKey) {
391
391
  throw new Error(
392
392
  "No API key found. Set RESHOT_API_KEY in your environment or run `reshot auth` locally to create .reshot/settings.json.\n" +
393
- "Alternatively, configure BYOS (Bring Your Own Storage) in docsync.config.json to publish without authentication.",
393
+ "Alternatively, configure BYOS (Bring Your Own Storage) in reshot.config.json to publish without authentication.",
394
394
  );
395
395
  }
396
396
 
397
397
  if (!projectId) {
398
398
  throw new Error(
399
- "No project ID found. Set RESHOT_PROJECT_ID in your environment or ensure docsync.config.json contains _metadata.projectId.",
399
+ "No project ID found. Set RESHOT_PROJECT_ID in your environment or ensure reshot.config.json contains _metadata.projectId.",
400
400
  );
401
401
  }
402
402
 
@@ -1167,70 +1167,6 @@ function getRecentCommits(lastCommitHash) {
1167
1167
  }
1168
1168
  }
1169
1169
 
1170
- /**
1171
- * Recursively find all markdown files matching include/exclude patterns
1172
- */
1173
- function findDocFiles(
1174
- docsRoot,
1175
- includePatterns = ["**/*.md", "**/*.mdx"],
1176
- excludePatterns = [],
1177
- ) {
1178
- const files = [];
1179
- const rootPath = path.resolve(process.cwd(), docsRoot);
1180
-
1181
- if (!fs.existsSync(rootPath)) {
1182
- return files;
1183
- }
1184
-
1185
- function walkDir(dir, relativePath = "") {
1186
- const items = fs.readdirSync(dir);
1187
-
1188
- for (const item of items) {
1189
- const fullPath = path.join(dir, item);
1190
- const relativeItemPath = path
1191
- .join(relativePath, item)
1192
- .replace(/\\/g, "/");
1193
- const stat = fs.statSync(fullPath);
1194
-
1195
- // Check exclude patterns
1196
- const shouldExclude = excludePatterns.some((pattern) => {
1197
- const regex = new RegExp(
1198
- pattern.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*"),
1199
- );
1200
- return regex.test(relativeItemPath) || regex.test(fullPath);
1201
- });
1202
-
1203
- if (shouldExclude) {
1204
- continue;
1205
- }
1206
-
1207
- if (stat.isDirectory()) {
1208
- walkDir(fullPath, relativeItemPath);
1209
- } else if (stat.isFile()) {
1210
- const ext = path.extname(item).toLowerCase();
1211
- const matchesInclude = includePatterns.some((pattern) => {
1212
- const regex = new RegExp(
1213
- pattern.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*"),
1214
- );
1215
- return (
1216
- regex.test(relativeItemPath) || ext === ".md" || ext === ".mdx"
1217
- );
1218
- });
1219
-
1220
- if (matchesInclude && (ext === ".md" || ext === ".mdx")) {
1221
- files.push({
1222
- fullPath,
1223
- relativePath: relativeItemPath,
1224
- });
1225
- }
1226
- }
1227
- }
1228
- }
1229
-
1230
- walkDir(rootPath);
1231
- return files;
1232
- }
1233
-
1234
1170
  /**
1235
1171
  * Parse frontmatter from markdown content
1236
1172
  */
@@ -1368,8 +1304,6 @@ async function publishCommand(options = {}) {
1368
1304
  // Get feature toggles
1369
1305
  const features = docSyncConfig?._metadata?.features || {
1370
1306
  visuals: true,
1371
- docs: false,
1372
- changelog: true,
1373
1307
  };
1374
1308
 
1375
1309
  // Get git information
@@ -1558,141 +1492,6 @@ async function publishCommand(options = {}) {
1558
1492
  );
1559
1493
  }
1560
1494
 
1561
- // Stream B: Documentation
1562
- if (features.docs === true) {
1563
- console.log(chalk.cyan("\n📚 Publishing documentation...\n"));
1564
-
1565
- if (!docSyncConfig || !docSyncConfig.docs) {
1566
- console.log(
1567
- chalk.yellow(
1568
- " ⚠ No docs configuration found in docsync.config.json. Skipping docs stream.",
1569
- ),
1570
- );
1571
- } else {
1572
- const docsConfig = docSyncConfig.docs;
1573
- const docsRoot = docsConfig.root || "./docs";
1574
- const includePatterns = docsConfig.include || ["**/*.md", "**/*.mdx"];
1575
- const excludePatterns = docsConfig.exclude || [
1576
- "**/node_modules/**",
1577
- "**/.git/**",
1578
- ];
1579
-
1580
- const docFiles = findDocFiles(docsRoot, includePatterns, excludePatterns);
1581
-
1582
- if (docFiles.length === 0) {
1583
- console.log(
1584
- chalk.yellow(" ⚠ No documentation files found to publish."),
1585
- );
1586
- } else {
1587
- console.log(
1588
- chalk.cyan(` Found ${docFiles.length} documentation file(s)\n`),
1589
- );
1590
-
1591
- const docsPayload = [];
1592
- for (const docFile of docFiles) {
1593
- const content = fs.readFileSync(docFile.fullPath, "utf-8");
1594
- const { frontmatter, content: docContent } =
1595
- parseFrontmatter(content);
1596
-
1597
- docsPayload.push({
1598
- path: docFile.relativePath,
1599
- content: docContent,
1600
- frontmatter:
1601
- Object.keys(frontmatter).length > 0 ? frontmatter : undefined,
1602
- status: frontmatter.status || "draft",
1603
- });
1604
- }
1605
-
1606
- // Docs publishing requires platform (no BYOS support yet)
1607
- if (resolvedMode === "byos") {
1608
- console.log(
1609
- chalk.yellow(
1610
- " ⚠ Documentation publishing requires Reshot platform.",
1611
- ),
1612
- );
1613
- console.log(
1614
- chalk.gray(
1615
- " Run 'reshot auth' to enable doc hosting with review workflow.",
1616
- ),
1617
- );
1618
- } else {
1619
- try {
1620
- const result = await apiClient.publishDocs(apiKey, {
1621
- projectId,
1622
- docs: docsPayload,
1623
- });
1624
- console.log(
1625
- chalk.green(
1626
- ` ✔ Published ${result.created || 0} new doc(s), updated ${
1627
- result.updated || 0
1628
- } doc(s)`,
1629
- ),
1630
- );
1631
- } catch (error) {
1632
- console.log(
1633
- chalk.red(` ✖ Failed to publish docs: ${error.message}`),
1634
- );
1635
- }
1636
- }
1637
- }
1638
- }
1639
- } else {
1640
- console.log(
1641
- chalk.yellow(
1642
- " ⚠ Documentation publishing is disabled for this project.",
1643
- ),
1644
- );
1645
- }
1646
-
1647
- // Stream C: Changelog
1648
- if (features.changelog === true) {
1649
- // Changelog requires platform (no BYOS support)
1650
- if (resolvedMode === "byos") {
1651
- console.log(chalk.cyan("\n📝 Changelog drafts...\n"));
1652
- console.log(
1653
- chalk.yellow(
1654
- " ⚠ Changelog requires Reshot platform for tracking and publishing.",
1655
- ),
1656
- );
1657
- console.log(
1658
- chalk.gray(" Run 'reshot auth' to enable changelog generation."),
1659
- );
1660
- } else {
1661
- console.log(chalk.cyan("\n📝 Posting changelog drafts...\n"));
1662
- const lastPublishedHash = settings?.lastPublishedCommitHash;
1663
- const recentCommits = getRecentCommits(lastPublishedHash);
1664
-
1665
- if (recentCommits.length > 0) {
1666
- try {
1667
- await apiClient.postChangelogDrafts(projectId, recentCommits, apiKey);
1668
- console.log(
1669
- chalk.green(
1670
- ` ✔ Posted ${recentCommits.length} changelog draft(s)`,
1671
- ),
1672
- );
1673
-
1674
- // Update last published commit hash
1675
- if (settings) {
1676
- settings.lastPublishedCommitHash = commitHash;
1677
- config.writeSettings(settings);
1678
- }
1679
- } catch (error) {
1680
- console.log(
1681
- chalk.yellow(
1682
- ` ⚠ Failed to post changelog drafts: ${error.message}`,
1683
- ),
1684
- );
1685
- }
1686
- } else {
1687
- console.log(chalk.gray(" No new commits to publish"));
1688
- }
1689
- }
1690
- } else {
1691
- console.log(
1692
- chalk.yellow(" ⚠ Changelog publishing is disabled for this project."),
1693
- );
1694
- }
1695
-
1696
1495
  // Print upgrade path for BYOS users
1697
1496
  if (resolvedMode === "byos") {
1698
1497
  console.log(chalk.cyan("\n💡 Upgrade to Reshot Platform for:"));
@@ -1700,7 +1499,7 @@ async function publishCommand(options = {}) {
1700
1499
  console.log(chalk.gray(" • Unbreakable URLs that never change"));
1701
1500
  console.log(chalk.gray(" • Version history and rollback"));
1702
1501
  console.log(chalk.gray(" • Team collaboration and RBAC"));
1703
- console.log(chalk.gray(" • Automatic changelog generation"));
1502
+ console.log(chalk.gray(" • Drift detection and notifications"));
1704
1503
  console.log(chalk.gray("\n Run 'reshot auth' to connect your project."));
1705
1504
  }
1706
1505
 
@@ -112,7 +112,7 @@ async function pullCommand(options = {}) {
112
112
  projectConfig = config.readConfig();
113
113
  } catch (e) {
114
114
  console.error(
115
- chalk.red("Error: No docsync.config.json found. Run 'reshot init' first.")
115
+ chalk.red("Error: No reshot.config.json found. Run 'reshot init' first.")
116
116
  );
117
117
  process.exit(1);
118
118
  }
@@ -120,7 +120,7 @@ async function pullCommand(options = {}) {
120
120
  const projectId = projectConfig._metadata?.projectId || projectConfig.projectId;
121
121
  if (!projectId) {
122
122
  console.error(
123
- chalk.red("Error: No projectId found in docsync.config.json")
123
+ chalk.red("Error: No projectId found in reshot.config.json")
124
124
  );
125
125
  process.exit(1);
126
126
  }