@warpgogol/repo-extract 1.3.0 → 1.4.0

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
@@ -42,12 +42,22 @@ npx @warpgogol/repo-extract --config extract.config.yaml --dry-run
42
42
 
43
43
  ## CLI flags
44
44
 
45
- | Flag | Description |
46
- | ----------------- | ------------------------------------------------ |
47
- | `--config <path>` | Path to `extract.config.yaml` (required) |
48
- | `--dest <path>` | Destination directory (overrides config default) |
49
- | `--dry-run` | Print plan without writing files |
50
- | `--verbose` | Verbose output |
45
+ | Flag | Description |
46
+ | ------------------ | ------------------------------------------------------------------- |
47
+ | `--config <path>` | Path to `extract.config.yaml` (required) |
48
+ | `--dest <path>` | Destination directory (overrides config default) |
49
+ | `--dry-run` | Print plan without writing files |
50
+ | `--verbose` | Verbose output |
51
+ | `--from-head` | Export HEAD via a temporary worktree (ignores working-tree changes) |
52
+ | `--ref <sha\|ref>` | Export a specific ref (implies `--from-head`) |
53
+ | `--allow-dirty` | Allow exporting with uncommitted changes |
54
+ | `--no-push` | Commit the export locally without pushing |
55
+
56
+ ### Clean-source behavior
57
+
58
+ By default, `repo-extract` aborts when the exported directories carry uncommitted changes — a release must never silently include stray WIP. Pass `--allow-dirty` to opt out explicitly, or `--from-head`/`--ref` to export committed content only: the tool materializes a temporary `git worktree` at the ref, copies from it, and removes it afterward. `versionBump` cannot combine with `--from-head` — bump and commit the source first, then export the bumped revision.
59
+
60
+ The preflight checks every source path the export reads — declared `copyDirs`/`appDirs`/`packageDirs`, root inputs (`package.json`, `tsconfig.base.json`, lockfiles, the `extends` target of `projectDir/tsconfig.json`), monorepo config defaults in monorepo mode, and `packages/*/package.json` when `preservePackages` is used. Gitignored files are invisible to it; `--from-head` is the airtight path. Note: `extract.config.yaml` itself is still loaded from the ambient working tree — keep it committed and clean for release exports.
51
61
 
52
62
  ## Configuration
53
63
 
@@ -60,12 +70,18 @@ projectDir: packages/my-package
60
70
  destName: my-package
61
71
  standalone: true
62
72
 
73
+ # source: worktree # "worktree" (default) or "head" — like --from-head
74
+ # allowDirty: false # default: abort on uncommitted changes in exported dirs
75
+
63
76
  git:
64
77
  remote: git@github.com:user/my-package.git
65
78
  autoPush: true
79
+ # autoReconcile: true # on non-fast-forward push: fetch + merge -s ours + retry
66
80
  ```
67
81
 
68
- Standalone mode flattens the package to the repo root — `src/`, `tests/`, `package.json`, etc. become top-level. Workspace dependencies (`workspace:*`) are replaced with `*`, and `@warpgogol/*` devDependencies are stripped (except the package itself).
82
+ `git.autoReconcile` (default off) automates the established "local tree is the authoritative export" policy: when the destination remote has diverged (e.g. previous export/reconcile commits), the push rejection triggers `fetch` + `merge -s ours` + a single retry instead of failing. Remote history is preserved; its tree state is never merged in. Never force-pushes.
83
+
84
+ Standalone mode flattens the package to the repo root — `src/`, `tests/`, `package.json`, etc. become top-level. Workspace dependencies (`workspace:*`) are replaced with `*` — except packages listed in `preservePackages`, which are pinned to `^<sourceVersion>` resolved from the source monorepo (ADR-0082). `@warpgogol/*` devDependencies are stripped (except the package itself).
69
85
 
70
86
  ### Multi-app monorepo export
71
87
 
@@ -148,6 +164,8 @@ await extractProject(config, { dest: "../my-package" });
148
164
  | `scanForSecrets(dir)` | Scan a directory for secret patterns |
149
165
  | `transferGitHistory(root, dest, prefixes)` | Transfer filtered git history |
150
166
  | `commitExport(dest, message, gitConfig)` | Commit and optionally push |
167
+ | `assertCleanSource(root, dirs)` | Fail-closed dirty-source preflight |
168
+ | `materializeHeadWorktree(root, ref)` | Temporary clean worktree at a ref |
151
169
  | `diffSummary(...)` | Generate diff summary for changes |
152
170
  | `generateCiWorkflow(pm, ci?)` | Generate a GitHub Actions CI workflow string |
153
171
  | `fixStandalonePackageJson(dest)` | Fix package.json for standalone export |
package/dist/cli.js CHANGED
@@ -9,6 +9,7 @@
9
9
  <CHANGE_SUMMARY>
10
10
  <item>Initial CLI for RFC-0070. Supports --config, --dest, --dry-run, --verbose flags.</item>
11
11
  <item>RFC-0074: Catch SecretScanError, GitOperationError, PackageManagerError and exit with code 1. Pass verbose: true.</item>
12
+ <item>RFC-0131: Added --from-head, --ref, --allow-dirty, --no-push flags.</item>
12
13
  </CHANGE_SUMMARY>
13
14
  */
14
15
  import { Command } from "commander";
@@ -23,6 +24,10 @@ program
23
24
  .option("--dest <path>", "Destination directory (overrides config default)")
24
25
  .option("--dry-run", "Print plan without writing files")
25
26
  .option("--verbose", "Verbose output")
27
+ .option("--from-head", "Export HEAD via a temporary worktree instead of the working tree")
28
+ .option("--ref <sha|ref>", "Export a specific ref (implies --from-head)")
29
+ .option("--allow-dirty", "Allow exporting with uncommitted changes (disables the dirty preflight)")
30
+ .option("--no-push", "Commit the export locally without pushing (overrides git.autoPush)")
26
31
  .action(async (opts) => {
27
32
  if (!opts.config) {
28
33
  console.error("Error: --config is required");
@@ -35,6 +40,10 @@ program
35
40
  dest: opts.dest,
36
41
  dryRun: opts.dryRun,
37
42
  verbose: true,
43
+ fromHead: opts.fromHead,
44
+ ref: opts.ref,
45
+ allowDirty: opts.allowDirty,
46
+ noPush: opts.noPush,
38
47
  });
39
48
  }
40
49
  catch (err) {
package/dist/config.d.ts CHANGED
@@ -66,6 +66,8 @@ declare const ExtractConfigSchema: z.ZodObject<{
66
66
  git: z.ZodOptional<z.ZodObject<{
67
67
  remote: z.ZodOptional<z.ZodString>;
68
68
  autoPush: z.ZodOptional<z.ZodBoolean>;
69
+ history: z.ZodOptional<z.ZodBoolean>;
70
+ autoReconcile: z.ZodOptional<z.ZodBoolean>;
69
71
  }, z.core.$strip>>;
70
72
  copyDirs: z.ZodDefault<z.ZodArray<z.ZodString>>;
71
73
  standalone: z.ZodDefault<z.ZodBoolean>;
@@ -78,6 +80,11 @@ declare const ExtractConfigSchema: z.ZodObject<{
78
80
  minor: "minor";
79
81
  major: "major";
80
82
  }>>;
83
+ source: z.ZodOptional<z.ZodEnum<{
84
+ worktree: "worktree";
85
+ head: "head";
86
+ }>>;
87
+ allowDirty: z.ZodOptional<z.ZodBoolean>;
81
88
  }, z.core.$strip>;
82
89
  export declare function loadConfig(configPath: string): Promise<ExtractConfig>;
83
90
  export { ExtractConfigSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAwDhD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BvB,CAAC;AAEH,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAQ3E;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA4DhD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkCvB,CAAC;AAEH,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAQ3E;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
package/dist/config.js CHANGED
@@ -11,6 +11,7 @@
11
11
  <item>RFC-0072: Changed packageManager from string to enum. Added CiConfigSchema and ci field.</item>
12
12
  <item>RFC-0075: Added excludePathSegments and excludeExtensions fields.</item>
13
13
  <item>ADR-0016: Config schema is the single source of truth — all org-specific values are config fields with org-neutral defaults, no behavioral assumptions baked into source code.</item>
14
+ <item>RFC-0131: Added git.autoReconcile, source, allowDirty fields.</item>
14
15
  </CHANGE_SUMMARY>
15
16
  */
16
17
  import { readFile } from "node:fs/promises";
@@ -19,6 +20,10 @@ import { z } from "zod";
19
20
  const GitConfigSchema = z.object({
20
21
  remote: z.string().optional(),
21
22
  autoPush: z.boolean().optional(),
23
+ history: z.boolean().optional(),
24
+ // RFC-0131: reconcile a non-fast-forward push via merge -s ours
25
+ // (local tree is the authoritative export). Off by default.
26
+ autoReconcile: z.boolean().optional(),
22
27
  });
23
28
  const CopyRuleSchema = z.object({
24
29
  action: z.literal("copy"),
@@ -89,6 +94,11 @@ const ExtractConfigSchema = z.object({
89
94
  excludeExtensions: z.array(z.string()).optional(),
90
95
  skipSecretScan: z.boolean().optional(),
91
96
  versionBump: z.enum(["patch", "minor", "major"]).optional(),
97
+ // RFC-0131: "head" exports from a temporary worktree at HEAD; "worktree"
98
+ // (default) exports the live working tree. allowDirty opts out of the
99
+ // fail-closed dirty-source preflight.
100
+ source: z.enum(["worktree", "head"]).optional(),
101
+ allowDirty: z.boolean().optional(),
92
102
  });
93
103
  export async function loadConfig(configPath) {
94
104
  const raw = await readFile(configPath, "utf-8");
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EACd,aAAa,EAGd,MAAM,YAAY,CAAC;AAqCpB,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAwDxB"}
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EACd,aAAa,EAGd,MAAM,YAAY,CAAC;AA0CpB,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAkJxB"}
package/dist/extract.js CHANGED
@@ -13,27 +13,26 @@
13
13
  <item>RFC-0074: Replaced process.exit(1) with SecretScanError. Changed return type to Promise<ExtractResult>. Added progress events, logger, PackageManagerError wrapping.</item>
14
14
  <item>RFC-0075: Consolidated all inline await import("node:fs*") to top-level static imports.</item>
15
15
  <item>Fix: Added lockfile generation to exportStandalonePackage — standalone packages need lockfiles for --frozen-lockfile in CI.</item>
16
+ <item>RFC-0131: Clean-source extraction — dirty preflight via assertCleanSource, --from-head/--ref via materializeHeadWorktree, versionBump×head conflict rejection, --no-push autoPush override.</item>
16
17
  </CHANGE_SUMMARY>
17
18
  */
18
19
  import { stat, cp, mkdir, writeFile, readFile } from "node:fs/promises";
19
20
  import { readFileSync } from "node:fs";
20
21
  import { execFileSync } from "node:child_process";
21
22
  import * as path from "node:path";
22
- import { SecretScanError, PackageManagerError } from "./errors.js";
23
+ import { SecretScanError, PackageManagerError, GitOperationError } from "./errors.js";
23
24
  import { createLogger } from "./log.js";
24
25
  import { getMonorepoConfigFiles, copyBatchSample, copyFiltered, copyStandalonePackage, ensureDir, isIgnored, removeDest, } from "./fs/copy.js";
25
26
  import { buildGitignore, cleanStrayArtifacts, findAppTsconfigs, findPackageJsonFiles, fixAppTsconfigs, fixPackageTsconfigs, fixStandalonePackageJson, fixStandaloneVitestConfig, generateCiWorkflow, generateRootFiles, bumpSourceVersion, regenerateTsconfigBase, transformPackageJson, } from "./fs/transform.js";
26
27
  import { discoverPackageDeps } from "./fs/discover.js";
27
28
  import { runPostProcess } from "./postprocess/index.js";
28
- import { commitExport, transferGitHistory } from "./fs/git.js";
29
+ import { assertCleanSource, commitExport, materializeHeadWorktree, transferGitHistory, } from "./fs/git.js";
29
30
  import { tryGenerateChangelog } from "./changelog.js";
30
31
  import { scanForSecrets } from "./scan.js";
31
32
  import { detectPackageManager } from "./package-manager.js";
32
33
  const HTML_LIMIT = 5;
33
34
  export async function extractProject(config, options = {}) {
34
- const root = process.cwd();
35
- const destBase = config.destBase ?? (config.projectDir.startsWith("packages/") ? "packages" : "exports");
36
- const dest = options.dest ?? path.resolve(root, "..", destBase, config.destName);
35
+ const realRoot = process.cwd();
37
36
  const logger = createLogger(options.verbose);
38
37
  const onProgress = options.onProgress;
39
38
  const emit = (event) => {
@@ -44,22 +43,76 @@ export async function extractProject(config, options = {}) {
44
43
  // callback errors are non-fatal
45
44
  }
46
45
  };
46
+ const fail = (err) => {
47
+ emit({ phase: "error", error: err });
48
+ throw err;
49
+ };
50
+ // RFC-0131: clean-source resolution. --ref implies from-head; config
51
+ // source: "head" is equivalent. The dest default must resolve against the
52
+ // real cwd, never the materialized worktree.
53
+ const fromHead = options.fromHead || Boolean(options.ref) || config.source === "head";
54
+ const allowDirty = options.allowDirty ?? config.allowDirty ?? false;
55
+ if (fromHead && allowDirty) {
56
+ fail(new GitOperationError("preflight", "--allow-dirty cannot be combined with --from-head/--ref (head exports are clean by construction)"));
57
+ }
58
+ if (fromHead && config.versionBump) {
59
+ fail(new GitOperationError("preflight", "versionBump cannot run under --from-head/--ref: the bump would land in a disposable worktree and drift source vs export — bump and commit the source first, then export the bumped revision"));
60
+ }
61
+ const destBase = config.destBase ?? (config.projectDir.startsWith("packages/") ? "packages" : "exports");
62
+ const dest = options.dest ?? path.resolve(realRoot, "..", destBase, config.destName);
63
+ // RFC-0131: the export reads more than projectDir — declared copy/app/package
64
+ // dirs, root-level config/ecosystem files (explicit or the pm-derived
65
+ // defaults), batch data, postProcess copy sources, and implicit root inputs
66
+ // (package.json for version detection, tsconfig `extends` targets inlined by
67
+ // fixStandaloneTsconfig, lockfiles for pm detection, preserved packages'
68
+ // manifests). The standalone predicate must match the dispatch below.
69
+ const isStandaloneExport = config.standalone || config.projectDir.startsWith("packages/");
70
+ const pm = config.packageManager ?? detectPackageManager(realRoot, logger);
71
+ const preflightDirs = [
72
+ config.projectDir,
73
+ "package.json",
74
+ "tsconfig.base.json",
75
+ "pnpm-lock.yaml",
76
+ "package-lock.json",
77
+ "yarn.lock",
78
+ ...(config.copyDirs ?? []),
79
+ ...(config.appDirs ?? []),
80
+ ...(config.packageDirs ?? (isStandaloneExport ? [] : ["packages"])),
81
+ // Standalone exports never copy monorepo config files — only the
82
+ // monorepo-mode defaults (or an explicit override) are checked.
83
+ ...(isStandaloneExport ? [] : (config.monorepoConfigFiles ?? getMonorepoConfigFiles(pm))),
84
+ ...(config.aiEcosystemFiles ?? []),
85
+ ...(config.batchDataDir ? [config.batchDataDir] : []),
86
+ ...(config.postProcess ?? []).filter((r) => r.action === "copy").map((r) => r.from),
87
+ ...(config.preservePackages?.length ? ["packages/*/package.json"] : []),
88
+ ...tsconfigExtendsTargets(realRoot, config.projectDir),
89
+ ];
47
90
  logger.log(`Exporting ${config.destName} to ${destBase}...`);
48
- logger.log(` source: ${root}`);
91
+ logger.log(` source: ${realRoot}${fromHead ? ` (worktree @ ${options.ref ?? "HEAD"})` : ""}`);
49
92
  logger.log(` dest: ${dest}`);
50
93
  logger.log("");
51
94
  if (options.dryRun) {
52
95
  logger.log("=== Dry run — no files will be written ===");
53
96
  logger.log(` projectDir: ${config.projectDir}`);
54
97
  logger.log(` destName: ${config.destName}`);
55
- logger.log(` standalone: ${config.standalone}`);
98
+ logger.log(` standalone: ${isStandaloneExport}`);
99
+ logger.log(` source mode: ${fromHead ? `head (${options.ref ?? "HEAD"})` : "worktree"}`);
100
+ logger.log(` allowDirty: ${allowDirty}`);
56
101
  logger.log(` appDirs: ${config.appDirs.join(", ") || "(none)"}`);
57
102
  if (config.postProcess) {
58
103
  logger.log(` postProcess rules: ${config.postProcess.length}`);
59
104
  }
105
+ if (!fromHead && !allowDirty) {
106
+ try {
107
+ assertCleanSource(realRoot, preflightDirs, logger);
108
+ }
109
+ catch (err) {
110
+ logger.log(` dirty sources — a real export would abort: ${err.message}`);
111
+ }
112
+ }
60
113
  const result = {
61
114
  dest,
62
- mode: config.standalone ? "standalone" : "monorepo",
115
+ mode: isStandaloneExport ? "standalone" : "monorepo",
63
116
  filesCopied: 0,
64
117
  packagesCopied: 0,
65
118
  gitCommitted: false,
@@ -70,19 +123,73 @@ export async function extractProject(config, options = {}) {
70
123
  emit({ phase: "complete", result });
71
124
  return result;
72
125
  }
126
+ // RFC-0131: fail-closed dirty preflight on the live working tree — before
127
+ // any destination mutation.
128
+ if (!fromHead && !allowDirty) {
129
+ try {
130
+ assertCleanSource(realRoot, preflightDirs, logger);
131
+ }
132
+ catch (err) {
133
+ emit({ phase: "error", error: err instanceof Error ? err : new Error(String(err)) });
134
+ throw err;
135
+ }
136
+ }
73
137
  emit({ phase: "start", config, dest });
138
+ // --no-push overrides git.autoPush for this run (RFC-0131).
139
+ const effectiveConfig = options.noPush
140
+ ? { ...config, git: { ...config.git, autoPush: false } }
141
+ : config;
142
+ let cleanup;
74
143
  try {
75
- if (config.standalone || config.projectDir.startsWith("packages/")) {
76
- return await exportStandalonePackage(root, dest, config, logger, emit);
144
+ let root = realRoot;
145
+ if (fromHead) {
146
+ const wt = await materializeHeadWorktree(realRoot, options.ref ?? "HEAD", logger);
147
+ root = wt.dir;
148
+ cleanup = wt.cleanup;
149
+ }
150
+ if (isStandaloneExport) {
151
+ return await exportStandalonePackage(root, dest, effectiveConfig, logger, emit);
77
152
  }
78
153
  else {
79
- return await exportMonorepo(root, dest, config, logger, emit);
154
+ return await exportMonorepo(root, dest, effectiveConfig, logger, emit);
80
155
  }
81
156
  }
82
157
  catch (err) {
83
158
  emit({ phase: "error", error: err instanceof Error ? err : new Error(String(err)) });
84
159
  throw err;
85
160
  }
161
+ finally {
162
+ await cleanup?.();
163
+ }
164
+ }
165
+ /**
166
+ * RFC-0131: resolve the repo-relative tsconfig `extends` targets the standalone
167
+ * inline step reads (`fixStandaloneTsconfig` resolves one hop relative to
168
+ * projectDir/tsconfig.json). Package presets (@tsconfig/…) and paths outside
169
+ * the repo are skipped — they are not working-tree content.
170
+ */
171
+ function tsconfigExtendsTargets(root, projectDir) {
172
+ const tsconfigPath = path.join(root, projectDir, "tsconfig.json");
173
+ let extendsValue;
174
+ try {
175
+ extendsValue = JSON.parse(readFileSync(tsconfigPath, "utf-8"))?.extends;
176
+ }
177
+ catch {
178
+ return [];
179
+ }
180
+ const targets = Array.isArray(extendsValue) ? extendsValue : [extendsValue];
181
+ const out = [];
182
+ for (const t of targets) {
183
+ if (typeof t !== "string" || (!t.startsWith(".") && !t.startsWith("/")))
184
+ continue;
185
+ let resolved = path.resolve(path.dirname(tsconfigPath), t);
186
+ if (!resolved.endsWith(".json"))
187
+ resolved += ".json";
188
+ const rel = path.relative(root, resolved);
189
+ if (!rel.startsWith("..") && !path.isAbsolute(rel))
190
+ out.push(rel);
191
+ }
192
+ return out;
86
193
  }
87
194
  async function exportMonorepo(root, dest, config, logger, emit) {
88
195
  const pm = config.packageManager ?? detectPackageManager(root, logger);
@@ -289,10 +396,17 @@ async function exportMonorepo(root, dest, config, logger, emit) {
289
396
  }
290
397
  logger.log(" no secrets found");
291
398
  }
292
- // 15c. Transfer git history
293
- const pathPrefixes = [config.projectDir, ...config.appDirs];
294
- emit({ phase: "gitHistory", pathPrefixes });
295
- await transferGitHistory(root, dest, pathPrefixes, logger);
399
+ // 15c. Transfer git history (skip when git.history is false — keeps
400
+ // the destination's own history and avoids the clone + filter-branch
401
+ // rewrite, which dominates export time on large monorepos)
402
+ if (config.git?.history !== false) {
403
+ const pathPrefixes = [config.projectDir, ...config.appDirs];
404
+ emit({ phase: "gitHistory", pathPrefixes });
405
+ await transferGitHistory(root, dest, pathPrefixes, logger);
406
+ }
407
+ else {
408
+ logger.log("Skipping git history transfer (git.history: false)");
409
+ }
296
410
  // 16. Git commit + push
297
411
  emit({ phase: "gitCommit", message: changelogCommitMessage });
298
412
  const gitResult = await commitExport(dest, changelogCommitMessage, config.git, logger);
package/dist/fs/git.d.ts CHANGED
@@ -4,6 +4,27 @@ export declare function commitExport(dest: string, commitMessage: string, gitCon
4
4
  committed: boolean;
5
5
  pushed: boolean;
6
6
  }>;
7
+ /**
8
+ * RFC-0131: collect uncommitted changes (modified, staged, untracked) under the
9
+ * given repo-relative dirs, grouped by status letter. Returns an empty map for
10
+ * non-git roots — there is no HEAD to be dirty against.
11
+ */
12
+ export declare function collectDirtyFiles(root: string, dirs: string[]): Map<string, string[]>;
13
+ /**
14
+ * RFC-0131: fail-closed dirty-source preflight. Throws GitOperationError when
15
+ * any of the given repo-relative dirs carries uncommitted changes. The offender
16
+ * list is bounded and grouped by status letter.
17
+ */
18
+ export declare function assertCleanSource(root: string, dirs: string[], logger?: Logger): void;
19
+ /**
20
+ * RFC-0131: materialize a temporary git worktree at `ref` so the export reads
21
+ * committed content instead of the ambient working tree. Returns the worktree
22
+ * path plus a cleanup that removes it (`git worktree remove --force`).
23
+ */
24
+ export declare function materializeHeadWorktree(root: string, ref: string, logger?: Logger): Promise<{
25
+ dir: string;
26
+ cleanup: () => Promise<void>;
27
+ }>;
7
28
  export declare function getLastExportDate(dest: string): string | null;
8
29
  export declare function transferGitHistory(root: string, dest: string, pathPrefixes: string[], logger?: Logger): Promise<boolean>;
9
30
  export declare function diffSummary(dest: string): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/fs/git.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,SAAS,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAkGlD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW7D;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAA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EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EAAE,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAsGlB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoCvD"}
package/dist/fs/git.js CHANGED
@@ -10,6 +10,7 @@
10
10
  <item>RFC-0073: replaced all execSync with execFileSync (argument arrays) to eliminate shell injection.</item>
11
11
  <item>RFC-0074: Wrapped execFileSync calls with GitOperationError. Changed commitExport return to { committed, pushed }.</item>
12
12
  <item>RFC-0075: Added Windows multi-prefix guard in transferGitHistory().</item>
13
+ <item>RFC-0131: Added assertCleanSource (dirty preflight), materializeHeadWorktree (--from-head), and git.autoReconcile ours-merge retry in commitExport.</item>
13
14
  </CHANGE_SUMMARY>
14
15
  */
15
16
  import { existsSync, rmSync } from "node:fs";
@@ -69,6 +70,18 @@ export async function commitExport(dest, commitMessage, gitConfig, logger) {
69
70
  log(` added origin remote: ${gitConfig.remote}`);
70
71
  }
71
72
  }
73
+ // Deterministic committer identity — hosts without a configured git
74
+ // identity (CI runners, fresh machines) still produce export commits.
75
+ try {
76
+ execFileSync("git", ["config", "user.email"], { cwd: dest, stdio: "pipe" });
77
+ }
78
+ catch {
79
+ execFileSync("git", ["config", "user.email", "repo-extract@localhost"], {
80
+ cwd: dest,
81
+ stdio: "pipe",
82
+ });
83
+ execFileSync("git", ["config", "user.name", "repo-extract"], { cwd: dest, stdio: "pipe" });
84
+ }
72
85
  execFileSync("git", ["add", "-A"], { cwd: dest, stdio: "pipe" });
73
86
  const status = execFileSync("git", ["status", "--porcelain"], { cwd: dest, stdio: "pipe" })
74
87
  .toString()
@@ -94,13 +107,67 @@ export async function commitExport(dest, commitMessage, gitConfig, logger) {
94
107
  log(" skipped (no branch to push)");
95
108
  return { committed, pushed };
96
109
  }
97
- try {
98
- execFileSync("git", ["push", "-u", "origin", branch], { cwd: dest, stdio: "inherit" });
110
+ const tryPush = () => {
111
+ try {
112
+ execFileSync("git", ["push", "-u", "origin", branch], { cwd: dest, stdio: "pipe" });
113
+ return { ok: true, stderr: "" };
114
+ }
115
+ catch (e) {
116
+ const stderr = e instanceof Error && "stderr" in e
117
+ ? String(e.stderr ?? e.message)
118
+ : String(e);
119
+ return { ok: false, stderr };
120
+ }
121
+ };
122
+ const attempt = tryPush();
123
+ if (attempt.ok) {
99
124
  log(` pushed to origin/${branch}`);
100
125
  pushed = true;
101
126
  }
102
- catch (pushErr) {
103
- error(` push rejected: ${pushErr instanceof Error ? pushErr.message : pushErr}`);
127
+ else if (gitConfig.autoReconcile &&
128
+ /non-fast-forward|\(fetch first\)/i.test(attempt.stderr)) {
129
+ // RFC-0131: opt-in reconcile — fetch + merge -s ours + retry once.
130
+ // Fires only on non-fast-forward rejections; auth/hook/transient
131
+ // failures take the manual path. The local tree is the authoritative
132
+ // export; remote history is preserved, its tree state is not adopted.
133
+ error(` push rejected (non-fast-forward) — reconciling via merge -s ours`);
134
+ try {
135
+ execFileSync("git", ["fetch", "origin"], { cwd: dest, stdio: "pipe" });
136
+ try {
137
+ execFileSync("git", ["merge-base", "HEAD", `origin/${branch}`], {
138
+ cwd: dest,
139
+ stdio: "pipe",
140
+ });
141
+ }
142
+ catch {
143
+ error(` warning: no merge base — remote history is unrelated to this export; grafting via ours-merge (local tree stays authoritative)`);
144
+ }
145
+ execFileSync("git", [
146
+ "merge",
147
+ "-s",
148
+ "ours",
149
+ "--allow-unrelated-histories",
150
+ `origin/${branch}`,
151
+ "-m",
152
+ "merge: reconcile remote export history (local tree is authoritative export)",
153
+ ], { cwd: dest, stdio: "inherit" });
154
+ const retry = tryPush();
155
+ if (retry.ok) {
156
+ log(` pushed to origin/${branch} after reconcile`);
157
+ pushed = true;
158
+ }
159
+ else {
160
+ error(` push after reconcile failed: ${retry.stderr.trim().slice(0, 500)}`);
161
+ error(" commit is saved locally — resolve manually, then push.");
162
+ }
163
+ }
164
+ catch (reconcileErr) {
165
+ error(` reconcile failed: ${reconcileErr instanceof Error ? reconcileErr.message : reconcileErr}`);
166
+ error(" commit is saved locally — resolve manually, then push.");
167
+ }
168
+ }
169
+ else {
170
+ error(` push rejected: ${attempt.stderr.trim().slice(0, 500)}`);
104
171
  error(" remote has diverged — commit is saved locally.");
105
172
  error(" resolve manually: pull remote changes, merge, then push.");
106
173
  }
@@ -118,6 +185,95 @@ export async function commitExport(dest, commitMessage, gitConfig, logger) {
118
185
  }
119
186
  return { committed, pushed };
120
187
  }
188
+ /**
189
+ * RFC-0131: collect uncommitted changes (modified, staged, untracked) under the
190
+ * given repo-relative dirs, grouped by status letter. Returns an empty map for
191
+ * non-git roots — there is no HEAD to be dirty against.
192
+ */
193
+ export function collectDirtyFiles(root, dirs) {
194
+ const byStatus = new Map();
195
+ try {
196
+ execFileSync("git", ["rev-parse", "--is-inside-work-tree"], { cwd: root, stdio: "pipe" });
197
+ }
198
+ catch {
199
+ return byStatus;
200
+ }
201
+ const uniqueDirs = [...new Set(dirs.filter(Boolean))];
202
+ if (!uniqueDirs.length)
203
+ return byStatus;
204
+ const out = execFileSync("git", ["status", "--porcelain", "--", ...uniqueDirs], {
205
+ cwd: root,
206
+ stdio: "pipe",
207
+ })
208
+ .toString()
209
+ .trim();
210
+ for (const line of out.split("\n")) {
211
+ if (!line)
212
+ continue;
213
+ const letter = line.slice(0, 2).trim() || "??";
214
+ const file = line.slice(3);
215
+ byStatus.set(letter, [...(byStatus.get(letter) ?? []), file]);
216
+ }
217
+ return byStatus;
218
+ }
219
+ const DIRTY_PREFLIGHT_LIMIT = 20;
220
+ /**
221
+ * RFC-0131: fail-closed dirty-source preflight. Throws GitOperationError when
222
+ * any of the given repo-relative dirs carries uncommitted changes. The offender
223
+ * list is bounded and grouped by status letter.
224
+ */
225
+ export function assertCleanSource(root, dirs, logger) {
226
+ const log = logger?.log ?? console.log;
227
+ const dirty = collectDirtyFiles(root, dirs);
228
+ if (!dirty.size)
229
+ return;
230
+ const lines = [];
231
+ for (const [letter, files] of dirty) {
232
+ for (const file of files)
233
+ lines.push(`${letter} ${file}`);
234
+ }
235
+ const shown = lines.slice(0, DIRTY_PREFLIGHT_LIMIT);
236
+ const suffix = lines.length > DIRTY_PREFLIGHT_LIMIT ? ` … +${lines.length - DIRTY_PREFLIGHT_LIMIT}` : "";
237
+ log(" preflight: uncommitted changes in exported sources:");
238
+ for (const line of shown)
239
+ log(` ${line}`);
240
+ throw new GitOperationError("preflight", `exported sources have uncommitted changes: ${shown.join(", ")}${suffix} — commit them, export --from-head, or pass --allow-dirty`);
241
+ }
242
+ /**
243
+ * RFC-0131: materialize a temporary git worktree at `ref` so the export reads
244
+ * committed content instead of the ambient working tree. Returns the worktree
245
+ * path plus a cleanup that removes it (`git worktree remove --force`).
246
+ */
247
+ export async function materializeHeadWorktree(root, ref, logger) {
248
+ const log = logger?.log ?? console.log;
249
+ let sha;
250
+ try {
251
+ sha = execFileSync("git", ["rev-parse", ref], { cwd: root, stdio: "pipe" }).toString().trim();
252
+ }
253
+ catch (err) {
254
+ throw new GitOperationError("worktree", `cannot resolve ref "${ref}": ${err instanceof Error ? err.message : String(err)}`, err instanceof Error ? err : undefined);
255
+ }
256
+ const dir = await mkdtemp(path.join(os.tmpdir(), "repo-extract-head-"));
257
+ try {
258
+ execFileSync("git", ["worktree", "add", "--detach", dir, sha], { cwd: root, stdio: "pipe" });
259
+ }
260
+ catch (err) {
261
+ await rm(dir, { recursive: true, force: true }).catch(() => { });
262
+ throw new GitOperationError("worktree", `git worktree add failed: ${err instanceof Error ? err.message : String(err)}`, err instanceof Error ? err : undefined);
263
+ }
264
+ log(` source worktree: ${dir} @ ${sha.slice(0, 9)}`);
265
+ return {
266
+ dir,
267
+ cleanup: async () => {
268
+ try {
269
+ execFileSync("git", ["worktree", "remove", "--force", dir], { cwd: root, stdio: "pipe" });
270
+ }
271
+ catch {
272
+ await rm(dir, { recursive: true, force: true }).catch(() => { });
273
+ }
274
+ },
275
+ };
276
+ }
121
277
  export function getLastExportDate(dest) {
122
278
  try {
123
279
  const dateStr = execFileSync("git", ["log", "-1", "--format=%ad", "--date=format:%Y-%m-%d"], {
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/fs/transform.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CA2Df;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0D5F;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY7F;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOzF;AAmBD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAO1F;AAmBD,wBAAgB,cAAc,CAAC,UAAU,GAAE,MAAM,EAAO,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,MAAM,CA4BxF;AA6CD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAA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AAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BrE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,cAAc,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAqInF;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAmCf;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,cAAc,EAClB,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CA2Ef;AAmBD,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAe5F"}
@@ -11,7 +11,7 @@
11
11
  <item>RFC-0071: Replaced hardcoded org-specific values with config-driven options (stripScopes, preservePackages, rootPackageName, customConditions, onlyBuiltDependencies, packageManager, gitignoreMode).</item>
12
12
  <item>RFC-0072: Parameterized buildRootPackageJson, generateRootFiles, generateCiWorkflow, fixStandalonePackageJson for pnpm/npm/yarn support.</item>
13
13
  <item>Fix: Split generateCiWorkflow into ci + publish jobs — publish only on push to main, with registry-url for NODE_AUTH_TOKEN.</item>
14
- <item>ADR-0082: preservePackages workspace:* deps now pin to ^<sourceVersion> instead of * — extracted lockfiles resolve the just-published sibling under pnpm minimumReleaseAge.</item>
14
+ <item>ADR-0082: preservePackages workspace:* deps now pin to ^&lt;sourceVersion&gt; instead of * — extracted lockfiles resolve the just-published sibling under pnpm minimumReleaseAge.</item>
15
15
  <item>RFC-1081: Added gh release create step after npm publish with --generate-notes and || true for tag collision. Updated publish job permissions to contents: write. (Ported back from standalone repo — was committed there directly on 2026-09-13.)</item>
16
16
  </CHANGE_SUMMARY>
17
17
  */
@@ -542,7 +542,7 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
542
542
  for (const key of Object.keys(pkg[depField])) {
543
543
  if (depField === "peerDependencies") {
544
544
  if (pkg[depField][key] === "workspace:*") {
545
- pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root);
545
+ pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root, logger);
546
546
  changed = true;
547
547
  }
548
548
  }
@@ -554,7 +554,7 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
554
554
  changed = true;
555
555
  }
556
556
  else if (pkg[depField][key] === "workspace:*") {
557
- pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root);
557
+ pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root, logger);
558
558
  changed = true;
559
559
  }
560
560
  }
@@ -576,11 +576,15 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
576
576
  (logger?.log ?? console.log)(" fixed standalone package.json (test script, workspace deps, packageManager)");
577
577
  }
578
578
  }
579
- async function rewriteWorkspaceSpecifier(depName, preservePackages, root) {
579
+ async function rewriteWorkspaceSpecifier(depName, preservePackages, root, logger) {
580
580
  if (!root || !preservePackages.includes(depName))
581
581
  return "*";
582
582
  const version = await resolveSourceVersion(root, depName);
583
- return version ? `^${version}` : "*";
583
+ if (!version) {
584
+ (logger?.log ?? console.log)(` warning: could not resolve source version for preserved dep ${depName} — falling back to *`);
585
+ return "*";
586
+ }
587
+ return `^${version}`;
584
588
  }
585
589
  export async function fixStandaloneVitestConfig(dest, logger) {
586
590
  const configPath = path.join(dest, "vitest.config.ts");
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { loadConfig, ExtractConfigSchema } from "./config.js";
2
2
  export { extractProject } from "./extract.js";
3
3
  export { detectPackageManager } from "./package-manager.js";
4
4
  export { scanForSecrets } from "./scan.js";
5
- export { transferGitHistory, commitExport, diffSummary } from "./fs/git.js";
5
+ export { transferGitHistory, commitExport, diffSummary, assertCleanSource, materializeHeadWorktree, } from "./fs/git.js";
6
6
  export { generateCiWorkflow, fixStandalonePackageJson, fixStandaloneVitestConfig, buildGitignore, buildRootPackageJson, } from "./fs/transform.js";
7
7
  export { isIgnored } from "./fs/copy.js";
8
8
  export { SecretScanError, GitOperationError, PackageManagerError } from "./errors.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,cAAc,EACd,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtF,YAAY,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,cAAc,EACd,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtF,YAAY,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -9,13 +9,14 @@
9
9
  <CHANGE_SUMMARY>
10
10
  <item>Initial scaffold for RFC-0070.</item>
11
11
  <item>RFC-0074: Added diffSummary, buildGitignore, buildRootPackageJson, isIgnored, ExtractResult, ExtractProgressEvent, ProgressCallback, error class exports.</item>
12
+ <item>RFC-0131: Added assertCleanSource and materializeHeadWorktree exports.</item>
12
13
  </CHANGE_SUMMARY>
13
14
  */
14
15
  export { loadConfig, ExtractConfigSchema } from "./config.js";
15
16
  export { extractProject } from "./extract.js";
16
17
  export { detectPackageManager } from "./package-manager.js";
17
18
  export { scanForSecrets } from "./scan.js";
18
- export { transferGitHistory, commitExport, diffSummary } from "./fs/git.js";
19
+ export { transferGitHistory, commitExport, diffSummary, assertCleanSource, materializeHeadWorktree, } from "./fs/git.js";
19
20
  export { generateCiWorkflow, fixStandalonePackageJson, fixStandaloneVitestConfig, buildGitignore, buildRootPackageJson, } from "./fs/transform.js";
20
21
  export { isIgnored } from "./fs/copy.js";
21
22
  export { SecretScanError, GitOperationError, PackageManagerError } from "./errors.js";
package/dist/types.d.ts CHANGED
@@ -39,6 +39,19 @@ export type PostProcessRule = CopyRule | PatchRule | DeleteRule;
39
39
  export interface GitConfig {
40
40
  remote?: string;
41
41
  autoPush?: boolean;
42
+ /**
43
+ * Transfer filtered monorepo git history into the destination repo.
44
+ * Default: true. Set false to keep the destination's existing history
45
+ * and commit plain snapshots — skips the full clone + filter-branch
46
+ * rewrite, which dominates export time on large monorepos.
47
+ */
48
+ history?: boolean;
49
+ /**
50
+ * RFC-0131: on a non-fast-forward push rejection, reconcile automatically:
51
+ * fetch origin, `merge -s ours origin/<branch>` (local tree is the
52
+ * authoritative export), retry push once. Never force-pushes. Default: off.
53
+ */
54
+ autoReconcile?: boolean;
42
55
  }
43
56
  export interface ExtractConfig {
44
57
  projectDir: string;
@@ -69,6 +82,17 @@ export interface ExtractConfig {
69
82
  excludeExtensions?: string[];
70
83
  skipSecretScan?: boolean;
71
84
  versionBump?: VersionBump;
85
+ /**
86
+ * RFC-0131: where the export sources its files from.
87
+ * "worktree" (default) — the working tree of the current checkout.
88
+ * "head" — a temporary git worktree materialized at HEAD.
89
+ */
90
+ source?: "worktree" | "head";
91
+ /**
92
+ * RFC-0131: allow exporting with uncommitted changes under the exported
93
+ * dirs. Default off — the dirty preflight aborts instead.
94
+ */
95
+ allowDirty?: boolean;
72
96
  }
73
97
  export interface ExtractContext {
74
98
  root: string;
@@ -81,6 +105,14 @@ export interface ExtractOptions {
81
105
  dryRun?: boolean;
82
106
  verbose?: boolean;
83
107
  onProgress?: ProgressCallback;
108
+ /** RFC-0131: export HEAD via a temporary worktree instead of the working tree. */
109
+ fromHead?: boolean;
110
+ /** RFC-0131: export this ref instead of HEAD; implies fromHead. */
111
+ ref?: string;
112
+ /** RFC-0131: permit exporting with uncommitted changes (overrides dirty preflight). */
113
+ allowDirty?: boolean;
114
+ /** RFC-0131: commit the export locally without pushing (overrides git.autoPush). */
115
+ noPush?: boolean;
84
116
  }
85
117
  export interface SecretFinding {
86
118
  file: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAEjD,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B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,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/C;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAC5C;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAErC,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC"}
package/dist/types.js CHANGED
@@ -12,6 +12,7 @@
12
12
  <item>RFC-0072: Changed packageManager from string to PackageManager enum. Added CiConfig interface and ci field.</item>
13
13
  <item>RFC-0074: Added ExtractResult, ExtractProgressEvent, ProgressCallback types. Added onProgress to ExtractOptions.</item>
14
14
  <item>RFC-0075: Added excludePathSegments and excludeExtensions fields for config-driven file exclusion.</item>
15
+ <item>RFC-0131: Added source/allowDirty config fields, git.autoReconcile, and ExtractOptions fromHead/ref/allowDirty/noPush for clean-source extraction and push reconciliation.</item>
15
16
  </CHANGE_SUMMARY>
16
17
  */
17
18
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warpgogol/repo-extract",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Extract apps and packages from a TurboRepo monorepo into standalone public repositories",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Andrii Syrokomskyi <andrii@syrokomskyi.com> (https://syrokomskyi.com)",