mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
Merge pull request #8996 from Kilo-Org/session/agent_ff4de034-ef4e-4209-a163-ac950e340c4b
fix(cli): add pnpm-lock.yaml and yarn.lock to .kilo/.gitignore
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
---
|
||||
|
||||
Include pnpm-lock.yaml and yarn.lock in the .kilo/.gitignore so lockfiles from alternative package managers don't appear as untracked files
|
||||
@@ -190,7 +190,17 @@ export namespace Config {
|
||||
if (!ignore) {
|
||||
await Filesystem.write(
|
||||
gitignore,
|
||||
["node_modules", "package.json", "package-lock.json", "bun.lock", ".gitignore"].join("\n"),
|
||||
// kilocode_change start - added pnpm-lock.yaml and yarn.lock (not in upstream)
|
||||
[
|
||||
"node_modules",
|
||||
"package.json",
|
||||
"package-lock.json",
|
||||
"pnpm-lock.yaml",
|
||||
"bun.lock",
|
||||
"yarn.lock",
|
||||
".gitignore",
|
||||
].join("\n"),
|
||||
// kilocode_change end
|
||||
)
|
||||
}
|
||||
// kilocode_change start
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// kilocode_change - new file
|
||||
//
|
||||
// Kilo uses @npmcli/arborist instead of bun for dependency installation.
|
||||
// Users may have pnpm or yarn as their system package manager, which can
|
||||
// produce lockfiles in the .kilo/ config directory. These must be ignored
|
||||
// so they don't appear as untracked files in the user's project.
|
||||
|
||||
import { expect, spyOn, test } from "bun:test"
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { Config } from "../../src/config/config"
|
||||
import { Npm } from "../../src/npm"
|
||||
import * as Network from "../../src/util/network"
|
||||
import { Filesystem } from "../../src/util/filesystem"
|
||||
import { tmpdir } from "../fixture/fixture"
|
||||
|
||||
test(".gitignore includes pnpm and yarn lockfile patterns", async () => {
|
||||
await using tmp = await tmpdir()
|
||||
const dir = path.join(tmp.path, "a")
|
||||
await fs.mkdir(dir, { recursive: true })
|
||||
|
||||
const online = spyOn(Network, "online").mockReturnValue(false)
|
||||
const run = spyOn(Npm, "install").mockImplementation(async (d: string) => {
|
||||
const mod = path.join(d, "node_modules", "@kilocode", "plugin")
|
||||
await fs.mkdir(mod, { recursive: true })
|
||||
await Filesystem.write(
|
||||
path.join(mod, "package.json"),
|
||||
JSON.stringify({ name: "@kilocode/plugin", version: "1.0.0" }),
|
||||
)
|
||||
})
|
||||
|
||||
try {
|
||||
await Config.installDependencies(dir)
|
||||
const ignore = await Filesystem.readText(path.join(dir, ".gitignore"))
|
||||
expect(ignore).toContain("pnpm-lock.yaml")
|
||||
expect(ignore).toContain("yarn.lock")
|
||||
} finally {
|
||||
online.mockRestore()
|
||||
run.mockRestore()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user