@opencanon/canon 0.1.0 → 0.1.1
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/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencanon/canon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Canon worldbuilding CLI — scaffold, validate, and manage shared fiction universes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"canon": "
|
|
7
|
+
"canon": "dist/cli.js"
|
|
8
8
|
},
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"!dist/test",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
10
15
|
"exports": {
|
|
11
16
|
".": {
|
|
12
17
|
"import": "./dist/core/index.js",
|
|
@@ -28,7 +33,13 @@
|
|
|
28
33
|
"test": "ls dist/test/*.test.js >/dev/null 2>&1 && node --test dist/test/*.test.js || { echo 'No test files found in dist/test/'; exit 1; }",
|
|
29
34
|
"pretest": "tsc"
|
|
30
35
|
},
|
|
31
|
-
"keywords": [
|
|
36
|
+
"keywords": [
|
|
37
|
+
"worldbuilding",
|
|
38
|
+
"canon",
|
|
39
|
+
"fiction",
|
|
40
|
+
"compliance",
|
|
41
|
+
"opencanon"
|
|
42
|
+
],
|
|
32
43
|
"license": "MIT",
|
|
33
44
|
"engines": {
|
|
34
45
|
"node": ">=18"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/test/hotfix.test.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { execSync } from "node:child_process";
|
|
4
|
-
import { mkdtempSync, mkdirSync, readFileSync, existsSync } from "node:fs";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { tmpdir } from "node:os";
|
|
7
|
-
import { buildRepoModel } from "../adapters/github.js";
|
|
8
|
-
import { checkTimeline } from "../core/validate.js";
|
|
9
|
-
const CLI = join(import.meta.dirname, "..", "cli.js");
|
|
10
|
-
describe("hotfix regressions", () => {
|
|
11
|
-
it("check exits 1 when 0 stories found", () => {
|
|
12
|
-
const tmp = mkdtempSync(join(tmpdir(), "canon-empty-"));
|
|
13
|
-
mkdirSync(join(tmp, "stories"), { recursive: true });
|
|
14
|
-
const result = (() => {
|
|
15
|
-
try {
|
|
16
|
-
execSync(`node ${CLI} check ${tmp}`, { encoding: "utf-8", stdio: "pipe" });
|
|
17
|
-
return { code: 0 };
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
return { code: e.status, stderr: e.stderr };
|
|
21
|
-
}
|
|
22
|
-
})();
|
|
23
|
-
assert.equal(result.code, 1);
|
|
24
|
-
});
|
|
25
|
-
it("github adapter parses canon/characters/alice.json blob", () => {
|
|
26
|
-
const input = {
|
|
27
|
-
tree: [
|
|
28
|
-
{ path: "canon/characters/alice.json", type: "blob", sha: "aaa" },
|
|
29
|
-
{ path: "canon/characters/bob", type: "tree", sha: "bbb" },
|
|
30
|
-
{ path: "canon/characters/index.json", type: "blob", sha: "ccc" },
|
|
31
|
-
{ path: "stories/ep01", type: "tree", sha: "ddd" },
|
|
32
|
-
],
|
|
33
|
-
files: new Map([
|
|
34
|
-
["stories/ep01/metadata.json", JSON.stringify({
|
|
35
|
-
schema_version: "1.1", canon_ref: "abc", id: "ep01", episode: 1,
|
|
36
|
-
title: { ko: "t", en: "t" }, timeline: "2025-01-01",
|
|
37
|
-
synopsis: { ko: "s", en: "s" }, characters: ["alice", "bob"],
|
|
38
|
-
locations: [], canon_status: "canonical",
|
|
39
|
-
})],
|
|
40
|
-
]),
|
|
41
|
-
};
|
|
42
|
-
const model = buildRepoModel(input);
|
|
43
|
-
assert.ok(model.characters.has("alice"), "alice.json blob should be parsed");
|
|
44
|
-
assert.ok(model.characters.has("bob"), "bob/ dir should be parsed");
|
|
45
|
-
assert.ok(!model.characters.has("index"), "index should be excluded");
|
|
46
|
-
});
|
|
47
|
-
it("timeline rejects 2025-02-30 and 2025-01-01junk", () => {
|
|
48
|
-
const feb30 = checkTimeline({ timeline: "2025-02-30" });
|
|
49
|
-
assert.equal(feb30.pass, false, "2025-02-30 should fail");
|
|
50
|
-
const junk = checkTimeline({ timeline: "2025-01-01junk" });
|
|
51
|
-
assert.equal(junk.pass, false, "2025-01-01junk should fail");
|
|
52
|
-
const valid = checkTimeline({ timeline: "2025-03-15" });
|
|
53
|
-
assert.equal(valid.pass, true, "2025-03-15 should pass");
|
|
54
|
-
});
|
|
55
|
-
it("init creates .canonrc.json but not canon.lock.json", () => {
|
|
56
|
-
const tmp = mkdtempSync(join(tmpdir(), "canon-init-"));
|
|
57
|
-
execSync(`node ${CLI} init ${tmp}`, { encoding: "utf-8", stdio: "pipe" });
|
|
58
|
-
assert.ok(existsSync(join(tmp, ".canonrc.json")), ".canonrc.json should exist");
|
|
59
|
-
assert.ok(!existsSync(join(tmp, "canon.lock.json")), "canon.lock.json should NOT exist");
|
|
60
|
-
const rc = JSON.parse(readFileSync(join(tmp, ".canonrc.json"), "utf-8"));
|
|
61
|
-
assert.equal(rc.schema_version, "canonrc.v1");
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=hotfix.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hotfix.test.js","sourceRoot":"","sources":["../../src/test/hotfix.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAiB,YAAY,EAAE,UAAU,EAAE,MAAM,SA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