@procedures/procedure 0.0.0-stage → 0.2.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 (40) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +405 -2
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/index.d.ts +9 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +11 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/module.d.ts +23 -0
  10. package/dist/module.d.ts.map +1 -0
  11. package/dist/module.js +51 -0
  12. package/dist/module.js.map +1 -0
  13. package/dist/procedures/procedure/index.d.ts +5 -0
  14. package/dist/procedures/procedure/index.d.ts.map +1 -0
  15. package/dist/procedures/procedure/index.js +5 -0
  16. package/dist/procedures/procedure/index.js.map +1 -0
  17. package/dist/procedures/procedure/new.d.ts +55 -0
  18. package/dist/procedures/procedure/new.d.ts.map +1 -0
  19. package/dist/procedures/procedure/new.js +448 -0
  20. package/dist/procedures/procedure/new.js.map +1 -0
  21. package/dist/procedures/procedure/registry.d.ts +10 -0
  22. package/dist/procedures/procedure/registry.d.ts.map +1 -0
  23. package/dist/procedures/procedure/registry.js +68 -0
  24. package/dist/procedures/procedure/registry.js.map +1 -0
  25. package/dist/register.d.ts +7 -0
  26. package/dist/register.d.ts.map +1 -0
  27. package/dist/register.js +9 -0
  28. package/dist/register.js.map +1 -0
  29. package/dist/types.d.ts +29 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/dist/types.js +34 -0
  32. package/dist/types.js.map +1 -0
  33. package/package.json +75 -3
  34. package/src/index.ts +13 -0
  35. package/src/module.ts +61 -0
  36. package/src/procedures/procedure/index.ts +5 -0
  37. package/src/procedures/procedure/new.ts +502 -0
  38. package/src/procedures/procedure/registry.ts +93 -0
  39. package/src/register.ts +11 -0
  40. package/src/types.ts +63 -0
package/dist/types.js ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Type definitions for client-procedure
3
+ */
4
+ import { z } from "zod";
5
+ // =============================================================================
6
+ // procedure.new Types
7
+ // =============================================================================
8
+ export const ProcedureNewInputSchema = z.object({
9
+ /** Procedure name (e.g., "greet", "user.create" or "fs.readJson") */
10
+ name: z
11
+ .string()
12
+ .regex(/^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$/, "Name must be dot-separated segments, each starting with a lowercase letter (camelCase is allowed)").describe("Procedure name (e.g., \"greet\", \"user.create\" or \"fs.readJson\")"),
13
+ /** Namespace override (defaults to first segment of name): the folder under src/procedures */
14
+ namespace: z
15
+ .string()
16
+ .regex(/^[a-z][a-zA-Z0-9]*$/, "Namespace must be one segment that starts with a lowercase letter")
17
+ .optional().describe("Namespace override (defaults to first segment of name): the folder under src/procedures"),
18
+ /** Procedure description for CLI help */
19
+ description: z.string().optional().describe("Procedure description for CLI help"),
20
+ /** Project path (defaults to cwd) */
21
+ path: z.string().optional().describe("Project path (defaults to cwd)"),
22
+ /** Preview changes without creating */
23
+ dryRun: z.boolean().default(false).describe("Preview changes without creating"),
24
+ });
25
+ /** The output schema of procedure.new (roadmap 2.1). Loose: a field that it does not name stays. */
26
+ export const ProcedureNewOutputSchema = z.looseObject({
27
+ success: z.boolean().describe("True when the procedure was made"),
28
+ procedurePath: z.array(z.string()).describe('The path of the new procedure, for example ["user", "create"]'),
29
+ created: z.array(z.string()).describe("The files that the call made"),
30
+ modified: z.array(z.string()).describe("The files that the call changed (types.ts, register.ts)"),
31
+ operations: z.array(z.string()).describe("The steps that the call ran"),
32
+ errors: z.array(z.string()).describe("The errors"),
33
+ });
34
+ //# 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;AAExB,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF,MAAM,CAAC,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AAE,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACvE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC;CACnD,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,78 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package",
2
3
  "name": "@procedures/procedure",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
4
+ "version": "0.2.0",
5
+ "description": "Procedure scaffolding and management: procedure.new writes typed procedure files, plus get, list, define and the procedure store.",
6
+ "keywords": [
7
+ "scaffolding",
8
+ "codegen",
9
+ "generator",
10
+ "procedures"
11
+ ],
12
+ "homepage": "https://mark1russell7.github.io/client/",
13
+ "bugs": {
14
+ "url": "https://github.com/mark1russell7/client/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/mark1russell7/client.git",
19
+ "directory": "packages/client-procedure"
20
+ },
21
+ "license": "MIT",
22
+ "author": "Mark Russell (https://github.com/mark1russell7)",
23
+ "type": "module",
24
+ "main": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ },
31
+ "./module": {
32
+ "types": "./dist/module.d.ts",
33
+ "import": "./dist/module.js"
34
+ },
35
+ "./register": {
36
+ "types": "./dist/register.d.ts",
37
+ "import": "./dist/register.js"
38
+ }
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "src",
43
+ "!src/**/*.test.ts",
44
+ "!src/**/*.test.tsx",
45
+ "!src/**/__tests__",
46
+ "CHANGELOG.md"
47
+ ],
48
+ "sideEffects": [
49
+ "./dist/register.js"
50
+ ],
51
+ "engines": {
52
+ "node": ">=22"
53
+ },
54
+ "publishConfig": {
55
+ "access": "public",
56
+ "provenance": true
57
+ },
58
+ "devDependencies": {
59
+ "typescript": "^7.0.2",
60
+ "@types/node": "^22.0.0",
61
+ "@mark1russell7/cue": "^1.0.0",
62
+ "vitest": "^5.0.3"
63
+ },
64
+ "dependencies": {
65
+ "zod": "^4.6.5",
66
+ "@procedures/client": "0.2.0"
67
+ },
68
+ "client": {
69
+ "procedures": "./dist/register.js"
70
+ },
71
+ "scripts": {
72
+ "build": "tsc -b",
73
+ "typecheck": "tsc --noEmit",
74
+ "clean": "rm -rf dist .tsbuildinfo",
75
+ "test": "vitest run --passWithNoTests",
76
+ "test:watch": "vitest"
77
+ }
6
78
  }
package/src/index.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @procedures/procedure
3
+ *
4
+ * Procedure scaffolding procedures - procedure.new
5
+ */
6
+
7
+ export * from "./module.js";
8
+
9
+ // Re-export types
10
+ export * from "./types.js";
11
+
12
+ // Re-export procedures
13
+ export { procedureNew } from "./procedures/procedure/index.js";
package/src/module.ts ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Module (no side effects): the procedures of this package as data, for `createRegistry()`.
3
+ *
4
+ * Procedure Registration for procedure operations
5
+ *
6
+ * This is the canonical home for procedure.* procedures.
7
+ * client-cli no longer registers these to avoid duplicates.
8
+ */
9
+
10
+ import { createProcedure, zodAdapter, defineModule, type AnyProcedure, type ProcedureModule, PROCEDURE_REGISTRY, registerModules, type ProcedureRegistry } from "@procedures/client";
11
+ import { procedureNew } from "./procedures/procedure/index.js";
12
+ import { procedureRegistryProcedures } from "./procedures/procedure/registry.js";
13
+ import {
14
+ ProcedureNewInputSchema,
15
+ type ProcedureNewInput,
16
+ type ProcedureNewOutput,
17
+ ProcedureNewOutputSchema,
18
+ } from "./types.js";
19
+ import type { ProcedureContext } from "@procedures/client";
20
+
21
+ // procedure.new procedure
22
+ const procedureNewProcedure = createProcedure()
23
+ .path(["procedure", "new"])
24
+ .input(zodAdapter<ProcedureNewInput>(ProcedureNewInputSchema))
25
+ .output(zodAdapter<ProcedureNewOutput>(ProcedureNewOutputSchema))
26
+ .meta({
27
+ description: "Scaffold a new procedure with types and registration boilerplate",
28
+ calls: ["fs.exists", "fs.read", "fs.write", "fs.mkdir"],
29
+ // It refuses a name that collides, makes new files and adds lines to the existing files
30
+ effects: { reads: ["fs", "registry"], writes: ["fs"], destructive: false },
31
+ args: ["name"],
32
+ shorts: { namespace: "n", description: "d", path: "p", dryRun: "D" },
33
+ output: "text",
34
+ })
35
+ .handler(async (input: ProcedureNewInput, ctx: ProcedureContext): Promise<ProcedureNewOutput> => {
36
+ return procedureNew(input, ctx);
37
+ })
38
+ .build();
39
+
40
+ /**
41
+ * The module of this package, for `createRegistry()`: its procedures as data. Importing this
42
+ * file registers nothing. (`register.ts` registers the same procedures in the global registry.)
43
+ * `procedure.new` calls `fs.*`: the host gives them (this package does not depend on client-fs).
44
+ */
45
+ export const procedureModule: ProcedureModule = defineModule("@procedures/procedure", [
46
+ // procedure.new
47
+ procedureNewProcedure as AnyProcedure,
48
+ // procedure.export (from registry.ts)
49
+ ...procedureRegistryProcedures,
50
+ ]);
51
+
52
+ export default procedureModule;
53
+
54
+ /**
55
+ * This function registers the procedures of @procedures/procedure, and of the modules that it requires, in
56
+ * a registry. The default is the global registry. Importing this file registers nothing: the
57
+ * `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
58
+ */
59
+ export function registerProcedureProcedures(registry: ProcedureRegistry = PROCEDURE_REGISTRY): void {
60
+ registerModules(registry, [procedureModule], { override: true });
61
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * procedure namespace procedures
3
+ */
4
+
5
+ export { procedureNew } from "./new.js";