@procedures/cue 0.0.0-stage → 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 (60) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +71 -2
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/index.d.ts +13 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +16 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/module.d.ts +16 -0
  10. package/dist/module.d.ts.map +1 -0
  11. package/dist/module.js +110 -0
  12. package/dist/module.js.map +1 -0
  13. package/dist/procedures/cue/add.d.ts +13 -0
  14. package/dist/procedures/cue/add.d.ts.map +1 -0
  15. package/dist/procedures/cue/add.js +63 -0
  16. package/dist/procedures/cue/add.js.map +1 -0
  17. package/dist/procedures/cue/generate.d.ts +14 -0
  18. package/dist/procedures/cue/generate.d.ts.map +1 -0
  19. package/dist/procedures/cue/generate.js +189 -0
  20. package/dist/procedures/cue/generate.js.map +1 -0
  21. package/dist/procedures/cue/index.d.ts +6 -0
  22. package/dist/procedures/cue/index.d.ts.map +1 -0
  23. package/dist/procedures/cue/index.js +6 -0
  24. package/dist/procedures/cue/index.js.map +1 -0
  25. package/dist/procedures/cue/init.d.ts +13 -0
  26. package/dist/procedures/cue/init.d.ts.map +1 -0
  27. package/dist/procedures/cue/init.js +79 -0
  28. package/dist/procedures/cue/init.js.map +1 -0
  29. package/dist/procedures/cue/remove.d.ts +13 -0
  30. package/dist/procedures/cue/remove.d.ts.map +1 -0
  31. package/dist/procedures/cue/remove.js +52 -0
  32. package/dist/procedures/cue/remove.js.map +1 -0
  33. package/dist/procedures/cue/validate.d.ts +13 -0
  34. package/dist/procedures/cue/validate.d.ts.map +1 -0
  35. package/dist/procedures/cue/validate.js +76 -0
  36. package/dist/procedures/cue/validate.js.map +1 -0
  37. package/dist/register.d.ts +9 -0
  38. package/dist/register.d.ts.map +1 -0
  39. package/dist/register.js +17 -0
  40. package/dist/register.js.map +1 -0
  41. package/dist/shared.d.ts +39 -0
  42. package/dist/shared.d.ts.map +1 -0
  43. package/dist/shared.js +148 -0
  44. package/dist/shared.js.map +1 -0
  45. package/dist/types.d.ts +80 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +81 -0
  48. package/dist/types.js.map +1 -0
  49. package/package.json +78 -3
  50. package/src/index.ts +18 -0
  51. package/src/module.ts +140 -0
  52. package/src/procedures/cue/add.ts +80 -0
  53. package/src/procedures/cue/generate.ts +245 -0
  54. package/src/procedures/cue/index.ts +5 -0
  55. package/src/procedures/cue/init.ts +98 -0
  56. package/src/procedures/cue/remove.ts +64 -0
  57. package/src/procedures/cue/validate.ts +96 -0
  58. package/src/register.ts +21 -0
  59. package/src/shared.ts +216 -0
  60. package/src/types.ts +181 -0
@@ -0,0 +1,76 @@
1
+ /**
2
+ * cue.validate procedure
3
+ *
4
+ * Validate dependencies.json against schema.
5
+ * Uses ctx.client.call() for file system operations (dogfooding).
6
+ */
7
+ import { resolve } from "node:path";
8
+ import { loadFeatures, loadDependencies, checkCue, runCue, packageRoot, fileExists, } from "../../shared.js";
9
+ /**
10
+ * Validate dependencies.json
11
+ */
12
+ export async function cueValidate(input, ctx) {
13
+ const projectPath = input.cwd ?? process.cwd();
14
+ const errors = [];
15
+ // Load dependencies
16
+ const deps = await loadDependencies(projectPath, ctx);
17
+ if (!deps) {
18
+ return {
19
+ success: false,
20
+ valid: false,
21
+ features: [],
22
+ errors: ["No dependencies.json found. Run cue.init first."],
23
+ };
24
+ }
25
+ // Load features manifest
26
+ const manifest = await loadFeatures(ctx);
27
+ if (!manifest) {
28
+ return {
29
+ success: false,
30
+ valid: false,
31
+ features: deps,
32
+ errors: ["Could not load features.json from @mark1russell7/cue package"],
33
+ };
34
+ }
35
+ // Validate each feature exists
36
+ for (const feature of deps) {
37
+ if (!manifest.features[feature]) {
38
+ errors.push(`Unknown feature: '${feature}'`);
39
+ }
40
+ }
41
+ if (errors.length > 0) {
42
+ return {
43
+ success: true,
44
+ valid: false,
45
+ features: deps,
46
+ errors,
47
+ message: `Validation failed with ${errors.length} error(s)`,
48
+ };
49
+ }
50
+ // If CUE is available, validate against schema
51
+ if (await checkCue(ctx.signal)) {
52
+ const schemaPath = resolve(packageRoot, "dependencies/schema.cue");
53
+ if (await fileExists(schemaPath, ctx)) {
54
+ const depsPath = resolve(projectPath, "dependencies.json");
55
+ const result = await runCue(["vet", "-d", "#Dependencies", schemaPath, depsPath], { signal: ctx.signal });
56
+ if (!result.success) {
57
+ errors.push(`CUE schema validation failed: ${result.stderr || result.stdout}`);
58
+ return {
59
+ success: true,
60
+ valid: false,
61
+ features: deps,
62
+ errors,
63
+ message: "CUE schema validation failed",
64
+ };
65
+ }
66
+ }
67
+ }
68
+ return {
69
+ success: true,
70
+ valid: true,
71
+ features: deps,
72
+ errors: [],
73
+ message: "Validation passed",
74
+ };
75
+ }
76
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/procedures/cue/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,WAAW,EACX,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAuB,EACvB,GAAqB;IAErB,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,oBAAoB;IACpB,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACtD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,OAAO,EAAE,KAA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GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YAE1G,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,iCAAiC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC/E,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,KAAK;oBACZ,QAAQ,EAAE,IAAI;oBACd,MAAM;oBACN,OAAO,EAAE,8BAA8B;iBACxC,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,mBAAmB;KAC7B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Importing this file registers the procedures of @procedures/cue in the global registry
3
+ * (DECISIONS-2026-10, "Every package root registers its procedures"). The procedures as data
4
+ * are in `module.ts`, which registers nothing: a host with its own registry uses that one.
5
+ */
6
+ import "@procedures/fs";
7
+ export * from "./module.js";
8
+ export declare function registerCueProcedures(): void;
9
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,gBAAgB,CAAC;AAKxB,cAAc,aAAa,CAAC;AAE5B,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Importing this file registers the procedures of @procedures/cue in the global registry
3
+ * (DECISIONS-2026-10, "Every package root registers its procedures"). The procedures as data
4
+ * are in `module.ts`, which registers nothing: a host with its own registry uses that one.
5
+ */
6
+ // The cue procedures read and write files through fs.*: register them wherever cue.* runs.
7
+ // (Over the MCP server, fs.* was not registered, so every cue tool failed: deep dive WRP-3.)
8
+ import "@procedures/fs";
9
+ import { registerProcedures } from "@procedures/client";
10
+ import { cueModule } from "./module.js";
11
+ export * from "./module.js";
12
+ export function registerCueProcedures() {
13
+ registerProcedures(cueModule.procedures);
14
+ }
15
+ // Auto-register when this module is loaded
16
+ registerCueProcedures();
17
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2FAA2F;AAC3F,6FAA6F;AAC7F,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,cAAc,aAAa,CAAC;AAE5B,MAAM,UAAU,qBAAqB;IACnC,kBAAkB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED,2CAA2C;AAC3C,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shared utilities for cue procedures
3
+ *
4
+ * Uses ctx.client.call() for file system operations (dogfooding).
5
+ *
6
+ * A file operation that fails is an error of the call. Only a missing file is a normal result.
7
+ * (Before, each helper turned every error into "missing": with no fs.* procedures in the host,
8
+ * cue.validate answered "No dependencies.json found", deep dive WRP-3.)
9
+ */
10
+ import type { ProcedureContext } from "@procedures/client";
11
+ import { type CommandResult } from "@procedures/shell/command";
12
+ import type { FeaturesManifest } from "./types.js";
13
+ export declare const packageRoot: string;
14
+ export declare const TSCONFIG_PRIORITY: readonly string[];
15
+ export declare function fileExists(path: string, ctx: ProcedureContext): Promise<boolean>;
16
+ /** The content of a file, or null when the file does not exist. Other failures throw. */
17
+ export declare function readFile(path: string, ctx: ProcedureContext): Promise<string | null>;
18
+ export declare function writeFile(path: string, content: string, ctx: ProcedureContext): Promise<boolean>;
19
+ export declare function mkdir(path: string, ctx: ProcedureContext): Promise<boolean>;
20
+ /** The JSON content of a file, or null when the file does not exist. Text that is not JSON throws. */
21
+ export declare function readJson<T>(path: string, ctx: ProcedureContext): Promise<T | null>;
22
+ export declare function writeJson<T>(path: string, data: T, ctx: ProcedureContext): Promise<boolean>;
23
+ export declare function loadFeatures(ctx: ProcedureContext): Promise<FeaturesManifest | null>;
24
+ export declare function loadDependencies(projectPath: string, ctx: ProcedureContext): Promise<string[] | null>;
25
+ export declare function saveDependencies(deps: string[], projectPath: string, ctx: ProcedureContext): Promise<boolean>;
26
+ export declare function resolveFeatures(requested: string[], manifest: FeaturesManifest): string[];
27
+ export declare function featureToFieldName(feature: string): string;
28
+ /**
29
+ * This function runs the cue program with an argument list and no shell, through `runCommand`
30
+ * of client-shell: async, and the signal of the call kills it (roadmap 2.2).
31
+ */
32
+ export declare function runCue(args: string[], options?: {
33
+ cwd?: string | undefined;
34
+ signal?: AbortSignal | undefined;
35
+ }): Promise<CommandResult>;
36
+ /** True when the cue program is installed. */
37
+ export declare function checkCue(signal?: AbortSignal): Promise<boolean>;
38
+ export declare function determineTsconfig(resolvedFeatures: string[]): string;
39
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,YAAY,CAAC;AAOrE,eAAO,MAAM,WAAW,EAAE,MAAqE,CAAC;AAGhG,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAyD,CAAC;AA8BzG,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAMtF;AAED,yFAAyF;AACzF,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,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,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAAO,GAC3E,OAAO,CAAC,aAAa,CAAC,CAExB;AAED,8CAA8C;AAC9C,wBAAsB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAErE;AAED,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,MAAM,CAQpE"}
package/dist/shared.js ADDED
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Shared utilities for cue procedures
3
+ *
4
+ * Uses ctx.client.call() for file system operations (dogfooding).
5
+ *
6
+ * A file operation that fails is an error of the call. Only a missing file is a normal result.
7
+ * (Before, each helper turned every error into "missing": with no fs.* procedures in the host,
8
+ * cue.validate answered "No dependencies.json found", deep dive WRP-3.)
9
+ */
10
+ import { createRequire } from "node:module";
11
+ import { dirname, resolve } from "node:path";
12
+ import { runCommand } from "@procedures/shell/command";
13
+ // Constants
14
+ // The root of the installed @mark1russell7/cue package (its CUE files and features.json).
15
+ // Resolve it like an import, so it works wherever the package manager put it
16
+ // (BUGS-2026-07 H32: a hard-coded node_modules path only worked for a dev install).
17
+ const require = createRequire(import.meta.url);
18
+ export const packageRoot = dirname(require.resolve("@mark1russell7/cue/features.json"));
19
+ // Tsconfig priority: later features override earlier (most specific wins)
20
+ export const TSCONFIG_PRIORITY = ["ts", "node", "node-cjs", "vite", "react"];
21
+ // =============================================================================
22
+ // File System Helpers (using ctx.client.call)
23
+ // =============================================================================
24
+ export async function fileExists(path, ctx) {
25
+ const result = await ctx.client.call(["fs", "exists"], { path });
26
+ return result.exists;
27
+ }
28
+ /** The content of a file, or null when the file does not exist. Other failures throw. */
29
+ export async function readFile(path, ctx) {
30
+ if (!(await fileExists(path, ctx)))
31
+ return null;
32
+ const result = await ctx.client.call(["fs", "read"], { path, encoding: "utf-8" });
33
+ return result.content;
34
+ }
35
+ export async function writeFile(path, content, ctx) {
36
+ try {
37
+ await ctx.client.call(["fs", "write"], { path, content });
38
+ return true;
39
+ }
40
+ catch {
41
+ return false;
42
+ }
43
+ }
44
+ export async function mkdir(path, ctx) {
45
+ try {
46
+ await ctx.client.call(["fs", "mkdir"], { path, recursive: true });
47
+ return true;
48
+ }
49
+ catch {
50
+ return false;
51
+ }
52
+ }
53
+ // =============================================================================
54
+ // JSON Helpers
55
+ // =============================================================================
56
+ /** The JSON content of a file, or null when the file does not exist. Text that is not JSON throws. */
57
+ export async function readJson(path, ctx) {
58
+ const content = await readFile(path, ctx);
59
+ if (content === null)
60
+ return null;
61
+ try {
62
+ return JSON.parse(content);
63
+ }
64
+ catch (error) {
65
+ throw new Error(`${path} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
66
+ }
67
+ }
68
+ export async function writeJson(path, data, ctx) {
69
+ const content = JSON.stringify(data, null, 2) + "\n";
70
+ return writeFile(path, content, ctx);
71
+ }
72
+ // =============================================================================
73
+ // Core Functions
74
+ // =============================================================================
75
+ export async function loadFeatures(ctx) {
76
+ const featuresPath = resolve(packageRoot, "features.json");
77
+ return readJson(featuresPath, ctx);
78
+ }
79
+ export async function loadDependencies(projectPath, ctx) {
80
+ const depsPath = resolve(projectPath, "dependencies.json");
81
+ const content = await readJson(depsPath, ctx);
82
+ if (!content)
83
+ return null;
84
+ if (Array.isArray(content)) {
85
+ return content;
86
+ }
87
+ if (content.dependencies && Array.isArray(content.dependencies)) {
88
+ return content.dependencies;
89
+ }
90
+ return null;
91
+ }
92
+ export async function saveDependencies(deps, projectPath, ctx) {
93
+ const depsJson = {
94
+ $schema: "./node_modules/@mark1russell7/cue/dependencies/schema.json",
95
+ dependencies: deps,
96
+ };
97
+ return writeJson(resolve(projectPath, "dependencies.json"), depsJson, ctx);
98
+ }
99
+ // Flood-fill resolve all transitive dependencies
100
+ export function resolveFeatures(requested, manifest) {
101
+ const resolved = new Set();
102
+ const queue = [...requested];
103
+ while (queue.length > 0) {
104
+ const feature = queue.shift();
105
+ if (resolved.has(feature))
106
+ continue;
107
+ const featureDef = manifest.features[feature];
108
+ if (!featureDef)
109
+ continue;
110
+ resolved.add(feature);
111
+ for (const dep of featureDef.dependencies) {
112
+ if (!resolved.has(dep)) {
113
+ queue.push(dep);
114
+ }
115
+ }
116
+ }
117
+ return Array.from(resolved);
118
+ }
119
+ // Map feature name to CUE file field name (handle vite-react -> viteReact)
120
+ export function featureToFieldName(feature) {
121
+ if (feature === "vite-react")
122
+ return "viteReact";
123
+ return feature;
124
+ }
125
+ // =============================================================================
126
+ // CUE Evaluation
127
+ // =============================================================================
128
+ /**
129
+ * This function runs the cue program with an argument list and no shell, through `runCommand`
130
+ * of client-shell: async, and the signal of the call kills it (roadmap 2.2).
131
+ */
132
+ export function runCue(args, options = {}) {
133
+ return runCommand("cue", { args, cwd: options.cwd, signal: options.signal, timeout: 120_000 });
134
+ }
135
+ /** True when the cue program is installed. */
136
+ export async function checkCue(signal) {
137
+ return (await runCue(["version"], { signal })).success;
138
+ }
139
+ export function determineTsconfig(resolvedFeatures) {
140
+ let selected = "ts";
141
+ for (const feature of TSCONFIG_PRIORITY) {
142
+ if (resolvedFeatures.includes(feature)) {
143
+ selected = feature;
144
+ }
145
+ }
146
+ return selected;
147
+ }
148
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAsB,MAAM,2BAA2B,CAAC;AAG3E,YAAY;AACZ,0FAA0F;AAC1F,6EAA6E;AAC7E,oFAAoF;AACpF,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,WAAW,GAA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GAAG,OAAO,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Types and schemas for cue procedures
3
+ */
4
+ import { z } from "zod";
5
+ export interface Feature {
6
+ dependencies: string[];
7
+ }
8
+ export interface FeaturesManifest {
9
+ features: Record<string, Feature>;
10
+ presets: Record<string, string[]>;
11
+ }
12
+ export interface DependenciesJson {
13
+ $schema?: string;
14
+ dependencies: string[];
15
+ }
16
+ export declare const CueInitInputSchema: z.ZodObject<{
17
+ preset: z.ZodDefault<z.ZodOptional<z.ZodString>>;
18
+ force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
19
+ cwd: z.ZodOptional<z.ZodString>;
20
+ }>;
21
+ export type CueInitInput = z.infer<typeof CueInitInputSchema>;
22
+ export interface CueInitOutput {
23
+ success: boolean;
24
+ preset: string;
25
+ created: string[];
26
+ message?: string | undefined;
27
+ error?: string | undefined;
28
+ }
29
+ export declare const CueAddInputSchema: z.ZodObject<{
30
+ feature: z.ZodString;
31
+ cwd: z.ZodOptional<z.ZodString>;
32
+ }>;
33
+ export type CueAddInput = z.infer<typeof CueAddInputSchema>;
34
+ export interface CueAddOutput {
35
+ success: boolean;
36
+ feature: string;
37
+ added: boolean;
38
+ message?: string | undefined;
39
+ error?: string | undefined;
40
+ }
41
+ export declare const CueRemoveInputSchema: z.ZodObject<{
42
+ feature: z.ZodString;
43
+ cwd: z.ZodOptional<z.ZodString>;
44
+ }>;
45
+ export type CueRemoveInput = z.infer<typeof CueRemoveInputSchema>;
46
+ export interface CueRemoveOutput {
47
+ success: boolean;
48
+ feature: string;
49
+ removed: boolean;
50
+ message?: string | undefined;
51
+ error?: string | undefined;
52
+ }
53
+ export declare const CueGenerateInputSchema: z.ZodObject<{
54
+ cwd: z.ZodOptional<z.ZodString>;
55
+ }>;
56
+ export type CueGenerateInput = z.infer<typeof CueGenerateInputSchema>;
57
+ export interface CueGenerateOutput {
58
+ success: boolean;
59
+ resolvedFeatures: string[];
60
+ generated: string[];
61
+ message?: string | undefined;
62
+ error?: string | undefined;
63
+ }
64
+ export declare const CueValidateInputSchema: z.ZodObject<{
65
+ cwd: z.ZodOptional<z.ZodString>;
66
+ }>;
67
+ export type CueValidateInput = z.infer<typeof CueValidateInputSchema>;
68
+ export interface CueValidateOutput {
69
+ success: boolean;
70
+ valid: boolean;
71
+ features: string[];
72
+ errors: string[];
73
+ message?: string | undefined;
74
+ }
75
+ export declare const CueInitOutputSchema: z.ZodType<CueInitOutput>;
76
+ export declare const CueAddOutputSchema: z.ZodType<CueAddOutput>;
77
+ export declare const CueRemoveOutputSchema: z.ZodType<CueRemoveOutput>;
78
+ export declare const CueGenerateOutputSchema: z.ZodType<CueGenerateOutput>;
79
+ export declare const CueValidateOutputSchema: z.ZodType<CueValidateOutput>;
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,MAAM,WAAW,OAAO;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAMD,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,UAAU,C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AE,CAAC,CAAC,OAAO,CAAC,YAAY,CAMrD,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAM3D,CAAC;AAEH,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAM/D,CAAC;AAEH,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAM/D,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Types and schemas for cue procedures
3
+ */
4
+ import { z } from "zod";
5
+ // =============================================================================
6
+ // cue.init
7
+ // =============================================================================
8
+ export const CueInitInputSchema = z.object({
9
+ preset: z.string().optional().default("lib").describe("The preset: lib, react-lib or app"),
10
+ force: z.boolean().optional().default(false).describe("Write dependencies.json again when it exists"),
11
+ cwd: z.string().optional().describe("The folder of the package (default: the current folder)"),
12
+ });
13
+ // =============================================================================
14
+ // cue.add
15
+ // =============================================================================
16
+ export const CueAddInputSchema = z.object({
17
+ feature: z.string().describe("The feature: git, npm, ts, node, node-cjs, react, vite, vite-react, cue or vitest"),
18
+ cwd: z.string().optional().describe("The folder of the package (default: the current folder)"),
19
+ });
20
+ // =============================================================================
21
+ // cue.remove
22
+ // =============================================================================
23
+ export const CueRemoveInputSchema = z.object({
24
+ feature: z.string().describe("The feature: git, npm, ts, node, node-cjs, react, vite, vite-react, cue or vitest"),
25
+ cwd: z.string().optional().describe("The folder of the package (default: the current folder)"),
26
+ });
27
+ // =============================================================================
28
+ // cue.generate
29
+ // =============================================================================
30
+ export const CueGenerateInputSchema = z.object({
31
+ cwd: z.string().optional().describe("The folder of the package (default: the current folder)"),
32
+ });
33
+ // =============================================================================
34
+ // cue.validate
35
+ // =============================================================================
36
+ export const CueValidateInputSchema = z.object({
37
+ cwd: z.string().optional().describe("The folder of the package (default: the current folder)"),
38
+ });
39
+ // =============================================================================
40
+ // Output schemas (roadmap 2.1)
41
+ // =============================================================================
42
+ // Loose objects: a field that a schema does not name stays in the result (a strict schema
43
+ // would remove it when the output is validated).
44
+ const messageField = z.string().optional().describe("A message about the result");
45
+ const errorField = z.string().optional().describe("The reason of a failure (when success is false)");
46
+ export const CueInitOutputSchema = z.looseObject({
47
+ success: z.boolean().describe("True when dependencies.json exists after the call"),
48
+ preset: z.string().describe("The preset of the new dependencies.json"),
49
+ created: z.array(z.string()).describe("The files that the call made"),
50
+ message: messageField,
51
+ error: errorField,
52
+ });
53
+ export const CueAddOutputSchema = z.looseObject({
54
+ success: z.boolean().describe("True when the feature is in dependencies.json after the call"),
55
+ feature: z.string().describe("The feature"),
56
+ added: z.boolean().describe("True when the call added the feature (false when it was there already)"),
57
+ message: messageField,
58
+ error: errorField,
59
+ });
60
+ export const CueRemoveOutputSchema = z.looseObject({
61
+ success: z.boolean().describe("True when the feature is not in dependencies.json after the call"),
62
+ feature: z.string().describe("The feature"),
63
+ removed: z.boolean().describe("True when the call removed the feature"),
64
+ message: messageField,
65
+ error: errorField,
66
+ });
67
+ export const CueGenerateOutputSchema = z.looseObject({
68
+ success: z.boolean().describe("True when every file was generated"),
69
+ resolvedFeatures: z.array(z.string()).describe("The features with their dependencies"),
70
+ generated: z.array(z.string()).describe("The files that the call wrote"),
71
+ message: messageField,
72
+ error: errorField,
73
+ });
74
+ export const CueValidateOutputSchema = z.looseObject({
75
+ success: z.boolean().describe("True when the validation ran"),
76
+ valid: z.boolean().describe("True when dependencies.json is valid"),
77
+ features: z.array(z.string()).describe("The features of dependencies.json"),
78
+ errors: z.array(z.string()).describe("The problems that the validation found"),
79
+ message: messageField,
80
+ });
81
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,MAAM,CAAC,MAAM,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YAAY;CACtB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,81 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package",
2
3
  "name": "@procedures/cue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
4
+ "version": "0.1.0",
5
+ "description": "cue-config as procedures: generate package.json, tsconfig.json and .gitignore from CUE feature presets, add and remove features, and validate projects.",
6
+ "keywords": [
7
+ "cue",
8
+ "cuelang",
9
+ "configuration",
10
+ "package-json",
11
+ "tsconfig",
12
+ "codegen",
13
+ "procedures"
14
+ ],
15
+ "homepage": "https://mark1russell7.github.io/client/",
16
+ "bugs": {
17
+ "url": "https://github.com/mark1russell7/client/issues"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/mark1russell7/client.git",
22
+ "directory": "packages/client-cue"
23
+ },
24
+ "license": "MIT",
25
+ "author": "Mark Russell (https://github.com/mark1russell7)",
26
+ "type": "module",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ },
34
+ "./module": {
35
+ "types": "./dist/module.d.ts",
36
+ "import": "./dist/module.js"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "src",
42
+ "!src/**/*.test.ts",
43
+ "!src/**/*.test.tsx",
44
+ "!src/**/__tests__",
45
+ "CHANGELOG.md"
46
+ ],
47
+ "sideEffects": [
48
+ "./dist/index.js",
49
+ "./dist/register.js"
50
+ ],
51
+ "engines": {
52
+ "node": ">=22"
53
+ },
54
+ "publishConfig": {
55
+ "access": "public",
56
+ "provenance": true
57
+ },
58
+ "client": {
59
+ "procedures": "./dist/register.js"
60
+ },
61
+ "dependencies": {
62
+ "@procedures/client": "0.1.0",
63
+ "@procedures/fs": "0.1.0",
64
+ "@procedures/shell": "0.1.0",
65
+ "@mark1russell7/cue": "^1.0.0",
66
+ "zod": "^4.6.5"
67
+ },
68
+ "devDependencies": {
69
+ "typescript": "^7.0.2",
70
+ "@types/node": "^22.0.0",
71
+ "@mark1russell7/cue": "^1.0.0",
72
+ "vitest": "^5.0.3"
73
+ },
74
+ "scripts": {
75
+ "build": "tsc -b",
76
+ "typecheck": "tsc --noEmit",
77
+ "clean": "rm -rf dist .tsbuildinfo",
78
+ "test": "vitest run",
79
+ "test:watch": "vitest"
80
+ }
6
81
  }
package/src/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @procedures/cue
3
+ *
4
+ * CUE configuration procedures for the client ecosystem.
5
+ */
6
+
7
+ // Re-export types
8
+ export * from "./types.js";
9
+
10
+ // Re-export procedures
11
+ export { cueInit } from "./procedures/cue/init.js";
12
+ export { cueAdd } from "./procedures/cue/add.js";
13
+ export { cueRemove } from "./procedures/cue/remove.js";
14
+ export { cueGenerate } from "./procedures/cue/generate.js";
15
+ export { cueValidate } from "./procedures/cue/validate.js";
16
+
17
+ // Registration
18
+ export { registerCueProcedures } from "./register.js";