Skip to content

sandbox mode #75

@haoliangyu

Description

@haoliangyu

The add and remove command is directly updating the js files. If there is an error and the process is forced to exit, it will leave some files changed and some unchanged. This will pollute the user's codebase and it is difficult to restore if the user is unfamiliar with the internal process of Koop CLI. Ideally, the change should be generated first and then applied to the files if the first step succeeds.

In the sandbox mode, the CLI tool should generate all changed files and new files in a temporary work directory. It should take several steps:

  1. Create a temporary work directory
  2. Create all new files
  3. Copy all files to change
  4. Change files
  5. Move all changes to the actual work directory

If there is an error in step 1 to 4, or the user specifies the --sandbox flag, it should skip the final step. This will keep the user's codebase in the original state at problematic situations.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions