typeclaw 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -2
  3. package/src/agent/git-nudge.ts +2 -1
  4. package/src/agent/index.ts +67 -25
  5. package/src/agent/live-subagents.ts +18 -0
  6. package/src/agent/loop-guard.ts +208 -10
  7. package/src/agent/multimodal/index.ts +1 -1
  8. package/src/agent/multimodal/look-at.ts +78 -44
  9. package/src/agent/multimodal/looker.ts +151 -39
  10. package/src/agent/network/response-body.ts +26 -0
  11. package/src/agent/network/safe-http.ts +198 -0
  12. package/src/agent/plugin-tools.ts +438 -162
  13. package/src/agent/provider-error.ts +62 -4
  14. package/src/agent/restart/index.ts +61 -40
  15. package/src/agent/restart-handoff/index.ts +73 -4
  16. package/src/agent/retry-same-ref.ts +66 -0
  17. package/src/agent/reviewer-bash-policy.ts +42 -1
  18. package/src/agent/session-origin.ts +2 -0
  19. package/src/agent/subagent-drain.ts +117 -7
  20. package/src/agent/subagents.ts +77 -18
  21. package/src/agent/throttle-circuit.ts +25 -5
  22. package/src/agent/tool-error-remediation.ts +72 -0
  23. package/src/agent/tool-file-safety.ts +1050 -0
  24. package/src/agent/tools/channel-fetch-attachment.ts +10 -3
  25. package/src/agent/tools/channel-reply.ts +15 -1
  26. package/src/agent/tools/channel-send.ts +17 -1
  27. package/src/agent/tools/ddg.ts +16 -2
  28. package/src/agent/tools/post-github-review.ts +199 -0
  29. package/src/agent/tools/spawn-subagent.ts +21 -18
  30. package/src/agent/tools/webfetch/fetch.ts +143 -183
  31. package/src/agent/tools/webfetch/tool.ts +2 -3
  32. package/src/agent/tools/websearch.ts +23 -2
  33. package/src/agent/tools-without-local-file-operands.ts +27 -0
  34. package/src/agent/turn-runner.ts +109 -15
  35. package/src/bundled-plugins/backup/index.ts +2 -1
  36. package/src/bundled-plugins/backup/runner.ts +2 -1
  37. package/src/bundled-plugins/doc-render/render.ts +93 -12
  38. package/src/bundled-plugins/doc-render/skills/typeclaw-render-pdf/SKILL.md +13 -13
  39. package/src/bundled-plugins/github-cli-auth/effective-approval.ts +16 -6
  40. package/src/bundled-plugins/github-cli-auth/gh-command.ts +555 -15
  41. package/src/bundled-plugins/github-cli-auth/index.ts +131 -135
  42. package/src/bundled-plugins/github-cli-auth/review-checkout.ts +138 -0
  43. package/src/bundled-plugins/guard/policies/uncommitted-changes.ts +2 -1
  44. package/src/bundled-plugins/memory/README.md +23 -11
  45. package/src/bundled-plugins/memory/append-tool.ts +15 -8
  46. package/src/bundled-plugins/memory/citations.ts +22 -9
  47. package/src/bundled-plugins/memory/dreaming.ts +13 -8
  48. package/src/bundled-plugins/memory/find-entry-tool.ts +4 -0
  49. package/src/bundled-plugins/memory/index.ts +0 -4
  50. package/src/bundled-plugins/memory/load-memory.ts +8 -3
  51. package/src/bundled-plugins/memory/provenance-index.ts +717 -0
  52. package/src/bundled-plugins/memory/provenance-sanitize.ts +40 -0
  53. package/src/bundled-plugins/memory/references/store-reference-tool.ts +4 -0
  54. package/src/bundled-plugins/memory/search-tool.ts +163 -60
  55. package/src/bundled-plugins/memory/stream-events.ts +2 -0
  56. package/src/bundled-plugins/memory/vector/hybrid.ts +126 -13
  57. package/src/bundled-plugins/researcher/write-report.ts +6 -3
  58. package/src/bundled-plugins/reviewer/index.ts +2 -2
  59. package/src/bundled-plugins/reviewer/reviewer.ts +10 -3
  60. package/src/bundled-plugins/reviewer/skills/code-review.ts +24 -9
  61. package/src/bundled-plugins/scout/scout.ts +8 -0
  62. package/src/bundled-plugins/security/index.ts +4 -4
  63. package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +1 -0
  64. package/src/bundled-plugins/security/policies/private-surface-read.ts +220 -29
  65. package/src/bundled-plugins/security/policies/secret-exfil-read.ts +1 -0
  66. package/src/bundled-plugins/security/policies/ssrf.ts +29 -9
  67. package/src/channels/adapters/discord-bot-channel-resolver.ts +26 -14
  68. package/src/channels/adapters/discord-bot-thread-room.ts +44 -12
  69. package/src/channels/adapters/discord-bot.ts +91 -10
  70. package/src/channels/adapters/discord-channel-resolver.ts +91 -23
  71. package/src/channels/adapters/discord-id.ts +4 -0
  72. package/src/channels/adapters/discord-resolver-cache.ts +41 -0
  73. package/src/channels/adapters/discord.ts +57 -7
  74. package/src/channels/adapters/github/auth-app.ts +41 -12
  75. package/src/channels/adapters/github/index.ts +23 -11
  76. package/src/channels/adapters/github/review-submitter.ts +302 -0
  77. package/src/channels/adapters/kakaotalk-channel-resolver.ts +12 -1
  78. package/src/channels/adapters/kakaotalk-fetch-attachment.ts +8 -4
  79. package/src/channels/adapters/kakaotalk-typing.ts +127 -0
  80. package/src/channels/adapters/kakaotalk.ts +19 -0
  81. package/src/channels/adapters/slack-attachment-download.ts +71 -0
  82. package/src/channels/adapters/slack-bot.ts +19 -8
  83. package/src/channels/adapters/slack-classify.ts +21 -2
  84. package/src/channels/adapters/slack.ts +59 -7
  85. package/src/channels/adapters/telegram-bot.ts +18 -5
  86. package/src/channels/adapters/webex-bot.ts +8 -3
  87. package/src/channels/adapters/webex.ts +8 -3
  88. package/src/channels/fetch-attachment.ts +43 -0
  89. package/src/{bundled-plugins/github-cli-auth/approve-idempotency.ts → channels/github-review-verdict-coordinator.ts} +25 -1
  90. package/src/channels/github-token-bridge.ts +10 -3
  91. package/src/channels/manager.ts +9 -0
  92. package/src/channels/router.ts +568 -12
  93. package/src/channels/types.ts +28 -1
  94. package/src/cli/channel.ts +1 -1
  95. package/src/cli/init.ts +1 -1
  96. package/src/cli/model.ts +57 -7
  97. package/src/compose/stop.ts +17 -5
  98. package/src/config/config.ts +6 -6
  99. package/src/config/models-mutation.ts +13 -1
  100. package/src/config/providers.ts +176 -0
  101. package/src/container/start.ts +49 -10
  102. package/src/doctor/checks.ts +3 -1
  103. package/src/doctor/commit.ts +2 -1
  104. package/src/doctor/file-ownership.ts +52 -0
  105. package/src/dreams/git.ts +2 -1
  106. package/src/git/hookless.ts +5 -0
  107. package/src/git/reconcile-ignored.ts +18 -5
  108. package/src/git/secret-history.ts +371 -0
  109. package/src/git/system-commit.ts +12 -6
  110. package/src/init/dockerfile.ts +86 -5
  111. package/src/init/index.ts +17 -5
  112. package/src/init/models-dev.ts +4 -0
  113. package/src/init/validate-api-key.ts +2 -0
  114. package/src/mcp/tools.ts +16 -3
  115. package/src/permissions/builtins.ts +3 -1
  116. package/src/plugin/context.ts +2 -0
  117. package/src/plugin/index.ts +1 -0
  118. package/src/plugin/manager.ts +4 -0
  119. package/src/plugin/types.ts +21 -0
  120. package/src/run/index.ts +40 -0
  121. package/src/run/llm-fetch-observer.ts +188 -13
  122. package/src/sandbox/build.ts +37 -15
  123. package/src/sandbox/canonical-secrets.ts +18 -0
  124. package/src/sandbox/env-exposure.ts +80 -0
  125. package/src/sandbox/errors.ts +13 -6
  126. package/src/sandbox/hidden-paths.ts +102 -44
  127. package/src/sandbox/index.ts +22 -4
  128. package/src/sandbox/package-install.ts +3 -27
  129. package/src/sandbox/policy.ts +11 -25
  130. package/src/sandbox/privileged-runtime.ts +255 -0
  131. package/src/sandbox/session-tmp.ts +8 -2
  132. package/src/sandbox/writable-zones.ts +204 -140
  133. package/src/secrets/index.ts +8 -0
  134. package/src/secrets/refresh-provider-oauth.ts +128 -0
  135. package/src/server/command-runner.ts +48 -4
  136. package/src/server/index.ts +4 -0
  137. package/src/skills/typeclaw-channel-github/SKILL.md +49 -56
  138. package/src/skills/typeclaw-claude-code/SKILL.md +24 -60
  139. package/src/skills/typeclaw-claude-code/references/auth-flow.md +17 -158
  140. package/src/skills/typeclaw-codex-cli/SKILL.md +19 -49
  141. package/src/skills/typeclaw-codex-cli/references/auth-flow.md +17 -154
  142. package/src/skills/typeclaw-config/SKILL.md +5 -5
  143. package/src/skills/typeclaw-config/references/recommended-mounts.md +24 -24
  144. package/src/skills/typeclaw-github-contributing/SKILL.md +23 -26
  145. package/src/skills/typeclaw-memory/SKILL.md +9 -3
  146. package/src/skills/typeclaw-permissions/SKILL.md +19 -15
  147. package/typeclaw.schema.json +20 -0
@@ -1,5 +1,5 @@
1
1
  import { randomBytes } from 'node:crypto'
2
- import { existsSync } from 'node:fs'
2
+ import { accessSync, constants as fsConstants, existsSync } from 'node:fs'
3
3
  import { cp, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
4
4
  import { tmpdir } from 'node:os'
5
5
  import { isAbsolute, join, relative, resolve } from 'node:path'
@@ -85,6 +85,9 @@ export type PlanStartOptions = {
85
85
  // Defaults to `process.platform`; tests inject it to exercise the native-
86
86
  // Windows dev-source mount branch without running on a Windows host.
87
87
  platform?: NodeJS.Platform
88
+ // POSIX identity whose ownership bind-mounted runtime writes must retain.
89
+ // Omitted when unavailable (native Windows and unusual JS hosts).
90
+ hostIdentity?: { uid: number; gid: number } | null
88
91
  }
89
92
 
90
93
  export type HostDaemonControl = {
@@ -168,6 +171,9 @@ export type StartOptions = {
168
171
  // Defaults to `process.platform`; tests inject it to exercise the
169
172
  // native-Windows dev-link reconcile path off a non-Windows runner.
170
173
  platform?: NodeJS.Platform
174
+ hostIdentity?: { uid: number; gid: number } | null
175
+ // Test seam for the host-stage writable-config preflight.
176
+ assertConfigWritable?: (cwd: string) => void
171
177
  }
172
178
 
173
179
  export type HostDaemonStatus =
@@ -219,6 +225,8 @@ export async function start({
219
225
  verifyRunning = createVerifyRunning({ exec }),
220
226
  runBunLink,
221
227
  platform = process.platform,
228
+ hostIdentity = currentHostIdentity(),
229
+ assertConfigWritable = assertAgentConfigWritable,
222
230
  }: StartOptions): Promise<StartResult> {
223
231
  try {
224
232
  const containerName = containerNameFromCwd(cwd)
@@ -234,6 +242,8 @@ export async function start({
234
242
  return await reportAlreadyRunning(exec, cwd, containerName)
235
243
  }
236
244
 
245
+ assertConfigWritable(cwd)
246
+
237
247
  // TypeClaw owns Dockerfile, .gitignore, and the bun-workspaces shape of
238
248
  // package.json. Refresh them from the current CLI templates on every fresh
239
249
  // start (not just --build) so version drift between the agent folder and
@@ -463,6 +473,7 @@ export async function start({
463
473
  publishHost,
464
474
  tuiToken,
465
475
  platform,
476
+ hostIdentity,
466
477
  })
467
478
 
468
479
  let built = false
@@ -598,6 +609,25 @@ function installedReachesTarget(installed: string, target: string): boolean {
598
609
  return true
599
610
  }
600
611
 
612
+ function currentHostIdentity(): { uid: number; gid: number } | null {
613
+ if (typeof process.getuid !== 'function' || typeof process.getgid !== 'function') return null
614
+ return { uid: process.getuid(), gid: process.getgid() }
615
+ }
616
+
617
+ function assertAgentConfigWritable(cwd: string): void {
618
+ const configPath = join(cwd, 'typeclaw.json')
619
+ if (!existsSync(configPath)) return
620
+ try {
621
+ accessSync(configPath, fsConstants.R_OK | fsConstants.W_OK)
622
+ } catch (error) {
623
+ const detail = error instanceof Error ? error.message : String(error)
624
+ throw new Error(
625
+ `typeclaw.json is not writable by the current host user: ${configPath}. ` +
626
+ `Inspect ownership with \`ls -ln "${configPath}"\` and run \`typeclaw doctor\` for repair guidance. ${detail}`,
627
+ )
628
+ }
629
+ }
630
+
601
631
  export async function planStart({
602
632
  cwd,
603
633
  hostPort,
@@ -607,6 +637,7 @@ export async function planStart({
607
637
  publishHost = '127.0.0.1',
608
638
  tuiToken = null,
609
639
  platform = process.platform,
640
+ hostIdentity = currentHostIdentity(),
610
641
  }: PlanStartOptions): Promise<StartPlan> {
611
642
  const containerName = containerNameFromCwd(cwd)
612
643
  const imageTag = imageTagFromCwd(cwd)
@@ -694,9 +725,9 @@ export async function planStart({
694
725
  }
695
726
 
696
727
  // sandbox.symlinks: the entrypoint shim creates `from -> /agent/<to>` at the
697
- // real container HOME for the UNSANDBOXED (trusted/owner) bash path. The
698
- // low-trust path is handled separately by the per-tool bwrap --symlink op
699
- // (src/sandbox/build.ts). Passed as base64-encoded JSON because `from`/`to`
728
+ // real container HOME for runtime-owned processes. Model-driven bash creates
729
+ // its corresponding link at the bwrap HOME via src/sandbox/build.ts. Passed
730
+ // as base64-encoded JSON because `from`/`to`
700
731
  // are arbitrary operator strings — base64 sidesteps every shell-metachar and
701
732
  // env-quoting hazard; the shim decodes + JSON-parses it with bun. Omitted when
702
733
  // empty so the common case adds no env clutter and the shim's loop never runs.
@@ -729,6 +760,14 @@ export async function planStart({
729
760
  runArgs.push('-e', `TZ=${hostTz}`)
730
761
  }
731
762
 
763
+ // Run the container entrypoint as root for iptables/bootstrap work, then
764
+ // re-exec the TypeClaw runtime under the invoking POSIX host identity. Docker
765
+ // Desktop/OrbStack propagate numeric ownership through the /agent bind mount,
766
+ // so this prevents container-created files from becoming root-owned on host.
767
+ if (platform !== 'win32' && hostIdentity !== null) {
768
+ runArgs.push('-e', `TYPECLAW_HOST_UID=${hostIdentity.uid}`, '-e', `TYPECLAW_HOST_GID=${hostIdentity.gid}`)
769
+ }
770
+
732
771
  // The agent's `restart` tool needs to identify itself to hostd. Inside the
733
772
  // container, cwd is `/agent` and basename(cwd) loses the host folder name,
734
773
  // so we cannot derive containerName from cwd at runtime. Inject it as an
@@ -969,13 +1008,13 @@ async function inspectContainer(exec: DockerExec, name: string): Promise<Inspect
969
1008
  // removal needs the user to act (`docker rm -f <name>` manually, or restart
970
1009
  // Docker) instead of looping forever.
971
1010
  //
972
- // A small bounded backoff (100/200/400ms) follows each cleanup before the
1011
+ // A bounded backoff (100/200/400/800/1200ms) follows each cleanup before the
973
1012
  // next `docker run`. waitForRemoval polls `docker inspect`, which can
974
1013
  // report the container gone BEFORE Docker's internal name-reservation
975
- // table has fully released the name. Without the backoff, the three
976
- // retries can all fire inside the same daemon drain window and exhaust
977
- // uselessly. The cumulative ~700ms is small next to the docker run RTT
978
- // itself and dwarfed by the user-visible cost of a failed start.
1014
+ // table has fully released the name. Without the backoff, the retries can
1015
+ // all fire inside the same daemon drain window and exhaust uselessly. The
1016
+ // cumulative ~2.7s is small next to the docker run RTT itself and dwarfed by
1017
+ // the user-visible cost of a failed start.
979
1018
  //
980
1019
  // Only the name-conflict path engages this destructive retry. Any other
981
1020
  // non-zero exit (port-allocated, image-not-found, permission-denied) is
@@ -999,7 +1038,7 @@ async function execRunWithConflictRetry(
999
1038
  return last
1000
1039
  }
1001
1040
 
1002
- const CONFLICT_RETRY_BACKOFFS_MS = [100, 200, 400] as const
1041
+ const CONFLICT_RETRY_BACKOFFS_MS = [100, 200, 400, 800, 1200] as const
1003
1042
 
1004
1043
  // Idempotent path for `start()`: the named container is already up. Reflect
1005
1044
  // the live container's identity (id) and host port in the result so callers
@@ -23,9 +23,10 @@ import { buildGitignore, GITIGNORE_FILE } from '@/init/gitignore'
23
23
  import { detectWsl, isWindows, isWindowsDriveMount, type WslInfo } from '@/shared'
24
24
 
25
25
  import { buildChannelChecks } from './channel-checks'
26
+ import { agentFileOwnership, type FileOwnershipDeps } from './file-ownership'
26
27
  import type { DoctorCheck } from './types'
27
28
 
28
- export function buildStaticChecks(opts: { dockerExec?: DockerExec } = {}): DoctorCheck[] {
29
+ export function buildStaticChecks(opts: { dockerExec?: DockerExec } & FileOwnershipDeps = {}): DoctorCheck[] {
29
30
  const dockerExec = opts.dockerExec ?? defaultDockerExec
30
31
 
31
32
  return [
@@ -36,6 +37,7 @@ export function buildStaticChecks(opts: { dockerExec?: DockerExec } = {}): Docto
36
37
  agentFolderGitignoreTemplate(),
37
38
  agentFolderNodeModules(),
38
39
  agentFolderGitRepo(),
40
+ agentFileOwnership(opts),
39
41
  configValid(),
40
42
  hostdHomeWritable(),
41
43
  wslDriveMount(),
@@ -1,3 +1,4 @@
1
+ import { hooklessGitArgs } from '@/git/hookless'
1
2
  import { resolveAgentGit } from '@/git/resolve-agent-git'
2
3
 
3
4
  import type { CommitOutcome, FixAttempt } from './types'
@@ -97,7 +98,7 @@ const defaultSpawnGit: SpawnGit = async (args, cwd) => {
97
98
  const bun = (globalThis as { Bun?: { spawn: typeof Bun.spawn } }).Bun
98
99
  if (!bun) return { exitCode: -1, stdout: '', stderr: 'bun runtime not available' }
99
100
  try {
100
- const proc = bun.spawn({ cmd: ['git', ...args], cwd, stdout: 'pipe', stderr: 'pipe' })
101
+ const proc = bun.spawn({ cmd: ['git', ...hooklessGitArgs(args)], cwd, stdout: 'pipe', stderr: 'pipe' })
101
102
  const exitCode = await proc.exited
102
103
  const stdout = await new Response(proc.stdout).text()
103
104
  const stderr = await new Response(proc.stderr).text()
@@ -0,0 +1,52 @@
1
+ import { existsSync, lstatSync, readdirSync } from 'node:fs'
2
+ import { join, relative } from 'node:path'
3
+
4
+ import type { DoctorCheck } from './types'
5
+
6
+ const MANAGED_PATHS = ['typeclaw.json', 'sessions', 'memory', '.typeclaw'] as const
7
+
8
+ export type FileOwnershipDeps = {
9
+ readonly platform?: NodeJS.Platform
10
+ readonly currentUid?: () => number
11
+ }
12
+
13
+ export function agentFileOwnership(deps: FileOwnershipDeps = {}): DoctorCheck {
14
+ const platform = deps.platform ?? process.platform
15
+ const currentUid = deps.currentUid ?? process.getuid
16
+
17
+ return {
18
+ name: 'agent-folder.file-ownership',
19
+ category: 'agent-folder',
20
+ description: 'agent-managed files are owned by the current host user',
21
+ applies: (ctx) => ctx.hasAgentFolder,
22
+ async run(ctx) {
23
+ if (platform === 'win32' || currentUid === undefined) {
24
+ return { status: 'ok', message: 'POSIX ownership does not apply on this host' }
25
+ }
26
+
27
+ const uid = currentUid()
28
+ const foreignPaths: string[] = []
29
+ for (const managedPath of MANAGED_PATHS) {
30
+ collectForeignPaths(join(ctx.cwd, managedPath), ctx.cwd, uid, foreignPaths)
31
+ }
32
+ if (foreignPaths.length === 0) return { status: 'ok', message: 'agent-managed files match the host user' }
33
+
34
+ return {
35
+ status: 'error',
36
+ message: `agent-managed files have a different owner: ${foreignPaths.join(', ')}`,
37
+ details: [
38
+ 'This usually means an older TypeClaw container wrote bind-mounted files as root.',
39
+ `Repair ownership from the agent folder: sudo chown -R "$(id -u):$(id -g)" ${MANAGED_PATHS.join(' ')}`,
40
+ ],
41
+ }
42
+ },
43
+ }
44
+ }
45
+
46
+ function collectForeignPaths(path: string, cwd: string, uid: number, foreignPaths: string[]): void {
47
+ if (!existsSync(path)) return
48
+ const stat = lstatSync(path)
49
+ if (stat.uid !== uid) foreignPaths.push(relative(cwd, path))
50
+ if (!stat.isDirectory()) return
51
+ for (const entry of readdirSync(path)) collectForeignPaths(join(path, entry), cwd, uid, foreignPaths)
52
+ }
package/src/dreams/git.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { hooklessGitArgs } from '@/git/hookless'
1
2
  import { resolveAgentGit } from '@/git/resolve-agent-git'
2
3
 
3
4
  export type GitResult = { exitCode: number; stdout: string; stderr: string }
@@ -87,7 +88,7 @@ const defaultSpawnGit: SpawnGit = async (args, cwd) => {
87
88
  const bun = (globalThis as { Bun?: { spawn: typeof Bun.spawn } }).Bun
88
89
  if (!bun) return { exitCode: -1, stdout: '', stderr: 'bun runtime not available' }
89
90
  try {
90
- const proc = bun.spawn({ cmd: ['git', ...args], cwd, stdout: 'pipe', stderr: 'pipe' })
91
+ const proc = bun.spawn({ cmd: ['git', ...hooklessGitArgs(args)], cwd, stdout: 'pipe', stderr: 'pipe' })
91
92
  const exitCode = await proc.exited
92
93
  const stdout = await new Response(proc.stdout).text()
93
94
  const stderr = await new Response(proc.stderr).text()
@@ -0,0 +1,5 @@
1
+ const HOOKLESS_GIT_CONFIG = ['-c', 'core.hooksPath=/dev/null'] as const
2
+
3
+ export function hooklessGitArgs(args: readonly string[]): string[] {
4
+ return [...HOOKLESS_GIT_CONFIG, ...args]
5
+ }
@@ -4,6 +4,7 @@ import { join } from 'node:path'
4
4
 
5
5
  import { SYSTEM_MANAGED_ROOTS, TRULY_IGNORED_PATTERNS } from '@/init/gitignore'
6
6
 
7
+ import { hooklessGitArgs } from './hookless'
7
8
  import { type AgentGit, resolveAgentGit } from './resolve-agent-git'
8
9
 
9
10
  export type UntrackResult = { untracked: string[] }
@@ -170,7 +171,7 @@ async function listTrackedIgnored(
170
171
  excludeFile: string,
171
172
  ): Promise<string[]> {
172
173
  const proc = bun.spawn({
173
- cmd: ['git', ...gitArgs, 'ls-files', '-z', '-c', '-i', '--exclude-from', excludeFile],
174
+ cmd: ['git', ...hooklessGitArgs([...gitArgs, 'ls-files', '-z', '-c', '-i', '--exclude-from', excludeFile])],
174
175
  cwd,
175
176
  stdout: 'pipe',
176
177
  stderr: 'pipe',
@@ -182,7 +183,7 @@ async function listTrackedIgnored(
182
183
 
183
184
  async function gitRmCached(bun: BunLike, cwd: string, gitArgs: readonly string[], files: string[]): Promise<string[]> {
184
185
  const proc = bun.spawn({
185
- cmd: ['git', ...gitArgs, 'rm', '--cached', '-q', '--', ...files],
186
+ cmd: ['git', ...hooklessGitArgs([...gitArgs, 'rm', '--cached', '-q', '--', ...files])],
186
187
  cwd,
187
188
  stdout: 'pipe',
188
189
  stderr: 'pipe',
@@ -200,7 +201,13 @@ async function run(
200
201
  args: readonly string[],
201
202
  env?: GitEnv,
202
203
  ): Promise<boolean> {
203
- const proc = bun.spawn({ cmd: ['git', ...gitArgs, ...args], cwd, env, stdout: 'pipe', stderr: 'pipe' })
204
+ const proc = bun.spawn({
205
+ cmd: ['git', ...hooklessGitArgs([...gitArgs, ...args])],
206
+ cwd,
207
+ env,
208
+ stdout: 'pipe',
209
+ stderr: 'pipe',
210
+ })
204
211
  return (await proc.exited) === 0
205
212
  }
206
213
 
@@ -211,7 +218,13 @@ async function capture(
211
218
  args: readonly string[],
212
219
  env?: GitEnv,
213
220
  ): Promise<string> {
214
- const proc = bun.spawn({ cmd: ['git', ...gitArgs, ...args], cwd, env, stdout: 'pipe', stderr: 'pipe' })
221
+ const proc = bun.spawn({
222
+ cmd: ['git', ...hooklessGitArgs([...gitArgs, ...args])],
223
+ cwd,
224
+ env,
225
+ stdout: 'pipe',
226
+ stderr: 'pipe',
227
+ })
215
228
  if ((await proc.exited) !== 0) return ''
216
229
  return await new Response(proc.stdout).text()
217
230
  }
@@ -226,7 +239,7 @@ async function forceRemove(
226
239
  env: GitEnv,
227
240
  ): Promise<boolean> {
228
241
  const proc = bun.spawn({
229
- cmd: ['git', ...gitArgs, 'update-index', '-z', '--force-remove', '--stdin'],
242
+ cmd: ['git', ...hooklessGitArgs([...gitArgs, 'update-index', '-z', '--force-remove', '--stdin'])],
230
243
  cwd,
231
244
  env,
232
245
  stdin: new TextEncoder().encode(files.join('\0')),