@procedures/lib 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 (114) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +119 -2
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/cli-flags.d.ts +27 -0
  6. package/dist/cli-flags.d.ts.map +1 -0
  7. package/dist/cli-flags.js +33 -0
  8. package/dist/cli-flags.js.map +1 -0
  9. package/dist/dag/builder.d.ts +18 -0
  10. package/dist/dag/builder.d.ts.map +1 -0
  11. package/dist/dag/builder.js +35 -0
  12. package/dist/dag/builder.js.map +1 -0
  13. package/dist/dag/index.d.ts +12 -0
  14. package/dist/dag/index.d.ts.map +1 -0
  15. package/dist/dag/index.js +12 -0
  16. package/dist/dag/index.js.map +1 -0
  17. package/dist/git/index.d.ts +5 -0
  18. package/dist/git/index.d.ts.map +1 -0
  19. package/dist/git/index.js +5 -0
  20. package/dist/git/index.js.map +1 -0
  21. package/dist/git/ref-parser.d.ts +34 -0
  22. package/dist/git/ref-parser.d.ts.map +1 -0
  23. package/dist/git/ref-parser.js +70 -0
  24. package/dist/git/ref-parser.js.map +1 -0
  25. package/dist/index.d.ts +14 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +20 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/module.d.ts +16 -0
  30. package/dist/module.d.ts.map +1 -0
  31. package/dist/module.js +156 -0
  32. package/dist/module.js.map +1 -0
  33. package/dist/procedures/core/catch.d.ts +33 -0
  34. package/dist/procedures/core/catch.d.ts.map +1 -0
  35. package/dist/procedures/core/catch.js +118 -0
  36. package/dist/procedures/core/catch.js.map +1 -0
  37. package/dist/procedures/core/index.d.ts +9 -0
  38. package/dist/procedures/core/index.d.ts.map +1 -0
  39. package/dist/procedures/core/index.js +8 -0
  40. package/dist/procedures/core/index.js.map +1 -0
  41. package/dist/procedures/dag/index.d.ts +5 -0
  42. package/dist/procedures/dag/index.d.ts.map +1 -0
  43. package/dist/procedures/dag/index.js +5 -0
  44. package/dist/procedures/dag/index.js.map +1 -0
  45. package/dist/procedures/dag/traverse.d.ts +54 -0
  46. package/dist/procedures/dag/traverse.d.ts.map +1 -0
  47. package/dist/procedures/dag/traverse.js +252 -0
  48. package/dist/procedures/dag/traverse.js.map +1 -0
  49. package/dist/procedures/ecosystem/index.d.ts +7 -0
  50. package/dist/procedures/ecosystem/index.d.ts.map +1 -0
  51. package/dist/procedures/ecosystem/index.js +6 -0
  52. package/dist/procedures/ecosystem/index.js.map +1 -0
  53. package/dist/procedures/ecosystem/procedures.d.ts +63 -0
  54. package/dist/procedures/ecosystem/procedures.d.ts.map +1 -0
  55. package/dist/procedures/ecosystem/procedures.js +215 -0
  56. package/dist/procedures/ecosystem/procedures.js.map +1 -0
  57. package/dist/procedures/lib/audit.d.ts +29 -0
  58. package/dist/procedures/lib/audit.d.ts.map +1 -0
  59. package/dist/procedures/lib/audit.js +236 -0
  60. package/dist/procedures/lib/audit.js.map +1 -0
  61. package/dist/procedures/lib/index.d.ts +8 -0
  62. package/dist/procedures/lib/index.d.ts.map +1 -0
  63. package/dist/procedures/lib/index.js +8 -0
  64. package/dist/procedures/lib/index.js.map +1 -0
  65. package/dist/procedures/lib/new.d.ts +18 -0
  66. package/dist/procedures/lib/new.d.ts.map +1 -0
  67. package/dist/procedures/lib/new.js +170 -0
  68. package/dist/procedures/lib/new.js.map +1 -0
  69. package/dist/procedures/lib/rename.d.ts +28 -0
  70. package/dist/procedures/lib/rename.d.ts.map +1 -0
  71. package/dist/procedures/lib/rename.js +267 -0
  72. package/dist/procedures/lib/rename.js.map +1 -0
  73. package/dist/procedures/lib/scan.d.ts +14 -0
  74. package/dist/procedures/lib/scan.d.ts.map +1 -0
  75. package/dist/procedures/lib/scan.js +102 -0
  76. package/dist/procedures/lib/scan.js.map +1 -0
  77. package/dist/register.d.ts +10 -0
  78. package/dist/register.d.ts.map +1 -0
  79. package/dist/register.js +19 -0
  80. package/dist/register.js.map +1 -0
  81. package/dist/scoped-input.d.ts +17 -0
  82. package/dist/scoped-input.d.ts.map +1 -0
  83. package/dist/scoped-input.js +23 -0
  84. package/dist/scoped-input.js.map +1 -0
  85. package/dist/types.d.ts +248 -0
  86. package/dist/types.d.ts.map +1 -0
  87. package/dist/types.js +231 -0
  88. package/dist/types.js.map +1 -0
  89. package/dist/workspace.d.ts +46 -0
  90. package/dist/workspace.d.ts.map +1 -0
  91. package/dist/workspace.js +98 -0
  92. package/dist/workspace.js.map +1 -0
  93. package/package.json +84 -3
  94. package/src/cli-flags.ts +49 -0
  95. package/src/dag/builder.ts +44 -0
  96. package/src/dag/index.ts +23 -0
  97. package/src/git/index.ts +11 -0
  98. package/src/git/ref-parser.ts +83 -0
  99. package/src/index.ts +57 -0
  100. package/src/module.ts +207 -0
  101. package/src/procedures/core/catch.ts +142 -0
  102. package/src/procedures/core/index.ts +9 -0
  103. package/src/procedures/dag/index.ts +5 -0
  104. package/src/procedures/dag/traverse.ts +281 -0
  105. package/src/procedures/ecosystem/index.ts +12 -0
  106. package/src/procedures/ecosystem/procedures.ts +317 -0
  107. package/src/procedures/lib/audit.ts +307 -0
  108. package/src/procedures/lib/index.ts +8 -0
  109. package/src/procedures/lib/new.ts +216 -0
  110. package/src/procedures/lib/rename.ts +355 -0
  111. package/src/procedures/lib/scan.ts +143 -0
  112. package/src/register.ts +23 -0
  113. package/src/types.ts +526 -0
  114. package/src/workspace.ts +110 -0
@@ -0,0 +1,215 @@
1
+ /**
2
+ * ecosystem.procedures
3
+ *
4
+ * Enumerates all procedures across the ecosystem by:
5
+ * 1. Scanning all packages (lib.scan)
6
+ * 2. Loading each package's procedure registry
7
+ * 3. Aggregating using the collector pattern (pure)
8
+ *
9
+ * This is a composition of dag traversal + procedure discovery.
10
+ */
11
+ import { z } from "zod";
12
+ import { libScan } from "../lib/scan.js";
13
+ import { join } from "node:path";
14
+ import { pathToFileURL } from "node:url";
15
+ import { readFile } from "node:fs/promises";
16
+ // =============================================================================
17
+ // Types
18
+ // =============================================================================
19
+ export const EcosystemProceduresInputSchema = z.object({
20
+ /** Workspace root (defaults to the pnpm workspace that contains client-lib) */
21
+ rootPath: z.string().optional().describe("Workspace root (defaults to the pnpm workspace that contains client-lib)"),
22
+ /** Filter by namespace prefix */
23
+ namespace: z.string().optional().describe("Filter by namespace prefix"),
24
+ /** Include full metadata */
25
+ includeMetadata: z.boolean().default(false).describe("Include full metadata"),
26
+ });
27
+ const procedureInfoSchema = z.looseObject({
28
+ path: z.array(z.string()).describe("The procedure path"),
29
+ key: z.string().describe("The dotted key of the path"),
30
+ package: z.string().describe("The package that registers the procedure"),
31
+ packagePath: z.string().describe("The folder of the package"),
32
+ description: z.string().optional().describe("The description of the procedure"),
33
+ tags: z.array(z.string()).optional().describe("The tags of the procedure"),
34
+ });
35
+ /** The output schema of ecosystem.procedures (roadmap 2.1). Loose: other fields stay. */
36
+ export const EcosystemProceduresOutputSchema = z.looseObject({
37
+ procedures: z.array(procedureInfoSchema).describe("Every procedure of the workspace packages"),
38
+ byPackage: z
39
+ .array(z.looseObject({
40
+ name: z.string().describe("The package name"),
41
+ path: z.string().describe("The package folder"),
42
+ procedures: z.array(procedureInfoSchema).describe("The procedures of the package"),
43
+ success: z.boolean().describe("False when the package did not load"),
44
+ error: z.string().optional().describe("Why the package did not load"),
45
+ }))
46
+ .describe("The procedures of each package"),
47
+ byNamespace: z.record(z.string(), z.array(procedureInfoSchema)).describe("The procedures of each namespace"),
48
+ summary: z
49
+ .looseObject({
50
+ totalPackages: z.number().describe("The number of packages that were examined"),
51
+ packagesWithProcedures: z.number().describe("The number of packages that have procedures"),
52
+ totalProcedures: z.number().describe("The number of procedures"),
53
+ namespaces: z.array(z.string()).describe("The namespaces (first path segments)"),
54
+ })
55
+ .describe("The counts"),
56
+ });
57
+ function collect(items, collector) {
58
+ const acc = collector.supplier();
59
+ for (const item of items) {
60
+ collector.accumulator(acc, item);
61
+ }
62
+ return collector.finisher(acc);
63
+ }
64
+ // Collector that aggregates PackageProcedures into EcosystemProceduresOutput
65
+ function ecosystemProceduresCollector(namespace) {
66
+ return {
67
+ supplier: () => ({
68
+ procedures: [],
69
+ byPackage: [],
70
+ byNamespace: new Map(),
71
+ }),
72
+ accumulator: (acc, pkg) => {
73
+ acc.byPackage.push(pkg);
74
+ for (const proc of pkg.procedures) {
75
+ // Filter by namespace if specified
76
+ if (namespace && proc.path[0] !== namespace) {
77
+ continue;
78
+ }
79
+ acc.procedures.push(proc);
80
+ // Group by namespace
81
+ const ns = proc.path[0] ?? "root";
82
+ if (!acc.byNamespace.has(ns)) {
83
+ acc.byNamespace.set(ns, []);
84
+ }
85
+ acc.byNamespace.get(ns).push(proc);
86
+ }
87
+ },
88
+ finisher: (acc) => {
89
+ const namespaces = [...acc.byNamespace.keys()].sort();
90
+ return {
91
+ procedures: acc.procedures,
92
+ byPackage: acc.byPackage,
93
+ byNamespace: Object.fromEntries(acc.byNamespace),
94
+ summary: {
95
+ totalPackages: acc.byPackage.length,
96
+ packagesWithProcedures: acc.byPackage.filter(p => p.procedures.length > 0).length,
97
+ totalProcedures: acc.procedures.length,
98
+ namespaces,
99
+ },
100
+ };
101
+ },
102
+ };
103
+ }
104
+ // =============================================================================
105
+ // Package Procedure Discovery
106
+ // =============================================================================
107
+ async function discoverPackageProcedures(packageName, packagePath, _ctx) {
108
+ try {
109
+ // Read package.json to find client.procedures entry
110
+ const pkgJsonPath = join(packagePath, "package.json");
111
+ const pkgJsonContent = await readFile(pkgJsonPath, "utf-8");
112
+ const pkgJson = JSON.parse(pkgJsonContent);
113
+ if (!pkgJson.client?.procedures) {
114
+ return {
115
+ name: packageName,
116
+ path: packagePath,
117
+ procedures: [],
118
+ success: true,
119
+ };
120
+ }
121
+ // Dynamically import the procedures register file
122
+ const proceduresPath = join(packagePath, pkgJson.client.procedures);
123
+ // Import to trigger registration. import() needs a file:// URL: a Windows path such as
124
+ // C:\... is not a valid module specifier (BUGS-2026-07 M33)
125
+ try {
126
+ await import(pathToFileURL(proceduresPath).href);
127
+ }
128
+ catch (importError) {
129
+ // May already be imported or path issue - continue anyway
130
+ }
131
+ // Query the global registry for procedures from this package
132
+ // We identify procedures by checking if they're in a namespace that
133
+ // matches the package pattern (e.g., client-fs -> fs.*)
134
+ const { PROCEDURE_REGISTRY } = await import("@procedures/client");
135
+ const allProcs = PROCEDURE_REGISTRY.getAll();
136
+ // Extract namespace from package name (e.g., @procedures/fs -> fs)
137
+ const match = packageName.match(/^@procedures\/(\w+)/) ?? packageName.match(/@mark1russell7\/client-(\w+)/);
138
+ const expectedNamespace = match ? match[1] : null;
139
+ const procedures = [];
140
+ for (const proc of allProcs) {
141
+ // For now, include all procedures but mark their source
142
+ // A more sophisticated approach would track which package registered which procedure
143
+ const meta = proc.metadata;
144
+ const description = meta?.["description"];
145
+ const tags = meta?.["tags"];
146
+ // Heuristic: if first path segment matches expected namespace, it's from this package
147
+ if (expectedNamespace && proc.path[0] === expectedNamespace) {
148
+ procedures.push({
149
+ path: proc.path,
150
+ key: proc.path.join("."),
151
+ package: packageName,
152
+ packagePath,
153
+ description,
154
+ tags,
155
+ });
156
+ }
157
+ else if (packageName === "@procedures/lib" && proc.path[0] === "lib") {
158
+ procedures.push({
159
+ path: proc.path,
160
+ key: proc.path.join("."),
161
+ package: packageName,
162
+ packagePath,
163
+ description,
164
+ tags,
165
+ });
166
+ }
167
+ else if (packageName === "@procedures/cli-run" &&
168
+ (proc.path[0] === "procedure" || proc.path[0] === "dag")) {
169
+ procedures.push({
170
+ path: proc.path,
171
+ key: proc.path.join("."),
172
+ package: packageName,
173
+ packagePath,
174
+ description,
175
+ tags,
176
+ });
177
+ }
178
+ }
179
+ return {
180
+ name: packageName,
181
+ path: packagePath,
182
+ procedures,
183
+ success: true,
184
+ };
185
+ }
186
+ catch (error) {
187
+ return {
188
+ name: packageName,
189
+ path: packagePath,
190
+ procedures: [],
191
+ success: false,
192
+ error: error instanceof Error ? error.message : String(error),
193
+ };
194
+ }
195
+ }
196
+ // =============================================================================
197
+ // Main Procedure
198
+ // =============================================================================
199
+ export async function ecosystemProcedures(input, ctx) {
200
+ // Step 1: Scan all packages
201
+ const scanResult = await libScan({ rootPath: input.rootPath }, ctx);
202
+ // Step 2: Discover procedures in each package
203
+ const packageResults = [];
204
+ for (const [name, info] of Object.entries(scanResult.packages)) {
205
+ // Only process client-* packages (they have procedures)
206
+ if (name.includes("/client-") || name === "@procedures/client") {
207
+ const result = await discoverPackageProcedures(name, info.repoPath, ctx);
208
+ packageResults.push(result);
209
+ }
210
+ }
211
+ // Step 3: Aggregate using collector pattern
212
+ const output = collect(packageResults, ecosystemProceduresCollector(input.namespace));
213
+ return output;
214
+ }
215
+ //# sourceMappingURL=procedures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"procedures.js","sourceRoot":"","sources":["../../../src/procedures/ecosystem/procedures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,MAAM,CAAC,MAAM,8BAA8B,GAItC,CAAC,CAAC,MAAM,CAAC;IACZ,+EAA+E;IAC/E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0EAA0E,CAAC;IACpH,iCAAiC;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACvE,4BAA4B;IAC5B,eAAe,EAAE,CAAC,CAAC,OAAO,EAA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B,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACzE,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,4CAA4C;IAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,4BAA4B,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAEtF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * lib.audit procedure
3
+ *
4
+ * Validates the workspace packages against the package template, and checks for
5
+ * pnpm settings that do not work in a workspace.
6
+ */
7
+ import { type AnyProcedure, type ProcedureContext } from "@procedures/client";
8
+ import type { FlagNotice, LibAuditInput, LibAuditOutput } from "../../types.js";
9
+ /**
10
+ * The files and folders every client package has. dist/ is not in the list:
11
+ * it is build output and does not exist before `pnpm build`.
12
+ */
13
+ export declare const PACKAGE_TEMPLATE: {
14
+ files: string[];
15
+ dirs: string[];
16
+ };
17
+ /**
18
+ * The procedure flags that hide a global flag of `mark` after the command path. `mark` gives a
19
+ * flag after the path to the procedure when the procedure declares it, so the user must give
20
+ * the global flag before the command. The server options (`--port`, `--host`, `--transport`)
21
+ * are not reported: they are global only with `--server`, which takes no command.
22
+ */
23
+ export declare function findFlagNotices(procedures: readonly AnyProcedure[]): FlagNotice[];
24
+ /**
25
+ * Audit all client packages of the workspace against the package template. The result also
26
+ * lists the procedure flags that hide a global flag of `mark` (information only).
27
+ */
28
+ export declare function libAudit(input: LibAuditInput, ctx: ProcedureContext): Promise<LibAuditOutput>;
29
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/procedures/lib/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,cAAc,EAGf,MAAM,gBAAgB,CAAC;AAUxB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAG/D,CAAC;AAsMF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,SAAS,YAAY,EAAE,GAAG,UAAU,EAAE,CAqBjF;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CA2CnG"}
@@ -0,0 +1,236 @@
1
+ /**
2
+ * lib.audit procedure
3
+ *
4
+ * Validates the workspace packages against the package template, and checks for
5
+ * pnpm settings that do not work in a workspace.
6
+ */
7
+ import { basename, join } from "node:path";
8
+ import { PROCEDURE_REGISTRY } from "@procedures/client";
9
+ import { libScan } from "./scan.js";
10
+ import { resolveWorkspaceRoot } from "../../workspace.js";
11
+ import { CLI_GLOBAL_FLAGS } from "../../cli-flags.js";
12
+ /**
13
+ * The files and folders every client package has. dist/ is not in the list:
14
+ * it is build output and does not exist before `pnpm build`.
15
+ */
16
+ export const PACKAGE_TEMPLATE = {
17
+ files: ["package.json", "tsconfig.json", "dependencies.json", ".gitignore"],
18
+ dirs: ["src"],
19
+ };
20
+ /**
21
+ * Folders under packages/ that are not client packages.
22
+ * packages/cli holds the repository tool from the template, which does not use cue-config.
23
+ */
24
+ const NOT_CLIENT_PACKAGES = new Set(["cli"]);
25
+ /**
26
+ * Check if path exists
27
+ */
28
+ async function pathExists(pathStr, ctx) {
29
+ try {
30
+ const result = await ctx.client.call(["fs", "exists"], { path: pathStr });
31
+ return result.exists;
32
+ }
33
+ catch {
34
+ return false;
35
+ }
36
+ }
37
+ /**
38
+ * Check for pnpm configuration that does not work in a workspace
39
+ */
40
+ async function checkPnpmIssues(pkgPath, workspacePackages, ctx) {
41
+ const issues = [];
42
+ if (await pathExists(join(pkgPath, "package-lock.json"), ctx)) {
43
+ issues.push({
44
+ type: "npm-lockfile",
45
+ message: "Found package-lock.json - the workspace uses the root pnpm-lock.yaml",
46
+ });
47
+ }
48
+ if (await pathExists(join(pkgPath, "pnpm-lock.yaml"), ctx)) {
49
+ issues.push({
50
+ type: "package-lockfile",
51
+ message: "Found a per-package pnpm-lock.yaml - the workspace uses the root pnpm-lock.yaml",
52
+ });
53
+ }
54
+ let pkgJson;
55
+ try {
56
+ const result = await ctx.client.call(["fs", "read.json"], { path: join(pkgPath, "package.json") });
57
+ pkgJson = result.data;
58
+ }
59
+ catch {
60
+ return issues;
61
+ }
62
+ if (pkgJson.pnpm !== undefined) {
63
+ issues.push({
64
+ type: "ignored-pnpm-field",
65
+ message: 'The "pnpm" field of a workspace package is ignored - use the root pnpm-workspace.yaml',
66
+ });
67
+ }
68
+ // A dependency on another workspace package must use the workspace link, not a git reference
69
+ for (const deps of [pkgJson.dependencies, pkgJson.devDependencies, pkgJson.peerDependencies]) {
70
+ for (const [name, spec] of Object.entries(deps ?? {})) {
71
+ if (workspacePackages.has(name) && !spec.startsWith("workspace:")) {
72
+ issues.push({
73
+ type: "not-workspace-link",
74
+ message: `"${name}" is a workspace package but the dependency is "${spec}" - use "workspace:*"`,
75
+ package: name,
76
+ });
77
+ }
78
+ }
79
+ }
80
+ return issues;
81
+ }
82
+ /**
83
+ * Audit a single package against the template
84
+ */
85
+ async function auditPackage(pkgPath, pkgName, template, workspacePackages, fix, ctx) {
86
+ const missingFiles = [];
87
+ const missingDirs = [];
88
+ const fixedFiles = [];
89
+ const fixedDirs = [];
90
+ // Check required directories
91
+ for (const dir of template.dirs) {
92
+ const dirPath = join(pkgPath, dir);
93
+ if (!(await pathExists(dirPath, ctx))) {
94
+ missingDirs.push(dir);
95
+ if (fix) {
96
+ try {
97
+ await ctx.client.call(["fs", "mkdir"], { path: dirPath, recursive: true });
98
+ fixedDirs.push(dir);
99
+ }
100
+ catch {
101
+ // Could not fix
102
+ }
103
+ }
104
+ }
105
+ }
106
+ // Check required files
107
+ for (const file of template.files) {
108
+ const filePath = join(pkgPath, file);
109
+ if (!(await pathExists(filePath, ctx))) {
110
+ missingFiles.push(file);
111
+ if (fix) {
112
+ // Only fix certain files with sensible defaults
113
+ try {
114
+ if (file === "dependencies.json") {
115
+ await ctx.client.call(["fs", "write"], {
116
+ path: filePath,
117
+ content: JSON.stringify({ $schema: "./node_modules/@mark1russell7/cue/dependencies/schema.json", dependencies: ["ts", "node"] }, null, 2) + "\n"
118
+ });
119
+ fixedFiles.push(file);
120
+ }
121
+ else if (file === ".gitignore") {
122
+ await ctx.client.call(["fs", "write"], { path: filePath, content: "node_modules/\ndist/\n.tsbuildinfo\n" });
123
+ fixedFiles.push(file);
124
+ }
125
+ // Don't auto-create package.json or tsconfig.json - those need cue-config generate
126
+ }
127
+ catch {
128
+ // Could not fix
129
+ }
130
+ }
131
+ }
132
+ }
133
+ // Check pnpm configuration
134
+ const pnpmIssues = await checkPnpmIssues(pkgPath, workspacePackages, ctx);
135
+ // Remove fixed items from missing lists
136
+ const stillMissingFiles = missingFiles.filter((f) => !fixedFiles.includes(f));
137
+ const stillMissingDirs = missingDirs.filter((d) => !fixedDirs.includes(d));
138
+ // Package is valid only if no missing files/dirs AND no pnpm issues
139
+ const isValid = stillMissingFiles.length === 0 && stillMissingDirs.length === 0 && pnpmIssues.length === 0;
140
+ return {
141
+ name: pkgName,
142
+ path: pkgPath,
143
+ valid: isValid,
144
+ missingFiles: stillMissingFiles,
145
+ missingDirs: stillMissingDirs,
146
+ pnpmIssues,
147
+ ...(fix && fixedFiles.length > 0 ? { fixedFiles } : {}),
148
+ ...(fix && fixedDirs.length > 0 ? { fixedDirs } : {}),
149
+ };
150
+ }
151
+ /**
152
+ * The field names of a procedure's input schema (a Zod object, also through zodAdapter)
153
+ */
154
+ function inputFieldNames(schema) {
155
+ const node = schema;
156
+ if (node?.shape && typeof node.shape === "object") {
157
+ return Object.keys(node.shape);
158
+ }
159
+ if (typeof node?._def?.shape === "function") {
160
+ return Object.keys(node._def.shape());
161
+ }
162
+ return [];
163
+ }
164
+ /**
165
+ * The procedure flags that hide a global flag of `mark` after the command path. `mark` gives a
166
+ * flag after the path to the procedure when the procedure declares it, so the user must give
167
+ * the global flag before the command. The server options (`--port`, `--host`, `--transport`)
168
+ * are not reported: they are global only with `--server`, which takes no command.
169
+ */
170
+ export function findFlagNotices(procedures) {
171
+ const notices = [];
172
+ const globals = CLI_GLOBAL_FLAGS.filter((flag) => !flag.serverOption);
173
+ for (const procedure of procedures) {
174
+ const name = procedure.path.join(" ");
175
+ const shorts = (procedure.metadata ?? {}).shorts ?? {};
176
+ for (const [field, letter] of Object.entries(shorts)) {
177
+ const global = globals.find((flag) => flag.short === letter);
178
+ if (global) {
179
+ notices.push({ procedure: name, flag: `-${letter} (${field})`, global: `-${letter} (--${global.long})` });
180
+ }
181
+ }
182
+ for (const field of inputFieldNames(procedure.input)) {
183
+ const kebab = field.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
184
+ const global = globals.find((flag) => flag.long === field || flag.long === kebab);
185
+ if (global) {
186
+ notices.push({ procedure: name, flag: `--${kebab}`, global: `--${global.long}` });
187
+ }
188
+ }
189
+ }
190
+ return notices;
191
+ }
192
+ /**
193
+ * Audit all client packages of the workspace against the package template. The result also
194
+ * lists the procedure flags that hide a global flag of `mark` (information only).
195
+ */
196
+ export async function libAudit(input, ctx) {
197
+ const template = PACKAGE_TEMPLATE;
198
+ const flagNotices = findFlagNotices(PROCEDURE_REGISTRY.getAll());
199
+ const empty = {
200
+ success: false,
201
+ flagNotices,
202
+ template,
203
+ results: [],
204
+ summary: { total: 0, valid: 0, invalid: 0 },
205
+ };
206
+ let rootPath;
207
+ try {
208
+ rootPath = resolveWorkspaceRoot(input.rootPath);
209
+ }
210
+ catch {
211
+ return empty;
212
+ }
213
+ const scan = await libScan({ rootPath }, ctx);
214
+ const workspacePackages = new Set(Object.keys(scan.packages));
215
+ const results = [];
216
+ for (const info of Object.values(scan.packages)) {
217
+ if (NOT_CLIENT_PACKAGES.has(basename(info.repoPath))) {
218
+ continue;
219
+ }
220
+ results.push(await auditPackage(info.repoPath, info.name, template, workspacePackages, input.fix, ctx));
221
+ }
222
+ const validCount = results.filter((r) => r.valid).length;
223
+ const invalidCount = results.filter((r) => !r.valid).length;
224
+ return {
225
+ success: invalidCount === 0,
226
+ flagNotices,
227
+ template,
228
+ results,
229
+ summary: {
230
+ total: results.length,
231
+ valid: validCount,
232
+ invalid: invalidCount,
233
+ },
234
+ };
235
+ }
236
+ //# sourceMappingURL=audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/procedures/lib/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAA4C,MAAM,oBAAoB,CAAC;AAQlG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAwC;IACnE,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,CAAC;IAC3E,IAAI,EAAE,CAAC,KAAK,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAE7C;;GAEG;AACH,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,GAAqB;IAC9D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAClC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAChB,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OAAO,GAAyB,EAAE,CAAC;IAEzC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChD,IAAI,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACrD,SAAS;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1G,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACzD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IAE5D,OAAO;QACL,OAAO,EAAE,YAAY,KAAK,CAAC;QAC3B,WAAW;QACX,QAAQ;QACR,OAAO;QACP,OAAO,EAAE;YACP,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,YAAY;SACtB;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * lib procedures
3
+ */
4
+ export { libScan } from "./scan.js";
5
+ export { libRename } from "./rename.js";
6
+ export { libNew } from "./new.js";
7
+ export { libAudit } from "./audit.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/procedures/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * lib procedures
3
+ */
4
+ export { libScan } from "./scan.js";
5
+ export { libRename } from "./rename.js";
6
+ export { libNew } from "./new.js";
7
+ export { libAudit } from "./audit.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/procedures/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * lib.new procedure
3
+ *
4
+ * Creates a new client package in the workspace, at packages/<name>, with the
5
+ * structure the other client packages have: cue-config files, src/index.ts (which
6
+ * imports src/register.ts), src/register.ts, src/types.ts, the "./register" export and the
7
+ * "client.procedures" field. `mark procedure new` then adds procedures that compile.
8
+ * Uses fs.* and shell.* procedures via ctx.client.call() for all operations.
9
+ *
10
+ * After it, run `pnpm install` and `pnpm build` in the workspace root.
11
+ */
12
+ import type { ProcedureContext } from "@procedures/client";
13
+ import type { LibNewInput, LibNewOutput } from "../../types.js";
14
+ /**
15
+ * Create a new client package in the workspace
16
+ */
17
+ export declare function libNew(input: LibNewInput, ctx: ProcedureContext): Promise<LibNewOutput>;
18
+ //# sourceMappingURL=new.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/procedures/lib/new.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAiEhE;;GAEG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAqI7F"}