@bastani/atomic 0.9.20-alpha.4 → 0.9.20-alpha.5

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 (245) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/intercom/skills/intercom/SKILL.md +32 -1
  5. package/dist/builtin/mcp/package.json +1 -1
  6. package/dist/builtin/subagents/CHANGELOG.md +12 -0
  7. package/dist/builtin/subagents/README.md +2 -0
  8. package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
  9. package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
  10. package/dist/builtin/subagents/agents/codebase-online-researcher.md +3 -3
  11. package/dist/builtin/subagents/agents/debugger.md +7 -5
  12. package/dist/builtin/subagents/agents/worker.md +4 -2
  13. package/dist/builtin/subagents/package.json +1 -1
  14. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +56 -0
  15. package/dist/builtin/subagents/skills/subagent/SKILL.md +32 -8
  16. package/dist/builtin/subagents/src/extension/index.bundle.mjs +7 -4
  17. package/dist/builtin/web-access/package.json +1 -1
  18. package/dist/builtin/workflows/CHANGELOG.md +30 -0
  19. package/dist/builtin/workflows/README.md +4 -2
  20. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  21. package/dist/builtin/workflows/builtin/{chunk-n8g2da69.js → chunk-00ywx588.js} +1 -1
  22. package/dist/builtin/workflows/builtin/{chunk-d1xqh1rd.js → chunk-55p5dxjk.js} +1 -1
  23. package/dist/builtin/workflows/builtin/{chunk-1dydq7w3.js → chunk-7f381xnq.js} +62 -24
  24. package/dist/builtin/workflows/builtin/{chunk-k18g9me8.js → chunk-7h7s5xdj.js} +1 -1
  25. package/dist/builtin/workflows/builtin/{chunk-n4yxrsm9.js → chunk-e83tc6nr.js} +1 -1
  26. package/dist/builtin/workflows/builtin/{chunk-sn5mchnx.js → chunk-evfb0312.js} +1 -1
  27. package/dist/builtin/workflows/builtin/{chunk-scgprmdj.js → chunk-ne6vh5ct.js} +1 -1
  28. package/dist/builtin/workflows/builtin/{chunk-119kxb28.js → chunk-pfm1kgqz.js} +62 -43
  29. package/dist/builtin/workflows/builtin/{chunk-hnbbb5r0.js → chunk-tdqvdrg1.js} +4 -4
  30. package/dist/builtin/workflows/builtin/{chunk-kf5xpbkz.js → chunk-tvcydq13.js} +1 -1
  31. package/dist/builtin/workflows/builtin/{chunk-9y0f90rd.js → chunk-x2nftpgj.js} +1 -1
  32. package/dist/builtin/workflows/builtin/{chunk-vt9zgr9d.js → chunk-zj5162bh.js} +4 -4
  33. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  34. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  35. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  36. package/dist/builtin/workflows/builtin/goal.js +4 -4
  37. package/dist/builtin/workflows/builtin/index.d.ts +1 -1
  38. package/dist/builtin/workflows/builtin/index.js +12 -12
  39. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  40. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +1 -1
  41. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  42. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  43. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  44. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  45. package/dist/builtin/workflows/package.json +1 -1
  46. package/dist/builtin/workflows/skills/impeccable/SKILL.md +18 -11
  47. package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +1 -1
  48. package/dist/builtin/workflows/skills/impeccable/reference/adapt.native.md +1 -1
  49. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +1 -1
  50. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +5 -5
  51. package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +6 -6
  52. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +2 -2
  53. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +1 -1
  54. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +1 -1
  55. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +0 -6
  56. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +19 -41
  57. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +11 -65
  58. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +3 -3
  59. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +4 -4
  60. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +1 -1
  61. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +1 -1
  62. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  63. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +4 -4
  64. package/dist/builtin/workflows/skills/impeccable/reference/document.md +4 -4
  65. package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
  66. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -1
  67. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +21 -21
  68. package/dist/builtin/workflows/skills/impeccable/reference/init.md +8 -8
  69. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +2 -2
  70. package/dist/builtin/workflows/skills/impeccable/reference/live-setup.md +10 -8
  71. package/dist/builtin/workflows/skills/impeccable/reference/live.md +39 -38
  72. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +48 -21
  73. package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +1 -1
  74. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +1 -1
  75. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
  76. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +11 -3
  77. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +2 -2
  78. package/dist/builtin/workflows/skills/impeccable/reference/routing.md +13 -7
  79. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +2 -2
  80. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +13 -19
  81. package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -0
  82. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index-failures.json +121 -0
  83. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index.json +1 -0
  84. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +212 -0
  85. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +218 -0
  86. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-dom.js +21 -0
  87. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-ignores.js +242 -0
  88. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +25 -4
  89. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +666 -197
  90. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
  91. package/dist/builtin/workflows/src/extension/index.bundle.mjs +156 -84
  92. package/dist/builtin/workflows/src/index.js +62 -24
  93. package/dist/core/execution-model-router.d.ts +2 -0
  94. package/dist/core/execution-model-router.d.ts.map +1 -1
  95. package/dist/core/execution-model-router.js +30 -4
  96. package/dist/core/execution-model-router.js.map +1 -1
  97. package/dist/core/model-routing-task.d.ts +1 -1
  98. package/dist/core/model-routing-task.d.ts.map +1 -1
  99. package/dist/core/model-routing-task.js +4 -3
  100. package/dist/core/model-routing-task.js.map +1 -1
  101. package/dist/core/system-prompt.d.ts.map +1 -1
  102. package/dist/core/system-prompt.js +2 -1
  103. package/dist/core/system-prompt.js.map +1 -1
  104. package/dist/index.d.ts +1 -1
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +1 -1
  107. package/dist/index.js.map +1 -1
  108. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  109. package/dist/modes/interactive/components/chat-message-renderer.js +4 -0
  110. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  111. package/docs/computer-use.md +22 -21
  112. package/docs/getting-started/first-session.md +2 -2
  113. package/docs/getting-started/installation.md +6 -2
  114. package/docs/intercom.md +6 -1
  115. package/docs/models/model-selection.md +11 -7
  116. package/docs/quickstart.md +1 -1
  117. package/docs/skills.md +1 -1
  118. package/docs/subagents/reference.md +2 -2
  119. package/docs/subagents.md +7 -1
  120. package/docs/usage.md +2 -0
  121. package/docs/windows.md +1 -1
  122. package/docs/workflows/api-reference.md +3 -4
  123. package/docs/workflows/builtins.md +2 -2
  124. package/docs/workflows/operations.md +1 -1
  125. package/docs/workflows/reliable-design.md +12 -1
  126. package/docs/workflows/verification.md +8 -8
  127. package/npm-shrinkwrap.json +32 -32
  128. package/package.json +3 -3
  129. package/dist/builtin/subagents/skills/playwright-cli/SKILL.md +0 -420
  130. package/dist/builtin/subagents/skills/playwright-cli/references/element-attributes.md +0 -23
  131. package/dist/builtin/subagents/skills/playwright-cli/references/playwright-tests.md +0 -39
  132. package/dist/builtin/subagents/skills/playwright-cli/references/request-mocking.md +0 -87
  133. package/dist/builtin/subagents/skills/playwright-cli/references/running-code.md +0 -241
  134. package/dist/builtin/subagents/skills/playwright-cli/references/session-management.md +0 -225
  135. package/dist/builtin/subagents/skills/playwright-cli/references/storage-state.md +0 -275
  136. package/dist/builtin/subagents/skills/playwright-cli/references/test-generation.md +0 -433
  137. package/dist/builtin/subagents/skills/playwright-cli/references/tracing.md +0 -139
  138. package/dist/builtin/subagents/skills/playwright-cli/references/video-recording.md +0 -143
  139. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +0 -94
  140. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +0 -27
  141. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +0 -41
  142. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +0 -95
  143. package/dist/builtin/workflows/skills/impeccable/agents/openai.yaml +0 -4
  144. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +0 -695
  145. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +0 -325
  146. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +0 -1503
  147. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +0 -222
  148. package/dist/builtin/workflows/skills/impeccable/scripts/detect-csp.mjs +0 -198
  149. package/dist/builtin/workflows/skills/impeccable/scripts/detect.mjs +0 -21
  150. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +0 -2073
  151. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +0 -432
  152. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +0 -1121
  153. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -8746
  154. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +0 -51
  155. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -376
  156. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -1168
  157. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1192
  158. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -290
  159. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
  160. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +0 -18
  161. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +0 -213
  162. package/dist/builtin/workflows/skills/impeccable/scripts/detector/profile/profiler.mjs +0 -166
  163. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -617
  164. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +0 -5534
  165. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +0 -588
  166. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +0 -112
  167. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/fonts.mjs +0 -30
  168. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
  169. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +0 -35
  170. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +0 -338
  171. package/dist/builtin/workflows/skills/impeccable/scripts/embed-prompt.mjs +0 -270
  172. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +0 -277
  173. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +0 -783
  174. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +0 -2305
  175. package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +0 -78
  176. package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +0 -93
  177. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +0 -200
  178. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +0 -395
  179. package/dist/builtin/workflows/skills/impeccable/scripts/lib/design-parser.mjs +0 -925
  180. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +0 -640
  181. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +0 -137
  182. package/dist/builtin/workflows/skills/impeccable/scripts/lib/is-generated.mjs +0 -72
  183. package/dist/builtin/workflows/skills/impeccable/scripts/lib/open-system-browser.mjs +0 -57
  184. package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +0 -5
  185. package/dist/builtin/workflows/skills/impeccable/scripts/lib/roll-selection.mjs +0 -369
  186. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +0 -483
  187. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +0 -169
  188. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +0 -528
  189. package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +0 -151
  190. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-args.mjs +0 -42
  191. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +0 -33
  192. package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +0 -146
  193. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-css.mjs +0 -617
  194. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-verify.mjs +0 -71
  195. package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +0 -77
  196. package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +0 -28
  197. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +0 -199
  198. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/astro.mjs +0 -47
  199. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/detect-utils.mjs +0 -157
  200. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/index.mjs +0 -143
  201. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/journal.mjs +0 -205
  202. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nextjs.mjs +0 -49
  203. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nuxt.mjs +0 -170
  204. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/script-src.mjs +0 -26
  205. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/static-html.mjs +0 -26
  206. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/sveltekit.mjs +0 -71
  207. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tag-strategy.mjs +0 -247
  208. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tanstack-start.mjs +0 -70
  209. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/vite-generic.mjs +0 -42
  210. package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +0 -149
  211. package/dist/builtin/workflows/skills/impeccable/scripts/live/insert-ui.mjs +0 -458
  212. package/dist/builtin/workflows/skills/impeccable/scripts/live/instructions.mjs +0 -169
  213. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-apply.mjs +0 -939
  214. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
  215. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
  216. package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +0 -14
  217. package/dist/builtin/workflows/skills/impeccable/scripts/live/roots.mjs +0 -670
  218. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +0 -563
  219. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +0 -105
  220. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +0 -105
  221. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-ast.mjs +0 -969
  222. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +0 -1401
  223. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +0 -314
  224. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +0 -280
  225. package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-surfaces.mjs +0 -75
  226. package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +0 -171
  227. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +0 -961
  228. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +0 -1244
  229. package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +0 -107
  230. package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +0 -800
  231. package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
  232. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +0 -515
  233. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +0 -292
  234. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +0 -371
  235. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +0 -427
  236. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +0 -123
  237. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +0 -1675
  238. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +0 -71
  239. package/dist/builtin/workflows/skills/impeccable/scripts/live-target.mjs +0 -30
  240. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +0 -927
  241. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +0 -365
  242. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +0 -628
  243. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +0 -224
  244. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +0 -1540
  245. package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +0 -74
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * CLI helper: discard pending manual edits from the buffer without applying.
4
- *
5
- * Reads .impeccable/live/pending-manual-edits.json, drops entries, writes back.
6
- * No source-file writes. Use this when the user wants to throw away unsaved
7
- * manual edits.
8
- *
9
- * Trigger: only when the user explicitly asks the AI to discard / throw away /
10
- * clear pending manual edits.
11
- *
12
- * Usage:
13
- * node live-discard-manual-edits.mjs # discard all pending
14
- * node live-discard-manual-edits.mjs --page-url=/ # discard only entries for "/"
15
- *
16
- * Output JSON: { discarded: N, entries: [...discardedEntries], totalCount: N }
17
- */
18
-
19
- import { readBuffer, removeEntries, truncateBuffer } from './live/manual-edits-buffer.mjs';
20
-
21
- function argVal(args, name) {
22
- const prefix = name + '=';
23
- for (const a of args) {
24
- if (a === name) return true;
25
- if (a.startsWith(prefix)) return a.slice(prefix.length);
26
- }
27
- return null;
28
- }
29
-
30
- const args = process.argv.slice(2);
31
- if (args.includes('--help') || args.includes('-h')) {
32
- console.log('Usage: node live-discard-manual-edits.mjs [--page-url=<url>]');
33
- process.exit(0);
34
- }
35
-
36
- const pageUrlFilter = argVal(args, '--page-url');
37
- const cwd = process.cwd();
38
-
39
- let discarded;
40
- let entries;
41
- const buffer = readBuffer(cwd);
42
- if (pageUrlFilter) {
43
- entries = buffer.entries.filter((entry) => entry.pageUrl === pageUrlFilter);
44
- discarded = removeEntries(cwd, (entry) => entry.pageUrl === pageUrlFilter);
45
- } else {
46
- entries = buffer.entries;
47
- discarded = truncateBuffer(cwd);
48
- }
49
-
50
- const remaining = readBuffer(cwd).entries.reduce((n, e) => n + e.ops.length, 0);
51
- console.log(JSON.stringify({ discarded, entries, totalCount: remaining }));
@@ -1,515 +0,0 @@
1
- /**
2
- * CLI helper: insert/remove the live variant mode script tag in the project's
3
- * main HTML entry point.
4
- *
5
- * On first live run, the agent generates `.impeccable/live/config.json`
6
- * with the project's insertion target (framework-specific). On
7
- * every subsequent run, this script handles insert/remove deterministically
8
- * with zero LLM involvement.
9
- *
10
- * Framework knowledge lives in `live/frameworks/` — detection order, adapters,
11
- * the generic tag strategy, and the per-extension authoring traits live-wrap
12
- * reads. This file is the CLI around it: resolve config, resolve the
13
- * framework, heal orphaned artifacts, apply or remove, record the journal.
14
- *
15
- * Usage:
16
- * node live-inject.mjs --port PORT [--token TOKEN] # Insert the live script tag
17
- * node live-inject.mjs --remove # Remove the live script tag
18
- * node live-inject.mjs --check # Check whether live config exists
19
- *
20
- * When --token is supplied, it is appended to the /live.js src as `?token=...`
21
- * so the server's token-gated /live.js handler will serve the bundle. Omitting
22
- * the token yields a bare `/live.js` src (legacy behavior; the server returns
23
- * 401 for it under the current gate).
24
- */
25
-
26
- import fs from 'node:fs';
27
- import path from 'node:path';
28
- import { fileURLToPath } from 'node:url';
29
- import { resolveLiveConfigPath } from './lib/impeccable-paths.mjs';
30
- import {
31
- describeInjectArtifacts,
32
- frameworkIgnorePatterns,
33
- resolveFramework,
34
- resolveSourceTraits,
35
- } from './live/frameworks/index.mjs';
36
- import {
37
- clearInjectJournal,
38
- healInjectJournal,
39
- recordInjection,
40
- } from './live/frameworks/journal.mjs';
41
- import {
42
- buildTagBlock,
43
- insertTag,
44
- patchCspMeta,
45
- removeTag,
46
- revertCspMeta,
47
- } from './live/frameworks/tag-strategy.mjs';
48
- import { buildLiveScriptSrc } from './live/frameworks/script-src.mjs';
49
- import { assertSafeProjectRelative, resolveProjectPath, writeProjectFileAtomic } from './live/frameworks/detect-utils.mjs';
50
- import { enterLiveRoot, validateRootsManifest } from './live/roots.mjs';
51
-
52
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
53
- // Resolved lazily so the enterLiveRoot() chdir in the CLI guard below takes
54
- // effect first; module scope runs before the guard.
55
- let CONFIG_PATH_CACHED = null;
56
- function CONFIG_PATH_GET() {
57
- if (!CONFIG_PATH_CACHED) {
58
- CONFIG_PATH_CACHED = resolveLiveConfigPath({ cwd: process.cwd(), scriptsDir: __dirname });
59
- }
60
- return CONFIG_PATH_CACHED;
61
- }
62
- const IGNORE_MARKER_OPEN = '# impeccable-live-ignore-start';
63
- const IGNORE_MARKER_CLOSE = '# impeccable-live-ignore-end';
64
-
65
- export const LIVE_IGNORE_PATTERNS = Object.freeze([
66
- '.impeccable/hook.cache.json',
67
- '.impeccable/config.local.json',
68
- '.impeccable/live/server.json',
69
- '.impeccable/live/roots.json',
70
- '.impeccable/live/app-root.json',
71
- '.impeccable/live/inject-journal.json',
72
- '.impeccable/live/sessions/',
73
- '.impeccable/live/previews/',
74
- '.impeccable/live/annotations/',
75
- '.impeccable/live/artifacts/',
76
- '.impeccable/live/accept-receipts/',
77
- '.impeccable/live/locks/',
78
- '.impeccable/live/cache/',
79
- '.impeccable/live/manual-edit-apply-transaction.json',
80
- '.impeccable/live/manual-edit-events.jsonl',
81
- '.impeccable/live/manual-edit-evidence/',
82
- '.impeccable/live/pending-manual-edits.json',
83
- '.impeccable/live/deferred-svelte-component-accepts.json',
84
- '.impeccable-live.json',
85
- '.impeccable-live/',
86
- 'app/.impeccable-live/',
87
- 'src/.impeccable-live/',
88
- 'node_modules/.impeccable-live/',
89
- 'src/lib/impeccable/ImpeccableLiveRoot.svelte',
90
- 'src/lib/impeccable/__runtime.js',
91
- 'src/lib/impeccable/[0-9a-f]*/',
92
- 'plugins/impeccable-live.client.ts',
93
- 'app/plugins/impeccable-live.client.ts',
94
- 'src/plugins/impeccable-live.client.ts',
95
- ]);
96
-
97
- /**
98
- * Hard-excluded directory patterns. These are NEVER user-facing pages and
99
- * matching them would silently inject tracking scripts into third-party
100
- * code. The user cannot turn these off via config — they are the floor.
101
- */
102
- const HARD_EXCLUDES = [
103
- '**/node_modules/**',
104
- '**/.git/**',
105
- ];
106
-
107
- export async function injectCli() {
108
- const args = process.argv.slice(2);
109
-
110
- if (args.includes('--help') || args.includes('-h')) {
111
- console.log(`Usage: node live-inject.mjs [options]
112
-
113
- Insert or remove the live mode script tag in the project's HTML entry point.
114
- Reads configuration from .impeccable/live/config.json.
115
-
116
- Modes:
117
- --port PORT Insert script tag pointing at http://localhost:PORT/live.js
118
- --remove Remove the script tag (if present)
119
- --check Print whether .impeccable/live/config.json exists and its content
120
-
121
- Output (JSON):
122
- { ok, file, inserted|removed, config? }`);
123
- process.exit(0);
124
- }
125
-
126
- if (args.includes('--check')) {
127
- // Deliberately read-only: --check runs from status paths and must never
128
- // mutate the tree. Journal reconciliation happens on the inject run.
129
- if (!fs.existsSync(CONFIG_PATH_GET())) {
130
- console.log(JSON.stringify({ ok: false, error: 'config_missing', path: CONFIG_PATH_GET() }));
131
- process.exit(0);
132
- }
133
- let cfg;
134
- try {
135
- cfg = JSON.parse(fs.readFileSync(CONFIG_PATH_GET(), 'utf-8'));
136
- } catch (err) {
137
- console.log(JSON.stringify({ ok: false, error: 'config_invalid', message: err.message, path: CONFIG_PATH_GET() }));
138
- return;
139
- }
140
- try {
141
- validateConfig(cfg);
142
- } catch (err) {
143
- console.log(JSON.stringify({ ok: false, error: 'config_invalid', message: err.message, path: CONFIG_PATH_GET() }));
144
- return;
145
- }
146
- console.log(JSON.stringify({ ok: true, config: cfg, path: CONFIG_PATH_GET() }));
147
- return;
148
- }
149
-
150
- // Load config
151
- if (!fs.existsSync(CONFIG_PATH_GET())) {
152
- console.error(JSON.stringify({ ok: false, error: 'config_missing', path: CONFIG_PATH_GET() }));
153
- process.exit(1);
154
- }
155
- const config = JSON.parse(fs.readFileSync(CONFIG_PATH_GET(), 'utf-8'));
156
- validateConfig(config);
157
-
158
- const cwd = process.cwd();
159
- const resolvedFiles = resolveFiles(cwd, config);
160
- const resolved = resolveFramework(cwd, config);
161
- const isAdapter = resolved?.framework.inject.kind === 'adapter';
162
-
163
- if (args.includes('--remove')) {
164
- if (isAdapter) {
165
- const adapterResult = resolved.framework.inject.remove({ cwd, config, project: resolved.project });
166
- const ok = !(adapterResult && adapterResult.error);
167
- // Anything the adapter could not reach (its detection may have shifted
168
- // since the session started) is still on the journal.
169
- const { healed } = healInjectJournal(cwd);
170
- clearInjectJournal(cwd);
171
- console.log(JSON.stringify({
172
- ok,
173
- adapter: resolved.framework.name,
174
- results: [adapterResult],
175
- healed: healed.length ? healed : undefined,
176
- }));
177
- if (!ok) process.exitCode = 1;
178
- return;
179
- }
180
- const results = resolvedFiles.map((relFile) => {
181
- let absFile;
182
- try {
183
- absFile = resolveProjectPath(cwd, relFile, { mustExist: true, kind: 'file' });
184
- } catch (error) {
185
- return { file: relFile, error: 'unsafe_file_path', message: error.message };
186
- }
187
- const content = fs.readFileSync(absFile, 'utf-8');
188
- const detagged = removeTag(content, config.commentSyntax);
189
- const updated = revertCspMeta(detagged);
190
- if (updated === content) return { file: relFile, removed: false, note: 'no tag present' };
191
- writeProjectFileAtomic(cwd, relFile, updated);
192
- return {
193
- file: relFile,
194
- removed: detagged !== content,
195
- cspReverted: updated !== detagged,
196
- };
197
- });
198
- const { healed } = healInjectJournal(cwd);
199
- clearInjectJournal(cwd);
200
- console.log(JSON.stringify({ ok: true, results, healed: healed.length ? healed : undefined }));
201
- return;
202
- }
203
-
204
- // Insert mode — need --port
205
- const portIdx = args.indexOf('--port');
206
- const port = portIdx !== -1 ? Number(args[portIdx + 1]) : NaN;
207
- if (!Number.isInteger(port) || port < 1 || port > 65_535) {
208
- console.error(JSON.stringify({ ok: false, error: 'missing_or_invalid_port' }));
209
- process.exit(1);
210
- }
211
- // Optional server token: appended to the /live.js src so the token-gated
212
- // /live.js handler authorizes the browser fetch. `live.mjs` always passes
213
- // it; a manual `--port`-only invocation reads the running helper's token
214
- // from server.json instead of writing an unauthenticated URL that 401s.
215
- const tokenIdx = args.indexOf('--token');
216
- let token = tokenIdx !== -1 ? args[tokenIdx + 1] : undefined;
217
- if (!token) {
218
- try {
219
- const info = JSON.parse(fs.readFileSync(path.join(cwd, '.impeccable', 'live', 'server.json'), 'utf-8'));
220
- // A record for a DIFFERENT port is a stale or foreign helper; its token
221
- // would 401 just the same, so only adopt a matching one.
222
- if (info?.token && Number(info.port) === port) token = info.token;
223
- } catch { /* no running helper recorded; keep legacy tokenless behavior */ }
224
- }
225
-
226
- // Reconcile before writing anything. Artifacts this run is about to own are
227
- // kept (so a repeat inject stays byte-idempotent); artifacts left behind by
228
- // a session that never got to stop are healed.
229
- const plannedArtifacts = describeInjectArtifacts(resolved, { cwd, files: resolvedFiles });
230
- const { healed } = healInjectJournal(cwd, { keep: plannedArtifacts.map((a) => a.path) });
231
-
232
- const gitIgnore = ensureLiveGitIgnores(cwd, frameworkIgnorePatterns(resolved));
233
- // In a nested-app repo the roots pointer lives at the REPO root, outside the
234
- // reach of the appRoot-relative ignore block above; give that directory its
235
- // own local excludes so the pointer (absolute host paths) never gets staged.
236
- try {
237
- const rootsManifest = validateRootsManifest(JSON.parse(fs.readFileSync(path.join(cwd, '.impeccable', 'live', 'roots.json'), 'utf-8')));
238
- if (path.resolve(rootsManifest.repoRoot) !== path.resolve(cwd)) {
239
- ensureLiveGitIgnores(rootsManifest.repoRoot);
240
- }
241
- } catch { /* no valid manifest: single-root project */ }
242
-
243
- if (isAdapter) {
244
- const adapterResult = resolved.framework.inject.apply({
245
- cwd,
246
- port,
247
- token,
248
- config,
249
- project: resolved.project,
250
- });
251
- const ok = !(adapterResult && adapterResult.error);
252
- if (ok) recordInjection(cwd, { framework: resolved.framework.name, port, artifacts: plannedArtifacts });
253
- console.log(JSON.stringify({
254
- ok,
255
- port,
256
- adapter: resolved.framework.name,
257
- gitIgnore,
258
- results: [adapterResult],
259
- healed: healed.length ? healed : undefined,
260
- }));
261
- if (!ok) process.exitCode = 1;
262
- return;
263
- }
264
-
265
- const results = resolvedFiles.map((relFile) => {
266
- let absFile;
267
- try {
268
- absFile = resolveProjectPath(cwd, relFile, { mustExist: true, kind: 'file' });
269
- } catch (error) {
270
- return { file: relFile, error: 'unsafe_file_path', message: error.message };
271
- }
272
- const content = fs.readFileSync(absFile, 'utf-8');
273
- const withoutOld = revertCspMeta(removeTag(content, config.commentSyntax));
274
- // Per-file, not per-project: a Vite app can hold an .astro partial, and a
275
- // framework project's entry template is often plain HTML.
276
- const scriptAttrs = resolveSourceTraits(relFile).injectScriptAttrs;
277
- const withTag = insertTag(withoutOld, config, port, token, scriptAttrs);
278
- if (withTag === withoutOld) {
279
- return { file: relFile, error: 'insertion_point_not_found', anchor: config.insertBefore || config.insertAfter };
280
- }
281
- const updated = patchCspMeta(withTag, port);
282
- writeProjectFileAtomic(cwd, relFile, updated);
283
- return {
284
- file: relFile,
285
- inserted: true,
286
- cspPatched: updated !== withTag,
287
- };
288
- });
289
- const anyInserted = results.some((r) => r.inserted);
290
- const writtenFiles = new Set(results.filter((r) => r.inserted).map((r) => r.file));
291
- recordInjection(cwd, {
292
- framework: resolved?.framework.name,
293
- port,
294
- artifacts: plannedArtifacts.filter((a) => writtenFiles.has(a.path)),
295
- });
296
- console.log(JSON.stringify({
297
- ok: anyInserted,
298
- port,
299
- gitIgnore,
300
- results,
301
- healed: healed.length ? healed : undefined,
302
- }));
303
- if (!anyInserted) process.exit(1);
304
- }
305
-
306
- export function ensureLiveGitIgnores(cwd = process.cwd(), extraPatterns = []) {
307
- const target = resolveIgnoreTarget(cwd);
308
- const existing = fs.existsSync(target.path) ? fs.readFileSync(target.path, 'utf-8') : '';
309
- const block = [
310
- IGNORE_MARKER_OPEN,
311
- ...new Set([...LIVE_IGNORE_PATTERNS, ...extraPatterns]),
312
- IGNORE_MARKER_CLOSE,
313
- ].join('\n');
314
- const markerRe = new RegExp(`${escapeRegExp(IGNORE_MARKER_OPEN)}[\\s\\S]*?${escapeRegExp(IGNORE_MARKER_CLOSE)}`);
315
-
316
- let updated;
317
- if (markerRe.test(existing)) {
318
- updated = existing.replace(markerRe, block);
319
- } else {
320
- const prefix = existing.length === 0 ? '' : existing.endsWith('\n') ? existing : existing + '\n';
321
- updated = `${prefix}${prefix.endsWith('\n\n') || prefix === '' ? '' : '\n'}${block}\n`;
322
- }
323
-
324
- if (updated !== existing) {
325
- fs.mkdirSync(path.dirname(target.path), { recursive: true });
326
- fs.writeFileSync(target.path, updated, 'utf-8');
327
- }
328
-
329
- return {
330
- file: path.relative(cwd, target.path).split(path.sep).join('/'),
331
- mode: target.mode,
332
- changed: updated !== existing,
333
- patterns: [...new Set([...LIVE_IGNORE_PATTERNS, ...extraPatterns])],
334
- };
335
- }
336
-
337
- function resolveIgnoreTarget(cwd) {
338
- const gitExcludePath = resolveGitInfoExcludePath(cwd);
339
- if (gitExcludePath) {
340
- return { path: gitExcludePath, mode: 'git-info-exclude' };
341
- }
342
- return { path: path.join(cwd, '.gitignore'), mode: 'gitignore' };
343
- }
344
-
345
- function resolveGitInfoExcludePath(cwd) {
346
- const dotGit = path.join(cwd, '.git');
347
- if (!fs.existsSync(dotGit)) return null;
348
-
349
- const stat = fs.statSync(dotGit);
350
- if (stat.isDirectory()) return path.join(dotGit, 'info', 'exclude');
351
- if (!stat.isFile()) return null;
352
-
353
- const body = fs.readFileSync(dotGit, 'utf-8').trim();
354
- const match = body.match(/^gitdir:\s*(.+)$/i);
355
- if (!match) return null;
356
- const gitDir = path.isAbsolute(match[1]) ? match[1] : path.resolve(cwd, match[1]);
357
- return path.join(gitDir, 'info', 'exclude');
358
- }
359
-
360
- function escapeRegExp(value) {
361
- return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
362
- }
363
-
364
- /**
365
- * Expand config.files (which may contain glob patterns) into a literal list
366
- * of existing file paths relative to rootDir. Literal entries pass through;
367
- * glob patterns are expanded via fs.globSync. HARD_EXCLUDES and config.exclude
368
- * are applied as filters. Duplicates are removed. Order is preserved by
369
- * first appearance.
370
- */
371
- export function resolveFiles(rootDir, config) {
372
- const patterns = config.files;
373
- const userExcludes = Array.isArray(config.exclude) ? config.exclude : [];
374
- const allExcludes = [...HARD_EXCLUDES, ...userExcludes];
375
- const excludeRegexes = allExcludes.map(globToRegex);
376
-
377
- const isExcluded = (relPath) => excludeRegexes.some((re) => re.test(relPath));
378
- const isGlob = (s) => /[*?[]/.test(s);
379
-
380
- const seen = new Set();
381
- const out = [];
382
- for (const pat of patterns) {
383
- const normalizedPattern = assertSafeProjectRelative(pat, 'config.files entry', { allowGlob: true });
384
- if (!isGlob(normalizedPattern)) {
385
- // Literal path — include even if it doesn't exist yet; the caller
386
- // reports file_not_found per-entry. Exclude list doesn't apply to
387
- // explicit literal entries (user named it on purpose).
388
- if (!seen.has(normalizedPattern)) {
389
- seen.add(normalizedPattern);
390
- out.push(normalizedPattern);
391
- }
392
- continue;
393
- }
394
- let matches;
395
- try {
396
- matches = fs.globSync(normalizedPattern, { cwd: rootDir, withFileTypes: true });
397
- } catch {
398
- continue;
399
- }
400
- for (const ent of matches) {
401
- if (!ent.isFile || !ent.isFile()) continue;
402
- const abs = path.join(ent.parentPath || ent.path || rootDir, ent.name);
403
- const rel = assertSafeProjectRelative(path.relative(rootDir, abs).split(path.sep).join('/'));
404
- try { resolveProjectPath(rootDir, rel, { mustExist: true, kind: 'file' }); } catch { continue; }
405
- if (isExcluded(rel)) continue;
406
- if (seen.has(rel)) continue;
407
- seen.add(rel);
408
- out.push(rel);
409
- }
410
- }
411
- return out;
412
- }
413
-
414
- /**
415
- * Convert a glob pattern to a RegExp. Supports:
416
- * ** → any number of path segments (including zero)
417
- * * → any chars except `/`
418
- * ? → any single char except `/`
419
- * Paths are normalized to forward slashes before matching.
420
- */
421
- function globToRegex(pattern) {
422
- let re = '';
423
- let i = 0;
424
- while (i < pattern.length) {
425
- const c = pattern[i];
426
- if (c === '*') {
427
- if (pattern[i + 1] === '*') {
428
- // ** — any number of segments, including zero. Handle the common
429
- // **/ and /** forms so `a/**/b` matches `a/b` as well as `a/x/y/b`.
430
- if (pattern[i + 2] === '/') {
431
- re += '(?:.*/)?';
432
- i += 3;
433
- } else {
434
- re += '.*';
435
- i += 2;
436
- }
437
- } else {
438
- re += '[^/]*';
439
- i += 1;
440
- }
441
- } else if (c === '?') {
442
- re += '[^/]';
443
- i += 1;
444
- } else if (/[.+^${}()|[\]\\]/.test(c)) {
445
- re += '\\' + c;
446
- i += 1;
447
- } else {
448
- re += c;
449
- i += 1;
450
- }
451
- }
452
- return new RegExp('^' + re + '$');
453
- }
454
-
455
- // ---------------------------------------------------------------------------
456
- // Core operations
457
- // ---------------------------------------------------------------------------
458
-
459
- function validateConfig(cfg) {
460
- if (!cfg || typeof cfg !== 'object') throw new Error('config.json must be an object');
461
- if (!Array.isArray(cfg.files) || cfg.files.length === 0) {
462
- throw new Error('config.files (non-empty string array) required');
463
- }
464
- if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {
465
- throw new Error('config.files must contain only non-empty strings');
466
- }
467
- for (const file of cfg.files) assertSafeProjectRelative(file, 'config.files entry', { allowGlob: true });
468
- if (cfg.exclude !== undefined) {
469
- if (!Array.isArray(cfg.exclude)) {
470
- throw new Error('config.exclude, if present, must be a string array');
471
- }
472
- if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {
473
- throw new Error('config.exclude must contain only non-empty strings');
474
- }
475
- for (const file of cfg.exclude) assertSafeProjectRelative(file, 'config.exclude entry', { allowGlob: true });
476
- }
477
- if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {
478
- throw new Error('config.insertBefore or config.insertAfter (string) required');
479
- }
480
- if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {
481
- throw new Error("config.commentSyntax must be 'html' or 'jsx'");
482
- }
483
- if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {
484
- throw new Error("config.cspChecked, if present, must be a boolean");
485
- }
486
- }
487
-
488
- // ---------------------------------------------------------------------------
489
- // Auto-execute
490
- // ---------------------------------------------------------------------------
491
-
492
- const _running = process.argv[1];
493
- if (_running?.endsWith('live-inject.mjs') || _running?.endsWith('live-inject.mjs/')) {
494
- enterLiveRoot();
495
- injectCli();
496
- }
497
-
498
- // Re-exported so long-standing importers (live.mjs, the adapter modules, the
499
- // test suites) keep their entry points while the implementations live in
500
- // live/frameworks/.
501
- export {
502
- buildLiveScriptSrc,
503
- buildTagBlock,
504
- insertTag,
505
- patchCspMeta,
506
- removeTag,
507
- revertCspMeta,
508
- validateConfig,
509
- };
510
- export {
511
- applyNuxtLiveAdapter,
512
- buildNuxtPlugin,
513
- detectNuxtProject,
514
- removeNuxtLiveAdapter,
515
- } from './live/frameworks/nuxt.mjs';