Skip to content

netresearch/jira-skill / skills/jira-communication

jira-communication

Flagged

Use when handling Jira issues, sprints, boards, links, fields, worklogs, attachments, or users, or on any Jira intent without a key ("create/find a ticket", "pick a project"). Auto-triggers on Jira URLs and issue keys (PROJ-123). Also use when MCP Atlassian tools fail or are unavailable for Jira Server/DC.

FileKindSize
AGENTS.mdmarkdown2.5 KB
CLAUDE.mdmarkdown9 B
SKILL.mdskill md10.4 KB
evals/evals.jsonconfig7.6 KB
references/agile.mdmarkdown1.9 KB
references/attachments.mdmarkdown4.7 KB
references/comments.mdmarkdown14.4 KB
references/creation.mdmarkdown4.0 KB
references/fields-and-users.mdmarkdown7.7 KB
references/intent-verbs.mdmarkdown13.5 KB
references/issue-editing.mdmarkdown11.6 KB
references/jql-cookbook.mdmarkdown8.0 KB
references/jql-quick-reference.mdmarkdown6.3 KB
references/links.mdmarkdown7.8 KB
references/multi-profile.mdmarkdown3.9 KB
references/no-editorializing.mdmarkdown2.3 KB
references/qa-gather.mdmarkdown12.1 KB
references/troubleshooting.mdmarkdown12.0 KB
references/versions.mdmarkdown7.7 KB
references/watchers.mdmarkdown3.9 KB
references/worklog.mdmarkdown8.6 KB
scripts/core/jira-attachment.pyexecutablescript21.2 KB
scripts/core/jira-issue.pyexecutablescript50.6 KB
scripts/core/jira-search.pyexecutablescript9.6 KB
scripts/core/jira-setup.pyexecutablescript20.0 KB
scripts/core/jira-validate.pyexecutablescript14.2 KB
scripts/core/jira-worklog.pyexecutablescript15.5 KB
scripts/lib/__init__.pyscript742 B
scripts/lib/changelog.pyscript8.0 KB
scripts/lib/client.pyscript26.4 KB
scripts/lib/config.pyscript15.9 KB
scripts/lib/errors.pyscript1.8 KB
scripts/lib/input.pyscript3.5 KB
scripts/lib/jql.pyscript375 B
scripts/lib/markup.pyscript33.2 KB
scripts/lib/markup_cli.pyscript11.3 KB
scripts/lib/output.pyscript6.9 KB
scripts/lib/preview.pyscript10.0 KB
scripts/lib/render.pyscript1.8 KB
scripts/lib/ticket_state.pyscript13.3 KB
scripts/lib/users.pyscript7.5 KB
scripts/utility/jira-fields.pyexecutablescript11.7 KB
scripts/utility/jira-link.pyexecutablescript42.9 KB
scripts/utility/jira-qa-gather.pyexecutablescript26.3 KB
scripts/utility/jira-user.pyexecutablescript9.3 KB
scripts/utility/jira-watchers.pyexecutablescript9.1 KB
scripts/utility/jira-weblink.pyexecutablescript11.2 KB
scripts/utility/jira-worklog-query.pyexecutablescript27.4 KB
scripts/workflow/jira-board.pyexecutablescript7.0 KB
scripts/workflow/jira-comment.pyexecutablescript19.2 KB
scripts/workflow/jira-create.pyexecutablescript24.3 KB
scripts/workflow/jira-move.pyexecutablescript23.5 KB
scripts/workflow/jira-sprint.pyexecutablescript8.1 KB
scripts/workflow/jira-transition.pyexecutablescript33.7 KB
scripts/workflow/jira-version.pyexecutablescript29.4 KB
scripts/workflow/tempo-account.pyexecutablescript9.1 KB

scripts/utility/jira-user.py

View on GitHub
#!/usr/bin/env -S uv run --script
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Netresearch DTT GmbH
# /// script
# requires-python = ">=3.11"
# dependencies = [
#     "atlassian-python-api>=3.41.0,<4",
#     "click>=8.1.0,<9",
# ]
# ///
"""Jira user operations - get user information."""

import sys
from pathlib import Path

# ═══════════════════════════════════════════════════════════════════════════════
# Shared library import (TR1.1.1 - PYTHONPATH approach)
# ═══════════════════════════════════════════════════════════════════════════════
_script_dir = Path(__file__).parent
_lib_path = _script_dir.parent / "lib"
if _lib_path.exists():
    sys.path.insert(0, str(_lib_path.parent))

import click
from lib.client import CaptchaError, LazyJiraClient, _sanitize_error, is_account_id
from lib.output import error, format_output
from lib.users import find_users

# ═══════════════════════════════════════════════════════════════════════════════
# CLI Definition
# ═══════════════════════════════════════════════════════════════════════════════


@click.group()
@click.option("--json", "output_json", is_flag=True, help="Output as JSON")
@click.option("--quiet", "-q", is_flag=True, help="Minimal output")
@click.option("--env-file", type=click.Path(), help="Environment file path")
@click.option("--profile", "-P", help="Jira profile name from ~/.jira/profiles.json")
@click.option("--debug", is_flag=True, help="Show debug information on errors")
@click.pass_context
def cli(ctx, output_json: bool, quiet: bool, env_file: str | None, profile: str | None, debug: bool):
    """Jira user operations.

    Get information about Jira users.
    """
    ctx.ensure_object(dict)
    ctx.obj["json"] = output_json
    ctx.obj["quiet"] = quiet
    ctx.obj["debug"] = debug
    ctx.obj["client"] = LazyJiraClient(env_file=env_file, profile=profile)


@cli.command()
@click.pass_context
def me(ctx):
    """Get current user information.

    Shows details about the authenticated user.

    Example:

      jira-user me
    """
    client = ctx.obj["client"]

    try:
        user = client.myself()

        if ctx.obj["json"]:
            format_output(user, as_json=True)
        elif ctx.obj["quiet"]:
            print(user.get("accountId", user.get("name", "")))
        else:
            print("Current User:")
            print(f"  Name: {user.get('displayName', 'Unknown')}")
            print(f"  Email: {user.get('emailAddress', 'N/A')}")
            print(f"  Account ID: {user.get('accountId', user.get('key', 'N/A'))}")
            print(f"  Active: {'Yes' if user.get('active', True) else 'No'}")
            timezone = user.get("timeZone", "N/A")
            print(f"  Timezone: {timezone}")

    except Exception as e:
        if ctx.obj["debug"]:
            raise
        error(f"Failed to get current user: {e}")
        sys.exit(1)


@cli.command()
@click.argument("identifier")
@click.pass_context
def get(ctx, identifier: str):
    """Get user by identifier.

    IDENTIFIER: Username, email, or account ID

    Examples:

      jira-user get john.doe

      jira-user get john.doe@example.com

      jira-user get 5b10ac8d82e05b22cc7d4ef5
    """
    client = ctx.obj["client"]

    debug = ctx.obj["debug"]

    try:
        # Try different methods to find user
        user = None

        # Try by account ID first (Cloud)
        if is_account_id(identifier):
            try:
                user = client.user(account_id=identifier)
            except Exception as e:
                if debug:
                    print(f"  [debug] account_id lookup failed: {e}", file=sys.stderr)

        # Try by username directly (Server/DC)
        if not user:
            try:
                user = client.user(username=identifier)
            except Exception as e:
                if debug:
                    print(f"  [debug] username lookup failed: {e}", file=sys.stderr)

        # Try user search API (works for email on Server/DC)
        if not user:
            try:
                users = client.get("rest/api/2/user/search", params={"username": identifier})
                if users and isinstance(users, list) and len(users) > 0:
                    user = users[0]
            except Exception as e:
                if debug:
                    print(f"  [debug] user/search API failed: {e}", file=sys.stderr)

        # Try cloud-aware user search as fallback (username= on Server/DC, query= on Cloud)
        if not user:
            try:
                users = find_users(client, identifier, limit=1)
                if users:
                    user = users[0]
            except Exception as e:
                if debug:
                    print(f"  [debug] find_users failed: {e}", file=sys.stderr)

        if not user:
            error(f"User not found: {identifier}")
            sys.exit(1)

        if ctx.obj["json"]:
            format_output(user, as_json=True)
        elif ctx.obj["quiet"]:
            print(user.get("accountId", user.get("name", "")))
        else:
            print(f"User: {user.get('displayName', 'Unknown')}")
            print(f"  Email: {user.get('emailAddress', 'N/A')}")
            print(f"  Account ID: {user.get('accountId', user.get('key', 'N/A'))}")
            print(f"  Active: {'Yes' if user.get('active', True) else 'No'}")

    except Exception as e:
        if ctx.obj["debug"]:
            raise
        error(f"Failed to get user {identifier}: {e}")
        sys.exit(1)


@cli.command()
@click.argument("query")
@click.option("--limit", "-n", default=10, help="Maximum number of results")
@click.pass_context
def search(ctx, query: str, limit: int):
    """Search for users by name, username, or email.

    QUERY: Search term (matches display name, username, or email)

    Examples:

      jira-user search doreen

      jira-user search "john doe"

      jira-user --json search admin -n 5
    """
    client = ctx.obj["client"]

    try:
        users = []
        api_errors = []

        # Try Server/DC user search API first
        try:
            results = client.get(
                "rest/api/2/user/search",
                params={"username": query, "maxResults": limit},
            )
            if results and isinstance(results, list):
                # Ensure all results are dicts (Server/DC may return strings)
                for r in results:
                    if isinstance(r, dict):
                        users.append(r)
                    elif isinstance(r, str):
                        if not ctx.obj["quiet"]:
                            try:
                                users.append(client.user(username=r))
                            except CaptchaError:
                                raise
                            except Exception as e:
                                if ctx.obj["debug"]:
                                    print(f"  [debug] Failed to resolve user '{r}': {e}", file=sys.stderr)
                        else:
                            users.append({"name": r})
        except CaptchaError:
            raise
        except Exception as e:
            api_errors.append(_sanitize_error(str(e)))
            if ctx.obj["debug"]:
                print(f"  [debug] user/search API failed: {e}", file=sys.stderr)

        # Fallback to cloud-aware library search (username= on Server/DC, query= on Cloud)
        if not users:
            try:
                users = find_users(client, query, limit=limit)
            except CaptchaError:
                raise
            except Exception as e:
                api_errors.append(_sanitize_error(str(e)))
                if ctx.obj["debug"]:
                    print(f"  [debug] find_users failed: {e}", file=sys.stderr)

        if not users:
            if api_errors:
                error("User search failed — all API attempts errored:\n  " + "\n  ".join(api_errors))
            else:
                error(f"No users found matching: {query}")
            sys.exit(1)

        if ctx.obj["json"]:
            format_output(users, as_json=True)
        elif ctx.obj["quiet"]:
            for u in users:
                print(u.get("accountId", u.get("name", "")))
        else:
            print(f"Found {len(users)} user(s) matching '{query}':\n")
            for u in users:
                name = u.get("displayName", "Unknown")
                uid = u.get("name", u.get("key", u.get("accountId", "N/A")))
                email = u.get("emailAddress", "N/A")
                active = "Yes" if u.get("active", True) else "No"
                print(f"  {name} ({uid})")
                print(f"    Email: {email}  Active: {active}")

    except Exception as e:
        if ctx.obj["debug"]:
            raise
        error(f"Failed to search users: {_sanitize_error(str(e))}")
        sys.exit(1)


if __name__ == "__main__":
    cli()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall