Files
Kilo-Org_kilo/script/upstream/utils/config.ts
T
Catriel Müller f259b6a90b chore: remove hosted platform packages and update upstream merge config
Remove 8 hosted platform packages that are not needed for the CLI-focused fork:
- infra/ (SST infrastructure)
- packages/console/ (console web app + backend)
- packages/enterprise/ (enterprise/teams platform)
- packages/web/ (Astro documentation site)
- packages/slack/ (Slack integration)
- packages/function/ (API workers)
- packages/docs/ (static docs)
- packages/identity/ (brand assets)

Update upstream merge configuration to prevent these packages from being
re-added during future merges from opencode upstream:
- Add all deleted folders/files to skipFiles in config.ts
- Add Vouch-related files to skip list (VOUCHED.md, vouch workflows)
- Update transform-package-json.ts to preserve Kilo's workspace config
- Remove slack/web references from transform lists

Update supporting files:
- Remove console/* and slack from package.json workspaces
- Remove sst and @aws-sdk/client-s3 dependencies
- Update AGENTS.md package references
- Clean .prettierignore of deleted package references
- Add logs/.gitignore to keep folder empty

Result: 310,297 lines deleted, 11 npm packages removed, typecheck passing
2026-02-11 13:05:19 -03:00

216 lines
5.8 KiB
TypeScript

#!/usr/bin/env bun
/**
* Configuration for upstream merge automation
*/
export interface PackageMapping {
from: string
to: string
}
export interface MergeConfig {
/** Package name mappings from opencode to kilo */
packageMappings: PackageMapping[]
/** Files to always keep Kilo's version (never take upstream changes) */
keepOurs: string[]
/** Files to skip entirely (don't add from upstream, remove if added) */
skipFiles: string[]
/** Files that should take upstream version and apply Kilo branding transforms */
takeTheirsAndTransform: string[]
/** Tauri/Desktop config files with predictable branding patterns */
tauriFiles: string[]
/** Script files with GitHub API references */
scriptFiles: string[]
/** Extension files (Zed, etc.) */
extensionFiles: string[]
/** Web/docs files */
webFiles: string[]
/** Lock files to accept ours and regenerate after merge */
lockFiles: string[]
/** Directories that are Kilo-specific and should be preserved */
kiloDirectories: string[]
/** File patterns to exclude from codemods */
excludePatterns: string[]
/** Default branch to merge into */
baseBranch: string
/** Branch prefix for merge branches */
branchPrefix: string
/** Remote name for upstream */
upstreamRemote: string
/** Remote name for origin */
originRemote: string
/** i18n file patterns that need string transformation */
i18nPatterns: string[]
}
export const defaultConfig: MergeConfig = {
packageMappings: [
{ from: "opencode-ai", to: "@kilocode/cli" },
{ from: "@opencode-ai/cli", to: "@kilocode/cli" },
{ from: "@opencode-ai/sdk", to: "@kilocode/sdk" },
{ from: "@opencode-ai/plugin", to: "@kilocode/plugin" },
],
keepOurs: [
"README.md",
"CONTRIBUTING.md",
"CODE_OF_CONDUCT.md",
"PRIVACY.md",
"SECURITY.md",
"AGENTS.md",
// GitHub workflows - MANUAL REVIEW (can break CI/CD)
".github/workflows/publish-stable.yml",
".github/workflows/publish.yml",
".github/workflows/close-stale-prs.yml",
".github/pull_request_template.md",
// Kilo-specific command files
".opencode/command/commit.md",
// Kilo-specific publish scripts
"packages/opencode/script/publish-registries.ts",
],
// Files that only exist in upstream and should NOT be added to Kilo
// These are removed during merge if they appear
skipFiles: [
// Translated README files (Kilo doesn't have these)
"README.ar.md",
"README.br.md",
"README.bs.md",
"README.da.md",
"README.de.md",
"README.es.md",
"README.fr.md",
"README.it.md",
"README.ja.md",
"README.ko.md",
"README.no.md",
"README.pl.md",
"README.ru.md",
"README.th.md",
"README.tr.md",
"README.zh.md",
"README.zht.md",
// Stats file
"STATS.md",
// Workflows that don't exist in Kilo
".github/workflows/update-nix-hashes.yml",
".github/workflows/deploy.yml",
".github/workflows/docs-update.yml",
".github/workflows/docs-locale-sync.yml",
// Vouch files (Kilo doesn't use Vouch)
".github/VOUCHED.md",
".github/workflows/vouch-check-issue.yml",
".github/workflows/vouch-check-pr.yml",
".github/workflows/vouch-manage-by-issue.yml",
// SST infrastructure files (Kilo is CLI-only, no hosted platform)
"sst.config.ts",
"sst-env.d.ts",
// Hosted platform packages (not needed for CLI)
"infra/**",
"packages/console/**",
"packages/enterprise/**",
"packages/web/**",
"packages/slack/**",
"packages/function/**",
"packages/docs/**",
"packages/identity/**",
],
// Files that should take upstream version and apply Kilo branding transforms
// These are files with only branding differences, no logic changes
takeTheirsAndTransform: [
// App components with branding only
"packages/app/src/components/**/*.tsx",
"packages/app/src/context/**/*.tsx",
"packages/app/src/pages/**/*.tsx",
// UI components
"packages/ui/src/components/**/*.tsx",
"packages/ui/src/context/**/*.tsx",
// Desktop TypeScript files (not Rust)
"packages/desktop/src/**/*.ts",
// E2E and test fixtures
"packages/app/e2e/**/*.ts",
"packages/app/script/**/*.ts",
// GitHub script
"github/index.ts",
],
// Tauri/Desktop config files with predictable branding patterns
tauriFiles: [
"packages/desktop/src-tauri/tauri.conf.json",
"packages/desktop/src-tauri/tauri.prod.conf.json",
"packages/desktop/src-tauri/Cargo.toml",
"packages/desktop/src-tauri/Cargo.lock",
"packages/desktop/src-tauri/src/*.rs",
],
// Script files with GitHub API references
scriptFiles: ["script/*.ts", "packages/opencode/script/*.ts"],
// Extension files
extensionFiles: ["packages/extensions/**/*"],
// Web/docs files
webFiles: [],
// Lock files and generated files to accept ours and regenerate after merge
// Note: nix/hashes.json is regenerated by CI (update-nix-hashes.yml), not locally
lockFiles: [
"bun.lock",
"**/bun.lock",
"package-lock.json",
"**/package-lock.json",
"yarn.lock",
"**/yarn.lock",
"pnpm-lock.yaml",
"**/pnpm-lock.yaml",
"Cargo.lock",
"**/Cargo.lock",
"nix/hashes.json",
],
kiloDirectories: [
"packages/opencode/src/kilocode",
"packages/opencode/test/kilocode",
"packages/kilo-gateway",
"packages/kilo-telemetry",
"script/upstream",
],
excludePatterns: [
"**/node_modules/**",
"**/dist/**",
"**/.git/**",
"**/bun.lock",
"**/package-lock.json",
"**/yarn.lock",
],
baseBranch: "dev",
branchPrefix: "upstream-merge",
upstreamRemote: "upstream",
originRemote: "origin",
// i18n translation files that need Kilo branding transforms
i18nPatterns: ["packages/*/src/i18n/*.ts", "packages/desktop/src/i18n/*.ts"],
}
export function loadConfig(overrides?: Partial<MergeConfig>): MergeConfig {
return { ...defaultConfig, ...overrides }
}