Skip to content

Conversation

@morinokami
Copy link
Contributor

Added validation in packages/cta-cli/src/options.ts to check whether the target directory exists and is non-empty. Previously, the CLI would overwrite existing files. Now it exits with an error message instead.

import type { AddOn, PackageManager } from '@tanstack/cta-engine'

import type { Framework } from '@tanstack/cta-engine/dist/types/types.js'
import { InitialData } from '../../cta-ui/src/types'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not part of the main change, but I removed an unused import.

@WahidinAji
Copy link

WahidinAji commented Nov 5, 2025

I think it will be better to let people choose like

⚠️ Warning: target directory "dir" already exists and is not empty.
Continue and potentially overwrite existing files?
● Yes / ○ No

image

source issue: #198

@morinokami
Copy link
Contributor Author

@WahidinAji Thank you for your feedback! I've updated the code and it now asks the user for confirmation before exiting:

image

@jherr
Copy link
Collaborator

jherr commented Nov 6, 2025

It needs a force flag.

@morinokami
Copy link
Contributor Author

@jherr I've added a -f (--force) flag! Thank you for reviewing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants