claudecode-omc 5.9.1 → 5.11.0

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 (103) hide show
  1. package/.local/settings/settings.json +8 -0
  2. package/.omc-curation/governance.json +3 -0
  3. package/.omc-curation/sources.lock.json +5 -0
  4. package/README.md +10 -1
  5. package/bundled/manifest.json +2 -1
  6. package/bundled/upstream/impeccable/.omc-source/bundle.json +20 -0
  7. package/bundled/upstream/impeccable/.omc-source/provenance.json +105 -0
  8. package/bundled/upstream/impeccable/agents/impeccable-manual-edit-applier.md +97 -0
  9. package/bundled/upstream/impeccable/skills/impeccable/SKILL.md +168 -0
  10. package/bundled/upstream/impeccable/skills/impeccable/reference/adapt.md +311 -0
  11. package/bundled/upstream/impeccable/skills/impeccable/reference/animate.md +201 -0
  12. package/bundled/upstream/impeccable/skills/impeccable/reference/audit.md +133 -0
  13. package/bundled/upstream/impeccable/skills/impeccable/reference/bolder.md +113 -0
  14. package/bundled/upstream/impeccable/skills/impeccable/reference/brand.md +108 -0
  15. package/bundled/upstream/impeccable/skills/impeccable/reference/clarify.md +288 -0
  16. package/bundled/upstream/impeccable/skills/impeccable/reference/codex.md +105 -0
  17. package/bundled/upstream/impeccable/skills/impeccable/reference/colorize.md +257 -0
  18. package/bundled/upstream/impeccable/skills/impeccable/reference/craft.md +123 -0
  19. package/bundled/upstream/impeccable/skills/impeccable/reference/critique.md +767 -0
  20. package/bundled/upstream/impeccable/skills/impeccable/reference/delight.md +302 -0
  21. package/bundled/upstream/impeccable/skills/impeccable/reference/distill.md +111 -0
  22. package/bundled/upstream/impeccable/skills/impeccable/reference/document.md +429 -0
  23. package/bundled/upstream/impeccable/skills/impeccable/reference/extract.md +69 -0
  24. package/bundled/upstream/impeccable/skills/impeccable/reference/harden.md +347 -0
  25. package/bundled/upstream/impeccable/skills/impeccable/reference/hooks.md +88 -0
  26. package/bundled/upstream/impeccable/skills/impeccable/reference/init.md +172 -0
  27. package/bundled/upstream/impeccable/skills/impeccable/reference/interaction-design.md +189 -0
  28. package/bundled/upstream/impeccable/skills/impeccable/reference/layout.md +161 -0
  29. package/bundled/upstream/impeccable/skills/impeccable/reference/live.md +718 -0
  30. package/bundled/upstream/impeccable/skills/impeccable/reference/onboard.md +234 -0
  31. package/bundled/upstream/impeccable/skills/impeccable/reference/optimize.md +258 -0
  32. package/bundled/upstream/impeccable/skills/impeccable/reference/overdrive.md +130 -0
  33. package/bundled/upstream/impeccable/skills/impeccable/reference/polish.md +241 -0
  34. package/bundled/upstream/impeccable/skills/impeccable/reference/product.md +60 -0
  35. package/bundled/upstream/impeccable/skills/impeccable/reference/quieter.md +99 -0
  36. package/bundled/upstream/impeccable/skills/impeccable/reference/shape.md +165 -0
  37. package/bundled/upstream/impeccable/skills/impeccable/reference/typeset.md +279 -0
  38. package/bundled/upstream/impeccable/skills/impeccable/scripts/command-metadata.json +94 -0
  39. package/bundled/upstream/impeccable/skills/impeccable/scripts/context-signals.mjs +225 -0
  40. package/bundled/upstream/impeccable/skills/impeccable/scripts/context.mjs +280 -0
  41. package/bundled/upstream/impeccable/skills/impeccable/scripts/critique-storage.mjs +242 -0
  42. package/bundled/upstream/impeccable/skills/impeccable/scripts/detect-csp.mjs +198 -0
  43. package/bundled/upstream/impeccable/skills/impeccable/scripts/detect.mjs +21 -0
  44. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/browser/injected/index.mjs +1735 -0
  45. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/cli/main.mjs +244 -0
  46. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +4907 -0
  47. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
  48. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
  49. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +552 -0
  50. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +1013 -0
  51. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
  52. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
  53. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/findings.mjs +12 -0
  54. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/node/file-system.mjs +198 -0
  55. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/profile/profiler.mjs +166 -0
  56. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
  57. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/rules/checks.mjs +2671 -0
  58. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/shared/color.mjs +124 -0
  59. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/shared/constants.mjs +101 -0
  60. package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/shared/page.mjs +7 -0
  61. package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-admin.mjs +574 -0
  62. package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-before-edit.mjs +473 -0
  63. package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-lib.mjs +1286 -0
  64. package/bundled/upstream/impeccable/skills/impeccable/scripts/hook.mjs +61 -0
  65. package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/design-parser.mjs +835 -0
  66. package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/impeccable-paths.mjs +126 -0
  67. package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/is-generated.mjs +69 -0
  68. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/browser-script-parts.mjs +49 -0
  69. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/completion.mjs +19 -0
  70. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/event-validation.mjs +137 -0
  71. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/insert-ui.mjs +458 -0
  72. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/manual-apply.mjs +939 -0
  73. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/manual-edit-routes.mjs +357 -0
  74. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/manual-edits-buffer.mjs +152 -0
  75. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/session-store.mjs +289 -0
  76. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/svelte-component.mjs +826 -0
  77. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/sveltekit-adapter.mjs +274 -0
  78. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/ui-core.mjs +180 -0
  79. package/bundled/upstream/impeccable/skills/impeccable/scripts/live/vocabulary.mjs +36 -0
  80. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-accept.mjs +812 -0
  81. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-browser-dom.js +146 -0
  82. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-browser-session.js +123 -0
  83. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-browser.js +11086 -0
  84. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
  85. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-complete.mjs +75 -0
  86. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
  87. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
  88. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-inject.mjs +583 -0
  89. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-insert.mjs +272 -0
  90. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
  91. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-poll.mjs +379 -0
  92. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-resume.mjs +94 -0
  93. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-server.mjs +1134 -0
  94. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-status.mjs +61 -0
  95. package/bundled/upstream/impeccable/skills/impeccable/scripts/live-wrap.mjs +894 -0
  96. package/bundled/upstream/impeccable/skills/impeccable/scripts/live.mjs +246 -0
  97. package/bundled/upstream/impeccable/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
  98. package/bundled/upstream/impeccable/skills/impeccable/scripts/palette.mjs +633 -0
  99. package/bundled/upstream/impeccable/skills/impeccable/scripts/pin.mjs +214 -0
  100. package/package.json +1 -1
  101. package/src/cli/source.js +6 -0
  102. package/src/config/sources.js +15 -0
  103. package/src/merge/content-patch.js +4 -0
@@ -0,0 +1,289 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { getLegacyLiveSessionsDir, getLiveSessionsDir } from '../lib/impeccable-paths.mjs';
4
+
5
+ const COMPLETED_PHASES = new Set(['completed', 'discarded']);
6
+
7
+ export function createLiveSessionStore({ cwd = process.cwd(), sessionId } = {}) {
8
+ const rootDir = getLiveSessionsDir(cwd);
9
+ const legacyRootDir = getLegacyLiveSessionsDir(cwd);
10
+ fs.mkdirSync(rootDir, { recursive: true });
11
+ const snapshotCache = new Map();
12
+
13
+ function loadCachedOrRebuild(id) {
14
+ const cached = snapshotCache.get(id);
15
+ if (cached) return cached;
16
+ const journalPath = getReadableJournalPath(id);
17
+ const rebuilt = rebuildSnapshotFromJournal(journalPath, id);
18
+ snapshotCache.set(id, rebuilt);
19
+ return rebuilt;
20
+ }
21
+
22
+ function getReadableJournalPath(id) {
23
+ const primary = getJournalPath(rootDir, id);
24
+ if (fs.existsSync(primary)) return primary;
25
+ const legacy = getJournalPath(legacyRootDir, id);
26
+ if (fs.existsSync(legacy)) return legacy;
27
+ return primary;
28
+ }
29
+
30
+ return {
31
+ rootDir,
32
+ legacyRootDir,
33
+ appendEvent(event) {
34
+ const normalized = normalizeEvent(event, sessionId);
35
+ const journalPath = getJournalPath(rootDir, normalized.id);
36
+ const snapshotPath = getSnapshotPath(rootDir, normalized.id);
37
+ const legacyJournalPath = getJournalPath(legacyRootDir, normalized.id);
38
+ if (!fs.existsSync(journalPath) && fs.existsSync(legacyJournalPath)) {
39
+ fs.copyFileSync(legacyJournalPath, journalPath);
40
+ }
41
+ const prior = loadCachedOrRebuild(normalized.id);
42
+ const seq = prior.nextSeq;
43
+ const entry = {
44
+ seq,
45
+ id: normalized.id,
46
+ type: normalized.type,
47
+ ts: new Date().toISOString(),
48
+ event: normalized,
49
+ };
50
+ fs.appendFileSync(journalPath, JSON.stringify(entry) + '\n');
51
+ const next = applyEvent(prior.snapshot, entry, prior.diagnostics);
52
+ snapshotCache.set(normalized.id, { snapshot: next, diagnostics: next.diagnostics || [], nextSeq: seq + 1 });
53
+ writeSnapshot(snapshotPath, next);
54
+ return next;
55
+ },
56
+ getSnapshot(id = sessionId, opts = {}) {
57
+ if (!id) throw new Error('session id required');
58
+ const journalPath = getReadableJournalPath(id);
59
+ const snapshotPath = getSnapshotPath(rootDir, id);
60
+ const rebuilt = rebuildSnapshotFromJournal(journalPath, id);
61
+ snapshotCache.set(id, rebuilt);
62
+ writeSnapshot(snapshotPath, rebuilt.snapshot);
63
+ if (!opts.includeCompleted && COMPLETED_PHASES.has(rebuilt.snapshot.phase)) return null;
64
+ return rebuilt.snapshot;
65
+ },
66
+ listActiveSessions() {
67
+ const ids = new Set();
68
+ for (const dir of [legacyRootDir, rootDir]) {
69
+ if (!fs.existsSync(dir)) continue;
70
+ for (const name of fs.readdirSync(dir)) {
71
+ if (name.endsWith('.jsonl')) ids.add(name.slice(0, -'.jsonl'.length));
72
+ }
73
+ }
74
+ return [...ids]
75
+ .sort()
76
+ .map((id) => this.getSnapshot(id))
77
+ .filter(Boolean);
78
+ },
79
+ };
80
+ }
81
+
82
+ function normalizeEvent(event, fallbackId) {
83
+ if (!event || typeof event !== 'object') throw new Error('event object required');
84
+ const id = event.id || fallbackId;
85
+ if (!id || typeof id !== 'string') throw new Error('event id required');
86
+ if (!event.type || typeof event.type !== 'string') throw new Error('event type required');
87
+ return { ...event, id };
88
+ }
89
+
90
+ function getJournalPath(rootDir, id) {
91
+ return path.join(rootDir, safeSessionId(id) + '.jsonl');
92
+ }
93
+
94
+ function getSnapshotPath(rootDir, id) {
95
+ return path.join(rootDir, safeSessionId(id) + '.snapshot.json');
96
+ }
97
+
98
+ function safeSessionId(id) {
99
+ if (!/^[A-Za-z0-9_-]{1,128}$/.test(id)) throw new Error('invalid session id: ' + id);
100
+ return id;
101
+ }
102
+
103
+ function baseSnapshot(id) {
104
+ return {
105
+ id,
106
+ phase: 'new',
107
+ pageUrl: null,
108
+ sourceFile: null,
109
+ previewFile: null,
110
+ previewMode: null,
111
+ expectedVariants: 0,
112
+ arrivedVariants: 0,
113
+ visibleVariant: null,
114
+ paramValues: {},
115
+ pendingEventSeq: null,
116
+ pendingEvent: null,
117
+ deliveryLease: null,
118
+ checkpointRevision: 0,
119
+ activeOwner: null,
120
+ sourceMarkers: {},
121
+ fallbackMode: null,
122
+ annotationArtifacts: [],
123
+ diagnostics: [],
124
+ updatedAt: null,
125
+ };
126
+ }
127
+
128
+ function rebuildSnapshotFromJournal(journalPath, id) {
129
+ let snapshot = baseSnapshot(id);
130
+ const diagnostics = [];
131
+ let nextSeq = 1;
132
+ if (!fs.existsSync(journalPath)) return { snapshot, diagnostics, nextSeq };
133
+
134
+ const lines = fs.readFileSync(journalPath, 'utf-8').split('\n');
135
+ for (let i = 0; i < lines.length; i++) {
136
+ const line = lines[i];
137
+ if (!line.trim()) continue;
138
+ try {
139
+ const entry = JSON.parse(line);
140
+ if (!entry || typeof entry !== 'object') throw new Error('entry is not object');
141
+ if (Number.isInteger(entry.seq)) nextSeq = Math.max(nextSeq, entry.seq + 1);
142
+ snapshot = applyEvent(snapshot, entry);
143
+ } catch (err) {
144
+ diagnostics.push({
145
+ error: 'journal_parse_failed',
146
+ line: i + 1,
147
+ message: err.message,
148
+ });
149
+ }
150
+ }
151
+ snapshot.diagnostics = [...snapshot.diagnostics, ...diagnostics];
152
+ return { snapshot, diagnostics, nextSeq };
153
+ }
154
+
155
+ function applyEvent(snapshot, entry, inheritedDiagnostics = []) {
156
+ const event = entry.event || entry;
157
+ const next = {
158
+ ...snapshot,
159
+ paramValues: { ...(snapshot.paramValues || {}) },
160
+ sourceMarkers: { ...(snapshot.sourceMarkers || {}) },
161
+ annotationArtifacts: [...(snapshot.annotationArtifacts || [])],
162
+ diagnostics: [...(snapshot.diagnostics || [])],
163
+ updatedAt: entry.ts || new Date().toISOString(),
164
+ };
165
+
166
+ if (inheritedDiagnostics.length && next.diagnostics.length === 0) {
167
+ next.diagnostics = [...inheritedDiagnostics];
168
+ }
169
+
170
+ switch (event.type) {
171
+ case 'generate':
172
+ next.phase = 'generate_requested';
173
+ next.pageUrl = event.pageUrl ?? next.pageUrl;
174
+ next.expectedVariants = event.count ?? next.expectedVariants;
175
+ next.pendingEventSeq = entry.seq ?? next.pendingEventSeq;
176
+ next.pendingEvent = toPendingEvent(event);
177
+ if (event.screenshotPath) upsertArtifact(next.annotationArtifacts, { type: 'screenshot', path: event.screenshotPath });
178
+ break;
179
+ case 'variants_ready':
180
+ case 'agent_done':
181
+ next.phase = event.carbonize === true ? 'carbonize_required' : 'variants_ready';
182
+ next.sourceFile = event.sourceFile ?? event.file ?? next.sourceFile;
183
+ next.previewFile = event.previewFile ?? next.previewFile;
184
+ next.previewMode = event.previewMode ?? next.previewMode;
185
+ next.arrivedVariants = event.arrivedVariants ?? (next.expectedVariants || next.arrivedVariants || 0);
186
+ next.pendingEventSeq = null;
187
+ next.pendingEvent = null;
188
+ if (event.carbonize === true) {
189
+ next.diagnostics.push({
190
+ error: 'carbonize_cleanup_required',
191
+ file: event.file || null,
192
+ message: 'Accepted variant still has carbonize markers that must be folded into source CSS.',
193
+ });
194
+ }
195
+ break;
196
+ case 'checkpoint':
197
+ if (COMPLETED_PHASES.has(next.phase)) {
198
+ next.diagnostics.push({ error: 'checkpoint_after_terminal_ignored', phase: event.phase ?? null, revision: event.revision ?? null });
199
+ break;
200
+ }
201
+ if ((event.revision ?? 0) >= (next.checkpointRevision ?? 0)) {
202
+ next.phase = event.phase ?? next.phase;
203
+ next.checkpointRevision = event.revision ?? next.checkpointRevision;
204
+ next.activeOwner = event.owner ?? next.activeOwner;
205
+ next.arrivedVariants = event.arrivedVariants ?? next.arrivedVariants;
206
+ next.visibleVariant = event.visibleVariant ?? next.visibleVariant;
207
+ next.sourceFile = event.sourceFile ?? next.sourceFile;
208
+ next.previewFile = event.previewFile ?? next.previewFile;
209
+ next.previewMode = event.previewMode ?? next.previewMode;
210
+ if (event.paramValues) next.paramValues = { ...event.paramValues };
211
+ } else {
212
+ next.diagnostics.push({ error: 'stale_checkpoint_ignored', revision: event.revision });
213
+ }
214
+ break;
215
+ case 'accept':
216
+ case 'accept_intent':
217
+ next.phase = 'accept_requested';
218
+ next.visibleVariant = Number(event.variantId ?? next.visibleVariant);
219
+ if (event.paramValues) next.paramValues = { ...event.paramValues };
220
+ next.pendingEventSeq = entry.seq ?? next.pendingEventSeq;
221
+ next.pendingEvent = toPendingEvent(event);
222
+ break;
223
+ case 'manual_edit_apply':
224
+ next.phase = 'manual_edit_apply_requested';
225
+ next.pageUrl = event.pageUrl ?? next.pageUrl;
226
+ next.pendingEventSeq = entry.seq ?? next.pendingEventSeq;
227
+ next.pendingEvent = toPendingEvent(event);
228
+ break;
229
+ case 'steer':
230
+ next.phase = 'steer_requested';
231
+ next.pageUrl = event.pageUrl ?? next.pageUrl;
232
+ next.pendingEventSeq = entry.seq ?? next.pendingEventSeq;
233
+ next.pendingEvent = toPendingEvent(event);
234
+ break;
235
+ case 'steer_done':
236
+ next.phase = 'steer_done';
237
+ next.sourceFile = event.sourceFile ?? event.file ?? next.sourceFile;
238
+ next.previewFile = event.previewFile ?? next.previewFile;
239
+ next.previewMode = event.previewMode ?? next.previewMode;
240
+ next.message = event.message ?? next.message;
241
+ next.pendingEventSeq = null;
242
+ next.pendingEvent = null;
243
+ break;
244
+ case 'discard':
245
+ next.phase = 'discard_requested';
246
+ next.pendingEventSeq = entry.seq ?? next.pendingEventSeq;
247
+ next.pendingEvent = toPendingEvent(event);
248
+ break;
249
+ case 'discarded':
250
+ next.phase = 'discarded';
251
+ next.pendingEventSeq = null;
252
+ next.pendingEvent = null;
253
+ break;
254
+ case 'complete':
255
+ next.phase = 'completed';
256
+ next.sourceFile = event.sourceFile ?? event.file ?? next.sourceFile;
257
+ next.previewFile = event.previewFile ?? next.previewFile;
258
+ next.previewMode = event.previewMode ?? next.previewMode;
259
+ next.pendingEventSeq = null;
260
+ next.pendingEvent = null;
261
+ break;
262
+ case 'agent_error':
263
+ next.phase = 'agent_error';
264
+ next.pendingEventSeq = null;
265
+ next.pendingEvent = null;
266
+ next.diagnostics.push({ error: 'agent_error', message: event.message || 'unknown agent error' });
267
+ break;
268
+ default:
269
+ next.diagnostics.push({ error: 'unknown_event_type', type: event.type });
270
+ break;
271
+ }
272
+ return next;
273
+ }
274
+
275
+ function toPendingEvent(event) {
276
+ const pending = { ...event };
277
+ delete pending.token;
278
+ return pending;
279
+ }
280
+
281
+ function upsertArtifact(artifacts, artifact) {
282
+ if (!artifacts.some((existing) => existing.path === artifact.path && existing.type === artifact.type)) {
283
+ artifacts.push(artifact);
284
+ }
285
+ }
286
+
287
+ function writeSnapshot(snapshotPath, snapshot) {
288
+ fs.writeFileSync(snapshotPath, JSON.stringify(snapshot, null, 2) + '\n');
289
+ }