@yattalo/task-system 0.1.2 → 0.3.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.
@@ -1,20 +1,8 @@
1
1
  // ============================================================
2
2
  // Schema merge logic
3
3
  // ============================================================
4
- import { existsSync, readFileSync } from "node:fs";
4
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import { join } from "node:path";
6
- /**
7
- * Generates the import snippet that the user must add to their
8
- * main convex/schema.ts to include the task system tables.
9
- */
10
- export function getSchemaImportSnippet(subDir) {
11
- return `\
12
- // --- Task System (generated by @yattalo/task-system) ---
13
- import { taskSystemTables } from "./${subDir}/schema";
14
-
15
- // Add to your defineSchema call:
16
- // export default defineSchema({ ...taskSystemTables, /* your tables */ });`;
17
- }
18
6
  /**
19
7
  * Check if the main schema.ts already imports taskSystemTables.
20
8
  */
@@ -26,18 +14,34 @@ export function isSchemaAlreadyMerged(convexDir) {
26
14
  return content.includes("taskSystemTables");
27
15
  }
28
16
  /**
29
- * Returns instructions for the user to manually merge the schema.
17
+ * Generate a root convex/schema.ts that imports taskSystemTables.
18
+ * If convex/schema.ts already exists (with other content), prints
19
+ * a warning instead of overwriting.
30
20
  */
31
- export function getSchemaMergeInstructions(subDir) {
32
- return `
33
- To integrate the task system with your Convex schema, add this to your convex/schema.ts:
34
-
35
- import { taskSystemTables } from "./${subDir}/schema";
36
-
37
- export default defineSchema({
38
- ...taskSystemTables,
39
- // ... your existing tables
40
- });
41
- `.trim();
21
+ export function generateRootSchema(convexDir, subDir, dryRun) {
22
+ const schemaPath = join(convexDir, "schema.ts");
23
+ // If schema.ts exists but doesn't have taskSystemTables, don't overwrite
24
+ if (existsSync(schemaPath)) {
25
+ return null;
26
+ }
27
+ const lines = [
28
+ `// ============================================================`,
29
+ `// Convex Schema auto-generated by @yattalo/task-system`,
30
+ `// ============================================================`,
31
+ ``,
32
+ `import { defineSchema } from "convex/server";`,
33
+ `import { taskSystemTables } from "./${subDir}/schema";`,
34
+ ``,
35
+ `export default defineSchema({`,
36
+ ` ...taskSystemTables,`,
37
+ ` // Add your own tables here:`,
38
+ ` // myTable: defineTable({ ... }),`,
39
+ `});`,
40
+ ``,
41
+ ];
42
+ if (!dryRun) {
43
+ writeFileSync(schemaPath, lines.join("\n"), "utf-8");
44
+ }
45
+ return { file: "convex/schema.ts", lines: lines.length };
42
46
  }
43
47
  //# sourceMappingURL=merge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,qBAAqB;AACrB,+DAA+D;AAE/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAiB,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,OAAO;;sCAE6B,MAAM;;;4EAGgC,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACvD,OAAO;;;wCAG+B,MAAM;;;;;;CAM7C,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,qBAAqB;AACrB,+DAA+D;AAE/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,MAAc,EACd,MAAe;IAEf,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAEhD,yEAAyE;IACzE,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,iEAAiE;QACjE,2DAA2D;QAC3D,iEAAiE;QACjE,EAAE;QACF,+CAA+C;QAC/C,uCAAuC,MAAM,WAAW;QACxD,EAAE;QACF,+BAA+B;QAC/B,wBAAwB;QACxB,gCAAgC;QAChC,qCAAqC;QACrC,KAAK;QACL,EAAE;KACH,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yattalo/task-system",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Portable multi-agent task orchestration scaffold for Convex projects",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,16 +8,13 @@
8
8
  "bin": {
9
9
  "task-system": "./dist/index.js"
10
10
  },
11
- "publishConfig": {
12
- "registry": "https://registry.npmjs.org/"
13
- },
14
11
  "scripts": {
15
12
  "build": "tsc",
16
13
  "dev": "tsc --watch",
17
14
  "clean": "rm -rf dist"
18
15
  },
19
16
  "dependencies": {
20
- "@yattalo/task-system-core": "^0.1.0",
17
+ "@yattalo/task-system-core": "^0.3.0",
21
18
  "commander": "^12.1.0",
22
19
  "ts-morph": "^24.0.0",
23
20
  "prompts": "^2.4.2",
@@ -31,21 +28,12 @@
31
28
  "@types/serve-handler": "^6.1.4",
32
29
  "typescript": "^5.7.0"
33
30
  },
34
- "files": [
35
- "dist"
36
- ],
31
+ "files": ["dist"],
37
32
  "license": "MIT",
38
33
  "repository": {
39
34
  "type": "git",
40
- "url": "git+https://github.com/yattalo/task-system.git",
35
+ "url": "https://github.com/yattalo/task-system.git",
41
36
  "directory": "packages/cli"
42
37
  },
43
- "keywords": [
44
- "convex",
45
- "task-system",
46
- "multi-agent",
47
- "orchestration",
48
- "scaffold",
49
- "cli"
50
- ]
38
+ "keywords": ["convex", "task-system", "multi-agent", "orchestration", "scaffold", "cli"]
51
39
  }