motia 0.0.37 → 0.0.39-alpha
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 +46 -42
- package/dist/src/cli.js +2 -2
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -36,51 +36,55 @@ yarn add motia
|
|
|
36
36
|
pnpm add motia
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
40
39
|
## Quick Start
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```
|
|
41
|
+
Ready to get started in minutes? Follow these simple steps using **pnpm** and the automated project creation:
|
|
42
|
+
|
|
43
|
+
1. **Create a new project using the Motia CLI:**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx motia create -t default -n my-motia-project
|
|
47
|
+
```
|
|
48
|
+
*(Replace `my-motia-project` with your desired project name)*
|
|
49
|
+
|
|
50
|
+
This command will:
|
|
51
|
+
* Create a new folder `my-motia-project`
|
|
52
|
+
* Set up a basic Motia project with example steps
|
|
53
|
+
* Install dependencies using pnpm
|
|
54
|
+
|
|
55
|
+
2. **Navigate into your new project directory:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cd my-motia-project
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
3. **Start the Motia development server:**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm run dev
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This will launch the Motia server and the Workbench UI (typically at `http://localhost:3000`).
|
|
68
|
+
|
|
69
|
+
4. **Open the Motia Workbench in your browser (usually `http://localhost:3000`)**. You should see a pre-built flow named "default" with example steps visualized.
|
|
70
|
+
|
|
71
|
+
5. **Test an example API Step:** In your terminal, use `curl` to trigger the example API endpoint (often `/default` in the default template):
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
curl -X POST http://localhost:3000/default \
|
|
75
|
+
-H "Content-Type: application/json" \
|
|
76
|
+
-d '{}'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Alternatively, use the Motia CLI to emit an event (for event-based steps in the template):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx motia emit --topic test-state --message '{}'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Check the Workbench logs – you should see logs indicating the step execution and event flow!
|
|
83
86
|
|
|
87
|
+
**Congratulations! You've just created and run your first Motia workflow using the automated project setup.**
|
|
84
88
|
## CLI Commands
|
|
85
89
|
|
|
86
90
|
Motia comes with a powerful CLI to help you manage your projects:
|
package/dist/src/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ commander_1.program
|
|
|
22
22
|
.action(async (arg) => {
|
|
23
23
|
const { create } = require('./create');
|
|
24
24
|
await create({
|
|
25
|
-
projectName: arg.
|
|
25
|
+
projectName: arg.name ?? '.',
|
|
26
26
|
template: arg.template ?? undefined,
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -84,7 +84,7 @@ commander_1.program
|
|
|
84
84
|
method: 'POST',
|
|
85
85
|
headers: { 'Content-Type': 'application/json' },
|
|
86
86
|
body: JSON.stringify({
|
|
87
|
-
|
|
87
|
+
topic: options.topic,
|
|
88
88
|
data: JSON.parse(options.message),
|
|
89
89
|
}),
|
|
90
90
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motia",
|
|
3
3
|
"description": "Code-first framework for intelligent workflows",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.39-alpha",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/motiadev/motia.git"
|
|
9
|
+
},
|
|
6
10
|
"bin": {
|
|
7
11
|
"motia": "dist/src/cli.js"
|
|
8
12
|
},
|
|
@@ -17,8 +21,8 @@
|
|
|
17
21
|
"inquirer": "^12.4.1",
|
|
18
22
|
"ts-node": "^10.9.2",
|
|
19
23
|
"yaml": "^2.7.0",
|
|
20
|
-
"@motiadev/
|
|
21
|
-
"@motiadev/
|
|
24
|
+
"@motiadev/core": "0.0.39-alpha",
|
|
25
|
+
"@motiadev/workbench": "0.0.39-alpha"
|
|
22
26
|
},
|
|
23
27
|
"devDependencies": {
|
|
24
28
|
"@types/archiver": "^6.0.3",
|