diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3897178..af5a0e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,7 +70,12 @@ jobs: run: | test -s README.md test -s AGENTS.md - test -s LICENSING.md + test -s LICENSE + test -s NOTICE + test -s THIRD_PARTY_LICENSES.md + test -s CONTRIBUTING.md + test -s SECURITY.md + test -s docs/publication-audit.md test -s Cargo.toml test -s Cargo.lock test -s src/main.rs diff --git a/AGENTS.md b/AGENTS.md index 1fde1ac..c2c27ff 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,16 +6,17 @@ Write repository content, code comments, commit messages, issues, and pull reque ## Architecture -- Keep this repository focused on the native `stack` command, host I/O, exit codes, configuration discovery, and future authenticated theme delivery. +- Keep this repository focused on the native `stack` command, host I/O, exit codes, configuration discovery, provider-pack import, and notice output. - Link `stack-engine` as a native Rust dependency; do not duplicate compiler, formatter, layout, or SVG-rendering logic. -- Keep user authentication, token issuance, billing, and entitlement authority in the future web service. The CLI may only act as a scoped client. -- Do not add auth or entitlement behavior before its threat model, token lifecycle, storage mechanism, and public service contract are reviewed. +- Keep provider-pack import, local cache behavior, provenance display, and notice output at the CLI boundary. Do not make the engine read the filesystem or network. +- Do not add authentication, billing, entitlement, or proprietary-theme delivery behavior; they are outside the product roadmap. ## Licensing and security -- Do not describe this private source repository as open source or add an open-source `LICENSE` without an explicit product decision. -- Complete `LICENSING.md` release requirements before distributing a CLI binary externally. -- Never commit credentials, tokens, private keys, signing material, paid-theme contents, customer data, or local auth state. +- Repository-authored work is Apache-2.0. Record every distributed dependency and asset in `THIRD_PARTY_LICENSES.md` before release. +- Do not bundle vendor icons unless their exact terms permit the relevant source, binary, and generated-output distribution channels. Preserve upstream artwork, provenance, and notices. +- Never commit credentials, tokens, private keys, signing material, customer data, or local auth state. +- Report security vulnerabilities privately through the process in `SECURITY.md`. ## Delivery diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bc4672f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# Contributing to Stack CLI + +Thank you for helping improve the native Stack command-line experience. + +## Before starting + +- Search existing issues before opening a new one. +- Keep changes focused on native command behavior, host I/O, exit codes, configuration discovery, provider-pack import, or notice output. +- Propose language, compiler, theme, formatter, layout, or SVG-rendering changes in the repository that owns that contract. +- Do not include credentials, private data, signing material, or third-party assets without complete provenance and redistribution terms. + +For a larger behavioral change, open an issue first so its repository and compatibility boundary can be agreed before implementation. + +## Development checks + +The minimum supported Rust version is 1.85. Run the same core checks used by CI: + +```sh +cargo fmt --check +cargo test --locked +cargo clippy --all-targets --all-features --locked -- -D warnings +RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --locked +cargo build --release --locked +``` + +Formatter conformance also requires a checkout of the pinned Stack specification revision: + +```sh +STACK_SPECIFICATION_DIR=../specification \ + cargo test --features conformance --test formatter-conformance --locked +``` + +## Pull requests + +- Write source, comments, commits, issues, and pull requests in English. +- Add tests for behavior changes and keep standard output machine-readable. +- Explain compatibility, host-I/O, and license effects in the pull request. +- Keep generated output, local state, and build artifacts out of commits. + +Unless explicitly stated otherwise, contributions intentionally submitted for inclusion are licensed under Apache-2.0 as described by Section 5 of the repository license. diff --git a/Cargo.lock b/Cargo.lock index a953a67..7a7d85f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,12 +85,12 @@ dependencies = [ [[package]] name = "stack-compiler" version = "0.1.0" -source = "git+https://github.com/stack-sh/compiler.git?rev=17a0abe9c35e641761ff08fdf59b29a42828d9fd#17a0abe9c35e641761ff08fdf59b29a42828d9fd" +source = "git+https://github.com/stack-sh/compiler.git?rev=3d2379483da1edaeb24a26d43743587a4f5bd645#3d2379483da1edaeb24a26d43743587a4f5bd645" [[package]] name = "stack-engine" -version = "0.1.0" -source = "git+https://github.com/stack-sh/engine.git?rev=07b71c783a3c1f9037d865b19672a9522eb0b24d#07b71c783a3c1f9037d865b19672a9522eb0b24d" +version = "0.3.0" +source = "git+https://github.com/stack-sh/engine.git?rev=e1240661b6d8cebd95ef24207618a62fadb15b48#e1240661b6d8cebd95ef24207618a62fadb15b48" dependencies = [ "stack-compiler", "stack-formatter", @@ -100,15 +100,15 @@ dependencies = [ [[package]] name = "stack-formatter" version = "0.1.0" -source = "git+https://github.com/stack-sh/engine.git?rev=07b71c783a3c1f9037d865b19672a9522eb0b24d#07b71c783a3c1f9037d865b19672a9522eb0b24d" +source = "git+https://github.com/stack-sh/engine.git?rev=e1240661b6d8cebd95ef24207618a62fadb15b48#e1240661b6d8cebd95ef24207618a62fadb15b48" dependencies = [ "stack-compiler", ] [[package]] name = "stack-theme" -version = "0.1.0" -source = "git+https://github.com/stack-sh/theme.git?rev=ed6c500762fc9ccffc8777172ac672a716dcd916#ed6c500762fc9ccffc8777172ac672a716dcd916" +version = "0.2.0" +source = "git+https://github.com/stack-sh/theme.git?rev=d25b883884420adcc124e4c9c786ad92925eae60#d25b883884420adcc124e4c9c786ad92925eae60" dependencies = [ "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 0456099..ea29f40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,13 +6,15 @@ rust-version = "1.85" publish = false description = "Native command-line interface for Stack diagrams" repository = "https://github.com/stack-sh/cli" +license = "Apache-2.0" +readme = "README.md" [[bin]] name = "stack" path = "src/main.rs" [dependencies] -stack-engine = { git = "https://github.com/stack-sh/engine.git", rev = "07b71c783a3c1f9037d865b19672a9522eb0b24d" } +stack-engine = { git = "https://github.com/stack-sh/engine.git", rev = "e1240661b6d8cebd95ef24207618a62fadb15b48" } [features] conformance = [] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSING.md b/LICENSING.md deleted file mode 100644 index 2d62054..0000000 --- a/LICENSING.md +++ /dev/null @@ -1,14 +0,0 @@ -# Licensing status - -The source code in this private repository is not currently offered under an open-source license. No external source or binary distribution terms have been selected. - -Before the first external CLI release, the release process must: - -- define and publish the terms governing use and redistribution of the CLI binary; -- generate a complete inventory of distributed dependencies and their licenses; -- include the Apache-2.0 license and any required notices for distributed Stack Engine code; -- include all third-party license texts and attributions required by shipped dependencies; -- keep paid or proprietary theme bundles under separate product terms; -- receive a legal review if authentication, billing, export controls, telemetry, or commercial distribution materially changes the risk profile. - -This file documents repository policy and does not itself grant a license. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..78906c6 --- /dev/null +++ b/NOTICE @@ -0,0 +1,5 @@ +Stack CLI +Copyright 2026 Stack contributors + +This product includes software developed by the Stack project +(https://github.com/stack-sh). diff --git a/README.md b/README.md index 19b8bf2..3a4b916 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Stack CLI -`stack-sh/cli` is the private source repository for the native Rust `stack` command. +`stack-sh/cli` is the open-source native Rust `stack` command for Stack architecture diagrams. -The repository contains native validation, formatting, and rendering commands. The CLI is not yet distributed as a supported external binary and its interface remains pre-release. +The repository contains native validation, formatting, and rendering commands. The interface remains pre-release and no supported binary distribution is published yet. ## Commands @@ -27,9 +27,9 @@ stack render arch.stack -o arch.svg | One or more Stack error diagnostics, or `fmt --check` finds a difference | `1` | | Invalid arguments, host I/O failure, or engine operational failure | `2` | -The CLI will link `stack-engine` as a native Rust dependency. It owns filesystem and standard-stream behavior, process exit codes, configuration discovery, and command presentation. It must not duplicate compiler, formatter, layout, or SVG-rendering logic. +The CLI links `stack-engine` as a native Rust dependency. It owns filesystem and standard-stream behavior, process exit codes, configuration discovery, provider-pack import, notice output, and command presentation. It must not duplicate compiler, formatter, layout, or SVG-rendering logic. -Future authenticated theme delivery may add a client for short-lived, scope-limited Stack tokens and entitlement-aware theme downloads. Credentials and downloaded paid-theme contents must never be committed to this repository. +The bundled engine resolves the provider-neutral core icons `api`, `web`, `mobile`, `desktop`, `server`, `container`, `cluster`, `cloud`, `scheduler`, `webhook`, `identity`, and `observability`. Vendor assets are not bundled unless their exact terms permit software redistribution. Future provider-pack support will preserve upstream artwork and attach source and terms metadata. ## Development @@ -45,6 +45,8 @@ CI validates formatting, unit and process-level integration tests, at least 90% Canonical formatter behavior is checked against the pinned `stack-sh/specification` fixture revision recorded in `tests/specification-revision`. +See [CONTRIBUTING.md](./CONTRIBUTING.md) before opening a change. Please report security vulnerabilities through the process in [SECURITY.md](./SECURITY.md), not a public issue. + ## Licensing -The private source code in this repository is not currently offered under an open-source license. See [LICENSING.md](./LICENSING.md) for the decisions required before external distribution. +Repository-authored work is licensed under the [Apache License 2.0](./LICENSE) for personal and commercial use. Runtime and build dependency licenses are recorded in [THIRD_PARTY_LICENSES.md](./THIRD_PARTY_LICENSES.md). A future binary release must ship the applicable license and notice files described there. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..a411107 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,13 @@ +# Security policy + +## Supported versions + +Stack CLI is pre-release. Security fixes are applied to the latest revision on `main`; no released binary version is currently supported. + +## Reporting a vulnerability + +Do not open a public issue for a suspected vulnerability. Use GitHub's private vulnerability reporting for `stack-sh/cli` so maintainers can investigate before disclosure. + +Include the affected revision, reproduction steps, impact, and any suggested mitigation. Do not include real credentials, customer data, or other people's private information in the report. + +The project will acknowledge a report, assess its scope, and coordinate remediation and disclosure through the private report. This policy does not promise a bug bounty or a fixed response deadline. diff --git a/THIRD_PARTY_LICENSES.md b/THIRD_PARTY_LICENSES.md new file mode 100644 index 0000000..4273819 --- /dev/null +++ b/THIRD_PARTY_LICENSES.md @@ -0,0 +1,40 @@ +# Third-party licenses + +Audit date: 2026-09-04 + +## Runtime dependencies + +| Component | Version or revision | License | Source | Distribution note | +| --- | --- | --- | --- | --- | +| `stack-engine` / `stack-formatter` | `e1240661b6d8cebd95ef24207618a62fadb15b48` | Apache-2.0 | | Linked into the native binary; includes the repository-authored core icon catalog through `stack-theme`. | +| `stack-compiler` | `3d2379483da1edaeb24a26d43743587a4f5bd645` | Apache-2.0 | | Linked transitively through `stack-engine`. | +| `stack-theme` | `d25b883884420adcc124e4c9c786ad92925eae60` | Apache-2.0 | | Linked transitively through `stack-engine`; its 30 fallback and 12 explicit core SVGs are Stack-authored Apache-2.0 assets. | +| `serde` / `serde_core` | `1.0.229` | MIT OR Apache-2.0 | | Runtime catalog data types through `stack-theme`. | +| `serde_json` | `1.0.151` | MIT OR Apache-2.0 | | Embedded catalog decoding through `stack-theme`. | +| `itoa` | `1.0.18` | MIT OR Apache-2.0 | | Transitive runtime dependency of `serde_json`. | +| `memchr` | `2.8.3` | Unlicense OR MIT | | Transitive runtime dependency of `serde_json`. | +| `zmij` | `1.0.23` | MIT | | Transitive runtime dependency of `serde_json`. | + +## Build-only dependencies + +| Component | Version | License | Source | Distribution note | +| --- | --- | --- | --- | --- | +| `serde_derive` | `1.0.229` | MIT OR Apache-2.0 | | Procedural macro; not linked into the release binary. | +| `proc-macro2` | `1.0.107` | MIT OR Apache-2.0 | | Procedural-macro build dependency; not linked into the release binary. | +| `quote` | `1.0.47` | MIT OR Apache-2.0 | | Procedural-macro build dependency; not linked into the release binary. | +| `syn` | `3.0.4` | MIT OR Apache-2.0 | | Procedural-macro build dependency; not linked into the release binary. | +| `unicode-ident` | `1.0.24` | (MIT OR Apache-2.0) AND Unicode-3.0 | | Procedural-macro build dependency; not linked into the release binary. | + +No third-party vendor icon is bundled in the repository or binary. Provider-specific assets require a separate rights record covering source revision, copyright, trademark restrictions, modification, software redistribution, commercial diagram output, and required notices. + +## Binary distribution requirements + +A future binary archive must include: + +- this repository's `LICENSE` and `NOTICE`; +- this inventory at the dependency versions resolved in that release's `Cargo.lock`; +- the Apache-2.0 text for Stack dependencies and dependencies distributed under the Apache-2.0 option; +- the complete MIT notices selected for `memchr`, `zmij`, and any dependency distributed under the MIT option; +- any additional license text or attribution introduced by a later runtime dependency or provider pack. + +Build-only dependencies do not require inclusion in a binary archive when none of their source or object code is distributed, but they remain listed here so the audited build graph is reproducible. diff --git a/docs/publication-audit.md b/docs/publication-audit.md new file mode 100644 index 0000000..d6f8f02 --- /dev/null +++ b/docs/publication-audit.md @@ -0,0 +1,41 @@ +# Repository publication audit + +Audit date: 2026-09-04 + +This audit covers making the source repository public. It does not authorize or publish a binary release. + +## History and private data + +- Gitleaks `8.30.1` scanned all 11 commits and approximately 154 KB from every local and remote ref with redacted output; it found no secret. +- The complete path history contains only source, tests, fixtures, workflow, and repository documentation. No credential-like filename or blob larger than 100 KB is present. +- The repository has no issue, release, Actions artifact, fork, or non-default remote branch. Existing pull requests contain implementation discussion but no private product, customer, credential, or signing data. +- Commit and pull-request history is retained. Publication does not rewrite contributor history. + +## License and dependency graph + +- Repository-authored work is licensed under Apache-2.0. +- `cargo metadata --locked` reports license metadata for every resolved dependency after the repository license is applied. +- Runtime code consists of Apache-2.0 Stack repositories plus permissively licensed Rust dependencies listed in [`THIRD_PARTY_LICENSES.md`](../THIRD_PARTY_LICENSES.md). +- No vendor icon, font, credential, network client, telemetry client, updater, signing key, or customer data is bundled. + +## Public repository surface + +- The source remains pre-release; `Cargo.toml` keeps `publish = false` and there is no supported binary release. +- Contributions are accepted under the repository license boundary in [`CONTRIBUTING.md`](../CONTRIBUTING.md). +- Vulnerabilities must be submitted through GitHub private vulnerability reporting as documented in [`SECURITY.md`](../SECURITY.md). +- Public branch protection must require the existing `baseline` and `Minimum supported Rust` checks, reject force pushes and branch deletion, and require pull requests before the visibility change is complete. + +## Reproduction + +```sh +gitleaks detect --redact --source . --log-opts='--all' +cargo metadata --locked --format-version 1 +cargo tree --locked +cargo fmt --check +cargo test --locked +cargo clippy --all-targets --all-features --locked -- -D warnings +RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --locked +cargo build --release --locked +``` + +The manager repository owns the declarative GitHub visibility, security, and ruleset change. Its `gh infra validate` and `gh infra plan` output must be reviewed and recorded before apply. diff --git a/src/lib.rs b/src/lib.rs index 7d4aee1..88cf40a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -563,6 +563,9 @@ fn render_diagnostics(path: &Path, diagnostics: &[Diagnostic]) -> String { diagnostic.code, diagnostic.message ); + if !diagnostic.expected.is_empty() { + let _ = writeln!(rendered, " expected: {}", diagnostic.expected.join(", ")); + } if let Some(help) = &diagnostic.help { let _ = writeln!(rendered, " help: {help}"); } @@ -802,7 +805,8 @@ mod tests { column: 4, }, }, - help: None, + expected: vec!["node".to_owned(), "group".to_owned()], + help: Some("choose a declaration".to_owned()), related: vec![stack_engine::RelatedInformation { message: "related".to_owned(), range: stack_engine::SourceRange { @@ -822,7 +826,7 @@ mod tests { assert_eq!( render_diagnostics(Path::new("arch.stack"), &[diagnostic]), - "arch.stack:2:3: error[STKTEST]: primary\narch.stack:4:5: note: related\n" + "arch.stack:2:3: error[STKTEST]: primary\n expected: node, group\n help: choose a declaration\narch.stack:4:5: note: related\n" ); } diff --git a/tests/cli.rs b/tests/cli.rs index 1823e0a..3fc803e 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -111,7 +111,7 @@ fn invalid_utf8_exits_one_and_writes_only_stderr() -> Result<(), Box> let output = stack([OsStr::new("check"), path.as_os_str()])?; let expected = format!( - "{}:1:1: error[STK1001]: Input is not valid UTF-8.\n", + "{}:1:1: error[STK1001]: Input is not valid UTF-8.\n help: Save the source as UTF-8 and replace the invalid byte sequence.\n", path.display() );