workpeg 0.151.1__tar.gz → 0.153.0__tar.gz
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.
- {workpeg-0.151.1/src/workpeg.egg-info → workpeg-0.153.0}/PKG-INFO +3 -4
- {workpeg-0.151.1 → workpeg-0.153.0}/README.md +2 -3
- {workpeg-0.151.1 → workpeg-0.153.0}/pyproject.toml +1 -1
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/cli.py +79 -239
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/terminal.py +3 -3
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/build.py +64 -4
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/create.py +4 -4
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/devmode.py +16 -21
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/devserve.py +11 -12
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/devsite.py +5 -28
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/fake_cloud.py +37 -266
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/workpeg-runtime.js +69 -23
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/serve.py +23 -74
- {workpeg-0.151.1 → workpeg-0.153.0/src/workpeg.egg-info}/PKG-INFO +3 -4
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_cli.py +2 -381
- {workpeg-0.151.1 → workpeg-0.153.0}/LICENSE +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/MANIFEST.in +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/setup.cfg +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/auth.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/build.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/cdn.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/config.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/context.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/create_new.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/doctor.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/project.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/run.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/runtime.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/sandbox/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/sandbox/docker_driver.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/sandbox/driver.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/submit.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/functions/Dockerfile +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/functions/LICENSE +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/functions/README.md +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/functions/app/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/functions/app/main.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/functions/requirements.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/project/README.md +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/project/function/Dockerfile +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/project/function/app/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/project/function/app/main.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/project/function/requirements.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/project/ui/main.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/templates/project/workpeg.json +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/actions.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/actions_manifest.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/app.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/calendar.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/compiler/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/compiler/ast_parser.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/compiler/ir.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/compiler/js_generator.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/dates.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/dev_refused_names.json +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/minify.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/render_nodes.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/renderers_manifest.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-concurrent-replies.md +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-prompt-queue.md +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-question-frame.md +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-subagent-frame.md +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai.js +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/editor.js +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/OFL.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic-ext.af944491.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic.88be6946.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin-ext.370a8962.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin.7611b95c.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-vietnamese.8dfcf303.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic-ext.b7a545bb.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic.6129fc85.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin-ext.58a6b173.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin.9b6f5ff4.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-vietnamese.f689f638.woff2 +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/icons.css.gz +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/overlay.js +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/pegment.css +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/runtime/scaffold.js +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/scaffold.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/search_manifest.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/skills_manifest.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/state.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/validators.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/watcher.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/__init__.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/base.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/canvas.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/display.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/fields.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/forms.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/futures.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/gestures.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/interactive.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/layout.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/ui/widgets/pickers.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg/utils.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg.egg-info/SOURCES.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg.egg-info/dependency_links.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg.egg-info/entry_points.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg.egg-info/requires.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/src/workpeg.egg-info/top_level.txt +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_auth.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_build.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_cdn.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_cdn_publish.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_changelog.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_changelog_guard.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_config.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_context.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_create_new.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_doctor.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_project_create.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_release_script.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_run.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_runtime.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_submit.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_utils.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_version.py +0 -0
- {workpeg-0.151.1 → workpeg-0.153.0}/tests/test_watch_pipeline.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: workpeg
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.153.0
|
|
4
4
|
Summary: Workpeg function runtime and SDK
|
|
5
5
|
Author-email: Workpeg <support@workpeg.com>
|
|
6
6
|
License: MIT
|
|
@@ -392,7 +392,7 @@ Full reference: [docs/schema-ui.md](https://gitlab.com/workpeg/workpeg-sdk/-/blo
|
|
|
392
392
|
| [docs/functions.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/functions.md) | Function contract, context, runtime, Docker, publishing |
|
|
393
393
|
| [docs/cdn.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/cdn.md) | CDN uploads, paths, authentication, asset structure |
|
|
394
394
|
| [docs/getting-started.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/getting-started.md) | Peg UI: how it works, quick start, CLI, live reload |
|
|
395
|
-
| [docs/dev-install.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/dev-install.md) | Test a peg before release: `workpeg ui serve --
|
|
395
|
+
| [docs/dev-install.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/dev-install.md) | Test a peg before release: `workpeg ui serve --fake-cloud`, `workpeg ui dev-clean`, the separate development account |
|
|
396
396
|
| [docs/core-concepts.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/core-concepts.md) | `App`, `State`, `build()`, supported Python, lists, reactivity |
|
|
397
397
|
| [docs/widgets.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/widgets.md) | Widget gallery + full per-widget reference |
|
|
398
398
|
| [docs/routing.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/routing.md) · [data-realtime.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/data-realtime.md) · [state-components.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/state-components.md) · [styling.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/styling.md) | Routing, data/realtime, global state, theming |
|
|
@@ -475,8 +475,7 @@ Optional `workpeg.json` in your project root. `namespace` records the peg the pr
|
|
|
475
475
|
| Method local variables (`step = 5; self.count += step`) | Available |
|
|
476
476
|
| Console logging (`print()` → `console.log()`) | Available |
|
|
477
477
|
| Dev error overlay (compile + runtime errors in the browser) | Available |
|
|
478
|
-
| Dev install (`workpeg ui serve --
|
|
479
|
-
| Fake cloud (`--fake-cloud`: the older way to serve a build at `https://<app>.dev.workpeg.com`, kept and fenced like the dev install; to test a peg before release, use `workpeg ui serve --dev`) | Available |
|
|
478
|
+
| Dev install (`workpeg ui serve --fake-cloud`: the release build at `https://<namespace>.dev.workpeg.com`, from your own computer, to it only, reaching the API on the same domain as a released peg; [guide](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/dev-install.md)) | Available |
|
|
480
479
|
| Widget categories — layout / display / interactive (Flutter-style) | Available |
|
|
481
480
|
| `ListView` with lazy, virtualized `ListView.builder` | Available |
|
|
482
481
|
| `Center` layout widget | Available |
|
|
@@ -367,7 +367,7 @@ Full reference: [docs/schema-ui.md](https://gitlab.com/workpeg/workpeg-sdk/-/blo
|
|
|
367
367
|
| [docs/functions.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/functions.md) | Function contract, context, runtime, Docker, publishing |
|
|
368
368
|
| [docs/cdn.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/cdn.md) | CDN uploads, paths, authentication, asset structure |
|
|
369
369
|
| [docs/getting-started.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/getting-started.md) | Peg UI: how it works, quick start, CLI, live reload |
|
|
370
|
-
| [docs/dev-install.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/dev-install.md) | Test a peg before release: `workpeg ui serve --
|
|
370
|
+
| [docs/dev-install.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/dev-install.md) | Test a peg before release: `workpeg ui serve --fake-cloud`, `workpeg ui dev-clean`, the separate development account |
|
|
371
371
|
| [docs/core-concepts.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/core-concepts.md) | `App`, `State`, `build()`, supported Python, lists, reactivity |
|
|
372
372
|
| [docs/widgets.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/widgets.md) | Widget gallery + full per-widget reference |
|
|
373
373
|
| [docs/routing.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/routing.md) · [data-realtime.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/data-realtime.md) · [state-components.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/state-components.md) · [styling.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/styling.md) | Routing, data/realtime, global state, theming |
|
|
@@ -450,8 +450,7 @@ Optional `workpeg.json` in your project root. `namespace` records the peg the pr
|
|
|
450
450
|
| Method local variables (`step = 5; self.count += step`) | Available |
|
|
451
451
|
| Console logging (`print()` → `console.log()`) | Available |
|
|
452
452
|
| Dev error overlay (compile + runtime errors in the browser) | Available |
|
|
453
|
-
| Dev install (`workpeg ui serve --
|
|
454
|
-
| Fake cloud (`--fake-cloud`: the older way to serve a build at `https://<app>.dev.workpeg.com`, kept and fenced like the dev install; to test a peg before release, use `workpeg ui serve --dev`) | Available |
|
|
453
|
+
| Dev install (`workpeg ui serve --fake-cloud`: the release build at `https://<namespace>.dev.workpeg.com`, from your own computer, to it only, reaching the API on the same domain as a released peg; [guide](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/dev-install.md)) | Available |
|
|
455
454
|
| Widget categories — layout / display / interactive (Flutter-style) | Available |
|
|
456
455
|
| `ListView` with lazy, virtualized `ListView.builder` | Available |
|
|
457
456
|
| `Center` layout widget | Available |
|
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import sys
|
|
4
4
|
|
|
5
5
|
from workpeg import build, cdn, create_new, run, runtime, submit
|
|
6
|
-
from workpeg.terminal import
|
|
6
|
+
from workpeg.terminal import shown_lines
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
# The package's, not a second copy of the same lookup. Keeping its own was
|
|
@@ -299,8 +299,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
299
299
|
"--fake-cloud",
|
|
300
300
|
action="store_true",
|
|
301
301
|
help=(
|
|
302
|
-
"Serve
|
|
303
|
-
"
|
|
302
|
+
"Serve the new project as `workpeg ui serve <name> --fake-cloud`\n"
|
|
303
|
+
"does: a dev page at https://<namespace>.dev.workpeg.com"
|
|
304
304
|
),
|
|
305
305
|
)
|
|
306
306
|
|
|
@@ -367,7 +367,6 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
367
367
|
" workpeg ui serve counter/main.py\n"
|
|
368
368
|
" workpeg ui serve counter/dist/\n"
|
|
369
369
|
" workpeg ui serve counter/ --fake-cloud\n"
|
|
370
|
-
" workpeg ui serve counter/ --dev\n"
|
|
371
370
|
),
|
|
372
371
|
)
|
|
373
372
|
|
|
@@ -384,7 +383,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
384
383
|
"--port",
|
|
385
384
|
type=int,
|
|
386
385
|
default=0,
|
|
387
|
-
help="Port for the local server (default: auto). With --
|
|
386
|
+
help=("Port for the local server (default: auto). With --fake-cloud, "
|
|
387
|
+
"443 only"),
|
|
388
388
|
)
|
|
389
389
|
|
|
390
390
|
ui_serve_p.add_argument(
|
|
@@ -400,8 +400,16 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
400
400
|
"--fake-cloud",
|
|
401
401
|
action="store_true",
|
|
402
402
|
help=(
|
|
403
|
-
"
|
|
404
|
-
"
|
|
403
|
+
"Dev install: build the project exactly as `workpeg ui build`\n"
|
|
404
|
+
"does and serve only that build at\n"
|
|
405
|
+
"https://<namespace>.dev.workpeg.com, the namespace its\n"
|
|
406
|
+
"workpeg.json declares, on port 443 and to this computer\n"
|
|
407
|
+
"only, so the page reaches the API on the same domain as a\n"
|
|
408
|
+
"released peg. Needs mkcert. Reads no token. Before anything\n"
|
|
409
|
+
"is bound it refuses a name Workpeg keeps, a pre-built\n"
|
|
410
|
+
"folder, --peg-namespace, a --port other than 443 and\n"
|
|
411
|
+
"WORKPEG_BIND_HOST.\n"
|
|
412
|
+
"Guide: docs/dev-install.md"
|
|
405
413
|
),
|
|
406
414
|
)
|
|
407
415
|
|
|
@@ -413,25 +421,18 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
413
421
|
"Run locally as the Peg NAMESPACE — the CDN logo, the workpeg.* "
|
|
414
422
|
"namespace header, etc. resolve as if served from "
|
|
415
423
|
"<NAMESPACE>.dev.workpeg.com (default: the project name). "
|
|
416
|
-
"Applies when compiling a project/.py source
|
|
417
|
-
"
|
|
424
|
+
"Applies when compiling a project/.py source, without "
|
|
425
|
+
"--fake-cloud: a dev page takes its namespace from the project."
|
|
418
426
|
),
|
|
419
427
|
)
|
|
420
428
|
|
|
429
|
+
# The 0.151 spelling of --fake-cloud, kept so that a command line
|
|
430
|
+
# written then still works, and hidden: the one documented flag is
|
|
431
|
+
# --fake-cloud (owner, 2026-11-08).
|
|
421
432
|
ui_serve_p.add_argument(
|
|
422
433
|
"--dev",
|
|
423
434
|
action="store_true",
|
|
424
|
-
help=
|
|
425
|
-
"Dev install: build the project exactly as `workpeg ui build`\n"
|
|
426
|
-
"does and serve only that build at\n"
|
|
427
|
-
"https://<namespace>.dev.workpeg.com, the namespace its\n"
|
|
428
|
-
"workpeg.json declares, on port 443 and to this computer\n"
|
|
429
|
-
"only. Needs mkcert. Reads no token. Before anything is\n"
|
|
430
|
-
"bound it refuses a name Workpeg keeps, a pre-built folder,\n"
|
|
431
|
-
"--fake-cloud, --peg-namespace, a --port other than 443 and\n"
|
|
432
|
-
"WORKPEG_BIND_HOST.\n"
|
|
433
|
-
"Guide: docs/dev-install.md"
|
|
434
|
-
),
|
|
435
|
+
help=argparse.SUPPRESS,
|
|
435
436
|
)
|
|
436
437
|
|
|
437
438
|
ui_serve_p.set_defaults(_handler="ui.serve")
|
|
@@ -439,8 +440,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
439
440
|
ui_dev_clean_p = ui_sub.add_parser(
|
|
440
441
|
"dev-clean",
|
|
441
442
|
help=(
|
|
442
|
-
"Remove the hosts lines and certificates serve --
|
|
443
|
-
"
|
|
443
|
+
"Remove the hosts lines and certificates serve --fake-cloud "
|
|
444
|
+
"wrote"
|
|
444
445
|
),
|
|
445
446
|
formatter_class=argparse.RawTextHelpFormatter,
|
|
446
447
|
epilog=(
|
|
@@ -533,102 +534,6 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
533
534
|
return p
|
|
534
535
|
|
|
535
536
|
|
|
536
|
-
def _fake_cloud_setup(app_name: str, explicit_port: int) -> "tuple[int, dict]":
|
|
537
|
-
"""Set up the local fake cloud for *app_name*.
|
|
538
|
-
|
|
539
|
-
Maps <slug>.dev.workpeg.com to 127.0.0.1 in the hosts file (sudo prompt
|
|
540
|
-
on macOS; Administrator terminal needed on Windows), creates a local TLS
|
|
541
|
-
certificate (mkcert when available, openssl self-signed otherwise), and
|
|
542
|
-
picks an HTTPS port (443 when bindable).
|
|
543
|
-
|
|
544
|
-
Returns ``(port, serve_kwargs)`` for serve_blocking. The kwargs ask for
|
|
545
|
-
a fake cloud, so the server answers this computer only and serves only
|
|
546
|
-
what its build wrote, whatever interface it binds.
|
|
547
|
-
"""
|
|
548
|
-
import subprocess
|
|
549
|
-
|
|
550
|
-
from workpeg.ui import fake_cloud
|
|
551
|
-
from workpeg.ui.serve import _format_url
|
|
552
|
-
|
|
553
|
-
# Fake-cloud binds ALL interfaces (0.0.0.0) by default, unlike plain
|
|
554
|
-
# `serve`, which stays on loopback: on macOS that is the only way a
|
|
555
|
-
# non-root process can bind a privileged port like 443, so the clean
|
|
556
|
-
# no-port URL works without sudo or an extra env var. It still answers
|
|
557
|
-
# this computer only: the server closes every other peer before TLS
|
|
558
|
-
# (serve.LoopbackTLSServer), and nothing here can turn that off. An
|
|
559
|
-
# explicit WORKPEG_BIND_HOST picks the interface. Passed through explicitly
|
|
560
|
-
# (not via os.environ) so it can't leak between runs, and given to
|
|
561
|
-
# pick_https_port so it probes the host we'll actually bind.
|
|
562
|
-
bind_host = os.environ.get("WORKPEG_BIND_HOST") or "0.0.0.0"
|
|
563
|
-
|
|
564
|
-
try:
|
|
565
|
-
domain = fake_cloud.derive_domain(app_name)
|
|
566
|
-
added = fake_cloud.ensure_hosts_entry(domain)
|
|
567
|
-
cert, key, kind = fake_cloud.ensure_certificate(domain)
|
|
568
|
-
port = explicit_port or fake_cloud.pick_https_port(bind_host=bind_host)
|
|
569
|
-
except fake_cloud.FakeCloudError as e:
|
|
570
|
-
print(f"ERROR: {shown_lines(e)}", file=sys.stderr)
|
|
571
|
-
raise SystemExit(2)
|
|
572
|
-
except subprocess.CalledProcessError as e:
|
|
573
|
-
print(f"ERROR: certificate generation failed: {shown_lines(e)}",
|
|
574
|
-
file=sys.stderr)
|
|
575
|
-
raise SystemExit(2)
|
|
576
|
-
|
|
577
|
-
# MIGRATION: the dev host used to be dev.<slug>.workpeg.com, and renaming it
|
|
578
|
-
# does not un-write anyone's hosts file. Clean the old line up here, the one
|
|
579
|
-
# place that is already editing that file with the project name in hand.
|
|
580
|
-
#
|
|
581
|
-
# Outside the try above, because a leftover line is untidy but not fatal: a
|
|
582
|
-
# cleanup we cannot complete warns and serving continues. AFTER it, because
|
|
583
|
-
# both functions slugify the same name and raise the same "cannot derive a
|
|
584
|
-
# domain" for an unusable one — pruning first printed that sentence twice,
|
|
585
|
-
# once as a WARNING about a cleanup the developer never asked for and then
|
|
586
|
-
# again as the real ERROR. Letting derive_domain reject the name first means
|
|
587
|
-
# a bad name fails once, as an error.
|
|
588
|
-
pruned = False
|
|
589
|
-
try:
|
|
590
|
-
pruned = fake_cloud.prune_legacy_hosts_entry(app_name)
|
|
591
|
-
except fake_cloud.FakeCloudError as e:
|
|
592
|
-
print(f"WARNING: {shown_lines(e)}", file=sys.stderr)
|
|
593
|
-
|
|
594
|
-
hosts_note = "added" if added else "already present"
|
|
595
|
-
tls_note = (
|
|
596
|
-
"mkcert (browser-trusted)"
|
|
597
|
-
if kind == "mkcert"
|
|
598
|
-
else "self-signed (browser will warn; install mkcert to avoid)"
|
|
599
|
-
)
|
|
600
|
-
bind_note = (
|
|
601
|
-
f"{bind_host} (every interface; answers this computer only)"
|
|
602
|
-
if bind_host == "0.0.0.0"
|
|
603
|
-
else f"{bind_host} (answers this computer only)"
|
|
604
|
-
)
|
|
605
|
-
# Through _format_url, not f"https://{domain}", so this line carries the
|
|
606
|
-
# port whenever pick_https_port could not get 443 — which is exactly when
|
|
607
|
-
# a stale server (an old-SDK process still holding 443, say) is the reason
|
|
608
|
-
# it could not. Hardcoded, this banner advertised a bare host that the new
|
|
609
|
-
# hosts entry sends to that other process: a certificate warning, then its
|
|
610
|
-
# old build, while the server this command actually started sat unvisited
|
|
611
|
-
# on 8443. Two lines of one banner disagreeing about the URL is the worst
|
|
612
|
-
# possible moment to be terse — serve.py prints the same URL just below.
|
|
613
|
-
print(f"\n Fake cloud → {_format_url(domain, port, True)}")
|
|
614
|
-
print(f" Hosts → 127.0.0.1 {domain} ({hosts_note})")
|
|
615
|
-
if pruned:
|
|
616
|
-
print(f" Migrated → removed stale {fake_cloud.legacy_domain(app_name)}")
|
|
617
|
-
print(f" TLS → {tls_note}")
|
|
618
|
-
print(f" Bind → {bind_note}")
|
|
619
|
-
_print_fake_cloud_warning(bind_host)
|
|
620
|
-
|
|
621
|
-
return port, {"ssl_cert": cert, "ssl_key": key, "url_host": domain,
|
|
622
|
-
"bind_host": bind_host, "fake_cloud": True}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
#: Bold red, and reset. Emitted only to a TTY — a redirected log or a CI
|
|
626
|
-
#: capture gets the words without the escape codes, which is the point of
|
|
627
|
-
#: checking rather than always colouring.
|
|
628
|
-
_BOLD_RED = BOLD_RED
|
|
629
|
-
_RESET = RESET
|
|
630
|
-
|
|
631
|
-
|
|
632
537
|
def _quoted(name) -> str:
|
|
633
538
|
"""A path the developer gave, as an error repeats it: quoted, or
|
|
634
539
|
escaped whole when it holds anything unprintable."""
|
|
@@ -637,56 +542,47 @@ def _quoted(name) -> str:
|
|
|
637
542
|
return _q(name)
|
|
638
543
|
|
|
639
544
|
|
|
640
|
-
def
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
return False
|
|
645
|
-
|
|
545
|
+
def _serve_dev_page(source: str, out: "str | None",
|
|
546
|
+
peg_namespace: "str | None", port: int) -> None:
|
|
547
|
+
"""``serve --fake-cloud``: a dev page at
|
|
548
|
+
``https://<namespace>.dev.workpeg.com``, built as a release is.
|
|
646
549
|
|
|
647
|
-
|
|
648
|
-
|
|
550
|
+
The checks run first and bind nothing (:mod:`workpeg.ui.devmode`); then
|
|
551
|
+
the release's build; then mkcert, the hosts line and the certificate,
|
|
552
|
+
after the build so that a build that fails changes nothing on this
|
|
553
|
+
computer (:mod:`workpeg.ui.devserve`); then port 443 behind the peer
|
|
554
|
+
check, serving only what that build wrote (:mod:`workpeg.ui.devsite`).
|
|
555
|
+
"""
|
|
556
|
+
from workpeg.ui import devmode, devserve, devsite
|
|
557
|
+
from workpeg.ui.build import PublicAssetError
|
|
558
|
+
from workpeg.ui.compiler.ast_parser import UnsupportedSyntaxError
|
|
559
|
+
from workpeg.ui.actions_manifest import ActionValidationError
|
|
560
|
+
from workpeg.ui.search_manifest import ManifestValidationError
|
|
649
561
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
562
|
+
try:
|
|
563
|
+
plan = devmode.preflight(
|
|
564
|
+
source, peg_namespace=peg_namespace, port=port,
|
|
565
|
+
environ=os.environ)
|
|
566
|
+
except devmode.DevModeRefused as refusal:
|
|
567
|
+
print(f"ERROR: {shown_lines(refusal)}", file=sys.stderr)
|
|
568
|
+
raise SystemExit(2)
|
|
654
569
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
570
|
+
out_dir = out or str(plan.entry.parent / "dist")
|
|
571
|
+
try:
|
|
572
|
+
# The release's build, whatever WORKPEG_CHROME says: the page
|
|
573
|
+
# tested is the page shipped.
|
|
574
|
+
devsite.release_build(plan.entry, out_dir)
|
|
575
|
+
except (UnsupportedSyntaxError, SyntaxError, ManifestValidationError,
|
|
576
|
+
ActionValidationError, PublicAssetError) as e:
|
|
577
|
+
print(f"ERROR: {shown_lines(e)}", file=sys.stderr)
|
|
578
|
+
raise SystemExit(2)
|
|
659
579
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
"your browser sends your Workpeg session and this build talks to the",
|
|
667
|
-
"PRODUCTION API as you. Anything it writes is written for real.",
|
|
668
|
-
# The owner's words, the same as serve --dev's, each whole on a line
|
|
669
|
-
# of its own so that it reads, and greps, as one sentence.
|
|
670
|
-
*DEV_PAGE,
|
|
671
|
-
]
|
|
672
|
-
# The line that used to say anyone on the network could open it. The
|
|
673
|
-
# server now closes every connection that is not from this computer, so
|
|
674
|
-
# a phone that opened the page before gets no answer, and this says why.
|
|
675
|
-
if bind_host == "0.0.0.0":
|
|
676
|
-
lines.append("Bound to every interface, but it answers this "
|
|
677
|
-
"computer only:")
|
|
678
|
-
else:
|
|
679
|
-
lines.append("It answers this computer only:")
|
|
680
|
-
lines.append("a phone or another computer gets no answer.")
|
|
681
|
-
|
|
682
|
-
out = sys.stderr
|
|
683
|
-
print(file=out)
|
|
684
|
-
for line in lines:
|
|
685
|
-
prefix = " ⚠ " if line is lines[0] else " "
|
|
686
|
-
if _tty():
|
|
687
|
-
print(f"{_BOLD_RED}{prefix}{line}{_RESET}", file=out)
|
|
688
|
-
else:
|
|
689
|
-
print(f"{prefix}{line}", file=out)
|
|
580
|
+
try:
|
|
581
|
+
tls = devserve.prepare(plan)
|
|
582
|
+
except devserve.DevServeRefused as refusal:
|
|
583
|
+
print(f"ERROR: {shown_lines(refusal)}", file=sys.stderr)
|
|
584
|
+
raise SystemExit(2)
|
|
585
|
+
_run_server(devserve.run, plan, out_dir, tls)
|
|
690
586
|
|
|
691
587
|
|
|
692
588
|
def _dev_clean(args) -> None:
|
|
@@ -966,28 +862,25 @@ def main(argv=None) -> None:
|
|
|
966
862
|
return
|
|
967
863
|
|
|
968
864
|
# The starter uses the SDK Scaffold, which gates on a signed-in
|
|
969
|
-
# session — a plain serve shows only the auth gate. --fake-cloud
|
|
970
|
-
#
|
|
971
|
-
if
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
print(f" workpeg ui serve {rel} --fake-cloud\n")
|
|
865
|
+
# session — a plain serve shows only the auth gate. --fake-cloud
|
|
866
|
+
# serves it as a dev page, signed in, so the sidebar + pages render.
|
|
867
|
+
if args.fake_cloud:
|
|
868
|
+
_serve_dev_page(str(project_dir), None, None, args.port)
|
|
869
|
+
return
|
|
975
870
|
|
|
976
|
-
|
|
871
|
+
print("This starter uses the Workpeg Scaffold (sidebar + auth "
|
|
872
|
+
"gate). To see the sidebar and pages, preview it with:")
|
|
873
|
+
print(f" workpeg ui serve {rel} --fake-cloud\n")
|
|
977
874
|
|
|
978
|
-
|
|
979
|
-
extra: dict = {}
|
|
980
|
-
if args.fake_cloud:
|
|
981
|
-
port, extra = _fake_cloud_setup(name, args.port)
|
|
875
|
+
from workpeg.ui.serve import serve_blocking
|
|
982
876
|
|
|
983
877
|
# Watch the whole project directory so edits to any page file trigger
|
|
984
878
|
# a recompile — not just changes to main.py.
|
|
985
879
|
_run_server(
|
|
986
880
|
serve_blocking,
|
|
987
881
|
str(project_dir / "dist"),
|
|
988
|
-
port,
|
|
882
|
+
args.port,
|
|
989
883
|
watch_source=str(project_dir),
|
|
990
|
-
**extra,
|
|
991
884
|
)
|
|
992
885
|
return
|
|
993
886
|
|
|
@@ -1017,42 +910,12 @@ def main(argv=None) -> None:
|
|
|
1017
910
|
)
|
|
1018
911
|
from workpeg.ui.serve import serve_blocking
|
|
1019
912
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
# nothing and sends nothing.
|
|
1025
|
-
try:
|
|
1026
|
-
plan = devmode.preflight(
|
|
1027
|
-
args.source, fake_cloud=args.fake_cloud,
|
|
1028
|
-
peg_namespace=args.peg_namespace, port=args.port,
|
|
1029
|
-
environ=os.environ)
|
|
1030
|
-
except devmode.DevModeRefused as refusal:
|
|
1031
|
-
print(f"ERROR: {shown_lines(refusal)}", file=sys.stderr)
|
|
1032
|
-
raise SystemExit(2)
|
|
1033
|
-
|
|
1034
|
-
out_dir = args.out or str(plan.entry.parent / "dist")
|
|
1035
|
-
try:
|
|
1036
|
-
# The release's build, not plain serve's, whatever
|
|
1037
|
-
# WORKPEG_CHROME says: the page tested is the page shipped.
|
|
1038
|
-
devsite.release_build(plan.entry, out_dir)
|
|
1039
|
-
except _BUILD_ERRORS as e:
|
|
1040
|
-
print(f"ERROR: {shown_lines(e)}", file=sys.stderr)
|
|
1041
|
-
raise SystemExit(2)
|
|
1042
|
-
|
|
1043
|
-
# mkcert, the hosts line and the certificate, after the build so
|
|
1044
|
-
# that a build that fails changes nothing on this computer. Then
|
|
1045
|
-
# port 443 on this OS's address, behind the peer check, and no
|
|
1046
|
-
# other port: nothing here reads the environment or --port.
|
|
1047
|
-
try:
|
|
1048
|
-
tls = devserve.prepare(plan)
|
|
1049
|
-
except devserve.DevServeRefused as refusal:
|
|
1050
|
-
print(f"ERROR: {shown_lines(refusal)}", file=sys.stderr)
|
|
1051
|
-
raise SystemExit(2)
|
|
1052
|
-
_run_server(devserve.run, plan, out_dir, tls)
|
|
913
|
+
# A dev page. args.dev is the hidden 0.151 alias: the same path.
|
|
914
|
+
if args.fake_cloud or args.dev:
|
|
915
|
+
_serve_dev_page(args.source, args.out, args.peg_namespace,
|
|
916
|
+
args.port)
|
|
1053
917
|
return
|
|
1054
918
|
|
|
1055
|
-
extra: dict = {}
|
|
1056
919
|
source = pathlib.Path(args.source)
|
|
1057
920
|
|
|
1058
921
|
if not source.exists():
|
|
@@ -1061,29 +924,6 @@ def main(argv=None) -> None:
|
|
|
1061
924
|
|
|
1062
925
|
port = args.port
|
|
1063
926
|
peg_ns = args.peg_namespace
|
|
1064
|
-
if args.fake_cloud:
|
|
1065
|
-
from workpeg.ui import devmode
|
|
1066
|
-
from workpeg.ui.fake_cloud import derive_app_name
|
|
1067
|
-
|
|
1068
|
-
# Before the hosts file, the certificate or a port. A folder with
|
|
1069
|
-
# no main.py would be served as it stands, hand-written HTML and
|
|
1070
|
-
# script on a .dev.workpeg.com name that holds the visitor's
|
|
1071
|
-
# session, so --fake-cloud takes only Python it builds itself,
|
|
1072
|
-
# refused in the words dev mode uses.
|
|
1073
|
-
try:
|
|
1074
|
-
devmode._source(args.source)
|
|
1075
|
-
except devmode.DevModeRefused as refusal:
|
|
1076
|
-
print(f"ERROR: {shown_lines(refusal)}", file=sys.stderr)
|
|
1077
|
-
raise SystemExit(2)
|
|
1078
|
-
|
|
1079
|
-
# --peg-namespace also picks the fake-cloud domain, so the page is
|
|
1080
|
-
# served at <namespace>.dev.workpeg.com. That matters: the runtime
|
|
1081
|
-
# resolves the namespace from the host *before* the baked <meta>, so
|
|
1082
|
-
# the domain must match or the host (e.g. the project name) would
|
|
1083
|
-
# win and the meta be ignored.
|
|
1084
|
-
port, extra = _fake_cloud_setup(
|
|
1085
|
-
peg_ns or derive_app_name(str(source)), args.port
|
|
1086
|
-
)
|
|
1087
927
|
|
|
1088
928
|
if source.is_dir():
|
|
1089
929
|
main_py = source / "main.py"
|
|
@@ -1109,16 +949,16 @@ def main(argv=None) -> None:
|
|
|
1109
949
|
# any page file also trigger a recompile.
|
|
1110
950
|
_run_server(serve_blocking, out_dir, port,
|
|
1111
951
|
watch_source=str(source),
|
|
1112
|
-
peg_namespace=peg_ns
|
|
952
|
+
peg_namespace=peg_ns)
|
|
1113
953
|
else:
|
|
1114
954
|
# No main.py — treat as a pre-built dist directory and serve
|
|
1115
|
-
# as-is, on localhost
|
|
1116
|
-
#
|
|
955
|
+
# as-is, on localhost (a dev page refuses one). There's no
|
|
956
|
+
# recompile, so --peg-namespace can't apply (the namespace
|
|
1117
957
|
# baked at build time stands).
|
|
1118
958
|
if peg_ns:
|
|
1119
959
|
print(" Note: --peg-namespace is ignored for a pre-built "
|
|
1120
960
|
"dist (rebuild to change it).", file=sys.stderr)
|
|
1121
|
-
_run_server(serve_blocking, str(source), port
|
|
961
|
+
_run_server(serve_blocking, str(source), port)
|
|
1122
962
|
|
|
1123
963
|
elif source.suffix == ".py":
|
|
1124
964
|
from workpeg.ui.build import build_ui
|
|
@@ -1136,7 +976,7 @@ def main(argv=None) -> None:
|
|
|
1136
976
|
|
|
1137
977
|
_run_server(serve_blocking, out_dir, port,
|
|
1138
978
|
watch_source=str(source),
|
|
1139
|
-
peg_namespace=peg_ns
|
|
979
|
+
peg_namespace=peg_ns)
|
|
1140
980
|
|
|
1141
981
|
else:
|
|
1142
982
|
print(
|
|
@@ -7,7 +7,7 @@ it. Printed as it is, ``ESC[2J`` clears their screen, a carriage return
|
|
|
7
7
|
writes over the line before it, a backspace rubs out what a line says, and
|
|
8
8
|
U+202E makes a name read as another. So every such string goes through
|
|
9
9
|
:func:`shown`, or :func:`shown_lines` for text of several lines, before it
|
|
10
|
-
is printed. ``workpeg ui serve --
|
|
10
|
+
is printed. ``workpeg ui serve --fake-cloud`` and the build use
|
|
11
11
|
these, and so does ``workpeg function listen``, so there is one rule.
|
|
12
12
|
|
|
13
13
|
The rule is the one the build has always used for a path: a string that is
|
|
@@ -34,8 +34,8 @@ DEVELOPMENT_ONLY = (
|
|
|
34
34
|
"This account is for development only, not the account you use for "
|
|
35
35
|
"your company.")
|
|
36
36
|
|
|
37
|
-
#: The banner of a command that serves a dev page (``serve --
|
|
38
|
-
#:
|
|
37
|
+
#: The banner of a command that serves a dev page (``serve --fake-cloud``),
|
|
38
|
+
#: each sentence whole on a line of its own.
|
|
39
39
|
DEV_PAGE = (
|
|
40
40
|
DEVELOPMENT_ONLY,
|
|
41
41
|
"Your browser gives this page your Workpeg session, with everything "
|
|
@@ -647,7 +647,7 @@ def _public_folder(source: Path) -> Path:
|
|
|
647
647
|
|
|
648
648
|
def _public_files(public: Path):
|
|
649
649
|
"""``(path, parts)`` for each file ``_copy_public`` copies. Its own
|
|
650
|
-
function so that ``serve --
|
|
650
|
+
function so that ``serve --fake-cloud``, which serves only what a build copied,
|
|
651
651
|
reads the same rule rather than a second copy of it."""
|
|
652
652
|
for path, parts in _walk_no_links(public):
|
|
653
653
|
name = os.path.basename(path)
|
|
@@ -883,8 +883,10 @@ def _check_manifest_size(text: str) -> None:
|
|
|
883
883
|
f"manifest.json is {size} bytes; the platform refuses to read one "
|
|
884
884
|
f"over {MAX_MANIFEST_BYTES}. It does not read part of it — the "
|
|
885
885
|
f"whole file is skipped, so every section in it (search, actions, "
|
|
886
|
-
f"renderers, skills) silently never arrives
|
|
887
|
-
f"
|
|
886
|
+
f"renderers, skills, summary, dev) silently never arrives, and a "
|
|
887
|
+
f"\"dev\": {{\"others\": \"deny\"}} with it lets other "
|
|
888
|
+
f"businesses' dev pages back onto this namespace. Shorten the "
|
|
889
|
+
f"longest section; skill instructions are usually what grows.")
|
|
888
890
|
|
|
889
891
|
|
|
890
892
|
def _peg_manifest(ir, namespace: str, source: Path) -> "dict | None":
|
|
@@ -926,6 +928,10 @@ def _peg_manifest(ir, namespace: str, source: Path) -> "dict | None":
|
|
|
926
928
|
summary = _summary_section(source)
|
|
927
929
|
if summary:
|
|
928
930
|
sections["summary"] = summary
|
|
931
|
+
|
|
932
|
+
dev = _dev_section(source)
|
|
933
|
+
if dev:
|
|
934
|
+
sections["dev"] = dev
|
|
929
935
|
# Future sections slot in here, each read from its own workpeg.json block.
|
|
930
936
|
|
|
931
937
|
if not sections:
|
|
@@ -1006,6 +1012,60 @@ def _summary_section(source: Path) -> "str | None":
|
|
|
1006
1012
|
return text
|
|
1007
1013
|
|
|
1008
1014
|
|
|
1015
|
+
#: Who may run a dev page on this Peg's label, besides its owner: the one
|
|
1016
|
+
#: key the ``dev`` section has, and the only two words it takes.
|
|
1017
|
+
DEV_KEYS = ("others",)
|
|
1018
|
+
DEV_OTHERS = ("allow", "deny")
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
def _dev_section(source: Path) -> "dict | None":
|
|
1022
|
+
"""The Peg's ``dev`` section: whether other businesses may run a dev
|
|
1023
|
+
page (``https://<namespace>.dev.workpeg.com``) on this Peg's label.
|
|
1024
|
+
|
|
1025
|
+
``{"others": "allow"}`` or ``{"others": "deny"}``. The owner's own
|
|
1026
|
+
business is never refused by it. With no section, others are allowed.
|
|
1027
|
+
|
|
1028
|
+
**Exact words, closed key set, refused at build.** The registry reads
|
|
1029
|
+
this from the uploaded ``manifest.json`` and counts anything it cannot
|
|
1030
|
+
read as ``deny``, so a typo would quietly close the Peg to everyone
|
|
1031
|
+
else. Failing here says so where the author can fix it. Nothing is
|
|
1032
|
+
normalised: ``"Deny"`` and ``" deny"`` are refused, not guessed at.
|
|
1033
|
+
"""
|
|
1034
|
+
from workpeg.ui.search_manifest import ManifestValidationError
|
|
1035
|
+
|
|
1036
|
+
config_path = _find_peg_config(source)
|
|
1037
|
+
if config_path is None:
|
|
1038
|
+
return None
|
|
1039
|
+
try:
|
|
1040
|
+
data = json.loads(config_path.read_text(encoding="utf-8"))
|
|
1041
|
+
except (OSError, ValueError):
|
|
1042
|
+
# Reported by _search_section, which reads the same file.
|
|
1043
|
+
return None
|
|
1044
|
+
if not isinstance(data, dict) or "dev" not in data:
|
|
1045
|
+
return None
|
|
1046
|
+
value = data["dev"]
|
|
1047
|
+
shape = ('"dev" must be {"others": "allow"} or {"others": "deny"}')
|
|
1048
|
+
if not isinstance(value, dict):
|
|
1049
|
+
raise ManifestValidationError(
|
|
1050
|
+
f"{config_path}: {shape}, an object; got "
|
|
1051
|
+
f"{type(value).__name__}.")
|
|
1052
|
+
unknown = sorted(str(k) for k in value if k not in DEV_KEYS)
|
|
1053
|
+
if unknown:
|
|
1054
|
+
raise ManifestValidationError(
|
|
1055
|
+
f"{config_path}: {shape}. Unknown key(s) {unknown}; "
|
|
1056
|
+
f'"others" is the only key.')
|
|
1057
|
+
if "others" not in value:
|
|
1058
|
+
raise ManifestValidationError(
|
|
1059
|
+
f'{config_path}: {shape}. "others" is missing; leave the whole '
|
|
1060
|
+
f'"dev" section out to allow others.')
|
|
1061
|
+
others = value["others"]
|
|
1062
|
+
if not isinstance(others, str) or others not in DEV_OTHERS:
|
|
1063
|
+
raise ManifestValidationError(
|
|
1064
|
+
f'{config_path}: {shape}. "others" is {others!r}; it takes '
|
|
1065
|
+
f'exactly "allow" or "deny", in lower case.')
|
|
1066
|
+
return {"others": others}
|
|
1067
|
+
|
|
1068
|
+
|
|
1009
1069
|
def _actions_section(source: Path) -> "list | None":
|
|
1010
1070
|
"""The Peg's ``actions`` manifest section, from ``workpeg.json``.
|
|
1011
1071
|
|
|
@@ -1121,7 +1181,7 @@ def _find_peg_config(source: Path, *, warn: bool = True) -> "Path | None":
|
|
|
1121
1181
|
# and the developer who wrote it has no other way to find out.
|
|
1122
1182
|
#
|
|
1123
1183
|
# ``warn=False`` is for a caller that only needs the answer and is not the
|
|
1124
|
-
# build: ``serve --
|
|
1184
|
+
# build: ``serve --fake-cloud``'s checks read the namespace before building, and
|
|
1125
1185
|
# a refusal there is one line. The build that follows still says it.
|
|
1126
1186
|
stray = here.parent.parent / "workpeg.json"
|
|
1127
1187
|
if warn and stray.is_file() and (
|
|
@@ -233,10 +233,10 @@ def create_ui_project(
|
|
|
233
233
|
└── dist/ ← compiled output
|
|
234
234
|
|
|
235
235
|
The app uses the SDK ``Scaffold``, so it renders behind an auth gate:
|
|
236
|
-
run it signed in with ``workpeg ui serve <name> --
|
|
237
|
-
release build at ``https://<namespace>.dev.workpeg.com``
|
|
238
|
-
computer for a dev install (docs/dev-install.md), rather than
|
|
239
|
-
static serve.
|
|
236
|
+
run it signed in with ``workpeg ui serve <name> --fake-cloud``, which
|
|
237
|
+
serves the release build at ``https://<namespace>.dev.workpeg.com``
|
|
238
|
+
from this computer for a dev install (docs/dev-install.md), rather than
|
|
239
|
+
a bare static serve.
|
|
240
240
|
|
|
241
241
|
Raises ProjectExistsError if the project directory already exists
|
|
242
242
|
and force is False.
|