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
5 changes: 5 additions & 0 deletions .changeset/warm-pencils-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sketchi/cli": patch
---

Add a human-TTY-only generate wizard and responsive, terminal-aware CLI presentation while preserving direct and machine-readable generation contracts.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ curl -fsSL https://raw.githubusercontent.com/shpitdev/sketchi/main/install.sh |
Turn a prompt into a validated PNG and editable local record:

```sh
sketchi generate

# Direct and noninteractive:
sketchi generate --prompt "Map release approval with pass and revise branches"
```

Bare `sketchi generate` opens a short wizard only in a human text TTY. Scripts,
pipes, redirects, CI, and JSON output never prompt and must pass `--prompt`.
Explicit `--type` and file `--dest` values preset their wizard questions;
interactive generation remains PNG-only, so other formats and `--dest -` also
require `--prompt`.
The default file is `<generated-id>.png` in the current directory. Use
`--format excalidraw` or `--format scene` for another artifact, and `--dest`
to choose its path or stream bytes with `--dest -`.
Expand Down
20 changes: 20 additions & 0 deletions apps/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,26 @@ persists the editable result, then writes `<generated-id>.png` in the current
directory:

```sh
sketchi generate

# Direct and noninteractive:
sketchi generate --prompt "Map release approval with pass and revise branches"
```

With no `--prompt`, Sketchi opens a short wizard only when both standard input
and standard output are human terminals, output is text, and CI is absent. It
asks for prompt text, flowchart (the default) or mind map, and where to save the
PNG. The choices are the current directory, a `diagrams/` folder under exactly
the directory where Sketchi was run, or a custom path with the same semantics as
`--dest`. Sketchi does not inspect Git, and it creates `diagrams/` only after
generation succeeds. An explicit `--type` or file `--dest` presets and skips
that wizard question. Explicit `--format png` may proceed; another format or
`--dest -` requires `--prompt` because the interactive wizard writes PNG files.

Scripts, pipes, redirected streams, CI, and `--output json` never prompt or
block. They must pass `--prompt`; omitting it retains the deterministic usage
error. Passing `--prompt` is always direct and noninteractive.

The PNG is rendered locally from the returned validated artifacts and is not
written back into the record. Choose another artifact or destination explicitly:

Expand Down Expand Up @@ -230,6 +247,9 @@ Agents can use
`--output json`, complete noninteractive input through `--json` or `--file`, and
raw artifact output through `export --dest -` without prompts.

Agents must pass `--prompt` to `generate`. Interactive prompting is restricted
to human text TTYs and is never enabled by JSON output, pipes, redirects, or CI.

After exporting PNG to a file, agents can follow the returned hint to display
that path as an inline Markdown image for the user.

Expand Down
61 changes: 61 additions & 0 deletions apps/cli/THIRD_PARTY_NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,67 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Terminal presentation dependency tree
-------------------------------------

The CLI bundles the following terminal presentation packages under the MIT
License:

- @clack/prompts 1.7.0 and @clack/core 1.4.3
- fast-string-width 3.0.2, fast-wrap-ansi 0.2.2, and sisteransi 1.0.5
- chalk 6.0.0
- string-width 8.2.2, get-east-asian-width 1.6.0, and strip-ansi 7.2.0
- wrap-ansi 10.0.0 and ansi-styles 6.2.3

Copyright (c) 2025-Present Bombshell contributors
Copyright (c) 2024-present Fabio Spampinato
Copyright (c) 2025 James Garbutt
Copyright (c) 2018 Terkel Gjervig Nielsen
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

CI detection dependency tree
----------------------------

The CLI bundles is-ci 4.1.0 and ci-info 4.4.0 under the MIT License.

Copyright (c) Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

pako 2.0.3
-----------

Expand Down
7 changes: 6 additions & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
"dist"
],
"dependencies": {
"@clack/prompts": "^1.7.0",
"@effect/platform-node": "4.0.0-beta.99",
"@excalidraw/excalidraw": "0.18.1",
"@resvg/resvg-wasm": "2.6.2",
"@sketchi/diagram-agent": "workspace:*",
"chalk": "^6.0.0",
"effect": "4.0.0-beta.99",
"is-ci": "^4.1.0",
"linkedom": "0.18.13",
"pako": "2.0.3"
"pako": "2.0.3",
"string-width": "^8.2.2",
"wrap-ansi": "^10.0.0"
},
"devDependencies": {
"@types/pako": "2.0.4",
Expand Down
Loading
Loading