@glyphlang/glyph 0.1.67 → 0.1.69
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 +34 -20
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -6,10 +6,25 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@glyphlang/glyph)
|
|
7
7
|
[](https://github.com/chadetov/glyph)
|
|
8
8
|
|
|
9
|
-
Glyph is a statically typed language that **transpiles to TypeScript**,
|
|
9
|
+
Glyph is a statically typed language that **transpiles to TypeScript**, built so AI agents can read, write, and modify code safely. It looks almost like TypeScript, so you read it on day one with no tutorial. Where it differs, each difference closes a hole an agent falls through and `tsc --strict` waves past.
|
|
10
|
+
|
|
11
|
+
## Try it without installing anything
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx @glyphlang/glyph init my-app
|
|
15
|
+
cd my-app
|
|
16
|
+
npm install
|
|
17
|
+
npx glyph run
|
|
18
|
+
# hello from glyph
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That scaffolds four files, pins the compiler in `devDependencies`, and runs the program. Anyone who clones the project builds it with `npm install` and nothing global.
|
|
22
|
+
|
|
23
|
+
Prefer it on your PATH:
|
|
10
24
|
|
|
11
25
|
```sh
|
|
12
26
|
npm install -g @glyphlang/glyph
|
|
27
|
+
glyph init my-app && cd my-app && glyph run
|
|
13
28
|
```
|
|
14
29
|
|
|
15
30
|
> **Website:** [glyphlang.io](https://glyphlang.io) · **Try it in the browser:** [playground](https://glyphlang.io/playground/) · **Pointing an agent at it?** [glyphlang.io/llms.txt](https://glyphlang.io/llms.txt)
|
|
@@ -18,13 +33,13 @@ npm install -g @glyphlang/glyph
|
|
|
18
33
|
|
|
19
34
|
## The problem it solves
|
|
20
35
|
|
|
21
|
-
An AI agent will happily write TypeScript that compiles clean and breaks at runtime. It reaches for `any` at a boundary, casts an `unknown`, forgets a `switch` case,
|
|
36
|
+
An AI agent will happily write TypeScript that compiles clean and breaks at runtime. It reaches for `any` at a boundary, casts an `unknown`, forgets a `switch` case, drops a `Promise` on the floor, and `tsc --strict` stays green the whole time. On a large codebase it cannot even reliably *find* where something is defined, because overloads, decorators, namespace merging, and barrel re-exports scatter one symbol across many places.
|
|
22
37
|
|
|
23
|
-
Glyph removes those hazards at the language level. The bugs an agent ships
|
|
38
|
+
Glyph removes those hazards at the language level. The bugs an agent ships do not compile here.
|
|
24
39
|
|
|
25
40
|
## See it
|
|
26
41
|
|
|
27
|
-
Glyph reads like TypeScript, but there
|
|
42
|
+
Glyph reads like TypeScript, but there is no `any`, `match` must cover every case, and a type you declare is *actually checked at runtime*:
|
|
28
43
|
|
|
29
44
|
```glyph
|
|
30
45
|
type User = {
|
|
@@ -44,34 +59,33 @@ fn handle(body: unknown) -> string {
|
|
|
44
59
|
|
|
45
60
|
That compiles to clean, readable TypeScript you can commit, run anywhere TS runs, and mix with any npm package.
|
|
46
61
|
|
|
47
|
-
##
|
|
62
|
+
## What's different
|
|
48
63
|
|
|
49
|
-
- **No `any`, no erasure.** What the types say is true when the code runs. Every record type generates a runtime validator (`User.parse(x)`), so untrusted input is typed only after it
|
|
50
|
-
- **Exhaustive by default.** `match` over a union
|
|
51
|
-
- **Errors are values.** `Result` and the `?` operator instead of thrown exceptions
|
|
52
|
-
- **Greppable.** One name, one declaration form. `grep "fn parseUser"` finds the definition
|
|
53
|
-
- **Stable diffs.** One canonical format, one element per line, trailing commas, no reflow. A one-line change is a one-line diff
|
|
54
|
-
- **Generate, don't hand-write.** `glyph gen openapi spec.yaml --client` emits a typed HTTP client and server stubs
|
|
55
|
-
- **Talks to real databases.** Import any npm client by name. Class-based clients (`new Pool`, `new MongoClient`) construct with `new`, and SQLite is built in via `std/sqlite`. A row comes back untrusted, so you `Row.parse` it into a typed record
|
|
64
|
+
- **No `any`, no erasure.** What the types say is true when the code runs. Every record type generates a runtime validator (`User.parse(x)`), so untrusted input is typed only after it has been checked, and a failure names the field and its path.
|
|
65
|
+
- **Exhaustive by default.** `match` over a union, or over `number`/`string`, must handle every case or it does not compile. Add a variant and every unhandled site lights up.
|
|
66
|
+
- **Errors are values.** `Result` and the `?` operator instead of thrown exceptions. Drop a `Result` and you get a warning, because a discarded error is a swallowed failure.
|
|
67
|
+
- **Greppable.** One name, one declaration form. `grep "fn parseUser"` finds the definition every time. No overloads, decorators, or barrel files.
|
|
68
|
+
- **Stable diffs.** One canonical format, one element per line, trailing commas, no reflow. A one-line change is a one-line diff, so agent edits stay reviewable.
|
|
69
|
+
- **Generate, don't hand-write.** `glyph gen openapi spec.yaml --client` emits a typed HTTP client and server stubs. `glyph gen zod` and `gen dts` turn existing schemas into checked Glyph types.
|
|
70
|
+
- **Talks to real databases.** Import any npm client by name. Class-based clients (`new Pool`, `new MongoClient`) construct with `new`, and SQLite is built in via `std/sqlite`. A row comes back untrusted, so you `Row.parse` it into a typed record and the schema-versus-code mismatch a cast would hide is caught at the boundary. See the [databases guide](https://github.com/chadetov/glyph/blob/main/docs/guide/databases.md).
|
|
56
71
|
|
|
57
|
-
##
|
|
72
|
+
## The commands
|
|
58
73
|
|
|
59
74
|
```sh
|
|
60
75
|
glyph init my-app # scaffold a project
|
|
61
|
-
cd my-app
|
|
62
76
|
glyph run # build + type-check + execute
|
|
63
77
|
glyph build --check # emit TypeScript, verified with tsc --strict
|
|
64
78
|
glyph fmt # one canonical layout
|
|
65
79
|
glyph --explain E0200 # long-form help for any diagnostic
|
|
66
80
|
```
|
|
67
81
|
|
|
68
|
-
Glyph ships as a single prebuilt binary per platform (macOS, Linux, Windows
|
|
82
|
+
Glyph ships as a single prebuilt binary per platform (macOS, Linux, and Windows, on Intel and ARM). No postinstall download and no toolchain to set up. Running or type-checking uses your local `tsx`/`tsc`.
|
|
69
83
|
|
|
70
84
|
## Built for agents
|
|
71
85
|
|
|
72
|
-
Point your coding agent at **[glyphlang.io/llms.txt](https://glyphlang.io/llms.txt)
|
|
86
|
+
Point your coding agent at **[glyphlang.io/llms.txt](https://glyphlang.io/llms.txt)**, a single file that takes it from zero to correct, runnable Glyph: the canonical program shape, the full stdlib surface, the common gotchas, and the complete diagnostic catalogue with one-line fixes. Agents writing Glyph get compile-time feedback precise enough to self-correct.
|
|
73
87
|
|
|
74
|
-
**Model Context Protocol.** For an agent that speaks MCP, `glyph mcp` runs a server over stdio that
|
|
88
|
+
**Model Context Protocol.** For an agent that speaks MCP, `glyph mcp` runs a server over stdio that answers five queries: type-check a file for coded diagnostics, the inferred type at a cursor, where a name is defined (following imports), every reference to a symbol across the project, and symbol search. It runs the same analysis the editor uses, so the agent's answers match the compiler. Point any MCP client at `glyph mcp <project>`; details at [glyphlang.io/mcp](https://glyphlang.io/mcp/).
|
|
75
89
|
|
|
76
90
|
**Editors.** `glyph lsp` is a full language server (diagnostics, hover, go-to-definition, completion, symbols, workspace-wide find-references and rename, formatting) that any LSP client can drive over stdio. A VS Code extension ships ready-made.
|
|
77
91
|
|
|
@@ -82,15 +96,15 @@ Point your coding agent at **[glyphlang.io/llms.txt](https://glyphlang.io/llms.t
|
|
|
82
96
|
| Your first program in 10 minutes | [Start Here](https://glyphlang.io/start/) |
|
|
83
97
|
| The whole language in five minutes | [the tour](https://github.com/chadetov/glyph/blob/main/docs/guide/tour.md) |
|
|
84
98
|
| Try it without installing | [playground](https://glyphlang.io/playground/) |
|
|
85
|
-
| Straight
|
|
99
|
+
| Straight answers to engineer questions | [glyphlang.io/answers](https://glyphlang.io/answers/) |
|
|
86
100
|
| The four pillars, in depth | [glyphlang.io/pillars/verifiability](https://glyphlang.io/pillars/verifiability/) |
|
|
87
101
|
| Source, issues, roadmap | [github.com/chadetov/glyph](https://github.com/chadetov/glyph) |
|
|
88
102
|
|
|
89
103
|
## Status
|
|
90
104
|
|
|
91
|
-
Glyph is an **early preview** and moves fast. The compiler toolchain
|
|
105
|
+
Glyph is an **early preview** and moves fast. The compiler toolchain (`build`, `run`, `fmt`, `gen`, `regen`, `--explain`) works end to end, and every release is type-checked against `tsc --strict`. It is not ready for production yet. It is ready for you to try and to tell us where it breaks. Every version's changes are at [glyphlang.io/versions](https://glyphlang.io/versions/).
|
|
92
106
|
|
|
93
|
-
**Stability while pre-1.0:** the language can still change between 0.1.x releases.
|
|
107
|
+
**Stability while pre-1.0:** the language can still change between 0.1.x releases. Two lines hold. Your code stays runnable, because it always compiles to plain TypeScript you own, which is a permanent escape hatch. And when syntax does change we aim to make `glyph fmt` migrate it for you. Full policy: [docs/stability.md](https://github.com/chadetov/glyph/blob/main/docs/stability.md).
|
|
94
108
|
|
|
95
109
|
## Verifying your download
|
|
96
110
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glyphlang/glyph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.69",
|
|
4
4
|
"description": "TypeScript your AI agents can't quietly break: a statically typed language that transpiles to TypeScript, with no any, exhaustive matching, and runtime-checked types.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"glyph": "bin/glyph.js"
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"node": ">=18"
|
|
14
14
|
},
|
|
15
15
|
"optionalDependencies": {
|
|
16
|
-
"@glyphlang/darwin-x64": "0.1.
|
|
17
|
-
"@glyphlang/darwin-arm64": "0.1.
|
|
18
|
-
"@glyphlang/linux-x64": "0.1.
|
|
19
|
-
"@glyphlang/linux-arm64": "0.1.
|
|
20
|
-
"@glyphlang/win32-x64": "0.1.
|
|
16
|
+
"@glyphlang/darwin-x64": "0.1.69",
|
|
17
|
+
"@glyphlang/darwin-arm64": "0.1.69",
|
|
18
|
+
"@glyphlang/linux-x64": "0.1.69",
|
|
19
|
+
"@glyphlang/linux-arm64": "0.1.69",
|
|
20
|
+
"@glyphlang/win32-x64": "0.1.69"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|