diff --git a/README.md b/README.md index 22aed2b..c5adff1 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ linear-cli i get LIN-123 --comments # Inline comments linear-cli i get LIN-1 LIN-2 LIN-3 # Batch fetch linear-cli i create "Fix login" -t ENG -p 1 # Create urgent issue +linear-cli i create "Fix login" -t ENG --project "Q2 Roadmap" linear-cli i update LIN-123 -s Done # Update status linear-cli i update LIN-123 -l bug -l urgent # Add labels linear-cli i update LIN-123 --due tomorrow # Set due date @@ -100,6 +101,8 @@ linear-cli i open LIN-123 # Open in browser linear-cli i link LIN-123 # Print URL ``` +**Create flags:** `--team`, `--description`, `--data`, `--priority`, `--state`, `--assignee`, `--labels`, `--due`, `--estimate`, `--project`, `--template`, `--dry-run` + **List flags:** `--mine`, `--team`, `--state`, `--assignee`, `--project`, `--label`, `--since`, `--view`, `--group-by` (state/priority/assignee/project), `--count-only`, `--archived` ### Projects diff --git a/src/commands/issues.rs b/src/commands/issues.rs index 8527275..b9b2783 100644 --- a/src/commands/issues.rs +++ b/src/commands/issues.rs @@ -103,6 +103,7 @@ pub enum IssueCommands { linear issues create "Fix bug" -t ENG # Create with title and team linear i create "Feature" -t ENG -p 2 # Create with high priority linear i create "Task" -t ENG -a me # Assign to yourself + linear i create "Task" -t ENG --project Q2 # Add to project linear i create "Task" -t ENG --due +3d # Due in 3 days linear i create "Bug" -t ENG --dry-run # Preview without creating"#)] Create { @@ -135,6 +136,9 @@ pub enum IssueCommands { /// Estimate in points (e.g., 1, 2, 3, 5, 8) #[arg(short, long)] estimate: Option, + /// Project name or ID + #[arg(long)] + project: Option, /// Template name to use for default values #[arg(long)] template: Option, @@ -348,6 +352,7 @@ pub async fn handle( labels, due, estimate, + project, template, dry_run, } => { @@ -429,6 +434,7 @@ pub async fn handle( final_labels, due, estimate, + project, output, agent_opts, dry_run, @@ -1267,6 +1273,7 @@ async fn create_issue( labels: Vec, due: Option, estimate: Option, + project: Option, output: &OutputOptions, agent_opts: AgentOptions, dry_run: bool, @@ -1356,6 +1363,14 @@ async fn create_issue( if let Some(e) = estimate { input["estimate"] = json!(e); } + if let Some(ref p) = project { + if dry_run { + input["projectId"] = json!(p); + } else { + let project_id = resolve_project_id(&client, p, &output.cache).await?; + input["projectId"] = json!(project_id); + } + } // Dry run: show what would be created without actually creating if dry_run { @@ -1374,6 +1389,7 @@ async fn create_issue( "labels": labels, "dueDate": due, "estimate": estimate, + "project": project, } }), output, @@ -1409,6 +1425,9 @@ async fn create_issue( if let Some(e) = estimate { println!(" Estimate: {}", e); } + if let Some(ref p) = project { + println!(" Project: {}", p); + } } return Ok(()); } diff --git a/tests/cli_tests.rs b/tests/cli_tests.rs index ef5925c..5cde509 100644 --- a/tests/cli_tests.rs +++ b/tests/cli_tests.rs @@ -73,6 +73,13 @@ fn test_issues_help() { assert!(stdout.contains("stop")); } +#[test] +fn test_issues_create_help_includes_project() { + let (code, stdout, _stderr) = run_cli(&["issues", "create", "--help"]); + assert_eq!(code, 0); + assert!(stdout.contains("--project")); +} + #[test] fn test_teams_help() { let (code, stdout, _stderr) = run_cli(&["teams", "--help"]);