all-hands-cli 0.1.10 → 0.1.11

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/bin/sync-cli.js CHANGED
@@ -7245,6 +7245,16 @@ function collectFilesToPush(cwd, finalIncludes, finalExcludes) {
7245
7245
  const upstreamFiles = manifest.getDistributableFiles();
7246
7246
  const filesToPush = [];
7247
7247
  const localGitFiles = new Set(getGitFiles(cwd));
7248
+ const deletedFiles = /* @__PURE__ */ new Set();
7249
+ for (const args of [
7250
+ ["diff", "--name-only", "--diff-filter=D"],
7251
+ ["diff", "--cached", "--name-only", "--diff-filter=D"]
7252
+ ]) {
7253
+ const result = git(args, cwd);
7254
+ if (result.success && result.stdout) {
7255
+ result.stdout.split("\n").filter(Boolean).forEach((f) => deletedFiles.add(f));
7256
+ }
7257
+ }
7248
7258
  for (const relPath of upstreamFiles) {
7249
7259
  if (manifest.isInitOnly(relPath)) {
7250
7260
  continue;
@@ -7255,15 +7265,19 @@ function collectFilesToPush(cwd, finalIncludes, finalExcludes) {
7255
7265
  if (finalExcludes.some((pattern) => minimatch(relPath, pattern, { dot: true }))) {
7256
7266
  continue;
7257
7267
  }
7258
- if (!localGitFiles.has(relPath)) {
7268
+ if (!localGitFiles.has(relPath) && !deletedFiles.has(relPath)) {
7259
7269
  continue;
7260
7270
  }
7261
7271
  const localFile = join9(cwd, relPath);
7262
7272
  const upstreamFile = join9(allhandsRoot, relPath);
7263
- if (existsSync11(localFile) && filesAreDifferent(localFile, upstreamFile)) {
7264
- if (wasModifiedByTargetRepo(cwd, relPath, allhandsRoot)) {
7265
- filesToPush.push({ path: relPath, type: "M" });
7273
+ if (existsSync11(localFile)) {
7274
+ if (filesAreDifferent(localFile, upstreamFile)) {
7275
+ if (wasModifiedByTargetRepo(cwd, relPath, allhandsRoot)) {
7276
+ filesToPush.push({ path: relPath, type: "M" });
7277
+ }
7266
7278
  }
7279
+ } else if (deletedFiles.has(relPath)) {
7280
+ filesToPush.push({ path: relPath, type: "D" });
7267
7281
  }
7268
7282
  }
7269
7283
  for (const pattern of finalIncludes) {
@@ -7335,12 +7349,16 @@ async function createPullRequest(cwd, ghUser, filesToPush, title, body) {
7335
7349
  console.error("Error creating branch:", checkoutResult.stderr);
7336
7350
  return 1;
7337
7351
  }
7338
- console.log("Copying files...");
7352
+ console.log("Applying changes...");
7339
7353
  for (const file of filesToPush) {
7340
- const src = join9(cwd, file.path);
7341
- const dest = join9(tempDir, file.path);
7342
- mkdirSync2(dirname8(dest), { recursive: true });
7343
- copyFileSync2(src, dest);
7354
+ if (file.type === "D") {
7355
+ git(["rm", "--ignore-unmatch", file.path], tempDir);
7356
+ } else {
7357
+ const src = join9(cwd, file.path);
7358
+ const dest = join9(tempDir, file.path);
7359
+ mkdirSync2(dirname8(dest), { recursive: true });
7360
+ copyFileSync2(src, dest);
7361
+ }
7344
7362
  }
7345
7363
  const addResult = git(["add", "."], tempDir);
7346
7364
  if (!addResult.success) {
@@ -7409,8 +7427,8 @@ async function cmdPush(include, exclude, dryRun, titleArg, bodyArg) {
7409
7427
  }
7410
7428
  console.log("\nFiles to be included in PR:");
7411
7429
  for (const file of filesToPush.sort((a, b) => a.path.localeCompare(b.path))) {
7412
- const marker = file.type === "M" ? "M" : "A";
7413
- const label = file.type === "M" ? "modified" : "included";
7430
+ const marker = file.type;
7431
+ const label = { D: "deleted", M: "modified", A: "included" }[file.type];
7414
7432
  console.log(` ${marker} ${file.path} (${label})`);
7415
7433
  }
7416
7434
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "all-hands-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Agentic harness for model-first software development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,7 @@ interface SyncConfig {
17
17
 
18
18
  interface FileEntry {
19
19
  path: string;
20
- type: 'M' | 'A';
20
+ type: 'M' | 'A' | 'D';
21
21
  }
22
22
 
23
23
  interface PrerequisiteResult {
@@ -124,6 +124,18 @@ function collectFilesToPush(
124
124
  // Get non-ignored files in user's repo (respects .gitignore)
125
125
  const localGitFiles = new Set(getGitFiles(cwd));
126
126
 
127
+ // Get files deleted locally (both staged and unstaged deletions)
128
+ const deletedFiles = new Set<string>();
129
+ for (const args of [
130
+ ['diff', '--name-only', '--diff-filter=D'],
131
+ ['diff', '--cached', '--name-only', '--diff-filter=D'],
132
+ ]) {
133
+ const result = git(args, cwd);
134
+ if (result.success && result.stdout) {
135
+ result.stdout.split('\n').filter(Boolean).forEach((f) => deletedFiles.add(f));
136
+ }
137
+ }
138
+
127
139
  for (const relPath of upstreamFiles) {
128
140
  if (manifest.isInitOnly(relPath)) {
129
141
  continue;
@@ -134,18 +146,22 @@ function collectFilesToPush(
134
146
  if (finalExcludes.some((pattern) => minimatch(relPath, pattern, { dot: true }))) {
135
147
  continue;
136
148
  }
137
- // Skip files that are gitignored in user's repo
138
- if (!localGitFiles.has(relPath)) {
149
+ // Skip files that are gitignored in user's repo (but allow deleted files through)
150
+ if (!localGitFiles.has(relPath) && !deletedFiles.has(relPath)) {
139
151
  continue;
140
152
  }
141
153
 
142
154
  const localFile = join(cwd, relPath);
143
155
  const upstreamFile = join(allhandsRoot, relPath);
144
156
 
145
- if (existsSync(localFile) && filesAreDifferent(localFile, upstreamFile)) {
146
- if (wasModifiedByTargetRepo(cwd, relPath, allhandsRoot)) {
147
- filesToPush.push({ path: relPath, type: 'M' });
157
+ if (existsSync(localFile)) {
158
+ if (filesAreDifferent(localFile, upstreamFile)) {
159
+ if (wasModifiedByTargetRepo(cwd, relPath, allhandsRoot)) {
160
+ filesToPush.push({ path: relPath, type: 'M' });
161
+ }
148
162
  }
163
+ } else if (deletedFiles.has(relPath)) {
164
+ filesToPush.push({ path: relPath, type: 'D' });
149
165
  }
150
166
  }
151
167
 
@@ -239,12 +255,16 @@ async function createPullRequest(
239
255
  return 1;
240
256
  }
241
257
 
242
- console.log('Copying files...');
258
+ console.log('Applying changes...');
243
259
  for (const file of filesToPush) {
244
- const src = join(cwd, file.path);
245
- const dest = join(tempDir, file.path);
246
- mkdirSync(dirname(dest), { recursive: true });
247
- copyFileSync(src, dest);
260
+ if (file.type === 'D') {
261
+ git(['rm', '--ignore-unmatch', file.path], tempDir);
262
+ } else {
263
+ const src = join(cwd, file.path);
264
+ const dest = join(tempDir, file.path);
265
+ mkdirSync(dirname(dest), { recursive: true });
266
+ copyFileSync(src, dest);
267
+ }
248
268
  }
249
269
 
250
270
  const addResult = git(['add', '.'], tempDir);
@@ -328,8 +348,8 @@ export async function cmdPush(
328
348
 
329
349
  console.log('\nFiles to be included in PR:');
330
350
  for (const file of filesToPush.sort((a, b) => a.path.localeCompare(b.path))) {
331
- const marker = file.type === 'M' ? 'M' : 'A';
332
- const label = file.type === 'M' ? 'modified' : 'included';
351
+ const marker = file.type;
352
+ const label = { D: 'deleted', M: 'modified', A: 'included' }[file.type];
333
353
  console.log(` ${marker} ${file.path} (${label})`);
334
354
  }
335
355
  console.log();