Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/docs-dispatch.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Update the help center

# The Hub help center (CompositeCode/substratalapps-applications-specs → /help/) is the one documentation reference
# The Hub help center (CompositeCode/substratal-hub-interface-specs → https://specs.substratalapps.com/help/) is the one documentation reference
# for every Hub app. When this app's code, screen registry or docs change on main, ask the help center to rebuild,
# so its Windows pages, screen pages and "What's new" reflect what shipped. See help/README.md → Automation there.
#
# Needs the secret SPECS_DOCS_TOKEN: a fine-grained token with Contents: read and write on
# CompositeCode/substratalapps-applications-specs. Without it, this job says so and succeeds.
# CompositeCode/substratal-hub-interface-specs. Without it, this job says so and succeeds.
on:
push:
branches: [main]
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
fi
version=$(sed -n 's:.*<VersionPrefix>\(.*\)</VersionPrefix>.*:\1:p' Directory.Build.props)
contract=$(grep -m1 -E '^\s+version:' api/openapi.yaml | awk '{print $2}' | tr -d '"')
gh api repos/CompositeCode/substratalapps-applications-specs/dispatches \
gh api repos/CompositeCode/substratal-hub-interface-specs/dispatches \
-f event_type=app-docs-updated \
-F 'client_payload[app]=windows' \
-F "client_payload[sha]=$GITHUB_SHA" \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ The Windows edition of the **Substratal Hub**, the client for the [Substratal Ap
|---|---|
| Stack | WinUI 3 on the Windows App SDK 2.x, C# / .NET 10, MVVM (CommunityToolkit.Mvvm), MSIX |
| API | `https://api.substratalapps.com` with `Substratal-Version: 1` (see [API versioning](#api-versioning)) |
| Specs | [Hub application specs](https://compositecode.github.io/substratalapps-applications-specs/platforms/windows.html): `windows/PLATFORM-SPEC.md`, `windows/SCREENS.md`, `shared/*` |
| Help center | [Substratal Hub help](https://compositecode.github.io/substratalapps-applications-specs/help/), the documentation every Hub app links to |
| Specs | [Hub interface specifications](https://specs.substratalapps.com/platforms/windows.html): `windows/PLATFORM-SPEC.md`, `windows/SCREENS.md`, `00-shared/*` |
| Help center | [Substratal Hub help](https://specs.substratalapps.com/help/), the documentation every Hub app links to |
| Plans | [docs/PLAN.md](docs/PLAN.md) (the app) · [docs/API-GAPS.md](docs/API-GAPS.md) (what the API still needs) |

## Status
Expand Down
2 changes: 1 addition & 1 deletion docs/PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Three things changed between 2026-10-21 and 2026-10-23. Where this page and the
Sources this plan is built on (read 2026-10-21):

- API spec: <https://compositecode.github.io/substratalapps.com/> (`openapi.yaml` 1.0.0-draft.3, 118 operations) and the API repo (`CompositeCode/substratalapps.com`, branch `main`, including `plan-remaining.md`, `infra/README.md`, and the Go source).
- UI specs: <https://compositecode.github.io/substratalapps-applications-specs/> (`windows/PLATFORM-SPEC.md`, `windows/SCREENS.md`, `00-shared/*`).
- UI specs: <https://specs.substratalapps.com/> (`windows/PLATFORM-SPEC.md`, `windows/SCREENS.md`, `00-shared/*`).
- Production: `GET https://api.substratalapps.com/health` returns `200 {"status":"ok"}`; JWKS is published.

---
Expand Down
25 changes: 16 additions & 9 deletions scripts/gen-from-spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"""Generate C# from the Hub specs, so the app can't drift from them.

windows/SCREENS.md -> src/Substratal.Hub.Core/Navigation/ScreenCatalog.g.cs (all 75 screens)
windows/shared/COPY-AND-STATES -> src/Substratal.Hub.Core/Api/ErrorCopy.g.cs (error code -> message)
00-shared/COPY-AND-STATES -> src/Substratal.Hub.Core/Api/ErrorCopy.g.cs (error code -> message)

Source of truth: CompositeCode/substratalapps-applications-specs. By default the files are read from GitHub (main).
Set SPECS_DIR to a local checkout of that repository to read them from disk.
Source of truth: the Hub specs, published at https://specs.substratalapps.com/spec/ (the same paths as specs/ in
CompositeCode/substratal-hub-interface-specs, which is private). By default the files are read from the published
site, which needs no token. Set SPECS_URL to read another build of the site, or SPECS_DIR to a local checkout of the
specs repository to read them from disk.

python3 scripts/gen-from-spec.py
SPECS_DIR=../substratalapps-applications-specs python3 scripts/gen-from-spec.py
Expand All @@ -17,7 +19,9 @@
import sys
import urllib.request

RAW = "https://raw.githubusercontent.com/CompositeCode/substratalapps-applications-specs/main/substratal-application-specs/"
SPECS_URL = os.environ.get("SPECS_URL", "https://specs.substratalapps.com/spec/").rstrip("/") + "/"
# The package directory in a checkout of the specs repository: specs/ (substratal-application-specs/ before 2.0.0).
PACKAGE_DIRS = ("specs", "substratal-application-specs")
CORE = os.path.join(os.path.dirname(__file__), "..", "src", "Substratal.Hub.Core")
SCREENS_OUT = os.path.join(CORE, "Navigation", "ScreenCatalog.g.cs")
COPY_OUT = os.path.join(CORE, "Api", "ErrorCopy.g.cs")
Expand All @@ -26,9 +30,12 @@
def load(rel: str) -> str:
specs = os.environ.get("SPECS_DIR")
if specs:
with open(os.path.join(specs, "substratal-application-specs", *rel.split("/")), encoding="utf-8") as f:
package = next((d for d in PACKAGE_DIRS if os.path.isdir(os.path.join(specs, d))), None)
if package is None:
raise SystemExit(f"SPECS_DIR={specs} has no {' or '.join(d + '/' for d in PACKAGE_DIRS)}")
with open(os.path.join(specs, package, *rel.split("/")), encoding="utf-8") as f:
return f.read()
with urllib.request.urlopen(RAW + rel, timeout=30) as r:
with urllib.request.urlopen(SPECS_URL + rel, timeout=30) as r:
return r.read().decode("utf-8")


Expand Down Expand Up @@ -69,7 +76,7 @@ def screens() -> str:

lines = [
"// <auto-generated>",
"// Generated by scripts/gen-screens.py from substratal-application-specs/windows/SCREENS.md.",
"// Generated by scripts/gen-from-spec.py from the Hub specs' windows/SCREENS.md.",
"// Don't edit by hand: change the spec, then regenerate.",
"// </auto-generated>",
"#nullable enable",
Expand All @@ -89,7 +96,7 @@ def screens() -> str:


def errors() -> str:
md = load("windows/shared/COPY-AND-STATES.md")
md = load("00-shared/COPY-AND-STATES.md")
section = md.split("## Error code → message", 1)[1].split("\n## ", 1)[0]
rows = []
for line in section.splitlines():
Expand All @@ -100,7 +107,7 @@ def errors() -> str:
raise SystemExit(f"Only parsed {len(rows)} error codes; COPY-AND-STATES.md format changed?")
lines = [
"// <auto-generated>",
"// Generated by scripts/gen-from-spec.py from substratal-application-specs/windows/shared/COPY-AND-STATES.md",
"// Generated by scripts/gen-from-spec.py from the Hub specs' 00-shared/COPY-AND-STATES.md",
"// (\"Error code → message\"). Don't edit by hand: change the spec, then regenerate.",
"// </auto-generated>",
"#nullable enable",
Expand Down
6 changes: 4 additions & 2 deletions scripts/gen-msix-assets.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generates the MSIX visual assets (src/Substratal.Hub/Assets/*.png) from the brand SVG masters in
// substratal-application-specs/windows/brand-assets/svg, following PLATFORM-SPEC §4b:
// the specs package's windows/brand-assets/svg, following PLATFORM-SPEC §4b:
// - plated tiles use the tint surface #E8E8F7 so they read on light and dark Start;
// - unplated taskbar icons switch palette by theme (altform-unplated = dark taskbar, altform-lightunplated = light);
// - 16–24 px use the small mark.
Expand All @@ -11,7 +11,9 @@ import path from 'node:path';
import sharp from 'sharp';

const SPECS = process.env.SPECS_DIR ?? '../substratalapps-applications-specs';
const SVG = path.join(SPECS, 'substratal-application-specs/windows/brand-assets/svg');
// The package directory in a checkout of the specs repository: specs/ (substratal-application-specs/ before 2.0.0).
const PACKAGE = ['specs', 'substratal-application-specs'].find((d) => fs.existsSync(path.join(SPECS, d))) ?? 'specs';
const SVG = path.join(SPECS, PACKAGE, 'windows/brand-assets/svg');
const OUT = path.join(import.meta.dirname, '../src/Substratal.Hub/Assets');
const TINT = '#E8E8F7';
const svg = (name) => fs.readFileSync(path.join(SVG, `${name}.svg`));
Expand Down
18 changes: 17 additions & 1 deletion src/Substratal.Hub.Core/Api/ErrorCopy.g.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// Generated by scripts/gen-from-spec.py from substratal-application-specs/windows/shared/COPY-AND-STATES.md
// Generated by scripts/gen-from-spec.py from the Hub specs' 00-shared/COPY-AND-STATES.md
// ("Error code → message"). Don't edit by hand: change the spec, then regenerate.
// </auto-generated>
#nullable enable
Expand Down Expand Up @@ -50,6 +50,22 @@ public static partial class ErrorCopy
["method_not_allowed"] = (405, "Something went wrong on our side. Request ID {id} (client bug: log `details.allowed`)"),
["api_version_required"] = (400, "Something went wrong on our side. Request ID {id} (client bug: the request skipped the version header)"),
["unsupported_api_version"] = (400, "This version of Substratal is no longer supported. Update to keep going. Update (GLB-03 Update required)"),
["application_retired"] = (409, "{app} is retired, so nothing new can be added to it."),
["invalid_review_transition"] = (409, "Only approved or suspended applications can be retired."),
["live_mode_required"] = (403, "Retiring a live application needs a live-mode sign-in."),
["application_not_deletable"] = (409, "Only test-mode applications can be deleted. Retire it instead."),
["application_in_use"] = (409, "This application is still used by {references}. Remove those first."),
["invalid_image"] = (422, "That image can't be used: {reason}. Use a PNG, JPEG or WebP under {max} MB."),
["upload_not_found"] = (404, "That upload expired. Choose the image again."),
["passkey_not_registered"] = (404, "That passkey isn't set up for your account."),
["passkey_already_registered"] = (409, "This passkey is already on your account."),
["passkey_limit_reached"] = (409, "You have 10 passkeys, the most allowed. Remove one first."),
["passkey_not_found"] = (404, "This passkey was already removed."),
["recent_sign_in_required"] = (403, "Sign in again to turn on two-step verification."),
["access_tier_reserved"] = (422, "Standard is only for Substratal's own apps. Choose Free or Invite only."),
["application_not_available"] = (409, "You can change who gets in only while the app is approved or in review."),
["delivery_not_found"] = (404, "This delivery is older than 30 days, or isn't on this webhook."),
["unknown_permission"] = (422, "{key} isn't one of this application's permissions."),
["scim_token_not_found"] = (404, "(not an error: ORG-08 shows the \"Not set up\" state below)"),
["not_implemented"] = (501, "(never shown — the feature is hidden behind its flag)"),
["service_unavailable"] = (503, "Substratal is briefly unavailable. Retrying in {n}s."),
Expand Down
4 changes: 2 additions & 2 deletions src/Substratal.Hub.Core/Help/HelpLinks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ namespace Substratal.Hub.Core.Help;

/// <summary>
/// Links into the Substratal Hub help center, the one documentation reference every Hub app shares. It's built from
/// CompositeCode/substratalapps-applications-specs (<c>help/</c> and <c>site/help.mjs</c>) and rebuilt whenever this
/// CompositeCode/substratal-hub-interface-specs (<c>help/</c> and <c>site/help.mjs</c>) and rebuilt whenever this
/// repository merges to main (<c>.github/workflows/docs-dispatch.yml</c>).
/// </summary>
public static class HelpLinks
{
public static Uri Root { get; } = new("https://compositecode.github.io/substratalapps-applications-specs/help/");
public static Uri Root { get; } = new("https://specs.substratalapps.com/help/");

/// <summary>The page behind each screen's <b>?</b> button: generated per screen, IDs lower-cased.</summary>
public static Uri ForScreen(string screenId) => new(Root, $"screens/{screenId.ToLowerInvariant()}.html");
Expand Down
Loading
Loading