@beehexa/hexasync-template-assets 2608.8.3 → 2608.20.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beehexa/hexasync-template-assets",
3
- "version": "2608.8.3",
3
+ "version": "2608.20.18",
4
4
  "description": "Canonical intellisense asset installation. Pure core: ports in, no IO.",
5
5
  "license": "SEE LICENSE IN ../../LICENSE",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "main": "./dist/index.js",
21
21
  "types": "./dist/index.d.ts",
22
22
  "dependencies": {
23
- "@beehexa/hexasync-template-model": "2608.8.3"
23
+ "@beehexa/hexasync-template-model": "2608.20.18"
24
24
  },
25
25
  "hexasync": {
26
26
  "layer": "core"
@@ -1,96 +0,0 @@
1
- /**
2
- * Asset-name policy — the trust boundary for anything an `AssetSource` reports.
3
- *
4
- * A relative path from a source is UNTRUSTED INPUT that we are about to splice
5
- * into a URI string. The first version of this code validated *after* joining,
6
- * which is unsound: a URI parser decodes percent-escapes, so `%2e%2e` is an
7
- * ordinary opaque segment to a string check and a `..` to `new URL()` /
8
- * `vscode.Uri.parse()`. The guard approved a path the sink then resolved
9
- * somewhere else entirely — a directory traversal, and worse, one that the two
10
- * hosts disagreed about (Node's `fileURLToPath` rejects `%2f`, `vscode-uri`
11
- * decodes it), which is precisely the desktop-vs-web identity split AD-18
12
- * exists to prevent.
13
- *
14
- * So the order is inverted and the policy is an ALLOWLIST:
15
- *
16
- * 1. split on `/` FIRST, while the string is still a path;
17
- * 2. accept a segment only if it matches `ASSET_SEGMENT_PATTERN`;
18
- * 3. only then encode and join.
19
- *
20
- * An allowlist is the right shape here because the asset bundle is content we
21
- * author — JSON schemas and markdown. Nothing legitimate in it needs a space, a
22
- * `%`, a `#`, a `?`, a backslash or a non-ASCII character, and each of those is
23
- * a known way to make a path mean two different things. A denylist of dot-shapes
24
- * loses this argument permanently: `..`, `%2e%2e`, `%2E%2E`, `.%2e`, `%2e.`,
25
- * `..%2f`, `%252e%252e` are all the same attack wearing different hats.
26
- *
27
- * Pure string work. No IO, no Node builtins (AD-3).
28
- */
29
- /** Bundle metadata, not an asset. Lives at the bundle root. */
30
- export declare const BUNDLE_VERSION_FILENAME = "BUNDLE_VERSION";
31
- /**
32
- * One path segment: ASCII letters, digits, `.`, `_`, `-`. Nothing else.
33
- *
34
- * Deliberately excludes every character with meaning to a URI (`%` `#` `?` `/`
35
- * `\` `:` `@`) and everything non-ASCII, so an accepted segment cannot change
36
- * meaning when it is parsed as a URI on either host.
37
- */
38
- export declare const ASSET_SEGMENT_PATTERN: RegExp;
39
- /**
40
- * True for a name that belongs in an install.
41
- *
42
- * ONE definition, used by every adapter. The Node and VS Code walkers each had
43
- * their own copy and had already drifted — one installed `.gitkeep`, the other
44
- * skipped it — so the same bundle produced two different manifests. That is the
45
- * exact divergence FR-17 ("one implementation") forbids, so the policy lives in
46
- * core where neither host can hold a private opinion about it.
47
- *
48
- * Dotfiles are tooling artifacts (`.gitkeep`, `.DS_Store`), not assets.
49
- *
50
- * @param atBundleRoot whether this entry sits directly in the bundle root.
51
- * Depth matters: metadata is only metadata at the root. Defaults to `true` so
52
- * a caller that forgets it errs toward *excluding* a metadata-named file
53
- * rather than shipping one.
54
- */
55
- export declare function isAssetFileName(name: string, atBundleRoot?: boolean): boolean;
56
- export declare class AssetPathError extends Error {
57
- constructor(message: string);
58
- }
59
- /**
60
- * Validates an asset-relative path and returns its segments.
61
- *
62
- * Throws `AssetPathError` naming the offending segment and what to do about it —
63
- * a bundle author reading this needs to know which file to rename.
64
- */
65
- export declare function parseAssetRelativePath(relativePath: string): string[];
66
- /**
67
- * Percent-encodes each segment for splicing into a URI.
68
- *
69
- * For any segment `parseAssetRelativePath` accepts this is the identity function
70
- * — every allowed character is URI-unreserved. It is applied anyway so that the
71
- * encode step is structurally present: if the allowlist is ever widened, paths
72
- * stay correctly encoded instead of silently reacquiring the traversal bug.
73
- */
74
- export declare function encodeAssetSegments(segments: readonly string[]): string;
75
- /**
76
- * Parses a `BUNDLE_VERSION` file's contents into a monotonic integer (AD-16).
77
- *
78
- * Strict on purpose. `Number.parseInt` is far too generous for a value whose
79
- * whole job is to be *ordered*: it reads `"1e10"` as 1, `"0x10"` as 0 and
80
- * `"12abc"` as 12, each of which inverts a comparison Story 2.5 will make. Both
81
- * adapters had their own copy of the lax version; this is the only one now.
82
- */
83
- export declare function parseBundleVersion(raw: string, sourceLabel: string): number;
84
- /** The two independently-installable halves of the bundle (FR-22, Story 2.7). */
85
- export type AssetKind = 'schemas' | 'docs' | 'all';
86
- /** Documentation lives under this prefix; everything else is schema. */
87
- export declare const DOCS_PREFIX = "docs/";
88
- /**
89
- * True when a bundle path belongs to the requested half.
90
- *
91
- * `Install Documentation` and `Install IntelliSense` must each succeed alone, and the manifest
92
- * has to reflect exactly what was installed — so the split is decided here, once, rather than
93
- * by each caller filtering its own source and drifting.
94
- */
95
- export declare function isKind(relativePath: string, kind: AssetKind): boolean;
96
- //# sourceMappingURL=assetPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assetPath.d.ts","sourceRoot":"","sources":["../src/assetPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAsB,CAAC;AAkBzD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,UAAO,GAAG,OAAO,CAG1E;AAED,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CA+CrE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEvE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAgB3E;AAED,iFAAiF;AACjF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;AAEnD,wEAAwE;AACxE,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAIrE"}
package/dist/assetPath.js DELETED
@@ -1,170 +0,0 @@
1
- /**
2
- * Asset-name policy — the trust boundary for anything an `AssetSource` reports.
3
- *
4
- * A relative path from a source is UNTRUSTED INPUT that we are about to splice
5
- * into a URI string. The first version of this code validated *after* joining,
6
- * which is unsound: a URI parser decodes percent-escapes, so `%2e%2e` is an
7
- * ordinary opaque segment to a string check and a `..` to `new URL()` /
8
- * `vscode.Uri.parse()`. The guard approved a path the sink then resolved
9
- * somewhere else entirely — a directory traversal, and worse, one that the two
10
- * hosts disagreed about (Node's `fileURLToPath` rejects `%2f`, `vscode-uri`
11
- * decodes it), which is precisely the desktop-vs-web identity split AD-18
12
- * exists to prevent.
13
- *
14
- * So the order is inverted and the policy is an ALLOWLIST:
15
- *
16
- * 1. split on `/` FIRST, while the string is still a path;
17
- * 2. accept a segment only if it matches `ASSET_SEGMENT_PATTERN`;
18
- * 3. only then encode and join.
19
- *
20
- * An allowlist is the right shape here because the asset bundle is content we
21
- * author — JSON schemas and markdown. Nothing legitimate in it needs a space, a
22
- * `%`, a `#`, a `?`, a backslash or a non-ASCII character, and each of those is
23
- * a known way to make a path mean two different things. A denylist of dot-shapes
24
- * loses this argument permanently: `..`, `%2e%2e`, `%2E%2E`, `.%2e`, `%2e.`,
25
- * `..%2f`, `%252e%252e` are all the same attack wearing different hats.
26
- *
27
- * Pure string work. No IO, no Node builtins (AD-3).
28
- */
29
- /** Bundle metadata, not an asset. Lives at the bundle root. */
30
- export const BUNDLE_VERSION_FILENAME = 'BUNDLE_VERSION';
31
- /**
32
- * One path segment: ASCII letters, digits, `.`, `_`, `-`. Nothing else.
33
- *
34
- * Deliberately excludes every character with meaning to a URI (`%` `#` `?` `/`
35
- * `\` `:` `@`) and everything non-ASCII, so an accepted segment cannot change
36
- * meaning when it is parsed as a URI on either host.
37
- */
38
- export const ASSET_SEGMENT_PATTERN = /^[A-Za-z0-9._-]+$/;
39
- /**
40
- * Files that describe the bundle rather than belonging to it.
41
- *
42
- * These are metadata **at the bundle root only**. A `README.md` inside
43
- * `docs/` is genuine installable content; the one beside `BUNDLE_VERSION` is a
44
- * note to whoever maintains the bundle. Getting this wrong is not cosmetic: the
45
- * first real run of the editor install command copied our own maintainer note
46
- * ("this directory is the source of truth; install targets are downstream") into
47
- * the user's workspace and reported it as a successfully installed IntelliSense
48
- * asset.
49
- */
50
- const ROOT_METADATA_NAMES = [
51
- BUNDLE_VERSION_FILENAME,
52
- 'README.md',
53
- ];
54
- /**
55
- * True for a name that belongs in an install.
56
- *
57
- * ONE definition, used by every adapter. The Node and VS Code walkers each had
58
- * their own copy and had already drifted — one installed `.gitkeep`, the other
59
- * skipped it — so the same bundle produced two different manifests. That is the
60
- * exact divergence FR-17 ("one implementation") forbids, so the policy lives in
61
- * core where neither host can hold a private opinion about it.
62
- *
63
- * Dotfiles are tooling artifacts (`.gitkeep`, `.DS_Store`), not assets.
64
- *
65
- * @param atBundleRoot whether this entry sits directly in the bundle root.
66
- * Depth matters: metadata is only metadata at the root. Defaults to `true` so
67
- * a caller that forgets it errs toward *excluding* a metadata-named file
68
- * rather than shipping one.
69
- */
70
- export function isAssetFileName(name, atBundleRoot = true) {
71
- if (name.startsWith('.'))
72
- return false;
73
- return !(atBundleRoot && ROOT_METADATA_NAMES.includes(name));
74
- }
75
- export class AssetPathError extends Error {
76
- constructor(message) {
77
- super(message);
78
- this.name = 'AssetPathError';
79
- }
80
- }
81
- /**
82
- * Validates an asset-relative path and returns its segments.
83
- *
84
- * Throws `AssetPathError` naming the offending segment and what to do about it —
85
- * a bundle author reading this needs to know which file to rename.
86
- */
87
- export function parseAssetRelativePath(relativePath) {
88
- const raw = String(relativePath);
89
- if (raw === '') {
90
- throw new AssetPathError('Refusing an empty asset path: it names no file.');
91
- }
92
- // Checked before splitting: a backslash is a separator on one host and a
93
- // filename character on another, so it can never be allowed through.
94
- if (raw.includes('\\')) {
95
- throw new AssetPathError(`Refusing asset path "${raw}": it contains a backslash. Use "/" as the separator — ` +
96
- `a backslash is a path separator on Windows and a filename character elsewhere, ` +
97
- `so the same bundle would install differently per platform.`);
98
- }
99
- if (raw.startsWith('/')) {
100
- throw new AssetPathError(`Refusing asset path "${raw}": asset paths must be relative to the bundle root. ` +
101
- `An absolute path is malformed input, not a location.`);
102
- }
103
- const segments = raw.split('/');
104
- for (const segment of segments) {
105
- if (segment === '') {
106
- throw new AssetPathError(`Refusing asset path "${raw}": it has an empty path segment ` +
107
- `(a leading, trailing or doubled "/").`);
108
- }
109
- if (segment === '.' || segment === '..') {
110
- throw new AssetPathError(`Refusing asset path "${raw}": the segment "${segment}" is a relative-path ` +
111
- `reference, which could move the install outside its target.`);
112
- }
113
- if (!ASSET_SEGMENT_PATTERN.test(segment)) {
114
- throw new AssetPathError(`Refusing asset path "${raw}": the segment "${segment}" contains characters that are ` +
115
- `not allowed in an asset name. Allowed: ASCII letters, digits, ".", "_" and "-". ` +
116
- `Characters such as a space, "%", "#", "?" or ":" change meaning when the path is ` +
117
- `parsed as a URI, so the file could be written somewhere other than where the ` +
118
- `manifest records it. Rename the asset.`);
119
- }
120
- }
121
- return segments;
122
- }
123
- /**
124
- * Percent-encodes each segment for splicing into a URI.
125
- *
126
- * For any segment `parseAssetRelativePath` accepts this is the identity function
127
- * — every allowed character is URI-unreserved. It is applied anyway so that the
128
- * encode step is structurally present: if the allowlist is ever widened, paths
129
- * stay correctly encoded instead of silently reacquiring the traversal bug.
130
- */
131
- export function encodeAssetSegments(segments) {
132
- return segments.map((segment) => encodeURIComponent(segment)).join('/');
133
- }
134
- /**
135
- * Parses a `BUNDLE_VERSION` file's contents into a monotonic integer (AD-16).
136
- *
137
- * Strict on purpose. `Number.parseInt` is far too generous for a value whose
138
- * whole job is to be *ordered*: it reads `"1e10"` as 1, `"0x10"` as 0 and
139
- * `"12abc"` as 12, each of which inverts a comparison Story 2.5 will make. Both
140
- * adapters had their own copy of the lax version; this is the only one now.
141
- */
142
- export function parseBundleVersion(raw, sourceLabel) {
143
- const trimmed = String(raw).trim();
144
- if (!/^\d+$/.test(trimmed)) {
145
- throw new AssetPathError(`Invalid BUNDLE_VERSION in ${sourceLabel}: ${JSON.stringify(trimmed)} is not a ` +
146
- `non-negative integer. The asset bundle is versioned by a monotonic integer (AD-16).`);
147
- }
148
- const parsed = Number(trimmed);
149
- if (!Number.isSafeInteger(parsed)) {
150
- throw new AssetPathError(`Invalid BUNDLE_VERSION in ${sourceLabel}: ${JSON.stringify(trimmed)} exceeds the ` +
151
- `safe integer range, so version comparisons would be unreliable.`);
152
- }
153
- return parsed;
154
- }
155
- /** Documentation lives under this prefix; everything else is schema. */
156
- export const DOCS_PREFIX = 'docs/';
157
- /**
158
- * True when a bundle path belongs to the requested half.
159
- *
160
- * `Install Documentation` and `Install IntelliSense` must each succeed alone, and the manifest
161
- * has to reflect exactly what was installed — so the split is decided here, once, rather than
162
- * by each caller filtering its own source and drifting.
163
- */
164
- export function isKind(relativePath, kind) {
165
- if (kind === 'all')
166
- return true;
167
- const isDoc = relativePath.startsWith(DOCS_PREFIX);
168
- return kind === 'docs' ? isDoc : !isDoc;
169
- }
170
- //# sourceMappingURL=assetPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assetPath.js","sourceRoot":"","sources":["../src/assetPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,+DAA+D;A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AAC,OAAO,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,cAAc,CACtB,6BAA6B,WAAW,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe;YACjF,iEAAiE,CACpE,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAKD,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,YAAoB,EAAE,IAAe;IAC1D,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1C,CAAC"}
@@ -1,44 +0,0 @@
1
- import type { AssetSource, FileReader, Hasher } from './ports.js';
2
- /**
3
- * What an update would do to one file.
4
- *
5
- * `unknown` is the important one: it means there is no manifest to compare against, so we
6
- * cannot tell an untouched file from an edited one. It is treated as potentially modified
7
- * rather than assumed safe — assets installed by hand before manifests existed are exactly
8
- * the case where silently overwriting would lose the most.
9
- */
10
- export type FileState = 'unchanged' | 'locally-modified' | 'outdated' | 'newer-than-installer' | 'missing' | 'added' | 'unknown';
11
- export interface ClassifiedFile {
12
- readonly path: string;
13
- readonly state: FileState;
14
- /** True when writing this file would discard something the developer cannot recover. */
15
- readonly destructive: boolean;
16
- readonly reason: string;
17
- /**
18
- * The checksum the manifest recorded at install time, when there was one.
19
- *
20
- * Exposed because a declined overwrite must carry this value forward rather than the file's
21
- * current one: recording what is on disk would make the edit look like the installed state,
22
- * and the next update would classify it `outdated` — safe to overwrite — which is precisely
23
- * the loss this feature exists to prevent.
24
- */
25
- readonly installedChecksum?: string;
26
- }
27
- export interface ClassifyOptions {
28
- readonly source: AssetSource;
29
- readonly reader: FileReader;
30
- readonly hasher: Hasher;
31
- readonly targetUri: string;
32
- }
33
- export interface Classification {
34
- readonly destinationUri: string;
35
- readonly installedBundleVersion?: number;
36
- readonly availableBundleVersion: number;
37
- readonly pinned: boolean;
38
- readonly hasManifest: boolean;
39
- readonly files: readonly ClassifiedFile[];
40
- }
41
- export declare function classifyTarget(options: ClassifyOptions): Promise<Classification>;
42
- /** Counts by state, for a one-line summary. */
43
- export declare function summariseClassification(classification: Classification): Record<FileState, number>;
44
- //# sourceMappingURL=classify.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../src/classify.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGlE;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,kBAAkB,GAClB,UAAU,GACV,sBAAsB,GACtB,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,wFAAwF;IACxF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;CAC3C;AAkBD,wBAAsB,cAAc,CAClC,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CA2HzB;AAED,+CAA+C;AAC/C,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,GAC7B,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAY3B"}
package/dist/classify.js DELETED
@@ -1,147 +0,0 @@
1
- /**
2
- * Classifying an installed target before an update overwrites it (FR-21).
3
- *
4
- * The whole point is that an update must never destroy work a developer did in the target.
5
- * That is only decidable by comparing three things — what the bundle has now, what the
6
- * manifest recorded at install time, and what is actually on disk — so all three are read
7
- * before anything is written.
8
- *
9
- * Pure: no IO of its own (AD-4), everything arrives through ports.
10
- */
11
- import { AssetPathError, encodeAssetSegments, parseAssetRelativePath, } from './assetPath.js';
12
- import { CANONICAL_SUBPATH, MANIFEST_FILENAME, } from './install.js';
13
- import { joinUri, normalizeUri } from '@beehexa/hexasync-template-model';
14
- /** The manifest as installed, or undefined when there is none. */
15
- async function readManifest(reader, destinationUri) {
16
- const bytes = await reader.read(joinUri(destinationUri, MANIFEST_FILENAME));
17
- if (bytes === undefined)
18
- return undefined;
19
- try {
20
- return JSON.parse(new TextDecoder().decode(bytes));
21
- }
22
- catch {
23
- // A truncated manifest is worse than none: it would be read as authoritative while
24
- // describing a subset. Treated as absent, which routes every file through `unknown`.
25
- return undefined;
26
- }
27
- }
28
- export async function classifyTarget(options) {
29
- const { source, reader, hasher } = options;
30
- const targetUri = normalizeUri(options.targetUri);
31
- const destinationUri = joinUri(targetUri, CANONICAL_SUBPATH);
32
- const availableBundleVersion = await source.bundleVersion();
33
- const manifest = await readManifest(reader, destinationUri);
34
- const recorded = new Map((manifest?.files ?? []).map((f) => [f.path, f.checksum]));
35
- const bundlePaths = [...(await source.list())].sort();
36
- const files = [];
37
- for (const path of bundlePaths) {
38
- let uri;
39
- try {
40
- uri = joinUri(destinationUri, encodeAssetSegments(parseAssetRelativePath(path)));
41
- }
42
- catch (error) {
43
- if (error instanceof AssetPathError)
44
- continue;
45
- throw error;
46
- }
47
- const onDisk = await reader.read(uri);
48
- const bundleBytes = await source.read(path);
49
- const bundleChecksum = await hasher.hash(bundleBytes);
50
- if (onDisk === undefined) {
51
- files.push({
52
- path,
53
- state: 'missing',
54
- destructive: false,
55
- reason: 'In the bundle but not installed. An update adds it.',
56
- });
57
- continue;
58
- }
59
- const diskChecksum = await hasher.hash(onDisk);
60
- const installedChecksum = recorded.get(path);
61
- if (installedChecksum === undefined) {
62
- // On disk, in the bundle, unrecorded — either no manifest at all, or a file that
63
- // arrived by hand. Either way its provenance is unknown.
64
- files.push({
65
- path,
66
- state: 'unknown',
67
- destructive: diskChecksum !== bundleChecksum,
68
- reason: manifest === undefined
69
- ? 'No manifest to compare against, so local edits cannot be ruled out.'
70
- : 'Installed but absent from the manifest, so its provenance is unknown.',
71
- });
72
- continue;
73
- }
74
- if (diskChecksum === bundleChecksum) {
75
- files.push({
76
- path,
77
- state: 'unchanged',
78
- destructive: false,
79
- reason: 'Identical to the bundle. Nothing to do.',
80
- });
81
- continue;
82
- }
83
- if (diskChecksum === installedChecksum) {
84
- files.push({
85
- path,
86
- state: 'outdated',
87
- destructive: false,
88
- reason: 'Untouched since install, and the bundle has moved on. Safe to update.',
89
- installedChecksum,
90
- });
91
- continue;
92
- }
93
- // Differs from BOTH the bundle and what was installed: the developer edited it.
94
- files.push({
95
- path,
96
- state: 'locally-modified',
97
- destructive: true,
98
- reason: 'Edited since install. Overwriting would discard those edits.',
99
- installedChecksum,
100
- });
101
- }
102
- // Anything recorded or present that the bundle no longer has.
103
- for (const [path] of recorded) {
104
- if (bundlePaths.includes(path))
105
- continue;
106
- files.push({
107
- path,
108
- state: 'added',
109
- destructive: false,
110
- reason: 'Installed previously but no longer in the bundle. Left in place.',
111
- });
112
- }
113
- const installedVersion = manifest?.assetBundleVersion;
114
- const newer = installedVersion !== undefined && installedVersion > availableBundleVersion;
115
- return {
116
- destinationUri,
117
- installedBundleVersion: installedVersion,
118
- availableBundleVersion,
119
- pinned: manifest?.pinned === true,
120
- hasManifest: manifest !== undefined,
121
- files: newer
122
- ? files.map((f) => f.state === 'outdated' || f.state === 'unchanged'
123
- ? {
124
- ...f,
125
- state: 'newer-than-installer',
126
- reason: `Installed bundle ${installedVersion} is newer than the installer's ${availableBundleVersion}. Not downgraded.`,
127
- }
128
- : f)
129
- : files,
130
- };
131
- }
132
- /** Counts by state, for a one-line summary. */
133
- export function summariseClassification(classification) {
134
- const counts = {
135
- unchanged: 0,
136
- 'locally-modified': 0,
137
- outdated: 0,
138
- 'newer-than-installer': 0,
139
- missing: 0,
140
- added: 0,
141
- unknown: 0,
142
- };
143
- for (const file of classification.files)
144
- counts[file.state] += 1;
145
- return counts;
146
- }
147
- //# sourceMappingURL=classify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classify.js","sourceRoot":"","sources":["../src/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAoDzE,kEAAkE;AAClE,KAAK,UAAU,YAAY,CACzB,MAAkB,EAClB,cAAsB;IAEtB,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC5E,IAAI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,CAAC,KAAK;KACV,CAAC;AACJ,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,uBAAuB,CACrC,cAA8B;IAE9B,MAAM,MAAM,GAAG;QACb,SAAS,EAAE,CAAC;QACZ,kBAAkB,EAAE,CAAC;QACrB,QAAQ,EAAE,CAAC;QACX,sBAAsB,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;KACyB,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export { ASSET_SEGMENT_PATTERN, AssetPathError, BUNDLE_VERSION_FILENAME, DOCS_PREFIX, isKind, type AssetKind, encodeAssetSegments, isAssetFileName, parseAssetRelativePath, parseBundleVersion, } from './assetPath.js';
2
- export { AssetInstallError, CANONICAL_SUBPATH, MANIFEST_FILENAME, installAssets, type InstallManifest, type InstallOptions, type InstallProgress, type InstallResult, type InstalledFile, } from './install.js';
3
- export type { AssetSource, Clock, FileSink, Hasher } from './ports.js';
4
- export { basenameUri, dirnameUri, isInsideUri, joinUri, normalizeUri, relativeUri, resolveUri, } from '@beehexa/hexasync-template-model';
5
- export { classifyTarget, summariseClassification, type ClassifiedFile, type Classification, type ClassifyOptions, type FileState, } from './classify.js';
6
- export { assertInstalled, updateAssets, type ConfirmOverwrite, type OverwriteDiff, type UpdateOptions, type UpdateOutcome, type UpdateResult, } from './update.js';
7
- export type { FileReader } from './ports.js';
8
- export { COLLECTIONS, FILENAME_CONVENTION, MAX_COLLECTIONS_PER_FILE, declaredCollections, lintDocument, summariseLint, type Collection, type LintDiagnostic, type LintSummary, type Severity, } from './lint.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,MAAM,EACN,KAAK,SAAS,EACd,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,QAAQ,GACd,MAAM,WAAW,CAAC"}
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- export { ASSET_SEGMENT_PATTERN, AssetPathError, BUNDLE_VERSION_FILENAME, DOCS_PREFIX, isKind, encodeAssetSegments, isAssetFileName, parseAssetRelativePath, parseBundleVersion, } from './assetPath.js';
2
- export { AssetInstallError, CANONICAL_SUBPATH, MANIFEST_FILENAME, installAssets, } from './install.js';
3
- export { basenameUri, dirnameUri, isInsideUri, joinUri, normalizeUri, relativeUri, resolveUri, } from '@beehexa/hexasync-template-model';
4
- export { classifyTarget, summariseClassification, } from './classify.js';
5
- export { assertInstalled, updateAssets, } from './update.js';
6
- export { COLLECTIONS, FILENAME_CONVENTION, MAX_COLLECTIONS_PER_FILE, declaredCollections, lintDocument, summariseLint, } from './lint.js';
7
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,MAAM,EAEN,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GAMd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,uBAAuB,GAKxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,YAAY,GAMb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,aAAa,GAKd,MAAM,WAAW,CAAC"}
package/dist/install.d.ts DELETED
@@ -1,83 +0,0 @@
1
- /**
2
- * Asset installation core (FR-17, FR-18, FR-19, FR-20).
3
- *
4
- * Pure: no IO, no Node builtins. Everything it touches arrives through a port,
5
- * which is what lets the CLI and the extension share one implementation rather
6
- * than growing two that drift.
7
- */
8
- import { type AssetKind } from './assetPath.js';
9
- import type { AssetSource, Clock, FileSink, Hasher } from './ports.js';
10
- /** Where installed assets live, relative to a target. Dot-prefixed (FR-19). */
11
- export declare const CANONICAL_SUBPATH = ".hexasync/intellisense";
12
- export declare const MANIFEST_FILENAME = ".install-manifest.json";
13
- export declare class AssetInstallError extends Error {
14
- constructor(message: string);
15
- }
16
- /** Reported after each file, so a host can drive a progress indicator. */
17
- export interface InstallProgress {
18
- readonly written: number;
19
- readonly total: number;
20
- readonly path: string;
21
- }
22
- export interface InstallOptions {
23
- readonly source: AssetSource;
24
- readonly sink: FileSink;
25
- readonly hasher: Hasher;
26
- /**
27
- * The install manifest already at the target, when there is one.
28
- *
29
- * Supplied by the host because reading the TARGET is not the source's job. When it describes exactly
30
- * the bundle about to be written, every write is skipped — see the `unchanged` short-circuit below.
31
- * Omitted by a caller that wants an unconditional install.
32
- */
33
- readonly existingManifest?: () => Promise<string | undefined>;
34
- readonly clock: Clock;
35
- readonly targetUri: string;
36
- /**
37
- * Which half of the bundle to install — schemas, docs, or both. Defaults to `all`.
38
- *
39
- * Exists because `Install Documentation` and `Install IntelliSense` must each work on their
40
- * own (Story 2.7), and the manifest must then describe exactly what was installed rather
41
- * than what the bundle happens to contain.
42
- */
43
- readonly kind?: AssetKind;
44
- /**
45
- * Optional progress callback.
46
- *
47
- * Exists because the editor wraps the install in a progress notification and
48
- * had nothing to report into it — a static spinner regardless of file count.
49
- * Synchronous and never awaited: a host's reporting must not be able to slow,
50
- * reorder or fail the install. Exceptions from it are deliberately swallowed.
51
- */
52
- readonly onProgress?: (progress: InstallProgress) => void;
53
- }
54
- export interface InstalledFile {
55
- readonly path: string;
56
- readonly checksum: string;
57
- }
58
- export interface InstallManifest {
59
- readonly generator: string;
60
- readonly assetBundleVersion: number;
61
- readonly installedAt: string;
62
- readonly files: readonly InstalledFile[];
63
- }
64
- export interface InstallResult {
65
- readonly targetUri: string;
66
- readonly destinationUri: string;
67
- readonly manifestUri: string;
68
- readonly assetBundleVersion: number;
69
- readonly filesWritten: number;
70
- /** True when the source held no assets. Reported, never silently treated as success. */
71
- readonly empty: boolean;
72
- /**
73
- * True when the target already held this exact bundle and nothing was written.
74
- *
75
- * Distinct from `filesWritten === 0`, which is also true for an empty source. A caller reporting
76
- * "installed 0 files" for an up-to-date target says the wrong thing twice: it sounds like a failure,
77
- * and it hides that the check is what made it fast.
78
- */
79
- readonly unchanged: boolean;
80
- readonly files: readonly InstalledFile[];
81
- }
82
- export declare function installAssets(options: InstallOptions): Promise<InstallResult>;
83
- //# sourceMappingURL=install.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAOvE,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAC1D,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAE1D,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9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