@shrkcrft/rules 0.1.0-alpha.29 → 0.1.0-alpha.31
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/is-rule-entry.d.ts +13 -0
- package/dist/is-rule-entry.d.ts.map +1 -0
- package/dist/is-rule-entry.js +14 -0
- package/dist/rule-service.d.ts.map +1 -1
- package/dist/rule-service.js +3 -2
- package/package.json +3 -3
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,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type IKnowledgeEntry } from '@shrkcrft/knowledge';
|
|
2
|
+
/**
|
|
3
|
+
* THE "is this knowledge entry a rule?" predicate.
|
|
4
|
+
*
|
|
5
|
+
* A rule is a knowledge entry with `type: 'rule'` — from any loader (TypeScript
|
|
6
|
+
* or Markdown), local or pack. `shrk rules list` (RuleService) and the custom
|
|
7
|
+
* checks registry (`shrk checks`) both read this one function, so the rules a
|
|
8
|
+
* user sees listed are exactly the rules whose `metadata.checks[]` are scanned.
|
|
9
|
+
* They used to be two private copies of the same comparison, agreeing only by
|
|
10
|
+
* coincidence.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isRuleEntry(entry: Pick<IKnowledgeEntry, 'type'>): boolean;
|
|
13
|
+
//# sourceMappingURL=is-rule-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-rule-entry.d.ts","sourceRoot":"","sources":["../src/is-rule-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,OAAO,CAEzE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { KnowledgeType } from '@shrkcrft/knowledge';
|
|
2
|
+
/**
|
|
3
|
+
* THE "is this knowledge entry a rule?" predicate.
|
|
4
|
+
*
|
|
5
|
+
* A rule is a knowledge entry with `type: 'rule'` — from any loader (TypeScript
|
|
6
|
+
* or Markdown), local or pack. `shrk rules list` (RuleService) and the custom
|
|
7
|
+
* checks registry (`shrk checks`) both read this one function, so the rules a
|
|
8
|
+
* user sees listed are exactly the rules whose `metadata.checks[]` are scanned.
|
|
9
|
+
* They used to be two private copies of the same comparison, agreeing only by
|
|
10
|
+
* coincidence.
|
|
11
|
+
*/
|
|
12
|
+
export function isRuleEntry(entry) {
|
|
13
|
+
return String(entry.type) === KnowledgeType.Rule;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-service.d.ts","sourceRoot":"","sources":["../src/rule-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"rule-service.d.ts","sourceRoot":"","sources":["../src/rule-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;gBAE3B,OAAO,EAAE,SAAS,eAAe,EAAE;IAI/C,IAAI,IAAI,KAAK,EAAE;IAIf,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAM7B,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,EAAE;IAalC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,KAAK,EAAE;CAGtE"}
|
package/dist/rule-service.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { KnowledgeIndex, KnowledgeType } from '@shrkcrft/knowledge';
|
|
2
|
+
import { isRuleEntry } from "./is-rule-entry.js";
|
|
2
3
|
export class RuleService {
|
|
3
4
|
index;
|
|
4
5
|
constructor(entries) {
|
|
5
6
|
this.index = new KnowledgeIndex(entries);
|
|
6
7
|
}
|
|
7
8
|
list() {
|
|
8
|
-
return this.index.filter((e) =>
|
|
9
|
+
return this.index.filter((e) => isRuleEntry(e));
|
|
9
10
|
}
|
|
10
11
|
get(id) {
|
|
11
12
|
const entry = this.index.get(id);
|
|
12
|
-
if (!entry ||
|
|
13
|
+
if (!entry || !isRuleEntry(entry))
|
|
13
14
|
return null;
|
|
14
15
|
return entry;
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/rules",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.31",
|
|
4
4
|
"description": "SharkCraft rules service: typed rule entries, relevance lookup, AI formatting.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
47
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
46
|
+
"@shrkcrft/core": "^0.1.0-alpha.31",
|
|
47
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.31"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|