@clossys/launcher 0.1.1

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.
package/src/types.ts ADDED
@@ -0,0 +1,114 @@
1
+ /** Ternary retained by the installed CLI. */
2
+ export type WorkspaceState = "satisfied" | "violated" | "indeterminate";
3
+
4
+ /** Captured stdout/stderr from a host command. */
5
+ export interface CommandResult {
6
+ readonly status: number | null;
7
+ readonly stdout: string;
8
+ readonly stderr: string;
9
+ }
10
+
11
+ /** Filesystem and process ports. Tests inject these; the CLI supplies Node. */
12
+ export interface WorkspaceHost {
13
+ readonly cwd: string;
14
+ readonly env: NodeJS.ProcessEnv;
15
+ readonly isTTY: boolean;
16
+ now(): string;
17
+ exists(path: string): boolean;
18
+ isDirectory(path: string): boolean;
19
+ readText(path: string): string | null;
20
+ writeText(path: string, contents: string): void;
21
+ mkdirp(path: string): void;
22
+ readDir(path: string): string[];
23
+ run(command: string, args: readonly string[], options?: { cwd?: string }): CommandResult;
24
+ prompt(message: string, choices: readonly string[]): string | null;
25
+ }
26
+
27
+ /** On-disk hub marker generated on the consumer hub. Packed template: skeleton/.clossys/workspace.json. */
28
+ export interface HubDocument {
29
+ readonly schemaVersion: 1;
30
+ readonly kind: "account-hub";
31
+ readonly owner: string;
32
+ readonly repository: string;
33
+ }
34
+
35
+ export interface InventoryObservation {
36
+ readonly status: "missing" | "empty" | "populated";
37
+ readonly count: number;
38
+ }
39
+
40
+ /** Read-only pin and inventory report after adopt or resume. Never uninstalls. */
41
+ export interface HubHealthReport {
42
+ readonly marker: "present" | "missing";
43
+ readonly inventory: InventoryObservation;
44
+ readonly advisorPin: {
45
+ readonly dependencies?: string;
46
+ readonly devDependencies?: string;
47
+ readonly live?: string;
48
+ };
49
+ readonly dualPin: boolean;
50
+ readonly extraClossys: readonly string[];
51
+ }
52
+
53
+ export interface CwdObservation {
54
+ readonly absolutePath: string;
55
+ readonly empty: boolean;
56
+ readonly git: boolean;
57
+ readonly githubOwner?: string;
58
+ readonly githubRepository?: string;
59
+ readonly hub?: HubDocument;
60
+ readonly looksLikeFoundry: boolean;
61
+ readonly inventory?: InventoryObservation;
62
+ }
63
+
64
+ export interface WorkspaceObservation {
65
+ readonly cwd: CwdObservation;
66
+ readonly ownerCandidates: readonly string[];
67
+ readonly envOwner?: string;
68
+ readonly remoteDefaultHub?: { readonly owner: string; readonly repository: string };
69
+ readonly advisorVersion?: string;
70
+ readonly ghAvailable: boolean;
71
+ readonly gitAvailable: boolean;
72
+ }
73
+
74
+ export interface WorkspacePlanCreate {
75
+ readonly action: "create";
76
+ readonly owner: string;
77
+ readonly repository: string;
78
+ readonly directory: string;
79
+ readonly advisorVersion: string;
80
+ }
81
+
82
+ export interface WorkspacePlanResume {
83
+ readonly action: "resume";
84
+ readonly owner: string;
85
+ readonly repository: string;
86
+ readonly directory: string;
87
+ readonly clone: boolean;
88
+ }
89
+
90
+ export interface WorkspacePlanAdopt {
91
+ readonly action: "adopt";
92
+ readonly owner: string;
93
+ readonly repository: string;
94
+ readonly directory: string;
95
+ readonly advisorVersion: string;
96
+ /** Absolute path of a populated inventory document to copy. Absent when cwd already has one. */
97
+ readonly inventorySource?: string;
98
+ }
99
+
100
+ export type WorkspacePlan = WorkspacePlanCreate | WorkspacePlanResume | WorkspacePlanAdopt;
101
+
102
+ export interface WorkspaceRefusal {
103
+ readonly action: "refuse";
104
+ readonly state: WorkspaceState;
105
+ readonly message: string;
106
+ }
107
+
108
+ export type WorkspaceDecision = WorkspacePlan | WorkspaceRefusal;
109
+
110
+ export interface WorkspaceApplyResult {
111
+ readonly state: "satisfied";
112
+ readonly message: string;
113
+ readonly health: HubHealthReport;
114
+ }