politty 0.11.9 → 0.12.1

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.
package/README.md CHANGED
@@ -62,6 +62,37 @@ runMain(command);
62
62
 
63
63
  Field descriptions can also come from valibot's own metadata actions. They are actions, not schemas, so they belong inside `v.pipe(...)`: `v.pipe(v.string(), v.description("..."))` or `v.pipe(v.string(), v.metadata({ description: "..." }))`. The one zod-only feature without a valibot counterpart is the `politty/augment` module (zod `GlobalMeta` interface augmentation) — use `arg()` or `v.metadata()` instead. The `politty` package itself remains the zod flavor (an alias of `@politty/zod`).
64
64
 
65
+ ### Using zod/mini instead of zod
66
+
67
+ politty is also available as [`@politty/zod-mini`](https://www.npmjs.com/package/@politty/zod-mini), built on [`zod/mini`](https://zod.dev/) — the same `zod` package's minimal, function-style entry point instead of its chainable classic API — for a smaller bundle. Same API (`defineCommand`, `arg`, `runMain`, and all subpath modules):
68
+
69
+ ```bash
70
+ npm install @politty/zod-mini zod
71
+ ```
72
+
73
+ ```typescript
74
+ import * as z from "zod/mini";
75
+ import { defineCommand, runMain, arg } from "@politty/zod-mini";
76
+
77
+ const command = defineCommand({
78
+ name: "greet",
79
+ args: z.object({
80
+ name: arg(z.string(), { description: "Name to greet", positional: true }),
81
+ loud: arg(z._default(z.boolean(), false), { alias: "l" }),
82
+ }),
83
+ run: (args) => {
84
+ const greeting = `Hello, ${args.name}!`;
85
+ console.log(args.loud ? greeting.toUpperCase() : greeting);
86
+ },
87
+ });
88
+
89
+ runMain(command);
90
+ ```
91
+
92
+ `zod/mini` drops classic zod's chainable sugar (`.optional()`, `.default()`, `.describe()`, `.meta()`), so schemas are built with functions instead (`z.optional(z.string())`, `z._default(z.string(), "x")`). Field descriptions come from `arg()` or from zod's own metadata registry: `schema.register(z.globalRegistry, { description: "..." })`. The `politty/augment` module (classic zod's `GlobalMeta` interface augmentation) has no `@politty/zod-mini` counterpart for the same reason it has none for valibot — use `arg()` or the registry instead.
93
+
94
+ You can write your schemas against either `import * as z from "zod/mini"` or [`import * as z from "@zod/mini"`](https://zod.dev/packages/mini) — `@zod/mini` re-exports `zod/mini` (same classes, same `globalRegistry`), so schemas built either way are fully interchangeable. Per zod's own installation instructions, install `@zod/mini` alongside `zod` (`npm install zod @zod/mini`), not instead of it — `@zod/mini` only re-exports `zod/mini` from a peer dependency on `zod`, so `zod` still needs to be resolvable in your project either way.
95
+
65
96
  ## Quick Start
66
97
 
67
98
  ```typescript
package/dist/augment.js CHANGED
@@ -1,3 +1 @@
1
- import "@politty/zod/augment";
2
-
3
- export { };
1
+ import"@politty/zod/augment";export{};
@@ -0,0 +1 @@
1
+ import{runPolittyCli as e}from"@politty/zod";await e(`politty`);export{};
package/dist/cli.js CHANGED
@@ -1,21 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import { enableCompileCache } from "@politty/zod/compile-cache";
3
-
4
- //#region src/cli.ts
5
- /**
6
- * Bin shim for the `politty` bin of this compatibility alias.
7
- *
8
- * Cannot simply re-run `@politty/zod`'s CLI: the CLI bakes the name of the
9
- * package running it into the shims `generate-shim` writes, and for a CLI
10
- * depending on `politty` alone that name has to be `politty` — under a strict
11
- * node_modules layout (pnpm) its own package cannot resolve `@politty/zod`.
12
- *
13
- * Mirrors `@politty/zod`'s entry otherwise: enable the on-disk V8 compile
14
- * cache before the real CLI graph is compiled, then load that graph through a
15
- * dynamic import so it is what the cache covers.
16
- */
17
- enableCompileCache("politty");
18
- await import("./cli-run-DGe88d0G.js");
19
-
20
- //#endregion
21
- export { };
2
+ import{enableCompileCache as e}from"@politty/zod/compile-cache";e(`politty`),await import(`./cli-run-MIwiURm8.js`);export{};
@@ -1,3 +1 @@
1
- export * from "@politty/zod/compile-cache"
2
-
3
- export { };
1
+ export*from"@politty/zod/compile-cache";export{};
@@ -1,3 +1 @@
1
- export * from "@politty/zod/completion"
2
-
3
- export { };
1
+ export*from"@politty/zod/completion";export{};
package/dist/docs.js CHANGED
@@ -1,3 +1 @@
1
- export * from "@politty/zod/docs"
2
-
3
- export { };
1
+ export*from"@politty/zod/docs";export{};
package/dist/index.js CHANGED
@@ -1,18 +1 @@
1
- import { createCompileCacheShimGenerator } from "@politty/zod";
2
-
3
- export * from "@politty/zod"
4
-
5
- //#region src/index.ts
6
- /**
7
- * Generate compile-cache bin shims that import the cache helper from
8
- * `politty/compile-cache`.
9
- *
10
- * Overrides `@politty/zod`'s binding of the same name — the one thing this
11
- * alias cannot re-export as-is. A CLI depending on `politty` alone cannot
12
- * resolve `@politty/zod` from its own package under a strict node_modules
13
- * layout (pnpm), so a shim naming it would silently lose the compile cache.
14
- */
15
- const generateCompileCacheShim = createCompileCacheShimGenerator("politty");
16
-
17
- //#endregion
18
- export { generateCompileCacheShim };
1
+ import{createCompileCacheShimGenerator as e}from"@politty/zod";export*from"@politty/zod";const t=e(`politty`);export{t as generateCompileCacheShim};
@@ -1,3 +1 @@
1
- export * from "@politty/zod/prompt/clack"
2
-
3
- export { };
1
+ export*from"@politty/zod/prompt/clack";export{};
@@ -1,3 +1 @@
1
- export * from "@politty/zod/prompt/inquirer"
2
-
3
- export { };
1
+ export*from"@politty/zod/prompt/inquirer";export{};
package/dist/prompt.js CHANGED
@@ -1,3 +1 @@
1
- export * from "@politty/zod/prompt"
2
-
3
- export { };
1
+ export*from"@politty/zod/prompt";export{};
package/dist/skill.js CHANGED
@@ -1,3 +1 @@
1
- export * from "@politty/zod/skill"
2
-
3
- export { };
1
+ export*from"@politty/zod/skill";export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "politty",
3
- "version": "0.11.9",
3
+ "version": "0.12.1",
4
4
  "description": "A lightweight CLI framework inspired by citty with zod v4 registry integration for type-safe metadata management",
5
5
  "keywords": [
6
6
  "argument-parser",
@@ -67,7 +67,7 @@
67
67
  }
68
68
  },
69
69
  "dependencies": {
70
- "@politty/zod": "^0.1.2"
70
+ "@politty/zod": "^0.2.1"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/node": "25.9.5",
@@ -1,14 +0,0 @@
1
- import { runPolittyCli } from "@politty/zod";
2
-
3
- //#region src/cli-run.ts
4
- /**
5
- * The real CLI graph behind this package's bin shim.
6
- *
7
- * Importing `@politty/zod` registers the zod adapter as a side effect of that
8
- * package's entry, so the adapter is installed before the politty CLI can
9
- * dynamically load user command modules carrying zod schemas.
10
- */
11
- await runPolittyCli("politty");
12
-
13
- //#endregion
14
- export { };