@zea.cl/create-cerebelum 0.1.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.
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * create-cerebelum — Scaffold a new Cerebelum workflow project.
4
+ *
5
+ * Usage:
6
+ * npx @zea.cl/create-cerebelum my-project
7
+ */
8
+
9
+ const fs = require('fs')
10
+ const path = require('path')
11
+ const { execSync } = require('child_process')
12
+
13
+ const args = process.argv.slice(2)
14
+ const projectName = args[0]
15
+
16
+ if (!projectName) {
17
+ console.log('\n🧠 create-cerebelum — Scaffold a new Cerebelum project\n')
18
+ console.log(' Usage: npx @zea.cl/create-cerebelum <project-name>\n')
19
+ console.log(' Example:')
20
+ console.log(' npx @zea.cl/create-cerebelum my-workflow')
21
+ console.log(' cd my-workflow')
22
+ console.log(' python workflow.py')
23
+ console.log('')
24
+ process.exit(0)
25
+ }
26
+
27
+ const projectDir = path.resolve(projectName)
28
+ const templateDir = path.resolve(__dirname, '..', 'template')
29
+
30
+ // ── Create project directory ──
31
+ if (fs.existsSync(projectDir)) {
32
+ console.error(`āŒ Directory "${projectName}" already exists.`)
33
+ process.exit(1)
34
+ }
35
+
36
+ fs.mkdirSync(projectDir, { recursive: true })
37
+ console.log(`\n🧠 Creating Cerebelum project: ${projectName}\n`)
38
+
39
+ // ── Copy template files ──
40
+ const files = fs.readdirSync(templateDir)
41
+ for (const file of files) {
42
+ const src = path.join(templateDir, file)
43
+ const dest = path.join(projectDir, file)
44
+ fs.copyFileSync(src, dest)
45
+ console.log(` āœ… ${file}`)
46
+ }
47
+
48
+ // ── Python venv ──
49
+ console.log(`\n šŸ“¦ Installing Python dependencies...`)
50
+ try {
51
+ execSync('pip install cerebelum-sdk', {
52
+ cwd: projectDir,
53
+ stdio: 'pipe',
54
+ })
55
+ console.log(` āœ… cerebelum-sdk installed`)
56
+ } catch {
57
+ console.log(` āš ļø Could not install cerebelum-sdk via pip.`)
58
+ console.log(` Run: pip install cerebelum-sdk`)
59
+ }
60
+
61
+ // ── Auth hint ──
62
+ console.log(`\n šŸ” To use cloud mode, authenticate:`)
63
+ console.log(` npx @zea.cl/cerebelum-cli login`)
64
+ console.log(`\n šŸš€ Quickstart:`)
65
+ console.log(` cd ${projectName}`)
66
+ console.log(` python workflow.py`)
67
+ console.log(`\n ā˜ļø Cloud mode:`)
68
+ console.log(` npx @zea.cl/cerebelum-cli deploy workflow.py`)
69
+ console.log(` npx @zea.cl/cerebelum-cli run my_workflow --inputs '{"name":"ZEA"}'`)
70
+ console.log('')
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@zea.cl/create-cerebelum",
3
+ "version": "0.1.0",
4
+ "description": "Scaffold a new Cerebelum workflow project",
5
+ "bin": {
6
+ "create-cerebelum": "./bin/create-cerebelum.js"
7
+ },
8
+ "files": ["bin", "template"],
9
+ "keywords": ["cerebelum", "workflow", "scaffold", "create"],
10
+ "license": "Apache-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/ZeaCl/cerebelum.git",
14
+ "directory": "create-cerebelum"
15
+ }
16
+ }
@@ -0,0 +1,33 @@
1
+ """My Cerebelum Workflow — modify this file to build your workflow."""
2
+
3
+ from cerebelum import step, workflow
4
+
5
+ # ── Define your steps ─────────────────────────────────────
6
+
7
+ @step
8
+ async def hello(context):
9
+ """First step: greets the world."""
10
+ return {"message": "Hello, Cerebelum! 🧠"}
11
+
12
+ # Add more steps here...
13
+ # @step
14
+ # async def my_step(context, previous_result=None):
15
+ # return {"data": "my result"}
16
+
17
+ # ── Define your workflow ──────────────────────────────────
18
+
19
+ @workflow
20
+ def my_workflow(wf):
21
+ wf.timeline(hello)
22
+ # wf.timeline(hello >> my_step) # Chain steps
23
+
24
+ # ── Execute ───────────────────────────────────────────────
25
+
26
+ import asyncio
27
+
28
+ async def main():
29
+ result = await my_workflow.execute({})
30
+ print(f"Status: {result.status}")
31
+
32
+ if __name__ == "__main__":
33
+ asyncio.run(main())