From 26e1e2fb7fa7b97a929a201b2e3c16ab0f653cce Mon Sep 17 00:00:00 2001 From: Manfred Riem <15701806+mnriem@users.noreply.github.com> Date: Mon, 30 Nov 2026 15:53:15 -0600 Subject: [PATCH 1/2] feat(docs): generate community workflow step directory Generate searchable workflow step package listings and detail pages from the community catalog. Preserve package and submission guidance, wire generation into Pages, and make submission automation catalog-only. Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../add-community-workflow-step.lock.yml | 6 +- .../workflows/add-community-workflow-step.md | 32 +- .github/workflows/docs.yml | 6 + docs/.gitignore | 1 + docs/README.md | 23 +- docs/assets/workflow-step-catalog.js | 60 +++ docs/community/workflow-steps.md | 229 +++--------- docs/docfx.json | 1 + docs/generate_workflow_steps.py | 258 +++++++++++++ docs/workflow-steps/cli.md | 11 +- docs/workflow-steps/decision.md | 37 ++ docs/workflow-steps/publishing.md | 199 ++++++++-- tests/test_github_workflows.py | 2 +- tests/test_workflow_step_documentation.py | 344 ++++++++++++++++++ tests/test_workflow_step_submission.py | 26 +- 15 files changed, 986 insertions(+), 249 deletions(-) create mode 100644 docs/assets/workflow-step-catalog.js create mode 100644 docs/generate_workflow_steps.py create mode 100644 docs/workflow-steps/decision.md create mode 100644 tests/test_workflow_step_documentation.py diff --git a/.github/workflows/add-community-workflow-step.lock.yml b/.github/workflows/add-community-workflow-step.lock.yml index 8dffc4efff..0e6e340247 100644 --- a/.github/workflows/add-community-workflow-step.lock.yml +++ b/.github/workflows/add-community-workflow-step.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"8afebb8429e0d385eb72f85e4ad601a08d7af8f6a1265c79a02d66f6ccac377c","body_hash":"461df4638989a7ad711b2f7423980e664a369fca0a657580b4f5c7e9fba6737c","compiler_version":"v0.88.7","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.80"}} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"298a3f51828e7d37ae1a00832fee1791b04a75719c37e866a658eb18cc1e3a03","body_hash":"25a5610e1df30434b0c7009d3c25dc2f4e864a107dd64694d9ee8d234cbcf657","compiler_version":"v0.88.7","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.80"}} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/setup-python","sha":"5fda3b95a4ea91299a34e894583c3862153e4b97","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"5e508589e03a7757a7e05b26e834292f5445bfb6","version":"v0.88.7"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.28.14","digest":"sha256:f7df036c86575527b61f3f7df91c4412349a12b2a74988d929eafa2999230c98","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.28.14@sha256:f7df036c86575527b61f3f7df91c4412349a12b2a74988d929eafa2999230c98"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.14","digest":"sha256:6f95e2234dd9bd6333a8ff28ccea7ecf0204acd4a09108723844dbd2bf6268c5","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.14@sha256:6f95e2234dd9bd6333a8ff28ccea7ecf0204acd4a09108723844dbd2bf6268c5"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.28.14","digest":"sha256:2ce8df3abf3e9b76e9c0cf5863da41f1ab3f89b20ad14b988806ab89e7bf2cd5","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.28.14@sha256:2ce8df3abf3e9b76e9c0cf5863da41f1ab3f89b20ad14b988806ab89e7bf2cd5"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.18","digest":"sha256:85b940556a8faa4e1fdbef124bfd75f2c4ebd855a10b88a1c3b6f3e97f6f1a53","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.18@sha256:85b940556a8faa4e1fdbef124bfd75f2c4ebd855a10b88a1c3b6f3e97f6f1a53"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:0daa8971fa4732b647150cb6524a6b0804b68d5d24f6f58b5dd1af23bd63fb23","pinned_image":"ghcr.io/github/gh-aw-node@sha256:0daa8971fa4732b647150cb6524a6b0804b68d5d24f6f58b5dd1af23bd63fb23"},{"image":"ghcr.io/github/github-mcp-server:v1.11.0","digest":"sha256:fbec75de11c255213fa08d80fb166abe73d851fff631c51c0079872967720699","pinned_image":"ghcr.io/github/github-mcp-server:v1.11.0@sha256:fbec75de11c255213fa08d80fb166abe73d851fff631c51c0079872967720699"}],"mcp_servers":[{"name":"github","tools":["get_commit","get_file_contents","get_latest_release","get_release_by_tag","get_tag","issue_read","list_branches","list_commits","list_issue_types","list_issues","list_releases","list_starred_repositories","list_tags","search_code","search_issues","search_repositories"]},{"name":"safeoutputs","tools":["add_comment","add_labels","create_pull_request","missing_data","missing_tool","noop","remove_labels"]}]} # This file was automatically generated by gh-aw (v0.88.7). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # @@ -576,7 +576,7 @@ jobs: env: GH_AW_FILE_ROOT: "${{ runner.temp }}/gh-aw" GH_AW_FILE_CONFIG: "{\"files\":[{\"path\":\"safeoutputs/config.json\",\"content_env\":\"GH_AW_SAFE_OUTPUTS_CONFIG\"}]}" - GH_AW_SAFE_OUTPUTS_CONFIG: "{\"add_comment\":{\"max\":2},\"add_labels\":{\"allowed\":[\"workflow-step-submission\",\"validation-failed\",\"needs-info\"],\"issue_intent\":false,\"max\":3},\"create_pull_request\":{\"allowed_files\":[\"workflows/step-catalog.community.json\",\"docs/community/workflow-steps.md\"],\"draft\":true,\"labels\":[\"workflow-step-submission\",\"automated\"],\"max\":1,\"max_patch_files\":100,\"max_patch_size\":4096,\"protect_top_level_dot_folders\":true,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"CODEOWNERS\",\"DESIGN.md\",\"CONTRIBUTING.md\",\"SECURITY.md\",\"CODE_OF_CONDUCT.md\",\"AGENTS.md\"],\"protected_files_policy\":\"blocked\",\"title_prefix\":\"[workflow-step] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"remove_labels\":{\"allowed\":[\"validation-passed\",\"validation-failed\",\"needs-info\"]},\"report_incomplete\":{}}" + GH_AW_SAFE_OUTPUTS_CONFIG: "{\"add_comment\":{\"max\":2},\"add_labels\":{\"allowed\":[\"workflow-step-submission\",\"validation-failed\",\"needs-info\"],\"issue_intent\":false,\"max\":3},\"create_pull_request\":{\"allowed_files\":[\"workflows/step-catalog.community.json\"],\"draft\":true,\"labels\":[\"workflow-step-submission\",\"automated\"],\"max\":1,\"max_patch_files\":100,\"max_patch_size\":4096,\"protect_top_level_dot_folders\":true,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"CODEOWNERS\",\"DESIGN.md\",\"CONTRIBUTING.md\",\"SECURITY.md\",\"CODE_OF_CONDUCT.md\",\"AGENTS.md\"],\"protected_files_policy\":\"blocked\",\"title_prefix\":\"[workflow-step] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"remove_labels\":{\"allowed\":[\"validation-passed\",\"validation-failed\",\"needs-info\"]},\"report_incomplete\":{}}" with: script: | const path = require('path'); @@ -2010,7 +2010,7 @@ jobs: GH_AW_ALLOWED_DOMAINS: "api.github.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" GITHUB_SERVER_URL: ${{ github.server_url }} GITHUB_API_URL: ${{ github.api_url }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":2},\"add_labels\":{\"allowed\":[\"workflow-step-submission\",\"validation-failed\",\"needs-info\"],\"issue_intent\":false,\"max\":3},\"create_pull_request\":{\"allowed_files\":[\"workflows/step-catalog.community.json\",\"docs/community/workflow-steps.md\"],\"draft\":true,\"labels\":[\"workflow-step-submission\",\"automated\"],\"max\":1,\"max_patch_files\":100,\"max_patch_size\":4096,\"protect_top_level_dot_folders\":true,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"CODEOWNERS\",\"DESIGN.md\",\"CONTRIBUTING.md\",\"SECURITY.md\",\"CODE_OF_CONDUCT.md\",\"AGENTS.md\"],\"protected_files_policy\":\"blocked\",\"title_prefix\":\"[workflow-step] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"remove_labels\":{\"allowed\":[\"validation-passed\",\"validation-failed\",\"needs-info\"]},\"report_incomplete\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":2},\"add_labels\":{\"allowed\":[\"workflow-step-submission\",\"validation-failed\",\"needs-info\"],\"issue_intent\":false,\"max\":3},\"create_pull_request\":{\"allowed_files\":[\"workflows/step-catalog.community.json\"],\"draft\":true,\"labels\":[\"workflow-step-submission\",\"automated\"],\"max\":1,\"max_patch_files\":100,\"max_patch_size\":4096,\"protect_top_level_dot_folders\":true,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"CODEOWNERS\",\"DESIGN.md\",\"CONTRIBUTING.md\",\"SECURITY.md\",\"CODE_OF_CONDUCT.md\",\"AGENTS.md\"],\"protected_files_policy\":\"blocked\",\"title_prefix\":\"[workflow-step] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"remove_labels\":{\"allowed\":[\"validation-passed\",\"validation-failed\",\"needs-info\"]},\"report_incomplete\":{}}" GH_AW_CI_TRIGGER_TOKEN: ${{ secrets.GH_AW_CI_TRIGGER_TOKEN }} with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/add-community-workflow-step.md b/.github/workflows/add-community-workflow-step.md index 7a50363fa9..f1675cf79d 100644 --- a/.github/workflows/add-community-workflow-step.md +++ b/.github/workflows/add-community-workflow-step.md @@ -58,7 +58,6 @@ safe-outputs: max: 1 allowed-files: - workflows/step-catalog.community.json - - docs/community/workflow-steps.md protected-files: policy: blocked exclude: @@ -410,10 +409,9 @@ update and draft PR. Do not add `validation-passed` before PR publication; the conclusion job applies it and removes stale failure/info labels only after successful safe-output processing and creation of a PR. -## 4. Update catalog and documentation +## 4. Update the catalog -Edit only `workflows/step-catalog.community.json` and -`docs/community/workflow-steps.md`. +Edit only `workflows/step-catalog.community.json`. Use validated metadata and computed per-file digests. Preserve history as described above. Set `verified: false`, set entry and top-level `updated_at` @@ -423,23 +421,13 @@ Validate the complete JSON using repository-owned Python, without importing the submitted step. Use the verifier's `expected_catalog` snapshot to perform the catalog update; do not recreate history or timestamps from memory. -Add or update one row in the Available Step Types table, sorted by Step Type Name. -Like other community submission tables, this table does not conflate package -authors with maintainers or collect a separate Maintainer field. Retain Author -in the catalog and manifest correspondence checks only: - -```text -| []() (``) | | | -``` - -Collapse newlines and remove control characters from user display values. -Escape backslashes, pipes, backticks, Markdown formatting, brackets, and angle -brackets; only the validated repository URL is used as a link destination. -Do not replace surrounding guide content. -Preserve the existing Decision listing and its compatibility/dependency notes -and maintainer attribution in prose when processing unrelated submissions. -Never replace maintainer attribution with the package Author. For an update to a listed step with -version-specific notes, update those notes from validated release documentation. +The documentation build generates the alphabetical community directory and +detail pages from the catalog. Do not edit `docs/community/workflow-steps.md`, +generated documentation, or a second Markdown table. Retain Author in the +catalog and manifest correspondence checks; it is not maintainer attribution. +Package and submission guidance is canonical in `docs/workflow-steps/publishing.md`; +version-specific notes in `docs/workflow-steps/decision.md` remain historical +guidance, not a current release listing. Do not modify those notes. Before emitting a PR safe output, verify the generated catalog: @@ -457,7 +445,7 @@ report success while this check is incomplete or failing. This repository-owned gh-aw maintenance workflow does not perform the contributor open-PR count check or request confirmation. After successful validation and -allowed catalog/docs file updates, emit the configured draft `create_pull_request` +allowed catalog updates, emit the configured draft `create_pull_request` safe output regardless of the submitter's or filing account's open PR count. Use branch `community/${{ github.event.issue.number }}-add--step` or diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9d9d340a06..ba75782911 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,6 +10,7 @@ on: - 'presets/catalog.community.json' - 'bundles/catalog.community.json' - 'workflows/catalog.community.json' + - 'workflows/step-catalog.community.json' - '.github/workflows/docs.yml' # Allows you to run this workflow manually from the Actions tab @@ -64,6 +65,11 @@ jobs: env: GH_TOKEN: ${{ github.token }} + - name: Generate community workflow step documentation + run: python3 docs/generate_workflow_steps.py --fetch-stars + env: + GH_TOKEN: ${{ github.token }} + - name: Build with DocFX run: | cd docs diff --git a/docs/.gitignore b/docs/.gitignore index 20c42faf2b..b9d6f0252c 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -6,6 +6,7 @@ _generated/ community/presets/ community/bundles/ community/workflows/ +community/workflow-steps/ # Temporary files *.tmp diff --git a/docs/README.md b/docs/README.md index bf29c514fb..cb0ea42c73 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,12 +12,13 @@ To build the documentation locally: dotnet tool install -g docfx ``` -2. Generate the community preset, bundle, and workflow directories from the local catalogs: +2. Generate the community preset, bundle, workflow, and workflow step directories from the local catalogs: ```bash python3 docs/generate_presets.py --fetch-stars python3 docs/generate_bundles.py --fetch-stars python3 docs/generate_workflows.py --fetch-stars + python3 docs/generate_workflow_steps.py --fetch-stars ``` 3. Build the documentation: @@ -30,12 +31,17 @@ To build the documentation locally: 4. Open your browser to `http://localhost:8080` to view the documentation. Run the corresponding generator again after editing `presets/catalog.community.json`, -`bundles/catalog.community.json`, or `workflows/catalog.community.json`. They create +`bundles/catalog.community.json`, `workflows/catalog.community.json`, or +`workflows/step-catalog.community.json`. They create the ignored `_generated/preset-directory.md`, `_generated/bundle-directory.md`, -and `_generated/workflow-directory.md` includes and `community/presets/*.md`, -`community/bundles/*.md`, and `community/workflows/*.md` detail pages, removing pages for deleted entries. +`_generated/workflow-directory.md`, and `_generated/workflow-step-directory.md` +includes and `community/presets/*.md`, `community/bundles/*.md`, +`community/workflows/*.md`, and `community/workflow-steps/*.md` detail pages, +removing pages for deleted entries. Do not edit these generated files. The directory uses only catalog metadata: -building it does not fetch or execute third-party preset, bundle, or workflow content. With +building it does not fetch or execute third-party preset, bundle, workflow, or +executable step-package content. Step pages reuse the workflow directory's +stylesheet and build-time star lookup; only workflows have integration filters. With `--fetch-stars`, it reads star counts from the GitHub API once per repository. Set `GH_TOKEN` or `GITHUB_TOKEN` for authenticated API limits; the deployment workflow uses its repository token. Counts reflect the last build, @@ -118,7 +124,8 @@ the site homepage. Process command references and authentication remain under - `community/extensions.md` - Community extension listing - `community/integrations.md` - Community integration discovery and contribution - `community/workflows.md` - Community workflow listing and contribution -- `community/workflow-steps.md` - Community step listing and submission contract +- `community/workflow-steps.md` - Catalog-generated community step directory +- `workflow-steps/decision.md` - Version-specific Decision 0.9.0 dependency notes - `integrations/index.md` - Integration directory and shared setup guidance - `integrations/cli.md` - Shared integration management CLI reference - `integrations/api.md` - Public Python adapter and file ownership contracts @@ -130,9 +137,9 @@ the site homepage. Process command references and authentication remain under ## Deployment -Documentation, community preset, bundle, or workflow catalog, and docs workflow changes on the +Documentation, community preset, bundle, workflow, or workflow step catalog, and docs workflow changes on the upstream `main` branch trigger the normal GitHub Pages deployment. Each build -generates the preset, bundle, and workflow directories and detail pages and refreshes repository star +generates the preset, bundle, workflow, and workflow step directories and detail pages and refreshes repository star counts before running DocFX. A weekly run on Mondays at 04:17 UTC refreshes the site and its build-time star counts, using the same path as manual runs. It does not write star counts back to the catalogs. diff --git a/docs/assets/workflow-step-catalog.js b/docs/assets/workflow-step-catalog.js new file mode 100644 index 0000000000..a756bd9e4a --- /dev/null +++ b/docs/assets/workflow-step-catalog.js @@ -0,0 +1,60 @@ +(() => { + const catalog = document.querySelector("[data-step-catalog]"); + if (!catalog) return; + + const form = catalog.querySelector("[data-step-controls]"); + const query = form.elements.namedItem("q"); + const tag = form.elements.namedItem("tag"); + const sort = form.elements.namedItem("sort"); + const list = catalog.querySelector(".workflow-results"); + const entries = Array.from(list.children); + const status = catalog.querySelector("[data-step-status]"); + const empty = catalog.querySelector("[data-step-empty]"); + const searchable = entries.map((entry) => ({ + entry, + text: entry.dataset.stepSearch.toLocaleLowerCase(), + tags: JSON.parse(entry.dataset.stepTags), + })); + const params = new URLSearchParams(window.location.search); + query.value = params.get("q") || ""; + tag.value = params.get("tag") || ""; + if (!tag.value) tag.value = ""; + sort.value = params.get("sort") === "za" ? "za" : "az"; + + function update() { + const words = query.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean); + let visible = 0; + for (const item of searchable) { + const matches = words.every((word) => item.text.includes(word)) + && (!tag.value || item.tags.includes(tag.value)); + item.entry.hidden = !matches; + if (matches) visible += 1; + } + const ordered = sort.value === "za" ? [...entries].reverse() : entries; + for (const entry of ordered) list.append(entry); + status.textContent = `${visible} of ${entries.length} step types`; + empty.hidden = visible !== 0; + + const next = new URL(window.location.href); + for (const [key, value] of [["q", query.value], ["tag", tag.value], ["sort", sort.value === "za" ? "za" : ""]]) { + if (value) next.searchParams.set(key, value); + else next.searchParams.delete(key); + } + window.history.replaceState(null, "", next); + } + + form.addEventListener("input", update); + form.addEventListener("change", update); + form.addEventListener("submit", (event) => { + event.preventDefault(); + update(); + }); + form.addEventListener("reset", () => { + query.value = ""; + tag.value = ""; + sort.value = "az"; + update(); + }); + update(); + form.hidden = false; +})(); diff --git a/docs/community/workflow-steps.md b/docs/community/workflow-steps.md index b54f91d0e1..df7dd36607 100644 --- a/docs/community/workflow-steps.md +++ b/docs/community/workflow-steps.md @@ -1,191 +1,64 @@ # Community Workflow Step Types -> [!NOTE] -> Community workflow step types are independently created and maintained by -> their authors. Maintainers verify submission metadata and package shape; they -> do **not review, audit, endorse, or support the executable Python code**. -> Installation validates and copies the package without importing its Python -> code. Later `specify workflow add`, `run`, and `resume` commands load installed -> step packages, executing import-time code with the user's privileges. Review -> the source before installation and use. - -Custom workflow step packages add a `type:` that workflows can use beyond the -built-in step types. The canonical intake path is the -[Workflow Step Type Submission](https://github.com/github/spec-kit/issues/new?template=workflow_step_submission.yml) -issue form for new entries, version updates, and metadata corrections. +Custom step packages add executable Python `type:` implementations beyond +Spec Kit's built-in workflow step types. They are distinct from +[workflow definitions](workflows.md), which compose steps into processes. -Opening the form applies only the `triage-must-have` verdict. A maintainer -applies `workflow-step-submission` during triage to start automated metadata -validation. Successful validation proposes catalog and documentation changes -in a draft PR for maintainer review. The automation never installs, imports, -executes, or reviews submitted Python. - -Accepted entries are published in -[`workflows/step-catalog.community.json`](https://github.com/github/spec-kit/blob/main/workflows/step-catalog.community.json). -The built-in community catalog is **discovery-only**. Accepted entries can -appear in `specify workflow step search` and `info`, but -`specify workflow step add ` will not install executable code from that -source. After reviewing the source, install the submitted versioned archive -directly with `--from`, or use a separately configured step catalog that you -explicitly allow for installation. +> [!NOTE] +> Maintainers validate submission metadata and package shape; they do not +> review, audit, endorse, or support submitted Python code. You must vet the +> exact release, dependencies, and side effects before installation and use. +> Installation copies and validates files without importing Python, but later +> `specify workflow add`, `run`, and `resume` load installed step packages and +> execute import-time code with your privileges. ## Available Step Types -| Step type | Version | Description | -| --- | --- | --- | -| [Decision](https://github.com/markuswondrak/spec-kit-decision-step) (`decision`) | 0.9.0 | Typed bounded choice, score, and noul decisions with native probabilities and score legends using Jev and Laya backends. | - -Decision is maintained by [Markus Wondrak](https://github.com/markuswondrak). -As in the other community submission tables, author metadata belongs in the -catalog; it is not used as a substitute for maintainer attribution. +This directory is generated from +[`workflows/step-catalog.community.json`](https://github.com/github/spec-kit/blob/main/workflows/step-catalog.community.json), +alphabetically by name. Detail pages show the current catalog release, source +and package-file links, per-file checksums where provided, and review guidance. +Missing metadata is explicitly marked; declared Spec Kit compatibility is +advisory, not enforced by the installer. Repository stars are captured at +documentation build time and are not an endorsement. -Decision declares runtime compatibility with Spec Kit `>=0.11.0`; installing -its [versioned release archive](https://github.com/markuswondrak/spec-kit-decision-step/releases/download/v0.9.0/decision-0.9.0.zip) -with `--from` requires Spec Kit `>=1.1.0`. The catalog compatibility field is -advisory and is not enforced by the current step installer. +[!INCLUDE [Community workflow step directory](../_generated/workflow-step-directory.md)] -The package uses the host's PyYAML and `specify_cli` packages. Jev requires -`TYPESAFE_API_KEY` (or a configured `api_key_env`) and outbound HTTPS to the -configured backend endpoint; in-process Laya requires the optional -`laya[onnx]` package. See the -[version-pinned documentation](https://github.com/markuswondrak/spec-kit-decision-step/blob/v0.9.0/README.md) -for configuration, outputs, failure behavior, and side effects, and the -[changelog](https://github.com/markuswondrak/spec-kit-decision-step/blob/v0.9.0/CHANGELOG.md) -for release details. The MIT-licensed manifest credits -`spec-kit-decision-step contributors` as the package author. +Inspect active step catalog sources and advertised releases: -## Package Contract - -One installed package provides one workflow step type: - -```text -my-step/ -├── step.yml -├── __init__.py -└── helpers.py # optional; every catalog-downloaded extra file is declared +```bash +specify workflow step catalog list +specify workflow step search +specify workflow step info --versions ``` -The package must satisfy the current installer and loader contract: - -- `step.yml` and `__init__.py` are regular, non-symlink files at the package - root. An archive may wrap the package in exactly one top-level directory. -- `step.type_key`, the catalog key/ID, and the matching - `StepBase.type_key` are identical. -- The ID is one safe path component. The installer rejects separators, leading - dots, trailing dots or spaces, reserved names, control characters, and - Windows-invalid filename characters. Catalog automation additionally requires - lowercase letters, digits, and hyphens, starting with a letter. -- `__init__.py` defines a `StepBase` subclass matching that single type key. - Additional classes do not make the package provide additional registered - step types. This is an author attestation, not a maintainer code check. -- Extra-file paths use forward slashes, are relative and non-empty, contain no - empty, `.` or `..` segments, and do not case-insensitively alias `step.yml`, - `__init__.py`, another file, or a package directory. -- The package stays within the current installer limits: 512 retained entries - (files and directories combined), 32 directory levels, and 50 MiB of retained - content. Submission downloads additionally have a 10 MiB per-file limit. -- `.git`, `__pycache__`, and `.DS_Store` are excluded from installation; - submission automation rejects case-insensitive aliases of these components. - -See [Custom step packages](../workflow-steps/developing.md#custom-step-packages) for -package validation and runtime behavior, and the -[step installation reference](../workflow-steps/cli.md#step-management) for installation. - -## Submission Contract - -The issue form separates fields consumed by the current package/catalog code -from provenance and disclosure fields used during metadata review. - -| Submission data | Current contract | -| --- | --- | -| Step type ID | Catalog key, `step.type_key`, and matching `StepBase.type_key` | -| Name, version, description, author | `step.yml` metadata and catalog/installed registry metadata | -| Download URL | Versioned release archive used to test the supported direct-URL installation path | -| `step.yml`, `__init__.py`, and extra-file URLs | Exact HTTPS file URLs consumed when installing from an explicitly install-allowed catalog; extra-file keys follow the package-relative path restrictions above | -| Per-file SHA-256 mapping | Catalog `sha256`; keys must be exactly the files the installer downloads | -| Provided type name/count | Loader invariant: one matching type key per installed package | -| Repository, license, documentation, changelog | Source provenance and metadata-review evidence; these are not `step.yml` fields | -| Spec Kit compatibility | Required intake disclosure; stored as advisory `requires.speckit_version`, not enforced by the installer | -| Runtime and tool dependencies | Required intake disclosure; the CLI does not resolve or install dependencies for custom steps | +The built-in community source is discovery-only. A listing does not make +`specify workflow step add ` installable through that source. Review active +sources and the exact package before using a separately vetted install-allowed +catalog or an explicitly reviewed archive or local package. Per-file catalog +digests do not verify a release archive; follow the +[checksum-before-install guidance](../workflow-steps/cli.md#install-from-an-archive-url). -Use a versioned GitHub release URL for the archive, consistent with the other -community submission forms. Versions must be PEP 440-compatible and match the -manifest. The archive's release tag must identify that version, optionally -with a `v` prefix or a scoped prefix, and must contain no slashes. -Epoch versions such as `1!2.0` and local versions such as `2.0+cpu` are -supported. Tag characters must match `^[A-Za-z0-9._~+!-]+$`. -All catalog file URLs must use `raw.githubusercontent.com` in the submitted -repository, pinned to that exact release tag and package directory. The -required per-file SHA-256 mapping detects changed bytes even if a referenced -tag is later moved. Do not submit branch URLs, `releases/latest` URLs, or other -floating targets. +## Contribute a step type -The archive URL path must match `^[A-Za-z0-9._~+!/-]+$`. Package-relative -file keys and file paths within the tag must match `^[A-Za-z0-9._~/-]+$`. -Spaces, percent escapes (including `%20` in asset names), query strings, -fragments, and empty/dot/traversal file-path segments are not accepted by -community submission automation. Publish archives and package files with -names in these alphabets rather than URL-encoding unsupported characters. - -GitHub-generated `archive/refs/tags/` archives support `.zip` and `.tar.gz` -only. A `.tgz` archive must be a named `releases/download//.tgz` -release asset, not a generated tag archive. - -Documentation may be any tag-pinned Markdown file (`.md`, case-insensitive) -in the submitted GitHub repository, including `docs/deploy.md`; it need not be -named `README.md`. It must explain installation, configuration, dependencies, -outputs, failure behavior, side effects, and example workflow usage. - -The direct `--from` archive installer does not currently accept or verify an -archive digest. The submitted Download URL and Testing Details fields provide -versioned-release and installation-test evidence, not an immutable content -guarantee; the per-file digests protect the separate catalog-installation path. -Automation downloads the complete declared file set in one pass to enforce -the cumulative byte budget. It does not execute the archive or its contents. - -License must be one exact SPDX license identifier from the official license -list, matching the repository license detected at the submitted release tag. -An unknown identifier or known license mismatch fails validation. If release -license detection is unavailable or inconclusive, validation is Blocked for -maintainer clarification rather than guessing a license. This metadata check -is not a legal opinion or code audit. - -## Prepare a Submission - -1. Create a public source repository with the complete package, license, - documentation, and changelog where applicable. -2. Test valid and invalid configuration, `StepStatus`, outputs, errors, and any - relevant resume, nested-step, or concurrent execution behavior. -3. Publish a versioned release archive (`.zip`, `.tar.gz`, or a named `.tgz` - release asset) and test it: - - ```bash - specify workflow step add my-step \ - --from https://github.com/your-org/my-step/releases/download/v1.0.0/my-step-1.0.0.zip - ``` - -4. Publish tag-pinned raw GitHub URLs for `step.yml`, `__init__.py`, and every - extra package file. Compute the SHA-256 digest of each downloaded file. -5. File the canonical submission issue with the exact release metadata and - test evidence. - -## Automated Metadata Validation - -The maintainer-triggered workflow checks complete metadata, matching manifest -identity, pinned release/file URLs, per-file digests, package paths and limits, -documentation, and author testing attestations. It does not review submitted -code or claim to verify its execution behavior. - -Confirmed submission defects produce `validation-failed` and actionable -corrections. Environment failures, including permissions, unavailable tools, -timeouts, and transient HTTP failures, are Blocked rather than submission -defects. Only the guarded conclusion job can apply `validation-passed`, after -successful publication of the draft catalog PR. - -New versions preserve existing catalog release history. Same-version metadata -repairs must be identified explicitly and cannot replace file URLs or digests; -publish a new version when package content changes. -The repository-owned verifier snapshots the expected catalog before edits and -checks the complete generated catalog before PR creation, including migration -of the previous current release and preservation of history. Missing existing -release digests block publication pending maintainer repair. +Use the +[Workflow Step Type Submission](https://github.com/github/spec-kit/issues/new?template=workflow_step_submission.yml) +issue form for new entries, version updates, and metadata corrections. +The form applies only `triage-must-have`; a maintainer applies +`workflow-step-submission` during triage to start automated metadata validation. +Successful validation proposes a draft catalog PR. Automation never installs, +imports, executes, or reviews submitted Python. + +The [publishing guide](../workflow-steps/publishing.md) owns the package and +submission contracts, release pinning, per-file digests, author evidence, and +validation outcomes. Do not maintain a second Markdown listing. + +## See also + +- [Step overview](../workflow-steps/overview.md) +- [Step installation CLI](../workflow-steps/cli.md) +- [Step catalogs, releases, and trust](../workflow-steps/catalogs.md) +- [Developing custom packages](../workflow-steps/developing.md) +- [Publishing and submitting step types](../workflow-steps/publishing.md) +- [Decision 0.9.0 compatibility and dependency notes](../workflow-steps/decision.md) +- [Community workflow definitions](workflows.md) diff --git a/docs/docfx.json b/docs/docfx.json index c874496f93..f9889c3b8b 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -9,6 +9,7 @@ "community/presets/*.md", "community/bundles/*.md", "community/workflows/*.md", + "community/workflow-steps/*.md", "bundles/*.md", "extensions/*.md", "guides/*.md", diff --git a/docs/generate_workflow_steps.py b/docs/generate_workflow_steps.py new file mode 100644 index 0000000000..ad20feef56 --- /dev/null +++ b/docs/generate_workflow_steps.py @@ -0,0 +1,258 @@ +"""Generate the community executable step-package directory from its catalog.""" + +import argparse +import json +import re +from pathlib import Path + +if __package__: + from . import generate_workflows as shared +else: + import generate_workflows as shared + + +ROOT = Path(__file__).resolve().parent.parent +escape = shared.escape_metadata + + +def package_files(entry: dict) -> dict[str, str]: + step_url = entry.get("step_yml_url", entry.get("url")) + shared.url(step_url, f"{entry['id']}.step_yml_url") + init_url = entry.get("init_url") + if init_url is None: + if not step_url.endswith("step.yml"): + raise ValueError(f"{entry['id']}: cannot derive __init__.py URL") + init_url = step_url[:-len("step.yml")] + "__init__.py" + shared.url(init_url, f"{entry['id']}.init_url") + extras = entry.get("extra_files", {}) + if not isinstance(extras, dict): + raise ValueError(f"{entry['id']}.extra_files must be an object") + files = {"step.yml": step_url, "__init__.py": init_url} + seen = {("step.yml",), ("__init__.py",)} + for name, value in extras.items(): + parts = name.split("/") + if ( + not re.fullmatch(r"[A-Za-z0-9._~/-]+", name) + or any(part in ("", ".", "..") for part in parts) + or any(part.casefold() in {".git", "__pycache__", ".ds_store"} for part in parts) + ): + raise ValueError(f"{entry['id']}: invalid package file path: {name}") + folded = tuple(part.casefold() for part in parts) + if any(folded[:len(other)] == other or other[:len(folded)] == folded for other in seen): + raise ValueError(f"{entry['id']}: conflicting package file path: {name}") + seen.add(folded) + files[name] = shared.url(value, f"{entry['id']}.extra_files.{name}") + return files + + +def load_steps(catalog_path: Path) -> list[dict]: + catalog = json.loads(catalog_path.read_text(encoding="utf-8"), object_pairs_hook=shared.unique_keys) + if not isinstance(catalog, dict) or catalog.get("schema_version") != "1.0": + raise ValueError("step catalog must be an object with schema_version 1.0") + entries = catalog.get("steps") + if not isinstance(entries, dict): + raise ValueError("step catalog must contain a steps object") + for step_id, entry in entries.items(): + if not re.fullmatch(r"[a-z][a-z0-9-]*", step_id): + raise ValueError(f"invalid step ID: {step_id}") + if not isinstance(entry, dict) or entry.get("id") != step_id: + raise ValueError(f"{step_id}: entry ID must match its catalog key") + for field in ("name", "description", "author", "version"): + shared.text(entry.get(field), f"{step_id}.{field}") + for field in ("repository", "documentation", "changelog", "download_url"): + if field in entry: + shared.url(entry[field], f"{step_id}.{field}") + requires = entry.get("requires", {}) + if not isinstance(requires, dict): + raise ValueError(f"{step_id}.requires must be an object") + if "speckit_version" in requires: + shared.text(requires["speckit_version"], f"{step_id}.requires.speckit_version") + tags = entry.get("tags", []) + if not isinstance(tags, list): + raise ValueError(f"{step_id}.tags must be a list") + for tag in tags: + shared.text(tag, f"{step_id}.tags") + for field in ("license", "created_at", "updated_at"): + if field in entry: + shared.text(entry[field], f"{step_id}.{field}") + files = package_files(entry) + if "sha256" in entry: + hashes = entry["sha256"] + if ( + not isinstance(hashes, dict) or hashes.keys() != files.keys() + or any(not isinstance(value, str) or not re.fullmatch(r"[a-fA-F0-9]{64}", value) + for value in hashes.values()) + ): + raise ValueError(f"{step_id}.sha256 must pin exactly every package file with 64 hex digits") + return sorted(entries.values(), key=lambda entry: (entry["name"].casefold(), entry["name"], entry["id"])) + + +def directory(steps: list[dict], stars: dict[str, int | None]) -> str: + tags = sorted({tag for entry in steps for tag in entry.get("tags", [])}, + key=lambda tag: (tag.casefold(), tag)) + options = "".join(f'' for tag in tags) + rows = [] + for entry in steps: + search = " ".join([entry[field] for field in ("id", "name", "description", "author")] + + entry.get("tags", [])) + badges = "".join(f'{escape(tag)}' for tag in entry.get("tags", [])) + rows.append( + f'
  • ' + f'

    ' + f'{escape(entry["name"])}

    ' + f'{escape(entry["version"])}' + f'{shared.star_badge(entry, stars.get(entry.get("repository")))}
    ' + f'

    {escape(entry["description"])}

    ' + f'' + f'
    {badges}
  • ' + ) + return f""" + + +
    + +

    {len(steps)} step types

    + +
      {"".join(rows)}
    +
    +""" + + +def detail(entry: dict, stars: int | None) -> str: + metadata = { + "Step type": entry["id"], + "Catalog version": entry["version"], + "Package author": entry["author"], + "Repository stars": f"{stars:,}" if stars is not None else "Unavailable", + "License": entry.get("license", "Not provided"), + "Declared Spec Kit compatibility": entry.get("requires", {}).get("speckit_version", "Not specified"), + "Tags": ", ".join(entry.get("tags", [])) or "None listed", + "Created": entry.get("created_at", "Not provided"), + "Updated": entry.get("updated_at", "Not provided"), + } + definitions = "".join(f"
    {escape(label)}
    {escape(value)}
    " + for label, value in metadata.items()) + links = " ".join( + f'{label}' if field in entry else f"{label}: Not provided" + for field, label in (("repository", "Source repository"), ("documentation", "Author documentation"), + ("changelog", "Changelog")) + ) + hashes = entry.get("sha256", {}) + files = "".join( + f'
  • {escape(name)}: ' + + (f'SHA-256 {hashes[name]}' if name in hashes else "SHA-256 not provided") + + "
  • " + for name, value in package_files(entry).items() + ) + archive = ( + f'

    Catalog-listed archive for version ' + f'{escape(entry["version"])}. The catalog does not provide an archive digest.

    ' + if "download_url" in entry else + "

    No release archive URL or archive digest is provided in this catalog entry. " + "The individual file links below are not an installable archive.

    " + ) + checksum = ( + "

    The SHA-256 values below cover individual catalog-downloaded files, not the archive. " + "An install-allowed catalog verifies these digests before installation; " + "a mismatch stops installation. They do not authenticate archive contents.

    " + if hashes else + "

    No per-file SHA-256 digests are listed. Obtain and verify integrity digests from " + "a source you trust before installation. Legacy unqualified catalog installs can " + "omit digests; exact-version catalog installs require complete per-file digests.

    " + ) + return f""" + + +
    +

    Back to community workflow step types

    +

    {escape(entry["name"])}

    +

    {escape(entry["description"])}

    + +

    Step package details

    + +

    Compatibility is author-declared advisory metadata, not enforced by the current +step installer. Missing metadata does not imply compatibility. The CLI does not +resolve or install custom step dependencies. Review the release documentation for +runtime and tool requirements, credentials, network access, outputs, failure behavior, +and side effects; these are not fully represented in the catalog. +Repository stars reflect the last documentation build, not a safety assessment.

    +

    Review before installing or loading

    +

    This is an executable Python step package, not a workflow definition. +Maintainers validate submission metadata and package shape; they do not review, +audit, endorse, or support submitted Python code. You must vet the exact release, +all package files and dependencies, and their side effects before installation and use.

    +

    The built-in community catalog is discovery-only: +specify workflow step add {escape(entry["id"])} cannot install from +that source. Inspect specify workflow step catalog list and project +configuration; active sources may have been selected by someone else. Use only a +separately vetted, install-allowed catalog or an explicitly reviewed archive or local package.

    +{archive} +

    Direct --from installation asks for trust confirmation before any +network request, but does not accept or verify an archive digest. Before installation, +download the archive and compute its SHA-256; compare it with a publisher-provided +digest from a source you trust where available. If no archive digest is available, +obtain one from a trusted source; the per-file mapping is not a substitute. +If digests differ, stop and do not install. To install the exact bytes you checked, +inspect and unpack the verified archive and use --dev on its complete +local package directory. A later --from command downloads again. +A digest establishes integrity, not code safety.

    +{checksum} +

    Catalog package files

    +
      {files}
    +

    Installation validates and copies the package without importing its Python. +Later specify workflow add, run, and resume +load installed step packages and execute import-time Python with your privileges, +even before a particular custom step executes. This is not a sandbox. +Test unfamiliar packages in a disposable project and remove packages you no longer trust.

    +

    See also

    + +
    +""" + + +def generate(catalog_path: Path, docs_path: Path, *, fetch_stars: bool = False) -> int: + steps = load_steps(catalog_path) + stars = shared.repository_stars(steps) if fetch_stars else {} + pages = {f"{entry['id']}.md": detail(entry, stars.get(entry.get("repository"))) for entry in steps} + listing = directory(steps, stars) + details_path = docs_path / "community" / "workflow-steps" + details_path.mkdir(parents=True, exist_ok=True) + for stale in details_path.glob("*.md"): + if stale.name not in pages: + stale.unlink() + for name, content in pages.items(): + (details_path / name).write_text(content, encoding="utf-8") + include_path = docs_path / "_generated" + include_path.mkdir(parents=True, exist_ok=True) + (include_path / "workflow-step-directory.md").write_text(listing, encoding="utf-8") + return len(steps) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--catalog", type=Path, default=ROOT / "workflows/step-catalog.community.json") + parser.add_argument("--docs", type=Path, default=ROOT / "docs") + parser.add_argument("--fetch-stars", action="store_true", help="Fetch GitHub repository stars at build time") + args = parser.parse_args() + try: + count = generate(args.catalog, args.docs, fetch_stars=args.fetch_stars) + except (ValueError, OSError) as exc: + parser.exit(1, f"Workflow step documentation generation failed: {exc}\n") + print(f"Generated directory and detail pages for {count} community workflow step types.") + + +if __name__ == "__main__": + main() diff --git a/docs/workflow-steps/cli.md b/docs/workflow-steps/cli.md index e678087e44..bec46be091 100644 --- a/docs/workflow-steps/cli.md +++ b/docs/workflow-steps/cli.md @@ -51,6 +51,15 @@ request; declining cancels with no request and no error. HTTPS is required (HTTP is permitted only for loopback hosts), redirects must remain secure, and downloads are size-bounded. +Before installation, compute the downloaded archive's SHA-256 and compare it +with a publisher-provided digest from a source you trust where available. +If none is available, obtain a trusted digest first; stop on a mismatch. +The direct installer does not accept or verify an archive digest, and the step +catalog's `sha256` mapping covers individual files, not archive bytes. +To install the exact bytes you verified, inspect and unpack the archive and +use `--dev` on its complete local package directory. A later `--from` command +downloads again. A digest establishes integrity, not code safety. + ### Install from the catalog ```bash @@ -62,7 +71,7 @@ then go through the same validation and commit path as `--dev` and `--from`. Discovery-only catalogs cannot be installed from. To submit a custom step type to the discovery-only community catalog, follow -[Community Workflow Steps](../community/workflow-steps.md). Submissions use +[Publishing workflow steps](publishing.md). Submissions use tag-pinned individual file URLs and per-file digests; maintainers validate metadata and distribution evidence, not submitted code. diff --git a/docs/workflow-steps/decision.md b/docs/workflow-steps/decision.md new file mode 100644 index 0000000000..ecced96bd0 --- /dev/null +++ b/docs/workflow-steps/decision.md @@ -0,0 +1,37 @@ +# Decision 0.9.0 release notes + +These notes preserve package-specific guidance for Decision **0.9.0**, not a +second current-release listing. Consult the +[catalog-generated detail page](../community/workflow-steps/decision.md) for +current catalog metadata and source-review guidance. + +Decision is maintained by [Markus Wondrak](https://github.com/markuswondrak). +Package author metadata is not a substitute for maintainer attribution: +the MIT-licensed manifest credits `spec-kit-decision-step contributors`. + +Decision 0.9.0 declares runtime compatibility with Spec Kit `>=0.11.0`; +installing its +[versioned release archive](https://github.com/markuswondrak/spec-kit-decision-step/releases/download/v0.9.0/decision-0.9.0.zip) +with `--from` requires Spec Kit `>=1.1.0`. The catalog compatibility field is +advisory and is not enforced by the current step installer. + +The package uses the host's PyYAML and `specify_cli` packages. Jev requires +`TYPESAFE_API_KEY` (or a configured `api_key_env`) and outbound HTTPS to the +configured backend endpoint; in-process Laya requires the optional +`laya[onnx]` package. The CLI does not install these dependencies. +See the +[version-pinned documentation](https://github.com/markuswondrak/spec-kit-decision-step/blob/v0.9.0/README.md) +for configuration, outputs, failure behavior, and side effects, and the +[changelog](https://github.com/markuswondrak/spec-kit-decision-step/blob/v0.9.0/CHANGELOG.md) +for release details. + +Review the exact package source before installation and use. Maintainers check +catalog metadata and package shape, not executable Python. Per-file catalog +digests are not an archive checksum, and loading an installed step runs its +import-time Python with your privileges. + +## See also + +- [Community workflow step directory](../community/workflow-steps.md) +- [Step installation and checksum guidance](cli.md#step-management) +- [Step package validation and runtime](developing.md#custom-step-packages) diff --git a/docs/workflow-steps/publishing.md b/docs/workflow-steps/publishing.md index 9f75362876..ae62f699b0 100644 --- a/docs/workflow-steps/publishing.md +++ b/docs/workflow-steps/publishing.md @@ -1,50 +1,181 @@ # Publishing workflow steps -Publish a versioned Python package so workflows can reuse the same step type. -Custom steps use a different catalog and submission contract from workflow -definitions. +> [!NOTE] +> Community workflow step types are independently created and maintained by +> their authors. Maintainers verify submission metadata and package shape; they +> do **not review, audit, endorse, or support the executable Python code**. +> Installation validates and copies the package without importing its Python +> code. Later `specify workflow add`, `run`, and `resume` commands load installed +> step packages, executing import-time code with the user's privileges. Review +> the source before installation and use. -## Prepare a release +Custom workflow step packages add a `type:` that workflows can use beyond the +built-in step types. The canonical intake path is the +[Workflow Step Type Submission](https://github.com/github/spec-kit/issues/new?template=workflow_step_submission.yml) +issue form for new entries, version updates, and metadata corrections. -Provide a package with matching `step.type_key` and `StepBase.type_key`, a -quoted PEP 440-compatible version, an open-source license, and documentation. -Describe installation, configuration, dependencies, outputs, failure behavior, -side effects, and example workflow usage. +Opening the form applies only the `triage-must-have` verdict. A maintainer +applies `workflow-step-submission` during triage to start automated metadata +validation. Successful validation proposes catalog changes +in a draft PR for maintainer review. The automation never installs, imports, +executes, or reviews submitted Python. -Test valid and invalid configuration, returned statuses, and relevant resume -and concurrent execution paths. Publish a versioned archive with `step.yml` -and `__init__.py` at the root or inside exactly one top-level directory. +Accepted entries are published in +[`workflows/step-catalog.community.json`](https://github.com/github/spec-kit/blob/main/workflows/step-catalog.community.json). +The built-in community catalog is **discovery-only**. Accepted entries can +appear in `specify workflow step search` and `info`, but +`specify workflow step add ` will not install executable code from that +source. After reviewing the source, install the submitted versioned archive +directly with `--from`, or use a separately configured step catalog that you +explicitly allow for installation. -After reviewing the source, test installation of the published artifact in a -disposable initialized project: +The [community directory](../community/workflow-steps.md) and its detail pages +are generated from the catalog at documentation build time. Do not maintain a +separate Markdown listing or edit generated pages. Submit all listing metadata +through the issue process; catalog-only updates trigger the normal Pages build. +These are executable Python packages, not +[workflow definitions](../workflows/publishing.md). -```bash -specify workflow step add my-step \ - --from https://github.com/your-org/my-step/releases/download/v1.0.0/my-step-1.0.0.zip +## Package Contract + +One installed package provides one workflow step type: + +```text +my-step/ +├── step.yml +├── __init__.py +└── helpers.py # optional; every catalog-downloaded extra file is declared ``` -Installation validates and copies the package without importing it. Exercise -the installed type through a workflow as well: loading the package executes -Python with your privileges. +The package must satisfy the current installer and loader contract: + +- `step.yml` and `__init__.py` are regular, non-symlink files at the package + root. An archive may wrap the package in exactly one top-level directory. +- `step.type_key`, the catalog key/ID, and the matching + `StepBase.type_key` are identical. +- The ID is one safe path component. The installer rejects separators, leading + dots, trailing dots or spaces, reserved names, control characters, and + Windows-invalid filename characters. Catalog automation additionally requires + lowercase letters, digits, and hyphens, starting with a letter. +- `__init__.py` defines a `StepBase` subclass matching that single type key. + Additional classes do not make the package provide additional registered + step types. This is an author attestation, not a maintainer code check. +- Extra-file paths use forward slashes, are relative and non-empty, contain no + empty, `.` or `..` segments, and do not case-insensitively alias `step.yml`, + `__init__.py`, another file, or a package directory. +- The package stays within the current installer limits: 512 retained entries + (files and directories combined), 32 directory levels, and 50 MiB of retained + content. Submission downloads additionally have a 10 MiB per-file limit. +- `.git`, `__pycache__`, and `.DS_Store` are excluded from installation; + submission automation rejects case-insensitive aliases of these components. + +See [Custom step packages](developing.md#custom-step-packages) for +package validation and runtime behavior, and the +[step installation reference](cli.md#step-management) for installation. + +## Submission Contract + +The issue form separates fields consumed by the current package/catalog code +from provenance and disclosure fields used during metadata review. + +| Submission data | Current contract | +| --- | --- | +| Step type ID | Catalog key, `step.type_key`, and matching `StepBase.type_key` | +| Name, version, description, author | `step.yml` metadata and catalog/installed registry metadata | +| Download URL | Versioned release archive used to test the supported direct-URL installation path | +| `step.yml`, `__init__.py`, and extra-file URLs | Exact HTTPS file URLs consumed when installing from an explicitly install-allowed catalog; extra-file keys follow the package-relative path restrictions above | +| Per-file SHA-256 mapping | Catalog `sha256`; keys must be exactly the files the installer downloads | +| Provided type name/count | Loader invariant: one matching type key per installed package | +| Repository, license, documentation, changelog | Source provenance and metadata-review evidence; these are not `step.yml` fields | +| Spec Kit compatibility | Required intake disclosure; stored as advisory `requires.speckit_version`, not enforced by the installer | +| Runtime and tool dependencies | Required intake disclosure; the CLI does not resolve or install dependencies for custom steps | + +Use a versioned GitHub release URL for the archive, consistent with the other +community submission forms. Versions must be PEP 440-compatible and match the +manifest. The archive's release tag must identify that version, optionally +with a `v` prefix or a scoped prefix, and must contain no slashes. +Epoch versions such as `1!2.0` and local versions such as `2.0+cpu` are +supported. Tag characters must match `^[A-Za-z0-9._~+!-]+$`. +All catalog file URLs must use `raw.githubusercontent.com` in the submitted +repository, pinned to that exact release tag and package directory. The +required per-file SHA-256 mapping detects changed bytes even if a referenced +tag is later moved. Do not submit branch URLs, `releases/latest` URLs, or other +floating targets. + +The archive URL path must match `^[A-Za-z0-9._~+!/-]+$`. Package-relative +file keys and file paths within the tag must match `^[A-Za-z0-9._~/-]+$`. +Spaces, percent escapes (including `%20` in asset names), query strings, +fragments, and empty/dot/traversal file-path segments are not accepted by +community submission automation. Publish archives and package files with +names in these alphabets rather than URL-encoding unsupported characters. + +GitHub-generated `archive/refs/tags/` archives support `.zip` and `.tar.gz` +only. A `.tgz` archive must be a named `releases/download//.tgz` +release asset, not a generated tag archive. + +Documentation may be any tag-pinned Markdown file (`.md`, case-insensitive) +in the submitted GitHub repository, including `docs/deploy.md`; it need not be +named `README.md`. It must explain installation, configuration, dependencies, +outputs, failure behavior, side effects, and example workflow usage. + +The direct `--from` archive installer does not currently accept or verify an +archive digest. The submitted Download URL and Testing Details fields provide +versioned-release and installation-test evidence, not an immutable content +guarantee; the per-file digests protect the separate catalog-installation path. +Automation downloads the complete declared file set in one pass to enforce +the cumulative byte budget. It does not execute the archive or its contents. + +License must be one exact SPDX license identifier from the official license +list, matching the repository license detected at the submitted release tag. +An unknown identifier or known license mismatch fails validation. If release +license detection is unavailable or inconclusive, validation is Blocked for +maintainer clarification rather than guessing a license. This metadata check +is not a legal opinion or code audit. + +## Prepare a Submission + +1. Create a public source repository with the complete package, license, + documentation, and changelog where applicable. +2. Test valid and invalid configuration, `StepStatus`, outputs, errors, and any + relevant resume, nested-step, or concurrent execution behavior. +3. Publish a versioned release archive (`.zip`, `.tar.gz`, or a named `.tgz` + release asset). Before installation, compute the downloaded archive's + SHA-256 and compare it with a digest from a source you trust; obtain one if + missing and stop on a mismatch. The direct installer does not perform this + check. Inspect and unpack those verified bytes and use `--dev` for that + exact local package, then also test the submitted direct URL in a disposable + initialized project (it downloads again): + + ```bash + specify workflow step add my-step \ + --from https://github.com/your-org/my-step/releases/download/v1.0.0/my-step-1.0.0.zip + ``` -## Community submission +4. Publish tag-pinned raw GitHub URLs for `step.yml`, `__init__.py`, and every + extra package file. Compute the SHA-256 digest of each downloaded file. +5. File the canonical submission issue with the exact release metadata and + test evidence. -Follow the [Community Workflow Step Types guide](../community/workflow-steps.md) -for the canonical issue form, versioned archive, individual tag-pinned file -URLs, per-file digests, package limits, and maintainer-triggered metadata -validation. +## Automated Metadata Validation -Do not submit a hand-edited step catalog PR in place of that issue process. -Maintainers validate metadata and distribution evidence, not the submitted -Python code. The community step catalog remains discovery-only. +The maintainer-triggered workflow checks complete metadata, matching manifest +identity, pinned release/file URLs, per-file digests, package paths and limits, +documentation, and author testing attestations. It does not review submitted +code or claim to verify its execution behavior. -## Release updates +Confirmed submission defects produce `validation-failed` and actionable +corrections. Environment failures, including permissions, unavailable tools, +timeouts, and transient HTTP failures, are Blocked rather than submission +defects. Only the guarded conclusion job can apply `validation-passed`, after +successful publication of the draft catalog PR. -Publish a new version when package content changes, and use the same community -submission issue form for version updates and metadata corrections. Preserve -advertised historical releases. Review source again before replacing an -installed package; digest checks identify bytes, not whether those bytes are -safe. +New versions preserve existing catalog release history. Same-version metadata +repairs must be identified explicitly and cannot replace file URLs or digests; +publish a new version when package content changes. +The repository-owned verifier snapshots the expected catalog before edits and +checks the complete generated catalog before PR creation, including migration +of the previous current release and preservation of history. Missing existing +release digests block publication pending maintainer repair. ## See also @@ -52,5 +183,5 @@ safe. - [Python API](api.md) - [Installation CLI](cli.md) - [Step catalogs and releases](catalogs.md) -- [Community submission contract](../community/workflow-steps.md#submission-contract) +- [Community workflow step directory](../community/workflow-steps.md) - [Publishing workflow definitions](../workflows/publishing.md) diff --git a/tests/test_github_workflows.py b/tests/test_github_workflows.py index e6d22669f0..d0aa227ad2 100644 --- a/tests/test_github_workflows.py +++ b/tests/test_github_workflows.py @@ -71,7 +71,7 @@ "workflow-step", "workflow-step-submission", "workflows/step-catalog.community.json", - "docs/community/workflow-steps.md", + None, "Edit only `workflows/step-catalog.community.json`", ), ) diff --git a/tests/test_workflow_step_documentation.py b/tests/test_workflow_step_documentation.py new file mode 100644 index 0000000000..030a4be260 --- /dev/null +++ b/tests/test_workflow_step_documentation.py @@ -0,0 +1,344 @@ +"""Executable step catalog directory, source trust, rendering, and controls.""" + +import copy +import json +import os +import shutil +import subprocess +import sys +from html.parser import HTMLParser +from pathlib import Path + +import pytest +import yaml + +from docs import generate_workflow_steps as generator + + +ROOT = Path(__file__).resolve().parent.parent +GENERATOR = ROOT / "docs/generate_workflow_steps.py" + + +class DirectoryParser(HTMLParser): + def __init__(self): + super().__init__() + self.entries = [] + self.links = [] + self.scripts = [] + + def handle_starttag(self, tag, attrs): + attrs = dict(attrs) + if tag == "li" and attrs.get("class") == "workflow-entry": + self.entries.append(attrs) + if tag == "a": + self.links.append(attrs["href"]) + if tag == "script": + self.scripts.append(attrs.get("src")) + + +@pytest.fixture +def catalog(tmp_path): + entry = { + "id": "sample", "name": "Sample Step", "description": "Review a specification", + "author": "Contributor", "version": "1.2.3", + "repository": "https://github.com/example/steps", + "documentation": "https://github.com/example/steps/blob/v1.2.3/README.md", + "changelog": "https://github.com/example/steps/blob/v1.2.3/CHANGELOG.md", + "download_url": "https://example.com/v1.2.3/package.zip", + "step_yml_url": "https://example.com/v1.2.3/step.yml", + "init_url": "https://example.com/v1.2.3/__init__.py", + "extra_files": {"data/settings.yml": "https://example.com/v1.2.3/data/settings.yml"}, + "sha256": {"step.yml": "a" * 64, "__init__.py": "b" * 64, "data/settings.yml": "c" * 64}, + "requires": {"speckit_version": ">=1.0.0"}, "license": "MIT", "tags": ["review", "planning"], + } + data = {"schema_version": "1.0", "steps": {"sample": entry}} + path = tmp_path / "catalog.json" + path.write_text(json.dumps(data), encoding="utf-8") + return data, path, tmp_path / "docs" + + +def save(data, path): + path.write_text(json.dumps(data), encoding="utf-8") + + +def listing(docs): + return (docs / "_generated/workflow-step-directory.md").read_text(encoding="utf-8") + + +def detail(docs, step_id="sample"): + return (docs / f"community/workflow-steps/{step_id}.md").read_text(encoding="utf-8") + + +def test_real_catalog_remains_unchanged_and_every_package_has_a_static_detail(tmp_path, monkeypatch): + path = ROOT / "workflows/step-catalog.community.json" + original = path.read_bytes() + entries = json.loads(original)["steps"] + monkeypatch.setattr(generator.shared, "urlopen", lambda *a, **k: pytest.fail("Offline generation must not fetch")) + assert generator.generate(path, tmp_path) == len(entries) + parsed = DirectoryParser() + parsed.feed(listing(tmp_path)) + assert len(parsed.entries) == len(entries) + assert parsed.links == [f"workflow-steps/{entry['id']}.md" for entry in generator.load_steps(path)] + assert all("hidden" not in entry for entry in parsed.entries) + for step_id, entry in entries.items(): + page = detail(tmp_path, step_id) + assert generator.escape(entry["name"]) in page + assert generator.escape(entry["download_url"]) in page + for name, value in generator.package_files(entry).items(): + assert f'href="{value}"' in page + assert entry["sha256"][name] in page + assert "discovery-only" in page + assert "import-time Python with your privileges" in page + assert "not enforced" in page + assert "does not\nresolve or install" in page + assert "not a workflow definition" in page + assert "not accept or verify an archive digest" in page + assert "A later --from command downloads again" in page + assert "If digests differ, stop and do not install" in page + assert "individual catalog-downloaded files, not the archive" in page + assert path.read_bytes() == original + + +def test_deterministic_case_insensitive_sort_with_original_label_and_id_ties(catalog): + data, path, docs = catalog + entry = data["steps"]["sample"] + entry.update(name="same", tags=["review", "Review"]) + for step_id, name in (("other", "Same"), ("another", "Same"), ("alpha", "Alpha")): + data["steps"][step_id] = {**copy.deepcopy(entry), "id": step_id, "name": name} + save(data, path) + results = [] + for seed in ("1", "2"): + output = docs / seed + result = subprocess.run( + [sys.executable, str(GENERATOR), "--catalog", str(path), "--docs", str(output)], + capture_output=True, text=True, timeout=30, check=False, + env={**os.environ, "PYTHONHASHSEED": seed}, + ) + assert result.returncode == 0, result.stderr + results.append(listing(output)) + assert results[0] == results[1] + parsed = DirectoryParser() + parsed.feed(results[0]) + assert parsed.links == [f"workflow-steps/{key}.md" for key in ("alpha", "another", "other", "sample")] + assert results[0].index('value="Review"') < results[0].index('value="review"') + del data["steps"]["other"] + save(data, path) + generator.generate(path, docs / "1") + assert not (docs / "1/community/workflow-steps/other.md").exists() + + +def test_optional_metadata_missing_digests_and_legacy_file_urls_are_explicit(catalog): + data, path, docs = catalog + entry = data["steps"]["sample"] + entry["url"] = entry.pop("step_yml_url") + for key in ("repository", "documentation", "changelog", "download_url", "init_url", + "requires", "tags", "license", "sha256"): + del entry[key] + save(data, path) + generator.generate(path, docs, fetch_stars=True) + page = detail(docs) + assert 'href="https://example.com/v1.2.3/__init__.py"' in page + assert "Source repository: Not provided" in page + assert "Author documentation: Not provided" in page + assert "Changelog: Not provided" in page + assert "No release archive URL or archive digest" in page + assert "
    Declared Spec Kit compatibility
    Not specified
    " in page + assert "
    Repository stars
    Unavailable
    " in page + assert "No per-file SHA-256 digests are listed" in page + assert "Obtain and verify integrity digests" in page + assert "exact-version catalog installs require complete per-file digests" in page + data["steps"] = {} + save(data, path) + assert generator.generate(path, docs) == 0 + assert "0 step types" in listing(docs) + assert not (docs / "community/workflow-steps/sample.md").exists() + + +@pytest.mark.parametrize(("field", "value"), [ + ("id", "../escape"), ("name", None), ("author", ""), ("version", 1), + ("repository", "https://user:secret@example.com/repo"), + ("download_url", "javascript:alert(1)"), ("documentation", "https://example.com/\nx"), + ("init_url", "http://example.com/__init__.py"), ("step_yml_url", None), + ("extra_files", []), ("extra_files", {"../escape": "https://example.com/file"}), + ("extra_files", {"STEP.yml": "https://example.com/file"}), + ("extra_files", {"__init__.py/extra": "https://example.com/file"}), + ("extra_files", {"data": "https://example.com/file", "DATA/file": "https://example.com/other"}), + ("extra_files", {"a/.GIT/config": "https://example.com/file"}), + ("extra_files", {"a\\b": "https://example.com/file"}), + ("extra_files", {"/absolute": "https://example.com/file"}), + ("extra_files", {"data": "javascript:alert(1)"}), + ("tags", "review"), ("tags", [None]), ("requires", []), + ("requires", {"speckit_version": None}), ("sha256", "a" * 64), + ("sha256", {}), ("sha256", {"step.yml": "not a hash"}), ("license", []), +]) +def test_invalid_metadata_fails_without_replacing_output(catalog, field, value): + data, path, docs = catalog + generator.generate(path, docs) + original = listing(docs) + original_detail = detail(docs) + data["steps"]["sample"][field] = value + save(data, path) + with pytest.raises(ValueError): + generator.generate(path, docs) + assert listing(docs) == original + assert detail(docs) == original_detail + + +@pytest.mark.parametrize("content", [ + "{", "[]", '{"schema_version":"2.0","steps":{}}', + '{"schema_version":"1.0","steps":[]}', '{"schema_version":"1.0","steps":{"a":[]}}', + '{"schema_version":"1.0","steps":{},"steps":{}}', + '{"schema_version":"1.0","steps":{"../escape":{}}}', +]) +def test_cli_invalid_catalog_has_clear_failure_and_no_output(tmp_path, content): + path = tmp_path / "catalog.json" + path.write_text(content, encoding="utf-8") + output = tmp_path / "docs" + result = subprocess.run( + [sys.executable, str(GENERATOR), "--catalog", str(path), "--docs", str(output)], + capture_output=True, text=True, timeout=30, check=False, + ) + assert result.returncode == 1 + assert "Workflow step documentation generation failed:" in result.stderr + assert not output.exists() + + +@pytest.mark.parametrize("line_break", ["\n", "\r\n", "\r"]) +def test_multiline_metadata_survives_actual_docfx_as_literal_text(catalog, line_break): + data, path, docs = catalog + payload = f'{line_break}{line_break}[injected](javascript:alert%281%29) & |' + entry = data["steps"]["sample"] + for key in ("name", "description", "author", "version", "license", "created_at", "updated_at"): + entry[key] = payload + entry.update(tags=[payload], requires={"speckit_version": payload}) + save(data, path) + generator.generate(path, docs) + for source in (listing(docs), detail(docs)): + assert payload not in source + assert generator.escape(payload) in source + parsed = DirectoryParser() + parsed.feed(listing(docs)) + assert parsed.scripts == ["../assets/workflow-step-catalog.js"] + assert json.loads(parsed.entries[0]["data-step-tags"]) == [payload] + if shutil.which("docfx") is None: + pytest.skip("DocFX is required to verify rendered Markdown") + (docs / "community/workflow-steps.md").write_text( + "# Community Step Types\n\n[!INCLUDE [Directory](../_generated/workflow-step-directory.md)]\n", + encoding="utf-8", + ) + (docs / "docfx.json").write_text(json.dumps({"build": { + "content": [{"files": ["community/**.md"]}], "dest": "_site", "template": ["default", "modern"], + }}), encoding="utf-8") + result = subprocess.run( + [shutil.which("docfx"), "docfx.json", "--logLevel", "Error"], cwd=docs, + capture_output=True, text=True, timeout=120, check=False, + ) + assert result.returncode == 0, result.stdout + result.stderr + for page in ("community/workflow-steps.html", "community/workflow-steps/sample.html"): + rendered = (docs / "_site" / page).read_text(encoding="utf-8") + parsed = DirectoryParser() + parsed.feed(rendered) + assert not any(link.startswith("javascript:") for link in parsed.links) + assert "[injected](javascript:alert%281%29)" in rendered + + +def test_uses_existing_safe_build_time_star_lookup_without_modifying_catalog(catalog, monkeypatch): + data, path, docs = catalog + original = path.read_bytes() + calls = [] + + def stars(entries): + calls.append(entries) + return {entries[0]["repository"]: 0} + + monkeypatch.setattr(generator.shared, "repository_stars", stars) + generator.generate(path, docs) + assert not calls + generator.generate(path, docs, fetch_stars=True) + assert calls == [[data["steps"]["sample"]]] + assert 'aria-label="0 GitHub repository stars"' in listing(docs) + assert "
    Repository stars
    0
    " in detail(docs) + assert path.read_bytes() == original + + +@pytest.mark.skipif(shutil.which("node") is None, reason="Node.js is required to exercise controls") +def test_search_tag_sort_empty_state_url_submit_and_reset(catalog): + data, path, docs = catalog + data["steps"]["other"] = {**copy.deepcopy(data["steps"]["sample"]), + "id": "other", "name": "Another Step", "tags": ["design"]} + save(data, path) + generator.generate(path, docs) + parsed = DirectoryParser() + parsed.feed(listing(docs)) + result = subprocess.run([shutil.which("node"), "-e", r""" +const assert = require("node:assert/strict"); +const fs = require("node:fs"); +const vm = require("node:vm"); +const input = JSON.parse(fs.readFileSync(0, "utf8")); +const entries = input.entries.map((attrs) => ({ + hidden: false, dataset: {stepSearch: attrs["data-step-search"], stepTags: attrs["data-step-tags"]}, +})); +const fields = Object.fromEntries(["q", "tag", "sort"].map((key) => [key, {value: ""}])); +const handlers = {}; +const form = {hidden: true, elements: {namedItem: (name) => fields[name]}, + addEventListener: (event, handler) => {handlers[event] = handler;}}; +const list = {children: [...entries], append: (entry) => { + list.children.splice(list.children.indexOf(entry), 1); list.children.push(entry); +}}; +const status = {}, empty = {}; +const elements = {"[data-step-controls]": form, ".workflow-results": list, + "[data-step-status]": status, "[data-step-empty]": empty}; +let current = new URL("https://example.com/spec-kit/community/workflow-steps.html?q=REVIEW&tag=planning&sort=za&keep=1"); +vm.runInNewContext(input.script, { + document: {querySelector: () => ({querySelector: (key) => elements[key]})}, + window: {location: current, history: {replaceState: (_state, _title, url) => {current = url;}}}, + URL, URLSearchParams, +}); +const visible = () => list.children.filter((entry) => !entry.hidden); +assert.equal(form.hidden, false); +assert.equal(visible().length, 1); +assert.equal(status.textContent, "1 of 2 step types"); +fields.q.value = "missing"; handlers.input(); +assert.equal(visible().length, 0); assert.equal(empty.hidden, false); +handlers.reset(); +assert.equal(visible().length, 2); assert.equal(empty.hidden, true); +assert.equal(list.children[0].dataset.stepTags, '["design"]'); +assert.equal(current.search, "?keep=1"); +fields.sort.value = "za"; handlers.change(); +assert.equal(list.children[0].dataset.stepTags, '["review", "planning"]'); +fields.tag.value = "design"; handlers.change(); assert.equal(visible().length, 1); +fields.q.value = "Sample Contributor"; handlers.input(); assert.equal(visible().length, 0); +handlers.reset(); fields.q.value = "Sample Contributor"; +let prevented = false; +handlers.submit({preventDefault: () => {prevented = true;}}); +assert.equal(prevented, true); assert.equal(visible().length, 1); +"""], input=json.dumps({ + "entries": parsed.entries, + "script": (ROOT / "docs/assets/workflow-step-catalog.js").read_text(encoding="utf-8"), + }), capture_output=True, text=True, timeout=30, check=False) + assert result.returncode == 0, result.stdout + result.stderr + + +def test_catalog_only_deployment_and_canonical_guidance(): + workflow = yaml.safe_load((ROOT / ".github/workflows/docs.yml").read_text(encoding="utf-8")) + assert "workflows/step-catalog.community.json" in workflow[True]["push"]["paths"] + assert workflow[True]["schedule"] == [{"cron": "17 4 * * 1"}] + steps = workflow["jobs"]["build"]["steps"] + generation = next(index for index, step in enumerate(steps) + if step.get("run") == "python3 docs/generate_workflow_steps.py --fetch-stars") + assert steps[generation]["env"] == {"GH_TOKEN": "${{ github.token }}"} + assert generation < next(index for index, step in enumerate(steps) + if "docfx docfx.json" in step.get("run", "")) + config = json.loads((ROOT / "docs/docfx.json").read_text(encoding="utf-8")) + assert "community/workflow-steps/*.md" in config["build"]["content"][0]["files"] + page = (ROOT / "docs/community/workflow-steps.md").read_text(encoding="utf-8") + assert "[!INCLUDE [Community workflow step directory](../_generated/workflow-step-directory.md)]" in page + assert "| Step type |" not in page + publishing = (ROOT / "docs/workflow-steps/publishing.md").read_text(encoding="utf-8") + for heading in ("Package Contract", "Submission Contract", "Prepare a Submission", "Automated Metadata Validation"): + assert f"## {heading}" in publishing + assert "Do not maintain a\nseparate Markdown listing" in publishing + decision = (ROOT / "docs/workflow-steps/decision.md").read_text(encoding="utf-8") + for guidance in ("Markus Wondrak", ">=0.11.0", ">=1.1.0", "TYPESAFE_API_KEY", "laya[onnx]", + "api_key_env", "outbound HTTPS", "spec-kit-decision-step contributors"): + assert guidance in decision diff --git a/tests/test_workflow_step_submission.py b/tests/test_workflow_step_submission.py index 850f2f54e1..2b21b0975d 100644 --- a/tests/test_workflow_step_submission.py +++ b/tests/test_workflow_step_submission.py @@ -63,7 +63,7 @@ def test_step_submission_form_and_compiled_workflow_contract(): assert source["safe-outputs"]["threat-detection"]["continue-on-error"] is False outputs = _safe_output_config(compiled) assert outputs["create_pull_request"]["allowed_files"] == [ - "workflows/step-catalog.community.json", "docs/community/workflow-steps.md", + "workflows/step-catalog.community.json", ] assert outputs["create_pull_request"]["draft"] is True assert outputs["create_pull_request"]["max"] == 1 @@ -74,7 +74,9 @@ def test_step_submission_form_and_compiled_workflow_contract(): assert outputs["remove_labels"]["allowed"] == [ "validation-passed", "validation-failed", "needs-info", ] - assert REPOSITORY_OWNED_DRAFT_PR_EXEMPTION in " ".join(text.split()) + assert REPOSITORY_OWNED_DRAFT_PR_EXEMPTION.replace( + "catalog/docs file updates", "catalog updates", + ) in " ".join(text.split()) assert "{{#runtime-import .github/workflows/add-community-workflow-step.md}}" in compiled_text conclusion = compiled["jobs"]["conclusion"] step = source["jobs"]["conclusion"]["pre-steps"][0] @@ -631,6 +633,26 @@ def catalog_update(file_submission): return data, original, receipt +def test_verified_catalog_alone_generates_the_published_directory(verifier, catalog_update, tmp_path): + from docs import generate_workflow_steps + + data, original, receipt = catalog_update + del original["steps"]["unrelated"] + snapshot = verifier.catalog_snapshot(data, original, receipt) + catalog = snapshot["expected_catalog"] + verifier.verify_generated_catalog(snapshot, catalog) + path = tmp_path / "catalog.json" + path.write_text(json.dumps(catalog), encoding="utf-8") + docs = tmp_path / "docs" + assert generate_workflow_steps.generate(path, docs) == 1 + page = (docs / f"community/workflow-steps/{data['step_id']}.md").read_text(encoding="utf-8") + for field in ("name", "version", "description", "author", "download_url", "documentation"): + assert generate_workflow_steps.escape(data["catalog_entry"][field]) in page + workflow = (WORKFLOWS_DIR / "add-community-workflow-step.md").read_text(encoding="utf-8") + assert "Do not edit `docs/community/workflow-steps.md`" in workflow + assert "Add or update one row" not in workflow + + @pytest.mark.parametrize("key", [ "name", "description", "author", "repository", "download_url", "documentation", "license", ]) From faf0b6f0c1d29605dd67469df76c0d0726676280 Mon Sep 17 00:00:00 2001 From: Manfred Riem <15701806+mnriem@users.noreply.github.com> Date: Mon, 30 Nov 2026 16:17:24 -0600 Subject: [PATCH 2/2] fix(docs): warn that workflow updates import custom steps Include workflow update in generated and canonical step-package warnings. Clarify that imports happen before update checks and protect the guidance with a regression test. Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/community/workflow-steps.md | 5 +++-- docs/generate_workflow_steps.py | 4 ++-- docs/workflow-steps/cli.md | 6 ++++-- docs/workflow-steps/developing.md | 5 +++-- docs/workflow-steps/publishing.md | 7 ++++--- tests/test_workflow_step_documentation.py | 19 +++++++++++++++++++ 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/docs/community/workflow-steps.md b/docs/community/workflow-steps.md index df7dd36607..f02d6c29d3 100644 --- a/docs/community/workflow-steps.md +++ b/docs/community/workflow-steps.md @@ -9,8 +9,9 @@ Spec Kit's built-in workflow step types. They are distinct from > review, audit, endorse, or support submitted Python code. You must vet the > exact release, dependencies, and side effects before installation and use. > Installation copies and validates files without importing Python, but later -> `specify workflow add`, `run`, and `resume` load installed step packages and -> execute import-time code with your privileges. +> `specify workflow add`, `update`, `run`, and `resume` load installed step +> packages and execute import-time code with your privileges, even before +> checking for workflow updates or executing a particular custom step. ## Available Step Types diff --git a/docs/generate_workflow_steps.py b/docs/generate_workflow_steps.py index ad20feef56..6928936bf3 100644 --- a/docs/generate_workflow_steps.py +++ b/docs/generate_workflow_steps.py @@ -210,9 +210,9 @@ def detail(entry: dict, stars: int | None) -> str:

    Catalog package files

      {files}

    Installation validates and copies the package without importing its Python. -Later specify workflow add, run, and resume +Later specify workflow add, update, run, and resume load installed step packages and execute import-time Python with your privileges, -even before a particular custom step executes. This is not a sandbox. +even before checking for workflow updates or executing a particular custom step. This is not a sandbox. Test unfamiliar packages in a disposable project and remove packages you no longer trust.

    See also

    • Step installation options
    • diff --git a/docs/workflow-steps/cli.md b/docs/workflow-steps/cli.md index bec46be091..426e08a6bb 100644 --- a/docs/workflow-steps/cli.md +++ b/docs/workflow-steps/cli.md @@ -96,8 +96,10 @@ automatic rollback is attempted. ### Listing, running, and removing Installed custom steps appear in `specify workflow step list` and are loaded -automatically by `workflow add`, `workflow run`, and `workflow resume`. Remove -one with: +automatically by `workflow add`, `workflow update`, `workflow run`, and +`workflow resume`. Loading executes import-time Python with your privileges, +even before checking for workflow updates or executing a particular custom +step. Remove one with: ```bash specify workflow step remove my-step diff --git a/docs/workflow-steps/developing.md b/docs/workflow-steps/developing.md index f57c5f4480..560efbd20d 100644 --- a/docs/workflow-steps/developing.md +++ b/docs/workflow-steps/developing.md @@ -59,8 +59,9 @@ Every source is validated identically before anything is committed: 10 MiB per archive member. Catalog files have a 50 MiB per-response bound. - Installation validates and copies the package but does **not** import or execute `__init__.py`. Installed custom step modules are loaded during startup - of `workflow add`, `workflow run`, and `workflow resume`, before any particular - custom step necessarily executes. + of `workflow add`, `workflow update`, `workflow run`, and `workflow resume`, + even before checking for workflow updates or executing a particular custom + step. > **Security note:** Loading a custom step runs its Python with **your** > privileges. Only install and retain step packages from sources you trust. diff --git a/docs/workflow-steps/publishing.md b/docs/workflow-steps/publishing.md index ae62f699b0..a8f35bef81 100644 --- a/docs/workflow-steps/publishing.md +++ b/docs/workflow-steps/publishing.md @@ -5,9 +5,10 @@ > their authors. Maintainers verify submission metadata and package shape; they > do **not review, audit, endorse, or support the executable Python code**. > Installation validates and copies the package without importing its Python -> code. Later `specify workflow add`, `run`, and `resume` commands load installed -> step packages, executing import-time code with the user's privileges. Review -> the source before installation and use. +> code. Later `specify workflow add`, `update`, `run`, and `resume` commands load +> installed step packages, executing import-time code with the user's privileges, +> even before checking for workflow updates or executing a particular custom +> step. Review the source before installation and use. Custom workflow step packages add a `type:` that workflows can use beyond the built-in step types. The canonical intake path is the diff --git a/tests/test_workflow_step_documentation.py b/tests/test_workflow_step_documentation.py index 030a4be260..300e2f3136 100644 --- a/tests/test_workflow_step_documentation.py +++ b/tests/test_workflow_step_documentation.py @@ -99,6 +99,25 @@ def test_real_catalog_remains_unchanged_and_every_package_has_a_static_detail(tm assert path.read_bytes() == original +def test_import_warning_covers_workflow_update_before_any_update_check(catalog): + _, path, docs = catalog + generator.generate(path, docs) + page = detail(docs) + assert ( + "Later specify workflow add, update, " + "run, and resume" + ) in page + assert "before checking for workflow updates" in page + for relative in ( + "community/workflow-steps.md", + "workflow-steps/publishing.md", + "workflow-steps/developing.md", + "workflow-steps/cli.md", + ): + source = (ROOT / "docs" / relative).read_text(encoding="utf-8") + assert "`update`" in source or "`workflow update`" in source + + def test_deterministic_case_insensitive_sort_with_original_label_and_id_ties(catalog): data, path, docs = catalog entry = data["steps"]["sample"]