@hegemonart/get-design-done 1.52.0 → 1.54.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +90 -0
- package/README.md +4 -0
- package/SKILL.md +2 -1
- package/agents/component-taxonomy-mapper.md +3 -0
- package/agents/design-context-reviewer-gate.md +102 -0
- package/agents/design-context-reviewer.md +186 -0
- package/agents/motion-mapper.md +1 -0
- package/agents/token-mapper.md +3 -0
- package/dist/claude-code/.claude/skills/discover/SKILL.md +7 -1
- package/dist/claude-code/.claude/skills/explore/SKILL.md +3 -1
- package/dist/claude-code/.claude/skills/new-addendum/SKILL.md +81 -0
- package/package.json +1 -1
- package/reference/frameworks/astro.md +43 -0
- package/reference/frameworks/nextjs.md +44 -0
- package/reference/frameworks/remix.md +44 -0
- package/reference/frameworks/storybook.md +44 -0
- package/reference/frameworks/sveltekit.md +43 -0
- package/reference/frameworks/vite-react.md +43 -0
- package/reference/interaction.md +1 -0
- package/reference/motion/framer-motion.md +45 -0
- package/reference/motion/gsap.md +45 -0
- package/reference/motion/motion-one.md +44 -0
- package/reference/motion/react-spring.md +44 -0
- package/reference/motion.md +1 -0
- package/reference/registry.json +163 -1
- package/reference/registry.schema.json +18 -1
- package/reference/skill-graph.md +2 -1
- package/reference/systems/chakra.md +44 -0
- package/reference/systems/css-modules.md +44 -0
- package/reference/systems/mui.md +44 -0
- package/reference/systems/radix-themes.md +43 -0
- package/reference/systems/shadcn.md +45 -0
- package/reference/systems/styled-components.md +44 -0
- package/reference/systems/tailwind.md +44 -0
- package/reference/systems/vanilla-extract.md +44 -0
- package/scripts/lib/detect/stack.cjs +455 -0
- package/scripts/lib/detect/stack.d.cts +44 -0
- package/scripts/lib/explore-parallel-runner/index.ts +196 -1
- package/scripts/lib/explore-parallel-runner/types.ts +85 -0
- package/scripts/lib/health-mirror/index.cjs +73 -1
- package/scripts/lib/manifest/skills.json +10 -2
- package/scripts/lib/mapper-spawn.cjs +257 -0
- package/scripts/lib/mapper-spawn.d.cts +60 -0
- package/scripts/lib/mappers/compute-batches.mjs +625 -0
- package/scripts/lib/mappers/graph-adjacency.mjs +129 -0
- package/scripts/lib/mappers/incremental-discover.cjs +617 -0
- package/scripts/lib/mappers/incremental-discover.d.cts +133 -0
- package/scripts/lib/mappers/neighbor-map.mjs +0 -0
- package/scripts/lib/new-addendum.cjs +204 -0
- package/sdk/cli/index.js +1504 -3
- package/sdk/fingerprint/classify.cjs +406 -0
- package/sdk/fingerprint/index.ts +405 -0
- package/sdk/fingerprint/store.cjs +523 -0
- package/sdk/index.ts +1 -0
- package/sdk/mcp/gdd-mcp/server.js +1047 -0
- package/skills/discover/SKILL.md +7 -1
- package/skills/explore/SKILL.md +3 -1
- package/skills/new-addendum/SKILL.md +81 -0
|
@@ -513,6 +513,1001 @@ var require_harness_freshness = __commonJS({
|
|
|
513
513
|
}
|
|
514
514
|
});
|
|
515
515
|
|
|
516
|
+
// scripts/lib/detect/rules/ban-01.cjs
|
|
517
|
+
var require_ban_01 = __commonJS({
|
|
518
|
+
"scripts/lib/detect/rules/ban-01.cjs"(exports2, module2) {
|
|
519
|
+
"use strict";
|
|
520
|
+
var PATTERN = "border-left:\\s*[2-9][0-9]*px|border-right:\\s*[2-9][0-9]*px";
|
|
521
|
+
function matcher(ctx) {
|
|
522
|
+
const out = [];
|
|
523
|
+
const re = new RegExp(PATTERN, "gi");
|
|
524
|
+
const text = String(ctx && ctx.content || "");
|
|
525
|
+
let m;
|
|
526
|
+
while ((m = re.exec(text)) !== null) {
|
|
527
|
+
const upto = text.slice(0, m.index);
|
|
528
|
+
const line = upto.split("\n").length;
|
|
529
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
530
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
531
|
+
out.push({ line, column, match: m[0] });
|
|
532
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
533
|
+
}
|
|
534
|
+
return out;
|
|
535
|
+
}
|
|
536
|
+
module2.exports = {
|
|
537
|
+
id: "BAN-01",
|
|
538
|
+
category: "decoration",
|
|
539
|
+
name: "Side-Stripe Borders",
|
|
540
|
+
description: "A thick (>=2px) left/right accent border \u2014 a dated, decorative side-stripe.",
|
|
541
|
+
references: ["reference/anti-patterns.md#BAN-01"],
|
|
542
|
+
severity: "warn",
|
|
543
|
+
pattern: PATTERN,
|
|
544
|
+
matcher
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
// scripts/lib/detect/rules/ban-02.cjs
|
|
550
|
+
var require_ban_02 = __commonJS({
|
|
551
|
+
"scripts/lib/detect/rules/ban-02.cjs"(exports2, module2) {
|
|
552
|
+
"use strict";
|
|
553
|
+
var PATTERN = "background-clip:\\s*text|text-fill-color:\\s*transparent";
|
|
554
|
+
function matcher(ctx) {
|
|
555
|
+
const out = [];
|
|
556
|
+
const re = new RegExp(PATTERN, "gi");
|
|
557
|
+
const text = String(ctx && ctx.content || "");
|
|
558
|
+
let m;
|
|
559
|
+
while ((m = re.exec(text)) !== null) {
|
|
560
|
+
const upto = text.slice(0, m.index);
|
|
561
|
+
const line = upto.split("\n").length;
|
|
562
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
563
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
564
|
+
out.push({ line, column, match: m[0] });
|
|
565
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
566
|
+
}
|
|
567
|
+
return out;
|
|
568
|
+
}
|
|
569
|
+
module2.exports = {
|
|
570
|
+
id: "BAN-02",
|
|
571
|
+
category: "decoration",
|
|
572
|
+
name: "Gradient Text",
|
|
573
|
+
description: "Gradient-filled text via background-clip:text \u2014 low legibility, an AI-era cliche.",
|
|
574
|
+
references: ["reference/anti-patterns.md#BAN-02"],
|
|
575
|
+
severity: "warn",
|
|
576
|
+
pattern: PATTERN,
|
|
577
|
+
matcher
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
// scripts/lib/detect/rules/ban-03.cjs
|
|
583
|
+
var require_ban_03 = __commonJS({
|
|
584
|
+
"scripts/lib/detect/rules/ban-03.cjs"(exports2, module2) {
|
|
585
|
+
"use strict";
|
|
586
|
+
var PATTERN = "cubic-bezier\\(.*-[0-9]|bounce|elastic|spring\\(";
|
|
587
|
+
function matcher(ctx) {
|
|
588
|
+
const out = [];
|
|
589
|
+
const re = new RegExp(PATTERN, "gi");
|
|
590
|
+
const text = String(ctx && ctx.content || "");
|
|
591
|
+
let m;
|
|
592
|
+
while ((m = re.exec(text)) !== null) {
|
|
593
|
+
const upto = text.slice(0, m.index);
|
|
594
|
+
const line = upto.split("\n").length;
|
|
595
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
596
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
597
|
+
out.push({ line, column, match: m[0] });
|
|
598
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
599
|
+
}
|
|
600
|
+
return out;
|
|
601
|
+
}
|
|
602
|
+
module2.exports = {
|
|
603
|
+
id: "BAN-03",
|
|
604
|
+
category: "motion",
|
|
605
|
+
name: "Bounce/Elastic Easing",
|
|
606
|
+
description: "Bounce/elastic/spring easing \u2014 playful overshoot that reads as unserious for product UI.",
|
|
607
|
+
references: ["reference/anti-patterns.md#BAN-03"],
|
|
608
|
+
severity: "warn",
|
|
609
|
+
pattern: PATTERN,
|
|
610
|
+
matcher
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// scripts/lib/detect/rules/ban-05.cjs
|
|
616
|
+
var require_ban_05 = __commonJS({
|
|
617
|
+
"scripts/lib/detect/rules/ban-05.cjs"(exports2, module2) {
|
|
618
|
+
"use strict";
|
|
619
|
+
var PATTERN = "background.*#000000|background.*rgb\\(0,\\s*0,\\s*0\\)";
|
|
620
|
+
function matcher(ctx) {
|
|
621
|
+
const out = [];
|
|
622
|
+
const re = new RegExp(PATTERN, "gi");
|
|
623
|
+
const text = String(ctx && ctx.content || "");
|
|
624
|
+
let m;
|
|
625
|
+
while ((m = re.exec(text)) !== null) {
|
|
626
|
+
const upto = text.slice(0, m.index);
|
|
627
|
+
const line = upto.split("\n").length;
|
|
628
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
629
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
630
|
+
out.push({ line, column, match: m[0] });
|
|
631
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
632
|
+
}
|
|
633
|
+
return out;
|
|
634
|
+
}
|
|
635
|
+
module2.exports = {
|
|
636
|
+
id: "BAN-05",
|
|
637
|
+
category: "color",
|
|
638
|
+
name: "Pure Black Dark Mode",
|
|
639
|
+
description: "Pure #000 dark-mode background \u2014 harsh contrast + halation; use a near-black surface.",
|
|
640
|
+
references: ["reference/anti-patterns.md#BAN-05"],
|
|
641
|
+
severity: "warn",
|
|
642
|
+
pattern: PATTERN,
|
|
643
|
+
matcher
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
// scripts/lib/detect/rules/ban-06.cjs
|
|
649
|
+
var require_ban_06 = __commonJS({
|
|
650
|
+
"scripts/lib/detect/rules/ban-06.cjs"(exports2, module2) {
|
|
651
|
+
"use strict";
|
|
652
|
+
var PATTERN = "user-scalable=no|maximum-scale=1";
|
|
653
|
+
function matcher(ctx) {
|
|
654
|
+
const out = [];
|
|
655
|
+
const re = new RegExp(PATTERN, "gi");
|
|
656
|
+
const text = String(ctx && ctx.content || "");
|
|
657
|
+
let m;
|
|
658
|
+
while ((m = re.exec(text)) !== null) {
|
|
659
|
+
const upto = text.slice(0, m.index);
|
|
660
|
+
const line = upto.split("\n").length;
|
|
661
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
662
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
663
|
+
out.push({ line, column, match: m[0] });
|
|
664
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
665
|
+
}
|
|
666
|
+
return out;
|
|
667
|
+
}
|
|
668
|
+
module2.exports = {
|
|
669
|
+
id: "BAN-06",
|
|
670
|
+
category: "accessibility",
|
|
671
|
+
name: "Disabling Zoom",
|
|
672
|
+
description: "Viewport meta that disables pinch-zoom \u2014 a WCAG 1.4.4 failure.",
|
|
673
|
+
references: ["reference/anti-patterns.md#BAN-06"],
|
|
674
|
+
severity: "error",
|
|
675
|
+
pattern: PATTERN,
|
|
676
|
+
matcher
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// scripts/lib/detect/rules/ban-07.cjs
|
|
682
|
+
var require_ban_07 = __commonJS({
|
|
683
|
+
"scripts/lib/detect/rules/ban-07.cjs"(exports2, module2) {
|
|
684
|
+
"use strict";
|
|
685
|
+
var PATTERN = ":focus\\s*\\{[^}]*outline:\\s*(none|0)";
|
|
686
|
+
function matcher(ctx) {
|
|
687
|
+
const out = [];
|
|
688
|
+
const re = new RegExp(PATTERN, "gi");
|
|
689
|
+
const text = String(ctx && ctx.content || "");
|
|
690
|
+
let m;
|
|
691
|
+
while ((m = re.exec(text)) !== null) {
|
|
692
|
+
const upto = text.slice(0, m.index);
|
|
693
|
+
const line = upto.split("\n").length;
|
|
694
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
695
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
696
|
+
out.push({ line, column, match: m[0] });
|
|
697
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
698
|
+
}
|
|
699
|
+
return out;
|
|
700
|
+
}
|
|
701
|
+
module2.exports = {
|
|
702
|
+
id: "BAN-07",
|
|
703
|
+
category: "accessibility",
|
|
704
|
+
name: "Naked outline: none",
|
|
705
|
+
description: "Removing the focus outline without a replacement \u2014 a keyboard-a11y failure.",
|
|
706
|
+
references: ["reference/anti-patterns.md#BAN-07"],
|
|
707
|
+
severity: "error",
|
|
708
|
+
pattern: PATTERN,
|
|
709
|
+
matcher
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// scripts/lib/detect/rules/ban-08.cjs
|
|
715
|
+
var require_ban_08 = __commonJS({
|
|
716
|
+
"scripts/lib/detect/rules/ban-08.cjs"(exports2, module2) {
|
|
717
|
+
"use strict";
|
|
718
|
+
var PATTERN = "transition:\\s*all\\s";
|
|
719
|
+
function matcher(ctx) {
|
|
720
|
+
const out = [];
|
|
721
|
+
const re = new RegExp(PATTERN, "gi");
|
|
722
|
+
const text = String(ctx && ctx.content || "");
|
|
723
|
+
let m;
|
|
724
|
+
while ((m = re.exec(text)) !== null) {
|
|
725
|
+
const upto = text.slice(0, m.index);
|
|
726
|
+
const line = upto.split("\n").length;
|
|
727
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
728
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
729
|
+
out.push({ line, column, match: m[0] });
|
|
730
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
731
|
+
}
|
|
732
|
+
return out;
|
|
733
|
+
}
|
|
734
|
+
module2.exports = {
|
|
735
|
+
id: "BAN-08",
|
|
736
|
+
category: "motion",
|
|
737
|
+
name: "transition: all",
|
|
738
|
+
description: "transition: all animates layout-triggering properties \u2014 jank; name the exact properties.",
|
|
739
|
+
references: ["reference/anti-patterns.md#BAN-08"],
|
|
740
|
+
severity: "warn",
|
|
741
|
+
pattern: PATTERN,
|
|
742
|
+
matcher
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
// scripts/lib/detect/rules/ban-09.cjs
|
|
748
|
+
var require_ban_09 = __commonJS({
|
|
749
|
+
"scripts/lib/detect/rules/ban-09.cjs"(exports2, module2) {
|
|
750
|
+
"use strict";
|
|
751
|
+
var PATTERN = "transform:\\s*scale\\(\\s*0\\s*\\)|scale\\(\\s*0\\s*\\)";
|
|
752
|
+
function matcher(ctx) {
|
|
753
|
+
const out = [];
|
|
754
|
+
const re = new RegExp(PATTERN, "gi");
|
|
755
|
+
const text = String(ctx && ctx.content || "");
|
|
756
|
+
let m;
|
|
757
|
+
while ((m = re.exec(text)) !== null) {
|
|
758
|
+
const upto = text.slice(0, m.index);
|
|
759
|
+
const line = upto.split("\n").length;
|
|
760
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
761
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
762
|
+
out.push({ line, column, match: m[0] });
|
|
763
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
764
|
+
}
|
|
765
|
+
return out;
|
|
766
|
+
}
|
|
767
|
+
module2.exports = {
|
|
768
|
+
id: "BAN-09",
|
|
769
|
+
category: "motion",
|
|
770
|
+
name: "scale(0) Animation Entry",
|
|
771
|
+
description: "Entering from scale(0) \u2014 nothing materializes from nothing; start at scale(0.95)+opacity.",
|
|
772
|
+
references: ["reference/anti-patterns.md#BAN-09"],
|
|
773
|
+
severity: "warn",
|
|
774
|
+
pattern: PATTERN,
|
|
775
|
+
matcher
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
// scripts/lib/detect/rules/ban-11.cjs
|
|
781
|
+
var require_ban_11 = __commonJS({
|
|
782
|
+
"scripts/lib/detect/rules/ban-11.cjs"(exports2, module2) {
|
|
783
|
+
"use strict";
|
|
784
|
+
var PATTERN = "outline-(slate|zinc|neutral|gray|stone|blue|red|green|yellow|purple)-\\d+|img\\s*\\{[^}]*outline:\\s*[^}]*#[0-9a-fA-F]{3,8}";
|
|
785
|
+
function matcher(ctx) {
|
|
786
|
+
const out = [];
|
|
787
|
+
const re = new RegExp(PATTERN, "gi");
|
|
788
|
+
const text = String(ctx && ctx.content || "");
|
|
789
|
+
let m;
|
|
790
|
+
while ((m = re.exec(text)) !== null) {
|
|
791
|
+
const upto = text.slice(0, m.index);
|
|
792
|
+
const line = upto.split("\n").length;
|
|
793
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
794
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
795
|
+
out.push({ line, column, match: m[0] });
|
|
796
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
797
|
+
}
|
|
798
|
+
return out;
|
|
799
|
+
}
|
|
800
|
+
module2.exports = {
|
|
801
|
+
id: "BAN-11",
|
|
802
|
+
category: "decoration",
|
|
803
|
+
name: "Tinted Image Outline",
|
|
804
|
+
description: "A colored outline on an image \u2014 color contamination; use low-opacity black/white.",
|
|
805
|
+
references: ["reference/anti-patterns.md#BAN-11"],
|
|
806
|
+
severity: "warn",
|
|
807
|
+
pattern: PATTERN,
|
|
808
|
+
matcher
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
// scripts/lib/detect/rules/ban-12.cjs
|
|
814
|
+
var require_ban_12 = __commonJS({
|
|
815
|
+
"scripts/lib/detect/rules/ban-12.cjs"(exports2, module2) {
|
|
816
|
+
"use strict";
|
|
817
|
+
var PATTERN = "transition:\\s*all|transition-property:\\s*all";
|
|
818
|
+
function matcher(ctx) {
|
|
819
|
+
const out = [];
|
|
820
|
+
const re = new RegExp(PATTERN, "gi");
|
|
821
|
+
const text = String(ctx && ctx.content || "");
|
|
822
|
+
let m;
|
|
823
|
+
while ((m = re.exec(text)) !== null) {
|
|
824
|
+
const upto = text.slice(0, m.index);
|
|
825
|
+
const line = upto.split("\n").length;
|
|
826
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
827
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
828
|
+
out.push({ line, column, match: m[0] });
|
|
829
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
830
|
+
}
|
|
831
|
+
return out;
|
|
832
|
+
}
|
|
833
|
+
module2.exports = {
|
|
834
|
+
id: "BAN-12",
|
|
835
|
+
category: "motion",
|
|
836
|
+
name: "transition: all (property)",
|
|
837
|
+
description: "transition: all / transition-property: all \u2014 recalculates layout every transition.",
|
|
838
|
+
references: ["reference/anti-patterns.md#BAN-12"],
|
|
839
|
+
severity: "warn",
|
|
840
|
+
pattern: PATTERN,
|
|
841
|
+
matcher
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
// scripts/lib/detect/rules/ban-13.cjs
|
|
847
|
+
var require_ban_13 = __commonJS({
|
|
848
|
+
"scripts/lib/detect/rules/ban-13.cjs"(exports2, module2) {
|
|
849
|
+
"use strict";
|
|
850
|
+
var PATTERN = "will-change:\\s*all";
|
|
851
|
+
function matcher(ctx) {
|
|
852
|
+
const out = [];
|
|
853
|
+
const re = new RegExp(PATTERN, "gi");
|
|
854
|
+
const text = String(ctx && ctx.content || "");
|
|
855
|
+
let m;
|
|
856
|
+
while ((m = re.exec(text)) !== null) {
|
|
857
|
+
const upto = text.slice(0, m.index);
|
|
858
|
+
const line = upto.split("\n").length;
|
|
859
|
+
const lastNl = upto.lastIndexOf("\n");
|
|
860
|
+
const column = lastNl < 0 ? m.index + 1 : m.index - lastNl;
|
|
861
|
+
out.push({ line, column, match: m[0] });
|
|
862
|
+
if (m.index === re.lastIndex) re.lastIndex++;
|
|
863
|
+
}
|
|
864
|
+
return out;
|
|
865
|
+
}
|
|
866
|
+
module2.exports = {
|
|
867
|
+
id: "BAN-13",
|
|
868
|
+
category: "performance",
|
|
869
|
+
name: "will-change: all",
|
|
870
|
+
description: "will-change: all promotes every property to its own GPU layer \u2014 huge texture memory.",
|
|
871
|
+
references: ["reference/anti-patterns.md#BAN-13"],
|
|
872
|
+
severity: "warn",
|
|
873
|
+
pattern: PATTERN,
|
|
874
|
+
matcher
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
// scripts/lib/detect/rules/index.cjs
|
|
880
|
+
var require_rules = __commonJS({
|
|
881
|
+
"scripts/lib/detect/rules/index.cjs"(exports2, module2) {
|
|
882
|
+
"use strict";
|
|
883
|
+
var r0 = require_ban_01();
|
|
884
|
+
var r1 = require_ban_02();
|
|
885
|
+
var r2 = require_ban_03();
|
|
886
|
+
var r3 = require_ban_05();
|
|
887
|
+
var r4 = require_ban_06();
|
|
888
|
+
var r5 = require_ban_07();
|
|
889
|
+
var r6 = require_ban_08();
|
|
890
|
+
var r7 = require_ban_09();
|
|
891
|
+
var r8 = require_ban_11();
|
|
892
|
+
var r9 = require_ban_12();
|
|
893
|
+
var r10 = require_ban_13();
|
|
894
|
+
var RULES = [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10];
|
|
895
|
+
var EXEMPT = Object.freeze(["BAN-04", "BAN-10"]);
|
|
896
|
+
module2.exports = { RULES, EXEMPT };
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
// scripts/lib/detect/engine.cjs
|
|
901
|
+
var require_engine = __commonJS({
|
|
902
|
+
"scripts/lib/detect/engine.cjs"(exports2, module2) {
|
|
903
|
+
"use strict";
|
|
904
|
+
var fs = require("node:fs");
|
|
905
|
+
var path = require("node:path");
|
|
906
|
+
var { RULES, EXEMPT } = require_rules();
|
|
907
|
+
var SCANNABLE_EXT = /* @__PURE__ */ new Set([".html", ".htm", ".css", ".scss", ".jsx", ".tsx", ".js", ".ts", ".vue", ".svelte"]);
|
|
908
|
+
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", "build", ".next", "coverage", ".design", ".planning"]);
|
|
909
|
+
function walk(root) {
|
|
910
|
+
const out = [];
|
|
911
|
+
if (!fs.existsSync(root)) return out;
|
|
912
|
+
const st = fs.statSync(root);
|
|
913
|
+
if (st.isFile()) {
|
|
914
|
+
if (SCANNABLE_EXT.has(path.extname(root).toLowerCase())) out.push(root);
|
|
915
|
+
return out;
|
|
916
|
+
}
|
|
917
|
+
const stack = [root];
|
|
918
|
+
while (stack.length) {
|
|
919
|
+
const dir = stack.pop();
|
|
920
|
+
let entries;
|
|
921
|
+
try {
|
|
922
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
923
|
+
} catch {
|
|
924
|
+
continue;
|
|
925
|
+
}
|
|
926
|
+
for (const e of entries) {
|
|
927
|
+
const full = path.join(dir, e.name);
|
|
928
|
+
if (e.isDirectory()) {
|
|
929
|
+
if (!SKIP_DIRS.has(e.name)) stack.push(full);
|
|
930
|
+
} else if (e.isFile() && SCANNABLE_EXT.has(path.extname(e.name).toLowerCase())) out.push(full);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
return out;
|
|
934
|
+
}
|
|
935
|
+
function selectRules(ruleId) {
|
|
936
|
+
if (!ruleId) return RULES;
|
|
937
|
+
const id = String(ruleId).toUpperCase();
|
|
938
|
+
return RULES.filter((r) => r.id === id);
|
|
939
|
+
}
|
|
940
|
+
function scanContent(content, ctx, rules) {
|
|
941
|
+
const findings = [];
|
|
942
|
+
for (const rule of rules) {
|
|
943
|
+
let hits = [];
|
|
944
|
+
try {
|
|
945
|
+
hits = rule.matcher({ content, ext: ctx.ext, path: ctx.path }) || [];
|
|
946
|
+
} catch {
|
|
947
|
+
hits = [];
|
|
948
|
+
}
|
|
949
|
+
for (const h of hits) {
|
|
950
|
+
findings.push({
|
|
951
|
+
ruleId: rule.id,
|
|
952
|
+
category: rule.category,
|
|
953
|
+
name: rule.name,
|
|
954
|
+
severity: rule.severity,
|
|
955
|
+
file: ctx.path,
|
|
956
|
+
line: h.line,
|
|
957
|
+
column: h.column,
|
|
958
|
+
match: h.match,
|
|
959
|
+
references: rule.references
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return findings;
|
|
964
|
+
}
|
|
965
|
+
function run(root, opts) {
|
|
966
|
+
const o = opts || {};
|
|
967
|
+
const rules = selectRules(o.ruleId);
|
|
968
|
+
const cwd = o.cwd || process.cwd();
|
|
969
|
+
const files = walk(root);
|
|
970
|
+
const findings = [];
|
|
971
|
+
let errors = 0;
|
|
972
|
+
for (const abs of files) {
|
|
973
|
+
let content;
|
|
974
|
+
try {
|
|
975
|
+
content = fs.readFileSync(abs, "utf8");
|
|
976
|
+
} catch {
|
|
977
|
+
errors++;
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
980
|
+
const rel = path.relative(cwd, abs).split(path.sep).join("/");
|
|
981
|
+
findings.push(...scanContent(content, { path: rel || abs, ext: path.extname(abs).toLowerCase() }, rules));
|
|
982
|
+
}
|
|
983
|
+
findings.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line || a.column - b.column || a.ruleId.localeCompare(b.ruleId));
|
|
984
|
+
return { findings, filesScanned: files.length, errors, rules: rules.length };
|
|
985
|
+
}
|
|
986
|
+
module2.exports = { run, walk, scanContent, selectRules, RULES, EXEMPT, SCANNABLE_EXT, SKIP_DIRS };
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
// scripts/lib/detect/stack.cjs
|
|
991
|
+
var require_stack = __commonJS({
|
|
992
|
+
"scripts/lib/detect/stack.cjs"(exports2, module2) {
|
|
993
|
+
"use strict";
|
|
994
|
+
var fs = require("node:fs");
|
|
995
|
+
var path = require("node:path");
|
|
996
|
+
var { walk, SKIP_DIRS } = require_engine();
|
|
997
|
+
function readDeps(root) {
|
|
998
|
+
const pkgPath = path.basename(String(root || "")) === "package.json" ? root : path.join(root || ".", "package.json");
|
|
999
|
+
let raw;
|
|
1000
|
+
try {
|
|
1001
|
+
raw = fs.readFileSync(pkgPath, "utf8");
|
|
1002
|
+
} catch {
|
|
1003
|
+
return { deps: {}, present: false, error: null };
|
|
1004
|
+
}
|
|
1005
|
+
let pkg;
|
|
1006
|
+
try {
|
|
1007
|
+
pkg = JSON.parse(raw);
|
|
1008
|
+
} catch (e) {
|
|
1009
|
+
return { deps: {}, present: true, error: "package.json is not valid JSON" + (e && e.message ? `: ${e.message}` : "") };
|
|
1010
|
+
}
|
|
1011
|
+
if (!pkg || typeof pkg !== "object") {
|
|
1012
|
+
return { deps: {}, present: true, error: "package.json did not parse to an object" };
|
|
1013
|
+
}
|
|
1014
|
+
const deps = {};
|
|
1015
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
|
|
1016
|
+
const m = pkg[field];
|
|
1017
|
+
if (m && typeof m === "object" && !Array.isArray(m)) {
|
|
1018
|
+
for (const k of Object.keys(m)) deps[k] = m[k];
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return { deps, present: true, error: null };
|
|
1022
|
+
}
|
|
1023
|
+
function hasDep(deps, name14) {
|
|
1024
|
+
return Object.prototype.hasOwnProperty.call(deps, name14);
|
|
1025
|
+
}
|
|
1026
|
+
function hasDepPrefix(deps, prefix) {
|
|
1027
|
+
for (const k of Object.keys(deps)) {
|
|
1028
|
+
if (k === prefix || k.startsWith(prefix)) return true;
|
|
1029
|
+
}
|
|
1030
|
+
return false;
|
|
1031
|
+
}
|
|
1032
|
+
function hasTopLevelFile(root, names) {
|
|
1033
|
+
let entries;
|
|
1034
|
+
try {
|
|
1035
|
+
entries = fs.readdirSync(root, { withFileTypes: true });
|
|
1036
|
+
} catch {
|
|
1037
|
+
return false;
|
|
1038
|
+
}
|
|
1039
|
+
const set = new Set(entries.filter((e) => e.isFile()).map((e) => e.name));
|
|
1040
|
+
for (const n of names) if (set.has(n)) return true;
|
|
1041
|
+
return false;
|
|
1042
|
+
}
|
|
1043
|
+
function hasTopLevelConfig(root, stem) {
|
|
1044
|
+
let entries;
|
|
1045
|
+
try {
|
|
1046
|
+
entries = fs.readdirSync(root, { withFileTypes: true });
|
|
1047
|
+
} catch {
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
const prefix = stem + ".";
|
|
1051
|
+
for (const e of entries) {
|
|
1052
|
+
if (e.isFile() && e.name.startsWith(prefix)) return true;
|
|
1053
|
+
}
|
|
1054
|
+
return false;
|
|
1055
|
+
}
|
|
1056
|
+
function hasTopLevelDir(root, name14) {
|
|
1057
|
+
try {
|
|
1058
|
+
const st = fs.statSync(path.join(root, name14));
|
|
1059
|
+
return st.isDirectory();
|
|
1060
|
+
} catch {
|
|
1061
|
+
return false;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
function findFileMatching(root, re) {
|
|
1065
|
+
let files;
|
|
1066
|
+
try {
|
|
1067
|
+
files = walk(root);
|
|
1068
|
+
} catch {
|
|
1069
|
+
return null;
|
|
1070
|
+
}
|
|
1071
|
+
for (const abs of files) {
|
|
1072
|
+
if (re.test(path.basename(abs))) return relish(root, abs);
|
|
1073
|
+
}
|
|
1074
|
+
return null;
|
|
1075
|
+
}
|
|
1076
|
+
function findContentMatching(root, re, fileFilter) {
|
|
1077
|
+
let files;
|
|
1078
|
+
try {
|
|
1079
|
+
files = walk(root);
|
|
1080
|
+
} catch {
|
|
1081
|
+
return null;
|
|
1082
|
+
}
|
|
1083
|
+
for (const abs of files) {
|
|
1084
|
+
if (fileFilter && !fileFilter(abs)) continue;
|
|
1085
|
+
let text;
|
|
1086
|
+
try {
|
|
1087
|
+
text = fs.readFileSync(abs, "utf8");
|
|
1088
|
+
} catch {
|
|
1089
|
+
continue;
|
|
1090
|
+
}
|
|
1091
|
+
const m = re.exec(text);
|
|
1092
|
+
if (m) return { file: relish(root, abs), match: m[0] };
|
|
1093
|
+
}
|
|
1094
|
+
return null;
|
|
1095
|
+
}
|
|
1096
|
+
function relish(root, abs) {
|
|
1097
|
+
const rel = path.relative(root, abs);
|
|
1098
|
+
return (rel || abs).split(path.sep).join("/");
|
|
1099
|
+
}
|
|
1100
|
+
var DS_PROBES = [
|
|
1101
|
+
{
|
|
1102
|
+
id: "shadcn",
|
|
1103
|
+
// shadcn is a tailwind super-set: detect it FIRST so a shadcn project (which also
|
|
1104
|
+
// ships tailwind) is labeled shadcn rather than the more generic tailwind.
|
|
1105
|
+
detect(root, deps) {
|
|
1106
|
+
const hasComponentsJson = hasTopLevelFile(root, ["components.json"]);
|
|
1107
|
+
const cnHit = hasComponentsJson ? null : findContentMatching(root, /\bcn\s*\(/, (abs) => /utils\.(t|j)sx?$/.test(abs.split(path.sep).join("/")));
|
|
1108
|
+
if (hasComponentsJson) return { ev: "components.json present (shadcn/ui)" };
|
|
1109
|
+
if (cnHit) return { ev: `cn() helper in ${cnHit.file} (shadcn/ui)` };
|
|
1110
|
+
return null;
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
id: "tailwind",
|
|
1115
|
+
detect(root, deps) {
|
|
1116
|
+
if (hasDep(deps, "tailwindcss")) return { ev: "tailwindcss in dependencies" };
|
|
1117
|
+
if (hasTopLevelConfig(root, "tailwind.config")) return { ev: "tailwind.config.* present" };
|
|
1118
|
+
const themeHit = findContentMatching(root, /@theme\b/, (abs) => /\.css$/.test(abs));
|
|
1119
|
+
if (themeHit) return { ev: `@theme directive in ${themeHit.file} (tailwind v4)` };
|
|
1120
|
+
return null;
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
id: "radix-themes",
|
|
1125
|
+
detect(root, deps) {
|
|
1126
|
+
if (hasDep(deps, "@radix-ui/themes")) return { ev: "@radix-ui/themes in dependencies" };
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
id: "mui",
|
|
1132
|
+
detect(root, deps) {
|
|
1133
|
+
if (hasDep(deps, "@mui/material")) return { ev: "@mui/material in dependencies" };
|
|
1134
|
+
return null;
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
id: "chakra",
|
|
1139
|
+
detect(root, deps) {
|
|
1140
|
+
if (hasDep(deps, "@chakra-ui/react")) return { ev: "@chakra-ui/react in dependencies" };
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
id: "vanilla-extract",
|
|
1146
|
+
detect(root, deps) {
|
|
1147
|
+
if (hasDep(deps, "@vanilla-extract/css")) return { ev: "@vanilla-extract/css in dependencies" };
|
|
1148
|
+
const cssTs = findFileMatching(root, /\.css\.ts$/);
|
|
1149
|
+
if (cssTs) return { ev: `*.css.ts file ${cssTs} (vanilla-extract)` };
|
|
1150
|
+
return null;
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
id: "styled-components",
|
|
1155
|
+
detect(root, deps) {
|
|
1156
|
+
if (hasDep(deps, "styled-components")) return { ev: "styled-components in dependencies" };
|
|
1157
|
+
return null;
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
id: "css-modules",
|
|
1162
|
+
// Weakest signal (a plain file pattern, no dep). Last so any explicit DS wins over it.
|
|
1163
|
+
detect(root, deps) {
|
|
1164
|
+
const mod = findFileMatching(root, /\.module\.css$/);
|
|
1165
|
+
if (mod) return { ev: `*.module.css file ${mod} (CSS Modules)` };
|
|
1166
|
+
return null;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
];
|
|
1170
|
+
function detectDs(root, deps) {
|
|
1171
|
+
for (const probe of DS_PROBES) {
|
|
1172
|
+
let res = null;
|
|
1173
|
+
try {
|
|
1174
|
+
res = probe.detect(root, deps);
|
|
1175
|
+
} catch {
|
|
1176
|
+
res = null;
|
|
1177
|
+
}
|
|
1178
|
+
if (res) return { ds: probe.id, evidence: res.ev };
|
|
1179
|
+
}
|
|
1180
|
+
return { ds: null, evidence: "no design-system signal (no known DS dep, config file, or file pattern)" };
|
|
1181
|
+
}
|
|
1182
|
+
function detectFramework(root, deps) {
|
|
1183
|
+
if (hasDep(deps, "next")) {
|
|
1184
|
+
const router = hasTopLevelDir(root, "app") ? "app-router" : hasTopLevelDir(root, "pages") ? "pages-router" : hasTopLevelDir(root, "src") && hasTopLevelDir(path.join(root, "src"), "app") ? "app-router (src/)" : "router undetermined";
|
|
1185
|
+
return { framework: "nextjs", evidence: `next in dependencies (${router})` };
|
|
1186
|
+
}
|
|
1187
|
+
if (hasDepPrefix(deps, "@remix-run/")) {
|
|
1188
|
+
return { framework: "remix", evidence: "@remix-run/* in dependencies" };
|
|
1189
|
+
}
|
|
1190
|
+
if (hasDep(deps, "astro") || hasTopLevelConfig(root, "astro.config")) {
|
|
1191
|
+
return { framework: "astro", evidence: hasDep(deps, "astro") ? "astro in dependencies" : "astro.config.* present" };
|
|
1192
|
+
}
|
|
1193
|
+
if (hasDep(deps, "@sveltejs/kit") || hasTopLevelConfig(root, "svelte.config")) {
|
|
1194
|
+
return {
|
|
1195
|
+
framework: "sveltekit",
|
|
1196
|
+
evidence: hasDep(deps, "@sveltejs/kit") ? "@sveltejs/kit in dependencies" : "svelte.config.* present"
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
if (hasDep(deps, "storybook") || hasDepPrefix(deps, "@storybook/")) {
|
|
1200
|
+
return { framework: "storybook", evidence: "storybook / @storybook/* in dependencies" };
|
|
1201
|
+
}
|
|
1202
|
+
if ((hasDep(deps, "vite") || hasTopLevelConfig(root, "vite.config")) && (hasDep(deps, "react") || hasDep(deps, "react-dom"))) {
|
|
1203
|
+
return { framework: "vite-react", evidence: "vite + react in dependencies (no next/remix/astro/sveltekit)" };
|
|
1204
|
+
}
|
|
1205
|
+
return { framework: null, evidence: "no framework signal (no next/remix/vite-react/astro/sveltekit/storybook)" };
|
|
1206
|
+
}
|
|
1207
|
+
var MOTION_PROBES = [
|
|
1208
|
+
{
|
|
1209
|
+
id: "framer-motion",
|
|
1210
|
+
detect(deps) {
|
|
1211
|
+
if (hasDep(deps, "framer-motion")) return "framer-motion in dependencies";
|
|
1212
|
+
if (hasDep(deps, "motion")) return "motion in dependencies (framer-motion v11+)";
|
|
1213
|
+
return null;
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
id: "gsap",
|
|
1218
|
+
detect(deps) {
|
|
1219
|
+
if (hasDep(deps, "gsap")) return "gsap in dependencies";
|
|
1220
|
+
return null;
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
id: "motion-one",
|
|
1225
|
+
detect(deps) {
|
|
1226
|
+
if (hasDepPrefix(deps, "@motionone/")) return "@motionone/* in dependencies";
|
|
1227
|
+
return null;
|
|
1228
|
+
}
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
id: "react-spring",
|
|
1232
|
+
detect(deps) {
|
|
1233
|
+
if (hasDep(deps, "react-spring") || hasDepPrefix(deps, "@react-spring/")) return "react-spring / @react-spring/* in dependencies";
|
|
1234
|
+
return null;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
];
|
|
1238
|
+
function detectMotion(deps) {
|
|
1239
|
+
const libs = [];
|
|
1240
|
+
const evidence = [];
|
|
1241
|
+
for (const probe of MOTION_PROBES) {
|
|
1242
|
+
let ev = null;
|
|
1243
|
+
try {
|
|
1244
|
+
ev = probe.detect(deps);
|
|
1245
|
+
} catch {
|
|
1246
|
+
ev = null;
|
|
1247
|
+
}
|
|
1248
|
+
if (ev) {
|
|
1249
|
+
libs.push(probe.id);
|
|
1250
|
+
evidence.push(`${probe.id}: ${ev}`);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
return { motion_libs: libs, evidence };
|
|
1254
|
+
}
|
|
1255
|
+
function detectStack(root) {
|
|
1256
|
+
const dir = root || process.cwd();
|
|
1257
|
+
const evidence = {};
|
|
1258
|
+
let exists = false;
|
|
1259
|
+
try {
|
|
1260
|
+
exists = fs.existsSync(dir);
|
|
1261
|
+
} catch {
|
|
1262
|
+
exists = false;
|
|
1263
|
+
}
|
|
1264
|
+
if (!exists) {
|
|
1265
|
+
return {
|
|
1266
|
+
ds: null,
|
|
1267
|
+
framework: null,
|
|
1268
|
+
motion_libs: [],
|
|
1269
|
+
evidence: { note: `root path does not exist: ${dir}` }
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
const { deps, present, error } = readDeps(dir);
|
|
1273
|
+
if (!present) evidence.note = "no package.json at root \u2014 relying on config-file + file-pattern probes only";
|
|
1274
|
+
else if (error) evidence.note = `${error} \u2014 relying on config-file + file-pattern probes only`;
|
|
1275
|
+
let ds = null;
|
|
1276
|
+
let framework = null;
|
|
1277
|
+
let motion_libs = [];
|
|
1278
|
+
try {
|
|
1279
|
+
const dsr = detectDs(dir, deps);
|
|
1280
|
+
ds = dsr.ds;
|
|
1281
|
+
evidence.ds = dsr.evidence;
|
|
1282
|
+
} catch (e) {
|
|
1283
|
+
evidence.ds = "ds detection error: " + (e && e.message ? e.message : String(e));
|
|
1284
|
+
}
|
|
1285
|
+
try {
|
|
1286
|
+
const fwr = detectFramework(dir, deps);
|
|
1287
|
+
framework = fwr.framework;
|
|
1288
|
+
evidence.framework = fwr.evidence;
|
|
1289
|
+
} catch (e) {
|
|
1290
|
+
evidence.framework = "framework detection error: " + (e && e.message ? e.message : String(e));
|
|
1291
|
+
}
|
|
1292
|
+
try {
|
|
1293
|
+
const mr = detectMotion(deps);
|
|
1294
|
+
motion_libs = mr.motion_libs;
|
|
1295
|
+
evidence.motion = mr.evidence;
|
|
1296
|
+
} catch (e) {
|
|
1297
|
+
evidence.motion = ["motion detection error: " + (e && e.message ? e.message : String(e))];
|
|
1298
|
+
}
|
|
1299
|
+
return { ds, framework, motion_libs, evidence };
|
|
1300
|
+
}
|
|
1301
|
+
var HELP = `gdd stack detection \u2014 fingerprint a project's design-system / framework / motion stack.
|
|
1302
|
+
|
|
1303
|
+
Usage:
|
|
1304
|
+
detect-stack [root] [options]
|
|
1305
|
+
|
|
1306
|
+
Arguments:
|
|
1307
|
+
[root] Project directory to scan (defaults to the current directory).
|
|
1308
|
+
|
|
1309
|
+
Options:
|
|
1310
|
+
--json Machine-readable JSON (default).
|
|
1311
|
+
--pretty Pretty-printed human summary.
|
|
1312
|
+
-h, --help This help.
|
|
1313
|
+
|
|
1314
|
+
Always exits 0 \u2014 an undetected stack is reported, not an error.`;
|
|
1315
|
+
function parseArgs(argv) {
|
|
1316
|
+
const opts = { root: null, json: true, pretty: false, help: false };
|
|
1317
|
+
for (let i = 0; i < argv.length; i++) {
|
|
1318
|
+
const a = argv[i];
|
|
1319
|
+
if (a === "--json") opts.json = true;
|
|
1320
|
+
else if (a === "--pretty") {
|
|
1321
|
+
opts.pretty = true;
|
|
1322
|
+
opts.json = false;
|
|
1323
|
+
} else if (a === "-h" || a === "--help") opts.help = true;
|
|
1324
|
+
else if (!a.startsWith("-") && opts.root === null) opts.root = a;
|
|
1325
|
+
}
|
|
1326
|
+
return opts;
|
|
1327
|
+
}
|
|
1328
|
+
function renderPretty(res) {
|
|
1329
|
+
const lines = [];
|
|
1330
|
+
lines.push("gdd stack:");
|
|
1331
|
+
lines.push(` design-system : ${res.ds || "(none detected)"}`);
|
|
1332
|
+
lines.push(` framework : ${res.framework || "(none detected)"}`);
|
|
1333
|
+
lines.push(` motion : ${res.motion_libs.length ? res.motion_libs.join(", ") : "(none detected)"}`);
|
|
1334
|
+
if (res.evidence && res.evidence.note) lines.push(` note : ${res.evidence.note}`);
|
|
1335
|
+
return lines.join("\n");
|
|
1336
|
+
}
|
|
1337
|
+
function main(argv, io) {
|
|
1338
|
+
const o = io || {};
|
|
1339
|
+
const log = o.log || ((s) => process.stdout.write(s + "\n"));
|
|
1340
|
+
const opts = parseArgs(argv);
|
|
1341
|
+
if (opts.help) {
|
|
1342
|
+
log(HELP);
|
|
1343
|
+
return 0;
|
|
1344
|
+
}
|
|
1345
|
+
const root = opts.root || o.cwd || process.cwd();
|
|
1346
|
+
const res = detectStack(root);
|
|
1347
|
+
if (opts.pretty) log(renderPretty(res));
|
|
1348
|
+
else log(JSON.stringify(res, null, 2));
|
|
1349
|
+
return 0;
|
|
1350
|
+
}
|
|
1351
|
+
module2.exports = {
|
|
1352
|
+
detectStack,
|
|
1353
|
+
main,
|
|
1354
|
+
// internals exported for unit reuse / introspection (kept stable for executors B & F).
|
|
1355
|
+
readDeps,
|
|
1356
|
+
hasDep,
|
|
1357
|
+
hasDepPrefix,
|
|
1358
|
+
detectDs,
|
|
1359
|
+
detectFramework,
|
|
1360
|
+
detectMotion,
|
|
1361
|
+
parseArgs,
|
|
1362
|
+
HELP,
|
|
1363
|
+
SKIP_DIRS
|
|
1364
|
+
};
|
|
1365
|
+
if (require.main === module2) process.exit(main(process.argv.slice(2)));
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
|
|
1369
|
+
// scripts/lib/mapper-spawn.cjs
|
|
1370
|
+
var require_mapper_spawn = __commonJS({
|
|
1371
|
+
"scripts/lib/mapper-spawn.cjs"(exports2, module2) {
|
|
1372
|
+
"use strict";
|
|
1373
|
+
var fs = require("node:fs");
|
|
1374
|
+
var path = require("node:path");
|
|
1375
|
+
var BLOCK_HEADER = "## Stack-specific guidance";
|
|
1376
|
+
var ADDENDUM_SEPARATOR = "\n\n---\n\n";
|
|
1377
|
+
var CATEGORY_ORDER = ["system", "framework", "motion"];
|
|
1378
|
+
function normKey(value) {
|
|
1379
|
+
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
1380
|
+
}
|
|
1381
|
+
function baseNameNoExt(p) {
|
|
1382
|
+
if (typeof p !== "string" || p.length === 0) return "";
|
|
1383
|
+
const tail = p.replace(/\\/g, "/").split("/").pop() || "";
|
|
1384
|
+
return tail.replace(/\.md$/i, "");
|
|
1385
|
+
}
|
|
1386
|
+
function classifyEntry(entry) {
|
|
1387
|
+
let category = null;
|
|
1388
|
+
const explicitKind = normKey(entry.kind || entry.category);
|
|
1389
|
+
if (explicitKind === "system" || explicitKind === "ds" || explicitKind === "design-system") {
|
|
1390
|
+
category = "system";
|
|
1391
|
+
} else if (explicitKind === "framework") {
|
|
1392
|
+
category = "framework";
|
|
1393
|
+
} else if (explicitKind === "motion") {
|
|
1394
|
+
category = "motion";
|
|
1395
|
+
} else if (typeof entry.path === "string") {
|
|
1396
|
+
const p = entry.path.replace(/\\/g, "/");
|
|
1397
|
+
if (/(^|\/)reference\/systems\//i.test(p) || /(^|\/)systems\//i.test(p)) category = "system";
|
|
1398
|
+
else if (/(^|\/)reference\/frameworks\//i.test(p) || /(^|\/)frameworks\//i.test(p)) category = "framework";
|
|
1399
|
+
else if (/(^|\/)reference\/motion\//i.test(p) || /(^|\/)motion\//i.test(p)) category = "motion";
|
|
1400
|
+
}
|
|
1401
|
+
let key = normKey(entry.stack);
|
|
1402
|
+
if (key === "") key = normKey(baseNameNoExt(entry.path));
|
|
1403
|
+
if (key === "") {
|
|
1404
|
+
const nameParts = normKey(entry.name).split("-").filter(Boolean);
|
|
1405
|
+
key = nameParts.length > 0 ? nameParts[nameParts.length - 1] : "";
|
|
1406
|
+
}
|
|
1407
|
+
return { category, key };
|
|
1408
|
+
}
|
|
1409
|
+
function composesInto(entry, mapperName) {
|
|
1410
|
+
if (!entry || entry.type !== "stack-addendum") return false;
|
|
1411
|
+
const list = entry.composes_into;
|
|
1412
|
+
if (!Array.isArray(list)) return false;
|
|
1413
|
+
return list.some((m) => normKey(m) === normKey(mapperName));
|
|
1414
|
+
}
|
|
1415
|
+
function readAddendumBody(entry, refDir) {
|
|
1416
|
+
if (typeof entry.path !== "string" || entry.path.length === 0) return null;
|
|
1417
|
+
const rel = entry.path.replace(/\\/g, "/");
|
|
1418
|
+
const candidates = [];
|
|
1419
|
+
if (path.isAbsolute(rel)) {
|
|
1420
|
+
candidates.push(rel);
|
|
1421
|
+
} else {
|
|
1422
|
+
candidates.push(path.resolve(refDir, rel));
|
|
1423
|
+
const stripped = rel.replace(/^reference\//i, "");
|
|
1424
|
+
if (stripped !== rel) candidates.push(path.resolve(refDir, stripped));
|
|
1425
|
+
}
|
|
1426
|
+
for (const abs of candidates) {
|
|
1427
|
+
let body;
|
|
1428
|
+
try {
|
|
1429
|
+
body = fs.readFileSync(abs, "utf8");
|
|
1430
|
+
} catch {
|
|
1431
|
+
continue;
|
|
1432
|
+
}
|
|
1433
|
+
const trimmed = body.replace(/\s+$/, "").replace(/^/, "");
|
|
1434
|
+
if (trimmed.trim().length > 0) return trimmed;
|
|
1435
|
+
}
|
|
1436
|
+
return null;
|
|
1437
|
+
}
|
|
1438
|
+
function composeAddendums(mapperName, stack, opts) {
|
|
1439
|
+
const used = [];
|
|
1440
|
+
const missing = [];
|
|
1441
|
+
const empty = () => ({ block: "", used, missing });
|
|
1442
|
+
const o = opts || {};
|
|
1443
|
+
const cap = Number.isInteger(o.cap) && o.cap >= 0 ? o.cap : 3;
|
|
1444
|
+
const refDir = typeof o.refDir === "string" && o.refDir.length > 0 ? o.refDir : process.cwd();
|
|
1445
|
+
if (!stack || typeof stack !== "object" || cap === 0) return empty();
|
|
1446
|
+
const registry = o.registry;
|
|
1447
|
+
const entries = registry && Array.isArray(registry.entries) ? registry.entries : [];
|
|
1448
|
+
const detected = {
|
|
1449
|
+
system: normKey(stack.ds),
|
|
1450
|
+
framework: normKey(stack.framework),
|
|
1451
|
+
// motion is a list; take the first non-empty entry (cap allows only one
|
|
1452
|
+
// motion addendum, so the leading detected lib wins).
|
|
1453
|
+
motion: Array.isArray(stack.motion_libs) ? normKey(stack.motion_libs.find((m) => normKey(m) !== "")) : ""
|
|
1454
|
+
};
|
|
1455
|
+
const candidates = [];
|
|
1456
|
+
for (const entry of entries) {
|
|
1457
|
+
if (!composesInto(entry, mapperName)) continue;
|
|
1458
|
+
const { category, key } = classifyEntry(entry);
|
|
1459
|
+
if (category === null || key === "") continue;
|
|
1460
|
+
candidates.push({ entry, category, key });
|
|
1461
|
+
}
|
|
1462
|
+
const bodies = [];
|
|
1463
|
+
for (const category of CATEGORY_ORDER) {
|
|
1464
|
+
if (used.length >= cap) break;
|
|
1465
|
+
const want = detected[category];
|
|
1466
|
+
if (want === "") continue;
|
|
1467
|
+
const hit = candidates.find((c) => c.category === category && c.key === want);
|
|
1468
|
+
if (!hit) {
|
|
1469
|
+
missing.push(want);
|
|
1470
|
+
continue;
|
|
1471
|
+
}
|
|
1472
|
+
const body = readAddendumBody(hit.entry, refDir);
|
|
1473
|
+
if (body === null) {
|
|
1474
|
+
missing.push(want);
|
|
1475
|
+
continue;
|
|
1476
|
+
}
|
|
1477
|
+
bodies.push(body);
|
|
1478
|
+
used.push(typeof hit.entry.name === "string" && hit.entry.name.length > 0 ? hit.entry.name : hit.key);
|
|
1479
|
+
}
|
|
1480
|
+
if (bodies.length === 0) return empty();
|
|
1481
|
+
const block = `${BLOCK_HEADER}
|
|
1482
|
+
|
|
1483
|
+
${bodies.join(ADDENDUM_SEPARATOR)}`;
|
|
1484
|
+
return { block, used, missing };
|
|
1485
|
+
}
|
|
1486
|
+
function applyAddendums(spec, stack, opts) {
|
|
1487
|
+
if (!spec || typeof spec !== "object") {
|
|
1488
|
+
return { spec, block: "", used: [], missing: [] };
|
|
1489
|
+
}
|
|
1490
|
+
const mapperName = typeof spec.name === "string" ? spec.name : "";
|
|
1491
|
+
const { block, used, missing } = composeAddendums(mapperName, stack, opts);
|
|
1492
|
+
if (block !== "") {
|
|
1493
|
+
const base = typeof spec.prompt === "string" ? spec.prompt : "";
|
|
1494
|
+
spec.prompt = base === "" ? block : `${base}
|
|
1495
|
+
|
|
1496
|
+
${block}`;
|
|
1497
|
+
}
|
|
1498
|
+
return { spec, block, used, missing };
|
|
1499
|
+
}
|
|
1500
|
+
module2.exports = {
|
|
1501
|
+
composeAddendums,
|
|
1502
|
+
applyAddendums,
|
|
1503
|
+
// Exported for unit-level coverage + reuse by the runner wiring (executor F).
|
|
1504
|
+
classifyEntry,
|
|
1505
|
+
composesInto,
|
|
1506
|
+
BLOCK_HEADER
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
|
|
516
1511
|
// scripts/lib/health-mirror/index.cjs
|
|
517
1512
|
var require_health_mirror = __commonJS({
|
|
518
1513
|
"scripts/lib/health-mirror/index.cjs"(exports2, module2) {
|
|
@@ -671,6 +1666,58 @@ var require_health_mirror = __commonJS({
|
|
|
671
1666
|
}
|
|
672
1667
|
checks.push({ name: "harness_freshness", status, detail });
|
|
673
1668
|
}
|
|
1669
|
+
{
|
|
1670
|
+
let status = "ok";
|
|
1671
|
+
let detail;
|
|
1672
|
+
try {
|
|
1673
|
+
const { detectStack } = require_stack();
|
|
1674
|
+
const stack = detectStack(rootDir) || { ds: null, framework: null, motion_libs: [] };
|
|
1675
|
+
const wanted = [];
|
|
1676
|
+
if (typeof stack.ds === "string" && stack.ds) wanted.push({ category: "system", key: stack.ds });
|
|
1677
|
+
if (typeof stack.framework === "string" && stack.framework) {
|
|
1678
|
+
wanted.push({ category: "framework", key: stack.framework });
|
|
1679
|
+
}
|
|
1680
|
+
if (Array.isArray(stack.motion_libs)) {
|
|
1681
|
+
for (const m of stack.motion_libs) {
|
|
1682
|
+
if (typeof m === "string" && m) wanted.push({ category: "motion", key: m });
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
if (wanted.length === 0) {
|
|
1686
|
+
detail = "stack addendums: no stacks detected";
|
|
1687
|
+
status = "ok";
|
|
1688
|
+
} else {
|
|
1689
|
+
let entries = [];
|
|
1690
|
+
try {
|
|
1691
|
+
const reg = JSON.parse(
|
|
1692
|
+
fs.readFileSync(path.join(rootDir, "reference", "registry.json"), "utf8")
|
|
1693
|
+
);
|
|
1694
|
+
entries = Array.isArray(reg.entries) ? reg.entries : [];
|
|
1695
|
+
} catch {
|
|
1696
|
+
entries = null;
|
|
1697
|
+
}
|
|
1698
|
+
if (entries === null) {
|
|
1699
|
+
detail = "stack addendums: registry unavailable";
|
|
1700
|
+
status = "warn";
|
|
1701
|
+
} else {
|
|
1702
|
+
const { classifyEntry } = require_mapper_spawn();
|
|
1703
|
+
const covered = /* @__PURE__ */ new Set();
|
|
1704
|
+
for (const e of entries) {
|
|
1705
|
+
if (!e || e.type !== "stack-addendum") continue;
|
|
1706
|
+
const { category, key } = classifyEntry(e);
|
|
1707
|
+
if (category && key) covered.add(category + "|" + key);
|
|
1708
|
+
}
|
|
1709
|
+
const have = wanted.filter((w) => covered.has(w.category + "|" + String(w.key).toLowerCase())).length;
|
|
1710
|
+
const total = wanted.length;
|
|
1711
|
+
status = have >= total ? "ok" : "warn";
|
|
1712
|
+
detail = `stack addendums: ${have}/${total} detected stacks have addendums`;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
} catch {
|
|
1716
|
+
status = "warn";
|
|
1717
|
+
detail = "stack addendums: unavailable";
|
|
1718
|
+
}
|
|
1719
|
+
checks.push({ name: "stack_addendums", status, detail });
|
|
1720
|
+
}
|
|
674
1721
|
return { checks };
|
|
675
1722
|
}
|
|
676
1723
|
function sessionStartWiresInject(rootDir) {
|