jioogen 0.2.8 → 0.2.9

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 (163) hide show
  1. package/authoring-pack/agent/core.md +10 -4
  2. package/authoring-pack/agent/discovery.md +1 -1
  3. package/authoring-pack/agent/prd.md +7 -3
  4. package/authoring-pack/agent/specs.md +10 -6
  5. package/authoring-pack/agent/tasks.md +12 -8
  6. package/authoring-pack/knowledge/catalog.generated.json +465 -3
  7. package/authoring-pack/knowledge/library/discovery/discovery-standard.md +47 -3
  8. package/authoring-pack/knowledge/library/gamedev/K-GAME-001-discovery-game.md +60 -0
  9. package/authoring-pack/knowledge/library/gamedev/K-GAME-101-prd-game.md +62 -0
  10. package/authoring-pack/knowledge/library/gamedev/disciplines/game-ai.md +33 -0
  11. package/authoring-pack/knowledge/library/gamedev/disciplines/game-feel.md +32 -0
  12. package/authoring-pack/knowledge/library/gamedev/disciplines/game-ui-ux.md +32 -0
  13. package/authoring-pack/knowledge/library/gamedev/disciplines/level-design.md +31 -0
  14. package/authoring-pack/knowledge/library/gamedev/disciplines/procedural-gen.md +33 -0
  15. package/authoring-pack/knowledge/library/gamedev/disciplines/save-systems.md +32 -0
  16. package/authoring-pack/knowledge/library/gamedev/genres/card-game.md +33 -0
  17. package/authoring-pack/knowledge/library/gamedev/genres/fps-shooter.md +34 -0
  18. package/authoring-pack/knowledge/library/gamedev/genres/platformer.md +37 -0
  19. package/authoring-pack/knowledge/library/gamedev/genres/puzzle.md +32 -0
  20. package/authoring-pack/knowledge/library/gamedev/genres/roguelike.md +34 -0
  21. package/authoring-pack/knowledge/library/gamedev/genres/rpg.md +33 -0
  22. package/authoring-pack/knowledge/library/gamedev/genres/survival-crafting.md +34 -0
  23. package/authoring-pack/knowledge/library/gamedev/genres/tower-defense.md +33 -0
  24. package/authoring-pack/knowledge/library/gamedev/genres/visual-novel.md +32 -0
  25. package/authoring-pack/knowledge/library/prd/capability-coverage.md +2 -2
  26. package/authoring-pack/knowledge/library/prd/decomposition.md +1 -1
  27. package/authoring-pack/knowledge/library/prd/prd-standard.md +6 -2
  28. package/authoring-pack/knowledge/library/prd/self-check.md +9 -2
  29. package/authoring-pack/knowledge/library/prd/writing-style.md +2 -2
  30. package/authoring-pack/knowledge/library/qa/gate-reference.md +21 -16
  31. package/authoring-pack/knowledge/library/specs/specs-standard.md +12 -10
  32. package/authoring-pack/knowledge/library/tasks/conditional-coverage-b.md +3 -3
  33. package/authoring-pack/knowledge/library/tasks/tasks-standard.md +9 -9
  34. package/authoring-pack/knowledge/library/ui/K-UIX-001-universal-uiux-principles.md +66 -0
  35. package/authoring-pack/knowledge/library/ui/K-UIX-002-visual-ux-qa-rubric.md +65 -0
  36. package/authoring-pack/knowledge/library/ui/K-UIX-003-adaptive-ui-authoring.md +66 -0
  37. package/authoring-pack/manifest.json +105 -25
  38. package/authoring-pack/skills/business-discovery/SKILL.md +22 -0
  39. package/authoring-pack/skills/creative-discovery/SKILL.md +11 -0
  40. package/authoring-pack/skills/prd-authoring/SKILL.md +54 -6
  41. package/authoring-pack/skills/product-discovery/SKILL.md +16 -5
  42. package/authoring-pack/skills/specs-authoring/SKILL.md +26 -22
  43. package/authoring-pack/skills/specs-authoring/skill.yaml +1 -1
  44. package/authoring-pack/skills/tasks-authoring/SKILL.md +44 -29
  45. package/authoring-pack/skills/tasks-authoring/skill.yaml +1 -1
  46. package/dist/index.js +3727 -2134
  47. package/dist/index.js.map +4 -4
  48. package/package.json +1 -1
  49. package/skills-pack/ui-quality/THIRD-PARTY-NOTICE.md +32 -0
  50. package/skills-pack/ui-quality/impeccable/LICENSE +191 -0
  51. package/skills-pack/ui-quality/impeccable/SKILL.md +93 -0
  52. package/skills-pack/ui-quality/impeccable/reference/adapt.md +318 -0
  53. package/skills-pack/ui-quality/impeccable/reference/adapt.native.md +58 -0
  54. package/skills-pack/ui-quality/impeccable/reference/android.md +46 -0
  55. package/skills-pack/ui-quality/impeccable/reference/animate.md +106 -0
  56. package/skills-pack/ui-quality/impeccable/reference/audit.md +150 -0
  57. package/skills-pack/ui-quality/impeccable/reference/audit.native.md +143 -0
  58. package/skills-pack/ui-quality/impeccable/reference/bolder.md +33 -0
  59. package/skills-pack/ui-quality/impeccable/reference/clarify.md +94 -0
  60. package/skills-pack/ui-quality/impeccable/reference/colorize.md +86 -0
  61. package/skills-pack/ui-quality/impeccable/reference/component-review.md +63 -0
  62. package/skills-pack/ui-quality/impeccable/reference/craft-floor.md +44 -0
  63. package/skills-pack/ui-quality/impeccable/reference/craft.md +5 -0
  64. package/skills-pack/ui-quality/impeccable/reference/critique-rubric.md +496 -0
  65. package/skills-pack/ui-quality/impeccable/reference/critique.md +327 -0
  66. package/skills-pack/ui-quality/impeccable/reference/degraded/asset-producer.md +42 -0
  67. package/skills-pack/ui-quality/impeccable/reference/degraded/documenter.md +24 -0
  68. package/skills-pack/ui-quality/impeccable/reference/degraded/finish-reviewer.md +38 -0
  69. package/skills-pack/ui-quality/impeccable/reference/degraded/manual-edit-applier.md +93 -0
  70. package/skills-pack/ui-quality/impeccable/reference/degraded/motion-reviewer.md +29 -0
  71. package/skills-pack/ui-quality/impeccable/reference/delight.md +70 -0
  72. package/skills-pack/ui-quality/impeccable/reference/distill.md +111 -0
  73. package/skills-pack/ui-quality/impeccable/reference/doctor.md +54 -0
  74. package/skills-pack/ui-quality/impeccable/reference/document.md +418 -0
  75. package/skills-pack/ui-quality/impeccable/reference/extract.md +69 -0
  76. package/skills-pack/ui-quality/impeccable/reference/foundations.md +44 -0
  77. package/skills-pack/ui-quality/impeccable/reference/generate.md +101 -0
  78. package/skills-pack/ui-quality/impeccable/reference/harden.md +362 -0
  79. package/skills-pack/ui-quality/impeccable/reference/hooks.md +120 -0
  80. package/skills-pack/ui-quality/impeccable/reference/init.md +133 -0
  81. package/skills-pack/ui-quality/impeccable/reference/ios.md +51 -0
  82. package/skills-pack/ui-quality/impeccable/reference/layout.md +84 -0
  83. package/skills-pack/ui-quality/impeccable/reference/live-setup.md +104 -0
  84. package/skills-pack/ui-quality/impeccable/reference/live.md +341 -0
  85. package/skills-pack/ui-quality/impeccable/reference/mode-operate.md +21 -0
  86. package/skills-pack/ui-quality/impeccable/reference/mode-persuade.md +19 -0
  87. package/skills-pack/ui-quality/impeccable/reference/mode-read.md +21 -0
  88. package/skills-pack/ui-quality/impeccable/reference/new-work-comp.md +24 -0
  89. package/skills-pack/ui-quality/impeccable/reference/new-work-world.md +20 -0
  90. package/skills-pack/ui-quality/impeccable/reference/new-work.md +124 -0
  91. package/skills-pack/ui-quality/impeccable/reference/onboard.md +235 -0
  92. package/skills-pack/ui-quality/impeccable/reference/operate.md +61 -0
  93. package/skills-pack/ui-quality/impeccable/reference/optimize.md +257 -0
  94. package/skills-pack/ui-quality/impeccable/reference/overdrive.md +127 -0
  95. package/skills-pack/ui-quality/impeccable/reference/polish.md +105 -0
  96. package/skills-pack/ui-quality/impeccable/reference/quieter.md +99 -0
  97. package/skills-pack/ui-quality/impeccable/reference/region-map.md +26 -0
  98. package/skills-pack/ui-quality/impeccable/reference/routing.md +24 -0
  99. package/skills-pack/ui-quality/impeccable/reference/shape.md +59 -0
  100. package/skills-pack/ui-quality/impeccable/reference/typeset.md +96 -0
  101. package/skills-pack/ui-quality/impeccable/reference/visualize.md +47 -0
  102. package/skills-pack/ui-quality/impeccable/scripts/VERSION +1 -0
  103. package/skills-pack/ui-quality/impeccable/scripts/command-metadata.json +98 -0
  104. package/skills-pack/ui-quality/impeccable/scripts/data/font-index-failures.json +121 -0
  105. package/skills-pack/ui-quality/impeccable/scripts/data/font-index.json +1 -0
  106. package/skills-pack/ui-quality/impeccable/scripts/engine-checksums.txt +9 -0
  107. package/skills-pack/ui-quality/impeccable/scripts/impeccable +319 -0
  108. package/skills-pack/ui-quality/impeccable/scripts/impeccable.cmd +354 -0
  109. package/skills-pack/ui-quality/impeccable/scripts/live-browser-dom.js +320 -0
  110. package/skills-pack/ui-quality/impeccable/scripts/live-browser-ignores.js +246 -0
  111. package/skills-pack/ui-quality/impeccable/scripts/live-browser-session.js +183 -0
  112. package/skills-pack/ui-quality/impeccable/scripts/live-browser.js +13901 -0
  113. package/skills-pack/ui-quality/impeccable/scripts/modern-screenshot.umd.js +14 -0
  114. package/skills-pack/ui-quality/impeccable/skill.yaml +25 -0
  115. package/skills-pack/ui-quality/ui-ux-pro-max/LICENSE +21 -0
  116. package/skills-pack/ui-quality/ui-ux-pro-max/SKILL.md +217 -0
  117. package/skills-pack/ui-quality/ui-ux-pro-max/data/app-interface.csv +33 -0
  118. package/skills-pack/ui-quality/ui-ux-pro-max/data/catalog-summary.json +78 -0
  119. package/skills-pack/ui-quality/ui-ux-pro-max/data/charts.csv +26 -0
  120. package/skills-pack/ui-quality/ui-ux-pro-max/data/colors.csv +193 -0
  121. package/skills-pack/ui-quality/ui-ux-pro-max/data/data-provenance.json +1396 -0
  122. package/skills-pack/ui-quality/ui-ux-pro-max/data/google-font-licenses.json +20185 -0
  123. package/skills-pack/ui-quality/ui-ux-pro-max/data/google-fonts.csv +1935 -0
  124. package/skills-pack/ui-quality/ui-ux-pro-max/data/icons.csv +106 -0
  125. package/skills-pack/ui-quality/ui-ux-pro-max/data/landing.csv +35 -0
  126. package/skills-pack/ui-quality/ui-ux-pro-max/data/motion.csv +18 -0
  127. package/skills-pack/ui-quality/ui-ux-pro-max/data/phosphor-icons-upstream.json +32582 -0
  128. package/skills-pack/ui-quality/ui-ux-pro-max/data/products.csv +193 -0
  129. package/skills-pack/ui-quality/ui-ux-pro-max/data/react-performance.csv +45 -0
  130. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/angular.csv +51 -0
  131. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  132. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/avalonia.csv +57 -0
  133. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  134. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/html-tailwind.csv +60 -0
  135. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/javafx.csv +76 -0
  136. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  137. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/laravel.csv +51 -0
  138. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/nextjs.csv +62 -0
  139. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/nuxt-ui.csv +84 -0
  140. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/nuxtjs.csv +68 -0
  141. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  142. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/react.csv +67 -0
  143. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/shadcn.csv +69 -0
  144. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/svelte.csv +56 -0
  145. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  146. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/threejs.csv +54 -0
  147. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/uno.csv +60 -0
  148. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/uwp.csv +56 -0
  149. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  150. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/winui.csv +60 -0
  151. package/skills-pack/ui-quality/ui-ux-pro-max/data/stacks/wpf.csv +57 -0
  152. package/skills-pack/ui-quality/ui-ux-pro-max/data/styles.csv +90 -0
  153. package/skills-pack/ui-quality/ui-ux-pro-max/data/typography.csv +75 -0
  154. package/skills-pack/ui-quality/ui-ux-pro-max/data/ui-reasoning.csv +193 -0
  155. package/skills-pack/ui-quality/ui-ux-pro-max/data/ux-guidelines.csv +121 -0
  156. package/skills-pack/ui-quality/ui-ux-pro-max/references/pro-rules.md +117 -0
  157. package/skills-pack/ui-quality/ui-ux-pro-max/references/quick-reference.md +257 -0
  158. package/skills-pack/ui-quality/ui-ux-pro-max/scripts/core.py +1053 -0
  159. package/skills-pack/ui-quality/ui-ux-pro-max/scripts/design_system.py +1668 -0
  160. package/skills-pack/ui-quality/ui-ux-pro-max/scripts/reasoning_contract.py +123 -0
  161. package/skills-pack/ui-quality/ui-ux-pro-max/scripts/search.py +201 -0
  162. package/skills-pack/ui-quality/ui-ux-pro-max/scripts/validate_data.py +1095 -0
  163. package/skills-pack/ui-quality/ui-ux-pro-max/skill.yaml +25 -0
@@ -0,0 +1,9 @@
1
+ # Engine binary digests for the pinned ENGINE_VERSION: <engine-version> <asset> <sha256>.
2
+ # The launchers, the npm shim, `impeccable install` and scripts/fetch-engine.mjs verify
3
+ # every engine download against this file. Written by
4
+ # `node scripts/check-engine-release.mjs --record` after each engine release.
5
+ 0.1.24 impeccable-darwin-arm64 f5cc3923ac93fe9ec0a01449eb3b8f03859dae08a81959e4415333c042bc2f80
6
+ 0.1.24 impeccable-darwin-x64 970ce4d9fd38542b4f013acdcd8b4c5da36891a4c9e74c39915348fdaf601a1d
7
+ 0.1.24 impeccable-linux-x64 d317bd1be061fdc902c4dede7fdf1efd1f7744882fb511a1f962fcdc4eed5382
8
+ 0.1.24 impeccable-linux-arm64 34ef563966cb95c1b36c450ee626c727266763579fc5e95a9aef280b74875080
9
+ 0.1.24 impeccable-windows-x64.exe c4e71217677f53beaabec1cd4823a9bb2587355615f1170cf5508e69be4587bc
@@ -0,0 +1,319 @@
1
+ #!/bin/sh
2
+ # Impeccable launcher. Runs the platform binary shipped next to this script:
3
+ # <this dir>/bin/<os>-<arch>/impeccable
4
+ # Order: $IMPECCABLE_BIN, the sibling binary, ~/.impeccable/bin/impeccable,
5
+ # the version-pinned cache, then `impeccable` on PATH. Never needs Node.
6
+ # The unversioned home binary and the PATH candidate are validated with the
7
+ # engine-probe handshake first: the retired 3.x npm CLI also installed a bin
8
+ # named `impeccable`, and exec'ing it would fail every verb with
9
+ # "Unknown command". The sibling binary must also report the version in
10
+ # VERSION: it is gitignored, so a skill upgrade that copies files over this
11
+ # directory leaves the old engine in place. A local build of the same version
12
+ # passes, which is why it is not hashed. IMPECCABLE_BIN is the operator's
13
+ # explicit choice and is exec'd without a probe. The version-pinned cache and
14
+ # the download are verified against engine-checksums.txt (next to this
15
+ # script), never against anything published beside the binary; a
16
+ # <binary>.verified stamp holding the manifest digest and the binary's size
17
+ # skips rehashing until either changes or the binary is newer than the stamp.
18
+ # No path hashes on every run: hooks run this launcher on every edit.
19
+ set -eu
20
+
21
+ # True when the candidate answers the engine handshake (prints
22
+ # "impeccable-engine <version>", exit 0). Quiet and fast (<100ms).
23
+ # IMPECCABLE_LAUNCHER_PROBE marks the child as a probe: a copy of this
24
+ # launcher reached recursively (e.g. symlinked onto PATH as `impeccable`)
25
+ # then skips its own probes and refuses to download, so probing stays cheap
26
+ # and can never loop.
27
+ probe_ok() {
28
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
29
+ case "$probe_out" in
30
+ impeccable-engine*) probe_version=${probe_out#impeccable-engine }; return 0 ;;
31
+ esac
32
+ return 1
33
+ }
34
+ probing=${IMPECCABLE_LAUNCHER_PROBE:-}
35
+ # Space, tab and CR, made once: hooks run this launcher on every edit and turn
36
+ # end, and every process it starts before the engine costs real time on a busy
37
+ # Windows machine (#1237), so the hot path below sticks to shell builtins.
38
+ ws=$(printf ' \t\r')
39
+
40
+ # Sets $digest_out to the digest engine-checksums.txt records for engine
41
+ # version $1 and asset $2 (lines are "<version> <asset> <sha256>"), empty when
42
+ # there is none.
43
+ # A CR is a separator too (CRLF checkouts), and a last line with no newline
44
+ # still counts.
45
+ manifest_digest() {
46
+ digest_out=""
47
+ [ -f "$manifest" ] || return 0
48
+ while IFS="$ws" read -r m_version m_asset m_sum _ || [ -n "$m_version" ]; do
49
+ case "$m_version" in ''|'#'*) continue ;; esac
50
+ if [ "$m_version" = "$1" ] && [ "$m_asset" = "$2" ]; then
51
+ digest_out=$m_sum
52
+ return 0
53
+ fi
54
+ done < "$manifest"
55
+ return 0
56
+ }
57
+ # Sets $expected (and, on Windows on ARM, which runs x64 binaries,
58
+ # $expected_x64) from engine-checksums.txt.
59
+ read_expected() {
60
+ manifest_digest "$version" "$asset"
61
+ expected=$digest_out
62
+ expected_x64=""
63
+ if [ "$os" = windows ] && [ "$arch" = arm64 ]; then
64
+ manifest_digest "$version" impeccable-windows-x64.exe
65
+ expected_x64=$digest_out
66
+ fi
67
+ }
68
+ # Sets $size to the byte count of the cached binary (BSD wc pads it).
69
+ cached_size() {
70
+ size=$(wc -c < "$cached") || size=""
71
+ size=${size##* }
72
+ }
73
+ # Sets $actual to the sha256 of $1, empty when no hash tool works.
74
+ hash_file() {
75
+ actual=""
76
+ if command -v shasum >/dev/null 2>&1; then
77
+ if digest=$(shasum -a 256 "$1" 2>/dev/null); then actual=${digest%% *}; fi
78
+ elif command -v sha256sum >/dev/null 2>&1; then
79
+ if digest=$(sha256sum "$1" 2>/dev/null); then actual=${digest%% *}; fi
80
+ fi
81
+ }
82
+
83
+ # This script's directory without dirname or a subshell: what dirname "$0"
84
+ # gives, made absolute by a cd there and back.
85
+ case $0 in
86
+ */*) dir=${0%/*} ;;
87
+ *) dir=. ;;
88
+ esac
89
+ [ -n "$dir" ] || dir=/
90
+ caller_pwd=$PWD
91
+ CDPATH= cd -- "$dir" || { echo "impeccable: cannot enter the launcher directory $dir" >&2; exit 127; }
92
+ dir=$PWD
93
+ skill_dir=${dir%/*}
94
+ [ -n "$skill_dir" ] || skill_dir=/
95
+ cd -- "$caller_pwd" || { echo "impeccable: cannot return to $caller_pwd" >&2; exit 127; }
96
+ # VS Code syncs a plugin without the executable bit. Its hooks run this through
97
+ # sh, so restore the bit for the commands the skill runs directly (#1249).
98
+ [ -x "$0" ] || chmod +x "$0" 2>/dev/null || :
99
+ manifest="$dir/engine-checksums.txt"
100
+
101
+ # What the binary needs to know about its home: the skill directory (for
102
+ # reference/*.md and command-metadata.json) and how to name itself in the
103
+ # commands it prints. Exported BEFORE any exec below, including the
104
+ # IMPECCABLE_BIN override: an engine binary reached with no IMPECCABLE_SKILL_DIR
105
+ # cannot find reference/*.md (so native platform refs never inline) or read its
106
+ # own version (so UPDATE_AVAILABLE never fires). Setting it here covers every
107
+ # candidate the launcher can exec.
108
+ : "${IMPECCABLE_SKILL_DIR:=$skill_dir}"
109
+ : "${IMPECCABLE_SELF:=$0}"
110
+ export IMPECCABLE_SKILL_DIR IMPECCABLE_SELF
111
+
112
+ if [ -n "${IMPECCABLE_BIN:-}" ] && [ -x "${IMPECCABLE_BIN}" ]; then
113
+ exec "${IMPECCABLE_BIN}" "$@"
114
+ fi
115
+
116
+ # Windows names itself in the environment, which saves a process there; one
117
+ # uname covers the rest. PROCESSOR_ARCHITECTURE is what impeccable.cmd reads,
118
+ # so both launchers pick the same cached engine (AMD64 under x64 Git Bash on
119
+ # ARM64, as uname -m reported before).
120
+ if [ "${OS:-}" = Windows_NT ]; then
121
+ sys="Windows_NT ${PROCESSOR_ARCHITECTURE:-unknown}"
122
+ else
123
+ sys=$(uname -sm 2>/dev/null) || sys="unknown unknown"
124
+ fi
125
+ case "${sys%% *}" in
126
+ Darwin) os=darwin ;;
127
+ Linux) os=linux ;;
128
+ MINGW*|MSYS*|CYGWIN*|Windows_NT) os=windows ;;
129
+ *) os=unknown ;;
130
+ esac
131
+ case "${sys##* }" in
132
+ arm64|aarch64|ARM64) arch=arm64 ;;
133
+ x86_64|amd64|AMD64) arch=x64 ;;
134
+ *) arch=unknown ;;
135
+ esac
136
+
137
+ version=""
138
+ [ -f "$dir/VERSION" ] && { IFS="$ws" read -r version _ < "$dir/VERSION" || :; }
139
+ bin="$dir/bin/$os-$arch/impeccable"
140
+ [ "$os" = windows ] && bin="$bin.exe"
141
+
142
+ # Lost the executable bit in transit (zip extraction, some copiers).
143
+ if [ -f "$bin" ] && { [ -x "$bin" ] || chmod +x "$bin" 2>/dev/null; }; then
144
+ if [ -n "$probing" ] || [ -z "$version" ] || { probe_ok "$bin" && [ "$probe_version" = "$version" ]; }; then
145
+ exec "$bin" "$@"
146
+ fi
147
+ echo "impeccable: skipping $bin: it reports engine ${probe_version:-unknown} but this skill pins $version; delete it to stop this warning" >&2
148
+ fi
149
+ # On Windows (an MSYS/Git Bash shell) the cached names carry .exe so this
150
+ # launcher and impeccable.cmd share one cache.
151
+ exe=""
152
+ [ "$os" = windows ] && exe=".exe"
153
+ home_bin="${HOME:-/nonexistent}/.impeccable/bin/impeccable$exe"
154
+ if [ -z "$probing" ] && [ -x "$home_bin" ] && probe_ok "$home_bin"; then
155
+ exec "$home_bin" "$@"
156
+ fi
157
+ # Version-pinned user cache, filled by the download below or by `impeccable update`.
158
+ cache_root="${IMPECCABLE_HOME:-${HOME:-/nonexistent}/.impeccable}"
159
+ cached="$cache_root/bin/$version/impeccable$exe"
160
+ asset="impeccable-$os-$arch"
161
+ [ "$os" = windows ] && asset="$asset.exe"
162
+ if [ -n "$version" ] && [ -x "$cached" ]; then
163
+ read_expected
164
+ cached_size
165
+ stamp=""
166
+ stamp_size=""
167
+ { IFS="$ws" read -r stamp stamp_size _ < "$cached.verified"; } 2>/dev/null || :
168
+ if [ -n "$stamp" ] && [ "$stamp_size" = "$size" ] && { [ "$stamp" = "$expected" ] || [ "$stamp" = "$expected_x64" ]; } && [ ! "$cached" -nt "$cached.verified" ]; then
169
+ exec "$cached" "$@"
170
+ fi
171
+ hash_file "$cached"
172
+ if [ -n "$actual" ] && { [ "$actual" = "$expected" ] || [ "$actual" = "$expected_x64" ]; }; then
173
+ { echo "$actual $size" > "$cached.verified"; } 2>/dev/null || :
174
+ exec "$cached" "$@"
175
+ fi
176
+ echo "impeccable: cannot verify the cached engine $cached against $manifest; not using it" >&2
177
+ fi
178
+ if [ -z "$probing" ] && command -v impeccable >/dev/null 2>&1 && probe_ok impeccable; then
179
+ exec impeccable "$@"
180
+ fi
181
+
182
+ # Last resort: fetch this version's binary for the current platform from the
183
+ # public release channel into the user cache. Needs network; sandboxes without
184
+ # egress preinstall the binary on PATH instead.
185
+ setup_help() {
186
+ echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
187
+ echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
188
+ echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
189
+ }
190
+ fetch_url() {
191
+ http_status=""
192
+ download_host=""
193
+ if command -v curl >/dev/null 2>&1; then
194
+ fetch_result=0
195
+ metadata=$(curl -fsSL --retry 2 -w '%{http_code} %{url_effective}' -o "$tmp" "$1" 2>/dev/null) || fetch_result=$?
196
+ http_status=${metadata%% *}
197
+ effective_url=${metadata#* }
198
+ # Only the authority is needed, never the signed storage URL's query.
199
+ download_host=${effective_url#*://}
200
+ download_host=${download_host%%/*}
201
+ download_host=${download_host##*@}
202
+ case "$download_host" in
203
+ \[*) download_host=${download_host%%]*}] ;;
204
+ *) download_host=${download_host%%:*} ;;
205
+ esac
206
+ download_host=$(printf '%s' "$download_host" | tr '[:upper:]' '[:lower:]')
207
+ return "$fetch_result"
208
+ elif command -v wget >/dev/null 2>&1; then
209
+ wget -q -O "$tmp" "$1" 2>/dev/null
210
+ else
211
+ return 1
212
+ fi
213
+ }
214
+ check_download() {
215
+ download_file=${1:-$tmp}
216
+ if [ ! -f "$download_file" ]; then
217
+ echo "impeccable: download completed but the file was removed before execution: $url; check your antivirus quarantine or logs. Refusing to continue; do not disable protection." >&2
218
+ exit 127
219
+ fi
220
+ if [ ! -s "$download_file" ]; then
221
+ rm -f "$download_file"
222
+ echo "impeccable: downloaded file is empty: $url; refusing the unverified download" >&2
223
+ exit 127
224
+ fi
225
+ }
226
+ if [ -n "$probing" ]; then
227
+ # Inside another launcher's probe: no download, fail fast and quiet.
228
+ exit 127
229
+ fi
230
+ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
231
+ base="${IMPECCABLE_DOWNLOAD_BASE:-https://github.com/pbakaus/impeccable/releases/download}"
232
+ url="$base/engine-v$version/$asset"
233
+ read_expected
234
+ # Fail closed before any network traffic or cache write.
235
+ if [ -z "$expected" ] && [ -z "$expected_x64" ]; then
236
+ echo "impeccable: no checksum for engine $version ($asset) in $manifest; refusing the unverified download" >&2
237
+ exit 127
238
+ fi
239
+ tmp="$cache_root/bin/$version/.impeccable.part.$$"
240
+ # An interrupted download (Ctrl-C, a hook timeout) would otherwise leave the
241
+ # PID-named staging file behind for good. The handlers must exit explicitly.
242
+ cleanup() { rm -f "$tmp" 2>/dev/null || :; }
243
+ trap 'cleanup; exit 129' HUP
244
+ trap 'cleanup; exit 130' INT
245
+ trap 'cleanup; exit 143' TERM
246
+ if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
247
+ echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
248
+ setup_help
249
+ exit 127
250
+ fi
251
+ # Check the actual staging file, not just directory existence: a cache from
252
+ # an earlier run can be readable but no longer writable inside a sandbox.
253
+ if ! (umask 077; : > "$tmp") 2>/dev/null; then
254
+ echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
255
+ setup_help
256
+ exit 127
257
+ fi
258
+ fetched=0
259
+ if [ -n "$expected" ] && fetch_url "$url"; then
260
+ fetched=1
261
+ elif [ -n "$expected_x64" ]; then
262
+ # Windows on ARM runs x64 binaries; fall back when no arm64 asset exists.
263
+ url="$base/engine-v$version/impeccable-windows-x64.exe"
264
+ expected=$expected_x64
265
+ fetch_url "$url" && fetched=1
266
+ fi
267
+ if [ "$fetched" = 1 ]; then
268
+ check_download
269
+ # No sha256 tool refuses the download too.
270
+ hash_file "$tmp"
271
+ check_download
272
+ if [ -z "$actual" ]; then
273
+ rm -f "$tmp"
274
+ echo "impeccable: cannot verify $url (no sha256 tool, or hashing failed); refusing the unverified download" >&2
275
+ exit 127
276
+ fi
277
+ if [ "$actual" != "$expected" ]; then
278
+ rm -f "$tmp"
279
+ echo "impeccable: checksum mismatch downloading $url" >&2
280
+ exit 127
281
+ fi
282
+ check_download
283
+ if ! chmod +x "$tmp" 2>/dev/null; then
284
+ check_download
285
+ rm -f "$tmp"
286
+ echo "impeccable: could not make the verified download executable: $url" >&2
287
+ exit 127
288
+ fi
289
+ check_download
290
+ if ! mv -f "$tmp" "$cached" 2>/dev/null; then
291
+ check_download
292
+ rm -f "$tmp"
293
+ echo "impeccable: could not cache the verified download: $url" >&2
294
+ exit 127
295
+ fi
296
+ check_download "$cached"
297
+ cached_size
298
+ { echo "$actual $size" > "$cached.verified"; } 2>/dev/null || :
299
+ exec "$cached" "$@"
300
+ fi
301
+ rm -f "$tmp" 2>/dev/null
302
+ case "$http_status" in
303
+ 5[0-9][0-9])
304
+ case "$download_host" in
305
+ github.com|*.github.com|githubusercontent.com|*.githubusercontent.com)
306
+ echo "impeccable: could not download engine $version: GitHub's downloads are failing right now (HTTP $http_status from $download_host). This is an outage on GitHub's side, not a problem with your setup or the CLI, so updating won't help. Check https://www.githubstatus.com and run the same command again once GitHub has recovered." >&2 ;;
307
+ *)
308
+ echo "impeccable: could not download engine $version: $download_host is failing right now (HTTP $http_status), a server error on $download_host's side. Try again later." >&2 ;;
309
+ esac
310
+ exit 127 ;;
311
+ esac
312
+ echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
313
+ setup_help
314
+ exit 127
315
+ fi
316
+
317
+ echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
318
+ echo "Download impeccable-$os-$arch from https://github.com/pbakaus/impeccable/releases (tag engine-v$version) into $cache_root/bin/$version/impeccable$exe (then chmod +x), or set IMPECCABLE_BIN to a preinstalled engine binary. Docs: https://impeccable.style" >&2
319
+ exit 127
@@ -0,0 +1,354 @@
1
+ @echo off
2
+ setlocal
3
+ rem Impeccable launcher (Windows). Runs bin\windows-<arch>\impeccable.exe next
4
+ rem to this file, else a cached or freshly downloaded engine binary.
5
+ rem
6
+ rem Structure notes (this file is exercised by dry parsing and string-level
7
+ rem tests, not yet on a real Windows machine):
8
+ rem - No multi-line parenthesized blocks: cmd expands %var% at block parse
9
+ rem time, which made the old download path read back empty %url%/%cached%.
10
+ rem Linear goto flow keeps every expansion on its own line, and avoids
11
+ rem delayed expansion eating ! characters in user arguments.
12
+ rem - The unversioned user binary and the PATH candidate are validated with
13
+ rem the engine-probe handshake (see :probe) so the retired 3.x npm CLI,
14
+ rem whose bin is also named impeccable, is never exec'd. The sibling binary
15
+ rem must also report the version in VERSION: it is not tracked, so a skill
16
+ rem upgrade can leave an old engine in place. IMPECCABLE_BIN stays trusted.
17
+ rem - Downloads and the version-pinned cache are verified via certutil
18
+ rem against engine-checksums.txt next to this file, and fail closed; a
19
+ rem .verified stamp lets later runs skip hashing the cache while it holds
20
+ rem the manifest digest and the binary's size and is not older than the
21
+ rem binary. On ARM64 the arm64 asset is tried first and the x64 asset is the
22
+ rem fallback (Windows on ARM runs x64 binaries), each only when the manifest
23
+ rem has a line for it.
24
+ if not defined IMPECCABLE_SKILL_DIR set "IMPECCABLE_SKILL_DIR=%~dp0.."
25
+ if not defined IMPECCABLE_SELF set "IMPECCABLE_SELF=%~f0"
26
+ set "arch=x64"
27
+ if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "arch=arm64"
28
+
29
+ if not defined IMPECCABLE_BIN goto no_env_bin
30
+ if not exist "%IMPECCABLE_BIN%" goto no_env_bin
31
+ set "run=%IMPECCABLE_BIN%"
32
+ goto run
33
+ :no_env_bin
34
+
35
+ set "version="
36
+ if exist "%~dp0VERSION" set /p version=<"%~dp0VERSION"
37
+ set "bin=%~dp0bin\windows-%arch%\impeccable.exe"
38
+ if not exist "%bin%" goto no_sibling
39
+ if defined IMPECCABLE_LAUNCHER_PROBE goto sibling_ok
40
+ if not defined version goto sibling_ok
41
+ call :probe "%bin%"
42
+ if "%probe_version%"=="%version%" goto sibling_ok
43
+ if not defined probe_version set "probe_version=unknown"
44
+ echo impeccable: skipping "%bin%": it reports engine %probe_version% but this skill pins %version%; delete it to stop this warning 1>&2
45
+ goto no_sibling
46
+ :sibling_ok
47
+ set "run=%bin%"
48
+ goto run
49
+ :no_sibling
50
+
51
+ set "home_bin=%USERPROFILE%\.impeccable\bin\impeccable.exe"
52
+ if not exist "%home_bin%" goto no_home_bin
53
+ if defined IMPECCABLE_LAUNCHER_PROBE goto no_home_bin
54
+ call :probe "%home_bin%"
55
+ if not "%probe_ok%"=="1" goto no_home_bin
56
+ set "run=%home_bin%"
57
+ goto run
58
+ :no_home_bin
59
+
60
+ if not defined IMPECCABLE_HOME set "IMPECCABLE_HOME=%USERPROFILE%\.impeccable"
61
+ set "cached=%IMPECCABLE_HOME%\bin\%version%\impeccable.exe"
62
+ set "asset=impeccable-windows-%arch%.exe"
63
+ set "manifest=%~dp0engine-checksums.txt"
64
+ if not defined version goto no_cache
65
+ if not exist "%cached%" goto no_cache
66
+ call :read_expected
67
+ for %%f in ("%cached%") do set "size=%%~zf"
68
+ set "stamp="
69
+ if exist "%cached%.verified" for /f "usebackq tokens=1,2" %%s in ("%cached%.verified") do set "stamp=%%s"& set "stamp_size=%%t"
70
+ if not defined stamp goto cache_hash
71
+ if not "%stamp_size%"=="%size%" goto cache_hash
72
+ if /I "%stamp%"=="%expected%" goto cache_stamp_matches
73
+ if /I "%stamp%"=="%expected_x64%" goto cache_stamp_matches
74
+ goto cache_hash
75
+ :cache_stamp_matches
76
+ rem Newest first: the stamp must be listed before the binary it vouches for.
77
+ set "newest="
78
+ for /f "delims=" %%f in ('dir /b /a:-d /o:-d "%cached%*" 2^>nul') do if not defined newest set "newest=%%f"
79
+ if /I "%newest%"=="impeccable.exe.verified" goto cache_trusted
80
+ :cache_hash
81
+ call :sha256 "%cached%" "%TEMP%\impeccable-hash-%RANDOM%%RANDOM%.txt"
82
+ if not defined actual goto cache_unverified
83
+ if /I "%actual%"=="%expected%" goto cache_verified
84
+ if /I "%actual%"=="%expected_x64%" goto cache_verified
85
+ :cache_unverified
86
+ echo impeccable: cannot verify the cached engine "%cached%" against "%manifest%"; not using it 1>&2
87
+ goto no_cache
88
+ :cache_verified
89
+ (>"%cached%.verified" echo %actual% %size%) 2>nul
90
+ :cache_trusted
91
+ set "run=%cached%"
92
+ goto run
93
+ :no_cache
94
+
95
+ if defined IMPECCABLE_LAUNCHER_PROBE goto download
96
+ rem The first impeccable on PATH, resolved once so the probe and the run see
97
+ rem the same file. A batch shim (npm writes impeccable.cmd) must run under
98
+ rem call to return here (#1240), and call expands % in the arguments a second
99
+ rem time; a real binary runs directly so a target such as a%20b reaches it intact.
100
+ set "path_bin="
101
+ rem where also lists npm's extensionless POSIX shim, which cmd cannot run:
102
+ rem take the first match with a runnable extension.
103
+ rem Loop letters c and k are not path modifiers, so %%~xc reads as the
104
+ rem extension of c and never as a loop variable followed by text.
105
+ for /f "delims=" %%c in ('where impeccable 2^>nul') do if not defined path_bin for %%k in (.exe .com .cmd .bat) do if /I "%%~xc"=="%%k" set "path_bin=%%c"
106
+ if not defined path_bin goto download
107
+ call :probe "%path_bin%"
108
+ if not "%probe_ok%"=="1" goto download
109
+ for %%k in ("%path_bin%") do set "path_ext=%%~xk"
110
+ if /I "%path_ext%"==".cmd" goto path_shim
111
+ if /I "%path_ext%"==".bat" goto path_shim
112
+ "%path_bin%" %*
113
+ exit /b %errorlevel%
114
+ :path_shim
115
+ call "%path_bin%" %*
116
+ exit /b %errorlevel%
117
+
118
+ :download
119
+ rem Last resort: fetch this version's binary from the release channel into
120
+ rem the version-pinned user cache, verify it, then run it. Never inside
121
+ rem another launcher's probe: fail fast and quiet instead.
122
+ if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
123
+ if not defined version goto fail
124
+ call :read_expected
125
+ if not defined expected if not defined expected_x64 goto no_checksum
126
+ where curl.exe >nul 2>nul
127
+ if errorlevel 1 goto curl_missing
128
+ if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
129
+ if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
130
+ mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
131
+ if errorlevel 1 goto cache_directory_failed
132
+ :cache_ready
133
+ rem Stage the download in a directory only this run owns, as the sh launcher
134
+ rem does with .impeccable.part.$$: concurrent first runs (parallel hooks, two
135
+ rem agents) must never write, hash or move each other's files. mkdir fails
136
+ rem when the name exists, so it claims the name atomically. RANDOM alone is
137
+ rem not enough because cmd seeds it from the clock in whole seconds; the
138
+ rem timestamp and the retry on collision keep same-second runs apart. A cache
139
+ rem directory that refuses every mkdir is reported as unwritable.
140
+ set "attempt=0"
141
+ :claim_staging
142
+ set /a attempt+=1
143
+ if %attempt% GTR 20 goto cache_write_failed
144
+ set "stamp=%TIME: =0%"
145
+ set "stamp=%stamp::=%"
146
+ set "stamp=%stamp:.=%"
147
+ set "stamp=%stamp:,=%"
148
+ set "staging=%IMPECCABLE_HOME%\bin\%version%\.impeccable.part.%stamp%-%RANDOM%%RANDOM%"
149
+ mkdir "%staging%" >nul 2>nul
150
+ if errorlevel 1 goto claim_staging
151
+ set "part=%staging%\impeccable.exe"
152
+ rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
153
+ rem branch on the command's failure directly.
154
+ (type nul >"%part%") 2>nul || goto staging_write_failed
155
+ set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
156
+ if not defined expected goto fetch_x64
157
+ call :fetch_url
158
+ if not errorlevel 1 goto verify
159
+ :fetch_x64
160
+ if not defined expected_x64 goto download_failed
161
+ set "asset=impeccable-windows-x64.exe"
162
+ set "expected=%expected_x64%"
163
+ set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
164
+ call :fetch_url
165
+ if errorlevel 1 goto download_failed
166
+
167
+ :verify
168
+ call :check_download
169
+ if errorlevel 1 exit /b 127
170
+ rem Mirrors the sh launcher and fails closed: a freshly downloaded binary
171
+ rem runs only after its hash matches the digest read from engine-checksums.txt.
172
+ rem An empty certutil result refuses the download instead of running an
173
+ rem unverified binary.
174
+ call :sha256 "%part%" "%staging%\hash.txt"
175
+ call :check_download
176
+ if errorlevel 1 exit /b 127
177
+ if not defined actual goto verify_refuse
178
+ if /I "%actual%"=="%expected%" goto place
179
+ call :discard_staging
180
+ echo impeccable: checksum mismatch downloading %url% 1>&2
181
+ exit /b 127
182
+
183
+ :verify_refuse
184
+ call :check_download
185
+ if errorlevel 1 exit /b 127
186
+ call :discard_staging
187
+ echo impeccable: cannot verify %url% (certutil could not hash it); refusing the unverified download 1>&2
188
+ exit /b 127
189
+
190
+ :fetch_url
191
+ set "http_status="
192
+ set "effective_url="
193
+ set "download_host="
194
+ curl.exe -fsSL --retry 2 -w "%%{http_code} %%{url_effective}" -o "%part%" "%url%" >"%staging%\http.txt" 2>nul
195
+ set "fetch_result=%errorlevel%"
196
+ for /f "usebackq tokens=1" %%a in ("%staging%\http.txt") do set "http_status=%%a"
197
+ for /f "usebackq tokens=2" %%a in ("%staging%\http.txt") do set "effective_url=%%a"
198
+ rem Token 2 is the authority after scheme://. Drop userinfo and the port.
199
+ for /f "tokens=2 delims=/" %%h in ("%effective_url%") do set "download_host=%%h"
200
+ for /f "tokens=1,* delims=@" %%h in ("%download_host%") do if not "%%i"=="" set "download_host=%%i"
201
+ rem Bracketed IPv6 hosts contain colons that are not port separators.
202
+ if "%download_host:~0,1%"=="[" goto fetch_ipv6
203
+ for /f "tokens=1 delims=:" %%h in ("%download_host%") do set "download_host=%%h"
204
+ exit /b %fetch_result%
205
+ :fetch_ipv6
206
+ for /f "tokens=1 delims=]" %%h in ("%download_host%") do set "download_host=%%h]"
207
+ exit /b %fetch_result%
208
+
209
+ :read_expected
210
+ rem Sets expected (and, on ARM64, expected_x64: Windows on ARM runs x64
211
+ rem binaries) from engine-checksums.txt.
212
+ call :manifest_digest "%asset%" expected
213
+ set "expected_x64="
214
+ if "%arch%"=="arm64" call :manifest_digest impeccable-windows-x64.exe expected_x64
215
+ exit /b 0
216
+
217
+ :manifest_digest
218
+ rem Sets the variable named %2 to the digest the first engine-checksums.txt
219
+ rem line for this version and asset %1 records, empty when there is none.
220
+ set "%~2="
221
+ if not exist "%manifest%" exit /b 0
222
+ for /f "usebackq tokens=1-3" %%a in ("%manifest%") do if "%%a"=="%version%" if /I "%%b"=="%~1" if not defined %~2 set "%~2=%%c"
223
+ exit /b 0
224
+
225
+ :sha256
226
+ rem Sets actual to the sha256 of %~1, empty when certutil fails. %~2 is the
227
+ rem scratch file for its output. Check certutil's status before parsing: its
228
+ rem error text on stdout is not a digest.
229
+ set "actual="
230
+ certutil -hashfile "%~1" SHA256 >"%~2" 2>nul
231
+ if errorlevel 1 goto sha256_done
232
+ for /f "usebackq skip=1 delims=" %%h in ("%~2") do if not defined actual set "actual=%%h"
233
+ if not defined actual goto sha256_done
234
+ set "actual=%actual: =%"
235
+ :sha256_done
236
+ del "%~2" >nul 2>nul
237
+ exit /b 0
238
+
239
+ :check_download
240
+ set "download_file=%~1"
241
+ if not defined download_file set "download_file=%part%"
242
+ if not exist "%download_file%" goto download_missing
243
+ for %%f in ("%download_file%") do if %%~zf==0 goto download_empty
244
+ exit /b 0
245
+
246
+ :download_missing
247
+ call :discard_staging
248
+ echo impeccable: download completed but the file was removed before execution: %url%; check your antivirus quarantine or logs. Refusing to continue; do not disable protection. 1>&2
249
+ exit /b 127
250
+
251
+ :download_empty
252
+ del "%download_file%" >nul 2>nul
253
+ call :discard_staging
254
+ echo impeccable: downloaded file is empty: %url%; refusing the unverified download 1>&2
255
+ exit /b 127
256
+
257
+ :discard_staging
258
+ rem Removes this run's staging directory and whatever is left in it. Never
259
+ rem touches another run's staging directory or the cached binary.
260
+ if defined staging rd /s /q "%staging%" >nul 2>nul
261
+ exit /b 0
262
+
263
+ :place
264
+ call :check_download
265
+ if errorlevel 1 exit /b 127
266
+ move /y "%part%" "%cached%" >nul 2>nul
267
+ if errorlevel 1 goto place_failed
268
+ call :discard_staging
269
+ call :check_download "%cached%"
270
+ if errorlevel 1 exit /b 127
271
+ for %%f in ("%cached%") do set "size=%%~zf"
272
+ (>"%cached%.verified" echo %actual% %size%) 2>nul
273
+ set "run=%cached%"
274
+ goto run
275
+
276
+ :place_failed
277
+ call :check_download
278
+ if errorlevel 1 exit /b 127
279
+ call :discard_staging
280
+ echo impeccable: could not cache the verified download: %url% 1>&2
281
+ exit /b 127
282
+
283
+ :run
284
+ "%run%" %*
285
+ exit /b %errorlevel%
286
+
287
+ :probe
288
+ rem Sets probe_ok=1 when %1 answers the engine handshake: prints
289
+ rem "impeccable-engine <version>" and exits 0, and probe_version to that
290
+ rem version. The 3.x npm CLI answers any unknown verb with "Unknown command",
291
+ rem exit 1, so it never passes.
292
+ rem The candidate runs under call: an npm .cmd shim run without it takes
293
+ rem over this script and never returns (#1240).
294
+ set "probe_ok="
295
+ set "probe_version="
296
+ set "probe_tmp=%TEMP%\impeccable-probe-%RANDOM%%RANDOM%.txt"
297
+ set "IMPECCABLE_LAUNCHER_PROBE=1"
298
+ call "%~1" engine-probe >"%probe_tmp%" 2>nul
299
+ set "probe_err=%ERRORLEVEL%"
300
+ set "IMPECCABLE_LAUNCHER_PROBE="
301
+ if not "%probe_err%"=="0" goto probe_done
302
+ findstr /b /c:"impeccable-engine" "%probe_tmp%" >nul 2>nul
303
+ if errorlevel 1 goto probe_done
304
+ set "probe_ok=1"
305
+ for /f "usebackq tokens=2" %%v in ("%probe_tmp%") do if not defined probe_version set "probe_version=%%v"
306
+ :probe_done
307
+ del "%probe_tmp%" >nul 2>nul
308
+ exit /b 0
309
+
310
+ :no_checksum
311
+ echo impeccable: no checksum for engine %version% (%asset%) in "%manifest%"; refusing the unverified download 1>&2
312
+ exit /b 127
313
+
314
+ :cache_directory_failed
315
+ echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
316
+ goto setup_failed
317
+
318
+ :staging_write_failed
319
+ call :discard_staging
320
+
321
+ :cache_write_failed
322
+ echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
323
+ goto setup_failed
324
+
325
+ :curl_missing
326
+ echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
327
+ goto setup_failed
328
+
329
+ :download_failed
330
+ call :discard_staging
331
+ if not "%http_status:~0,1%"=="5" goto download_generic
332
+ if "%http_status:~2,1%"=="" goto download_generic
333
+ if /I "%download_host%"=="github.com" goto download_github
334
+ if /I "%download_host:~-11%"==".github.com" goto download_github
335
+ if /I "%download_host%"=="githubusercontent.com" goto download_github
336
+ if /I "%download_host:~-22%"==".githubusercontent.com" goto download_github
337
+ echo impeccable: could not download engine %version%: %download_host% is failing right now (HTTP %http_status%), a server error on %download_host%'s side. Try again later. 1>&2
338
+ exit /b 127
339
+ :download_github
340
+ echo impeccable: could not download engine %version%: GitHub's downloads are failing right now (HTTP %http_status% from %download_host%). This is an outage on GitHub's side, not a problem with your setup or the CLI, so updating won't help. Check https://www.githubstatus.com and run the same command again once GitHub has recovered. 1>&2
341
+ exit /b 127
342
+ :download_generic
343
+ echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
344
+
345
+ :setup_failed
346
+ echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
347
+ echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
348
+ echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
349
+ exit /b 127
350
+
351
+ :fail
352
+ echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
353
+ echo Download impeccable-windows-%arch%.exe from https://github.com/pbakaus/impeccable/releases (tag engine-v%version%) and save it as %cached%, or set IMPECCABLE_BIN to a preinstalled engine binary. Docs: https://impeccable.style 1>&2
354
+ exit /b 127