When executing apify pull within an existing Actor directory, the command unexpectedly creates a new folder with the same name instead of updating the current directory's contents. This behavior deviates from the expected "pull" functionality, which is typically to synchronize and update existing local files, similar to how git pull operates.
To address the unexpected folder creation with apify pull and ensure a predictable user experience, I propose the following solution:
When a user executes apify pull within an existing actor directory, the CLI should prompt them before overwriting any local changes.
Proposed Flow:
- User runs
apify pull in an actor directory.
- CLI Prompt: "If you pull, your local changes will be overwritten. Do you want to proceed? [Yes / No]"
If "Yes":
- The CLI will "rewrite/replace" all files in the current directory with the latest version from the Apify Console.
- The files from the Console will become the new source of truth for that local directory.
If "No":
- The apify pull operation is aborted.
- No files are changed or created.
For CLI use cases, we should also add --no-prompt flag, similar to apify push:
|
// Disable open browser on CI, or if user passed --no-prompt flag |
|
if (!isCI && !this.flags.noPrompt) { |
|
const shouldOpenBrowser = await inquirer.prompt([ |
|
{ |
|
type: 'confirm', |
|
name: 'continue', |
|
message: 'Do you want to open the Actor detail in your browser?', |
|
default: true, |
|
}, |
|
]); |
|
|
|
if (shouldOpenBrowser.continue) { |
|
await open(`https://console.apify.com${redirectUrlPart}/actors/${build.actId}`); |
|
} |
|
} |
When executing
apify pullwithin an existing Actor directory, the command unexpectedly creates a new folder with the same name instead of updating the current directory's contents. This behavior deviates from the expected "pull" functionality, which is typically to synchronize and update existing local files, similar to how git pull operates.To address the unexpected folder creation with
apify pulland ensure a predictable user experience, I propose the following solution:When a user executes
apify pullwithin an existing actor directory, the CLI should prompt them before overwriting any local changes.Proposed Flow:
apify pullin an actor directory.If "Yes":
If "No":
For CLI use cases, we should also add
--no-promptflag, similar toapify push:apify-cli/src/commands/actors/push.ts
Lines 314 to 328 in 4cd83b0