---
name: imdone-add
description: Create new issues with `imdone add` using project-local defaults and a summary provided by the user. Use when the user wants to create a Jira or GitHub issue through imdone, especially with requests like `imdone-add summary`, "add a story", or "create an issue with the usual defaults". Ask for the summary if it was not provided. If no custom config exists, ask the user for the missing option values and then run `imdone add`.
---

# Imdone Add

Use the wrapper script at `scripts/imdone_add.mjs` instead of composing `imdone add` flags manually. The wrapper now supports both creation and discovery flows for the current `imdone add` options, including `--list-sprints` and `--list-issue-types`.

## Workflow

1. Determine the summary.
2. If the Jira issue needs an exact sprint ID or issue type and the value is not already known from config or the user, run the wrapper in discovery mode first.
3. Run `scripts/imdone_add.mjs` with the summary.
4. Wait for the wrapper run to finish before checking whether the story exists, deciding whether the create failed, or attempting another add with the same summary. Do not add separate polling around issue creation; rely on `imdone add` to run until it finishes or hits its own timeout.
5. If the script reports missing values, ask the user only for those values and rerun with flags.
6. Present the created issue details from `imdone add`.

Important concurrency rule:
- Do not run multiple `imdone add` wrapper commands in parallel in the same repo. Create issues serially, one run at a time, because the flow touches shared git state, performs provider-side waits, uploads template attachments, and refreshes local issue files.

## Command Pattern

Basic usage:

```bash
node .codex/skills/imdone-add/scripts/imdone_add.mjs "Add keyboard shortcut docs"
```

Pass explicit overrides only when needed:

```bash
node .codex/skills/imdone-add/scripts/imdone_add.mjs \
  --provider jira \
  --project-key SCRUM \
  --issue-type Story \
  --location sprint \
  --template story \
  "Add keyboard shortcut docs"
```

Use discovery mode before non-interactive Jira issue creation when you need exact provider values:

```bash
node .codex/skills/imdone-add/scripts/imdone_add.mjs \
  --provider jira \
  --project-key SCRUM \
  --list-issue-types

node .codex/skills/imdone-add/scripts/imdone_add.mjs \
  --provider jira \
  --project-key SCRUM \
  --list-sprints
```

Pass `--comment` when a template may require a comment and you want the wrapper to satisfy that non-interactively:

```bash
node .codex/skills/imdone-add/scripts/imdone_add.mjs \
  --provider github \
  --template story \
  --comment "Auto-added by imdone-add." \
  "Add keyboard shortcut docs"
```

## Configuration

The script looks for custom config in this order:

1. Path from `IMDONE_ADD_CONFIG`
2. `.imdone/imdone-add.yml`
3. `.imdone/imdone-add.yaml`
4. `.codex/imdone-add.yml`
5. `.codex/imdone-add.yaml`
6. `.imdone-add.yml`
7. `.imdone-add.yaml`

If no custom config is found, read `.imdone/config.yml` only to suggest defaults while prompting. After a successful prompted run, save the resolved defaults to `.imdone/imdone-add.yml`. Read [references/configuration.md](references/configuration.md) for the YAML format and precedence rules.

## Prompting Rules

- If the user did not provide a summary, ask for it before running the script.
- If a Jira run needs an exact `issue_type` or `sprint_id` and the value is not already known, prefer using the wrapper's `--list-issue-types` or `--list-sprints` mode before asking the user to guess.
- If the script reports missing fields, ask only for those fields.
- Do not check for an existing created story or rerun `imdone add` while the wrapper is still running. Wait for the wrapper to finish first, because `imdone add` can legitimately take time and already owns its timeout behavior.
- If the chosen template requires a comment, prefer passing `--comment` so the wrapper can satisfy it non-interactively.
- Prefer project-local config over hardcoding defaults in the prompt.
- Do not edit `.imdone/config.yml` unless the user explicitly asks for that.
- Never parallelize multiple create runs in the same repo. Start the next `imdone add` only after the previous wrapper command has exited.
