Skip to content

feat(projects): auto-translate raw unicode emoji to shortcode for --icon #148

@flipbit03

Description

@flipbit03

Background

Surfaced as follow-up #1 in #146 (and PR #147 lands the doc fix that's the immediate-scope half of that issue).

Linear's API rejects raw unicode emoji on icon fields (🔁, , 📦INVALID_INPUT) but accepts the equivalent colon-wrapped shortcode (:repeat:, :star:, :package:). #146 documents this; this issue tracks making lineark paper over the gap so users don't have to know.

Proposal

When --icon receives a value containing non-ASCII chars, translate it to its standard emoji shortcode before sending to Linear. So:

lineark projects create "Demo" --team ENG --icon "🔁"
# lineark internally rewrites to --icon ":repeat:" and the API accepts it

The standard emoji↔shortcode mapping is well-defined and shared across Slack, GitHub, Discord, and emojibase — picking any one of those tables (or the emojis crate, which exposes Slack/GitHub shortcodes from a generated table) gets us coverage of the common set.

Behavior

  • Input is pure ASCII → pass through unchanged (named icons, existing shortcodes).
  • Input contains a recognized unicode emoji → rewrite to :shortcode: and proceed.
  • Input contains an unrecognized non-ASCII char → pass through unchanged; let Linear reject it. Rationale: don't silently discard data we don't understand.

Escape hatch

--icon-raw (or --no-translate) for users who genuinely want to send raw bytes — useful if Linear ever fixes the validator and we need a way to test without lineark "helping."

Scope

Why this isn't speculative

Acceptance criteria

  • --icon "🔁" translates to :repeat: and succeeds against Linear's API
  • --icon "Computer" (named icon) passes through unchanged
  • --icon ":repeat:" (already-shortcode) passes through unchanged
  • --icon "<unrecognized unicode>" passes through unchanged and surfaces Linear's rejection
  • Online test in crates/lineark/tests/online.rs covers the unicode→shortcode happy path against a real project
  • Offline test covers the translation logic in isolation
  • --icon help text updated to remove the "rejects raw unicode emoji" warning (since lineark now handles it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions