@shrkcrft/context-planner 0.1.0-alpha.22 → 0.1.0-alpha.24

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.
@@ -26,11 +26,14 @@ export interface IRankerWeights {
26
26
  hintedFile: number;
27
27
  /** File belongs to a hinted package. */
28
28
  hintedPackage: number;
29
- /** File is a test for a ranked source file (followed-up only). */
30
- testFollowup: number;
31
29
  /** Penalty for generated files (subtract). */
32
30
  generatedPenalty: number;
33
- /** Penalty for test files when intent != bug-fix. */
31
+ /**
32
+ * Test-file weight, applied as a SIGNED term (`score -= testPenalty`). A
33
+ * positive value penalises test files (the default for non-bug-fix intents);
34
+ * a negative value boosts them (bug-fix sets `-0.2`, turning the term into a
35
+ * `+0.2` boost so a co-located test survives the cut).
36
+ */
34
37
  testPenalty: number;
35
38
  }
36
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"score-files.d.ts","sourceRoot":"","sources":["../../src/ranker/score-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,MAAM,EAAE,UAAU,CAAC;IACnB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,8BAA8B;IAC9B,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;I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AU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAiBD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,GAAG,SAAS,WAAW,EAAE,CAqDzF"}
@@ -3,7 +3,6 @@ const DEFAULT_WEIGHTS = {
3
3
  symbolKeyword: 0.7,
4
4
  hintedFile: 2.0,
5
5
  hintedPackage: 0.5,
6
- testFollowup: 0.4,
7
6
  generatedPenalty: 0.6,
8
7
  testPenalty: 0.3,
9
8
  };
@@ -59,10 +58,13 @@ export function scoreFiles(api, input) {
59
58
  reasons.push('generated (penalty)');
60
59
  }
61
60
  if ((node.tags ?? []).includes('test')) {
62
- if (input.intent !== 'bug-fix') {
63
- score -= weights.testPenalty;
64
- reasons.push('test (intent-mismatched penalty)');
65
- }
61
+ // Apply the test weight as a SIGNED term unconditionally. For most intents
62
+ // `testPenalty` is positive, so this subtracts (a real penalty). bug-fix
63
+ // tuning sets it negative, so `score -= (-0.2)` becomes a `+0.2` boost —
64
+ // previously the boost lived inside an `intent !== 'bug-fix'` guard and so
65
+ // never ran, leaving the bug-fix knob dead.
66
+ score -= weights.testPenalty;
67
+ reasons.push(weights.testPenalty < 0 ? 'test (intent-relevant boost)' : 'test (intent-mismatched penalty)');
66
68
  }
67
69
  if (score <= 0)
68
70
  continue;
@@ -74,7 +76,7 @@ export function scoreFiles(api, input) {
74
76
  function applyIntentTuning(intent) {
75
77
  switch (intent) {
76
78
  case 'bug-fix':
77
- return { testFollowup: 0.6, testPenalty: -0.2 }; // negative penalty = boost
79
+ return { testPenalty: -0.2 }; // negative weight = boost for co-located tests
78
80
  case 'refactor':
79
81
  return { symbolKeyword: 0.9 };
80
82
  case 'docs':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shrkcrft/context-planner",
3
- "version": "0.1.0-alpha.22",
3
+ "version": "0.1.0-alpha.24",
4
4
  "description": "SharkCraft context planner: deterministic, token-budgeted context packs for AI coding agents. Combines code graph, rule-graph, and intent classification to pick the minimal relevant file set for a task.",
5
5
  "license": "MIT",
6
6
  "author": "SharkCraft contributors",
@@ -43,9 +43,9 @@
43
43
  "typecheck": "tsc --noEmit -p tsconfig.json"
44
44
  },
45
45
  "dependencies": {
46
- "@shrkcrft/core": "^0.1.0-alpha.22",
47
- "@shrkcrft/graph": "^0.1.0-alpha.22",
48
- "@shrkcrft/rule-graph": "^0.1.0-alpha.22"
46
+ "@shrkcrft/core": "^0.1.0-alpha.24",
47
+ "@shrkcrft/graph": "^0.1.0-alpha.24",
48
+ "@shrkcrft/rule-graph": "^0.1.0-alpha.24"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"