@bastani/atomic 0.9.11-alpha.6 → 0.9.11-alpha.7

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 (140) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/package.json +1 -1
  5. package/dist/builtin/web-access/package.json +1 -1
  6. package/dist/builtin/workflows/package.json +1 -1
  7. package/dist/builtin/workflows/skills/impeccable/SKILL.md +33 -129
  8. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +11 -3
  9. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +26 -0
  10. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +35 -0
  11. package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
  12. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +72 -189
  13. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +10 -9
  14. package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +2 -2
  15. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +19 -108
  16. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +59 -253
  17. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +51 -222
  18. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +45 -0
  19. package/dist/builtin/workflows/skills/impeccable/reference/craft.md +3 -121
  20. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +28 -20
  21. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +97 -0
  22. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +23 -0
  23. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +32 -0
  24. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
  25. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +47 -279
  26. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  27. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +53 -0
  28. package/dist/builtin/workflows/skills/impeccable/reference/document.md +60 -73
  29. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -12
  30. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +17 -4
  31. package/dist/builtin/workflows/skills/impeccable/reference/init.md +64 -163
  32. package/dist/builtin/workflows/skills/impeccable/reference/ios.md +1 -1
  33. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +52 -153
  34. package/dist/builtin/workflows/skills/impeccable/reference/live.md +44 -32
  35. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +105 -0
  36. package/dist/builtin/workflows/skills/impeccable/reference/{product.md → operate.md} +6 -5
  37. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +4 -4
  38. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -4
  39. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +68 -212
  40. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +3 -3
  41. package/dist/builtin/workflows/skills/impeccable/reference/routing.md +18 -0
  42. package/dist/builtin/workflows/skills/impeccable/reference/shape.md +38 -144
  43. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +48 -269
  44. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +38 -0
  45. package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +1 -1
  46. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +584 -0
  47. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +117 -9
  48. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +486 -59
  49. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +16 -45
  50. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +96 -10
  51. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +143 -26
  52. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +181 -12
  53. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +3187 -182
  54. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +102 -7
  55. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +282 -70
  56. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +183 -15
  57. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +22 -7
  58. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +7 -1
  59. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +16 -2
  60. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +155 -42
  61. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2988 -155
  62. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +11 -0
  63. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +336 -0
  64. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +232 -0
  65. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +90 -10
  66. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +410 -78
  67. package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +25 -8
  68. package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +93 -0
  69. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +165 -0
  70. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +329 -0
  71. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +20 -5
  72. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +16 -8
  73. package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +1 -0
  74. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +455 -0
  75. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +169 -0
  76. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +457 -0
  77. package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +151 -0
  78. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +33 -0
  79. package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +146 -0
  80. package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +10 -1
  81. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +15 -0
  82. package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +149 -0
  83. package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +14 -0
  84. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +109 -32
  85. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +105 -0
  86. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +105 -0
  87. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +8 -6
  88. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +280 -0
  89. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +208 -68
  90. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +563 -112
  91. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +3 -0
  92. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +198 -13
  93. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +24 -6
  94. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +6 -1
  95. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +44 -14
  96. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +398 -33
  97. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +9 -5
  98. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +81 -67
  99. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +7 -2
  100. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +76 -81
  101. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +2 -2
  102. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +890 -0
  103. package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +74 -0
  104. package/dist/builtin/workflows/src/extension/index.bundle.mjs +201 -22
  105. package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +23 -9
  106. package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +1 -0
  107. package/dist/builtin/workflows/src/runs/foreground/postmortem-stage-chat.ts +20 -5
  108. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +10 -0
  109. package/dist/builtin/workflows/src/runs/foreground/stage-delivery-activity.ts +86 -0
  110. package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +6 -2
  111. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +19 -13
  112. package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +8 -0
  113. package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +16 -0
  114. package/dist/builtin/workflows/src/tui/stage-chat-view-delivery-activity.ts +121 -0
  115. package/dist/builtin/workflows/src/tui/stage-chat-view-live-events.ts +42 -0
  116. package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +16 -0
  117. package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +4 -0
  118. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  119. package/dist/modes/interactive/components/chat-session-host-actions.js +2 -14
  120. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
  121. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  122. package/dist/modes/interactive/components/chat-session-host-events.js +9 -0
  123. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  124. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +25 -0
  125. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  126. package/dist/modes/interactive/components/chat-session-host-runtime.js +53 -0
  127. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  128. package/dist/modes/interactive/components/chat-session-host.d.ts +13 -0
  129. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  130. package/dist/modes/interactive/components/chat-session-host.js +22 -1
  131. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  132. package/dist/modes/interactive/interactive-agent-events.js +9 -3
  133. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  134. package/docs/tui.md +7 -2
  135. package/docs/workflows.md +1 -1
  136. package/npm-shrinkwrap.json +23 -23
  137. package/package.json +2 -2
  138. package/dist/builtin/workflows/skills/impeccable/reference/brand.md +0 -108
  139. package/dist/builtin/workflows/skills/impeccable/reference/codex.md +0 -105
  140. package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +0 -189
@@ -11,7 +11,7 @@
11
11
  * output is always valid JSON.
12
12
  *
13
13
  * Signals:
14
- * - setup: PRODUCT.md / DESIGN.md presence, register, whether code exists
14
+ * - setup: PRODUCT.md / DESIGN.md presence and whether code exists
15
15
  * - critique: the latest cached critique score (.impeccable/critique)
16
16
  * - git: branch + files changed vs the default branch (a scope hint)
17
17
  * - devServer: whether a local dev server answers on a common port (gates live)
@@ -21,7 +21,7 @@ import net from 'node:net';
21
21
  import path from 'node:path';
22
22
  import { fileURLToPath } from 'node:url';
23
23
  import { execFileSync } from 'node:child_process';
24
- import { loadContext, extractRegister, extractPlatform } from './context.mjs';
24
+ import { loadContext, extractPlatform } from './context.mjs';
25
25
  import { getCritiqueDir } from './lib/impeccable-paths.mjs';
26
26
 
27
27
  /** Is there code here at all, or just context files / an empty repo? */
@@ -86,15 +86,109 @@ function gitSignals(cwd) {
86
86
  return { isRepo: false, branch: null, base: null, changedFiles: [], changedCount: 0 };
87
87
  }
88
88
  const branch = run(['rev-parse', '--abbrev-ref', 'HEAD']);
89
+ // The merge target is detected, not assumed. A hardcoded main/master list
90
+ // diffed develop-based repos against the wrong base, so git.changedFiles
91
+ // carried the whole develop/main divergence into scan.targets (issue
92
+ // #302). Signals, most specific first: the branch's configured upstream
93
+ // (@{u}; a branch pushed with -u tracks itself and is skipped by the
94
+ // self-check), then the remote's default-branch symref (origin/HEAD),
95
+ // then the conventional integration names. The conventional fallbacks
96
+ // are withheld when the current branch IS one of them: sitting on main
97
+ // in a repo that also has develop must not diff the two integration
98
+ // branches against each other.
99
+ // Candidates carry a display name (what git.base reports) and the revs to
100
+ // try, in order. A remote ref like `upstream/release` (fork workflows) or
101
+ // an origin/HEAD target with no local checkout is a perfectly good diff
102
+ // base, so revs are not limited to local branch names.
103
+ const remotes = (run(['remote']) || '').split('\n').filter(Boolean);
104
+ // Read @{u} as a FULL symbolic ref: refs/heads/... is a local upstream
105
+ // (branch.<x>.remote = "."), refs/remotes/<r>/... is remote-tracking. No
106
+ // string guessing on the abbreviated form survives contact with reality:
107
+ // a local upstream named release/2.0 is one branch name, and a local
108
+ // feature/foo beside a remote actually named "feature" is only told apart
109
+ // from feature's remote-tracking refs by the full ref namespace.
110
+ const resolveUpstream = () => {
111
+ const full = run(['rev-parse', '--symbolic-full-name', '@{u}']);
112
+ if (!full) return null;
113
+ if (full.startsWith('refs/heads/')) {
114
+ const name = full.slice('refs/heads/'.length);
115
+ return { name, rev: name };
116
+ }
117
+ if (full.startsWith('refs/remotes/')) {
118
+ const rest = full.slice('refs/remotes/'.length);
119
+ const i = rest.indexOf('/');
120
+ if (i > 0) return { name: rest.slice(i + 1), rev: rest };
121
+ }
122
+ return null;
123
+ };
124
+ const conventional = ['develop', 'main', 'master'];
125
+ // On an integration branch itself the scope hint is the working tree. No
126
+ // signal may override that: an origin/HEAD or upstream naming a DIFFERENT
127
+ // integration branch (sitting on develop while the remote default is
128
+ // main) would produce exactly the integration-vs-integration divergence
129
+ // this detection exists to prevent. "Integration branch" means a
130
+ // conventional name OR any remote's default branch (origin first, but a
131
+ // fork-parent layout may only have an `upstream` remote), so a
132
+ // non-standard default like trunk is guarded the same way. A detached
133
+ // checkout (branch reads as the literal `HEAD`) has no branch identity to
134
+ // diff for and keeps the working-tree scope too.
135
+ const remoteHeads = [];
136
+ for (const r of [...new Set(['origin', ...remotes])]) {
137
+ // The symref's own prefix is the remote just queried, so it is stripped
138
+ // directly; the remote need not be in `git remote` output (tests and
139
+ // partial clones fabricate refs/remotes/origin/* without a remote).
140
+ const ref = run(['symbolic-ref', '--short', `refs/remotes/${r}/HEAD`]);
141
+ if (ref && ref.startsWith(`${r}/`)) remoteHeads.push({ name: ref.slice(r.length + 1), rev: ref });
142
+ }
143
+ const onIntegrationBranch = branch === 'HEAD'
144
+ || conventional.includes(branch)
145
+ || remoteHeads.some((head) => head.name === branch);
89
146
  let base = null;
90
- for (const b of ['main', 'master']) {
91
- if (run(['rev-parse', '--verify', '--quiet', b]) !== null) {
92
- base = b;
93
- break;
147
+ let baseRev = null;
148
+ if (!onIntegrationBranch) {
149
+ const upstream = resolveUpstream();
150
+ // Every named candidate tries the local branch first, then that name on
151
+ // every remote (origin first). Covering all remotes up front is what
152
+ // makes the name-level dedup below safe: a develop or main that exists
153
+ // only as upstream/<name> still resolves even though origin's candidate
154
+ // claimed the name first.
155
+ const remoteOrder = ['origin', ...remotes.filter((name) => name !== 'origin')];
156
+ const revsFor = (name) => [name, ...remoteOrder.map((r) => `${r}/${name}`)];
157
+ const candidates = [];
158
+ const seen = new Set();
159
+ const addCandidate = (name, revs) => {
160
+ if (!name || name === branch || seen.has(name)) return;
161
+ seen.add(name);
162
+ candidates.push({ name, revs });
163
+ };
164
+ // The upstream tracks the actual merge target, so its own rev wins over
165
+ // a possibly stale local branch of the same name.
166
+ if (upstream) addCandidate(upstream.name, [upstream.rev]);
167
+ // A develop branch marks a git-flow repo where features merge to develop
168
+ // even when the platform default (origin/HEAD) was never flipped off
169
+ // main; an existing develop therefore outranks the remote default. This
170
+ // is #302's own repro shape, and repos without develop are unaffected.
171
+ // A remote's advertised default prefers its own remote-tracking rev over
172
+ // a possibly stale local checkout of the same name, for the same reason
173
+ // the upstream candidate leads with its rev. That applies to the develop
174
+ // candidate too when the remote default IS develop: it sits before the
175
+ // remote-default entries in the order, so it must lead with their rev
176
+ // itself or a stale local develop would win.
177
+ const advertisedRevs = (name) => remoteHeads.filter((head) => head.name === name).map((head) => head.rev);
178
+ addCandidate('develop', [...new Set([...advertisedRevs('develop'), ...revsFor('develop')])]);
179
+ for (const head of remoteHeads) addCandidate(head.name, [...new Set([head.rev, ...revsFor(head.name)])]);
180
+ for (const name of ['main', 'master']) addCandidate(name, revsFor(name));
181
+ for (const c of candidates) {
182
+ const rev = c.revs.find((r) => run(['rev-parse', '--verify', '--quiet', r]) !== null);
183
+ if (rev) {
184
+ base = c.name;
185
+ baseRev = rev;
186
+ break;
187
+ }
94
188
  }
95
189
  }
96
190
  const diffBase = base && branch && branch !== base ? base : null;
97
- const fromDiff = diffBase ? run(['diff', '--name-only', `${diffBase}...HEAD`]) : null;
191
+ const fromDiff = diffBase ? run(['diff', '--name-only', `${baseRev}...HEAD`]) : null;
98
192
  // porcelain lines are `XY PATH`: a 2-char status + a space, then the path.
99
193
  // Don't trim the combined output — an unstaged-modified line starts with a
100
194
  // leading space (` M path`), and a global trim would eat the first line's
@@ -156,9 +250,23 @@ const SCANNABLE_EXT = new Set([
156
250
  '.jsx', '.tsx', '.js', '.ts', '.vue', '.svelte', '.astro',
157
251
  ]);
158
252
  // Where UI source typically lives. The detector walks these and skips
159
- // node_modules / dist / build / .next / .nuxt automatically.
253
+ // node_modules / dist / build and all hidden dirs automatically.
160
254
  const SOURCE_DIRS = ['src', 'app', 'components', 'pages', 'public'];
161
255
 
256
+ // A changed file under a hidden or dependency/build directory is not app
257
+ // source — it's a vendored AI-harness install (.claude/skills/..., .cursor/,
258
+ // .impeccable/, issue #303), a build artifact, or a dependency. Mirrors the
259
+ // engine walkDir's skip rule so git-changes targeting can't resurface paths
260
+ // the walker would never visit.
261
+ function isVendoredPath(rel) {
262
+ const dirSegments = rel.split(/[\\/]/).slice(0, -1);
263
+ return dirSegments.some(
264
+ (seg) =>
265
+ (seg.startsWith('.') && seg !== '.vitepress' && seg !== '.vuepress' && seg !== '.storybook') ||
266
+ seg === 'node_modules' || seg === 'dist' || seg === 'build' || seg === '__pycache__',
267
+ );
268
+ }
269
+
162
270
  /**
163
271
  * Local paths the agent should point the bundled detector at — never a URL.
164
272
  * A URL means a costly Puppeteer browser render, and a probed dev-server port
@@ -173,6 +281,7 @@ function scanTargets(cwd, git) {
173
281
  if (git.isRepo && git.changedFiles.length) {
174
282
  const changed = git.changedFiles
175
283
  .filter((f) => SCANNABLE_EXT.has(path.extname(f).toLowerCase()))
284
+ .filter((f) => !isVendoredPath(f))
176
285
  .filter((f) => fs.existsSync(path.join(cwd, f)));
177
286
  if (changed.length) return { targets: changed.slice(0, 50), via: 'git-changes' };
178
287
  }
@@ -196,7 +305,6 @@ export async function gatherSignals(cwd = process.cwd()) {
196
305
  hasDesign: ctx.hasDesign,
197
306
  designPath: ctx.designPath,
198
307
  hasCode: hasCode(cwd),
199
- register: extractRegister(ctx.product),
200
308
  platform: extractPlatform(ctx.product),
201
309
  },
202
310
  critique: { latest: latestCritique(cwd) },