politty 0.14.0 → 0.14.2

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
@@ -148,11 +148,11 @@ Arguments:
148
148
  <name> Name of the person to greet
149
149
 
150
150
  Options:
151
+ -g, --greeting <GREETING> Greeting phrase (default: "Hello")
152
+ -l, --loud Output in uppercase (default: false)
151
153
  -h, --help Show help
152
154
  -H, --help-all Show help with all subcommand options
153
155
  --help-json Show help as JSON
154
- -g, --greeting <GREETING> Greeting phrase (default: "Hello")
155
- -l, --loud Output in uppercase (default: false)
156
156
  ```
157
157
 
158
158
  Every command also accepts `--help-json`, which prints the same information as a single JSON object instead of formatted text — useful for tools that consume a CLI's help programmatically (e.g. generating docs or another UI) rather than parsing `--help`'s output:
@@ -531,6 +531,21 @@ politty integrates Node.js's on-disk compile cache (V8 code cache, Node >= 22.8.
531
531
 
532
532
  `generate-shim` writes an executable shim that enables the cache and loads `--entry` (a specifier relative to the shim) with a dynamic import. The output path and program name come from `package.json` (the `bin` path and the `bin` name), and the shim imports the cache helper from the politty package whose `politty` bin you ran — the one you installed, so it resolves from your package. Packages with multiple bins pass `--entry` once per bin, and `--entry` itself can be omitted when the entry sits next to the shim under a conventional name (`./cli.js`, `./index.js`, ...). See [Faster Startup (Compile Cache)](./docs/recipes.md#faster-startup-compile-cache) for the flags, the opt-out (`compileCache: false`), and the hand-written shim variant.
533
533
 
534
+ ## AI Coding Agents
535
+
536
+ politty detects AI coding agents (Claude Code, Codex, Cursor, Gemini CLI, ...) from the environment, following [vercel/detect-agent](https://github.com/vercel/detect-agent)'s spec. Give agents guidance humans never see, and branch on the detected agent at run time:
537
+
538
+ ```typescript
539
+ runMain(cli, {
540
+ agentHelp: "**AGENTS:** Pass `--json` and parse stdout instead of the table output.",
541
+ });
542
+
543
+ // In run/setup/cleanup: args.$agent // e.g. { id: "claude_code", rawId: "claude_code" }, or undefined
544
+ // Anywhere: import { detectAgent } from "politty/agent";
545
+ ```
546
+
547
+ Set `POLITTY_NO_AGENT=1` to opt out. See [AI Coding Agents](./docs/advanced-features.md#ai-coding-agents).
548
+
534
549
  ## Skill Management
535
550
 
536
551
  politty manages SKILL.md-based agent skills distributed via npm packages.
@@ -0,0 +1 @@
1
+ export * from "@politty/zod/agent";
package/dist/agent.js ADDED
@@ -0,0 +1 @@
1
+ export*from"@politty/zod/agent";export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "politty",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
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",
@@ -41,6 +41,10 @@
41
41
  "types": "./dist/compile-cache.d.ts",
42
42
  "default": "./dist/compile-cache.js"
43
43
  },
44
+ "./agent": {
45
+ "types": "./dist/agent.d.ts",
46
+ "default": "./dist/agent.js"
47
+ },
44
48
  "./docs": {
45
49
  "types": "./dist/docs.d.ts",
46
50
  "default": "./dist/docs.js"
@@ -67,7 +71,7 @@
67
71
  }
68
72
  },
69
73
  "dependencies": {
70
- "@politty/zod": "^0.4.0"
74
+ "@politty/zod": "^0.4.2"
71
75
  },
72
76
  "devDependencies": {
73
77
  "@types/node": "25.9.8",