@nautorun/nauto 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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -0
  3. package/dist/commands/db-migrate.d.ts +2 -0
  4. package/dist/commands/db-migrate.d.ts.map +1 -0
  5. package/dist/commands/db-migrate.js +27 -0
  6. package/dist/commands/db-migrate.js.map +1 -0
  7. package/dist/commands/help.d.ts +2 -0
  8. package/dist/commands/help.d.ts.map +1 -0
  9. package/dist/commands/help.js +16 -0
  10. package/dist/commands/help.js.map +1 -0
  11. package/dist/commands/make-step.d.ts +2 -0
  12. package/dist/commands/make-step.d.ts.map +1 -0
  13. package/dist/commands/make-step.js +37 -0
  14. package/dist/commands/make-step.js.map +1 -0
  15. package/dist/commands/make-workflow.d.ts +2 -0
  16. package/dist/commands/make-workflow.d.ts.map +1 -0
  17. package/dist/commands/make-workflow.js +38 -0
  18. package/dist/commands/make-workflow.js.map +1 -0
  19. package/dist/commands/queue-replay.d.ts +2 -0
  20. package/dist/commands/queue-replay.d.ts.map +1 -0
  21. package/dist/commands/queue-replay.js +88 -0
  22. package/dist/commands/queue-replay.js.map +1 -0
  23. package/dist/commands/queue-worker.d.ts +2 -0
  24. package/dist/commands/queue-worker.d.ts.map +1 -0
  25. package/dist/commands/queue-worker.js +46 -0
  26. package/dist/commands/queue-worker.js.map +1 -0
  27. package/dist/commands/sail-install.d.ts +2 -0
  28. package/dist/commands/sail-install.d.ts.map +1 -0
  29. package/dist/commands/sail-install.js +293 -0
  30. package/dist/commands/sail-install.js.map +1 -0
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +6 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/main.d.ts +2 -0
  36. package/dist/main.d.ts.map +1 -0
  37. package/dist/main.js +56 -0
  38. package/dist/main.js.map +1 -0
  39. package/dist/utils/strings.d.ts +3 -0
  40. package/dist/utils/strings.d.ts.map +1 -0
  41. package/dist/utils/strings.js +19 -0
  42. package/dist/utils/strings.js.map +1 -0
  43. package/dist/utils/write.d.ts +2 -0
  44. package/dist/utils/write.d.ts.map +1 -0
  45. package/dist/utils/write.js +21 -0
  46. package/dist/utils/write.js.map +1 -0
  47. package/package.json +40 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nautorun
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.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # nauto
2
+
3
+ Nautorun CLI for scaffolding, migrations, and a Sail-like Docker environment.
4
+
5
+ ## Install
6
+ ```bash
7
+ npm i -g @nautorun/nauto
8
+ ```
9
+
10
+ ## Use in a project
11
+ ```bash
12
+ nauto sail:install
13
+ ./nauto up
14
+ ```
@@ -0,0 +1,2 @@
1
+ export declare function runMigrations(): Promise<void>;
2
+ //# sourceMappingURL=db-migrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-migrate.d.ts","sourceRoot":"","sources":["../../src/commands/db-migrate.ts"],"names":[],"mappings":"AAGA,wBAAsB,aAAa,kBAoBlC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runMigrations = runMigrations;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const knex_1 = __importDefault(require("knex"));
9
+ async function runMigrations() {
10
+ const databaseUrl = process.env.DATABASE_URL;
11
+ if (!databaseUrl) {
12
+ process.stderr.write("DATABASE_URL is required for db:migrate.\n");
13
+ process.exit(1);
14
+ }
15
+ const migrationsDir = node_path_1.default.resolve(process.cwd(), "db/core/migrations");
16
+ const db = (0, knex_1.default)({
17
+ client: "pg",
18
+ connection: databaseUrl,
19
+ migrations: {
20
+ directory: migrationsDir
21
+ }
22
+ });
23
+ await db.migrate.latest();
24
+ await db.destroy();
25
+ process.stdout.write("Migrations complete.\n");
26
+ }
27
+ //# sourceMappingURL=db-migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-migrate.js","sourceRoot":"","sources":["../../src/commands/db-migrate.ts"],"names":[],"mappings":";;;;;AAGA,sCAoBC;AAvBD,0DAA6B;AAC7B,gDAAwB;AAEjB,KAAK,UAAU,aAAa;IACjC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,aAAa,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC,CAAC;IAExE,MAAM,EAAE,GAAG,IAAA,cAAI,EAAC;QACd,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE;YACV,SAAS,EAAE,aAAa;SACzB;KACF,CAAC,CAAC;IAEH,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const helpText = "\nnauto - Nautorun CLI\n\nUsage:\n nauto help\n nauto make:workflow <Name>\n nauto make:step <Name>\n nauto db:migrate\n nauto sail:install [--force] [--path=<dir>]\n nauto queue:worker\n nauto queue:replay [limit] [workflowName]\n";
2
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,mPAWpB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.helpText = void 0;
4
+ exports.helpText = `
5
+ nauto - Nautorun CLI
6
+
7
+ Usage:
8
+ nauto help
9
+ nauto make:workflow <Name>
10
+ nauto make:step <Name>
11
+ nauto db:migrate
12
+ nauto sail:install [--force] [--path=<dir>]
13
+ nauto queue:worker
14
+ nauto queue:replay [limit] [workflowName]
15
+ `;
16
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;;;;;;;;;;;CAWvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function makeStep(name?: string): void;
2
+ //# sourceMappingURL=make-step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-step.d.ts","sourceRoot":"","sources":["../../src/commands/make-step.ts"],"names":[],"mappings":"AAKA,wBAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,QA8BrC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.makeStep = makeStep;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const strings_1 = require("../utils/strings");
10
+ const write_1 = require("../utils/write");
11
+ function makeStep(name) {
12
+ if (!name) {
13
+ process.stderr.write("Step name is required.\n");
14
+ process.exit(1);
15
+ }
16
+ const fileName = (0, strings_1.toKebab)(name);
17
+ const className = (0, strings_1.toPascal)(name);
18
+ const dir = node_path_1.default.resolve(process.cwd(), "packages/framework/src/steps");
19
+ const filePath = node_path_1.default.join(dir, `${fileName}.ts`);
20
+ node_fs_1.default.mkdirSync(dir, { recursive: true });
21
+ if (node_fs_1.default.existsSync(filePath)) {
22
+ process.stderr.write(`Step already exists: ${filePath}\n`);
23
+ process.exit(1);
24
+ }
25
+ const content = `import type { StepHandler, StepContext, StepResult } from "@nautorun/core-contracts";
26
+
27
+ export class ${className} implements StepHandler {
28
+ async handle(ctx: StepContext): Promise<StepResult> {
29
+ return { output: ctx.input };
30
+ }
31
+ }
32
+ `;
33
+ node_fs_1.default.writeFileSync(filePath, content, "utf8");
34
+ (0, write_1.updateIndexExport)(dir, className, `./${fileName}`);
35
+ process.stdout.write(`Created step: ${filePath}\n`);
36
+ }
37
+ //# sourceMappingURL=make-step.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-step.js","sourceRoot":"","sources":["../../src/commands/make-step.ts"],"names":[],"mappings":";;;;;AAKA,4BA8BC;AAnCD,0DAA6B;AAC7B,sDAAyB;AACzB,8CAAqD;AACrD,0CAAmD;AAEnD,SAAgB,QAAQ,CAAC,IAAa;IACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,iBAAO,EAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,8BAA8B,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,KAAK,CAAC,CAAC;IAElD,iBAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvC,IAAI,iBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,QAAQ,IAAI,CAAC,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG;;eAEH,SAAS;;;;;CAKvB,CAAC;IAEA,iBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5C,IAAA,yBAAiB,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,CAAC,CAAC;IACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,QAAQ,IAAI,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function makeWorkflow(name?: string): void;
2
+ //# sourceMappingURL=make-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-workflow.d.ts","sourceRoot":"","sources":["../../src/commands/make-workflow.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,QA+BzC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.makeWorkflow = makeWorkflow;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const strings_1 = require("../utils/strings");
10
+ const write_1 = require("../utils/write");
11
+ function makeWorkflow(name) {
12
+ if (!name) {
13
+ process.stderr.write("Workflow name is required.\n");
14
+ process.exit(1);
15
+ }
16
+ const fileName = (0, strings_1.toKebab)(name);
17
+ const className = (0, strings_1.toPascal)(name);
18
+ const dir = node_path_1.default.resolve(process.cwd(), "packages/framework/src/workflows");
19
+ const filePath = node_path_1.default.join(dir, `${fileName}.ts`);
20
+ node_fs_1.default.mkdirSync(dir, { recursive: true });
21
+ if (node_fs_1.default.existsSync(filePath)) {
22
+ process.stderr.write(`Workflow already exists: ${filePath}\n`);
23
+ process.exit(1);
24
+ }
25
+ const content = `import type { Workflow } from "@nautorun/core-contracts";
26
+
27
+ export const ${className}Workflow: Workflow = {
28
+ name: () => "${fileName}",
29
+ steps: () => [
30
+ // { name: "stepName", handler: StepClass }
31
+ ]
32
+ };
33
+ `;
34
+ node_fs_1.default.writeFileSync(filePath, content, "utf8");
35
+ (0, write_1.updateIndexExport)(dir, `${className}Workflow`, `./${fileName}`);
36
+ process.stdout.write(`Created workflow: ${filePath}\n`);
37
+ }
38
+ //# sourceMappingURL=make-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-workflow.js","sourceRoot":"","sources":["../../src/commands/make-workflow.ts"],"names":[],"mappings":";;;;;AAKA,oCA+BC;AApCD,0DAA6B;AAC7B,sDAAyB;AACzB,8CAAqD;AACrD,0CAAmD;AAEnD,SAA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":"queue-replay.d.ts","sourceRoot":"","sources":["../../src/commands/queue-replay.ts"],"names":[],"mappings":"AAwBA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,iBAoF7C"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runReplay = runReplay;
7
+ const knex_1 = __importDefault(require("knex"));
8
+ const core_queue_1 = require("@nautorun/core-queue");
9
+ function parseArgs(args) {
10
+ const first = args[0];
11
+ const second = args[1];
12
+ if (first && !Number.isNaN(Number(first))) {
13
+ return {
14
+ limit: Number(first),
15
+ workflowName: second
16
+ };
17
+ }
18
+ return {
19
+ limit: 50,
20
+ workflowName: first
21
+ };
22
+ }
23
+ async function runReplay(args) {
24
+ const databaseUrl = process.env.DATABASE_URL;
25
+ const redisUrl = process.env.REDIS_URL ?? "redis://127.0.0.1:6379";
26
+ if (!databaseUrl) {
27
+ process.stderr.write("DATABASE_URL is required for queue:replay.\n");
28
+ process.exit(1);
29
+ }
30
+ const options = parseArgs(args);
31
+ const parsedRedis = new URL(redisUrl);
32
+ const queue = new core_queue_1.BullMQAdapter({
33
+ connection: {
34
+ host: parsedRedis.hostname,
35
+ port: Number(parsedRedis.port) || 6379,
36
+ password: parsedRedis.password || undefined
37
+ }
38
+ });
39
+ const db = (0, knex_1.default)({
40
+ client: "pg",
41
+ connection: databaseUrl
42
+ });
43
+ const rows = (await db("workflow_steps")
44
+ .select("workflow_steps.id", "workflow_steps.run_id", "workflow_steps.step_name")
45
+ .modify((query) => {
46
+ if (options.workflowName) {
47
+ query
48
+ .join("workflow_runs", "workflow_runs.id", "workflow_steps.run_id")
49
+ .where("workflow_runs.workflow_name", options.workflowName);
50
+ }
51
+ })
52
+ .where("workflow_steps.status", "failed")
53
+ .orderBy("workflow_steps.updated_at", "asc")
54
+ .limit(options.limit));
55
+ if (rows.length === 0) {
56
+ process.stdout.write("No failed steps to replay.\n");
57
+ return;
58
+ }
59
+ await db.transaction(async (trx) => {
60
+ const stepIds = rows.map((row) => row.id);
61
+ await trx("workflow_steps")
62
+ .whereIn("id", stepIds)
63
+ .update({
64
+ status: "queued",
65
+ error: null,
66
+ locked_at: null,
67
+ locked_by: null,
68
+ updated_at: trx.fn.now()
69
+ });
70
+ const runIds = Array.from(new Set(rows.map((row) => row.run_id)));
71
+ await trx("workflow_runs")
72
+ .whereIn("id", runIds)
73
+ .update({
74
+ status: "queued",
75
+ updated_at: trx.fn.now()
76
+ });
77
+ });
78
+ for (const row of rows) {
79
+ const jobId = `${row.run_id}:${row.step_name}`;
80
+ await queue.enqueue({
81
+ jobId,
82
+ runId: row.run_id,
83
+ stepName: row.step_name
84
+ });
85
+ }
86
+ process.stdout.write(`Requeued ${rows.length} failed step(s).\n`);
87
+ }
88
+ //# sourceMappingURL=queue-replay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-replay.js","sourceRoot":"","sources":["../../src/commands/queue-replay.ts"],"names":[],"mappings":";;;;;AAwBA,8BAoFC;AA5GD,gDAAwB;AACxB,qDAAqD;AAOrD,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC1C,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;YACpB,YAAY,EAAE,MAAM;SACrB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,EAAE;QACT,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,IAAc;IAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,GA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IACL,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,MAAM,oBAAoB,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function runWorker(): Promise<void>;
2
+ //# sourceMappingURL=queue-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-worker.d.ts","sourceRoot":"","sources":["../../src/commands/queue-worker.ts"],"names":[],"mappings":"AAMA,wBAAsB,SAAS,kBAuC9B"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runWorker = runWorker;
7
+ const knex_1 = __importDefault(require("knex"));
8
+ const core_engine_1 = require("@nautorun/core-engine");
9
+ const core_queue_1 = require("@nautorun/core-queue");
10
+ const core_storage_1 = require("@nautorun/core-storage");
11
+ const framework_1 = require("@nautorun/framework");
12
+ async function runWorker() {
13
+ const databaseUrl = process.env.DATABASE_URL;
14
+ const redisUrl = process.env.REDIS_URL ?? "redis://127.0.0.1:6379";
15
+ if (!databaseUrl) {
16
+ process.stderr.write("DATABASE_URL is required for queue:worker.\n");
17
+ process.exit(1);
18
+ }
19
+ const parsedRedis = new URL(redisUrl);
20
+ const queue = new core_queue_1.BullMQAdapter({
21
+ connection: {
22
+ host: parsedRedis.hostname,
23
+ port: Number(parsedRedis.port) || 6379,
24
+ password: parsedRedis.password || undefined
25
+ }
26
+ });
27
+ const db = (0, knex_1.default)({
28
+ client: "pg",
29
+ connection: databaseUrl
30
+ });
31
+ const stateStore = new core_storage_1.PostgresStateStore(db);
32
+ const registry = new framework_1.WorkflowRegistry();
33
+ const workflow = registry.resolve("default");
34
+ if (!workflow) {
35
+ process.stderr.write("Default workflow not found.\n");
36
+ process.exit(1);
37
+ }
38
+ const worker = new core_engine_1.Worker(workflow, stateStore, queue);
39
+ for (;;) {
40
+ const worked = await worker.runOnce();
41
+ if (!worked) {
42
+ await new Promise((resolve) => setTimeout(resolve, 200));
43
+ }
44
+ }
45
+ }
46
+ //# sourceMappingURL=queue-worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-worker.js","sourceRoot":"","sources":["../../src/commands/queue-worker.ts"],"names":[],"mappings":";;;;;AAMA,8BAuCC;AA7CD,gDAAwB;AACxB,uDAA+C;AAC/C,qDAAqD;AACrD,yDAA4D;AAC5D,mDAAuD;AAEhD,KAAK,UAAU,SAAS;IAC7B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,wBAAwB,CAAC;IACnE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,0BAAa,CAAC;QAC9B,UAAU,EAAE;YACV,IAAI,EAAE,WAAW,CAAC,QAAQ;YAC1B,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI;YACtC,QAAQ,EAAE,WAAW,CAAC,QAAQ,IAAI,SAAS;SAC5C;KACF,CAAC,CAAC;IAEH,MAAM,EAAE,GAAG,IAAA,cAAI,EAAC;QACd,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,WAAW;KACxB,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,IAAI,iCAAkB,CAAC,EAAE,CAAC,CAAC;IAE9C,MAAM,QAAQ,GAAG,IAAI,4BAAgB,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAEvD,SAAS,CAAC;QACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function installSail(args: string[]): Promise<void>;
2
+ //# sourceMappingURL=sail-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sail-install.d.ts","sourceRoot":"","sources":["../../src/commands/sail-install.ts"],"names":[],"mappings":"AAmPA,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,iBA4B/C"}
@@ -0,0 +1,293 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installSail = installSail;
4
+ const promises_1 = require("node:fs/promises");
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const dockerignore = `.git
8
+ .github
9
+ .pnpm-store
10
+ .cache
11
+ .corepack
12
+ .bin
13
+ node_modules
14
+ dist
15
+ coverage
16
+ .env
17
+ .env.*
18
+ *.log
19
+ **/*.tsbuildinfo
20
+ `;
21
+ const dockerfile = `FROM node:20-bookworm-slim
22
+
23
+ ENV PNPM_HOME=/pnpm
24
+ ENV PATH=$PNPM_HOME:$PATH
25
+
26
+ RUN corepack enable
27
+
28
+ WORKDIR /app
29
+
30
+ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
31
+ COPY tsconfig.base.json tsconfig.tsbuildinfo ./
32
+ COPY apps ./apps
33
+ COPY packages ./packages
34
+ COPY db ./db
35
+ COPY docs ./docs
36
+ COPY *.md ./
37
+
38
+ RUN pnpm install --frozen-lockfile
39
+ `;
40
+ const compose = `version: "3.9"
41
+
42
+ services:
43
+ postgres:
44
+ image: postgres:16-alpine
45
+ container_name: nautorun-postgres
46
+ environment:
47
+ POSTGRES_USER: \${POSTGRES_USER:-nautorun}
48
+ POSTGRES_PASSWORD: \${POSTGRES_PASSWORD:-nautorun}
49
+ POSTGRES_DB: \${POSTGRES_DB:-nautorun}
50
+ ports:
51
+ - "\${POSTGRES_PORT:-5432}:5432"
52
+ volumes:
53
+ - nautorun-postgres:/var/lib/postgresql/data
54
+ healthcheck:
55
+ test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
56
+ interval: 5s
57
+ timeout: 3s
58
+ retries: 10
59
+
60
+ redis:
61
+ image: redis:7-alpine
62
+ container_name: nautorun-redis
63
+ ports:
64
+ - "\${REDIS_PORT:-6379}:6379"
65
+ volumes:
66
+ - nautorun-redis:/data
67
+ healthcheck:
68
+ test: ["CMD", "redis-cli", "ping"]
69
+ interval: 5s
70
+ timeout: 3s
71
+ retries: 10
72
+
73
+ api:
74
+ build:
75
+ context: .
76
+ dockerfile: Dockerfile.nauto
77
+ container_name: nautorun-api
78
+ command: pnpm --filter @nautorun/api dev
79
+ environment:
80
+ DATABASE_URL: \${DATABASE_URL:-postgres://nautorun:nautorun@postgres:5432/nautorun}
81
+ REDIS_URL: \${REDIS_URL:-redis://redis:6379}
82
+ PORT: \${PORT:-3333}
83
+ ports:
84
+ - "\${PORT:-3333}:3333"
85
+ depends_on:
86
+ postgres:
87
+ condition: service_healthy
88
+ redis:
89
+ condition: service_healthy
90
+ volumes:
91
+ - .:/app
92
+ - nautorun-pnpm-store:/pnpm/store
93
+ - /app/node_modules
94
+
95
+ worker:
96
+ build:
97
+ context: .
98
+ dockerfile: Dockerfile.nauto
99
+ container_name: nautorun-worker
100
+ command: pnpm --filter @nautorun/worker dev
101
+ environment:
102
+ DATABASE_URL: \${DATABASE_URL:-postgres://nautorun:nautorun@postgres:5432/nautorun}
103
+ REDIS_URL: \${REDIS_URL:-redis://redis:6379}
104
+ OUTBOX_HANDLER_MODULES: \${OUTBOX_HANDLER_MODULES:-/app/apps/worker/src/outbox-handlers.ts}
105
+ depends_on:
106
+ postgres:
107
+ condition: service_healthy
108
+ redis:
109
+ condition: service_healthy
110
+ volumes:
111
+ - .:/app
112
+ - nautorun-pnpm-store:/pnpm/store
113
+ - /app/node_modules
114
+
115
+ tooling:
116
+ build:
117
+ context: .
118
+ dockerfile: Dockerfile.nauto
119
+ container_name: nautorun-tooling
120
+ command: ["sleep", "infinity"]
121
+ environment:
122
+ DATABASE_URL: \${DATABASE_URL:-postgres://nautorun:nautorun@postgres:5432/nautorun}
123
+ REDIS_URL: \${REDIS_URL:-redis://redis:6379}
124
+ depends_on:
125
+ postgres:
126
+ condition: service_healthy
127
+ redis:
128
+ condition: service_healthy
129
+ volumes:
130
+ - .:/app
131
+ - nautorun-pnpm-store:/pnpm/store
132
+ - /app/node_modules
133
+ tty: true
134
+ stdin_open: true
135
+
136
+ volumes:
137
+ nautorun-postgres:
138
+ nautorun-redis:
139
+ nautorun-pnpm-store:
140
+ `;
141
+ const envExample = `POSTGRES_USER=nautorun
142
+ POSTGRES_PASSWORD=nautorun
143
+ POSTGRES_DB=nautorun
144
+ POSTGRES_PORT=5432
145
+
146
+ REDIS_PORT=6379
147
+
148
+ DATABASE_URL=postgres://nautorun:nautorun@postgres:5432/nautorun
149
+ REDIS_URL=redis://redis:6379
150
+ PORT=3333
151
+
152
+ OUTBOX_HANDLER_MODULES=/app/apps/worker/src/outbox-handlers.ts
153
+ `;
154
+ const wrapper = `#!/usr/bin/env bash
155
+ set -euo pipefail
156
+
157
+ COMPOSE_FILE="\${NAUTO_COMPOSE_FILE:-docker-compose.yml}"
158
+ COMPOSE_BIN="\${NAUTO_COMPOSE_BIN:-docker compose}"
159
+
160
+ if [[ ! -f "$COMPOSE_FILE" ]]; then
161
+ echo "Compose file not found: $COMPOSE_FILE" >&2
162
+ exit 1
163
+ fi
164
+
165
+ usage() {
166
+ cat <<'EOF'
167
+ Usage: ./nauto <command> [args...]
168
+
169
+ Common commands:
170
+ up Start containers (detached)
171
+ down Stop containers
172
+ build Build images
173
+ ps Show container status
174
+ logs [svc] Tail logs
175
+ shell [svc] Shell into service (default: tooling)
176
+ exec <svc> <cmd> Execute a command in a service
177
+ pnpm <args...> Run pnpm in tooling container
178
+ nauto <args...> Run the nauto CLI in tooling container
179
+ migrate Run db:migrate via nauto CLI
180
+
181
+ Pass-through:
182
+ Any other command is forwarded to docker compose.
183
+ EOF
184
+ }
185
+
186
+ if [[ "\${1:-}" == "" ]]; then
187
+ usage
188
+ exit 1
189
+ fi
190
+
191
+ cmd="$1"
192
+ shift || true
193
+
194
+ case "$cmd" in
195
+ up)
196
+ $COMPOSE_BIN -f "$COMPOSE_FILE" up -d "$@"
197
+ ;;
198
+ down)
199
+ $COMPOSE_BIN -f "$COMPOSE_FILE" down "$@"
200
+ ;;
201
+ build)
202
+ $COMPOSE_BIN -f "$COMPOSE_FILE" build "$@"
203
+ ;;
204
+ ps|start|stop|restart)
205
+ $COMPOSE_BIN -f "$COMPOSE_FILE" "$cmd" "$@"
206
+ ;;
207
+ logs)
208
+ $COMPOSE_BIN -f "$COMPOSE_FILE" logs -f "$@"
209
+ ;;
210
+ shell)
211
+ service="\${1:-tooling}"
212
+ shift || true
213
+ $COMPOSE_BIN -f "$COMPOSE_FILE" exec "$service" "\${SHELL:-/bin/sh}" "$@"
214
+ ;;
215
+ exec)
216
+ if [[ "\${1:-}" == "" ]]; then
217
+ echo "Usage: ./nauto exec <service> <cmd> [args...]" >&2
218
+ exit 1
219
+ fi
220
+ $COMPOSE_BIN -f "$COMPOSE_FILE" exec "$@"
221
+ ;;
222
+ pnpm)
223
+ $COMPOSE_BIN -f "$COMPOSE_FILE" exec tooling pnpm "$@"
224
+ ;;
225
+ nauto)
226
+ $COMPOSE_BIN -f "$COMPOSE_FILE" exec tooling pnpm --filter nauto exec nauto "$@"
227
+ ;;
228
+ migrate)
229
+ $COMPOSE_BIN -f "$COMPOSE_FILE" exec tooling pnpm --filter nauto exec nauto db:migrate
230
+ ;;
231
+ *)
232
+ $COMPOSE_BIN -f "$COMPOSE_FILE" "$cmd" "$@"
233
+ ;;
234
+ esac
235
+ `;
236
+ async function installSail(args) {
237
+ const options = parseOptions(args);
238
+ const targetDir = options.targetDir;
239
+ await (0, promises_1.mkdir)(targetDir, { recursive: true });
240
+ const tasks = [
241
+ writeIfMissing((0, node_path_1.join)(targetDir, ".dockerignore"), dockerignore, options.force),
242
+ writeIfMissing((0, node_path_1.join)(targetDir, "Dockerfile.nauto"), dockerfile, options.force),
243
+ writeIfMissing((0, node_path_1.join)(targetDir, "docker-compose.yml"), compose, options.force),
244
+ writeIfMissing((0, node_path_1.join)(targetDir, ".env.example"), envExample, options.force),
245
+ writeIfMissing((0, node_path_1.join)(targetDir, "nauto"), wrapper, options.force)
246
+ ];
247
+ const results = await Promise.all(tasks);
248
+ for (const result of results) {
249
+ if (result.written) {
250
+ process.stdout.write(`Created ${result.path}\n`);
251
+ if ((0, node_path_1.basename)(result.path) === "nauto") {
252
+ await (0, promises_1.chmod)(result.path, 0o755);
253
+ }
254
+ }
255
+ else {
256
+ process.stdout.write(`Skipped ${result.path} (exists)\n`);
257
+ }
258
+ }
259
+ process.stdout.write("Done.\n");
260
+ }
261
+ function parseOptions(args) {
262
+ let force = false;
263
+ let targetDir = process.cwd();
264
+ for (const arg of args) {
265
+ if (arg === "--force") {
266
+ force = true;
267
+ continue;
268
+ }
269
+ if (arg.startsWith("--path=")) {
270
+ targetDir = arg.slice("--path=".length);
271
+ continue;
272
+ }
273
+ }
274
+ return { force, targetDir };
275
+ }
276
+ async function writeIfMissing(path, contents, force) {
277
+ const exists = await fileExists(path);
278
+ if (exists && !force) {
279
+ return { path, written: false };
280
+ }
281
+ await (0, promises_1.writeFile)(path, contents, "utf8");
282
+ return { path, written: true };
283
+ }
284
+ async function fileExists(path) {
285
+ try {
286
+ await (0, promises_1.access)(path, node_fs_1.constants.F_OK);
287
+ return true;
288
+ }
289
+ catch {
290
+ return false;
291
+ }
292
+ }
293
+ //# sourceMappingURL=sail-install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sail-install.js","sourceRoot":"","sources":["../../src/commands/sail-install.ts"],"names":[],"mappings":";;AAmPA,kCA4BC;AA/QD,+CAAmE;AACnE,qCAAmD;AACnD,yCAA2C;AAO3C,MAAM,YAAY,GAAG;;;;;;;;;;;;;CAapB,CAAC;AAEF,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;CAkBlB,CAAC;AAEF,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoGf,CAAC;AAEF,MAAM,UAAU,GAAG;;;;;;;;;;;;CAYlB,CAAC;AAEF,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFf,CAAC;AAEK,KAAK,UAAU,WAAW,CAAC,IAAc;IAC9C,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAEpC,MAAM,IAAA,gBAAK,EAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAG;QACZ,cAAc,CAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,eAAe,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC;QAC7E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,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,GAAG,IAAI,CAAC;YACb,SAAS;QACX,CAAC;QACD,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACxC,SAAS;QACX,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,IAAY,EAAE,QAAgB,EAAE,KAAc;IAC1E,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC;IACD,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,IAAA,iBAAM,EAAC,IAAI,EAAE,mBAAW,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const main_1 = require("./main");
5
+ (0, main_1.run)(process.argv.slice(2));
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,iCAA6B;AAE7B,IAAA,UAAG,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function run(args: string[]): void;
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAQA,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAiDjC"}
package/dist/main.js ADDED
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = run;
4
+ const help_1 = require("./commands/help");
5
+ const db_migrate_1 = require("./commands/db-migrate");
6
+ const queue_worker_1 = require("./commands/queue-worker");
7
+ const queue_replay_1 = require("./commands/queue-replay");
8
+ const make_workflow_1 = require("./commands/make-workflow");
9
+ const make_step_1 = require("./commands/make-step");
10
+ const sail_install_1 = require("./commands/sail-install");
11
+ function run(args) {
12
+ const command = args[0] ?? "help";
13
+ switch (command) {
14
+ case "help":
15
+ exitWithHelp(0);
16
+ break;
17
+ case "db:migrate":
18
+ (0, db_migrate_1.runMigrations)().catch((error) => {
19
+ process.stderr.write(`Migration failed: ${error instanceof Error ? error.message : error}\n`);
20
+ process.exit(1);
21
+ });
22
+ break;
23
+ case "queue:worker":
24
+ (0, queue_worker_1.runWorker)().catch((error) => {
25
+ process.stderr.write(`Worker failed: ${error instanceof Error ? error.message : error}\n`);
26
+ process.exit(1);
27
+ });
28
+ break;
29
+ case "queue:replay":
30
+ (0, queue_replay_1.runReplay)(args.slice(1)).catch((error) => {
31
+ process.stderr.write(`Replay failed: ${error instanceof Error ? error.message : error}\n`);
32
+ process.exit(1);
33
+ });
34
+ break;
35
+ case "make:workflow":
36
+ (0, make_workflow_1.makeWorkflow)(args[1]);
37
+ break;
38
+ case "make:step":
39
+ (0, make_step_1.makeStep)(args[1]);
40
+ break;
41
+ case "sail:install":
42
+ (0, sail_install_1.installSail)(args.slice(1)).catch((error) => {
43
+ process.stderr.write(`Sail install failed: ${error instanceof Error ? error.message : error}\n`);
44
+ process.exit(1);
45
+ });
46
+ break;
47
+ default:
48
+ process.stderr.write(`Unknown command: ${command}\n`);
49
+ exitWithHelp(1);
50
+ }
51
+ }
52
+ function exitWithHelp(code = 0) {
53
+ process.stdout.write(help_1.helpText);
54
+ process.exit(code);
55
+ }
56
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAQA,kBAiDC;AAzDD,0CAA2C;AAC3C,sDAAsD;AACtD,0DAAoD;AACpD,0DAAoD;AACpD,4DAAwD;AACxD,oDAAgD;AAChD,0DAAsD;AAEtD,SAAgB,GAAG,CAAC,IAAc;IAChC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;IAElC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,MAAM;YACT,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,MAAM;QACR,KAAK,YAAY;YACf,IAAA,0BAAa,GAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CACxE,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,MAAM;QACR,KAAK,cAAc;YACjB,IAAA,wBAAS,GAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC1B,OAAO,CAAC,MAA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ACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAI,GAAG,CAAC;IAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function toKebab(value: string): string;
2
+ export declare function toPascal(value: string): string;
3
+ //# sourceMappingURL=strings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,UAKpC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,UAOrC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toKebab = toKebab;
4
+ exports.toPascal = toPascal;
5
+ function toKebab(value) {
6
+ return value
7
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
8
+ .replace(/[_\\s]+/g, "-")
9
+ .toLowerCase();
10
+ }
11
+ function toPascal(value) {
12
+ return value
13
+ .replace(/[_\\-]+/g, " ")
14
+ .split(" ")
15
+ .filter(Boolean)
16
+ .map((part) => part[0].toUpperCase() + part.slice(1))
17
+ .join("");
18
+ }
19
+ //# sourceMappingURL=strings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":";;AAAA,0BAKC;AAED,4BAOC;AAdD,SAAgB,OAAO,CAAC,KAAa;IACnC,OAAO,KAAK;SACT,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,WAAW,EAAE,CAAC;AACnB,CAAC;AAED,SAAgB,QAAQ,CAAC,KAAa;IACpC,OAAO,KAAK;SACT,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function updateIndexExport(dir: string, symbol: string, fromPath: string): void;
2
+ //# sourceMappingURL=write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/utils/write.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAa9E"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.updateIndexExport = updateIndexExport;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ function updateIndexExport(dir, symbol, fromPath) {
10
+ const indexPath = node_path_1.default.join(dir, "index.ts");
11
+ const exportLine = `export { ${symbol} } from "${fromPath}";\n`;
12
+ if (!node_fs_1.default.existsSync(indexPath)) {
13
+ node_fs_1.default.writeFileSync(indexPath, exportLine, "utf8");
14
+ return;
15
+ }
16
+ const current = node_fs_1.default.readFileSync(indexPath, "utf8");
17
+ if (!current.includes(exportLine.trim())) {
18
+ node_fs_1.default.appendFileSync(indexPath, exportLine, "utf8");
19
+ }
20
+ }
21
+ //# sourceMappingURL=write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/utils/write.ts"],"names":[],"mappings":";;;;;AAGA,8CAaC;AAhBD,sDAAyB;AACzB,0DAA6B;AAE7B,SAAgB,iBAAiB,CAAC,GAAW,EAAE,MAAc,EAAE,QAAgB;IAC7E,MAAM,SAAS,GAAG,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,YAAY,MAAM,YAAY,QAAQ,MAAM,CAAC;IAEhE,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,iBAAE,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,iBAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACnD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACzC,iBAAE,CAAC,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@nautorun/nauto",
3
+ "version": "0.1.0",
4
+ "description": "Nautorun CLI for scaffolding, migrations, and Sail-like Docker setup.",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "nauto": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "prepack": "pnpm build",
18
+ "build": "tsc -b",
19
+ "typecheck": "tsc -b --noEmit"
20
+ },
21
+ "keywords": [
22
+ "nautorun",
23
+ "workflow",
24
+ "automation",
25
+ "cli",
26
+ "docker",
27
+ "compose"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "dependencies": {
33
+ "@nautorun/core-engine": "0.1.0",
34
+ "@nautorun/core-queue": "0.1.0",
35
+ "@nautorun/core-storage": "0.1.0",
36
+ "@nautorun/framework": "0.1.0",
37
+ "knex": "^3.1.0",
38
+ "pg": "^8.11.5"
39
+ }
40
+ }