Skip to content

Commit 3be36f8

Browse files
feat: add SDD artifacts check and task progress parsing to specify status
1 parent 681dc46 commit 3be36f8

1 file changed

Lines changed: 100 additions & 1 deletion

File tree

‎src/specify_cli/__init__.py‎

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,106 @@ def status():
19081908
padding=(1, 2),
19091909
)
19101910
console.print(panel)
1911-
console.print()
1911+
1912+
# --- SDD Artifacts & Task Progress ---
1913+
if feature_dir and feature_dir.is_dir():
1914+
console.print(f"[bold cyan] Current Feature:[/bold cyan] {feature_dir.name}")
1915+
console.print(f" {'─' * 40}")
1916+
1917+
# Define all SDD artifacts to check
1918+
artifacts = [
1919+
("spec.md", feature_dir / "spec.md"),
1920+
("plan.md", feature_dir / "plan.md"),
1921+
("tasks.md", feature_dir / "tasks.md"),
1922+
("research.md", feature_dir / "research.md"),
1923+
("data-model.md", feature_dir / "data-model.md"),
1924+
("quickstart.md", feature_dir / "quickstart.md"),
1925+
]
1926+
# Directory-based artifacts
1927+
contracts_dir = feature_dir / "contracts"
1928+
checklists_dir = feature_dir / "checklists"
1929+
1930+
# Parse task progress from tasks.md if it exists
1931+
tasks_file = feature_dir / "tasks.md"
1932+
tasks_completed = 0
1933+
tasks_total = 0
1934+
if tasks_file.is_file():
1935+
try:
1936+
tasks_content = tasks_file.read_text(encoding="utf-8")
1937+
import re
1938+
for line in tasks_content.splitlines():
1939+
stripped = line.strip()
1940+
if re.match(r"^-\s+\[([ xX])\]", stripped):
1941+
tasks_total += 1
1942+
if re.match(r"^-\s+\[[xX]\]", stripped):
1943+
tasks_completed += 1
1944+
except OSError:
1945+
pass
1946+
1947+
# Parse checklist progress if checklists/ exists
1948+
checklist_count = 0
1949+
checklists_all_pass = True
1950+
if checklists_dir.is_dir():
1951+
for cl_file in checklists_dir.iterdir():
1952+
if cl_file.is_file() and cl_file.suffix == ".md":
1953+
checklist_count += 1
1954+
try:
1955+
cl_content = cl_file.read_text(encoding="utf-8")
1956+
for line in cl_content.splitlines():
1957+
stripped = line.strip()
1958+
if re.match(r"^-\s+\[ \]", stripped):
1959+
checklists_all_pass = False
1960+
break
1961+
except OSError:
1962+
pass
1963+
1964+
# Display artifacts with status
1965+
console.print()
1966+
console.print(" [bold]Artifacts:[/bold]")
1967+
for artifact_name, artifact_path in artifacts:
1968+
if artifact_path.is_file():
1969+
icon = "[green]✓[/green]"
1970+
extra = ""
1971+
# Add task progress info for tasks.md
1972+
if artifact_name == "tasks.md" and tasks_total > 0:
1973+
pct = int(tasks_completed / tasks_total * 100)
1974+
if tasks_completed == tasks_total:
1975+
extra = f" [green]{tasks_completed}/{tasks_total} completed (100%)[/green]"
1976+
else:
1977+
extra = f" [yellow]{tasks_completed}/{tasks_total} completed ({pct}%)[/yellow]"
1978+
console.print(f" {icon} {artifact_name}{extra}")
1979+
else:
1980+
console.print(f" [dim]✗ {artifact_name}[/dim]")
1981+
1982+
# Contracts directory
1983+
has_contracts = contracts_dir.is_dir() and any(contracts_dir.iterdir())
1984+
if has_contracts:
1985+
contract_files = len([f for f in contracts_dir.iterdir() if f.is_file()])
1986+
console.print(f" [green]✓[/green] contracts/ [dim]{contract_files} file(s)[/dim]")
1987+
else:
1988+
console.print(f" [dim]✗ contracts/[/dim]")
1989+
1990+
# Checklists directory
1991+
if checklist_count > 0:
1992+
if checklists_all_pass:
1993+
console.print(f" [green]✓[/green] checklists/ [green]{checklist_count} checklist(s), all passing[/green]")
1994+
else:
1995+
console.print(f" [yellow]✓[/yellow] checklists/ [yellow]{checklist_count} checklist(s), some incomplete[/yellow]")
1996+
else:
1997+
console.print(f" [dim]✗ checklists/[/dim]")
1998+
1999+
console.print()
2000+
2001+
elif current_branch and current_branch not in ("main", "master"):
2002+
console.print(f"\n [yellow]No feature directory found for branch '{current_branch}'[/yellow]")
2003+
console.print(f" [dim]Run /speckit.specify to create a feature.[/dim]\n")
2004+
else:
2005+
specs_dir = project_root / "specs"
2006+
if specs_dir.is_dir() and any(specs_dir.iterdir()):
2007+
feature_count = len([d for d in specs_dir.iterdir() if d.is_dir()])
2008+
console.print(f"\n [dim]{feature_count} feature(s) in specs/ — switch to a feature branch to see details.[/dim]\n")
2009+
else:
2010+
console.print(f"\n [dim]No features created yet. Run /speckit.specify to start.[/dim]\n")
19122011

19132012

19142013
# ===== Extension Commands =====

0 commit comments

Comments
 (0)