@automovie/template 0.2.0 → 0.3.1
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/generated/pnpm-workspace.json +3 -3
- package/generated/skills/3d-modeling/conditioning.md +42 -34
- package/generated/skills/3d-modeling/crafting/SKILL.md +6 -6
- package/generated/skills/3d-modeling/crafting/construction.md +22 -29
- package/generated/skills/3d-modeling/crafting/lofting.md +26 -24
- package/generated/skills/3d-modeling/crafting/recovery.md +8 -8
- package/generated/skills/3d-modeling/diffusion/image-hints.md +5 -5
- package/generated/skills/3d-modeling/diffusion/models.md +32 -16
- package/generated/skills/3d-modeling/diffusion/prompts.md +3 -3
- package/generated/skills/3d-modeling/diffusion/request.md +7 -5
- package/generated/skills/3d-modeling/diffusion/shape-hints.md +19 -17
- package/generated/skills/3d-modeling/inspection.md +11 -9
- package/generated/skills/3d-modeling/modularization.md +9 -9
- package/generated/skills/3d-modeling/rigging.md +44 -35
- package/generated/skills/3d-modeling/sources.md +10 -10
- package/generated/skills/contracts/development/common.md +4 -4
- package/generated/skills/contracts/development/design.md +4 -4
- package/generated/skills/contracts/development/implementation.md +7 -7
- package/generated/skills/contracts/development/testing.md +4 -4
- package/generated/skills/development/repair.md +2 -4
- package/generated/skills/documentation/SKILL.md +4 -4
- package/generated/skills/documentation/writing.md +56 -34
- package/generated/skills/motion/laws/authoring.md +20 -30
- package/generated/skills/motion/laws/contacts.md +13 -13
- package/generated/skills/motion/laws/declaration.md +8 -6
- package/generated/skills/motion/laws/transitions.md +20 -18
- package/generated/skills/motion/laws/variation.md +6 -6
- package/generated/skills/motion/laws/verification.md +8 -6
- package/generated/skills/prompting/SKILL.md +52 -34
- package/generated/skills/visual-debugging/capture.md +24 -22
- package/generated/skills/visual-debugging/comparison.md +4 -4
- package/generated/skills/visual-debugging/correction-rounds.md +6 -15
- package/generated/skills/visual-debugging/passes.md +11 -11
- package/generated/skills/visual-debugging/rendering-cost.md +2 -2
- package/lib/createAutoMovieScaffold.js +2 -20
- package/lib/createAutoMovieScaffold.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/renderAutoMovieWorkspace.d.ts +22 -0
- package/lib/renderAutoMovieWorkspace.js +141 -0
- package/lib/renderAutoMovieWorkspace.js.map +1 -0
- package/package.json +5 -5
- package/scaffold/instructions/.agents/skills/3d-modeling/SKILL.md +22 -21
- package/scaffold/instructions/.agents/skills/3d-modeling/coarse-forms.md +7 -7
- package/scaffold/instructions/.agents/skills/3d-modeling/diffusion/SKILL.md +14 -10
- package/scaffold/instructions/.agents/skills/audio/SKILL.md +10 -10
- package/scaffold/instructions/.agents/skills/audio/acquisition.md +16 -18
- package/scaffold/instructions/.agents/skills/audio/diffusion/SKILL.md +18 -0
- package/scaffold/instructions/.agents/skills/audio/diffusion/cloning.md +25 -0
- package/scaffold/instructions/.agents/skills/audio/diffusion/models.md +59 -0
- package/scaffold/instructions/.agents/skills/audio/diffusion/prompts.md +45 -0
- package/scaffold/instructions/.agents/skills/audio/film-sound.md +7 -5
- package/scaffold/instructions/.agents/skills/audio/generated-sound.md +5 -3
- package/scaffold/instructions/.agents/skills/audio/listening.md +13 -0
- package/scaffold/instructions/.agents/skills/audio/sound-effects.md +6 -6
- package/scaffold/instructions/.agents/skills/audio/soundtrack.md +4 -2
- package/scaffold/instructions/.agents/skills/automovie/SKILL.md +32 -0
- package/scaffold/instructions/.agents/skills/contracts/SKILL.md +6 -29
- package/scaffold/instructions/.agents/skills/contracts/development/SKILL.md +13 -13
- package/scaffold/instructions/.agents/skills/contracts/development/behaviors.md +18 -7
- package/scaffold/instructions/.agents/skills/contracts/development/composition.md +9 -6
- package/scaffold/instructions/.agents/skills/contracts/development/entities.md +6 -7
- package/scaffold/instructions/.agents/skills/contracts/development/statements/behaviors.md +18 -20
- package/scaffold/instructions/.agents/skills/contracts/development/statements/composition.md +4 -6
- package/scaffold/instructions/.agents/skills/contracts/development/statements/entities.md +12 -13
- package/scaffold/instructions/.agents/skills/contracts/items.md +26 -0
- package/scaffold/instructions/.agents/skills/contracts/story/SKILL.md +37 -25
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/brief.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/common.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/narratives.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/screenplay.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/scripts.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/treatments.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/common.md +4 -4
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/obligations/common.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/obligations/realized.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/obligations/scripts.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/realized.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/scripts.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/brief.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/common.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/index.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/narratives.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/review.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/screenplay.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/scripts.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/settings.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/treatments.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/brief.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/common.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/index.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/narratives.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/realized.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/research.md +3 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/screenplay.md +3 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/scripts.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/settings.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/treatments.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/brief.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/common.md +3 -5
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/narratives.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/screenplay.md +0 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/scripts.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/settings.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/treatments.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/common.md +11 -14
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/obligations/common.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/obligations/realized.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/obligations/scripts.md +3 -5
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/realized.md +2 -4
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/scripts.md +1 -4
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/brief.md +6 -6
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/common.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/index.md +2 -4
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/narratives.md +3 -5
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/review.md +5 -7
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/screenplay.md +5 -7
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/scripts.md +2 -4
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/settings.md +6 -8
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/treatments.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/brief.md +4 -6
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/common.md +2 -4
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/index.md +2 -4
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/narratives.md +3 -5
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/realized.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/research.md +6 -8
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/review.md +5 -7
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/screenplay.md +19 -22
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/scripts.md +9 -11
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/settings.md +3 -5
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/treatments.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/upstream/screenplay.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/upstream/scripts.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/upstream/treatments.md +0 -2
- package/scaffold/instructions/.agents/skills/contracts/story/shared/upstream/screenplay.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/upstream/scripts.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/story/shared/upstream/treatments.md +1 -1
- package/scaffold/instructions/.agents/skills/development/SKILL.md +14 -24
- package/scaffold/instructions/.agents/skills/development/entities.md +19 -15
- package/scaffold/instructions/.agents/skills/development/modules.md +31 -0
- package/scaffold/instructions/.agents/skills/development/source-layout.md +66 -50
- package/scaffold/instructions/.agents/skills/development/testing.md +10 -11
- package/scaffold/instructions/.agents/skills/evidence/SKILL.md +7 -7
- package/scaffold/instructions/.agents/skills/evidence/adoption.md +4 -4
- package/scaffold/instructions/.agents/skills/evidence/answering.md +3 -3
- package/scaffold/instructions/.agents/skills/evidence/configuration.md +4 -4
- package/scaffold/instructions/.agents/skills/image/SKILL.md +8 -19
- package/scaffold/instructions/.agents/skills/image/canon-references.md +16 -6
- package/scaffold/instructions/.agents/skills/image/diffusion/SKILL.md +23 -0
- package/scaffold/instructions/.agents/skills/image/diffusion/conditioning.md +29 -0
- package/scaffold/instructions/.agents/skills/image/diffusion/consistency.md +25 -0
- package/scaffold/instructions/.agents/skills/image/diffusion/editing.md +15 -0
- package/scaffold/instructions/.agents/skills/image/diffusion/finishing.md +11 -0
- package/scaffold/instructions/.agents/skills/image/diffusion/models.md +35 -0
- package/scaffold/instructions/.agents/skills/image/diffusion/prompting.md +27 -0
- package/scaffold/instructions/.agents/skills/image/turnaround-views.md +6 -2
- package/scaffold/instructions/.agents/skills/motion/SKILL.md +15 -32
- package/scaffold/instructions/.agents/skills/motion/catalog-cases.md +15 -15
- package/scaffold/instructions/.agents/skills/motion/compose/composition.md +34 -26
- package/scaffold/instructions/.agents/skills/motion/compose/refusals.md +5 -5
- package/scaffold/instructions/.agents/skills/motion/control-channels.md +14 -10
- package/scaffold/instructions/.agents/skills/motion/diffusion/SKILL.md +12 -8
- package/scaffold/instructions/.agents/skills/motion/diffusion/clips.md +23 -9
- package/scaffold/instructions/.agents/skills/motion/diffusion/hints.md +20 -8
- package/scaffold/instructions/.agents/skills/motion/diffusion/models.md +24 -16
- package/scaffold/instructions/.agents/skills/motion/diffusion/tracing.md +18 -12
- package/scaffold/instructions/.agents/skills/motion/frame-evaluation.md +6 -6
- package/scaffold/instructions/.agents/skills/motion/judgment.md +37 -0
- package/scaffold/instructions/.agents/skills/motion/laws/SKILL.md +11 -11
- package/scaffold/instructions/.agents/skills/motion/laws/extension.md +15 -11
- package/scaffold/instructions/.agents/skills/motion/laws/method-references.md +47 -17
- package/scaffold/instructions/.agents/skills/motion/performance.md +11 -0
- package/scaffold/instructions/.agents/skills/motion/physical-feedback.md +15 -15
- package/scaffold/instructions/.agents/skills/motion/retargeting.md +5 -5
- package/scaffold/instructions/.agents/skills/motion/segment-review.md +7 -5
- package/scaffold/instructions/.agents/skills/motion/staging.md +10 -8
- package/scaffold/instructions/.agents/skills/production/SKILL.md +11 -38
- package/scaffold/instructions/.agents/skills/production/assembly.md +11 -5
- package/scaffold/instructions/.agents/skills/production/captions.md +4 -4
- package/scaffold/instructions/.agents/skills/production/director.md +17 -0
- package/scaffold/instructions/.agents/skills/production/media-records.md +33 -11
- package/scaffold/instructions/.agents/skills/production/project-context.md +64 -22
- package/scaffold/instructions/.agents/skills/production/reorganization.md +3 -3
- package/scaffold/instructions/.agents/skills/production/stage-caches.md +7 -11
- package/scaffold/instructions/.agents/skills/production/sustained-runs.md +7 -7
- package/scaffold/instructions/.agents/skills/production/workflow.md +45 -0
- package/scaffold/instructions/.agents/skills/review/SKILL.md +10 -15
- package/scaffold/instructions/.agents/skills/review/delivery-review.md +51 -30
- package/scaffold/instructions/.agents/skills/review/estimation.md +32 -13
- package/scaffold/instructions/.agents/skills/review/independent-reading.md +6 -4
- package/scaffold/instructions/.agents/skills/review/narrative-rounds.md +7 -7
- package/scaffold/instructions/.agents/skills/review/source-review.md +5 -9
- package/scaffold/instructions/.agents/skills/story/SKILL.md +10 -13
- package/scaffold/instructions/.agents/skills/story/answers.md +10 -10
- package/scaffold/instructions/.agents/skills/story/correction/inspection.md +10 -12
- package/scaffold/instructions/.agents/skills/story/correction/repair.md +20 -14
- package/scaffold/instructions/.agents/skills/story/document-layout.md +32 -17
- package/scaffold/instructions/.agents/skills/story/layers/SKILL.md +11 -9
- package/scaffold/instructions/.agents/skills/story/layers/brief.md +4 -8
- package/scaffold/instructions/.agents/skills/story/layers/notation.md +8 -6
- package/scaffold/instructions/.agents/skills/story/layers/screenplay.md +20 -12
- package/scaffold/instructions/.agents/skills/story/layers/scripts.md +3 -3
- package/scaffold/instructions/.agents/skills/story/layers/settings.md +28 -11
- package/scaffold/instructions/.agents/skills/story/layers/shots.md +8 -8
- package/scaffold/instructions/.agents/skills/story/layers/treatments.md +3 -3
- package/scaffold/instructions/.agents/skills/story/planning/SKILL.md +7 -7
- package/scaffold/instructions/.agents/skills/story/planning/direction.md +2 -2
- package/scaffold/instructions/.agents/skills/story/planning/discovery.md +9 -7
- package/scaffold/instructions/.agents/skills/story/planning/requirements.md +10 -8
- package/scaffold/instructions/.agents/skills/story/planning/research.md +15 -18
- package/scaffold/instructions/.agents/skills/story/workflow/SKILL.md +8 -7
- package/scaffold/instructions/.agents/skills/story/workflow/long.md +18 -14
- package/scaffold/instructions/.agents/skills/story/workflow/routes.md +23 -17
- package/scaffold/instructions/.agents/skills/story/workflow/short.md +22 -14
- package/scaffold/instructions/.agents/skills/video/SKILL.md +9 -14
- package/scaffold/instructions/.agents/skills/video/diffusion/SKILL.md +7 -7
- package/scaffold/instructions/.agents/skills/video/diffusion/continuity.md +6 -6
- package/scaffold/instructions/.agents/skills/video/diffusion/hints.md +29 -12
- package/scaffold/instructions/.agents/skills/video/diffusion/models.md +40 -19
- package/scaffold/instructions/.agents/skills/video/diffusion/prompts.md +23 -15
- package/scaffold/instructions/.agents/skills/video/direct-film.md +53 -0
- package/scaffold/instructions/.agents/skills/video/finishing.md +14 -12
- package/scaffold/instructions/.agents/skills/video/generated-film.md +24 -0
- package/scaffold/instructions/.agents/skills/video/generation.md +25 -17
- package/scaffold/instructions/.agents/skills/video/requests.md +8 -8
- package/scaffold/instructions/.agents/skills/visual-debugging/SKILL.md +20 -18
- package/scaffold/instructions/AGENTS.md +46 -46
- package/scaffold/production/README.md +10 -19
- package/scaffold/production/package.json +1 -1
- package/scaffold/production/src/IFilmProduction.ts +22 -3
- package/scaffold/production/src/executable/physics.ts +8 -4
- package/scaffold/production/src/executable/recovery/node/artifact/archiveAutoMovieRecoveryModel.ts +4 -4
- package/scaffold/production/src/executable/recovery/node/artifact/createAutoMovieRecoveryArtifact.ts +5 -3
- package/scaffold/production/src/executable/recovery/node/artifact/writeAutoMovieRecoveryArtifact.ts +7 -7
- package/scaffold/production/src/executable/recovery/node/internal/readRecoveryCameraImages.ts +4 -2
- package/scaffold/production/src/executable/recovery/node/internal/recovery.ts +3 -3
- package/scaffold/production/src/executable/recovery/node/internal/recoveryImages.ts +3 -3
- package/scaffold/production/src/executable/recovery/node/internal/recoveryLocal.ts +4 -2
- package/scaffold/production/src/executable/recovery/node/internal/recoveryOpen.ts +2 -2
- package/scaffold/production/src/executable/recovery/node/mesh/createAutoMovieRecoveryContourFileMesh.ts +17 -18
- package/scaffold/production/src/executable/recovery/node/mesh/createAutoMovieRecoveryMeshSpool.ts +17 -18
- package/scaffold/production/src/executable/recovery/node/mesh/readAutoMovieRecoveryMeshFrontier.ts +4 -4
- package/scaffold/production/src/executable/recovery/node/publishAutoMovieRecoveryArtifact.ts +37 -21
- package/scaffold/production/src/executable/recovery/node/reconstruction/reconstructAutoMovieRecoveryLocal.ts +25 -15
- package/scaffold/production/src/executable/recovery/node/runAutoMovieRecoveryCommand.ts +1 -1
- package/scaffold/production/src/markFilmProduction.ts +1 -1
- package/scaffold/production/src/subjects.ts +28 -7
- package/scaffold/production/test/features/test_recovery_publication_cancellation.ts +129 -0
- package/scaffold/production/tsconfig.json +1 -2
- package/scaffold/production/vite.config.ts +12 -0
- package/scaffold/workspace/README.md +2 -2
- package/scaffold/workspace/package.json +1 -1
- package/src/createAutoMovieScaffold.ts +2 -39
- package/src/index.ts +1 -0
- package/src/renderAutoMovieWorkspace.ts +157 -0
- package/scaffold/instructions/.agents/skills/development/reuse.md +0 -48
- package/scaffold/instructions/.agents/skills/direct-film/SKILL.md +0 -51
- package/scaffold/instructions/.agents/skills/image/conditioning.md +0 -27
- package/scaffold/instructions/.agents/skills/image/consistency.md +0 -23
- package/scaffold/instructions/.agents/skills/image/editing.md +0 -15
- package/scaffold/instructions/.agents/skills/image/finishing.md +0 -11
- package/scaffold/instructions/.agents/skills/image/models.md +0 -18
- package/scaffold/instructions/.agents/skills/image/prompting.md +0 -25
package/scaffold/production/src/executable/recovery/node/publishAutoMovieRecoveryArtifact.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "@automovie/
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieFilePublicationOptions,
|
|
3
|
+
IAutoMovieFileReceipt,
|
|
4
|
+
IAutoMovieRecoveryResult,
|
|
5
|
+
} from "@automovie/interface";
|
|
6
6
|
|
|
7
7
|
import { writeAutoMovieRecoveryArtifact } from "./artifact/writeAutoMovieRecoveryArtifact";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Publish one plain data artifact atomically without replacing an existing file.
|
|
11
11
|
* Publication identity is the exact emitted UTF-8 byte hash, independent of model
|
|
12
|
-
* identity.
|
|
13
|
-
* operation cannot observe
|
|
12
|
+
* identity. The optional cancellation predicate runs before serialization; this
|
|
13
|
+
* operation cannot observe event-loop changes while blocked in synchronous I/O.
|
|
14
|
+
* A thrown predicate or nonboolean result fails without publishing an artifact.
|
|
14
15
|
* Failed serialization leaves the target unpublished and removes its temporary
|
|
15
16
|
* file. A process crash can leave an unpublished temporary file, as documented by
|
|
16
17
|
* the writer. Cancellation does not delete a completed immutable publication.
|
|
@@ -26,23 +27,38 @@ import { writeAutoMovieRecoveryArtifact } from "./artifact/writeAutoMovieRecover
|
|
|
26
27
|
export function publishAutoMovieRecoveryArtifact(
|
|
27
28
|
output: string,
|
|
28
29
|
artifact: object,
|
|
29
|
-
options:
|
|
30
|
-
): IAutoMovieRecoveryResult<
|
|
30
|
+
options: IAutoMovieFilePublicationOptions = {},
|
|
31
|
+
): IAutoMovieRecoveryResult<IAutoMovieFileReceipt> {
|
|
31
32
|
const operator: IAutoMovieRecoveryResult<never>["operator"] =
|
|
32
33
|
"json-publication-v1";
|
|
33
|
-
if (options.signal?.aborted)
|
|
34
|
-
return {
|
|
35
|
-
operator,
|
|
36
|
-
status: "cancelled",
|
|
37
|
-
diagnostics: ["Cancelled before publication"],
|
|
38
|
-
};
|
|
39
|
-
if (!output || artifact === null || typeof artifact !== "object")
|
|
40
|
-
return {
|
|
41
|
-
operator,
|
|
42
|
-
status: "refused",
|
|
43
|
-
diagnostics: ["An output path and plain data artifact are required"],
|
|
44
|
-
};
|
|
45
34
|
try {
|
|
35
|
+
if (
|
|
36
|
+
options === null ||
|
|
37
|
+
typeof options !== "object" ||
|
|
38
|
+
(options.cancelled !== undefined &&
|
|
39
|
+
typeof options.cancelled !== "function")
|
|
40
|
+
)
|
|
41
|
+
return {
|
|
42
|
+
operator,
|
|
43
|
+
status: "refused",
|
|
44
|
+
diagnostics: ["Cancellation must be an optional synchronous predicate"],
|
|
45
|
+
};
|
|
46
|
+
const cancelled: boolean =
|
|
47
|
+
options.cancelled === undefined ? false : options.cancelled();
|
|
48
|
+
if (typeof cancelled !== "boolean")
|
|
49
|
+
throw new Error("Cancellation predicate must return a boolean");
|
|
50
|
+
if (cancelled)
|
|
51
|
+
return {
|
|
52
|
+
operator,
|
|
53
|
+
status: "cancelled",
|
|
54
|
+
diagnostics: ["Cancelled before publication"],
|
|
55
|
+
};
|
|
56
|
+
if (!output || artifact === null || typeof artifact !== "object")
|
|
57
|
+
return {
|
|
58
|
+
operator,
|
|
59
|
+
status: "refused",
|
|
60
|
+
diagnostics: ["An output path and plain data artifact are required"],
|
|
61
|
+
};
|
|
46
62
|
const publication: ReturnType<typeof writeAutoMovieRecoveryArtifact> =
|
|
47
63
|
writeAutoMovieRecoveryArtifact(output, artifact);
|
|
48
64
|
return {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { tessellateAutoMovieLocalHermite64 as T } from "@automovie/engine";
|
|
2
|
+
import type {
|
|
3
|
+
IAutoMovieCubicBezierCurve64,
|
|
4
|
+
IAutoMovieLocalHermiteStream64,
|
|
5
|
+
IAutoMovieRecoveryLocalBinding,
|
|
6
|
+
IAutoMovieRecoveryLocalResult,
|
|
7
|
+
IAutoMovieRecoveryLocalRunReport,
|
|
8
|
+
IAutoMovieRecoveryOpenContinuation,
|
|
9
|
+
IAutoMovieRecoveryTensorFamiliesInput,
|
|
10
|
+
} from "@automovie/interface";
|
|
1
11
|
import {
|
|
2
|
-
type IAutoMovieCurve64 as C,
|
|
3
|
-
tessellateAutoMovieLocalHermite64 as T,
|
|
4
|
-
} from "@automovie/engine";
|
|
5
|
-
import {
|
|
6
|
-
type IAutoMovieRecoveryLocalBinding,
|
|
7
|
-
type IAutoMovieRecoveryLocalResult,
|
|
8
|
-
type IAutoMovieRecoveryOpenContinuation,
|
|
9
|
-
type IAutoMovieRecoveryTensorFamiliesInput,
|
|
10
|
-
type RecoveryLocalRunReport,
|
|
11
12
|
describeRecoveryOpenRun,
|
|
12
13
|
normalizeRecoveryCourse,
|
|
13
14
|
prepareRecoveryLocalContinuation,
|
|
@@ -121,7 +122,7 @@ export function reconstructAutoMovieRecoveryLocal(
|
|
|
121
122
|
attachedBone: null,
|
|
122
123
|
transform: null,
|
|
123
124
|
});
|
|
124
|
-
type RunReport =
|
|
125
|
+
type RunReport = IAutoMovieRecoveryLocalRunReport;
|
|
125
126
|
const runs: RunReport[] = [],
|
|
126
127
|
checkpoints: { path: string; sha256: string; bytes: number }[] = [];
|
|
127
128
|
let completedPairs: number = 0,
|
|
@@ -311,11 +312,17 @@ export function reconstructAutoMovieRecoveryLocal(
|
|
|
311
312
|
elapsedMs: performance.now() - started,
|
|
312
313
|
}),
|
|
313
314
|
);
|
|
314
|
-
let iterator:
|
|
315
|
+
let iterator:
|
|
316
|
+
| Generator<
|
|
317
|
+
IAutoMovieLocalHermiteStream64.Chunk,
|
|
318
|
+
IAutoMovieLocalHermiteStream64.Summary,
|
|
319
|
+
void
|
|
320
|
+
>
|
|
321
|
+
| undefined;
|
|
315
322
|
let outputOperation: boolean = false;
|
|
316
323
|
try {
|
|
317
|
-
const courses:
|
|
318
|
-
(n: Node, i: number):
|
|
324
|
+
const courses: IAutoMovieCubicBezierCurve64[] = nodes.map(
|
|
325
|
+
(n: Node, i: number): IAutoMovieCubicBezierCurve64 =>
|
|
319
326
|
normalizeRecoveryCourse(
|
|
320
327
|
bundle.reports[n.section]!.open[n.arc]!.curve,
|
|
321
328
|
reversals[i]!,
|
|
@@ -334,9 +341,12 @@ export function reconstructAutoMovieRecoveryLocal(
|
|
|
334
341
|
maxVerticesPerChunk: 32_768,
|
|
335
342
|
vertexOffset: spool.counts.vertices,
|
|
336
343
|
});
|
|
337
|
-
let result: IteratorResult<
|
|
344
|
+
let result: IteratorResult<
|
|
345
|
+
IAutoMovieLocalHermiteStream64.Chunk,
|
|
346
|
+
IAutoMovieLocalHermiteStream64.Summary
|
|
347
|
+
> = iterator.next();
|
|
338
348
|
while (!result.done) {
|
|
339
|
-
const chunk:
|
|
349
|
+
const chunk: IAutoMovieLocalHermiteStream64.Chunk = result.value;
|
|
340
350
|
outputOperation = true;
|
|
341
351
|
spool.append(chunk, {
|
|
342
352
|
run: id,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { IAutoMovieMark } from "@automovie/engine";
|
|
2
1
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
IAutoMovieMark,
|
|
3
|
+
IAutoMovieRenderSoftPropFrame,
|
|
4
|
+
} from "@automovie/interface";
|
|
5
|
+
import {
|
|
6
|
+
type AutoMovieDrawSubjects,
|
|
7
|
+
type IAutoMovieDrawScene,
|
|
8
|
+
type IAutoMovieDrawSubject,
|
|
9
|
+
bindAutoMovieDrawSceneSoftProps,
|
|
6
10
|
} from "@automovie/render";
|
|
7
11
|
|
|
8
12
|
import type { IFilm } from "./IFilm";
|
|
@@ -17,12 +21,12 @@ import { markFilmProduction } from "./markFilmProduction";
|
|
|
17
21
|
* Each film is created as the Viewer creates it, at its delivery raster (1280 × 720 when it states none), seeked through its own `seek` at a second clamped to its running time, and marked by `markFilmProduction`, so a capture, a delivered frame and the Viewer show the same state.
|
|
18
22
|
*
|
|
19
23
|
* @evidence contracts/development/common.md#meaningful-documentation States what each subject is, who draws it, and how its raster, seek and marks are taken.
|
|
20
|
-
* @evidence contracts/development/implementation.md#principled-implementation
|
|
24
|
+
* @evidence contracts/development/implementation.md#principled-implementation Maps the film registry, placement and shared marks onto the draw contract, and binds optional soft surfaces after placement at the same clamped second.
|
|
21
25
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure One mapping per film.
|
|
22
26
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No film is named; the props are not read, since films need none.
|
|
23
27
|
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the registered films; a film is created only when its subject is.
|
|
24
28
|
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A mapping made once per page.
|
|
25
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The
|
|
29
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The subject's dispose releases the film, and the render adapter independently releases any soft prop meshes it mounts.
|
|
26
30
|
*/
|
|
27
31
|
export const subjects: AutoMovieDrawSubjects = (): Readonly<
|
|
28
32
|
Record<string, IAutoMovieDrawSubject>
|
|
@@ -34,13 +38,19 @@ export const subjects: AutoMovieDrawSubjects = (): Readonly<
|
|
|
34
38
|
{
|
|
35
39
|
create: async (): Promise<IAutoMovieDrawScene> => {
|
|
36
40
|
const production: IFilmProduction = await film.create();
|
|
37
|
-
|
|
41
|
+
const subject: IAutoMovieDrawScene = {
|
|
38
42
|
scene: production.scene,
|
|
39
43
|
camera: production.camera,
|
|
40
44
|
durationSeconds: film.durationSeconds,
|
|
41
45
|
fps: film.fps,
|
|
42
46
|
width: film.width ?? 1280,
|
|
43
47
|
height: film.height ?? 720,
|
|
48
|
+
markKinds: [
|
|
49
|
+
...(production.markKinds ?? []),
|
|
50
|
+
...(production.performance === undefined
|
|
51
|
+
? []
|
|
52
|
+
: ["joint", "bone", "contact"]),
|
|
53
|
+
],
|
|
44
54
|
...(production.views === undefined
|
|
45
55
|
? {}
|
|
46
56
|
: { views: production.views }),
|
|
@@ -52,6 +62,17 @@ export const subjects: AutoMovieDrawSubjects = (): Readonly<
|
|
|
52
62
|
),
|
|
53
63
|
dispose: (): void => production.dispose(),
|
|
54
64
|
};
|
|
65
|
+
const softPropsAt: IFilmProduction["softPropsAt"] =
|
|
66
|
+
production.softPropsAt?.bind(production);
|
|
67
|
+
return softPropsAt === undefined
|
|
68
|
+
? subject
|
|
69
|
+
: bindAutoMovieDrawSceneSoftProps(
|
|
70
|
+
subject,
|
|
71
|
+
(seconds: number): readonly IAutoMovieRenderSoftPropFrame[] =>
|
|
72
|
+
softPropsAt(
|
|
73
|
+
clampProductionSeconds(seconds, film.durationSeconds),
|
|
74
|
+
),
|
|
75
|
+
);
|
|
55
76
|
},
|
|
56
77
|
},
|
|
57
78
|
],
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieFilePublicationOptions,
|
|
3
|
+
IAutoMovieFileReceipt,
|
|
4
|
+
IAutoMovieRecoveryResult,
|
|
5
|
+
} from "@automovie/interface";
|
|
6
|
+
import { TestValidator } from "@nestia/e2e";
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import os from "node:os";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
|
|
11
|
+
import { publishAutoMovieRecoveryArtifact } from "../../src/executable/recovery/node/publishAutoMovieRecoveryArtifact";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A publication's cancellation predicate is observed before any output is created.
|
|
15
|
+
*
|
|
16
|
+
* Scenarios:
|
|
17
|
+
* 1. True cancels and a thrown predicate fails; both run exactly once and create no output.
|
|
18
|
+
* 2. Nonboolean predicate results fail, while a nonfunction predicate refuses, without output.
|
|
19
|
+
* 3. False permits exact JSON publication and a later cancellation preserves the existing bytes.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/development/testing.md#behavioral-verification Calls the shipped Node publication host and observes terminal tags, predicate invocation count, filesystem absence and exact surviving JSON bytes.
|
|
22
|
+
* @evidence contracts/development/testing.md#independent-expectations Literal predicates and callback errors determine the terminal outcomes; an owned empty directory independently exposes any premature publication.
|
|
23
|
+
* @evidence contracts/development/testing.md#distinguishing-cases Separates true/false, thrown callback, undefined/null/string/number result, malformed callback and cancellation after an immutable output already exists.
|
|
24
|
+
* @evidence contracts/development/testing.md#execution-ownership The entry owns one unique temporary directory and removes it in finally; it replaces no foreign method and starts no subprocess, compiler, renderer or timer.
|
|
25
|
+
* @evidence contracts/development/common.md#meaningful-documentation States pre-work cancellation and failure behavior alongside exact output/lifetime checks.
|
|
26
|
+
*/
|
|
27
|
+
export function test_recovery_publication_cancellation(): void {
|
|
28
|
+
const directory: string = fs.mkdtempSync(
|
|
29
|
+
path.join(os.tmpdir(), "automovie-interface-publication-"),
|
|
30
|
+
);
|
|
31
|
+
const output: string = path.join(directory, "artifact.json");
|
|
32
|
+
const artifact: { value: number } = { value: 42 };
|
|
33
|
+
try {
|
|
34
|
+
for (const throws of [false, true]) {
|
|
35
|
+
let calls: number = 0;
|
|
36
|
+
const result: IAutoMovieRecoveryResult<IAutoMovieFileReceipt> =
|
|
37
|
+
publishAutoMovieRecoveryArtifact(output, artifact, {
|
|
38
|
+
cancelled: (): boolean => {
|
|
39
|
+
calls++;
|
|
40
|
+
if (throws) throw new Error("publication predicate failed");
|
|
41
|
+
return true;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
TestValidator.equals(
|
|
45
|
+
"cancellation and exception remain distinct",
|
|
46
|
+
result.status,
|
|
47
|
+
throws ? "failed" : "cancelled",
|
|
48
|
+
);
|
|
49
|
+
TestValidator.equals("one pre-work predicate call", calls, 1);
|
|
50
|
+
TestValidator.predicate(
|
|
51
|
+
"pre-work exit returns no receipt",
|
|
52
|
+
!("value" in result),
|
|
53
|
+
);
|
|
54
|
+
TestValidator.equals(
|
|
55
|
+
"pre-work exit creates no files",
|
|
56
|
+
fs.readdirSync(directory),
|
|
57
|
+
[],
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
for (const invalidResult of [undefined, null, "yes", 1]) {
|
|
61
|
+
const options: IAutoMovieFilePublicationOptions = Object.defineProperty(
|
|
62
|
+
{},
|
|
63
|
+
"cancelled",
|
|
64
|
+
{ value: (): unknown => invalidResult },
|
|
65
|
+
);
|
|
66
|
+
const result: IAutoMovieRecoveryResult<IAutoMovieFileReceipt> =
|
|
67
|
+
publishAutoMovieRecoveryArtifact(output, artifact, options);
|
|
68
|
+
TestValidator.equals(
|
|
69
|
+
"nonboolean predicate fails",
|
|
70
|
+
result.status,
|
|
71
|
+
"failed",
|
|
72
|
+
);
|
|
73
|
+
TestValidator.equals(
|
|
74
|
+
"invalid result creates no files",
|
|
75
|
+
fs.readdirSync(directory),
|
|
76
|
+
[],
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
const invalid: IAutoMovieRecoveryResult<IAutoMovieFileReceipt> =
|
|
80
|
+
publishAutoMovieRecoveryArtifact(
|
|
81
|
+
output,
|
|
82
|
+
artifact,
|
|
83
|
+
JSON.parse('{"cancelled":null}'),
|
|
84
|
+
);
|
|
85
|
+
TestValidator.equals(
|
|
86
|
+
"nonfunction predicate refuses",
|
|
87
|
+
invalid.status,
|
|
88
|
+
"refused",
|
|
89
|
+
);
|
|
90
|
+
TestValidator.equals(
|
|
91
|
+
"refused predicate creates no files",
|
|
92
|
+
fs.readdirSync(directory),
|
|
93
|
+
[],
|
|
94
|
+
);
|
|
95
|
+
const completed: IAutoMovieRecoveryResult<IAutoMovieFileReceipt> =
|
|
96
|
+
publishAutoMovieRecoveryArtifact(output, artifact, {
|
|
97
|
+
cancelled: (): boolean => false,
|
|
98
|
+
});
|
|
99
|
+
TestValidator.equals(
|
|
100
|
+
"false permits publication",
|
|
101
|
+
completed.status,
|
|
102
|
+
"complete",
|
|
103
|
+
);
|
|
104
|
+
const bytes: string = fs.readFileSync(output, "utf8");
|
|
105
|
+
TestValidator.equals(
|
|
106
|
+
"published data preserves the artifact",
|
|
107
|
+
JSON.parse(bytes),
|
|
108
|
+
artifact,
|
|
109
|
+
);
|
|
110
|
+
const cancelled: IAutoMovieRecoveryResult<IAutoMovieFileReceipt> =
|
|
111
|
+
publishAutoMovieRecoveryArtifact(
|
|
112
|
+
output,
|
|
113
|
+
{ value: 99 },
|
|
114
|
+
{ cancelled: (): boolean => true },
|
|
115
|
+
);
|
|
116
|
+
TestValidator.equals(
|
|
117
|
+
"later cancellation returns no publication",
|
|
118
|
+
cancelled.status,
|
|
119
|
+
"cancelled",
|
|
120
|
+
);
|
|
121
|
+
TestValidator.equals(
|
|
122
|
+
"cancellation preserves published bytes",
|
|
123
|
+
fs.readFileSync(output, "utf8"),
|
|
124
|
+
bytes,
|
|
125
|
+
);
|
|
126
|
+
} finally {
|
|
127
|
+
fs.rmSync(directory, { recursive: true });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -7,8 +7,20 @@ const productionRoot: string = fileURLToPath(new URL(".", import.meta.url));
|
|
|
7
7
|
|
|
8
8
|
/** The production's inspector page; generated evidence and capture scratch never reload it. `automovie capture`, `render` and `inspect` build their own pages with this configuration. */
|
|
9
9
|
export default defineConfig({
|
|
10
|
+
resolve: {
|
|
11
|
+
// Published SDK CommonJS imports must share the browser's ESM Three.js;
|
|
12
|
+
// Three.js's require entry emits a Node-only process warning.
|
|
13
|
+
alias: [
|
|
14
|
+
{
|
|
15
|
+
find: /^three$/,
|
|
16
|
+
replacement: fileURLToPath(import.meta.resolve("three")),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
10
20
|
build: {
|
|
11
21
|
target: "es2022",
|
|
22
|
+
// Preserve lazy initialization across the published SDK's require cycles.
|
|
23
|
+
commonjsOptions: { strictRequires: true },
|
|
12
24
|
},
|
|
13
25
|
server: {
|
|
14
26
|
host: "127.0.0.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{name}}
|
|
2
2
|
|
|
3
|
-
An AutoMovie workspace
|
|
3
|
+
An AutoMovie workspace lets productions share skills, contracts, an AutoMovie release and workspace packages. Follow each production's README for its workflow.
|
|
4
4
|
|
|
5
5
|
## Layout
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ pnpm automovie add shorts/<name>
|
|
|
24
24
|
pnpm install
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
`pnpm automovie add shorts/<name>` or `pnpm automovie add series/<name>` creates the production from the installed
|
|
27
|
+
`pnpm automovie add shorts/<name>` or `pnpm automovie add series/<name>` creates the production from the installed scaffold and fills any missing dependency catalog entries. Existing pins and overrides keep their values. The package name is the lowercased, npm-safe form of `<name>`, unless you supply `--name <package>`. Run `pnpm install` again to link the production, then follow its README.
|
|
28
28
|
|
|
29
29
|
## Packages
|
|
30
30
|
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import { stringify } from "yaml";
|
|
4
3
|
|
|
5
4
|
import type { IAutoMovieScaffoldProps } from "./IAutoMovieScaffoldProps";
|
|
6
5
|
import { assertScaffoldProjectName } from "./assertScaffoldProjectName";
|
|
7
6
|
import { listAutoMovieScaffoldFiles } from "./listAutoMovieScaffoldFiles";
|
|
7
|
+
import { renderAutoMovieWorkspace } from "./renderAutoMovieWorkspace";
|
|
8
8
|
import { scaffoldSharedSkillPath } from "./scaffoldSharedSkillPath";
|
|
9
9
|
|
|
10
10
|
/** The package root: `src` under ttsx and `lib` when published both sit one level below it. */
|
|
11
11
|
const PACKAGE: string = path.resolve(__dirname, "..");
|
|
12
12
|
|
|
13
|
-
/** The pnpm settings `build/prepare.ts` reads from the repository's own `pnpm-workspace.yaml`. */
|
|
14
|
-
interface IScaffoldPnpmSettings {
|
|
15
|
-
/** Names of the packages in the `automovie` catalog, whose range is this package's own version. */
|
|
16
|
-
automovie: string[];
|
|
17
|
-
|
|
18
|
-
/** Every other catalog the scaffold's `package.json` files reference, with the repository's ranges. */
|
|
19
|
-
catalogs: Record<string, Record<string, string>>;
|
|
20
|
-
|
|
21
|
-
/** The repository's dependency build policy. */
|
|
22
|
-
allowBuilds: Record<string, boolean>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
13
|
/**
|
|
26
14
|
* Create the files of a new AutoMovie installation as a `{ posixPath: content }` map.
|
|
27
15
|
*
|
|
@@ -73,7 +61,7 @@ export const createAutoMovieScaffold: (
|
|
|
73
61
|
if (props.kind !== "workspace-production") readLayer("instructions", add);
|
|
74
62
|
readLayer(props.kind === "workspace" ? "workspace" : "production", add);
|
|
75
63
|
if (props.kind !== "workspace-production")
|
|
76
|
-
add("pnpm-workspace.yaml",
|
|
64
|
+
add("pnpm-workspace.yaml", renderAutoMovieWorkspace(props.kind));
|
|
77
65
|
if (props.kind !== "workspace")
|
|
78
66
|
add(
|
|
79
67
|
"evidence.config.ts",
|
|
@@ -106,31 +94,6 @@ const readLayer = (
|
|
|
106
94
|
}
|
|
107
95
|
};
|
|
108
96
|
|
|
109
|
-
/** The `pnpm-workspace.yaml` of a single production, or with `packages` of a workspace root. */
|
|
110
|
-
const renderPnpmWorkspace = (packages: boolean): string => {
|
|
111
|
-
const settings: IScaffoldPnpmSettings = JSON.parse(
|
|
112
|
-
read(path.join(PACKAGE, "generated", "pnpm-workspace.json")),
|
|
113
|
-
) as IScaffoldPnpmSettings;
|
|
114
|
-
const manifest: { version: string } = JSON.parse(
|
|
115
|
-
read(path.join(PACKAGE, "package.json")),
|
|
116
|
-
) as { version: string };
|
|
117
|
-
return stringify({
|
|
118
|
-
...(packages
|
|
119
|
-
? { packages: ["movies/shorts/*", "movies/series/*", "packages/*"] }
|
|
120
|
-
: {}),
|
|
121
|
-
catalogs: {
|
|
122
|
-
automovie: Object.fromEntries(
|
|
123
|
-
settings.automovie.map((key: string): [string, string] => [
|
|
124
|
-
key,
|
|
125
|
-
`^${manifest.version}`,
|
|
126
|
-
]),
|
|
127
|
-
),
|
|
128
|
-
...settings.catalogs,
|
|
129
|
-
},
|
|
130
|
-
allowBuilds: settings.allowBuilds,
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
|
|
134
97
|
/** The `evidence.config.ts` of a production, reading its own skills or, inside a workspace, the root's. */
|
|
135
98
|
const renderEvidenceConfig = (workspace: boolean): string =>
|
|
136
99
|
[
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { type Document, isMap, parseDocument, stringify, visit } from "yaml";
|
|
4
|
+
|
|
5
|
+
/** Catalog dependencies and build policy collected from the shipped manifests at build time. */
|
|
6
|
+
interface IScaffoldSettings {
|
|
7
|
+
automovie: string[];
|
|
8
|
+
catalogs: Record<string, Record<string, string>>;
|
|
9
|
+
allowBuilds: Record<string, boolean>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Render pnpm settings for a new production or workspace. Given an existing
|
|
14
|
+
* workspace's directory and YAML, fill missing scaffold catalog entries.
|
|
15
|
+
* Existing pins, overrides, workspace members and build policy keep their values.
|
|
16
|
+
* A linked SDK supplies missing scoped packages when their sibling manifests
|
|
17
|
+
* identify them. Other new entries use the installed scaffold's ranges.
|
|
18
|
+
*
|
|
19
|
+
* @param workspace The new layout or the existing workspace whose catalogs the CLI needs.
|
|
20
|
+
* @returns Workspace YAML, byte-for-byte unchanged when every required entry exists.
|
|
21
|
+
* @throws If the shipped settings or workspace YAML cannot be read as required.
|
|
22
|
+
* @evidence contracts/development/implementation.md#principled-implementation Both paths resolve the shipped manifests' catalog references from the same build settings and template version. Local SDK lookup requires an existing link and the requested package identity.
|
|
23
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The layout selects creation or completion. The YAML document owns edits and the caller owns the write.
|
|
24
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The build discovers the dependencies. Package names and workspace layouts follow their published conventions.
|
|
25
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms The existing document is parsed once and each required entry is visited once. Only missing SDK entries probe sibling manifests in distinct linked directories.
|
|
26
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Both layouts share the resolved defaults. SDK directories are deduplicated per document.
|
|
27
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources File reads close synchronously. Parsed settings, document and link directories live for one call.
|
|
28
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment describes each mode, precedence, return value and failure.
|
|
29
|
+
*/
|
|
30
|
+
export function renderAutoMovieWorkspace(
|
|
31
|
+
workspace: "production" | "workspace" | { directory: string; source: string },
|
|
32
|
+
): string {
|
|
33
|
+
const settings: IScaffoldSettings = JSON.parse(
|
|
34
|
+
fs.readFileSync(
|
|
35
|
+
path.join(__dirname, "../generated/pnpm-workspace.json"),
|
|
36
|
+
"utf8",
|
|
37
|
+
),
|
|
38
|
+
);
|
|
39
|
+
const manifest: { version: string } = JSON.parse(
|
|
40
|
+
fs.readFileSync(path.join(__dirname, "../package.json"), "utf8"),
|
|
41
|
+
);
|
|
42
|
+
const catalogs: Record<string, Record<string, string>> = {
|
|
43
|
+
automovie: Object.fromEntries(
|
|
44
|
+
settings.automovie.map((name: string) => [name, `^${manifest.version}`]),
|
|
45
|
+
),
|
|
46
|
+
...settings.catalogs,
|
|
47
|
+
};
|
|
48
|
+
if (typeof workspace === "string")
|
|
49
|
+
return stringify({
|
|
50
|
+
...(workspace === "workspace"
|
|
51
|
+
? { packages: ["movies/shorts/*", "movies/series/*", "packages/*"] }
|
|
52
|
+
: {}),
|
|
53
|
+
catalogs,
|
|
54
|
+
allowBuilds: settings.allowBuilds,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const document: Document = parseDocument(workspace.source, { merge: true });
|
|
58
|
+
if (document.errors.length) throw document.errors[0];
|
|
59
|
+
const root: Map<string, unknown> = mapping(
|
|
60
|
+
document.toJS({ mapAsMap: true }),
|
|
61
|
+
"pnpm-workspace.yaml",
|
|
62
|
+
);
|
|
63
|
+
const current: Map<string, unknown> = mapping(
|
|
64
|
+
root.get("catalogs"),
|
|
65
|
+
"catalogs",
|
|
66
|
+
);
|
|
67
|
+
const sdk: Map<string, unknown> = mapping(
|
|
68
|
+
current.get("automovie"),
|
|
69
|
+
"catalogs.automovie",
|
|
70
|
+
);
|
|
71
|
+
const overrides: Map<string, unknown> = mapping(
|
|
72
|
+
root.get("overrides"),
|
|
73
|
+
"overrides",
|
|
74
|
+
);
|
|
75
|
+
const directories: Set<string> = new Set();
|
|
76
|
+
for (const [name, spec] of new Map([...sdk, ...overrides]))
|
|
77
|
+
if (
|
|
78
|
+
name.startsWith("@automovie/") &&
|
|
79
|
+
typeof spec === "string" &&
|
|
80
|
+
spec.startsWith("link:")
|
|
81
|
+
)
|
|
82
|
+
directories.add(
|
|
83
|
+
path.dirname(path.resolve(workspace.directory, spec.slice(5))),
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
let changed: boolean = false;
|
|
87
|
+
for (const [catalog, dependencies] of Object.entries(catalogs)) {
|
|
88
|
+
const entries: Map<string, unknown> = mapping(
|
|
89
|
+
current.get(catalog),
|
|
90
|
+
`catalogs.${catalog}`,
|
|
91
|
+
);
|
|
92
|
+
const missing: [string, string][] = Object.entries(dependencies).filter(
|
|
93
|
+
([name]) => !entries.has(name),
|
|
94
|
+
);
|
|
95
|
+
if (missing.length === 0) continue;
|
|
96
|
+
if (!changed) isolateMapping(document, ["catalogs"], current);
|
|
97
|
+
isolateMapping(document, ["catalogs", catalog], entries);
|
|
98
|
+
for (const [name, range] of missing) {
|
|
99
|
+
const link: string | undefined =
|
|
100
|
+
catalog === "automovie" && !overrides.has(name)
|
|
101
|
+
? linkedSibling(workspace.directory, directories, name)
|
|
102
|
+
: undefined;
|
|
103
|
+
document.setIn(["catalogs", catalog, name], link ?? range);
|
|
104
|
+
}
|
|
105
|
+
changed = true;
|
|
106
|
+
}
|
|
107
|
+
return changed ? document.toString() : workspace.source;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Give this path its own entries, preserving the old values at other uses of its anchor. */
|
|
111
|
+
function isolateMapping(
|
|
112
|
+
document: Document,
|
|
113
|
+
keys: string[],
|
|
114
|
+
values: Map<string, unknown>,
|
|
115
|
+
): void {
|
|
116
|
+
const node = document.getIn(keys, true);
|
|
117
|
+
if (!isMap(node)) {
|
|
118
|
+
document.setIn(keys, document.createNode(values));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (node.anchor)
|
|
122
|
+
visit(document, {
|
|
123
|
+
Alias: (_key, alias) => {
|
|
124
|
+
if (alias.resolve(document) === node)
|
|
125
|
+
return document.createNode(values, { aliasDuplicateObjects: false });
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Read an optional YAML mapping, refusing malformed pnpm settings before edits. */
|
|
131
|
+
function mapping(value: unknown, key: string): Map<string, unknown> {
|
|
132
|
+
if (value === undefined || value === null) return new Map();
|
|
133
|
+
if (value instanceof Map) return value;
|
|
134
|
+
throw new Error(`${key} must be a mapping in pnpm-workspace.yaml`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Resolve a missing scoped SDK package beside the workspace's linked SDK packages. */
|
|
138
|
+
function linkedSibling(
|
|
139
|
+
root: string,
|
|
140
|
+
directories: Set<string>,
|
|
141
|
+
name: string,
|
|
142
|
+
): string | undefined {
|
|
143
|
+
if (!name.startsWith("@automovie/")) return undefined;
|
|
144
|
+
for (const directory of directories) {
|
|
145
|
+
const candidate: string = path.join(
|
|
146
|
+
directory,
|
|
147
|
+
name.slice("@automovie/".length),
|
|
148
|
+
);
|
|
149
|
+
const file: string = path.join(candidate, "package.json");
|
|
150
|
+
if (
|
|
151
|
+
fs.existsSync(file) &&
|
|
152
|
+
JSON.parse(fs.readFileSync(file, "utf8")).name === name
|
|
153
|
+
)
|
|
154
|
+
return `link:${path.relative(root, candidate).split(path.sep).join("/")}`;
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|