Metadata-Version: 2.4
Name: python-asana-cli
Version: 0.1.1
Summary: A powerful command line interface for Asana
Author: asana-cli contributors
License: MIT
Project-URL: Homepage, https://github.com/hanzhichao/asana-cli
Project-URL: Issues, https://github.com/hanzhichao/asana-cli/issues
Keywords: asana,cli,task,project,management
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: asana>=5.0.0
Requires-Dist: click>=8.0
Requires-Dist: rich>=13.0
Requires-Dist: python-dotenv>=1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-mock>=3.11; extra == "dev"
Dynamic: license-file

# asana-cli

A powerful, colorful command line interface for [Asana](https://asana.com), built on top of the official `asana` Python SDK and `click`.

![Languate - Python](https://img.shields.io/badge/language-python-blue.svg)
![PyPI - License](https://img.shields.io/pypi/l/python-asana-cli)
![PyPI](https://img.shields.io/pypi/v/python-asana-cli)
![PyPI - Downloads](https://img.shields.io/pypi/dm/python-asana-cli)

## Features

- 🗂 **Tasks**: list, get, create, update, complete, delete, comment, subtasks
- 📁 **Projects**: list, get, create, update, delete, sections
- 🏢 **Workspaces**: list workspaces and users
- 👤 **Users**: whoami, list assigned tasks
- 🎨 Beautiful rich terminal output with colors and tables
- 🔐 Secure token storage in `~/.asana-cli`

## Installation

```bash
pip install python-asana-cli
```

## Configuration

Get your **Personal Access Token** from https://app.asana.com/0/my-apps, then:

```bash
asana-cli config set-token <YOUR_TOKEN>
```

Or set the environment variable:

```bash
export ASANA_TOKEN=<YOUR_TOKEN>
```

## Usage

### General

```bash
asana-cli --help
asana-cli config show
asana-cli config set-token <TOKEN>
```

### Workspaces

```bash
# List all workspaces
asana-cli workspace list

# List users in a workspace
asana-cli workspace users <WORKSPACE_GID>
```

### User

```bash
# Show current user info
asana-cli user me

# Show tasks assigned to me
asana-cli user tasks --workspace <WORKSPACE_GID>
asana-cli user tasks --workspace <WORKSPACE_GID> --completed  # include done tasks
```

### Projects

```bash
# List projects in a workspace
asana-cli project list --workspace <WORKSPACE_GID>

# Get project details
asana-cli project get <PROJECT_GID>

# Create a project
asana-cli project create --workspace <WORKSPACE_GID> --name "My Project" --color light-green

# Update a project
asana-cli project update <PROJECT_GID> --name "New Name"

# Archive a project
asana-cli project update <PROJECT_GID> --archive

# Delete a project
asana-cli project delete <PROJECT_GID>

# List sections
asana-cli project sections <PROJECT_GID>

# Add a section
asana-cli project add-section <PROJECT_GID> --name "In Progress"
```

### Tasks

```bash
# List tasks in a project (default 10)
asana-cli task list --project <PROJECT_GID>

# Limit and pagination
asana-cli task list --project <PROJECT_GID> --limit 20
asana-cli task list --project <PROJECT_GID> --limit 5 --offset <OFFSET>

# Filter by section
asana-cli task list --project <PROJECT_GID> --section <SECTION_GID>

# Filter by assignee (use "me" or fuzzy name)
asana-cli task list --project <PROJECT_GID> --assignee me
asana-cli task list --project <PROJECT_GID> --assignee "roby"

# Filter by creator (use "me" for current user)
asana-cli task list --project <PROJECT_GID> --creator me

# Show completed tasks
asana-cli task list --project <PROJECT_GID> --completed

# Get task details
asana-cli task get <TASK_GID>

# Create a task
asana-cli task create --project <PROJECT_GID> --name "Fix bug" --due 2026-04-29 --assignee me

# Create a task with fuzzy assignee search
asana-cli task create --project <PROJECT_GID> --name "Task" --assignee "Kevin"
asana-cli task create --project <PROJECT_GID> --name "Task" --assignee "kevin@xxx.com"

# Create a task with custom fields
asana-cli task create --project <PROJECT_GID> --name "Task" \
    --custom-field "Priority=High" \
    --custom-field "类型=后端" \
    --custom-field "发现日期=2026-04-29"

# Create a task in a specific section
asana-cli task create --project <PROJECT_GID> --name "Review PR" --section <SECTION_GID>

# Update a task
asana-cli task update <TASK_GID> --name "New Name" --due 2025-11-01

# Update a task with custom fields
asana-cli task update <TASK_GID> --custom-field "Priority=Medium"

# Mark task complete
asana-cli task complete <TASK_GID>

# Mark task incomplete
asana-cli task update <TASK_GID> --incomplete

# Delete a task
asana-cli task delete <TASK_GID>

# Add a comment
asana-cli task comment <TASK_GID> "Great progress on this!"

# List subtasks
asana-cli task subtasks <TASK_GID>

# Add a subtask
asana-cli task add-subtask <PARENT_TASK_GID> --name "Write tests"
```

## Tips

- Find GIDs in the Asana URL: `https://app.asana.com/0/<project_gid>/...`
- Use `--assignee me` to assign to yourself
- Fuzzy assignee search: `--assignee "roby"` matches "roby.qian", "Roby Qian", "roby.qian@trueusd.com"
- Custom fields: supports enum, text, date types (e.g., `--custom-field "发现日期=2026-04-29"`)
- Due date colors: 🔴 overdue, 🟡 due soon (≤3 days), 🟢 upcoming

## License

MIT
