tsquare 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/assets/mark.png +0 -0
- package/bin/tsquare.js +2 -6
- package/dist/catalog.d.ts +1021 -0
- package/dist/chunks/chunk-L6GTIZQH.js +2029 -0
- package/{src/cli.ts → dist/cli.js} +28 -24
- package/dist/colors.d.ts +29 -0
- package/dist/compile.d.ts +24 -0
- package/dist/components.d.ts +83 -0
- package/dist/icons.d.ts +12 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +38 -0
- package/dist/layout.d.ts +66 -0
- package/dist/playground/index.d.ts +27 -0
- package/dist/playground/index.html +501 -0
- package/dist/playground/index.js +376 -0
- package/dist/playground/reference.d.ts +11 -0
- package/dist/print.d.ts +2 -0
- package/dist/prompt-example.d.ts +3 -0
- package/dist/prompt.d.ts +22 -0
- package/dist/render.d.ts +20 -0
- package/dist/schema.d.ts +33 -0
- package/dist/suggest.d.ts +5 -0
- package/dist/text.d.ts +45 -0
- package/examples/notes-mobile.tsq +84 -0
- package/examples/notes-web.tsq +54 -0
- package/package.json +23 -7
- package/skill/tsquare/SKILL.md +3 -3
- package/skill/tsquare/reference.md +2 -2
- package/src/catalog.ts +0 -329
- package/src/colors.ts +0 -82
- package/src/compile.ts +0 -64
- package/src/components.tsx +0 -1057
- package/src/icons.ts +0 -54
- package/src/index.ts +0 -11
- package/src/layout.ts +0 -63
- package/src/print.ts +0 -73
- package/src/prompt-example.ts +0 -43
- package/src/prompt.ts +0 -121
- package/src/render.ts +0 -178
- package/src/schema.ts +0 -43
- package/src/suggest.ts +0 -34
- package/src/text.ts +0 -333
package/README.md
CHANGED
|
@@ -29,14 +29,14 @@ Requires Node 20 or newer. To work on tsquare itself, clone the repo, run `npm i
|
|
|
29
29
|
## Playground
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
|
|
32
|
+
npx tsquare playground # http://localhost:4321
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
- **Editor:** live render as you type, problems listed by line (click one to jump there), and SVG/PNG export. Paste a whole model reply and it keeps just the code block.
|
|
36
36
|
- **Components:** every component with its props and a rendered example you can open in the editor. It's generated from the catalog, so it can't drift from what the renderer accepts.
|
|
37
37
|
- **Prompt:** the system prompt for models, with a copy button.
|
|
38
38
|
|
|
39
|
-
It
|
|
39
|
+
It runs on a local server with the same renderer as the CLI. In this repo, `npm run playground` runs it from source.
|
|
40
40
|
|
|
41
41
|
## The language
|
|
42
42
|
|
|
@@ -95,13 +95,25 @@ tsquare render <file.tsq|-> [-o out.svg|out.png] [--scale 2]
|
|
|
95
95
|
tsquare check <file.tsq|-> # problems by line number
|
|
96
96
|
tsquare fmt <file.tsq|-> [-w] # canonical formatting (drops comments)
|
|
97
97
|
tsquare prompt # system prompt for models
|
|
98
|
+
tsquare playground [--port 4321] # live editor, component reference, prompt
|
|
98
99
|
```
|
|
99
100
|
|
|
100
101
|
Use `-` to read from stdin. In this repo, run them through npm: `npm run check -- file.tsq`. Files use the `.tsq` extension; the CLI reads any text file.
|
|
101
102
|
|
|
103
|
+
## Library
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { renderWireframe, compileWireframe, formatIssues } from "tsquare";
|
|
107
|
+
|
|
108
|
+
const { issues } = compileWireframe(source); // problems by line, empty when valid
|
|
109
|
+
const png = await renderWireframe(source, { format: "png", scale: 2 });
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`tsquare/playground` exports the playground's request handler, for hosting it inside your own Node server. See [Using it with AI](docs/ai.md) for the prompt and the repair loop.
|
|
113
|
+
|
|
102
114
|
## Using it with Claude (skill)
|
|
103
115
|
|
|
104
|
-
`skill/tsquare/` is a Claude skill: the syntax, the component reference, and a workflow of write → `tsquare check` → `tsquare render` → look at the PNG and fix. Copy it to `~/.claude/skills/tsquare` (all projects) or `<project>/.claude/skills/tsquare`, and make
|
|
116
|
+
`skill/tsquare/` is a Claude skill: the syntax, the component reference, and a workflow of write → `tsquare check` → `tsquare render` → look at the PNG and fix. Copy it to `~/.claude/skills/tsquare` (all projects) or `<project>/.claude/skills/tsquare`, and make sure `npx tsquare` runs where Claude works. Rebuild it after catalog changes with `npm run skill`.
|
|
105
117
|
|
|
106
118
|
## How it works
|
|
107
119
|
|
package/assets/mark.png
ADDED
|
Binary file
|
package/bin/tsquare.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
import { register } from "tsx/esm/api";
|
|
5
|
-
|
|
6
|
-
register();
|
|
7
|
-
await import("../src/cli.ts");
|
|
2
|
+
// Runs the built CLI (npm run build writes dist/).
|
|
3
|
+
import "../dist/cli.js";
|