Files
dockernecontainer/src/dnc/agents.py
T

57 lines
1.6 KiB
Python
Raw Normal View History

2026-05-23 23:24:56 +03:00
import os
DNC_MD_CONTENT = """# dnc
This project uses dnc (dockernecontainer). When `.dnc` is present,
run ALL commands inside the container by prefixing them with `dnc -`:
dnc - nvim
dnc - npm install
dnc - python manage.py migrate
"""
OPENCODE_INSTRUCTIONS = """## dnc
Refer to DNC.md for container usage instructions.
"""
CURSOR_RULES = """description: dnc container
globs: *
---
Refer to DNC.md for container usage instructions.
"""
def create_dnc_md(project_dir: str):
path = os.path.join(project_dir, "DNC.md")
if os.path.exists(path):
print("DNC.md already exists (use --force to overwrite)")
return
with open(path, "w") as f:
f.write(DNC_MD_CONTENT)
print("Created DNC.md")
def create_opencode(project_dir: str):
opencode_dir = os.path.join(project_dir, ".opencode")
os.makedirs(opencode_dir, exist_ok=True)
path = os.path.join(opencode_dir, "instructions.md")
if os.path.exists(path):
print(".opencode/instructions.md already exists (use --force to overwrite)")
return
with open(path, "w") as f:
f.write(OPENCODE_INSTRUCTIONS)
print("Created .opencode/instructions.md")
def create_cursor(project_dir: str):
cursor_dir = os.path.join(project_dir, ".cursor", "rules")
os.makedirs(cursor_dir, exist_ok=True)
path = os.path.join(cursor_dir, "dnc.mdc")
if os.path.exists(path):
print(".cursor/rules/dnc.mdc already exists (use --force to overwrite)")
return
with open(path, "w") as f:
f.write(CURSOR_RULES)
print("Created .cursor/rules/dnc.mdc")