refactor: clean kilo artifacts before compat commit

This commit is contained in:
Catriel Müller
2026-03-16 19:45:59 -03:00
parent a01e8e5bfb
commit c29dcdcc60
3 changed files with 22 additions and 0 deletions
+7
View File
@@ -362,6 +362,13 @@ async function main() {
const keepOursResults = await resetToOurs(config.keepOurs, { dryRun: false, verbose: options.verbose })
logger.success(`Reset ${keepOursResults.length} files to Kilo's version`)
// Clean untracked build artifacts from Kilo-specific directories.
// These packages don't exist in upstream, so their .gitignore files are absent
// on the opencode branch. Artifacts like bin/, out/, .next/ etc. would otherwise
// be picked up by the git add -A below.
logger.info("Cleaning Kilo-specific directory artifacts...")
await git.cleanDirectories(config.kiloDirectories)
// Commit all transformations
await git.stageAll()
await git.commit(`refactor: kilo compat for ${targetVersion.tag}`)
+4
View File
@@ -203,6 +203,10 @@ export const defaultConfig: MergeConfig = {
"packages/opencode/test/kilocode",
"packages/kilo-gateway",
"packages/kilo-telemetry",
"packages/kilo-vscode",
"packages/kilo-ui",
"packages/kilo-docs",
"packages/kilo-i18n",
"script/upstream",
],
+11
View File
@@ -215,6 +215,17 @@ export async function checkoutTheirs(files: string[]): Promise<void> {
}
}
/**
* Remove untracked files and directories from specific directories.
* Used to clean build artifacts from Kilo-specific directories after checking
* out the upstream branch, where package-level .gitignore files don't exist.
*/
export async function cleanDirectories(dirs: string[]): Promise<void> {
for (const dir of dirs) {
await $`git clean -fd ${dir}`.quiet().nothrow()
}
}
/**
* Check if the "ours" version of a conflicted file contains kilocode_change markers.
* Uses git stage :2: which is the "ours" side during a merge conflict.