midudev/autoskills · warning

⚠️ No se pudieron restaurar todos los archivos…

Error message

⚠️  No se pudieron restaurar todos los archivos automáticamente

What it means

This is the final fallback warning in rollbackRelease(). If neither the tag deletion nor the commit reset context applied (no release commit was created), the script restores package.json and CHANGELOG.md directly with writeFileSync of saved contents and `git restore --staged`. If any of those writes or the git restore fail, it logs that not all files could be restored automatically. At this point manual intervention is required.

Solutions

  1. Restore the files manually: `git restore --staged package.json CHANGELOG.md && git restore package.json CHANGELOG.md` (or `git checkout -- .`).
  2. Verify package.json still has the ORIGINAL version (not newVersion) and revert CHANGELOG.md edits by hand if git restore fails.
  3. Fix the underlying permission/state issue (writable files, clean index) before re-running the release.

Example fix

// before
package.json  version: "2.0.0"  (bumped by failed release)
// after
git restore --staged package.json CHANGELOG.md && git restore package.json CHANGELOG.md
Defensive patterns

Strategy: try-catch

Validate before calling

git diff --quiet package.json CHANGELOG.md && echo "files clean" || echo "release artifacts present; restore needed"

Try / catch

try {
  writeFileSync(PKG_PATH, originalPkgContent);
  writeFileSync(CHANGELOG_PATH, originalChangelogContent);
  run("git restore --staged package.json CHANGELOG.md", { cwd: ROOT });
} catch (err) {
  console.warn(`⚠️  Restaure manualmente: git restore --staged package.json CHANGELOG.md (${err.message})`);
}

Prevention

When it happens

Trigger: During rollbackRelease() with no commitCreated, `writeFileSync(PKG_PATH/CHANGELOG_PATH, originalContent)` or `git restore --staged package.json CHANGELOG.md` throws — e.g. file permission issues, paths missing, or git errors — triggering the catch block.

Common situations: Release failed very early (after version bump edits but before commit); read-only filesystem or locked files in CI; the script run with insufficient permissions; files already manually edited so restore semantics differ from expectations.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of midudev/autoskills@0ec725320d (2026-09-15). Data as JSON: /api/errors/0ba8de3a52b78f54. Report an issue: GitHub.

Appendix: source

Thrown at packages/autoskills/scripts/release.mjs:289

    }
  }

  // If no release commit was created, restore touched files directly.
  try {
    writeFileSync(PKG_PATH, originalPkgContent);

    if (originalChangelogContent === null) {
      if (existsSync(CHANGELOG_PATH)) {
        rmSync(CHANGELOG_PATH);
      }
    } else {
      writeFileSync(CHANGELOG_PATH, originalChangelogContent);
    }

    run("git restore --staged package.json CHANGELOG.md", { cwd: ROOT });
    console.log("✅ package.json y CHANGELOG.md restaurados");
  } catch {
    console.warn("⚠️  No se pudieron restaurar todos los archivos automáticamente");
  }
}

console.log(`\n📦 ${pkg.name} ${currentVersion} → ${newVersion} (${bump})\n`);

// 1. Ensure release is run only on main and from a fully clean working tree.
const currentBranch = run("git branch --show-current", { cwd: REPO_ROOT });
if (currentBranch !== "main") {
  fail(`La release solo se puede ejecutar en main. Rama actual: ${currentBranch}`);
}

const status = run("git status --porcelain -- .", { cwd: REPO_ROOT });
const dirtyFiles = status.split("\n").filter((f) => f.trim());
if (dirtyFiles.length) {
  fail(`Hay cambios sin commitear:\n${dirtyFiles.join("\n")}`);
}

// 2. Ensure every advertised skill is present and installable from the registry.

View on GitHub (pinned to 0ec725320d)