project-tiny-context-harness 0.8.10 → 0.8.11
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/README.md +2 -2
- package/assets/README.md +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lib/design-resource-fact-manifest-validation.d.ts +2 -1
- package/dist/lib/design-resource-handoff-bundle-draft.d.ts +11 -0
- package/dist/lib/design-resource-handoff-bundle-draft.js +38 -0
- package/dist/lib/design-resource-handoff-bundle.js +4 -28
- package/dist/lib/design-resource-handoff-input-types.d.ts +11 -0
- package/dist/lib/design-resource-handoff-input-types.js +1 -0
- package/dist/lib/design-resource-handoff-manifest-projection.d.ts +2 -1
- package/dist/lib/design-resource-handoff-parser.d.ts +1 -1
- package/dist/lib/design-resource-handoff-shape.d.ts +2 -1
- package/dist/lib/design-resource-handoff-snapshot.d.ts +1 -1
- package/dist/lib/design-resource-handoff-types.d.ts +0 -10
- package/dist/lib/design-resource-handoff-validation.d.ts +2 -1
- package/dist/lib/long-task-source-item-parser.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ npm ci
|
|
|
182
182
|
npm run smoke:quickstart
|
|
183
183
|
npm run preview:pack
|
|
184
184
|
cd /path/to/your/test-repo
|
|
185
|
-
npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.8.
|
|
185
|
+
npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.8.11.tgz
|
|
186
186
|
npx --no-install ty-context init --adopt
|
|
187
187
|
make validate-context
|
|
188
188
|
```
|
|
@@ -446,7 +446,7 @@ make validate-harness
|
|
|
446
446
|
|
|
447
447
|
The modularity gate is the capability-aware `ty-context check-modularity`. Scoped waivers require `owner`, `introduced_at`, `reason`, `tracking_issue` and `expiry_condition`; unsupported metrics never appear as passing zeroes.
|
|
448
448
|
|
|
449
|
-
The synchronized local preview tarball is named `project-tiny-context-harness-0.8.
|
|
449
|
+
The synchronized local preview tarball is named `project-tiny-context-harness-0.8.11.tgz`.
|
|
450
450
|
|
|
451
451
|
## Community And Further Reading
|
|
452
452
|
|
package/assets/README.md
CHANGED
|
@@ -180,7 +180,7 @@ The smoke packs the local workspace, installs it into a disposable repo and vali
|
|
|
180
180
|
|
|
181
181
|
```sh
|
|
182
182
|
cd /path/to/your/test-repo
|
|
183
|
-
npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.8.
|
|
183
|
+
npm install -D /path/to/project-tiny-context-harness/tmp/ty-context/source-preview/package/project-tiny-context-harness-0.8.11.tgz
|
|
184
184
|
npx --no-install ty-context init --adopt
|
|
185
185
|
make validate-context
|
|
186
186
|
```
|
|
@@ -715,7 +715,7 @@ make validate-harness
|
|
|
715
715
|
|
|
716
716
|
The modularity gate is `ty-context check-modularity`. Scoped waivers require `owner`, `introduced_at`, `reason`, `tracking_issue` and `expiry_condition`.
|
|
717
717
|
|
|
718
|
-
`npm run preview:pack` produces a local preview named `project-tiny-context-harness-0.8.
|
|
718
|
+
`npm run preview:pack` produces a local preview named `project-tiny-context-harness-0.8.11.tgz` under the preview output directory.
|
|
719
719
|
|
|
720
720
|
## Community And Further Reading
|
|
721
721
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { commands } from "./commands/index.js";
|
|
|
2
2
|
export { compileDeliveryContract, type CompileDeliveryOptionsV2, } from "./lib/long-task-delivery-compiler.js";
|
|
3
3
|
export { DELIVERY_CONTRACT_FILE, parseDeliveryContract, parseDeliveryContractBundle, } from "./lib/long-task-delivery-parser.js";
|
|
4
4
|
export { evaluateContractBoundary } from "./lib/long-task-boundary-check.js";
|
|
5
|
-
export { publishDesignResourceHandoffBundle, type DesignResourceHandoffBundleOptions, type DesignResourceHandoffBundleResult, } from "./lib/design-resource-handoff-bundle.js";
|
|
6
5
|
export { preflightDesignResourceHandoff } from "./lib/design-resource-handoff-validation.js";
|
|
7
6
|
export { classifyLongTaskRisk, validateRiskProof, } from "./lib/long-task-risk.js";
|
|
8
7
|
export { verifyDeliveryContract } from "./lib/long-task-verifier-v2.js";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { commands } from "./commands/index.js";
|
|
|
2
2
|
export { compileDeliveryContract, } from "./lib/long-task-delivery-compiler.js";
|
|
3
3
|
export { DELIVERY_CONTRACT_FILE, parseDeliveryContract, parseDeliveryContractBundle, } from "./lib/long-task-delivery-parser.js";
|
|
4
4
|
export { evaluateContractBoundary } from "./lib/long-task-boundary-check.js";
|
|
5
|
-
export { publishDesignResourceHandoffBundle, } from "./lib/design-resource-handoff-bundle.js";
|
|
6
5
|
export { preflightDesignResourceHandoff } from "./lib/design-resource-handoff-validation.js";
|
|
7
6
|
export { classifyLongTaskRisk, validateRiskProof, } from "./lib/long-task-risk.js";
|
|
8
7
|
export { verifyDeliveryContract } from "./lib/long-task-verifier-v2.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DesignResourceObservableFactManifestV1 } from "./design-resource-fact-manifest-types.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ParsedDesignResourceHandoffV1 } from "./design-resource-handoff-types.js";
|
|
3
|
+
import type { ParsedDesignResourceHandoffInputV1 } from "./design-resource-handoff-input-types.js";
|
|
3
4
|
export declare function parseDesignResourceFactManifests(parsed: ParsedDesignResourceHandoffInputV1, contents: Map<string, Buffer>): Map<string, DesignResourceObservableFactManifestV1>;
|
|
4
5
|
export declare function validateDesignResourceFactManifests(parsed: ParsedDesignResourceHandoffV1, contents: Map<string, Buffer>, manifests: Map<string, DesignResourceObservableFactManifestV1>, validateProjection: boolean): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParsedDesignResourceHandoffInputV1 } from "./design-resource-handoff-input-types.js";
|
|
2
|
+
import type { DesignResourceHandoffResourceV1, DesignResourceHandoffTargetV1 } from "./design-resource-handoff-types.js";
|
|
3
|
+
type BundleFailure = (code: string, detail: string) => never;
|
|
4
|
+
export interface StagedDesignResourceHandoffDraft {
|
|
5
|
+
bytes: Buffer;
|
|
6
|
+
parsed: ParsedDesignResourceHandoffInputV1;
|
|
7
|
+
target: DesignResourceHandoffTargetV1;
|
|
8
|
+
manifest_resource: DesignResourceHandoffResourceV1;
|
|
9
|
+
}
|
|
10
|
+
export declare function stageDesignResourceHandoffDraft(repository: string, draftDirectory: string, temporaryDirectory: string, entryName: string, maxBytes: number, fail: BundleFailure): Promise<StagedDesignResourceHandoffDraft>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { lstat, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { parseDesignResourceHandoffMarkdown } from "./design-resource-handoff-parser.js";
|
|
4
|
+
import { repoRelative } from "./long-task-workspace.js";
|
|
5
|
+
export async function stageDesignResourceHandoffDraft(repository, draftDirectory, temporaryDirectory, entryName, maxBytes, fail) {
|
|
6
|
+
const draftFile = path.join(draftDirectory, entryName);
|
|
7
|
+
const info = await lstat(draftFile);
|
|
8
|
+
if (typeof info.nlink === "number" && info.nlink > 1)
|
|
9
|
+
fail("draft_hardlink_not_allowed", entryName);
|
|
10
|
+
assertByteLimit(entryName, info.size, maxBytes, fail);
|
|
11
|
+
const bytes = await readFile(draftFile);
|
|
12
|
+
assertByteLimit(entryName, bytes.length, maxBytes, fail);
|
|
13
|
+
const content = bytes.toString("utf8");
|
|
14
|
+
if (!Buffer.from(content, "utf8").equals(bytes))
|
|
15
|
+
fail("handoff_utf8_invalid", entryName);
|
|
16
|
+
const stagedFile = path.join(temporaryDirectory, entryName);
|
|
17
|
+
await writeFile(stagedFile, bytes, { flag: "wx" });
|
|
18
|
+
const stagedPath = repoRelative(repository, stagedFile);
|
|
19
|
+
const parsed = parseDesignResourceHandoffMarkdown(stagedPath, content);
|
|
20
|
+
if (!("representation" in parsed.handoff))
|
|
21
|
+
fail("manifest_backed_representation_required", entryName);
|
|
22
|
+
if (parsed.handoff.targets.length !== 1)
|
|
23
|
+
fail("one_target_per_handoff_required", `${entryName}:${parsed.handoff.targets.length}`);
|
|
24
|
+
const target = parsed.handoff.targets[0];
|
|
25
|
+
const manifestResource = parsed.handoff.resources.find((resource) => resource.key === target.source_profile.fact_manifest_resource_ref);
|
|
26
|
+
if (!manifestResource)
|
|
27
|
+
fail("target_manifest_resource_missing", target.key);
|
|
28
|
+
return {
|
|
29
|
+
bytes,
|
|
30
|
+
parsed,
|
|
31
|
+
target,
|
|
32
|
+
manifest_resource: manifestResource,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function assertByteLimit(entryName, actual, maximum, fail) {
|
|
36
|
+
if (actual > maximum)
|
|
37
|
+
fail("handoff_byte_limit_exceeded", `${entryName}:${actual}:${maximum}`);
|
|
38
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { lstat, mkdtemp,
|
|
1
|
+
import { lstat, mkdtemp, readdir, realpath, rename, rm, } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { stageDesignResourceHandoffDraft } from "./design-resource-handoff-bundle-draft.js";
|
|
4
4
|
import { createDesignResourceHandoffSetIntegrity } from "./design-resource-handoff-set-integrity.js";
|
|
5
5
|
import { preflightParsedDesignResourceHandoff } from "./design-resource-handoff-validation.js";
|
|
6
6
|
import { normalizeRepositoryCwd, normalizeRepositoryFile, } from "./long-task-paths.js";
|
|
7
|
-
import {
|
|
7
|
+
import { resolveInsideRepository } from "./long-task-workspace.js";
|
|
8
8
|
import { sha256Hex } from "./strict-codec.js";
|
|
9
9
|
export async function publishDesignResourceHandoffBundle(options) {
|
|
10
10
|
const repository = path.resolve(options.repository);
|
|
@@ -39,31 +39,7 @@ export async function publishDesignResourceHandoffBundle(options) {
|
|
|
39
39
|
const manifests = new Map();
|
|
40
40
|
const handoffSetIntegrity = createDesignResourceHandoffSetIntegrity((code, detail) => invalid(code, detail));
|
|
41
41
|
for (const entry of draftEntries) {
|
|
42
|
-
const
|
|
43
|
-
const info = await lstat(draftFile);
|
|
44
|
-
if (typeof info.nlink === "number" && info.nlink > 1)
|
|
45
|
-
invalid("draft_hardlink_not_allowed", entry.name);
|
|
46
|
-
if (info.size > options.max_handoff_bytes)
|
|
47
|
-
invalid("handoff_byte_limit_exceeded", `${entry.name}:${info.size}:${options.max_handoff_bytes}`);
|
|
48
|
-
const bytes = await readFile(draftFile);
|
|
49
|
-
if (bytes.length > options.max_handoff_bytes)
|
|
50
|
-
invalid("handoff_byte_limit_exceeded", `${entry.name}:${bytes.length}:${options.max_handoff_bytes}`);
|
|
51
|
-
const content = bytes.toString("utf8");
|
|
52
|
-
if (!Buffer.from(content, "utf8").equals(bytes))
|
|
53
|
-
invalid("handoff_utf8_invalid", entry.name);
|
|
54
|
-
const stagedFile = path.join(temporary, entry.name);
|
|
55
|
-
await writeFile(stagedFile, bytes, { flag: "wx" });
|
|
56
|
-
const stagedPath = repoRelative(repository, stagedFile);
|
|
57
|
-
const parsed = parseDesignResourceHandoffMarkdown(stagedPath, content);
|
|
58
|
-
if (!("representation" in parsed.handoff))
|
|
59
|
-
invalid("manifest_backed_representation_required", entry.name);
|
|
60
|
-
if (parsed.handoff.targets.length !== 1)
|
|
61
|
-
invalid("one_target_per_handoff_required", `${entry.name}:${parsed.handoff.targets.length}`);
|
|
62
|
-
const declaredTarget = parsed.handoff.targets[0];
|
|
63
|
-
const manifestResource = parsed.handoff.resources.find((resource) => resource.key ===
|
|
64
|
-
declaredTarget.source_profile.fact_manifest_resource_ref);
|
|
65
|
-
if (!manifestResource)
|
|
66
|
-
invalid("target_manifest_resource_missing", declaredTarget.key);
|
|
42
|
+
const { bytes, parsed, target: declaredTarget, manifest_resource: manifestResource, } = await stageDesignResourceHandoffDraft(repository, draftAbsolute, temporary, entry.name, options.max_handoff_bytes, invalid);
|
|
67
43
|
if (!declaredManifestPaths.has(manifestResource.path))
|
|
68
44
|
invalid("target_manifest_not_declared", `${declaredTarget.key}:${manifestResource.path}`);
|
|
69
45
|
const preflight = await preflightParsedDesignResourceHandoff(repository, parsed);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DesignResourceHandoffV1 } from "./design-resource-handoff-types.js";
|
|
2
|
+
export type DesignResourceHandoffManifestBackedV1 = Pick<DesignResourceHandoffV1, "schema_version" | "intent" | "scope" | "provenance" | "resources" | "targets" | "resource_fact_closure" | "coverage" | "proposal"> & {
|
|
3
|
+
representation: "manifest_backed";
|
|
4
|
+
};
|
|
5
|
+
export type DesignResourceHandoffInputV1 = DesignResourceHandoffV1 | DesignResourceHandoffManifestBackedV1;
|
|
6
|
+
export interface ParsedDesignResourceHandoffInputV1 {
|
|
7
|
+
handoff_path: string;
|
|
8
|
+
handoff: DesignResourceHandoffInputV1;
|
|
9
|
+
source_item_keys: string[];
|
|
10
|
+
source_item_kinds: Record<string, string>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { DesignResourceObservableFactManifestV1 } from "./design-resource-fact-manifest-types.js";
|
|
2
|
-
import type { DesignResourceHandoffManifestBackedV1
|
|
2
|
+
import type { DesignResourceHandoffManifestBackedV1 } from "./design-resource-handoff-input-types.js";
|
|
3
|
+
import type { DesignResourceHandoffV1 } from "./design-resource-handoff-types.js";
|
|
3
4
|
export declare function hydrateManifestBackedDesignResourceHandoff(descriptor: DesignResourceHandoffManifestBackedV1, manifests: Map<string, DesignResourceObservableFactManifestV1>): DesignResourceHandoffV1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ParsedDesignResourceHandoffInputV1 } from "./design-resource-handoff-types.js";
|
|
1
|
+
import type { ParsedDesignResourceHandoffInputV1 } from "./design-resource-handoff-input-types.js";
|
|
2
2
|
export interface DesignResourceHandoffBlockSpan {
|
|
3
3
|
bodyStartOffset: number;
|
|
4
4
|
bodyEndOffset: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { DesignResourceHandoffInputV1
|
|
1
|
+
import type { DesignResourceHandoffInputV1 } from "./design-resource-handoff-input-types.js";
|
|
2
|
+
import type { DesignResourceHandoffV1 } from "./design-resource-handoff-types.js";
|
|
2
3
|
export declare function parseDesignResourceHandoffInputShape(value: unknown): DesignResourceHandoffInputV1;
|
|
3
4
|
export declare function parseDesignResourceHandoffShape(value: unknown): DesignResourceHandoffV1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ParsedDesignResourceHandoffInputV1 } from "./design-resource-handoff-types.js";
|
|
1
|
+
import type { ParsedDesignResourceHandoffInputV1 } from "./design-resource-handoff-input-types.js";
|
|
2
2
|
export interface DesignResourceSnapshot {
|
|
3
3
|
contents: Map<string, Buffer>;
|
|
4
4
|
hashes: Record<string, string>;
|
|
@@ -57,10 +57,6 @@ export interface DesignResourceHandoffV1 {
|
|
|
57
57
|
revision: string;
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
export type DesignResourceHandoffManifestBackedV1 = Pick<DesignResourceHandoffV1, "schema_version" | "intent" | "scope" | "provenance" | "resources" | "targets" | "resource_fact_closure" | "coverage" | "proposal"> & {
|
|
61
|
-
representation: "manifest_backed";
|
|
62
|
-
};
|
|
63
|
-
export type DesignResourceHandoffInputV1 = DesignResourceHandoffV1 | DesignResourceHandoffManifestBackedV1;
|
|
64
60
|
export interface DesignResourceHandoffResourceV1 {
|
|
65
61
|
key: string;
|
|
66
62
|
role: "exact_target" | "constraint" | "supporting";
|
|
@@ -220,12 +216,6 @@ export interface ParsedDesignResourceHandoffV1 {
|
|
|
220
216
|
source_item_keys: string[];
|
|
221
217
|
source_item_kinds: Record<string, string>;
|
|
222
218
|
}
|
|
223
|
-
export interface ParsedDesignResourceHandoffInputV1 {
|
|
224
|
-
handoff_path: string;
|
|
225
|
-
handoff: DesignResourceHandoffInputV1;
|
|
226
|
-
source_item_keys: string[];
|
|
227
|
-
source_item_kinds: Record<string, string>;
|
|
228
|
-
}
|
|
229
219
|
export interface DesignResourceHandoffPreflightV1 extends ParsedDesignResourceHandoffV1 {
|
|
230
220
|
schema_version: "design-resource-handoff-preflight-v1";
|
|
231
221
|
status: "ready";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedDesignResourceHandoffInputV1 } from "./design-resource-handoff-input-types.js";
|
|
2
|
+
import type { DesignResourceHandoffPreflightV1, ParsedDesignResourceHandoffV1 } from "./design-resource-handoff-types.js";
|
|
2
3
|
export declare function preflightDesignResourceHandoff(repository: string, handoffPath: string): Promise<DesignResourceHandoffPreflightV1>;
|
|
3
4
|
export declare function preflightParsedDesignResourceHandoff(repository: string, parsed: ParsedDesignResourceHandoffInputV1): Promise<DesignResourceHandoffPreflightV1>;
|
|
4
5
|
export declare function validateDesignResourceHandoffSemantics(parsed: ParsedDesignResourceHandoffV1): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompiledSourceItemV2 } from "./long-task-delivery-types.js";
|
|
2
|
-
import type { DesignResourceHandoffInputV1 } from "./design-resource-handoff-types.js";
|
|
2
|
+
import type { DesignResourceHandoffInputV1 } from "./design-resource-handoff-input-types.js";
|
|
3
3
|
import type { SemanticFactManifestV1 } from "./semantic-fact-types.js";
|
|
4
4
|
export interface ParsedSourceDocument {
|
|
5
5
|
items: CompiledSourceItemV2[];
|