instrlint 0.2.3 → 0.2.4

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/cli.js CHANGED
@@ -7,7 +7,7 @@ import { Command } from "commander";
7
7
  import { execSync } from "child_process";
8
8
  import { writeFileSync as writeFileSync3 } from "fs";
9
9
  import { createInterface } from "readline";
10
- import { basename as basename2, resolve, relative as relative4 } from "path";
10
+ import { basename, resolve, relative as relative4 } from "path";
11
11
  import chalk4 from "chalk";
12
12
 
13
13
  // src/core/scanner.ts
@@ -92,11 +92,21 @@ function scanProject(projectRoot, forceTool) {
92
92
  if (byFile != null) {
93
93
  return { ...byFile, confidence: "low" };
94
94
  }
95
- return { tool: "unknown", rootFilePath: null, configDir: null, confidence: "low" };
95
+ return {
96
+ tool: "unknown",
97
+ rootFilePath: null,
98
+ configDir: null,
99
+ confidence: "low"
100
+ };
96
101
  }
97
102
  if (detections.length === 1) {
98
103
  const d = detections[0];
99
- return { tool: d.tool, rootFilePath: d.rootFilePath, configDir: d.configDir, confidence: "high" };
104
+ return {
105
+ tool: d.tool,
106
+ rootFilePath: d.rootFilePath,
107
+ configDir: d.configDir,
108
+ confidence: "high"
109
+ };
100
110
  }
101
111
  const first = detections[0];
102
112
  return {
@@ -2484,7 +2494,9 @@ function printStructureSuggestions(suggestions, projectRoot, output) {
2484
2494
  } else {
2485
2495
  const dir = s.pathDir ?? "src";
2486
2496
  const { filePath, content } = buildPathScopedFile(dir, s.ruleText);
2487
- output.log(` ${chalk3.cyan(t("fix.pathScopedCreate", { path: filePath }))}`);
2497
+ output.log(
2498
+ ` ${chalk3.cyan(t("fix.pathScopedCreate", { path: filePath }))}`
2499
+ );
2488
2500
  terminalCodeBlock(content, output);
2489
2501
  if (lineNum > 0) {
2490
2502
  output.log(
@@ -2507,7 +2519,14 @@ function markdownStructureSuggestions(suggestions, projectRoot) {
2507
2519
  ""
2508
2520
  );
2509
2521
  if (s.type === "hook") {
2510
- lines.push(t("fix.hookCreate"), "", "```json", buildHookSnippet(s.ruleText), "```", "");
2522
+ lines.push(
2523
+ t("fix.hookCreate"),
2524
+ "",
2525
+ "```json",
2526
+ buildHookSnippet(s.ruleText),
2527
+ "```",
2528
+ ""
2529
+ );
2511
2530
  lines.push(`> ${t("fix.hookWarning")}`, "");
2512
2531
  if (lineNum > 0) {
2513
2532
  lines.push(
@@ -2815,18 +2834,30 @@ import { existsSync as existsSync8, mkdirSync, readFileSync as readFileSync10, w
2815
2834
  import { join as join8 } from "path";
2816
2835
  import { homedir as homedir2 } from "os";
2817
2836
  import { fileURLToPath as fileURLToPath2 } from "url";
2818
- function resolveSkillFile(target) {
2837
+ function resolveSkillFile() {
2819
2838
  const thisFile = fileURLToPath2(import.meta.url);
2820
- const subDir = target === "claude-code" ? "claude-code" : "codex";
2821
- for (const levels of [2, 3]) {
2839
+ const levelCandidates = [2, 3];
2840
+ for (const levels of levelCandidates) {
2822
2841
  const parts = Array(levels).fill("..");
2823
- const candidate = join8(thisFile, ...parts, "skills", subDir, "SKILL.md");
2842
+ const candidate = join8(
2843
+ thisFile,
2844
+ ...parts,
2845
+ "skills",
2846
+ "instrlint",
2847
+ "SKILL.md"
2848
+ );
2824
2849
  if (existsSync8(candidate)) return candidate;
2825
2850
  }
2826
- return join8(thisFile, "..", "..", "skills", subDir, "SKILL.md");
2851
+ return join8(
2852
+ thisFile,
2853
+ ...Array(levelCandidates[0]).fill(".."),
2854
+ "skills",
2855
+ "instrlint",
2856
+ "SKILL.md"
2857
+ );
2827
2858
  }
2828
- function readSkillContent(target) {
2829
- const skillPath = resolveSkillFile(target);
2859
+ function readSkillContent() {
2860
+ const skillPath = resolveSkillFile();
2830
2861
  try {
2831
2862
  const raw = readFileSync10(skillPath, "utf8");
2832
2863
  return injectVersion(raw, CURRENT_VERSION);
@@ -2863,14 +2894,14 @@ function installCodex(content, projectRoot, force, output) {
2863
2894
  function runInstall(opts, output = console) {
2864
2895
  const projectRoot = opts.projectRoot ?? process.cwd();
2865
2896
  const force = opts.force ?? false;
2897
+ let content;
2898
+ try {
2899
+ content = readSkillContent();
2900
+ } catch (err) {
2901
+ output.error(String(err));
2902
+ return { exitCode: 1, errorMessage: String(err) };
2903
+ }
2866
2904
  if (opts.claudeCode) {
2867
- let content;
2868
- try {
2869
- content = readSkillContent("claude-code");
2870
- } catch (err) {
2871
- output.error(String(err));
2872
- return { exitCode: 1, errorMessage: String(err) };
2873
- }
2874
2905
  return installClaudeCode(
2875
2906
  content,
2876
2907
  projectRoot,
@@ -2880,13 +2911,6 @@ function runInstall(opts, output = console) {
2880
2911
  );
2881
2912
  }
2882
2913
  if (opts.codex) {
2883
- let content;
2884
- try {
2885
- content = readSkillContent("codex");
2886
- } catch (err) {
2887
- output.error(String(err));
2888
- return { exitCode: 1, errorMessage: String(err) };
2889
- }
2890
2914
  return installCodex(content, projectRoot, force, output);
2891
2915
  }
2892
2916
  output.error(t("install.unknownTarget"));
@@ -2982,7 +3006,7 @@ async function runAll(opts, output = console) {
2982
3006
  const { score, grade } = calculateScore(allFindings, summary);
2983
3007
  const actionPlan = buildActionPlan(allFindings);
2984
3008
  const report = {
2985
- project: basename2(projectRoot),
3009
+ project: basename(projectRoot),
2986
3010
  tool: instructions.tool,
2987
3011
  score,
2988
3012
  grade,
@@ -3245,7 +3269,7 @@ async function runStructure(opts, output = console) {
3245
3269
 
3246
3270
  // src/commands/ci-command.ts
3247
3271
  import { writeFileSync as writeFileSync4 } from "fs";
3248
- import { basename as basename3 } from "path";
3272
+ import { basename as basename2 } from "path";
3249
3273
 
3250
3274
  // src/reporters/sarif.ts
3251
3275
  function severityToLevel(severity) {
@@ -3351,7 +3375,7 @@ async function runCi(opts, output = console) {
3351
3375
  const { score, grade } = calculateScore(allFindings, summary);
3352
3376
  const actionPlan = buildActionPlan(allFindings);
3353
3377
  const report = {
3354
- project: basename3(projectRoot),
3378
+ project: basename2(projectRoot),
3355
3379
  tool: instructions.tool,
3356
3380
  score,
3357
3381
  grade,