codiedev 0.10.0-beta.4 → 0.10.0-beta.5

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 (146) hide show
  1. package/README.md +7 -1
  2. package/assets/tui-brand-plugin.tsx +14 -2
  3. package/dist/backup/cache.js +1 -5
  4. package/dist/backup/match.js +0 -6
  5. package/dist/backup/run.js +3 -35
  6. package/dist/captureExclusions.js +0 -12
  7. package/dist/captureLog.js +0 -28
  8. package/dist/captureReadiness.js +0 -58
  9. package/dist/captureSignals.js +66 -3
  10. package/dist/cli.js +41 -18
  11. package/dist/codexHookTrust.js +61 -5
  12. package/dist/codexLimitScan.js +2 -109
  13. package/dist/codie.js +27 -40
  14. package/dist/codieBrandInstall.js +0 -18
  15. package/dist/codieLauncher.js +2 -70
  16. package/dist/codieRuntime.js +19 -23
  17. package/dist/codieRuntimeInstall.js +108 -23
  18. package/dist/codieStartup.js +0 -3
  19. package/dist/codieUsage.js +38 -41
  20. package/dist/commands/ask.js +0 -3
  21. package/dist/commands/capture.js +0 -2
  22. package/dist/commands/createTicket.js +0 -10
  23. package/dist/commands/doctor.js +41 -82
  24. package/dist/commands/inbox.js +0 -2
  25. package/dist/commands/library.js +0 -3
  26. package/dist/commands/pack.js +573 -0
  27. package/dist/commands/ping.js +0 -2
  28. package/dist/commands/pull.js +6 -10
  29. package/dist/commands/push.js +2 -12
  30. package/dist/commands/react.js +0 -2
  31. package/dist/commands/reverseTicket.js +0 -33
  32. package/dist/commands/search.js +0 -4
  33. package/dist/commands/send.js +0 -5
  34. package/dist/commands/share.js +0 -4
  35. package/dist/commands/shared.js +0 -35
  36. package/dist/commands/traces.js +280 -0
  37. package/dist/configDir.js +0 -10
  38. package/dist/connect.js +21 -77
  39. package/dist/connectFlow.js +0 -9
  40. package/dist/copilotHooks.js +395 -0
  41. package/dist/copilotInstallation.js +64 -0
  42. package/dist/cursorHooks.js +40 -17
  43. package/dist/cursorLifecycle.js +109 -0
  44. package/dist/detection.js +0 -30
  45. package/dist/harnessDirs.js +73 -0
  46. package/dist/hook.js +193 -316
  47. package/dist/inboxFormat.js +0 -24
  48. package/dist/launchContext.js +150 -0
  49. package/dist/launcher.js +140 -0
  50. package/dist/limitEvent.js +41 -35
  51. package/dist/limitEventReporter.js +1 -1
  52. package/dist/mcp.js +3 -77
  53. package/dist/nativeSteering.js +24 -0
  54. package/dist/packs/codie.js +182 -0
  55. package/dist/packs/harnesses.js +374 -0
  56. package/dist/packs/hookGate.js +256 -0
  57. package/dist/packs/install.js +285 -0
  58. package/dist/packs/manifest.js +126 -0
  59. package/dist/packs/paths.js +81 -0
  60. package/dist/packs/shim.js +214 -0
  61. package/dist/packs/store.js +155 -0
  62. package/dist/packs/sync.js +170 -0
  63. package/dist/prUrl.js +0 -5
  64. package/dist/repoResolver.js +0 -19
  65. package/dist/secret.js +0 -3
  66. package/dist/security.js +0 -20
  67. package/dist/securityDeepScan.js +1 -14
  68. package/dist/securityDoctor.js +0 -2
  69. package/dist/securityFeature.js +0 -1
  70. package/dist/securityInstall.js +6 -13
  71. package/dist/securityInventory.js +23 -13
  72. package/dist/securityPilot.js +0 -2
  73. package/dist/securityPolicy.js +0 -7
  74. package/dist/selfUpdate.js +331 -0
  75. package/dist/skillMarker.js +23 -0
  76. package/dist/subagents.js +135 -0
  77. package/dist/teamSkillContext.js +10 -0
  78. package/dist/transcriptModels.js +6 -8
  79. package/dist/upgradeNudge.js +0 -30
  80. package/dist/utils.js +286 -733
  81. package/dist/version.js +0 -10
  82. package/dist/versionCheck.js +0 -33
  83. package/package.json +7 -6
  84. package/dist/backup/cache.d.ts +0 -14
  85. package/dist/backup/match.d.ts +0 -2
  86. package/dist/backup/run.d.ts +0 -25
  87. package/dist/captureExclusions.d.ts +0 -30
  88. package/dist/captureLog.d.ts +0 -20
  89. package/dist/captureReadiness.d.ts +0 -65
  90. package/dist/captureSignals.d.ts +0 -19
  91. package/dist/cli.d.ts +0 -16
  92. package/dist/codexHookTrust.d.ts +0 -34
  93. package/dist/codexLimitScan.d.ts +0 -64
  94. package/dist/codie.d.ts +0 -2
  95. package/dist/codieBrandInstall.d.ts +0 -11
  96. package/dist/codieLauncher.d.ts +0 -86
  97. package/dist/codieRuntime.d.ts +0 -29
  98. package/dist/codieRuntimeInstall.d.ts +0 -28
  99. package/dist/codieStartup.d.ts +0 -26
  100. package/dist/codieUsage.d.ts +0 -57
  101. package/dist/commands/ask.d.ts +0 -1
  102. package/dist/commands/capture.d.ts +0 -14
  103. package/dist/commands/createTicket.d.ts +0 -27
  104. package/dist/commands/delete.d.ts +0 -1
  105. package/dist/commands/doctor.d.ts +0 -1
  106. package/dist/commands/inbox.d.ts +0 -3
  107. package/dist/commands/library.d.ts +0 -2
  108. package/dist/commands/note.d.ts +0 -1
  109. package/dist/commands/ping.d.ts +0 -1
  110. package/dist/commands/promote.d.ts +0 -1
  111. package/dist/commands/pull.d.ts +0 -2
  112. package/dist/commands/push.d.ts +0 -33
  113. package/dist/commands/react.d.ts +0 -2
  114. package/dist/commands/reverseTicket.d.ts +0 -2
  115. package/dist/commands/search.d.ts +0 -2
  116. package/dist/commands/security.d.ts +0 -1
  117. package/dist/commands/send.d.ts +0 -2
  118. package/dist/commands/share.d.ts +0 -2
  119. package/dist/commands/shared.d.ts +0 -64
  120. package/dist/configDir.d.ts +0 -1
  121. package/dist/connect.d.ts +0 -1
  122. package/dist/connectFlow.d.ts +0 -13
  123. package/dist/cursorHooks.d.ts +0 -23
  124. package/dist/detection.d.ts +0 -30
  125. package/dist/hook.d.ts +0 -6
  126. package/dist/inboxFormat.d.ts +0 -38
  127. package/dist/limitEvent.d.ts +0 -16
  128. package/dist/limitEventReporter.d.ts +0 -21
  129. package/dist/mcp.d.ts +0 -12
  130. package/dist/prUrl.d.ts +0 -9
  131. package/dist/repoResolver.d.ts +0 -17
  132. package/dist/secret.d.ts +0 -1
  133. package/dist/security.d.ts +0 -102
  134. package/dist/securityDeepScan.d.ts +0 -41
  135. package/dist/securityDoctor.d.ts +0 -32
  136. package/dist/securityFeature.d.ts +0 -5
  137. package/dist/securityInstall.d.ts +0 -63
  138. package/dist/securityInventory.d.ts +0 -54
  139. package/dist/securityPilot.d.ts +0 -19
  140. package/dist/securityPolicy.d.ts +0 -33
  141. package/dist/securitySession.d.ts +0 -6
  142. package/dist/transcriptModels.d.ts +0 -18
  143. package/dist/upgradeNudge.d.ts +0 -25
  144. package/dist/utils.d.ts +0 -346
  145. package/dist/version.d.ts +0 -1
  146. package/dist/versionCheck.d.ts +0 -68
@@ -1,63 +0,0 @@
1
- export type SecuritySurface = "claude-code" | "codex" | "cursor" | "codie-harness";
2
- export interface SecurityInstallTarget {
3
- surface: SecuritySurface;
4
- configPath: string;
5
- }
6
- export interface SecurityRollbackFile {
7
- originalPath: string;
8
- snapshotPath: string;
9
- }
10
- export interface SecurityInstallSnapshot {
11
- id: string;
12
- createdAt: string;
13
- files: SecurityRollbackFile[];
14
- }
15
- export interface SecurityInstallManifest {
16
- schemaVersion: 1;
17
- cliVersion: string;
18
- installedAt: string;
19
- hookScriptPath: string;
20
- hookScriptSha256: string;
21
- targets: SecurityInstallTarget[];
22
- rollbackSnapshotId: string;
23
- rollbackFiles: SecurityRollbackFile[];
24
- }
25
- export interface SecurityInstallInspection {
26
- surface: SecuritySurface;
27
- status: "pass" | "fail" | "not-installed";
28
- detail: string;
29
- }
30
- /**
31
- * Capture the exact pre-update hook configuration. This function never removes
32
- * or restores anything; it creates the evidence needed for an explicit,
33
- * administrator-approved rollback later.
34
- */
35
- export declare function createSecurityInstallSnapshot(configPaths: string[], stateDir?: string, now?: () => number): SecurityInstallSnapshot;
36
- export declare function writeSecurityInstallManifest(options: {
37
- stateDir?: string;
38
- hookScriptPath: string;
39
- snapshot: SecurityInstallSnapshot;
40
- targets: SecurityInstallTarget[];
41
- now?: () => number;
42
- }): SecurityInstallManifest;
43
- export declare function readSecurityInstallManifest(stateDir?: string): SecurityInstallManifest | null;
44
- export declare function verifySecurityInstallManifest(manifest: SecurityInstallManifest | null): {
45
- ok: boolean;
46
- detail: string;
47
- };
48
- /**
49
- * Restore only files recorded in the selected install manifest. The snapshot
50
- * location is validated before any write and each replacement is atomic, so a
51
- * partial copy cannot leave a hook configuration truncated.
52
- */
53
- export declare function restoreSecurityInstallSnapshot(manifest: SecurityInstallManifest | null): {
54
- restored: number;
55
- snapshotId: string;
56
- };
57
- export declare function inspectSecurityInstallation(paths?: {
58
- claudeSettingsPath?: string;
59
- codexHooksPath?: string;
60
- codexConfigPath?: string;
61
- cursorHooksPath?: string;
62
- codiePluginPath?: string;
63
- }): SecurityInstallInspection[];
@@ -1,54 +0,0 @@
1
- export type SecurityComponentKind = "mcp-server" | "skill" | "extension" | "plugin" | "hook" | "instruction";
2
- export type SecurityFindingSeverity = "low" | "medium" | "high" | "critical";
3
- export interface SecurityInventoryFinding {
4
- code: string;
5
- severity: SecurityFindingSeverity;
6
- detail: string;
7
- }
8
- export interface SecurityComponent {
9
- componentKey: string;
10
- kind: SecurityComponentKind;
11
- name: string;
12
- version?: string;
13
- source: string;
14
- scope: "user" | "workspace";
15
- sha256: string;
16
- findings: SecurityInventoryFinding[];
17
- metadata: Record<string, string | number | boolean>;
18
- }
19
- export interface SecurityInventoryReport {
20
- schemaVersion: 1;
21
- generatedAt: string;
22
- endpointId: string;
23
- workspace: string;
24
- components: SecurityComponent[];
25
- drift: Array<{
26
- componentKey: string;
27
- name: string;
28
- previousSha256: string;
29
- currentSha256: string;
30
- }>;
31
- }
32
- interface InventoryOptions {
33
- homeDir?: string;
34
- workspace?: string;
35
- stateDir?: string;
36
- now?: () => number;
37
- persist?: boolean;
38
- }
39
- export declare function readSecurityInventory(stateDir?: string): SecurityInventoryReport | null;
40
- export declare function securityInventoryDue(stateDir?: string, maxAgeMs?: number, now?: number): boolean;
41
- export declare function buildSecurityInventory(options?: InventoryOptions): SecurityInventoryReport;
42
- export declare function scannerAvailability(): Array<{
43
- name: string;
44
- available: boolean;
45
- purpose: string;
46
- }>;
47
- export declare function uploadSecurityInventory(report: SecurityInventoryReport, config: {
48
- backendUrl: string;
49
- token: string;
50
- }, timeoutMs?: number): Promise<{
51
- ok: boolean;
52
- accepted: number;
53
- }>;
54
- export {};
@@ -1,19 +0,0 @@
1
- import { type AgentSurface, type LocalSecurityAction } from "./security";
2
- export interface SecurityPilotCase {
3
- surface: AgentSurface;
4
- name: string;
5
- expected: LocalSecurityAction;
6
- actual: LocalSecurityAction;
7
- passed: boolean;
8
- }
9
- export interface SecurityPilotReport {
10
- schemaVersion: 1;
11
- runAt: string;
12
- ok: boolean;
13
- containsRealSecrets: false;
14
- surfaces: AgentSurface[];
15
- cases: SecurityPilotCase[];
16
- }
17
- /** Safe, side-effect-free policy validation. No command is executed and none
18
- * of the synthetic values are real credentials. */
19
- export declare function runSyntheticSecurityPilot(cwd?: string, now?: () => number): SecurityPilotReport;
@@ -1,33 +0,0 @@
1
- import { type AgentSurface, type EndpointSecurityPolicy } from "./security";
2
- export type TrustedPolicyKeys = Record<string, string>;
3
- /**
4
- * Vendor policy roots are compiled into the endpoint binary. This prevents a
5
- * compromised control-plane response from introducing the key that verifies
6
- * that same response. Additional customer-managed roots may still be supplied
7
- * through CODIEDEV_SECURITY_POLICY_PUBLIC_KEYS, but they cannot replace the
8
- * Codiedev production root with the same key id.
9
- */
10
- export declare const BUILT_IN_POLICY_KEYS: TrustedPolicyKeys;
11
- export declare function trustedPolicyKeysFromEnvironment(env?: NodeJS.ProcessEnv): TrustedPolicyKeys;
12
- export declare function verifyEndpointSecurityPolicySignature(policy: EndpointSecurityPolicy, trustedKeys?: TrustedPolicyKeys): {
13
- ok: boolean;
14
- trusted: boolean;
15
- detail: string;
16
- };
17
- export declare function readEndpointSecurityPolicy(stateDir?: string, trustedKeys?: TrustedPolicyKeys, companyId?: string): EndpointSecurityPolicy | undefined;
18
- export declare function inspectEndpointSecurityPolicy(stateDir?: string, trustedKeys?: TrustedPolicyKeys, companyId?: string): {
19
- exists: boolean;
20
- policy?: EndpointSecurityPolicy;
21
- verification: {
22
- ok: boolean;
23
- trusted: boolean;
24
- detail: string;
25
- };
26
- };
27
- export declare function writeEndpointSecurityPolicy(policy: EndpointSecurityPolicy, stateDir?: string, trustedKeys?: TrustedPolicyKeys, companyId?: string): void;
28
- export declare function syncEndpointSecurityPolicy(config: {
29
- backendUrl: string;
30
- token: string;
31
- companyId: string;
32
- deviceId?: string;
33
- }, source?: AgentSurface, timeoutMs?: number, stateDir?: string, trustedKeys?: TrustedPolicyKeys): Promise<EndpointSecurityPolicy>;
@@ -1,6 +0,0 @@
1
- interface SessionSignal {
2
- sensitiveReadAt?: number;
3
- }
4
- export declare function readSessionSecuritySignal(sessionId: string | undefined, stateDir?: string, now?: number): SessionSignal | undefined;
5
- export declare function recordSensitiveReadSignal(sessionId: string | undefined, stateDir?: string, now?: number): void;
6
- export {};
@@ -1,18 +0,0 @@
1
- /** Compact per-model usage, derived from captured transcript records. */
2
- export type TranscriptModelUsage = {
3
- model: string;
4
- /** Assistant message IDs; nonzero cumulative usage events for Codex. */
5
- requests: number;
6
- inputTokens: number;
7
- outputTokens: number;
8
- cacheReadTokens: number;
9
- cacheCreationTokens: number;
10
- costUsd?: number;
11
- /** Reported provider figure, retained separately from trusted billing inputs. */
12
- reportedCostUsd?: number;
13
- /** Reported reasoning is included in outputTokens, never added again. */
14
- reasoningTokens?: number;
15
- };
16
- export declare function transcriptRecords(content: string, source?: string): Generator<unknown>;
17
- export declare function parseTranscriptModels(content: string, source?: string): TranscriptModelUsage[];
18
- export declare function totalModelTokens(row: Omit<TranscriptModelUsage, "model" | "requests">): number;
@@ -1,25 +0,0 @@
1
- /**
2
- * Fail-silent — never throws, never blocks on network. If the registry is
3
- * unreachable or the cache is corrupt, the warning just doesn't print. The
4
- * worst outcome is "user keeps running an old version" — same as before
5
- * this feature existed.
6
- */
7
- export declare function maybePrintUpgradeNudge(): Promise<void>;
8
- export interface OfferOpts {
9
- env?: NodeJS.ProcessEnv;
10
- argv?: string[];
11
- nowMs?: number;
12
- fetchImpl?: typeof fetch;
13
- log?: (line: string) => void;
14
- isTty?: boolean;
15
- }
16
- export declare function promptYesNo(question: string): Promise<boolean>;
17
- /**
18
- * Prompt-capable sibling of maybePrintUpgradeNudge. Call this before handing
19
- * the terminal to a TUI. A successful upgrade relaunches the fresh CLI and
20
- * tells the stale caller to stop rather than continuing with old modules.
21
- */
22
- export declare function maybeOfferUpgrade(opts?: OfferOpts): Promise<{
23
- relaunched: boolean;
24
- status?: number;
25
- }>;
package/dist/utils.d.ts DELETED
@@ -1,346 +0,0 @@
1
- import * as fs from "fs";
2
- import type { CaptureSignals } from "./captureSignals";
3
- import type { TranscriptModelUsage } from "./transcriptModels";
4
- import { spawn as nodeSpawn } from "child_process";
5
- import type { CaptureLogEntry } from "./captureLog";
6
- import { codiedevStateDir } from "./configDir";
7
- export { codiedevStateDir };
8
- export interface CodiedevConfig {
9
- token: string;
10
- companyId: string;
11
- companyName: string;
12
- repos: Array<{
13
- repoId: string;
14
- url: string;
15
- fullName: string;
16
- }>;
17
- lastSynced: string;
18
- backendUrl: string;
19
- agentSecurityEnabled?: boolean;
20
- deviceId?: string;
21
- deviceName?: string;
22
- captureIgnoredPaths?: string[];
23
- }
24
- export declare const CONFIG_PATH: string;
25
- export declare function readConfig(): CodiedevConfig | null;
26
- export declare function writeConfig(config: CodiedevConfig): void;
27
- /** Exported for permission-focused tests; normal callers use writeConfig. */
28
- export declare function writeConfigAtPath(config: CodiedevConfig, configDir: string, configPath: string): void;
29
- export declare function parseGitRemoteFromConfig(configText: string): string | null;
30
- export declare function readGitRemoteFromConfig(startDir: string): string | null;
31
- export declare function getGitRemoteUrl(cwd: string): string | null;
32
- export declare function resolveCaptureRemoteUrl(workspaceRoot: string, captureDirs: string[], getRemote?: (dir: string) => string | null): string | null;
33
- export declare function normalizeRepoUrl(url: string): string;
34
- export declare function matchRepo(remoteUrl: string, repos: Array<{
35
- repoId: string;
36
- url: string;
37
- fullName: string;
38
- }>): {
39
- repoId: string;
40
- url: string;
41
- fullName: string;
42
- } | null;
43
- export declare function resolveCaptureDir(transcriptContent: string, workspaceRoot: string): string;
44
- export declare function resolveCaptureDirs(transcriptContent: string, workspaceRoot: string): string[];
45
- export declare function collectCaptureKeys(dirs: string[], getBranch?: (d: string) => string | null, getSha?: (d: string) => string | null): {
46
- branch: string | null;
47
- headSha: string | null;
48
- branches: string[];
49
- headShas: string[];
50
- };
51
- export type CaptureGitRef = {
52
- repoUrl: string;
53
- branch?: string;
54
- headSha?: string;
55
- };
56
- export declare function collectCaptureGitRefs(dirs: string[], getRemote?: (d: string) => string | null, getBranch?: (d: string) => string | null, getSha?: (d: string) => string | null): CaptureGitRef[];
57
- export declare function parsePullRequestUrls(transcriptContent: string): string[];
58
- export declare function extractShaTokens(transcriptContent: string): string[];
59
- export declare function parseAuthoredBranches(transcriptContent: string): string[];
60
- export declare function parseAuthoredShas(transcriptContent: string, repoRoot: string, resolveFullBatch?: (shas: string[]) => Map<string, string>): string[];
61
- export declare function getGitBranch(cwd: string): string | null;
62
- export declare function getGitHeadSha(cwd: string): string | null;
63
- export interface CapturePayloadInput {
64
- modelUsage?: TranscriptModelUsage[];
65
- captureSignals?: CaptureSignals;
66
- sessionId?: string;
67
- transcriptBase64: string;
68
- remoteUrl: string | null;
69
- matchedRepoId?: string;
70
- companyId: string;
71
- messageCount: number;
72
- toolCallCount: number;
73
- capturedAt: number;
74
- source: string;
75
- branch?: string | null;
76
- headSha?: string | null;
77
- branches?: string[];
78
- headShas?: string[];
79
- gitRefs?: CaptureGitRef[];
80
- pullRequestUrls?: string[];
81
- inputTokens?: number;
82
- outputTokens?: number;
83
- cacheTokens?: number;
84
- cacheReadTokens?: number;
85
- cacheCreationTokens?: number;
86
- model?: string | null;
87
- sessionStartedAt?: number | null;
88
- interruptCount?: number;
89
- rejectionCount?: number;
90
- final?: boolean;
91
- costUsd?: number;
92
- }
93
- export declare function buildCapturePayload(input: CapturePayloadInput): Record<string, unknown>;
94
- export declare function hashToken(token: string): string;
95
- export declare function extractHookNodePath(cmd: string | undefined): string | undefined;
96
- export declare function resetStableNodeCacheForTests(): void;
97
- export declare function claudeCodeInstalled(): boolean;
98
- export declare function codexInstalled(): boolean;
99
- export declare function cursorInstalled(): boolean;
100
- export declare function openCodeInstalled(): boolean;
101
- /** Install a dormant global OpenCode adapter. Installing it unconditionally
102
- * keeps `codiedev connect` as the only setup step even when Codie/OpenCode is
103
- * installed later. OpenCode loads this file from its documented plugin dir. */
104
- export declare function installOpenCodeCapturePlugin(agentSecurityEnabled?: boolean): void;
105
- /**
106
- * VS Code with the GitHub Copilot Chat extension installed. The extension
107
- * directory pattern is `~/.vscode/extensions/github.copilot-chat-*`. We treat
108
- * the presence of any `github.copilot*` directory as the Copilot fingerprint.
109
- */
110
- export declare function vscodeCopilotInstalled(): boolean;
111
- export declare function upsertCodiedevHook(hooks: Record<string, unknown>, eventName: string, subcommand: string, matcher?: string | null): void;
112
- /** Remove Codiedev's entries for one event while preserving foreign hooks. */
113
- export declare function removeCodiedevHook(hooks: Record<string, unknown>, eventName: string): boolean;
114
- export declare function installHook(agentSecurityEnabled?: boolean): void;
115
- export declare function ensureDiscoveryHookInstalled(): void;
116
- export declare function ensureBackupHookInstalled(): void;
117
- export declare function ensureLimitHookInstalled(): void;
118
- export declare function ensureAllCodiedevHooksInstalled(agentSecurityEnabled?: boolean): void;
119
- export declare function ensureSessionStartHookInstalled(): void;
120
- export declare function installClaudeCodeInstructions(): void;
121
- export declare function installCodexInstructions(): void;
122
- export declare function installCursorInstructions(): void;
123
- /**
124
- * Install the Codiedev MCP server into Claude Code's user-scope config.
125
- * Safe to call multiple times — updates the existing entry if present.
126
- */
127
- export declare function installClaudeCodeMcp(): void;
128
- /**
129
- * Install the Codiedev MCP server into Cursor's user-scope config.
130
- * Cursor uses the same `mcpServers` schema as Claude Code; just a different
131
- * file path (~/.cursor/mcp.json). Project-scoped servers can also live at
132
- * <project>/.cursor/mcp.json — we only manage the user-scope one.
133
- */
134
- export declare function installCursorMcp(): void;
135
- /**
136
- * Install the Codiedev MCP server into VS Code's user-scope MCP config so
137
- * GitHub Copilot Chat picks it up. VS Code uses a different schema than
138
- * Claude / Cursor: top-level key is `servers` (not `mcpServers`). On first
139
- * Copilot Chat run after install, VS Code prompts the user to trust the
140
- * server — that's expected and documented in the connect success message.
141
- *
142
- * Reverse-ticket and the other on-demand verbs work in Copilot identically
143
- * to Claude Code since the MCP server's reverse_ticket handler is already
144
- * 100% diff-driven (no transcript dependency).
145
- */
146
- export declare function installVSCodeMcp(): void;
147
- /**
148
- * Removes `mcpServers.codiedev` from `~/.claude.json` if present. Leaves
149
- * other MCP servers and unrelated top-level settings untouched.
150
- */
151
- export declare function cleanupClaudeCodeMcp(): void;
152
- /**
153
- * Removes `mcpServers.codiedev` from `~/.cursor/mcp.json` if present.
154
- */
155
- export declare function cleanupCursorMcp(): void;
156
- /**
157
- * Removes `servers.codiedev` from VS Code's user-scope mcp.json. VS Code
158
- * uses a different schema (`servers` not `mcpServers`), so this is a
159
- * separate helper.
160
- */
161
- export declare function cleanupVSCodeMcp(): void;
162
- /**
163
- * Removes the `# codiedev-mcp` block from `~/.codex/config.toml`. The
164
- * install side appends a well-marked block; we strip it the same way —
165
- * the marker line through the end of its TOML section. Whitespace-only
166
- * gaps between sections are preserved.
167
- */
168
- export declare function cleanupCodexMcp(): void;
169
- /**
170
- * Best-effort append of the Codiedev MCP server block to ~/.codex/config.toml.
171
- *
172
- * Codex uses TOML and we don't want a full parser for such a small addition,
173
- * so we append a well-marked block if one isn't already present. Idempotent.
174
- */
175
- export declare function installCodexMcp(): boolean;
176
- export declare function installCodexHook(agentSecurityEnabled?: boolean): void;
177
- export declare function ensureCodexLimitHookInstalled(): void;
178
- export declare function installCursorHook(agentSecurityEnabled?: boolean): void;
179
- /** Repair Cursor's complete flat hook set after upgrades or configuration
180
- * drift. This is deliberately separate from Claude Code's nested-hook healer:
181
- * the schemas and event names differ, and mixing them risks corrupting both. */
182
- export declare function ensureCursorCodiedevHooksInstalled(agentSecurityEnabled?: boolean): void;
183
- export interface ParsedStats {
184
- messageCount: number;
185
- toolCallCount: number;
186
- }
187
- export interface SteeringStats {
188
- interrupts: number;
189
- rejections: number;
190
- }
191
- export declare function parseClaudeSteering(content: string): SteeringStats;
192
- export declare function parseCodexSteering(content: string): SteeringStats;
193
- export declare function parseSteering(content: string, mode: "claude-code" | "codex" | "cursor" | "opencode"): SteeringStats;
194
- export interface UsageStats {
195
- inputTokens: number;
196
- outputTokens: number;
197
- /** Legacy fold of read + creation — kept for older servers. */
198
- cacheTokens: number;
199
- cacheReadTokens: number;
200
- cacheCreationTokens: number;
201
- model: string | null;
202
- /** Engine-reported spend (opencode SDK `info.cost`). Desktop mode only. */
203
- costUsd?: number;
204
- }
205
- export declare function parseUsage(content: string, mode: "claude-code" | "codex" | "cursor" | "opencode" | "desktop"): UsageStats;
206
- export declare function parseSessionStart(content: string): number | null;
207
- export declare function parseClaudeCodeStats(content: string): ParsedStats;
208
- /** Convert OpenCode's SDK message array (`{info, parts}[]`) into the same
209
- * newline-delimited shape used by Claude Code. The rest of capture—privacy
210
- * exclusions, git keys, token parsing, scrubbing, storage, and merge joins—can
211
- * therefore stay one shared pipeline instead of becoming a parallel product. */
212
- export declare function normalizeOpenCodeTranscript(content: string): string;
213
- export declare function parseCodexStats(content: string): ParsedStats;
214
- export declare function extractCodexRepoUrl(content: string): string | null;
215
- export interface CaptureUploadJob {
216
- url: string;
217
- token: string;
218
- body: Record<string, unknown>;
219
- attempts?: number;
220
- queuedAt?: number;
221
- scopePaths?: string[];
222
- }
223
- export declare const MAX_UPLOAD_ATTEMPTS = 5;
224
- export declare const UPLOAD_TTL_MS: number;
225
- interface DispatchDeps {
226
- spawn: typeof nodeSpawn;
227
- writeFileSync: typeof fs.writeFileSync;
228
- tmpFile: string;
229
- nodePath?: string;
230
- openSync?: typeof fs.openSync;
231
- closeSync?: typeof fs.closeSync;
232
- }
233
- export interface CaptureFinishInput {
234
- mode: string;
235
- session_id?: string;
236
- transcript_path?: string;
237
- cwd?: string;
238
- workspace_roots?: string[];
239
- final?: boolean;
240
- }
241
- export declare function dispatchCaptureFinish(input: CaptureFinishInput, hookScriptPath: string, deps: DispatchDeps): void;
242
- export declare function dispatchCaptureDetached(job: CaptureUploadJob, hookScriptPath: string, deps: DispatchDeps): void;
243
- export declare function dispatchDeferredUpload(job: CaptureUploadJob, hookScriptPath: string, deps: DispatchDeps, delayMs: number): void;
244
- interface SweepDeps {
245
- dir: string;
246
- readdirSync: (dir: string) => string[];
247
- renameSync: (from: string, to: string) => void;
248
- statSync: (p: string) => {
249
- mtimeMs: number;
250
- };
251
- spawn: typeof nodeSpawn;
252
- hookScriptPath: string;
253
- nodePath?: string;
254
- exclude?: string;
255
- max?: number;
256
- now?: () => number;
257
- openSync?: typeof fs.openSync;
258
- closeSync?: typeof fs.closeSync;
259
- pruneState?: () => void;
260
- unlinkSync?: (p: string) => void;
261
- reportOrphan?: (sessionId: string | undefined) => void;
262
- }
263
- export declare const CLAIM_STALE_MS: number;
264
- export declare const FINISH_ORPHAN_AGE_MS: number;
265
- export declare function sweepPendingCaptures(deps: SweepDeps): void;
266
- export declare const CAPTURE_THROTTLE_MS: number;
267
- export declare const SWEEP_MIN_AGE_MS: number;
268
- export declare function resolveCaptureFinal(argv2: string | undefined): boolean | undefined;
269
- export declare function finishInputTmpFile(sessionId: string | undefined): string;
270
- export declare function captureUploadTmpFile(sessionId: string | undefined, mode: "immediate" | "deferred", pid?: number, now?: number): string;
271
- export declare function cancelDeferredCaptureUpload(sessionId: string, deps?: Pick<typeof fs, "unlinkSync">): boolean;
272
- export declare function decideDispatch(args: {
273
- final: boolean;
274
- lastUploadAt: number | null;
275
- now: number;
276
- }): {
277
- mode: "immediate";
278
- } | {
279
- mode: "deferred";
280
- delayMs: number;
281
- };
282
- export interface SessionUploadState {
283
- lastUploadAt: number;
284
- }
285
- interface SessionStateDeps {
286
- readFileSync: typeof fs.readFileSync;
287
- existsSync: typeof fs.existsSync;
288
- }
289
- interface SessionStateWriteDeps {
290
- writeFileSync: typeof fs.writeFileSync;
291
- existsSync: typeof fs.existsSync;
292
- mkdirSync: typeof fs.mkdirSync;
293
- }
294
- export declare function readSessionUploadState(sessionId: string, deps?: SessionStateDeps): SessionUploadState | null;
295
- export declare function writeSessionUploadState(sessionId: string, state: SessionUploadState, deps?: SessionStateWriteDeps): void;
296
- export declare function pruneCaptureStateDir(deps?: {
297
- readdirSync: (d: string) => string[];
298
- statSync: (p: string) => {
299
- mtimeMs: number;
300
- };
301
- unlinkSync: (p: string) => void;
302
- }, dir?: string, now?: number): void;
303
- export declare const DIRECT_UPLOAD_THRESHOLD_CHARS = 2000000;
304
- interface UploadDeps {
305
- post: (url: string, body: Record<string, unknown>, token: string) => Promise<void>;
306
- requestJson?: (url: string, body: Record<string, unknown>, token: string) => Promise<any>;
307
- uploadBytes?: (url: string, bytes: Buffer, contentType: string) => Promise<any>;
308
- readFileSync: typeof fs.readFileSync;
309
- unlinkSync: typeof fs.unlinkSync;
310
- writeFileSync?: typeof fs.writeFileSync;
311
- now?: () => number;
312
- recordSuccess?: (job: CaptureUploadJob) => void;
313
- log?: (entry: CaptureLogEntry) => void;
314
- writeSessionState?: (sessionId: string, state: SessionUploadState) => void;
315
- shouldSkipJob?: (job: CaptureUploadJob) => boolean;
316
- }
317
- export interface LastCaptureRecord {
318
- sessionId: string | undefined;
319
- repoUrl: string;
320
- matched: boolean;
321
- branch: string;
322
- headSha: string;
323
- source: string;
324
- capturedAt: number | undefined;
325
- recordedAt: number;
326
- }
327
- export declare function buildLastCaptureRecord(job: CaptureUploadJob, now: number): LastCaptureRecord;
328
- interface LastCaptureWriteDeps {
329
- writeFileSync: typeof fs.writeFileSync;
330
- existsSync: typeof fs.existsSync;
331
- mkdirSync: typeof fs.mkdirSync;
332
- }
333
- export declare function writeLastCapture(record: LastCaptureRecord, deps?: LastCaptureWriteDeps, filePath?: string): void;
334
- interface LastCaptureReadDeps {
335
- readFileSync: typeof fs.readFileSync;
336
- existsSync: typeof fs.existsSync;
337
- }
338
- export declare function readLastCapture(deps?: LastCaptureReadDeps, filePath?: string): LastCaptureRecord | null;
339
- export declare function runCaptureUpload(jobFile: string, deps: UploadDeps): Promise<void>;
340
- interface DeferredUploadDeps extends UploadDeps {
341
- renameSync: typeof fs.renameSync;
342
- sleep?: (ms: number) => Promise<void>;
343
- }
344
- export declare function runDeferredUpload(jobFile: string, delayMs: number, deps: DeferredUploadDeps): Promise<void>;
345
- export declare function transcriptReadSkipReason(err: unknown): string;
346
- export declare function shouldReportCaptureSkip(final: boolean | undefined): boolean;
package/dist/version.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const CLI_VERSION: string;
@@ -1,68 +0,0 @@
1
- export interface Semver {
2
- major: number;
3
- minor: number;
4
- patch: number;
5
- }
6
- export declare function parseSemver(input: string): Semver | null;
7
- /**
8
- * Returns -1 if a < b, 0 if equal, 1 if a > b.
9
- *
10
- * Malformed input on either side returns 0 — we never want to nag a user
11
- * because of garbage version strings (corrupt cache, registry returned
12
- * something weird, prerelease format we don't recognize).
13
- */
14
- export declare function compareSemver(a: string, b: string): -1 | 0 | 1;
15
- export interface UpdateWarningInput {
16
- current: string;
17
- latest: string | null;
18
- lastChecked: number;
19
- nowMs: number;
20
- cacheTtlMs: number;
21
- }
22
- /**
23
- * Warning policy: only show when we have a known-newer `latest` from a
24
- * recent-enough cache. Stale-cache freshness is enforced by the *caller*
25
- * (which decides whether to refetch); this helper takes the cache state
26
- * as-given and answers a single question — should the user see a nag?
27
- */
28
- export declare function shouldShowUpdateWarning(input: UpdateWarningInput): boolean;
29
- export type InstallKind = "npx" | "container" | "global" | "readonly";
30
- export interface InstallKindDeps {
31
- dirname: string;
32
- env: NodeJS.ProcessEnv;
33
- existsSync: (p: string) => boolean;
34
- readFileSync: (p: string, enc: string) => string;
35
- accessSync: (p: string, mode?: number) => void;
36
- }
37
- /**
38
- * npx — running from npm's _npx cache; nothing to upgrade in place.
39
- * container — baked into an image; the honest fix is rebuilding it.
40
- * global — a real install directory we can write to. Upgradable.
41
- * readonly — a real install directory we cannot write to (root-owned global
42
- * on a shared box, read-only mount). Needs sudo, so print rather
43
- * than attempt an upgrade that would EACCES.
44
- */
45
- export declare function resolveInstallKind(deps: InstallKindDeps): InstallKind;
46
- export declare function upgradeCommand(kind: InstallKind, pkg?: string): string;
47
- export type UpdateAction = "none" | "notify" | "prompt";
48
- export interface UpdateActionInput {
49
- current: string;
50
- latest: string | null;
51
- installKind: InstallKind;
52
- isTty: boolean;
53
- isCi: boolean;
54
- promptedAt?: number;
55
- nowMs: number;
56
- cacheTtlMs?: number;
57
- pkg?: string;
58
- }
59
- /**
60
- * `promptedAt` makes a decline stick until the next window instead of asking
61
- * on every launch. It is deliberately not keyed to a dismissed version:
62
- * somebody who says no today should be asked again tomorrow, not silently
63
- * stranded on that version forever.
64
- */
65
- export declare function decideUpdateAction(input: UpdateActionInput): {
66
- action: UpdateAction;
67
- command: string;
68
- };