fix(scaffold-create): auto-cleanup downloaded scaffold after create (#157)#158
Draft
ericelliott wants to merge 3 commits intomainfrom
Draft
fix(scaffold-create): auto-cleanup downloaded scaffold after create (#157)#158ericelliott wants to merge 3 commits intomainfrom
ericelliott wants to merge 3 commits intomainfrom
Conversation
…eate After a successful `npx aidd create <url>`, the downloaded scaffold files in ~/.aidd/scaffold/ are now automatically removed via scaffoldCleanup(). This prevents the destination-conflict error on subsequent runs. Named and file:// scaffolds are unaffected — cleanup only fires when paths.downloaded === true (HTTP/HTTPS downloads). Closes #157
…-cleanup CLI Cleanup of downloaded scaffold files now happens unconditionally in a try/finally block inside runCreate, covering both success and failure paths. Previously it only ran on success, leaving ~/.aidd/scaffold/ behind on a failed manifest run. The scaffold-cleanup subcommand has been removed from the public CLI. There is no way to opt out of auto-cleanup (no --keep flag), so a public cleanup command was asymmetric. scaffoldCleanup remains an internal function used by runCreate. Changes: - scaffold-create.js: wrap runManifest in try/finally; call scaffoldCleanupFn() in finally when paths.downloaded - scaffold-commands.js: remove scaffold-cleanup subcommand + import - scaffold-resolver.js: update destination-conflict error message to say "delete manually" instead of "run scaffold-cleanup" - scaffold-create.test.js: add test for cleanup-on-failure - scaffold-commands.test.js: remove scaffold-cleanup from expected command list; drop its vi.mock - scaffold-resolver.test.js: update mentionsCleanup -> mentionsDelete - create-e2e.test.js: remove scaffold-cleanup describe block; update "does not suggest" test to check success message instead - docs/scaffold-authoring.md: document automatic cleanup behaviour - tasks/, plan.md: update epic and plan to reflect removal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running
npx aidd create <url>a second time failed with a destination-conflict error because~/.aidd/scaffold/was left on disk. The previous code returned acleanupTiphint but never ran cleanup automatically.Additionally, there was an asymmetry in the public CLI: no way to opt out of cleanup (no
--keepflag), yetscaffold-cleanupexisted as a public subcommand.Fixes #157.
Solution
Commit 1 — auto-cleanup on success
runCreatenow automatically callsscaffoldCleanup()after a successfulrunManifestwhenpaths.downloaded === true. Named andfile://sources are unaffected.Commit 2 — move cleanup to
finally; remove public subcommandtry/finallyblock so it fires on both success and failure (e.g. a manifest step throws). This eliminates the last scenario where~/.aidd/scaffold/could be orphaned.scaffold-cleanupsubcommand removed from the CLI. With no--keepflag, a public cleanup command is pointless and confusing.scaffoldCleanupremains an internal function.scaffold-resolver.jserror message updated to say "delete manually" instead of "runnpx aidd scaffold-cleanup".Changed files
lib/scaffold-create.jsscaffoldCleanupFnintry/finally; updated JSDoclib/scaffold-commands.jsscaffold-cleanupsubcommand and its importlib/scaffold-resolver.jslib/scaffold-create.test.jslib/scaffold-commands.test.jsscaffold-cleanupfrom expected command list; dropped itsvi.mocklib/scaffold-resolver.test.jsmentionsCleanup→mentionsDeleteassertionbin/create-e2e.test.jsaidd scaffold-cleanupdescribe block; updated success-message testdocs/scaffold-authoring.mdtasks/npx-aidd-create-epic.mdtasks/scaffold-review-followups-epic.mdplan.mdTests