Skip to content

comment create: --body-adf flag missing (present on comment update) #45

Description

@maximharizanov

Summary

acli jira workitem comment create does not support the --body-adf flag, even though acli jira workitem comment update does. This means there's no way to create a comment with rich ADF formatting in a single command.

The --body flag's help text says it accepts "plain text or Atlassian Document Format (ADF)", but passing raw ADF JSON results in it being wrapped as a plain text paragraph via adf.FromText(), not parsed as ADF.

Steps to Reproduce

# Create an ADF JSON file
cat > /tmp/test.json << 'ENDJSON'
{
  "version": 1,
  "type": "doc",
  "content": [
    {
      "type": "heading",
      "attrs": { "level": 2 },
      "content": [{ "type": "text", "text": "Hello" }]
    }
  ]
}
ENDJSON

# This fails with INVALID_INPUT:
acli jira workitem comment create --key TEST-123 --body-adf /tmp/test.json

# This also doesn't work — ADF JSON is posted as plain text:
acli jira workitem comment create --key TEST-123 --body '{"version":1,"type":"doc","content":[...]}'

# But update works fine:
acli jira workitem comment update --key TEST-123 --id 12345 --body-adf /tmp/test.json

Expected Behavior

acli jira workitem comment create should support --body-adf <file> the same way comment update does.

Workaround

Create a stub comment, then immediately update it with ADF:

acli jira workitem comment create --key TEST-123 --body "placeholder" --json
# extract comment ID from output
acli jira workitem comment update --key TEST-123 --id <ID> --body-adf /path/to/adf.json

Root Cause (from binary analysis, v1.3.13-stable)

The two commands use different architectures internally:

  • comment create is a hardcoded Go command (create_comment.go) that only registers --body and --body-file cobra flags. When --body receives input, it unconditionally calls adf.FromText() which wraps everything as a plain text paragraph — even valid ADF JSON.

  • comment update is a YAML-templated dynamic command (jira/workitem/comment_update.yaml) that defines three mutually exclusive flags: body, body-file, and body-adf (type flag.BodyAdf). The body-adf flag properly reads and parses ADF JSON via adf.FromJSON().

Relevant functions in the binary:

  • adf.FromText() — wraps as plain text paragraph (what comment create uses)
  • adf.FromJSON() — parses ADF JSON (what comment update --body-adf uses)
  • adf.FromData() — auto-detects format (not used by either command)

The fix would be to either:

  1. Add --body-adf flag to the comment create Go command, or
  2. Migrate comment create to the YAML-templated system (which already has the infrastructure for --body-adf)

Environment

  • acli version: 1.3.13-stable
  • OS: macOS (Apple Silicon, Homebrew install)
  • Jira Cloud

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions