@contextecf/guardian-cli 0.1.0
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/README.md +218 -0
- package/dist/packages/guardian-cli/src/bin.d.ts +2 -0
- package/dist/packages/guardian-cli/src/bin.js +27021 -0
- package/dist/packages/guardian-cli/src/index.d.ts +1 -0
- package/dist/packages/guardian-cli/src/index.js +22138 -0
- package/dist/packages/guardian-cli/src/runtime.d.ts +523 -0
- package/package.json +60 -0
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import type { Writable } from 'node:stream';
|
|
2
|
+
import { type PolicyPackMarketplaceManifest } from '@contextecf/personal-fabric-contracts';
|
|
3
|
+
import { SQLitePersonalFabricStore, type PersonalFabricDataImportResult, type PersonalFabricMutableDataDeleteResult, type SQLitePersonalFabricBackupResult } from '@contextecf/personal-fabric-store';
|
|
4
|
+
export declare const GUARDIAN_CLI_VERSION = "0.1.0";
|
|
5
|
+
export declare const GUARDIAN_PROFILE_SCHEMA_VERSION = "contextecf/project-guardian-profile/v1";
|
|
6
|
+
export declare const GUARDIAN_NPM_PACKAGE_NAME = "@contextecf/guardian-cli";
|
|
7
|
+
export declare const GUARDIAN_GLOBAL_INSTALL_COMMAND = "npm install -g @contextecf/guardian-cli";
|
|
8
|
+
export declare const GUARDIAN_NPX_SETUP_COMMAND = "npx @contextecf/guardian-cli@latest setup";
|
|
9
|
+
export declare const GUARDIAN_FIRST_RUN_COMMAND = "guardian setup";
|
|
10
|
+
export declare const GUARDIAN_OPEN_CONTROL_TOWER_COMMAND = "guardian launch";
|
|
11
|
+
export declare const GUARDIAN_CONTROL_TOWER_URL_ENV = "GUARDIAN_CONTROL_TOWER_URL";
|
|
12
|
+
export declare const GUARDIAN_DEFAULT_CONTROL_TOWER_URL = "http://127.0.0.1:4317/control-tower";
|
|
13
|
+
export declare const GUARDIAN_LOCAL_DATA_ENCRYPTION_KEY_ENV = "GUARDIAN_LOCAL_DATA_ENCRYPTION_KEY";
|
|
14
|
+
export declare const GUARDIAN_LOCAL_DATA_ENCRYPTION_KEY_ID_ENV = "GUARDIAN_LOCAL_DATA_ENCRYPTION_KEY_ID";
|
|
15
|
+
export declare const GUARDIAN_SQLITE_PAGE_ENCRYPTION_KEY_ENV = "GUARDIAN_SQLITE_PAGE_ENCRYPTION_KEY";
|
|
16
|
+
export declare const GUARDIAN_SQLITE_PAGE_ENCRYPTION_KEY_ID_ENV = "GUARDIAN_SQLITE_PAGE_ENCRYPTION_KEY_ID";
|
|
17
|
+
export declare const GUARDIAN_DESKTOP_ADAPTER_SIMULATE_OPEN_ENV = "GUARDIAN_DESKTOP_ADAPTER_SIMULATE_OPEN";
|
|
18
|
+
export declare const GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_ID = "guardian_desktop_url_open";
|
|
19
|
+
export declare const GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_VERSION = "1.0.0";
|
|
20
|
+
export declare const GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_PROOF_SCHEMA_VERSION = "contextecf/project-guardian-desktop-url-open-adapter-proof/v1";
|
|
21
|
+
export declare const GUARDIAN_SERVICE_PROOF_SCHEMA_VERSION = "contextecf/project-guardian-service-supervision/v1";
|
|
22
|
+
export declare const GUARDIAN_OS_KEY_STORAGE_PROOF_SCHEMA_VERSION = "contextecf/project-guardian-os-key-storage/v1";
|
|
23
|
+
export declare const GUARDIAN_WINDOWS_NATIVE_HOST_REGISTRY_PROOF_SCHEMA_VERSION = "contextecf/project-guardian-windows-native-host-registry/v1";
|
|
24
|
+
export interface GuardianCliOptions {
|
|
25
|
+
env?: NodeJS.ProcessEnv;
|
|
26
|
+
platform?: NodeJS.Platform;
|
|
27
|
+
now?: () => Date;
|
|
28
|
+
stdout?: Pick<Writable, 'write'>;
|
|
29
|
+
stderr?: Pick<Writable, 'write'>;
|
|
30
|
+
openUrl?: (url: string) => Promise<void>;
|
|
31
|
+
startMcpServer?: () => Promise<void>;
|
|
32
|
+
startDetachedDaemon?: (request: GuardianDetachedDaemonStartRequest) => Promise<GuardianDetachedDaemonStartResult>;
|
|
33
|
+
healthDaemon?: (request: GuardianDaemonHealthRequest) => Promise<GuardianDaemonHealthResult>;
|
|
34
|
+
stopDaemon?: (request: GuardianDaemonStopRequest) => Promise<GuardianDaemonStopResult>;
|
|
35
|
+
startDaemonServer?: (request: GuardianDaemonServeRequest) => Promise<GuardianDaemonServerHandle>;
|
|
36
|
+
executeDesktopAction?: (request: GuardianDesktopActionExecutionRequest) => Promise<GuardianDesktopActionExecutionResult>;
|
|
37
|
+
executeOsKeyStorageCommand?: (request: GuardianOsKeyStorageCommandRequest) => Promise<GuardianOsKeyStorageCommandResult>;
|
|
38
|
+
executeWindowsRegistryCommand?: (request: GuardianWindowsRegistryCommandRequest) => Promise<GuardianWindowsRegistryCommandResult>;
|
|
39
|
+
}
|
|
40
|
+
export interface GuardianDaemonServeRequest {
|
|
41
|
+
home: string;
|
|
42
|
+
host: string;
|
|
43
|
+
port: number;
|
|
44
|
+
}
|
|
45
|
+
export interface GuardianDetachedDaemonStartRequest extends GuardianDaemonServeRequest {
|
|
46
|
+
}
|
|
47
|
+
export interface GuardianDetachedDaemonStartResult {
|
|
48
|
+
url: string;
|
|
49
|
+
pid?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface GuardianDaemonStopRequest {
|
|
52
|
+
url: string;
|
|
53
|
+
token: string;
|
|
54
|
+
}
|
|
55
|
+
export interface GuardianDaemonStopResult {
|
|
56
|
+
ok: boolean;
|
|
57
|
+
statusCode?: number;
|
|
58
|
+
error?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface GuardianDaemonHealthRequest {
|
|
61
|
+
url: string;
|
|
62
|
+
token: string;
|
|
63
|
+
}
|
|
64
|
+
export interface GuardianDaemonHealthResult {
|
|
65
|
+
ok: boolean;
|
|
66
|
+
reachable: boolean;
|
|
67
|
+
statusCode?: number;
|
|
68
|
+
service?: string;
|
|
69
|
+
rawContentPersistence?: boolean;
|
|
70
|
+
error?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface GuardianDesktopActionExecutionRequest {
|
|
73
|
+
adapter: typeof GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_ID;
|
|
74
|
+
adapterVersion: typeof GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_VERSION;
|
|
75
|
+
actionId: string;
|
|
76
|
+
appId: string;
|
|
77
|
+
actionType: 'open';
|
|
78
|
+
targetRef: string;
|
|
79
|
+
targetRefHash: `sha256:${string}`;
|
|
80
|
+
planId: string;
|
|
81
|
+
planHash: `sha256:${string}`;
|
|
82
|
+
}
|
|
83
|
+
export interface GuardianDesktopActionExecutionResult {
|
|
84
|
+
executed: boolean;
|
|
85
|
+
adapter: typeof GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_ID;
|
|
86
|
+
adapterVersion: typeof GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_VERSION;
|
|
87
|
+
opened: boolean;
|
|
88
|
+
simulated?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface GuardianProductionGateEvidenceStatus {
|
|
91
|
+
schemaVersion: string;
|
|
92
|
+
releaseClaim: string;
|
|
93
|
+
status: 'production_allowed' | 'production_blocked';
|
|
94
|
+
productionClaimAllowed: boolean;
|
|
95
|
+
validatorCommand?: string;
|
|
96
|
+
matrixPath?: string;
|
|
97
|
+
evidencePath?: string;
|
|
98
|
+
matrixSha256?: string;
|
|
99
|
+
provenGateCount?: number;
|
|
100
|
+
notProvenGateCount?: number;
|
|
101
|
+
notProvenGates?: Array<{
|
|
102
|
+
id: string;
|
|
103
|
+
label: string;
|
|
104
|
+
owner?: string;
|
|
105
|
+
runtimeBoundary?: string;
|
|
106
|
+
releaseBoundary?: string;
|
|
107
|
+
evidencePacket?: string;
|
|
108
|
+
evidenceRequiredFields?: string[];
|
|
109
|
+
closesWhen?: string[];
|
|
110
|
+
}>;
|
|
111
|
+
}
|
|
112
|
+
export interface GuardianReleaseEvidenceStatus {
|
|
113
|
+
installedFromProtectedArtifact: boolean;
|
|
114
|
+
status: 'missing' | 'verified' | 'invalid';
|
|
115
|
+
evidencePath: string;
|
|
116
|
+
schemaVersion?: string;
|
|
117
|
+
generatedAt?: string;
|
|
118
|
+
gitCommit?: string;
|
|
119
|
+
packageName?: string;
|
|
120
|
+
packageVersion?: string;
|
|
121
|
+
checksumCount?: number;
|
|
122
|
+
boundaries?: {
|
|
123
|
+
expectedFileCount?: number;
|
|
124
|
+
sourceFilesIncluded?: boolean;
|
|
125
|
+
sourceMapsIncluded?: boolean;
|
|
126
|
+
unpublishedWorkspaceRuntimeImports?: boolean;
|
|
127
|
+
};
|
|
128
|
+
publishDryRun?: {
|
|
129
|
+
enabled: boolean;
|
|
130
|
+
status: 'passed' | 'skipped' | 'not_recorded';
|
|
131
|
+
command?: string;
|
|
132
|
+
packageName?: string;
|
|
133
|
+
packageVersion?: string;
|
|
134
|
+
filename?: string;
|
|
135
|
+
};
|
|
136
|
+
productionGateEvidence?: GuardianProductionGateEvidenceStatus;
|
|
137
|
+
error?: string;
|
|
138
|
+
}
|
|
139
|
+
declare const PROMPT_COACH_MODES: readonly ["off", "quiet", "balanced", "hands_on"];
|
|
140
|
+
export type GuardianPromptCoachMode = (typeof PROMPT_COACH_MODES)[number];
|
|
141
|
+
export declare const GUARDIAN_POSTURE_PROFILE_IDS: readonly ["calm", "balanced", "guided", "high_assurance", "autopilot_lite"];
|
|
142
|
+
export type GuardianPostureProfileId = (typeof GUARDIAN_POSTURE_PROFILE_IDS)[number];
|
|
143
|
+
export interface GuardianPostureProfileDefinition {
|
|
144
|
+
id: GuardianPostureProfileId;
|
|
145
|
+
displayName: string;
|
|
146
|
+
summary: string;
|
|
147
|
+
coachCadence: 'minimal' | 'standard' | 'active';
|
|
148
|
+
contextAppetite: 'low' | 'standard' | 'rich';
|
|
149
|
+
confirmationLevel: 'strict' | 'standard' | 'high_assurance';
|
|
150
|
+
localActionTrustCeiling: 'confirm' | 'restricted_autopilot_lite';
|
|
151
|
+
learningDefault: 'off' | 'suggest_opt_in';
|
|
152
|
+
receiptDetail: 'metadata_only' | 'metadata_plus_policy_detail';
|
|
153
|
+
}
|
|
154
|
+
export declare const GUARDIAN_POSTURE_PROFILE_CATALOG: readonly GuardianPostureProfileDefinition[];
|
|
155
|
+
export declare const GUARDIAN_POLICY_PACK_MARKETPLACE_CATALOG: readonly PolicyPackMarketplaceManifest[];
|
|
156
|
+
export declare const GUARDIAN_PROVIDER_IDS: readonly ["chatgpt", "claude", "gemini", "perplexity", "cursor", "windsurf", "openrouter", "local_model", "unknown"];
|
|
157
|
+
export type GuardianProviderId = (typeof GUARDIAN_PROVIDER_IDS)[number];
|
|
158
|
+
export declare const GUARDIAN_SOURCE_TYPES: readonly ["files", "folders", "calendar", "email", "notes", "tasks", "contacts", "downloads", "clipboard", "browser", "cloud_drives"];
|
|
159
|
+
export type GuardianSourceTypeId = (typeof GUARDIAN_SOURCE_TYPES)[number];
|
|
160
|
+
export interface GuardianDaemonServerHandle {
|
|
161
|
+
url: string;
|
|
162
|
+
close: () => Promise<void>;
|
|
163
|
+
closed: Promise<void>;
|
|
164
|
+
}
|
|
165
|
+
export type GuardianServiceSupervisorPlatform = 'launchd' | 'systemd' | 'windows-task-scheduler';
|
|
166
|
+
export type GuardianOsKeyStoragePlatform = 'macos-keychain' | 'windows-dpapi' | 'linux-secret-service';
|
|
167
|
+
export interface GuardianWindowsRegistryCommandRequest {
|
|
168
|
+
action: 'add' | 'delete';
|
|
169
|
+
executable: 'reg';
|
|
170
|
+
args: string[];
|
|
171
|
+
}
|
|
172
|
+
export interface GuardianWindowsRegistryCommandResult {
|
|
173
|
+
exitCode: number;
|
|
174
|
+
stdout: string;
|
|
175
|
+
stderr: string;
|
|
176
|
+
}
|
|
177
|
+
export interface GuardianServiceSupervisionProof {
|
|
178
|
+
schema_version: typeof GUARDIAN_SERVICE_PROOF_SCHEMA_VERSION;
|
|
179
|
+
installed_at: string;
|
|
180
|
+
platform: GuardianServiceSupervisorPlatform;
|
|
181
|
+
serviceName: string;
|
|
182
|
+
profileDir: string;
|
|
183
|
+
daemonUrl: string;
|
|
184
|
+
controlTowerUrl: string;
|
|
185
|
+
artifactPath: string;
|
|
186
|
+
artifactSha256: `sha256:${string}`;
|
|
187
|
+
registrationMode: 'artifact_only';
|
|
188
|
+
osRegistered: false;
|
|
189
|
+
command: string;
|
|
190
|
+
args: string[];
|
|
191
|
+
startCommand: string;
|
|
192
|
+
stopCommand: string;
|
|
193
|
+
statusCommand: string;
|
|
194
|
+
uninstallCommand: string;
|
|
195
|
+
tokenPrinted: false;
|
|
196
|
+
rawContentIncluded: false;
|
|
197
|
+
}
|
|
198
|
+
export interface GuardianServiceSupervisionStatus {
|
|
199
|
+
schema_version: typeof GUARDIAN_SERVICE_PROOF_SCHEMA_VERSION;
|
|
200
|
+
installed: boolean;
|
|
201
|
+
status: 'missing' | 'verified' | 'invalid';
|
|
202
|
+
platform?: GuardianServiceSupervisorPlatform;
|
|
203
|
+
serviceName?: string;
|
|
204
|
+
profileDir: string;
|
|
205
|
+
daemonUrl?: string;
|
|
206
|
+
controlTowerUrl?: string;
|
|
207
|
+
artifactPath: string;
|
|
208
|
+
proofPath: string;
|
|
209
|
+
artifactSha256?: `sha256:${string}`;
|
|
210
|
+
registrationMode?: 'artifact_only';
|
|
211
|
+
osRegistered: false;
|
|
212
|
+
tokenPrinted: false;
|
|
213
|
+
rawContentIncluded: false;
|
|
214
|
+
error?: string;
|
|
215
|
+
nextCommands: string[];
|
|
216
|
+
}
|
|
217
|
+
export interface GuardianOsKeyStorageCommandRequest {
|
|
218
|
+
platform: GuardianOsKeyStoragePlatform;
|
|
219
|
+
action: 'store' | 'probe' | 'delete';
|
|
220
|
+
command: string;
|
|
221
|
+
args: string[];
|
|
222
|
+
input?: string;
|
|
223
|
+
redactedCommand: string;
|
|
224
|
+
}
|
|
225
|
+
export interface GuardianOsKeyStorageCommandResult {
|
|
226
|
+
ok: boolean;
|
|
227
|
+
statusCode?: number;
|
|
228
|
+
stdout?: string;
|
|
229
|
+
stderr?: string;
|
|
230
|
+
}
|
|
231
|
+
export interface GuardianOsKeyStorageProof {
|
|
232
|
+
schema_version: typeof GUARDIAN_OS_KEY_STORAGE_PROOF_SCHEMA_VERSION;
|
|
233
|
+
installed_at: string;
|
|
234
|
+
platform: GuardianOsKeyStoragePlatform;
|
|
235
|
+
profileDir: string;
|
|
236
|
+
keyId: string;
|
|
237
|
+
keySha256: `sha256:${string}`;
|
|
238
|
+
credentialService: string;
|
|
239
|
+
credentialAccount: string;
|
|
240
|
+
proofPath: string;
|
|
241
|
+
storageCommand: string;
|
|
242
|
+
probeCommand: string;
|
|
243
|
+
deleteCommand: string;
|
|
244
|
+
osBackedKeyStorage: 'verified';
|
|
245
|
+
secretInputVia: 'stdin';
|
|
246
|
+
secretInCommandArgs: false;
|
|
247
|
+
commandExecuted: true;
|
|
248
|
+
tokenPrinted: false;
|
|
249
|
+
keyPrinted: false;
|
|
250
|
+
rawContentIncluded: false;
|
|
251
|
+
}
|
|
252
|
+
export interface GuardianOsKeyStorageStatus {
|
|
253
|
+
schema_version: typeof GUARDIAN_OS_KEY_STORAGE_PROOF_SCHEMA_VERSION;
|
|
254
|
+
installed: boolean;
|
|
255
|
+
status: 'missing' | 'verified' | 'invalid';
|
|
256
|
+
platform?: GuardianOsKeyStoragePlatform;
|
|
257
|
+
profileDir: string;
|
|
258
|
+
keyId?: string;
|
|
259
|
+
credentialService?: string;
|
|
260
|
+
credentialAccount?: string;
|
|
261
|
+
proofPath: string;
|
|
262
|
+
osBackedKeyStorage: 'missing' | 'verified' | 'invalid';
|
|
263
|
+
secretInputVia?: 'stdin';
|
|
264
|
+
secretInCommandArgs: false;
|
|
265
|
+
tokenPrinted: false;
|
|
266
|
+
keyPrinted: false;
|
|
267
|
+
rawContentIncluded: false;
|
|
268
|
+
error?: string;
|
|
269
|
+
nextCommands: string[];
|
|
270
|
+
}
|
|
271
|
+
export interface GuardianProfile {
|
|
272
|
+
schema_version: typeof GUARDIAN_PROFILE_SCHEMA_VERSION;
|
|
273
|
+
installed_at: string;
|
|
274
|
+
profile_dir: string;
|
|
275
|
+
runtime: {
|
|
276
|
+
daemon_status: 'not_started_mvp' | 'start_requested';
|
|
277
|
+
loopback_auth: 'token_file';
|
|
278
|
+
mcp_stdio_available: boolean;
|
|
279
|
+
};
|
|
280
|
+
control_tower: {
|
|
281
|
+
url: string;
|
|
282
|
+
source: 'default_loopback' | 'env_or_flag';
|
|
283
|
+
};
|
|
284
|
+
privacy: {
|
|
285
|
+
privacy_mode_enabled: true;
|
|
286
|
+
raw_content_capture_enabled: false;
|
|
287
|
+
cloud_sync_enabled: false;
|
|
288
|
+
local_app_autopilot_enabled: false;
|
|
289
|
+
};
|
|
290
|
+
policy_packs: {
|
|
291
|
+
active: string[];
|
|
292
|
+
available: string[];
|
|
293
|
+
};
|
|
294
|
+
posture_profile: {
|
|
295
|
+
selected: GuardianPostureProfileId;
|
|
296
|
+
available: GuardianPostureProfileId[];
|
|
297
|
+
managed: boolean;
|
|
298
|
+
managed_baseline_id?: string;
|
|
299
|
+
updated_at?: string;
|
|
300
|
+
};
|
|
301
|
+
permissions: {
|
|
302
|
+
revoked_app_ids: string[];
|
|
303
|
+
revoked_provider_ids: GuardianProviderId[];
|
|
304
|
+
revoked_source_types: GuardianSourceTypeId[];
|
|
305
|
+
};
|
|
306
|
+
prompt_coach_mode: GuardianPromptCoachMode;
|
|
307
|
+
learning_graph: {
|
|
308
|
+
enabled: boolean;
|
|
309
|
+
prompt_coach_interruption_budget: {
|
|
310
|
+
daily_soft_card_limit: number;
|
|
311
|
+
repeated_dismissal_quieting: boolean;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
receipts: {
|
|
315
|
+
raw_content_included: false;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
export interface DoctorCheck {
|
|
319
|
+
id: string;
|
|
320
|
+
label: string;
|
|
321
|
+
status: 'pass' | 'warn' | 'fail';
|
|
322
|
+
detail: string;
|
|
323
|
+
}
|
|
324
|
+
export interface GuardianNotProvenProductionGate {
|
|
325
|
+
id: string;
|
|
326
|
+
label: string;
|
|
327
|
+
boundary: string;
|
|
328
|
+
owner: string;
|
|
329
|
+
runtimeBoundary: string;
|
|
330
|
+
releaseBoundary: string;
|
|
331
|
+
evidencePacket: string;
|
|
332
|
+
evidenceRequiredFields: readonly string[];
|
|
333
|
+
closesWhen: readonly string[];
|
|
334
|
+
}
|
|
335
|
+
export declare const GUARDIAN_NOT_PROVEN_PRODUCTION_GATES: readonly GuardianNotProvenProductionGate[];
|
|
336
|
+
export interface GuardianDoctorStatus {
|
|
337
|
+
schema_version: 'contextecf/project-guardian-doctor/v1';
|
|
338
|
+
cli_version: typeof GUARDIAN_CLI_VERSION;
|
|
339
|
+
profile_dir: string;
|
|
340
|
+
overall: 'pass' | 'warn' | 'fail';
|
|
341
|
+
checkCounts: {
|
|
342
|
+
pass: number;
|
|
343
|
+
warn: number;
|
|
344
|
+
fail: number;
|
|
345
|
+
};
|
|
346
|
+
checks: DoctorCheck[];
|
|
347
|
+
notProvenProductionGates: readonly GuardianNotProvenProductionGate[];
|
|
348
|
+
tokenPrinted: false;
|
|
349
|
+
rawContentIncluded: false;
|
|
350
|
+
}
|
|
351
|
+
export interface GuardianProductionReadinessStatus {
|
|
352
|
+
schema_version: 'contextecf/project-guardian-production-readiness/v1';
|
|
353
|
+
cli_version: typeof GUARDIAN_CLI_VERSION;
|
|
354
|
+
profile_dir: string;
|
|
355
|
+
installed: boolean;
|
|
356
|
+
doctorOverall: GuardianDoctorStatus['overall'];
|
|
357
|
+
npmPreview: {
|
|
358
|
+
status: 'ready' | 'not_ready';
|
|
359
|
+
reason: string;
|
|
360
|
+
protectedEvidenceStatus: GuardianReleaseEvidenceStatus['status'];
|
|
361
|
+
publishDryRunStatus: NonNullable<GuardianReleaseEvidenceStatus['publishDryRun']>['status'];
|
|
362
|
+
publishCommand: string | null;
|
|
363
|
+
};
|
|
364
|
+
fullProduction: {
|
|
365
|
+
status: 'ready' | 'blocked';
|
|
366
|
+
reason: string;
|
|
367
|
+
blockedGateCount: number;
|
|
368
|
+
blockedGates: readonly GuardianNotProvenProductionGate[];
|
|
369
|
+
productionGateEvidenceStatus: GuardianProductionGateEvidenceStatus['status'] | 'not_recorded';
|
|
370
|
+
productionGateEvidencePath?: string;
|
|
371
|
+
};
|
|
372
|
+
tokenPrinted: false;
|
|
373
|
+
rawContentIncluded: false;
|
|
374
|
+
}
|
|
375
|
+
export type GuardianPolicyPackAction = 'enable' | 'disable';
|
|
376
|
+
export interface GuardianPolicyPackControlResult {
|
|
377
|
+
success: true;
|
|
378
|
+
action: GuardianPolicyPackAction;
|
|
379
|
+
policyPackId: string;
|
|
380
|
+
active: string[];
|
|
381
|
+
available: string[];
|
|
382
|
+
userManaged: true;
|
|
383
|
+
}
|
|
384
|
+
export interface GuardianPreferenceControlResult {
|
|
385
|
+
success: true;
|
|
386
|
+
preference: 'prompt_coach_mode' | 'learning_graph';
|
|
387
|
+
value: string;
|
|
388
|
+
promptCoachMode: GuardianPromptCoachMode;
|
|
389
|
+
learningGraphEnabled: boolean;
|
|
390
|
+
userManaged: true;
|
|
391
|
+
}
|
|
392
|
+
export interface GuardianPostureProfileControlResult {
|
|
393
|
+
success: true;
|
|
394
|
+
selected: GuardianPostureProfileId;
|
|
395
|
+
available: GuardianPostureProfileId[];
|
|
396
|
+
profile: GuardianPostureProfileDefinition;
|
|
397
|
+
managed: boolean;
|
|
398
|
+
managedBaselineId?: string;
|
|
399
|
+
userManaged: true;
|
|
400
|
+
}
|
|
401
|
+
export interface GuardianPrivacyControlResult {
|
|
402
|
+
success: true;
|
|
403
|
+
privacyModeEnabled: true;
|
|
404
|
+
rawContentCaptureEnabled: false;
|
|
405
|
+
cloudSyncEnabled: false;
|
|
406
|
+
localAppAutopilotEnabled: false;
|
|
407
|
+
encryptedAtRest: false;
|
|
408
|
+
encryptionStatus: 'not_proven';
|
|
409
|
+
userManaged: true;
|
|
410
|
+
}
|
|
411
|
+
export type GuardianAppPermissionAction = 'revoke' | 'allow';
|
|
412
|
+
export interface GuardianAppPermissionControlResult {
|
|
413
|
+
success: true;
|
|
414
|
+
action: GuardianAppPermissionAction;
|
|
415
|
+
scope: 'app' | 'provider' | 'source';
|
|
416
|
+
targetId: string;
|
|
417
|
+
appId: string;
|
|
418
|
+
revokedAppIds: string[];
|
|
419
|
+
revokedProviderIds: GuardianProviderId[];
|
|
420
|
+
revokedSourceTypes: GuardianSourceTypeId[];
|
|
421
|
+
userManaged: true;
|
|
422
|
+
}
|
|
423
|
+
export type GuardianDataLifecycleAction = 'export' | 'backup' | 'restore' | 'delete';
|
|
424
|
+
export type GuardianDataLifecycleResult = {
|
|
425
|
+
success: true;
|
|
426
|
+
action: 'export';
|
|
427
|
+
profileDir: string;
|
|
428
|
+
outputPath: string;
|
|
429
|
+
exportHash: string;
|
|
430
|
+
contextPackageHash?: never;
|
|
431
|
+
rawContentIncluded: false;
|
|
432
|
+
tokenPrinted: false;
|
|
433
|
+
} | ({
|
|
434
|
+
success: true;
|
|
435
|
+
action: 'backup';
|
|
436
|
+
profileDir: string;
|
|
437
|
+
rawContentIncluded: false;
|
|
438
|
+
tokenPrinted: false;
|
|
439
|
+
} & SQLitePersonalFabricBackupResult) | ({
|
|
440
|
+
success: true;
|
|
441
|
+
action: 'restore';
|
|
442
|
+
profileDir: string;
|
|
443
|
+
inputPath: string;
|
|
444
|
+
rawContentIncluded: false;
|
|
445
|
+
tokenPrinted: false;
|
|
446
|
+
} & PersonalFabricDataImportResult) | ({
|
|
447
|
+
success: true;
|
|
448
|
+
action: 'delete';
|
|
449
|
+
profileDir: string;
|
|
450
|
+
rawContentIncluded: false;
|
|
451
|
+
tokenPrinted: false;
|
|
452
|
+
} & PersonalFabricMutableDataDeleteResult);
|
|
453
|
+
interface GuardianDesktopExecutionActionRequest {
|
|
454
|
+
action_id: string;
|
|
455
|
+
app_id: string;
|
|
456
|
+
action_type: string;
|
|
457
|
+
target_ref: string;
|
|
458
|
+
payload_hash: `sha256:${string}`;
|
|
459
|
+
}
|
|
460
|
+
interface GuardianDesktopExecutionPlan {
|
|
461
|
+
plan_id: string;
|
|
462
|
+
action_id: string;
|
|
463
|
+
action_type: string;
|
|
464
|
+
confirmation_receipt_id: string;
|
|
465
|
+
action_payload_hash: `sha256:${string}`;
|
|
466
|
+
execution_surface: string;
|
|
467
|
+
action_executable_by_mcp: boolean;
|
|
468
|
+
requires_desktop_confirmation: boolean;
|
|
469
|
+
plan_hash: `sha256:${string}`;
|
|
470
|
+
expires_at: string;
|
|
471
|
+
}
|
|
472
|
+
interface GuardianDesktopExecutionInput {
|
|
473
|
+
actionRequest: GuardianDesktopExecutionActionRequest;
|
|
474
|
+
executionPlan: GuardianDesktopExecutionPlan;
|
|
475
|
+
}
|
|
476
|
+
export declare function runGuardianCli(argv: readonly string[], options?: GuardianCliOptions): Promise<number>;
|
|
477
|
+
export declare function resolveGuardianHome(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
478
|
+
export declare function installGuardian(flags: ReadonlyMap<string, string | boolean>, options?: GuardianCliOptions): Promise<string>;
|
|
479
|
+
export declare function doctorGuardian(flags: ReadonlyMap<string, string | boolean>, options?: GuardianCliOptions): Promise<string>;
|
|
480
|
+
export declare function buildGuardianProductionReadinessStatus(home: string, profile: GuardianProfile | undefined, env?: NodeJS.ProcessEnv | undefined): Promise<GuardianProductionReadinessStatus>;
|
|
481
|
+
export declare function requestGuardianDaemonStop(request: GuardianDaemonStopRequest): Promise<GuardianDaemonStopResult>;
|
|
482
|
+
export declare function requestGuardianDaemonHealth(request: GuardianDaemonHealthRequest): Promise<GuardianDaemonHealthResult>;
|
|
483
|
+
export declare function startGuardianDetachedDaemonProcess(request: GuardianDetachedDaemonStartRequest, entrypoint: string, env?: NodeJS.ProcessEnv): Promise<GuardianDetachedDaemonStartResult>;
|
|
484
|
+
export declare function buildGuardianServiceSupervisionStatus(home: string): Promise<GuardianServiceSupervisionStatus>;
|
|
485
|
+
export declare function buildGuardianOsKeyStorageStatus(home: string): Promise<GuardianOsKeyStorageStatus>;
|
|
486
|
+
export declare function updateGuardianPolicyPackSelection(home: string, profile: GuardianProfile, action: GuardianPolicyPackAction, policyPackId: string): Promise<GuardianPolicyPackControlResult>;
|
|
487
|
+
export declare function updateGuardianPromptCoachMode(home: string, profile: GuardianProfile, mode: GuardianPromptCoachMode): Promise<GuardianPreferenceControlResult>;
|
|
488
|
+
export declare function updateGuardianLearningGraph(home: string, profile: GuardianProfile, enabled: boolean): Promise<GuardianPreferenceControlResult>;
|
|
489
|
+
export declare function updateGuardianPostureProfileSelection(home: string, profile: GuardianProfile, selected: GuardianPostureProfileId): Promise<GuardianPostureProfileControlResult>;
|
|
490
|
+
export declare function updateGuardianPrivacyMode(home: string, profile: GuardianProfile): Promise<GuardianPrivacyControlResult>;
|
|
491
|
+
export declare function updateGuardianAppPermission(home: string, profile: GuardianProfile, action: GuardianAppPermissionAction, appId: string): Promise<GuardianAppPermissionControlResult>;
|
|
492
|
+
export declare function updateGuardianProviderPermission(home: string, profile: GuardianProfile, action: GuardianAppPermissionAction, providerId: GuardianProviderId): Promise<GuardianAppPermissionControlResult>;
|
|
493
|
+
export declare function updateGuardianSourcePermission(home: string, profile: GuardianProfile, action: GuardianAppPermissionAction, sourceType: GuardianSourceTypeId): Promise<GuardianAppPermissionControlResult>;
|
|
494
|
+
export declare function normalizeGuardianProfile(profile: GuardianProfile): GuardianProfile;
|
|
495
|
+
export declare function exportGuardianDataSnapshot(home: string, outputPath: string, env?: NodeJS.ProcessEnv | undefined): Promise<GuardianDataLifecycleResult>;
|
|
496
|
+
export declare function backupGuardianDataStore(home: string, outputPath: string, env?: NodeJS.ProcessEnv | undefined): Promise<GuardianDataLifecycleResult>;
|
|
497
|
+
export declare function restoreGuardianDataSnapshot(home: string, inputPath: string, env?: NodeJS.ProcessEnv | undefined): Promise<GuardianDataLifecycleResult>;
|
|
498
|
+
export declare function deleteGuardianMutableData(home: string, env?: NodeJS.ProcessEnv | undefined): Promise<GuardianDataLifecycleResult>;
|
|
499
|
+
export declare function executeGuardianDesktopActionPlan(home: string, profile: GuardianProfile, input: GuardianDesktopExecutionInput, options?: GuardianCliOptions): Promise<{
|
|
500
|
+
schema_version: 'contextecf/project-guardian-desktop-execution/v1';
|
|
501
|
+
success: true;
|
|
502
|
+
actionExecuted: true;
|
|
503
|
+
actionAuthorized: true;
|
|
504
|
+
executionMode: 'desktop_adapter_executed';
|
|
505
|
+
adapter: typeof GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_ID;
|
|
506
|
+
adapterVersion: typeof GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_VERSION;
|
|
507
|
+
adapterProofSchemaVersion: typeof GUARDIAN_DESKTOP_URL_OPEN_ADAPTER_PROOF_SCHEMA_VERSION;
|
|
508
|
+
adapterCapability: 'browser_url_open';
|
|
509
|
+
appId: string;
|
|
510
|
+
actionType: 'open';
|
|
511
|
+
actionId: string;
|
|
512
|
+
planId: string;
|
|
513
|
+
planHash: `sha256:${string}`;
|
|
514
|
+
targetRefHash: `sha256:${string}`;
|
|
515
|
+
receiptId: string;
|
|
516
|
+
receiptHash: string;
|
|
517
|
+
rawContentIncluded: false;
|
|
518
|
+
tokenPrinted: false;
|
|
519
|
+
eventChain: Awaited<ReturnType<SQLitePersonalFabricStore['verifyEventChain']>>;
|
|
520
|
+
}>;
|
|
521
|
+
export declare function buildGuardianReleaseEvidenceStatus(home: string): Promise<GuardianReleaseEvidenceStatus>;
|
|
522
|
+
export declare function buildGuardianDoctorStatus(home: string, profile: GuardianProfile | undefined, env?: NodeJS.ProcessEnv | undefined): Promise<GuardianDoctorStatus>;
|
|
523
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contextecf/guardian-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Project Guardian local-first Personal Context Fabric CLI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"main": "dist/packages/guardian-cli/src/index.js",
|
|
8
|
+
"types": "dist/packages/guardian-cli/src/index.d.ts",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/packages/guardian-cli/src/bin.d.ts",
|
|
14
|
+
"dist/packages/guardian-cli/src/index.d.ts",
|
|
15
|
+
"dist/packages/guardian-cli/src/runtime.d.ts",
|
|
16
|
+
"dist/packages/guardian-cli/src/bin.js",
|
|
17
|
+
"dist/packages/guardian-cli/src/index.js",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": "./dist/packages/guardian-cli/src/index.js",
|
|
23
|
+
"types": "./dist/packages/guardian-cli/src/index.d.ts"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"guardian": "./dist/packages/guardian-cli/src/bin.js"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.build.json && node scripts/bundle-npm-entrypoints.mjs && node scripts/mark-bin-executable.mjs",
|
|
31
|
+
"dev": "tsx src/index.ts",
|
|
32
|
+
"pack:dry-run": "npm pack --dry-run",
|
|
33
|
+
"prepack": "npm run build",
|
|
34
|
+
"release:doctor": "npm run build && npm pack --dry-run",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"test": "vitest run"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"ai-governance",
|
|
43
|
+
"context-fabric",
|
|
44
|
+
"guardian",
|
|
45
|
+
"local-first",
|
|
46
|
+
"mcp"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"better-sqlite3": "^13.0.1",
|
|
50
|
+
"better-sqlite3-multiple-ciphers": "^12.11.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@contextecf/guardian-mcp-server": "*",
|
|
54
|
+
"@contextecf/personal-fabric-contracts": "*",
|
|
55
|
+
"@contextecf/personal-fabric-runtime": "*",
|
|
56
|
+
"@contextecf/personal-fabric-store": "*",
|
|
57
|
+
"esbuild": "^0.25.0",
|
|
58
|
+
"vitest": "^4.1.8"
|
|
59
|
+
}
|
|
60
|
+
}
|