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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
baseline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22.14.0
- name: Check whitespace
run: git diff --check "$(git hash-object -t tree /dev/null)" HEAD
- name: Check generator syntax
run: node --check scripts/generate.mjs
- name: Test shared-source generation and drift rejection
run: npm test
- name: Verify committed generated content
run: npm run check
- name: Verify and exercise published CLI
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(node -p 'JSON.parse(require("fs").readFileSync("content/cli-release.json")).version')
archive="stack-v${version}-x86_64-unknown-linux-gnu.tar.gz"
mkdir "$RUNNER_TEMP/stack-release"
gh release download "v${version}" --repo stack-sh/cli --pattern "$archive" --dir "$RUNNER_TEMP/stack-release"
gh attestation verify "$RUNNER_TEMP/stack-release/$archive" --repo stack-sh/cli
tar -xzf "$RUNNER_TEMP/stack-release/$archive" -C "$RUNNER_TEMP/stack-release"
STACK_CLI_BIN="$RUNNER_TEMP/stack-release/stack-v${version}-x86_64-unknown-linux-gnu/stack" npm run smoke
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Repository guide

This repository owns shared user documentation and agent guidance. Write repository content, code comments, commits, and pull requests in English; translated documentation keeps its target language.

Edit sources under `content/`, not files under `generated/`. Run `npm run generate`, `npm run check`, and `npm test`. Commit generated changes together with their sources. Keep generation deterministic and offline.

Language syntax, schemas, and canonical examples belong to `stack-sh/specification`. CLI-specific contracts belong to `stack-sh/cli`. Link to those owners instead of creating competing contracts here.

Preserve the public documentation URLs and the `npx skills add stack-sh/cli` installation entry point. Consumer updates must pin a merged provider commit and validate generated content before publication. Use topic branches and pull requests; never push implementation directly to main.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
# docs
# Stack documentation sources

Canonical user documentation and generated agent guidance for Stack architecture diagrams.

## Ownership

Edit the shared agent workflow in `content/agent-workflow.md`. Both the installable
skill and the human-readable workflow are generated from this one source. Skill
discovery metadata lives in `content/skill-metadata.json`, and published CLI
identity lives in `content/cli-release.json`.

Language syntax, schemas, and canonical examples remain owned by
[stack-sh/specification](https://github.com/stack-sh/specification).
[stack-sh/cli](https://github.com/stack-sh/cli) owns native command behavior and the
`npx skills add stack-sh/cli` installation entry point.
[stack-sh/web](https://github.com/stack-sh/web) owns the playground and deployment
at [stack-diagram.com/docs](https://stack-diagram.com/docs).

## Generate and verify

Node.js 22 or newer is required. There are no generation dependencies or install scripts.

```sh
npm run generate
npm test
npm run check
```

Commit source and generated changes together. Do not edit `generated/` directly.
Check mode rejects modified, missing, or unexpected generated files. Generation
does not silently delete old files. The manifest records SHA-256 values and the
published CLI revision; hashes prove byte integrity, not publisher identity.

Consumers must pin a reviewed, merged commit and verify its manifest and files.
The CLI's source revision is distinct from the documentation revision: updating
instructions does not publish a new CLI binary. Recheck capability statements
against the released binary's help when updating the release lock; changing a
version string alone does not prove a feature is available.

## Migration status

Shared workflow generation is available here. CLI and Web consumption, the full
multilingual guide migration, and automated consumer freshness checks are still
being integrated. Existing public documentation and skill installation remain
available from their current repositories until those consumer changes land.
40 changes: 40 additions & 0 deletions content/agent-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Stack diagrams

Deliver editable `.stack` source and, when rendering is available, an SVG. Preserve the requested architecture and existing unrelated content. Stack describes architecture; it does not provision resources or execute application code.

## Start with the available tools

Run `stack --version` and `stack help` before selecting commands. Use the installed binary's help, not unreleased repository instructions. The published CLI {{cliVersion}} supports `check`, `fmt`, and `render`; it does not support their `--json` flags. A newer version may support additional options: verify them using `stack help <command>`.

If the CLI is missing, consult the [installation guide](https://stack-diagram.com/docs/guide/getting-started.md) and [release distribution contract](https://github.com/stack-sh/cli/blob/v{{cliVersion}}/docs/distribution.md). Install only when the user's authorization allows it. Otherwise provide source with an explicit validation gap; do not report it as checked. No remote source upload is required.

## Read only the relevant reference

Start with [syntax](https://stack-diagram.com/docs/language/syntax.md), [nodes and groups](https://stack-diagram.com/docs/language/nodes-and-groups.md), and [edges and layout](https://stack-diagram.com/docs/language/edges-and-layout.md) when the grammar is unfamiliar. Find complete examples in the [gallery](https://stack-diagram.com/docs/examples/index.md). The [documentation index](https://stack-diagram.com/docs/llms.txt) links the remaining references. If the client cannot fetch one resource, try its Markdown page or report the missing information rather than inventing syntax.

Non-obvious constraints:

- One `stack 1.0` declaration and one named `diagram`; node/group IDs are globally unique.
- Declare edges at diagram scope. Endpoints are node IDs, not labels or groups.
- Model technologies using labels and `detail`; choose semantic `kind` values from the reference. Do not invent properties such as coordinates, colors, or ports.
- Prefer automatic layout or `direction` initially. `order` controls relative cross-axis ordering, not execution sequence; add `rank` or `order` only when the user needs that constraint. References must be direct children of that layout scope.
- Do not guess vendor icon IDs. Consult [provider icons](https://stack-diagram.com/docs/guide/provider-icons.md), query `stack icons list`, and verify the required pack is installed. Import downloads and terms acceptance need appropriate user authorization. If no pack is available, use the semantic kind fallback and explain that branded artwork is absent.

## Generate, validate, and render

For a new diagram, start with the smallest complete source that preserves the requested components and relationships. For an edit, inspect the existing source first and retain unrelated nodes, edges, labels, and comments.

Using the user's actual filenames:

```sh
stack check architecture.stack
stack fmt architecture.stack
stack check architecture.stack
stack render architecture.stack -o architecture.svg
```

`fmt` changes the source in place; avoid unrelated formatting when it would obscure a narrowly requested edit. Rendering to a file may replace it, so honor existing artifact ownership.

Read both the exit status and diagnostics. An exit code of zero can still carry warnings. Fix unknown references or invalid syntax from the diagnostic ranges; never remove requested architecture merely to make validation pass. Investigate layout warnings without treating an optional visual hint as a required semantic relationship. Missing-icon warnings mean the image rendered with a fallback, not that provider artwork was found. Bound repeated repair attempts and report a remaining blocker rather than silently weakening the task.

After rendering, inspect the SVG visually when a suitable viewer is available. Compiler success does not prove readable layout. Confirm the requested nodes, boundaries, relationships, and labels remain present. Report the source/SVG paths, CLI version, validation result, and any unresolved warnings or unverified visual behavior.
5 changes: 5 additions & 0 deletions content/cli-release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"repository": "stack-sh/cli",
"revision": "7f4066884f7902d4c582d45184f3a9019fe59bf7",
"version": "0.4.0"
}
5 changes: 5 additions & 0 deletions content/skill-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "stack-diagrams",
"description": "Create or edit Stack (.stack) software architecture diagrams, validate them with the Stack CLI, and render SVG. Use for Stack diagrams or when a user chooses Stack for architecture documentation; not for infrastructure provisioning or unrelated programming stacks.",
"license": "Apache-2.0"
}
42 changes: 42 additions & 0 deletions generated/guide/agent-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!-- Generated from stack-sh/docs/content/agent-workflow.md. Do not edit. -->

# Stack diagrams

Deliver editable `.stack` source and, when rendering is available, an SVG. Preserve the requested architecture and existing unrelated content. Stack describes architecture; it does not provision resources or execute application code.

## Start with the available tools

Run `stack --version` and `stack help` before selecting commands. Use the installed binary's help, not unreleased repository instructions. The published CLI 0.4.0 supports `check`, `fmt`, and `render`; it does not support their `--json` flags. A newer version may support additional options: verify them using `stack help <command>`.

If the CLI is missing, consult the [installation guide](https://stack-diagram.com/docs/guide/getting-started.md) and [release distribution contract](https://github.com/stack-sh/cli/blob/v0.4.0/docs/distribution.md). Install only when the user's authorization allows it. Otherwise provide source with an explicit validation gap; do not report it as checked. No remote source upload is required.

## Read only the relevant reference

Start with [syntax](https://stack-diagram.com/docs/language/syntax.md), [nodes and groups](https://stack-diagram.com/docs/language/nodes-and-groups.md), and [edges and layout](https://stack-diagram.com/docs/language/edges-and-layout.md) when the grammar is unfamiliar. Find complete examples in the [gallery](https://stack-diagram.com/docs/examples/index.md). The [documentation index](https://stack-diagram.com/docs/llms.txt) links the remaining references. If the client cannot fetch one resource, try its Markdown page or report the missing information rather than inventing syntax.

Non-obvious constraints:

- One `stack 1.0` declaration and one named `diagram`; node/group IDs are globally unique.
- Declare edges at diagram scope. Endpoints are node IDs, not labels or groups.
- Model technologies using labels and `detail`; choose semantic `kind` values from the reference. Do not invent properties such as coordinates, colors, or ports.
- Prefer automatic layout or `direction` initially. `order` controls relative cross-axis ordering, not execution sequence; add `rank` or `order` only when the user needs that constraint. References must be direct children of that layout scope.
- Do not guess vendor icon IDs. Consult [provider icons](https://stack-diagram.com/docs/guide/provider-icons.md), query `stack icons list`, and verify the required pack is installed. Import downloads and terms acceptance need appropriate user authorization. If no pack is available, use the semantic kind fallback and explain that branded artwork is absent.

## Generate, validate, and render

For a new diagram, start with the smallest complete source that preserves the requested components and relationships. For an edit, inspect the existing source first and retain unrelated nodes, edges, labels, and comments.

Using the user's actual filenames:

```sh
stack check architecture.stack
stack fmt architecture.stack
stack check architecture.stack
stack render architecture.stack -o architecture.svg
```

`fmt` changes the source in place; avoid unrelated formatting when it would obscure a narrowly requested edit. Rendering to a file may replace it, so honor existing artifact ownership.

Read both the exit status and diagnostics. An exit code of zero can still carry warnings. Fix unknown references or invalid syntax from the diagnostic ranges; never remove requested architecture merely to make validation pass. Investigate layout warnings without treating an optional visual hint as a required semantic relationship. Missing-icon warnings mean the image rendered with a fallback, not that provider artwork was found. Bound repeated repair attempts and report a remaining blocker rather than silently weakening the task.

After rendering, inspect the SVG visually when a suitable viewer is available. Compiler success does not prove readable layout. Confirm the requested nodes, boundaries, relationships, and labels remain present. Report the source/SVG paths, CLI version, validation result, and any unresolved warnings or unverified visual behavior.
18 changes: 18 additions & 0 deletions generated/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"schemaVersion": "1.0",
"cli": {
"repository": "stack-sh/cli",
"revision": "7f4066884f7902d4c582d45184f3a9019fe59bf7",
"version": "0.4.0"
},
"files": [
{
"path": "skills/stack-diagrams/SKILL.md",
"sha256": "a7f39a9d3da0f7074ea348bebb0260a642f202ee5f2026742c08972f75c7f2a6"
},
{
"path": "guide/agent-workflow.md",
"sha256": "66fe4c3c97afad3a740d9ab824c5aae3f43783bfa251fe0347666b38bc3afc9b"
}
]
}
48 changes: 48 additions & 0 deletions generated/skills/stack-diagrams/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: "stack-diagrams"
description: "Create or edit Stack (.stack) software architecture diagrams, validate them with the Stack CLI, and render SVG. Use for Stack diagrams or when a user chooses Stack for architecture documentation; not for infrastructure provisioning or unrelated programming stacks."
license: "Apache-2.0"
---

<!-- Generated from stack-sh/docs/content/agent-workflow.md. Do not edit. -->

# Stack diagrams

Deliver editable `.stack` source and, when rendering is available, an SVG. Preserve the requested architecture and existing unrelated content. Stack describes architecture; it does not provision resources or execute application code.

## Start with the available tools

Run `stack --version` and `stack help` before selecting commands. Use the installed binary's help, not unreleased repository instructions. The published CLI 0.4.0 supports `check`, `fmt`, and `render`; it does not support their `--json` flags. A newer version may support additional options: verify them using `stack help <command>`.

If the CLI is missing, consult the [installation guide](https://stack-diagram.com/docs/guide/getting-started.md) and [release distribution contract](https://github.com/stack-sh/cli/blob/v0.4.0/docs/distribution.md). Install only when the user's authorization allows it. Otherwise provide source with an explicit validation gap; do not report it as checked. No remote source upload is required.

## Read only the relevant reference

Start with [syntax](https://stack-diagram.com/docs/language/syntax.md), [nodes and groups](https://stack-diagram.com/docs/language/nodes-and-groups.md), and [edges and layout](https://stack-diagram.com/docs/language/edges-and-layout.md) when the grammar is unfamiliar. Find complete examples in the [gallery](https://stack-diagram.com/docs/examples/index.md). The [documentation index](https://stack-diagram.com/docs/llms.txt) links the remaining references. If the client cannot fetch one resource, try its Markdown page or report the missing information rather than inventing syntax.

Non-obvious constraints:

- One `stack 1.0` declaration and one named `diagram`; node/group IDs are globally unique.
- Declare edges at diagram scope. Endpoints are node IDs, not labels or groups.
- Model technologies using labels and `detail`; choose semantic `kind` values from the reference. Do not invent properties such as coordinates, colors, or ports.
- Prefer automatic layout or `direction` initially. `order` controls relative cross-axis ordering, not execution sequence; add `rank` or `order` only when the user needs that constraint. References must be direct children of that layout scope.
- Do not guess vendor icon IDs. Consult [provider icons](https://stack-diagram.com/docs/guide/provider-icons.md), query `stack icons list`, and verify the required pack is installed. Import downloads and terms acceptance need appropriate user authorization. If no pack is available, use the semantic kind fallback and explain that branded artwork is absent.

## Generate, validate, and render

For a new diagram, start with the smallest complete source that preserves the requested components and relationships. For an edit, inspect the existing source first and retain unrelated nodes, edges, labels, and comments.

Using the user's actual filenames:

```sh
stack check architecture.stack
stack fmt architecture.stack
stack check architecture.stack
stack render architecture.stack -o architecture.svg
```

`fmt` changes the source in place; avoid unrelated formatting when it would obscure a narrowly requested edit. Rendering to a file may replace it, so honor existing artifact ownership.

Read both the exit status and diagnostics. An exit code of zero can still carry warnings. Fix unknown references or invalid syntax from the diagnostic ranges; never remove requested architecture merely to make validation pass. Investigate layout warnings without treating an optional visual hint as a required semantic relationship. Missing-icon warnings mean the image rendered with a fallback, not that provider artwork was found. Bound repeated repair attempts and report a remaining blocker rather than silently weakening the task.

After rendering, inspect the SVG visually when a suitable viewer is available. Compiler success does not prove readable layout. Confirm the requested nodes, boundaries, relationships, and labels remain present. Report the source/SVG paths, CLI version, validation result, and any unresolved warnings or unverified visual behavior.
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@stack-sh/docs",
"version": "0.1.0",
"private": true,
"type": "module",
"license": "Apache-2.0",
"scripts": {
"generate": "node scripts/generate.mjs",
"check": "node scripts/generate.mjs --check",
"test": "node --test scripts/*.test.mjs",
"smoke": "node scripts/smoke-skill.mjs"
}
}
Loading