mdkg 0.0.3 → 0.0.4
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/README.md +171 -169
- package/dist/cli.js +980 -624
- package/dist/commands/checkpoint.js +17 -6
- package/dist/commands/event.js +46 -0
- package/dist/commands/event_support.js +146 -0
- package/dist/commands/format.js +6 -7
- package/dist/commands/index.js +10 -4
- package/dist/commands/init.js +198 -16
- package/dist/commands/list.js +18 -1
- package/dist/commands/new.js +30 -5
- package/dist/commands/pack.js +194 -2
- package/dist/commands/query_output.js +84 -0
- package/dist/commands/search.js +22 -5
- package/dist/commands/show.js +26 -11
- package/dist/commands/skill.js +359 -0
- package/dist/commands/skill_support.js +121 -0
- package/dist/commands/task.js +270 -0
- package/dist/commands/validate.js +104 -7
- package/dist/graph/edges.js +2 -2
- package/dist/graph/frontmatter.js +1 -0
- package/dist/graph/indexer.js +21 -0
- package/dist/graph/node.js +20 -4
- package/dist/graph/skills_index_cache.js +94 -0
- package/dist/graph/skills_indexer.js +160 -0
- package/dist/init/core/rule-1-mdkg-conventions.md +9 -2
- package/dist/init/core/rule-3-cli-contract.md +73 -14
- package/dist/init/core/rule-4-repo-safety-and-ignores.md +9 -3
- package/dist/init/core/rule-6-templates-and-schemas.md +6 -2
- package/dist/init/skills/SKILL.md.example +41 -0
- package/dist/init/templates/default/bug.md +1 -0
- package/dist/init/templates/default/chk.md +1 -0
- package/dist/init/templates/default/epic.md +1 -0
- package/dist/init/templates/default/feat.md +1 -0
- package/dist/init/templates/default/task.md +1 -0
- package/dist/init/templates/default/test.md +1 -0
- package/dist/pack/export_md.js +6 -0
- package/dist/pack/export_xml.js +6 -0
- package/dist/pack/pack.js +35 -0
- package/dist/util/argparse.js +25 -0
- package/dist/util/filter.js +18 -0
- package/dist/util/id.js +23 -0
- package/package.json +5 -2
package/dist/util/filter.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.filterNodes = filterNodes;
|
|
4
|
+
function matchesTags(nodeTags, filterTags, mode) {
|
|
5
|
+
if (!filterTags || filterTags.length === 0) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (nodeTags.length === 0) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const nodeSet = new Set(nodeTags.map((value) => value.toLowerCase()));
|
|
12
|
+
if (mode === "all") {
|
|
13
|
+
return filterTags.every((value) => nodeSet.has(value));
|
|
14
|
+
}
|
|
15
|
+
return filterTags.some((value) => nodeSet.has(value));
|
|
16
|
+
}
|
|
4
17
|
function filterNodes(nodes, filters) {
|
|
18
|
+
const normalizedTags = filters.tags?.map((value) => value.toLowerCase()).filter(Boolean) ?? [];
|
|
19
|
+
const tagsMode = filters.tagsMode ?? "any";
|
|
5
20
|
return nodes.filter((node) => {
|
|
6
21
|
if (filters.ws && node.ws !== filters.ws) {
|
|
7
22
|
return false;
|
|
@@ -21,6 +36,9 @@ function filterNodes(nodes, filters) {
|
|
|
21
36
|
if (filters.blocked && node.status !== "blocked") {
|
|
22
37
|
return false;
|
|
23
38
|
}
|
|
39
|
+
if (!matchesTags(node.tags, normalizedTags, tagsMode)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
24
42
|
return true;
|
|
25
43
|
});
|
|
26
44
|
}
|
package/dist/util/id.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCanonicalId = isCanonicalId;
|
|
4
|
+
exports.isCanonicalIdRef = isCanonicalIdRef;
|
|
5
|
+
const NUMERIC_ID_RE = /^[a-z]+-[0-9]+$/;
|
|
6
|
+
const WORKSPACE_RE = /^[a-z][a-z0-9_]*$/;
|
|
7
|
+
const SPECIAL_IDS = new Set(["rule-guide", "rule-soul", "rule-human"]);
|
|
8
|
+
function isCanonicalId(value) {
|
|
9
|
+
return NUMERIC_ID_RE.test(value) || SPECIAL_IDS.has(value);
|
|
10
|
+
}
|
|
11
|
+
function isCanonicalIdRef(value) {
|
|
12
|
+
const normalized = value.toLowerCase();
|
|
13
|
+
const parts = normalized.split(":");
|
|
14
|
+
if (parts.length === 1) {
|
|
15
|
+
return isCanonicalId(parts[0] ?? "");
|
|
16
|
+
}
|
|
17
|
+
if (parts.length !== 2) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const workspace = parts[0] ?? "";
|
|
21
|
+
const id = parts[1] ?? "";
|
|
22
|
+
return WORKSPACE_RE.test(workspace) && isCanonicalId(id);
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdkg",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Markdown Knowledge Graph",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
"build": "tsc -p tsconfig.build.json && node scripts/add-shebang.js && node scripts/copy-init-assets.js",
|
|
11
11
|
"build:test": "tsc -p tsconfig.test.json",
|
|
12
12
|
"test": "npm run build && npm run build:test && node --test dist/tests/**/*.test.js",
|
|
13
|
-
"
|
|
13
|
+
"test:coverage": "npm run build && npm run build:test && node --test --experimental-test-coverage dist/tests/**/*.test.js",
|
|
14
|
+
"smoke:consumer": "npm run build && node scripts/smoke-consumer.js",
|
|
15
|
+
"cli:snapshot": "npm run build && node scripts/cli_help_snapshot.js",
|
|
16
|
+
"cli:check": "npm run build && node scripts/cli_help_snapshot.js --check"
|
|
14
17
|
},
|
|
15
18
|
"devDependencies": {
|
|
16
19
|
"@types/node": "^18.19.0",
|