@commentray/core 0.1.2 → 0.3.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/dist/approval-flow-grid.d.ts +25 -0
- package/dist/approval-flow-grid.d.ts.map +1 -0
- package/dist/approval-flow-grid.js +274 -0
- package/dist/approval-flow-grid.js.map +1 -0
- package/dist/block-scroll-pickers.d.ts +42 -0
- package/dist/block-scroll-pickers.d.ts.map +1 -1
- package/dist/block-scroll-pickers.js +183 -14
- package/dist/block-scroll-pickers.js.map +1 -1
- package/dist/browse-contract.d.ts +16 -0
- package/dist/browse-contract.d.ts.map +1 -0
- package/dist/browse-contract.js +8 -0
- package/dist/browse-contract.js.map +1 -0
- package/dist/browse-path-default.d.ts +4 -0
- package/dist/browse-path-default.d.ts.map +1 -0
- package/dist/browse-path-default.js +6 -0
- package/dist/browse-path-default.js.map +1 -0
- package/dist/buffering-flow-synchronizer-approval-printer.d.ts +44 -0
- package/dist/buffering-flow-synchronizer-approval-printer.d.ts.map +1 -0
- package/dist/buffering-flow-synchronizer-approval-printer.js +864 -0
- package/dist/buffering-flow-synchronizer-approval-printer.js.map +1 -0
- package/dist/buffering-flow-synchronizer.d.ts +28 -0
- package/dist/buffering-flow-synchronizer.d.ts.map +1 -0
- package/dist/buffering-flow-synchronizer.js +193 -0
- package/dist/buffering-flow-synchronizer.js.map +1 -0
- package/dist/commentray-disk-pairs.d.ts +6 -0
- package/dist/commentray-disk-pairs.d.ts.map +1 -1
- package/dist/commentray-disk-pairs.js +21 -1
- package/dist/commentray-disk-pairs.js.map +1 -1
- package/dist/commentray-static-browse-path.d.ts +9 -0
- package/dist/commentray-static-browse-path.d.ts.map +1 -0
- package/dist/commentray-static-browse-path.js +65 -0
- package/dist/commentray-static-browse-path.js.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -0
- package/dist/config.js.map +1 -1
- package/dist/height-adjustable.d.ts +25 -0
- package/dist/height-adjustable.d.ts.map +1 -0
- package/dist/height-adjustable.js +2 -0
- package/dist/height-adjustable.js.map +1 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/monorepo-layout.d.ts +1 -1
- package/dist/monorepo-layout.js +1 -1
- package/dist/orphan-companion-markdown.d.ts +32 -0
- package/dist/orphan-companion-markdown.d.ts.map +1 -0
- package/dist/orphan-companion-markdown.js +91 -0
- package/dist/orphan-companion-markdown.js.map +1 -0
- package/dist/paths.d.ts +1 -13
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +2 -24
- package/dist/paths.js.map +1 -1
- package/dist/repo-relative-path.d.ts +18 -0
- package/dist/repo-relative-path.d.ts.map +1 -0
- package/dist/repo-relative-path.js +29 -0
- package/dist/repo-relative-path.js.map +1 -0
- package/dist/scroll-sync.d.ts +2 -2
- package/dist/scroll-sync.d.ts.map +1 -1
- package/dist/scroll-sync.js +26 -5
- package/dist/scroll-sync.js.map +1 -1
- package/dist/validate-project.d.ts.map +1 -1
- package/dist/validate-project.js +38 -13
- package/dist/validate-project.js.map +1 -1
- package/package.json +11 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface WithHeight {
|
|
2
|
+
height: number;
|
|
3
|
+
}
|
|
4
|
+
export interface Identifiable {
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
/** One row after the `R{N}XX` header inside a synced region (`height` includes that header row). */
|
|
8
|
+
export type SyncRegionContinuationKind = "body" | "stagger";
|
|
9
|
+
/**
|
|
10
|
+
* A vertical segment in a flow: intrinsic `height` plus optional slack so it can align with other
|
|
11
|
+
* flows (padding before the segment and padding after it, in abstract row units).
|
|
12
|
+
*/
|
|
13
|
+
export interface HeightAdjustable extends Identifiable, WithHeight {
|
|
14
|
+
/** Row slack before the segment’s content when stacking or aligning flows. */
|
|
15
|
+
bufferAbove: number;
|
|
16
|
+
/** Row slack after the segment’s content when stacking or aligning flows. */
|
|
17
|
+
bufferBelow: number;
|
|
18
|
+
/**
|
|
19
|
+
* When `id` matches `R{N}XX` and `height > 1`, each entry is the kind of that continuation row
|
|
20
|
+
* (partner `XXXX` in this column vs empty/stagger in this column). Approval printing uses `XXXX`
|
|
21
|
+
* only for `body`; `stagger` is rendered as an empty cell so slack is not shown as fake code.
|
|
22
|
+
*/
|
|
23
|
+
syncRegionContinuationRows?: readonly SyncRegionContinuationKind[];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=height-adjustable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"height-adjustable.d.ts","sourceRoot":"","sources":["../src/height-adjustable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,oGAAoG;AACpG,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,SAAS,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY,EAAE,UAAU;IAChE,8EAA8E;IAC9E,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"height-adjustable.js","sourceRoot":"","sources":["../src/height-adjustable.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,15 @@ export { defaultAngleIdForOpen, FALLBACK_DEFAULT_ANGLE_ID, resolveCommentrayMark
|
|
|
9
9
|
export type { ResolvedCommentrayMarkdownPath } from "./commentray-path-resolution.js";
|
|
10
10
|
export { commentrayAnglesLayoutEnabled, commentrayAnglesSentinelPath, commentrayMarkdownPath, commentrayMarkdownPathForAngle, defaultMetadataIndexPath, normalizeRepoRelativePath, resolvePathUnderRepoRoot, } from "./paths.js";
|
|
11
11
|
export { findMonorepoPackagesDir, monorepoLayoutStartDir } from "./monorepo-layout.js";
|
|
12
|
-
export {
|
|
12
|
+
export type { CommentrayStaticBrowsePairPaths, CommentrayStaticBrowsePathResolver, } from "./browse-contract.js";
|
|
13
|
+
export { defaultCommentrayStaticBrowsePathResolver } from "./browse-path-default.js";
|
|
14
|
+
export { staticBrowseIndexRelPathFromPair } from "./commentray-static-browse-path.js";
|
|
15
|
+
export { commentrayPairSourceFileExistsOnDisk, discoverCommentrayPairsOnDisk, pairFromCommentraySourceRel, } from "./commentray-disk-pairs.js";
|
|
13
16
|
export type { DiskCommentrayPair } from "./commentray-disk-pairs.js";
|
|
14
|
-
export
|
|
15
|
-
export {
|
|
17
|
+
export { collectOrphanCompanionMarkdownTargets, orphanCompanionCleanupAbsPath, pruneOrphanCompanionMarkdown, } from "./orphan-companion-markdown.js";
|
|
18
|
+
export type { OrphanCompanionMarkdownTarget, PruneOrphanCompanionMarkdownResult, } from "./orphan-companion-markdown.js";
|
|
19
|
+
export type { CommentrayToml, ResolvedAngleDefinition, ResolvedAngles, ResolvedCommentrayConfig, ResolvedGithubNavLink, ResolvedStaticSite, StaticSiteStretchBufferSync, } from "./config.js";
|
|
20
|
+
export { DEFAULT_STRETCH_BUFFER_SYNC, loadCommentrayConfig, mergeCommentrayConfig, } from "./config.js";
|
|
16
21
|
export { githubRepoBlobFileUrl, parseGithubRepoWebUrl } from "./github-url.js";
|
|
17
22
|
export { assertValidIndex, emptyIndex } from "./metadata.js";
|
|
18
23
|
export { describeIndexSchemaRemediation } from "./index-schema-messages.js";
|
|
@@ -31,11 +36,16 @@ export type { ValidationIssue, ValidationResult, ValidateProjectOptions, } from
|
|
|
31
36
|
export { readIndex, refreshIndexMigrationsOnDisk, validateProject, writeIndex, } from "./validate-project.js";
|
|
32
37
|
export { plannedSymbolResolutionStrategy } from "./language-intelligence.js";
|
|
33
38
|
export type { SymbolResolutionStrategy } from "./language-intelligence.js";
|
|
39
|
+
export type { HeightAdjustable, Identifiable, SyncRegionContinuationKind, WithHeight, } from "./height-adjustable.js";
|
|
40
|
+
export { BufferingFlowSynchronizer, NON_SYNC_TAIL_SLACK_ITEM_ID, } from "./buffering-flow-synchronizer.js";
|
|
41
|
+
export { APPROVAL_GRID_STANDARD, APPROVAL_HUMAN_BREAK_ROW, approvalHumanBreakFullRow, inferApprovalGridFormatFromAscii, printApprovalFlowSection, printApprovalSynchronizedFlow, } from "./buffering-flow-synchronizer-approval-printer.js";
|
|
42
|
+
export type { ApprovalFlowSection, ApprovalGridFormat, } from "./buffering-flow-synchronizer-approval-printer.js";
|
|
43
|
+
export { parseApprovalFlowSections, parseApprovalFlowSectionsWithFormat, parseApprovalRows, splitApprovalLineToCells, } from "./approval-flow-grid.js";
|
|
34
44
|
export { relocationHintMessages } from "./relocation-hints.js";
|
|
35
45
|
export type { RelocationHintsInput } from "./relocation-hints.js";
|
|
36
46
|
export { runCommanderMain } from "./cli-bootstrap.js";
|
|
37
|
-
export type { BlockScrollLink } from "./scroll-sync.js";
|
|
38
|
-
export { buildBlockScrollLinks, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, } from "./scroll-sync.js";
|
|
47
|
+
export type { BlockScrollLink, BlockScrollStickyState } from "./scroll-sync.js";
|
|
48
|
+
export { blockStrictlyContainingSourceViewportLine, buildBlockScrollLinks, commentrayProbeInStrictInterMarkerGap, DEFAULT_COMMENTRAY_VIEWPORT_HYSTERESIS_LINES, DEFAULT_SOURCE_VIEWPORT_HYSTERESIS_LINES, pickBlockScrollLinkForCommentrayScroll, pickBlockScrollLinkForCommentrayViewportWithHysteresis, pickBlockScrollLinkForSourceViewportTop, pickBlockScrollLinkForSourceViewportWithHysteresis, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, sourceTopLineStrictlyBeforeFirstIndexLine, } from "./scroll-sync.js";
|
|
39
49
|
export { commentrayRegionInsertions, lineCommentLeaderForLanguage, markerViewportHalfOpen1Based, parseCommentrayRegionBoundary, sourceLineRangeForMarkerId, } from "./source-markers.js";
|
|
40
50
|
export type { RegionMarkerNamingHintStrategy, RegionMarkerNamingInput, RegionMarkerNamingRange, RegionMarkerNamingStrategy, } from "./region-marker-naming.js";
|
|
41
51
|
export { CallbackRegionMarkerNamingStrategy, CodeStructureHintStrategy, CompositeRegionMarkerNamingStrategy, defaultRegionMarkerNamingStrategy, EnclosingSymbolHintStrategy, MarkdownHeadingHintStrategy, TomlTableHeaderHintStrategy, tryCodeStructureNameHint, tryMarkdownHeadingTitleAbove, tryNormaliseContextLabelToMarkerId, tryTomlTablePathAboveSelection, } from "./region-marker-naming.js";
|
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,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC9E,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,wBAAwB,EACxB,YAAY,EACZ,6CAA6C,EAC7C,8CAA8C,GAC/C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,wCAAwC,GACzC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,wCAAwC,EACxC,wBAAwB,EACxB,qCAAqC,GACtC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AACzC,YAAY,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}
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,11 @@ export { applyAnglesFlatMigrationToCommentrayToml, ensureAnglesSentinelFile, ups
|
|
|
5
5
|
export { defaultAngleIdForOpen, FALLBACK_DEFAULT_ANGLE_ID, resolveCommentrayMarkdownPath, } from "./commentray-path-resolution.js";
|
|
6
6
|
export { commentrayAnglesLayoutEnabled, commentrayAnglesSentinelPath, commentrayMarkdownPath, commentrayMarkdownPathForAngle, defaultMetadataIndexPath, normalizeRepoRelativePath, resolvePathUnderRepoRoot, } from "./paths.js";
|
|
7
7
|
export { findMonorepoPackagesDir, monorepoLayoutStartDir } from "./monorepo-layout.js";
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
8
|
+
export { defaultCommentrayStaticBrowsePathResolver } from "./browse-path-default.js";
|
|
9
|
+
export { staticBrowseIndexRelPathFromPair } from "./commentray-static-browse-path.js";
|
|
10
|
+
export { commentrayPairSourceFileExistsOnDisk, discoverCommentrayPairsOnDisk, pairFromCommentraySourceRel, } from "./commentray-disk-pairs.js";
|
|
11
|
+
export { collectOrphanCompanionMarkdownTargets, orphanCompanionCleanupAbsPath, pruneOrphanCompanionMarkdown, } from "./orphan-companion-markdown.js";
|
|
12
|
+
export { DEFAULT_STRETCH_BUFFER_SYNC, loadCommentrayConfig, mergeCommentrayConfig, } from "./config.js";
|
|
10
13
|
export { githubRepoBlobFileUrl, parseGithubRepoWebUrl } from "./github-url.js";
|
|
11
14
|
export { assertValidIndex, emptyIndex } from "./metadata.js";
|
|
12
15
|
export { describeIndexSchemaRemediation } from "./index-schema-messages.js";
|
|
@@ -18,9 +21,12 @@ export { applyPathRenamesToCommentrayIndex, inferAngleIdFromCommentrayPath, } fr
|
|
|
18
21
|
export { diagnoseBlock } from "./staleness.js";
|
|
19
22
|
export { readIndex, refreshIndexMigrationsOnDisk, validateProject, writeIndex, } from "./validate-project.js";
|
|
20
23
|
export { plannedSymbolResolutionStrategy } from "./language-intelligence.js";
|
|
24
|
+
export { BufferingFlowSynchronizer, NON_SYNC_TAIL_SLACK_ITEM_ID, } from "./buffering-flow-synchronizer.js";
|
|
25
|
+
export { APPROVAL_GRID_STANDARD, APPROVAL_HUMAN_BREAK_ROW, approvalHumanBreakFullRow, inferApprovalGridFormatFromAscii, printApprovalFlowSection, printApprovalSynchronizedFlow, } from "./buffering-flow-synchronizer-approval-printer.js";
|
|
26
|
+
export { parseApprovalFlowSections, parseApprovalFlowSectionsWithFormat, parseApprovalRows, splitApprovalLineToCells, } from "./approval-flow-grid.js";
|
|
21
27
|
export { relocationHintMessages } from "./relocation-hints.js";
|
|
22
28
|
export { runCommanderMain } from "./cli-bootstrap.js";
|
|
23
|
-
export { buildBlockScrollLinks, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, } from "./scroll-sync.js";
|
|
29
|
+
export { blockStrictlyContainingSourceViewportLine, buildBlockScrollLinks, commentrayProbeInStrictInterMarkerGap, DEFAULT_COMMENTRAY_VIEWPORT_HYSTERESIS_LINES, DEFAULT_SOURCE_VIEWPORT_HYSTERESIS_LINES, pickBlockScrollLinkForCommentrayScroll, pickBlockScrollLinkForCommentrayViewportWithHysteresis, pickBlockScrollLinkForSourceViewportTop, pickBlockScrollLinkForSourceViewportWithHysteresis, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, sourceTopLineStrictlyBeforeFirstIndexLine, } from "./scroll-sync.js";
|
|
24
30
|
export { commentrayRegionInsertions, lineCommentLeaderForLanguage, markerViewportHalfOpen1Based, parseCommentrayRegionBoundary, sourceLineRangeForMarkerId, } from "./source-markers.js";
|
|
25
31
|
export { CallbackRegionMarkerNamingStrategy, CodeStructureHintStrategy, CompositeRegionMarkerNamingStrategy, defaultRegionMarkerNamingStrategy, EnclosingSymbolHintStrategy, MarkdownHeadingHintStrategy, TomlTableHeaderHintStrategy, tryCodeStructureNameHint, tryMarkdownHeadingTitleAbove, tryNormaliseContextLabelToMarkerId, tryTomlTablePathAboveSelection, } from "./region-marker-naming.js";
|
|
26
32
|
export { convertCommentraySourceMarkersToLanguage, findCommentrayMarkerPairs, leadingIndentOfLine, } from "./region-marker-convert.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAS9E,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,wCAAwC,GACzC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,wCAAwC,EACxC,wBAAwB,EACxB,qCAAqC,GACtC,MAAM,kBAAkB,CAAC;AAK1B,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,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAS9E,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,wCAAwC,GACzC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,wCAAwC,EACxC,wBAAwB,EACxB,qCAAqC,GACtC,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AA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C,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Starting directory for locating the monorepo `packages/` folder: typically
|
|
3
3
|
* `dirname(import.meta.url)` in normal ESM, or `dirname(process.argv[1])` when
|
|
4
|
-
* `import.meta.url` is missing (e.g. code bundled into
|
|
4
|
+
* `import.meta.url` is missing (e.g. code bundled into the commentray CLI's single
|
|
5
5
|
* CJS file, where esbuild emits empty `import.meta` shims for nested packages).
|
|
6
6
|
*/
|
|
7
7
|
export declare function monorepoLayoutStartDir(importMetaUrl: string | undefined): string;
|
package/dist/monorepo-layout.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
/**
|
|
5
5
|
* Starting directory for locating the monorepo `packages/` folder: typically
|
|
6
6
|
* `dirname(import.meta.url)` in normal ESM, or `dirname(process.argv[1])` when
|
|
7
|
-
* `import.meta.url` is missing (e.g. code bundled into
|
|
7
|
+
* `import.meta.url` is missing (e.g. code bundled into the commentray CLI's single
|
|
8
8
|
* CJS file, where esbuild emits empty `import.meta` shims for nested packages).
|
|
9
9
|
*/
|
|
10
10
|
export function monorepoLayoutStartDir(importMetaUrl) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type OrphanCompanionMarkdownTarget = {
|
|
2
|
+
/** Repo-relative companion path (POSIX, e.g. `.commentray/source/docs/plan/plan.md/main.md`). */
|
|
3
|
+
commentrayPath: string;
|
|
4
|
+
/** Inferred primary source path the companion belongs to (missing as a regular file). */
|
|
5
|
+
sourcePath: string;
|
|
6
|
+
/** Absolute path to remove: a single `.md` file (flat) or an Angles directory under `source/`. */
|
|
7
|
+
absCleanupPath: string;
|
|
8
|
+
/** When true, `pruneOrphanCompanionMarkdown` removes a directory tree; otherwise one file. */
|
|
9
|
+
cleanupIsDirectory: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Absolute path under `{storage}/source/` to remove so this companion no longer appears in discovery.
|
|
13
|
+
* Flat: the lone `*.md` file. Angles: the per-source directory (parent of `*.md` angle files).
|
|
14
|
+
*/
|
|
15
|
+
export declare function orphanCompanionCleanupAbsPath(repoRoot: string, storageDirNorm: string, relFromSourceDir: string, anglesOn: boolean): string;
|
|
16
|
+
/**
|
|
17
|
+
* Lists companion Markdown trees/files under `{storage}/source/` whose inferred primary source file
|
|
18
|
+
* is missing from the repo (same rule as static nav / discover).
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectOrphanCompanionMarkdownTargets(repoRoot: string, storageDir?: string): Promise<OrphanCompanionMarkdownTarget[]>;
|
|
21
|
+
export type PruneOrphanCompanionMarkdownResult = {
|
|
22
|
+
/** Repo-relative POSIX paths that were removed (files) or directories (shown as trailing `/` optional — use absolute in log). */
|
|
23
|
+
removedAbsPaths: string[];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Deletes orphan companion storage discovered by {@link collectOrphanCompanionMarkdownTargets}.
|
|
27
|
+
* Only removes paths previously identified as orphan cleanup targets (under `{storage}/source/`).
|
|
28
|
+
*/
|
|
29
|
+
export declare function pruneOrphanCompanionMarkdown(repoRoot: string, storageDir?: string, options?: {
|
|
30
|
+
dryRun?: boolean;
|
|
31
|
+
}): Promise<PruneOrphanCompanionMarkdownResult>;
|
|
32
|
+
//# sourceMappingURL=orphan-companion-markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orphan-companion-markdown.d.ts","sourceRoot":"","sources":["../src/orphan-companion-markdown.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,iGAAiG;IACjG,cAAc,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,UAAU,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,cAAc,EAAE,MAAM,CAAC;IACvB,8FAA8F;IAC9F,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAUR;AAED;;;GAGG;AACH,wBAAsB,qCAAqC,CACzD,QAAQ,EAAE,MAAM,EAChB,UAAU,SAAgB,GACzB,OAAO,CAAC,6BAA6B,EAAE,CAAC,CAuC1C;AAED,MAAM,MAAM,kCAAkC,GAAG;IAC/C,iIAAiI;IACjI,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,MAAM,EAChB,UAAU,SAAgB,EAC1B,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7B,OAAO,CAAC,kCAAkC,CAAC,CAqB7C"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { rm, stat, unlink } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { commentrayAnglesLayoutEnabled, normalizeRepoRelativePath } from "./paths.js";
|
|
4
|
+
import { commentrayPairSourceFileExistsOnDisk, pairFromCommentraySourceRel, } from "./commentray-disk-pairs.js";
|
|
5
|
+
import { collectMdRelPathsUnderSourceAbs } from "./walk-commentray-source-md.js";
|
|
6
|
+
/**
|
|
7
|
+
* Absolute path under `{storage}/source/` to remove so this companion no longer appears in discovery.
|
|
8
|
+
* Flat: the lone `*.md` file. Angles: the per-source directory (parent of `*.md` angle files).
|
|
9
|
+
*/
|
|
10
|
+
export function orphanCompanionCleanupAbsPath(repoRoot, storageDirNorm, relFromSourceDir, anglesOn) {
|
|
11
|
+
const sourceAbs = path.join(repoRoot, ...storageDirNorm.split("/"), "source");
|
|
12
|
+
if (!anglesOn) {
|
|
13
|
+
return path.join(sourceAbs, ...relFromSourceDir.split("/"));
|
|
14
|
+
}
|
|
15
|
+
const parent = path.posix.dirname(relFromSourceDir);
|
|
16
|
+
if (parent === "." || parent === "") {
|
|
17
|
+
return path.join(sourceAbs, ...relFromSourceDir.split("/"));
|
|
18
|
+
}
|
|
19
|
+
return path.join(sourceAbs, ...parent.split("/"));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Lists companion Markdown trees/files under `{storage}/source/` whose inferred primary source file
|
|
23
|
+
* is missing from the repo (same rule as static nav / discover).
|
|
24
|
+
*/
|
|
25
|
+
export async function collectOrphanCompanionMarkdownTargets(repoRoot, storageDir = ".commentray") {
|
|
26
|
+
const storageNorm = normalizeRepoRelativePath(storageDir.replaceAll("\\", "/"));
|
|
27
|
+
const sourceAbs = path.join(repoRoot, ...storageNorm.split("/"), "source");
|
|
28
|
+
let rels;
|
|
29
|
+
try {
|
|
30
|
+
rels = await collectMdRelPathsUnderSourceAbs(sourceAbs);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const anglesOn = commentrayAnglesLayoutEnabled(repoRoot, storageDir);
|
|
36
|
+
const byCleanupAbs = new Map();
|
|
37
|
+
for (const rel of rels) {
|
|
38
|
+
const pair = pairFromCommentraySourceRel(storageNorm, rel, anglesOn);
|
|
39
|
+
if (!pair)
|
|
40
|
+
continue;
|
|
41
|
+
if (await commentrayPairSourceFileExistsOnDisk(repoRoot, pair.sourcePath))
|
|
42
|
+
continue;
|
|
43
|
+
const absCleanupPath = orphanCompanionCleanupAbsPath(repoRoot, storageNorm, rel, anglesOn);
|
|
44
|
+
let cleanupIsDirectory;
|
|
45
|
+
try {
|
|
46
|
+
const st = await stat(absCleanupPath);
|
|
47
|
+
cleanupIsDirectory = st.isDirectory();
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const key = absCleanupPath;
|
|
53
|
+
if (byCleanupAbs.has(key))
|
|
54
|
+
continue;
|
|
55
|
+
byCleanupAbs.set(key, {
|
|
56
|
+
commentrayPath: pair.commentrayPath,
|
|
57
|
+
sourcePath: pair.sourcePath,
|
|
58
|
+
absCleanupPath,
|
|
59
|
+
cleanupIsDirectory,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return [...byCleanupAbs.values()].sort((a, b) => a.commentrayPath.localeCompare(b.commentrayPath));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Deletes orphan companion storage discovered by {@link collectOrphanCompanionMarkdownTargets}.
|
|
66
|
+
* Only removes paths previously identified as orphan cleanup targets (under `{storage}/source/`).
|
|
67
|
+
*/
|
|
68
|
+
export async function pruneOrphanCompanionMarkdown(repoRoot, storageDir = ".commentray", options) {
|
|
69
|
+
const targets = await collectOrphanCompanionMarkdownTargets(repoRoot, storageDir);
|
|
70
|
+
const removedAbsPaths = [];
|
|
71
|
+
const dryRun = options?.dryRun === true;
|
|
72
|
+
const storageNorm = normalizeRepoRelativePath(storageDir.replaceAll("\\", "/"));
|
|
73
|
+
const sourceAbs = path.join(repoRoot, ...storageNorm.split("/"), "source");
|
|
74
|
+
for (const t of targets) {
|
|
75
|
+
if (!t.absCleanupPath.startsWith(sourceAbs))
|
|
76
|
+
continue;
|
|
77
|
+
if (dryRun) {
|
|
78
|
+
removedAbsPaths.push(t.absCleanupPath);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (t.cleanupIsDirectory) {
|
|
82
|
+
await rm(t.absCleanupPath, { recursive: true, maxRetries: 2, retryDelay: 50 });
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
await unlink(t.absCleanupPath);
|
|
86
|
+
}
|
|
87
|
+
removedAbsPaths.push(t.absCleanupPath);
|
|
88
|
+
}
|
|
89
|
+
return { removedAbsPaths };
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=orphan-companion-markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orphan-companion-markdown.js","sourceRoot":"","sources":["../src/orphan-companion-markdown.ts"],"names":[],"mappings":"AAAA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,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,eAAe,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/paths.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Normalize a repo-relative path to POSIX separators and reject anything that
|
|
3
|
-
* would escape the repository root when joined with it.
|
|
4
|
-
*
|
|
5
|
-
* Rejects:
|
|
6
|
-
* - Windows drive letters (e.g. `C:\foo`).
|
|
7
|
-
* - `..` path segments, which would let a config value or CLI argument walk
|
|
8
|
-
* out of the repo root.
|
|
9
|
-
*
|
|
10
|
-
* Accepts filenames that merely *contain* dots like `..name.ts`; only whole
|
|
11
|
-
* `..` segments are traversal.
|
|
12
|
-
*/
|
|
13
|
-
export declare function normalizeRepoRelativePath(relativePath: string): string;
|
|
1
|
+
export { normalizeRepoRelativePath } from "./repo-relative-path.js";
|
|
14
2
|
/**
|
|
15
3
|
* Resolve `repoRelative` under `repoRootAbs` after {@link normalizeRepoRelativePath} validation,
|
|
16
4
|
* then assert the absolute path cannot escape `repoRootAbs` (defense in depth for index or
|
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAS1F;AAED,sGAAsG;AACtG,wBAAgB,sBAAsB,CACpC,sBAAsB,EAAE,MAAM,EAC9B,UAAU,SAAgB,GACzB,MAAM,CAIR;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,SAAgB,GAAG,MAAM,CAG/E;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,UAAU,SAAgB,GACzB,OAAO,CAIT;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,sBAAsB,EAAE,MAAM,EAC9B,OAAO,EAAE,MAAM,EACf,UAAU,SAAgB,GACzB,MAAM,CAKR;AAED,uDAAuD;AACvD,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD"}
|
package/dist/paths.js
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { assertValidAngleId } from "./angles.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* would escape the repository root when joined with it.
|
|
7
|
-
*
|
|
8
|
-
* Rejects:
|
|
9
|
-
* - Windows drive letters (e.g. `C:\foo`).
|
|
10
|
-
* - `..` path segments, which would let a config value or CLI argument walk
|
|
11
|
-
* out of the repo root.
|
|
12
|
-
*
|
|
13
|
-
* Accepts filenames that merely *contain* dots like `..name.ts`; only whole
|
|
14
|
-
* `..` segments are traversal.
|
|
15
|
-
*/
|
|
16
|
-
export function normalizeRepoRelativePath(relativePath) {
|
|
17
|
-
const posix = relativePath.replaceAll("\\", "/");
|
|
18
|
-
if (/^[a-zA-Z]:\//.test(posix)) {
|
|
19
|
-
throw new Error(`Path must be repository-relative (got absolute: ${relativePath})`);
|
|
20
|
-
}
|
|
21
|
-
const stripped = posix.replace(/^\/+/, "");
|
|
22
|
-
const segments = stripped.split("/").filter((s) => s !== "" && s !== ".");
|
|
23
|
-
if (segments.some((s) => s === "..")) {
|
|
24
|
-
throw new Error(`Path escapes repository root: ${relativePath}`);
|
|
25
|
-
}
|
|
26
|
-
return segments.join("/");
|
|
27
|
-
}
|
|
4
|
+
import { normalizeRepoRelativePath } from "./repo-relative-path.js";
|
|
5
|
+
export { normalizeRepoRelativePath } from "./repo-relative-path.js";
|
|
28
6
|
/**
|
|
29
7
|
* Resolve `repoRelative` under `repoRootAbs` after {@link normalizeRepoRelativePath} validation,
|
|
30
8
|
* then assert the absolute path cannot escape `repoRootAbs` (defense in depth for index or
|
package/dist/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAmB,EAAE,YAAoB;IAChF,MAAM,GAAG,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,yCAAyC,YAAY,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,sGAAsG;AACtG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IACzE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,wBAAwB;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure path normalization for repo-relative strings (no filesystem).
|
|
3
|
+
* Kept separate from {@link ./paths.js} so browser bundles can import browse-path logic without `node:fs`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Normalize a repo-relative path to POSIX separators and reject anything that
|
|
7
|
+
* would escape the repository root when joined with it.
|
|
8
|
+
*
|
|
9
|
+
* Rejects:
|
|
10
|
+
* - Windows drive letters (e.g. `C:\foo`).
|
|
11
|
+
* - `..` path segments, which would let a config value or CLI argument walk
|
|
12
|
+
* out of the repo root.
|
|
13
|
+
*
|
|
14
|
+
* Accepts filenames that merely *contain* dots like `..name.ts`; only whole
|
|
15
|
+
* `..` segments are traversal.
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeRepoRelativePath(relativePath: string): string;
|
|
18
|
+
//# sourceMappingURL=repo-relative-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-relative-path.d.ts","sourceRoot":"","sources":["../src/repo-relative-path.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAWtE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure path normalization for repo-relative strings (no filesystem).
|
|
3
|
+
* Kept separate from {@link ./paths.js} so browser bundles can import browse-path logic without `node:fs`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Normalize a repo-relative path to POSIX separators and reject anything that
|
|
7
|
+
* would escape the repository root when joined with it.
|
|
8
|
+
*
|
|
9
|
+
* Rejects:
|
|
10
|
+
* - Windows drive letters (e.g. `C:\foo`).
|
|
11
|
+
* - `..` path segments, which would let a config value or CLI argument walk
|
|
12
|
+
* out of the repo root.
|
|
13
|
+
*
|
|
14
|
+
* Accepts filenames that merely *contain* dots like `..name.ts`; only whole
|
|
15
|
+
* `..` segments are traversal.
|
|
16
|
+
*/
|
|
17
|
+
export function normalizeRepoRelativePath(relativePath) {
|
|
18
|
+
const posix = relativePath.replaceAll("\\", "/");
|
|
19
|
+
if (/^[a-zA-Z]:\//.test(posix)) {
|
|
20
|
+
throw new Error(`Path must be repository-relative (got absolute: ${relativePath})`);
|
|
21
|
+
}
|
|
22
|
+
const stripped = posix.replace(/^\/+/, "");
|
|
23
|
+
const segments = stripped.split("/").filter((s) => s !== "" && s !== ".");
|
|
24
|
+
if (segments.some((s) => s === "..")) {
|
|
25
|
+
throw new Error(`Path escapes repository root: ${relativePath}`);
|
|
26
|
+
}
|
|
27
|
+
return segments.join("/");
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=repo-relative-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-relative-path.js","sourceRoot":"","sources":["../src/repo-relative-path.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CAAC,YAAoB;IAC5D,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACjD,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,mDAAmD,YAAY,GAAG,CAAC,CAAC;IACtF,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IAC1E,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,iCAAiC,YAAY,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/scroll-sync.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BlockScrollLink } from "./block-scroll-pickers.js";
|
|
2
2
|
import type { CommentrayIndex } from "./model.js";
|
|
3
|
-
export type { BlockScrollLink } from "./block-scroll-pickers.js";
|
|
4
|
-
export { pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, } from "./block-scroll-pickers.js";
|
|
3
|
+
export type { BlockScrollLink, BlockScrollStickyState } from "./block-scroll-pickers.js";
|
|
4
|
+
export { blockStrictlyContainingSourceViewportLine, commentrayProbeInStrictInterMarkerGap, DEFAULT_COMMENTRAY_VIEWPORT_HYSTERESIS_LINES, DEFAULT_SOURCE_VIEWPORT_HYSTERESIS_LINES, pickBlockScrollLinkForCommentrayScroll, pickBlockScrollLinkForCommentrayViewportWithHysteresis, pickBlockScrollLinkForSourceViewportTop, pickBlockScrollLinkForSourceViewportWithHysteresis, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, sourceTopLineStrictlyBeforeFirstIndexLine, } from "./block-scroll-pickers.js";
|
|
5
5
|
/**
|
|
6
6
|
* Correlate index blocks with `<!-- commentray:block id=… -->` markers in
|
|
7
7
|
* commentray. Supports legacy `lines:` anchors and `marker:` anchors (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-sync.d.ts","sourceRoot":"","sources":["../src/scroll-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"scroll-sync.d.ts","sourceRoot":"","sources":["../src/scroll-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EACL,yCAAyC,EACzC,qCAAqC,EACrC,4CAA4C,EAC5C,wCAAwC,EACxC,sCAAsC,EACtC,sDAAsD,EACtD,uCAAuC,EACvC,kDAAkD,EAClD,iCAAiC,EACjC,kCAAkC,EAClC,yCAAyC,GAC1C,MAAM,2BAA2B,CAAC;AAoCnC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EACzC,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,EAC1B,UAAU,CAAC,EAAE,MAAM,GAClB,eAAe,EAAE,CA0CnB"}
|
package/dist/scroll-sync.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parseAnchor } from "./anchors.js";
|
|
|
2
2
|
import { MARKER_ID_BODY } from "./marker-ids.js";
|
|
3
3
|
import { normalizeRepoRelativePath } from "./paths.js";
|
|
4
4
|
import { markerViewportHalfOpen1Based, sourceLineRangeForMarkerId } from "./source-markers.js";
|
|
5
|
-
export { pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, } from "./block-scroll-pickers.js";
|
|
5
|
+
export { blockStrictlyContainingSourceViewportLine, commentrayProbeInStrictInterMarkerGap, DEFAULT_COMMENTRAY_VIEWPORT_HYSTERESIS_LINES, DEFAULT_SOURCE_VIEWPORT_HYSTERESIS_LINES, pickBlockScrollLinkForCommentrayScroll, pickBlockScrollLinkForCommentrayViewportWithHysteresis, pickBlockScrollLinkForSourceViewportTop, pickBlockScrollLinkForSourceViewportWithHysteresis, pickCommentrayLineForSourceScroll, pickSourceLine0ForCommentrayScroll, sourceTopLineStrictlyBeforeFirstIndexLine, } from "./block-scroll-pickers.js";
|
|
6
6
|
const BLOCK_MARKER_RE = new RegExp(`<!-- commentray:block id=(${MARKER_ID_BODY}) -->`);
|
|
7
7
|
function markerLineByIdFromMarkdown(markdown) {
|
|
8
8
|
const map = new Map();
|
|
@@ -14,6 +14,26 @@ function markerLineByIdFromMarkdown(markdown) {
|
|
|
14
14
|
}
|
|
15
15
|
return map;
|
|
16
16
|
}
|
|
17
|
+
function buildMarkerFallbackLinks(markerLineById, sourceText) {
|
|
18
|
+
if (sourceText === undefined || markerLineById.size === 0)
|
|
19
|
+
return [];
|
|
20
|
+
const links = [];
|
|
21
|
+
for (const [id, commentrayLine] of markerLineById) {
|
|
22
|
+
const range = sourceLineRangeForMarkerId(sourceText, id);
|
|
23
|
+
const mv = markerViewportHalfOpen1Based(sourceText, id);
|
|
24
|
+
if (range === null || mv === null)
|
|
25
|
+
continue;
|
|
26
|
+
links.push({
|
|
27
|
+
id,
|
|
28
|
+
commentrayLine,
|
|
29
|
+
sourceStart: range.start,
|
|
30
|
+
sourceEnd: range.end,
|
|
31
|
+
markerViewportHalfOpen1Based: mv,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
links.sort((a, b) => a.sourceStart - b.sourceStart);
|
|
35
|
+
return links;
|
|
36
|
+
}
|
|
17
37
|
/**
|
|
18
38
|
* Correlate index blocks with `<!-- commentray:block id=… -->` markers in
|
|
19
39
|
* commentray. Supports legacy `lines:` anchors and `marker:` anchors (the
|
|
@@ -21,14 +41,15 @@ function markerLineByIdFromMarkdown(markdown) {
|
|
|
21
41
|
* Sorted by `sourceStart`.
|
|
22
42
|
*/
|
|
23
43
|
export function buildBlockScrollLinks(index, sourceRelative, commentrayPath, commentrayMarkdown, sourceText) {
|
|
44
|
+
const markerLineById = markerLineByIdFromMarkdown(commentrayMarkdown);
|
|
24
45
|
const entry = index?.byCommentrayPath[commentrayPath];
|
|
25
|
-
if (!entry || entry.sourcePath !== sourceRelative || entry.blocks.length === 0)
|
|
26
|
-
return
|
|
46
|
+
if (!entry || entry.sourcePath !== sourceRelative || entry.blocks.length === 0) {
|
|
47
|
+
return buildMarkerFallbackLinks(markerLineById, sourceText);
|
|
48
|
+
}
|
|
27
49
|
const entryCrNorm = normalizeRepoRelativePath(entry.commentrayPath.replaceAll("\\", "/"));
|
|
28
50
|
const lookupCrNorm = normalizeRepoRelativePath(commentrayPath.replaceAll("\\", "/"));
|
|
29
51
|
if (entryCrNorm !== lookupCrNorm)
|
|
30
|
-
return
|
|
31
|
-
const markerLineById = markerLineByIdFromMarkdown(commentrayMarkdown);
|
|
52
|
+
return buildMarkerFallbackLinks(markerLineById, sourceText);
|
|
32
53
|
const links = [];
|
|
33
54
|
for (const block of entry.blocks) {
|
|
34
55
|
const anchor = parseAnchor(block.anchor);
|
package/dist/scroll-sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-sync.js","sourceRoot":"","sources":["../src/scroll-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAG/F,OAAO,EACL,iCAAiC,EACjC,kCAAkC,
|
|
1
|
+
{"version":3,"file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Z,cAAc;gBACd,WAAW,EAAE,KAAK,CAAC,KAAK;gBACxB,SAAS,EAAE,KAAK,CAAC,GAAG;gBACpB,4BAA4B,EAAE,EAAE;aACjC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-project.d.ts","sourceRoot":"","sources":["../src/validate-project.ts"],"names":[],"mappings":"AAOA,OAAO,EAAoD,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-project.d.ts","sourceRoot":"","sources":["../src/validate-project.ts"],"names":[],"mappings":"AAOA,OAAO,EAAoD,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAapG,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C,CAAC;AAwLF,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAuD3B;AAiBD;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAqBvD;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CASjF;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAKxF"}
|
package/dist/validate-project.js
CHANGED
|
@@ -10,6 +10,7 @@ import { defaultMetadataIndexPath, normalizeRepoRelativePath } from "./paths.js"
|
|
|
10
10
|
import { extractCommentrayBlockIdsFromMarkdown, validateIndexMarkerSemantics, validateMarkerBoundariesInSource, validateMarkerRegionsAgainstIndexedSources, } from "./marker-validation.js";
|
|
11
11
|
import { loadGitTrackedSourceTextsOutsideIndex } from "./git-relocation-scan.js";
|
|
12
12
|
import { relocationHintMessages } from "./relocation-hints.js";
|
|
13
|
+
import { collectOrphanCompanionMarkdownTargets } from "./orphan-companion-markdown.js";
|
|
13
14
|
import { GitScmProvider } from "./scm/git-scm-provider.js";
|
|
14
15
|
function stagedPathsSet(paths) {
|
|
15
16
|
return new Set(paths.map((p) => normalizeRepoRelativePath(p)));
|
|
@@ -123,6 +124,41 @@ async function collectIssuesForLoadedIndex(repoRoot, index) {
|
|
|
123
124
|
}
|
|
124
125
|
return issues;
|
|
125
126
|
}
|
|
127
|
+
async function pushMissingStorageSubdirWarnings(repoRoot, storageDir, issues) {
|
|
128
|
+
const storageAbs = path.join(repoRoot, storageDir);
|
|
129
|
+
for (const sub of ["source", "metadata"]) {
|
|
130
|
+
const p = path.join(storageAbs, sub);
|
|
131
|
+
try {
|
|
132
|
+
await fs.stat(p);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
issues.push({
|
|
136
|
+
level: "warn",
|
|
137
|
+
message: `Missing directory: ${path.join(storageDir, sub)}`,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function pushOrphanCompanionMarkdownIssues(repoRoot, storageDir, issues) {
|
|
143
|
+
try {
|
|
144
|
+
const orphans = await collectOrphanCompanionMarkdownTargets(repoRoot, storageDir);
|
|
145
|
+
for (const o of orphans) {
|
|
146
|
+
const relCleanup = normalizeRepoRelativePath(path.relative(repoRoot, o.absCleanupPath).replaceAll("\\", "/"));
|
|
147
|
+
issues.push({
|
|
148
|
+
level: "error",
|
|
149
|
+
message: `Orphan companion Markdown: primary source "${o.sourcePath}" is not a readable file, but ` +
|
|
150
|
+
`companion storage exists (${o.commentrayPath}). Static browse and search would advertise a broken pair. ` +
|
|
151
|
+
`Delete this orphan with: commentray doctor --allow-deletions (removes ${relCleanup})`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
issues.push({
|
|
157
|
+
level: "warn",
|
|
158
|
+
message: `Could not scan for orphan companion Markdown: ${err instanceof Error ? err.message : String(err)}`,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
126
162
|
export async function validateProject(repoRoot, options) {
|
|
127
163
|
const issues = [];
|
|
128
164
|
let config;
|
|
@@ -136,19 +172,8 @@ export async function validateProject(repoRoot, options) {
|
|
|
136
172
|
});
|
|
137
173
|
return { issues };
|
|
138
174
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const p = path.join(storageAbs, sub);
|
|
142
|
-
try {
|
|
143
|
-
await fs.stat(p);
|
|
144
|
-
}
|
|
145
|
-
catch {
|
|
146
|
-
issues.push({
|
|
147
|
-
level: "warn",
|
|
148
|
-
message: `Missing directory: ${path.join(config.storageDir, sub)}`,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
175
|
+
await pushMissingStorageSubdirWarnings(repoRoot, config.storageDir, issues);
|
|
176
|
+
await pushOrphanCompanionMarkdownIssues(repoRoot, config.storageDir, issues);
|
|
152
177
|
let index = null;
|
|
153
178
|
try {
|
|
154
179
|
index = await readIndex(repoRoot);
|