()
| 304 | } |
| 305 | |
| 306 | private buildEnvironmentDetails(): string { |
| 307 | const files = walkFiles(this.options.cwd, true, 200) |
| 308 | const git = getGitSummary(this.options.cwd) |
| 309 | const now = new Date() |
| 310 | const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone |
| 311 | const timeZoneOffset = -now.getTimezoneOffset() / 60 |
| 312 | const timeZoneOffsetHours = Math.floor(Math.abs(timeZoneOffset)) |
| 313 | const timeZoneOffsetMinutes = Math.abs(Math.round((Math.abs(timeZoneOffset) - timeZoneOffsetHours) * 60)) |
| 314 | const timeZoneOffsetStr = `${timeZoneOffset >= 0 ? "+" : "-"}${timeZoneOffsetHours}:${timeZoneOffsetMinutes.toString().padStart(2, "0")}` |
| 315 | const linkedRepos = renderLinkedReposSection(this.options.cwd) |
| 316 | return `# Environment Details |
| 317 | |
| 318 | ## Current Workspace Directory (${this.options.cwd}) Files |
| 319 | ${files.join("\n") || "(empty directory)"} |
| 320 | ${files.length >= 200 ? "\n(File list truncated.)" : ""} |
| 321 | |
| 322 | ${git} |
| 323 | ${linkedRepos ? `\n${linkedRepos}` : ""} |
| 324 | ## Current Time |
| 325 | Current time in ISO 8601 UTC format: ${now.toISOString()} |
| 326 | User time zone: ${timeZone}, UTC${timeZoneOffsetStr}` |
| 327 | } |
| 328 | |
| 329 | /** Conversation history with internal markers stripped, ready for the model. */ |
| 330 | private outgoingMessages(): OpenAI.Chat.ChatCompletionMessageParam[] { |
no test coverage detected