# Dedupe, close, and tag

Keep the issue list honest: one issue per real problem, closed when resolved.

## Close

```bash
cofactor issues close <issueId>
cofactor issues close <issueId> --not-a-bug --reason "<why this is intended>"
```

`--not-a-bug` requires `--reason`. Cofactor records the reason as intended
behavior so the same behavior is not reported again; write it as a clear
statement of the rule ("Archived projects intentionally hide the Edit
button"), not as an apology.

## Reopen

```bash
cofactor issues reopen <issueId>
```

Use when a closed issue recurs. This also clears a duplicate link.

## Merge duplicates

```bash
cofactor issues merge <dupId>[,<dupId>...] --into <canonicalId>
```

The duplicates are closed, their tags are copied to the canonical issue, it
gains a comment, and later sightings land on the canonical issue. Pick the
oldest or best-documented issue as canonical. Confirm they share a root
cause, not just a symptom, before merging.

## Add a sighting

```bash
cofactor issues bump <issueId> --url <page-url> [--from-run <runId>] [--body "<note>"]
```

Records that the problem was seen again, attaching the run's video and trace,
instead of filing a duplicate.

## Comment

```bash
cofactor issues comment <issueId> --body "<text>"
cofactor issues comment <issueId> --body @note.md
```

Leaves a note for the team on the issue. `issues get` lists the comments.

## Tag

```bash
cofactor issues tag <issueId> --add regression,checkout
cofactor issues tag <issueId> --remove checkout
cofactor issues tag <issueId> --set regression
```

Tags are referenced by name. Create a missing tag first:

```bash
cofactor tag create --name <name> --color <color>
```

## Rules

- Read an issue with `issues get` before closing or merging it.
- Never paste credentials or tokens from an issue's evidence into tickets,
  comments or chat.
- Search (`issues list --search`, or `issues create --check`) before filing
  or closing.
- Never close as not-a-bug without a reason you could defend to the person
  who owns the feature.
- Add `--json` to any command for scripting.
