Skip to content

Commit 2257bd0

Browse files
authored
feat(amazonq): support Dockerfile files in /dev (#6107)
## Problem `Dockerfile` files are not currently supported by /dev ## Solution Add a list of file prefixes that are considered code files for /dev. This approach supports not only `Dockerfile` but also popular variants of this such as `Dockerfile.build`, `Dockerfile-prod`, etc. I manually tested some prompts in /dev with requests. I set breakpoints to see that the file was being zipped up in workspace upload.
1 parent b516e1f commit 2257bd0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Amazon Q /dev: support `Dockerfile` files"
4+
}

packages/core/src/shared/filetypes.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export const codefileExtensions = new Set([
185185
'.d',
186186
'.dart',
187187
'.dfm',
188+
'.dockerfile',
188189
'.dpr',
189190
'.e',
190191
'.el',
@@ -347,8 +348,16 @@ export const codefileExtensions = new Set([
347348
'.zig',
348349
])
349350

351+
// Some well-known code files without an extension
352+
export const wellKnownCodeFiles = new Set(['Dockerfile', 'Dockerfile.build'])
353+
350354
/** Returns true if `filename` is a code file. */
351355
export function isCodeFile(filename: string): boolean {
352-
const ext = path.extname(filename).toLowerCase()
353-
return codefileExtensions.has(ext)
356+
if (codefileExtensions.has(path.extname(filename).toLowerCase())) {
357+
return true
358+
} else if (wellKnownCodeFiles.has(filename)) {
359+
return true
360+
} else {
361+
return false
362+
}
354363
}

0 commit comments

Comments
 (0)