vc-extras 0.1.0 → 0.1.1

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 (249) hide show
  1. package/README.md +128 -71
  2. package/agent-install.mjs +159 -0
  3. package/agents/tester.md +23 -23
  4. package/install-extras.mjs +41 -109
  5. package/install-menu.mjs +22 -43
  6. package/install-skills.mjs +112 -112
  7. package/package.json +72 -28
  8. package/plugin-registry.mjs +73 -0
  9. package/plugins/config-ui/index.ts +159 -159
  10. package/plugins/config-ui/lib/arguments.mjs +24 -24
  11. package/plugins/config-ui/lib/documents.mjs +67 -67
  12. package/plugins/config-ui/lib/frontmatter.mjs +91 -91
  13. package/plugins/config-ui/lib/open.mjs +16 -16
  14. package/plugins/config-ui/lib/ownership.mjs +99 -99
  15. package/plugins/config-ui/lib/page.mjs +11 -11
  16. package/plugins/config-ui/lib/patch.mjs +35 -35
  17. package/plugins/config-ui/lib/paths.mjs +14 -14
  18. package/plugins/config-ui/lib/plugin-fields.mjs +86 -86
  19. package/plugins/config-ui/lib/plugin-validation.mjs +28 -28
  20. package/plugins/config-ui/lib/redaction.mjs +8 -8
  21. package/plugins/config-ui/lib/registry.mjs +282 -282
  22. package/plugins/config-ui/lib/secrets.mjs +44 -44
  23. package/plugins/config-ui/lib/server.mjs +250 -250
  24. package/plugins/config-ui/lib/sources.mjs +96 -96
  25. package/plugins/config-ui/lib/state.mjs +156 -156
  26. package/plugins/config-ui/lib/themes.mjs +113 -113
  27. package/plugins/config-ui/lib/writer.mjs +690 -690
  28. package/plugins/config-ui/project-local-owner.ts +106 -106
  29. package/plugins/config-ui/vc-extras.plugin.json +13 -0
  30. package/plugins/config-ui/web/app.mjs +997 -997
  31. package/plugins/config-ui/web/index.html +342 -342
  32. package/plugins/pi-blackhole/vc-extras.plugin.json +12 -0
  33. package/plugins/pi-btw/vc-extras.plugin.json +12 -0
  34. package/plugins/pi-claude-code/vc-extras.plugin.json +12 -0
  35. package/plugins/pi-fff/vc-extras.plugin.json +12 -0
  36. package/plugins/pi-jev-auto-mode/vc-extras.plugin.json +12 -0
  37. package/plugins/pi-mcp-adapter/vc-extras.plugin.json +12 -0
  38. package/plugins/pi-web-access/vc-extras.plugin.json +12 -0
  39. package/plugins/vc-ask/claude-hook.mjs +37 -0
  40. package/plugins/vc-ask/codex-native.mjs +28 -0
  41. package/plugins/vc-ask/host-channel.mjs +75 -0
  42. package/plugins/vc-ask/index.ts +57 -0
  43. package/plugins/vc-ask/native-questions.mjs +33 -0
  44. package/plugins/vc-ask/package.json +10 -0
  45. package/plugins/vc-ask/payload.ts +170 -0
  46. package/plugins/vc-ask/questionnaire/LICENSE.ask-user-question +21 -0
  47. package/plugins/vc-ask/questionnaire/UPSTREAM.md +104 -0
  48. package/plugins/vc-ask/questionnaire/answer-channel.ts +135 -0
  49. package/plugins/vc-ask/questionnaire/config.ts +180 -0
  50. package/plugins/vc-ask/questionnaire/events.ts +154 -0
  51. package/plugins/vc-ask/questionnaire/execute.ts +688 -0
  52. package/plugins/vc-ask/questionnaire/i18n.ts +73 -0
  53. package/plugins/vc-ask/questionnaire/inline-entry.ts +312 -0
  54. package/plugins/vc-ask/questionnaire/locales/de.json +43 -0
  55. package/plugins/vc-ask/questionnaire/locales/en.json +42 -0
  56. package/plugins/vc-ask/questionnaire/locales/es.json +43 -0
  57. package/plugins/vc-ask/questionnaire/locales/fr.json +43 -0
  58. package/plugins/vc-ask/questionnaire/locales/pt-BR.json +43 -0
  59. package/plugins/vc-ask/questionnaire/locales/pt.json +43 -0
  60. package/plugins/vc-ask/questionnaire/locales/ru.json +43 -0
  61. package/plugins/vc-ask/questionnaire/locales/uk.json +43 -0
  62. package/plugins/vc-ask/questionnaire/locales/zh.json +46 -0
  63. package/plugins/vc-ask/questionnaire/presentation.ts +11 -0
  64. package/plugins/vc-ask/questionnaire/question-preview.ts +6 -0
  65. package/plugins/vc-ask/questionnaire/rpc.ts +221 -0
  66. package/plugins/vc-ask/questionnaire/session-timeout.ts +67 -0
  67. package/plugins/vc-ask/questionnaire/state/build-questionnaire.ts +144 -0
  68. package/plugins/vc-ask/questionnaire/state/external-editor.ts +62 -0
  69. package/plugins/vc-ask/questionnaire/state/geometry.ts +131 -0
  70. package/plugins/vc-ask/questionnaire/state/key-router.ts +382 -0
  71. package/plugins/vc-ask/questionnaire/state/panel-router.ts +32 -0
  72. package/plugins/vc-ask/questionnaire/state/questionnaire-session.ts +642 -0
  73. package/plugins/vc-ask/questionnaire/state/row-intent.ts +143 -0
  74. package/plugins/vc-ask/questionnaire/state/selectors/contract.ts +24 -0
  75. package/plugins/vc-ask/questionnaire/state/selectors/derivations.ts +40 -0
  76. package/plugins/vc-ask/questionnaire/state/selectors/focus.ts +17 -0
  77. package/plugins/vc-ask/questionnaire/state/selectors/projections.ts +99 -0
  78. package/plugins/vc-ask/questionnaire/state/state-reducer.ts +455 -0
  79. package/plugins/vc-ask/questionnaire/state/state.ts +90 -0
  80. package/plugins/vc-ask/questionnaire/state/vertical.ts +158 -0
  81. package/plugins/vc-ask/questionnaire/timeout.ts +59 -0
  82. package/plugins/vc-ask/questionnaire/tool/external-answer.ts +103 -0
  83. package/plugins/vc-ask/questionnaire/tool/format-answer.ts +24 -0
  84. package/plugins/vc-ask/questionnaire/tool/normalize-params.ts +37 -0
  85. package/plugins/vc-ask/questionnaire/tool/response-envelope.ts +75 -0
  86. package/plugins/vc-ask/questionnaire/tool/types.ts +74 -0
  87. package/plugins/vc-ask/questionnaire/tool/validate-questionnaire.ts +75 -0
  88. package/plugins/vc-ask/questionnaire/view/card-theme.ts +245 -0
  89. package/plugins/vc-ask/questionnaire/view/components/inline-input.ts +66 -0
  90. package/plugins/vc-ask/questionnaire/view/components/multi-select-view.ts +177 -0
  91. package/plugins/vc-ask/questionnaire/view/components/option-list-view.ts +65 -0
  92. package/plugins/vc-ask/questionnaire/view/components/preview/markdown-content-cache.ts +101 -0
  93. package/plugins/vc-ask/questionnaire/view/components/preview/preview-block-renderer.ts +130 -0
  94. package/plugins/vc-ask/questionnaire/view/components/preview/preview-box-renderer.ts +86 -0
  95. package/plugins/vc-ask/questionnaire/view/components/preview/preview-layout-decider.ts +204 -0
  96. package/plugins/vc-ask/questionnaire/view/components/preview/preview-pane.ts +257 -0
  97. package/plugins/vc-ask/questionnaire/view/components/submit-picker.ts +65 -0
  98. package/plugins/vc-ask/questionnaire/view/components/tab-bar.ts +57 -0
  99. package/plugins/vc-ask/questionnaire/view/components/wrapping-select.ts +269 -0
  100. package/plugins/vc-ask/questionnaire/view/dialog-builder.ts +319 -0
  101. package/plugins/vc-ask/questionnaire/view/document-theme.ts +53 -0
  102. package/plugins/vc-ask/questionnaire/view/document-view.ts +306 -0
  103. package/plugins/vc-ask/questionnaire/view/panel-chrome.ts +133 -0
  104. package/plugins/vc-ask/questionnaire/view/props-adapter.ts +77 -0
  105. package/plugins/vc-ask/questionnaire/view/stateful-view.ts +24 -0
  106. package/plugins/vc-ask/questionnaire/view/tab-components.ts +16 -0
  107. package/plugins/vc-ask/questionnaire/view/tab-content-strategy.ts +280 -0
  108. package/plugins/vc-ask/questionnaire/view/vertical-view.ts +218 -0
  109. package/plugins/vc-ask/user-input-events.ts +34 -0
  110. package/plugins/vc-ask/vc-extras.plugin.json +18 -0
  111. package/plugins/vc-footer/agents/claude-code/adapter.mjs +29 -0
  112. package/plugins/vc-footer/agents/claude-code/cli.mjs +23 -0
  113. package/plugins/vc-footer/agents/claude-code/renderer.mjs +1 -0
  114. package/plugins/vc-footer/agents/claude-code/types.d.ts +38 -0
  115. package/plugins/vc-footer/agents/codex/adapter.mjs +13 -0
  116. package/plugins/vc-footer/agents/codex/mcp.mjs +45 -0
  117. package/plugins/vc-footer/agents/codex/native.mjs +19 -0
  118. package/plugins/vc-footer/agents/codex/renderer.mjs +2 -0
  119. package/plugins/vc-footer/agents/pi/adapter.mjs +23 -0
  120. package/plugins/vc-footer/agents/pi/index.js +84 -0
  121. package/plugins/vc-footer/agents/pi/project-local-owner.mjs +97 -0
  122. package/plugins/vc-footer/agents/pi/renderer.mjs +5 -0
  123. package/plugins/vc-footer/core/data.mjs +218 -0
  124. package/plugins/vc-footer/core/render.mjs +291 -0
  125. package/plugins/vc-footer/core/types.d.ts +29 -0
  126. package/plugins/vc-footer/package.json +22 -0
  127. package/plugins/vc-footer/vc-extras.plugin.json +32 -0
  128. package/skills/animate/LICENSE +21 -21
  129. package/skills/animate/RECIPES.md +324 -324
  130. package/skills/animate/SKILL.md +208 -208
  131. package/skills/animate/UPSTREAM.md +19 -19
  132. package/skills/animation-performance/LICENSE +21 -21
  133. package/skills/animation-performance/SKILL.md +223 -223
  134. package/skills/animation-performance/UPSTREAM.md +19 -19
  135. package/skills/answer-me-with-html/SKILL.md +174 -174
  136. package/skills/answer-me-with-html/scripts/am.mjs +12896 -12896
  137. package/skills/apple-design/LICENSE +21 -21
  138. package/skills/apple-design/SKILL.md +291 -291
  139. package/skills/apple-design/UPSTREAM.md +19 -19
  140. package/skills/bad-smell/SKILL.md +44 -44
  141. package/skills/commit/SKILL.md +90 -90
  142. package/skills/emil-design-eng/LICENSE +21 -21
  143. package/skills/emil-design-eng/SKILL.md +677 -677
  144. package/skills/emil-design-eng/UPSTREAM.md +19 -19
  145. package/skills/find-the-truth/SKILL.md +38 -38
  146. package/skills/find-the-truth/references/trace-method.md +48 -48
  147. package/skills/find-the-truth/references/truth-method.md +39 -39
  148. package/skills/gestures/LICENSE +21 -21
  149. package/skills/gestures/SKILL.md +107 -107
  150. package/skills/gestures/UPSTREAM.md +19 -19
  151. package/skills/humanizer-zh/LICENSE +21 -21
  152. package/skills/humanizer-zh/SKILL.md +409 -409
  153. package/skills/humanizer-zh/UPSTREAM.md +7 -7
  154. package/skills/impeccable/LICENSE +191 -191
  155. package/skills/impeccable/NOTICE.md +11 -11
  156. package/skills/impeccable/SKILL.md +89 -89
  157. package/skills/impeccable/licenses/modern-screenshot-MIT.txt +8 -8
  158. package/skills/impeccable/licenses/platform-design-skills-MIT.txt +21 -21
  159. package/skills/impeccable/reference/adapt.md +318 -318
  160. package/skills/impeccable/reference/adapt.native.md +58 -58
  161. package/skills/impeccable/reference/android.md +46 -46
  162. package/skills/impeccable/reference/animate.md +89 -89
  163. package/skills/impeccable/reference/audit.md +139 -139
  164. package/skills/impeccable/reference/audit.native.md +139 -139
  165. package/skills/impeccable/reference/bolder.md +33 -33
  166. package/skills/impeccable/reference/clarify.md +94 -94
  167. package/skills/impeccable/reference/colorize.md +86 -86
  168. package/skills/impeccable/reference/component-review.md +63 -63
  169. package/skills/impeccable/reference/craft-floor.md +44 -44
  170. package/skills/impeccable/reference/craft.md +5 -5
  171. package/skills/impeccable/reference/critique.md +819 -819
  172. package/skills/impeccable/reference/degraded/asset-producer.md +41 -41
  173. package/skills/impeccable/reference/degraded/documenter.md +23 -23
  174. package/skills/impeccable/reference/degraded/finish-reviewer.md +37 -37
  175. package/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -92
  176. package/skills/impeccable/reference/delight.md +70 -70
  177. package/skills/impeccable/reference/distill.md +111 -111
  178. package/skills/impeccable/reference/doctor.md +54 -54
  179. package/skills/impeccable/reference/document.md +416 -416
  180. package/skills/impeccable/reference/extract.md +69 -69
  181. package/skills/impeccable/reference/generate.md +101 -101
  182. package/skills/impeccable/reference/harden.md +362 -362
  183. package/skills/impeccable/reference/hooks.md +114 -114
  184. package/skills/impeccable/reference/init.md +131 -131
  185. package/skills/impeccable/reference/ios.md +51 -51
  186. package/skills/impeccable/reference/layout.md +84 -84
  187. package/skills/impeccable/reference/live-setup.md +104 -104
  188. package/skills/impeccable/reference/live.md +327 -327
  189. package/skills/impeccable/reference/mode-operate.md +21 -21
  190. package/skills/impeccable/reference/mode-persuade.md +19 -19
  191. package/skills/impeccable/reference/mode-read.md +21 -21
  192. package/skills/impeccable/reference/new-work.md +152 -152
  193. package/skills/impeccable/reference/onboard.md +234 -234
  194. package/skills/impeccable/reference/operate.md +61 -61
  195. package/skills/impeccable/reference/optimize.md +257 -257
  196. package/skills/impeccable/reference/overdrive.md +127 -127
  197. package/skills/impeccable/reference/polish.md +105 -105
  198. package/skills/impeccable/reference/quieter.md +99 -99
  199. package/skills/impeccable/reference/region-map.md +26 -26
  200. package/skills/impeccable/reference/routing.md +24 -24
  201. package/skills/impeccable/reference/shape.md +59 -59
  202. package/skills/impeccable/reference/typeset.md +90 -90
  203. package/skills/impeccable/reference/visualize.md +47 -47
  204. package/skills/impeccable/scripts/VERSION +1 -1
  205. package/skills/impeccable/scripts/command-metadata.json +98 -98
  206. package/skills/impeccable/scripts/data/font-index-failures.json +120 -120
  207. package/skills/impeccable/scripts/engine-checksums.txt +9 -9
  208. package/skills/impeccable/scripts/impeccable +249 -249
  209. package/skills/impeccable/scripts/impeccable.cmd +278 -278
  210. package/skills/impeccable/scripts/live-browser-dom.js +320 -320
  211. package/skills/impeccable/scripts/live-browser-ignores.js +246 -246
  212. package/skills/impeccable/scripts/live-browser-session.js +183 -183
  213. package/skills/impeccable/scripts/live-browser.js +13862 -13862
  214. package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -14
  215. package/skills/improve-animations/AUDIT.md +115 -115
  216. package/skills/improve-animations/LICENSE +21 -21
  217. package/skills/improve-animations/PLAN-TEMPLATE.md +73 -73
  218. package/skills/improve-animations/SKILL.md +110 -110
  219. package/skills/improve-animations/UPSTREAM.md +19 -19
  220. package/skills/pick-ui-library/LICENSE +21 -21
  221. package/skills/pick-ui-library/SKILL.md +85 -85
  222. package/skills/pick-ui-library/UPSTREAM.md +19 -19
  223. package/skills/review-animations/LICENSE +21 -21
  224. package/skills/review-animations/SKILL.md +120 -120
  225. package/skills/review-animations/STANDARDS.md +187 -187
  226. package/skills/review-animations/UPSTREAM.md +19 -19
  227. package/skills/test/SKILL.md +29 -29
  228. package/skills/test/references/test-method.md +60 -60
  229. package/skills/write-doc/SKILL.md +115 -115
  230. package/skills/write-doc/examples/result-report.md +53 -53
  231. package/skills/write-doc/examples/task-summary.md +45 -45
  232. package/skills/write-doc/references/terminology.md +147 -147
  233. package/specs/ask-host-protocol-v1.md +58 -0
  234. package/specs/design-demo.md +1102 -1102
  235. package/specs/frontend-immersive.md +28 -28
  236. package/specs/plugin-install-v2.md +123 -0
  237. package/specs/plugin-install.md +38 -0
  238. package/specs/web-modes/explore.md +31 -31
  239. package/specs/web-modes/risk.md +15 -15
  240. package/specs/web-modes/verify.md +16 -16
  241. package/vc-extras.mjs +46 -62
  242. package/plugins/essrj/context.ts +0 -47
  243. package/plugins/essrj/data.ts +0 -190
  244. package/plugins/essrj/index.ts +0 -139
  245. package/plugins/essrj/package.json +0 -12
  246. package/plugins/essrj/project-local-owner.ts +0 -106
  247. package/plugins/essrj/render.ts +0 -217
  248. package/plugins/essrj/types.ts +0 -40
  249. package/plugins.json +0 -38
@@ -1,249 +1,249 @@
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". Trusted candidates (IMPECCABLE_BIN, the sibling binary,
10
- # the version-pinned cache) are exec'd without a probe: hooks run them on
11
- # every edit and must stay fast. The version-pinned cache and the download are
12
- # verified against engine-checksums.txt (next to this script), never against
13
- # anything published beside the binary; a <binary>.verified stamp records that
14
- # a cached binary passed, so only the first run hashes it.
15
- set -eu
16
-
17
- # True when the candidate answers the engine handshake (prints
18
- # "impeccable-engine <version>", exit 0). Quiet and fast (<100ms).
19
- # IMPECCABLE_LAUNCHER_PROBE marks the child as a probe: a copy of this
20
- # launcher reached recursively (e.g. symlinked onto PATH as `impeccable`)
21
- # then skips its own probes and refuses to download, so probing stays cheap
22
- # and can never loop.
23
- probe_ok() {
24
- probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
25
- case "$probe_out" in
26
- impeccable-engine*) return 0 ;;
27
- esac
28
- return 1
29
- }
30
- probing=${IMPECCABLE_LAUNCHER_PROBE:-}
31
-
32
- # Prints the digest engine-checksums.txt records for engine version $1 and
33
- # asset $2 (lines are "<version> <asset> <sha256>"), nothing when there is none.
34
- # A CR is a separator too (CRLF checkouts), and a last line with no newline
35
- # still counts.
36
- manifest_digest() {
37
- [ -f "$manifest" ] || return 0
38
- while IFS="$(printf ' \t\r')" read -r m_version m_asset m_sum _ || [ -n "$m_version" ]; do
39
- case "$m_version" in ''|'#'*) continue ;; esac
40
- if [ "$m_version" = "$1" ] && [ "$m_asset" = "$2" ]; then
41
- printf '%s' "$m_sum"
42
- return 0
43
- fi
44
- done < "$manifest"
45
- return 0
46
- }
47
- # Sets $expected (and, on Windows on ARM, which runs x64 binaries,
48
- # $expected_x64) from engine-checksums.txt. Only called off the stamped fast
49
- # path: hooks run this launcher on every edit.
50
- read_expected() {
51
- expected=$(manifest_digest "$version" "$asset")
52
- expected_x64=""
53
- if [ "$os" = windows ] && [ "$arch" = arm64 ]; then
54
- expected_x64=$(manifest_digest "$version" impeccable-windows-x64.exe)
55
- fi
56
- }
57
- # Sets $actual to the sha256 of $1, empty when no hash tool works.
58
- hash_file() {
59
- actual=""
60
- if command -v shasum >/dev/null 2>&1; then
61
- if digest=$(shasum -a 256 "$1" 2>/dev/null); then actual=${digest%% *}; fi
62
- elif command -v sha256sum >/dev/null 2>&1; then
63
- if digest=$(sha256sum "$1" 2>/dev/null); then actual=${digest%% *}; fi
64
- fi
65
- }
66
-
67
- dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
68
- manifest="$dir/engine-checksums.txt"
69
-
70
- # What the binary needs to know about its home: the skill directory (for
71
- # reference/*.md and command-metadata.json) and how to name itself in the
72
- # commands it prints. Exported BEFORE any exec below, including the
73
- # IMPECCABLE_BIN override: an engine binary reached with no IMPECCABLE_SKILL_DIR
74
- # cannot find reference/*.md (so native platform refs never inline) or read its
75
- # own version (so UPDATE_AVAILABLE never fires). Setting it here covers every
76
- # candidate the launcher can exec.
77
- : "${IMPECCABLE_SKILL_DIR:=$(CDPATH= cd -- "$dir/.." && pwd)}"
78
- : "${IMPECCABLE_SELF:=$0}"
79
- export IMPECCABLE_SKILL_DIR IMPECCABLE_SELF
80
-
81
- if [ -n "${IMPECCABLE_BIN:-}" ] && [ -x "${IMPECCABLE_BIN}" ]; then
82
- exec "${IMPECCABLE_BIN}" "$@"
83
- fi
84
-
85
- case "$(uname -s 2>/dev/null || echo unknown)" in
86
- Darwin) os=darwin ;;
87
- Linux) os=linux ;;
88
- MINGW*|MSYS*|CYGWIN*|Windows_NT) os=windows ;;
89
- *) os=unknown ;;
90
- esac
91
- case "$(uname -m 2>/dev/null || echo unknown)" in
92
- arm64|aarch64) arch=arm64 ;;
93
- x86_64|amd64) arch=x64 ;;
94
- *) arch=unknown ;;
95
- esac
96
-
97
- bin="$dir/bin/$os-$arch/impeccable"
98
- [ "$os" = windows ] && bin="$bin.exe"
99
-
100
- if [ -x "$bin" ]; then
101
- exec "$bin" "$@"
102
- fi
103
- if [ -f "$bin" ]; then
104
- # Lost the executable bit in transit (zip extraction, some copiers).
105
- chmod +x "$bin" 2>/dev/null && exec "$bin" "$@"
106
- fi
107
- # On Windows (an MSYS/Git Bash shell) the cached names carry .exe so this
108
- # launcher and impeccable.cmd share one cache.
109
- exe=""
110
- [ "$os" = windows ] && exe=".exe"
111
- home_bin="${HOME:-/nonexistent}/.impeccable/bin/impeccable$exe"
112
- if [ -z "$probing" ] && [ -x "$home_bin" ] && probe_ok "$home_bin"; then
113
- exec "$home_bin" "$@"
114
- fi
115
- # Version-pinned user cache, filled by the download below or by `impeccable update`.
116
- version=""
117
- [ -f "$dir/VERSION" ] && version=$(tr -d '[:space:]' < "$dir/VERSION")
118
- cache_root="${IMPECCABLE_HOME:-${HOME:-/nonexistent}/.impeccable}"
119
- cached="$cache_root/bin/$version/impeccable$exe"
120
- asset="impeccable-$os-$arch"
121
- [ "$os" = windows ] && asset="$asset.exe"
122
- if [ -n "$version" ] && [ -x "$cached" ]; then
123
- if [ -f "$cached.verified" ]; then
124
- exec "$cached" "$@"
125
- fi
126
- read_expected
127
- hash_file "$cached"
128
- if [ -n "$actual" ] && { [ "$actual" = "$expected" ] || [ "$actual" = "$expected_x64" ]; }; then
129
- { echo "$actual" > "$cached.verified"; } 2>/dev/null || :
130
- exec "$cached" "$@"
131
- fi
132
- echo "impeccable: cannot verify the cached engine $cached against $manifest; not using it" >&2
133
- fi
134
- if [ -z "$probing" ] && command -v impeccable >/dev/null 2>&1 && probe_ok impeccable; then
135
- exec impeccable "$@"
136
- fi
137
-
138
- # Last resort: fetch this version's binary for the current platform from the
139
- # public release channel into the user cache. Needs network; sandboxes without
140
- # egress preinstall the binary on PATH instead.
141
- setup_help() {
142
- echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
143
- echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
144
- echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
145
- }
146
- fetch_url() {
147
- if command -v curl >/dev/null 2>&1; then
148
- curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
149
- elif command -v wget >/dev/null 2>&1; then
150
- wget -q -O "$tmp" "$1" 2>/dev/null
151
- else
152
- return 1
153
- fi
154
- }
155
- check_download() {
156
- download_file=${1:-$tmp}
157
- if [ ! -f "$download_file" ]; then
158
- 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
159
- exit 127
160
- fi
161
- if [ ! -s "$download_file" ]; then
162
- rm -f "$download_file"
163
- echo "impeccable: downloaded file is empty: $url; refusing the unverified download" >&2
164
- exit 127
165
- fi
166
- }
167
- if [ -n "$probing" ]; then
168
- # Inside another launcher's probe: no download, fail fast and quiet.
169
- exit 127
170
- fi
171
- if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
172
- base="${IMPECCABLE_DOWNLOAD_BASE:-https://github.com/pbakaus/impeccable/releases/download}"
173
- url="$base/engine-v$version/$asset"
174
- read_expected
175
- # Fail closed before any network traffic or cache write.
176
- if [ -z "$expected" ] && [ -z "$expected_x64" ]; then
177
- echo "impeccable: no checksum for engine $version ($asset) in $manifest; refusing the unverified download" >&2
178
- exit 127
179
- fi
180
- tmp="$cache_root/bin/$version/.impeccable.part.$$"
181
- # An interrupted download (Ctrl-C, a hook timeout) would otherwise leave the
182
- # PID-named staging file behind for good. The handlers must exit explicitly.
183
- cleanup() { rm -f "$tmp" 2>/dev/null || :; }
184
- trap 'cleanup; exit 129' HUP
185
- trap 'cleanup; exit 130' INT
186
- trap 'cleanup; exit 143' TERM
187
- if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
188
- echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
189
- setup_help
190
- exit 127
191
- fi
192
- # Check the actual staging file, not just directory existence: a cache from
193
- # an earlier run can be readable but no longer writable inside a sandbox.
194
- if ! (umask 077; : > "$tmp") 2>/dev/null; then
195
- echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
196
- setup_help
197
- exit 127
198
- fi
199
- fetched=0
200
- if [ -n "$expected" ] && fetch_url "$url"; then
201
- fetched=1
202
- elif [ -n "$expected_x64" ]; then
203
- # Windows on ARM runs x64 binaries; fall back when no arm64 asset exists.
204
- url="$base/engine-v$version/impeccable-windows-x64.exe"
205
- expected=$expected_x64
206
- fetch_url "$url" && fetched=1
207
- fi
208
- if [ "$fetched" = 1 ]; then
209
- check_download
210
- # No sha256 tool refuses the download too.
211
- hash_file "$tmp"
212
- check_download
213
- if [ -z "$actual" ]; then
214
- rm -f "$tmp"
215
- echo "impeccable: cannot verify $url (no sha256 tool, or hashing failed); refusing the unverified download" >&2
216
- exit 127
217
- fi
218
- if [ "$actual" != "$expected" ]; then
219
- rm -f "$tmp"
220
- echo "impeccable: checksum mismatch downloading $url" >&2
221
- exit 127
222
- fi
223
- check_download
224
- if ! chmod +x "$tmp" 2>/dev/null; then
225
- check_download
226
- rm -f "$tmp"
227
- echo "impeccable: could not make the verified download executable: $url" >&2
228
- exit 127
229
- fi
230
- check_download
231
- if ! mv -f "$tmp" "$cached" 2>/dev/null; then
232
- check_download
233
- rm -f "$tmp"
234
- echo "impeccable: could not cache the verified download: $url" >&2
235
- exit 127
236
- fi
237
- check_download "$cached"
238
- { echo "$actual" > "$cached.verified"; } 2>/dev/null || :
239
- exec "$cached" "$@"
240
- fi
241
- rm -f "$tmp" 2>/dev/null
242
- echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
243
- setup_help
244
- exit 127
245
- fi
246
-
247
- echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
248
- 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
249
- exit 127
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". Trusted candidates (IMPECCABLE_BIN, the sibling binary,
10
+ # the version-pinned cache) are exec'd without a probe: hooks run them on
11
+ # every edit and must stay fast. The version-pinned cache and the download are
12
+ # verified against engine-checksums.txt (next to this script), never against
13
+ # anything published beside the binary; a <binary>.verified stamp records that
14
+ # a cached binary passed, so only the first run hashes it.
15
+ set -eu
16
+
17
+ # True when the candidate answers the engine handshake (prints
18
+ # "impeccable-engine <version>", exit 0). Quiet and fast (<100ms).
19
+ # IMPECCABLE_LAUNCHER_PROBE marks the child as a probe: a copy of this
20
+ # launcher reached recursively (e.g. symlinked onto PATH as `impeccable`)
21
+ # then skips its own probes and refuses to download, so probing stays cheap
22
+ # and can never loop.
23
+ probe_ok() {
24
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
25
+ case "$probe_out" in
26
+ impeccable-engine*) return 0 ;;
27
+ esac
28
+ return 1
29
+ }
30
+ probing=${IMPECCABLE_LAUNCHER_PROBE:-}
31
+
32
+ # Prints the digest engine-checksums.txt records for engine version $1 and
33
+ # asset $2 (lines are "<version> <asset> <sha256>"), nothing when there is none.
34
+ # A CR is a separator too (CRLF checkouts), and a last line with no newline
35
+ # still counts.
36
+ manifest_digest() {
37
+ [ -f "$manifest" ] || return 0
38
+ while IFS="$(printf ' \t\r')" read -r m_version m_asset m_sum _ || [ -n "$m_version" ]; do
39
+ case "$m_version" in ''|'#'*) continue ;; esac
40
+ if [ "$m_version" = "$1" ] && [ "$m_asset" = "$2" ]; then
41
+ printf '%s' "$m_sum"
42
+ return 0
43
+ fi
44
+ done < "$manifest"
45
+ return 0
46
+ }
47
+ # Sets $expected (and, on Windows on ARM, which runs x64 binaries,
48
+ # $expected_x64) from engine-checksums.txt. Only called off the stamped fast
49
+ # path: hooks run this launcher on every edit.
50
+ read_expected() {
51
+ expected=$(manifest_digest "$version" "$asset")
52
+ expected_x64=""
53
+ if [ "$os" = windows ] && [ "$arch" = arm64 ]; then
54
+ expected_x64=$(manifest_digest "$version" impeccable-windows-x64.exe)
55
+ fi
56
+ }
57
+ # Sets $actual to the sha256 of $1, empty when no hash tool works.
58
+ hash_file() {
59
+ actual=""
60
+ if command -v shasum >/dev/null 2>&1; then
61
+ if digest=$(shasum -a 256 "$1" 2>/dev/null); then actual=${digest%% *}; fi
62
+ elif command -v sha256sum >/dev/null 2>&1; then
63
+ if digest=$(sha256sum "$1" 2>/dev/null); then actual=${digest%% *}; fi
64
+ fi
65
+ }
66
+
67
+ dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
68
+ manifest="$dir/engine-checksums.txt"
69
+
70
+ # What the binary needs to know about its home: the skill directory (for
71
+ # reference/*.md and command-metadata.json) and how to name itself in the
72
+ # commands it prints. Exported BEFORE any exec below, including the
73
+ # IMPECCABLE_BIN override: an engine binary reached with no IMPECCABLE_SKILL_DIR
74
+ # cannot find reference/*.md (so native platform refs never inline) or read its
75
+ # own version (so UPDATE_AVAILABLE never fires). Setting it here covers every
76
+ # candidate the launcher can exec.
77
+ : "${IMPECCABLE_SKILL_DIR:=$(CDPATH= cd -- "$dir/.." && pwd)}"
78
+ : "${IMPECCABLE_SELF:=$0}"
79
+ export IMPECCABLE_SKILL_DIR IMPECCABLE_SELF
80
+
81
+ if [ -n "${IMPECCABLE_BIN:-}" ] && [ -x "${IMPECCABLE_BIN}" ]; then
82
+ exec "${IMPECCABLE_BIN}" "$@"
83
+ fi
84
+
85
+ case "$(uname -s 2>/dev/null || echo unknown)" in
86
+ Darwin) os=darwin ;;
87
+ Linux) os=linux ;;
88
+ MINGW*|MSYS*|CYGWIN*|Windows_NT) os=windows ;;
89
+ *) os=unknown ;;
90
+ esac
91
+ case "$(uname -m 2>/dev/null || echo unknown)" in
92
+ arm64|aarch64) arch=arm64 ;;
93
+ x86_64|amd64) arch=x64 ;;
94
+ *) arch=unknown ;;
95
+ esac
96
+
97
+ bin="$dir/bin/$os-$arch/impeccable"
98
+ [ "$os" = windows ] && bin="$bin.exe"
99
+
100
+ if [ -x "$bin" ]; then
101
+ exec "$bin" "$@"
102
+ fi
103
+ if [ -f "$bin" ]; then
104
+ # Lost the executable bit in transit (zip extraction, some copiers).
105
+ chmod +x "$bin" 2>/dev/null && exec "$bin" "$@"
106
+ fi
107
+ # On Windows (an MSYS/Git Bash shell) the cached names carry .exe so this
108
+ # launcher and impeccable.cmd share one cache.
109
+ exe=""
110
+ [ "$os" = windows ] && exe=".exe"
111
+ home_bin="${HOME:-/nonexistent}/.impeccable/bin/impeccable$exe"
112
+ if [ -z "$probing" ] && [ -x "$home_bin" ] && probe_ok "$home_bin"; then
113
+ exec "$home_bin" "$@"
114
+ fi
115
+ # Version-pinned user cache, filled by the download below or by `impeccable update`.
116
+ version=""
117
+ [ -f "$dir/VERSION" ] && version=$(tr -d '[:space:]' < "$dir/VERSION")
118
+ cache_root="${IMPECCABLE_HOME:-${HOME:-/nonexistent}/.impeccable}"
119
+ cached="$cache_root/bin/$version/impeccable$exe"
120
+ asset="impeccable-$os-$arch"
121
+ [ "$os" = windows ] && asset="$asset.exe"
122
+ if [ -n "$version" ] && [ -x "$cached" ]; then
123
+ if [ -f "$cached.verified" ]; then
124
+ exec "$cached" "$@"
125
+ fi
126
+ read_expected
127
+ hash_file "$cached"
128
+ if [ -n "$actual" ] && { [ "$actual" = "$expected" ] || [ "$actual" = "$expected_x64" ]; }; then
129
+ { echo "$actual" > "$cached.verified"; } 2>/dev/null || :
130
+ exec "$cached" "$@"
131
+ fi
132
+ echo "impeccable: cannot verify the cached engine $cached against $manifest; not using it" >&2
133
+ fi
134
+ if [ -z "$probing" ] && command -v impeccable >/dev/null 2>&1 && probe_ok impeccable; then
135
+ exec impeccable "$@"
136
+ fi
137
+
138
+ # Last resort: fetch this version's binary for the current platform from the
139
+ # public release channel into the user cache. Needs network; sandboxes without
140
+ # egress preinstall the binary on PATH instead.
141
+ setup_help() {
142
+ echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
143
+ echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
144
+ echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
145
+ }
146
+ fetch_url() {
147
+ if command -v curl >/dev/null 2>&1; then
148
+ curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
149
+ elif command -v wget >/dev/null 2>&1; then
150
+ wget -q -O "$tmp" "$1" 2>/dev/null
151
+ else
152
+ return 1
153
+ fi
154
+ }
155
+ check_download() {
156
+ download_file=${1:-$tmp}
157
+ if [ ! -f "$download_file" ]; then
158
+ 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
159
+ exit 127
160
+ fi
161
+ if [ ! -s "$download_file" ]; then
162
+ rm -f "$download_file"
163
+ echo "impeccable: downloaded file is empty: $url; refusing the unverified download" >&2
164
+ exit 127
165
+ fi
166
+ }
167
+ if [ -n "$probing" ]; then
168
+ # Inside another launcher's probe: no download, fail fast and quiet.
169
+ exit 127
170
+ fi
171
+ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
172
+ base="${IMPECCABLE_DOWNLOAD_BASE:-https://github.com/pbakaus/impeccable/releases/download}"
173
+ url="$base/engine-v$version/$asset"
174
+ read_expected
175
+ # Fail closed before any network traffic or cache write.
176
+ if [ -z "$expected" ] && [ -z "$expected_x64" ]; then
177
+ echo "impeccable: no checksum for engine $version ($asset) in $manifest; refusing the unverified download" >&2
178
+ exit 127
179
+ fi
180
+ tmp="$cache_root/bin/$version/.impeccable.part.$$"
181
+ # An interrupted download (Ctrl-C, a hook timeout) would otherwise leave the
182
+ # PID-named staging file behind for good. The handlers must exit explicitly.
183
+ cleanup() { rm -f "$tmp" 2>/dev/null || :; }
184
+ trap 'cleanup; exit 129' HUP
185
+ trap 'cleanup; exit 130' INT
186
+ trap 'cleanup; exit 143' TERM
187
+ if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
188
+ echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
189
+ setup_help
190
+ exit 127
191
+ fi
192
+ # Check the actual staging file, not just directory existence: a cache from
193
+ # an earlier run can be readable but no longer writable inside a sandbox.
194
+ if ! (umask 077; : > "$tmp") 2>/dev/null; then
195
+ echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
196
+ setup_help
197
+ exit 127
198
+ fi
199
+ fetched=0
200
+ if [ -n "$expected" ] && fetch_url "$url"; then
201
+ fetched=1
202
+ elif [ -n "$expected_x64" ]; then
203
+ # Windows on ARM runs x64 binaries; fall back when no arm64 asset exists.
204
+ url="$base/engine-v$version/impeccable-windows-x64.exe"
205
+ expected=$expected_x64
206
+ fetch_url "$url" && fetched=1
207
+ fi
208
+ if [ "$fetched" = 1 ]; then
209
+ check_download
210
+ # No sha256 tool refuses the download too.
211
+ hash_file "$tmp"
212
+ check_download
213
+ if [ -z "$actual" ]; then
214
+ rm -f "$tmp"
215
+ echo "impeccable: cannot verify $url (no sha256 tool, or hashing failed); refusing the unverified download" >&2
216
+ exit 127
217
+ fi
218
+ if [ "$actual" != "$expected" ]; then
219
+ rm -f "$tmp"
220
+ echo "impeccable: checksum mismatch downloading $url" >&2
221
+ exit 127
222
+ fi
223
+ check_download
224
+ if ! chmod +x "$tmp" 2>/dev/null; then
225
+ check_download
226
+ rm -f "$tmp"
227
+ echo "impeccable: could not make the verified download executable: $url" >&2
228
+ exit 127
229
+ fi
230
+ check_download
231
+ if ! mv -f "$tmp" "$cached" 2>/dev/null; then
232
+ check_download
233
+ rm -f "$tmp"
234
+ echo "impeccable: could not cache the verified download: $url" >&2
235
+ exit 127
236
+ fi
237
+ check_download "$cached"
238
+ { echo "$actual" > "$cached.verified"; } 2>/dev/null || :
239
+ exec "$cached" "$@"
240
+ fi
241
+ rm -f "$tmp" 2>/dev/null
242
+ echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
243
+ setup_help
244
+ exit 127
245
+ fi
246
+
247
+ echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
248
+ 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
249
+ exit 127