@mindfoldhq/trellis 0.3.0-beta.7 → 0.3.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.3.0-beta.8",
|
|
3
|
+
"description": "Task commands now support task name lookup",
|
|
4
|
+
"breaking": false,
|
|
5
|
+
"recommendMigrate": false,
|
|
6
|
+
"changelog": "All task commands (start, init-context, set-branch, etc.) now support task name in addition to full path. Example: `python3 task.py start my-task` instead of `python3 task.py start .trellis/tasks/01-31-my-task`.",
|
|
7
|
+
"migrations": [],
|
|
8
|
+
"notes": "Usability improvement. No migration required."
|
|
9
|
+
}
|
|
@@ -96,9 +96,31 @@ def _slugify(title: str) -> str:
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
def _resolve_task_dir(target_dir: str, repo_root: Path) -> Path:
|
|
99
|
-
"""Resolve task directory to absolute path.
|
|
99
|
+
"""Resolve task directory to absolute path.
|
|
100
|
+
|
|
101
|
+
Supports:
|
|
102
|
+
- Absolute path: /path/to/task
|
|
103
|
+
- Relative path: .trellis/tasks/01-31-my-task
|
|
104
|
+
- Task name: my-task (uses find_task_by_name for lookup)
|
|
105
|
+
"""
|
|
106
|
+
if not target_dir:
|
|
107
|
+
return Path()
|
|
108
|
+
|
|
109
|
+
# Absolute path
|
|
100
110
|
if target_dir.startswith("/"):
|
|
101
111
|
return Path(target_dir)
|
|
112
|
+
|
|
113
|
+
# Relative path (contains path separator or starts with .trellis)
|
|
114
|
+
if "/" in target_dir or target_dir.startswith(".trellis"):
|
|
115
|
+
return repo_root / target_dir
|
|
116
|
+
|
|
117
|
+
# Task name - try to find in tasks directory
|
|
118
|
+
tasks_dir = get_tasks_dir(repo_root)
|
|
119
|
+
found = find_task_by_name(target_dir, tasks_dir)
|
|
120
|
+
if found:
|
|
121
|
+
return found
|
|
122
|
+
|
|
123
|
+
# Fallback to treating as relative path
|
|
102
124
|
return repo_root / target_dir
|
|
103
125
|
|
|
104
126
|
|
|
@@ -529,22 +551,26 @@ def cmd_list_context(args: argparse.Namespace) -> int:
|
|
|
529
551
|
def cmd_start(args: argparse.Namespace) -> int:
|
|
530
552
|
"""Set current task."""
|
|
531
553
|
repo_root = get_repo_root()
|
|
532
|
-
|
|
554
|
+
task_input = args.dir
|
|
533
555
|
|
|
534
|
-
if not
|
|
535
|
-
print(colored("Error: task directory required", Colors.RED))
|
|
556
|
+
if not task_input:
|
|
557
|
+
print(colored("Error: task directory or name required", Colors.RED))
|
|
536
558
|
return 1
|
|
537
559
|
|
|
538
|
-
#
|
|
539
|
-
|
|
540
|
-
task_dir = task_dir[len(str(repo_root)) + 1:]
|
|
560
|
+
# Resolve task directory (supports task name, relative path, or absolute path)
|
|
561
|
+
full_path = _resolve_task_dir(task_input, repo_root)
|
|
541
562
|
|
|
542
|
-
# Verify directory exists
|
|
543
|
-
full_path = repo_root / task_dir
|
|
544
563
|
if not full_path.is_dir():
|
|
545
|
-
print(colored(f"Error: Task
|
|
564
|
+
print(colored(f"Error: Task not found: {task_input}", Colors.RED))
|
|
565
|
+
print("Hint: Use task name (e.g., 'my-task') or full path (e.g., '.trellis/tasks/01-31-my-task')")
|
|
546
566
|
return 1
|
|
547
567
|
|
|
568
|
+
# Convert to relative path for storage
|
|
569
|
+
try:
|
|
570
|
+
task_dir = str(full_path.relative_to(repo_root))
|
|
571
|
+
except ValueError:
|
|
572
|
+
task_dir = str(full_path)
|
|
573
|
+
|
|
548
574
|
if set_current_task(task_dir, repo_root):
|
|
549
575
|
print(colored(f"✓ Current task set to: {task_dir}", Colors.GREEN))
|
|
550
576
|
print()
|
package/package.json
CHANGED