codeep 2.14.0 → 2.16.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.
Files changed (70) hide show
  1. package/README.md +47 -27
  2. package/dist/acp/commands.js +22 -1
  3. package/dist/acp/server.js +13 -2
  4. package/dist/acp/session.js +22 -1
  5. package/dist/config/index.d.ts +10 -0
  6. package/dist/config/index.js +2 -2
  7. package/dist/config/providers.js +35 -24
  8. package/dist/renderer/App.d.ts +77 -30
  9. package/dist/renderer/App.js +429 -659
  10. package/dist/renderer/agentExecution.d.ts +1 -0
  11. package/dist/renderer/agentExecution.js +3 -2
  12. package/dist/renderer/commands/helpers.d.ts +251 -0
  13. package/dist/renderer/commands/helpers.js +450 -0
  14. package/dist/renderer/commands/registry.js +7 -1
  15. package/dist/renderer/commands.d.ts +4 -0
  16. package/dist/renderer/commands.js +363 -318
  17. package/dist/renderer/components/ActionFormatting.d.ts +17 -0
  18. package/dist/renderer/components/ActionFormatting.js +67 -0
  19. package/dist/renderer/components/Autocomplete.d.ts +58 -0
  20. package/dist/renderer/components/Autocomplete.js +75 -0
  21. package/dist/renderer/components/Intro.d.ts +9 -0
  22. package/dist/renderer/components/Intro.js +5 -15
  23. package/dist/renderer/components/MessageFormatter.d.ts +96 -0
  24. package/dist/renderer/components/MessageFormatter.js +375 -0
  25. package/dist/renderer/components/Permission.d.ts +4 -0
  26. package/dist/renderer/components/Permission.js +1 -1
  27. package/dist/renderer/components/Status.d.ts +4 -0
  28. package/dist/renderer/components/Status.js +2 -3
  29. package/dist/renderer/components/WelcomeFormatter.d.ts +19 -0
  30. package/dist/renderer/components/WelcomeFormatter.js +79 -0
  31. package/dist/renderer/components/uiConstants.d.ts +8 -0
  32. package/dist/renderer/components/uiConstants.js +24 -0
  33. package/dist/renderer/inputParsing.d.ts +22 -0
  34. package/dist/renderer/inputParsing.js +28 -0
  35. package/dist/renderer/layout.d.ts +219 -0
  36. package/dist/renderer/layout.js +338 -0
  37. package/dist/renderer/main.d.ts +2 -1
  38. package/dist/renderer/main.js +79 -11
  39. package/dist/renderer/ollamaHint.d.ts +12 -0
  40. package/dist/renderer/ollamaHint.js +29 -0
  41. package/dist/utils/agentChat.js +23 -1
  42. package/dist/utils/codeepCloud.d.ts +54 -0
  43. package/dist/utils/codeepCloud.js +95 -0
  44. package/dist/utils/diffPreview.d.ts +31 -0
  45. package/dist/utils/diffPreview.js +102 -0
  46. package/dist/utils/export.d.ts +12 -0
  47. package/dist/utils/export.js +3 -3
  48. package/dist/utils/git.d.ts +28 -0
  49. package/dist/utils/git.js +111 -1
  50. package/dist/utils/hooks.d.ts +26 -0
  51. package/dist/utils/hooks.js +69 -1
  52. package/dist/utils/keychain.js +45 -29
  53. package/dist/utils/logger.d.ts +12 -0
  54. package/dist/utils/logger.js +1 -1
  55. package/dist/utils/mcpConfig.d.ts +26 -0
  56. package/dist/utils/mcpConfig.js +109 -4
  57. package/dist/utils/mentions.d.ts +195 -0
  58. package/dist/utils/mentions.js +672 -0
  59. package/dist/utils/skillBundles.d.ts +14 -0
  60. package/dist/utils/skillBundles.js +3 -3
  61. package/dist/utils/skillBundlesCloud.d.ts +7 -0
  62. package/dist/utils/skillBundlesCloud.js +1 -1
  63. package/dist/utils/tokenTracker.js +21 -5
  64. package/dist/utils/toolParsing.d.ts +11 -0
  65. package/dist/utils/toolParsing.js +6 -0
  66. package/dist/utils/webFetch.d.ts +101 -0
  67. package/dist/utils/webFetch.js +375 -0
  68. package/dist/version.d.ts +1 -1
  69. package/dist/version.js +1 -1
  70. package/package.json +2 -2
@@ -0,0 +1,195 @@
1
+ /**
2
+ * `@-mention` context expansion for the CLI chat input.
3
+ *
4
+ * When the user types `@path/to/file.ts` inline in their prompt, we
5
+ * detect those mentions, read the file contents, and inject them as an
6
+ * "[Attached files]" block prepended to the prompt — same format as the
7
+ * explicit `/add` command, so the agent sees a single, consistent shape.
8
+ *
9
+ * Supported mention forms (case-sensitive `@`):
10
+ * @src/index.ts → relative-to-project-root file
11
+ * @./local.ts → relative-to-cwd file
12
+ * @/abs/path.ts → absolute path
13
+ * @"path with space.ts" → quoted (spaces/special chars allowed)
14
+ * @'path with space.ts' → single-quoted variant
15
+ *
16
+ * A `@` immediately followed by whitespace, another `@`, or a non-path
17
+ * character (e.g. an email like `user@host`, or a GitHub `@handle`) is
18
+ * left untouched.
19
+ *
20
+ * Mentions are resolved against the project root (or cwd when no
21
+ * project is open). Files larger than `MAX_MENTION_BYTES` are skipped
22
+ * with a warning rather than silently truncated — the user should
23
+ * explicitly `/add` very large files if they really want them.
24
+ */
25
+ /** Max file size we'll auto-inline from a mention (100 KB). */
26
+ export declare const MAX_MENTION_BYTES: number;
27
+ /** Result of expanding `@-mentions` in a prompt. */
28
+ export interface MentionExpansionResult {
29
+ /** The prompt with file contents prepended (or the original if no mentions). */
30
+ enrichedPrompt: string;
31
+ /**
32
+ * The prompt with each mention's `@` sigil removed but WITHOUT the attached
33
+ * block — i.e. `enrichedPrompt` minus its header. Callers that merge several
34
+ * expanders into one block need this: parsing the block back out of
35
+ * `enrichedPrompt` with a regex silently left the file bodies behind and
36
+ * attached every mentioned file twice.
37
+ */
38
+ strippedPrompt: string;
39
+ /** Successfully loaded files: `[fullPath, relativePath, content][]`. */
40
+ loaded: Array<{
41
+ fullPath: string;
42
+ relativePath: string;
43
+ content: string;
44
+ }>;
45
+ /** Mentions that couldn't be resolved, with a human-readable reason. */
46
+ failures: Array<{
47
+ mention: string;
48
+ reason: string;
49
+ }>;
50
+ }
51
+ /**
52
+ * The raw text of a mention match (without the leading `@`).
53
+ * Used internally by the tokenizer.
54
+ */
55
+ interface MentionToken {
56
+ /** Full match including `@`, for replacement. */
57
+ raw: string;
58
+ /** The path portion (without quotes if it was quoted). */
59
+ path: string;
60
+ /** Start index in the source string. */
61
+ start: number;
62
+ /** End index (exclusive). */
63
+ end: number;
64
+ }
65
+ /**
66
+ * The single source of truth for "may a mention start after this character?".
67
+ * `MENTION_RE`'s lookbehind above and the editor's `detectMentionQuery` picker
68
+ * MUST agree — when they diverged, the picker happily completed mentions
69
+ * (e.g. after `]`) that the expander then ignored, so the file silently never
70
+ * got attached. Import this rather than re-spelling the class.
71
+ */
72
+ export declare const MENTION_BOUNDARY: RegExp;
73
+ /**
74
+ * Extract all `@-mention` tokens from `text`. Returns them in document
75
+ * order. Pure (no FS) — testable without touching the disk.
76
+ */
77
+ export declare function extractMentions(text: string): MentionToken[];
78
+ export interface MentionExpansionOptions {
79
+ /**
80
+ * The root directory mentions are resolved against when they're
81
+ * relative (not starting with `/` or `.`). Usually the project root
82
+ * or `process.cwd()`.
83
+ */
84
+ root: string;
85
+ }
86
+ /**
87
+ * Expand all `@-mentions` in `prompt`: load each referenced file,
88
+ * prepend the contents as an `[Attached files]` block, and strip the
89
+ * `@path` tokens from the visible prompt (replacing them with a bare
90
+ * path so the agent still sees what was referenced).
91
+ *
92
+ * Failures (missing file, too large, not a file) are collected and
93
+ * returned rather than thrown — the caller decides how to surface them.
94
+ */
95
+ export declare function expandMentions(prompt: string, opts: MentionExpansionOptions): MentionExpansionResult;
96
+ /**
97
+ * Max total bytes of file content we'll inline from a single `@folder`
98
+ * mention (200 KB). Prevents a huge directory from blowing the context
99
+ * window — the user can raise this via explicit `/add` if they really
100
+ * want everything.
101
+ */
102
+ export declare const MAX_FOLDER_BYTES: number;
103
+ /** One `@folder <path>` mention match. */
104
+ interface FolderToken {
105
+ /** Full match including `@folder `, for display in failures. */
106
+ raw: string;
107
+ /** The path portion (after `@folder `). */
108
+ path: string;
109
+ /** Start index of the match (pointing at the `@`). */
110
+ start: number;
111
+ /** End index (exclusive). */
112
+ end: number;
113
+ }
114
+ /**
115
+ * Extract all `@folder`/`@dir` mentions from `text`. Pure (no FS).
116
+ * Returns them in document order.
117
+ */
118
+ export declare function extractFolderMentions(text: string): FolderToken[];
119
+ /**
120
+ * Expand all `@folder`/`@dir` mentions in `prompt`: recursively read
121
+ * every source file under each directory, and return them in the same
122
+ * shape as `expandMentions` (so the caller can merge the results).
123
+ *
124
+ * Skips the same ignored directories (`node_modules`, `.git`, …) and
125
+ * binary/generated extensions as the autocomplete scanner. Caps total
126
+ * content per mention at `MAX_FOLDER_BYTES` so a single huge tree
127
+ * can't blow the context window.
128
+ *
129
+ * Sync (filesystem reads only) — call before or after `expandMentions`.
130
+ */
131
+ export declare function expandFolderMentions(prompt: string, opts: MentionExpansionOptions): MentionExpansionResult;
132
+ /**
133
+ * Expand both `@folder` and `@file` mentions in one pass, merging the
134
+ * loaded files into a single `[Attached files]` block (instead of two
135
+ * separate blocks when called back-to-back).
136
+ *
137
+ * `@web` mentions are async and handled separately in `webFetch.ts`.
138
+ */
139
+ export declare function expandFileAndFolderMentions(prompt: string, opts: MentionExpansionOptions): MentionExpansionResult;
140
+ /** Format the `[Attached files]` block prepended to the enriched prompt. */
141
+ export declare function formatFileBlock(files: Array<{
142
+ relativePath: string;
143
+ content: string;
144
+ }>): string;
145
+ export interface MentionSuggestion {
146
+ /** Display label for the picker (e.g. `src/index.ts`). */
147
+ label: string;
148
+ /** The path to insert after `@` when picked. */
149
+ insertPath: string;
150
+ /** A short hint — the file's directory or type. */
151
+ detail: string;
152
+ }
153
+ export interface SuggestOptions {
154
+ /** Root directory to scan. */
155
+ root: string;
156
+ /** Filter prefix typed so far (e.g. `src/ind` from `@src/ind`). */
157
+ query?: string;
158
+ /** Max suggestions to return. */
159
+ limit?: number;
160
+ /** Extra directories to skip (merged with the defaults). */
161
+ extraIgnoreDirs?: string[];
162
+ }
163
+ /**
164
+ * Build (or reuse from cache) the flat list of suggestible files under
165
+ * `root`, then filter by `query`. The scan walks up to `maxScan` files,
166
+ * skipping ignored directories and binary/generated extensions.
167
+ */
168
+ export declare function suggestMentions(opts: SuggestOptions): MentionSuggestion[];
169
+ /** Clear the suggestion cache. Call between tests so fixtures don't leak. */
170
+ export declare function clearSuggestionCache(): void;
171
+ /** True if `fullPath`'s basename looks like it holds secrets. */
172
+ export declare function isSensitiveFile(fullPath: string): boolean;
173
+ /** One `@git <ref>` mention match. */
174
+ interface GitToken {
175
+ raw: string;
176
+ ref: string;
177
+ start: number;
178
+ end: number;
179
+ }
180
+ /**
181
+ * Extract all `@git <ref>` mentions from `text`. Pure (no FS / no git).
182
+ */
183
+ export declare function extractGitMentions(text: string): GitToken[];
184
+ /**
185
+ * Expand all `@git <ref>` mentions in `prompt`: resolve each ref to
186
+ * git content (diff, file-at-ref, or commit patch) and inject it as
187
+ * a `[Git ref]` block. Sync (git is run via `execSync`).
188
+ *
189
+ * The block is appended *after* any `[Attached files]` block from
190
+ * `@folder`/`@file` expansion, so the final prompt reads:
191
+ *
192
+ * [Attached files] … [Git ref] … <user text>
193
+ */
194
+ export declare function expandGitMentions(prompt: string, opts: MentionExpansionOptions): Promise<MentionExpansionResult>;
195
+ export {};