motia 0.13.0 → 0.13.1-beta.162

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.
Files changed (59) hide show
  1. package/LICENSE +93 -21
  2. package/README.md +1 -1
  3. package/dist/cjs/cloud/cli-output-manager.d.ts.map +1 -1
  4. package/dist/cjs/cloud/cli-output-manager.js +38 -9
  5. package/dist/cjs/cloud/new-deployment/build.d.ts.map +1 -1
  6. package/dist/cjs/cloud/new-deployment/build.js +2 -1
  7. package/dist/cjs/create/index.d.ts.map +1 -1
  8. package/dist/cjs/create/index.js +22 -15
  9. package/dist/cjs/create/interactive.js +3 -3
  10. package/dist/cjs/create/templates/generate.d.ts.map +1 -1
  11. package/dist/cjs/create/templates/generate.js +4 -0
  12. package/dist/cjs/create/templates/generate.ts +3 -0
  13. package/dist/cjs/create/templates/hello/README.md.txt +77 -0
  14. package/dist/cjs/create/templates/hello_js/README.md.txt +77 -0
  15. package/dist/cjs/create/templates/hello_python/README.md.txt +78 -0
  16. package/dist/cjs/create/templates/index.js +2 -2
  17. package/dist/cjs/create/templates/index.ts +2 -2
  18. package/dist/cjs/create/templates/nodejs/README.md.txt +86 -0
  19. package/dist/cjs/create/templates/python/README.md.txt +87 -0
  20. package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/api-steps.mdc +22 -6
  21. package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/event-steps.mdc +19 -3
  22. package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/motia-config.mdc +359 -0
  23. package/dist/cjs/cursor-rules/dot-files/.cursor/rules/motia/realtime-streaming.mdc +37 -16
  24. package/dist/cjs/generate-locked-data.d.ts.map +1 -1
  25. package/dist/cjs/generate-locked-data.js +1 -1
  26. package/dist/cjs/install.d.ts.map +1 -1
  27. package/dist/cjs/install.js +2 -1
  28. package/dist/esm/cloud/cli-output-manager.d.ts.map +1 -1
  29. package/dist/esm/cloud/cli-output-manager.js +38 -9
  30. package/dist/esm/cloud/new-deployment/build.d.ts.map +1 -1
  31. package/dist/esm/cloud/new-deployment/build.js +3 -2
  32. package/dist/esm/create/index.d.ts.map +1 -1
  33. package/dist/esm/create/index.js +22 -15
  34. package/dist/esm/create/interactive.js +3 -3
  35. package/dist/esm/create/templates/generate.d.ts.map +1 -1
  36. package/dist/esm/create/templates/generate.js +4 -0
  37. package/dist/esm/create/templates/generate.ts +3 -0
  38. package/dist/esm/create/templates/hello/README.md.txt +77 -0
  39. package/dist/esm/create/templates/hello_js/README.md.txt +77 -0
  40. package/dist/esm/create/templates/hello_python/README.md.txt +78 -0
  41. package/dist/esm/create/templates/index.js +2 -2
  42. package/dist/esm/create/templates/index.ts +2 -2
  43. package/dist/esm/create/templates/nodejs/README.md.txt +86 -0
  44. package/dist/esm/create/templates/python/README.md.txt +87 -0
  45. package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/api-steps.mdc +22 -6
  46. package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/event-steps.mdc +19 -3
  47. package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/motia-config.mdc +359 -0
  48. package/dist/esm/cursor-rules/dot-files/.cursor/rules/motia/realtime-streaming.mdc +37 -16
  49. package/dist/esm/generate-locked-data.d.ts.map +1 -1
  50. package/dist/esm/generate-locked-data.js +1 -1
  51. package/dist/esm/install.d.ts.map +1 -1
  52. package/dist/esm/install.js +3 -2
  53. package/dist/types/cloud/cli-output-manager.d.ts.map +1 -1
  54. package/dist/types/cloud/new-deployment/build.d.ts.map +1 -1
  55. package/dist/types/create/index.d.ts.map +1 -1
  56. package/dist/types/create/templates/generate.d.ts.map +1 -1
  57. package/dist/types/generate-locked-data.d.ts.map +1 -1
  58. package/dist/types/install.d.ts.map +1 -1
  59. package/package.json +7 -7
package/LICENSE CHANGED
@@ -1,21 +1,93 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Motia
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject
14
+ to the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor's trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is the
76
+ software the licensor makes available under these terms, including any portion
77
+ of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that organization.
84
+ **control** means ownership of substantially all the assets of an entity, or the
85
+ power to direct its management and policies by vote, contract, or otherwise.
86
+ Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Motia Banner](https://github.com/MotiaDev/motia/raw/main/assets/github-readme-banner.png)](https://motia.dev/)
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/motia?style=flat&logo=npm&logoColor=white&color=CB3837&labelColor=000000)](https://www.npmjs.com/package/motia)
4
- [![license](https://img.shields.io/badge/license-MIT-green?style=flat&logo=opensourceinitiative&logoColor=white&labelColor=000000)](https://github.com/MotiaDev/motia/blob/main/LICENSE)
4
+ [![license](https://img.shields.io/badge/license-ELv2-blue?style=flat&logo=opensourceinitiative&logoColor=white&labelColor=000000)](https://github.com/MotiaDev/motia/blob/main/LICENSE)
5
5
  [![GitHub stars](https://img.shields.io/github/stars/MotiaDev/motia?style=flat&logo=github&logoColor=white&color=yellow&labelColor=000000)](https://github.com/MotiaDev/motia)
6
6
  [![Twitter Follow](https://img.shields.io/badge/Follow-@motiadev-1DA1F2?style=flat&logo=twitter&logoColor=white&labelColor=000000)](https://twitter.com/motiadev)
7
7
  [![Discord](https://img.shields.io/discord/1322278831184281721?style=flat&logo=discord&logoColor=white&color=5865F2&label=Discord&labelColor=000000)](https://discord.gg/motia)
@@ -1 +1 @@
1
- {"version":3,"file":"cli-output-manager.d.ts","sourceRoot":"","sources":["../../../src/cloud/cli-output-manager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAU3B,QAAA,MAAM,IAAI;;;;;;CAMA,CAAA;AAEV,QAAA,MAAM,SAAS;;;;;;;;;;CAUL,CAAA;AAEV,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAU;;IAMxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAK9B,GAAG,CAAC,GAAG,EAAE,MAAM,OAAO,IAAI,GAAG,OAAO;IAKpC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,OAAO,SAAS,GAAG,OAAO;IAShE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,GAAE,MAAM,OAAO,SAAkB,GAAG,OAAO;IAgBxE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO;IAiC/D,QAAQ,IAAI,MAAM;CAGnB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,SAAS,CAAI;IAErB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;IAsBpD,aAAa,IAAI,OAAO;CAGzB"}
1
+ {"version":3,"file":"cli-output-manager.d.ts","sourceRoot":"","sources":["../../../src/cloud/cli-output-manager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAU3B,QAAA,MAAM,IAAI;;;;;;CAMA,CAAA;AAEV,QAAA,MAAM,SAAS;;;;;;;;;;CAUL,CAAA;AAEV,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAU;;IAMxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAK9B,GAAG,CAAC,GAAG,EAAE,MAAM,OAAO,IAAI,GAAG,OAAO;IAKpC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,OAAO,SAAS,GAAG,OAAO;IAShE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,GAAE,MAAM,OAAO,SAAkB,GAAG,OAAO;IA0CxE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO;IAiC/D,QAAQ,IAAI,MAAM;CAGnB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,SAAS,CAAI;IAErB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;IAsBpD,aAAa,IAAI,OAAO;CAGzB"}
@@ -55,17 +55,46 @@ class Message {
55
55
  return this;
56
56
  }
57
57
  box(messages, color = 'blue') {
58
- const message = messages.join('\n \n');
59
- const lines = message.match(/.{1,40}/g) || [message];
60
- const width = Math.min(40, Math.max(...lines.map((line) => line.length)));
61
- const border = '─'.repeat(width + 2);
58
+ const ansiEscape = String.fromCharCode(0x1b);
59
+ const stripAnsi = (str) => str.replace(new RegExp(`${ansiEscape}\\[[0-9;]*m`, 'g'), '');
60
+ const contentWidth = 40;
61
+ const border = '─'.repeat(contentWidth + 2);
62
62
  const borderColor = colorTags[color];
63
- this.output.push(borderColor('\n ┌' + border + '┐\n'));
64
- lines.forEach((line) => {
65
- const padding = ' '.repeat(width - line.trim().length);
66
- this.output.push(borderColor('│ ') + line.trim() + padding + borderColor(' │\n'));
63
+ const processedLines = [];
64
+ messages.forEach((msg) => {
65
+ const trimmed = msg.trim();
66
+ if (trimmed.length === 0)
67
+ return;
68
+ const visibleLength = stripAnsi(trimmed).length;
69
+ if (visibleLength <= contentWidth) {
70
+ processedLines.push(trimmed);
71
+ }
72
+ else {
73
+ const words = trimmed.split(/\s+/);
74
+ let currentLine = '';
75
+ words.forEach((word) => {
76
+ const wordLength = stripAnsi(word).length;
77
+ const currentLength = stripAnsi(currentLine).length;
78
+ if (currentLength + wordLength + 1 <= contentWidth) {
79
+ currentLine = currentLine ? `${currentLine} ${word}` : word;
80
+ }
81
+ else {
82
+ if (currentLine)
83
+ processedLines.push(currentLine);
84
+ currentLine = word;
85
+ }
86
+ });
87
+ if (currentLine)
88
+ processedLines.push(currentLine);
89
+ }
67
90
  });
68
- this.output.push(borderColor('└' + border + '┘'));
91
+ this.output.push(borderColor(`\n ┌${border}┐\n`));
92
+ processedLines.forEach((line) => {
93
+ const lineLength = stripAnsi(line).length;
94
+ const padding = ' '.repeat(contentWidth - lineLength);
95
+ this.output.push(`${borderColor(' │')} ${line}${padding} ${borderColor('│\n')}`);
96
+ });
97
+ this.output.push(borderColor(` └${border}┘`));
69
98
  return this;
70
99
  }
71
100
  table(headers, rows) {
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cloud/new-deployment/build.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAwB,MAAM,kBAAkB,CAAA;AAIhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAM/D,eAAO,MAAM,KAAK,GAAU,UAAU,aAAa,KAAG,OAAO,CAAC,OAAO,CAsDpE,CAAA"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cloud/new-deployment/build.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAwB,MAAM,kBAAkB,CAAA;AAIhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAM/D,eAAO,MAAM,KAAK,GAAU,UAAU,aAAa,KAAG,OAAO,CAAC,OAAO,CAuDpE,CAAA"}
@@ -20,6 +20,7 @@ const hasPythonSteps = (stepFiles) => {
20
20
  const build = async (listener) => {
21
21
  const builder = new builder_1.Builder(constants_1.projectDir, listener);
22
22
  const stepFiles = (0, generate_locked_data_1.getStepFiles)(constants_1.projectDir);
23
+ const streamFiles = (0, generate_locked_data_1.getStreamFiles)(constants_1.projectDir);
23
24
  if (stepFiles.length === 0) {
24
25
  throw new Error('Project contains no steps, please add some steps before building');
25
26
  }
@@ -29,7 +30,7 @@ const build = async (listener) => {
29
30
  fs_1.default.mkdirSync(constants_1.distDir, { recursive: true });
30
31
  const redisClient = await (0, redis_memory_manager_1.instanceRedisMemoryServer)(constants_1.projectDir, false);
31
32
  const lockedData = new core_1.LockedData(constants_1.projectDir, new core_1.MemoryStreamAdapterManager(), new printer_1.NoPrinter(), redisClient);
32
- if (hasPythonSteps(stepFiles)) {
33
+ if (hasPythonSteps([...stepFiles, ...streamFiles])) {
33
34
  builder.registerBuilder('python', new python_1.PythonBuilder(builder, listener));
34
35
  }
35
36
  const invalidSteps = await (0, generate_locked_data_1.collectFlows)(constants_1.projectDir, lockedData).catch((err) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/create/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAwEvD,KAAK,IAAI,GAAG;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,EAAE,UAAU,CAAA;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,MAAM,GAAU,mDAAmD,IAAI,KAAG,OAAO,CAAC,IAAI,CA8KlG,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/create/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAwEvD,KAAK,IAAI,GAAG;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,EAAE,UAAU,CAAA;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,MAAM,GAAU,mDAAmD,IAAI,KAAG,OAAO,CAAC,IAAI,CAmLlG,CAAA"}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.create = void 0;
7
+ const colors_1 = __importDefault(require("colors"));
7
8
  const fs_1 = __importDefault(require("fs"));
8
9
  const path_1 = __importDefault(require("path"));
9
10
  const generate_types_1 = require("../generate-types");
@@ -60,14 +61,14 @@ const installNodeDependencies = async (rootDir, context) => {
60
61
  const create = async ({ projectName, template, cursorEnabled, context }) => {
61
62
  console.log('\n\n' +
62
63
  `
63
- _____ ______ ______ ______
64
- /'\\_/\`\\/\\ __\`\\/\\__ _\\/\\__ _\\ /\\ _ \\
65
- /\\ \\ \\ \\/\\ \\/_/\\ \\/\\/_/\\ \\/ \\ \\ \\L\\ \\
66
- \\ \\ \\__\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ __ \\
67
- \\ \\ \\_/\\ \\ \\ \\_\\ \\ \\ \\ \\ \\_\\ \\__\\ \\ \\/\\ \\
68
- \\ \\_\\\\ \\_\\ \\_____\\ \\ \\_\\ /\\_____\\\\ \\_\\ \\_\\
69
- \\/_/ \\/_/\\/_____/ \\/_/ \\/_____/ \\/_/\\/_/
70
- ` +
64
+ _____ ______ ______ ______
65
+ /'\\_/\`\\/\\ __\`\\/\\__ _\\/\\__ _\\ /\\ _ \\
66
+ /\\ \\ \\ \\/\\ \\/_/\\ \\/\\/_/\\ \\/ \\ \\ \\L\\ \\
67
+ \\ \\ \\__\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ __ \\
68
+ \\ \\ \\_/\\ \\ \\ \\_\\ \\ \\ \\ \\ \\_\\ \\__\\ \\ \\/\\ \\
69
+ \\ \\_\\\\ \\_\\ \\_____\\ \\ \\_\\ /\\_____\\\\ \\_\\ \\_\\
70
+ \\/_/ \\/_/\\/_____/ \\/_/ \\/_____/ \\/_/\\/_/
71
+ ` +
71
72
  '\n\n');
72
73
  const isCurrentDir = projectName === '.' || projectName === './' || projectName === '.\\';
73
74
  const rootDir = isCurrentDir ? process.cwd() : path_1.default.join(process.cwd(), projectName);
@@ -186,12 +187,18 @@ const create = async ({ projectName, template, cursorEnabled, context }) => {
186
187
  .append('Created at')
187
188
  .append(`./${path_1.default.basename(rootDir)}`, 'cyan')
188
189
  .append('- happy coding!'));
189
- context.log('starting-development-server-command', (message) => message
190
- .tag('info')
191
- .append('Next steps:')
192
- .append(`cd ${path_1.default.basename(rootDir)}`, 'gray')
193
- .append('then run', 'dark')
194
- .append(`${packageManager} run dev`, 'gray')
195
- .append('to start the development server.', 'dark'));
190
+ const projectDirName = path_1.default.basename(rootDir);
191
+ const devCommand = `${packageManager} run dev`;
192
+ const nextSteps = [];
193
+ if (isCurrentDir) {
194
+ nextSteps.push(`Run ${colors_1.default.cyan(devCommand)}`);
195
+ }
196
+ else {
197
+ nextSteps.push(`cd ${colors_1.default.cyan(projectDirName)}`, `then run ${colors_1.default.cyan(devCommand)}`);
198
+ }
199
+ context.log('starting-development-server-command', (message) => {
200
+ message.tag('info').append('Next steps:');
201
+ message.box([...nextSteps, 'to start the development server.'], 'cyan');
202
+ });
196
203
  };
197
204
  exports.create = create;
@@ -8,8 +8,8 @@ const colors_1 = __importDefault(require("colors"));
8
8
  const inquirer_1 = __importDefault(require("inquirer"));
9
9
  const index_1 = require("./index");
10
10
  const choices = {
11
- nodejs: 'Tutorial (TypeScript)',
12
- python: 'Tutorial (Python)',
11
+ 'motia-tutorial-typescript': 'Tutorial (TypeScript)',
12
+ 'motia-tutorial-python': 'Tutorial (Python)',
13
13
  'starter-typescript': 'Starter (TypeScript)',
14
14
  'starter-javascript': 'Starter (JavaScript)',
15
15
  'starter-python': 'Starter (Python)',
@@ -68,7 +68,7 @@ const createInteractive = async (args, context) => {
68
68
  context.log('creating', (message) => message.append('\n🔨 Creating your Motia project...\n'));
69
69
  await (0, index_1.create)({
70
70
  projectName: name || '.',
71
- template: template || 'nodejs',
71
+ template: template || 'motia-tutorial-typescript',
72
72
  cursorEnabled: true, // Default to true for cursor rules
73
73
  context,
74
74
  });
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/create/templates/generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAuB/E,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,KAAG,SA+D9D,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,MAAM,KAAG,SA0C/D,CAAA"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/create/templates/generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAuB/E,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,KAAG,SAkE9D,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,MAAM,KAAG,SA0C/D,CAAA"}
@@ -59,6 +59,7 @@ const generateTemplateSteps = (templateFolder) => {
59
59
  return async (rootDir, context) => {
60
60
  const templatePath = path.join(__dirname, templateFolder);
61
61
  const files = (0, glob_1.globSync)('**/*', { absolute: false, cwd: templatePath, dot: true });
62
+ const projectName = path.basename(rootDir);
62
63
  try {
63
64
  for (const fileName of files) {
64
65
  const filePath = path.join(templatePath, fileName);
@@ -95,6 +96,9 @@ const generateTemplateSteps = (templateFolder) => {
95
96
  void 0;
96
97
  }
97
98
  }
99
+ else {
100
+ content = replaceTemplateVariables(content, projectName);
101
+ }
98
102
  // Use file descriptor for atomic write operation
99
103
  let fd = null;
100
104
  try {
@@ -30,6 +30,7 @@ export const generateTemplateSteps = (templateFolder: string): Generator => {
30
30
  return async (rootDir: string, context: CliContext): Promise<void> => {
31
31
  const templatePath = path.join(__dirname, templateFolder)
32
32
  const files = globSync('**/*', { absolute: false, cwd: templatePath, dot: true })
33
+ const projectName = path.basename(rootDir)
33
34
 
34
35
  try {
35
36
  for (const fileName of files) {
@@ -71,6 +72,8 @@ export const generateTemplateSteps = (templateFolder: string): Generator => {
71
72
  } catch {
72
73
  void 0
73
74
  }
75
+ } else {
76
+ content = replaceTemplateVariables(content, projectName)
74
77
  }
75
78
 
76
79
  // Use file descriptor for atomic write operation
@@ -0,0 +1,77 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Motia project created with the starter template.
4
+
5
+ ## What is Motia?
6
+
7
+ Motia is an open-source, unified backend framework that eliminates runtime fragmentation by bringing **APIs, background jobs, queueing, streaming, state, workflows, AI agents, observability, scaling, and deployment** into one unified system using a single core primitive, the **Step**.
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # Start the development server
13
+ npm run dev
14
+ # or
15
+ yarn dev
16
+ # or
17
+ pnpm dev
18
+ ```
19
+
20
+ This starts the Motia runtime and the **Workbench** - a powerful UI for developing and debugging your workflows. By default, it's available at [`http://localhost:3000`](http://localhost:3000).
21
+
22
+ ```bash
23
+ # Test your first endpoint
24
+ curl http://localhost:3000/hello
25
+ ```
26
+
27
+ ## Step Types
28
+
29
+ Every Step has a `type` that defines how it triggers:
30
+
31
+ | Type | When it runs | Use case |
32
+ |------|--------------|----------|
33
+ | **`api`** | HTTP request | REST APIs, webhooks |
34
+ | **`event`** | Event emitted | Background jobs, workflows |
35
+ | **`cron`** | Schedule | Cleanup, reports, reminders |
36
+
37
+ ## Development Commands
38
+
39
+ ```bash
40
+ # Start Workbench and development server
41
+ npm run dev
42
+ # or
43
+ yarn dev
44
+ # or
45
+ pnpm dev
46
+
47
+ # Generate TypeScript types from Step configs
48
+ npm run generate-types
49
+ # or
50
+ yarn generate-types
51
+ # or
52
+ pnpm generate-types
53
+
54
+ # Build project for deployment
55
+ npm run build
56
+ # or
57
+ yarn build
58
+ # or
59
+ pnpm build
60
+ ```
61
+
62
+ ## Project Structure
63
+
64
+ ```
65
+ steps/ # Your Step definitions (or use src/)
66
+ motia.config.ts # Motia configuration
67
+ ```
68
+
69
+ Steps are auto-discovered from your `steps/` or `src/` directories - no manual registration required.
70
+
71
+ ## Learn More
72
+
73
+ - [Documentation](https://motia.dev/docs) - Complete guides and API reference
74
+ - [Quick Start Guide](https://motia.dev/docs/getting-started/quick-start) - Detailed getting started tutorial
75
+ - [Core Concepts](https://motia.dev/docs/concepts/overview) - Learn about Steps and Motia architecture
76
+ - [Discord Community](https://discord.gg/motia) - Get help and connect with other developers
77
+
@@ -0,0 +1,77 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Motia project created with the starter template.
4
+
5
+ ## What is Motia?
6
+
7
+ Motia is an open-source, unified backend framework that eliminates runtime fragmentation by bringing **APIs, background jobs, queueing, streaming, state, workflows, AI agents, observability, scaling, and deployment** into one unified system using a single core primitive, the **Step**.
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # Start the development server
13
+ npm run dev
14
+ # or
15
+ yarn dev
16
+ # or
17
+ pnpm dev
18
+ ```
19
+
20
+ This starts the Motia runtime and the **Workbench** - a powerful UI for developing and debugging your workflows. By default, it's available at [`http://localhost:3000`](http://localhost:3000).
21
+
22
+ ```bash
23
+ # Test your first endpoint
24
+ curl http://localhost:3000/hello
25
+ ```
26
+
27
+ ## Step Types
28
+
29
+ Every Step has a `type` that defines how it triggers:
30
+
31
+ | Type | When it runs | Use case |
32
+ |------|--------------|----------|
33
+ | **`api`** | HTTP request | REST APIs, webhooks |
34
+ | **`event`** | Event emitted | Background jobs, workflows |
35
+ | **`cron`** | Schedule | Cleanup, reports, reminders |
36
+
37
+ ## Development Commands
38
+
39
+ ```bash
40
+ # Start Workbench and development server
41
+ npm run dev
42
+ # or
43
+ yarn dev
44
+ # or
45
+ pnpm dev
46
+
47
+ # Generate TypeScript types from Step configs
48
+ npm run generate-types
49
+ # or
50
+ yarn generate-types
51
+ # or
52
+ pnpm generate-types
53
+
54
+ # Build project for deployment
55
+ npm run build
56
+ # or
57
+ yarn build
58
+ # or
59
+ pnpm build
60
+ ```
61
+
62
+ ## Project Structure
63
+
64
+ ```
65
+ steps/ # Your Step definitions (or use src/)
66
+ motia.config.ts # Motia configuration
67
+ ```
68
+
69
+ Steps are auto-discovered from your `steps/` or `src/` directories - no manual registration required.
70
+
71
+ ## Learn More
72
+
73
+ - [Documentation](https://motia.dev/docs) - Complete guides and API reference
74
+ - [Quick Start Guide](https://motia.dev/docs/getting-started/quick-start) - Detailed getting started tutorial
75
+ - [Core Concepts](https://motia.dev/docs/concepts/overview) - Learn about Steps and Motia architecture
76
+ - [Discord Community](https://discord.gg/motia) - Get help and connect with other developers
77
+
@@ -0,0 +1,78 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Motia project created with the starter template.
4
+
5
+ ## What is Motia?
6
+
7
+ Motia is an open-source, unified backend framework that eliminates runtime fragmentation by bringing **APIs, background jobs, queueing, streaming, state, workflows, AI agents, observability, scaling, and deployment** into one unified system using a single core primitive, the **Step**.
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # Start the development server
13
+ npm run dev
14
+ # or
15
+ yarn dev
16
+ # or
17
+ pnpm dev
18
+ ```
19
+
20
+ This starts the Motia runtime and the **Workbench** - a powerful UI for developing and debugging your workflows. By default, it's available at [`http://localhost:3000`](http://localhost:3000).
21
+
22
+ ```bash
23
+ # Test your first endpoint
24
+ curl http://localhost:3000/hello
25
+ ```
26
+
27
+ ## Step Types
28
+
29
+ Every Step has a `type` that defines how it triggers:
30
+
31
+ | Type | When it runs | Use case |
32
+ |------|--------------|----------|
33
+ | **`api`** | HTTP request | REST APIs, webhooks |
34
+ | **`event`** | Event emitted | Background jobs, workflows |
35
+ | **`cron`** | Schedule | Cleanup, reports, reminders |
36
+
37
+ ## Development Commands
38
+
39
+ ```bash
40
+ # Start Workbench and development server
41
+ npm run dev
42
+ # or
43
+ yarn dev
44
+ # or
45
+ pnpm dev
46
+
47
+ # Generate TypeScript types from Step configs
48
+ npm run generate-types
49
+ # or
50
+ yarn generate-types
51
+ # or
52
+ pnpm generate-types
53
+
54
+ # Build project for deployment
55
+ npm run build
56
+ # or
57
+ yarn build
58
+ # or
59
+ pnpm build
60
+ ```
61
+
62
+ ## Project Structure
63
+
64
+ ```
65
+ steps/ # Your Step definitions (or use src/)
66
+ motia.config.ts # Motia configuration
67
+ requirements.txt # Python dependencies
68
+ ```
69
+
70
+ Steps are auto-discovered from your `steps/` or `src/` directories - no manual registration required. You can write Steps in Python, TypeScript, or JavaScript, all in the same project.
71
+
72
+ ## Learn More
73
+
74
+ - [Documentation](https://motia.dev/docs) - Complete guides and API reference
75
+ - [Quick Start Guide](https://motia.dev/docs/getting-started/quick-start) - Detailed getting started tutorial
76
+ - [Core Concepts](https://motia.dev/docs/concepts/overview) - Learn about Steps and Motia architecture
77
+ - [Discord Community](https://discord.gg/motia) - Get help and connect with other developers
78
+
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.templates = void 0;
4
4
  const generate_1 = require("./generate");
5
5
  exports.templates = {
6
- nodejs: (0, generate_1.generateTemplateSteps)('nodejs'),
7
- python: (0, generate_1.generateTemplateSteps)('python'),
6
+ 'motia-tutorial-typescript': (0, generate_1.generateTemplateSteps)('nodejs'),
7
+ 'motia-tutorial-python': (0, generate_1.generateTemplateSteps)('python'),
8
8
  plugin: (0, generate_1.generatePluginTemplate)('plugin'),
9
9
  'starter-typescript': (0, generate_1.generateTemplateSteps)('hello'),
10
10
  'starter-javascript': (0, generate_1.generateTemplateSteps)('hello_js'),
@@ -1,8 +1,8 @@
1
1
  import { type Generator, generatePluginTemplate, generateTemplateSteps } from './generate'
2
2
 
3
3
  export const templates: Record<string, Generator> = {
4
- nodejs: generateTemplateSteps('nodejs'),
5
- python: generateTemplateSteps('python'),
4
+ 'motia-tutorial-typescript': generateTemplateSteps('nodejs'),
5
+ 'motia-tutorial-python': generateTemplateSteps('python'),
6
6
  plugin: generatePluginTemplate('plugin'),
7
7
  'starter-typescript': generateTemplateSteps('hello'),
8
8
  'starter-javascript': generateTemplateSteps('hello_js'),