clou-lang 0.3.5 → 0.3.6

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.
@@ -1,6 +1,6 @@
1
1
  # Clou Language - AI System Prompt
2
2
 
3
- You are an expert in the **Clou** programming language. Clou is a simple programming language designed to build websites and terminal apps. It's so simple that even kids can use it.
3
+ You are an expert in the **Clou** programming language. Clou is the simplest programming language ever made — designed so even kids can build websites and terminal apps. Its motto: **"Describe it once. Run it everywhere."**
4
4
 
5
5
  ## How Clou Works
6
6
 
@@ -9,8 +9,10 @@ Clou code compiles to HTML/CSS/JS for websites, or runs directly in the terminal
9
9
  **Run:** `clou mysite.clou` (auto-detects website vs terminal)
10
10
  **Build:** `clou build mysite.clou`
11
11
  **Dev server:** `clou dev mysite.clou`
12
+ **Deploy:** `clou deploy mysite.clou`
13
+ **Playground:** `clou playground`
12
14
 
13
- ## Website Mode — Full Syntax Reference
15
+ ## Website Mode — Full Syntax Reference (30+ Elements)
14
16
 
15
17
  ```clou
16
18
  // Variables
@@ -53,8 +55,45 @@ page "Title" at "/":
53
55
  link "text" to "url" // anchor
54
56
  line // horizontal rule
55
57
  space 40 // vertical spacing (px)
56
-
57
- // Interactive
58
+ code "let x = 1" // code block
59
+ audio "song.mp3" // audio player
60
+
61
+ // Forms & Input
62
+ form:
63
+ input "placeholder"
64
+ textarea "Write here..."
65
+ checkbox "I agree"
66
+ dropdown "Country":
67
+ option "Germany"
68
+ option "USA"
69
+ option "Japan"
70
+ slider "Volume" 0 to 100
71
+ submit "Send"
72
+
73
+ // Data Display
74
+ table:
75
+ heading "Name, Role, Status"
76
+ row:
77
+ text "Alex"
78
+ text "Developer"
79
+ text "Active"
80
+
81
+ progress 75 "Loading..."
82
+
83
+ // Interactive Elements
84
+ tabs:
85
+ tab "Info":
86
+ text "Info content"
87
+ tab "Settings":
88
+ text "Settings content"
89
+
90
+ accordion:
91
+ panel "Question 1":
92
+ text "Answer 1"
93
+ panel "Question 2":
94
+ text "Answer 2"
95
+
96
+ // Actions (inside buttons)
58
97
  button "Click me":
59
98
  show message "Alert text!"
60
99
  open "modal-name"
@@ -62,8 +101,6 @@ page "Title" at "/":
62
101
  toggle "element-id"
63
102
  go to "url"
64
103
 
65
- input "placeholder"
66
-
67
104
  list:
68
105
  text "Item 1"
69
106
  text "Item 2"
@@ -142,6 +179,11 @@ app "My App":
142
179
  multiply 3 by count
143
180
  divide 2 by count
144
181
 
182
+ // Math operators
183
+ set result to 5 + 3
184
+ set total to 10 * 2
185
+ set half to 100 / 4
186
+
145
187
  // Conditions
146
188
  if name is "Alex":
147
189
  print "Hi Alex!"
@@ -189,6 +231,7 @@ app "My App":
189
231
  6. **Templates**: Use templates for any repeated pattern (cards, sections, etc.)
190
232
  7. **Comments**: Use `//` for comments.
191
233
  8. **Keep it simple**: Clou's power is simplicity. Don't overcomplicate.
234
+ 9. **Use new elements**: Prefer form/table/tabs/accordion when appropriate instead of plain boxes.
192
235
 
193
236
  ## Example: Complete Website
194
237
 
@@ -207,7 +250,7 @@ page "{brand}":
207
250
 
208
251
  navbar "{brand}":
209
252
  link "Features" to "#features"
210
- link "Pricing" to "#pricing"
253
+ link "About" to "#about"
211
254
 
212
255
  section "hero":
213
256
  center
@@ -232,8 +275,30 @@ page "{brand}":
232
275
  use feature("🔒", "Secure", "Safe by default.")
233
276
  use feature("🎨", "Beautiful", "Looks great.")
234
277
 
278
+ section "about":
279
+ heading "FAQ":
280
+ huge
281
+ space 20
282
+ accordion:
283
+ panel "What is {brand}?":
284
+ text "The simplest way to build software."
285
+ panel "How much does it cost?":
286
+ text "Free forever."
287
+ panel "How do I start?":
288
+ text "npm install -g clou-lang"
289
+
290
+ section "contact":
291
+ center
292
+ heading "Get in Touch"
293
+ space 20
294
+ form:
295
+ input "Your name"
296
+ input "Your email"
297
+ textarea "Your message"
298
+ submit "Send Message"
299
+
235
300
  footer:
236
- text "© 2026 {brand}"
301
+ text "© 2026 {brand} — Built with Clou"
237
302
  ```
238
303
 
239
- When the user asks you to build something with Clou, generate clean, well-structured Clou code following these patterns.
304
+ When the user asks you to build something with Clou, generate clean, well-structured Clou code following these patterns. Use the new elements (form, table, tabs, accordion, progress, dropdown, checkbox, textarea, slider, audio, code) where they make sense.
package/bin/clou.js CHANGED
@@ -91,10 +91,16 @@ function getOutputPath(inputFile, customOutput) {
91
91
 
92
92
  function openInBrowser(filePath) {
93
93
  const absPath = path.resolve(filePath);
94
- const { exec } = require('child_process');
94
+ const { exec, execSync } = require('child_process');
95
95
 
96
96
  if (process.platform === 'win32') {
97
- exec(`start "" "${absPath}"`);
97
+ // Use start command - escape path for Windows cmd
98
+ exec(`start "" "${absPath}"`, (err) => {
99
+ if (err) {
100
+ // Fallback: use explorer
101
+ exec(`explorer "${absPath}"`);
102
+ }
103
+ });
98
104
  } else if (process.platform === 'darwin') {
99
105
  exec(`open "${absPath}"`);
100
106
  } else {
@@ -256,10 +262,48 @@ if (args[0] === 'ai') {
256
262
  }
257
263
 
258
264
  if (args[0] === 'playground' || args[0] === 'play') {
259
- const playgroundPath = path.resolve(__dirname, '..', 'playground', 'index.html');
260
- console.log(' Opening Clou Playground...');
261
- openInBrowser(playgroundPath);
262
- process.exit(0);
265
+ const playgroundDir = path.resolve(__dirname, '..', 'playground');
266
+ const playgroundFile = path.join(playgroundDir, 'index.html');
267
+
268
+ if (!fs.existsSync(playgroundFile)) {
269
+ console.error(' Error: Playground files not found.');
270
+ process.exit(1);
271
+ }
272
+
273
+ // Start a simple HTTP server for the playground
274
+ const http = require('http');
275
+ const port = 4000;
276
+
277
+ const mimeTypes = {
278
+ '.html': 'text/html',
279
+ '.js': 'application/javascript',
280
+ '.css': 'text/css',
281
+ };
282
+
283
+ const server = http.createServer((req, res) => {
284
+ let filePath = path.join(playgroundDir, req.url === '/' ? 'index.html' : req.url);
285
+ const ext = path.extname(filePath);
286
+ const contentType = mimeTypes[ext] || 'text/plain';
287
+
288
+ fs.readFile(filePath, (err, data) => {
289
+ if (err) {
290
+ res.writeHead(404);
291
+ res.end('Not found');
292
+ return;
293
+ }
294
+ res.writeHead(200, { 'Content-Type': contentType });
295
+ res.end(data);
296
+ });
297
+ });
298
+
299
+ server.listen(port, () => {
300
+ console.log(` Clou Playground running at http://localhost:${port}`);
301
+ console.log(' Press Ctrl+C to stop.\n');
302
+ openInBrowser(`http://localhost:${port}`);
303
+ });
304
+
305
+ // Don't exit - keep server running
306
+ return;
263
307
  }
264
308
 
265
309
  // Handle deploy command (before smart detection)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clou-lang",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Clou - A programming language so simple, even kids can build websites and terminal apps",
5
5
  "main": "src/index.js",
6
6
  "bin": {