@commentray/core 0.0.1 → 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/dist/anchors.d.ts +6 -0
- package/dist/anchors.d.ts.map +1 -1
- package/dist/anchors.js +11 -0
- package/dist/anchors.js.map +1 -1
- package/dist/angles-toml.d.ts +18 -0
- package/dist/angles-toml.d.ts.map +1 -0
- package/dist/angles-toml.js +62 -0
- package/dist/angles-toml.js.map +1 -0
- package/dist/angles.d.ts +6 -0
- package/dist/angles.d.ts.map +1 -0
- package/dist/angles.js +14 -0
- package/dist/angles.js.map +1 -0
- package/dist/block-scroll-pickers.d.ts +22 -0
- package/dist/block-scroll-pickers.d.ts.map +1 -0
- package/dist/block-scroll-pickers.js +41 -0
- package/dist/block-scroll-pickers.js.map +1 -0
- package/dist/block-snippet.d.ts +13 -0
- package/dist/block-snippet.d.ts.map +1 -0
- package/dist/block-snippet.js +30 -0
- package/dist/block-snippet.js.map +1 -0
- package/dist/blocks.d.ts +66 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +101 -0
- package/dist/blocks.js.map +1 -0
- package/dist/commentray-index-renames.d.ts +21 -0
- package/dist/commentray-index-renames.d.ts.map +1 -0
- package/dist/commentray-index-renames.js +85 -0
- package/dist/commentray-index-renames.js.map +1 -0
- package/dist/commentray-path-resolution.d.ts +20 -0
- package/dist/commentray-path-resolution.d.ts.map +1 -0
- package/dist/commentray-path-resolution.js +38 -0
- package/dist/commentray-path-resolution.js.map +1 -0
- package/dist/config.d.ts +48 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +72 -6
- package/dist/config.js.map +1 -1
- package/dist/github-url.d.ts +14 -0
- package/dist/github-url.d.ts.map +1 -0
- package/dist/github-url.js +25 -0
- package/dist/github-url.js.map +1 -0
- package/dist/index-normalize.d.ts +10 -0
- package/dist/index-normalize.d.ts.map +1 -0
- package/dist/index-normalize.js +60 -0
- package/dist/index-normalize.js.map +1 -0
- package/dist/index-schema-messages.d.ts +6 -0
- package/dist/index-schema-messages.d.ts.map +1 -0
- package/dist/index-schema-messages.js +26 -0
- package/dist/index-schema-messages.js.map +1 -0
- package/dist/index.d.ts +25 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/marker-ids.d.ts +19 -0
- package/dist/marker-ids.d.ts.map +1 -0
- package/dist/marker-ids.js +38 -0
- package/dist/marker-ids.js.map +1 -0
- package/dist/marker-validation.d.ts +22 -0
- package/dist/marker-validation.d.ts.map +1 -0
- package/dist/marker-validation.js +138 -0
- package/dist/marker-validation.js.map +1 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +84 -29
- package/dist/metadata.js.map +1 -1
- package/dist/migrate.d.ts.map +1 -1
- package/dist/migrate.js +52 -14
- package/dist/migrate.js.map +1 -1
- package/dist/model.d.ts +24 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +17 -1
- package/dist/model.js.map +1 -1
- package/dist/paths.d.ts +18 -2
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +34 -3
- package/dist/paths.js.map +1 -1
- package/dist/region-marker-convert.d.ts +27 -0
- package/dist/region-marker-convert.d.ts.map +1 -0
- package/dist/region-marker-convert.js +78 -0
- package/dist/region-marker-convert.js.map +1 -0
- package/dist/scm/git-scm-provider.d.ts +7 -1
- package/dist/scm/git-scm-provider.d.ts.map +1 -1
- package/dist/scm/git-scm-provider.js +42 -0
- package/dist/scm/git-scm-provider.js.map +1 -1
- package/dist/scm/scm-provider.d.ts +10 -0
- package/dist/scm/scm-provider.d.ts.map +1 -1
- package/dist/scroll-sync.d.ts +12 -0
- package/dist/scroll-sync.d.ts.map +1 -0
- package/dist/scroll-sync.js +59 -0
- package/dist/scroll-sync.js.map +1 -0
- package/dist/source-markers.d.ts +28 -0
- package/dist/source-markers.d.ts.map +1 -0
- package/dist/source-markers.js +241 -0
- package/dist/source-markers.js.map +1 -0
- package/dist/validate-project.d.ts +15 -1
- package/dist/validate-project.d.ts.map +1 -1
- package/dist/validate-project.js +87 -14
- package/dist/validate-project.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ResolvedCommentrayConfig } from "./config.js";
|
|
2
|
+
/**
|
|
3
|
+
* When Angles layout is on and the user has not configured a default, tools pick this id so a
|
|
4
|
+
* concrete file path exists (`…/main.md`). Authors may rename via `[angles]` in `.commentray.toml`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FALLBACK_DEFAULT_ANGLE_ID: "main";
|
|
7
|
+
export declare function defaultAngleIdForOpen(config: ResolvedCommentrayConfig): string;
|
|
8
|
+
export type ResolvedCommentrayMarkdownPath = {
|
|
9
|
+
/** Repo-relative path to the paired `.md` file. */
|
|
10
|
+
commentrayPath: string;
|
|
11
|
+
/** Present when `{storage}/source/.default` exists (Angles layout). */
|
|
12
|
+
angleId: string | null;
|
|
13
|
+
anglesLayout: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the commentray Markdown path for a primary source file, honoring Angles layout and
|
|
17
|
+
* optional explicit `angleId` (when Angles layout is active).
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveCommentrayMarkdownPath(repoRoot: string, sourceRepoRelativePath: string, config: ResolvedCommentrayConfig, angleId?: string | null): ResolvedCommentrayMarkdownPath;
|
|
20
|
+
//# sourceMappingURL=commentray-path-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commentray-path-resolution.d.ts","sourceRoot":"","sources":["../src/commentray-path-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAQ5D;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAG,MAAe,CAAC;AAEzD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM,CAK9E;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,MAAM,EAC9B,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACtB,8BAA8B,CAkBhC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { assertValidAngleId } from "./angles.js";
|
|
2
|
+
import { commentrayAnglesLayoutEnabled, commentrayMarkdownPath, commentrayMarkdownPathForAngle, } from "./paths.js";
|
|
3
|
+
/**
|
|
4
|
+
* When Angles layout is on and the user has not configured a default, tools pick this id so a
|
|
5
|
+
* concrete file path exists (`…/main.md`). Authors may rename via `[angles]` in `.commentray.toml`.
|
|
6
|
+
*/
|
|
7
|
+
export const FALLBACK_DEFAULT_ANGLE_ID = "main";
|
|
8
|
+
export function defaultAngleIdForOpen(config) {
|
|
9
|
+
if (config.angles.defaultAngleId)
|
|
10
|
+
return config.angles.defaultAngleId;
|
|
11
|
+
const first = config.angles.definitions[0];
|
|
12
|
+
if (first)
|
|
13
|
+
return first.id;
|
|
14
|
+
return FALLBACK_DEFAULT_ANGLE_ID;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the commentray Markdown path for a primary source file, honoring Angles layout and
|
|
18
|
+
* optional explicit `angleId` (when Angles layout is active).
|
|
19
|
+
*/
|
|
20
|
+
export function resolveCommentrayMarkdownPath(repoRoot, sourceRepoRelativePath, config, angleId) {
|
|
21
|
+
const anglesLayout = commentrayAnglesLayoutEnabled(repoRoot, config.storageDir);
|
|
22
|
+
if (!anglesLayout) {
|
|
23
|
+
return {
|
|
24
|
+
commentrayPath: commentrayMarkdownPath(sourceRepoRelativePath, config.storageDir),
|
|
25
|
+
angleId: null,
|
|
26
|
+
anglesLayout: false,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const id = angleId !== undefined && angleId !== null && String(angleId).trim() !== ""
|
|
30
|
+
? assertValidAngleId(String(angleId))
|
|
31
|
+
: defaultAngleIdForOpen(config);
|
|
32
|
+
return {
|
|
33
|
+
commentrayPath: commentrayMarkdownPathForAngle(sourceRepoRelativePath, id, config.storageDir),
|
|
34
|
+
angleId: id,
|
|
35
|
+
anglesLayout: true,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=commentray-path-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commentray-path-resolution.js","sourceRoot":"","sources":["../src/commentray-path-resolution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAe,CAAC;AAEzD,MAAM,UAAU,qBAAqB,CAAC,MAAgC;IACpE,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;IACtE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC;IAC3B,OAAO,yBAAyB,CAAC;AACnC,CAAC;AAUD;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,QAAgB,EAChB,sBAA8B,EAC9B,MAAgC,EAChC,OAAuB;IAEvB,MAAM,YAAY,GAAG,6BAA6B,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAChF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO;YACL,cAAc,EAAE,sBAAsB,CAAC,sBAAsB,EAAE,MAAM,CAAC,UAAU,CAAC;YACjF,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,KAAK;SACpB,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,GACN,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;QACxE,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO;QACL,cAAc,EAAE,8BAA8B,CAAC,sBAAsB,EAAE,EAAE,EAAE,MAAM,CAAC,UAAU,CAAC;QAC7F,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,IAAI;KACnB,CAAC;AACJ,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -8,10 +8,29 @@ export type CommentrayToml = {
|
|
|
8
8
|
render?: {
|
|
9
9
|
mermaid?: boolean;
|
|
10
10
|
syntaxTheme?: string;
|
|
11
|
+
/**
|
|
12
|
+
* When true, `https://github.com/<owner>/<repo>/blob|tree/<branch>/…` links in commentray
|
|
13
|
+
* Markdown are rewritten to paths relative to the generated HTML file (see
|
|
14
|
+
* `static_site.github_url` for owner/repo). Requires a parseable repository URL.
|
|
15
|
+
*/
|
|
16
|
+
relative_github_blob_links?: boolean;
|
|
11
17
|
};
|
|
12
18
|
anchors?: {
|
|
13
19
|
defaultStrategy?: string[];
|
|
14
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Named **Angles** — multiple commentrays per source file (see `docs/spec/storage.md`).
|
|
23
|
+
* Keys use snake_case in TOML (`[angles]`).
|
|
24
|
+
*/
|
|
25
|
+
angles?: {
|
|
26
|
+
/** Which Angle is selected by default in tooling and the static viewer (must match a `definitions` id when that list is non-empty). */
|
|
27
|
+
default_angle?: string;
|
|
28
|
+
/** Optional list of known Angles with display titles for UI (static browser, editor). */
|
|
29
|
+
definitions?: {
|
|
30
|
+
id: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
15
34
|
/**
|
|
16
35
|
* Optional settings for publishing a single-file static “code browser” (GitHub Pages, etc.).
|
|
17
36
|
* Keys use snake_case in TOML (`[static_site]`).
|
|
@@ -27,14 +46,41 @@ export type CommentrayToml = {
|
|
|
27
46
|
commentray_markdown?: string;
|
|
28
47
|
/** @deprecated Renamed to `commentray_markdown`. */
|
|
29
48
|
commentary_markdown?: string;
|
|
49
|
+
/** Branch name embedded in GitHub blob URLs for `related_github_files` (default `main`). */
|
|
50
|
+
github_blob_branch?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Optional toolbar links on the static code browser: open other repo files on GitHub
|
|
53
|
+
* (single-page Pages deploys cannot serve arbitrary paths next to `index.html`).
|
|
54
|
+
*/
|
|
55
|
+
related_github_files?: {
|
|
56
|
+
label?: string;
|
|
57
|
+
path: string;
|
|
58
|
+
}[];
|
|
30
59
|
};
|
|
31
60
|
};
|
|
61
|
+
export type ResolvedGithubNavLink = {
|
|
62
|
+
label: string;
|
|
63
|
+
href: string;
|
|
64
|
+
};
|
|
32
65
|
export type ResolvedStaticSite = {
|
|
33
66
|
title: string;
|
|
34
67
|
introMarkdown: string;
|
|
35
68
|
githubUrl: string | null;
|
|
69
|
+
/** Branch used when building `relatedGithubNav` blob URLs. */
|
|
70
|
+
githubBlobBranch: string;
|
|
36
71
|
sourceFile: string;
|
|
37
72
|
commentrayMarkdownFile: string;
|
|
73
|
+
/** Toolbar “Also on GitHub …” links for the static code browser. */
|
|
74
|
+
relatedGithubNav: ResolvedGithubNavLink[];
|
|
75
|
+
};
|
|
76
|
+
export type ResolvedAngleDefinition = {
|
|
77
|
+
id: string;
|
|
78
|
+
title: string;
|
|
79
|
+
};
|
|
80
|
+
export type ResolvedAngles = {
|
|
81
|
+
/** When `definitions` is non-empty, this must match one of them (enforced at merge). */
|
|
82
|
+
defaultAngleId: string | null;
|
|
83
|
+
definitions: ResolvedAngleDefinition[];
|
|
38
84
|
};
|
|
39
85
|
export type ResolvedCommentrayConfig = {
|
|
40
86
|
storageDir: string;
|
|
@@ -42,10 +88,12 @@ export type ResolvedCommentrayConfig = {
|
|
|
42
88
|
render: {
|
|
43
89
|
mermaid: boolean;
|
|
44
90
|
syntaxTheme: string;
|
|
91
|
+
relativeGithubBlobLinks: boolean;
|
|
45
92
|
};
|
|
46
93
|
anchors: {
|
|
47
94
|
defaultStrategy: string[];
|
|
48
95
|
};
|
|
96
|
+
angles: ResolvedAngles;
|
|
49
97
|
staticSite: ResolvedStaticSite;
|
|
50
98
|
};
|
|
51
99
|
export declare function mergeCommentrayConfig(parsed: CommentrayToml | null): ResolvedCommentrayConfig;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,GAAG,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB;;;;WAIG;QACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;KACtC,CAAC;IACF,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACzC;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,uIAAuI;QACvI,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,yFAAyF;QACzF,WAAW,CAAC,EAAE;YAAE,EAAE,EAAE,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BAAuB,EAAE,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC;IACnB,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,uBAAuB,EAAE,OAAO,CAAA;KAAE,CAAC;IACpF,OAAO,EAAE;QAAE,eAAe,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACvC,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAmKF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,wBAAwB,CAsB7F;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAY9F"}
|
package/dist/config.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { parse as parseToml } from "@iarna/toml";
|
|
4
|
+
import { assertValidAngleId } from "./angles.js";
|
|
5
|
+
import { githubRepoBlobFileUrl, parseGithubRepoWebUrl } from "./github-url.js";
|
|
4
6
|
import { normalizeRepoRelativePath } from "./paths.js";
|
|
5
7
|
const defaultStaticSite = {
|
|
6
8
|
title: "Commentray",
|
|
7
9
|
introMarkdown: "",
|
|
8
10
|
githubUrl: null,
|
|
11
|
+
githubBlobBranch: "main",
|
|
9
12
|
sourceFile: "README.md",
|
|
10
13
|
commentrayMarkdownFile: "",
|
|
14
|
+
relatedGithubNav: [],
|
|
11
15
|
};
|
|
16
|
+
const defaultAngles = { defaultAngleId: null, definitions: [] };
|
|
12
17
|
const defaultConfig = {
|
|
13
18
|
storageDir: ".commentray",
|
|
14
19
|
scmProvider: "git",
|
|
15
|
-
render: { mermaid: true, syntaxTheme: "github-dark" },
|
|
20
|
+
render: { mermaid: true, syntaxTheme: "github-dark", relativeGithubBlobLinks: false },
|
|
16
21
|
anchors: { defaultStrategy: ["symbol", "lines"] },
|
|
22
|
+
angles: { ...defaultAngles },
|
|
17
23
|
staticSite: { ...defaultStaticSite },
|
|
18
24
|
};
|
|
19
25
|
function nonEmptyTrimmed(s) {
|
|
@@ -52,17 +58,72 @@ function assertStorageDirNotInsideGit(value) {
|
|
|
52
58
|
`Git treats .git/ as opaque metadata and routine operations can wipe it.`);
|
|
53
59
|
}
|
|
54
60
|
}
|
|
61
|
+
function mergeAngleDefinitions(raw) {
|
|
62
|
+
if (!raw?.length)
|
|
63
|
+
return [];
|
|
64
|
+
const out = [];
|
|
65
|
+
const seen = new Set();
|
|
66
|
+
for (const row of raw) {
|
|
67
|
+
const id = assertValidAngleId(row.id);
|
|
68
|
+
if (seen.has(id)) {
|
|
69
|
+
throw new Error(`Duplicate angles.definitions id: ${id}`);
|
|
70
|
+
}
|
|
71
|
+
seen.add(id);
|
|
72
|
+
const title = row.title?.trim() || id;
|
|
73
|
+
out.push({ id, title });
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
function resolveAngles(parsed) {
|
|
78
|
+
const a = parsed.angles;
|
|
79
|
+
if (!a) {
|
|
80
|
+
return { ...defaultAngles };
|
|
81
|
+
}
|
|
82
|
+
const definitions = mergeAngleDefinitions(a.definitions);
|
|
83
|
+
const defaultRaw = a.default_angle?.trim();
|
|
84
|
+
const defaultAngleId = defaultRaw ? assertValidAngleId(defaultRaw) : null;
|
|
85
|
+
if (definitions.length > 0 &&
|
|
86
|
+
defaultAngleId &&
|
|
87
|
+
!definitions.some((d) => d.id === defaultAngleId)) {
|
|
88
|
+
throw new Error(`angles.default_angle "${defaultAngleId}" must match one of angles.definitions (got: ${definitions.map((d) => d.id).join(", ")})`);
|
|
89
|
+
}
|
|
90
|
+
return { defaultAngleId, definitions };
|
|
91
|
+
}
|
|
92
|
+
function mergeRelatedGithubNav(githubUrl, branch, raw) {
|
|
93
|
+
const gh = githubUrl ? parseGithubRepoWebUrl(githubUrl) : null;
|
|
94
|
+
if (!gh || !raw?.length)
|
|
95
|
+
return [];
|
|
96
|
+
const b = branch.trim() || defaultStaticSite.githubBlobBranch;
|
|
97
|
+
const out = [];
|
|
98
|
+
for (const row of raw) {
|
|
99
|
+
if (!row?.path?.trim())
|
|
100
|
+
continue;
|
|
101
|
+
const p = normalizeRepoRelativePath(row.path.trim());
|
|
102
|
+
const label = row.label?.trim() || path.posix.basename(p);
|
|
103
|
+
out.push({
|
|
104
|
+
label,
|
|
105
|
+
href: githubRepoBlobFileUrl(gh.owner, gh.repo, b, p),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
function resolvedStaticSiteMarkdownFile(ss) {
|
|
111
|
+
return (ss?.commentray_markdown?.trim() ??
|
|
112
|
+
ss?.commentary_markdown?.trim() ??
|
|
113
|
+
defaultStaticSite.commentrayMarkdownFile);
|
|
114
|
+
}
|
|
55
115
|
function resolveStaticSite(parsed) {
|
|
56
116
|
const ss = parsed.static_site;
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
defaultStaticSite.commentrayMarkdownFile;
|
|
117
|
+
const githubUrl = nonEmptyTrimmed(ss?.github_url);
|
|
118
|
+
const githubBlobBranch = nonEmptyTrimmed(ss?.github_blob_branch) ?? defaultStaticSite.githubBlobBranch;
|
|
60
119
|
return {
|
|
61
120
|
title: nonEmptyTrimmed(ss?.title) ?? defaultStaticSite.title,
|
|
62
121
|
introMarkdown: ss?.intro ?? defaultStaticSite.introMarkdown,
|
|
63
|
-
githubUrl
|
|
122
|
+
githubUrl,
|
|
123
|
+
githubBlobBranch,
|
|
64
124
|
sourceFile: nonEmptyTrimmed(ss?.source_file) ?? defaultStaticSite.sourceFile,
|
|
65
|
-
commentrayMarkdownFile:
|
|
125
|
+
commentrayMarkdownFile: resolvedStaticSiteMarkdownFile(ss),
|
|
126
|
+
relatedGithubNav: mergeRelatedGithubNav(githubUrl, githubBlobBranch, ss?.related_github_files),
|
|
66
127
|
};
|
|
67
128
|
}
|
|
68
129
|
function assertSafeConfigPaths(parsed) {
|
|
@@ -72,6 +133,9 @@ function assertSafeConfigPaths(parsed) {
|
|
|
72
133
|
assertSafeRepoRelativePath("static_site.source_file", ss?.source_file);
|
|
73
134
|
assertSafeRepoRelativePath("static_site.commentray_markdown", ss?.commentray_markdown);
|
|
74
135
|
assertSafeRepoRelativePath("static_site.commentary_markdown", ss?.commentary_markdown);
|
|
136
|
+
for (let i = 0; i < (ss?.related_github_files?.length ?? 0); i++) {
|
|
137
|
+
assertSafeRepoRelativePath(`static_site.related_github_files[${i}].path`, ss?.related_github_files?.[i]?.path);
|
|
138
|
+
}
|
|
75
139
|
}
|
|
76
140
|
export function mergeCommentrayConfig(parsed) {
|
|
77
141
|
if (!parsed)
|
|
@@ -87,10 +151,12 @@ export function mergeCommentrayConfig(parsed) {
|
|
|
87
151
|
render: {
|
|
88
152
|
mermaid: parsed.render?.mermaid ?? defaultConfig.render.mermaid,
|
|
89
153
|
syntaxTheme: parsed.render?.syntaxTheme ?? defaultConfig.render.syntaxTheme,
|
|
154
|
+
relativeGithubBlobLinks: parsed.render?.relative_github_blob_links ?? defaultConfig.render.relativeGithubBlobLinks,
|
|
90
155
|
},
|
|
91
156
|
anchors: {
|
|
92
157
|
defaultStrategy: parsed.anchors?.defaultStrategy ?? defaultConfig.anchors.defaultStrategy,
|
|
93
158
|
},
|
|
159
|
+
angles: resolveAngles(parsed),
|
|
94
160
|
staticSite: resolveStaticSite(parsed),
|
|
95
161
|
};
|
|
96
162
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAA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,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;QACjD,IAAI,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAAC;QACnD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a GitHub repository web URL into owner + repo name (no API calls).
|
|
3
|
+
* Accepts optional trailing slash and `.git` suffix.
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseGithubRepoWebUrl(url: string): {
|
|
6
|
+
owner: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
} | null;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a `https://github.com/owner/repo/blob/<branch>/path` URL for a repo-relative file path.
|
|
11
|
+
* Used for static-site “open another file” links when only `_site/index.html` is deployed.
|
|
12
|
+
*/
|
|
13
|
+
export declare function githubRepoBlobFileUrl(owner: string, repo: string, branch: string, repoRelativePath: string): string;
|
|
14
|
+
//# sourceMappingURL=github-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-url.d.ts","sourceRoot":"","sources":["../src/github-url.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAKzF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAOR"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { normalizeRepoRelativePath } from "./paths.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parses a GitHub repository web URL into owner + repo name (no API calls).
|
|
4
|
+
* Accepts optional trailing slash and `.git` suffix.
|
|
5
|
+
*/
|
|
6
|
+
export function parseGithubRepoWebUrl(url) {
|
|
7
|
+
const t = url.trim().replace(/\/+$/, "");
|
|
8
|
+
const m = t.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/i);
|
|
9
|
+
if (!m)
|
|
10
|
+
return null;
|
|
11
|
+
return { owner: m[1], repo: m[2] };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Builds a `https://github.com/owner/repo/blob/<branch>/path` URL for a repo-relative file path.
|
|
15
|
+
* Used for static-site “open another file” links when only `_site/index.html` is deployed.
|
|
16
|
+
*/
|
|
17
|
+
export function githubRepoBlobFileUrl(owner, repo, branch, repoRelativePath) {
|
|
18
|
+
const posix = normalizeRepoRelativePath(repoRelativePath.replace(/\\/g, "/"));
|
|
19
|
+
const tail = posix
|
|
20
|
+
.split("/")
|
|
21
|
+
.map((s) => encodeURIComponent(s))
|
|
22
|
+
.join("/");
|
|
23
|
+
return `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/blob/${encodeURIComponent(branch)}/${tail}`;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=github-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-url.js","sourceRoot":"","sources":["../src/github-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,IAAY,EACZ,MAAc,EACd,gBAAwB;IAExB,MAAM,KAAK,GAAG,yBAAyB,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9E,MAAM,IAAI,GAAG,KAAK;SACf,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;SACjC,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,sBAAsB,kBAAkB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;AAClI,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommentrayIndex } from "./model.js";
|
|
2
|
+
/**
|
|
3
|
+
* Drops legacy `fingerprint` objects from index.json into a single `snippet`
|
|
4
|
+
* string (diff-style). Returns a fresh index when anything changed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeCommentrayIndex(index: CommentrayIndex): {
|
|
7
|
+
index: CommentrayIndex;
|
|
8
|
+
changed: boolean;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index-normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-normalize.d.ts","sourceRoot":"","sources":["../src/index-normalize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,eAAe,EAAwB,MAAM,YAAY,CAAC;AAmCzF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG;IAChE,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB,CAiBA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { buildCommentraySnippetV1 } from "./block-snippet.js";
|
|
2
|
+
function isLegacyFingerprint(value) {
|
|
3
|
+
if (typeof value !== "object" || value === null)
|
|
4
|
+
return false;
|
|
5
|
+
const o = value;
|
|
6
|
+
return (typeof o.startLine === "string" &&
|
|
7
|
+
typeof o.endLine === "string" &&
|
|
8
|
+
typeof o.lineCount === "number" &&
|
|
9
|
+
Number.isInteger(o.lineCount) &&
|
|
10
|
+
o.lineCount >= 1);
|
|
11
|
+
}
|
|
12
|
+
function snippetFromLegacyFingerprint(fp) {
|
|
13
|
+
if (fp.lineCount === 1) {
|
|
14
|
+
return buildCommentraySnippetV1([fp.startLine]);
|
|
15
|
+
}
|
|
16
|
+
if (fp.lineCount === 2) {
|
|
17
|
+
return buildCommentraySnippetV1([fp.startLine, fp.endLine]);
|
|
18
|
+
}
|
|
19
|
+
const omitted = fp.lineCount - 2;
|
|
20
|
+
return buildCommentraySnippetV1([
|
|
21
|
+
fp.startLine,
|
|
22
|
+
`… (${omitted} line${omitted === 1 ? "" : "s"} omitted) …`,
|
|
23
|
+
fp.endLine,
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Drops legacy `fingerprint` objects from index.json into a single `snippet`
|
|
28
|
+
* string (diff-style). Returns a fresh index when anything changed.
|
|
29
|
+
*/
|
|
30
|
+
export function normalizeCommentrayIndex(index) {
|
|
31
|
+
let changed = false;
|
|
32
|
+
const nextByPath = { ...index.byCommentrayPath };
|
|
33
|
+
for (const [key, entry] of Object.entries(index.byCommentrayPath)) {
|
|
34
|
+
const blocks = entry.blocks.map((block) => normalizeBlock(block));
|
|
35
|
+
const entryChanged = JSON.stringify({ ...entry, blocks }) !== JSON.stringify({ ...entry, blocks: entry.blocks });
|
|
36
|
+
if (entryChanged) {
|
|
37
|
+
changed = true;
|
|
38
|
+
nextByPath[key] = { ...entry, blocks };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!changed)
|
|
42
|
+
return { index, changed: false };
|
|
43
|
+
return {
|
|
44
|
+
index: { schemaVersion: index.schemaVersion, byCommentrayPath: nextByPath },
|
|
45
|
+
changed: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function normalizeBlock(block) {
|
|
49
|
+
const raw = block;
|
|
50
|
+
if (!isLegacyFingerprint(raw.fingerprint))
|
|
51
|
+
return block;
|
|
52
|
+
if (typeof raw.snippet === "string" && raw.snippet.trim() !== "") {
|
|
53
|
+
const { fingerprint: _f, ...rest } = raw;
|
|
54
|
+
return rest;
|
|
55
|
+
}
|
|
56
|
+
const snippet = snippetFromLegacyFingerprint(raw.fingerprint);
|
|
57
|
+
const { fingerprint: _f, ...rest } = raw;
|
|
58
|
+
return { ...rest, snippet };
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=index-normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-normalize.js","sourceRoot":"","sources":["../src/index-normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAS9D,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,OAAO,CACL,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ;QAC/B,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;QAC7B,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ;QAC/B,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7B,CAAC,CAAC,SAAS,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,SAAS,4BAA4B,CAAC,EAAqB;IACzD,IAAI,EAAE,CAAC,SAAS,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,wBAAwB,CAAC,CAAC,E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,CAAC,OAAO;QAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/C,OAAO;QACL,KAAK,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE;QAC3E,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAsB;IAC5C,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACjE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;QACzC,OAAO,IAAuB,CAAC;IACjC,CAAC;IACD,MAAM,OAAO,GAAG,4BAA4B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC9D,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;IACzC,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAqB,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recovery steps when `index.json` `schemaVersion` does not match this build’s
|
|
3
|
+
* {@link CURRENT_SCHEMA_VERSION} (shown explicitly so you know which number to target).
|
|
4
|
+
*/
|
|
5
|
+
export declare function describeIndexSchemaRemediation(observedSchema: unknown): string;
|
|
6
|
+
//# sourceMappingURL=index-schema-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-schema-messages.d.ts","sourceRoot":"","sources":["../src/index-schema-messages.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,CAc9E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CURRENT_SCHEMA_VERSION } from "./model.js";
|
|
2
|
+
function formatObservedSchema(raw) {
|
|
3
|
+
if (raw === undefined)
|
|
4
|
+
return "missing";
|
|
5
|
+
if (typeof raw === "number" || typeof raw === "string")
|
|
6
|
+
return String(raw);
|
|
7
|
+
return JSON.stringify(raw);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Recovery steps when `index.json` `schemaVersion` does not match this build’s
|
|
11
|
+
* {@link CURRENT_SCHEMA_VERSION} (shown explicitly so you know which number to target).
|
|
12
|
+
*/
|
|
13
|
+
export function describeIndexSchemaRemediation(observedSchema) {
|
|
14
|
+
const obs = formatObservedSchema(observedSchema);
|
|
15
|
+
return (`This install expects "schemaVersion": ${String(CURRENT_SCHEMA_VERSION)} in index.json (bundled @commentray/core). ` +
|
|
16
|
+
`This file has ${obs}. ` +
|
|
17
|
+
`What to do: ` +
|
|
18
|
+
`(1) Upgrade Commentray from the same git revision as the index author — from the repo run \`bash scripts/install-extension.sh\` ` +
|
|
19
|
+
`or \`npm run extension:dogfood\`, then **Developer: Reload Window**. ` +
|
|
20
|
+
`(2) If the index was written by a *newer* CLI, install that newer Commentray, or open the repo with *this* build: ` +
|
|
21
|
+
`readIndex downgrades a newer numeric schema after writing a backup under \`.commentray/metadata/\` ` +
|
|
22
|
+
`named \`index.schema-<old>-backup-<timestamp>.json\`. ` +
|
|
23
|
+
`(3) Last resort after copying \`.commentray/metadata/\` elsewhere: set \`"schemaVersion": ${String(CURRENT_SCHEMA_VERSION)}\` ` +
|
|
24
|
+
`only if the rest of the JSON still matches this version’s validator.`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index-schema-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-schema-messages.js","sourceRoot":"","sources":["../src/index-schema-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,SAAS,oBAAoB,CAAC,GAAY;IACxC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3E,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,cAAuB;IACpE,MAAM,GAAG,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACjD,OAAO,CACL,yCAAyC,MAAM,CAAC,sBAAsB,CAAC,6CAA6C;QACpH,iBAAiB,GAAG,IAAI;QACxB,cAAc;QACd,kIAAkI;QAClI,uEAAuE;QACvE,oHAAoH;QACpH,qGAAqG;QACrG,wDAAwD;QACxD,6FAA6F,MAAM,CAAC,sBAAsB,CAAC,KAAK;QAChI,sEAAsE,CACvE,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
export type { CommentrayBlock, CommentrayIndex, SourceFileIndexEntry } from "./model.js";
|
|
2
|
-
export { CURRENT_SCHEMA_VERSION } from "./model.js";
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
2
|
+
export { coerceIndexSchemaVersion, CURRENT_SCHEMA_VERSION } from "./model.js";
|
|
3
|
+
export type { AddBlockToIndexInput, BlockRange, CreateBlockForRangeInput, CreatedBlock, } from "./blocks.js";
|
|
4
|
+
export { addBlockToIndex, appendBlockToCommentray, createBlockForRange, generateBlockId, } from "./blocks.js";
|
|
5
|
+
export { assertValidAngleId } from "./angles.js";
|
|
6
|
+
export { ensureAnglesSentinelFile, upsertAngleDefinitionInCommentrayToml } from "./angles-toml.js";
|
|
7
|
+
export type { UpsertAngleDefinitionInput } from "./angles-toml.js";
|
|
8
|
+
export { defaultAngleIdForOpen, FALLBACK_DEFAULT_ANGLE_ID, resolveCommentrayMarkdownPath, } from "./commentray-path-resolution.js";
|
|
9
|
+
export type { ResolvedCommentrayMarkdownPath } from "./commentray-path-resolution.js";
|
|
10
|
+
export { commentrayAnglesLayoutEnabled, commentrayAnglesSentinelPath, commentrayMarkdownPath, commentrayMarkdownPathForAngle, defaultMetadataIndexPath, normalizeRepoRelativePath, } from "./paths.js";
|
|
11
|
+
export type { CommentrayToml, ResolvedAngleDefinition, ResolvedAngles, ResolvedCommentrayConfig, ResolvedGithubNavLink, ResolvedStaticSite, } from "./config.js";
|
|
5
12
|
export { loadCommentrayConfig, mergeCommentrayConfig } from "./config.js";
|
|
13
|
+
export { githubRepoBlobFileUrl, parseGithubRepoWebUrl } from "./github-url.js";
|
|
6
14
|
export { assertValidIndex, emptyIndex } from "./metadata.js";
|
|
15
|
+
export { describeIndexSchemaRemediation } from "./index-schema-messages.js";
|
|
7
16
|
export { migrateIndex } from "./migrate.js";
|
|
8
17
|
export type { ParsedAnchor } from "./anchors.js";
|
|
9
18
|
export { formatLineRange, parseAnchor } from "./anchors.js";
|
|
10
|
-
export type { ScmProvider } from "./scm/scm-provider.js";
|
|
11
|
-
export { GitScmProvider } from "./scm/git-scm-provider.js";
|
|
19
|
+
export type { ScmPathRename, ScmProvider } from "./scm/scm-provider.js";
|
|
20
|
+
export { GitScmProvider, parseGitRenameLines } from "./scm/git-scm-provider.js";
|
|
21
|
+
export { applyPathRenamesToCommentrayIndex, inferAngleIdFromCommentrayPath, } from "./commentray-index-renames.js";
|
|
22
|
+
export type { PathRename } from "./commentray-index-renames.js";
|
|
12
23
|
export type { BlockDiagnostic } from "./staleness.js";
|
|
13
24
|
export { diagnoseBlock } from "./staleness.js";
|
|
14
25
|
export type { ValidationIssue, ValidationResult } from "./validate-project.js";
|
|
15
|
-
export { readIndex, validateProject } from "./validate-project.js";
|
|
26
|
+
export { readIndex, refreshIndexMigrationsOnDisk, validateProject, writeIndex, } from "./validate-project.js";
|
|
16
27
|
export { runCommanderMain } from "./cli-bootstrap.js";
|
|
28
|
+
export type { BlockScrollLink } from "./scroll-sync.js";
|
|
29
|
+
export { buildBlockScrollLinks, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, } from "./scroll-sync.js";
|
|
30
|
+
export { commentrayRegionInsertions, lineCommentLeaderForLanguage, parseCommentrayRegionBoundary, sourceLineRangeForMarkerId, } from "./source-markers.js";
|
|
31
|
+
export type { CommentrayMarkerPair } from "./region-marker-convert.js";
|
|
32
|
+
export { convertCommentraySourceMarkersToLanguage, findCommentrayMarkerPairs, leadingIndentOfLine, } from "./region-marker-convert.js";
|
|
33
|
+
export { MARKER_ID_BODY, assertValidMarkerId, normaliseMarkerSlugOrThrow } from "./marker-ids.js";
|
|
34
|
+
export type { MarkerValidationIssue } from "./marker-validation.js";
|
|
35
|
+
export { validateIndexMarkerSemantics, validateMarkerBoundariesInSource, } from "./marker-validation.js";
|
|
17
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC9E,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,wBAAwB,EACxB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,E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CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,SAAS,EACT,4BAA4B,EAC5B,eAAe,EACf,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACL,wCAAwC,EACxC,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAClG,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
export { CURRENT_SCHEMA_VERSION } from "./model.js";
|
|
2
|
-
export {
|
|
1
|
+
export { coerceIndexSchemaVersion, CURRENT_SCHEMA_VERSION } from "./model.js";
|
|
2
|
+
export { addBlockToIndex, appendBlockToCommentray, createBlockForRange, generateBlockId, } from "./blocks.js";
|
|
3
|
+
export { assertValidAngleId } from "./angles.js";
|
|
4
|
+
export { ensureAnglesSentinelFile, upsertAngleDefinitionInCommentrayToml } from "./angles-toml.js";
|
|
5
|
+
export { defaultAngleIdForOpen, FALLBACK_DEFAULT_ANGLE_ID, resolveCommentrayMarkdownPath, } from "./commentray-path-resolution.js";
|
|
6
|
+
export { commentrayAnglesLayoutEnabled, commentrayAnglesSentinelPath, commentrayMarkdownPath, commentrayMarkdownPathForAngle, defaultMetadataIndexPath, normalizeRepoRelativePath, } from "./paths.js";
|
|
3
7
|
export { loadCommentrayConfig, mergeCommentrayConfig } from "./config.js";
|
|
8
|
+
export { githubRepoBlobFileUrl, parseGithubRepoWebUrl } from "./github-url.js";
|
|
4
9
|
export { assertValidIndex, emptyIndex } from "./metadata.js";
|
|
10
|
+
export { describeIndexSchemaRemediation } from "./index-schema-messages.js";
|
|
5
11
|
export { migrateIndex } from "./migrate.js";
|
|
6
12
|
export { formatLineRange, parseAnchor } from "./anchors.js";
|
|
7
|
-
export { GitScmProvider } from "./scm/git-scm-provider.js";
|
|
13
|
+
export { GitScmProvider, parseGitRenameLines } from "./scm/git-scm-provider.js";
|
|
14
|
+
export { applyPathRenamesToCommentrayIndex, inferAngleIdFromCommentrayPath, } from "./commentray-index-renames.js";
|
|
8
15
|
export { diagnoseBlock } from "./staleness.js";
|
|
9
|
-
export { readIndex, validateProject } from "./validate-project.js";
|
|
16
|
+
export { readIndex, refreshIndexMigrationsOnDisk, validateProject, writeIndex, } from "./validate-project.js";
|
|
10
17
|
export { runCommanderMain } from "./cli-bootstrap.js";
|
|
18
|
+
export { buildBlockScrollLinks, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, } from "./scroll-sync.js";
|
|
19
|
+
export { commentrayRegionInsertions, lineCommentLeaderForLanguage, parseCommentrayRegionBoundary, sourceLineRangeForMarkerId, } from "./source-markers.js";
|
|
20
|
+
export { convertCommentraySourceMarkersToLanguage, findCommentrayMarkerPairs, leadingIndentOfLine, } from "./region-marker-convert.js";
|
|
21
|
+
export { MARKER_ID_BODY, assertValidMarkerId, normaliseMarkerSlugOrThrow } from "./marker-ids.js";
|
|
22
|
+
export { validateIndexMarkerSemantics, validateMarkerBoundariesInSource, } from "./marker-validation.js";
|
|
11
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAO9E,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,qCAAqC,EAAE,MAAM,kBAAkB,CAAC;AAEnG,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,sBAAsB,EACtB,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EACL,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EACL,SAAS,EACT,4BAA4B,EAC5B,eAAe,EACf,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,qBAAqB,EACrB,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,wCAAwC,EACxC,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAElG,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marker / block ids used in `marker:<id>` anchors, `markerId` in the index, and
|
|
3
|
+
* `commentray:<id>` / `commentray:start id=<id>` in source. Designed so authors
|
|
4
|
+
* can type **short slugs** (`intro`, `auth-flow`, `todo_1`) while tooling stays strict.
|
|
5
|
+
*/
|
|
6
|
+
/** Body: 1–64 chars, ASCII letters, digits, hyphen, underscore; must not be empty after trim. */
|
|
7
|
+
export declare const MARKER_ID_BODY = "[a-z0-9][a-z0-9_-]{0,63}";
|
|
8
|
+
/**
|
|
9
|
+
* Validates and returns the normalised (lower-case) marker id, or throws with a
|
|
10
|
+
* message suitable for CLI / editor output.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertValidMarkerId(raw: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Turns free-form author input into a valid marker id when possible: lower-case,
|
|
15
|
+
* spaces → hyphens, strips other punctuation. Throws if the result is empty or
|
|
16
|
+
* still invalid — callers may fall back to {@link generateBlockId} from `blocks.js`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function normaliseMarkerSlugOrThrow(raw: string): string;
|
|
19
|
+
//# sourceMappingURL=marker-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-ids.d.ts","sourceRoot":"","sources":["../src/marker-ids.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iGAAiG;AACjG,eAAO,MAAM,cAAc,6BAA6B,CAAC;AAIzD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASvD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAW9D"}
|