Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/agentex/lib/cli/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def create_project_structure(
# Create root files
root_templates = {
".dockerignore.j2": ".dockerignore",
".gitignore.j2": ".gitignore",
".env.example.j2": ".env.example",
"manifest.yaml.j2": "manifest.yaml",
"README.md.j2": "README.md",
Expand All @@ -118,7 +119,17 @@ def create_project_structure(

for template, output in root_templates.items():
output_path = project_dir / output
output_path.write_text(render_template(template, context, template_type))
rendered = render_template(template, context, template_type)
if output == ".gitignore" and output_path.exists():
# Re-running init on an existing project: keep the user's rules and
# append only the scaffold entries that are missing.
existing = output_path.read_text()
existing_lines = {line.strip() for line in existing.splitlines()}
missing = [line for line in rendered.splitlines() if line.strip() and not line.startswith("#") and line.strip() not in existing_lines]
if missing:
output_path.write_text(existing.rstrip("\n") + "\n\n# Added by agentex init\n" + "\n".join(missing) + "\n")
continue
output_path.write_text(rendered)

console.print(f"\n[green]✓[/green] Created project structure at: {project_dir}")

Expand Down
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/default-claude-code/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/default-codex/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/default-langgraph/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/default-openai-agents/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/default-pydantic-ai/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/default/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/sync-claude-code/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/sync-codex/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/sync-langgraph/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/sync-openai-agents/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/sync-pydantic-ai/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/sync/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/temporal-claude-code/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/temporal-codex/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/temporal-langgraph/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
20 changes: 20 additions & 0 deletions src/agentex/lib/cli/templates/temporal-openai-agents/.gitignore.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Secrets and local config
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
.venv/
venv/
*.egg-info/
build/
dist/

# Tooling
.ipynb_checkpoints/
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store
Loading