@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.
- package/CHANGELOG.md +14 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +33 -129
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +11 -3
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +26 -0
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +35 -0
- package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/animate.md +72 -189
- package/dist/builtin/workflows/skills/impeccable/reference/audit.md +10 -9
- package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +19 -108
- package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +59 -253
- package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +51 -222
- package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +45 -0
- package/dist/builtin/workflows/skills/impeccable/reference/craft.md +3 -121
- package/dist/builtin/workflows/skills/impeccable/reference/critique.md +28 -20
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +97 -0
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +23 -0
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +32 -0
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- package/dist/builtin/workflows/skills/impeccable/reference/delight.md +47 -279
- package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +53 -0
- package/dist/builtin/workflows/skills/impeccable/reference/document.md +60 -73
- package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -12
- package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +17 -4
- package/dist/builtin/workflows/skills/impeccable/reference/init.md +64 -163
- package/dist/builtin/workflows/skills/impeccable/reference/ios.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/layout.md +52 -153
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +44 -32
- package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +105 -0
- package/dist/builtin/workflows/skills/impeccable/reference/{product.md → operate.md} +6 -5
- package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -4
- package/dist/builtin/workflows/skills/impeccable/reference/polish.md +68 -212
- package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/routing.md +18 -0
- package/dist/builtin/workflows/skills/impeccable/reference/shape.md +38 -144
- package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +48 -269
- package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +38 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +584 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +117 -9
- package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +486 -59
- package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +16 -45
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +96 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +143 -26
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +181 -12
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +3187 -182
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +102 -7
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +282 -70
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +183 -15
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +22 -7
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +7 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +16 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +155 -42
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2988 -155
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +11 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +336 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +232 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +90 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +410 -78
- package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +25 -8
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +93 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +165 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +329 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +20 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +16 -8
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +1 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +455 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +169 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +457 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +151 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +33 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +146 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +10 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +15 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +149 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +14 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +109 -32
- package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +105 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +105 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +8 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +280 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +208 -68
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +563 -112
- package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +3 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +198 -13
- package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +24 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +6 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +44 -14
- package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +398 -33
- package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +9 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +81 -67
- package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +7 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +76 -81
- package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +890 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +74 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +201 -22
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +23 -9
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +1 -0
- package/dist/builtin/workflows/src/runs/foreground/postmortem-stage-chat.ts +20 -5
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +10 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-delivery-activity.ts +86 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +6 -2
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +19 -13
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +8 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +16 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-delivery-activity.ts +121 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-live-events.ts +42 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +16 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +4 -0
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +2 -14
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +9 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +25 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.js +53 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +13 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +22 -1
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +9 -3
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/docs/tui.md +7 -2
- package/docs/workflows.md +1 -1
- package/npm-shrinkwrap.json +23 -23
- package/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/brand.md +0 -108
- package/dist/builtin/workflows/skills/impeccable/reference/codex.md +0 -105
- package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +0 -189
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
import fs from 'node:fs';
|
|
15
15
|
import path from 'node:path';
|
|
16
16
|
import { isGeneratedFile } from './lib/is-generated.mjs';
|
|
17
|
+
import { resolveLiveTemplateExtensions } from './lib/template-extensions.mjs';
|
|
17
18
|
import { readBuffer as readManualEditsBuffer } from './live/manual-edits-buffer.mjs';
|
|
19
|
+
import { findSourceFile } from './live/source-search.mjs';
|
|
18
20
|
import {
|
|
19
21
|
buildSvelteComponentCssAuthoring,
|
|
20
22
|
scaffoldSvelteComponentSession,
|
|
21
23
|
shouldUseSvelteComponentInjection,
|
|
22
24
|
} from './live/svelte-component.mjs';
|
|
23
25
|
|
|
24
|
-
const EXTENSIONS = ['.html', '.jsx', '.tsx', '.vue', '.svelte', '.astro'];
|
|
25
|
-
|
|
26
26
|
export async function wrapCli() {
|
|
27
27
|
const args = process.argv.slice(2);
|
|
28
28
|
|
|
@@ -68,6 +68,13 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
68
68
|
const filePath = argVal(args, '--file');
|
|
69
69
|
const text = argVal(args, '--text');
|
|
70
70
|
const pageUrl = argVal(args, '--page-url');
|
|
71
|
+
// Preflight passes this for source-preview targets. It computes the scaffold
|
|
72
|
+
// (element location + wrapper text) but does NOT write it into source. The
|
|
73
|
+
// agent then writes the wrapper + all variants in one atomic edit. The
|
|
74
|
+
// premature server-side write full-reloaded the framework mid-generate and
|
|
75
|
+
// stranded the browser at 0/N (live-server.mjs missed-completion note). It is
|
|
76
|
+
// a no-op on the svelte-component path, which never writes the route source.
|
|
77
|
+
const deferSourceWrite = args.includes('--defer-source-write');
|
|
71
78
|
|
|
72
79
|
if (!id) { console.error('Missing --id'); process.exit(1); }
|
|
73
80
|
if (!elementId && !classes && !query) {
|
|
@@ -160,11 +167,29 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
160
167
|
if (filtered.length === 1) {
|
|
161
168
|
match = filtered[0];
|
|
162
169
|
} else if (filtered.length === 0) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
const normalizedText = String(text).replace(/\s+/g, ' ').trim();
|
|
171
|
+
if (normalizedText.length < 8) {
|
|
172
|
+
// Very short labels cannot disambiguate siblings reliably. Preserve
|
|
173
|
+
// the legacy behavior for these low-information picker events.
|
|
174
|
+
match = candidates[0];
|
|
175
|
+
} else {
|
|
176
|
+
// Rendered text that is absent from every candidate usually means
|
|
177
|
+
// the source uses expressions or component props. Picking the first
|
|
178
|
+
// same-class sibling silently edits the wrong instance (observed on
|
|
179
|
+
// Astro result cards), so stop and surface every candidate instead.
|
|
180
|
+
console.error(JSON.stringify({
|
|
181
|
+
error: 'element_ambiguous',
|
|
182
|
+
fallback: 'agent-driven',
|
|
183
|
+
reason: 'rendered_text_not_in_source',
|
|
184
|
+
file: path.relative(process.cwd(), targetFile),
|
|
185
|
+
candidates: candidates.map((c) => ({
|
|
186
|
+
startLine: c.startLine + 1,
|
|
187
|
+
endLine: c.endLine + 1,
|
|
188
|
+
})),
|
|
189
|
+
hint: 'Rendered text does not occur in any matching source branch. The element may use dynamic props or expressions; inspect the candidates and wrap the intended instance manually.',
|
|
190
|
+
}));
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
168
193
|
} else {
|
|
169
194
|
// Multiple candidates ALSO match the text. Truly ambiguous — refuse
|
|
170
195
|
// rather than pick wrong, and hand the agent the candidate locations
|
|
@@ -269,6 +294,7 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
269
294
|
const originalIndented = reindentOriginal(' ');
|
|
270
295
|
const relTargetFile = path.relative(process.cwd(), targetFile).split(path.sep).join('/');
|
|
271
296
|
const useSvelteComponent = shouldUseSvelteComponentInjection(targetFile);
|
|
297
|
+
const useFrameworkComponent = useSvelteComponent;
|
|
272
298
|
|
|
273
299
|
// Wrapper attributes differ by syntax. HTML allows plain string attrs;
|
|
274
300
|
// JSX requires object-literal style and parses string attrs as HTML (which
|
|
@@ -288,7 +314,7 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
288
314
|
// replacement range to include the wrapper's `<div>` open / close lines
|
|
289
315
|
// so the entire scaffold gets removed cleanly.
|
|
290
316
|
const wrapperLines = isJsx ? [
|
|
291
|
-
indent + '<div data-impeccable-variants="' + id + '" data-impeccable-variant-count="' + count + '" ' + styleContents + '>',
|
|
317
|
+
indent + '<div data-impeccable-variants="' + id + '" data-impeccable-variant-count="' + count + '"' + ' ' + styleContents + '>',
|
|
292
318
|
indent + ' ' + commentSyntax.open + ' impeccable-variants-start ' + id + ' ' + commentSyntax.close,
|
|
293
319
|
indent + ' ' + commentSyntax.open + ' Original ' + commentSyntax.close,
|
|
294
320
|
indent + ' <div data-impeccable-variant="original">',
|
|
@@ -299,7 +325,7 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
299
325
|
indent + '</div>',
|
|
300
326
|
] : [
|
|
301
327
|
indent + commentSyntax.open + ' impeccable-variants-start ' + id + ' ' + commentSyntax.close,
|
|
302
|
-
indent + '<div data-impeccable-variants="' + id + '" data-impeccable-variant-count="' + count + '" ' + styleContents + '>',
|
|
328
|
+
indent + '<div data-impeccable-variants="' + id + '" data-impeccable-variant-count="' + count + '"' + ' ' + styleContents + '>',
|
|
303
329
|
indent + ' ' + commentSyntax.open + ' Original ' + commentSyntax.close,
|
|
304
330
|
indent + ' <div data-impeccable-variant="original">',
|
|
305
331
|
originalIndented,
|
|
@@ -315,6 +341,7 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
315
341
|
let outputEndLine = startLine + wrapperLines.length + (originalLines.length - 1);
|
|
316
342
|
let insertLine;
|
|
317
343
|
let svelteSession = null;
|
|
344
|
+
let deferredWrapper = null;
|
|
318
345
|
|
|
319
346
|
if (useSvelteComponent) {
|
|
320
347
|
// Svelte/SvelteKit resets component-local state on markup HMR updates.
|
|
@@ -334,6 +361,20 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
334
361
|
outputStartLine = 1;
|
|
335
362
|
outputEndLine = 1;
|
|
336
363
|
insertLine = 1;
|
|
364
|
+
} else if (deferSourceWrite) {
|
|
365
|
+
// Deferred source write: compute the scaffold text but leave source
|
|
366
|
+
// untouched. The agent replaces the picked element's source range with
|
|
367
|
+
// `wrapperBlock` (variants spliced at the marker) in one edit. Writing the
|
|
368
|
+
// scaffold here first would reload the framework before the agent's write
|
|
369
|
+
// lands, and a browser caught mid-reload misses the `done` and sits at 0/N.
|
|
370
|
+
deferredWrapper = {
|
|
371
|
+
block: wrapperLines.join('\n'),
|
|
372
|
+
replaceStartLine: startLine + 1, // 1-indexed picked-element range the
|
|
373
|
+
replaceEndLine: endLine + 1, // agent's wrapper block replaces
|
|
374
|
+
};
|
|
375
|
+
// insertLine matches the final file position the wrapper occupies once the
|
|
376
|
+
// agent replaces the picked range, so downstream consumers stay consistent.
|
|
377
|
+
insertLine = startLine + 6 + (originalLines.length - 1) + 1;
|
|
337
378
|
} else {
|
|
338
379
|
// Replace the original element with the wrapper
|
|
339
380
|
const newLines = [
|
|
@@ -356,15 +397,25 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
356
397
|
const outputRelFile = path.relative(process.cwd(), outputFile).split(path.sep).join('/');
|
|
357
398
|
|
|
358
399
|
const svelteComponentAuthoring = useSvelteComponent ? buildSvelteComponentCssAuthoring(count) : null;
|
|
400
|
+
const componentSession = svelteSession;
|
|
401
|
+
const componentPreviewMode = useSvelteComponent ? 'svelte-component' : undefined;
|
|
402
|
+
const previewMode = componentPreviewMode;
|
|
359
403
|
|
|
360
404
|
console.log(JSON.stringify({
|
|
361
405
|
file: outputRelFile,
|
|
362
|
-
sourceFile:
|
|
363
|
-
previewMode
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
406
|
+
sourceFile: useFrameworkComponent ? relTargetFile : undefined,
|
|
407
|
+
previewMode,
|
|
408
|
+
// Deferred source write: the wrapper is NOT yet in source. The agent
|
|
409
|
+
// replaces [replaceStartLine, replaceEndLine] with `wrapperBlock` (variants
|
|
410
|
+
// spliced at the "insert below this line" marker) in one atomic edit.
|
|
411
|
+
sourceWritten: deferredWrapper ? false : undefined,
|
|
412
|
+
wrapperBlock: deferredWrapper ? deferredWrapper.block : undefined,
|
|
413
|
+
replaceStartLine: deferredWrapper ? deferredWrapper.replaceStartLine : undefined,
|
|
414
|
+
replaceEndLine: deferredWrapper ? deferredWrapper.replaceEndLine : undefined,
|
|
415
|
+
componentDir: componentSession?.componentDir,
|
|
416
|
+
propContract: componentSession?.propContract,
|
|
417
|
+
sourceStartLine: useFrameworkComponent ? startLine + 1 : undefined,
|
|
418
|
+
sourceEndLine: useFrameworkComponent ? endLine + 1 : undefined,
|
|
368
419
|
startLine: outputStartLine, // 1-indexed for the agent
|
|
369
420
|
// wrapperLines is an array but one element (the original-content slot)
|
|
370
421
|
// is a `\n`-joined multi-line string, so the actual file-row count is
|
|
@@ -374,10 +425,10 @@ The agent should insert variant HTML at insertLine.`);
|
|
|
374
425
|
endLine: outputEndLine, // 1-indexed
|
|
375
426
|
insertLine, // 1-indexed: where variants go
|
|
376
427
|
commentSyntax: commentSyntax,
|
|
377
|
-
styleMode:
|
|
378
|
-
styleTag:
|
|
379
|
-
cssSelectorPrefixExamples:
|
|
380
|
-
cssAuthoring:
|
|
428
|
+
styleMode: componentPreviewMode || styleMode.mode,
|
|
429
|
+
styleTag: useFrameworkComponent ? null : styleMode.styleTag,
|
|
430
|
+
cssSelectorPrefixExamples: useFrameworkComponent ? [] : buildCssSelectorPrefixExamples(styleMode.mode, count),
|
|
431
|
+
cssAuthoring: svelteComponentAuthoring || buildCssAuthoring(styleMode, count),
|
|
381
432
|
originalLineCount: originalLines.length,
|
|
382
433
|
}));
|
|
383
434
|
}
|
|
@@ -650,56 +701,19 @@ function buildCssAuthoring(styleMode, count) {
|
|
|
650
701
|
/**
|
|
651
702
|
* Search project files for the query string (class name, ID, etc.)
|
|
652
703
|
* Returns the first matching file path, or null.
|
|
704
|
+
*
|
|
705
|
+
* Only `node_modules`, `.git`, and `.impeccable` are skipped outright.
|
|
706
|
+
* dist/build/out are left to the isGeneratedFile guard so the
|
|
707
|
+
* `includeGenerated` second pass can still find the element there and report
|
|
708
|
+
* `generatedMatch`.
|
|
653
709
|
*/
|
|
654
710
|
function findFileWithQuery(query, cwd, genOpts = {}) {
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
const result = searchDir(absDir, query, seen, 0, genOpts);
|
|
662
|
-
if (result) return result;
|
|
663
|
-
}
|
|
664
|
-
return null;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
function searchDir(dir, query, seen, depth, genOpts) {
|
|
668
|
-
if (depth > 5) return null; // don't go too deep
|
|
669
|
-
const realDir = fs.realpathSync(dir);
|
|
670
|
-
if (seen.has(realDir)) return null;
|
|
671
|
-
seen.add(realDir);
|
|
672
|
-
|
|
673
|
-
let entries;
|
|
674
|
-
try { entries = fs.readdirSync(dir, { withFileTypes: true }); }
|
|
675
|
-
catch { return null; }
|
|
676
|
-
|
|
677
|
-
// Check files first
|
|
678
|
-
for (const entry of entries) {
|
|
679
|
-
if (!entry.isFile()) continue;
|
|
680
|
-
const ext = path.extname(entry.name).toLowerCase();
|
|
681
|
-
if (!EXTENSIONS.includes(ext)) continue;
|
|
682
|
-
|
|
683
|
-
const filePath = path.join(dir, entry.name);
|
|
684
|
-
if (!genOpts.includeGenerated && isGeneratedFile(filePath, genOpts)) continue;
|
|
685
|
-
try {
|
|
686
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
687
|
-
if (content.includes(query)) return filePath;
|
|
688
|
-
} catch { /* skip unreadable files */ }
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
// Then recurse into directories. Always skip node_modules and .git (never
|
|
692
|
-
// project content). dist/build/out are left to the isGeneratedFile guard so
|
|
693
|
-
// the includeGenerated second-pass can still find the element there and
|
|
694
|
-
// report `generatedMatch`.
|
|
695
|
-
for (const entry of entries) {
|
|
696
|
-
if (!entry.isDirectory()) continue;
|
|
697
|
-
if (entry.name === 'node_modules' || entry.name === '.git') continue;
|
|
698
|
-
const result = searchDir(path.join(dir, entry.name), query, seen, depth + 1, genOpts);
|
|
699
|
-
if (result) return result;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
return null;
|
|
711
|
+
return findSourceFile({
|
|
712
|
+
query,
|
|
713
|
+
cwd,
|
|
714
|
+
extensions: resolveLiveTemplateExtensions(cwd),
|
|
715
|
+
fileFilter: (filePath) => genOpts.includeGenerated || !isGeneratedFile(filePath, genOpts),
|
|
716
|
+
});
|
|
703
717
|
}
|
|
704
718
|
|
|
705
719
|
/**
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* After this, the agent's only remaining steps are:
|
|
12
12
|
* - Open the project's live dev/preview URL in the browser (optional, if browser automation exists)—not `serverPort`; that port is the Impeccable helper for /live.js and /poll
|
|
13
|
-
* - Enter the poll loop: `node live-poll.mjs`
|
|
13
|
+
* - Enter the harness-native poll loop: `node live-poll.mjs`
|
|
14
14
|
*
|
|
15
15
|
* Usage:
|
|
16
16
|
* node live.mjs # Prepare everything, print JSON, exit
|
|
@@ -40,6 +40,7 @@ Prepare everything for live variant mode in a single command:
|
|
|
40
40
|
- Starts (or reuses) the live server in the background
|
|
41
41
|
- Injects the browser script tag
|
|
42
42
|
- Reads PRODUCT.md / DESIGN.md for project context
|
|
43
|
+
- Prepares the harness-native foreground/background poll loop
|
|
43
44
|
- In monorepos, choose a child app first; --target <path> is the fallback/manual path
|
|
44
45
|
|
|
45
46
|
On success, prints a JSON blob with:
|
|
@@ -111,7 +112,11 @@ The agent should then:
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
// 3. Inject the script tag at the current port
|
|
114
|
-
const injectOut = runScript(
|
|
115
|
+
const injectOut = runScript(
|
|
116
|
+
'live-inject.mjs',
|
|
117
|
+
['--port', String(serverInfo.port), '--token', String(serverInfo.token)],
|
|
118
|
+
{ cwd: activeCwd },
|
|
119
|
+
);
|
|
115
120
|
const injectResult = safeParse(injectOut);
|
|
116
121
|
if (!injectResult || !injectResult.ok) {
|
|
117
122
|
console.log(JSON.stringify({
|