tileflow 0.0.0-bootstrap.0 → 0.1.0-alpha.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.
Files changed (3) hide show
  1. package/README.md +159 -62
  2. package/dist/index.js +2126 -358
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -9,7 +9,7 @@ no Tileflow account or API key:
9
9
 
10
10
  ```sh
11
11
  npm install @tileflow/core@alpha @tileflow/maps@alpha
12
- npm install --save-dev --save-exact tileflow@bootstrap
12
+ npm install --save-dev --save-exact tileflow@alpha
13
13
  npx tileflow init
14
14
  npx tileflow validate
15
15
  npx tileflow validate --target hosted
@@ -68,9 +68,22 @@ explicitly with `--out`:
68
68
  npx tileflow build --out public/tileflow
69
69
  ```
70
70
 
71
+ Named hosted sources with `local` archives are for account-free validation, development, preview,
72
+ and capture. `tileflow build` rejects them instead of copying, publishing, or taking ownership of
73
+ user data. For production, either publish managed data explicitly with `tileset publish` or serve
74
+ it from infrastructure owned by the application. A local declaration never selects either path
75
+ implicitly.
76
+
77
+ Preview, capture, and the React/Vue/Svelte adapters register Tileflow's local PMTiles protocol
78
+ before MapLibre reads the compiled Style. Its URL is stable by logical tileset ID; physical local
79
+ snapshot generations do not change Style identity. Standalone Capture retains one snapshot for the
80
+ render. Application Capture uses the application's server; Tileflow's local handler provides
81
+ immutable, ETag-guarded PMTiles reads, but does not freeze every local dataset for the complete
82
+ screenshot window.
83
+
71
84
  Build is local and credential-free. Hosted compatibility is a separate
72
- `tileflow validate --target hosted` preflight; both that command and `deploy` reject non-Tileflow
73
- World data through the same compatibility check.
85
+ `tileflow validate --target hosted` preflight. Primary map data must remain Tileflow World; named
86
+ Team sources are validated and resolved independently.
74
87
 
75
88
  ## Deterministic agent diagnostics
76
89
 
@@ -80,14 +93,23 @@ Use JSON mode when an agent or CI job needs to validate or reason about the reso
80
93
  npx tileflow validate --json
81
94
  npx tileflow inspect --json
82
95
  npx tileflow inspect --map madrid --json
96
+ npx tileflow language manifest --json
97
+ npx tileflow language schema --json
98
+ npx tileflow explain --map madrid --theme dark --json
99
+ npx tileflow semantic-diff --from-config before/tileflow.config.ts --to-config after/tileflow.config.ts --json
100
+ npx tileflow semantic-diff --config maps.workspace.ts --from before --to after --json
83
101
  ```
84
102
 
85
- Success writes exactly one schema-version-1 document to stdout. Failure leaves stdout empty and
86
- writes one document to stderr. Both summaries and every failure diagnostic always contain
87
- `phase`, `code`, `path`, `severity`, `message`, and a bounded safe `suggestion`; diagnostics are
88
- sorted and deduplicated deterministically.
103
+ `validate`, `inspect`, `explain`, and `semantic-diff` success writes exactly one
104
+ schema-version-1 command envelope to stdout. The two discovery commands intentionally return their
105
+ contracts raw instead of wrapping them: `language manifest --json` emits authoring-manifest version
106
+ 2 and `language schema --json` emits config-reference version 4. Every JSON-mode failure, including
107
+ failure to load either raw discovery contract, leaves stdout empty and writes one schema-version-1
108
+ command failure to stderr. Command summaries and every failure diagnostic contain `phase`, `code`,
109
+ `path`, `severity`, `message`, and a bounded safe `suggestion`; diagnostics are sorted and
110
+ deduplicated deterministically.
89
111
 
90
- Config inspection returns the resolved map, root-to-leaf lineage, declared paths, leaf-level merge
112
+ Config inspection returns the resolved map, parent-to-leaf lineage, declared paths, leaf-level merge
91
113
  provenance, and an explicit `themeContract`: default/system selection, shared token schema,
92
114
  concrete values, typography, lighting, differences from the default, and stable audit diagnostics.
93
115
  It omits the executable input-file graph and sanitizes credentials, URL queries,
@@ -98,15 +120,59 @@ config with `extends` and `scenes`, while its named `resolved` entrypoint matche
98
120
  compiler input. Both are produced from executable core schemas rather than a handwritten parallel
99
121
  API list.
100
122
 
123
+ `tileflow language manifest --json` discovers the complete closed semantic language without loading
124
+ a project: compiler identity, domains and their dependencies, public operations, expression-builder
125
+ signatures and limits, render selectors, semantic fields/features, diagnostics, reports, commands,
126
+ and schema references. `tileflow language schema --json` returns the packaged generated JSON Schema
127
+ that those references address. Together they are the canonical bootstrap surface for an authoring
128
+ agent; neither command writes files or accesses the network.
129
+
130
+ Each manifest command entry declares its `outputKind`, `outputVersion`, and stable
131
+ `outputSchemaRef`. `raw-authoring-manifest` and `raw-config-reference` identify the two bootstrap
132
+ documents above; `command-envelope` identifies the ordinary version-1 CLI contract.
133
+
134
+ `tileflow explain` compiles exactly one map/theme selection through `createStyleResult()` and emits
135
+ its structured `report` and safe compiler `diagnostics`; it deliberately omits the usually large
136
+ MapLibre `style`. In a singular config, `--map` is optional; a multi-map workbench requires it.
137
+ `--theme` defaults to that map's declared default. `--inspection` adds opt-in, read-only
138
+ physical-output provenance to the report. Its physical layer IDs and indexes are diagnostic
139
+ observations only: they are not stable application or authoring targets, and no semantic operation
140
+ accepts them. The JSON document has this stable projection:
141
+
142
+ ```json
143
+ {
144
+ "schemaVersion": 1,
145
+ "command": "explain",
146
+ "ok": true,
147
+ "selection": {"map": "madrid", "theme": "dark"},
148
+ "authoringManifestSchemaVersion": 2,
149
+ "compilation": {"ok": true, "diagnostics": [], "report": {}},
150
+ "diagnostics": []
151
+ }
152
+ ```
153
+
154
+ `tileflow semantic-diff --from-config <path> --to-config <path>` compares the sole map exported by
155
+ each ordinary config, which is the normal agent workflow for reviewing a change across two files or
156
+ checkouts. If either endpoint is a multi-map `*.workspace.ts`, select that endpoint explicitly with
157
+ `--from-map` or `--to-map`; selectors are rejected for singular configs. The existing
158
+ `--config <workspace> --from <map> --to <map>` form remains as the same-workspace shortcut. Paired
159
+ config options and workspace options cannot be mixed.
160
+
161
+ The successful document adds `diff`, whose exact core shape is `{schemaVersion, from, to, summary,
162
+ changes}`; each change is `add`, `remove`, or `change` at an RFC 6901 JSON Pointer. Differences are
163
+ informational, so a non-empty diff still exits successfully. Selection, load, validation, asset, or
164
+ compilation failures leave stdout empty and emit one safe structured document on stderr.
165
+
101
166
  ## Command families
102
167
 
103
- | Family | Commands |
104
- | --------------- | ---------------------------------------------------------------------------------------------- |
105
- | Map authoring | `init`, `validate`, `inspect`, `build`, `preview` (`dev` alias) |
106
- | Local evidence | `setup capture`, `capture`, `visual compare`, `visual analyze`, `visual diff`, `visual update` |
107
- | Data and assets | `inspect features`, `icons list --json`, `icons diff` |
108
- | Account | `login`, `logout`, `whoami` |
109
- | Hosted delivery | `deploy`, `status` |
168
+ | Family | Commands |
169
+ | ----------------- | ---------------------------------------------------------------------------------------------- |
170
+ | Semantic language | `language manifest`, `language schema` |
171
+ | Map authoring | `init`, `validate`, `inspect`, `explain`, `semantic-diff`, `build`, `preview` (`dev` alias) |
172
+ | Local evidence | `setup capture`, `capture`, `visual compare`, `visual analyze`, `visual diff`, `visual update` |
173
+ | Data and assets | `tileset inspect`, `tileset publish/list/status/purge`, `inspect features`, `icons list/diff` |
174
+ | Account | `login`, `logout`, `whoami` |
175
+ | Hosted delivery | `deploy`, `status` |
110
176
 
111
177
  Run `tileflow <command> --help` (or the family help, such as `tileflow icons --help`) for the exact
112
178
  arguments and bounded JSON modes.
@@ -404,50 +470,87 @@ effects and removes `TILEFLOW_API_KEY` before loading config.
404
470
  Hosted writes have two independent authorization paths:
405
471
 
406
472
  - Personal developer session: run `npx tileflow login` once for a
407
- Tileflow API origin. Login authenticates the account and selects no managed destination.
408
- The CLI exchanges that account session for a brief, narrow capability only
409
- after resolving the application internally.
473
+ Tileflow API origin. Login authenticates the account and selects no Map.
474
+ Map commands exchange it for a brief Map capability; tileset commands use a separate Team data
475
+ capability.
410
476
  - CI key: create a dashboard `CI deploy` key, store it as
411
- `TILEFLOW_API_KEY`, and let the repository workflow deploy without a local
412
- login. The server binds that key to exactly one internal application boundary.
477
+ `TILEFLOW_API_KEY`, and let the repository workflow deploy without a local login. The server
478
+ binds that key to exactly one Map.
413
479
 
414
480
  Hosted control-plane requests stay pinned to the configured HTTP(S) origin, apply a hard bounded
415
481
  timeout, and stream at most 1 MiB of response data. CLI diagnostics never echo an untrusted remote
416
482
  response body or bearer credential.
417
483
 
418
- Inspect the account and use the automatically resolved destination:
484
+ Inspect the account, then target the Map shown in the dashboard:
419
485
 
420
486
  ```sh
421
487
  npx tileflow whoami --json
422
- npx tileflow deploy
423
- npx tileflow status
488
+ npx tileflow deploy --map-id map_AbCdEfGhIjKlMnOp
489
+ npx tileflow status --map-id map_AbCdEfGhIjKlMnOp
424
490
  npx tileflow logout
425
491
  ```
426
492
 
427
- When Tileflow gives an agent a continuation command for a verified World conversion, keep its
428
- opaque technical destination and promotion reference in that exact deploy action:
493
+ The dashboard creates the Map and browser-access policy before repository setup. Keep that exact
494
+ Map ID in the deploy action. If the config contains several maps, select the authored map explicitly:
429
495
 
430
496
  ```sh
431
497
  npx tileflow deploy \
432
- --project @acme/web \
433
- --world-promotion wpr_example1234
498
+ --map-id map_AbCdEfGhIjKlMnOp \
499
+ --map store-locator
434
500
  ```
435
501
 
436
- The promotion reference is neither a map ID nor a credential. The CLI uses the map exported by the
437
- selected config. A successful server-confirmed continuation keeps unrelated manifest entries and
438
- records only that map's stable `mapId`, hosted theme URLs, World `v1` generation, and fixed session
439
- usage mode. Do not add an API key or payment authority to a copied prompt.
502
+ The Map ID is a public destination, not a credential. A successful server-confirmed deploy keeps
503
+ unrelated manifest entries and records that Map's stable ID, hosted theme URLs, World `v1`
504
+ generation, and fixed session usage mode. Browser access remains server-owned and is never read
505
+ from or written to repository configuration. Do not add an API key or payment authority to a copied
506
+ prompt.
440
507
 
441
- If the account has exactly one accessible managed destination, a hosted command resolves it
442
- automatically. With more than one, writes fail before config execution or network mutation, print
443
- deterministically sorted application choices with their technical `@organization/project`
444
- references, and give an exact retry containing `--project`. There is no persistent selection,
445
- per-directory profile, or `login --project`. The hidden `projects` compatibility family remains
446
- callable when support or explicit multi-application administration requires it.
508
+ Team tileset commands exchange the same account session for a separate Team-scoped data capability;
509
+ it carries no Map authority. Inspect and preview remain account-free:
510
+
511
+ ```sh
512
+ npx tileflow tileset inspect ./data/stores.pmtiles --json
513
+ npx tileflow tileset inspect ./data/stores.pmtiles \
514
+ --include-values category,status --json
515
+ npx tileflow tileset publish ./data/stores.pmtiles \
516
+ --id stores --team @acme --attribution 'Store data © Example' --json
517
+ npx tileflow tileset list --team @acme --json
518
+ npx tileflow tileset status stores --team @acme --json
519
+ ```
447
520
 
448
- An explicit key or `TILEFLOW_API_KEY` never uses the saved account session. If
449
- it is combined with `--project`, the selector is an assertion: the CLI checks
450
- `/v1/me` and rejects any mismatch before loading executable config or writing.
521
+ Inspection schema 1 separates authoritative PMTiles/TileJSON declarations from bounded MVT
522
+ observations. Sampled fields report present/missing feature counts, observed distinct-value counts,
523
+ numeric min/max, and truncation. Raw primitive values remain absent unless `--include-values`
524
+ explicitly selects their comma-separated field names; the command emits at most 16 values per field,
525
+ 32 selected fields, and 256 characters per string. `--no-sample` returns only authoritative metadata
526
+ and cannot be combined with value inspection. Directory traversal recomputes addressed-tile and
527
+ tile-entry counts; the header's tile-content count is reported only as a nullable declaration and is
528
+ not treated as authority.
529
+
530
+ `publish --id` names a Team-local logical resource; Tileflow owns its opaque delivery ID. The
531
+ command validates the archive locally before authentication, hashes it in fixed 16 MiB parts, then
532
+ uploads at most four parts concurrently without buffering the complete file. Interrupted sessions
533
+ remain resumable for 24 hours: rerunning the same command reconciles server receipts and transfers
534
+ only missing parts. Normal Queue initialization is polled for at most two minutes before the command
535
+ returns a resumable availability error. Retryable transfer failures receive fresh short-lived authorization; a changed
536
+ local file stops before completion. Free accepts versions through exactly 2,000,000,000 bytes and
537
+ Starter through exactly 4,000,000,000 bytes, subject to the Team's hosted-storage capacity.
538
+
539
+ Publication completes only after server-side integrity and PMTiles validation. A compatible new
540
+ version becomes current at the same stable TileJSON and tile URLs, so newly resolved browser
541
+ requests see it without creating a Map deployment. Purge requires `--confirm <exact-id>` and fails
542
+ with bounded dependency context while any retained Map deployment uses the resource. Automation may set a Team data
543
+ `TILEFLOW_API_KEY`; that key selects its Team, so commands omit `--team` and never load account
544
+ state.
545
+
546
+ `tileset publish --json` emits schema version 2 with the Team selector when known, logical and
547
+ opaque tileset identities, immutable version ID and number, exact byte count, content-hash
548
+ algorithm/hash, final state, and `changed` or `unchanged` publication result. It never emits the
549
+ local path, upload session, storage key, signed URL, ETag, credential, or retry details.
550
+
551
+ An explicit key or `TILEFLOW_API_KEY` never uses the saved account session. The deploy API rejects a
552
+ `--map-id` that does not match the key. Read-only hosted icon comparison validates the same binding
553
+ before loading its baseline.
451
554
 
452
555
  The CI key grants only `styles:write` and `status:read`. It cannot upload
453
556
  datasets or render images. Give it an expiration, rotate the repository secret
@@ -464,7 +567,7 @@ and do not pass keys through the `--api-key` command line in CI.
464
567
 
465
568
  The [deploy documentation](https://tileflow.dev/docs/deploy) contains copyable
466
569
  GitHub Actions and GitLab CI workflows. Both use `npm ci`, the committed
467
- lockfile, and the project-local CLI. GitHub exposes the key only to its deploy
570
+ lockfile, and the repository-local CLI. GitHub exposes the key only to its deploy
468
571
  step. GitLab variables are job-scoped, so its example validates in a keyless job
469
572
  and deploys in a protected `production` job; the locked install and runner are
470
573
  part of that trusted job boundary. Both serialize publications and intentionally
@@ -487,15 +590,16 @@ Invalid explicit values fail before a network write. Provider metadata that is
487
590
  missing, malformed, or too long is omitted. Secrets and the complete
488
591
  environment are never logged.
489
592
 
490
- Application build is absent from the minimal workflows. Self-hosted build and deploy emit the same
593
+ A separate app-build step is absent from the minimal workflows. Self-hosted build and deploy emit the same
491
594
  runtime manifest version 1 shape; Hosted fields are optional identity metadata on its map/theme
492
595
  entries. Filesystem build writers refuse to replace a manifest carrying Hosted metadata by default,
493
596
  and deploy refuses to replace a purely local manifest. Prefer `emitBuildArtifacts: false` or
494
597
  separate output paths when the app deliberately packages a deploy manifest. The explicit
495
598
  `overwriteHostedManifest: true` build option and
496
599
  `tileflow deploy --overwrite-self-hosted-manifest` flag authorize that destination replacement. A
497
- retry of the same compiled theme family and delivery policy reuses its deployment version and prints
498
- `Unchanged`; changed desired state prints `Published` with a new version. The
600
+ retry of the same compiled theme family reuses its deployment version and prints `Unchanged`;
601
+ changed cartography prints `Published` with a new version. Allowed websites is managed separately
602
+ in Tileflow and is never read from repository config. The
499
603
  fingerprint binds resource references, not the changing bytes behind referenced
500
604
  glyph or sprite URLs. Every theme of one logical map publishes atomically; separate maps can still
501
605
  partially succeed when no remote batch release is used.
@@ -535,21 +639,13 @@ before deletion. Upload success must confirm the submitted `contentHash`, exact
535
639
  generated byte total, one opaque `icp_<id>`, and the corresponding query-free
536
640
  `/sprites/<id>/sprite` URL. The CLI rejects any missing or divergent field before using that URL.
537
641
 
538
- For a map with local or package-owned `fonts`, deploy selects only faces used by the final Style and
539
- requires the contributing `LICENSE.txt` bytes. It uploads one bounded canonical font bundle to
540
- `PUT /v1/font-bundles/:contentHash` before the dependent Style. Hosted confirms the exact file set,
541
- hashes, MIME/signature agreement, licenses, and immutable public base URL; the CLI then binds
542
- `tileflow:fontFaces` to the returned `.../font-bundles/fnb_<id>/fonts/<content-addressed-file>` and
543
- sends only `fontBundle: {contentHash}` with the Style. Upload success must carry that exact opaque ID
544
- and base URL; clients never derive a storage URL from the hash. The build manifest records the effective font-byte
545
- digests, so a claimed hash or a different public URL cannot substitute for the uploaded bytes.
546
- Hosted's matching rollout candidate persists project ownership, organization quota, deployment
547
- references, grace-based cleanup, and deletion receipts. This repository contract does not by itself
548
- establish that the matching Hosted migration and API are already deployed in production.
642
+ Hosted deploy currently rejects local or package-owned web fonts before authentication or remote
643
+ writes. Use self-hosted delivery or an explicit public glyph provider. Enabling managed font bundles
644
+ requires a separately deployed ownership, quota, retention, and immutable-delivery contract.
549
645
 
550
646
  For both managed resource kinds, `assetSetSha256` remains a separate per-map output identity. It
551
647
  hashes each generated file's exact portable name, media type, byte count, and SHA-256 using Core's
552
- asset-set v1 contract; it does not hash only the icon-package or font-bundle manifest. Hosted must
648
+ asset-set v1 contract; it does not hash only the icon-package manifest. Hosted must
553
649
  confirm the immutable resource bytes, reconstruct those same per-file identities (including the
554
650
  `icons/<mapId>/` prefix), and reject the Style when the submitted build-manifest hash diverges.
555
651
 
@@ -606,14 +702,15 @@ source path with normal repository tools only when the pixels themselves are nee
606
702
  Compare the exported map with its active hosted revision before deciding whether to deploy:
607
703
 
608
704
  ```sh
609
- npx tileflow icons diff --against production
610
- npx tileflow icons diff --against production --json
611
- npx tileflow icons diff --against production --report ./icon-diff.html
705
+ npx tileflow icons diff --map-id map_AbCdEfGhIjKlMnOp --against production
706
+ npx tileflow icons diff --map-id map_AbCdEfGhIjKlMnOp --against production --json
707
+ npx tileflow icons diff --map-id map_AbCdEfGhIjKlMnOp --against production --report ./icon-diff.html
612
708
  ```
613
709
 
614
- The command compiles only the exported map, performs one authenticated baseline `GET`, and never
615
- uploads a package, creates a deployment, or writes the frontend manifest. Plain and JSON modes
616
- create no files. A requested HTML report adds reads of the baseline's four public sprite files and
710
+ The command compiles only the exported map, performs authenticated read-only control-plane
711
+ requests, and never uploads a package, creates a deployment, or writes the frontend manifest.
712
+ Plain and JSON modes create no files. A requested HTML report adds reads of the baseline's four
713
+ public sprite files and
617
714
  embeds verified old/new images in one self-contained file. The report groups exact-cell icon
618
715
  previews under `Added`, `Modified`, and `Removed`. Added and removed cards show only the affected
619
716
  icon; modified cards compare `Before` with `Next`. A script-free 1x/2x selector defaults to 2x,