diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6385057..ddcf922 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -56,15 +56,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- - uses: actions/checkout@v7
- with:
- repository: CompositeCode/substratalapps-applications-specs
- path: _specs
- - uses: actions/setup-node@v7
- with:
- node-version: 22
- - name: Build the help center
- working-directory: _specs
- run: npm ci && npm run build
+ # The published help center: the specs repository is private, so this
+ # public repository's token can't check it out and build it.
- name: Check every screen page and Help menu link
- run: ruby scripts/help-check.rb _specs/_site/help
+ run: ruby scripts/help-check.rb https://specs.substratalapps.com/help/
diff --git a/.github/workflows/docs-dispatch.yml b/.github/workflows/docs-dispatch.yml
index b2e932c..6e712ee 100644
--- a/.github/workflows/docs-dispatch.yml
+++ b/.github/workflows/docs-dispatch.yml
@@ -1,10 +1,10 @@
-# Tells the shared Hub help center (CompositeCode/substratalapps-applications-specs)
+# Tells the shared Hub help center (CompositeCode/substratal-hub-interface-specs)
# that this app changed, so it rebuilds and republishes straight away instead of
# waiting for its daily build. That help center is this app's documentation:
# every Help menu item and screen page the app opens lives there (HelpLinks.swift).
#
# Needs the secret SPECS_DOCS_TOKEN: a fine-grained token with Contents: read
-# and write on substratalapps-applications-specs (see that repo's help/README.md
+# and write on substratal-hub-interface-specs (see that repo's help/README.md
# → Automation). Without it, this job skips with a notice and the help center
# still picks changes up on its daily schedule.
name: Docs dispatch
@@ -31,7 +31,7 @@ jobs:
echo "::notice::SPECS_DOCS_TOKEN isn't set; the help center will rebuild on its daily schedule."
exit 0
fi
- 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]=macos' \
-F "client_payload[sha]=$GITHUB_SHA"
diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml
index 17104c1..8519c95 100644
--- a/.github/workflows/upstream-sync.yml
+++ b/.github/workflows/upstream-sync.yml
@@ -1,6 +1,6 @@
# Keeps the app in step with its two upstreams:
# - the Platform API's openapi.yaml (CompositeCode/substratalapps.com, main = production)
-# - the macOS screen inventory (CompositeCode/substratalapps-applications-specs)
+# - the macOS screen inventory (the Hub specs, published at https://specs.substratalapps.com/spec/)
#
# When either changed, it opens (or updates) one pull request with the new
# vendored spec and screen catalog. CI then has to build the app's generated
@@ -38,16 +38,11 @@ jobs:
# so the sync PR is checked like any other.
token: ${{ secrets.SYNC_TOKEN || github.token }}
- - uses: actions/checkout@v7
- with:
- repository: CompositeCode/substratalapps-applications-specs
- path: _specs
-
- name: Pull the API spec and the screen catalog
id: sync
run: |
api=$(scripts/sync-openapi.sh)
- ruby scripts/import-screens.rb _specs
+ ruby scripts/import-screens.rb https://specs.substratalapps.com/spec/
echo "api=$api" >> "$GITHUB_OUTPUT"
if git diff --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
@@ -73,7 +68,7 @@ jobs:
Automated sync from upstream.
- Platform API \`openapi.yaml\`: **${API}** (from \`CompositeCode/substratalapps.com@main\`)
- - Screen catalog: re-imported from \`CompositeCode/substratalapps-applications-specs\`
+ - Screen catalog: re-imported from \`https://specs.substratalapps.com/spec/macos/SCREENS.md\`
CI rebuilds the generated client against the new spec and checks the app's Help links. Before merging:
- Breaking changes ship as a new \`Substratal-Version\`. If \`components.parameters.ApiVersion\` gained a value, moving to it is a deliberate code change (\`APIVersion.current\`), not part of this PR.
diff --git a/App/Resources/Info.plist b/App/Resources/Info.plist
index ab8dece..e5fe34c 100644
--- a/App/Resources/Info.plist
+++ b/App/Resources/Info.plist
@@ -34,6 +34,6 @@
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
SubstratalHelpBaseURL
- https://compositecode.github.io/substratalapps-applications-specs/help/
+ https://specs.substratalapps.com/help/
diff --git a/App/Screens/ScreenPlaceholder.swift b/App/Screens/ScreenPlaceholder.swift
index 74ffbca..d4f3d09 100644
--- a/App/Screens/ScreenPlaceholder.swift
+++ b/App/Screens/ScreenPlaceholder.swift
@@ -53,7 +53,7 @@ struct ScreenPlaceholder: View {
}
private var specURL: URL {
- URL(string: "https://compositecode.github.io/substratalapps-applications-specs/spec/macos/SCREENS.html")!
+ URL(string: "https://specs.substratalapps.com/spec/macos/SCREENS.html")!
}
@ViewBuilder
diff --git a/Makefile b/Makefile
index 45486f4..12b9f47 100644
--- a/Makefile
+++ b/Makefile
@@ -33,14 +33,11 @@ ui-test: project ## UI smoke tests (needs Accessibility permission for Xcode)
sync-api: ## Vendor the latest openapi.yaml from the API repo's main
scripts/sync-openapi.sh
-sync-screens: ## Re-import the screen catalog from ../substratalapps-applications-specs
+sync-screens: ## Re-import the screen catalog from https://specs.substratalapps.com/spec/
ruby scripts/import-screens.rb
-SPECS ?= ../substratalapps-applications-specs
-
-help-check: ## Check the app's Help links against a fresh build of the Hub help center in SPECS
- cd $(SPECS) && npm ci --silent && npm run build
- ruby scripts/help-check.rb $(SPECS)/_site/help
+help-check: ## Check the app's Help links against https://specs.substratalapps.com/help/
+ ruby scripts/help-check.rb
check: test build help-check ## Everything CI runs
diff --git a/Packages/SubstratalKit/Sources/SubstratalKit/Help/HelpLinks.swift b/Packages/SubstratalKit/Sources/SubstratalKit/Help/HelpLinks.swift
index d5c95e2..8ccbfc5 100644
--- a/Packages/SubstratalKit/Sources/SubstratalKit/Help/HelpLinks.swift
+++ b/Packages/SubstratalKit/Sources/SubstratalKit/Help/HelpLinks.swift
@@ -2,13 +2,13 @@ import Foundation
/// Links into the Substratal Hub help center, the one documentation reference
/// every Hub app shares. It's built from the specs repository
-/// (`CompositeCode/substratalapps-applications-specs`, `help/` and
-/// `site/help.mjs`) and published at `…/substratalapps-applications-specs/help/`.
+/// (`CompositeCode/substratal-hub-interface-specs`, `help/` and
+/// `site/help.mjs`) and published at `https://specs.substratalapps.com/help/`.
/// Every screen has a page at `screens/.html`, generated from the same
/// spec this app's screen catalog is imported from. CI checks that every link
/// here exists in a fresh build of that site (`scripts/help-check.rb`).
public struct HelpLinks: Sendable {
- public static let defaultBase = URL(string: "https://compositecode.github.io/substratalapps-applications-specs/help/")!
+ public static let defaultBase = URL(string: "https://specs.substratalapps.com/help/")!
public let base: URL
diff --git a/Packages/SubstratalKit/Sources/SubstratalKit/Resources/screens.json b/Packages/SubstratalKit/Sources/SubstratalKit/Resources/screens.json
index 4982bcd..2340c70 100644
--- a/Packages/SubstratalKit/Sources/SubstratalKit/Resources/screens.json
+++ b/Packages/SubstratalKit/Sources/SubstratalKit/Resources/screens.json
@@ -1,6 +1,6 @@
{
- "_generated": "by scripts/import-screens.rb from substratalapps-applications-specs/macos/SCREENS.md; edit the spec, then re-run",
- "spec": "Substratal Apps Platform API v1.8.0 (openapi 1.0.0-draft.9; send `Substratal-Version: 1` on every request, no `/v1` in paths) — https://compositecode.github.io/substratalapps.com/",
+ "_generated": "by scripts/import-screens.rb from the Hub specs' macos/SCREENS.md (https://specs.substratalapps.com/spec/); edit the spec, then re-run",
+ "spec": "Substratal Apps Platform API, `openapi.yaml` 1.0.0-draft.33 (API docs v1.9.2; send `Substratal-Version: 1` on every request, no `/v1` in paths) — https://compositecode.github.io/substratalapps.com/",
"screens": [
{
"id": "AUTH-01",
@@ -20,7 +20,7 @@
"archetype": "auth",
"phase": "MVP",
"audience": "Holder of mfa_token",
- "purpose": "Complete sign-in with a TOTP code or a recovery code."
+ "purpose": "Complete sign-in with a passkey, a TOTP code or a recovery code."
},
{
"id": "AUTH-03",
@@ -128,7 +128,7 @@
"archetype": "wizard",
"phase": "MVP",
"audience": "Self",
- "purpose": "Enroll an authenticator app (TOTP) and save recovery codes."
+ "purpose": "Turn on two-step verification with a passkey (recommended) or an authenticator app (TOTP), and save recovery codes."
},
{
"id": "ACC-06",
@@ -467,7 +467,7 @@
"route": "/admin/roles",
"archetype": "list",
"phase": "MVP",
- "audience": "users.list (read), roles.manage (write)",
+ "audience": "users.list (read), roles.manage (write); an Application's owner reads and edits that Application's roles without a platform permission",
"purpose": "Platform and app roles.",
"sidebar": {
"section": "administration",
@@ -485,7 +485,7 @@
"route": "/admin/roles/:roleId",
"archetype": "detail",
"phase": "MVP",
- "audience": "users.list (read), roles.manage (write)",
+ "audience": "users.list (read), roles.manage (write); an Application's owner, for that Application's roles",
"purpose": "View or edit a role's permissions."
},
{
@@ -516,7 +516,7 @@
"archetype": "list",
"phase": "MVP",
"audience": "Any (catalog), owner/applications.manage (manage)",
- "purpose": "Applications you own or administer.",
+ "purpose": "Applications you own or administer, and (staff) the review queue.",
"sidebar": {
"section": "developer",
"label": "Applications",
@@ -543,8 +543,8 @@
"route": "/dev/apps/:appId",
"archetype": "detail",
"phase": "MVP",
- "audience": "Owner (configure), applications.manage (anything)",
- "purpose": "Configure an application."
+ "audience": "Owner (configure), applications.manage (anything, including retire and delete)",
+ "purpose": "Configure an application, and (staff) review, retire or delete it."
},
{
"id": "APL-04",
@@ -642,7 +642,7 @@
"archetype": "list",
"phase": "Phase 2",
"audience": "webhooks.manage or app owner",
- "purpose": "Endpoints that receive access-change events.",
+ "purpose": "Endpoints that receive access-change events, and failed deliveries across all of them.",
"sidebar": {
"section": "developer",
"label": "Webhooks",
@@ -718,7 +718,7 @@
"archetype": "handoff",
"phase": "Phase 2",
"audience": "Self (individual); org_admin (org checkout); org_admin or billing.manage (org portal)",
- "purpose": "Hand off to Stripe in the browser and confirm the result on return."
+ "purpose": "Hand off to the payment page or billing portal in the browser and confirm the result on return."
},
{
"id": "BIL-04",
diff --git a/Packages/SubstratalKit/Sources/SubstratalKit/Theme.swift b/Packages/SubstratalKit/Sources/SubstratalKit/Theme.swift
index adf3e80..bca729b 100644
--- a/Packages/SubstratalKit/Sources/SubstratalKit/Theme.swift
+++ b/Packages/SubstratalKit/Sources/SubstratalKit/Theme.swift
@@ -1,4 +1,4 @@
-// SubstratalTheme.swift — generated from shared/themes/themes.json. Lives in SubstratalKit (shared by iOS and macOS).
+// SubstratalTheme.swift — generated from 00-shared/themes/themes.json. Lives in SubstratalKit (shared by iOS and macOS).
// Five light and five dark themes. Defaults: Moss Paper (light) and Forest Floor (dark).
import SwiftUI
import Observation
diff --git a/Packages/SubstratalKit/Tests/SubstratalKitTests/NavigationTests.swift b/Packages/SubstratalKit/Tests/SubstratalKitTests/NavigationTests.swift
index 34eb9b9..428413f 100644
--- a/Packages/SubstratalKit/Tests/SubstratalKitTests/NavigationTests.swift
+++ b/Packages/SubstratalKit/Tests/SubstratalKitTests/NavigationTests.swift
@@ -71,7 +71,7 @@ struct NavigationTests {
@Test("Help links point into the shared Hub help center")
func helpLinks() {
let help = HelpLinks()
- let root = "https://compositecode.github.io/substratalapps-applications-specs/help/"
+ let root = "https://specs.substratalapps.com/help/"
#expect(help.screen("USR-01").absoluteString == root + "screens/usr-01.html")
#expect(help.apiExplorer.absoluteString == root + "api/v1/index.html")
#expect(help.shortcuts.absoluteString == root + "guides/macos.html#keyboard-shortcuts")
diff --git a/README.md b/README.md
index 153461e..d15fd5f 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
The native macOS client for the [Substratal Apps Platform API](https://compositecode.github.io/substratalapps.com/): the Hub that staff and app developers use to run the platform (users, access, roles, Applications, API keys, webhooks, tenants and the audit log), plus every person's own apps, inbox, account and plan.
-- **UI spec:** [substratalapps-applications-specs → macOS](https://compositecode.github.io/substratalapps-applications-specs/) (75 screens, the source of truth for screens, copy and behavior)
-- **Help:** the shared [Substratal Hub help center](https://compositecode.github.io/substratalapps-applications-specs/help/), the one documentation reference for every Hub app. Its source is `help/` in the [specs repo](https://github.com/CompositeCode/substratalapps-applications-specs); the macOS pages are [Using the Hub on macOS](https://compositecode.github.io/substratalapps-applications-specs/help/guides/macos.html) and [Troubleshooting](https://compositecode.github.io/substratalapps-applications-specs/help/guides/troubleshooting.html).
+- **UI spec:** [Hub interface specifications → macOS](https://specs.substratalapps.com/platforms/macos.html) (75 screens, the source of truth for screens, copy and behavior)
+- **Help:** the shared [Substratal Hub help center](https://specs.substratalapps.com/help/), the one documentation reference for every Hub app. Its source is `help/` in the [specs repo](https://github.com/CompositeCode/substratal-hub-interface-specs); the macOS pages are [Using the Hub on macOS](https://specs.substratalapps.com/help/guides/macos.html) and [Troubleshooting](https://specs.substratalapps.com/help/guides/troubleshooting.html).
- **Plans:** [docs/PLAN-management-app.md](docs/PLAN-management-app.md) · [docs/PLAN-api-gaps.md](docs/PLAN-api-gaps.md) · [docs/PREREQUISITES.md](docs/PREREQUISITES.md)
## Status
@@ -31,7 +31,7 @@ GET https://api.substratalapps.com/users/me ← no /v1
Substratal-Version: 1
```
-`/v1/…` paths return `404`. The version is the compile-time constant `APIVersion.current` in `SubstratalKit`, and `VersionMiddleware` adds the header to every request, so no call can forget it. Moving to a new API version is a code change, never configuration. See [API versioning](https://compositecode.github.io/substratalapps-applications-specs/help/developers/api-versioning.html) in the help center.
+`/v1/…` paths return `404`. The version is the compile-time constant `APIVersion.current` in `SubstratalKit`, and `VersionMiddleware` adds the header to every request, so no call can forget it. Moving to a new API version is a code change, never configuration. See [API versioning](https://specs.substratalapps.com/help/developers/api-versioning.html) in the help center.
## Layout
@@ -64,7 +64,7 @@ make build # or open SubstratalHub.xcodeproj and run the SubstratalHub sch
scripts/run-local.sh # build and launch against the production API (or pass http://localhost:8080)
make run # build and launch against production
make test # SubstratalKit unit tests
-make help-check # check the app's Help links against ../substratalapps-applications-specs
+make help-check # check the app's Help links against https://specs.substratalapps.com/help/
make check # everything CI runs
```
@@ -110,7 +110,7 @@ The screen catalog drives the sidebar, menus, routes and deep links. The help ce
The app's documentation is the shared Hub help center, in the specs repo, not here:
-- **Writing docs:** edit `help/` in [substratalapps-applications-specs](https://github.com/CompositeCode/substratalapps-applications-specs) (guides, tutorials, developer pages, FAQ, optional per-screen notes). See its `help/README.md`. Per-screen pages, the versioned API reference and What's new are generated there on every build.
+- **Writing docs:** edit `help/` in [substratal-hub-interface-specs](https://github.com/CompositeCode/substratal-hub-interface-specs) (guides, tutorials, developer pages, FAQ, optional per-screen notes). See its `help/README.md`. Per-screen pages, the versioned API reference and What's new are generated there on every build.
- **When this app changes:** `docs-dispatch.yml` sends `app-docs-updated` to the specs repo on every merge to `main`, which rebuilds and republishes the help center. It needs the `SPECS_DOCS_TOKEN` secret; without it, the help center rebuilds daily.
- **When the API changes:** the help center rebuilds its API reference from the live `openapi.yaml` daily and on `api-contract-updated`. This repo's `upstream-sync.yml` opens a PR that updates the app's generated client.
- **Links can't break:** CI builds the help center and runs `scripts/help-check.rb`, so a screen without a help page, or a Help menu item pointing nowhere, fails the build.
diff --git a/docs/PREREQUISITES.md b/docs/PREREQUISITES.md
index 175c0c1..1f1aeae 100644
--- a/docs/PREREQUISITES.md
+++ b/docs/PREREQUISITES.md
@@ -20,7 +20,7 @@ Verified on production on 2026-10-23:
| `GET /permissions` without the header | `400 api_version_required`, `details.supported: ["1"]` |
| `GET /permissions` with `Substratal-Version: 1`, no token | `401 unauthenticated`, and the response echoes `substratal-version: 1` |
-In this app: the base URL is the host root (`APIEnvironment.baseURL`). `APIVersion.current` is a compile-time constant, and `VersionMiddleware` stamps the header on every request, including the exempt ones, which is harmless. It also records `Deprecation`/`Sunset` and `400 unsupported_api_version` in `APIVersionMonitor`, which drives the GLB-03 banners. Unit tests cover each of these. The Hub help center documents the scheme for integrators ([API versioning](https://compositecode.github.io/substratalapps-applications-specs/help/developers/api-versioning.html)).
+In this app: the base URL is the host root (`APIEnvironment.baseURL`). `APIVersion.current` is a compile-time constant, and `VersionMiddleware` stamps the header on every request, including the exempt ones, which is harmless. It also records `Deprecation`/`Sunset` and `400 unsupported_api_version` in `APIVersionMonitor`, which drives the GLB-03 banners. Unit tests cover each of these. The Hub help center documents the scheme for integrators ([API versioning](https://specs.substratalapps.com/help/developers/api-versioning.html)).
## Development machine
@@ -56,7 +56,7 @@ In this app: the base URL is the host root (`APIEnvironment.baseURL`). `APIVersi
|---|---|---|
| This repo's GitHub remote | ✅ | [`CompositeCode/substratalapps-macos`](https://github.com/CompositeCode/substratalapps-macos), **private**, created 2026-10-23; `main` pushed. |
| GitHub Actions | ❌ **billing** | The first runs (2026-10-23) weren't started: "recent account payments have failed or your spending limit needs to be increased". Fix under the CompositeCode org's **Settings → Billing & plans**. Until then CI doesn't run; run `make check` locally. macOS runners use the most minutes, so set a spending limit that covers them. |
-| Help center | ✅ | Not hosted here. The app's documentation lives in the shared **Hub help center** in the public specs repo, published at `https://compositecode.github.io/substratalapps-applications-specs/help/`. The macOS guide and troubleshooting pages were moved there in [specs PR #2](https://github.com/CompositeCode/substratalapps-applications-specs/pull/2). This repo's Pages, which the plan doesn't support for a private repo, isn't needed. |
+| Help center | ✅ | Not hosted here. The app's documentation lives in the shared **Hub help center** in the specs repo (private), published at `https://specs.substratalapps.com/help/`. The macOS guide and troubleshooting pages were moved there in [specs PR #2](https://github.com/CompositeCode/substratal-hub-interface-specs/pull/2). This repo's Pages, which the plan doesn't support for a private repo, isn't needed. |
| `SPECS_DOCS_TOKEN` secret | ❌ optional | Lets `docs-dispatch.yml` tell the help center to rebuild as soon as this app merges. Without it, the help center rebuilds daily. |
| API repo `openapi.yaml` (raw, `main`) | ✅ | `200`. `scripts/sync-openapi.sh` vendors it; a scheduled workflow keeps it current. |
| Specs repo | ✅ | Up to date (`cebf679`, targets API v1.8.0). `scripts/import-screens.rb` imports its 75 macOS screens. |
diff --git a/project.yml b/project.yml
index d8b9026..7517b3d 100644
--- a/project.yml
+++ b/project.yml
@@ -55,7 +55,7 @@ targets:
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
LSMinimumSystemVersion: $(MACOSX_DEPLOYMENT_TARGET)
# The shared Hub help center (specs repo, help/), which every Hub app links to.
- SubstratalHelpBaseURL: https://compositecode.github.io/substratalapps-applications-specs/help/
+ SubstratalHelpBaseURL: https://specs.substratalapps.com/help/
CFBundleURLTypes:
- CFBundleURLName: com.substratalapps.hub.deeplink
CFBundleURLSchemes: [substratal]
diff --git a/scripts/help-check.rb b/scripts/help-check.rb
index a03db74..66ed07a 100644
--- a/scripts/help-check.rb
+++ b/scripts/help-check.rb
@@ -1,11 +1,13 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
-# Checks the app's Help links against a build of the shared Hub help center
-# (CompositeCode/substratalapps-applications-specs, `npm run build` → _site/help),
-# so the app can never open a help page that doesn't exist.
+# Checks the app's Help links against the shared Hub help center, so the app can
+# never open a help page that doesn't exist. HELP is the published help center
+# (the default) or a local build of it (CompositeCode/substratal-hub-interface-specs,
+# `npm run build` → _site/help).
#
-# scripts/help-check.rb HELP_DIR e.g. ../substratalapps-applications-specs/_site/help
+# scripts/help-check.rb https://specs.substratalapps.com/help/
+# scripts/help-check.rb HELP a URL, or a directory such as ../substratalapps-applications-specs/_site/help
#
# Fails when:
# - a screen in this app's catalog has no page at screens/.html
@@ -13,16 +15,39 @@
# - a #fragment HelpLinks.swift uses isn't an id on that page
require "json"
+require "net/http"
+require "uri"
ROOT = File.expand_path("..", __dir__)
-help = File.expand_path(ARGV[0] || File.join(ROOT, "..", "substratalapps-applications-specs", "_site", "help"))
-abort "help-check: #{help} doesn't exist; build the specs site first (npm ci && npm run build)" unless File.directory?(help)
+help = ARGV[0] || "https://specs.substratalapps.com/help/"
+REMOTE = help.match?(%r{\Ahttps?://})
+if REMOTE
+ help = help.end_with?("/") ? help : "#{help}/"
+else
+ help = File.expand_path(help)
+ abort "help-check: #{help} doesn't exist; build the specs site first (npm ci && npm run build)" unless File.directory?(help)
+end
+
+# The page's HTML, or nil if it doesn't exist.
+def page(base, path)
+ return (File.exist?(File.join(base, path)) ? File.read(File.join(base, path)) : nil) unless REMOTE
+
+ uri = URI.join(base, path)
+ 3.times do
+ res = Net::HTTP.get_response(uri)
+ return res.body.force_encoding("UTF-8") if res.is_a?(Net::HTTPSuccess)
+ return nil unless res.is_a?(Net::HTTPRedirection)
+
+ uri = URI.join(uri, res["location"])
+ end
+ nil
+end
problems = []
catalog = JSON.parse(File.read(File.join(ROOT, "Packages/SubstratalKit/Sources/SubstratalKit/Resources/screens.json")))
catalog.fetch("screens").each do |screen|
- page = File.join(help, "screens", "#{screen['id'].downcase}.html")
- problems << "no help page for #{screen['id']} (screens/#{screen['id'].downcase}.html)" unless File.exist?(page)
+ path = "screens/#{screen['id'].downcase}.html"
+ problems << "no help page for #{screen['id']} (#{path})" unless page(help, path)
end
source = File.read(File.join(ROOT, "Packages/SubstratalKit/Sources/SubstratalKit/Help/HelpLinks.swift"))
@@ -32,12 +57,12 @@
abort "help-check: no page(...) links found in HelpLinks.swift" if links.empty?
links.each do |path, fragment|
path = path.gsub('\(APIVersion.headerValue)', version.to_s)
- file = File.join(help, path)
- unless File.exist?(file)
+ html = page(help, path)
+ unless html
problems << "HelpLinks.swift opens #{path}, which isn't in the help center"
next
end
- problems << "HelpLinks.swift opens #{path}##{fragment}, but that page has no id=\"#{fragment}\"" if fragment && !File.read(file).include?(%(id="#{fragment}"))
+ problems << "HelpLinks.swift opens #{path}##{fragment}, but that page has no id=\"#{fragment}\"" if fragment && !html.include?(%(id="#{fragment}"))
end
if problems.empty?
diff --git a/scripts/import-screens.rb b/scripts/import-screens.rb
index bc5fa8e..b9b9649 100755
--- a/scripts/import-screens.rb
+++ b/scripts/import-screens.rb
@@ -4,11 +4,11 @@
# Imports the macOS screen inventory from the UI spec into the screen catalog
# that both the app and the help site read.
#
-# scripts/import-screens.rb [SPECS_DIR]
+# scripts/import-screens.rb [SPECS]
#
-# SPECS_DIR is a checkout of CompositeCode/substratalapps-applications-specs
-# (default: ../substratalapps-applications-specs). It reads
-# substratal-application-specs/macos/SCREENS.md and writes
+# SPECS is the published spec (default: https://specs.substratalapps.com/spec/)
+# or a checkout of CompositeCode/substratal-hub-interface-specs. It reads
+# macos/SCREENS.md and macos/README.md from the spec and writes
# Packages/SubstratalKit/Sources/SubstratalKit/Resources/screens.json.
#
# The spec is the source of truth for each screen's id, title, domain, route,
@@ -19,12 +19,26 @@
# then commit the result: CI fails if the help site has no page for a screen.
require "json"
+require "net/http"
+require "uri"
ROOT = File.expand_path("..", __dir__)
-specs = File.expand_path(ARGV[0] || File.join(ROOT, "..", "substratalapps-applications-specs"))
-source = File.join(specs, "substratal-application-specs", "macos", "SCREENS.md")
+specs = ARGV[0] || "https://specs.substratalapps.com/spec/"
+# A spec file's text, from the published site or a checkout (specs/, or
+# substratal-application-specs/ before spec 2.0.0).
+read_spec = lambda do |rel|
+ if specs.match?(%r{\Ahttps?://})
+ res = Net::HTTP.get_response(URI.join(specs.end_with?("/") ? specs : "#{specs}/", rel))
+ abort "import-screens: #{rel}: HTTP #{res.code} from #{specs}" unless res.is_a?(Net::HTTPSuccess)
+ res.body.force_encoding("UTF-8")
+ else
+ dir = %w[specs substratal-application-specs].map { |d| File.join(File.expand_path(specs), d) }.find { |d| File.directory?(d) }
+ abort "import-screens: #{specs} has no specs/ directory" unless dir
+ File.read(File.join(dir, rel))
+ end
+end
+source = "macos/SCREENS.md"
out = File.join(ROOT, "Packages", "SubstratalKit", "Sources", "SubstratalKit", "Resources", "screens.json")
-abort "import-screens: #{source} not found" unless File.exist?(source)
# Sidebar destinations, in order. `visible_when` names a Capabilities rule
# (see Capabilities.swift); `shortcut` is the menu key equivalent.
@@ -47,7 +61,7 @@
}.freeze
screens = []
-lines = File.readlines(source, chomp: true)
+lines = read_spec.call(source).lines(chomp: true)
lines.each_with_index do |line, i|
next unless (m = line.match(/\A### ([A-Z]+-\d+) — (.+)\z/))
@@ -76,9 +90,9 @@
missing = SIDEBAR.keys - screens.map { |s| s[:id] }
abort "import-screens: sidebar screens missing from the spec: #{missing.join(', ')}" unless missing.empty?
-spec_version = File.read(File.join(specs, "substratal-application-specs", "macos", "README.md"))[/\*\*API:\*\*\s*([^\n]+)/, 1]
+spec_version = read_spec.call("macos/README.md")[/\*\*API:\*\*\s*([^\n]+)/, 1]
doc = {
- "_generated" => "by scripts/import-screens.rb from substratalapps-applications-specs/macos/SCREENS.md; edit the spec, then re-run",
+ "_generated" => "by scripts/import-screens.rb from the Hub specs' macos/SCREENS.md (https://specs.substratalapps.com/spec/); edit the spec, then re-run",
"spec" => spec_version&.strip,
"screens" => screens,
}