@theia/ai-ide 1.77.0-next.7 → 1.77.0-next.71
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/lib/browser/{project-info-agent.d.ts → agents-md-agent.d.ts} +2 -2
- package/lib/browser/agents-md-agent.d.ts.map +1 -0
- package/lib/browser/{project-info-agent.js → agents-md-agent.js} +16 -15
- package/lib/browser/agents-md-agent.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-label-provider-contribution.js +1 -1
- package/lib/browser/ai-configuration/ai-configuration-label-provider-contribution.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-resource.js +2 -1
- package/lib/browser/ai-configuration/ai-configuration-resource.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-search-widget.js +1 -1
- package/lib/browser/ai-configuration/ai-configuration-search-widget.js.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.d.ts +11 -3
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.d.ts.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.js +64 -29
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.js.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.spec.js +480 -1
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.spec.js.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-detail-model.d.ts +10 -0
- package/lib/browser/ai-configuration/categories/agent-detail-model.d.ts.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-detail-model.js +8 -0
- package/lib/browser/ai-configuration/categories/agent-detail-model.js.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-detail-model.spec.d.ts +2 -0
- package/lib/browser/ai-configuration/categories/agent-detail-model.spec.d.ts.map +1 -0
- package/lib/browser/ai-configuration/categories/agent-detail-model.spec.js +74 -0
- package/lib/browser/ai-configuration/categories/agent-detail-model.spec.js.map +1 -0
- package/lib/browser/ai-configuration/categories/agent-detail-view.d.ts.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-detail-view.js +3 -2
- package/lib/browser/ai-configuration/categories/agent-detail-view.js.map +1 -1
- package/lib/browser/ai-configuration/categories/agents-configuration-category.d.ts +6 -1
- package/lib/browser/ai-configuration/categories/agents-configuration-category.d.ts.map +1 -1
- package/lib/browser/ai-configuration/categories/agents-configuration-category.js +20 -2
- package/lib/browser/ai-configuration/categories/agents-configuration-category.js.map +1 -1
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.js +5 -4
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.js.map +1 -1
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.spec.js +2 -1
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.spec.js.map +1 -1
- package/lib/browser/ai-configuration/categories/token-usage-configuration-category.js +2 -2
- package/lib/browser/ai-configuration/categories/token-usage-configuration-category.js.map +1 -1
- package/lib/browser/ai-configuration/categories/tools-configuration-category.js +1 -1
- package/lib/browser/ai-configuration/categories/tools-configuration-category.js.map +1 -1
- package/lib/browser/ai-configuration/categories/variables-configuration-category.js +1 -1
- package/lib/browser/ai-configuration/categories/variables-configuration-category.js.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.js +8 -15
- package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.spec.js +40 -1
- package/lib/browser/ai-configuration/language-model-renderer.spec.js.map +1 -1
- package/lib/browser/ai-sessions-widget.js +1 -1
- package/lib/browser/ai-sessions-widget.js.map +1 -1
- package/lib/browser/app-tester-prompt-template.d.ts.map +1 -1
- package/lib/browser/app-tester-prompt-template.js +4 -6
- package/lib/browser/app-tester-prompt-template.js.map +1 -1
- package/lib/browser/architect-prompt-template.d.ts.map +1 -1
- package/lib/browser/architect-prompt-template.js +20 -3
- package/lib/browser/architect-prompt-template.js.map +1 -1
- package/lib/browser/chat-session-item.js +2 -1
- package/lib/browser/chat-session-item.js.map +1 -1
- package/lib/browser/chat-sessions-welcome-message-provider.js +1 -1
- package/lib/browser/chat-sessions-welcome-message-provider.js.map +1 -1
- package/lib/browser/code-reviewer-prompt-template.d.ts.map +1 -1
- package/lib/browser/code-reviewer-prompt-template.js +2 -1
- package/lib/browser/code-reviewer-prompt-template.js.map +1 -1
- package/lib/browser/commit-message-agent.spec.js +2 -1
- package/lib/browser/commit-message-agent.spec.js.map +1 -1
- package/lib/browser/commit-message-runner.spec.js +2 -1
- package/lib/browser/commit-message-runner.spec.js.map +1 -1
- package/lib/browser/context-file-validation-service-impl.spec.js +2 -1
- package/lib/browser/context-file-validation-service-impl.spec.js.map +1 -1
- package/lib/browser/explore-prompt-template.d.ts.map +1 -1
- package/lib/browser/explore-prompt-template.js +2 -1
- package/lib/browser/explore-prompt-template.js.map +1 -1
- package/lib/browser/file-changeset-functions.d.ts +3 -1
- package/lib/browser/file-changeset-functions.d.ts.map +1 -1
- package/lib/browser/file-changeset-functions.js +60 -6
- package/lib/browser/file-changeset-functions.js.map +1 -1
- package/lib/browser/file-changeset-functions.spec.js +73 -9
- package/lib/browser/file-changeset-functions.spec.js.map +1 -1
- package/lib/browser/frontend-module.js +4 -4
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/git-changes-tool.d.ts +3 -3
- package/lib/browser/git-changes-tool.d.ts.map +1 -1
- package/lib/browser/git-changes-tool.js +7 -11
- package/lib/browser/git-changes-tool.js.map +1 -1
- package/lib/browser/git-changes-tool.spec.js +16 -3
- package/lib/browser/git-changes-tool.spec.js.map +1 -1
- package/lib/browser/multi-root-paths.spec.d.ts +2 -0
- package/lib/browser/multi-root-paths.spec.d.ts.map +1 -0
- package/lib/browser/multi-root-paths.spec.js +293 -0
- package/lib/browser/multi-root-paths.spec.js.map +1 -0
- package/lib/browser/remember-command-contribution.d.ts +2 -2
- package/lib/browser/remember-command-contribution.js +6 -6
- package/lib/browser/remember-command-contribution.js.map +1 -1
- package/lib/browser/review/pr-review-prompt-template.d.ts.map +1 -1
- package/lib/browser/review/pr-review-prompt-template.js +3 -2
- package/lib/browser/review/pr-review-prompt-template.js.map +1 -1
- package/lib/browser/task-context-file-storage-service.d.ts.map +1 -1
- package/lib/browser/task-context-file-storage-service.js +1 -2
- package/lib/browser/task-context-file-storage-service.js.map +1 -1
- package/lib/browser/task-context-file-storage-service.spec.d.ts +2 -0
- package/lib/browser/task-context-file-storage-service.spec.d.ts.map +1 -0
- package/lib/browser/task-context-file-storage-service.spec.js +111 -0
- package/lib/browser/task-context-file-storage-service.spec.js.map +1 -0
- package/lib/browser/user-interaction-tool-renderer.js +1 -1
- package/lib/browser/user-interaction-tool-renderer.js.map +1 -1
- package/lib/browser/user-interaction-tool.d.ts +12 -1
- package/lib/browser/user-interaction-tool.d.ts.map +1 -1
- package/lib/browser/user-interaction-tool.js +35 -9
- package/lib/browser/user-interaction-tool.js.map +1 -1
- package/lib/browser/user-interaction-tool.spec.js +15 -2
- package/lib/browser/user-interaction-tool.spec.js.map +1 -1
- package/lib/browser/workspace-functions.d.ts +20 -17
- package/lib/browser/workspace-functions.d.ts.map +1 -1
- package/lib/browser/workspace-functions.js +77 -115
- package/lib/browser/workspace-functions.js.map +1 -1
- package/lib/browser/workspace-functions.spec.js +54 -60
- package/lib/browser/workspace-functions.spec.js.map +1 -1
- package/lib/browser/workspace-launch-provider.js +1 -1
- package/lib/browser/workspace-launch-provider.js.map +1 -1
- package/lib/browser/workspace-launch-provider.spec.js +5 -3
- package/lib/browser/workspace-launch-provider.spec.js.map +1 -1
- package/lib/browser/workspace-search-provider.spec.js +2 -1
- package/lib/browser/workspace-search-provider.spec.js.map +1 -1
- package/lib/browser/workspace-task-provider.js +1 -1
- package/lib/browser/workspace-task-provider.js.map +1 -1
- package/lib/browser/workspace-task-provider.spec.js +6 -4
- package/lib/browser/workspace-task-provider.spec.js.map +1 -1
- package/lib/common/agents-md-prompt-template.d.ts +6 -0
- package/lib/common/agents-md-prompt-template.d.ts.map +1 -0
- package/lib/common/agents-md-prompt-template.js +165 -0
- package/lib/common/agents-md-prompt-template.js.map +1 -0
- package/lib/common/coder-replace-prompt-template.d.ts.map +1 -1
- package/lib/common/coder-replace-prompt-template.js +4 -6
- package/lib/common/coder-replace-prompt-template.js.map +1 -1
- package/lib/common/command-prompt-template.js +1 -1
- package/lib/common/command-prompt-template.js.map +1 -1
- package/lib/common/orchestrator-prompt-template.js +1 -1
- package/lib/common/orchestrator-prompt-template.js.map +1 -1
- package/lib/common/universal-prompt-template.js +1 -1
- package/lib/common/universal-prompt-template.js.map +1 -1
- package/lib/common/workspace-preferences.d.ts +1 -0
- package/lib/common/workspace-preferences.d.ts.map +1 -1
- package/lib/common/workspace-preferences.js +10 -1
- package/lib/common/workspace-preferences.js.map +1 -1
- package/lib/package.spec.js +1 -0
- package/lib/package.spec.js.map +1 -1
- package/package.json +27 -28
- package/src/browser/{project-info-agent.ts → agents-md-agent.ts} +11 -10
- package/src/browser/ai-configuration/categories/agent-capabilities-settings.spec.ts +508 -2
- package/src/browser/ai-configuration/categories/agent-capabilities-settings.tsx +92 -33
- package/src/browser/ai-configuration/categories/agent-detail-model.spec.ts +78 -0
- package/src/browser/ai-configuration/categories/agent-detail-model.ts +18 -0
- package/src/browser/ai-configuration/categories/agent-detail-view.tsx +15 -12
- package/src/browser/ai-configuration/categories/agents-configuration-category.tsx +18 -3
- package/src/browser/ai-configuration/categories/provider-model-discovery-section.tsx +3 -3
- package/src/browser/ai-configuration/categories/token-usage-configuration-category.tsx +2 -2
- package/src/browser/ai-configuration/language-model-renderer.spec.ts +38 -0
- package/src/browser/ai-configuration/language-model-renderer.tsx +6 -15
- package/src/browser/app-tester-prompt-template.ts +4 -7
- package/src/browser/architect-prompt-template.ts +4 -4
- package/src/browser/code-reviewer-prompt-template.ts +2 -2
- package/src/browser/context-file-validation-service-impl.spec.ts +2 -1
- package/src/browser/explore-prompt-template.ts +2 -2
- package/src/browser/file-changeset-functions.spec.ts +91 -9
- package/src/browser/file-changeset-functions.ts +62 -7
- package/src/browser/frontend-module.ts +4 -4
- package/src/browser/git-changes-tool.spec.ts +16 -1
- package/src/browser/git-changes-tool.ts +6 -10
- package/src/browser/multi-root-paths.spec.ts +340 -0
- package/src/browser/remember-command-contribution.ts +7 -7
- package/src/browser/review/pr-review-prompt-template.ts +3 -3
- package/src/browser/style/index.css +15 -0
- package/src/browser/task-context-file-storage-service.spec.ts +125 -0
- package/src/browser/task-context-file-storage-service.ts +3 -4
- package/src/browser/user-interaction-tool.spec.ts +18 -1
- package/src/browser/user-interaction-tool.ts +34 -9
- package/src/browser/workspace-functions.spec.ts +54 -60
- package/src/browser/workspace-functions.ts +80 -125
- package/src/browser/workspace-launch-provider.spec.ts +3 -2
- package/src/browser/workspace-task-provider.spec.ts +4 -3
- package/src/common/{project-info-prompt-template.ts → agents-md-prompt-template.ts} +54 -46
- package/src/common/coder-replace-prompt-template.ts +5 -7
- package/src/common/command-prompt-template.ts +1 -1
- package/src/common/orchestrator-prompt-template.ts +1 -1
- package/src/common/universal-prompt-template.ts +1 -1
- package/src/common/workspace-preferences.ts +10 -0
- package/lib/browser/project-info-agent.d.ts.map +0 -1
- package/lib/browser/project-info-agent.js.map +0 -1
- package/lib/common/project-info-prompt-template.d.ts +0 -6
- package/lib/common/project-info-prompt-template.d.ts.map +0 -1
- package/lib/common/project-info-prompt-template.js +0 -146
- package/lib/common/project-info-prompt-template.js.map +0 -1
|
@@ -86,7 +86,6 @@ export class WorkspaceFunctionScope {
|
|
|
86
86
|
private gitignoreMatchers = new Map<string, ReturnType<typeof ignore> | undefined>();
|
|
87
87
|
private gitignoreWatchersInitialized = new Set<string>();
|
|
88
88
|
|
|
89
|
-
private _rootMapping: Map<string, URI> | undefined;
|
|
90
89
|
private _allRootUris: URI[] | undefined;
|
|
91
90
|
|
|
92
91
|
private homeDirUri: Promise<URI | undefined> | undefined;
|
|
@@ -96,7 +95,6 @@ export class WorkspaceFunctionScope {
|
|
|
96
95
|
@postConstruct()
|
|
97
96
|
protected init(): void {
|
|
98
97
|
this.workspaceService.onWorkspaceChanged(() => {
|
|
99
|
-
this._rootMapping = undefined;
|
|
100
98
|
this._allRootUris = undefined;
|
|
101
99
|
});
|
|
102
100
|
}
|
|
@@ -114,56 +112,21 @@ export class WorkspaceFunctionScope {
|
|
|
114
112
|
}
|
|
115
113
|
|
|
116
114
|
/**
|
|
117
|
-
* Returns a mapping of root names to root URIs.
|
|
115
|
+
* Returns a mapping of root names to root URIs, in workspace order.
|
|
118
116
|
*
|
|
119
|
-
* Root names are
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* check (which examines path segments against all roots).
|
|
123
|
-
*
|
|
124
|
-
* **Known limitation:** duplicate basenames are not disambiguated with synthetic
|
|
125
|
-
* suffixes because agents observe real filesystem paths in terminal output,
|
|
126
|
-
* compiler errors, stack traces, etc. Synthetic names like `app-1` would
|
|
127
|
-
* conflict with those observations and cause more confusion than they solve.
|
|
128
|
-
* A future improvement could let users assign display names to roots.
|
|
117
|
+
* Root names are assigned by {@link WorkspaceService.getRootNames}: the directory basename, or for
|
|
118
|
+
* roots sharing a basename, the shortest tail of the path that tells them apart (e.g. `alice/app`
|
|
119
|
+
* and `bob/app`). Every root thus has a name, and names are always the ending of the real path.
|
|
129
120
|
*/
|
|
130
121
|
getRootMapping(): Map<string, URI> {
|
|
131
|
-
|
|
132
|
-
return this._rootMapping;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const wsRoots = this.workspaceService.tryGetRoots();
|
|
136
|
-
const sortedRoots = [...wsRoots].sort((a, b) => a.resource.toString().localeCompare(b.resource.toString()));
|
|
137
|
-
const mapping = new Map<string, URI>();
|
|
138
|
-
|
|
139
|
-
for (const root of sortedRoots) {
|
|
140
|
-
const basename = root.resource.path.base;
|
|
141
|
-
if (mapping.has(basename)) {
|
|
142
|
-
this.logger.debug(
|
|
143
|
-
`Multiple workspace roots share the basename '${basename}'. ` +
|
|
144
|
-
`Only '${mapping.get(basename)!.toString()}' is addressable as '${basename}'. ` +
|
|
145
|
-
`'${root.resource.toString()}' can still be accessed but may require full paths.`
|
|
146
|
-
);
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
mapping.set(basename, root.resource);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
this._rootMapping = mapping;
|
|
153
|
-
return mapping;
|
|
122
|
+
return new Map(this.workspaceService.getRootNames());
|
|
154
123
|
}
|
|
155
124
|
|
|
156
125
|
/**
|
|
157
|
-
* Returns the root name for a given root URI
|
|
126
|
+
* Returns the root name for a given root URI, see {@link WorkspaceService.getRootName}.
|
|
158
127
|
*/
|
|
159
128
|
getRootName(rootUri: URI): string | undefined {
|
|
160
|
-
|
|
161
|
-
for (const [name, uri] of mapping) {
|
|
162
|
-
if (uri.toString() === rootUri.toString()) {
|
|
163
|
-
return name;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return undefined;
|
|
129
|
+
return this.workspaceService.getRootName(rootUri);
|
|
167
130
|
}
|
|
168
131
|
|
|
169
132
|
/**
|
|
@@ -185,26 +148,11 @@ export class WorkspaceFunctionScope {
|
|
|
185
148
|
}
|
|
186
149
|
|
|
187
150
|
/**
|
|
188
|
-
* Converts a URI to a workspace-relative path with root name prefix.
|
|
151
|
+
* Converts a URI to a workspace-relative path with root name prefix, see {@link WorkspaceService.getRootPrefixedPath}.
|
|
189
152
|
* Format: <rootName>/<relativePath>
|
|
190
153
|
*/
|
|
191
154
|
toWorkspaceRelativePath(uri: URI): string | undefined {
|
|
192
|
-
|
|
193
|
-
if (!containingRoot) {
|
|
194
|
-
return undefined;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const rootName = this.getRootName(containingRoot);
|
|
198
|
-
if (!rootName) {
|
|
199
|
-
return undefined;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const relativePath = containingRoot.relative(uri);
|
|
203
|
-
if (!relativePath || relativePath.toString() === '') {
|
|
204
|
-
return rootName; // URI is the root itself
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return `${rootName}/${relativePath.toString()}`;
|
|
155
|
+
return this.getContainingRoot(uri) ? this.workspaceService.getRootPrefixedPath(uri) : undefined;
|
|
208
156
|
}
|
|
209
157
|
|
|
210
158
|
// ── Path resolution ─────────────────────────────────────────────────
|
|
@@ -215,57 +163,33 @@ export class WorkspaceFunctionScope {
|
|
|
215
163
|
* format. If the path cannot be resolved deterministically, an error is thrown.
|
|
216
164
|
*
|
|
217
165
|
* Resolution order:
|
|
218
|
-
* 1. Root+relative:
|
|
166
|
+
* 1. Root+relative: the path starts with a root name → resolve the rest relative to that root.
|
|
219
167
|
* 2. Supra-relative: a root's basename appears as a segment, and any preceding material
|
|
220
168
|
* matches the preceding path components of the root → resolve the trailing portion.
|
|
169
|
+
* If this matches different files in several roots, the path is ambiguous.
|
|
221
170
|
* 3. Single-root fallback: if exactly one workspace root, resolve relative to it.
|
|
222
171
|
* 4. Error: tell the agent how to format the path.
|
|
223
172
|
*/
|
|
224
173
|
resolveRelativePath(relativePath: string): URI {
|
|
225
174
|
const normalizedPath = new Path(Path.normalizePathSeparator(relativePath)).normalize().toString();
|
|
226
|
-
const mapping = this.getRootMapping();
|
|
227
175
|
const roots = this.getAllRootUris();
|
|
228
|
-
const segments = normalizedPath.split('/');
|
|
229
176
|
|
|
230
177
|
// Phase 1 — Root+relative check:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (rootUri) {
|
|
235
|
-
const restOfPath = segments.slice(1).join('/');
|
|
236
|
-
return restOfPath ? rootUri.resolve(restOfPath) : rootUri;
|
|
237
|
-
}
|
|
178
|
+
const rootRelative = this.workspaceService.resolveRootPrefixedPath(normalizedPath);
|
|
179
|
+
if (rootRelative) {
|
|
180
|
+
return rootRelative;
|
|
238
181
|
}
|
|
239
182
|
|
|
240
183
|
// Phase 2 — Supra-relative check:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
let matches = true;
|
|
252
|
-
if (pathPrecedingSegments.length > rootPrecedingSegments.length) {
|
|
253
|
-
matches = false;
|
|
254
|
-
} else {
|
|
255
|
-
const rootTail = rootPrecedingSegments.slice(rootPrecedingSegments.length - pathPrecedingSegments.length);
|
|
256
|
-
for (let j = 0; j < pathPrecedingSegments.length; j++) {
|
|
257
|
-
if (pathPrecedingSegments[j] !== rootTail[j]) {
|
|
258
|
-
matches = false;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if (matches) {
|
|
265
|
-
const restOfPath = segments.slice(i + 1).join('/');
|
|
266
|
-
return restOfPath ? rootUri.resolve(restOfPath) : rootUri;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
184
|
+
const candidates = this.workspaceService.resolveSupraRelativePath(normalizedPath);
|
|
185
|
+
if (candidates.length === 1) {
|
|
186
|
+
return candidates[0];
|
|
187
|
+
}
|
|
188
|
+
if (candidates.length > 1) {
|
|
189
|
+
throw new Error(
|
|
190
|
+
`Path '${relativePath}' is ambiguous in this multi-root workspace. ` +
|
|
191
|
+
`Prefix it with one of the workspace root names: ${this.describeRoots()}`
|
|
192
|
+
);
|
|
269
193
|
}
|
|
270
194
|
|
|
271
195
|
// Phase 3 — Single-root fallback:
|
|
@@ -274,13 +198,19 @@ export class WorkspaceFunctionScope {
|
|
|
274
198
|
}
|
|
275
199
|
|
|
276
200
|
// Phase 4 — Error:
|
|
277
|
-
const rootNames = Array.from(mapping.keys());
|
|
278
201
|
throw new Error(
|
|
279
202
|
`Could not resolve path '${relativePath}'. In a multi-root workspace, prefix paths with the workspace root name ` +
|
|
280
|
-
`(e.g., 'rootName/path/to/file'). Available roots: ${
|
|
203
|
+
`(e.g., 'rootName/path/to/file'). Available roots: ${this.describeRoots()}`
|
|
281
204
|
);
|
|
282
205
|
}
|
|
283
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Lists the workspace root names with their locations, for error messages.
|
|
209
|
+
*/
|
|
210
|
+
protected describeRoots(): string {
|
|
211
|
+
return Array.from(this.getRootMapping(), ([name, uri]) => `${name} (${uri.path.fsPath()})`).join(', ');
|
|
212
|
+
}
|
|
213
|
+
|
|
284
214
|
async resolveToUri(pathOrUri: string | URI): Promise<URI | undefined> {
|
|
285
215
|
if (pathOrUri instanceof URI) {
|
|
286
216
|
return pathOrUri;
|
|
@@ -658,7 +588,8 @@ export class GetWorkspaceDirectoryStructure implements ToolProvider {
|
|
|
658
588
|
properties: {
|
|
659
589
|
root: {
|
|
660
590
|
type: 'string',
|
|
661
|
-
description: 'Optional
|
|
591
|
+
description: 'Optional directory to inspect instead of the whole workspace: a workspace-relative path (\'rootName/path\'), ' +
|
|
592
|
+
'an absolute path or a `file://` URI. ' +
|
|
662
593
|
'Must point to a directory the tools may access, such as one listed in the `allowedExternalPaths` preference. ' +
|
|
663
594
|
'When omitted, all workspace roots are returned.'
|
|
664
595
|
}
|
|
@@ -1309,6 +1240,9 @@ export class FindFilesByPattern implements ToolProvider {
|
|
|
1309
1240
|
@inject(FileSearchService)
|
|
1310
1241
|
protected readonly fileSearchService: FileSearchService;
|
|
1311
1242
|
|
|
1243
|
+
@inject(WorkspaceService)
|
|
1244
|
+
protected readonly workspaceService: WorkspaceService;
|
|
1245
|
+
|
|
1312
1246
|
getTool(): ToolRequest {
|
|
1313
1247
|
return {
|
|
1314
1248
|
id: FindFilesByPattern.ID,
|
|
@@ -1327,23 +1261,27 @@ export class FindFilesByPattern implements ToolProvider {
|
|
|
1327
1261
|
properties: {
|
|
1328
1262
|
pattern: {
|
|
1329
1263
|
type: 'string',
|
|
1330
|
-
description: 'Glob pattern to match files against. ' +
|
|
1264
|
+
description: 'Glob pattern to match files against, relative to each workspace root. ' +
|
|
1265
|
+
'Start it with a root name, as in the returned paths, to match it relative to that root as well. ' +
|
|
1331
1266
|
'Examples: \'**/*.ts\' (all TypeScript files), \'src/**/*.js\' (JS files in src), ' +
|
|
1267
|
+
'\'my-project/src/**/*.js\' (JS files in src of the my-project root, or in my-project/src of any root), ' +
|
|
1332
1268
|
'\'**/*.{js,ts}\' (JS or TS files), \'**/test/**/*.spec.ts\' (test files).'
|
|
1333
1269
|
},
|
|
1334
1270
|
exclude: {
|
|
1335
1271
|
type: 'array',
|
|
1336
1272
|
items: { type: 'string' },
|
|
1337
|
-
description: 'Optional glob patterns to exclude. ' +
|
|
1273
|
+
description: 'Optional glob patterns to exclude, relative to each workspace root or starting with a root name. ' +
|
|
1338
1274
|
'Examples: [\'**/*.spec.ts\', \'**/node_modules/**\']. ' +
|
|
1339
1275
|
'Common exclusions (node_modules, .git) are applied automatically via gitignore.'
|
|
1340
1276
|
},
|
|
1341
1277
|
searchRoot: {
|
|
1342
1278
|
type: 'string',
|
|
1343
|
-
description: 'Optional
|
|
1279
|
+
description: 'Optional directory to search instead of the whole workspace: a workspace-relative path ' +
|
|
1280
|
+
'(\'rootName/path\'), an absolute path or a `file://` URI. ' +
|
|
1344
1281
|
'Must point to a directory the tools may access, such as one listed in the `allowedExternalPaths` preference. ' +
|
|
1345
|
-
'
|
|
1346
|
-
'
|
|
1282
|
+
'Results in the workspace are workspace-relative, results outside of it are absolute paths, ' +
|
|
1283
|
+
'so they can be passed back to getFileContent. ' +
|
|
1284
|
+
'When omitted (default), all workspace roots are searched.'
|
|
1347
1285
|
}
|
|
1348
1286
|
},
|
|
1349
1287
|
required: ['pattern']
|
|
@@ -1385,54 +1323,59 @@ export class FindFilesByPattern implements ToolProvider {
|
|
|
1385
1323
|
const maxResults = 200;
|
|
1386
1324
|
const useGitIgnore = this.preferences.get(CONSIDER_GITIGNORE_PREF, true);
|
|
1387
1325
|
const userExcludes = this.preferences.get<string[]>(USER_EXCLUDE_PATTERN_PREF, []);
|
|
1388
|
-
const excludes = [...userExcludes, ...(excludePatterns ?? [])];
|
|
1389
1326
|
|
|
1390
1327
|
// Resolve the set of roots to search and how each root's results should be rendered.
|
|
1391
|
-
const targets: { rootUri: URI; rootName?: string; external: boolean }[] = [];
|
|
1328
|
+
const targets: { rootUri: URI; rootName?: string; external: boolean; patterns: string[] }[] = [];
|
|
1392
1329
|
if (searchRoot) {
|
|
1393
1330
|
const resolved = await this.workspaceScope.resolveAccessiblePath(searchRoot);
|
|
1394
|
-
targets.push({ rootUri: resolved, external: !this.workspaceScope.isInWorkspace(resolved) });
|
|
1331
|
+
targets.push({ rootUri: resolved, external: !this.workspaceScope.isInWorkspace(resolved), patterns: [pattern] });
|
|
1395
1332
|
} else {
|
|
1396
1333
|
const rootMapping = this.workspaceScope.getRootMapping();
|
|
1397
1334
|
if (rootMapping.size === 0) {
|
|
1398
1335
|
return JSON.stringify({ error: 'No workspace has been opened yet' });
|
|
1399
1336
|
}
|
|
1400
1337
|
for (const [rootName, rootUri] of rootMapping) {
|
|
1401
|
-
targets.push({ rootUri, rootName, external: false });
|
|
1338
|
+
targets.push({ rootUri, rootName, external: false, patterns: this.globsForRoot([pattern], rootUri) });
|
|
1402
1339
|
}
|
|
1403
1340
|
}
|
|
1404
1341
|
|
|
1405
1342
|
// Delegate the actual traversal to the backend ripgrep-based file search.
|
|
1406
1343
|
// It runs natively on the backend filesystem (no per-directory RPC) and applies
|
|
1407
1344
|
// include/exclude globs.
|
|
1408
|
-
|
|
1345
|
+
// A file in a nested root is found in the outer root as well, if the glob matches it relative to either.
|
|
1346
|
+
const found = new Map<string, { uri: URI; display: string }>();
|
|
1409
1347
|
for (const target of targets) {
|
|
1410
1348
|
if (cancellationToken?.isCancellationRequested) {
|
|
1411
1349
|
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
1412
1350
|
}
|
|
1413
|
-
if (
|
|
1351
|
+
if (found.size > maxResults) {
|
|
1414
1352
|
break;
|
|
1415
1353
|
}
|
|
1354
|
+
const excludes = [...userExcludes, ...this.globsForRoot(excludePatterns ?? [], target.rootUri)];
|
|
1416
1355
|
// `considerGitIgnore` is scoped to workspace roots (see its preference description),
|
|
1417
1356
|
// so external allow-listed roots are searched with user/caller excludes only (plus
|
|
1418
1357
|
// `.git`). Applying gitignore there would also leak the user's *global* gitignore
|
|
1419
1358
|
// into an explicitly allow-listed directory and silently hide files.
|
|
1420
|
-
// Request one extra result across all roots so we can detect truncation
|
|
1359
|
+
// Request one extra result across all roots so we can detect truncation, besides the files
|
|
1360
|
+
// of this root that were found in a nested or outer root already.
|
|
1361
|
+
const foundInRoot = Array.from(found.values()).filter(file => target.rootUri.isEqualOrParent(file.uri)).length;
|
|
1421
1362
|
const matches = await this.fileSearchService.find('', {
|
|
1422
1363
|
rootUris: [target.rootUri.toString()],
|
|
1423
|
-
includePatterns:
|
|
1364
|
+
includePatterns: target.patterns,
|
|
1424
1365
|
excludePatterns: target.external ? [...excludes, '.git'] : excludes,
|
|
1425
1366
|
useGitIgnore: target.external ? false : useGitIgnore,
|
|
1426
1367
|
fuzzyMatch: false,
|
|
1427
|
-
limit: maxResults -
|
|
1368
|
+
limit: maxResults - found.size + 1 + foundInRoot
|
|
1428
1369
|
}, cancellationToken);
|
|
1429
1370
|
for (const match of matches) {
|
|
1430
|
-
const
|
|
1371
|
+
const matchUri = new URI(match);
|
|
1372
|
+
const display = this.toDisplayPath(matchUri, target);
|
|
1431
1373
|
if (display !== undefined) {
|
|
1432
|
-
|
|
1374
|
+
found.set(matchUri.toString(), { uri: matchUri, display });
|
|
1433
1375
|
}
|
|
1434
1376
|
}
|
|
1435
1377
|
}
|
|
1378
|
+
const files = Array.from(found.values(), file => file.display);
|
|
1436
1379
|
|
|
1437
1380
|
if (cancellationToken?.isCancellationRequested) {
|
|
1438
1381
|
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
@@ -1452,19 +1395,31 @@ export class FindFilesByPattern implements ToolProvider {
|
|
|
1452
1395
|
}
|
|
1453
1396
|
}
|
|
1454
1397
|
|
|
1398
|
+
/**
|
|
1399
|
+
* Returns the caller's globs to match relative to the given root. A glob is relative to every root,
|
|
1400
|
+
* and if it starts with the name of this root, e.g. `backend/src/**\/*.ts` as in the paths this tool
|
|
1401
|
+
* returns, its rest is relative to this root as well, as the caller may mean either.
|
|
1402
|
+
*/
|
|
1403
|
+
protected globsForRoot(globs: string[], rootUri: URI): string[] {
|
|
1404
|
+
const result: string[] = [];
|
|
1405
|
+
for (const glob of globs) {
|
|
1406
|
+
result.push(glob);
|
|
1407
|
+
const rootPrefixed = this.workspaceService.splitRootPrefixedPath(glob);
|
|
1408
|
+
if (rootPrefixed?.rest && rootPrefixed.rootUri.isEqual(rootUri)) {
|
|
1409
|
+
result.push(rootPrefixed.rest);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
return result;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1455
1415
|
/**
|
|
1456
1416
|
* Renders a search-result URI in the format expected by the caller: an absolute
|
|
1457
|
-
* path for external roots, or a `<rootName>/<relativePath>`
|
|
1458
|
-
* path when no root name is available) for workspace roots.
|
|
1417
|
+
* path for external roots, or a `<rootName>/<relativePath>` for workspace roots.
|
|
1459
1418
|
*/
|
|
1460
1419
|
protected toDisplayPath(match: URI, target: { rootUri: URI; rootName?: string; external: boolean }): string | undefined {
|
|
1461
1420
|
if (target.external) {
|
|
1462
1421
|
return match.path.fsPath();
|
|
1463
1422
|
}
|
|
1464
|
-
|
|
1465
|
-
if (relativePath === undefined) {
|
|
1466
|
-
return undefined;
|
|
1467
|
-
}
|
|
1468
|
-
return target.rootName ? `${target.rootName}/${relativePath}` : relativePath;
|
|
1423
|
+
return this.workspaceScope.toWorkspaceRelativePath(match) ?? match.path.fsPath();
|
|
1469
1424
|
}
|
|
1470
1425
|
}
|
|
@@ -40,6 +40,7 @@ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
|
40
40
|
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
41
41
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
42
42
|
import { MockLogger } from '@theia/core/lib/common/test/mock-logger';
|
|
43
|
+
import { withWorkspaceServiceDefaults } from '@theia/workspace/lib/browser/test/with-workspace-service-defaults';
|
|
43
44
|
|
|
44
45
|
const makeTrustAwareReader = (): AiConfigurationService => ({
|
|
45
46
|
get: <T>(_name: string, fallback?: T) => fallback,
|
|
@@ -87,7 +88,7 @@ describe('Launch Management Tool Providers', () => {
|
|
|
87
88
|
onWorkspaceChanged: () => ({ dispose: () => { } })
|
|
88
89
|
} as unknown as WorkspaceService;
|
|
89
90
|
|
|
90
|
-
container.bind(WorkspaceService).toConstantValue(mockWorkspaceService);
|
|
91
|
+
container.bind(WorkspaceService).toConstantValue(withWorkspaceServiceDefaults(mockWorkspaceService));
|
|
91
92
|
container.bind(FileService).toConstantValue({} as FileService);
|
|
92
93
|
container.bind(PreferenceService).toConstantValue({ get: () => false } as unknown as PreferenceService);
|
|
93
94
|
container.bind(AiConfigurationService).toConstantValue(makeTrustAwareReader());
|
|
@@ -396,7 +397,7 @@ describe('Launch Management Tool Providers', () => {
|
|
|
396
397
|
onWorkspaceChanged: () => ({ dispose: () => { } })
|
|
397
398
|
} as unknown as WorkspaceService;
|
|
398
399
|
|
|
399
|
-
multiRootContainer.bind(WorkspaceService).toConstantValue(multiRootWorkspaceService);
|
|
400
|
+
multiRootContainer.bind(WorkspaceService).toConstantValue(withWorkspaceServiceDefaults(multiRootWorkspaceService));
|
|
400
401
|
multiRootContainer.bind(FileService).toConstantValue({} as FileService);
|
|
401
402
|
multiRootContainer.bind(PreferenceService).toConstantValue({ get: () => false } as unknown as PreferenceService);
|
|
402
403
|
multiRootContainer.bind(AiConfigurationService).toConstantValue(makeTrustAwareReader());
|
|
@@ -29,6 +29,7 @@ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
|
29
29
|
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
30
30
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
31
31
|
import { MockLogger } from '@theia/core/lib/common/test/mock-logger';
|
|
32
|
+
import { withWorkspaceServiceDefaults } from '@theia/workspace/lib/browser/test/with-workspace-service-defaults';
|
|
32
33
|
|
|
33
34
|
const makeTrustAwareReader = (): AiConfigurationService => ({
|
|
34
35
|
get: <T>(_name: string, fallback?: T) => fallback,
|
|
@@ -127,7 +128,7 @@ describe('Workspace Task Provider Cancellation Tests', () => {
|
|
|
127
128
|
// Register mocks in the container
|
|
128
129
|
container.bind(TaskService).toConstantValue(mockTaskService);
|
|
129
130
|
container.bind(TerminalService).toConstantValue(mockTerminalService);
|
|
130
|
-
container.bind(WorkspaceService).toConstantValue(mockWorkspaceService);
|
|
131
|
+
container.bind(WorkspaceService).toConstantValue(withWorkspaceServiceDefaults(mockWorkspaceService));
|
|
131
132
|
container.bind(FileService).toConstantValue({} as FileService);
|
|
132
133
|
container.bind(PreferenceService).toConstantValue({ get: () => false } as unknown as PreferenceService);
|
|
133
134
|
container.bind(AiConfigurationService).toConstantValue(makeTrustAwareReader());
|
|
@@ -361,7 +362,7 @@ describe('Workspace Task Provider Cancellation Tests', () => {
|
|
|
361
362
|
|
|
362
363
|
multiRootContainer.bind(TaskService).toConstantValue(multiRootTaskService);
|
|
363
364
|
multiRootContainer.bind(TerminalService).toConstantValue(mockTerminalService);
|
|
364
|
-
multiRootContainer.bind(WorkspaceService).toConstantValue(multiRootWorkspaceService);
|
|
365
|
+
multiRootContainer.bind(WorkspaceService).toConstantValue(withWorkspaceServiceDefaults(multiRootWorkspaceService));
|
|
365
366
|
multiRootContainer.bind(FileService).toConstantValue({} as FileService);
|
|
366
367
|
multiRootContainer.bind(PreferenceService).toConstantValue({ get: () => false } as unknown as PreferenceService);
|
|
367
368
|
multiRootContainer.bind(AiConfigurationService).toConstantValue(makeTrustAwareReader());
|
|
@@ -409,7 +410,7 @@ describe('Workspace Task Provider Cancellation Tests', () => {
|
|
|
409
410
|
|
|
410
411
|
multiRootContainer.bind(TaskService).toConstantValue(multiRootTaskService);
|
|
411
412
|
multiRootContainer.bind(TerminalService).toConstantValue(mockTerminalService);
|
|
412
|
-
multiRootContainer.bind(WorkspaceService).toConstantValue(multiRootWorkspaceService);
|
|
413
|
+
multiRootContainer.bind(WorkspaceService).toConstantValue(withWorkspaceServiceDefaults(multiRootWorkspaceService));
|
|
413
414
|
multiRootContainer.bind(FileService).toConstantValue({} as FileService);
|
|
414
415
|
multiRootContainer.bind(PreferenceService).toConstantValue({ get: () => false } as unknown as PreferenceService);
|
|
415
416
|
multiRootContainer.bind(AiConfigurationService).toConstantValue(makeTrustAwareReader());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable @
|
|
1
|
+
/* eslint-disable @theia/file-header */
|
|
2
2
|
// *****************************************************************************
|
|
3
3
|
// Copyright (C) 2025 EclipseSource GmbH and others.
|
|
4
4
|
//
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
//
|
|
9
9
|
// SPDX-License-Identifier: MIT
|
|
10
10
|
// *****************************************************************************
|
|
11
|
-
import { PromptVariantSet } from '@theia/ai-core/lib/common';
|
|
11
|
+
import { AGENTS_MD_FILE_NAME, PromptVariantSet } from '@theia/ai-core/lib/common';
|
|
12
12
|
import {
|
|
13
13
|
GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, SEARCH_IN_WORKSPACE_FUNCTION_ID,
|
|
14
14
|
FIND_FILES_BY_PATTERN_FUNCTION_ID
|
|
@@ -22,65 +22,69 @@ import {
|
|
|
22
22
|
CLEAR_FILE_CHANGES_ID
|
|
23
23
|
} from './file-changeset-function-ids';
|
|
24
24
|
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
25
|
+
export const AGENTS_MD_SYSTEM_PROMPT_TEMPLATE_ID = 'agents-md-system';
|
|
26
|
+
export const AGENTS_MD_TEMPLATE_PROMPT_ID = 'agents-md-template';
|
|
27
27
|
|
|
28
|
-
export const
|
|
29
|
-
id:
|
|
28
|
+
export const agentsMdTemplateVariants = <PromptVariantSet>{
|
|
29
|
+
id: AGENTS_MD_TEMPLATE_PROMPT_ID,
|
|
30
30
|
defaultVariant: {
|
|
31
|
-
id: '
|
|
32
|
-
template: `##
|
|
31
|
+
id: 'agents-md-template-default',
|
|
32
|
+
template: `## ${AGENTS_MD_FILE_NAME} Structure
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
${AGENTS_MD_FILE_NAME} is schema-free Markdown; these headings are a starting point, not a contract.
|
|
35
|
+
Drop any section the project has nothing non-obvious to say about.
|
|
36
36
|
|
|
37
|
-
###
|
|
38
|
-
[
|
|
39
|
-
|
|
40
|
-
### Essential Development Patterns
|
|
41
|
-
Examples for key patterns (refer via relative file paths)
|
|
37
|
+
### Project Overview
|
|
38
|
+
[What the project does, and the key architectural decisions and patterns that shape it.]
|
|
42
39
|
|
|
43
|
-
###
|
|
44
|
-
[
|
|
40
|
+
### Key Technologies
|
|
41
|
+
[Main technologies, frameworks and libraries, with the versions that matter.]
|
|
45
42
|
|
|
46
43
|
### Build & Development
|
|
47
|
-
[How to build and
|
|
44
|
+
[How to build, run and debug the project. Exact commands.]
|
|
48
45
|
|
|
49
46
|
### Testing
|
|
50
|
-
[
|
|
47
|
+
[Which kinds of tests exist, how they are organized and how to run a single one. Examples as relative file paths.]
|
|
51
48
|
|
|
52
|
-
###
|
|
53
|
-
[Coding standards, conventions
|
|
49
|
+
### Code Style
|
|
50
|
+
[Coding standards, conventions and practices. Rules for imports and formatting. Examples as relative file paths.]
|
|
51
|
+
|
|
52
|
+
### Project Structure
|
|
53
|
+
[Important directories and packages, and what belongs in each.]
|
|
54
|
+
|
|
55
|
+
### Essential Patterns
|
|
56
|
+
[Project-specific patterns an agent has to follow, each pointing at an example via a relative file path.]
|
|
54
57
|
|
|
55
58
|
### Additional Notes
|
|
56
|
-
[
|
|
57
|
-
\`\`\`
|
|
59
|
+
[Anything else needed to understand the project and write code for it, including further documentation as relative file paths.]
|
|
58
60
|
`
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
|
|
62
|
-
export const
|
|
63
|
-
id:
|
|
64
|
+
export const agentsMdSystemVariants = <PromptVariantSet>{
|
|
65
|
+
id: AGENTS_MD_SYSTEM_PROMPT_TEMPLATE_ID,
|
|
64
66
|
defaultVariant: {
|
|
65
|
-
id: '
|
|
67
|
+
id: 'agents-md-system-default',
|
|
66
68
|
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
67
69
|
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
68
70
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
69
71
|
# Instructions
|
|
70
72
|
|
|
71
|
-
You are the
|
|
72
|
-
and maintain the
|
|
73
|
+
You are the ${AGENTS_MD_FILE_NAME} agent, an AI assistant specialized in project context for AI agents. Your role is to help users create, update
|
|
74
|
+
and maintain the \`${AGENTS_MD_FILE_NAME}\` file at the root of the workspace, which follows the open [${AGENTS_MD_FILE_NAME} standard](https://agents.md/)
|
|
75
|
+
and provides project context to other AI agents. Because it is a standard, the file you produce is also read by other agentic tools the user may
|
|
76
|
+
use on the same repository — write it for agents in general, not for one particular tool.
|
|
73
77
|
|
|
74
|
-
##
|
|
75
|
-
|
|
78
|
+
## ${AGENTS_MD_FILE_NAME} Guidelines
|
|
79
|
+
${AGENTS_MD_FILE_NAME} is handed to agents so they understand the current workspace, project and codebase.
|
|
76
80
|
Do not include obvious instructions, generic information, generic development practices or things that can be very easily discovered.
|
|
77
81
|
Focus on non-obvious and project-specific facts as well as specific guidelines and patterns.
|
|
78
|
-
|
|
82
|
+
Keep it minimal and avoid duplicates: every line costs context in every session that reads it.
|
|
79
83
|
|
|
80
84
|
## Your Capabilities
|
|
81
85
|
|
|
82
|
-
### Initially Create
|
|
83
|
-
For initial
|
|
86
|
+
### Initially Create ${AGENTS_MD_FILE_NAME}
|
|
87
|
+
For initial creation, start by determining the user's preferred working mode:
|
|
84
88
|
|
|
85
89
|
**Step 1: Define mode of working**
|
|
86
90
|
Ask the user about the preferred working mode:
|
|
@@ -90,32 +94,32 @@ Ask the user about the preferred working mode:
|
|
|
90
94
|
|
|
91
95
|
IMPORTANT: Remember the chosen mode and stick to it until the user requests otherwise!
|
|
92
96
|
|
|
93
|
-
- In automatic mode, create an initial version
|
|
97
|
+
- In automatic mode, create an initial version yourself by exploring the workspace
|
|
94
98
|
- In manual mode, guide the user section by section and ask for additional information.
|
|
95
99
|
Whenever you ask a question to the user, offer the option that you answer the question for them.
|
|
96
100
|
|
|
97
101
|
**Step 2: Final tasks**
|
|
98
102
|
After completing all sections or if you feel the user is done, offer the user to do an automatic refinement:
|
|
99
|
-
"Would you like me to review and finalize the
|
|
100
|
-
- In this final refinement, particularly focus on relevance and potential duplications and the "
|
|
103
|
+
"Would you like me to review and finalize the ${AGENTS_MD_FILE_NAME}?",
|
|
104
|
+
- In this final refinement, particularly focus on relevance and potential duplications and the "${AGENTS_MD_FILE_NAME} Guidelines"
|
|
101
105
|
- Then, ask for final user review. Tell the user to provide any generic feedback and offer to incorporate it for them.
|
|
102
106
|
- Finally remind them to accept the final version in the change set
|
|
103
107
|
|
|
104
|
-
### Complete
|
|
105
|
-
- If
|
|
108
|
+
### Complete ${AGENTS_MD_FILE_NAME}
|
|
109
|
+
- If the file is incomplete, offer the user to complete it
|
|
106
110
|
|
|
107
|
-
### Update
|
|
108
|
-
- Modify existing
|
|
111
|
+
### Update ${AGENTS_MD_FILE_NAME}
|
|
112
|
+
- Modify the existing file based on user requirements
|
|
109
113
|
- Do not use a specific workflow for this
|
|
110
114
|
|
|
111
115
|
## Workspace Analysis Guidelines
|
|
112
116
|
|
|
113
117
|
**Auto-Discovery File Patterns**
|
|
114
118
|
When auto-discovering project information or exploring the workspace structure, ALWAYS prioritize examining these file patterns that commonly contain agent instructions
|
|
115
|
-
and project documentation
|
|
119
|
+
and project documentation. Where a project already maintains one of them, treat it as a source to consolidate into \`${AGENTS_MD_FILE_NAME}\`,
|
|
120
|
+
and tell the user which files you drew from so they can decide whether to keep them:
|
|
116
121
|
- .github/copilot-instructions.md
|
|
117
122
|
- AGENT.md
|
|
118
|
-
- AGENTS.md
|
|
119
123
|
- CLAUDE.md
|
|
120
124
|
- .cursorrules
|
|
121
125
|
- .windsurfrules
|
|
@@ -140,13 +144,17 @@ Navigate step-by-step and confirm paths. Use **~{${UPDATE_CONTEXT_FILES_FUNCTION
|
|
|
140
144
|
|
|
141
145
|
## File Modification - SUGGEST ONLY
|
|
142
146
|
Use these functions liberally to suggest file changes. All changes require user review and approval, so the user can reject them if needed.
|
|
147
|
+
Always target \`${AGENTS_MD_FILE_NAME}\` at the root of the workspace root the user is working in.
|
|
143
148
|
|
|
144
|
-
- **~{${SUGGEST_FILE_CONTENT_ID}}**: Propose complete file content (for creating new
|
|
149
|
+
- **~{${SUGGEST_FILE_CONTENT_ID}}**: Propose complete file content (for creating a new file or complete rewrites)
|
|
145
150
|
- **~{${SUGGEST_FILE_REPLACEMENTS_ID}}**: Propose targeted replacements of specific text sections
|
|
146
151
|
- **~{${GET_PROPOSED_CHANGES_ID}}**: View current proposed changes before making additional ones
|
|
147
152
|
- **~{${CLEAR_FILE_CHANGES_ID}}**: Clear all pending changes for a file to start fresh
|
|
148
153
|
|
|
149
|
-
{
|
|
154
|
+
${AGENTS_MD_FILE_NAME} is plain Markdown read as-is by every tool that supports the standard. Never write prompt template syntax
|
|
155
|
+
(\`{{...}}\` or \`~{...}\`) into it — those references are not resolved and end up as literal text.
|
|
156
|
+
|
|
157
|
+
{{prompt:${AGENTS_MD_TEMPLATE_PROMPT_ID}}}
|
|
150
158
|
|
|
151
159
|
## Additional Context
|
|
152
160
|
|
|
@@ -154,11 +162,11 @@ Use these functions liberally to suggest file changes. All changes require user
|
|
|
154
162
|
|
|
155
163
|
## Workflow Guidelines
|
|
156
164
|
|
|
157
|
-
When creating
|
|
165
|
+
When creating ${AGENTS_MD_FILE_NAME} for the first time:
|
|
158
166
|
1. **Always start by asking about the user's preferred mode** (auto-exploration or manual) and stick to it
|
|
159
167
|
2. **After initial suggestions or provided content**: Always ask for refinement and additional information
|
|
160
168
|
|
|
161
|
-
Remember: Proactively help users maintain accurate project
|
|
169
|
+
Remember: Proactively help users maintain accurate project context for better AI assistance.
|
|
162
170
|
`
|
|
163
171
|
}
|
|
164
172
|
};
|