Sample workspaces for Stuga. Each one is a workspace archive,
unzipped: the files of a .stuga.zip, as
docs/workspace-archive.md
describes them.
Each release of this repository carries every sample as <id>.stuga.zip, and lists them in
index.json. When someone creates a workspace, their node offers the samples that index.json in
the latest release lists, and checks the archive it downloads against the SHA-256 and size listed
there. A new release changes what nodes offer; a workspace already created from a sample never
changes.
samples/<id>/ a workspace archive, unzipped
samples/<id>.json its listing: what index.json says of it, and its sources
scripts/check.mjs checks every sample
scripts/build.mjs zips every sample into dist/ and writes dist/index.json
scripts/python-specs.mjs writes python-specs from the PEP index and python/peps
scripts/team-handbook.mjs writes team-handbook from 18F Guides
scripts/market-research.mjs writes market-research from World Bank data
scripts/privacy-laws.mjs writes privacy-laws around the documents in its Laws/ folder
scripts/laws/<law>.mjs writes one of those documents from the law's official source
scripts/markdown.mjs the Markdown writer the four sample scripts share
The scripts need Node 22.2 or later. To fetch, scripts/laws/uae-pdpl.mjs also needs Playwright and Google Chrome.
<id> is 1 to 40 of a-z, 0-9 and -, starting with a letter or digit. samples/<id>.json
holds:
| Field | Value |
|---|---|
title |
Up to 60 characters. |
description |
Up to 60 characters: one short line under the title. |
langs |
The languages of its text, as primary language tags: en, zh. |
position |
Its place in the list of samples, from 1. |
sources_doc |
The path of its Sources document in the archive. |
sources |
Each {title, url, license, retrieved}: where third-party material comes from, its licence, and the day it was fetched, YYYY-MM-DD. The Sources document links each url. |
The new workspace's name is workspace.name in the sample's stuga.json. license is one of:
license |
Meaning |
|---|---|
CC0-1.0 |
Creative Commons Zero 1.0 |
CC-BY-4.0 |
Creative Commons Attribution 4.0 |
LicenseRef-public-domain |
Placed in the public domain by its author |
LicenseRef-official-text |
An official text that its country's copyright law does not protect |
LicenseRef-eu-reuse |
Reuse allowed with acknowledgement, Commission Decision 2011/833/EU |
A sample that a script writes is changed in the script: run it, then go on from step 6.
- Build or edit the workspace in Stuga.
- Export it: Settings → This workspace → General → Export workspace.
- Unzip it into
samples/<id>/, replacing what was there:rm -rf samples/<id> && unzip -q <file>.stuga.zip -d samples/<id>. - Add
startto itsstuga.json, the path of its Start here document, which the new workspace opens at, andsample.steps: what Sample agent proposes after an import (Sample steps). An export has neither, so carry both over wheneverstuga.jsonis replaced. - Write or update
samples/<id>.json. - Check it:
node scripts/check.mjs. With--stuga <dir>, a checkout of stuga-dev/stuga afterpnpm install, it also runsstuga-node archive checkon each sample, which reads every body, row, link, image and step as an import would:node scripts/check.mjs --stuga ../stuga. - Open a pull request. A reviewer checks its facts and legal summaries against the sources.
- Once it is merged, bring your
mainup to date and tag it with the day:git switch main && git pull --ff-only, thengit tag -a vYYYY.MM.DD -m vYYYY.MM.DD && git push origin vYYYY.MM.DD, orvYYYY.MM.DD.Nfor another release that day. The release workflow checks and builds every sample, then publishes the archives andindex.jsonas that tag's release. A published release never changes: a fix is a new tag. Since nodes read the latest release, a tag older than the newest is refused, and so is one on any commit but main's newest.
What Stuga wrote here, sample text, scripts and workflows, is dedicated to the public domain under CC0-1.0. Third-party material in a sample keeps its own terms: the sample's Sources document lists its sources and their terms, and its listing names each licence. Naming a source implies no endorsement by it.