@confect/cli 9.0.0-next.8 → 9.0.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 (44) hide show
  1. package/CHANGELOG.md +187 -1
  2. package/dist/Bundler.mjs +1 -4
  3. package/dist/Bundler.mjs.map +1 -1
  4. package/dist/CodegenError.mjs +3 -13
  5. package/dist/CodegenError.mjs.map +1 -1
  6. package/dist/LeafModule.mjs +9 -22
  7. package/dist/LeafModule.mjs.map +1 -1
  8. package/dist/SpecAssemblyNode.mjs +1 -8
  9. package/dist/SpecAssemblyNode.mjs.map +1 -1
  10. package/dist/confect/codegen.mjs +26 -69
  11. package/dist/confect/codegen.mjs.map +1 -1
  12. package/dist/confect/dev.mjs +0 -3
  13. package/dist/confect/dev.mjs.map +1 -1
  14. package/dist/log.mjs +2 -2
  15. package/dist/log.mjs.map +1 -1
  16. package/dist/package.mjs +1 -1
  17. package/dist/templates.mjs +5 -14
  18. package/dist/templates.mjs.map +1 -1
  19. package/dist/utils.mjs +32 -22
  20. package/dist/utils.mjs.map +1 -1
  21. package/package.json +4 -21
  22. package/dist/index.d.mts +0 -1
  23. package/src/BuildError.ts +0 -217
  24. package/src/Bundler.ts +0 -145
  25. package/src/CodeBlockWriter.ts +0 -65
  26. package/src/CodegenError.ts +0 -443
  27. package/src/ConfectDirectory.ts +0 -45
  28. package/src/ConvexDirectory.ts +0 -72
  29. package/src/FunctionPath.ts +0 -27
  30. package/src/FunctionPaths.ts +0 -107
  31. package/src/GroupPath.ts +0 -116
  32. package/src/GroupPaths.ts +0 -7
  33. package/src/LeafModule.ts +0 -323
  34. package/src/ProjectRoot.ts +0 -55
  35. package/src/SpecAssemblyNode.ts +0 -88
  36. package/src/TableModule.ts +0 -157
  37. package/src/cliApp.ts +0 -8
  38. package/src/confect/codegen.ts +0 -908
  39. package/src/confect/dev.ts +0 -790
  40. package/src/confect.ts +0 -19
  41. package/src/index.ts +0 -23
  42. package/src/log.ts +0 -110
  43. package/src/templates.ts +0 -633
  44. package/src/utils.ts +0 -428
package/src/confect.ts DELETED
@@ -1,19 +0,0 @@
1
- import * as Command from "@effect/cli/Command";
2
- import * as Layer from "effect/Layer";
3
- import { codegen } from "./confect/codegen";
4
- import { dev } from "./confect/dev";
5
- import { ConfectDirectory } from "./ConfectDirectory";
6
- import { ConvexDirectory } from "./ConvexDirectory";
7
- import { ProjectRoot } from "./ProjectRoot";
8
-
9
- export const confect = Command.make("confect").pipe(
10
- Command.withDescription("Generate and sync Confect files with Convex"),
11
- Command.withSubcommands([codegen, dev]),
12
- Command.provide(
13
- Layer.mergeAll(
14
- ConfectDirectory.Default,
15
- ProjectRoot.Default,
16
- ConvexDirectory.Default,
17
- ),
18
- ),
19
- );
package/src/index.ts DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import * as NodeContext from "@effect/platform-node/NodeContext";
4
- import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
5
- import * as Effect from "effect/Effect";
6
- import { cliApp } from "./cliApp";
7
-
8
- // Track if we received SIGINT so we can re-raise it after cleanup.
9
- // This ensures proper terminal state restoration when run via e.g. `pnpm`.
10
- let interrupted = false;
11
- process.prependListener("SIGINT", () => {
12
- interrupted = true;
13
- });
14
- process.on("exit", () => {
15
- if (interrupted) {
16
- process.kill(process.pid, "SIGINT");
17
- }
18
- });
19
-
20
- cliApp(process.argv).pipe(
21
- Effect.provide(NodeContext.layer),
22
- NodeRuntime.runMain,
23
- );
package/src/log.ts DELETED
@@ -1,110 +0,0 @@
1
- import * as Path from "@effect/platform/Path";
2
- import * as Ansi from "@effect/printer-ansi/Ansi";
3
- import * as AnsiDoc from "@effect/printer-ansi/AnsiDoc";
4
- import { pipe } from "effect/Function";
5
- import * as Console from "effect/Console";
6
- import * as Effect from "effect/Effect";
7
- import * as String from "effect/String";
8
- import type * as FunctionPath from "./FunctionPath";
9
- import * as GroupPath from "./GroupPath";
10
- import { ProjectRoot } from "./ProjectRoot";
11
-
12
- // --- Path styling ---
13
-
14
- /**
15
- * Render a relative path as an AnsiDoc with the directory portion
16
- * dimmed (`Ansi.blackBright`) and the file leaf rendered in the
17
- * default terminal color. Used inline anywhere a file path appears
18
- * in a CLI message.
19
- */
20
- export const formatPathDoc = (relativePath: string): AnsiDoc.AnsiDoc => {
21
- const lastSep = Math.max(
22
- relativePath.lastIndexOf("/"),
23
- relativePath.lastIndexOf("\\"),
24
- );
25
- const dir = lastSep < 0 ? "" : relativePath.slice(0, lastSep + 1);
26
- const leaf = lastSep < 0 ? relativePath : relativePath.slice(lastSep + 1);
27
- return AnsiDoc.hcat([
28
- pipe(AnsiDoc.text(dir), AnsiDoc.annotate(Ansi.blackBright)),
29
- AnsiDoc.text(leaf),
30
- ]);
31
- };
32
-
33
- // --- File operation logs ---
34
-
35
- const logFile = (char: string, color: Ansi.Ansi) => (fullPath: string) =>
36
- Effect.gen(function* () {
37
- const projectRoot = yield* ProjectRoot.get;
38
- const path = yield* Path.Path;
39
-
40
- const prefix = projectRoot + path.sep;
41
- const suffix = pipe(fullPath, String.startsWith(prefix))
42
- ? pipe(fullPath, String.slice(prefix.length))
43
- : fullPath;
44
-
45
- yield* Console.log(
46
- pipe(
47
- AnsiDoc.char(char),
48
- AnsiDoc.annotate(color),
49
- AnsiDoc.catWithSpace(
50
- AnsiDoc.hcat([
51
- pipe(AnsiDoc.text(prefix), AnsiDoc.annotate(Ansi.blackBright)),
52
- pipe(AnsiDoc.text(suffix), AnsiDoc.annotate(color)),
53
- ]),
54
- ),
55
- AnsiDoc.render({ style: "pretty" }),
56
- ),
57
- );
58
- });
59
-
60
- export const logFileAdded = logFile("+", Ansi.green);
61
-
62
- export const logFileRemoved = logFile("-", Ansi.red);
63
-
64
- export const logFileModified = logFile("~", Ansi.magenta);
65
-
66
- // --- Function subline logs ---
67
-
68
- const logFunction =
69
- (char: string, color: Ansi.Ansi) =>
70
- (functionPath: FunctionPath.FunctionPath) =>
71
- Console.log(
72
- pipe(
73
- AnsiDoc.text(" "),
74
- AnsiDoc.cat(pipe(AnsiDoc.char(char), AnsiDoc.annotate(color))),
75
- AnsiDoc.catWithSpace(
76
- AnsiDoc.hcat([
77
- pipe(
78
- AnsiDoc.text(GroupPath.toString(functionPath.groupPath) + "."),
79
- AnsiDoc.annotate(Ansi.blackBright),
80
- ),
81
- pipe(AnsiDoc.text(functionPath.name), AnsiDoc.annotate(color)),
82
- ]),
83
- ),
84
- AnsiDoc.render({ style: "pretty" }),
85
- ),
86
- );
87
-
88
- export const logFunctionAdded = logFunction("+", Ansi.green);
89
-
90
- export const logFunctionRemoved = logFunction("-", Ansi.red);
91
-
92
- // --- Process status logs ---
93
-
94
- const logStatus = (char: string, charColor: Ansi.Ansi) => (message: string) =>
95
- Console.log(
96
- pipe(
97
- AnsiDoc.char(char),
98
- AnsiDoc.annotate(charColor),
99
- AnsiDoc.catWithSpace(AnsiDoc.text(message)),
100
- AnsiDoc.render({ style: "pretty" }),
101
- ),
102
- );
103
-
104
- export const logSuccess = logStatus("✔︎", Ansi.green);
105
-
106
- export const logFailure = logStatus("✘", Ansi.red);
107
-
108
- export const logPending = logStatus("⭘", Ansi.cyan);
109
-
110
- export const logWarn = logStatus("⚠", Ansi.yellow);