fullcourtdefense-cli 1.35.10 → 1.36.2

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.
Files changed (74) hide show
  1. package/dist/actionPolicyEngine.d.ts +24 -0
  2. package/dist/actionPolicyEngine.js +79 -19
  3. package/dist/approvalPrompt.d.ts +15 -0
  4. package/dist/approvalPrompt.js +157 -20
  5. package/dist/askDialog.d.ts +2 -0
  6. package/dist/askDialog.js +15 -1
  7. package/dist/askHeader.d.ts +81 -0
  8. package/dist/askHeader.js +573 -0
  9. package/dist/blockExplanation.d.ts +9 -0
  10. package/dist/blockExplanation.js +14 -0
  11. package/dist/callerEnv.d.ts +1 -1
  12. package/dist/callerEnv.js +14 -0
  13. package/dist/cloudGrant.d.ts +46 -0
  14. package/dist/cloudGrant.js +420 -0
  15. package/dist/cloudGrantTools.d.ts +97 -0
  16. package/dist/cloudGrantTools.js +1112 -0
  17. package/dist/commandNarrative.d.ts +8 -0
  18. package/dist/commandNarrative.js +222 -49
  19. package/dist/commands/cmdGuard.js +3 -1
  20. package/dist/commands/daemon.js +56 -2
  21. package/dist/commands/deterministicGuard.d.ts +70 -4
  22. package/dist/commands/deterministicGuard.js +494 -63
  23. package/dist/commands/discover.js +50 -16
  24. package/dist/commands/discoverAgentFiles.d.ts +2 -0
  25. package/dist/commands/discoverAgentFiles.js +1 -0
  26. package/dist/commands/discoverPaths.d.ts +4 -0
  27. package/dist/commands/discoverPaths.js +19 -1
  28. package/dist/commands/discoverProjectRoots.d.ts +72 -0
  29. package/dist/commands/discoverProjectRoots.js +327 -0
  30. package/dist/commands/discoverProxy.d.ts +1 -1
  31. package/dist/commands/discoverProxy.js +1 -1
  32. package/dist/commands/discoverSecrets.d.ts +44 -0
  33. package/dist/commands/discoverSecrets.js +158 -14
  34. package/dist/commands/hook.js +25 -10
  35. package/dist/commands/knownMcpServers.d.ts +8 -2
  36. package/dist/commands/knownMcpServers.js +33 -2
  37. package/dist/commands/mcpGateway.js +9 -7
  38. package/dist/commands/posixShellGuard.js +1 -1
  39. package/dist/commands/shellGuard.js +86 -26
  40. package/dist/commands/uninstallAll.d.ts +1 -7
  41. package/dist/commands/uninstallAll.js +6 -45
  42. package/dist/commands/watchdog.js +17 -3
  43. package/dist/config.d.ts +1 -1
  44. package/dist/config.js +3 -3
  45. package/dist/credentialGrant.d.ts +48 -0
  46. package/dist/credentialGrant.js +29 -18
  47. package/dist/credentialStore.js +1 -1
  48. package/dist/devConfirm.d.ts +51 -3
  49. package/dist/devConfirm.js +226 -33
  50. package/dist/distress.d.ts +2 -0
  51. package/dist/distress.js +2 -0
  52. package/dist/grantTargets.d.ts +21 -0
  53. package/dist/grantTargets.js +235 -0
  54. package/dist/localSafetySnapshot.js +2 -0
  55. package/dist/msiProductCode.d.ts +10 -0
  56. package/dist/msiProductCode.js +124 -0
  57. package/dist/notify.js +1 -0
  58. package/dist/selfTest.d.ts +1 -1
  59. package/dist/selfTest.js +1 -1
  60. package/dist/selfUpdate.d.ts +108 -0
  61. package/dist/selfUpdate.js +353 -18
  62. package/dist/shellAst.d.ts +2 -0
  63. package/dist/shellAst.js +7 -1
  64. package/dist/shellAstLoader.js +14 -1
  65. package/dist/telemetry.d.ts +3 -0
  66. package/dist/telemetry.js +1 -0
  67. package/dist/version.json +1 -1
  68. package/installer/macos/guardian/ai.fullcourtdefense.guardian.plist +19 -0
  69. package/installer/macos/guardian/fcd-guardian.sh +590 -0
  70. package/installer/macos/guardian/install-guardian.sh +32 -0
  71. package/installer/macos/guardian/uninstall-guardian.sh +12 -0
  72. package/installer/windows/README.md +88 -0
  73. package/installer/windows/rescue/FullCourtDefense-Rescue.ps1 +229 -0
  74. package/package.json +11 -1
package/dist/askDialog.js CHANGED
@@ -144,12 +144,26 @@ async function resolveAskWithDialog(verdict, options = {}) {
144
144
  const allowAlways = envelope.remember !== 'none' && Boolean(grantHash) && Boolean(grantLimits) && (0, devConfirm_1.grantOffered)(envelope.scope);
145
145
  const scopeLabel = allowAlways ? (0, devConfirm_1.describeGrantScope)(envelope.scope, { policyId: envelope.policyId, policyName: envelope.policyName }) : undefined;
146
146
  const limitsLabel = allowAlways && grantLimits ? (0, devConfirm_1.describeGrantLimits)(grantLimits) : undefined;
147
+ const alwaysCovers = allowAlways ? (0, devConfirm_1.grantCoverage)(envelope.scope) : undefined;
148
+ // The scope's own refusal; `remember: none` / org switch-off / no rule identity travel as `subject.alwaysOff`.
149
+ const alwaysNotOffered = !allowAlways && envelope.remember !== 'none' && grantHash && grantLimits ? (0, devConfirm_1.grantNotOfferedReason)(envelope.scope) : undefined;
150
+ const subject = {
151
+ event: envelope.event,
152
+ operation: envelope.operation,
153
+ ...(envelope.scope.cloud ? { cloud: envelope.scope.cloud } : {}),
154
+ ...(envelope.scope.destinationDomain ? { destinationDomain: envelope.scope.destinationDomain } : {}),
155
+ ...(envelope.scope.credential?.hosts?.length ? { credentialHosts: envelope.scope.credential.hosts } : {}),
156
+ ...(envelope.policyId ? { ruleId: envelope.policyId } : {}),
157
+ // The client the runtime record carries; older hook builds leave it off (the `--agent-client` flag then).
158
+ ...(envelope.agentClient || options.clientLabel ? { agentClient: envelope.agentClient || options.clientLabel } : {}),
159
+ ...(allowAlways || alwaysNotOffered ? {} : { alwaysOff: envelope.remember === 'none' ? 'rule' : envelope.grantLimits === null ? 'org' : 'no_rule' }),
160
+ };
147
161
  const dialog = options.dialog || devConfirm_1.confirmNativeActionDetailed;
148
162
  const reason = options.clientLabel ? `IDE: ${options.clientLabel}\n${envelope.reason}` : envelope.reason;
149
163
  let outcome = 'unavailable';
150
164
  let latencyMs = 0;
151
165
  try {
152
- ({ outcome, latencyMs } = await dialog(reason, options.timeoutMs ?? exports.ASK_DIALOG_TIMEOUT_MS, { allowAlways, alwaysScopeLabel: scopeLabel, alwaysLimitsLabel: limitsLabel }));
166
+ ({ outcome, latencyMs } = await dialog(reason, options.timeoutMs ?? exports.ASK_DIALOG_TIMEOUT_MS, { allowAlways, alwaysScopeLabel: scopeLabel, alwaysLimitsLabel: limitsLabel, alwaysCovers, alwaysNotOffered, subject }));
153
167
  }
154
168
  catch {
155
169
  outcome = 'unavailable';
@@ -0,0 +1,81 @@
1
+ export type EnvironmentTag = 'production' | 'staging' | 'dev';
2
+ /** Facts the ask envelope carries besides the reason text (all optional: the MCP gateway has none). */
3
+ export interface AskSubject {
4
+ /** Hook event: shell | mcp | file | read. */
5
+ event?: string;
6
+ /** Engine operation of the action (read / write / DELETE / SHELL …). */
7
+ operation?: string;
8
+ /** Grant scope cloud entries, `gcloud|<how>|<where>`. */
9
+ cloud?: string[];
10
+ /** Host the action reaches (engine `destination.domain`). */
11
+ destinationDomain?: string;
12
+ /** Hosts a credential line sends to (credential binding). */
13
+ credentialHosts?: string[];
14
+ /** Rule id: `local-safety:<item>` or the action policy id. */
15
+ ruleId?: string;
16
+ /** Why no "Always allow" when the scope itself did not refuse it. */
17
+ alwaysOff?: 'rule' | 'org' | 'no_rule';
18
+ /** The client the hook records as `agentClient` on the runtime event (cursor, claude-code, …). */
19
+ agentClient?: string;
20
+ }
21
+ export interface AskHeaderInput {
22
+ /** The full action text: the script, else the "What" line. */
23
+ command?: string;
24
+ /** "shell command", "file edit", "MCP tool call" … */
25
+ kind?: string;
26
+ /** Tool line (MCP gateway). */
27
+ tool?: string;
28
+ /** The rule by name. */
29
+ policy?: string;
30
+ /** Local Safety rule detail from the Rule line: "id x, credential_commands". */
31
+ ruleDetail?: string;
32
+ /** The `IDE:` line of the reason (MCP gateway, older hook builds). */
33
+ ide?: string;
34
+ subject?: AskSubject;
35
+ /** "Always allow" is offered; `covers` says what it would cover. */
36
+ alwaysOffered: boolean;
37
+ alwaysCovers?: string;
38
+ /** The scope's own reason for not offering it (`grantNotOfferedReason`). */
39
+ alwaysNotOffered?: string;
40
+ }
41
+ export interface AskHeader {
42
+ /** Who is asking: "Your AI agent (Claude Code) wants to run this command." */
43
+ who: string;
44
+ /** One plain sentence. */
45
+ why: string;
46
+ /** What the action would change or remove, when the line names it; absent when unreadable. */
47
+ affects?: string;
48
+ /** Removes the home folder, a whole drive or the filesystem root: drawn like production (the words say it too). */
49
+ danger?: boolean;
50
+ /** Credential rules: where the token / secret is sent ("firestore.googleapis.com" or "unknown"). */
51
+ secretSentTo?: {
52
+ label: 'Token sent to' | 'Secret sent to';
53
+ value: string;
54
+ };
55
+ /** "Command" for shell lines, "Tool" for tool calls, "Target" otherwise. */
56
+ commandLabel: string;
57
+ command: string;
58
+ action: string;
59
+ /** Where the action lands, without the tag. */
60
+ where: string;
61
+ tag?: EnvironmentTag;
62
+ /** `where` with the tag spelled out: "acme-prod · production (by name)". */
63
+ whereText: string;
64
+ always: string;
65
+ /** Which fact the sentence came from; the dialog skips repeating it under "Why it triggered". */
66
+ source: 'cloud' | 'credential' | 'operation' | 'rule';
67
+ }
68
+ /** The client id as the console labels it; undefined for a missing or placeholder id. */
69
+ export declare function agentClientLabel(raw?: string): string | undefined;
70
+ /** Name tokens of a project id → environment. Deterministic, and only a hint: the dialog says "(by name)". */
71
+ export declare function environmentTag(projectId: string): EnvironmentTag | undefined;
72
+ interface ProjectRead {
73
+ /** Literal project ids, in order of appearance, unique. */
74
+ ids: string[];
75
+ /** A project reference exists but is computed (`$p`, `$(cat p.txt)`). */
76
+ computed: boolean;
77
+ }
78
+ /** Literal project ids named on the command: `--project x` / `--project=x` and Google API `projects/<id>` paths. */
79
+ export declare function projectsInCommand(command: string): ProjectRead;
80
+ export declare function buildAskHeader(input: AskHeaderInput): AskHeader;
81
+ export {};