@dialpad/dialtone-cli 1.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 (3) hide show
  1. package/README.md +184 -0
  2. package/build/index.js +526408 -0
  3. package/package.json +47 -0
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # Dialtone CLI
2
+
3
+ A command-line tool for searching and exploring the [Dialtone Design System](https://dialtone.dialpad.com). Look up components, design tokens, CSS utility classes, and icons from your terminal.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @dialpad/dialtone-cli
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ ### `dialtone search <query>`
14
+
15
+ Search across all domains — components, tokens, utilities, and icons.
16
+
17
+ ```bash
18
+ dialtone search button
19
+ dialtone search "padding 8px"
20
+ dialtone search "input|select|menu" # OR search
21
+ ```
22
+
23
+ ### `dialtone component <name>`
24
+
25
+ Show full component documentation.
26
+
27
+ ```bash
28
+ dialtone component button
29
+ dialtone component DtModal
30
+ dialtone component button --props # props table
31
+ dialtone component button --props --describe # props with descriptions
32
+ dialtone component button --prop kind # single prop detail
33
+ dialtone component button --events # events only
34
+ dialtone component button --slots # slots only
35
+ dialtone component button --examples # usage example
36
+ ```
37
+
38
+ ### `dialtone token <query>`
39
+
40
+ Look up design tokens.
41
+
42
+ ```bash
43
+ dialtone token "color foreground"
44
+ dialtone token "space 400"
45
+ dialtone token "color foreground" --values # show theme values
46
+ dialtone token "color foreground" --all # include HSL tokens
47
+ dialtone token "color foreground" --limit 0 # show all results
48
+ ```
49
+
50
+ ### `dialtone utility <query>`
51
+
52
+ Search CSS utility classes.
53
+
54
+ ```bash
55
+ dialtone utility "padding 8px"
56
+ dialtone utility "display flex"
57
+ dialtone utility "margin auto"
58
+ ```
59
+
60
+ ### `dialtone prompt <name>`
61
+
62
+ Emit a compact, LLM-optimized context block for a component. Designed for piping into AI tools.
63
+
64
+ ```bash
65
+ dialtone prompt button
66
+ dialtone prompt modal | pbcopy
67
+ dialtone prompt tooltip --format json
68
+ ```
69
+
70
+ ## Output Formats
71
+
72
+ All commands support `--format`:
73
+
74
+ | Flag | Output |
75
+ |------|--------|
76
+ | `--format minimal` | Plain text (default) |
77
+ | `--format markdown` | Markdown |
78
+ | `--format json` | Structured JSON |
79
+
80
+ ## Updating
81
+
82
+ The CLI checks for updates automatically. To update:
83
+
84
+ ```bash
85
+ npm install -g @dialpad/dialtone-cli@latest
86
+ ```
87
+
88
+ The data (components, tokens, utilities, icons) is bundled at build time. Update the CLI to get the latest design system data.
89
+
90
+ ## Claude Code Integration
91
+
92
+ The CLI can be used by Claude Code skills, hooks, and agents in any Dialpad repo. This is the recommended way to give Claude access to Dialtone when the MCP server isn't configured.
93
+
94
+ ### Rules
95
+
96
+ Add a rule to your project's `.claude/rules/` that teaches Claude about the CLI:
97
+
98
+ ```markdown
99
+ ---
100
+ description: "Dialtone design system lookups"
101
+ ---
102
+
103
+ # Dialtone Design System
104
+
105
+ When working with Dialtone components, tokens, or utility classes, use the `dialtone` CLI for lookups:
106
+
107
+ - Component API: `dialtone component <name> --props`
108
+ - Single prop: `dialtone component <name> --prop <prop>`
109
+ - Token lookup: `dialtone token "<query>"`
110
+ - Utility classes: `dialtone utility "<query>"`
111
+ - Structured data: add `--format json` to any command
112
+
113
+ Prefer the CLI over reading source files for design system information. It searches
114
+ the full published API and filters deprecated items automatically.
115
+ ```
116
+
117
+ ### Skills
118
+
119
+ Wrap CLI commands in a skill for common workflows:
120
+
121
+ ```markdown
122
+ ---
123
+ description: "Look up a Dialtone component. Use when referencing component props, events, or slots."
124
+ ---
125
+
126
+ # Dialtone Lookup
127
+
128
+ 1. Run `dialtone component <name> --format json` to get full component data
129
+ 2. If you need specific prop values, run `dialtone component <name> --prop <prop>`
130
+ 3. For LLM-optimized context, run `dialtone prompt <name>`
131
+ ```
132
+
133
+ ### Hooks
134
+
135
+ Use a `UserPromptSubmit` hook to auto-inject Dialtone context when a user mentions a component:
136
+
137
+ ```json
138
+ {
139
+ "hooks": {
140
+ "UserPromptSubmit": [
141
+ {
142
+ "matcher": "(?:Dt[A-Z]\\w+|dialtone\\s+component)",
143
+ "command": "dialtone prompt \"$MATCH\" --format json 2>/dev/null || true"
144
+ }
145
+ ]
146
+ }
147
+ }
148
+ ```
149
+
150
+ ### Agents
151
+
152
+ An agent can call the CLI via Bash to research design system questions:
153
+
154
+ ```markdown
155
+ ---
156
+ description: "Research Dialtone design system components, tokens, and utilities."
157
+ ---
158
+
159
+ Use the `dialtone` CLI to look up design system information:
160
+
161
+ - `dialtone search "<query>"` — broad search across all domains
162
+ - `dialtone search "<term1>|<term2>"` — OR search across multiple terms
163
+ - `dialtone component <name> --format json` — full component data
164
+ - `dialtone token "<query>" --format json` — token data
165
+ - `dialtone utility "<query>" --format json` — utility class data
166
+
167
+ Always use `--format json` when processing results programmatically.
168
+ ```
169
+
170
+ ### CLI vs MCP Server
171
+
172
+ Install both. They're complementary — the CLI for fast lookups, the MCP server for deep exploration.
173
+
174
+ **CLI** — token-efficient plain text. Best for direct lookups: "what props does this component have?", "what tokens match this query?" Returns compact output that costs minimal context window tokens.
175
+
176
+ **MCP server** — structured data + resources protocol. Best when the LLM needs to pull full datasets, cross-reference components with tokens, or reason through complex design system questions. The resources (`dialtone://components`, `dialtone://tokens`) give access to the complete data.
177
+
178
+ | Use case | Recommended |
179
+ |----------|-------------|
180
+ | Quick lookups (props, tokens, classes) | CLI |
181
+ | Deep reasoning across the design system | MCP server |
182
+ | Shell scripts and automation | CLI |
183
+ | Piping context into AI tools | CLI (`dialtone prompt`) |
184
+ | Non-Claude MCP clients (Cursor, Windsurf) | MCP server |