@beehexa/hexasync-template-assets 2608.15.1 → 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/dist/env.js DELETED
@@ -1,97 +0,0 @@
1
- /**
2
- * The environment check — does the tooling agree with its own knowledge? (Story 6.8)
3
- *
4
- * ### Why every item carries a REASON, never a bare boolean (AC-1)
5
- *
6
- * A check that answers `false` has told you nothing you can act on. This feature has spent a session on exactly that
7
- * failure in other clothes: four recorded constants that reproduced under no query, a guard that answered "fine" about a
8
- * step that throws, an index section that said a project has no collections. So an item reports `pass`, `fail` or `n/a`
9
- * **with a sentence**, and `n/a` is a first-class outcome rather than a disguised pass — "I could not evaluate this" and
10
- * "this is fine" are different answers, and conflating them is how a stale belief survives a green check.
11
- *
12
- * ### Pure, so the CLI is a printer
13
- *
14
- * Nothing here reads a disk or a network. The caller supplies what it observed; this decides what it means. That keeps
15
- * the decision in one place for every consumer — the CLI, the extension, an agent — which is the same reason the engine
16
- * facade exists.
17
- */
18
- const item = (id, title, outcome, reason) => ({
19
- id,
20
- title,
21
- outcome,
22
- reason,
23
- });
24
- /**
25
- * Decide what the observation means.
26
- *
27
- * ⚠️ The order is the reading order, and it matters: a reader who stops after the first failure should have seen the most
28
- * fundamental thing first.
29
- */
30
- export function checkEnvironment(observed) {
31
- const items = [];
32
- items.push(observed.projectFound === undefined
33
- ? item('project', 'A HexaSync project is open', 'n/a', 'Nothing said whether a project was found.')
34
- : observed.projectFound
35
- ? item('project', 'A HexaSync project is open', 'pass', 'Found a project to check against.')
36
- : item('project', 'A HexaSync project is open', 'n/a', 'No project here, so the project-specific items below could not be evaluated. The check still ran.'));
37
- items.push(observed.surfaceInstalled === undefined
38
- ? item('surface', 'The knowledge surface is installed', 'n/a', 'Could not look for the surface.')
39
- : observed.surfaceInstalled
40
- ? item('surface', 'The knowledge surface is installed', 'pass', 'Found it at the canonical path.')
41
- : item('surface', 'The knowledge surface is installed', 'fail', 'Not installed. Run `Install IntelliSense` (or `hexasync intellisense install`) — until then an agent ' +
42
- 'reading this repository has no vocabulary and will guess.'));
43
- /**
44
- * The stamp comparison — AC-2, and the reason this command exists.
45
- *
46
- * ⛔ Both versions are NAMED in the reason. "Stale" alone leaves a reader to go and find both numbers, which is the
47
- * work they ran this to avoid.
48
- */
49
- if (observed.toolingBundle === undefined ||
50
- observed.surfaceBundle === undefined) {
51
- items.push(item('surface-current', 'The knowledge matches the install', 'n/a', observed.surfaceBundle === undefined
52
- ? 'No surface stamp to compare — it is missing or unreadable.'
53
- : 'Could not determine the version of the installed tooling.'));
54
- }
55
- else if (observed.toolingBundle === observed.surfaceBundle) {
56
- items.push(item('surface-current', 'The knowledge matches the install', 'pass', `Both the surface and the install manifest say bundle ${observed.toolingBundle}. ⚠️ Whether the EDITOR has ` +
57
- `since moved on cannot be checked from here — only the extension knows its own bundle version.`));
58
- }
59
- else {
60
- items.push(item('surface-current', 'The knowledge matches the install', 'fail', `STALE: the knowledge surface says bundle ${observed.surfaceBundle}, the install recorded bundle ` +
61
- `${observed.toolingBundle}. Part of the install is older than the rest, so anything an agent read from the ` +
62
- `surface may be out of date — re-install to refresh it.`));
63
- }
64
- /**
65
- * ⛔ There is no separate "manifest agrees" item, and there was.
66
- *
67
- * The caller derived `toolingBundle` FROM `manifestBundle`, so `manifestBundle === toolingBundle` held by
68
- * construction: a green tick that could not fail, on an install that might be inconsistent. Its spec exercised the
69
- * failing branch with hand-made unequal inputs — a shape production could not produce. That is the
70
- * "a mutation test proves a test CAN fail, not that the shipped wiring is what's under test" trap exactly.
71
- *
72
- * The comparison that means something is surface-vs-manifest, and it is the item above. A second item comparing the
73
- * manifest to itself added a reassurance rather than a check.
74
- */
75
- items.push(observed.manifestBundle === undefined
76
- ? item('manifest', 'An install manifest was found', 'n/a', 'No manifest was read, so nothing recorded what was installed.')
77
- : item('manifest', 'An install manifest was found', 'pass', `It records bundle ${observed.manifestBundle}, which is what the check above compares the surface against.`));
78
- return {
79
- items,
80
- failed: items.some((entry) => entry.outcome === 'fail'),
81
- notApplicable: items.filter((entry) => entry.outcome === 'n/a').length,
82
- };
83
- }
84
- /** The report as lines, for a terminal. One item per line, the reason always shown. */
85
- export function formatEnvReport(report) {
86
- const mark = { pass: '✓', fail: '✗', 'n/a': '–' };
87
- return [
88
- ...report.items.map((entry) => `${mark[entry.outcome]} ${entry.title}\n ${entry.reason}`),
89
- '',
90
- report.failed
91
- ? `${report.items.filter((e) => e.outcome === 'fail').length} check(s) failed.`
92
- : report.notApplicable > 0
93
- ? `Nothing failed, but ${report.notApplicable} check(s) could not be evaluated — see the reasons above.`
94
- : 'Everything checks out.',
95
- ];
96
- }
97
- //# sourceMappingURL=env.js.map
package/dist/env.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAoCH,MAAM,IAAI,GAAG,CACX,EAAU,EACV,KAAa,EACb,OAAmB,EACnB,MAAc,EACL,EAAE,CAAC,CAAC;IACb,EAAE;IACF,KAAK;IACL,OAAO;IACP,MAAM;CACP,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAwB;IACvD,MAAM,KAAK,GAAc,EAAE,CAAC;IAE5B,KAAK,CAAC,IAAI,CACR,QAAQ,CAAC,YAAY,KAAK,SAAS;QACjC,CAAC,CAAC,IAAI,CACF,SAAS,EACT,4BAA4B,EAC5B,KAAK,EACL,2CAA2C,CAC5C;QACH,CAAC,CAAC,QAAQ,CAAC,YAAY;YACrB,CAAC,CAAC,IAAI,CACF,SAAS,EACT,4BAA4B,EAC5B,MAAM,EACN,mCAAmC,CACpC;YACH,CAAC,CAAC,IAAI,CACF,SAAS,EACT,4BAA4B,EAC5B,KAAK,EACL,mGAAmG,CACpG,CACR,CAAC;IAEF,KAAK,CAAC,IAAI,CACR,QAAQ,CAAC,gBAAgB,KAAK,SAAS;QACr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AU,EACV,+BAA+B,EAC/B,MAAM,EACN,qBAAqB,QAAQ,CAAC,cAAc,+DAA+D,CAC5G,CACN,CAAC;IAEF,OAAO;QACL,KAAK;QACL,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC;QACvD,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM;KACvE,CAAC;AACJ,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAW,CAAC;IAC3D,OAAO;QACL,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CACjB,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,KAAK,SAAS,KAAK,CAAC,MAAM,EAAE,CACxE;QACD,EAAE;QACF,MAAM,CAAC,MAAM;YACX,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,MAAM,mBAAmB;YAC/E,CAAC,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC;gBACxB,CAAC,CAAC,uBAAuB,MAAM,CAAC,aAAa,2DAA2D;gBACxG,CAAC,CAAC,wBAAwB;KAC/B,CAAC;AACJ,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,11 +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
- export { checkEnvironment, formatEnvReport, type EnvItem, type EnvObservation, type EnvOutcome, type EnvReport, } from './env.js';
10
- export { MCP_CLIENTS, SERVER_ENTRY, SERVER_NAME, clientSnippet, mergeClientConfig, type McpClient, type MergeOutcome, } from './mcpClients.js';
11
- //# 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;AAEnB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,GAClB,MAAM,iBAAiB,CAAC"}
package/dist/index.js DELETED
@@ -1,9 +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
- export { checkEnvironment, formatEnvReport, } from './env.js';
8
- export { MCP_CLIENTS, SERVER_ENTRY, SERVER_NAME, clientSnippet, mergeClientConfig, } from './mcpClients.js';
9
- //# 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;AAEnB,OAAO,EACL,gBAAgB,EAChB,eAAe,GAKhB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,aAAa,EACb,iBAAiB,GAGlB,MAAM,iBAAiB,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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/**
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 { AssetPathError, encodeAssetSegments, isKind, parseAssetRelativePath, } from './assetPath.js';
9
- import { isInsideUri, joinUri, normalizeUri, } from '@beehexa/hexasync-template-model';
10
- /** Where installed assets live, relative to a target. Dot-prefixed (FR-19). */
11
- export const CANONICAL_SUBPATH = '.hexasync/intellisense';
12
- export const MANIFEST_FILENAME = '.install-manifest.json';
13
- export class AssetInstallError extends Error {
14
- constructor(message) {
15
- super(message);
16
- this.name = 'AssetInstallError';
17
- }
18
- }
19
- /**
20
- * Turns reported asset paths into validated destination URIs, or throws.
21
- *
22
- * Every path is checked before any is written. `installAssets` calls this ahead
23
- * of the write loop so a single bad path cannot leave a partial tree behind —
24
- * and it validates EVERY entry, not just the first. (The escaping-path tests
25
- * used to pass names beginning with `.`, which sort to index 0, so a bug that
26
- * checked only `planned[0]` would have gone unnoticed.)
27
- */
28
- function plan(relativePaths, destinationUri) {
29
- const planned = [];
30
- const seen = new Map();
31
- for (const relativePath of relativePaths) {
32
- // Validate as a PATH before it becomes a URI — see assetPath.ts for why the
33
- // order matters. Re-thrown as AssetInstallError so callers keep one type.
34
- let segments;
35
- try {
36
- segments = parseAssetRelativePath(relativePath);
37
- }
38
- catch (error) {
39
- if (error instanceof AssetPathError) {
40
- throw new AssetInstallError(`${error.message} No files were written.`);
41
- }
42
- throw error;
43
- }
44
- if (segments.length === 1 && segments[0] === MANIFEST_FILENAME) {
45
- throw new AssetInstallError(`Refusing to install "${relativePath}": ${MANIFEST_FILENAME} is the install manifest's ` +
46
- `own name. Installing it would have it silently overwritten by the manifest, leaving a ` +
47
- `recorded checksum for content that is not on disk. No files were written.`);
48
- }
49
- const uri = joinUri(destinationUri, encodeAssetSegments(segments));
50
- // Defence in depth. The allowlist above already makes escape unreachable;
51
- // this is the invariant stated directly, so a future widening of the
52
- // allowlist cannot quietly reintroduce a traversal.
53
- if (!isInsideUri(destinationUri, uri)) {
54
- throw new AssetInstallError(`Refusing to install "${relativePath}": it resolves to ${uri}, which is outside the ` +
55
- `install target ${destinationUri}. No files were written.`);
56
- }
57
- // Two paths that differ only in case are one file on APFS and NTFS. Left
58
- // alone, the second write wins on disk while the manifest records both with
59
- // different checksums — permanently unverifiable.
60
- const identity = uri.toLowerCase();
61
- const clash = seen.get(identity);
62
- if (clash !== undefined) {
63
- throw new AssetInstallError(clash === relativePath
64
- ? `Refusing to install "${relativePath}": the bundle lists it more than once. ` +
65
- `No files were written.`
66
- : `Refusing to install "${relativePath}": it collides with "${clash}" on a ` +
67
- `case-insensitive filesystem (macOS, Windows), where both would be the same file. ` +
68
- `No files were written.`);
69
- }
70
- seen.set(identity, relativePath);
71
- planned.push({ relativePath, uri });
72
- }
73
- return planned;
74
- }
75
- function messageOf(error) {
76
- return error instanceof Error ? error.message : String(error);
77
- }
78
- /** Removes what was written, returning the URIs it could not remove. */
79
- async function unwind(sink, writtenUris) {
80
- if (sink.remove === undefined)
81
- return [...writtenUris];
82
- const unremoved = [];
83
- // Reverse order, so nested files go before the directories that hold them if a
84
- // sink ever chooses to prune empty parents.
85
- for (const uri of [...writtenUris].reverse()) {
86
- try {
87
- await sink.remove(uri);
88
- }
89
- catch {
90
- unremoved.push(uri);
91
- }
92
- }
93
- return unremoved;
94
- }
95
- /**
96
- * Parse a target's install manifest, or `undefined` when there is nothing usable there.
97
- *
98
- * Every failure is the same answer: absent, unreadable and malformed all mean "cannot claim the target is
99
- * up to date", and the safe response to each is to install. Throwing here would turn a corrupt manifest
100
- * into a broken command rather than a rewrite.
101
- */
102
- async function readManifest(read) {
103
- let text;
104
- try {
105
- text = await read();
106
- }
107
- catch {
108
- return undefined;
109
- }
110
- if (text === undefined)
111
- return undefined;
112
- try {
113
- const parsed = JSON.parse(text);
114
- return typeof parsed?.assetBundleVersion === 'number' &&
115
- Array.isArray(parsed.files)
116
- ? parsed
117
- : undefined;
118
- }
119
- catch {
120
- return undefined;
121
- }
122
- }
123
- /**
124
- * Do two file lists describe the same bytes?
125
- *
126
- * Compared as a MAP keyed by path, not as ordered arrays: the manifest's order is whatever a previous
127
- * version happened to write, and a reordering is not a change. The length check is what catches a file
128
- * added to or removed from the bundle, which a per-path lookup alone would miss in one direction.
129
- */
130
- function sameFiles(already, wanted) {
131
- if (already.length !== wanted.length)
132
- return false;
133
- const byPath = new Map(already.map((file) => [file.path, file.checksum]));
134
- return wanted.every((file) => byPath.get(file.path) === file.checksum);
135
- }
136
- export async function installAssets(options) {
137
- const { source, sink, hasher, clock } = options;
138
- const targetUri = normalizeUri(options.targetUri);
139
- if (targetUri === '') {
140
- throw new AssetInstallError('Refusing to install: the target URI is empty. An empty target normalizes to the ' +
141
- 'filesystem root, which is never what a caller means.');
142
- }
143
- const destinationUri = joinUri(targetUri, CANONICAL_SUBPATH);
144
- const kind = options.kind ?? 'all';
145
- const relativePaths = [...(await source.list())]
146
- .filter((p) => isKind(p, kind))
147
- .sort();
148
- // Everything that can fail is resolved BEFORE the first byte is written, so a
149
- // rejected bundle leaves no half-installed tree behind. That includes the
150
- // bundle version: reading it after the write loop meant the most likely
151
- // failure in the whole flow (a missing or malformed BUNDLE_VERSION) fired only
152
- // once every asset was already on disk, with no manifest to describe them.
153
- const assetBundleVersion = await source.bundleVersion();
154
- const planned = plan(relativePaths, destinationUri);
155
- const manifestUriForCheck = joinUri(destinationUri, MANIFEST_FILENAME);
156
- // Hash the SOURCE first, then compare. Reading and hashing the bundle is local and cheap; the cost
157
- // being avoided is the WRITES, which on a remote or browser host are one round trip each — the reason
158
- // installing IntelliSense felt like it re-did everything every time.
159
- //
160
- // Compared by CHECKSUM and not by bundle version alone. A version match would call a hand-edited
161
- // target up to date and leave it broken, and the install target has been edited in place before —
162
- // ADR 0003 records exactly that happening to `templates/.hexasync/intellisense`. Checksums notice, and
163
- // rewrite.
164
- const sourceFiles = [];
165
- const sourceBytes = new Map();
166
- for (const { relativePath } of planned) {
167
- const bytes = await source.read(relativePath);
168
- sourceBytes.set(relativePath, bytes);
169
- sourceFiles.push({
170
- path: relativePath,
171
- checksum: await hasher.hash(bytes),
172
- });
173
- }
174
- if (options.existingManifest !== undefined && sourceFiles.length > 0) {
175
- const already = await readManifest(options.existingManifest);
176
- if (already !== undefined &&
177
- already.assetBundleVersion === assetBundleVersion &&
178
- sameFiles(already.files, sourceFiles)) {
179
- return {
180
- targetUri,
181
- destinationUri,
182
- manifestUri: manifestUriForCheck,
183
- assetBundleVersion,
184
- filesWritten: 0,
185
- empty: false,
186
- unchanged: true,
187
- files: sourceFiles,
188
- };
189
- }
190
- }
191
- const files = [];
192
- const writtenUris = [];
193
- try {
194
- for (const { relativePath, uri } of planned) {
195
- // Already read and hashed above for the comparison; reading a second time would double the source
196
- // IO to learn nothing new.
197
- const bytes = sourceBytes.get(relativePath);
198
- files.push({ path: relativePath, checksum: await hasher.hash(bytes) });
199
- await sink.write(uri, bytes);
200
- writtenUris.push(uri);
201
- if (options.onProgress !== undefined) {
202
- try {
203
- options.onProgress({
204
- written: files.length,
205
- total: planned.length,
206
- path: relativePath,
207
- });
208
- }
209
- catch {
210
- // A host's progress reporting is never allowed to break an install.
211
- }
212
- }
213
- }
214
- }
215
- catch (error) {
216
- // Unwind. Validation already guarantees nothing is written when a path is
217
- // bad; this covers the other half — an IO failure part way through — so that
218
- // "no partial asset tree is left behind" is true in general and not only for
219
- // the validation case. Best-effort by nature: a sink that cannot remove, or
220
- // that fails to, is reported rather than hidden.
221
- const unremoved = await unwind(sink, writtenUris);
222
- throw new AssetInstallError(`Install failed after writing ${writtenUris.length} file(s): ${messageOf(error)}. ` +
223
- (unremoved.length === 0
224
- ? 'Files written before the failure were removed, so the target is unchanged.'
225
- : `${unremoved.length} file(s) could not be removed and remain in the target: ` +
226
- `${unremoved.join(', ')}. No manifest was written, so this cannot be mistaken ` +
227
- `for a complete install.`));
228
- }
229
- const manifest = {
230
- generator: '@beehexa/hexasync-template-assets',
231
- assetBundleVersion,
232
- installedAt: await clock.now(),
233
- files,
234
- };
235
- const manifestUri = joinUri(destinationUri, MANIFEST_FILENAME);
236
- await sink.write(manifestUri, new TextEncoder().encode(`${JSON.stringify(manifest, null, 2)}\n`));
237
- return {
238
- targetUri,
239
- destinationUri,
240
- manifestUri,
241
- assetBundleVersion,
242
- filesWritten: files.length,
243
- empty: files.length === 0,
244
- unchanged: false,
245
- files,
246
- };
247
- }
248
- //# sourceMappingURL=install.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,sBAAsB,GAEvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,WAAW,EACX,OAAO,EACP,YAAY,GACb,MAAM,kCAAkC,CAAC;AAE1C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAE1D,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AA8ED;;;;;;;;GAQG;AACH,SAAS,IAAI,CACX,aAAgC,EAChC,cAAsB;IAEtB,MAAM,OAAO,GAAkB,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEvC,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACzC,4EAA4E;QAC5E,0EAA0E;QAC1E,IAAI,QAAkB,CAAC;QACvB,IAAI,CAAC;YACH,QAAQ,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf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C,CAAC,4EAA4E;gBAC9E,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,0DAA0D;oBAC7E,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,wDAAwD;oBAC/E,yBAAyB,CAAC,CACjC,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAoB;QAChC,SAAS,EAAE,mCAAmC;QAC9C,kBAAkB;QAClB,WAAW,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE;QAC9B,KAAK;KACN,CAAC;IACF,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAC/D,MAAM,IAAI,CAAC,KAAK,CACd,WAAW,EACX,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CACnE,CAAC;IAEF,OAAO;QACL,SAAS;QACT,cAAc;QACd,WAAW;QACX,kBAAkB;QAClB,YAAY,EAAE,KAAK,CAAC,MAAM;QAC1B,KAAK,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC;QACzB,SAAS,EAAE,KAAK;QAChB,KAAK;KACN,CAAC;AACJ,CAAC"}
package/dist/lint.d.ts DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Structural lint rules for authored template files.
3
- *
4
- * These two constraints cannot live in JSON Schema:
5
- *
6
- * * **filename ↔ content agreement** — a schema has no access to the document's path;
7
- * * **at most N collections per file** — JSON Schema cannot count matching properties, so it
8
- * would take 286 generated `not`/`anyOf` branches to say "no three of these thirteen keys
9
- * together", and the resulting message would name none of them.
10
- *
11
- * So they are code, in core, with real messages — one rule set that the CLI surfaces today and
12
- * the editor's diagnostics will surface in Phase 1, rather than two implementations that drift.
13
- *
14
- * Pure: takes a path and an already-parsed document. No IO (AD-4).
15
- */
16
- /** The root collections a component file may declare. */
17
- export declare const COLLECTIONS: readonly ["objects", "pullers", "pushers", "tables", "validations", "transformations", "dependencies", "webhooks", "connectors", "metricGroups", "startupTasks", "objectAssociations", "variables"];
18
- export type Collection = (typeof COLLECTIONS)[number];
19
- /**
20
- * The filename each collection is expected to carry.
21
- *
22
- * Kept as a convention that must AGREE with the content, rather than as the thing that decides
23
- * which schema applies — content decides that. A name and a content that disagree is the error,
24
- * because it misleads every human reader even when the tooling gets it right.
25
- */
26
- export declare const FILENAME_CONVENTION: Readonly<Record<Collection, string>>;
27
- /**
28
- * How many collections one file may declare before it is an error.
29
- *
30
- * `main.yaml` is exempt: it is the project manifest and legitimately aggregates everything.
31
- *
32
- * Set to 2 — a file may pair a Task with its puller, which 192 corpus files do, but a
33
- * three-way grab-bag is an error. Measured against the corpus: this threshold flags **26**
34
- * files, where a threshold of 1 would flag **240** and condemn that established pairing.
35
- * Raise or lower it here; the rule reports the limit it applied so a report is never ambiguous
36
- * about which reading produced it.
37
- */
38
- export declare const MAX_COLLECTIONS_PER_FILE = 2;
39
- export type Severity = 'critical' | 'warning';
40
- export interface LintDiagnostic {
41
- readonly ruleId: 'one-component-per-file' | 'filename-matches-content';
42
- readonly severity: Severity;
43
- readonly path: string;
44
- readonly message: string;
45
- }
46
- /** The collections a parsed document declares, in declaration order. */
47
- export declare function declaredCollections(document: unknown): Collection[];
48
- /**
49
- * Lints one authored file.
50
- *
51
- * @param path the file's path, used for the filename rule and for reporting.
52
- * @param document the parsed YAML.
53
- */
54
- export declare function lintDocument(path: string, document: unknown): LintDiagnostic[];
55
- export interface LintSummary {
56
- readonly filesLinted: number;
57
- readonly diagnostics: readonly LintDiagnostic[];
58
- readonly byRule: Readonly<Record<string, number>>;
59
- readonly criticalCount: number;
60
- }
61
- /** Rolls per-file diagnostics into a summary. */
62
- export declare function summariseLint(results: readonly {
63
- path: string;
64
- diagnostics: readonly LintDiagnostic[];
65
- }[]): LintSummary;
66
- //# sourceMappingURL=lint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":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