tileflow 0.0.0-bootstrap.0 → 0.1.0-alpha.0

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