diff --git a/AGENTS.md b/AGENTS.md index f819fc6b..089a2e32 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,6 +8,8 @@ WebFront is a C++23 header-only library for serving a browser UI from a C++ appl - C++ calls browser functions with `ui.jsFunction(name)(arguments...)`, which is fire-and-forget and ignores the result, or with `ui.jsFunction(name)(arguments...)`, which returns a `std::future`. Only the untyped C++ form is fire-and-forget. - `webFront.ready` resolves after the WebSocket handshake acknowledgement and rejects if the initial connection fails or closes. +WebFront also ships a standalone developer environment (`NativeApp::bootstrap("developer")`): a terminal whose `wf` commands (`init`, `install`, `restore`, `dev`, `build`, `check`, `test`, `run`, `exec`, `embed`) manage a project manifest and lock, compile TS/TSX, type-check, run Jasmine specs and generate the application's embedded provider, with no JavaScript runtime or package manager on the developer's machine. It is not a sandbox. See `docs/DEVELOPER_ENVIRONMENT.md`. + The README introduces WebFront through the Game of Life walkthrough, demonstrating the developer bootstrap, reactive TypeScript UI and embedded distribution. The minimal `HelloWorld` example remains available under `examples/hello-world/`. Native modules and the bridge are covered by the Jasmine browser integration test. General DOM abstractions remain future work. Application coroutines use `webfront::Task` and `app.spawn(task)`/`ui.spawn(task)`; retain a `TaskHandle` to request individual cancellation. WebFront owns and drains these tasks. Spawn is callable from any thread while the application lives; a call rejected during shutdown returns a stopped handle. Destructors wait for outstanding operations; explicit shutdown reports a stalled join. Typed C++ sender calls support local cancellation; futures and JavaScript Promises do not expose cancellation. ## Repository map @@ -25,8 +27,9 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati - `.devcontainer/`: devcontainer and its Dockerfile; `docs/`: documentation, `docs/CHANGELOG.md`, `docs/Doxyfile.in`. - `docs/PROJECT_STATUS.md`: evidence-based status snapshot and known limitations. - `docs/adr/README.md`: architecture decision index, Git history, tradeoffs and implementation rules; read the relevant ADRs before changing their contracts. +- `docs/DEVELOPER_ENVIRONMENT.md`: the reference of the developer environment (`wf` commands, manifest and lock, TypeScript and `wf check`, tests, limits, distribution); `docs/EMBEDDED_ASSETS.md`: the core's embedded resources and their regeneration; `docs/NODE_TOOLS_MIGRATION.md`: where each former Node.js tool went (historical record). - `docs/UI_COMPONENTS.md`: what replaced the removed terminal component and `wf` tool manager, with the migration to `webfront::Commands`. -- `docs/ISSUE_AUDIT.md`: recommendations for the current GitHub backlog. +- `docs/ISSUE_AUDIT.md`: recommendations for the GitHub backlog (dated audit; the epic #303 reshaped the scope afterwards). The historical `webfront/` prototype and the former top-level `webtest/` are gone: use `test/unit/` for current C++ tests and `test/web/` for browser tests. Do not revive legacy code without a specific issue and regression coverage. diff --git a/README.md b/README.md index de1d1d62..53f54b5e 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ The animation shows the Game of Life example, with terminal output and timing co ## Game of Life: from console to native application -The example starts with a C++ simulation, adds a React interface, then embeds that interface in the executable. You need Git, CMake **3.31+** and a C++23 compiler. Initial CMake configuration, bootstrap and dependency installation require internet access. +The example starts with a C++ simulation, adds a React interface, then embeds that interface in the executable. You need Git, CMake **3.31+** and a C++23 compiler. The initial CMake configuration, the first bootstrap and the first `wf install` need internet access; afterwards the downloaded environment and packages are cached and can be verified offline. ```bash git clone https://github.com/ambroise-leclerc/WebFront.git @@ -70,8 +70,6 @@ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel 2 ``` -The developer package for this 0.4 development branch is prepared but not yet published. For local review, use [local archive provisioning](docs/DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers). - ### 1. Start with the C++ simulation [Life.hpp](examples/life/Life.hpp) implements Conway's B3/S23 rules on a wrapping 32 × 32 grid. Each step creates a new `std::bitset<1024>`. [LifeConsole.cpp](examples/life/LifeConsole.cpp) runs it without a GUI: @@ -94,7 +92,7 @@ app.bootstrap("developer"); app.show(); ``` -The project directory gives the application access to its development files. `bootstrap("developer")` opens the integrated terminal and loads the version-pinned UI tools, checking their SHA-512 integrity. Downloads are cached. Use `wf` commands there to create, install, preview and embed your interface. +The project directory gives the application access to its development files. `bootstrap("developer")` opens the integrated terminal and loads the version-pinned developer environment, checking its SHA-512 integrity. Downloads are cached, so later launches work offline. The terminal runs `wf` commands; no system shell is exposed and nothing is installed on your machine. Enable **one** engine for your platform: @@ -104,43 +102,34 @@ Enable **one** engine for your platform: | macOS 13.3+ | `-DWEBFRONT_EMBED_WKWEBVIEW=ON` | System Cocoa / WebKit | | Linux | `-DWEBFRONT_EMBED_WEBKITGTK=ON` | WebKitGTK 6.0; [installation](docs/WEBKITGTK.md) | -For local review of this unpublished branch, first [build the local archive](docs/DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers). That preparation is a maintainer task done with `wf` itself. Then, on macOS, from the repository root: +Then, on macOS, from the repository root, build and start the example on a new project directory: ```bash cmake -S . -B build-native -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_WKWEBVIEW=ON cmake --build build-native --target WebFrontLifeDeveloper --parallel 2 -mkdir -p life-project/.webfront/developer/preview/provision -cp build-developer-environment/*.tgz life-project/.webfront/developer/preview/provision/ -integrity=$(sed -n 's/^ "integrity": "\(.*\)",$/\1/p' build-developer-environment/provision.json) -./build-native/examples/WebFrontLifeDeveloper "$PWD/life-project" \ - /webfront/developer/preview/provision/environment.tgz "$integrity" -``` - -Replace the engine option on Linux or Windows. With Visual Studio, add `--config Release` when building. After preparing the local archive, launch from PowerShell with: - -```powershell -New-Item -ItemType Directory -Force life-project/.webfront/developer/preview/provision | Out-Null -Copy-Item build-developer-environment/*.tgz life-project/.webfront/developer/preview/provision/ -$integrity = (Get-Content build-developer-environment/provision.json -Raw | ConvertFrom-Json).integrity -.\build-native\examples\Release\WebFrontLifeDeveloper.exe "$PWD/life-project" ` - /webfront/developer/preview/provision/environment.tgz "$integrity" +mkdir -p life-project +./build-native/examples/WebFrontLifeDeveloper "$PWD/life-project" ``` -The example reports startup failures with a nonzero exit status. Use a fresh project directory for this walkthrough. Once developer distribution 0.4.0 is published, the archive URL and integrity arguments can be omitted to use the pinned defaults. +Replace the engine option on Linux or Windows. With Visual Studio, add `--config Release` when building and start it with the project directory, `build-native\examples\Release\WebFrontLifeDeveloper.exe life-project` (after `mkdir life-project`). The example reports startup failures with a nonzero exit status. Two extra arguments, ` `, select another environment archive, for instance one [built from the sources](docs/DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers). -### 3. Install dependencies in the application's terminal +### 3. Create the project and install its dependencies -In the downloaded terminal, run: +In the application's terminal, run: ```text wf create life +wf init wf install react@19.3.1 react-dom@19.3.1 -wf preview ui/main.tsx +wf dev ui/main.tsx ``` -`wf create life` writes the editable [TSX and CSS starter](examples/life/ui), without overwriting an existing project. `wf install` fetches the browser packages and their dependencies, verifies their integrity and records exact versions in `webfront-packages.lock.json`. It does not run the installation scripts of packages. `wf preview` compiles TSX with WebAssembly and opens the interface inside the application. +- `wf create life` writes the editable [TSX and CSS starter](examples/life/ui) into `ui/`; it never overwrites an existing directory. +- `wf init` writes `webfront.project.json`, the manifest every other command reads: dependencies, entries, providers, scripts and permissions. +- `wf install` resolves the packages and their dependencies from the registry, verifies their integrity and records exact versions in `webfront-packages.lock.json`. It does not run the installation scripts of packages. `wf restore` rebuilds the cache from the lock on another machine, and `wf restore --offline` verifies it without any network. +- `wf dev` compiles the TSX with esbuild-wasm, opens the interface inside the application and rebuilds it whenever you save a source. A build error appears in the terminal and over the preview, which keeps its last good version. Ctrl+C stops it; `wf build` compiles once without opening anything. -Edit `life-project/ui/main.tsx` and `style.css` with your usual editor, then run `wf preview` again. React renders the field and controls; each generation awaits the C++ callback: +Edit `life-project/ui/main.tsx` and `style.css` with your usual editor. React renders the field and controls; each generation awaits the C++ callback: ```js await webFront.ready; @@ -150,15 +139,63 @@ const next = await step(cells); `cells` and `next` are 128-byte `Uint8Array` grids mapped to C++ `std::bitset<1024>`, least-significant bit first in each byte. JavaScript calls always return a Promise: await them or handle rejection. No Life rules run in JavaScript. -### 4. Try the result +### 4. Run the tests and check the types + +`wf test` runs your [Jasmine](https://jasmine.github.io/) specs in the application's window, under the `jasmine-core` your lock pins. Install it, create `life-project/tests/life.spec.js` and list it in `webfront.project.json` (`wf init` does not copy the starter's recipe, so the manifest only holds what you add): + +```js +describe('the Life grid', () => { + it('packs 32 by 32 cells into 128 bytes, least significant bit first', () => { + const cells = new Uint8Array(32 * 32 / 8); + for (const i of [330, 331, 332]) cells[i >> 3] |= 1 << (i & 7); + expect(cells.length).toBe(128); + expect(cells[41]).toBe(0b00011100); + }); +}); +``` + +```text +wf install jasmine-core@7.0.2 +``` + +```json +"test": {"specs": ["tests/life.spec.js"]} +``` + +```text +wf test +``` + +The command ends with a nonzero code when a spec fails. + +The builds remove TypeScript types without checking them; `wf check` runs the TypeScript compiler that your lock pins, in the browser. It needs a `tsconfig.json` and the type packages of your imports. A complete one for the starter, the same as the journey tests use, is: + +```json +{ + "compilerOptions": { + "strict": true, + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "Bundler", + "jsx": "react-jsx", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "noEmit": true + }, + "include": ["ui"] +} +``` + +The type packages come next: installing `@types/react` and `@types/react-dom` needs an environment from the sources (0.6.2, not yet published: the pinned 0.6.1 refuses their archives), which you can [build and pass to the example](docs/DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers). With it, `wf install typescript@5.9.3 @types/react@19.3.0 @types/react-dom@19.3.0` then `wf check` type-check the starter. Both commands are described in the [developer environment reference](docs/DEVELOPER_ENVIRONMENT.md). + +### 5. Try the result ![Game of Life running in a native window](docs/images/life-preview.jpg) Play or pause, advance one generation, paint cells, switch patterns, change speed or select a plan view. Generation and population counters reflect the C++ simulation. Only one generation request is outstanding at a time; failures stop playback and appear in the interface. -### 5. Embed the interface for distribution +### 6. Embed the interface for distribution -In the application's terminal: +Declare the entry and the provider in `webfront.project.json` (`"entries": {"main": "ui/main.tsx"}` and `"providers": {"LifeUI": {"entry": "main", "output": "generated/LifeUI.hpp"}}`), or pass them explicitly. In the application's terminal: ```text wf embed ui/main.tsx --output generated/LifeUI.hpp @@ -220,7 +257,7 @@ CI runs one combined C++ / native-browser job per desktop platform on each code - WebFront owns an HTTP/WebSocket server on a background thread. Callbacks run there; avoid blocking it. Native windows must be created and shown on the main thread. Application coroutines use `app.spawn(task)` or `ui.spawn(task)`; see [execution and cancellation](docs/ASYNC_EXECUTION.md). - JavaScript calls to C++ always return Promises. C++ `ui.jsFunction(name)(...)` is fire-and-forget; `ui.jsFunction(name)(...)` returns `std::future`. Missing functions, exceptions, malformed replies and disconnects fail the typed call. - The binary bridge supports scalars, strings, tuples, numeric typed arrays and packed bitsets. Arbitrary objects do not cross it. Strings have a 16-bit encoded length limit. -- Development project access is explicit and intended for trusted local code. Downloaded tools run with the application's bridge authority. Package installation scripts, native add-ons and the APIs of server-side JavaScript runtimes are unsupported. Previews transform TypeScript without type checking; `wf check` type-checks with the compiler the project locks. +- Development project access is explicit and intended for trusted local code. Downloaded tools run with the application's bridge authority, and script permissions frame only the `context` API: neither is a sandbox. Only packages that run in a browser are supported; installation scripts and native add-ons are not executed. Builds transform TypeScript without type checking; `wf check` type-checks with the compiler the project locks. - Packaging, accessibility and native-engine deployment still need application-specific work. General DOM abstractions remain future work. See [project status](docs/PROJECT_STATUS.md) for known limitations. [Developer environment reference](docs/DEVELOPER_ENVIRONMENT.md) · [UI components](docs/UI_COMPONENTS.md) · [architecture decisions](docs/adr/README.md) · [contributing](.github/CONTRIBUTING.md) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1c1fb0ff..bbc25fff 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Documentation of the standalone developer environment (#317, epic #303): the README walkthrough uses `wf create`, `init`, `install`, `dev`, `check`, `test` and `embed` on the pinned environment; `DEVELOPER_ENVIRONMENT.md` opens with the commands, the direct statement of its limits (no sandbox, browser packages only, installation scripts not run) and the maintenance of TypeScript through `wf check`; the 0.4.0 "prepared, not published" text is removed; PROJECT_STATUS starts with the current state; ADR-016 is 1.5. + - Remove the retired PI starter from source distributions and `wf create`; Life remains the maintained React/C++ starter. Preserve real-time fallbacks in scoped test clocks, release preparation cancellation before the test frame runs, and retain independent reproducibility, bootstrap-refresh and packaged permission checks. The attribution audit diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 05d0c94b..22b2339f 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -1,21 +1,39 @@ # Browser-powered development -The developer environment downloads its terminal, npm resolver and WebAssembly compiler at -runtime. The application's C++ executable initially contains the bridge and a small bootstrap; -it does not embed React, Babel, xterm or esbuild. No separate JavaScript runtime is **required on the -application developer's machine**. A C++ compiler, CMake and the selected native webview remain -necessary. TypeScript/JSX is transformed in the browser without type checking; `wf check` type-checks the project -with the TypeScript compiler it locks. - -This is an experimental, explicit development facility. The downloaded environment runs with -the application's bridge authority and may read/write the selected project. It exposes no shell. -Do not ship developer mode as the distribution configuration. - -The 0.4 presentation update prepares developer distribution **0.4.0** with the revised Life text. -It is not published as part of the repository cleanup. Before releasing this branch, publish the -prepared archives using [the package release procedure](../js/developer/tools/PUBLISHING.md). -For local review, provision the generated archive as described below and pass its URL/integrity -to `WebFrontLifeDeveloper`. Existing published versions remain unchanged. +# The WebFront developer environment + +The developer environment is the tooling of WebFront: a terminal, a package installer, a TypeScript/TSX compiler, a type +checker, a test runner and an asset generator, all running in the browser of your application. The C++ executable holds the +bridge and a small bootstrap loader; at the first launch the loader downloads the environment, verifies its SHA-512 and +caches it, so later launches work offline. Nothing else has to be installed: a C++ compiler, CMake and the selected native +webview are enough. + +A project is a directory with a manifest, `webfront.project.json`, and a lock, `webfront-packages.lock.json`. The `wf` +commands of the terminal operate on it: + +| Command | Purpose | +| --- | --- | +| `wf init`, `wf create ` | write the manifest; copy the Life starter into a new directory | +| `wf install`, `wf restore` | resolve, download and lock packages; rebuild or verify the cache from the lock | +| `wf dev`, `wf build`, `wf preview` | rebuild and reload the preview on every change; build once; preview once | +| `wf check` | type-check with the locked TypeScript compiler | +| `wf test` | run Jasmine specs in the application's window | +| `wf run`, `wf exec` | run a manifest script or a package's executable entry | +| `wf embed` | generate the C++ provider of the application's resources | + +**Limits, stated directly.** The downloaded environment and the scripts you authorize run with the application's bridge +authority and may read and write the selected project: there is **no sandbox**, and the manifest's permissions frame only the +`context` API given to scripts. Only packages that run in a browser are installed; their installation scripts and native +add-ons are not executed, and the APIs of server-side JavaScript runtimes are not available. No shell is exposed. Do not +ship developer mode as the distribution configuration: `wf embed` produces the application that you distribute. + +**TypeScript** is supported throughout. TS and TSX are compiled by esbuild-wasm in the browser, which removes the types; +`wf check` verifies them with the TypeScript 5.x or 6.x compiler that your lock pins, using your `tsconfig.json`, the +`.d.ts` files and the type packages (`@types/*`, `types` and `typings` fields) of the locked graph. No external compiler is +installed or required (see [Type checking](#type-checking-wf-check)). + +The current environment is **0.6.1**, published as `developer-v0.6.1` and pinned by the release data. Earlier published +versions stay immutable; the sources advance to 0.6.2, which is not published yet. ## Minimal C++ application @@ -38,17 +56,12 @@ int main() { ``` The [versioned distributions](https://ambroise-leclerc.github.io/WebFront/) are published on GitHub Pages. -Version 0.3.0 provides the packed-bitset Life starter and requires the bridge support from #289. -Version 0.3.1 makes `wf install` keep the versions of the installed lock and reject an archive whose integrity differs from it. -Published versions 0.1.0 to 0.3.0 remain immutable; 0.2.0 used string-based Life grids. -On 2026-10-20, the 0.3.0 public download/WASM/React/PI/Life path passed in WKWebView, including -128-byte grid exchange, painting cells across an octet boundary, playback/reset and deterministic -header generation. Both resulting headers were compiled and the applications passed offline -native tests from empty working directories, with developer callbacks absent. Pages returned -HTTP 200, CORS `*` and the pinned archive bytes. These checks supplement offline CTest fixtures. +Each published version is immutable: 0.3.0 introduced the packed-bitset Life starter (bridge support from #289), 0.3.1 made +`wf install` keep the versions of the installed lock, 0.4.1 changed the include of the generated provider, 0.5.0 added the +manifest, `wf restore`, `wf run`, `wf exec`, `wf check` and the complete terminal, and 0.6.0 `wf build`, `wf dev` and `wf test`. The default configuration is generated in `include/webfront/system/DeveloperReleaseData.hpp` and targets -`https://ambroise-leclerc.github.io/WebFront/developer/0.6.1/environment.tgz`. This version (`wf build`, `wf dev`, `wf test` and the non-interactive entry, on top of the 0.5.0 manifest, `wf restore`, `wf run`, `wf check` and the complete terminal) is published and archived as `developer-v0.6.1`. Published 0.6.0, 0.5.0, 0.4.1 and 0.4.0 stay immutable; 0.4.0 targets the former include layout. The configuration pins one version and +`https://ambroise-leclerc.github.io/WebFront/developer/0.6.1/environment.tgz`. This version (`wf build`, `wf dev`, `wf test` and the non-interactive entry, on top of the 0.5.0 manifest, `wf restore`, `wf run`, `wf check` and the complete terminal) is published and archived as `developer-v0.6.1`. Published 0.6.0, 0.5.0 and 0.4.1 stay immutable; 0.4.0 and earlier target the former include layout. The configuration pins one version and its SHA-512 rather than resolving a mutable `latest` channel. An explicit `DeveloperBootstrapOptions{.environment = url, .integrity = trustedHash}` still selects a different HTTPS/CORS repository or a same-origin test fixture. Users install no JavaScript tooling. @@ -76,27 +89,29 @@ with cell `i` in bit `i % 8` of byte `i / 8`. The bridge validates the exact uns with a plain console application. `examples/life/LifeDeveloper.cpp` adds the native window and downloaded developer bootstrap. Configure -`build-native` with the native frontend option above, then [prepare the local archive](#environment-distribution-and-offline-tests-maintainers) and start with a fresh project directory: +`build-native` with the native frontend option above and start with a fresh project directory: ```sh -mkdir -p life-project/.webfront/developer/preview/provision -cp build-developer-environment/*.tgz life-project/.webfront/developer/preview/provision/ -integrity=$(sed -n 's/^ "integrity": "\(.*\)",$/\1/p' build-developer-environment/provision.json) -./build-native/examples/WebFrontLifeDeveloper "$PWD/life-project" \ - /webfront/developer/preview/provision/environment.tgz "$integrity" +mkdir -p life-project +./build-native/examples/WebFrontLifeDeveloper "$PWD/life-project" ``` -Optional extra arguments ` ` override the pinned default. -In the downloaded terminal: +Optional extra arguments ` ` override the pinned default (for instance with the local +archive of [the maintainers' section](#environment-distribution-and-offline-tests-maintainers)). In the downloaded terminal: ```text wf create life +wf init wf install react@19.3.1 react-dom@19.3.1 -wf preview ui/main.tsx +wf dev ui/main.tsx +wf install jasmine-core@7.0.2 +wf test wf embed ui/main.tsx --output generated/LifeUI.hpp ``` -The starter contains editable TSX/CSS and an exact-version `webfront.project.json` recipe. +`wf test` needs `test.specs` declared in the manifest and `jasmine-core` installed; type checking is a separate step that the pinned 0.6.1 cannot complete: `wf install typescript@5.9.3 @types/react@19.3.0 @types/react-dom@19.3.0` then `wf check` need an environment of 0.6.2 or later (start the example with a [local archive](#environment-distribution-and-offline-tests-maintainers)) and a `tsconfig.json` (see the README for a complete one). The terminal does not read `#` comments, so type the commands only. + +The starter contains editable TSX/CSS and a recipe of exact versions; `wf init` does not copy it, so list the dependencies with `wf install` and declare `test.specs`, `entries` and `providers` in the manifest yourself. `wf create life another-directory` selects a different new destination; existing directories are never replaced. React DOM pulls scheduler transitively and checks its React peer. Edit the local files in your normal editor and use `wf dev` for automatic rebuilds, or run `wf preview` again. Ctrl+C interrupts @@ -141,8 +156,8 @@ The former embedded React/Babel providers have been removed; use the generated a ## Project manifest (`webfront.project.json`) -Available from developer distribution 0.5.0, which the default configuration pins; the 0.4.1 environment predates the manifest. -A project has one manifest, the equivalent of `package.json`, which every `wf` command reads: +Available from developer distribution 0.5.0. +A project has one manifest, which every `wf` command reads: ```json { @@ -540,9 +555,9 @@ blocks the public network after the configure step. - `wf install` accepts exact versions, registry tags and semver ranges, resolves ordinary transitive dependencies, and retains separate nodes for different versions. Required peers must be satisfied by compatible explicitly installed roots or direct dependencies; conflicts fail. -- Package installation scripts, native add-ons and Node.js APIs are unsupported. Packages must be - usable in a browser. Optional dependencies are not installed in this first version; imports of - missing dependencies fail during the build. This is not a replacement for the complete npm CLI. +- Package installation scripts and native add-ons are not executed, and the APIs of server-side JavaScript runtimes are + not available. Packages must run in a browser. Optional dependencies are not installed; imports of missing + dependencies fail during the build. `wf` installs from npm registries and mirrors; it is not the complete npm client. - Browser/production exports, ESM, CommonJS, TS/TSX, JSX, CSS and imported resource files are supported. Private package exports, network imports and unavailable Node built-ins fail. Package-specific build pipelines and automatic polyfills are not supplied. diff --git a/docs/ISSUE_AUDIT.md b/docs/ISSUE_AUDIT.md index f5bb7e62..4816abde 100644 --- a/docs/ISSUE_AUDIT.md +++ b/docs/ISSUE_AUDIT.md @@ -1,5 +1,7 @@ # GitHub issue and branch audit +Scope note (#317, 2026-10-24): after epic #303 the core is minimal and the tooling is the standalone developer environment ([project status](PROJECT_STATUS.md), [environment reference](DEVELOPER_ENVIRONMENT.md)). Issues about the removed embedded providers, terminal or tool manager are superseded by it. The dated audit below is kept as a record. + Audit applied: 2026-07-19. The backlog was reduced to work that has concrete interfaces, acceptance criteria, and a place in the current WebFront roadmap. ## Active issues diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index c897573f..a09eade2 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -1,5 +1,30 @@ # WebFront project status +## Current state (#317, epic #303, 2026-10-24) + +WebFront is a minimal header-only C++23 core plus a standalone developer environment. + +- **Core.** `include/webfront/` holds the C++ library and a closed list of embedded resources (the bridge, the fallback page and + module, the favicon, the bootstrap page and loader, and the release data), guarded at 150 KiB decoded by `MinimalCoreAssets` + ([ADR-016](adr/ADR-016-bootstrap-comme-socle.md)). No third-party source is vendored. +- **Developer environment.** Downloaded and verified by `NativeApp::bootstrap("developer")` (0.6.1 published and pinned; the sources + advance to 0.6.2). `wf init`, `create`, `install`, `restore`, `run`, `exec`, `check`, `test`, `build`, `dev`, `preview` and + `embed` work on a manifest (`webfront.project.json`) and a lock; TypeScript and TSX are compiled by esbuild-wasm and type-checked + by `wf check` with the project's locked compiler. The application's own commands join the terminal through `webfront::Commands`. + See [DEVELOPER_ENVIRONMENT](DEVELOPER_ENVIRONMENT.md) and [UI_COMPONENTS](UI_COMPONENTS.md). +- **No JavaScript runtime or package manager** is needed to use, build, test, regenerate, publish or run the CI of WebFront + ([migration record](NODE_TOOLS_MIGRATION.md)); `NoNodeDependency` audits every tracked file. +- **Proofs.** The `Journey*` chain (create, init, install, check, test, build, embed, compile, run, permission denied, offline cache) + passes on CEF, WebKitGTK, WKWebView and WebView2 (see below). +- **Limitations.** There is no sandbox: the downloaded environment and the authorized scripts have the authority of the bridge and + of the project, and the permissions frame only the `context` API of scripts. Only browser packages install; installation scripts + and native add-ons are not executed. A synchronous infinite loop in a spec blocks the page hosting `wf test`. File reads fail beyond 260 characters + on Windows (#349). General DOM abstractions, packaging, accessibility and native-engine deployment remain application work. + The README walkthrough (Game of Life: console, developer, embedded) uses exactly these commands, and `NewcomerDocsMatchExamples` + keeps it aligned with the examples. + +The sections below are dated records, newest first where the topic is current; earlier entries keep the names and numbers of their time. + ## Repository layout (#320, epic #303) The root now holds only `.github`, `cmake`, `docs`, `examples`, `include`, `js` and `test`, plus tool configuration files @@ -151,8 +176,8 @@ published 0.1.0 to 0.4.0 remain immutable. APIs and packaging remain experimenta - Public examples now live in `examples/`: Hello World and the three stages of Game of Life. Browser bridge/component/bootstrap sources live in `js/`; the library remains header-only. PI and Signal Studio resources required by regression tests remain fixtures, without public demo targets. -- The README starts with Hello World and a linked Life thumbnail, then walks through the native - bootstrap, dependency installation, preview and offline embedding. No library feature is added. +- The README starts with the Life application and its animation, then walks through the native + bootstrap, dependency installation, development, checks, tests and offline embedding. No library feature is added. - Per-change CI combines unit tests and native browser coverage into three desktop jobs, with npm, CPM and compiler caches. The Linux job prints GCC line coverage on every PR (no external upload). Sanitizers, fuzzing, both CEF compiler variants and optional mddlog qualification run weekly or manually. Superseded runs are cancelled. diff --git a/docs/WKWEBVIEW.md b/docs/WKWEBVIEW.md index c51a9de2..02ef749f 100644 --- a/docs/WKWEBVIEW.md +++ b/docs/WKWEBVIEW.md @@ -3,12 +3,19 @@ `WKWebViewFrontend` opens a native AppKit window with the WebKit engine supplied by macOS. It is optional and never changes `webfront::WebFront`'s system-browser default. -For this unpublished 0.4 branch, first [build the local developer archive](DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers), then run from the repository root: +To run the Game of Life developer example on the pinned developer environment, from the repository root: ```bash cmake -S . -B build-wkwebview -DCMAKE_BUILD_TYPE=Release \ -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_EMBED_WKWEBVIEW=ON cmake --build build-wkwebview --target WebFrontLifeDeveloper --parallel 2 +mkdir -p life-project +./build-wkwebview/examples/WebFrontLifeDeveloper "$PWD/life-project" +``` + +To run an environment built from the sources instead, [build the local archive](DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers) and pass it: + +```bash mkdir -p life-project/.webfront/developer/preview/provision cp build-developer-environment/*.tgz life-project/.webfront/developer/preview/provision/ integrity=$(sed -n 's/^ "integrity": "\(.*\)",$/\1/p' build-developer-environment/provision.json) diff --git a/docs/adr/ADR-016-bootstrap-comme-socle.md b/docs/adr/ADR-016-bootstrap-comme-socle.md index c978feed..1edfb52e 100644 --- a/docs/adr/ADR-016-bootstrap-comme-socle.md +++ b/docs/adr/ADR-016-bootstrap-comme-socle.md @@ -9,6 +9,7 @@ | 1.2 | 2026-10-23 | Acceptée | Ambroise Leclerc | Auto-hébergement (#315) : le dépôt est un projet `wf` dont les scripts construisent l'environnement, le site et la vérification du pin avec l'environnement d'amorçage épinglé ; octets identiques à la construction de l'époque, preuve de reconstruction du bundle bootstrap. | — | | 1.3 | 2026-10-24 | Acceptée | Ambroise Leclerc | Tests, régénération et CI sans Node.js ni npm (#318) : les en-têtes du cœur sont produits et vérifiés par un générateur CMake pur (`js/core/EmbedAsset.cmake`), qui remplace `wf run embed-core` et le générateur Node.js ; les paquets du registre de test sont téléchargés et vérifiés au configure ; les tests JavaScript deviennent des specs Jasmine exécutées par `wf test` ; garde-fou global `NoNodeDependency`. | — | | 1.4 | 2026-10-24 | Acceptée | Ambroise Leclerc | Qualification du parcours (#316) : ADR-013, ADR-014 et ADR-015 passent à « Acceptée ». | [#348](https://github.com/ambroise-leclerc/WebFront/pull/348) | +| 1.5 | 2026-10-24 | Acceptée | Ambroise Leclerc | Documentation consolidée (#317) : la formulation courante décrit directement l'environnement et ses commandes (`wf init`, `install`, `dev`, `check`, `test`, `embed`), sans comparaison avec d'autres outils ; les versions et décisions antérieures de ce tableau et de l'historique Git restent l'historique de la décision. | [#317](https://github.com/ambroise-leclerc/WebFront/issues/317) | ## Statut et date @@ -22,8 +23,8 @@ cette décision ; les retraits qu'elle annonce sont réalisés par #311 à #319. L'étape développeur du jeu de la vie (`examples/life/LifeDeveloper.cpp`) montre le modèle visé : `NativeApp::bootstrap("developer")` sert une petite page embarquée, télécharge une archive -d'environnement vérifiée SHA-512, monte un terminal dans le navigateur, installe des paquets npm -sans Node (`wf install`), compile TS/TSX dans un Worker (`wf preview`) et génère un provider +d'environnement vérifiée SHA-512, monte un terminal dans le navigateur, installe des paquets du registre npm +(`wf install`), compile TS/TSX dans un Worker (`wf dev`, `wf build`), vérifie les types (`wf check`), exécute les specs (`wf test`) et génère un provider propre à l'application (`wf embed`), compilé ensuite dans un exécutable de distribution. Le dépôt livre encore en parallèle environ 2,5 Mo d'en-têtes pré-générés sous diff --git a/docs/adr/README.md b/docs/adr/README.md index ba124988..e838f6db 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -55,7 +55,7 @@ verification evidence remain in [PROJECT_STATUS](../PROJECT_STATUS.md). | [ADR-013](ADR-013-bootstrap-developpeur-a-la-demande.md) | Bootstrapping a downloaded developer environment | Accepted | 2026-10-20 | 1.0 — 2026-10-24 | | [ADR-014](ADR-014-construction-javascript-dans-le-browser.md) | Resolving npm dependencies and building inside the browser | Accepted | 2026-10-20 | 1.0 — 2026-10-24 | | [ADR-015](ADR-015-ressources-generees-par-application.md) | Generating application-owned embedded resources | Accepted | 2026-10-20 | 1.0 — 2026-10-24 | -| [ADR-016](ADR-016-bootstrap-comme-socle.md) | The bootstrap environment as WebFront's foundation | Accepted | 2026-10-22 | 1.4 — 2026-10-24 | +| [ADR-016](ADR-016-bootstrap-comme-socle.md) | The bootstrap environment as WebFront's foundation | Accepted | 2026-10-22 | 1.5 — 2026-10-24 | Numbering follows the reading topics; milestones and individual file histories provide the chronology, which does not follow the numerical order. diff --git a/js/developer/tools/PUBLISHING.md b/js/developer/tools/PUBLISHING.md index 9c147169..0c48f0a8 100644 --- a/js/developer/tools/PUBLISHING.md +++ b/js/developer/tools/PUBLISHING.md @@ -1,8 +1,8 @@ # Publishing the developer packages -The version and canonical HTTPS base URL are in `distribution.json`. The environment and Life/PI starters +The version and canonical HTTPS base URL are in `distribution.json`. The environment and the Life starter are published under `developer//`. React, React DOM and scheduler stay on npm; this site -hosts only WebFront's development environment, its pinned Life/PI starters and provisioning metadata. +hosts only WebFront's development environment, its pinned Life starter and provisioning metadata. The package names in their manifests are identifiers, not a requirement to own or publish npm scopes. The environment builds itself: the pinned bootstrap environment (`cmake/WebFrontBootstrap.cmake`) runs the scripts of @@ -122,7 +122,7 @@ ctest --test-dir build-native -R '^DeveloperFixtures$' --output-on-failure "$PWD/build-native/test/web/developer-fixtures" "$PWD/build-native/test/web/public-generated" --public ``` -This mode downloads the pinned environment and both starters from Pages, fetches exact React/React DOM -versions and scheduler from npm, executes esbuild/WASM, creates in-window PI and Life previews and generates -both application providers. A mismatch, download failure, browser error or failed assertion returns +This mode downloads the pinned environment and the starter from Pages, fetches exact React/React DOM +versions and scheduler from npm, executes esbuild/WASM, creates the in-window Life preview and generates +the application provider. A mismatch, download failure, browser error or failed assertion returns nonzero. Keep the issue open until this real-engine check and the normal offline regression suite pass. diff --git a/js/developer/tools/RELEASE_NOTES.md b/js/developer/tools/RELEASE_NOTES.md index 6409d08a..2e526ca8 100644 --- a/js/developer/tools/RELEASE_NOTES.md +++ b/js/developer/tools/RELEASE_NOTES.md @@ -1,8 +1,8 @@ -Browser-powered WebFront developer environment with Game of Life and PI starters, versioned separately from the C++ library. +Browser-powered WebFront developer environment with Game of Life starter (the PI starter of earlier versions is retired), versioned separately from the C++ library. Version 0.3.0 migrates the Life starter to packed Uint8Array grids: 128 bytes per generation with direct C++ bitset registration. It requires the bridge support introduced in #289. The interface retains editable patterns, playback, reset and single stepping. Version 0.3.1 makes `wf install` honor the installed lock: versions it records are kept and their archives must still match the recorded integrity. Published versions 0.1.0 to 0.3.0 remain available without modification. -Download through the version-pinned GitHub Pages URLs in the bootstrap configuration. SHA-512 is verified before executing the environment or creating a starter. React, React DOM and scheduler remain on npm; application developers install no JavaScript tooling. Both starters can generate their own compressed header-only resources for an offline native executable. +Download through the version-pinned GitHub Pages URLs in the bootstrap configuration. SHA-512 is verified before executing the environment or creating a starter. React, React DOM and scheduler remain on npm; application developers install no JavaScript tooling. Applications using the starter can generate their own compressed header-only resources for an offline native executable. The environment includes the terminal, npm resolver, esbuild/WASM compiler, embedding tools and dependency notices. These packages are experimental; browser packages only, without installation scripts, native modules or server-side runtime shims. diff --git a/test/cmake/CheckNewcomerDocs.cmake b/test/cmake/CheckNewcomerDocs.cmake index b3712b95..29f6294a 100644 --- a/test/cmake/CheckNewcomerDocs.cmake +++ b/test/cmake/CheckNewcomerDocs.cmake @@ -27,8 +27,10 @@ _read(frontends docs/FRONTENDS.md) _read(developer_guide docs/DEVELOPER_ENVIRONMENT.md) _read(wkwebview_guide docs/WKWEBVIEW.md) _read(developer_release include/webfront/system/DeveloperReleaseData.hpp) -# The local-review instructions must not silently use an unpublished default archive. -foreach(text readme wkwebview_guide) +# The README starts the example on the environment pinned in the release data; only the guides of the maintainers and of +# WKWebView show the explicit local archive, which must not silently use an unpublished default. +_require("${readme}" "./build-native/examples/WebFrontLifeDeveloper \"$PWD/life-project\"" "README default bootstrap") +foreach(text developer_guide wkwebview_guide) _require("${${text}}" "/webfront/developer/preview/provision/environment.tgz \"$integrity\"" "${text} local bootstrap arguments") _require("${${text}}" "sed -n 's/^ \"integrity\": \"\\(.*\\)\",$/\\1/p' build-developer-environment/provision.json" "${text} trusted local integrity") endforeach() @@ -64,7 +66,7 @@ list(LENGTH targets target_count) if(NOT target_count EQUAL 4) list(APPEND failures "Only Hello World and the three Life stages should be built") endif() -foreach(command "wf create life" "wf install react@19.3.1 react-dom@19.3.1" "wf preview ui/main.tsx" "wf embed ui/main.tsx --output generated/LifeUI.hpp") +foreach(command "wf create life" "wf init" "wf install react@19.3.1 react-dom@19.3.1" "wf dev ui/main.tsx" "wf check" "wf test" "wf embed ui/main.tsx --output generated/LifeUI.hpp") _require("${readme}" "${command}" "developer-terminal walkthrough") endforeach() _require("${readme}" "-DWEBFRONT_LIFE_ASSETS=\"$PWD/life-project/generated/LifeUI.hpp\"" "generated-header build")