hillclimb 0.8.6 → 0.8.8

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.
@@ -97,9 +97,43 @@ async function upsertProject(repoRoot, config) {
97
97
  const identity = await repoIdentity(resolvedRepoRoot);
98
98
  if (identity.rootCommit) normalized.rootCommit = identity.rootCommit;
99
99
  if (identity.remoteUrl) normalized.remoteUrl = identity.remoteUrl;
100
+ if (!normalized.snapshotLimits) {
101
+ for (const twin of deadTwins(file, resolvedRepoRoot, normalized)) {
102
+ if (twin.config.snapshotLimits) {
103
+ normalized.snapshotLimits = twin.config.snapshotLimits;
104
+ break;
105
+ }
106
+ }
107
+ }
108
+ for (const twin of deadTwins(file, resolvedRepoRoot, normalized)) {
109
+ delete file.projects[twin.key];
110
+ await logHeal(
111
+ "info",
112
+ `config heal: removed dead project entry ${twin.key} (same repo as ${resolvedRepoRoot}, directory gone)`
113
+ );
114
+ }
100
115
  file.projects[resolvedRepoRoot] = normalized;
101
116
  await saveProjects(file);
102
117
  }
118
+ function pathIsGone(p) {
119
+ try {
120
+ fs.statSync(p);
121
+ return false;
122
+ } catch (err) {
123
+ const code = err.code;
124
+ return code === "ENOENT" || code === "ENOTDIR";
125
+ }
126
+ }
127
+ function sameRepoIdentity(a, b) {
128
+ if (a.rootCommit && b.rootCommit) return a.rootCommit === b.rootCommit;
129
+ return Boolean(a.remoteUrl && b.remoteUrl && a.remoteUrl === b.remoteUrl);
130
+ }
131
+ function deadTwins(file, repoRoot, identity) {
132
+ if (!identity.rootCommit && !identity.remoteUrl) return [];
133
+ return Object.entries(file.projects).filter(
134
+ ([key, config]) => path.resolve(key) !== repoRoot && sameRepoIdentity(config, identity) && pathIsGone(path.resolve(key))
135
+ ).map(([key, config]) => ({ key, config }));
136
+ }
103
137
  async function gitOut(args, cwd) {
104
138
  try {
105
139
  const { stdout } = await execFileAsync("git", args, {
@@ -126,7 +160,7 @@ async function repoIdentity(repoRoot) {
126
160
  }
127
161
  async function logHeal(level, message) {
128
162
  try {
129
- const { appendLog: appendLog2 } = await import("./log-W7QJJF46.js");
163
+ const { appendLog: appendLog2 } = await import("./log-6MUC7Q3F.js");
130
164
  appendLog2(level, message);
131
165
  } catch {
132
166
  }
@@ -3,7 +3,7 @@ import {
3
3
  appendLog,
4
4
  setLogPrefix,
5
5
  todayLogPath
6
- } from "./chunk-543ASWNO.js";
6
+ } from "./chunk-IFGDO3FI.js";
7
7
  export {
8
8
  appendLog,
9
9
  setLogPrefix,