@shrkcrft/importer 0.1.0-alpha.16 → 0.1.0-alpha.17
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-cursor-rule.d.ts","sourceRoot":"","sources":["../../src/parse/parse-cursor-rule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"parse-cursor-rule.d.ts","sourceRoot":"","sources":["../../src/parse/parse-cursor-rule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAwDD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,kBAAkB,GAC1B,cAAc,CAqBhB"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { KnowledgePriority, KnowledgeType } from '@shrkcrft/knowledge';
|
|
2
2
|
import { keywordTags, slugify } from "./slugify.js";
|
|
3
3
|
function parseFrontmatter(raw) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
// Normalize CRLF/CR first: otherwise a trailing `\r` breaks the `\n---`
|
|
5
|
+
// separator offset math AND the `key: (.*)$` regex (`$` won't span `\r`),
|
|
6
|
+
// dropping description/globs/tags on a Windows-authored .mdc file.
|
|
7
|
+
const text = raw.replace(/\r\n?/g, '\n');
|
|
8
|
+
if (!text.startsWith('---'))
|
|
9
|
+
return { fm: {}, body: text };
|
|
10
|
+
const end = text.indexOf('\n---', 3);
|
|
7
11
|
if (end < 0)
|
|
8
|
-
return { fm: {}, body:
|
|
9
|
-
const block =
|
|
10
|
-
const body =
|
|
12
|
+
return { fm: {}, body: text };
|
|
13
|
+
const block = text.slice(3, end).trim();
|
|
14
|
+
const body = text.slice(end + 4).replace(/^\n+/, '');
|
|
11
15
|
const fm = {};
|
|
12
16
|
for (const line of block.split('\n')) {
|
|
13
17
|
const m = /^([A-Za-z][\w-]*)\s*:\s*(.*)$/.exec(line);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-markdown-rules.d.ts","sourceRoot":"","sources":["../../src/parse/parse-markdown-rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAkED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC7B,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"parse-markdown-rules.d.ts","sourceRoot":"","sources":["../../src/parse/parse-markdown-rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAkED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC7B,cAAc,EAAE,CAoElB"}
|
|
@@ -68,7 +68,10 @@ function bulletsFromBlock(block) {
|
|
|
68
68
|
}
|
|
69
69
|
export function parseMarkdownRules(raw, options) {
|
|
70
70
|
const entries = [];
|
|
71
|
-
|
|
71
|
+
// Normalize CRLF/CR first: a trailing `\r` on each line makes the heading
|
|
72
|
+
// regex `(.*)$` fail (`.`/`$` don't span `\r`), silently dropping every rule
|
|
73
|
+
// in a Windows/mixed-OS file.
|
|
74
|
+
const lines = raw.replace(/\r\n?/g, '\n').split('\n');
|
|
72
75
|
const sections = [];
|
|
73
76
|
let current = null;
|
|
74
77
|
let paragraph = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/importer",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.17",
|
|
4
4
|
"description": "SharkCraft importer: parse AGENTS.md / CLAUDE.md / .cursor/rules into structured knowledge entries.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
48
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
47
|
+
"@shrkcrft/core": "^0.1.0-alpha.17",
|
|
48
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.17"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|