1- import {
2- describePatchloomCompatibility ,
3- describePatchloomSource ,
4- patchloomNeedsUpgrade ,
5- PatchloomStatus ,
6- resolvePatchloomStatus
7- } from "../binary/patchloom" ;
8- import { inspectWorkspaceReadiness , WorkspaceReadiness } from "../workspace/readiness" ;
1+ import { patchloomNeedsUpgrade , resolvePatchloomStatus } from "../binary/patchloom" ;
2+ import { buildStatusDetails , preferredStatusAction } from "../status/details" ;
3+ import { inspectWorkspaceReadiness } from "../workspace/readiness" ;
94
10- export interface SetupAction {
11- readonly title : string ;
12- readonly command : string ;
13- }
5+ export { buildStatusDetails , preferredStatusAction , type SetupAction } from "../status/details" ;
146
157export async function showStatus ( ) : Promise < void > {
168 const vscode = await import ( "vscode" ) ;
@@ -35,68 +27,3 @@ export async function showStatus(): Promise<void> {
3527 await vscode . commands . executeCommand ( action . command ) ;
3628 }
3729}
38-
39- export function buildStatusDetails ( status : PatchloomStatus , workspaceReadiness ?: WorkspaceReadiness ) : string {
40- return [
41- status . ready ? "Patchloom is ready." : "Patchloom is not ready." ,
42- status . message ,
43- `Source: ${ describePatchloomSource ( status . source ) } ` ,
44- status . version ? `Version: ${ status . version } ` : undefined ,
45- status . detectedVersion ? `Detected CLI version: ${ status . detectedVersion } ` : undefined ,
46- status . minimumSupportedVersion ? `Required CLI version: >= ${ status . minimumSupportedVersion } ` : undefined ,
47- status . compatibility ? `CLI compatibility: ${ describePatchloomCompatibility ( status . compatibility ) } ` : undefined ,
48- status . compatibilityMessage && patchloomNeedsUpgrade ( status ) ? status . compatibilityMessage : undefined ,
49- status . binaryPath ? `Path: ${ status . binaryPath } ` : undefined ,
50- status . managedInstall ?. version ? `Managed install version: ${ status . managedInstall . version } ` : undefined ,
51- status . managedInstall ? `Managed install: ${ status . managedInstall . exists ? "available" : "not installed" } ` : undefined ,
52- status . managedInstall ?. target ? `Managed target: ${ status . managedInstall . target . targetTriple } ` : undefined ,
53- status . managedInstall ?. failure ? `Managed install last failure: ${ status . managedInstall . failure . stage } (${ status . managedInstall . failure . reason } )` : undefined ,
54- ...( status . diagnostics ?? [ ] ) ,
55- workspaceReadiness ?. workspaceName ? `Workspace: ${ workspaceReadiness . workspaceName } ` : undefined ,
56- workspaceReadiness ?. hasWorkspace === false
57- ? "Workspace: no folder open"
58- : undefined ,
59- `Environment: ${ workspaceReadiness ?. environmentLabel ?? "Local" } ` ,
60- workspaceReadiness ?. environmentSupport ? `Environment support: ${ workspaceReadiness . environmentSupport } ` : undefined ,
61- workspaceReadiness ?. environmentNote ,
62- workspaceReadiness && workspaceReadiness . workspaceCount > 1 ? `Workspace folders: ${ workspaceReadiness . workspaceCount } ` : undefined ,
63- workspaceReadiness ?. hasAgentsFile === undefined
64- ? undefined
65- : `AGENTS.md: ${ workspaceReadiness . hasAgentsFile ? "present" : "missing" } ` ,
66- workspaceReadiness ?. hasMcpConfig === undefined
67- ? undefined
68- : `MCP config: ${ workspaceReadiness . hasMcpConfig ? "present" : "missing" } `
69- ] . filter ( ( line ) : line is string => Boolean ( line ) ) . join ( "\n" ) ;
70- }
71-
72- export function preferredStatusAction ( status : PatchloomStatus , workspaceReadiness ?: WorkspaceReadiness ) : SetupAction | undefined {
73- if ( ! status . ready ) {
74- return {
75- title : "Open Settings" ,
76- command : "patchloom.openPatchloomSettings"
77- } ;
78- }
79-
80- if ( patchloomNeedsUpgrade ( status ) ) {
81- return {
82- title : "Open Releases" ,
83- command : "patchloom.openPatchloomReleases"
84- } ;
85- }
86-
87- if ( workspaceReadiness ?. hasWorkspace && workspaceReadiness . hasAgentsFile === false ) {
88- return {
89- title : "Initialize Project" ,
90- command : "patchloom.initializeProject"
91- } ;
92- }
93-
94- if ( workspaceReadiness ?. hasMcpConfig === false ) {
95- return {
96- title : "Configure MCP" ,
97- command : "patchloom.configureMcp"
98- } ;
99- }
100-
101- return undefined ;
102- }
0 commit comments