{"record":{"id":"0ba8de3a52b78f54","repo":"midudev/autoskills","slug":"no-se-pudieron-restaurar-todos-los-archivos-autom-ticamente","errorCode":null,"errorMessage":"⚠️  No se pudieron restaurar todos los archivos automáticamente","messagePattern":"⚠️  No se pudieron restaurar todos los archivos automáticamente","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/autoskills/scripts/release.mjs","lineNumber":289,"sourceCode":"    }\n  }\n\n  // If no release commit was created, restore touched files directly.\n  try {\n    writeFileSync(PKG_PATH, originalPkgContent);\n\n    if (originalChangelogContent === null) {\n      if (existsSync(CHANGELOG_PATH)) {\n        rmSync(CHANGELOG_PATH);\n      }\n    } else {\n      writeFileSync(CHANGELOG_PATH, originalChangelogContent);\n    }\n\n    run(\"git restore --staged package.json CHANGELOG.md\", { cwd: ROOT });\n    console.log(\"✅ package.json y CHANGELOG.md restaurados\");\n  } catch {\n    console.warn(\"⚠️  No se pudieron restaurar todos los archivos automáticamente\");\n  }\n}\n\nconsole.log(`\\n📦 ${pkg.name} ${currentVersion} → ${newVersion} (${bump})\\n`);\n\n// 1. Ensure release is run only on main and from a fully clean working tree.\nconst currentBranch = run(\"git branch --show-current\", { cwd: REPO_ROOT });\nif (currentBranch !== \"main\") {\n  fail(`La release solo se puede ejecutar en main. Rama actual: ${currentBranch}`);\n}\n\nconst status = run(\"git status --porcelain -- .\", { cwd: REPO_ROOT });\nconst dirtyFiles = status.split(\"\\n\").filter((f) => f.trim());\nif (dirtyFiles.length) {\n  fail(`Hay cambios sin commitear:\\n${dirtyFiles.join(\"\\n\")}`);\n}\n\n// 2. Ensure every advertised skill is present and installable from the registry.","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/midudev/autoskills/blob/0ec725320d2137253ab2e68e7ba8a072148e741a/packages/autoskills/scripts/release.mjs#L271-L307","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restore the files manually: `git restore --staged package.json CHANGELOG.md && git restore package.json CHANGELOG.md` (or `git checkout -- .`).","Verify package.json still has the ORIGINAL version (not newVersion) and revert CHANGELOG.md edits by hand if git restore fails.","Fix the underlying permission/state issue (writable files, clean index) before re-running the release."],"exampleFix":"// before\npackage.json  version: \"2.0.0\"  (bumped by failed release)\n// after\ngit restore --staged package.json CHANGELOG.md && git restore package.json CHANGELOG.md","handlingStrategy":"try-catch","validationCode":"git diff --quiet package.json CHANGELOG.md && echo \"files clean\" || echo \"release artifacts present; restore needed\"","typeGuard":null,"tryCatchPattern":"try {\n  writeFileSync(PKG_PATH, originalPkgContent);\n  writeFileSync(CHANGELOG_PATH, originalChangelogContent);\n  run(\"git restore --staged package.json CHANGELOG.md\", { cwd: ROOT });\n} catch (err) {\n  console.warn(`⚠️  Restaure manualmente: git restore --staged package.json CHANGELOG.md (${err.message})`);\n}","preventionTips":["Run releases with write permissions on package.json and CHANGELOG.md (avoid read-only mounts in CI).","After any failed release, immediately `git status` and restore/commit or discard artifacts before retrying.","Dry-run the bump locally (temp branch) to catch restore issues before releasing on main."],"tags":["git","release","rollback","file-restore","cleanup"],"backgroundTag":"git-command-failed","analyzedSha":"0ec725320d2137253ab2e68e7ba8a072148e741a","analyzedAt":"2026-09-15T14:12:31.090Z","contentChangedAt":"2026-09-15T14:12:31.090Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}