diff --git a/bin/disinto b/bin/disinto index 48b4526..9483f1b 100755 --- a/bin/disinto +++ b/bin/disinto @@ -1440,6 +1440,35 @@ EOF echo " Commit this to your repo when ready" } +# Copy issue templates from templates/ to target project repo. +copy_issue_templates() { + local repo_root="$1" + local template_dir="${FACTORY_ROOT}/templates" + local target_dir="${repo_root}/.forgejo/ISSUE_TEMPLATE" + + # Skip if templates directory doesn't exist + if [ ! -d "$template_dir" ]; then + return + fi + + # Create target directory + mkdir -p "$target_dir" + + # Copy each template file if it doesn't already exist + for template in "$template_dir"/issue/*; do + [ -f "$template" ] || continue + local filename + filename=$(basename "$template") + local target_path="${target_dir}/${filename}" + if [ ! -f "$target_path" ]; then + cp "$template" "$target_path" + echo "Copied: ${target_path}" + else + echo "Skipped: ${target_path} (already exists)" + fi + done +} + # Generate and optionally install cron entries for the project agents. install_cron() { local name="$1" toml="$2" auto_yes="$3" bare="${4:-false}" @@ -2050,6 +2079,9 @@ p.write_text(text) # Generate template deployment pipeline configs in project repo generate_deploy_pipelines "$repo_root" "$project_name" + # Copy issue templates to target project + copy_issue_templates "$repo_root" + # Install cron jobs install_cron "$project_name" "$toml_path" "$auto_yes" "$bare" @@ -2645,7 +2677,6 @@ disinto_hire_an_agent() { echo "" echo "Step 1: Creating user '${agent_name}' (if not exists)..." - local user_exists=false local user_pass="" local admin_pass="" @@ -2659,7 +2690,8 @@ disinto_hire_an_agent() { local admin_user="disinto-admin" admin_pass="${admin_pass:-admin}" local admin_token="" - local admin_token_name="temp-token-$(date +%s)" + local admin_token_name + admin_token_name="temp-token-$(date +%s)" admin_token=$(curl -sf -X POST \ -u "${admin_user}:${admin_pass}" \ -H "Content-Type: application/json" \ @@ -2680,7 +2712,6 @@ disinto_hire_an_agent() { fi if curl -sf --max-time 5 "${forge_url}/api/v1/users/${agent_name}" >/dev/null 2>&1; then - user_exists=true echo " User '${agent_name}' already exists" # Reset user password so we can get a token (#184) user_pass="agent-$(head -c 16 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | head -c 20)" @@ -2707,7 +2738,6 @@ disinto_hire_an_agent() { echo " Warning: failed to create user via admin API" >&2 # Try alternative: user might already exist if curl -sf --max-time 5 "${forge_url}/api/v1/users/${agent_name}" >/dev/null 2>&1; then - user_exists=true echo " User '${agent_name}' exists (confirmed)" else echo " Error: failed to create user '${agent_name}'" >&2 @@ -2765,9 +2795,7 @@ disinto_hire_an_agent() { echo "" echo "Step 2: Creating '${agent_name}/.profile' repo (if not exists)..." - local repo_exists=false if curl -sf --max-time 5 "${forge_url}/api/v1/repos/${agent_name}/.profile" >/dev/null 2>&1; then - repo_exists=true echo " Repo '${agent_name}/.profile' already exists" else # Create the repo using the admin API to ensure it's created in the agent's namespace. @@ -2874,8 +2902,8 @@ EOF git -C "$clone_dir" add -A if ! git -C "$clone_dir" diff --cached --quiet 2>/dev/null; then git -C "$clone_dir" commit -m "chore: initial .profile setup" -q - git -C "$clone_dir" push origin main 2>&1 >/dev/null || \ - git -C "$clone_dir" push origin master 2>&1 >/dev/null || true + git -C "$clone_dir" push origin main >/dev/null 2>&1 || \ + git -C "$clone_dir" push origin master >/dev/null 2>&1 || true echo " Committed: initial .profile setup" else echo " No changes to commit" diff --git a/templates/issue/bug.md b/templates/issue/bug.md new file mode 100644 index 0000000..9223e84 --- /dev/null +++ b/templates/issue/bug.md @@ -0,0 +1,28 @@ +--- +name: Bug Report +about: Report a bug or unexpected behavior +labels: bug-report +--- + +## What happened + + + +## What was expected + + + +## Steps to reproduce + + +1. +2. +3. + +## Environment + + +- Browser/Client: +- Wallet (if applicable): +- Network (if applicable): +- Version: