@geml/geml 1.6.0 → 1.7.0
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/codemap/browser-stub.mjs +5 -0
- package/codemap/verify.mjs +10 -3
- package/dist/chart.d.ts +1 -0
- package/dist/chart.js +4 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js +16 -0
- package/dist/geml.d.ts +5 -1
- package/dist/geml.js +790 -35
- package/dist/mcp.js +23 -2
- package/dist/render-html.d.ts +5 -0
- package/dist/render-html.js +10 -1
- package/dist/render.d.ts +1 -0
- package/dist/render.js +36 -0
- package/dist/serialize.js +12 -0
- package/dist/table.js +27 -1
- package/dist/to-md.js +5 -0
- package/package.json +2 -1
- package/skill/SKILL.md +82 -0
- package/skill/references/authoring.geml +333 -0
package/codemap/browser-stub.mjs
CHANGED
|
@@ -12,6 +12,9 @@ export const writeFileSync = () => {};
|
|
|
12
12
|
export const existsSync = () => false;
|
|
13
13
|
export const realpathSync = (p) => p;
|
|
14
14
|
export const statSync = () => ({ isDirectory: () => false });
|
|
15
|
+
export const mkdirSync = () => {};
|
|
16
|
+
export const readdirSync = () => [];
|
|
17
|
+
export const copyFileSync = () => {};
|
|
15
18
|
export const basename = (p) => p;
|
|
16
19
|
export const dirname = (p) => p;
|
|
17
20
|
export const resolve = (...p) => p.join("/");
|
|
@@ -21,6 +24,8 @@ export const relative = (_from, to) => to;
|
|
|
21
24
|
export const sep = "/";
|
|
22
25
|
export const fileURLToPath = (u) => String(u);
|
|
23
26
|
export const spawnSync = () => ({ status: 1 });
|
|
27
|
+
// node:os — `geml skill install` resolves the home directory; CLI-only.
|
|
28
|
+
export const homedir = () => "/";
|
|
24
29
|
export const createHash = () => ({
|
|
25
30
|
update() { return this; },
|
|
26
31
|
digest() { return ""; },
|
package/codemap/verify.mjs
CHANGED
|
@@ -39,16 +39,23 @@ if (!cli) cli = existsSync(localParser) ? localParser : "geml";
|
|
|
39
39
|
// CRT rules for embedded " / trailing \.
|
|
40
40
|
const q = (s) => (/[\s"]/.test(String(s)) ? `"${String(s).replace(/"/g, '\\"')}"` : String(s));
|
|
41
41
|
const shq = (s) => `"${String(s).replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, '$1$1')}"`;
|
|
42
|
+
// A codemap document's `src=` routes are written relative to the indexed
|
|
43
|
+
// SOURCE root (`geml-parser/src/attrs.ts` from a document two levels down), so
|
|
44
|
+
// checking one has to be told that root — the same value `serve` derives, from
|
|
45
|
+
// the recorded recipe, falling back to the parent of the graph directory.
|
|
46
|
+
let srcRoot = resolve(rootDir, "..");
|
|
47
|
+
try { srcRoot = resolve(rootDir, JSON.parse(readFileSync(join(rootDir, "_index", "refresh.json"), "utf8")).root ?? ".."); } catch { /* no recipe: parent */ }
|
|
48
|
+
const checkArgs = (file) => ["check", "--root", srcRoot, file];
|
|
42
49
|
const runCheck = (file) => {
|
|
43
50
|
// The built-parser path: run node on geml.js directly (array args, no shell).
|
|
44
|
-
if (cli.endsWith(".js")) return spawnSync(process.execPath, [cli,
|
|
51
|
+
if (cli.endsWith(".js")) return spawnSync(process.execPath, [cli, ...checkArgs(file)], { encoding: "utf8" });
|
|
45
52
|
// A non-.js cli may be a .cmd/.bat launcher (e.g. geml.cmd on PATH), which
|
|
46
53
|
// Node can only spawn through the shell. Hand cmd.exe ONE pre-escaped command
|
|
47
54
|
// string (never an args array — that is the unescaped, injection-prone path).
|
|
48
55
|
if (process.platform === "win32") {
|
|
49
|
-
return spawnSync([q(cli), ...
|
|
56
|
+
return spawnSync([q(cli), ...checkArgs(file).map(shq)].join(" "), { encoding: "utf8", shell: true });
|
|
50
57
|
}
|
|
51
|
-
return spawnSync(cli,
|
|
58
|
+
return spawnSync(cli, checkArgs(file), { encoding: "utf8" });
|
|
52
59
|
};
|
|
53
60
|
if (!existsSync(localParser)) {
|
|
54
61
|
console.error("verify: the profile pass needs the built parser (cd geml-parser && npm install && npm run build)");
|
package/dist/chart.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type Value } from "./attrs.js";
|
|
|
3
3
|
import { type TableModel } from "./table.js";
|
|
4
4
|
export type ChartType = "bar" | "line" | "area" | "pie" | "scatter";
|
|
5
5
|
export type RowScope = "data" | "all" | "summary";
|
|
6
|
+
export declare const USES: Record<ChartType, Set<string>>;
|
|
6
7
|
export interface ChartDataset {
|
|
7
8
|
categories: string[];
|
|
8
9
|
numbers: Record<string, number[]>;
|
package/dist/chart.js
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
// doc and §7.
|
|
9
9
|
const TYPES = new Set(["bar", "line", "area", "pie", "scatter"]);
|
|
10
10
|
// Channels each type can use; supplying any other is a warning (ignored).
|
|
11
|
-
|
|
11
|
+
// Exported for the record-array projection (GEP-0005): it must validate only
|
|
12
|
+
// the channels the chart TYPE actually reads, matching buildChart's leniency
|
|
13
|
+
// (an unused channel is a warning here, so it must not be an error there).
|
|
14
|
+
export const USES = {
|
|
12
15
|
bar: new Set(["x", "y", "series"]),
|
|
13
16
|
line: new Set(["x", "y", "series"]),
|
|
14
17
|
area: new Set(["x", "y", "series"]),
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type DiagnosticCode = "unterminated-block" | "unknown-block-type" | "unknown-attribute" | "block-nesting-too-deep" | "list-nesting-too-deep" | "inline-nesting-too-deep" | "duplicate-id" | "unresolved-reference" | "unresolved-footnote" | "unresolved-cross-document-reference" | "unresolvable-document" | "unchecked-cross-document-reference" | "embed-missing-src" | "ignored-embed-body" | "transclusion-cycle" | "embed-target-not-geml" | "media-target-is-document" | "inline-transclusion-not-inline" | "unsafe-embed-scheme" | "unresolvable-table-source" | "table-source-not-a-table" | "unknown-metadata-reference" | "table-src-and-body" | "unknown-table-format" | "bad-compute-formula" | "unlexable-compute-formula" | "compute-error" | "compute-non-numeric-cell" | "compute-not-a-number" | "bad-summary-entry" | "summary-unknown-column" | "unlexable-summary-expression" | "summary-error" | "unknown-diagram-format" | "ignored-diagram-body" | "code-graph-missing-src" | "code-graph-unresolvable-document" | "chart-missing-data" | "chart-data-not-a-table" | "chart-missing-type" | "chart-unknown-type" | "chart-unknown-rows-scope" | "chart-missing-channel" | "chart-empty-channel" | "chart-unknown-column" | "chart-unused-channel" | "chart-missing-summary-row" | "chart-summary-row-unavailable" | "chart-non-numeric-value";
|
|
1
|
+
export type DiagnosticCode = "unterminated-block" | "unknown-block-type" | "unknown-attribute" | "block-nesting-too-deep" | "list-nesting-too-deep" | "inline-nesting-too-deep" | "stray-labeled-fence" | "fence-like-line" | "unresolvable-code-source" | "bad-code-source" | "bad-source-range" | "stale-code-snapshot" | "duplicate-id" | "unresolved-reference" | "unresolved-footnote" | "unresolved-cross-document-reference" | "unresolvable-document" | "unchecked-cross-document-reference" | "embed-missing-src" | "ignored-embed-body" | "transclusion-cycle" | "embed-target-not-geml" | "media-target-is-document" | "inline-transclusion-not-inline" | "unsafe-embed-scheme" | "unresolvable-table-source" | "table-source-not-a-table" | "unknown-metadata-reference" | "table-src-and-body" | "unknown-table-format" | "bad-table-delimiter" | "ignored-table-delimiter" | "bad-compute-formula" | "unlexable-compute-formula" | "compute-error" | "compute-non-numeric-cell" | "compute-not-a-number" | "bad-summary-entry" | "summary-unknown-column" | "unlexable-summary-expression" | "summary-error" | "unknown-diagram-format" | "ignored-diagram-body" | "code-graph-missing-src" | "code-graph-unresolvable-document" | "chart-missing-data" | "chart-data-not-a-table" | "chart-missing-type" | "chart-unknown-type" | "chart-unknown-rows-scope" | "chart-missing-channel" | "chart-empty-channel" | "chart-unknown-column" | "chart-unused-channel" | "chart-missing-summary-row" | "chart-summary-row-unavailable" | "chart-non-numeric-value" | "chart-data-not-records" | "data-parse" | "unknown-data-format" | "data-format-no-engine" | "bad-data-schema" | "data-src-and-body" | "bad-data-source" | "unresolvable-data-source";
|
|
2
2
|
export interface Diagnostic {
|
|
3
3
|
severity: "error" | "warning";
|
|
4
4
|
code: DiagnosticCode;
|
package/dist/diagnostics.js
CHANGED
|
@@ -19,6 +19,12 @@ export const SEVERITY = {
|
|
|
19
19
|
"block-nesting-too-deep": "error",
|
|
20
20
|
"list-nesting-too-deep": "error",
|
|
21
21
|
"inline-nesting-too-deep": "error",
|
|
22
|
+
"stray-labeled-fence": "warning",
|
|
23
|
+
"fence-like-line": "warning",
|
|
24
|
+
"unresolvable-code-source": "warning",
|
|
25
|
+
"bad-code-source": "error",
|
|
26
|
+
"bad-source-range": "error",
|
|
27
|
+
"stale-code-snapshot": "warning",
|
|
22
28
|
"duplicate-id": "error",
|
|
23
29
|
"unresolved-reference": "error",
|
|
24
30
|
"unresolved-footnote": "error",
|
|
@@ -37,6 +43,8 @@ export const SEVERITY = {
|
|
|
37
43
|
"unknown-metadata-reference": "error",
|
|
38
44
|
"table-src-and-body": "error",
|
|
39
45
|
"unknown-table-format": "warning",
|
|
46
|
+
"bad-table-delimiter": "error",
|
|
47
|
+
"ignored-table-delimiter": "warning",
|
|
40
48
|
"bad-compute-formula": "error",
|
|
41
49
|
"unlexable-compute-formula": "error",
|
|
42
50
|
"compute-error": "error",
|
|
@@ -62,6 +70,14 @@ export const SEVERITY = {
|
|
|
62
70
|
"chart-missing-summary-row": "error",
|
|
63
71
|
"chart-summary-row-unavailable": "warning",
|
|
64
72
|
"chart-non-numeric-value": "error",
|
|
73
|
+
"chart-data-not-records": "error",
|
|
74
|
+
"data-parse": "error",
|
|
75
|
+
"unknown-data-format": "warning",
|
|
76
|
+
"data-format-no-engine": "warning",
|
|
77
|
+
"bad-data-schema": "error",
|
|
78
|
+
"data-src-and-body": "error",
|
|
79
|
+
"bad-data-source": "error",
|
|
80
|
+
"unresolvable-data-source": "error",
|
|
65
81
|
};
|
|
66
82
|
// ---------------------------------------------------------------------------
|
|
67
83
|
// Source normalization (spec §0)
|
package/dist/geml.d.ts
CHANGED
|
@@ -8,11 +8,14 @@ export { type Value } from "./attrs.js";
|
|
|
8
8
|
export { type Inline } from "./inline.js";
|
|
9
9
|
export { type TableModel } from "./table.js";
|
|
10
10
|
export { mdToGeml, type ConvertResult } from "./from-md.js";
|
|
11
|
-
export { renderHtml } from "./render-html.js";
|
|
11
|
+
export { renderHtml, pageAssets } from "./render-html.js";
|
|
12
12
|
export { type RenderOptions } from "./render.js";
|
|
13
13
|
export { serialize } from "./serialize.js";
|
|
14
14
|
export { gemlToMd } from "./to-md.js";
|
|
15
15
|
export type BodyMode = "raw" | "flow" | "data";
|
|
16
|
+
export type DataValue = null | boolean | number | string | DataValue[] | {
|
|
17
|
+
[key: string]: DataValue;
|
|
18
|
+
};
|
|
16
19
|
export interface ListItem {
|
|
17
20
|
text: string;
|
|
18
21
|
inlines: Inline[];
|
|
@@ -53,6 +56,7 @@ export type Block = {
|
|
|
53
56
|
data?: Record<string, Value>;
|
|
54
57
|
table?: TableModel;
|
|
55
58
|
chart?: ChartModel;
|
|
59
|
+
value?: DataValue;
|
|
56
60
|
hidden?: boolean;
|
|
57
61
|
};
|
|
58
62
|
export { type Diagnostic, type DiagnosticCode, SEVERITY } from "./diagnostics.js";
|