@emeryld/rrroutes-export 1.0.5 → 1.0.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.
package/README.md CHANGED
@@ -77,6 +77,11 @@ Behavior summary:
77
77
  - route events (`route_added`, `route_removed`, `schema_changed`, `cfg_changed`)
78
78
  - source-object events (`source_object_added`, `source_object_removed`, `source_schema_changed`)
79
79
 
80
+ Runtime progress logs:
81
+
82
+ - `rrroutes-export-changelog` now prints step-by-step progress (window resolution, commit filtering, per-commit snapshot progress, diff totals, output writing, cleanup).
83
+ - Bundle script prints stage logs for snapshot export + changelog export.
84
+
80
85
  ## Recommended end-to-end script
81
86
 
82
87
  Use this when you want one command to produce everything (snapshot + changelog + HTML + summary + timestamped storage).
@@ -135,5 +140,6 @@ const changelog = await exportFinalizedLeavesChangelog({
135
140
  to: 'HEAD',
136
141
  outFile: './finalized-leaves.changelog.json',
137
142
  htmlFile: './finalized-leaves.changelog.viewer.html',
143
+ log: (message) => console.log(message),
138
144
  })
139
145
  ```
@@ -114,6 +114,7 @@ export type ExportFinalizedLeavesChangelogOptions = {
114
114
  openOnFinish?: boolean;
115
115
  includeSource?: boolean;
116
116
  handlers?: ExportFinalizedLeavesOptions['handlers'];
117
+ log?: (message: string) => void;
117
118
  };
118
119
  declare function resolveCommitWindow(cwd: string, from?: string, to?: string): Promise<{
119
120
  from: string;
package/dist/index.cjs CHANGED
@@ -2083,7 +2083,9 @@ async function writeFinalizedLeavesChangelogExport(payload, outFileOrOptions) {
2083
2083
  return written;
2084
2084
  }
2085
2085
  async function exportFinalizedLeavesChangelog(options) {
2086
+ const log = options.log ?? (() => void 0);
2086
2087
  const cwd = process.cwd();
2088
+ log(`[changelog] resolving repository root from ${cwd}`);
2087
2089
  const repoRoot = await runGit(cwd, ["rev-parse", "--show-toplevel"]);
2088
2090
  const modulePathAbsolute = import_node_path4.default.resolve(cwd, options.modulePath);
2089
2091
  const modulePathRelative = normalizePath(import_node_path4.default.relative(repoRoot, modulePathAbsolute));
@@ -2096,25 +2098,36 @@ async function exportFinalizedLeavesChangelog(options) {
2096
2098
  throw new Error("tsconfigPath must resolve inside the git repository root.");
2097
2099
  }
2098
2100
  const exportName = options.exportName ?? "leaves";
2101
+ log("[changelog] resolving commit window");
2099
2102
  const window = await resolveCommitWindow(repoRoot, options.from, options.to);
2103
+ log(`[changelog] window: ${window.from.slice(0, 12)}..${window.to.slice(0, 12)}`);
2100
2104
  const allCommits = await resolveCommitPath(repoRoot, window.from, window.to);
2105
+ log(`[changelog] commits in ancestry path: ${allCommits.length}`);
2101
2106
  const selectedCommitShas = await filterCommits(
2102
2107
  repoRoot,
2103
2108
  allCommits,
2104
2109
  modulePathRelative,
2105
2110
  tsconfigRelative
2106
2111
  );
2112
+ log(`[changelog] commits after path filter: ${selectedCommitShas.length}`);
2107
2113
  if (selectedCommitShas.length === 0) {
2108
2114
  selectedCommitShas.push(window.to);
2115
+ log("[changelog] filter returned no commits, forcing tip commit inclusion");
2109
2116
  }
2110
2117
  const commits = [];
2118
+ log("[changelog] loading commit metadata");
2111
2119
  for (const commit of selectedCommitShas) {
2112
2120
  commits.push(await getCommitMetadata(repoRoot, commit));
2113
2121
  }
2114
2122
  const tempRoot = await import_promises2.default.mkdtemp(import_node_path4.default.join(import_node_os.default.tmpdir(), "rrroutes-export-changelog-"));
2123
+ log(`[changelog] temp workspace: ${tempRoot}`);
2115
2124
  try {
2116
2125
  const snapshots = [];
2117
- for (const commit of commits) {
2126
+ for (let index = 0; index < commits.length; index += 1) {
2127
+ const commit = commits[index];
2128
+ log(
2129
+ `[changelog] snapshot ${index + 1}/${commits.length}: ${commit.sha.slice(0, 12)} ${commit.subject}`
2130
+ );
2118
2131
  snapshots.push(
2119
2132
  await createSnapshot(
2120
2133
  repoRoot,
@@ -2129,6 +2142,7 @@ async function exportFinalizedLeavesChangelog(options) {
2129
2142
  }
2130
2143
  const routeEvents = [];
2131
2144
  const sourceEvents = [];
2145
+ log("[changelog] diffing adjacent snapshots");
2132
2146
  for (let i = 1; i < snapshots.length; i += 1) {
2133
2147
  const { routeEvents: nextRouteEvents, sourceEvents: nextSourceEvents } = diffSnapshots(
2134
2148
  snapshots[i - 1],
@@ -2137,6 +2151,9 @@ async function exportFinalizedLeavesChangelog(options) {
2137
2151
  routeEvents.push(...nextRouteEvents);
2138
2152
  sourceEvents.push(...nextSourceEvents);
2139
2153
  }
2154
+ log(
2155
+ `[changelog] diff complete: route events=${routeEvents.length}, source events=${sourceEvents.length}`
2156
+ );
2140
2157
  const payload = {
2141
2158
  kind: "finalized-leaves-changelog",
2142
2159
  _meta: {
@@ -2154,6 +2171,7 @@ async function exportFinalizedLeavesChangelog(options) {
2154
2171
  rollups: buildRollups(routeEvents, sourceEvents, commits)
2155
2172
  };
2156
2173
  if (options.outFile || options.htmlFile) {
2174
+ log("[changelog] writing output artifacts");
2157
2175
  await writeFinalizedLeavesChangelogExport(payload, {
2158
2176
  outFile: options.outFile,
2159
2177
  htmlFile: options.htmlFile,
@@ -2161,9 +2179,11 @@ async function exportFinalizedLeavesChangelog(options) {
2161
2179
  openOnFinish: options.openOnFinish
2162
2180
  });
2163
2181
  }
2182
+ log("[changelog] done");
2164
2183
  return payload;
2165
2184
  } finally {
2166
2185
  await import_promises2.default.rm(tempRoot, { recursive: true, force: true }).catch(() => void 0);
2186
+ log("[changelog] cleaned temp workspace");
2167
2187
  }
2168
2188
  }
2169
2189
  var __private = {
@@ -2210,6 +2230,10 @@ function parseFinalizedLeavesChangelogCliArgs(argv) {
2210
2230
  }
2211
2231
  async function runExportFinalizedLeavesChangelogCli(argv) {
2212
2232
  const args = parseFinalizedLeavesChangelogCliArgs(argv);
2233
+ const log = (message) => {
2234
+ process.stdout.write(`${message}
2235
+ `);
2236
+ };
2213
2237
  const options = {
2214
2238
  modulePath: args.modulePath,
2215
2239
  exportName: args.exportName,
@@ -2218,9 +2242,12 @@ async function runExportFinalizedLeavesChangelogCli(argv) {
2218
2242
  tsconfigPath: args.tsconfigPath,
2219
2243
  from: args.from,
2220
2244
  to: args.to,
2221
- includeSource: true
2245
+ includeSource: true,
2246
+ log
2222
2247
  };
2248
+ log("[changelog-cli] starting changelog export");
2223
2249
  const payload = await exportFinalizedLeavesChangelog(options);
2250
+ log("[changelog-cli] changelog export completed");
2224
2251
  return {
2225
2252
  payload,
2226
2253
  outFile: import_node_path5.default.resolve(args.outFile),