Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51a60ee75e | ||
|
|
96cb866d5c |
No files matched your search
@@ -3,6 +3,12 @@
|
||||
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
||||
until 1.0, minor versions may contain breaking changes.
|
||||
|
||||
## [v202611-00068] – 2026-11-20
|
||||
|
||||
### Added
|
||||
|
||||
- **Test runner: `"isolated": false` in `.factory/setup.json`** for apps that cannot run in a container (a native window, a library) – acceptance starts them itself, as before. `ready_seconds` sets how long the runner waits for the port. Free text after the `url` (e.g. `http://localhost:8080 (trunk serve)`) no longer confuses the port detection.
|
||||
|
||||
## [v202611-00067] – 2026-11-20
|
||||
|
||||
### Added
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img alt="Version v202611-00067" src="https://img.shields.io/badge/version-v202611--00067-d69e2e?style=flat-square">
|
||||
<img alt="Version v202611-00068" src="https://img.shields.io/badge/version-v202611--00068-d69e2e?style=flat-square">
|
||||
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-689d6a?style=flat-square">
|
||||
<img alt="Rust backend" src="https://img.shields.io/badge/backend-Rust-b7410e?style=flat-square&logo=rust">
|
||||
<img alt="React PWA" src="https://img.shields.io/badge/frontend-React%20PWA-2d81ff?style=flat-square&logo=react">
|
||||
|
||||
@@ -1642,7 +1642,7 @@ How to work:
|
||||
5. Also keep the file `setup.json` in your working directory: it tells the acceptance stage how to start the finished app, so the app can be checked by looking at it. Once the tech stack is settled write it, and update it when the stack changes. Format (one JSON object, all values strings, no comments):
|
||||
`{"install": "optional one-off setup command, e.g. npm ci", "start": "command that runs the app in the foreground", "url": "where it listens, e.g. http://localhost:8080"}`
|
||||
Ask the user for the port and commands if the spec leaves them open. A static site may use e.g. `"start": "python3 -m http.server 8080"`. Without a start command acceptance has to guess, so do not skip this file for anything that runs.
|
||||
Acceptance may run the app in a fresh throw-away container: then add `"image"` (a Docker image that has the toolchain for install/start, e.g. `node:22-bookworm`, `python:3.12`, `golang:1.23`) and, if the app needs a database or similar, `"services": {"db": {"image": "postgres:16", "env": {"POSTGRES_PASSWORD": "app"}}}` (reachable under the name `db`). Never write secrets there.
|
||||
Acceptance may run the app in a fresh throw-away container: then add `"image"` (a Docker image that has the toolchain for install/start, e.g. `node:22-bookworm`, `python:3.12`, `golang:1.23`) and, if the app needs a database or similar, `"services": {"db": {"image": "postgres:16", "env": {"POSTGRES_PASSWORD": "app"}}}` (reachable under the name `db`). Use `"ready_seconds"` for apps that need long to install and start. The app must listen on 0.0.0.0, not only 127.0.0.1. For something that cannot run in a container (a native desktop window, a library) set `"isolated": false`. Never write secrets there.
|
||||
6. When the user says the spec is done, propose a short project name and a repository slug (lowercase, digits and dashes) and end your message with exactly one fenced json block and nothing after it:
|
||||
```json
|
||||
{"decision": "ready", "name": "Project name", "slug": "project-name", "description": "one sentence"}
|
||||
|
||||
@@ -75,6 +75,10 @@ pub struct Started {
|
||||
/// Parse `.factory/setup.json` into a request (without `work`). `None` when there is nothing to start.
|
||||
pub fn parse_setup(text: &str) -> Option<StartReq> {
|
||||
let v: Value = serde_json::from_str(text).ok()?;
|
||||
// `"isolated": false`: the app cannot run in a container (e.g. a native window); acceptance starts it itself.
|
||||
if v["isolated"].as_bool() == Some(false) {
|
||||
return None;
|
||||
}
|
||||
let start = v["start"].as_str()?.trim().to_string();
|
||||
if start.is_empty() {
|
||||
return None;
|
||||
@@ -111,8 +115,9 @@ pub fn parse_setup(text: &str) -> Option<StartReq> {
|
||||
|
||||
/// Port of `http://host:1234/path` (80/443 by scheme when missing).
|
||||
pub fn port_of(url: &str) -> Option<u16> {
|
||||
let (scheme, rest) = url.split_once("://")?;
|
||||
let host = rest.split('/').next()?;
|
||||
let (scheme, rest) = url.trim().split_once("://")?;
|
||||
// Free text after the URL ("http://localhost:8080 (trunk serve)") is ignored.
|
||||
let host = rest.split(|c: char| c == '/' || c.is_whitespace()).next()?;
|
||||
match host.rsplit_once(':') {
|
||||
Some((_, p)) if p.chars().all(|c| c.is_ascii_digit()) && !p.is_empty() => p.parse().ok(),
|
||||
_ => Some(if scheme == "https" { 443 } else { 80 }),
|
||||
@@ -548,6 +553,8 @@ mod tests {
|
||||
assert_eq!(port_of("http://localhost"), Some(80));
|
||||
assert_eq!(port_of("https://x/y"), Some(443));
|
||||
assert_eq!(port_of("nonsense"), None);
|
||||
assert_eq!(port_of("http://localhost:8080 (web build: trunk serve)"), Some(8080));
|
||||
assert!(parse_setup(r#"{"start":"x","port":1,"isolated":false}"#).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
||||
*/
|
||||
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
||||
"202611-00068": {
|
||||
en: ["Test runner: \"isolated\": false in .factory/setup.json for apps that cannot run in a container"],
|
||||
de: ["Test-Runner: \"isolated\": false in .factory/setup.json für Apps, die nicht im Container laufen können"],
|
||||
},
|
||||
"202611-00067": {
|
||||
en: ["Factory: acceptance runs can use throw-away containers (optional test runner service) for the app and helper services such as a database"],
|
||||
de: ["Factory: Abnahmeläufe können Wegwerf-Container nutzen (optionaler Test-Runner-Dienst) für die App und Hilfsdienste wie eine Datenbank"],
|
||||
|
||||
Reference in new issue
Block a user