chapterhouse 0.3.14 → 0.3.16
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/config.js +12 -1
- package/dist/copilot/system-message.js +7 -0
- package/dist/copilot/tools.js +81 -76
- package/dist/copilot/tools.wiki.test.js +143 -0
- package/dist/daemon.js +6 -0
- package/dist/wiki/frontmatter.js +148 -0
- package/dist/wiki/frontmatter.test.js +109 -0
- package/dist/wiki/fs.js +8 -3
- package/dist/wiki/fs.test.js +3 -2
- package/dist/wiki/index-manager.js +106 -49
- package/dist/wiki/index-manager.test.js +22 -3
- package/dist/wiki/lint.js +424 -0
- package/dist/wiki/lint.test.js +260 -0
- package/dist/wiki/log-manager.js +52 -9
- package/dist/wiki/log-manager.test.js +47 -0
- package/dist/wiki/migrate-topics.js +132 -0
- package/dist/wiki/migrate-topics.test.js +57 -0
- package/dist/wiki/taxonomy.js +73 -0
- package/dist/wiki/taxonomy.test.js +70 -0
- package/dist/wiki/topic-structure.js +167 -0
- package/dist/wiki/topic-structure.test.js +74 -0
- package/package.json +1 -1
- package/web/dist/assets/{index-BlIWCM11.js → index-BYuMgJ36.js} +61 -61
- package/web/dist/assets/index-BYuMgJ36.js.map +1 -0
- package/web/dist/index.html +1 -1
- package/web/dist/assets/index-BlIWCM11.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { getCategoryDir, slugify, topicPagePath, validateTopicPath, topicPathError, } from "./topic-structure.js";
|
|
4
|
+
test("getCategoryDir maps category names to directories", () => {
|
|
5
|
+
assert.equal(getCategoryDir("project"), "projects");
|
|
6
|
+
assert.equal(getCategoryDir("projects"), "projects");
|
|
7
|
+
assert.equal(getCategoryDir("person"), "people");
|
|
8
|
+
assert.equal(getCategoryDir("org"), "orgs");
|
|
9
|
+
assert.equal(getCategoryDir("tool"), "tools");
|
|
10
|
+
assert.equal(getCategoryDir("topic"), "topics");
|
|
11
|
+
assert.equal(getCategoryDir("area"), "areas");
|
|
12
|
+
assert.equal(getCategoryDir("decision"), "decisions");
|
|
13
|
+
assert.equal(getCategoryDir("preference"), "preferences");
|
|
14
|
+
});
|
|
15
|
+
test("slugify normalizes free text into a safe path segment", () => {
|
|
16
|
+
assert.equal(slugify("Chapter House!"), "chapter-house");
|
|
17
|
+
assert.equal(slugify(" --Foo_Bar-- "), "foo-bar");
|
|
18
|
+
assert.equal(slugify("v0.3.14"), "v0-3-14");
|
|
19
|
+
assert.equal(slugify("!!!"), "untitled");
|
|
20
|
+
});
|
|
21
|
+
test("topicPagePath builds canonical paths", () => {
|
|
22
|
+
assert.equal(topicPagePath("project", "Chapterhouse"), "pages/projects/chapterhouse/index.md");
|
|
23
|
+
assert.equal(topicPagePath("project", "Chapterhouse", "decisions"), "pages/projects/chapterhouse/decisions.md");
|
|
24
|
+
assert.equal(topicPagePath("person", "Brian K"), "pages/people/brian-k/index.md");
|
|
25
|
+
assert.equal(topicPagePath("tool", "Kubernetes"), "pages/tools/kubernetes/index.md");
|
|
26
|
+
});
|
|
27
|
+
test("validateTopicPath accepts canonical and exempt paths", () => {
|
|
28
|
+
assert.deepEqual(validateTopicPath("pages/projects/chapterhouse/index.md"), { ok: true });
|
|
29
|
+
assert.deepEqual(validateTopicPath("pages/projects/chapterhouse/decisions.md"), { ok: true });
|
|
30
|
+
assert.deepEqual(validateTopicPath("pages/people/brian/index.md"), { ok: true });
|
|
31
|
+
assert.deepEqual(validateTopicPath("pages/preferences.md"), { ok: true });
|
|
32
|
+
assert.deepEqual(validateTopicPath("pages/facts.md"), { ok: true });
|
|
33
|
+
assert.deepEqual(validateTopicPath("pages/conversations/2026-05-12.md"), { ok: true });
|
|
34
|
+
assert.deepEqual(validateTopicPath("pages/team/onboarding.md"), { ok: true });
|
|
35
|
+
assert.deepEqual(validateTopicPath("pages/okrs/2026-Q2.md"), { ok: true });
|
|
36
|
+
});
|
|
37
|
+
test("validateTopicPath rejects a bare entity-category file and suggests the topic index", () => {
|
|
38
|
+
const r = validateTopicPath("pages/projects/chapterhouse.md");
|
|
39
|
+
assert.equal(r.ok, false);
|
|
40
|
+
assert.equal(r.ok === false && r.suggestion, "pages/projects/chapterhouse/index.md");
|
|
41
|
+
});
|
|
42
|
+
test("validateTopicPath rejects entity paths that nest too deep", () => {
|
|
43
|
+
const r = validateTopicPath("pages/projects/chapterhouse/sub/deep.md");
|
|
44
|
+
assert.equal(r.ok, false);
|
|
45
|
+
assert.equal(r.ok === false && r.suggestion, "pages/projects/chapterhouse/deep.md");
|
|
46
|
+
});
|
|
47
|
+
test("validateTopicPath rejects a flat category used as a directory", () => {
|
|
48
|
+
const r = validateTopicPath("pages/preferences/foo.md");
|
|
49
|
+
assert.equal(r.ok, false);
|
|
50
|
+
assert.equal(r.ok === false && r.suggestion, "pages/preferences.md");
|
|
51
|
+
});
|
|
52
|
+
test("validateTopicPath treats `decisions` as an entity facet, not a flat page", () => {
|
|
53
|
+
// A standalone pages/decisions.md is no longer valid…
|
|
54
|
+
assert.equal(validateTopicPath("pages/decisions.md").ok, false);
|
|
55
|
+
// …decisions live as a facet under the entity they concern.
|
|
56
|
+
assert.deepEqual(validateTopicPath("pages/projects/chapterhouse/decisions.md"), { ok: true });
|
|
57
|
+
assert.deepEqual(validateTopicPath("pages/tools/kubernetes/decisions.md"), { ok: true });
|
|
58
|
+
});
|
|
59
|
+
test("validateTopicPath rejects unknown top-level categories", () => {
|
|
60
|
+
const r = validateTopicPath("pages/randomstuff/foo.md");
|
|
61
|
+
assert.equal(r.ok, false);
|
|
62
|
+
assert.match(r.ok === false ? r.reason : "", /not a recognized wiki category/);
|
|
63
|
+
});
|
|
64
|
+
test("validateTopicPath rejects non-slug topic or page names", () => {
|
|
65
|
+
const r = validateTopicPath("pages/projects/Chapter House/index.md");
|
|
66
|
+
assert.equal(r.ok, false);
|
|
67
|
+
assert.equal(r.ok === false && r.suggestion, "pages/projects/chapter-house/index.md");
|
|
68
|
+
});
|
|
69
|
+
test("topicPathError returns a message for invalid paths and undefined for valid ones", () => {
|
|
70
|
+
assert.equal(topicPathError("pages/projects/chapterhouse/index.md"), undefined);
|
|
71
|
+
assert.equal(topicPathError("pages/preferences.md"), undefined);
|
|
72
|
+
assert.match(String(topicPathError("pages/projects/chapterhouse.md")), /Use: pages\/projects\/chapterhouse\/index\.md/);
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=topic-structure.test.js.map
|
package/package.json
CHANGED