[WIP] Add dsregcmd /status analyzer to CMTrace Open - #4
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new dsregcmd /status diagnostics workspace to CMTrace Open, including Rust-side parsing/rules + Tauri commands and a full frontend workflow (capture/paste/open file or evidence folder) to surface join/PRT/MDM/cert health and actionable insights.
Changes:
- Introduces a Rust
dsregcmdmodule (parser + derived signals + diagnostic rules) and exposesanalyze_dsregcmd/capture_dsregcmdTauri commands. - Adds a new frontend dsregcmd workspace UI (toolbar + sidebar + status bar integration) with source loading from file/folder/clipboard/live capture.
- Updates shared UI routing (workspace switching + drag/drop behavior) to support the new workspace.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/dsregcmd.ts | Adds frontend TS types for dsregcmd facts/derived fields/diagnostics and analysis state. |
| src/stores/ui-store.ts | Extends workspace/view model to include dsregcmd and updates chrome labels. |
| src/stores/dsregcmd-store.ts | Adds Zustand store for dsregcmd analysis lifecycle, result, and source context. |
| src/lib/dsregcmd-source.ts | Implements dsregcmd source reading (file/folder/clipboard/capture) and refresh orchestration. |
| src/lib/commands.ts | Adds frontend invoke wrappers for analyze_dsregcmd and capture_dsregcmd. |
| src/hooks/use-drag-drop.ts | Routes drag/drop opens through the active workspace’s source-loading flow. |
| src/components/layout/Toolbar.tsx | Adds dsregcmd open/capture/paste actions, workspace switching buttons, and per-workspace open behavior. |
| src/components/layout/StatusBar.tsx | Displays dsregcmd analysis status and diagnostic counts when dsregcmd workspace is active. |
| src/components/layout/FileSidebar.tsx | Refactors sidebar into per-workspace variants and adds dsregcmd sidebar summary/actions. |
| src/components/layout/AppShell.tsx | Renders the new dsregcmd workspace alongside existing log/intune workspaces. |
| src/components/dsregcmd/DsregcmdWorkspace.tsx | New dsregcmd workspace UI: facts, diagnostics, timeline, export, and raw input view. |
| src-tauri/src/lib.rs | Exposes the dsregcmd module and registers new Tauri commands. |
| src-tauri/src/dsregcmd/rules.rs | Adds derived-signal computation + diagnostic rule engine + unit tests. |
| src-tauri/src/dsregcmd/parser.rs | Adds dsregcmd field parser + unit tests. |
| src-tauri/src/dsregcmd/models.rs | Adds serde models for facts/derived/diagnostic insight payloads. |
| src-tauri/src/dsregcmd/mod.rs | Wires parser + rules into a single analyze_text entry point. |
| src-tauri/src/commands/mod.rs | Registers new commands::dsregcmd module. |
| src-tauri/src/commands/file_ops.rs | Adjusts cfg-dependent known-sources builder to avoid non-Windows clippy warnings. |
| src-tauri/src/commands/dsregcmd.rs | Adds analyze_dsregcmd + capture_dsregcmd Tauri commands (Windows capture via dsregcmd.exe /status). |
| src-tauri/capabilities/default.json | Grants clipboard read permission required for dsregcmd “Paste Clipboard” flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Adds a new dsregcmd /status diagnostics workflow to CMTrace Open, spanning a Rust-backed parser/analyzer plus a dedicated frontend workspace to load, capture, and review dsregcmd output alongside actionable insights.
Changes:
- Introduces a Rust
dsregcmdmodule (parser + derived signals + rule-based diagnostics) and Tauri commands to analyze text and capture live output on Windows. - Adds a new frontend dsregcmd workspace (store, source loaders for file/folder/clipboard/capture, UI panels, export).
- Updates shared UI (toolbar, drag-drop routing, sidebar, status bar, app shell) and Tauri capabilities for clipboard read + text file export.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/dsregcmd.ts | New TS contract for dsregcmd facts/derived/diagnostics + source context/state. |
| src/stores/ui-store.ts | Adds dsregcmd as a workspace/view and updates chrome labels. |
| src/stores/dsregcmd-store.ts | New zustand store for dsregcmd analysis lifecycle + results. |
| src/lib/dsregcmd-source.ts | Loads dsregcmd input from file/folder/clipboard/capture and dispatches analysis into the store. |
| src/lib/commands.ts | Adds analyze_dsregcmd and capture_dsregcmd invoke wrappers. |
| src/hooks/use-drag-drop.ts | Routes drag/drop open behavior through the active workspace. |
| src/components/layout/Toolbar.tsx | Adds dsregcmd open actions (paste/capture), workspace switching UI, and workspace-aware open logic. |
| src/components/layout/StatusBar.tsx | Adds dsregcmd status reporting and refactors tone handling (but currently introduces a compile error). |
| src/components/layout/FileSidebar.tsx | Splits sidebar into Log/Intune/Dsregcmd modes with a dsregcmd-specific sidebar. |
| src/components/layout/AppShell.tsx | Adds DsregcmdWorkspace rendering in the main shell. |
| src/components/dsregcmd/DsregcmdWorkspace.tsx | New dsregcmd workspace UI: summary, diagnostics, grouped facts, timeline, exports, raw input view. |
| src-tauri/src/lib.rs | Registers new dsregcmd module and commands. |
| src-tauri/src/dsregcmd/* | New Rust dsregcmd models/parser/rules + unit tests. |
| src-tauri/src/commands/* | Adds dsregcmd Tauri commands; minor formatting change in file_ops. |
| src-tauri/capabilities/default.json | Enables clipboard read and fs text export permissions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ? `Stale by ${result.derived.prtAgeHours?.toFixed(1) ?? "?"} hours.` | ||
| : "Primary Refresh Token presence derived from SSO state." | ||
| } | ||
| tone={result.derived.azureAdPrtPresent ? (result.derived.stalePrt ? "warn" : "good") : "bad"} |
| | "HybridEntraIdJoined" | ||
| | "EntraIdJoined" | ||
| | "NotJoined" | ||
| | "Unknown"; |
| ? [ | ||
| positionText ?? `${filteredCount} entries`, | ||
| `${totalLines} lines`, | ||
| severityText, | ||
| `${formatDetected ?? "Unknown"} format`, | ||
| parserDisplay?.provenanceLabel, | ||
| parserDisplay?.qualityLabel, | ||
| ] | ||
| .filter((part): part is string => Boolean(part)) | ||
| .join(" | ") |
|
dsregcmd analysis failed. |
Build out the dsregcmd troubleshooting workflow across the Tauri backend, React UI, evidence collection profile, and supporting documentation. This commit adds bundle-aware dsregcmd analysis and live capture support that stages a temporary evidence bundle instead of returning command output alone. The backend now loads dsregcmd sources directly, keeps file and path inspection out of React, and exposes commands for source loading, path inspection, and output writing through Tauri. On the policy-analysis side, this introduces registry-backed Windows Hello for Business evidence loading with support for PolicyManager exports, generic Policies hives, and Microsoft Policies PassportForWork hives. The registry loader now understands UTF-16 registry exports, correlates current and provider policy state, falls back to machine or user policy hives when needed, and feeds richer phase, confidence, and diagnostic rule evaluation into the analyzer. The frontend workspace is updated to present the expanded dsregcmd model, improved health and issue summaries, richer Windows Hello and NGC interpretation, compact policy evidence presentation, and backend-driven source workflows for capture, paste, file, and folder inputs. Toolbar and sidebar copy are aligned with the new troubleshooting flow. The Intune evidence collection profile is updated to capture the additional registry artifacts required for policy correlation, repository configuration is adjusted for the new test target output, and Rust dependencies are updated to support the new registry tests. Finally, add a DSREGCMD troubleshooting guide and include the four reference screenshots used by the document so the new workflow is documented end-to-end.
There was a problem hiding this comment.
Pull request overview
Adds a new dsregcmd /status diagnostics workspace to CMTrace Open, including backend parsing/analysis + frontend capture/open/paste flows, and surfaces derived join/PRT/MDM/WHfB policy signals with actionable findings.
Changes:
- Introduces Rust
dsregcmdmodule (parser + derived/rules plumbing + registry policy evidence loading) and new Tauri commands for analyze/capture/source loading. - Adds a new dsregcmd workspace in the UI (toolbar integration, drag-drop routing, status bar + sidebar support, export/copy actions).
- Extends evidence collection profile with additional registry exports used by the dsregcmd analyzer.
Reviewed changes
Copilot reviewed 24 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/dsregcmd.ts | Adds TypeScript types for dsregcmd facts/derived results, diagnostics, and source context/state. |
| src/stores/ui-store.ts | Adds dsregcmd as a workspace/view and updates chrome status labels. |
| src/stores/dsregcmd-store.ts | New Zustand store for dsregcmd analysis lifecycle, results, and source context. |
| src/lib/dsregcmd-source.ts | Implements source loading (file/folder/clipboard/capture) and connects to dsregcmd store. |
| src/lib/commands.ts | Adds frontend invoke wrappers for dsregcmd commands plus path inspection and text export write. |
| src/hooks/use-drag-drop.ts | Routes drag/drop open behavior through active workspace actions. |
| src/components/layout/Toolbar.tsx | Adds dsregcmd open/paste/capture actions, workspace switch buttons, and refresh integration. |
| src/components/layout/StatusBar.tsx | Extends status bar to show dsregcmd analysis status and quick diagnostics counters. |
| src/components/layout/FileSidebar.tsx | Refactors sidebar into per-workspace panels; adds dsregcmd sidebar summary/actions. |
| src/components/layout/AppShell.tsx | Adds dsregcmd workspace rendering and refactors workspace selection rendering. |
| src/components/dsregcmd/DsregcmdWorkspace.tsx | New dsregcmd workspace UI (cards, issues, grouped facts, timeline, exports, raw input). |
| src-tauri/src/lib.rs | Exposes dsregcmd module and registers new dsregcmd + file ops commands. |
| src-tauri/src/dsregcmd/registry.rs | Loads WHfB-related policy evidence from exported registry artifacts (with tests). |
| src-tauri/src/dsregcmd/parser.rs | Parses dsregcmd /status text into structured facts (with tests). |
| src-tauri/src/dsregcmd/models.rs | Defines dsregcmd facts/derived/result models serialized to the frontend (with tests). |
| src-tauri/src/dsregcmd/mod.rs | Wires parser + rule analysis entrypoint and re-exports dsregcmd model types. |
| src-tauri/src/commands/mod.rs | Registers new dsregcmd command module. |
| src-tauri/src/commands/file_ops.rs | Adds inspect_path_kind + write_text_output_file Tauri commands. |
| src-tauri/src/commands/dsregcmd.rs | New Tauri commands for dsregcmd analyze/capture/load source, including Windows signature verification and bundle staging. |
| src-tauri/capabilities/default.json | Expands app capabilities (notably fs + clipboard read). |
| src-tauri/Cargo.toml | Adds tempfile dev-dependency for new dsregcmd registry tests. |
| src-tauri/Cargo.lock | Locks tempfile dependency. |
| scripts/collection/intune-evidence-profile.json | Adds additional registry export definitions used for policy evidence correlation. |
| DSREGCMD_TROUBLESHOOTING.md | Adds user-facing documentation for the dsregcmd workspace and workflows. |
| .gitignore | Ignores src-tauri/target-test artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original prompt
This section details on the original issue you should resolve
<issue_title>Feature: dsregcmd /status Analyzer</issue_title>
<issue_description>
Summary
Add a
dsregcmd /statusanalyzer to CMTrace Open — a diagnostic tool that parses dsregcmd output, surfaces join state, MDM enrollment, PRT health, certificate validity, and diagnostic issues with actionable remediation guidance. Three input modes: live capture (executedsregcmd.exe /statusas the current user), paste from clipboard, or file picker / drag-drop (.txt). Inspired by intunediag.com (Maksymilian Olowski, closed-source, client-side Next.js). All analysis logic below was reverse-engineered from the production JS bundles.Motivation
dsregcmd /statusis the single most important triage command for Entra ID join, Hybrid Join, PRT, and MDM enrollment issues. The raw output is verbose and requires memorizing which fields matter and what their values mean. CMTrace Open already captures dsregcmd output in its evidence collection pipeline (Invoke-CmtraceEvidenceCollection.ps1→Get-DsRegStatusSummary), but that function only extracts 6 fields for the manifest summary. A full in-app analyzer would close the loop — admins can capture, parse, and diagnose without leaving the tool.Existing Repo Touchpoints
These are the integration points already present in the codebase:
scripts/collection/Invoke-CmtraceEvidenceCollection.ps1Get-DsRegStatusSummaryparses 6 fields (AzureAdJoined,DomainJoined,EnterpriseJoined,TenantId,TenantName,DeviceId) via regex. Saves full output asdsregcmd-status.txtinevidence/command-output/.scripts/collection/intune-evidence-profile.jsondsregcmd-statuscommand entry:dsregcmd.exe /status→dsregcmd-status.txtsrc-tauri/src/commands/file_ops.rswindows_known_log_sources()registers sources underwindows-intuneandwindows-setupfamilies. dsregcmd is not yet registered as a known source.src-tauri/src/commands/intune.rsanalyze_intune_logscommand withIntuneAnalysisResult,IntuneDiagnosticInsight(severity + evidence + fixes),IntuneDiagnosticsConfidence. This is the pattern to follow for the dsregcmd analyzer.src/types/intune.tsIntuneDiagnosticSeverity,IntuneDiagnosticInsight,IntuneAnalysisResult— reusable severity model.src-tauri/capabilities/default.jsonclipboard-manager:allow-write-textbut notclipboard-manager:allow-read-text. No shell plugin.Cargo.tomltauri-plugin-dialog,tauri-plugin-fs,tauri-plugin-clipboard-manager. Notauri-plugin-shell.Input Modes
Mode 1: Live Capture (Windows only)
Execute
dsregcmd.exe /statusas the launching user’s context viastd::process::Commandfrom a Tauri command. This avoids addingtauri-plugin-shellas a dependency — the Rust backend can spawn the process directly and return stdout as aString.User context note:
dsregcmd /statusreturns different output depending on whether it runs as the logged-on user or as SYSTEM. The tool should display the execution context (user vs. SYSTEM, local vs. remote session) and surface theremote-session-systemwarning when `UserCo...🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.