quiver-cli 0.8.0 → 1.0.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.
- package/README.md +110 -45
- package/bin/quiver-cli.mjs +3 -1
- package/dist/cli.js +546 -458
- package/package.json +2 -2
- package/template/.agents/AGENTS.md +4 -3
- package/template/.agents/config.json +7 -0
- package/template/.agents/plugins/opencode/rtk.ts +34 -0
- package/template/.agents/skills/agent-browser/SKILL.md +1 -0
- package/template/.agents/skills/apps/skybridge/SKILL.md +4 -0
- package/template/.agents/skills/design/impeccable/SKILL.md +36 -118
- package/template/.agents/skills/design/impeccable/reference/adapt.md +1 -0
- package/template/.agents/skills/design/impeccable/reference/adapt.native.md +58 -0
- package/template/.agents/skills/design/impeccable/reference/android.md +40 -0
- package/template/.agents/skills/design/impeccable/reference/animate.md +73 -188
- package/template/.agents/skills/design/impeccable/reference/audit.md +12 -9
- package/template/.agents/skills/design/impeccable/reference/audit.native.md +139 -0
- package/template/.agents/skills/design/impeccable/reference/bolder.md +19 -101
- package/template/.agents/skills/design/impeccable/reference/clarify.md +59 -253
- package/template/.agents/skills/design/impeccable/reference/colorize.md +51 -222
- package/template/.agents/skills/design/impeccable/reference/craft-floor.md +42 -0
- package/template/.agents/skills/design/impeccable/reference/craft.md +3 -121
- package/template/.agents/skills/design/impeccable/reference/critique.md +44 -23
- package/template/.agents/skills/design/impeccable/reference/degraded/asset-producer.md +90 -0
- package/template/.agents/skills/design/impeccable/reference/degraded/documenter.md +24 -0
- package/template/.agents/skills/design/impeccable/reference/degraded/finish-reviewer.md +37 -0
- package/template/.agents/skills/design/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- package/template/.agents/skills/design/impeccable/reference/delight.md +47 -279
- package/template/.agents/skills/design/impeccable/reference/distill.md +2 -2
- package/template/.agents/skills/design/impeccable/reference/doctor.md +53 -0
- package/template/.agents/skills/design/impeccable/reference/document.md +60 -73
- package/template/.agents/skills/design/impeccable/reference/harden.md +1 -12
- package/template/.agents/skills/design/impeccable/reference/hooks.md +20 -5
- package/template/.agents/skills/design/impeccable/reference/init.md +72 -119
- package/template/.agents/skills/design/impeccable/reference/ios.md +45 -0
- package/template/.agents/skills/design/impeccable/reference/layout.md +54 -131
- package/template/.agents/skills/design/impeccable/reference/live-setup.md +102 -0
- package/template/.agents/skills/design/impeccable/reference/live.md +116 -511
- package/template/.agents/skills/design/impeccable/reference/new-work.md +105 -0
- package/template/.agents/skills/design/impeccable/reference/{product.md → operate.md} +6 -5
- package/template/.agents/skills/design/impeccable/reference/optimize.md +4 -4
- package/template/.agents/skills/design/impeccable/reference/overdrive.md +1 -4
- package/template/.agents/skills/design/impeccable/reference/polish.md +68 -212
- package/template/.agents/skills/design/impeccable/reference/quieter.md +3 -3
- package/template/.agents/skills/design/impeccable/reference/routing.md +18 -0
- package/template/.agents/skills/design/impeccable/reference/shape.md +38 -144
- package/template/.agents/skills/design/impeccable/reference/typeset.md +51 -250
- package/template/.agents/skills/design/impeccable/reference/visualize.md +47 -0
- package/template/.agents/skills/design/impeccable/scripts/command-metadata.json +1 -1
- package/template/.agents/skills/design/impeccable/scripts/concept-seed.mjs +558 -0
- package/template/.agents/skills/design/impeccable/scripts/context-signals.mjs +119 -10
- package/template/.agents/skills/design/impeccable/scripts/context.mjs +534 -45
- package/template/.agents/skills/design/impeccable/scripts/critique-storage.mjs +18 -47
- package/template/.agents/skills/design/impeccable/scripts/detector/browser/injected/index.mjs +96 -10
- package/template/.agents/skills/design/impeccable/scripts/detector/cli/main.mjs +174 -26
- package/template/.agents/skills/design/impeccable/scripts/detector/design-system.mjs +233 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns-browser.js +3348 -203
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/browser/detect-url.mjs +102 -7
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/regex/detect-text.mjs +297 -97
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +187 -16
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/detect-html.mjs +41 -11
- package/template/.agents/skills/design/impeccable/scripts/detector/findings.mjs +7 -1
- package/template/.agents/skills/design/impeccable/scripts/detector/node/file-system.mjs +16 -2
- package/template/.agents/skills/design/impeccable/scripts/detector/registry/antipatterns.mjs +207 -38
- package/template/.agents/skills/design/impeccable/scripts/detector/rules/checks.mjs +3082 -173
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/constants.mjs +11 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/fonts.mjs +30 -0
- package/template/.agents/skills/design/impeccable/scripts/doctor.mjs +336 -0
- package/template/.agents/skills/design/impeccable/scripts/embed-prompt.mjs +133 -0
- package/template/.agents/skills/design/impeccable/scripts/generate-image.mjs +240 -0
- package/template/.agents/skills/design/impeccable/scripts/hook-admin.mjs +98 -18
- package/template/.agents/skills/design/impeccable/scripts/hook-before-edit.mjs +46 -6
- package/template/.agents/skills/design/impeccable/scripts/hook-lib.mjs +518 -50
- package/template/.agents/skills/design/impeccable/scripts/hook.mjs +25 -8
- package/template/.agents/skills/design/impeccable/scripts/lib/artifact-schema.mjs +93 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/composition-catalog.mjs +200 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/concept-catalog.mjs +357 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-config.mjs +27 -7
- package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-paths.mjs +17 -8
- package/template/.agents/skills/design/impeccable/scripts/lib/provider.mjs +5 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/roll-selection.mjs +362 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness-deep.mjs +457 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness-notice.mjs +169 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/staleness.mjs +457 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/surface-briefs.mjs +151 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/target-slug.mjs +33 -0
- package/template/.agents/skills/design/impeccable/scripts/lib/template-extensions.mjs +146 -0
- package/template/.agents/skills/design/impeccable/scripts/live/accept-css.mjs +617 -0
- package/template/.agents/skills/design/impeccable/scripts/live/accept-verify.mjs +60 -0
- package/template/.agents/skills/design/impeccable/scripts/live/browser-script-parts.mjs +7 -1
- package/template/.agents/skills/design/impeccable/scripts/live/completion.mjs +10 -1
- package/template/.agents/skills/design/impeccable/scripts/live/event-validation.mjs +67 -5
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/astro.mjs +47 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/detect-utils.mjs +73 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/index.mjs +143 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/journal.mjs +197 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nuxt.mjs +161 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/script-src.mjs +17 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/static-html.mjs +26 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
- package/template/.agents/skills/design/impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
- package/template/.agents/skills/design/impeccable/scripts/live/generation-preflight.mjs +149 -0
- package/template/.agents/skills/design/impeccable/scripts/live/instructions.mjs +142 -0
- package/template/.agents/skills/design/impeccable/scripts/live/poll-lanes.mjs +14 -0
- package/template/.agents/skills/design/impeccable/scripts/live/roots.mjs +508 -0
- package/template/.agents/skills/design/impeccable/scripts/live/session-store.mjs +324 -50
- package/template/.agents/skills/design/impeccable/scripts/live/source-lock.mjs +105 -0
- package/template/.agents/skills/design/impeccable/scripts/live/source-search.mjs +105 -0
- package/template/.agents/skills/design/impeccable/scripts/live/svelte-ast.mjs +961 -0
- package/template/.agents/skills/design/impeccable/scripts/live/svelte-component.mjs +588 -72
- package/template/.agents/skills/design/impeccable/scripts/live/sveltekit-adapter.mjs +59 -17
- package/template/.agents/skills/design/impeccable/scripts/live/tanstack-adapter.mjs +280 -0
- package/template/.agents/skills/design/impeccable/scripts/live/vocabulary.mjs +135 -0
- package/template/.agents/skills/design/impeccable/scripts/live-accept.mjs +210 -68
- package/template/.agents/skills/design/impeccable/scripts/live-browser.js +1562 -223
- package/template/.agents/skills/design/impeccable/scripts/live-commit-manual-edits.mjs +3 -0
- package/template/.agents/skills/design/impeccable/scripts/live-complete.mjs +33 -1
- package/template/.agents/skills/design/impeccable/scripts/live-inject.mjs +175 -255
- package/template/.agents/skills/design/impeccable/scripts/live-insert.mjs +26 -6
- package/template/.agents/skills/design/impeccable/scripts/live-manual-edit-evidence.mjs +6 -1
- package/template/.agents/skills/design/impeccable/scripts/live-poll.mjs +61 -16
- package/template/.agents/skills/design/impeccable/scripts/live-resume.mjs +39 -10
- package/template/.agents/skills/design/impeccable/scripts/live-server.mjs +573 -47
- package/template/.agents/skills/design/impeccable/scripts/live-status.mjs +17 -7
- package/template/.agents/skills/design/impeccable/scripts/live-wrap.mjs +124 -91
- package/template/.agents/skills/design/impeccable/scripts/live.mjs +88 -26
- package/template/.agents/skills/design/impeccable/scripts/palette.mjs +76 -81
- package/template/.agents/skills/design/impeccable/scripts/pin.mjs +18 -11
- package/template/.agents/skills/design/impeccable/scripts/serve-question.mjs +932 -0
- package/template/.agents/skills/design/impeccable/scripts/surface-brief.mjs +74 -0
- package/template/.agents/skills/design/shadcn/SKILL.md +46 -11
- package/template/.agents/skills/design/shadcn/cli.md +49 -16
- package/template/.agents/skills/design/shadcn/customization.md +14 -7
- package/template/.agents/skills/design/shadcn/evals/evals.json +30 -0
- package/template/.agents/skills/design/shadcn/mcp.md +27 -16
- package/template/.agents/skills/design/shadcn/registry.md +277 -0
- package/template/.agents/skills/design/shadcn/rules/chat.md +224 -0
- package/template/.agents/skills/design/shadcn/rules/composition.md +20 -2
- package/template/.agents/skills/design/shadcn/rules/styling.md +23 -0
- package/template/.agents/skills/find-skills/SKILL.md +2 -3
- package/template/.agents/skills/hono/SKILL.md +579 -0
- package/template/.agents/skills/integrations/langfuse/SKILL.md +10 -6
- package/template/.agents/skills/integrations/langfuse/references/ci-cd.md +41 -0
- package/template/.agents/skills/integrations/langfuse/references/cli.md +8 -0
- package/template/.agents/skills/integrations/langfuse/references/error-analysis.md +15 -27
- package/template/.agents/skills/integrations/langfuse/references/instrumentation.md +39 -52
- package/template/.agents/skills/integrations/langfuse/references/judge-calibration.md +5 -2
- package/template/.agents/skills/integrations/langfuse/references/prompt-engineering.md +35 -0
- package/template/.agents/skills/integrations/langfuse/references/prompt-migration.md +41 -196
- package/template/.agents/skills/integrations/langfuse/references/skill-feedback.md +3 -0
- package/template/.agents/skills/integrations/langfuse/references/trace-evaluator-upgrade.md +76 -0
- package/template/.agents/skills/integrations/langfuse/references/user-feedback.md +4 -0
- package/template/.agents/skills/integrations/langfuse/references/v4-project-migration.md +73 -0
- package/template/.agents/skills/supabase/CHANGELOG.md +71 -0
- package/template/.agents/skills/supabase/SKILL.md +145 -0
- package/template/.agents/skills/supabase/assets/feedback-issue-template.md +17 -0
- package/template/.agents/skills/supabase/references/skill-feedback.md +17 -0
- package/template/.agents/skills/supabase-postgres-best-practices/CHANGELOG.md +73 -0
- package/template/.agents/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
- package/template/.agents/upstreams.json +34 -12
- package/template/.agents/skills/design/impeccable/reference/brand.md +0 -108
- package/template/.agents/skills/design/impeccable/reference/codex.md +0 -105
- package/template/.agents/skills/design/impeccable/reference/interaction-design.md +0 -189
- package/template/.agents/skills/integrations/langfuse/references/sdk-upgrade.md +0 -175
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { WELL_TIERS } from './roll-selection.mjs';
|
|
4
|
+
|
|
5
|
+
export const CONCEPT_STATUSES = new Set(['approved', 'rejected']);
|
|
6
|
+
|
|
7
|
+
// What a concept is actually strong at. Worlds carry a durable visual
|
|
8
|
+
// identity (their palette/type half is the magnet); compositions carry a
|
|
9
|
+
// composition or interaction idea (their topology half is the magnet) that can be
|
|
10
|
+
// dressed in any committed identity; duals fuse both inseparably. Direction
|
|
11
|
+
// seeds draw world|dual, surface seeds draw composition|dual.
|
|
12
|
+
export const CONCEPT_STRENGTHS = new Set(['world', 'composition', 'dual']);
|
|
13
|
+
|
|
14
|
+
// Challenger tiers, ordered by translation cost: graphic grammars map to
|
|
15
|
+
// interface almost directly, instrument languages carry interaction physics,
|
|
16
|
+
// atmosphere worlds need the largest translation step. Every seed roll draws
|
|
17
|
+
// one challenger from each tier so at least one directly-usable graphic
|
|
18
|
+
// system is always on the table.
|
|
19
|
+
// Defined in roll-selection.mjs, the dependency-free leaf both the seeder and
|
|
20
|
+
// the roll API import. It cannot depend on this file: this one reads the
|
|
21
|
+
// filesystem, and a Pages Function must not pull node:fs into its bundle.
|
|
22
|
+
// Imported and re-exported rather than re-exported alone: a bare
|
|
23
|
+
// `export { X } from` does not bind X in this module's own scope, and
|
|
24
|
+
// validateConceptCatalog needs it.
|
|
25
|
+
export { WELL_TIERS };
|
|
26
|
+
|
|
27
|
+
// Reviewer axes that gate the challenger draw without touching approval.
|
|
28
|
+
export const CONCEPT_BREADTHS = new Set(['general', 'niche']);
|
|
29
|
+
// The registers of work a roll can be asked for. Kept here beside the review
|
|
30
|
+
// validation that uses it; roll-selection.mjs filters on it and the seeder
|
|
31
|
+
// validates the --mode flag against the same four.
|
|
32
|
+
export const SEED_MODES = new Set(['persuade', 'operate', 'read', 'experience']);
|
|
33
|
+
|
|
34
|
+
const WEB_LEVERAGE_RE = /(?:\b3d\b|\badaptive\b|\banimat(?:e|ed|ion)\b|\bapi\b|\baria\b|\baudio\b|\bautomated?\b|\bbarcode\b|\bbroadcastchannel\b|\bbrowser\b|\bcamera\b|canvas\b|\bcaption\b|\bcollaborat(?:e|ive|ion)\b|\bcompar(?:e|ison)\b|\bcomput(?:e|ed|ation)\b|\bcomputer[- ]vision\b|\bconstraint[- ]solving\b|\bcryptographic?\b|\bcss\b|\bdeep[- ]link(?:ing)?\b|\bdirect manipulation\b|\bdom\b|\bdrag\b|\bfilter\b|\bfocus\b|\bgenerative\b|\bgeolocat(?:e|ed|ion)\b|\bgesture\b|\bgpu\b|\bgraph\b|\bhistory\b|\bindexeddb\b|\binteractive\b|\bintersectionobserver\b|\bkeyboard\b|\blive\b|\blocal\b|\bmicrophone\b|\bmotion\b|\bmultiplayer\b|\bnative\b|\bnotification\b|\boffline\b|\bpersonaliz(?:e|ed|ation)\b|\bplayable\b|\bpointer\b|\bprocedural\b|\bprovenance\b|\breal[- ]?time\b|\bresizeobserver\b|\bresponsive\b|\breveal\b|\bscrub\b|\bsearch\b|\bsearchparams\b|\bsensor\b|\bserver[- ]sent\b|\bservice worker\b|\bshader\b|\bsimulat(?:e|ed|ion|or)\b|\bspatial\b|\bstate\b|\bstream(?:ing)?\b|\bsvg\b|\bsynchroniz(?:e|ed|ation)\b|\btimeline\b|\btouch\b|\burl|\bvideo\b|\bweb(?:gl|socket|vtt)?\b|\bworker\b|\bzoom\b)/i;
|
|
35
|
+
export const SYSTEM_PREFIXES = [
|
|
36
|
+
'Palette/material:',
|
|
37
|
+
'Type/composition:',
|
|
38
|
+
'Topology/navigation:',
|
|
39
|
+
'Controls/state:',
|
|
40
|
+
'Responsive/motion:',
|
|
41
|
+
];
|
|
42
|
+
const BLAND_FORM_RE = /\b(?:control room|command center|operations center|dispatch desk|review queue|speaker queue|management console|admin console|operator loop|coordination system|tracking system|planning system|software platform|digital platform|operations cockpit|app portal|web portal|data hub|dashboard|workflow|planner|tracker|orchestrator)\b/i;
|
|
43
|
+
|
|
44
|
+
export function normalizeConceptForm(value) {
|
|
45
|
+
return String(value || '')
|
|
46
|
+
.normalize('NFKD')
|
|
47
|
+
.toLowerCase()
|
|
48
|
+
.replace(/[’‘]/g, "'")
|
|
49
|
+
.replace(/[^a-z0-9]+/g, ' ')
|
|
50
|
+
.trim();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function validateConceptEntry(concept, { existingForms = new Map() } = {}) {
|
|
54
|
+
const errors = [];
|
|
55
|
+
const id = concept?.id || '(unknown)';
|
|
56
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(concept?.id || '')) {
|
|
57
|
+
errors.push(`invalid concept id: ${String(concept?.id)}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const normalized = normalizeConceptForm(concept?.form);
|
|
61
|
+
if (!normalized) {
|
|
62
|
+
errors.push(`concept ${id} needs a form`);
|
|
63
|
+
} else if (existingForms.has(normalized)) {
|
|
64
|
+
errors.push(`duplicate concept form: ${id} and ${existingForms.get(normalized)}`);
|
|
65
|
+
}
|
|
66
|
+
if (typeof concept?.form !== 'string'
|
|
67
|
+
|| concept.form.trim().length < 40
|
|
68
|
+
|| concept.form.trim().length > 360
|
|
69
|
+
|| !concept.form.includes(',')) {
|
|
70
|
+
errors.push(`concept ${id} must name a form and inherited structure after a comma`);
|
|
71
|
+
}
|
|
72
|
+
if (typeof concept?.lineage !== 'string'
|
|
73
|
+
|| concept.lineage.trim().length < 12
|
|
74
|
+
|| concept.lineage.trim().length > 200) {
|
|
75
|
+
errors.push(`concept ${id} needs specific lineage metadata of 12–200 characters`);
|
|
76
|
+
}
|
|
77
|
+
if (!CONCEPT_STRENGTHS.has(concept?.strength)) {
|
|
78
|
+
errors.push(`concept ${id} needs a strength of ${[...CONCEPT_STRENGTHS].join(', ')}`);
|
|
79
|
+
}
|
|
80
|
+
if (!Array.isArray(concept?.tags)
|
|
81
|
+
|| concept.tags.length !== 3
|
|
82
|
+
|| concept.tags.some(tag => typeof tag !== 'string' || !tag.trim())) {
|
|
83
|
+
errors.push(`concept ${id} must have exactly three structural tags`);
|
|
84
|
+
}
|
|
85
|
+
if (!Array.isArray(concept?.system)
|
|
86
|
+
|| concept.system.length !== SYSTEM_PREFIXES.length
|
|
87
|
+
|| concept.system.some(rule => typeof rule !== 'string' || rule.trim().length < 12 || rule.trim().length > 180)) {
|
|
88
|
+
errors.push(`concept ${id} needs system grammar with exactly five rules of 12–180 characters`);
|
|
89
|
+
} else {
|
|
90
|
+
const uniqueRules = new Set(concept.system.map(normalizeConceptForm));
|
|
91
|
+
if (uniqueRules.size !== SYSTEM_PREFIXES.length) {
|
|
92
|
+
errors.push(`concept ${id} has duplicate system grammar rules`);
|
|
93
|
+
}
|
|
94
|
+
if (concept.system.some((rule, index) => !rule.startsWith(SYSTEM_PREFIXES[index]))) {
|
|
95
|
+
errors.push(`concept ${id} system grammar must use palette, type, topology, controls, and responsive prefixes in order`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (typeof concept?.spark !== 'string'
|
|
99
|
+
|| concept.spark.trim().length < 80
|
|
100
|
+
|| concept.spark.trim().length > 320) {
|
|
101
|
+
errors.push(`concept ${id} needs a vivid creative spark of 80–320 characters`);
|
|
102
|
+
}
|
|
103
|
+
if (typeof concept?.webLeverage !== 'string'
|
|
104
|
+
|| concept.webLeverage.trim().length < 20
|
|
105
|
+
|| concept.webLeverage.trim().length > 240) {
|
|
106
|
+
errors.push(`concept ${id} needs web leverage of 20–240 characters`);
|
|
107
|
+
}
|
|
108
|
+
if (/\b(?:live digital system|shared participatory system) modeled on\b/i.test(concept?.form || '')) {
|
|
109
|
+
errors.push(`concept ${id} is a generic wrapper around another artifact`);
|
|
110
|
+
}
|
|
111
|
+
if (/\b(?:in the style of|styled like|copy of)\b/i.test(concept?.form || '')) {
|
|
112
|
+
errors.push(`concept ${id} contains imitation language`);
|
|
113
|
+
}
|
|
114
|
+
if (BLAND_FORM_RE.test(concept?.form || '')) {
|
|
115
|
+
errors.push(`concept ${id} is framed as a literal software or operations archetype instead of an inspiring visual world`);
|
|
116
|
+
}
|
|
117
|
+
return errors;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Fingerprint of everything a reviewer judged. Reviews carry this hash so an
|
|
121
|
+
// approval cannot silently survive a content edit: the validator rejects any
|
|
122
|
+
// review whose hash no longer matches the concept it points at.
|
|
123
|
+
export function conceptContentHash(concept) {
|
|
124
|
+
const payload = [
|
|
125
|
+
concept?.form ?? '',
|
|
126
|
+
concept?.lineage ?? '',
|
|
127
|
+
JSON.stringify(concept?.tags ?? []),
|
|
128
|
+
JSON.stringify(concept?.system ?? []),
|
|
129
|
+
concept?.spark ?? '',
|
|
130
|
+
concept?.webLeverage ?? '',
|
|
131
|
+
].join('\n');
|
|
132
|
+
return crypto.createHash('sha256').update(payload).digest('hex').slice(0, 12);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function readConceptCatalog(catalogPath, reviewsPath) {
|
|
136
|
+
const catalog = JSON.parse(readFileSync(catalogPath, 'utf8'));
|
|
137
|
+
const reviewData = JSON.parse(readFileSync(reviewsPath, 'utf8'));
|
|
138
|
+
const reviews = reviewData.reviews || {};
|
|
139
|
+
const wellsById = new Map((catalog.wells || []).map(well => [well.id, well]));
|
|
140
|
+
const concepts = [];
|
|
141
|
+
|
|
142
|
+
for (const family of catalog.families || []) {
|
|
143
|
+
for (const concept of family.concepts || []) {
|
|
144
|
+
concepts.push({
|
|
145
|
+
...concept,
|
|
146
|
+
familyId: family.id,
|
|
147
|
+
familyLabel: family.label,
|
|
148
|
+
wellId: family.well || null,
|
|
149
|
+
wellLabel: wellsById.get(family.well)?.label || null,
|
|
150
|
+
wellTier: wellsById.get(family.well)?.tier || null,
|
|
151
|
+
status: reviews[concept.id]?.status || 'pending',
|
|
152
|
+
review: reviews[concept.id] || null,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return { catalog, reviewData, reviews, concepts };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function validateConceptCatalog(catalog, reviewData, {
|
|
161
|
+
expectedTotal,
|
|
162
|
+
minimumTotal,
|
|
163
|
+
requireApprovedMinimum = true,
|
|
164
|
+
} = {}) {
|
|
165
|
+
const errors = [];
|
|
166
|
+
const warnings = [];
|
|
167
|
+
const familyIds = new Set();
|
|
168
|
+
const conceptIds = new Set();
|
|
169
|
+
const normalizedForms = new Map();
|
|
170
|
+
const concepts = [];
|
|
171
|
+
|
|
172
|
+
if (!Number.isInteger(catalog?.schemaVersion) || catalog.schemaVersion < 7) {
|
|
173
|
+
errors.push('catalog.schemaVersion must be 7 or newer');
|
|
174
|
+
}
|
|
175
|
+
if (typeof catalog?.catalogVersion !== 'string' || !catalog.catalogVersion.trim()) {
|
|
176
|
+
errors.push('catalog.catalogVersion must be a non-empty string');
|
|
177
|
+
}
|
|
178
|
+
if (typeof catalog?.qualityBar?.principle !== 'string' || catalog.qualityBar.principle.trim().length < 80) {
|
|
179
|
+
errors.push('catalog.qualityBar.principle must define the universal creative bar');
|
|
180
|
+
}
|
|
181
|
+
if (!Array.isArray(catalog?.qualityBar?.rejectIf) || catalog.qualityBar.rejectIf.length < 5) {
|
|
182
|
+
errors.push('catalog.qualityBar.rejectIf must define at least five rejection gates');
|
|
183
|
+
}
|
|
184
|
+
if (!Array.isArray(catalog?.qualityBar?.reviewAxes) || catalog.qualityBar.reviewAxes.length < 8) {
|
|
185
|
+
errors.push('catalog.qualityBar.reviewAxes must define at least eight review axes');
|
|
186
|
+
}
|
|
187
|
+
if (!Array.isArray(catalog?.families) || catalog.families.length < 3) {
|
|
188
|
+
errors.push('catalog.families must contain at least three families');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const wellIds = new Set();
|
|
192
|
+
if (!Array.isArray(catalog?.wells) || catalog.wells.length < 5) {
|
|
193
|
+
errors.push('catalog.wells must define at least five inspiration wells');
|
|
194
|
+
}
|
|
195
|
+
for (const well of catalog?.wells || []) {
|
|
196
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(well.id || '')) {
|
|
197
|
+
errors.push(`invalid well id: ${String(well.id)}`);
|
|
198
|
+
} else if (wellIds.has(well.id)) {
|
|
199
|
+
errors.push(`duplicate well id: ${well.id}`);
|
|
200
|
+
}
|
|
201
|
+
wellIds.add(well.id);
|
|
202
|
+
if (typeof well.label !== 'string' || !well.label.trim()) {
|
|
203
|
+
errors.push(`well ${well.id || '(unknown)'} needs a label`);
|
|
204
|
+
}
|
|
205
|
+
if (typeof well.description !== 'string' || well.description.trim().length < 40) {
|
|
206
|
+
errors.push(`well ${well.id || '(unknown)'} needs a description of at least 40 characters`);
|
|
207
|
+
}
|
|
208
|
+
if (!WELL_TIERS.includes(well.tier)) {
|
|
209
|
+
errors.push(`well ${well.id || '(unknown)'} needs a tier of ${WELL_TIERS.join(', ')}, got: ${String(well.tier)}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const tiersPresent = new Set((catalog?.wells || []).map(well => well.tier).filter(tier => WELL_TIERS.includes(tier)));
|
|
213
|
+
for (const tier of WELL_TIERS) {
|
|
214
|
+
if ((catalog?.wells || []).length > 0 && !tiersPresent.has(tier)) {
|
|
215
|
+
errors.push(`no well declares the ${tier} tier`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const populatedWells = new Set();
|
|
219
|
+
|
|
220
|
+
for (const family of catalog?.families || []) {
|
|
221
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(family.id || '')) {
|
|
222
|
+
errors.push(`invalid family id: ${String(family.id)}`);
|
|
223
|
+
} else if (familyIds.has(family.id)) {
|
|
224
|
+
errors.push(`duplicate family id: ${family.id}`);
|
|
225
|
+
}
|
|
226
|
+
familyIds.add(family.id);
|
|
227
|
+
if (typeof family.label !== 'string' || !family.label.trim()) {
|
|
228
|
+
errors.push(`family ${family.id || '(unknown)'} needs a label`);
|
|
229
|
+
}
|
|
230
|
+
if (!wellIds.has(family.well)) {
|
|
231
|
+
errors.push(`family ${family.id || '(unknown)'} must belong to a declared well, got: ${String(family.well)}`);
|
|
232
|
+
} else {
|
|
233
|
+
populatedWells.add(family.well);
|
|
234
|
+
}
|
|
235
|
+
if (!Array.isArray(family.concepts) || family.concepts.length === 0) {
|
|
236
|
+
errors.push(`family ${family.id || '(unknown)'} has no concepts`);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
for (const concept of family.concepts) {
|
|
241
|
+
concepts.push(concept);
|
|
242
|
+
if (conceptIds.has(concept.id)) {
|
|
243
|
+
errors.push(`duplicate concept id: ${concept.id}`);
|
|
244
|
+
}
|
|
245
|
+
errors.push(...validateConceptEntry(concept, { existingForms: normalizedForms }));
|
|
246
|
+
conceptIds.add(concept.id);
|
|
247
|
+
const normalized = normalizeConceptForm(concept.form);
|
|
248
|
+
if (normalized) normalizedForms.set(normalized, concept.id);
|
|
249
|
+
if (typeof concept.webLeverage === 'string' && !WEB_LEVERAGE_RE.test(concept.webLeverage)) {
|
|
250
|
+
warnings.push(`concept ${concept.id} web leverage should be checked for a specific browser-native capability`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
for (const well of catalog?.wells || []) {
|
|
256
|
+
if (well.id && !populatedWells.has(well.id)) {
|
|
257
|
+
errors.push(`well ${well.id} has no families`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (expectedTotal !== undefined && concepts.length !== expectedTotal) {
|
|
262
|
+
errors.push(`expected ${expectedTotal} concepts, found ${concepts.length}`);
|
|
263
|
+
}
|
|
264
|
+
if (minimumTotal !== undefined && concepts.length < minimumTotal) {
|
|
265
|
+
errors.push(`expected at least ${minimumTotal} concepts, found ${concepts.length}`);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (!Number.isInteger(reviewData?.schemaVersion) || reviewData.schemaVersion < 2) {
|
|
269
|
+
errors.push('reviews.schemaVersion must be 2 or newer');
|
|
270
|
+
}
|
|
271
|
+
const conceptsById = new Map(concepts.map(concept => [concept.id, concept]));
|
|
272
|
+
for (const [id, review] of Object.entries(reviewData?.reviews || {})) {
|
|
273
|
+
if (!conceptIds.has(id)) errors.push(`review references missing concept: ${id}`);
|
|
274
|
+
if (!CONCEPT_STATUSES.has(review?.status)) errors.push(`invalid review status for ${id}: ${String(review?.status)}`);
|
|
275
|
+
if (typeof review?.reviewedBy !== 'string' || !review.reviewedBy.trim()) {
|
|
276
|
+
errors.push(`review ${id} needs reviewedBy`);
|
|
277
|
+
}
|
|
278
|
+
if (typeof review?.reviewedAt !== 'string' || Number.isNaN(Date.parse(review.reviewedAt))) {
|
|
279
|
+
errors.push(`review ${id} needs an ISO reviewedAt timestamp`);
|
|
280
|
+
}
|
|
281
|
+
if (typeof review?.formHash !== 'string' || !review.formHash.trim()) {
|
|
282
|
+
errors.push(`review ${id} needs a formHash of the reviewed content`);
|
|
283
|
+
} else if (conceptsById.has(id) && review.formHash !== conceptContentHash(conceptsById.get(id))) {
|
|
284
|
+
errors.push(`review ${id} is stale: concept content changed since it was reviewed; reset or re-review it`);
|
|
285
|
+
}
|
|
286
|
+
if (review?.note !== undefined && (typeof review.note !== 'string' || !review.note.trim() || review.note.length > 500)) {
|
|
287
|
+
errors.push(`review ${id} note must be a non-empty string of 500 characters or fewer`);
|
|
288
|
+
}
|
|
289
|
+
// Rating grades how strong an approved concept is (3 exceptional, 2 solid,
|
|
290
|
+
// 1 marginal keep). Optional, approved-only, and read as a calibration
|
|
291
|
+
// signal for future authoring rounds.
|
|
292
|
+
if (review?.rating !== undefined) {
|
|
293
|
+
if (![1, 2, 3].includes(review.rating)) {
|
|
294
|
+
errors.push(`review ${id} rating must be 1, 2, or 3`);
|
|
295
|
+
} else if (review.status !== 'approved') {
|
|
296
|
+
errors.push(`review ${id} rating only applies to approved concepts`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Breadth: a world too narrow to serve an arbitrary build keeps its approval
|
|
300
|
+
// and leaves the challenger pool. Selection has honoured this for a while but
|
|
301
|
+
// nothing validated it, so a typo would silently read as "general".
|
|
302
|
+
if (review?.breadth !== undefined && !CONCEPT_BREADTHS.has(review.breadth)) {
|
|
303
|
+
errors.push(`review ${id} breadth must be one of ${[...CONCEPT_BREADTHS].join(', ')}`);
|
|
304
|
+
}
|
|
305
|
+
// Mode eligibility: which registers of work this world can carry. Absent
|
|
306
|
+
// means all of them, which is why it needs no backfill. Listing every mode
|
|
307
|
+
// is the same as omitting it, and an empty list would deal nothing, so both
|
|
308
|
+
// are rejected in favour of leaving the field out.
|
|
309
|
+
if (review?.allowedModes !== undefined) {
|
|
310
|
+
if (!Array.isArray(review.allowedModes) || review.allowedModes.length === 0) {
|
|
311
|
+
errors.push(`review ${id} allowedModes must be a non-empty array, or omitted to allow every mode`);
|
|
312
|
+
} else if (review.allowedModes.some(mode => !SEED_MODES.has(mode))) {
|
|
313
|
+
errors.push(`review ${id} allowedModes may only contain ${[...SEED_MODES].join(', ')}`);
|
|
314
|
+
} else if (new Set(review.allowedModes).size !== review.allowedModes.length) {
|
|
315
|
+
errors.push(`review ${id} allowedModes must not repeat a mode`);
|
|
316
|
+
} else if (review.allowedModes.length === SEED_MODES.size) {
|
|
317
|
+
errors.push(`review ${id} allowedModes lists every mode; omit the field instead`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const wellTierById = new Map((catalog?.wells || []).map(well => [well.id, well.tier]));
|
|
323
|
+
const approved = concepts.filter(concept => reviewData?.reviews?.[concept.id]?.status === 'approved');
|
|
324
|
+
const approvedTiers = new Set(
|
|
325
|
+
(catalog?.families || [])
|
|
326
|
+
.filter(family => family.concepts?.some(concept => reviewData?.reviews?.[concept.id]?.status === 'approved'))
|
|
327
|
+
.map(family => wellTierById.get(family.well))
|
|
328
|
+
.filter(tier => WELL_TIERS.includes(tier))
|
|
329
|
+
);
|
|
330
|
+
if (requireApprovedMinimum && approved.length < 3) errors.push('at least three concepts must be approved');
|
|
331
|
+
if (requireApprovedMinimum && approvedTiers.size < WELL_TIERS.length) {
|
|
332
|
+
errors.push('approved concepts must cover every challenger tier');
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
errors,
|
|
337
|
+
warnings,
|
|
338
|
+
stats: {
|
|
339
|
+
wells: wellIds.size,
|
|
340
|
+
families: familyIds.size,
|
|
341
|
+
concepts: concepts.length,
|
|
342
|
+
approved: approved.length,
|
|
343
|
+
pending: concepts.length - Object.keys(reviewData?.reviews || {}).length,
|
|
344
|
+
rejected: Object.values(reviewData?.reviews || {}).filter(review => review?.status === 'rejected').length,
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export function approvedPoolRevision(concepts) {
|
|
350
|
+
const payload = concepts
|
|
351
|
+
.filter(concept => concept.status === 'approved')
|
|
352
|
+
.map(concept => `${concept.familyId}:${concept.id}:${concept.strength}:${concept.form}:${concept.spark}:${JSON.stringify(concept.system)}:${concept.webLeverage}`)
|
|
353
|
+
.sort()
|
|
354
|
+
.join('\n');
|
|
355
|
+
return crypto.createHash('sha256').update(payload).digest('hex').slice(0, 12);
|
|
356
|
+
}
|
|
357
|
+
|
|
@@ -43,7 +43,7 @@ function detectorSection(raw) {
|
|
|
43
43
|
return raw && raw.detector && typeof raw.detector === 'object' && !Array.isArray(raw.detector) ? raw.detector : null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const DETECTOR_CONFIG_KEYS = new Set(['ignoreRules', 'ignoreFiles', 'ignoreValues', 'designSystem']);
|
|
46
|
+
const DETECTOR_CONFIG_KEYS = new Set(['ignoreRules', 'ignoreFiles', 'ignoreValues', 'designSystem', 'advisoryRules']);
|
|
47
47
|
|
|
48
48
|
const DEFAULT_DETECTION_CONFIG = Object.freeze({
|
|
49
49
|
ignoreRules: [],
|
|
@@ -71,6 +71,11 @@ function cloneRawDetectionConfig() {
|
|
|
71
71
|
|
|
72
72
|
function applyDetectionConfigSource(config, raw) {
|
|
73
73
|
if (!raw || typeof raw !== 'object') return config;
|
|
74
|
+
// Advisory rules are opt-in for the design hook; the CLI carries the setting
|
|
75
|
+
// so config round-trips (e.g. `impeccable hooks ignore-value`) preserve it.
|
|
76
|
+
if (raw.advisoryRules === 'include' || raw.advisoryRules === 'exclude') {
|
|
77
|
+
config.advisoryRules = raw.advisoryRules;
|
|
78
|
+
}
|
|
74
79
|
if (raw.designSystem && typeof raw.designSystem === 'object' && !Array.isArray(raw.designSystem)) {
|
|
75
80
|
config.designSystem = {
|
|
76
81
|
...config.designSystem,
|
|
@@ -151,6 +156,9 @@ function normalizeDetectionConfigForWrite(config) {
|
|
|
151
156
|
out.ignoreFiles = uniqueStrings(config.ignoreFiles.filter(v => typeof v === 'string' && v.trim()).map(v => v.trim()));
|
|
152
157
|
}
|
|
153
158
|
out.ignoreValues = normalizeIgnoreValueEntries(config?.ignoreValues || []);
|
|
159
|
+
if (config?.advisoryRules === 'include' || config?.advisoryRules === 'exclude') {
|
|
160
|
+
out.advisoryRules = config.advisoryRules;
|
|
161
|
+
}
|
|
154
162
|
if (config?.designSystem && typeof config.designSystem === 'object' && !Array.isArray(config.designSystem)) {
|
|
155
163
|
out.designSystem = {
|
|
156
164
|
enabled: config.designSystem.enabled === false ? false : true,
|
|
@@ -346,12 +354,16 @@ export function normalizeIgnoreValueEntries(entries) {
|
|
|
346
354
|
...(Array.isArray(entry.files) ? entry.files.filter(v => typeof v === 'string' && v.trim()).map(v => v.trim()) : []),
|
|
347
355
|
]);
|
|
348
356
|
if (files.length > 0) normalized.files = files;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
357
|
+
// Key order is rule, value, files, createdAt, reason and must stay that way:
|
|
358
|
+
// normalizing runs on every write, so emitting a different order than the one
|
|
359
|
+
// already on disk rewrites every untouched entry and churns the diff. Keep in
|
|
360
|
+
// step with normalizeIgnoreValueEntries in skill/scripts/hook-lib.mjs.
|
|
352
361
|
if (typeof entry.createdAt === 'string' && entry.createdAt.trim()) {
|
|
353
362
|
normalized.createdAt = entry.createdAt.trim();
|
|
354
363
|
}
|
|
364
|
+
if (typeof entry.reason === 'string' && entry.reason.trim()) {
|
|
365
|
+
normalized.reason = entry.reason.trim();
|
|
366
|
+
}
|
|
355
367
|
out.push(normalized);
|
|
356
368
|
}
|
|
357
369
|
return out;
|
|
@@ -369,7 +381,9 @@ function mergeIgnoreValues(existing, incoming) {
|
|
|
369
381
|
}
|
|
370
382
|
|
|
371
383
|
function ignoreValueFilesKey(files) {
|
|
372
|
-
|
|
384
|
+
// Sort before joining: a scope is a set, so an entry already on disk in another
|
|
385
|
+
// order must compare equal rather than dedup as two distinct entries.
|
|
386
|
+
return Array.isArray(files) && files.length > 0 ? [...files].sort().join('\x1f') : '';
|
|
373
387
|
}
|
|
374
388
|
|
|
375
389
|
// Glob -> RegExp. Supports `**`, `*`, `?`, and `{a,b}` alternation.
|
|
@@ -459,11 +473,13 @@ export function filterDetectionFindings(findings, config) {
|
|
|
459
473
|
function isIgnoredFindingValue(finding, ignoreValues) {
|
|
460
474
|
if (!Array.isArray(ignoreValues) || ignoreValues.length === 0) return false;
|
|
461
475
|
const rule = normalizeIgnoreRule(finding.antipattern);
|
|
476
|
+
if (!rule) return false;
|
|
477
|
+
// File-scoped wildcards suppress rules with no extractable value, such as side-tab.
|
|
462
478
|
const value = extractFindingIgnoreValue(finding);
|
|
463
|
-
if (!rule || !value) return false;
|
|
464
479
|
return ignoreValues.some((entry) => {
|
|
480
|
+
if (entry.rule !== rule) return false;
|
|
465
481
|
const wildcardValue = entry.value === '*';
|
|
466
|
-
if (
|
|
482
|
+
if (!wildcardValue && (!value || !ignoreValueMatches(rule, entry.value, value))) return false;
|
|
467
483
|
if (!Array.isArray(entry.files) || entry.files.length === 0) return !wildcardValue;
|
|
468
484
|
return findingMatchesScopedIgnoreFile(finding, entry.files);
|
|
469
485
|
});
|
|
@@ -492,6 +508,7 @@ export function extractFindingIgnoreValue(finding) {
|
|
|
492
508
|
'design-system-font',
|
|
493
509
|
'design-system-color',
|
|
494
510
|
'design-system-radius',
|
|
511
|
+
'design-system-font-size',
|
|
495
512
|
]);
|
|
496
513
|
if (!directValueRules.has(rule)) return '';
|
|
497
514
|
return normalizeIgnoreValue(extractFindingIgnoreValueRaw(finding, rule));
|
|
@@ -512,6 +529,9 @@ function extractFindingIgnoreValueRaw(finding, rule = normalizeIgnoreRule(findin
|
|
|
512
529
|
const primary = text.match(/Primary font:\s*([^()\n;]+)/i);
|
|
513
530
|
if (primary) return cleanIgnoreValueDisplay(primary[1]);
|
|
514
531
|
|
|
532
|
+
const googleLabel = text.match(/Google Fonts:\s*([^()\n;]+)/i);
|
|
533
|
+
if (googleLabel) return cleanIgnoreValueDisplay(googleLabel[1]);
|
|
534
|
+
|
|
515
535
|
const family = text.match(/font-family\s*:\s*["']?([^'",;\n]+)/i);
|
|
516
536
|
if (family) return cleanIgnoreValueDisplay(family[1]);
|
|
517
537
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { resolveProjectRoot } from '../context.mjs';
|
|
4
|
+
import { designSidecarCandidatesFor } from './staleness.mjs';
|
|
5
|
+
export { IMPECCABLE_COMMAND_PREFIX } from './provider.mjs';
|
|
4
6
|
|
|
5
7
|
export const IMPECCABLE_DIR = '.impeccable';
|
|
6
8
|
export const LIVE_DIR = 'live';
|
|
@@ -15,14 +17,7 @@ export function getDesignSidecarPath(cwd = process.cwd(), options = {}) {
|
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export function getDesignSidecarCandidates(cwd = process.cwd(), contextDir = cwd, options = {}) {
|
|
18
|
-
|
|
19
|
-
const candidates = [
|
|
20
|
-
getDesignSidecarPath(cwd, options),
|
|
21
|
-
path.join(projectRoot, 'DESIGN.json'),
|
|
22
|
-
];
|
|
23
|
-
const contextLegacy = path.join(contextDir, 'DESIGN.json');
|
|
24
|
-
if (!candidates.includes(contextLegacy)) candidates.push(contextLegacy);
|
|
25
|
-
return candidates;
|
|
20
|
+
return designSidecarCandidatesFor(resolveProjectRoot(cwd, options), contextDir);
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
export function resolveDesignSidecarPath(cwd = process.cwd(), contextDir = cwd, options = {}) {
|
|
@@ -103,6 +98,20 @@ export function removeLiveServerInfo(cwd = process.cwd(), options = {}) {
|
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Session IDs become path segments (journals, snapshots, accept receipts,
|
|
103
|
+
* preview manifests, generated component dirs). They arrive from CLI `--id`
|
|
104
|
+
* arguments and HTTP payloads, so anything containing a separator or `..` must
|
|
105
|
+
* be rejected before it reaches path.join, which would happily escape
|
|
106
|
+
* `.impeccable/live/`. Real IDs are 8 hex chars; the tests use short slugs.
|
|
107
|
+
*/
|
|
108
|
+
export function safeSessionId(id) {
|
|
109
|
+
if (typeof id !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(id)) {
|
|
110
|
+
throw new Error('invalid session id: ' + id);
|
|
111
|
+
}
|
|
112
|
+
return id;
|
|
113
|
+
}
|
|
114
|
+
|
|
106
115
|
export function getLiveSessionsDir(cwd = process.cwd(), options = {}) {
|
|
107
116
|
return path.join(getLiveDir(cwd, options), 'sessions');
|
|
108
117
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Source scripts default to slash commands. The provider build replaces only
|
|
2
|
+
// this exact declaration, avoiding heuristic rewrites across executable code.
|
|
3
|
+
export const IMPECCABLE_COMMAND_PREFIX = "/";
|
|
4
|
+
export const IMPECCABLE_PROVIDER_ID = "pi";
|
|
5
|
+
export const IMPECCABLE_COMMAND = `${IMPECCABLE_COMMAND_PREFIX}impeccable`;
|