@shrkcrft/context-planner 0.1.0-alpha.19 → 0.1.0-alpha.21
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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/planner/plan-context.d.ts.map +1 -1
- package/dist/planner/plan-context.js +7 -0
- package/dist/schema/context-pack.d.ts +7 -0
- package/dist/schema/context-pack.d.ts.map +1 -1
- package/dist/schema/context-pack.js +0 -8
- package/dist/schema/pack-coverage.d.ts +30 -0
- package/dist/schema/pack-coverage.d.ts.map +1 -0
- package/dist/schema/pack-coverage.js +1 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-context.d.ts","sourceRoot":"","sources":["../../src/planner/plan-context.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,YAAY,EAMlB,MAAM,2BAA2B,CAAC;AAInC,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"plan-context.d.ts","sourceRoot":"","sources":["../../src/planner/plan-context.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,YAAY,EAMlB,MAAM,2BAA2B,CAAC;AAInC,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CA6GtE"}
|
|
@@ -55,6 +55,7 @@ export function planContext(options) {
|
|
|
55
55
|
let paths = [];
|
|
56
56
|
let templates = [];
|
|
57
57
|
const bridgeStore = new BridgeStore(options.projectRoot);
|
|
58
|
+
const rulesComputed = bridgeStore.exists();
|
|
58
59
|
if (bridgeStore.exists()) {
|
|
59
60
|
const bridgeApi = RuleGraphQueryApi.fromStores(options.projectRoot);
|
|
60
61
|
const seenRule = new Set();
|
|
@@ -111,6 +112,10 @@ export function planContext(options) {
|
|
|
111
112
|
tests,
|
|
112
113
|
risks,
|
|
113
114
|
doNotTouch,
|
|
115
|
+
// risks/doNotTouch are graph-derived; once past the graph-missing early
|
|
116
|
+
// return they are always computed. rules/paths/templates depend on the
|
|
117
|
+
// rule-graph bridge.
|
|
118
|
+
coverage: { rulesComputed, risksComputed: true, doNotTouchComputed: true },
|
|
114
119
|
budget: { requested: budgetTokens, used, truncated },
|
|
115
120
|
diagnostics,
|
|
116
121
|
};
|
|
@@ -213,6 +218,8 @@ function emptyPack(task, budget, diagnostics) {
|
|
|
213
218
|
tests: [],
|
|
214
219
|
risks: [],
|
|
215
220
|
doNotTouch: [],
|
|
221
|
+
// Graph store was missing — nothing was computed.
|
|
222
|
+
coverage: { rulesComputed: false, risksComputed: false, doNotTouchComputed: false },
|
|
216
223
|
budget: { requested: budget, used: 0, truncated: false },
|
|
217
224
|
diagnostics,
|
|
218
225
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Schema: sharkcraft.context-pack/v1.
|
|
8
8
|
*/
|
|
9
|
+
import type { IPackCoverage } from './pack-coverage.js';
|
|
9
10
|
export declare const CONTEXT_PACK_SCHEMA: "sharkcraft.context-pack/v1";
|
|
10
11
|
export type TaskIntent = 'feature' | 'bug-fix' | 'refactor' | 'docs' | 'release' | 'migration' | 'unknown';
|
|
11
12
|
export interface IRankedFile {
|
|
@@ -61,6 +62,12 @@ export interface IContextPack {
|
|
|
61
62
|
* vendored code, lock files, dist/build outputs.
|
|
62
63
|
*/
|
|
63
64
|
doNotTouch: readonly string[];
|
|
65
|
+
/**
|
|
66
|
+
* Per-field provenance: which sections were actually computed vs. omitted
|
|
67
|
+
* for lack of a prerequisite index. Lets a consumer tell "empty because
|
|
68
|
+
* none apply" from "empty because not computed".
|
|
69
|
+
*/
|
|
70
|
+
coverage: IPackCoverage;
|
|
64
71
|
/** Token budget summary. */
|
|
65
72
|
budget: {
|
|
66
73
|
requested: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-pack.d.ts","sourceRoot":"","sources":["../../src/schema/context-pack.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAG,4BAAqC,CAAC;AAEzE,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,UAAU,GACV,MAAM,GACN,SAAS,GACT,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,eAAe,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,mBAAmB,CAAC;IACnC,MAAM,EAAE,UAAU,CAAC;IACnB,gDAAgD;IAChD,IAAI,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
|
1
|
-
/**
|
|
2
|
-
* Compact, deterministic context pack consumable by AI coding agents.
|
|
3
|
-
*
|
|
4
|
-
* Output of `@shrkcrft/context-planner`. Stable JSON shape so an agent
|
|
5
|
-
* can persist node ids across turns and verify what was cut.
|
|
6
|
-
*
|
|
7
|
-
* Schema: sharkcraft.context-pack/v1.
|
|
8
|
-
*/
|
|
9
1
|
export const CONTEXT_PACK_SCHEMA = 'sharkcraft.context-pack/v1';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-field coverage markers for an `IContextPack`.
|
|
3
|
+
*
|
|
4
|
+
* Distinguishes "computed and genuinely empty" from "not computed" so a
|
|
5
|
+
* consumer reading e.g. `rules: []` can tell whether no rules apply versus the
|
|
6
|
+
* prerequisite index was never built. Without this, an empty array reads as
|
|
7
|
+
* "no risks" rather than "risk analysis was skipped".
|
|
8
|
+
*
|
|
9
|
+
* Part of `sharkcraft.context-pack/v1`.
|
|
10
|
+
*/
|
|
11
|
+
export interface IPackCoverage {
|
|
12
|
+
/**
|
|
13
|
+
* True when the rule-graph bridge was present, so `rules` / `paths` /
|
|
14
|
+
* `templates` were actually computed. False means they were OMITTED (run
|
|
15
|
+
* `shrk rule-graph index`) — not that none apply.
|
|
16
|
+
*/
|
|
17
|
+
rulesComputed: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* True when risk analysis ran over the selected file set (requires the code
|
|
20
|
+
* graph). False only when the graph store was missing and an empty pack was
|
|
21
|
+
* returned.
|
|
22
|
+
*/
|
|
23
|
+
risksComputed: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* True when do-not-touch detection ran over the selected file set. Same
|
|
26
|
+
* precondition as `risksComputed`.
|
|
27
|
+
*/
|
|
28
|
+
doNotTouchComputed: boolean;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=pack-coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-coverage.d.ts","sourceRoot":"","sources":["../../src/schema/pack-coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/context-planner",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.21",
|
|
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",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
47
|
-
"@shrkcrft/graph": "^0.1.0-alpha.
|
|
48
|
-
"@shrkcrft/rule-graph": "^0.1.0-alpha.
|
|
46
|
+
"@shrkcrft/core": "^0.1.0-alpha.21",
|
|
47
|
+
"@shrkcrft/graph": "^0.1.0-alpha.21",
|
|
48
|
+
"@shrkcrft/rule-graph": "^0.1.0-alpha.21"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|