uilint 0.2.121 → 0.2.123

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/dist/index.js CHANGED
@@ -3672,9 +3672,12 @@ import chalk3 from "chalk";
3672
3672
  function findCommand() {
3673
3673
  return new Command2("find").description("Find semantic duplicate groups in the codebase").option(
3674
3674
  "--threshold <n>",
3675
- "Similarity threshold 0-1 (default: 0.85)",
3675
+ "Similarity threshold 0-1 (default: 0.75)",
3676
3676
  parseFloat
3677
- ).option("--min-size <n>", "Minimum group size (default: 2)", parseInt).option("--kind <type>", "Filter: component, hook, function").option("-o, --output <format>", "Output format: text or json", "text").action(async (options) => {
3677
+ ).option("--min-size <n>", "Minimum group size (default: 2)", parseInt).option("--kind <type>", "Filter: component, hook, function").option(
3678
+ "--confidence <level>",
3679
+ "Minimum confidence: high, medium, low (default: low)"
3680
+ ).option("--no-structural", "Disable structural similarity boost").option("--same-file", "Include duplicates within the same file").option("-o, --output <format>", "Output format: text or json", "text").action(async (options) => {
3678
3681
  const { findDuplicates } = await import("uilint-duplicates");
3679
3682
  const projectRoot = process.cwd();
3680
3683
  const isJson = options.output === "json";
@@ -3683,7 +3686,10 @@ function findCommand() {
3683
3686
  path: projectRoot,
3684
3687
  threshold: options.threshold,
3685
3688
  minGroupSize: options.minSize,
3686
- kind: options.kind
3689
+ kind: options.kind,
3690
+ confidenceLevel: options.confidence,
3691
+ useStructuralBoost: options.structural !== false,
3692
+ includeSameFile: options.sameFile ?? false
3687
3693
  });
3688
3694
  if (isJson) {
3689
3695
  console.log(JSON.stringify({ groups }, null, 2));
@@ -3701,9 +3707,11 @@ function findCommand() {
3701
3707
  );
3702
3708
  groups.forEach((group, idx) => {
3703
3709
  const similarity = Math.round(group.avgSimilarity * 100);
3710
+ const confidenceEmoji = group.confidence === "high" ? "\u{1F534}" : group.confidence === "medium" ? "\u{1F7E1}" : "\u{1F7E2}";
3711
+ const confidenceColor = group.confidence === "high" ? chalk3.red : group.confidence === "medium" ? chalk3.yellow : chalk3.green;
3704
3712
  console.log(
3705
- chalk3.yellow(
3706
- `Duplicate Group ${idx + 1} (${similarity}% similar, ${group.members.length} occurrences):`
3713
+ chalk3.bold(
3714
+ `${confidenceEmoji} Duplicate Group ${idx + 1} (${confidenceColor(`${similarity}% - ${group.confidence} confidence`)}, ${group.members.length} occurrences):`
3707
3715
  )
3708
3716
  );
3709
3717
  group.members.forEach((member) => {
@@ -3713,12 +3721,9 @@ function findCommand() {
3713
3721
  const score = member.score === 1 ? "" : chalk3.dim(` (${Math.round(member.score * 100)}%)`);
3714
3722
  console.log(` ${chalk3.cyan(location.padEnd(50))} ${name}${score}`);
3715
3723
  });
3716
- console.log(
3717
- chalk3.dim(
3718
- ` Suggestion: Consider extracting shared logic into a reusable ${group.kind}
3719
- `
3720
- )
3721
- );
3724
+ const suggestion = group.confidence === "high" ? `Strongly recommend consolidating into a single reusable ${group.kind}` : group.confidence === "medium" ? `Consider extracting shared logic into a reusable ${group.kind}` : `Optional: Review if a common abstraction makes sense`;
3725
+ console.log(chalk3.dim(` \u2192 ${suggestion}
3726
+ `));
3722
3727
  });
3723
3728
  } catch (error) {
3724
3729
  const message = error instanceof Error ? error.message : String(error);