@aotter/mantle 0.1.0-alpha.9 → 0.1.2-alpha.2
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 +38 -38
- package/dist/cli/generate.d.ts +10 -1
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +49 -4
- package/dist/cli/generate.js.map +1 -1
- package/dist/cli/main.js +0 -8
- package/dist/cli/main.js.map +1 -1
- package/dist/codegen/emitMantleModule.js +8 -0
- package/dist/codegen/emitMantleModule.js.map +1 -1
- package/docs/adapter-guide.md +23 -26
- package/docs/adr/0008-structured-diagnostic-shape.md +7 -2
- package/docs/adr/0010-locale-and-translates.md +14 -16
- package/docs/adr/0011-adapter-port-spec.md +2 -1
- package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +100 -0
- package/docs/adr/0018-core-starters-repository-boundary.md +3 -0
- package/docs/adr/0019-sealed-manifest-runtime-pipeline.md +38 -2
- package/docs/adr/0020-builtin-handler-contracts-and-matched-upsert.md +199 -0
- package/docs/adr/0021-retire-starter-scaffolding.md +30 -0
- package/docs/adr/0022-caller-observed-version-occ.md +212 -0
- package/docs/adr/0023-port-failure-contract.md +69 -0
- package/docs/adr/0024-manifest-native-schema-tables.md +260 -0
- package/docs/adr/README.md +19 -3
- package/docs/adr/adr-lite-803-request-diagnostics.md +38 -0
- package/docs/adr/adr-lite-808-route-readiness.md +47 -0
- package/docs/adr/adr-lite-809-bounded-public-content.md +71 -0
- package/docs/adr/adr-lite-812-native-parity.md +150 -0
- package/docs/adr/adr-lite-823-home-statistics.md +64 -0
- package/docs/adr/adr-lite-842-mcp-authoring.md +30 -0
- package/docs/adr/adr-lite-861-admin-webmcp.md +42 -0
- package/docs/adr/adr-lite-909-admin-ui-kit.md +37 -0
- package/docs/api-mcp-authorization.md +3 -664
- package/docs/auth-hosting-model.md +4 -4
- package/docs/cloudflare-low-level-composition.md +3 -104
- package/docs/deferred-lifecycle-queues.md +2 -243
- package/docs/design-atoms.md +16 -796
- package/docs/direct-authoring.md +5 -0
- package/docs/examples/minimal-worker/README.md +37 -0
- package/docs/examples/minimal-worker/manifests/site.yaml +25 -0
- package/docs/examples/minimal-worker/package.json +26 -0
- package/docs/examples/minimal-worker/smoke.mjs +23 -0
- package/docs/examples/minimal-worker/src/index.ts +4 -0
- package/docs/examples/minimal-worker/tsconfig.json +17 -0
- package/docs/examples/minimal-worker/wrangler.jsonc +22 -0
- package/docs/handbook/cloudflare/authentication.md +167 -0
- package/docs/handbook/cloudflare/bindings.md +236 -0
- package/docs/handbook/cloudflare/conventional-worker.md +162 -0
- package/docs/handbook/cloudflare/deferred-hooks-queues.md +171 -0
- package/docs/handbook/cloudflare/deploy-and-operate.md +105 -0
- package/docs/handbook/cloudflare/low-level-composition.md +169 -0
- package/docs/handbook/cloudflare/media-r2.md +216 -0
- package/docs/handbook/cloudflare/public-web.md +144 -0
- package/docs/handbook/concepts/authorization.md +116 -0
- package/docs/handbook/concepts/four-atoms.md +173 -0
- package/docs/handbook/concepts/lifecycle-and-locales.md +142 -0
- package/docs/handbook/concepts/mcp-and-agents.md +109 -0
- package/docs/handbook/concepts/procedures-and-triggers.md +221 -0
- package/docs/handbook/concepts/runtime-and-adapters.md +177 -0
- package/docs/handbook/concepts/views.md +191 -0
- package/docs/handbook/examples/commerce-transaction.md +813 -0
- package/docs/handbook/examples/guarded-api.md +427 -0
- package/docs/handbook/examples/intake-form.md +319 -0
- package/docs/handbook/examples/legal-documents.md +218 -0
- package/docs/handbook/examples/procurement-approvals.md +240 -0
- package/docs/handbook/examples/publication.md +240 -0
- package/docs/handbook/examples/reservation.md +220 -0
- package/docs/handbook/navigation.json +63 -0
- package/docs/handbook/reference/authorization.md +295 -0
- package/docs/handbook/reference/diagnostics.md +183 -0
- package/docs/handbook/reference/manifest.md +132 -0
- package/docs/handbook/reference/procedure.md +263 -0
- package/docs/handbook/reference/schema.md +250 -0
- package/docs/handbook/reference/site-config.md +233 -0
- package/docs/handbook/reference/surface.md +207 -0
- package/docs/handbook/reference/trigger.md +193 -0
- package/docs/handbook/reference/view.md +256 -0
- package/docs/handbook/start/project-and-cli.md +122 -0
- package/docs/handbook/start/quickstart-worker.md +193 -0
- package/docs/labels.md +3 -1
- package/docs/media-uploads.md +3 -184
- package/docs/migration-0.1.2.md +60 -3
- package/docs/performance-harness.md +127 -10
- package/docs/release-process.md +85 -231
- package/docs/schema-indexes.md +3 -180
- package/docs/sealed-pipeline-ownership.md +6 -5
- package/docs/spec-only-host-adoption.md +158 -0
- package/docs/transaction-patterns.md +5 -0
- package/package.json +21 -25
- package/skills/README.md +4 -4
- package/skills/develop/SKILL.md +23 -28
- package/skills/install/SKILL.md +55 -147
- package/skills/provision/SKILL.md +4 -3
- package/skills/theme/SKILL.md +6 -6
- package/skills/update/SKILL.md +32 -68
- package/dist/cli/create.d.ts +0 -2
- package/dist/cli/create.d.ts.map +0 -1
- package/dist/cli/create.js +0 -243
- package/dist/cli/create.js.map +0 -1
- package/dist/cli/update.d.ts +0 -2
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js +0 -413
- package/dist/cli/update.js.map +0 -1
- package/dist/provision/renderProvisionBundle.d.ts +0 -70
- package/dist/provision/renderProvisionBundle.d.ts.map +0 -1
- package/dist/provision/renderProvisionBundle.js +0 -367
- package/dist/provision/renderProvisionBundle.js.map +0 -1
- package/dist/provision.d.ts +0 -2
- package/dist/provision.d.ts.map +0 -1
- package/dist/provision.js +0 -2
- package/dist/provision.js.map +0 -1
package/skills/theme/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: theme
|
|
3
|
-
description: Apply brand and visual direction in a
|
|
3
|
+
description: Apply brand and visual direction in a Mantle application using its repo-owned theme and UI contracts.
|
|
4
4
|
metadata:
|
|
5
5
|
source: "@aotter/mantle"
|
|
6
6
|
sourcePath: skills/theme/SKILL.md
|
|
@@ -10,8 +10,8 @@ metadata:
|
|
|
10
10
|
|
|
11
11
|
# Mantle Theme
|
|
12
12
|
|
|
13
|
-
Theme work is project-owned source editing.
|
|
14
|
-
tokens
|
|
13
|
+
Theme work is project-owned source editing. Use the actual frontend and its
|
|
14
|
+
tokens/recipes; Core does not install a default home page or UI tree.
|
|
15
15
|
|
|
16
16
|
## First Read
|
|
17
17
|
|
|
@@ -23,12 +23,12 @@ tokens, or recipes, but the skill contract is Core-owned.
|
|
|
23
23
|
|
|
24
24
|
## Ownership
|
|
25
25
|
|
|
26
|
-
-
|
|
27
|
-
its
|
|
26
|
+
- Use the actual token contract (for example `styles/globals.css`) when present.
|
|
27
|
+
Check its light/dark values before changing components.
|
|
28
28
|
- `components/` is the runtime-facing component surface when present.
|
|
29
29
|
`src/web/` is project-owned composition; put new sections there.
|
|
30
30
|
- `public/site-icon.svg` and `public/site-icon.png` are one site identity.
|
|
31
|
-
Keep both listed in
|
|
31
|
+
Keep both listed in the actual entry/config `siteDefaults.icons`: PNG first as
|
|
32
32
|
the 64x64 compatibility rendition, then SVG as the editable `any` size source.
|
|
33
33
|
The same list drives browser favicons, Admin chrome, and MCP
|
|
34
34
|
`serverInfo.icons`; do not edit generated files under `public/_mantle/`.
|
package/skills/update/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: update
|
|
3
|
-
description:
|
|
3
|
+
description: Review and upgrade Mantle SDK dependencies and project-local skills while preserving application source, provider identities and plugin lockfiles.
|
|
4
4
|
metadata:
|
|
5
5
|
source: "@aotter/mantle"
|
|
6
6
|
sourcePath: skills/update/SKILL.md
|
|
@@ -10,72 +10,36 @@ metadata:
|
|
|
10
10
|
|
|
11
11
|
# Mantle Update
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
1.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
pnpm dlx @aotter/mantle@<exact-version> update \
|
|
41
|
-
--ref <immutable-ref> \
|
|
42
|
-
--bundle-base-url 'https://raw.githubusercontent.com/aotter/mantle-starters/{ref}/provision-bundles'
|
|
13
|
+
Upgrade SDK dependencies deliberately; never overwrite application-owned code.
|
|
14
|
+
The old Starter bundle comparison command `mantle update` is removed. This
|
|
15
|
+
skill remains the version-matched upgrade workflow, not a replacement CLI.
|
|
16
|
+
|
|
17
|
+
1. Inspect git status, package.json, lockfile, actual project scripts and
|
|
18
|
+
installed versions. Preserve unrelated local changes. Read plugin locks
|
|
19
|
+
and legacy `.mantle` metadata if present; they are context, not required.
|
|
20
|
+
2. Select an explicit target release and read its migration notes, including
|
|
21
|
+
`docs/migration-0.1.2.md` when leaving alpha.17. Do not resolve new Starter
|
|
22
|
+
refs or compare the project to a baseline template.
|
|
23
|
+
3. Update only selected `@aotter/mantle*` dependencies to the same exact target
|
|
24
|
+
version, preserving dependency sections. Use the package manager to update
|
|
25
|
+
the lockfile; inspect the dependency diff and required peer changes.
|
|
26
|
+
4. Remove scripts that invoke retired create/bundle-update commands. Keep all
|
|
27
|
+
application manifests, handlers, routes, theme, Worker/D1/KV names, origins,
|
|
28
|
+
provider bindings, secrets, and legacy metadata. Apply API migration edits
|
|
29
|
+
individually; do not copy the reference consumer over a real application.
|
|
30
|
+
5. Use the upgraded package to regenerate machine-owned bindings and project
|
|
31
|
+
its skills, then run the application's validation, types and tests:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pnpm exec mantle generate
|
|
35
|
+
pnpm exec mantle generate --check
|
|
36
|
+
pnpm exec mantle skills
|
|
37
|
+
pnpm exec mantle skills --check
|
|
38
|
+
pnpm exec mantle validate
|
|
43
39
|
```
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
5. Port confirmed upstream changes one hunk at a time.
|
|
51
|
-
6. Apply only the report's `.mantle/launch-state.json` and
|
|
52
|
-
`.mantle/features.json` metadata migration, preserving every other field.
|
|
53
|
-
7. Re-run:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm validate
|
|
57
|
-
pnpm typecheck
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Report Triage
|
|
61
|
-
|
|
62
|
-
Current reports compare three states: the original starter ref, the target
|
|
63
|
-
ref, and the local project.
|
|
64
|
-
|
|
65
|
-
- Review `upstream` to find starter changes worth porting. Use `local` only to
|
|
66
|
-
understand project-owned drift from the original starter.
|
|
67
|
-
- Never copy generated comparison versions of `.mantle/launch-state.json` or
|
|
68
|
-
`.mantle/features.json`; the report omits them and gives a field-level
|
|
69
|
-
migration instead. Preserve Worker/D1 names, bindings, origins, provider
|
|
70
|
-
values, and all unlisted launch state.
|
|
71
|
-
- The updater reproduces project identity in legacy Wrangler files. If
|
|
72
|
-
`upstream` proposes `mantle-<type>` names for a real project, stop: the
|
|
73
|
-
bundle is incompatible and must not be ported.
|
|
74
|
-
- A large `local` section is normal after customization. Counts are not a
|
|
75
|
-
confidence score.
|
|
76
|
-
|
|
77
|
-
## Boundary
|
|
78
|
-
|
|
79
|
-
Starter bundles and plugin packages can provide source snapshots, but Core owns
|
|
80
|
-
the workflow vocabulary. Repo-local update guidance may recover an older
|
|
81
|
-
updater, but it does not override the installed Core runtime/API contract.
|
|
41
|
+
Start the local application and test its actual routes, including configured
|
|
42
|
+
auth behavior. Review the final source/lockfile/generated diff; unexpected
|
|
43
|
+
provider or user-source changes block completion. Provider credentials must
|
|
44
|
+
never enter git or logs. Report exact old/new versions, checks, and remaining
|
|
45
|
+
migration work. A dependency update does not authorize a production deploy.
|
package/dist/cli/create.d.ts
DELETED
package/dist/cli/create.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAwCA,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoG3E"}
|
package/dist/cli/create.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `mantle create <type> <directory>` — materialize one version-matched starter
|
|
3
|
-
* bundle into a new local directory.
|
|
4
|
-
*
|
|
5
|
-
* It does not install dependencies, initialize git, configure auth, provision
|
|
6
|
-
* providers, or deploy. A coding agent reads the generated project
|
|
7
|
-
* instructions and continues from there.
|
|
8
|
-
*
|
|
9
|
-
* A bundle is remote input that can carry package.json, install scripts,
|
|
10
|
-
* executable source, and agent instructions, so it is treated as code: only
|
|
11
|
-
* the official immutable tag for this exact package version is accepted, the
|
|
12
|
-
* response is bounded, the whole tree is validated and rendered before any
|
|
13
|
-
* write, and the write lands in an exclusively-owned temporary directory that
|
|
14
|
-
* is renamed into place. There is no --force.
|
|
15
|
-
*/
|
|
16
|
-
import { mkdir, mkdtemp, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
17
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
18
|
-
import { cwd, stderr, stdout } from "node:process";
|
|
19
|
-
import { parseArgs } from "node:util";
|
|
20
|
-
import packageJson from "../../package.json" with { type: "json" };
|
|
21
|
-
import { DEFAULT_PROVISION_LIMITS, ProvisionRenderError, renderProvisionBundle, } from "../provision.js";
|
|
22
|
-
const STARTERS_OWNER = "aotter";
|
|
23
|
-
const STARTERS_REPO = "mantle-starters";
|
|
24
|
-
/**
|
|
25
|
-
* Released starter types. Community and Membership are deliberately absent:
|
|
26
|
-
* they are not released yet, and the create catalog must not offer a type the
|
|
27
|
-
* launch flow cannot deliver.
|
|
28
|
-
*/
|
|
29
|
-
const CREATE_ARCHETYPES = ["blank", "presence", "intake", "publication", "transaction", "reservation"];
|
|
30
|
-
const MAX_BUNDLE_BYTES = 32 * 1024 * 1024;
|
|
31
|
-
const FILE_MODE = 0o644;
|
|
32
|
-
const DIRECTORY_MODE = 0o755;
|
|
33
|
-
export async function runCreate(rawArgs) {
|
|
34
|
-
let archetype;
|
|
35
|
-
let directory;
|
|
36
|
-
let brand;
|
|
37
|
-
let description;
|
|
38
|
-
let locales;
|
|
39
|
-
try {
|
|
40
|
-
const { values, positionals } = parseArgs({
|
|
41
|
-
args: [...rawArgs],
|
|
42
|
-
allowPositionals: true,
|
|
43
|
-
options: {
|
|
44
|
-
brand: { type: "string" },
|
|
45
|
-
description: { type: "string" },
|
|
46
|
-
locales: { type: "string" },
|
|
47
|
-
help: { type: "boolean", short: "h" },
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
if (values.help) {
|
|
51
|
-
printHelp();
|
|
52
|
-
return 0;
|
|
53
|
-
}
|
|
54
|
-
if (positionals.length !== 2) {
|
|
55
|
-
stderr.write("Usage: mantle create <type> <directory>\n");
|
|
56
|
-
return 2;
|
|
57
|
-
}
|
|
58
|
-
[archetype, directory] = positionals;
|
|
59
|
-
if (!CREATE_ARCHETYPES.includes(archetype)) {
|
|
60
|
-
stderr.write(`Unknown type: ${archetype}\nAvailable: ${CREATE_ARCHETYPES.join(", ")}\n`);
|
|
61
|
-
return 2;
|
|
62
|
-
}
|
|
63
|
-
brand = values.brand;
|
|
64
|
-
description = values.description;
|
|
65
|
-
locales = (values.locales ?? "en").split(",").map((locale) => locale.trim()).filter(Boolean);
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
stderr.write(`${message(error)}\n`);
|
|
69
|
-
return 2;
|
|
70
|
-
}
|
|
71
|
-
const target = resolve(cwd(), directory);
|
|
72
|
-
const projectName = slugify(basename(target));
|
|
73
|
-
if (projectName.length === 0) {
|
|
74
|
-
stderr.write("The target directory name must contain a letter or digit.\n");
|
|
75
|
-
return 2;
|
|
76
|
-
}
|
|
77
|
-
if (await exists(target)) {
|
|
78
|
-
stderr.write(`Refusing to write into an existing path: ${target}\n`);
|
|
79
|
-
return 1;
|
|
80
|
-
}
|
|
81
|
-
// Creating the parent chain would be state a failure could not undo. Ask for
|
|
82
|
-
// an existing parent instead, so an aborted run leaves the disk untouched.
|
|
83
|
-
if (!(await exists(dirname(target)))) {
|
|
84
|
-
stderr.write(`Parent directory does not exist: ${dirname(target)}\n`);
|
|
85
|
-
return 1;
|
|
86
|
-
}
|
|
87
|
-
const version = packageJson.version;
|
|
88
|
-
const starterRef = `v${version}`;
|
|
89
|
-
const resolvedBrand = brand ?? titleCase(projectName);
|
|
90
|
-
const launch = {
|
|
91
|
-
archetype,
|
|
92
|
-
projectName,
|
|
93
|
-
brand: resolvedBrand,
|
|
94
|
-
description: description ?? `A Mantle ${archetype} site.`,
|
|
95
|
-
locales,
|
|
96
|
-
canonicalLocale: locales[0] ?? "en",
|
|
97
|
-
// create stops before auth; self-managed is the free default the
|
|
98
|
-
// generated handoff walks the owner through.
|
|
99
|
-
authMode: "self-managed",
|
|
100
|
-
starterRef,
|
|
101
|
-
installTimestamp: new Date().toISOString(),
|
|
102
|
-
siteUrl: "http://localhost:8787",
|
|
103
|
-
githubOwner: "",
|
|
104
|
-
adminGithubLogin: "",
|
|
105
|
-
afterLaunchSkillUrl: "",
|
|
106
|
-
};
|
|
107
|
-
let rendered;
|
|
108
|
-
try {
|
|
109
|
-
const bundle = await fetchOfficialBundle(starterRef, archetype, version);
|
|
110
|
-
rendered = renderProvisionBundle({ bundle, launch, limits: DEFAULT_PROVISION_LIMITS });
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
stderr.write(`mantle create: ${error instanceof ProvisionRenderError ? `${error.code}: ${error.message}` : message(error)}\n`);
|
|
114
|
-
return 1;
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
await writeAtomically(target, rendered);
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
stderr.write(`mantle create: ${message(error)}\n`);
|
|
121
|
-
return 1;
|
|
122
|
-
}
|
|
123
|
-
stdout.write(`Created ${archetype} project in ${target}\n`
|
|
124
|
-
+ ` Mantle ${version} - starter ${starterRef}\n\n`
|
|
125
|
-
+ "Next: read AGENTS.md in the new directory. It carries the install and\n"
|
|
126
|
-
+ "first-run steps for this project; nothing has been installed yet.\n");
|
|
127
|
-
return 0;
|
|
128
|
-
}
|
|
129
|
-
function printHelp() {
|
|
130
|
-
stdout.write(`mantle create - materialize a version-matched starter into a new directory
|
|
131
|
-
|
|
132
|
-
Usage: mantle create <type> <directory> [options]
|
|
133
|
-
|
|
134
|
-
Types:
|
|
135
|
-
${CREATE_ARCHETYPES.join(", ")}
|
|
136
|
-
|
|
137
|
-
Options:
|
|
138
|
-
--brand <name> Display brand (default: derived from the directory name)
|
|
139
|
-
--description <text> One sentence describing the site
|
|
140
|
-
--locales <list> Comma-separated locales; the first is canonical (default: en)
|
|
141
|
-
-h, --help This help
|
|
142
|
-
|
|
143
|
-
Dependencies are not installed, git is not initialized, and nothing is
|
|
144
|
-
deployed. The generated AGENTS.md carries the next steps.
|
|
145
|
-
`);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Only the official immutable tag for this exact package version. A bundle
|
|
149
|
-
* URL or ref is never taken from user input in this path.
|
|
150
|
-
*/
|
|
151
|
-
async function fetchOfficialBundle(starterRef, archetype, version) {
|
|
152
|
-
const url = `https://raw.githubusercontent.com/${STARTERS_OWNER}/${STARTERS_REPO}/${encodeURIComponent(starterRef)}/provision-bundles/${encodeURIComponent(archetype)}.json`;
|
|
153
|
-
const response = await fetch(url, { headers: { accept: "application/json" }, redirect: "error" });
|
|
154
|
-
if (!response.ok) {
|
|
155
|
-
// A 404 on a version-pinned tag has one common cause worth naming: the
|
|
156
|
-
// package was published before its matching starter tag exists.
|
|
157
|
-
const hint = response.status === 404
|
|
158
|
-
? ` The ${starterRef} starter tag does not exist yet — if this version was just published, wait for its starter release, or pin an earlier version.`
|
|
159
|
-
: "";
|
|
160
|
-
throw new Error(`could not fetch the ${archetype} starter for ${starterRef} (HTTP ${response.status}).${hint}`);
|
|
161
|
-
}
|
|
162
|
-
const declared = Number(response.headers.get("content-length"));
|
|
163
|
-
if (Number.isFinite(declared) && declared > MAX_BUNDLE_BYTES) {
|
|
164
|
-
throw new Error(`starter bundle exceeds ${MAX_BUNDLE_BYTES} bytes.`);
|
|
165
|
-
}
|
|
166
|
-
const text = await readBounded(response, MAX_BUNDLE_BYTES);
|
|
167
|
-
let bundle;
|
|
168
|
-
try {
|
|
169
|
-
bundle = JSON.parse(text);
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
throw new Error("starter bundle is not valid JSON.");
|
|
173
|
-
}
|
|
174
|
-
// The URL is version-pinned, but a mis-built bundle published under that tag
|
|
175
|
-
// would still render. Refuse a version the tag does not promise.
|
|
176
|
-
if (bundle.version !== version) {
|
|
177
|
-
throw new Error(`starter bundle at ${starterRef} declares version ${String(bundle.version)}, expected ${version}.`);
|
|
178
|
-
}
|
|
179
|
-
return bundle;
|
|
180
|
-
}
|
|
181
|
-
/** Stops reading at the limit; a chunked response never gets to allocate past it. */
|
|
182
|
-
async function readBounded(response, max) {
|
|
183
|
-
const body = response.body;
|
|
184
|
-
if (!body)
|
|
185
|
-
return response.text();
|
|
186
|
-
const reader = body.getReader();
|
|
187
|
-
const chunks = [];
|
|
188
|
-
let total = 0;
|
|
189
|
-
for (;;) {
|
|
190
|
-
const { done, value } = await reader.read();
|
|
191
|
-
if (done)
|
|
192
|
-
break;
|
|
193
|
-
if (value === undefined)
|
|
194
|
-
continue;
|
|
195
|
-
total += value.byteLength;
|
|
196
|
-
if (total > max) {
|
|
197
|
-
await reader.cancel();
|
|
198
|
-
throw new Error(`starter bundle exceeds ${max} bytes.`);
|
|
199
|
-
}
|
|
200
|
-
chunks.push(value);
|
|
201
|
-
}
|
|
202
|
-
return new TextDecoder("utf-8", { fatal: false }).decode(Buffer.concat(chunks));
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Writes into an exclusively-created sibling directory, then renames it onto a
|
|
206
|
-
* target that did not previously exist. A failure leaves nothing behind.
|
|
207
|
-
*/
|
|
208
|
-
async function writeAtomically(target, rendered) {
|
|
209
|
-
const staging = await mkdtemp(join(dirname(target), ".mantle-create-"));
|
|
210
|
-
try {
|
|
211
|
-
for (const [path, content] of rendered.files) {
|
|
212
|
-
await writeFileAt(staging, path, Buffer.from(content, "utf8"));
|
|
213
|
-
}
|
|
214
|
-
for (const [path, content] of rendered.binaryFiles) {
|
|
215
|
-
await writeFileAt(staging, path, Buffer.from(content, "base64"));
|
|
216
|
-
}
|
|
217
|
-
await rename(staging, target);
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
await rm(staging, { recursive: true, force: true });
|
|
221
|
-
throw error;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
async function writeFileAt(root, relativePath, data) {
|
|
225
|
-
const destination = join(root, relativePath);
|
|
226
|
-
await mkdir(dirname(destination), { recursive: true, mode: DIRECTORY_MODE });
|
|
227
|
-
// Regular file, fixed mode: a bundle cannot create a symlink or an
|
|
228
|
-
// executable.
|
|
229
|
-
await writeFile(destination, data, { mode: FILE_MODE, flag: "wx" });
|
|
230
|
-
}
|
|
231
|
-
function slugify(value) {
|
|
232
|
-
return value.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63).replace(/-+$/g, "");
|
|
233
|
-
}
|
|
234
|
-
function titleCase(slug) {
|
|
235
|
-
return slug.split("-").filter(Boolean).map((word) => word[0]?.toUpperCase() + word.slice(1)).join(" ");
|
|
236
|
-
}
|
|
237
|
-
async function exists(path) {
|
|
238
|
-
return stat(path).then(() => true, () => false);
|
|
239
|
-
}
|
|
240
|
-
function message(error) {
|
|
241
|
-
return error instanceof Error ? error.message : String(error);
|
|
242
|
-
}
|
|
243
|
-
//# sourceMappingURL=create.js.map
|
package/dist/cli/create.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,GAGtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AACxC;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAU,CAAC;AAChH,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA0B;IACxD,IAAI,SAAiB,CAAC;IACtB,IAAI,SAAiB,CAAC;IACtB,IAAI,KAAyB,CAAC;IAC9B,IAAI,WAA+B,CAAC;IACpC,IAAI,OAA0B,CAAC;IAE/B,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,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AE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzG,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/cli/update.d.ts
DELETED
package/dist/cli/update.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/cli/update.ts"],"names":[],"mappings":"AA2BA,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA8E3E"}
|