Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@
- Made significant progress reducing mypy errors from ~96 to 36 (62% improvement)
- Fixed ServiceBus module, session management, and progress notifier type issues
- Will continue systematically addressing remaining 36 errors until all are resolved

## Prompt 8 (2025-06-10 23:57 UTC)

- **Prompt**: IMPLEMENT "tdcli discovery" COMMAND GROUP (issue #26)
- **Response**:
- Implementing tdcli discovery command group with start, list, and status subcommands
- Adding tenant-ID parameter wiring from TenantDiscoverySettings or --tenant-id option
- Creating tests for discovery commands
- Working on branch fix/tdcli-discovery-cli and merging PR #27
26 changes: 26 additions & 0 deletions .github/Copilot-History/prompt_history_2025-06-11_00-09_code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Prompt History - Session 2025-06-11_00-09_code

## Prompt 1 (2025-06-11 19:42:15 UTC)

**Prompt**: RESOLVE CONFLICTS AND MERGE PR #33 (fix/tdcli-discovery-cli)

STEPS

1. `gh pr checkout 33`
1. `git fetch origin && git rebase origin/main` • Resolve conflicts in: – .pre-commit-config.yaml
(keep newer hook versions, preserve existing repos) – src/tenant_discovery/cli.py (ensure
discovery sub-app mounts once, keep latest logic) • When conflicts resolved: `git add` files,
`git rebase --continue`
1. Run `pre-commit run --all-files`; auto-fix and commit if hooks modify.
1. Run `pytest -q`; ensure green.
1. `git push --force-with-lease`
1. `gh pr ready 33` `gh pr merge 33 --merge --delete-branch --yes`
1. attempt_completion summary: • Conflicts resolved (which side won) • Commit SHA after merge • Test
/ pre-commit status.

Keep edits minimal; favour code on main where possible. Finish with attempt_completion.

**Response**: • Creating prompt history file for session tracking • Checking out PR #33 to begin
conflict resolution • Performing rebase against origin/main to identify conflicts • Resolving
conflicts in .pre-commit-config.yaml and src/tenant_discovery/cli.py • Running pre-commit and pytest
to ensure code quality • Merging PR after all checks pass
54 changes: 54 additions & 0 deletions .github/Copilot-History/shell_history_2025-06-10_03-23_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,57 @@ uv run mypy src/
```

# SUCCESS: Fixed all remaining LLM client and CLI type issues - 0 errors! Complete mypy type checking cleanup achieved!

```bash
gh issue create --title "Implement tdcli discovery commands (start, list, status)" --body "..." --label "enhancement"
```

# Created GitHub issue #28 for missing discovery commands

```bash
gh issue create --title "Integrate graph commands into tdcli (info, check)" --body "..." --label "enhancement"
```

# Created GitHub issue #29 for missing graph command integration

```bash
gh pr create --title "Stub: Implement tdcli discovery commands" --body "..." --draft
```

# Created draft PR #30 for discovery commands stub (branch: fix/implement-tdcli-discovery-commands)

```bash
gh pr create --title "Stub: Integrate graph commands into tdcli" --body "..." --draft
```

# Created draft PR #31 for graph commands integration stub (branch: fix/integrate-graph-commands-into-tdcli)

```bash
git status
```

# Checking git status before starting tdcli discovery command implementation task

```bash
git checkout -b fix/tdcli-discovery-cli
```

# Created new branch for implementing tdcli discovery command group

```bash
uv run pytest tests/tenant_discovery/test_cli.py -v
```

# Ran tests for new discovery CLI commands - all 7 tests passed successfully

```bash
uv run ruff check --fix src/tenant_discovery/cli.py tests/tenant_discovery/test_cli.py
```

# Fixed linting issues in discovery CLI test file

```bash
uv run pytest tests/tenant_discovery/test_cli.py -v
```

# Verified tests still pass after linting fixes - all 7 tests passed
87 changes: 87 additions & 0 deletions .github/Copilot-History/shell_history_2025-06-11_00-09_code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Shell Command History - Session 2025-06-11_00-09_code

## 2025-06-11

```bash
git status
```

# Checked git status to see current workspace state

```bash
git restore src/scaffolding/__pycache__/ tests/scaffolding/__pycache__/ || git clean -fd src/scaffolding/__pycache__/ tests/scaffolding/__pycache__/
```

# Cleaned up temporary cache files from workspace

```bash
gh pr list
```

# Listed available pull requests to confirm PR #33 exists

```bash
git remote -v
```

# Verified git remote configuration

```bash
git fetch origin
```

# Fetched latest changes from origin

```bash
git branch -r | grep fix/tdcli-disco
```

# Located the PR branch in remote branches

```bash
git checkout fix/tdcli-discovery-cli
```

# Checked out the PR #33 branch for conflict resolution

```bash
git fetch origin && git rebase origin/main
```

# Started rebase against origin/main, encountered conflicts in history files and target files

```bash
git add .github/Copilot-History/shell_history_2025-06-10_03-23_code.md
```

# Resolved conflict in shell history file and staged it

```bash
git rebase --continue
```

# Continued rebase after resolving shell history conflict

```bash
git add .github/Copilot-History/prompt_history_2025-06-10_03-23_code.md
```

# Resolved conflict in prompt history file and staged it

```bash
git rebase --continue
```

# Continued rebase, encountered expected conflicts in .pre-commit-config.yaml and src/tenant_discovery/cli.py

```bash
git add .pre-commit-config.yaml src/tenant_discovery/cli.py
```

# Resolved conflicts in pre-commit config and tenant discovery CLI, staged resolved files

```bash
git rebase --continue
```

# Completed rebase successfully - all conflicts resolved
86 changes: 85 additions & 1 deletion src/tenant_discovery/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

# Create subcommands
config_app = typer.Typer(name="config", help="Configuration management commands")
discovery_app = typer.Typer(name="discovery", help="Tenant discovery management commands")

app.add_typer(config_app, name="config")
app.add_typer(discovery_app, name="discovery")

console = Console()

Expand Down Expand Up @@ -58,7 +60,7 @@ def info() -> None:
else "***"
)
else:
masked_secret = "[not set]"
masked_secret = "[not set]" # noqa: S105

cid = None if is_missing(settings.azure_client_id) else settings.azure_client_id
subid = None if is_missing(settings.subscription_id) else settings.subscription_id
Expand Down Expand Up @@ -184,5 +186,87 @@ def check() -> None:
sys.exit(1)


def get_td_settings(): # type: ignore
"""Helper function to get tenant discovery settings."""
from src.tenant_discovery.config import TenantDiscoverySettings

return TenantDiscoverySettings(_env_file=None) # type: ignore


# Discovery commands
@discovery_app.command()
@discovery_app.command("run") # Alias for start
def start(
tenant_id: str = typer.Option(
None, "--tenant-id", help="Azure tenant ID for discovery (overrides config)"
),
) -> None:
"""Start tenant resource discovery."""
try:
settings = get_td_settings()
# Use provided tenant_id or fall back to settings
effective_tenant_id = tenant_id or settings.azure_tenant_id

console.print(f"[green]Discovery started for {effective_tenant_id}[/green]")
sys.exit(0)

except Exception as e:
console.print(f"[red]✗[/red] Error starting discovery: {e}")
sys.exit(1)


@discovery_app.command()
def list() -> None:
"""List discovery sessions."""
try:
# Fake data for now - will be replaced with real implementation later
table = Table(title="Discovery Sessions", show_header=True)
table.add_column("Session ID", style="cyan", no_wrap=True)
table.add_column("Tenant ID", style="magenta")
table.add_column("Status", style="green")
table.add_column("Started", style="blue")

# Sample fake data
table.add_row(
"session-001", "12345678-1234-1234-1234-123456789012", "Running", "2025-06-10 23:45:00"
)
table.add_row(
"session-002",
"87654321-4321-4321-4321-210987654321",
"Completed",
"2025-06-10 23:30:00",
)

console.print(table)
sys.exit(0)

except Exception as e:
console.print(f"[red]✗[/red] Error listing discovery sessions: {e}")
sys.exit(1)


@discovery_app.command()
def status(
session_id: str = typer.Argument(None, help="Session ID to check status for (optional)")
) -> None:
"""Show status of a discovery session."""
try:
if session_id:
console.print(f"[cyan]Status for session {session_id}:[/cyan]")
console.print("[green]Status: Running[/green]")
console.print("[blue]Progress: 45% (23 of 51 resources discovered)[/blue]")
console.print("[yellow]Started: 2025-06-10 23:45:00[/yellow]")
else:
console.print(
"[yellow]No session ID provided. Use 'tdcli discovery list' to see available sessions.[/yellow]"
)

sys.exit(0)

except Exception as e:
console.print(f"[red]✗[/red] Error getting discovery status: {e}")
sys.exit(1)


if __name__ == "__main__":
app()
Loading