create-cooktype-app 0.0.4
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/LICENSE +21 -0
- package/README.md +270 -0
- package/dist/chunk-WOPP5T3O.js +2 -0
- package/dist/cli.js +32 -0
- package/dist/impl-O4X5BFME.js +837 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Derek Nelsen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# create-cooktype-app
|
|
2
|
+
|
|
3
|
+
CLI to scaffold AI-promptable monorepos with Next.js, Convex, and Shadcn/ui.
|
|
4
|
+
|
|
5
|
+
## Installation (Private Repo)
|
|
6
|
+
|
|
7
|
+
This is a private package. Team members need:
|
|
8
|
+
1. Access to the GitHub repo
|
|
9
|
+
2. [GitHub CLI](https://cli.github.com/) installed and authenticated (`gh auth login`)
|
|
10
|
+
|
|
11
|
+
### Install the CLI
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Download the latest release and install
|
|
15
|
+
gh release download v0.0.1 --repo dereknelsen/cooktype-cli --pattern "*.tgz" --output /tmp/cooktype.tgz
|
|
16
|
+
npm install -g /tmp/cooktype.tgz
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or as a one-liner:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
gh release download v0.0.1 -R dereknelsen/cooktype-cli -p "*.tgz" -O- | npm install -g /dev/stdin
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Updating the CLI
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Check current version
|
|
29
|
+
create-cooktype-app --version
|
|
30
|
+
|
|
31
|
+
# Update to latest
|
|
32
|
+
gh release download latest --repo dereknelsen/cooktype-cli --pattern "*.tgz" --output /tmp/cooktype.tgz
|
|
33
|
+
npm install -g /tmp/cooktype.tgz
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Uninstall
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm uninstall -g create-cooktype-app
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
create-cooktype-app my-app
|
|
46
|
+
cd my-app
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## What You Get
|
|
50
|
+
|
|
51
|
+
A Turborepo monorepo with:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
my-app/
|
|
55
|
+
├── apps/
|
|
56
|
+
│ └── web/ # Next.js frontend (App Router)
|
|
57
|
+
├── packages/
|
|
58
|
+
│ ├── ui/ # Shared Shadcn/ui components (@repo/ui)
|
|
59
|
+
│ └── backend/ # Convex backend (@repo/backend)
|
|
60
|
+
├── CLAUDE.md # AI assistant instructions with mode switching
|
|
61
|
+
└── turbo.json # Turborepo configuration
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Features:**
|
|
65
|
+
- All Shadcn/ui components pre-installed and extracted to a shared package
|
|
66
|
+
- Convex backend with schema and functions structure
|
|
67
|
+
- ConvexProvider already wired up in the frontend
|
|
68
|
+
- CLAUDE.md files for AI-assisted development (backend/frontend modes)
|
|
69
|
+
- GitHub Actions CI workflow
|
|
70
|
+
- TypeScript throughout
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
### Basic
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
create-cooktype-app my-app
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### With Options
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Skip git initialization
|
|
84
|
+
create-cooktype-app my-app --noGit
|
|
85
|
+
|
|
86
|
+
# Skip dependency installation
|
|
87
|
+
create-cooktype-app my-app --noInstall
|
|
88
|
+
|
|
89
|
+
# Skip Convex setup
|
|
90
|
+
create-cooktype-app my-app --noConvex-init
|
|
91
|
+
|
|
92
|
+
# Combine options
|
|
93
|
+
create-cooktype-app my-app --noInstall --noConvex-init
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Interactive Theme Selection
|
|
97
|
+
|
|
98
|
+
When you run the CLI, you'll be prompted to configure your Shadcn theme:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
? Use default Shadcn theme? (Vega style, Zinc colors, Phosphor icons) (Y/n)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Press **Y** to use defaults, or **N** to customize:
|
|
105
|
+
|
|
106
|
+
- **Style:** Vega, Nova, Maia, Lyra, Mira
|
|
107
|
+
- **Base Color:** Neutral, Stone, Zinc, Gray
|
|
108
|
+
- **Theme Color:** Base color or Amber, Blue, Cyan, Emerald, Fuchsia, Green, Indigo, Lime, Orange, Pink, Purple, Red, Rose, Sky, Teal, Violet, Yellow
|
|
109
|
+
- **Icon Library:** Lucide, Tabler, HugeIcons, Phosphor, Remix
|
|
110
|
+
- **Menu Color:** Default, Inverted
|
|
111
|
+
|
|
112
|
+
## After Scaffolding
|
|
113
|
+
|
|
114
|
+
### 1. Start the Convex Backend
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cd packages/backend
|
|
118
|
+
pnpm dev
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This will:
|
|
122
|
+
- Open your browser for Convex authentication (first time only)
|
|
123
|
+
- Generate TypeScript types in `convex/_generated/`
|
|
124
|
+
- Display your deployment URL
|
|
125
|
+
|
|
126
|
+
### 2. Configure Environment Variables
|
|
127
|
+
|
|
128
|
+
Copy the Convex URL to your web app:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# In apps/web/.env.local
|
|
132
|
+
NEXT_PUBLIC_CONVEX_URL=https://your-deployment.convex.cloud
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Or copy from the example file:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cp apps/web/.env.local.example apps/web/.env.local
|
|
139
|
+
# Then edit with your Convex URL
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 3. Start the Web App
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
cd apps/web
|
|
146
|
+
pnpm dev
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Or start everything from root (after env is configured):
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pnpm dev
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Project Structure
|
|
156
|
+
|
|
157
|
+
### apps/web
|
|
158
|
+
|
|
159
|
+
Next.js frontend with App Router.
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
// Import UI components from the shared package
|
|
163
|
+
import { Button } from "@repo/ui/components/button";
|
|
164
|
+
import { Card } from "@repo/ui/components/card";
|
|
165
|
+
|
|
166
|
+
// Import Convex hooks and API
|
|
167
|
+
import { useQuery, useMutation } from "convex/react";
|
|
168
|
+
import { api } from "@repo/backend/convex/_generated/api";
|
|
169
|
+
|
|
170
|
+
export function MyComponent() {
|
|
171
|
+
const users = useQuery(api.functions.users.list);
|
|
172
|
+
const createUser = useMutation(api.functions.users.create);
|
|
173
|
+
// ...
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### packages/ui
|
|
178
|
+
|
|
179
|
+
Shared Shadcn/ui component library. All components are pre-installed.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Add more components
|
|
183
|
+
cd packages/ui
|
|
184
|
+
pnpm dlx shadcn@latest add <component-name>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### packages/backend
|
|
188
|
+
|
|
189
|
+
Convex backend with real-time database and serverless functions.
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
convex/
|
|
193
|
+
├── _generated/ # Auto-generated types (don't edit)
|
|
194
|
+
├── functions/ # Your queries, mutations, actions
|
|
195
|
+
└── schema.ts # Database schema
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## CLAUDE.md Mode Switching
|
|
199
|
+
|
|
200
|
+
The generated `CLAUDE.md` files enable AI assistants to switch between specialized modes:
|
|
201
|
+
|
|
202
|
+
**Backend Mode** (prefix with `backend:`):
|
|
203
|
+
- Focus on Convex schema, queries, mutations, actions
|
|
204
|
+
- Work in `packages/backend/convex/`
|
|
205
|
+
- Use proper validators, indexes, and Convex patterns
|
|
206
|
+
|
|
207
|
+
**Frontend Mode** (prefix with `frontend:`):
|
|
208
|
+
- Focus on layout, design, animation, polish
|
|
209
|
+
- Work in `apps/web/`
|
|
210
|
+
- Follow design system guidelines
|
|
211
|
+
|
|
212
|
+
Example prompts:
|
|
213
|
+
```
|
|
214
|
+
backend: Add a posts table with author reference and create CRUD functions
|
|
215
|
+
|
|
216
|
+
frontend: Create a dashboard page with a sidebar and user list
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Commands
|
|
220
|
+
|
|
221
|
+
From the project root:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
pnpm dev # Start all apps in development
|
|
225
|
+
pnpm build # Build all packages
|
|
226
|
+
pnpm lint # Lint all packages
|
|
227
|
+
pnpm typecheck # Type check all packages
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Requirements
|
|
231
|
+
|
|
232
|
+
- Node.js 20+
|
|
233
|
+
- pnpm (recommended) or npm
|
|
234
|
+
- [GitHub CLI](https://cli.github.com/) for installation
|
|
235
|
+
|
|
236
|
+
## Releasing New Versions (Maintainers)
|
|
237
|
+
|
|
238
|
+
Releases are automated via GitHub Actions. To release:
|
|
239
|
+
|
|
240
|
+
1. Update version in `package.json`
|
|
241
|
+
2. Commit and push:
|
|
242
|
+
```bash
|
|
243
|
+
git add -A
|
|
244
|
+
git commit -m "Bump version to X.Y.Z"
|
|
245
|
+
git push
|
|
246
|
+
```
|
|
247
|
+
3. Create and push a tag:
|
|
248
|
+
```bash
|
|
249
|
+
git tag vX.Y.Z
|
|
250
|
+
git push origin vX.Y.Z
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
The GitHub Action will automatically build, pack, and create a release with the tarball.
|
|
254
|
+
|
|
255
|
+
Team members can then update with:
|
|
256
|
+
```bash
|
|
257
|
+
gh release download vX.Y.Z --repo dereknelsen/cooktype-cli --pattern "*.tgz" --output /tmp/cooktype.tgz
|
|
258
|
+
npm install -g /tmp/cooktype.tgz
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Acknowledgments
|
|
262
|
+
|
|
263
|
+
The AI-assisted development guidelines (CLAUDE.md files) are inspired by:
|
|
264
|
+
|
|
265
|
+
- **[Convex Chef](https://chef.convex.dev/)** — Convex's AI assistant for building real-time backends. The backend mode guidelines are adapted from Chef's system prompts.
|
|
266
|
+
- **[Vercel v0](https://v0.dev/)** — Vercel's generative UI tool. The frontend mode design system and component patterns are inspired by v0's approach to building polished interfaces.
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
MIT — see [LICENSE](./LICENSE) for details.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,c,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(e=h(b,d))||e.enumerable});return a};var o=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
3
|
+
import"./chunk-WOPP5T3O.js";function se(e,n){let t=e.env?.[n];return typeof t=="string"&&t!=="0"}var S={UnknownCommand:-5,InvalidArgument:-4,ContextLoadError:-3,CommandLoadError:-2,InternalError:-1,Success:0,CommandRunError:1};function z(e){return e.replace(/-./g,n=>n[1].toUpperCase())}function A(e){return Array.from(e).map((n,t)=>{let c=n.toUpperCase(),r=n.toLowerCase();return t===0||c!==n||c===r?n:`-${r}`}).join("")}function Ae(e){let n=new Map;return{get:(...t)=>n.get(t.join(","))??e,set:(t,...c)=>{n.set(c.join(","),t)}}}function Se(e,n,t){let{threshold:c,weights:r}=t;if(e===n)return 0;let i=Math.abs(e.length-n.length);if(typeof c=="number"&&i>c)return 1/0;let o=Ae(1/0);o.set(0,-1,-1);for(let s=0;s<n.length;++s)o.set((s+1)*r.insertion,-1,s);for(let s=0;s<e.length;++s)o.set((s+1)*r.deletion,s,-1);let u=-1/0;for(let s=0;s<e.length;++s){let d=1/0;for(let a=0;a<=n.length-1;++a){let f=e[s]===n[a]?0:1,m=[o.get(s-1,a)+r.deletion,o.get(s,a-1)+r.insertion,o.get(s-1,a-1)+f*r.substitution];e[s]===n[a-1]&&e[s-1]===n[a]&&m.push(o.get(s-2,a-2)+f*r.transposition);let p=Math.min(...m);o.set(p,s,a),p<d&&(d=p)}if(d>c){if(u>c)return 1/0;u=d}else u=-1/0}let l=o.get(e.length-1,n.length-1);return l>c?1/0:l}function Fe(e,n,t){let c=e[1]-n[1];if(c!==0)return c;let r=e[0].startsWith(t),i=n[0].startsWith(t);return r&&!i?-1:!r&&i?1:e[0].localeCompare(n[0])}function U(e,n,t){let c=n.map(i=>[i,Se(e,i,t)]).filter(([,i])=>i<=t.threshold),r=Math.min(...c.map(([,i])=>i));return c.filter(([,i])=>i===r).sort((i,o)=>Fe(i,o,e)).map(([i])=>i)}var w=class extends Error{};function O(e){return e instanceof Error?e.stack??String(e):String(e)}function ke(e,n){let t=[],c=Math.max(e.length,n.length);for(let r=0;r<c;++r)t[r]=Math.max(e[r],n[r]);return t}function P(e,n){if(e.length===0)return[];let t=Array(Math.max(...e.map(r=>r.length))).fill(0,0),c=e.reduce((r,i)=>{let o=i.map(u=>u.length);return ke(r,o)},t);return e.map(r=>{let i=(r[0]??"").padEnd(c[0]);return r.slice(1).reduce((o,u,l,s)=>{let d=s.length===l+1?u:u.padEnd(c[l+1]);return[...o,n?.[l]??" ",d]},[i]).join("").trimEnd()})}function K(e,n){if(e.length<=1)return e[0]??"";if(e.length===2)return e.join(` ${n.conjunction} `);let t=e.slice(0,e.length-1).join(", ");return n.serialComma&&(t+=","),[t,n.conjunction,e[e.length-1]].join(" ")}function Be(e,n){return e.reduce((t,c)=>{let r=n(c),i=t[r]??[];return i.push(c),t[r]=i,t},{})}function Ee(e,n){return Be(e,t=>t[n])}async function V(e){let n=await Promise.allSettled(e),t=Ee(n,"status");return t.rejected&&t.rejected.length>0?{status:"rejected",reasons:t.rejected.map(c=>c.reason)}:{status:"fulfilled",value:t.fulfilled?.map(c=>c.value)??[]}}var Ie=new Set(["true","t","yes","y","on","1"]),Le=new Set(["false","f","no","n","off","0"]),je=e=>{let n=e.toLowerCase();if(Ie.has(n))return!0;if(Le.has(n))return!1;throw new SyntaxError(`Cannot convert ${e} to a boolean`)},Ne=e=>{let n=Number(e);if(Number.isNaN(n))throw new SyntaxError(`Cannot convert ${e} to a number`);return n},k=class extends w{_brand};function Re(e,n){let t=e.constructor.name,c=n[t];return c?c(e):e.message}function Ue(e,n,t){return Object.fromEntries(Object.entries(n).map(([c,r])=>{let i=r,o=e[i];if(!o){let u=E(i,t);throw new R(u,[],c)}return[c,[i,o]]}))}var R=class extends k{input;corrections;aliasName;constructor(e,n,t){let c=`No flag registered for --${e}`;if(t)c+=` (aliased from -${t})`;else if(n.length>0){let r=K(n.map(i=>`--${i}`),{kind:"conjunctive",conjunction:"or",serialComma:!0});c+=`, did you mean ${r}?`}super(c),this.input=e,this.corrections=n,this.aliasName=t}},G=class extends k{input;constructor(e){super(`No alias registered for -${e}`),this.input=e}};function q(e,n){return e.placeholder?e.placeholder:typeof n=="number"?`arg${n}`:"args"}function E(e,n){return n==="allow-kebab-for-camel"?A(e):e}var _=class extends k{externalFlagNameOrPlaceholder;input;exception;constructor(e,n,t){super(`Failed to parse "${n}" for ${e}: ${t instanceof Error?t.message:String(t)}`),this.externalFlagNameOrPlaceholder=e,this.input=n,this.exception=t}};function j(e,n,t,c){try{return n.parse.call(c,t)}catch(r){throw new _(e,t,r)}}var W=class extends k{externalFlagName;input;values;constructor(e,n,t,c){let r=`Expected "${n}" to be one of (${t.join("|")})`;if(c.length>0){let i=K(c.map(o=>`"${o}"`),{kind:"conjunctive",conjunction:"or",serialComma:!0});r+=`, did you mean ${i}?`}super(r),this.externalFlagName=e,this.input=n,this.values=t}},N=class extends k{externalFlagName;nextFlagName;constructor(e,n){let t=`Expected input for flag --${e}`;n&&(t+=` but encountered --${n} instead`),super(t),this.externalFlagName=e,this.nextFlagName=n}},X=class extends k{expectedCount;input;constructor(e,n){super(`Too many arguments, expected ${e} but encountered "${n}"`),this.expectedCount=e,this.input=n}},Z=class extends k{placeholder;limit;constructor(e,n){let t;n?(t=`Expected at least ${n[0]} argument(s) for ${e}`,n[1]===0?t+=" but found none":t+=` but only found ${n[1]}`):t=`Expected argument for ${e}`,super(t),this.placeholder=e,this.limit=n}};function ee(e){if(e.startsWith("no")&&e.length>2){if(e[2]==="-")return e.slice(4);let n=e[2],t=n.toUpperCase();return n!==t?void 0:n.toLowerCase()+e.slice(3)}}function ie(e,n,t){let c=e,r=n[c],i,o=!1;if(!r){let l=ee(c);if(l&&(r=n[l],r&&r.kind=="boolean")){if(r.withNegated!==!1)return{namedFlag:[l,r],negated:!0};i=l,r=void 0}}let u=z(e);if(t.caseStyle==="allow-kebab-for-camel"&&!r){if(r=n[u],r)return{namedFlag:[u,r]};let l=ee(u);if(l&&(r=n[l],r&&r.kind=="boolean")){if(r.withNegated!==!1)return{namedFlag:[l,r],negated:!0};i=l,o=!0,r=void 0}}if(!r){if(i){let d=i;throw o&&e.includes("-")&&(d=A(i)),new R(e,[d])}if(u in n)throw new R(e,[u]);let l=A(e);if(l in n)throw new R(e,[l]);let s=U(c,Object.keys(n),t.distanceOptions);throw new R(e,s)}return{namedFlag:[c,r]}}function te(e){return e.namedFlag[1].kind==="boolean"||e.namedFlag[1].kind==="counter"}var ae=/^-([a-z]+)$/i,Me=/^--([a-z][a-z-.\d_]+)$/i;function Oe(e,n,t,c){let r=ae.exec(e);if(r){let o=r[1];return Array.from(o).map(u=>{let l=u,s=t[l];if(!s)throw new G(l);return{namedFlag:s}})}let i=Me.exec(e);if(i){let o=i[1];return[ie(o,n,c)]}return[]}var Pe=/^--([a-z][a-z-.\d_]+)=(.+)$/i,Te=/^-([a-z])=(.+)$/i,He=class extends k{externalFlagName;valueText;constructor(e,n){super(`Cannot negate flag --${e} and pass "${n}" as value`),this.externalFlagName=e,this.valueText=n}};function Ve(e,n,t,c){let r=Pe.exec(e);if(r){let o=r[1],{namedFlag:u,negated:l}=ie(o,n,c),s=r[2];if(l)throw new He(o,s);return[u,s]}let i=Te.exec(e);if(i){let o=i[1],u=t[o];if(!u)throw new G(o);let l=i[2];return[u,l]}}async function qe(e,n,t,c,r){if(!t){if("default"in n&&typeof n.default<"u"){if(n.kind==="boolean")return n.default;if(n.kind==="enum"){if("variadic"in n&&n.variadic&&Array.isArray(n.default)){let o=n.default;for(let u of o)if(!n.values.includes(u)){let l=U(u,n.values,c.distanceOptions);throw new W(e,u,n.values,l)}return n.default}return n.default}if("variadic"in n&&n.variadic&&Array.isArray(n.default)){let o=n.default;return Promise.all(o.map(u=>j(e,n,u,r)))}return j(e,n,n.default,r)}if(n.optional)return;if(n.kind==="boolean")return!1;if(n.kind==="counter")return 0;throw new N(e)}if(n.kind==="counter")return t.reduce((o,u)=>{try{return o+Ne.call(r,u)}catch(l){throw new _(e,u,l)}},0);if("variadic"in n&&n.variadic){if(n.kind==="enum"){for(let o of t)if(!n.values.includes(o)){let u=U(o,n.values,c.distanceOptions);throw new W(e,o,n.values,u)}return t}return Promise.all(t.map(o=>j(e,n,o,r)))}let i=t[0];if(n.kind==="boolean")try{return je.call(r,i)}catch(o){throw new _(e,i,o)}if(n.kind==="enum"){if(!n.values.includes(i)){let o=U(i,n.values,c.distanceOptions);throw new W(e,i,n.values,o)}return i}return j(e,n,i,r)}var We=class extends k{externalFlagName;previousInput;input;constructor(e,n,t){super(`Too many arguments for --${e}, encountered "${t}" after "${n}"`),this.externalFlagName=e,this.previousInput=n,this.input=t}};function le(e){return e.kind==="counter"?!0:"variadic"in e?!!e.variadic:!1}function B(e,n,[t,c],r){let i=e.get(t)??[];if(i.length>0&&!le(c)){let o=E(t,n);throw new We(o,i[0],r)}if("variadic"in c&&typeof c.variadic=="string"){let o=r.split(c.variadic);e.set(t,[...i,...o])}else e.set(t,[...i,r])}function D(e,n,t){if(n.get(t)){let r=e[t];return!le(r)}return!1}function De(e,n){let{flags:t={},aliases:c={},positional:r={kind:"tuple",parameters:[]}}=e,i=Ue(t,c,n.caseStyle),o=[],u=new Map,l=0,s,d=!1;return{next:a=>{if(!d&&n.allowArgumentEscapeSequence&&a==="--"){if(s)if(s[1].kind==="parsed"&&s[1].inferEmpty)B(u,n.caseStyle,s,""),s=void 0;else{let f=E(s[0],n.caseStyle);throw new N(f)}d=!0;return}if(!d){let f=Ve(a,t,i,n);if(f){if(s)if(s[1].kind==="parsed"&&s[1].inferEmpty)B(u,n.caseStyle,s,""),s=void 0;else{let p=E(s[0],n.caseStyle),v=E(f[0][0],n.caseStyle);throw new N(p,v)}B(u,n.caseStyle,...f);return}let m=Oe(a,t,i,n);if(m.length>0){if(s)if(s[1].kind==="parsed"&&s[1].inferEmpty)B(u,n.caseStyle,s,""),s=void 0;else{let p=E(s[0],n.caseStyle),v=E(m[0].namedFlag[0],n.caseStyle);throw new N(p,v)}if(m.every(te))for(let p of m)p.namedFlag[1].kind==="boolean"?B(u,n.caseStyle,p.namedFlag,p.negated?"false":"true"):B(u,n.caseStyle,p.namedFlag,"1");else if(m.length>1){let p=m.find(x=>!te(x)),v=E(p.namedFlag[0],n.caseStyle);throw new N(v)}else s=m[0].namedFlag;return}}if(s)B(u,n.caseStyle,s,a),s=void 0;else{if(r.kind==="tuple"){if(l>=r.parameters.length)throw new X(r.parameters.length,a)}else if(typeof r.maximum=="number"&&l>=r.maximum)throw new X(r.maximum,a);o[l]=a,++l}},parseArguments:async a=>{let f=[],m;r.kind==="array"?(typeof r.minimum=="number"&&l<r.minimum&&f.push(new Z(q(r.parameter),[r.minimum,l])),m=V(o.map(async(h,b)=>{let y=q(r.parameter,b+1);return j(y,r.parameter,h,a)}))):m=V(r.parameters.map(async(h,b)=>{let y=q(h,b+1),g=o[b];if(typeof g!="string"){if(typeof h.default=="string")return j(y,h,h.default,a);if(h.optional)return;throw new Z(y)}return j(y,h,g,a)})),s&&s[1].kind==="parsed"&&s[1].inferEmpty&&(B(u,n.caseStyle,s,""),s=void 0);let p=V(Object.entries(t).map(async h=>{let[b,y]=h,g=E(b,n.caseStyle);if(s&&s[0]===b)throw new N(g);let $=u.get(b),L=await qe(g,y,$,n,a);return[b,L]})),[v,x]=await Promise.all([m,p]);if(v.status==="rejected")for(let h of v.reasons)f.push(h);if(x.status==="rejected")for(let h of x.reasons)f.push(h);if(f.length>0)return{success:!1,errors:f};if(v.status==="rejected")throw new w("Unknown failure while scanning positional arguments");if(x.status==="rejected")throw new w("Unknown failure while scanning flag arguments");return{success:!0,arguments:[Object.fromEntries(x.value),...v.value]}},proposeCompletions:async({partial:a,completionConfig:f,text:m,context:p,includeVersionFlag:v})=>{if(s)return ce(s[1],p,a);let x=[];if(!d){let C=ae.exec(a);if(f.includeAliases){if(a===""||a==="-"){let h=Object.entries(c).filter(b=>!D(t,u,b[1]));for(let[b]of h){let y=i[b];y&&x.push({kind:"argument:flag",completion:`-${b}`,brief:y[1].brief})}}else if(C){let h=Array.from(C[1]);if(h.includes("h"))return[];if(v&&h.includes("v"))return[];let b=new Map(u);for(let $ of h){let L=i[$];if(!L)throw new G($);B(b,n.caseStyle,L,L[1].kind==="boolean"?"true":"1")}let y=h[h.length-1];if(y){let $=i[y];$&&x.push({kind:"argument:flag",completion:a,brief:$[1].brief})}let g=Object.entries(c).filter($=>!D(t,b,$[1]));for(let[$]of g){let L=i[$];L&&x.push({kind:"argument:flag",completion:`${a}${$}`,brief:L[1].brief})}}}if(a===""||a==="-"||a.startsWith("--")){n.allowArgumentEscapeSequence&&x.push({kind:"argument:flag",completion:"--",brief:m.briefs.argumentEscapeSequence});let h=Object.entries(t).filter(([y])=>!D(t,u,y));n.caseStyle==="allow-kebab-for-camel"&&(h=h.map(([y,g])=>[A(y),g]));let b=h.map(([y,g])=>[`--${y}`,g]).filter(([y])=>y.startsWith(a));x.push(...b.map(([y,g])=>({kind:"argument:flag",completion:y,brief:g.brief})))}}if(r.kind==="array"){if(r.parameter.proposeCompletions&&(typeof r.maximum!="number"||l<r.maximum)){let C=await r.parameter.proposeCompletions.call(p,a);x.push(...C.map(h=>({kind:"argument:value",completion:h,brief:r.parameter.brief})))}}else{let C=r.parameters[l];if(C?.proposeCompletions){let h=await C.proposeCompletions.call(p,a);x.push(...h.map(b=>({kind:"argument:value",completion:b,brief:C.brief})))}}return x.filter(({completion:C})=>C.startsWith(a))}}}async function ce(e,n,t){if(typeof e.variadic=="string"&&t.endsWith(e.variadic))return ce(e,n,"");let c;return e.kind==="enum"?c=e.values:e.proposeCompletions?c=await e.proposeCompletions.call(n,t):c=[],c.map(r=>({kind:"argument:value",completion:r,brief:e.brief})).filter(({completion:r})=>r.startsWith(t))}function _e(e,n,t){let c=n==="allow-kebab-for-camel"?"convert-camel-to-kebab":n,r=e.getAllEntries();return t.includeHiddenRoutes||(r=r.filter(i=>!i.hidden)),r.flatMap(i=>{let o=i.name[c];return t.includeAliases?[o,...i.aliases]:[o]})}var ze={headers:{usage:"USAGE",aliases:"ALIASES",commands:"COMMANDS",flags:"FLAGS",arguments:"ARGUMENTS"},keywords:{default:"default =",separator:"separator ="},briefs:{help:"Print help information and exit",helpAll:"Print help information (including hidden commands/flags) and exit",version:"Print version information and exit",argumentEscapeSequence:"All subsequent inputs should be interpreted as arguments"},noCommandRegisteredForInput:({input:e,corrections:n})=>{let t=`No command registered for \`${e}\``;if(n.length>0){let c=K(n,{kind:"conjunctive",conjunction:"or",serialComma:!0});return`${t}, did you mean ${c}?`}else return t},noTextAvailableForLocale:({requestedLocale:e,defaultLocale:n})=>`Application does not support "${e}" locale, defaulting to "${n}"`,exceptionWhileParsingArguments:e=>e instanceof k?Re(e,{}):`Unable to parse arguments, ${O(e)}`,exceptionWhileLoadingCommandFunction:e=>`Unable to load command function, ${O(e)}`,exceptionWhileLoadingCommandContext:e=>`Unable to load command context, ${O(e)}`,exceptionWhileRunningCommand:e=>`Command failed, ${O(e)}`,commandErrorResult:e=>e.message,currentVersionIsNotLatest:({currentVersion:e,latestVersion:n,upgradeCommand:t})=>t?`Latest available version is ${n} (currently running ${e}), upgrade with "${t}"`:`Latest available version is ${n} (currently running ${e})`};function Ke(e){if(e.startsWith("en"))return ze}function F(e,n,t){return!t.disableAnsiColor&&!se(e,"STRICLI_NO_COLOR")&&(n.getColorDepth?.(e.env)??1)>=4}async function Ge({loader:e,parameters:n},{context:t,inputs:c,scannerConfig:r,errorFormatting:i,documentationConfig:o,determineExitCode:u}){let l;try{let d=De(n,r);for(let f of c)d.next(f);let a=await d.parseArguments(t);if(a.success)l=a.arguments;else{let f=F(t.process,t.process.stderr,o);for(let m of a.errors){let p=i.exceptionWhileParsingArguments(m,f);t.process.stderr.write(f?`\x1B[1m\x1B[31m${p}\x1B[39m\x1B[22m
|
|
4
|
+
`:`${p}
|
|
5
|
+
`)}return S.InvalidArgument}}catch(d){let a=F(t.process,t.process.stderr,o),f=i.exceptionWhileParsingArguments(d,a);return t.process.stderr.write(a?`\x1B[1m\x1B[31m${f}\x1B[39m\x1B[22m
|
|
6
|
+
`:`${f}
|
|
7
|
+
`),S.InvalidArgument}let s;try{let d=await e();typeof d=="function"?s=d:s=d.default}catch(d){let a=F(t.process,t.process.stderr,o),f=i.exceptionWhileLoadingCommandFunction(d,a);return t.process.stderr.write(a?`\x1B[1m\x1B[31m${f}\x1B[39m\x1B[22m
|
|
8
|
+
`:`${f}
|
|
9
|
+
`),S.CommandLoadError}try{let d=await s.call(t,...l);if(d instanceof Error){let a=F(t.process,t.process.stderr,o),f=i.commandErrorResult(d,a);return t.process.stderr.write(a?`\x1B[1m\x1B[31m${f}\x1B[39m\x1B[22m
|
|
10
|
+
`:`${f}
|
|
11
|
+
`),u?u(d):S.CommandRunError}}catch(d){let a=F(t.process,t.process.stderr,o),f=i.exceptionWhileRunningCommand(d,a);return t.process.stderr.write(a?`\x1B[1m\x1B[31m${f}\x1B[39m\x1B[22m
|
|
12
|
+
`:`${f}
|
|
13
|
+
`),u?u(d):S.CommandRunError}return S.Success}var T=Symbol("RouteMap"),J=Symbol("Command");function Je(e,n,t){let c=[...t],r=[],i,o=e,u,l=!0,s=!1;return{next:d=>{if(d==="--help"||d==="-h"){s=!0,u||(u=o);return}else if(d==="--helpAll"||d==="--help-all"||d==="-H"){s="all",u||(u=o);return}if(u){r.push(d);return}if(o.kind===J){u=o,r.push(d);return}let a=z(d),f=d,m=o.getRoutingTargetForInput(f);if(n.caseStyle==="allow-kebab-for-camel"&&!m&&(m=o.getRoutingTargetForInput(a),m&&(f=a)),!m){let p=o.getDefaultCommand();if(p){l=!1,i=[o,""],r.push(d),o=p;return}return{input:d,routeMap:o}}l=!1,i=[o,d],o=m,c.push(d)},finish:()=>{if(u=u??o,u.kind===T&&!s){let a=u.getDefaultCommand();a&&(i=[u,""],u=a,l=!1)}let d=i?i[0].getOtherAliasesForInput(i[1],n.caseStyle):{original:[],"convert-camel-to-kebab":[]};return{target:u,unprocessedInputs:r,helpRequested:s,prefix:c,rootLevel:l,aliases:d}}}}async function Ye({root:e,defaultText:n,config:t},c,r){let i=n;if(r.locale){let a=t.localization.loadText(r.locale);if(a)i=a;else{let f=F(r.process,r.process.stderr,t.documentation),m=i.noTextAvailableForLocale({requestedLocale:r.locale,defaultLocale:t.localization.defaultLocale,ansiColor:f});r.process.stderr.write(f?`\x1B[1m\x1B[33m${m}\x1B[39m\x1B[22m
|
|
14
|
+
`:`${m}
|
|
15
|
+
`)}}if(t.versionInfo?.getLatestVersion&&!se(r.process,"STRICLI_SKIP_VERSION_CHECK")){let a;"currentVersion"in t.versionInfo?a=t.versionInfo.currentVersion:a=await t.versionInfo.getCurrentVersion.call(r);let f=await t.versionInfo.getLatestVersion.call(r,a);if(f&&a!==f){let m=F(r.process,r.process.stderr,t.documentation),p=i.currentVersionIsNotLatest({currentVersion:a,latestVersion:f,upgradeCommand:t.versionInfo.upgradeCommand,ansiColor:m});r.process.stderr.write(m?`\x1B[1m\x1B[33m${p}\x1B[39m\x1B[22m
|
|
16
|
+
`:`${p}
|
|
17
|
+
`)}}let o=c.slice();if(t.versionInfo&&(o[0]==="--version"||o[0]==="-v")){let a;return"currentVersion"in t.versionInfo?a=t.versionInfo.currentVersion:a=await t.versionInfo.getCurrentVersion.call(r),r.process.stdout.write(a+`
|
|
18
|
+
`),S.Success}let u=Je(e,t.scanner,[t.name]),l;for(;o.length>0&&!l;){let a=o.shift();l=u.next(a)}if(l){let a=_e(l.routeMap,t.scanner.caseStyle,t.completion),f=U(l.input,a,t.scanner.distanceOptions).map(v=>`\`${v}\``),m=F(r.process,r.process.stderr,t.documentation),p=i.noCommandRegisteredForInput({input:l.input,corrections:f,ansiColor:m});return r.process.stderr.write(m?`\x1B[1m\x1B[31m${p}\x1B[39m\x1B[22m
|
|
19
|
+
`:`${p}
|
|
20
|
+
`),S.UnknownCommand}let s=u.finish();if(s.helpRequested||s.target.kind===T){let a=F(r.process,r.process.stdout,t.documentation);return r.process.stdout.write(s.target.formatHelp({prefix:s.prefix,includeVersionFlag:!!t.versionInfo&&s.rootLevel,includeArgumentEscapeSequenceFlag:t.scanner.allowArgumentEscapeSequence,includeHelpAllFlag:s.helpRequested==="all"||t.documentation.alwaysShowHelpAllFlag,includeHidden:s.helpRequested==="all",config:t.documentation,aliases:s.aliases[t.documentation.caseStyle],text:i,ansiColor:a})),S.Success}let d;if("forCommand"in r)try{d=await r.forCommand({prefix:s.prefix})}catch(a){let f=F(r.process,r.process.stderr,t.documentation),m=i.exceptionWhileLoadingCommandContext(a,f);return r.process.stderr.write(f?`\x1B[1m\x1B[31m${m}\x1B[39m\x1B[22m`:m),S.ContextLoadError}else d=r;return Ge(s.target,{context:d,inputs:s.unprocessedInputs,scannerConfig:t.scanner,documentationConfig:t.documentation,errorFormatting:i,determineExitCode:t.determineExitCode})}function H(e,n){return n==="convert-camel-to-kebab"?A(e):e}function Qe(e,n){return n==="convert-camel-to-kebab"?`no-${A(e)}`:`no${e[0].toUpperCase()}${e.slice(1)}`}function Xe(e){let n=e.scanner?.caseStyle??"original",t;if(e.documentation?.caseStyle){if(n==="original"&&e.documentation.caseStyle==="convert-camel-to-kebab")throw new w("Cannot convert route and flag names on display but scan as original");t=e.documentation.caseStyle}else n==="allow-kebab-for-camel"?t="convert-camel-to-kebab":t=n;let c={caseStyle:n,allowArgumentEscapeSequence:e.scanner?.allowArgumentEscapeSequence??!1,distanceOptions:e.scanner?.distanceOptions??{threshold:7,weights:{insertion:1,deletion:3,substitution:2,transposition:0}}},r={alwaysShowHelpAllFlag:e.documentation?.alwaysShowHelpAllFlag??!1,useAliasInUsageLine:e.documentation?.useAliasInUsageLine??!1,onlyRequiredInUsageLine:e.documentation?.onlyRequiredInUsageLine??!1,caseStyle:t,disableAnsiColor:e.documentation?.disableAnsiColor??!1},i={includeAliases:e.completion?.includeAliases??r.useAliasInUsageLine,includeHiddenRoutes:e.completion?.includeHiddenRoutes??!1,...e.completion};return{...e,scanner:c,completion:i,documentation:r,localization:{defaultLocale:"en",loadText:Ke,...e.localization}}}function ue(e,n){let t=Xe(n);if(e.kind===J&&t.versionInfo){if(e.usesFlag("version"))throw new w("Unable to use command with flag --version as root when version info is supplied");if(e.usesFlag("v"))throw new w("Unable to use command with alias -v as root when version info is supplied")}let c=t.localization.loadText(t.localization.defaultLocale);if(!c)throw new w(`No text available for the default locale "${t.localization.defaultLocale}"`);return{root:e,config:t,defaultText:c}}function de(e){return"default"in e&&typeof e.default<"u"}function M(e){return e.optional??de(e)}function ne(e){return`(${e})`}function re(e){return`[${e}]`}function oe(e){return`${e}...`}function Ze(e){return`<${e}>`}function et(e){return`[<${e}>]`}function tt(e){return`<${e}>...`}function fe(e,n){let t=Object.entries(e.flags??{}).filter(([,i])=>!(i.hidden||n.config.onlyRequiredInUsageLine&&M(i))).map(([i,o])=>{let u=n.config.caseStyle==="convert-camel-to-kebab"?`--${A(i)}`:`--${i}`;if(e.aliases&&n.config.useAliasInUsageLine){let s=Object.entries(e.aliases).filter(d=>d[1]===i);s.length===1&&s[0]&&(u=`-${s[0][0]}`)}if(o.kind==="boolean")return[o,u];if(o.kind==="enum"&&typeof o.placeholder!="string")return[o,`${u} ${o.values.join("|")}`];let l=o.placeholder??"value";return[o,`${u} ${l}`]}).map(([i,o])=>i.kind==="parsed"&&i.variadic?M(i)?oe(re(o)):oe(ne(o)):M(i)?re(o):ne(o)),c=[],r=e.positional;if(r)if(r.kind==="array")c=[tt(r.parameter.placeholder??"args")];else{let i=r.parameters;n.config.onlyRequiredInUsageLine&&(i=i.filter(o=>!o.optional&&typeof o.default>"u")),c=i.map((o,u)=>{let l=o.placeholder??`arg${u+1}`;return o.optional||typeof o.default<"u"?et(l):Ze(l)})}return[...n.prefix,...t,...c].join(" ")}function me(e,n,t){let{keywords:c,briefs:r}=t.text,i=Object.entries(e).filter(([,l])=>!(l.hidden&&!t.includeHidden)),o=i.some(([,l])=>M(l)),u=i.map(([l,s])=>{let d=Object.entries(n).filter(p=>p[1]===l).map(([p])=>`-${p}`),a="--"+H(l,t.config.caseStyle);if(s.kind==="boolean"&&s.default!==!1&&s.withNegated!==!1){let p=Qe(l,t.config.caseStyle);a=`${a}/--${p}`}M(s)?a=`[${a}]`:o&&(a=` ${a}`),s.kind==="parsed"&&s.variadic&&(a=`${a}...`);let f=[];if(s.kind==="enum"){let p=s.values.join("|");f.push(p)}if(de(s)){let p=t.ansiColor?`\x1B[90m${c.default}\x1B[39m`:c.default,v;if(Array.isArray(s.default))if(s.default.length===0)v="[]";else{let x="variadic"in s&&typeof s.variadic=="string"?s.variadic:" ";v=s.default.join(x)}else v=s.default===""?'""':String(s.default);f.push(`${p} ${v}`)}if("variadic"in s&&typeof s.variadic=="string"){let p=t.ansiColor?`\x1B[90m${c.separator}\x1B[39m`:c.separator;f.push(`${p} ${s.variadic}`)}let m=f.length>0?`[${f.join(", ")}]`:void 0;return{aliases:d.join(" "),flagName:a,brief:s.brief,suffix:m,hidden:s.hidden}});if(u.push({aliases:"-h",flagName:o?" --help":"--help",brief:r.help}),t.includeHelpAllFlag){let l=H("helpAll",t.config.caseStyle);u.push({aliases:"-H",flagName:o?` --${l}`:`--${l}`,brief:r.helpAll,hidden:!t.config.alwaysShowHelpAllFlag})}return t.includeVersionFlag&&u.push({aliases:"-v",flagName:o?" --version":"--version",brief:r.version}),t.includeArgumentEscapeSequenceFlag&&u.push({aliases:"",flagName:o?" --":"--",brief:r.argumentEscapeSequence}),P(u.map(l=>t.ansiColor?[l.hidden?`\x1B[90m${l.aliases}\x1B[39m`:`\x1B[97m${l.aliases}\x1B[39m`,l.hidden?`\x1B[90m${l.flagName}\x1B[39m`:`\x1B[97m${l.flagName}\x1B[39m`,l.hidden?`\x1B[90m${l.brief}\x1B[39m`:`\x1B[03m${l.brief}\x1B[23m`,l.suffix??""]:[l.aliases,l.flagName,l.brief,l.suffix??""]),[" "," "," "])}function*pe(e){if(yield e.config.useAliasInUsageLine?"-h":"--help",e.includeHelpAllFlag){let n=H("helpAll",e.config.caseStyle);yield e.config.useAliasInUsageLine?"-H":`--${n}`}e.includeVersionFlag&&(yield e.config.useAliasInUsageLine?"-v":"--version")}function nt(e,n){if(e.kind==="array"){let r=e.parameter.placeholder??"args",i=n.ansiColor?`\x1B[97m${r}...\x1B[39m`:`${r}...`,o=n.ansiColor?`\x1B[3m${e.parameter.brief}\x1B[23m`:e.parameter.brief;return P([[i,o]],[" "])}let{keywords:t}=n.text,c=e.parameters.some(r=>r.optional);return P(e.parameters.map((r,i)=>{let o=r.placeholder??`arg${i+1}`,u;return r.optional?o=`[${o}]`:c&&(o=` ${o}`),r.default&&(u=`[${n.ansiColor?`\x1B[90m${t.default}\x1B[39m`:t.default} ${r.default}]`),[n.ansiColor?`\x1B[97m${o}\x1B[39m`:o,n.ansiColor?`\x1B[3m${r.brief}\x1B[23m`:r.brief,u??""]}),[" "," "])}function*rt(e,n,t){let{brief:c,fullDescription:r,customUsage:i}=n,{headers:o}=t.text,u=t.prefix.join(" ");if(yield t.ansiColor?`\x1B[1m${o.usage}\x1B[22m`:o.usage,i)for(let s of i)if(typeof s=="string")yield` ${u} ${s}`;else{let d=t.ansiColor?`\x1B[3m${s.brief}\x1B[23m`:s.brief;yield` ${u} ${s.input}
|
|
21
|
+
${d}`}else yield` ${fe(e,t)}`;for(let s of pe(t))yield` ${u} ${s}`;if(yield"",yield r??c,t.aliases&&t.aliases.length>0){let s=t.prefix.slice(0,-1).join(" ");yield"",yield t.ansiColor?`\x1B[1m${o.aliases}\x1B[22m`:o.aliases;for(let d of t.aliases)yield` ${s} ${d}`}yield"",yield t.ansiColor?`\x1B[1m${o.flags}\x1B[22m`:o.flags;for(let s of me(e.flags??{},e.aliases??{},t))yield` ${s}`;let l=e.positional??{kind:"tuple",parameters:[]};if(l.kind==="array"||l.parameters.length>0){yield"",yield t.ansiColor?`\x1B[1m${o.arguments}\x1B[22m`:o.arguments;for(let s of nt(l,t))yield` ${s}`}}function ot(e,n){for(let t of n)if(t in e)throw new w(`Unable to use reserved flag --${t}`)}function st(e,n){for(let t of n)if(t in e)throw new w(`Unable to use reserved alias -${t}`)}function*it(e){yield`no-${A(e)}`,yield`no${e[0].toUpperCase()}${e.slice(1)}`}function at(e){let n=Object.entries(e).filter(([,t])=>t.kind==="boolean"&&!t.optional);for(let[t]of n)for(let c of it(t))if(c in e)throw new w(`Unable to allow negation for --${t} as it conflicts with --${c}`)}function lt(e){for(let[n,t]of Object.entries(e))if("variadic"in t&&typeof t.variadic=="string"){if(t.variadic.length<1)throw new w(`Unable to use "" as variadic separator for --${n} as it is empty`);if(/\s/.test(t.variadic))throw new w(`Unable to use "${t.variadic}" as variadic separator for --${n} as it contains whitespace`)}}function he(e){let{flags:n={},aliases:t={}}=e.parameters;ot(n,["help","helpAll","help-all"]),st(t,["h","H"]),at(n),lt(n);let c;return"func"in e?c=async()=>e.func:c=e.loader,{kind:J,loader:c,parameters:e.parameters,get brief(){return e.docs.brief},get fullDescription(){return e.docs.fullDescription},formatUsageLine:r=>fe(e.parameters,r),formatHelp:r=>[...rt(e.parameters,e.docs,r)].join(`
|
|
22
|
+
`)+`
|
|
23
|
+
`,usesFlag:r=>r in n||r in t}}function*ct(e,n,t){let{brief:c,fullDescription:r,hideRoute:i}=n,{headers:o}=t.text;yield t.ansiColor?`\x1B[1m${o.usage}\x1B[22m`:o.usage;for(let[a,f]of Object.entries(e))if(!i||!i[a]||t.includeHidden){let m=t.config.caseStyle==="convert-camel-to-kebab"?A(a):a;yield` ${f.formatUsageLine({...t,prefix:[...t.prefix,m]})}`}let u=t.prefix.join(" ");for(let a of pe(t))yield` ${u} ${a}`;if(yield"",yield r??c,t.aliases&&t.aliases.length>0){let a=t.prefix.slice(0,-1).join(" ");yield"",yield t.ansiColor?`\x1B[1m${o.aliases}\x1B[22m`:o.aliases;for(let f of t.aliases)yield` ${a} ${f}`}yield"",yield t.ansiColor?`\x1B[1m${o.flags}\x1B[22m`:o.flags;for(let a of me({},{},t))yield` ${a}`;yield"",yield t.ansiColor?`\x1B[1m${o.commands}\x1B[22m`:o.commands;let s=Object.entries(e).filter(([a])=>!i||!i[a]||t.includeHidden).map(([a,f])=>({routeName:H(a,t.config.caseStyle),brief:f.brief,hidden:i&&i[a]})),d=P(s.map(a=>t.ansiColor?[a.hidden?`\x1B[90m${a.routeName}\x1B[39m`:`\x1B[97m${a.routeName}\x1B[39m`,a.hidden?`\x1B[90m${a.brief}\x1B[39m`:`\x1B[03m${a.brief}\x1B[23m`]:[a.routeName,a.brief]),[" "]);for(let a of d)yield` ${a}`}function ye({routes:e,defaultCommand:n,docs:t,aliases:c}){if(Object.entries(e).length===0)throw new w("Route map must contain at least one route");let r=c??{},i=new Map;for(let[l,s]of Object.entries(r)){if(l in e)throw new w(`Cannot use "${l}" as an alias when a route with that name already exists`);let d=i.get(s)??[];i.set(s,[...d,l])}let o=n?e[n]:void 0;if(o&&o.kind===T)throw new w(`Cannot use "${n}" as the default command because it is not a Command`);let u=l=>{if(l in r)return r[l];if(l in e)return l};return{kind:T,get brief(){return t.brief},get fullDescription(){return t.fullDescription},formatUsageLine(l){let s=this.getAllEntries().filter(d=>!d.hidden).map(d=>d.name[l.config.caseStyle]);return`${l.prefix.join(" ")} ${s.join("|")} ...`},formatHelp:l=>[...ct(e,t,l)].join(`
|
|
24
|
+
`)+`
|
|
25
|
+
`,getDefaultCommand:()=>o,getOtherAliasesForInput:(l,s)=>{if(n){if(l===n)return{original:[""],"convert-camel-to-kebab":[""]};if(l==="")return{original:[n],"convert-camel-to-kebab":[n]}}let d=z(l),a=u(l);if(!a&&s==="allow-kebab-for-camel"&&(a=u(d)),!a)return{original:[],"convert-camel-to-kebab":[]};let f=[a,...i.get(a)??[]].filter(m=>m!==l&&m!==d);return{original:f,"convert-camel-to-kebab":f.map(A)}},getRoutingTargetForInput:l=>{let s=l in r?r[l]:l;return e[s]},getAllEntries(){let l=t.hideRoute;return Object.entries(e).map(([s,d])=>({name:{original:s,"convert-camel-to-kebab":A(s)},target:d,aliases:i.get(s)??[],hidden:l?.[s]??!1}))}}}async function be(e,n,t){let c=await Ye(e,n,t);t.process.exitCode=c}import ut from"node:fs";import dt from"node:os";import ft from"node:path";function ve(e){return{process:e,os:dt,fs:ut,path:ft}}var xe="create-cooktype-app";var we="CLI to scaffold AI-promptable monorepos with Next.js, Convex, and Shadcn/ui";var ge="0.0.4";var $e=he({loader:async()=>import("./impl-O4X5BFME.js"),parameters:{positional:{kind:"tuple",parameters:[{brief:"project-name",parse:String}]},flags:{git:{kind:"boolean",brief:"Initialize git repository",default:!0},install:{kind:"boolean",brief:"Run pnpm install after scaffold",default:!0},"convex-init":{kind:"boolean",brief:"Run Convex setup",default:!0}}},docs:{brief:"Create a new AI-promptable monorepo"}});var mt=ye({routes:{create:$e},docs:{brief:we},aliases:{}}),Ce=ue(mt,{name:xe,versionInfo:{currentVersion:ge}});var Q=process.argv.slice(2),I=Q[0];I&&!I.startsWith("-")&&I!=="create"&&I!=="help"&&I!=="--help"&&I!=="-h"&&I!=="version"&&I!=="--version"&&I!=="-v"&&Q.unshift("create");await be(Ce,Q,ve(process));
|
|
26
|
+
/*! Bundled license information:
|
|
27
|
+
|
|
28
|
+
@stricli/core/dist/index.js:
|
|
29
|
+
(* v8 ignore next -- @preserve *)
|
|
30
|
+
(* v8 ignore if -- @preserve *)
|
|
31
|
+
(* v8 ignore else -- @preserve *)
|
|
32
|
+
*/
|