@infinitedusky/indusk-mcp 1.10.2 → 1.10.3
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/lib/config.d.ts +18 -2
- package/dist/lib/config.js +21 -3
- package/package.json +1 -1
package/dist/lib/config.d.ts
CHANGED
|
@@ -44,12 +44,28 @@ export declare function getConfigPath(projectRoot: string): string;
|
|
|
44
44
|
export declare function readConfig(projectRoot: string): InduskConfig | null;
|
|
45
45
|
export declare function writeConfig(projectRoot: string, config: InduskConfig): void;
|
|
46
46
|
export declare function getPlanningDir(projectRoot: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Sanitize a string into a valid Graphiti group id.
|
|
49
|
+
*
|
|
50
|
+
* Graphiti uses RediSearch under the hood, which treats `-` as a token separator.
|
|
51
|
+
* A query like `chitin-sportsbook` parses as "find chitin, exclude sportsbook" and
|
|
52
|
+
* fails with `Syntax error at offset N near chitin`. Anything that isn't
|
|
53
|
+
* `[A-Za-z0-9_]` gets replaced with `_`. Multiple separators collapse to one.
|
|
54
|
+
*
|
|
55
|
+
* Examples:
|
|
56
|
+
* "chitin-sportsbook" → "chitin_sportsbook"
|
|
57
|
+
* "my.cool.project" → "my_cool_project"
|
|
58
|
+
* "@scope/pkg" → "scope_pkg"
|
|
59
|
+
* "indusk_already_ok" → "indusk_already_ok" (no change)
|
|
60
|
+
*/
|
|
61
|
+
export declare function sanitizeGroupId(raw: string): string;
|
|
47
62
|
/**
|
|
48
63
|
* Get the Graphiti group id for project-specific episodes.
|
|
49
64
|
*
|
|
50
65
|
* Resolution order:
|
|
51
|
-
* 1. .indusk/config.json `graphiti.groupId` if set
|
|
52
|
-
*
|
|
66
|
+
* 1. .indusk/config.json `graphiti.groupId` if set (used as-is, not sanitized —
|
|
67
|
+
* explicit overrides are trusted; if you set a hyphenated id, that's on you)
|
|
68
|
+
* 2. Sanitized project directory basename (`-` → `_`, etc., for RediSearch safety)
|
|
53
69
|
*
|
|
54
70
|
* Use `[getProjectGroupId(root), "shared"]` as the default group_ids list when
|
|
55
71
|
* searching Graphiti — this gives both project-scoped and cross-project knowledge.
|
package/dist/lib/config.js
CHANGED
|
@@ -26,12 +26,30 @@ export function getPlanningDir(projectRoot) {
|
|
|
26
26
|
// Default to new path (will be created by init)
|
|
27
27
|
return newPath;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Sanitize a string into a valid Graphiti group id.
|
|
31
|
+
*
|
|
32
|
+
* Graphiti uses RediSearch under the hood, which treats `-` as a token separator.
|
|
33
|
+
* A query like `chitin-sportsbook` parses as "find chitin, exclude sportsbook" and
|
|
34
|
+
* fails with `Syntax error at offset N near chitin`. Anything that isn't
|
|
35
|
+
* `[A-Za-z0-9_]` gets replaced with `_`. Multiple separators collapse to one.
|
|
36
|
+
*
|
|
37
|
+
* Examples:
|
|
38
|
+
* "chitin-sportsbook" → "chitin_sportsbook"
|
|
39
|
+
* "my.cool.project" → "my_cool_project"
|
|
40
|
+
* "@scope/pkg" → "scope_pkg"
|
|
41
|
+
* "indusk_already_ok" → "indusk_already_ok" (no change)
|
|
42
|
+
*/
|
|
43
|
+
export function sanitizeGroupId(raw) {
|
|
44
|
+
return raw.replace(/[^A-Za-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
|
|
45
|
+
}
|
|
29
46
|
/**
|
|
30
47
|
* Get the Graphiti group id for project-specific episodes.
|
|
31
48
|
*
|
|
32
49
|
* Resolution order:
|
|
33
|
-
* 1. .indusk/config.json `graphiti.groupId` if set
|
|
34
|
-
*
|
|
50
|
+
* 1. .indusk/config.json `graphiti.groupId` if set (used as-is, not sanitized —
|
|
51
|
+
* explicit overrides are trusted; if you set a hyphenated id, that's on you)
|
|
52
|
+
* 2. Sanitized project directory basename (`-` → `_`, etc., for RediSearch safety)
|
|
35
53
|
*
|
|
36
54
|
* Use `[getProjectGroupId(root), "shared"]` as the default group_ids list when
|
|
37
55
|
* searching Graphiti — this gives both project-scoped and cross-project knowledge.
|
|
@@ -40,7 +58,7 @@ export function getProjectGroupId(projectRoot) {
|
|
|
40
58
|
const config = readConfig(projectRoot);
|
|
41
59
|
if (config?.graphiti?.groupId)
|
|
42
60
|
return config.graphiti.groupId;
|
|
43
|
-
return basename(projectRoot);
|
|
61
|
+
return sanitizeGroupId(basename(projectRoot));
|
|
44
62
|
}
|
|
45
63
|
/**
|
|
46
64
|
* Whether the OTel gate should fire for this project.
|