qwen-code/scripts
易良 585589ac67
fix(dev): install hooks during worktree bootstrap (#11496)
* fix(dev): install hooks during worktree bootstrap

* fix(dev): keep worktree hook setup out of the shared git config

Husky runs `git config core.hooksPath .husky/_` with no --worktree, so
from a linked worktree the value lands in the config every worktree of
the repository shares while `.husky/_` is created only in the checkout
being bootstrapped. Skip the Husky step and report it when the key is
unset and this checkout does not own the repository config, so a
bootstrap can no longer repoint hook resolution for roots that never
received the wrappers. A primary checkout still installs hooks, and an
already-configured `core.hooksPath` is untouched.

Also drop the caller's success exit, which `install()` made unreachable
when it started exiting on every successful path, and bring the
pnpm-worktree-bootstrap design doc in line with a hook step it still
recorded as deliberately skipped.

The new fixture runs the real script against a throwaway root whose
`.git` is a file or a directory and whose config comes from a real
`git init` repo, which makes both new branches reachable and pins the
fail-closed guard: the injected `GIT_CONFIG_*` constant holds one value
for the child's whole lifetime and cannot express the unset state that
asks husky to write.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmtuo29vduf

* fix(dev): ask git which root owns the worktree hook config

`ownsRepositoryConfig()` inferred repository-config ownership from the
filesystem shape of `.git`, and the proxy is wrong at both ends. With no
`.git` at all, `statSync(..., { throwIfNoEntry: false })` returns `undefined`
and the predicate folded that absence into "owns the config", so a
repository-less checkout ran husky into its `.git can't be found` soft failure
(exit 0) and the fail-closed check then turned a successful dependency install
into exit 1 blaming Husky. A `.git` file is not only a linked worktree either:
`git clone --separate-git-dir` checkouts and submodules have one too and do own
their config, so hooks were declined where they would have been correctly
scoped.

Ask git instead: `rev-parse --git-dir` differs from `--git-common-dir` only in
a linked worktree, and a failed `rev-parse` names the no-repository state, so
the skip notice stops asserting "linked worktree" and the bootstrap does not
gain a hard git dependency.

Also bind the fail-closed check to an artefact husky's own write produced, not
only to the config value. husky 9.1.7 exits 0 on every soft-failure path
(`index.js:16` git command not found, `index.js:17` refused `git config` write)
before the `mkdirSync(_())` on line 19, and a linked worktree inherits
`core.hooksPath` from the config it shares, so re-reading that value compared
it against itself and passed exactly when husky had created nothing.

Restore the registry-fallback case's hermeticity: `PATH` holds only the stub
directory again, which now also pins that the retry needs no ambient git.
Rebuild the ownership fixture from real git layouts, because `rev-parse`
resolves nothing for a `mkdirSync`'d `.git` or a hand-written `gitdir:` file,
and give the stub husky a failing mode so the exit code husky returns is pinned
rather than the install result's.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmtuys2rjuu

* fix(dev): surface hooks-path read failures in worktree bootstrap

- getHooksPath() no longer collapses a refused git config read (exit 128/2/3) into "unset": only an absent key (exit 1) or a missing git binary keeps the skip path; anything else fails the bootstrap with the read error instead of a green, hook-less worktree.

- The linked-worktree skip notice now names the recovery path: re-run this script once the primary checkout has hooks installed.

- Tests cover a git stub exiting 128, the real-world unset HUSKY state, and pin the recovery sentence in the skip notice.

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-09-10 09:44:47 +00:00
..
codemod feat(opentui): bundle assets, CI matrix and parity tooling (Batch 7) (#10770) 2026-09-02 08:36:20 +00:00
installation feat(release): add gated bun/OpenTUI preview flavor to standalone releases (#10814) 2026-09-02 12:01:56 +00:00
lib refactor(ci): extract release workflow scripts (#11165) 2026-09-08 07:09:09 +00:00
tests fix(dev): install hooks during worktree bootstrap (#11496) 2026-09-10 09:44:47 +00:00
tui-parity fix(cli): Align OpenTUI mid-turn submit and exit with ink (#10883) 2026-09-03 09:31:05 +00:00
acp-http-smoke.mjs feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
assert-release-version.mjs refactor(ci): extract release workflow scripts (#11165) 2026-09-08 07:09:09 +00:00
audit-runtime-critical.js ci: keep the critical-audit gate honest when npm cannot answer (#7743) 2026-07-26 06:59:13 +00:00
benchmark-api-latency.mjs ci: make the Prettier lane a real gate (#11117) 2026-09-07 00:44:01 +00:00
build-hosted-installation-assets.js fix(installer): auto-detect SYSTEM account and default PATH scope to machine (#4903) 2026-06-10 21:02:10 +08:00
build-standalone-release.js feat(release): add gated bun/OpenTUI preview flavor to standalone releases (#10814) 2026-09-02 12:01:56 +00:00
build.js refactor!: retire @qwen-code/webui (#9812) 2026-09-05 09:13:54 +00:00
build_package.js fix(build): clean stale outputs before tsc --build to prevent TS5055 (#4453) 2026-05-23 23:06:31 +08:00
build_sandbox.js fix(release): stop hiding sandbox build failures and check the prepared package early (#10784) 2026-09-02 11:38:33 +00:00
build_vscode_companion.js
check-build-status.js fix(cli): scope startup warnings to dev sessions (#8456) 2026-08-29 13:22:34 +00:00
check-core-subpath-exports.mjs perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
check-desktop-isolation.js fix(live): restore Live Host after desktop removal (#9994) 2026-08-25 12:32:31 +00:00
check-i18n.ts fix(cli): localize approval mode UI labels (#6592) 2026-07-11 00:07:03 +00:00
check-lockfile.js perf(dev): add pnpm worktree bootstrap foundation (#10449) 2026-09-08 03:07:40 +00:00
check-serve-fast-path-bundle.js refactor(core,cli): rename generic Gemini identifiers to Llm (#10124) 2026-08-28 03:05:49 +00:00
check-tui-dep-direction.mjs feat(cli): OpenTUI migration infra batch — locked deps, dependency-direction arch check, framework-neutral streaming model (#10134) 2026-08-28 02:44:46 +00:00
clean-package-build-artifacts.js feat(channels): add DingTalk Workspace channel (#9394) 2026-08-25 06:40:47 +00:00
clean.js feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
cli-entry.js fix(cli): preserve Qwen Review startup version in footers (#8431) 2026-08-04 14:58:56 +00:00
copy_bundle_assets.js perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485) 2026-09-10 07:15:32 +00:00
copy_files.js refactor(core): move review skill incident narratives to DESIGN.md (#8499) 2026-08-04 12:41:18 +00:00
create-standalone-package.js perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485) 2026-09-10 07:15:32 +00:00
create_alias.sh
daemon-dev.js feat(serve): add workspace-scoped Skills runtime (#10697) 2026-09-05 08:03:24 +00:00
dev.js perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
esbuild-shims.js perf(cli): code-split lowlight to cut startup V8 parse cost (#4070) 2026-05-15 17:26:18 +08:00
generate-changelog.js feat(release): user-facing bilingual digest for release notes (#9216) 2026-08-17 00:12:04 +00:00
generate-git-commit-info.js
generate-release-notes.js feat(release): user-facing bilingual digest for release notes (#9216) 2026-08-17 00:12:04 +00:00
generate-settings-schema.ts revert: remove local PR verification gate (#7031) 2026-07-16 11:24:38 +00:00
get-release-version.js refactor(ci): extract release workflow scripts (#11165) 2026-09-08 07:09:09 +00:00
lint.js ci: make the Prettier lane a real gate (#11117) 2026-09-07 00:44:01 +00:00
local_telemetry.js
measure-flicker.mjs ci: make the Prettier lane a real gate (#11117) 2026-09-07 00:44:01 +00:00
pnpm-package.js perf(dev): add pnpm worktree bootstrap foundation (#10449) 2026-09-08 03:07:40 +00:00
pre-commit.js
prepare-package.js perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485) 2026-09-10 07:15:32 +00:00
prepare.js feat(web-shell): git status chip, visual working-tree diff, and sidebar git status (#7054) 2026-07-18 10:06:07 +00:00
pty-e2e.sh feat(opentui): bundle assets, CI matrix and parity tooling (Batch 7) (#10770) 2026-09-02 08:36:20 +00:00
release-script-utils.js feat(installer): add standalone hosted install and uninstall flow (#3828) 2026-05-21 11:57:10 +08:00
review-audit-layers.mts feat(review): cover modeled-system defect layers in the reverse audit (#8956) 2026-08-12 18:15:11 +00:00
run-java-daemon-sdk-e2e.ts ci: reduce SDK Java runner queueing (#8441) 2026-08-03 16:21:05 +00:00
sandbox_command.js fix(scripts): avoid shell injection in sandbox command detection (#6108) 2026-07-01 16:20:40 +08:00
sdk-node-exporter-stub.js chore(deps): Clear high-severity CVE baseline and harden the security gate (#9584) 2026-08-21 07:43:32 +00:00
setup-worktree.js fix(dev): install hooks during worktree bootstrap (#11496) 2026-09-10 09:44:47 +00:00
sign-release.sh feat(cli): add standalone auto-update support (#4629) 2026-06-04 22:53:12 +08:00
start.js fix(cli): scope startup warnings to dev sessions (#8456) 2026-08-29 13:22:34 +00:00
telemetry.js feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
telemetry_gcp.js
telemetry_utils.js feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
test-rewind-e2e.sh
test-windows-paths.js
tmux-compare.sh feat(opentui): bundle assets, CI matrix and parity tooling (Batch 7) (#10770) 2026-09-02 08:36:20 +00:00
unused-keys-only-in-locales.json feat: add /diff command and git diff statistics utility (#3491) 2026-05-10 11:15:59 +08:00
upload-aliyun-oss-assets.js ci: host PR evidence outside Git (#9985) 2026-08-29 04:36:57 +00:00
verify-capture.mjs refactor!: retire @qwen-code/webui (#9812) 2026-09-05 09:13:54 +00:00
verify-installation-release.js feat(release): add gated bun/OpenTUI preview flavor to standalone releases (#10814) 2026-09-02 12:01:56 +00:00
version.js feat(external-context): Publish the Mem0 Extension package (#10653) 2026-09-01 22:12:00 +00:00
vitest-global-setup.js feat(channels): add DingTalk Workspace channel (#9394) 2026-08-25 06:40:47 +00:00
workspaces.js ci: give every workspace the shared-pool test timeout, not just five (#10915) 2026-09-07 09:02:39 +00:00