The touchfs generate
command provides two modes of operation:
By default, files are created with AI-generated content. Each generated file includes statistics showing the number of characters, lines, and generation time.
# File Generation Mode
touchfs generate [options] file [file ...]
# Filesystem Generation Mode
touchfs generate -F "prompt" [options] directory
-p, --parents
: Create parent directories as needed
# Example: Create file in new directory structure
touchfs generate src/components/Button.tsx -p
-f, --force
: Skip confirmation prompts
# Example: Generate without confirmation
touchfs generate README.md --force
-n, --no-content
: Create empty files without generating content
# Example: Create empty files
touchfs generate -n file1.txt file2.txt
-F, --filesystem-generation-prompt
: Generate filesystem structure from prompt
# Example: Create project structure
touchfs generate -F "Create a React project" myproject/
-y, --yes
: Auto-confirm filesystem structure without prompting (only with -F)
# Example: Auto-confirm structure
touchfs generate -F "Create a React project" -y myproject/
--debug-stdout
: Enable debug output to stdout
# Example: Debug generation issues
touchfs generate app.py --debug-stdout
-m, --max-tokens
: Maximum number of tokens to include in context
# Example: Limit context size
touchfs generate README.md --max-tokens 4000
# Generate a file with content (default)
touchfs generate README.md
# Generate an empty file
touchfs generate -n README.md
# Generate with parent directories
touchfs generate src/utils/helpers.ts -p
# Generate several related files with content
touchfs generate \
src/models/user.py \
src/models/product.py \
tests/test_models.py
# Generate empty files
touchfs generate -n \
src/models/user.py \
src/models/product.py \
tests/test_models.py
# Generate documentation files
touchfs generate \
README.md \
docs/api.md \
docs/setup.md \
CONTRIBUTING.md
# Generate React component with types and tests
touchfs generate \
src/components/Button.tsx \
src/components/Button.test.tsx \
src/types/button.ts
# Generate project structure with content
touchfs generate -F "Create a React app with TypeScript" myapp/
# Generate project structure without content
touchfs generate -F "Create a React app with TypeScript" -n myapp/
# Auto-confirm structure
touchfs generate -F "Create a React app with TypeScript" -y myapp/
The generate command differs from the touch command in several important ways:
The command automatically builds context from the parent directory of the first specified file. This context is used to ensure generated content is relevant and consistent with existing project files.
# Files will be generated with awareness of existing project context
touchfs generate \
src/components/NewFeature.tsx \ # Context from src/components/
src/hooks/useNewFeature.ts \ # Uses same context
tests/NewFeature.test.tsx # Uses same context
# Output includes generation stats for each file
# Generated src/components/NewFeature.tsx: 1234 chars, 45 lines in 2.31s
# Generated src/hooks/useNewFeature.ts: 567 chars, 23 lines in 1.45s
# Generated tests/NewFeature.test.tsx: 890 chars, 34 lines in 1.89s