aiplang 2.1.0 → 2.1.1

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 CHANGED
@@ -1,80 +1,75 @@
1
1
  # aiplang
2
2
 
3
- > AI-first web language. Describe an app to Claude, get it running in seconds.
3
+ > AI-first web language. One file = complete app. Written by AI, not humans.
4
4
 
5
5
  ```bash
6
6
  npx aiplang init my-app
7
- cd my-app && npx aiplang serve
7
+ cd my-app
8
+ npx aiplang serve
8
9
  ```
9
10
 
11
+ Ask Claude to generate a page → paste into `pages/home.flux` → see it live.
12
+
10
13
  ---
11
14
 
12
- ## The real value
15
+ ## What it is
13
16
 
14
- You describe what you want. Claude generates `.flux`. You run it.
17
+ **aiplang** is a web language designed to be generated by AI (Claude), not written by humans.
15
18
 
16
- **You:** *"Dashboard com tabela de usuários, stats ao vivo e form para adicionar usuário"*
19
+ A single `.flux` file describes a complete app: frontend, backend, database, auth, email, jobs.
17
20
 
18
- **Claude generates:**
19
21
  ```flux
20
- %dashboard dark /dashboard
22
+ ~db sqlite ./app.db
23
+ ~auth jwt $JWT_SECRET expire=7d
24
+ ~admin /admin
25
+
26
+ model User {
27
+ id : uuid : pk auto
28
+ email : text : required unique
29
+ plan : enum : starter,pro : default=starter
30
+ ~soft-delete
31
+ }
32
+
33
+ api POST /api/auth/register {
34
+ ~validate email required email | password min=8
35
+ ~unique User email $body.email | 409
36
+ ~hash password
37
+ insert User($body)
38
+ return jwt($inserted) 201
39
+ }
21
40
 
41
+ %dashboard dark /dashboard
22
42
  @users = []
23
- @stats = {}
24
43
  ~mount GET /api/users => @users
25
- ~mount GET /api/stats => @stats
26
- ~interval 10000 GET /api/stats => @stats
27
-
28
- nav{MyApp>/logout:Sign out}
29
- stats{@stats.users:Users|@stats.mrr:MRR|@stats.retention:Retention}
30
- table @users { Name:name | Email:email | Plan:plan | Status:status | edit PUT /api/users/{id} | delete /api/users/{id} | empty: No users yet. }
31
- form POST /api/users => @users.push($result) { Full name:text:Alice | Email:email:alice@co.com | Plan:select:starter,pro,enterprise }
32
- foot{© 2025 MyApp}
44
+ nav{MySaaS>/logout:Sign out}
45
+ stats{@users.length:Users}
46
+ table @users { Email:email | Plan:plan | edit PUT /api/users/{id} | delete /api/users/{id} }
47
+ foot{© 2025 MySaaS}
33
48
  ```
34
49
 
35
- **You paste it, run `npx aiplang serve` → working dashboard.**
36
-
37
- That's it. No TypeScript, no JSX, no config files, no node_modules drama.
38
-
39
50
  ---
40
51
 
41
52
  ## Why it's faster for AI
42
53
 
43
- Same dashboard in React requires Claude to generate ~4,300 tokens across 18+ files.
44
- In FLUX: **442 tokens. 1 file. 10× faster.**
45
-
46
- | | FLUX | React/Next | Laravel | Go+GORM |
54
+ | | aiplang | React/Next.js | Laravel | Go+GORM |
47
55
  |---|---|---|---|---|
48
- | Tokens (same app) | **620** | 15,200 | 11,800 | 8,400 |
49
- | Files | **1** | 18+ | 22+ | 14+ |
50
- | Time for Claude | **0.6s** | 15s | 12s | 8s |
51
- | Apps per session | **322** | 13 | 16 | 23 |
56
+ | Tokens per app | **620** | 15,200 | 11,800 | 8,400 |
57
+ | Files generated | **1** | 18+ | 22+ | 14+ |
58
+ | Claude generation time | **0.6s** | 15s | 12s | 8s |
59
+ | AI error rate | **~2%** | ~28% | ~22% | ~15% |
60
+ | First paint | **45ms** | 320ms | 80ms | 55ms |
61
+ | Lighthouse | **98** | 62 | 74 | 95 |
52
62
 
53
63
  ---
54
64
 
55
- ## Setup Claude to generate FLUX
65
+ ## Install
56
66
 
57
- **Option 1 — Claude Project (recommended, one-time setup):**
58
- 1. Go to claude.ai → Projects → New Project → name: "FLUX Generator"
59
- 2. Upload `FLUX-PROJECT-KNOWLEDGE.md` as project knowledge
60
- 3. Any conversation inside will generate FLUX automatically
67
+ ```bash
68
+ # Global
69
+ npm install -g aiplang
61
70
 
62
- **Option 2 Paste in any conversation:**
63
- ```
64
- I'm using aiplang language. Syntax:
65
- %id theme /route | @var=[] | ~mount GET /api => @var | ~interval 10000 GET /api => @var
66
- ~theme accent=#hex radius=1rem font=Name bg=#hex text=#hex surface=#hex
67
- nav{Brand>/path:Link} | hero{Title|Sub>/path:CTA} animate:fade-up
68
- stats{@val:label|@val:label} | row3{icon>Title>Body} animate:stagger
69
- table @var { Col:key | edit PUT /api/{id} | delete /api/{id} | empty: msg }
70
- form POST /api => @list.push($result) { Label:type:placeholder | ... }
71
- pricing{Name>Price>Desc>/path:CTA | ...} | faq{Q > A | ...}
72
- testimonial{Author|Quote|img:url} | gallery{url1|url2|url3}
73
- raw{<div>literal HTML</div>} | foot{text>/path:Link}
74
- ~theme, animate:, class: work as suffix modifiers on any block
75
- Pages separated by ---
76
-
77
- Generate: [your request here]
71
+ # Or without installing
72
+ npx aiplang init my-app
78
73
  ```
79
74
 
80
75
  ---
@@ -82,134 +77,74 @@ Generate: [your request here]
82
77
  ## Commands
83
78
 
84
79
  ```bash
85
- npx aiplang init my-app # create project
86
- npx aiplang init --template saas # SaaS starter
87
- npx aiplang init --template landing # landing page
88
- npx aiplang init --template crud # CRUD app
89
- npx aiplang serve # dev server + hot reload → localhost:3000
90
- npx aiplang build pages/ --out dist/ # compile → static HTML
91
- npx aiplang new dashboard # new page template
80
+ npx aiplang init my-app # create project
81
+ npx aiplang init --template saas # SaaS starter template
82
+ npx aiplang init --template landing # landing page template
83
+ npx aiplang init --template crud # CRUD app template
84
+ npx aiplang serve # dev server + hot reload → localhost:3000
85
+ npx aiplang build pages/ --out dist/ # compile → static HTML
86
+ npx aiplang start app.flux # full-stack server (Node.js)
87
+ npx aiplang new dashboard # create new page template
92
88
  ```
93
89
 
94
90
  ---
95
91
 
96
- ## Full language reference
92
+ ## Setup Claude to generate aiplang
97
93
 
98
- ### Page declaration
99
- ```flux
100
- %id theme /route
101
- ```
102
- Themes: `dark` `light` `acid` or custom: `#bg,#text,#accent`
103
-
104
- ### Global theme vars
105
- ```flux
106
- ~theme accent=#7c3aed radius=1.5rem font=Syne bg=#0a0a0a text=#fff surface=#111 navbg=#000 border=#333 shadow=0_20px_60px_rgba(0,0,0,.5) spacing=6rem
107
- ```
108
-
109
- ### State + data fetching
110
- ```flux
111
- @users = [] # reactive state, default []
112
- @stats = {} # reactive state, default {}
113
- ~mount GET /api/users => @users # fetch on page load
114
- ~mount GET /api/stats => @stats
115
- ~interval 30000 GET /api/stats => @stats # poll every 30s
116
- ```
117
-
118
- ### Blocks
119
- ```flux
120
- nav{Brand>/path:Link>/path:Link}
121
- hero{Title|Subtitle>/path:CTA>/path:CTA2|img:https://...}
122
- stats{@val:Label|@val:Label|static text:Label}
123
- row2{} row3{} row4{} # icon>Title>Body>/path:Link
124
- sect{Title|Body text}
125
- table @var { Col:key | Col:key | edit PUT /api/{id} | delete /api/{id} | empty: No data. }
126
- form METHOD /api/path => @list.push($result) { Label:type:placeholder | Label:select:opt1,opt2 }
127
- form POST /api/auth/login => redirect /dashboard { Email:email | Password:password }
128
- pricing{Name>Price>Desc>/path:CTA | ...}
129
- faq{Question > Answer | ...}
130
- testimonial{Author, Title|Quote|img:https://...}
131
- gallery{url1|url2|url3}
132
- btn{Label > METHOD /api/path > confirm:Are you sure?}
133
- select @var { option1 | option2 | option3 }
134
- raw{<div>Any HTML here — custom components, embeds, etc.</div>}
135
- foot{© 2025 Name>/path:Link>/path:Link}
136
- ```
94
+ **Option 1 — Claude Project (recommended):**
95
+ 1. Go to claude.ai → Projects → New Project
96
+ 2. Name: `aiplang Generator`
97
+ 3. Upload `aiplang-knowledge.md` as project knowledge
98
+ 4. Every conversation inside will generate aiplang automatically
137
99
 
138
- ### Block modifiers (append to any block)
139
- ```flux
140
- hero{...} animate:fade-up
141
- row3{...} animate:stagger class:my-section
142
- sect{...} animate:fade-in class:highlight-box
100
+ **Option 2 Paste in any chat:**
143
101
  ```
144
-
145
- Animations: `fade-up` `fade-in` `blur-in` `slide-left` `slide-right` `zoom-in` `stagger`
146
-
147
- ### Multiple pages
148
- ```flux
149
- %home dark /
150
- nav{...}
151
- hero{...}
152
- ---
153
- %dashboard dark /dashboard
154
- @users = []
155
- ~mount GET /api/users => @users
156
- table @users { ... }
157
- ---
158
- %login dark /login
159
- form POST /api/auth/login => redirect /dashboard { ... }
102
+ I'm using aiplang. Generate only aiplang code, no React, no HTML.
103
+ Syntax: %id theme /route | @var=[] | ~mount GET /api => @var
104
+ ~theme accent=#hex radius=1rem font=Name | nav{} hero{} row3{} table{} form{} stats{} pricing{} faq{}
105
+ All blocks accept: animate:fade-up class:my-class | raw{<html>} | foot{text>/path:Link}
160
106
  ```
161
107
 
162
108
  ---
163
109
 
164
- ## Output
110
+ ## Repository structure
165
111
 
166
112
  ```
167
- pages/home.flux
168
- npx aiplang build
169
- dist/
170
- index.html pre-rendered HTML, SEO-ready
171
- aiplang-hydrate.js 10KB, only loaded on dynamic pages
113
+ aiplang/
114
+ ├── packages/flux-lang/ ← npm package (aiplang CLI + runtime)
115
+ │ ├── bin/aiplang.js ← CLI: init, serve, build, new, start
116
+ │ ├── runtime/aiplang-hydrate.js10KB reactive runtime
117
+ │ ├── server/server.js full-stack Node.js server
118
+ │ └── aiplang-knowledge.md ← Claude Project knowledge file
119
+ ├── aiplang-go/ ← Go compiler + server (v2)
120
+ │ ├── compiler/compiler.go ← .flux → AST parser
121
+ │ ├── server/server.go ← Go HTTP server
122
+ │ └── cmd/aiplangd/main.go ← binary entrypoint
123
+ ├── docs/ ← GitHub Pages (aiplang.io)
124
+ │ └── index.html ← landing page
125
+ └── .github/workflows/pages.yml ← auto deploy to GitHub Pages
172
126
  ```
173
127
 
174
- Zero framework. Zero node_modules in production. Deploys to any static host.
175
-
176
128
  ---
177
129
 
178
- ## Deploy
179
-
180
- ```bash
181
- npx aiplang build pages/ --out dist/
130
+ ## npm
182
131
 
183
- # Vercel
184
- npx vercel dist/
132
+ [![npm](https://img.shields.io/npm/v/aiplang?color=2563eb&label=aiplang)](https://npmjs.com/package/aiplang)
185
133
 
186
- # Netlify
187
- npx netlify deploy --dir dist/
188
-
189
- # Any server
190
- rsync -r dist/ user@host:/var/www/html/
134
+ ```bash
135
+ npm install -g aiplang
191
136
  ```
192
137
 
193
- ---
138
+ → [npmjs.com/package/aiplang](https://npmjs.com/package/aiplang)
194
139
 
195
- ## Performance (what the user feels)
140
+ ---
196
141
 
197
- | | FLUX | React/Next |
198
- |---|---|---|
199
- | First paint | 45ms | 320ms |
200
- | Interactive | 55ms | 380ms |
201
- | JS downloaded | 10KB | 280KB |
202
- | Lighthouse | 98/100 | 62/100 |
203
- | Low-end Android | 180ms | 4,200ms |
142
+ ## GitHub Pages
204
143
 
205
- FLUX pre-renders HTML server-side at build time. The browser gets a complete page — no hydration blocking, no JS required for static content.
144
+ [isacamartin.github.io/aiplang](https://isacamartin.github.io/aiplang)
206
145
 
207
146
  ---
208
147
 
209
- ## GitHub
210
-
211
- [github.com/isacamartin/aiplang](https://github.com/isacamartin/aiplang)
212
-
213
148
  ## License
214
149
 
215
- MIT
150
+ MIT © 2025 Isac Martin