@konstit/dne 0.0.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/LICENSE +19 -0
- package/README.md +225 -0
- package/dist/chunks/dynamic-completion-403da357-4jc4w04x.js +7 -0
- package/dist/chunks/dynamic-completion-403da357-4jc4w04x.js.map +10 -0
- package/dist/chunks/index-s0h4vdva.js +17 -0
- package/dist/chunks/index-s0h4vdva.js.map +10 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +24 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KONSTIT ENGENHARIA E TECNOLOGIA LTDA
|
|
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
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# CLI para e-DNE dos Correios
|
|
2
|
+
|
|
3
|
+
Crie em segundos uma base SQLite local, compacta e pronta para consultar os CEPs do Brasil com dados do e-DNE dos Correios. Depois da carga, as consultas funcionam sem servidor e sem acesso à rede.
|
|
4
|
+
|
|
5
|
+
O `@konstit/dne` recebe um diretório, um arquivo ZIP local ou o arquivo público mais recente do e-DNE. Os dados são processados em fluxo e gravados diretamente em uma única tabela `dne` indexada, sem tabelas brutas intermediárias.
|
|
6
|
+
|
|
7
|
+
Principais vantagens:
|
|
8
|
+
|
|
9
|
+
- **Rápido e compacto:** em um benchmark de 10 execuções realizado em 2026-08-30, a geração completa a partir do arquivo público levou 5,73 segundos em média, incluindo o download. A base final continha 1.605.136 registros e ocupava 125,4 MiB.
|
|
10
|
+
- **Consultas locais simples:** procure um CEP, consulte vários CEPs em lote ou execute SQL somente leitura diretamente no arquivo SQLite.
|
|
11
|
+
- **Atualizações seguras:** o modo WAL e uma única transação permitem atualizar a base sem expor dados parciais aos processos de leitura.
|
|
12
|
+
- **Atualizações automáticas:** registre uma agenda com `Bun.cron` para manter a base atualizada no Linux ou macOS. Cada job usa uma versão fixada do pacote, e o lock exclusivo evita cargas simultâneas.
|
|
13
|
+
- **Pronto para automação:** a CLI oferece saídas JSON e JSONL estáveis, códigos de saída documentados e separação entre dados e mensagens de progresso.
|
|
14
|
+
|
|
15
|
+
Nas mesmas condições do benchmark, `uvx edne-correios-loader load --database-url sqlite:///dne.db` levou 30 segundos e gerou uma base de 394 MiB sem `VACUUM`. Nessa comparação, o `@konstit/dne` foi 5,2 vezes mais rápido e usou 68,2% menos espaço em disco.
|
|
16
|
+
|
|
17
|
+
Este pacote fornece somente uma CLI. Ele não expõe uma API pública de biblioteca.
|
|
18
|
+
|
|
19
|
+
## Requisitos
|
|
20
|
+
|
|
21
|
+
- Bun 1.4 ou mais recente
|
|
22
|
+
- macOS ou Linux
|
|
23
|
+
|
|
24
|
+
## Início rápido
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
bunx @konstit/dne build --db ./dne.db
|
|
28
|
+
bunx @konstit/dne get 01001-000 --db ./dne.db
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Execução
|
|
32
|
+
|
|
33
|
+
Execute a CLI sem instalação global:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
bunx @konstit/dne --version
|
|
37
|
+
bunx @konstit/dne --json doctor --offline
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Os nomes de comandos, subcomandos, opções e flags permanecem em inglês. A ajuda, o progresso, os resultados textuais e as mensagens de erro são exibidos em português. O contrato JSON mantém chaves, códigos e valores de estado estáveis em inglês.
|
|
41
|
+
|
|
42
|
+
`--db` é uma opção global. Ela pode aparecer antes ou depois de um subcomando. O caminho da base segue esta ordem de precedência:
|
|
43
|
+
|
|
44
|
+
1. `--db PATH`
|
|
45
|
+
2. `./dne.db`
|
|
46
|
+
|
|
47
|
+
Use `--color` para forçar cores e `--no-color` para desativá-las. Sem essas opções, a CLI detecta o terminal. A presença da variável `NO_COLOR` sempre desativa as cores.
|
|
48
|
+
|
|
49
|
+
## Criar e atualizar
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
bunx @konstit/dne build --db ./dne.db
|
|
53
|
+
bunx @konstit/dne build --db ./dne.db --source ./eDNE_Basico.zip
|
|
54
|
+
bunx @konstit/dne build --db ./dne.db --source ./Delimitado
|
|
55
|
+
bunx @konstit/dne build --db ./dne.db --source https://example.com/eDNE_Basico.zip
|
|
56
|
+
bunx @konstit/dne build --db ./dne.db --force
|
|
57
|
+
bunx @konstit/dne build --db ./dne.db --check --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`build` grava cada etapa e sua duração em formato compacto (`ms`, `s`, `min` ou `h`) em stderr. O resultado final é gravado em stdout. Use `--quiet` para ocultar o progresso. Use `--json` para receber o caminho da base, a quantidade de registros, o tamanho em bytes, os metadados da fonte, o tempo total em `elapsed_ms` e o estado da atualização.
|
|
61
|
+
|
|
62
|
+
Cada carga grava a versão do `@konstit/dne` em `edne_metadata`. Ao usar uma fonte remota, a CLI também grava `Last-Modified`, ETag, tamanho do conteúdo, URL da fonte e horário da carga. Todos os validadores disponíveis devem continuar iguais para a base ser considerada atual. Uma execução posterior de `build` não recria a base se a fonte não mudou e mostra o `Last-Modified` remoto na saída textual. `--check` valida a estrutura de uma fonte local ou verifica se há uma atualização remota, sem alterar a base. `--force` ignora os metadados e recria a base.
|
|
63
|
+
|
|
64
|
+
Para fontes HTTP ou HTTPS, a CLI tenta obter os metadados com `HEAD`. Se o servidor não aceitar esse método, ela usa uma requisição `GET` limitada ao primeiro byte. Requisições têm timeout de 30 segundos e até duas novas tentativas para falhas transitórias, respostas 408, 425, 429 e 5xx.
|
|
65
|
+
|
|
66
|
+
As entradas do ZIP são verificadas com seus valores CRC32 durante a leitura. A carga também valida CEP, UF, código IBGE, campos obrigatórios e referências entre os arquivos. Qualquer rejeição interrompe a transação. Uma carga válida grava em `quality_report` as linhas lidas, aceitas e rejeitadas por etapa e arquivo.
|
|
67
|
+
|
|
68
|
+
## Acesso simultâneo
|
|
69
|
+
|
|
70
|
+
Cada execução de `build` que pode alterar a base adquire um lock exclusivo antes de verificar a fonte. Outra instância do `@konstit/dne` aguarda por até 30 segundos, então verifica novamente os metadados e evita uma carga duplicada se a primeira instância já atualizou a base. `build --check` não adquire esse lock.
|
|
71
|
+
|
|
72
|
+
O lock fica no diretório temporário do sistema, dentro de `konstit-dne-<uid>`. Seu nome contém um hash do caminho absoluto da base, evitando conflitos entre bases com o mesmo nome. Ele é removido quando a execução termina e também ao receber `SIGHUP`, `SIGINT` ou `SIGTERM`. Se o processo for encerrado sem executar essa limpeza, a próxima execução identifica o PID inativo e remove o lock antes de continuar. Processos que coordenam a mesma base devem usar o mesmo host e usuário do sistema.
|
|
73
|
+
|
|
74
|
+
Uma base existente é atualizada no próprio arquivo com o modo WAL do SQLite e uma única transação. Outros processos podem manter a base aberta para leitura durante a atualização. Esses processos não veem uma tabela atualizada parcialmente.
|
|
75
|
+
|
|
76
|
+
Um leitor com uma transação ativa continua vendo a versão anterior até o fim da transação. A próxima transação vê os dados atualizados.
|
|
77
|
+
|
|
78
|
+
O SQLite permite um escritor por vez. Se outro processo mantiver uma transação de escrita, a atualização aguarda por até 30 segundos. Depois desse período, ela falha se o bloqueio continuar ativo.
|
|
79
|
+
|
|
80
|
+
## Atualização automática
|
|
81
|
+
|
|
82
|
+
Instale uma atualização semanal para a base:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
bunx @konstit/dne cron install --db ./dne.db
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
O padrão `0 0 * * 5` executa à meia-noite de sexta-feira, no fuso local do cron. Informe outra expressão como argumento quando necessário:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
bunx @konstit/dne cron install '30 6 * * 5' --db ./dne.db
|
|
92
|
+
bunx @konstit/dne cron install --db ./dne.db --source https://example.com/eDNE_Basico.zip
|
|
93
|
+
bunx @konstit/dne cron install '@weekly' --db ./dne.db --dry-run
|
|
94
|
+
bunx @konstit/dne cron status --db ./dne.db --json
|
|
95
|
+
bunx @konstit/dne cron remove --db ./dne.db
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`cron install` usa `Bun.cron` para registrar o job no agendador do sistema operacional: `crontab` no Linux e `launchd` no macOS. O título contém um hash do caminho absoluto da base. Uma nova instalação para a mesma base substitui o job existente, enquanto bases diferentes mantêm agendamentos independentes. `cron remove` usa `Bun.cron.remove`.
|
|
99
|
+
|
|
100
|
+
Cada job recebe um módulo persistente e metadados no diretório de estado do usuário. O módulo executa os caminhos absolutos do `bunx`, da base e de fontes locais. A versão atual do `@konstit/dne` e a fonte ficam fixadas no comando. Alterar somente a expressão preserva a fonte já instalada. Execute `cron install` novamente depois de atualizar o pacote para usar a nova versão. A execução usa `--quiet`, descarta a saída normal e mantém erros em stderr para o agendador do sistema. `cron status` mostra a fonte e também calcula a próxima execução com `Bun.cron.parse`.
|
|
101
|
+
|
|
102
|
+
## Consultar CEPs
|
|
103
|
+
|
|
104
|
+
Consulta individual:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
bunx @konstit/dne get 01001000
|
|
108
|
+
bunx @konstit/dne get 01001-000 --json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Consulta em lote:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
bunx @konstit/dne get 01001000 20040002 --json
|
|
115
|
+
bunx @konstit/dne get --file ./ceps.txt --jsonl
|
|
116
|
+
printf '01001000\n20040002\n' | bunx @konstit/dne get --jsonl
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Os formatos aceitos são `01001000` e `01001-000`. A entrada por arquivo ou stdin pode usar espaços, vírgulas ou pontos e vírgulas como separadores.
|
|
120
|
+
|
|
121
|
+
`get` abre o SQLite em modo somente leitura. Se o caminho da base não existir, nenhum arquivo será criado. O formato JSONL lê a entrada e grava cada resultado de forma incremental, sem manter o lote completo na memória.
|
|
122
|
+
|
|
123
|
+
## Inspecionar a base
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
bunx @konstit/dne status --json
|
|
127
|
+
bunx @konstit/dne schema --json
|
|
128
|
+
bunx @konstit/dne schema --expected
|
|
129
|
+
bunx @konstit/dne doctor --json
|
|
130
|
+
bunx @konstit/dne doctor --offline --json
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`status` informa o tamanho do arquivo, a quantidade de registros, o esquema atual, a versão do pacote, o `Last-Modified` da fonte e os demais metadados da carga. A saída textual formata datas e números com a localidade `pt-BR`; a saída JSON mantém os valores originais. `schema` lê o esquema real do SQLite. `schema --expected` mostra o esquema definido pela CLI. `doctor` verifica o Bun, a configuração da base e o acesso à fonte remota. O modo offline não faz a verificação de rede.
|
|
134
|
+
|
|
135
|
+
## SQL somente leitura
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
bunx @konstit/dne sql 'SELECT cep, municipio, uf FROM dne WHERE uf = "SP" LIMIT 10' --json
|
|
139
|
+
bunx @konstit/dne sql 'PRAGMA page_size' --limit 20 --json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
O comando `sql` abre a base em modo somente leitura. Ele aceita `SELECT`, `WITH`, `PRAGMA` e `EXPLAIN`. O valor padrão de `--limit` é 100, com limite máximo de 10.000 registros.
|
|
143
|
+
|
|
144
|
+
## Contrato JSON
|
|
145
|
+
|
|
146
|
+
`--json` grava em stdout um envelope estável:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"ok": true,
|
|
151
|
+
"data": {}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Erros de execução e de argumentos usam este formato em stderr:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"ok": false,
|
|
160
|
+
"error": {
|
|
161
|
+
"code": "invalid-cep",
|
|
162
|
+
"message": "CEP inválido 'x'. Use 01001000 ou 01001-000."
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
O progresso e os diagnósticos são gravados em stderr. A saída JSON em stdout não inclui mensagens de progresso.
|
|
168
|
+
|
|
169
|
+
Códigos de saída:
|
|
170
|
+
|
|
171
|
+
- `0`: comando concluído
|
|
172
|
+
- `1`: falha na base, na fonte, na rede ou na execução
|
|
173
|
+
- `2`: argumentos inválidos ou CEP em formato inválido
|
|
174
|
+
- `3`: um ou mais CEPs válidos não foram encontrados
|
|
175
|
+
|
|
176
|
+
## Schema SQLite
|
|
177
|
+
|
|
178
|
+
```sql
|
|
179
|
+
CREATE TABLE "dne" (
|
|
180
|
+
"cep" TEXT NOT NULL /* Contém somente os oito dígitos do CEP, sem separadores. */,
|
|
181
|
+
"logradouro" TEXT,
|
|
182
|
+
"complemento" TEXT,
|
|
183
|
+
"bairro" TEXT,
|
|
184
|
+
"municipio" TEXT NOT NULL,
|
|
185
|
+
"municipio_cod_ibge" INTEGER NOT NULL,
|
|
186
|
+
"uf" TEXT NOT NULL,
|
|
187
|
+
"nome" TEXT,
|
|
188
|
+
PRIMARY KEY ("cep")
|
|
189
|
+
) WITHOUT ROWID;
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`cep` é a chave primária, sem digito separador. A tabela usa `WITHOUT ROWID` e páginas de 32 KiB para oferecer consultas diretas com menor uso de espaço.
|
|
193
|
+
|
|
194
|
+
### Drizzle ORM schema
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import { sqliteTable } from 'drizzle-orm/sqlite-core';
|
|
198
|
+
|
|
199
|
+
export const dneTable = sqliteTable('dne', (t) => ({
|
|
200
|
+
cep: t.text().primaryKey(),
|
|
201
|
+
logradouro: t.text(),
|
|
202
|
+
complemento: t.text(),
|
|
203
|
+
bairro: t.text(),
|
|
204
|
+
municipio: t.text().notNull(),
|
|
205
|
+
municipio_cod_ibge: t.integer().notNull(),
|
|
206
|
+
uf: t.text().notNull(),
|
|
207
|
+
nome: t.text(),
|
|
208
|
+
}));
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Este schema serve para consultar um banco criado pelo `@konstit/dne`. O Drizzle não representa `WITHOUT ROWID`; portanto, usar o Drizzle Kit para gerar ou migrar essa tabela cria uma estrutura física diferente.
|
|
212
|
+
|
|
213
|
+
## Desenvolvimento
|
|
214
|
+
|
|
215
|
+
O comando `zip` é necessário para os testes de desenvolvimento que usam fixtures e arquivos ZIP aninhados.
|
|
216
|
+
|
|
217
|
+
```sh
|
|
218
|
+
bun test
|
|
219
|
+
bun run lint
|
|
220
|
+
bun run fmt
|
|
221
|
+
bun run benchmark
|
|
222
|
+
bun run benchmark:download
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Outros scripts de benchmark específicos estão listados em `package.json`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{b as q,g as F,h as N,i as B,j as D,k as y,l as M,m as L,n as R}from"./index-s0h4vdva.js";async function z(e,t,i={}){let a=i.cursor??(t.length===0?0:t.length-1);G(a,t.length);let n=Object.freeze([...t]),r=n[a]??"",o=i.filter??!0,l=_(R(e));Y(l,n.slice(0,a));let s=Z(l,r);if(s!==void 0)return k(l,s,n,a,o);let u=[];if(r.length===0||r.startsWith("-"))u.push(...ie(l));if(!r.startsWith("-")){u.push(...ae(l));let d=p(l);if(d!==void 0){let g=await k(l,{argument:d,current:r,outputPrefix:""},n,a,o);return u.push(...g.candidates),b({candidates:h(u,r,o),commandPath:l.commandPath,current:r,argument:d,...g.valueHint===void 0?{}:{valueHint:g.valueHint}})}}return b({candidates:h(u,r,o),commandPath:l.commandPath,current:r})}async function C(e,t={}){let i=await z(e,t.argv??Bun.argv.slice(2),t.cursor===void 0?{}:{cursor:t.cursor});if(i.candidates.length>0){let a=`${i.candidates.map(({value:n,description:r})=>`${E(n)} ${E(r??"")}`).join(`
|
|
3
|
+
`)}
|
|
4
|
+
`;(t.stdout??((n)=>process.stdout.write(n)))(a)}return 0}function G(e,t){if(!Number.isSafeInteger(e)||e<0||e>t)throw RangeError("The completion cursor must be an argv index or argv.length")}function _(e){let t={command:e,commandPath:[e.name],inheritedGlobals:[],positionalIndex:0,optionsEnabled:!0,pending:void 0,values:{},rawValues:{},cliProvided:new Set};return A(e.arguments,t),t}function A(e,t){for(let i of e){if(i.color)t.values[i.name]=Bun.env.NO_COLOR===void 0&&process.stdout.isTTY===!0&&Bun.env.TERM!=="dumb";else if(i.repeatable||i.trailingVarArg)t.values[i.name]=[];else if(i.presence==="default")t.values[i.name]=i.defaultValue;else t.values[i.name]=void 0;let a=i.env===void 0?void 0:Bun.env[i.env];if(a!==void 0)if(i.kind==="flag")t.values[i.name]=i.color?!1:i.action===q.SetTrue;else if(i.kind==="count"){let n=Number(a);if(Number.isSafeInteger(n)&&n>=0)t.values[i.name]=n}else c(i,v(i,a),t,!1)}}function Y(e,t){let i=0;while(i<t.length){let a=t[i];if(a===void 0)break;if(e.pending!==void 0){if(a===e.pending.argument.valueTerminator){w(e.pending,e),e.pending=void 0,i+=1;continue}if(!T(e,e.pending.argument,a)){Q(e,e.pending,a),i+=1;continue}w(e.pending,e),e.pending=void 0}if(e.optionsEnabled&&a==="--"){e.optionsEnabled=!1,i+=1;continue}let n=e.optionsEnabled&&W(e,a);if(e.optionsEnabled&&!n&&a.startsWith("--")&&a.length>2){J(e,a),i+=1;continue}if(e.optionsEnabled&&!n&&a.startsWith("-")&&a!=="-"){K(e,a),i+=1;continue}if(e.optionsEnabled&&!n){let o=S(e.command,a);if(o!==void 0){X(e,o),i+=1;continue}}let r=p(e);if(r!==void 0)if(a===r.valueTerminator)e.positionalIndex+=1;else{let o=c(r,v(r,a),e);if(!r.repeatable&&r.maxValues!==null&&o>=r.maxValues)e.positionalIndex+=1;if(r.trailingVarArg)e.optionsEnabled=!1}i+=1}}function V(e){return[...e.command.arguments,...e.inheritedGlobals]}function P(e,t){return V(e).find((i)=>i.kind!=="positional"&&F(i).includes(t))}function x(e,t){return V(e).find((i)=>i.kind!=="positional"&&i.short===t)}function J(e,t){let{name:i,inlineValue:a}=N(t),n=P(e,i);if(n===void 0)return;if(n.kind==="flag"||n.kind==="count"){I(n,e,n.negativeLong===i?!1:void 0);return}if(a===void 0&&n.requireEquals){O(n,e);return}let r=a===void 0?[]:y(n,a);if(r.length>0)c(n,r,e);let o=r.length;H(e,n,o)}function K(e,t){let i=B(t);for(let a=0;a<i.length;a+=1){let n=i[a];if(n===void 0)break;let r=x(e,n);if(r===void 0)return;if(r.kind==="flag"||r.kind==="count"){I(r,e);continue}let o=i.slice(a+1).join(""),l=o.length>0,s=o;if(s.startsWith("="))s=s.slice(1);if(!l&&r.requireEquals){O(r,e);return}let u=l?v(r,s):[];if(u.length>0)c(r,u,e);let d=u.length;H(e,r,d);return}}function H(e,t,i){if(t.maxValues===null||i<t.maxValues)e.pending={argument:t,consumed:i};else e.pending=void 0}function w(e,t){if(e.consumed===0)O(e.argument,t)}function O(e,t){if(!e.hasDefaultMissingValue)return;if(!t.cliProvided.has(e.name))t.cliProvided.add(e.name),t.rawValues[e.name]=[],t.values[e.name]=f(e)?[]:void 0;if(f(e)){let i=t.values[e.name];t.values[e.name]=[...Array.isArray(i)?i:[],e.defaultMissingValue]}else t.values[e.name]=e.defaultMissingValue}function Q(e,t,i){let a=v(t.argument,i);if(c(t.argument,a,e),t.consumed+=a.length,t.argument.maxValues!==null&&t.consumed>=t.argument.maxValues)e.pending=void 0}function T(e,t,i){if(M(t,i))return!0;return e.optionsEnabled&&t.minValues<=(e.pending?.consumed??0)&&S(e.command,i)!==void 0}function W(e,t){let i=p(e);if(i===void 0||t==="--"||t==="-"||!t.startsWith("-")||U(e,t))return!1;return i.allowHyphenValues||i.allowNegativeNumbers&&D(t)}function U(e,t){if(t.startsWith("--")){let a=t.indexOf("="),n=t.slice(2,a<0?void 0:a);return P(e,n)!==void 0||!e.command.disableHelpFlag&&t==="--help"||!e.command.disableVersionFlag&&e.command.version!==void 0&&t==="--version"}let i=t[1];return i!==void 0&&(x(e,i)!==void 0||!e.command.disableHelpFlag&&t==="-h"||!e.command.disableVersionFlag&&e.command.version!==void 0&&t==="-V")}function v(e,t){return y(e,t)}function c(e,t,i,a=!0){if(a&&!i.cliProvided.has(e.name))i.cliProvided.add(e.name),i.rawValues[e.name]=[],i.values[e.name]=f(e)?[]:void 0;let n=i.rawValues[e.name]??[];n.push(...t),i.rawValues[e.name]=n;let r=[];for(let o of t)try{r.push(e.parser?.parse(o)??o)}catch{}if(r.length===0)return n.length;if(f(e)){let o=i.values[e.name];i.values[e.name]=[...Array.isArray(o)?o:[],...r]}else i.values[e.name]=r.at(-1);return n.length}function f(e){return e.repeatable||e.trailingVarArg||e.maxValues===null||e.maxValues!==1}function I(e,t,i){let a=!t.cliProvided.has(e.name);if(t.cliProvided.add(e.name),e.kind==="flag"){let n=i??e.action!=="setFalse";t.values[e.name]=e.color&&Bun.env.NO_COLOR!==void 0?!1:n}else{let n=t.values[e.name];t.values[e.name]=!a&&typeof n==="number"?n+1:1}}function S(e,t){let i=L(e,t);return i.kind==="exact"||i.kind==="unique"?i.command:void 0}function X(e,t){e.inheritedGlobals=[...e.inheritedGlobals,...e.command.arguments.filter(({global:i})=>i)],e.command=t,e.commandPath.push(t.name),e.positionalIndex=0,e.pending=void 0,A(t.arguments,e)}function p(e){return e.command.arguments.filter(({kind:t})=>t==="positional")[e.positionalIndex]}function Z(e,t){if(e.pending!==void 0&&!T(e,e.pending.argument,t))return m(e.pending.argument,t,"");if(!e.optionsEnabled)return j(e,t);if(W(e,t))return j(e,t);if(t.startsWith("--")){let i=t.indexOf("=");if(i>=0){let a=P(e,t.slice(2,i));if(a?.kind==="option")return m(a,t.slice(i+1),t.slice(0,i+1))}return}if(t.startsWith("-")&&t!=="-"){let i=t.slice(1);for(let a=0;a<i.length;a+=1){let n=i[a];if(n===void 0)break;let r=x(e,n);if(r===void 0)break;if(r.kind!=="option")continue;let o=i[a+1]==="="?a+3:a+2,l=t.slice(0,o);return m(r,t.slice(o),l)}return}return}function j(e,t){let i=p(e);return i===void 0?void 0:m(i,t,"")}function m(e,t,i){if(e.valueDelimiter===void 0)return{argument:e,current:t,outputPrefix:i};let a=t.lastIndexOf(e.valueDelimiter);if(a<0)return{argument:e,current:t,outputPrefix:i};return{argument:e,current:t.slice(a+e.valueDelimiter.length),outputPrefix:`${i}${t.slice(0,a+1)}`}}async function k(e,t,i,a,n){let r=Object.freeze({argv:i,cursor:a,current:t.current,commandPath:Object.freeze([...e.commandPath]),command:e.command,argument:t.argument,values:ne(e.values),rawValues:re(e.rawValues)}),o=t.argument.completion,l=o===void 0?t.argument.parser?.completions??[]:await ee(o,r),s=te(l).map((d)=>Object.freeze({...d,value:`${t.outputPrefix}${d.value}`})),u=t.argument.completionHint??t.argument.parser?.completionHint;return b({candidates:h(s,`${t.outputPrefix}${t.current}`,n),commandPath:e.commandPath,current:t.current,argument:t.argument,...u===void 0?{}:{valueHint:u}})}async function ee(e,t){let i=await e(t);if(typeof i==="string"||i===null||typeof i!=="object")throw TypeError("A completion provider must return an iterable of candidates");let a=[];if(Symbol.asyncIterator in i)for await(let n of i)a.push(n);else if(Symbol.iterator in i)for(let n of i)a.push(n);else throw TypeError("A completion provider must return an iterable of candidates");return a}function te(e){return e.map((t)=>{let i=typeof t==="string"?{value:t}:t;if(i.value.length===0||i.value.includes("\x00")||i.value.includes(`
|
|
5
|
+
`)||i.value.includes("\r")||i.value.includes("\t"))throw TypeError("A completion candidate must be a non-empty single-line value without tabs");return Object.freeze({value:i.value,...i.description===void 0?{}:{description:i.description}})})}function ie(e){let t=V(e).filter(({hidden:i,kind:a})=>!i&&a!=="positional").flatMap((i)=>[...i.short===void 0?[]:[`-${i.short}`],...i.long===void 0?[]:[`--${i.long}`],...i.negativeLong===void 0?[]:[`--${i.negativeLong}`],...i.aliases.map((a)=>`--${a}`)].map((a)=>({value:a,...i.help===void 0?{}:{description:i.help}})));if(!e.command.disableHelpFlag)t.push({value:"-h",description:"Print help"}),t.push({value:"--help",description:"Print help"});if(e.command.version!==void 0&&!e.command.disableVersionFlag)t.push({value:"-V",description:"Print version"}),t.push({value:"--version",description:"Print version"});return t}function ae(e){return e.command.subcommands.filter(({hidden:t})=>!t).flatMap((t)=>[t.name,...t.aliases.filter(({visible:i})=>i).map(({name:i})=>i)].map((i)=>({value:i,...t.about===void 0?{}:{description:t.about}})))}function h(e,t,i){let a=new Set;return Object.freeze(e.filter(({value:n})=>{if(i&&!n.startsWith(t))return!1;if(a.has(n))return!1;return a.add(n),!0}).map((n)=>Object.freeze({...n})))}function ne(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([t,i])=>[t,Array.isArray(i)?Object.freeze([...i]):i])))}function re(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([t,i])=>[t,Object.freeze([...i])])))}function b(e){return Object.freeze({...e,candidates:Object.freeze([...e.candidates]),commandPath:Object.freeze([...e.commandPath])})}function E(e){return Buffer.from(e).toString("hex")}export{z as resolveDynamicCompletion,C as runDynamicCompletionRequest};
|
|
6
|
+
|
|
7
|
+
//# debugId=A2F89EFA953574B564756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/@konstit/cli/dist/chunks/index-y9ratbta.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"// @bun\nimport{f as O,o as R,p as I,q as E,r as T,s as b,t as j,u as z,v as k}from\"./index-98nxgrz7.js\";async function B(n,e,i={}){let o=i.cursor??(e.length===0?0:e.length-1);G(o,e.length);let t=Object.freeze([...e]),a=t[o]??\"\",r=i.filter??!0,l=_(k(n));Y(l,t.slice(0,o));let u=Z(l,a);if(u!==void 0)return A(l,u,t,o,r);let d=[];if(a.length===0||a.startsWith(\"-\"))d.push(...en(l));if(!a.startsWith(\"-\")){d.push(...on(l));let c=g(l);if(c!==void 0){let y=await A(l,{argument:c,current:a,outputPrefix:\"\"},t,o,r);return d.push(...y.candidates),h({candidates:v(d,a,r),commandPath:l.commandPath,current:a,argument:c,...y.valueHint===void 0?{}:{valueHint:y.valueHint}})}}return h({candidates:v(d,a,r),commandPath:l.commandPath,current:a})}async function un(n,e={}){let i=await B(n,e.argv??Bun.argv.slice(2),e.cursor===void 0?{}:{cursor:e.cursor});if(i.candidates.length>0){let o=`${i.candidates.map(({value:t,description:a})=>`${w(t)}\t${w(a??\"\")}`).join(`\n`)}\n`;(e.stdout??((t)=>process.stdout.write(t)))(o)}return 0}function G(n,e){if(!Number.isSafeInteger(n)||n<0||n>e)throw RangeError(\"The completion cursor must be an argv index or argv.length\")}function _(n){let e={command:n,commandPath:[n.name],inheritedGlobals:[],positionalIndex:0,optionsEnabled:!0,pending:void 0,values:{},rawValues:{},cliProvided:new Set};return H(n.arguments,e),e}function H(n,e){for(let i of n){if(i.color)e.values[i.name]=Bun.env.NO_COLOR===void 0&&process.stdout.isTTY===!0&&Bun.env.TERM!==\"dumb\";else if(i.repeatable||i.trailingVarArg)e.values[i.name]=[];else if(i.presence===\"default\")e.values[i.name]=i.defaultValue;else e.values[i.name]=void 0;let o=i.env===void 0?void 0:Bun.env[i.env];if(o!==void 0)if(i.kind===\"flag\")e.values[i.name]=i.color?!1:i.action===O.SetTrue;else if(i.kind===\"count\"){let t=Number(o);if(Number.isSafeInteger(t)&&t>=0)e.values[i.name]=t}else s(i,p(i,o),e,!1)}}function Y(n,e){let i=0;while(i<e.length){let o=e[i];if(o===void 0)break;if(n.pending!==void 0){if(o===n.pending.argument.valueTerminator){x(n.pending,n),n.pending=void 0,i+=1;continue}if(!q(n,n.pending.argument,o)){Q(n,n.pending,o),i+=1;continue}x(n.pending,n),n.pending=void 0}if(n.optionsEnabled&&o===\"--\"){n.optionsEnabled=!1,i+=1;continue}let t=n.optionsEnabled&&L(n,o);if(n.optionsEnabled&&!t&&o.startsWith(\"--\")&&o.length>2){J(n,o),i+=1;continue}if(n.optionsEnabled&&!t&&o.startsWith(\"-\")&&o!==\"-\"){K(n,o),i+=1;continue}if(n.optionsEnabled&&!t){let r=M(n.command,o);if(r!==void 0){X(n,r),i+=1;continue}}let a=g(n);if(a!==void 0)if(o===a.valueTerminator)n.positionalIndex+=1;else{let r=s(a,p(a,o),n);if(!a.repeatable&&a.maxValues!==null&&r>=a.maxValues)n.positionalIndex+=1;if(a.trailingVarArg)n.optionsEnabled=!1}i+=1}}function C(n){return[...n.command.arguments,...n.inheritedGlobals]}function D(n,e){return C(n).find((i)=>i.kind!==\"positional\"&&R(i).includes(e))}function S(n,e){return C(n).find((i)=>i.kind!==\"positional\"&&i.short===e)}function J(n,e){let{name:i,inlineValue:o}=I(e),t=D(n,i);if(t===void 0)return;if(t.kind===\"flag\"||t.kind===\"count\"){F(t,n,t.negativeLong===i?!1:void 0);return}if(o===void 0&&t.requireEquals){V(t,n);return}let a=o===void 0?[]:b(t,o);if(a.length>0)s(t,a,n);let r=a.length;N(n,t,r)}function K(n,e){let i=E(e);for(let o=0;o<i.length;o+=1){let t=i[o];if(t===void 0)break;let a=S(n,t);if(a===void 0)return;if(a.kind===\"flag\"||a.kind===\"count\"){F(a,n);continue}let r=i.slice(o+1).join(\"\"),l=r.length>0,u=r;if(u.startsWith(\"=\"))u=u.slice(1);if(!l&&a.requireEquals){V(a,n);return}let d=l?p(a,u):[];if(d.length>0)s(a,d,n);let c=d.length;N(n,a,c);return}}function N(n,e,i){if(e.maxValues===null||i<e.maxValues)n.pending={argument:e,consumed:i};else n.pending=void 0}function x(n,e){if(n.consumed===0)V(n.argument,e)}function V(n,e){if(!n.hasDefaultMissingValue)return;if(!e.cliProvided.has(n.name))e.cliProvided.add(n.name),e.rawValues[n.name]=[],e.values[n.name]=f(n)?[]:void 0;if(f(n)){let i=e.values[n.name];e.values[n.name]=[...Array.isArray(i)?i:[],n.defaultMissingValue]}else e.values[n.name]=n.defaultMissingValue}function Q(n,e,i){let o=p(e.argument,i);if(s(e.argument,o,n),e.consumed+=o.length,e.argument.maxValues!==null&&e.consumed>=e.argument.maxValues)n.pending=void 0}function q(n,e,i){if(j(e,i))return!0;return n.optionsEnabled&&e.minValues<=(n.pending?.consumed??0)&&M(n.command,i)!==void 0}function L(n,e){let i=g(n);if(i===void 0||e===\"--\"||e===\"-\"||!e.startsWith(\"-\")||U(n,e))return!1;return i.allowHyphenValues||i.allowNegativeNumbers&&T(e)}function U(n,e){if(e.startsWith(\"--\")){let o=e.indexOf(\"=\"),t=e.slice(2,o<0?void 0:o);return D(n,t)!==void 0||!n.command.disableHelpFlag&&e===\"--help\"||!n.command.disableVersionFlag&&n.command.version!==void 0&&e===\"--version\"}let i=e[1];return i!==void 0&&(S(n,i)!==void 0||!n.command.disableHelpFlag&&e===\"-h\"||!n.command.disableVersionFlag&&n.command.version!==void 0&&e===\"-V\")}function p(n,e){return b(n,e)}function s(n,e,i,o=!0){if(o&&!i.cliProvided.has(n.name))i.cliProvided.add(n.name),i.rawValues[n.name]=[],i.values[n.name]=f(n)?[]:void 0;let t=i.rawValues[n.name]??[];t.push(...e),i.rawValues[n.name]=t;let a=[];for(let r of e)try{a.push(n.parser?.parse(r)??r)}catch{}if(a.length===0)return t.length;if(f(n)){let r=i.values[n.name];i.values[n.name]=[...Array.isArray(r)?r:[],...a]}else i.values[n.name]=a.at(-1);return t.length}function f(n){return n.repeatable||n.trailingVarArg||n.maxValues===null||n.maxValues!==1}function F(n,e,i){let o=!e.cliProvided.has(n.name);if(e.cliProvided.add(n.name),n.kind===\"flag\"){let t=i??n.action!==\"setFalse\";e.values[n.name]=n.color&&Bun.env.NO_COLOR!==void 0?!1:t}else{let t=e.values[n.name];e.values[n.name]=!o&&typeof t===\"number\"?t+1:1}}function M(n,e){let i=z(n,e);return i.kind===\"exact\"||i.kind===\"unique\"?i.command:void 0}function X(n,e){n.inheritedGlobals=[...n.inheritedGlobals,...n.command.arguments.filter(({global:i})=>i)],n.command=e,n.commandPath.push(e.name),n.positionalIndex=0,n.pending=void 0,H(e.arguments,n)}function g(n){return n.command.arguments.filter(({kind:e})=>e===\"positional\")[n.positionalIndex]}function Z(n,e){if(n.pending!==void 0&&!q(n,n.pending.argument,e))return m(n.pending.argument,e,\"\");if(!n.optionsEnabled)return P(n,e);if(L(n,e))return P(n,e);if(e.startsWith(\"--\")){let i=e.indexOf(\"=\");if(i>=0){let o=D(n,e.slice(2,i));if(o?.kind===\"option\")return m(o,e.slice(i+1),e.slice(0,i+1))}return}if(e.startsWith(\"-\")&&e!==\"-\"){let i=e.slice(1);for(let o=0;o<i.length;o+=1){let t=i[o];if(t===void 0)break;let a=S(n,t);if(a===void 0)break;if(a.kind!==\"option\")continue;let r=i[o+1]===\"=\"?o+3:o+2,l=e.slice(0,r);return m(a,e.slice(r),l)}return}return}function P(n,e){let i=g(n);return i===void 0?void 0:m(i,e,\"\")}function m(n,e,i){if(n.valueDelimiter===void 0)return{argument:n,current:e,outputPrefix:i};let o=e.lastIndexOf(n.valueDelimiter);if(o<0)return{argument:n,current:e,outputPrefix:i};return{argument:n,current:e.slice(o+n.valueDelimiter.length),outputPrefix:`${i}${e.slice(0,o+1)}`}}async function A(n,e,i,o,t){let a=Object.freeze({argv:i,cursor:o,current:e.current,commandPath:Object.freeze([...n.commandPath]),command:n.command,argument:e.argument,values:tn(n.values),rawValues:an(n.rawValues)}),r=e.argument.completion,l=r===void 0?e.argument.parser?.completions??[]:await W(r,a),u=nn(l).map((c)=>Object.freeze({...c,value:`${e.outputPrefix}${c.value}`})),d=e.argument.completionHint??e.argument.parser?.completionHint;return h({candidates:v(u,`${e.outputPrefix}${e.current}`,t),commandPath:n.commandPath,current:e.current,argument:e.argument,...d===void 0?{}:{valueHint:d}})}async function W(n,e){let i=await n(e);if(typeof i===\"string\"||i===null||typeof i!==\"object\")throw TypeError(\"A completion provider must return an iterable of candidates\");let o=[];if(Symbol.asyncIterator in i)for await(let t of i)o.push(t);else if(Symbol.iterator in i)for(let t of i)o.push(t);else throw TypeError(\"A completion provider must return an iterable of candidates\");return o}function nn(n){return n.map((e)=>{let i=typeof e===\"string\"?{value:e}:e;if(i.value.length===0||i.value.includes(\"\\x00\")||i.value.includes(`\n`)||i.value.includes(\"\\r\")||i.value.includes(\"\\t\"))throw TypeError(\"A completion candidate must be a non-empty single-line value without tabs\");return Object.freeze({value:i.value,...i.description===void 0?{}:{description:i.description}})})}function en(n){let e=C(n).filter(({hidden:i,kind:o})=>!i&&o!==\"positional\").flatMap((i)=>[...i.short===void 0?[]:[`-${i.short}`],...i.long===void 0?[]:[`--${i.long}`],...i.negativeLong===void 0?[]:[`--${i.negativeLong}`],...i.aliases.map((o)=>`--${o}`)].map((o)=>({value:o,...i.help===void 0?{}:{description:i.help}})));if(!n.command.disableHelpFlag)e.push({value:\"-h\",description:\"Print help\"}),e.push({value:\"--help\",description:\"Print help\"});if(n.command.version!==void 0&&!n.command.disableVersionFlag)e.push({value:\"-V\",description:\"Print version\"}),e.push({value:\"--version\",description:\"Print version\"});return e}function on(n){return n.command.subcommands.filter(({hidden:e})=>!e).flatMap((e)=>[e.name,...e.aliases.filter(({visible:i})=>i).map(({name:i})=>i)].map((i)=>({value:i,...e.about===void 0?{}:{description:e.about}})))}function v(n,e,i){let o=new Set;return Object.freeze(n.filter(({value:t})=>{if(i&&!t.startsWith(e))return!1;if(o.has(t))return!1;return o.add(t),!0}).map((t)=>Object.freeze({...t})))}function tn(n){return Object.freeze(Object.fromEntries(Object.entries(n).map(([e,i])=>[e,Array.isArray(i)?Object.freeze([...i]):i])))}function an(n){return Object.freeze(Object.fromEntries(Object.entries(n).map(([e,i])=>[e,Object.freeze([...i])])))}function h(n){return Object.freeze({...n,candidates:Object.freeze([...n.candidates]),commandPath:Object.freeze([...n.commandPath])})}function w(n){return Buffer.from(n).toString(\"hex\")}\nexport{B as c,un as d};\n\n//# debugId=07D9D4D7F54745A164756E2164756E21\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";gGACgG,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,IAAS,OAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE,WAAW,GAAG,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,CA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,EAAE,CAAC,OAAO,OAAO,KAAK,CAAC,EAAE,SAAS,KAAK",
|
|
8
|
+
"debugId": "A2F89EFA953574B564756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var Pe=import.meta.require;function b(e,r,t={}){return Object.freeze({label:e,parse:r,...t.completions===void 0?{}:{completions:Object.freeze([...t.completions])},...t.completionHint===void 0?{}:{completionHint:t.completionHint}})}function te(e){if(e.trim()==="")throw Error("expected a number");let r=Number(e);if(!Number.isFinite(r))throw Error("expected a finite number");return r}function ie(e,r,t){let o=/^(\d+)(?:\.(\d+))?([A-Za-z]+)$/.exec(e);if(o===null)throw Error(t);let[,i="0",n,a=""]=o,l=r[a];if(l===void 0)throw Error(t);let s=BigInt(l),u=BigInt(i)*s;if(n!==void 0){let f=10n**BigInt(n.length),m=BigInt(n)*s;if(m%f!==0n)throw Error(t);u+=m/f}if(u>BigInt(Number.MAX_SAFE_INTEGER))throw Error(t);return Number(u)}var De=Object.freeze({ms:1,s:1000,m:60000,h:3600000,d:86400000}),Le=Object.freeze({B:1,KB:1000,MB:1e6,GB:1e9,TB:1000000000000,KiB:1024,MiB:1048576,GiB:1073741824,TiB:1099511627776});function We(e){return b("JSON",(r)=>{let t;try{t=JSON.parse(r)}catch{throw Error("expected valid JSON")}if(e!==void 0&&!e(t))throw Error("JSON value has an invalid shape");return t})}var G=Object.freeze({string:b("STRING",(e)=>e),integer:b("INTEGER",(e)=>{if(!/^[+-]?\d+$/.test(e))throw Error("expected an integer");let r=Number(e);if(!Number.isSafeInteger(r))throw Error("integer is outside the safe range");return r}),float:b("NUMBER",te),bigint:b("INTEGER",(e)=>{if(!/^[+-]?\d+$/.test(e))throw Error("expected an integer");return BigInt(e)}),boolean:b("BOOLEAN",(e)=>{switch(e.toLowerCase()){case"1":case"true":case"yes":case"on":return!0;case"0":case"false":case"no":case"off":return!1;default:throw Error("expected true or false")}},{completions:["true","false"]}),url:b("URL",(e)=>{try{return new URL(e)}catch{throw Error("expected a valid URL")}}),date:b("DATE",(e)=>{let r=new Date(e);if(Number.isNaN(r.getTime()))throw Error("expected a valid date");return r}),duration:b("DURATION",(e)=>ie(e,De,"expected a duration such as 500ms, 30s, 5m, 2h, or 1d")),byteSize:b("BYTES",(e)=>ie(e,Le,"expected a byte size such as 512B, 10KB, or 4MiB")),keyValue:b("KEY=VALUE",(e)=>{let r=e.indexOf("=");if(r<1)throw Error("expected KEY=VALUE with a non-empty key");return Object.freeze({key:e.slice(0,r),value:e.slice(r+1)})}),cron:b("CRON",(e)=>{let r;try{r=Bun.cron.parse(e,0,{tz:"UTC"})}catch{throw Error("expected a schedulable Bun cron expression")}if(r===null)throw Error("expected a schedulable Bun cron expression");return e}),color:b("COLOR",(e)=>{if(Bun.color(e,"css")===null)throw Error("expected a valid CSS color");return e}),enum(e){let r=new Set(e);return b(e.join("|"),(t)=>{if(!r.has(t))throw Error(`expected one of: ${e.join(", ")}`);return t},{completions:e})},regex(e){if(!(e instanceof RegExp))throw TypeError("A regex parser requires a RegExp");let{source:r,flags:t}=e,o=e.toString();return b(o,(i)=>{if(!new RegExp(r,t).test(i))throw Error(`expected value matching ${o}`);return i})},json:We,custom(e,r,t={}){return b(e,r,t)},range(e,r){if(!Number.isFinite(e)||!Number.isFinite(r)||e>r)throw RangeError("A parser range must have finite, ascending bounds");return b(`${e}..${r}`,(t)=>{let o=te(t);if(o<e||o>r)throw Error(`expected a number from ${e} to ${r}`);return o})}}),w=Object.freeze({Set:"set",Append:"append",SetTrue:"setTrue",SetFalse:"setFalse",Count:"count",Help:"help",HelpShort:"helpShort",HelpLong:"helpLong",Version:"version"});function h(e,r){let t={...e,...r};return Object.freeze({...t,aliases:Object.freeze([...t.aliases])})}var ve=new WeakMap;function N(e){let r=Object.freeze({});return ve.set(r,e),r}function be(e){let r=ve.get(e);if(r===void 0)throw TypeError("Expected an argument created by option(), positional(), flag(), colorFlag(), or count()");return r}function we(e){if(typeof e!=="string")throw TypeError("An argument name must be a string");if(!/^[A-Za-z][A-Za-z0-9_-]*$/.test(e))throw TypeError(`Invalid argument name: ${JSON.stringify(e)}`)}function oe(e){we(e)}function _e(e){if(e===null||typeof e!=="object"||Array.isArray(e))throw TypeError("A value parser must be an object");if(!("label"in e)||typeof e.label!=="string")throw TypeError("A value parser label must be a string");if(!("parse"in e)||typeof e.parse!=="function")throw TypeError("A value parser parse field must be a function");if("completions"in e&&e.completions!==void 0){if(!Array.isArray(e.completions)||e.completions.some((r)=>typeof r!=="string"))throw TypeError("Value parser completions must be an array of strings")}if("completionHint"in e&&e.completionHint!==void 0&&e.completionHint!=="file"&&e.completionHint!=="directory")throw TypeError("A value parser completion hint must be 'file' or 'directory'")}function W(e,r){if(!Number.isSafeInteger(e)||e<0)throw RangeError("The minimum value count must be a non-negative integer");if(r!==void 0&&(!Number.isSafeInteger(r)||r<e))throw RangeError("The maximum value count must be an integer at least equal to min")}function U(e,r,t){if(we(e),r==="option"||r==="positional")_e(t);let o=r==="positional"?void 0:e.replaceAll("_","-");return Object.freeze({name:e,kind:r,color:!1,action:r==="flag"?w.SetTrue:r==="count"?w.Count:w.Set,...t===void 0?{}:{parser:t},...o===void 0?{}:{long:o},aliases:Object.freeze([]),presence:r==="flag"||r==="count"?"default":"optional",...r==="flag"?{defaultValue:!1}:{},...r==="count"?{defaultValue:0}:{},hasDefaultMissingValue:!1,repeatable:!1,minValues:r==="flag"||r==="count"?0:1,maxValues:r==="flag"||r==="count"?0:1,requireEquals:!1,allowHyphenValues:!1,allowNegativeNumbers:!1,trailingVarArg:!1,global:!1,hidden:!1})}function ye(e,r){let t=e;if(r.describe!==void 0)t=h(t,{help:r.describe});if(r.env!==void 0){if(r.env.length===0)throw TypeError("An environment variable name cannot be empty");t=h(t,{env:r.env})}if(r.hide!==void 0)t=h(t,{hidden:r.hide});return t}function $e(e,r){let t=ye(e,r);if(r.short!==void 0)t=h(t,{short:r.short});if(r.long!==void 0)oe(r.long),t=h(t,{long:r.long});for(let o of r.aliases??[])oe(o),t=h(t,{aliases:[...t.aliases,o]});return r.global===!0?h(t,{global:!0}):t}function Ge(e,r){Y(e,r);let t=Object.hasOwn(r,"default"),o=Object.hasOwn(r,"defaultMissing"),i=Object.hasOwn(r,"numArgs");if(e==="option"&&Object.hasOwn(r,"trailingVarArg"))throw TypeError("Options cannot be trailing positional arguments");if(e==="positional"){if(Object.hasOwn(r,"global"))throw TypeError("Positional arguments cannot be global");if(o)throw TypeError("Positional arguments cannot configure defaultMissing");if(Object.hasOwn(r,"requireEquals"))throw TypeError("Positional arguments cannot require equals-form values")}if(t&&r.required===!0)throw TypeError("An argument configuration cannot be required and have a default");if(t&&r.repeatable===!0)throw TypeError("A repeatable argument cannot have a scalar default");if(t&&r.trailingVarArg===!0)throw TypeError("A trailing argument cannot have a scalar default");if(t&&r.numArgs!==void 0){let n=typeof r.numArgs==="number"?r.numArgs:r.numArgs.max,a="A multi-value argument cannot have a scalar default";if(n!==1)throw TypeError("A multi-value argument cannot have a scalar default")}if(o&&i)throw TypeError("defaultMissing cannot be combined with numArgs");if(r.trailingVarArg===!0){if(r.repeatable===!0)throw TypeError("A trailing argument cannot be repeatable");if(i)throw TypeError("A trailing argument cannot configure numArgs");if(r.allowHyphenValues===!1)throw TypeError("A trailing argument must allow hyphen values")}}function Y(e,r){if(r===null||typeof r!=="object"||Array.isArray(r))throw TypeError(`${e} argument configuration must be an object`);let t=["describe","env","hide",...e==="positional"?[]:["global","short","long","aliases"],...e==="option"||e==="positional"?["valueName","valueHint","complete","required","default","repeatable","numArgs","valueDelimiter","valueTerminator","allowHyphenValues","allowNegativeNumbers"]:[],...e==="option"?["defaultMissing","requireEquals"]:[],...e==="positional"?["trailingVarArg"]:[],...e==="flag"?["negated"]:[]],o=e==="option"?["trailingVarArg"]:e==="positional"?["global","defaultMissing","requireEquals"]:[],i=Object.keys(r).find((a)=>!t.includes(a)&&!o.includes(a));if(i!==void 0)throw TypeError(`${e} arguments cannot configure ${i}`);let n=r;for(let a of["describe","env","long","valueName","valueDelimiter","valueTerminator"])if(n[a]!==void 0&&typeof n[a]!=="string")throw TypeError(`${e} argument option '${a}' must be a string`);for(let a of["hide","global","required","repeatable","requireEquals","allowHyphenValues","allowNegativeNumbers","trailingVarArg","negated"])if(n[a]!==void 0&&typeof n[a]!=="boolean")throw TypeError(`${e} argument option '${a}' must be a boolean`);if(n.short!==void 0){if(typeof n.short!=="string")throw TypeError(`${e} argument option 'short' must be a string`);if(n.short.length!==1||n.short==="-")throw TypeError("A short option must be one UTF-16 character other than '-'")}if(n.aliases!==void 0){if(!Array.isArray(n.aliases)||n.aliases.some((a)=>typeof a!=="string"))throw TypeError(`${e} argument option 'aliases' must be an array of strings`)}if(n.valueHint!==void 0&&n.valueHint!=="file"&&n.valueHint!=="directory")throw TypeError(`${e} argument option 'valueHint' must be 'file' or 'directory'`);if(n.complete!==void 0&&typeof n.complete!=="function")throw TypeError(`${e} argument option 'complete' must be a function`);if(n.numArgs!==void 0)if(typeof n.numArgs==="number")W(n.numArgs,n.numArgs);else{let a=n.numArgs;if(a===null||typeof a!=="object"||Array.isArray(a))throw TypeError(`${e} argument option 'numArgs' must be a number or range object`);let l=Object.keys(a).find((u)=>u!=="min"&&u!=="max");if(l!==void 0)throw TypeError(`${e} argument option 'numArgs' contains unsupported field '${l}'`);if(!("min"in a)||typeof a.min!=="number")throw TypeError(`${e} argument option 'numArgs.min' must be a number`);let s="max"in a?a.max:void 0;if(s!==void 0&&typeof s!=="number")throw TypeError(`${e} argument option 'numArgs.max' must be a number`);W(a.min,s)}}function Ae(e,r){Ge(e.kind,r);let t=ye(e,r);if(r.valueName!==void 0)t=h(t,{valueName:r.valueName});if(r.valueHint!==void 0)t=h(t,{completionHint:r.valueHint});if(r.complete!==void 0)t=h(t,{completion:r.complete});if(Object.hasOwn(r,"default"))t=h(t,{presence:"default",defaultValue:r.default});if(Object.hasOwn(r,"defaultMissing"))t=h(t,{minValues:0,maxValues:1,defaultMissingValue:r.defaultMissing,hasDefaultMissingValue:!0,requireEquals:!0});if(r.numArgs!==void 0){let o=typeof r.numArgs==="number"?r.numArgs:r.numArgs.min,i=typeof r.numArgs==="number"?r.numArgs:r.numArgs.max;W(o,i),t=h(t,{minValues:o,maxValues:i??null})}if(r.required===!0)t=h(t,{presence:"required"});if(r.repeatable===!0)t=h(t,{action:w.Append,repeatable:!0,presence:t.presence==="required"?"required":"optional",defaultValue:void 0});if(r.valueDelimiter!==void 0){if(Array.from(r.valueDelimiter).length!==1)throw TypeError("A value delimiter must be one character");t=h(t,{valueDelimiter:r.valueDelimiter})}if(r.valueTerminator!==void 0){if(r.valueTerminator.length===0)throw TypeError("A value terminator cannot be empty");t=h(t,{valueTerminator:r.valueTerminator})}if(r.requireEquals!==void 0)t=h(t,{requireEquals:r.requireEquals});if(r.allowHyphenValues!==void 0)t=h(t,{allowHyphenValues:r.allowHyphenValues});if(r.allowNegativeNumbers!==void 0)t=h(t,{allowNegativeNumbers:r.allowNegativeNumbers});if(r.trailingVarArg===!0)t=h(t,{minValues:t.presence==="required"?1:0,maxValues:null,trailingVarArg:!0,allowHyphenValues:!0});return t}function Wr(e,r=G.string,t={}){Y("option",t);let o=$e(U(e,"option",r),t);return N(Ae(o,t))}function _r(e,r=G.string,t={}){return N(Ae(U(e,"positional",r),t))}function Gr(e,r={}){Y("flag",r);let t=$e(U(e,"flag"),r);if(r.negated===!0)t=h(t,{action:w.SetFalse,defaultValue:!0});return N(t)}function Yr(e){let r=U(e,"flag");return N(h(r,{color:!0,negativeLong:`no-${e.replaceAll("_","-")}`,global:!0,env:"NO_COLOR",help:"Enable or disable color output"}))}var c=Object.freeze({UnknownArgument:"unknown-argument",InvalidSubcommand:"invalid-subcommand",InvalidValue:"invalid-value",NoEquals:"no-equals",MissingRequiredArgument:"missing-required-argument",MissingSubcommand:"missing-subcommand",ArgumentConflict:"argument-conflict",MissingDependency:"missing-dependency",TooFewValues:"too-few-values",TooManyValues:"too-many-values",InvalidDefinition:"invalid-definition"});class J extends Error{name="CliError";kind;exitCode;output;constructor(e,r,t,o=2){super(r);if(!Number.isSafeInteger(o)||o<1||o>255)throw RangeError("A CLI error exit code must be an integer from 1 to 255");this.kind=e,this.output=t,this.exitCode=o}}var x=Object.freeze({Help:"help",Version:"version"});function O(e){return[e.long,e.negativeLong,...e.aliases].filter((r)=>r!==void 0)}function Ye(e){let r=e.indexOf("=");return r===-1?{name:e.slice(2)}:{name:e.slice(2,r),inlineValue:e.slice(r+1)}}function Je(e){return Array.from(e.slice(1))}function qe(e){return/^-(?:\d|\.\d)/.test(e)}function Ke(e,r){return e.valueDelimiter===void 0?[r]:r.split(e.valueDelimiter)}function Ze(e,r){if(e.allowHyphenValues)return!1;if(e.allowNegativeNumbers&&qe(r))return!1;return r==="--"||r.startsWith("-")&&r!=="-"}function Ee(e,r){let t=e.subcommands.find((i)=>i.name===r||i.aliases.some(({name:n})=>n===r));if(t!==void 0)return{kind:"exact",command:t};if(!e.inferSubcommands)return{kind:"none"};let o=e.subcommands.filter((i)=>i.name.startsWith(r)||i.aliases.some(({name:n})=>n.startsWith(r)));if(o.length===1)return{kind:"unique",command:o[0]};return o.length===0?{kind:"none"}:{kind:"ambiguous",commands:o}}var Xe=new Set(["version","about","longAbout","author","beforeHelp","afterHelp","overrideUsage","overrideHelp","aliases","visibleAliases","args","subcommands","inferSubcommands","subcommandRequired","defaultToHelp","disableHelpSubcommand","disableHelpFlag","disableVersionFlag","hide","requires","requiresIf","requiredIfAny","requiredIfAll","requiredUnlessPresent","requiredUnlessAll","overrides","conflicts","exclusive","groups","handler"]),Qe=["version","about","longAbout","author","beforeHelp","afterHelp","overrideUsage","overrideHelp"],er=["inferSubcommands","subcommandRequired","defaultToHelp","disableHelpSubcommand","disableHelpFlag","disableVersionFlag","hide"],rr=new Set(["conditions","target"]),tr=new Set(["alternatives","target"]),ir=new Set(["name","members","required","multiple","requires","conflicts"]);function M(e,r,t){if(e===null||typeof e!=="object"||Array.isArray(e))throw TypeError(`${t} must be an object`);let o=Object.keys(e).find((i)=>!r.has(i));if(o!==void 0)throw TypeError(`${t} contains unsupported field '${o}'`)}function or(e,r){let t=e[r];if(t!==void 0&&typeof t!=="string")throw TypeError(`Command option '${r}' must be a string`)}function nr(e,r){let t=e[r];if(t!==void 0&&typeof t!=="boolean")throw TypeError(`Command option '${r}' must be a boolean`)}function E(e,r){if(!Array.isArray(e))throw TypeError(`${r} must be an array`);return e}function j(e,r,t=0){let o=E(e,r);if(o.length<t)throw TypeError(`${r} must contain at least ${t} value(s)`);if(o.some((i)=>typeof i!=="string"))throw TypeError(`${r} must contain only argument names`);return o}function K(e,r,t){let o=E(e,t);if(o.length!==r)throw TypeError(`${t} must contain exactly ${r} values`);return o}function ne(e,r){for(let t of E(e,r)){let o=K(t,2,`${r} entry`);if(typeof o[0]!=="string"||typeof o[1]!=="string")throw TypeError(`${r} entries must contain argument names`)}}function ar(e,r){for(let t of E(e,r)){let o=K(t,3,`${r} entry`);if(typeof o[0]!=="string"||typeof o[2]!=="string")throw TypeError(`${r} entries must contain argument names`)}}function lr(e,r){let t=E(e,r);if(t.length===0)throw TypeError(`${r} must contain a condition`);for(let o of t)if(typeof K(o,2,`${r} entry`)[0]!=="string")throw TypeError(`${r} entries must start with an argument name`)}function ae(e,r){for(let t of E(e,r))if(M(t,rr,`${r} entry`),lr(t.conditions,`${r} conditions`),typeof t.target!=="string")throw TypeError(`${r} target must be an argument name`)}function le(e,r){for(let t of E(e,r))if(M(t,tr,`${r} entry`),j(t.alternatives,`${r} alternatives`,1),typeof t.target!=="string")throw TypeError(`${r} target must be an argument name`)}function sr(e){for(let r of E(e,"Command option 'conflicts'"))j(r,"Command option 'conflicts' entry",2)}function ur(e){for(let r of E(e,"Command option 'groups'")){if(M(r,ir,"Command group"),typeof r.name!=="string")throw TypeError("Command group name must be a string");if(j(r.members,`Argument group '${r.name}' members`,1),r.required!==void 0&&typeof r.required!=="boolean")throw TypeError(`Argument group '${r.name}' required must be a boolean`);if(r.multiple!==void 0&&typeof r.multiple!=="boolean")throw TypeError(`Argument group '${r.name}' multiple must be a boolean`);if(r.requires!==void 0)j(r.requires,`Argument group '${r.name}' requirements`);if(r.conflicts!==void 0)j(r.conflicts,`Argument group '${r.name}' conflicts`)}}function mr(e){M(e,Xe,"Command configuration");for(let r of Qe)or(e,r);for(let r of er)nr(e,r);for(let r of["aliases","visibleAliases"])if(e[r]!==void 0)j(e[r],`Command option '${r}'`);for(let r of["args","subcommands"])if(e[r]!==void 0)E(e[r],`Command option '${r}'`);if(e.subcommandRequired===!0&&(e.subcommands===void 0||e.subcommands.length===0))throw TypeError("A command with subcommandRequired enabled must define at least one subcommand");if(e.requires!==void 0)ne(e.requires,"Command option 'requires'");if(e.requiresIf!==void 0)ar(e.requiresIf,"Command option 'requiresIf'");if(e.requiredIfAny!==void 0)ae(e.requiredIfAny,"Command option 'requiredIfAny'");if(e.requiredIfAll!==void 0)ae(e.requiredIfAll,"Command option 'requiredIfAll'");if(e.requiredUnlessPresent!==void 0)le(e.requiredUnlessPresent,"Command option 'requiredUnlessPresent'");if(e.requiredUnlessAll!==void 0)le(e.requiredUnlessAll,"Command option 'requiredUnlessAll'");if(e.overrides!==void 0)ne(e.overrides,"Command option 'overrides'");if(e.conflicts!==void 0)sr(e.conflicts);if(e.exclusive!==void 0)j(e.exclusive,"Command option 'exclusive'",1);if(e.groups!==void 0)ur(e.groups);if(e.handler!==void 0&&typeof e.handler!=="function")throw TypeError("Command option 'handler' must be a function")}function q(e,r,t){if(!e.has(r))throw TypeError(`${t} references unknown argument '${r}'`)}function H(e,r,t,o){if(q(e,r,o),q(e,t,o),r===t)throw TypeError(`${o} cannot target its source argument '${r}'`)}function k(e,r){if(new Set(e).size!==e.length)throw TypeError(`${r} cannot contain duplicate arguments`)}function fr(e,r){let t=new Set(r.arguments.map(({name:o})=>o));for(let[o,i]of e.requires??[])H(t,o,i,"Command option 'requires'");for(let[o,,i]of e.requiresIf??[])H(t,o,i,"Command option 'requiresIf'");for(let{conditions:o,target:i}of e.requiredIfAny??[]){q(t,i,"Command option 'requiredIfAny'");for(let[n]of o)H(t,n,i,"Command option 'requiredIfAny'")}for(let{conditions:o,target:i}of e.requiredIfAll??[]){q(t,i,"Command option 'requiredIfAll'");for(let[n]of o)H(t,n,i,"Command option 'requiredIfAll'")}for(let[o,i]of[["Command option 'requiredUnlessPresent'",e.requiredUnlessPresent],["Command option 'requiredUnlessAll'",e.requiredUnlessAll]])for(let{alternatives:n,target:a}of i??[]){q(t,a,o),k(n,o);for(let l of n)H(t,l,a,o)}for(let[o,i]of e.overrides??[])H(t,o,i,"Command option 'overrides'");for(let o of e.conflicts??[]){k(o,"Command option 'conflicts'");for(let i of o)q(t,i,"Command option 'conflicts'")}if(e.exclusive!==void 0){k(e.exclusive,"Command option 'exclusive'");for(let o of e.exclusive)q(t,o,"Command option 'exclusive'")}for(let o of e.groups??[]){k(o.members,`Argument group '${o.name}'`);for(let i of o.members)q(t,i,`Argument group '${o.name}'`);for(let i of o.requires??[])q(t,i,`Argument group '${o.name}' requirements`);for(let i of o.conflicts??[])q(t,i,`Argument group '${o.name}' conflicts`)}}function _(e){if(typeof e!=="string")throw TypeError("Invalid command name: expected a string");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(e))throw TypeError(`Invalid command name: ${JSON.stringify(e)}`)}function se(e,r){if(r===e.name||e.aliases.some(({name:t})=>t===r))throw TypeError(`Duplicate command alias: ${r}`)}function dr(e,r){let t=e.arguments;if(t.some(({name:a})=>a===r.name))throw TypeError(`Duplicate argument: ${r.name}`);if(r.color&&t.some((a)=>a.color))throw TypeError("A command cannot contain more than one color flag");if(r.kind==="positional"){if(r.short!==void 0||r.long!==void 0)throw TypeError(`Positional '${r.name}' cannot have option names`);let a=t.filter(({kind:s})=>s==="positional");if(r.maxValues===0)throw TypeError(`Positional '${r.name}' must accept at least one value`);let l=a.at(-1);if(l!==void 0&&(l.repeatable||l.trailingVarArg||l.maxValues===null))throw TypeError(`No positional can follow repeatable or unbounded '${l.name}'`);if(r.presence==="required"&&a.some(({presence:s})=>s!=="required"))throw TypeError("A required positional cannot follow an optional positional")}if(r.kind!=="positional"&&r.trailingVarArg)throw TypeError(`Named argument '${r.name}' cannot be trailing`);if(r.kind==="positional"&&r.global)throw TypeError(`Positional '${r.name}' cannot be global`);let o=new Set([...e.disableHelpFlag?[]:["help"],...e.version===void 0||e.disableVersionFlag?[]:["version"]]),i=new Set([...e.disableHelpFlag?[]:["h"],...e.version===void 0||e.disableVersionFlag?[]:["V"]]),n=O(r);if(new Set(n).size!==n.length)throw TypeError(`Argument '${r.name}' has duplicate long options`);for(let a of n){if(o.has(a))throw TypeError(`Option '--${a}' is reserved`);if(t.some((l)=>O(l).includes(a)))throw TypeError(`Duplicate long option: --${a}`)}if(r.short!==void 0){if(i.has(r.short))throw TypeError(`Option '-${r.short}' is reserved`);if(t.some(({short:a})=>a===r.short))throw TypeError(`Duplicate short option: -${r.short}`)}}function Te(e,r){let t=[...e.arguments,...r];if(!e.disableHelpFlag&&t.some((i)=>i.short==="h"||O(i).includes("help")))throw TypeError("Help flags conflict with an existing argument");if(e.version!==void 0&&!e.disableVersionFlag&&t.some((i)=>i.short==="V"||O(i).includes("version")))throw TypeError("Version flags conflict with an existing argument");let o=[...r,...e.arguments.filter(({global:i})=>i)];if(o.filter(({color:i})=>i).length>1)throw TypeError("An active command path cannot contain more than one color flag");for(let i of e.subcommands)Te(i,o)}var Ve=new WeakMap;function Oe(e,r){Ve.set(e,r)}function g(e){let r=Ve.get(e);if(r===void 0)throw TypeError("Expected a command created by command()");return r}function cr(e,r){let t={...e,...r},o=Object.freeze({...t,aliases:Object.freeze(t.aliases.map((i)=>Object.freeze({...i}))),arguments:Object.freeze([...t.arguments]),subcommands:Object.freeze([...t.subcommands]),requirements:Object.freeze(t.requirements.map((i)=>Object.freeze({...i}))),conditionalRequirements:Object.freeze(t.conditionalRequirements.map((i)=>Object.freeze({...i}))),conditionalSetRequirements:Object.freeze(t.conditionalSetRequirements.map((i)=>Object.freeze({...i,conditions:Object.freeze(i.conditions.map((n)=>Object.freeze({...n})))}))),requiredUnless:Object.freeze(t.requiredUnless.map((i)=>Object.freeze({...i,alternatives:Object.freeze([...i.alternatives])}))),requiredUnlessAll:Object.freeze(t.requiredUnlessAll.map((i)=>Object.freeze({...i,alternatives:Object.freeze([...i.alternatives])}))),exclusiveArguments:Object.freeze([...t.exclusiveArguments]),overrides:Object.freeze(t.overrides.map((i)=>Object.freeze({...i}))),conflicts:Object.freeze(t.conflicts.map((i)=>Object.freeze([...i]))),groups:Object.freeze(t.groups.map((i)=>Object.freeze({...i,members:Object.freeze([...i.members]),requires:Object.freeze([...i.requires]),conflicts:Object.freeze([...i.conflicts])})))});return Te(o,[]),o}function S(e){if(e.kind==="positional")return`<${e.name}>`;if(e.long!==void 0)return`--${e.long}`;if(e.short!==void 0)return`-${e.short}`;return e.name}function v(e,r){let t=e.arguments.find((o)=>o.name===r);return t===void 0?r:S(t)}function p(e,r,t,o,i=[]){let n=je(t,o,i),a=pr(r);return new J(e,a,`error: ${a}
|
|
3
|
+
|
|
4
|
+
${n}
|
|
5
|
+
|
|
6
|
+
For more information, try '--help'.
|
|
7
|
+
`)}function pr(e){return e.replace(/[\p{Cc}\p{Cf}]/gu,(r)=>{if(r===`
|
|
8
|
+
`)return"\\n";if(r==="\r")return"\\r";if(r==="\t")return"\\t";let t=r.codePointAt(0);return t===void 0?"":`\\u{${t.toString(16)}}`})}function R(e,r,t=[]){let o=[...[...r.arguments,...t].flatMap((l)=>[...O(l).map((s)=>`--${s}`),...l.short===void 0?[]:[`-${l.short}`]]),...r.subcommands.flatMap((l)=>[l.name,...l.aliases.map(({name:s})=>s)])],i,n=Number.POSITIVE_INFINITY;for(let l of o){let s=gr(e,l);if(s<n)i=l,n=s}let a=Math.max(1,Math.floor(e.length/3));return i!==void 0&&n<=a?`; a similar argument exists: '${i}'`:""}function gr(e,r){let t=Array.from({length:r.length+1},(o,i)=>i);for(let o=1;o<=e.length;o+=1){let i=[o];for(let n=1;n<=r.length;n+=1){let a=t[n-1]??0,l=t[n]??0,s=i[n-1]??0;i[n]=e[o-1]===r[n-1]?a:1+Math.min(a,l,s)}t.splice(0,t.length,...i)}return t[r.length]??0}function xe(e,r,t){if(e.overrideUsage!==void 0)return e.overrideUsage;let o=[...e.arguments,...t],i=o.filter((s)=>s.kind!=="positional"&&s.presence==="required"&&!s.hidden),n=o.some(({kind:s,presence:u,hidden:f})=>s!=="positional"&&u!=="required"&&!f),a=i.map((s)=>`${S(s)}${Z(s)}`),l=e.arguments.filter(({kind:s,hidden:u})=>s==="positional"&&!u).map((s)=>{let u=s.valueName??s.name.toUpperCase();return Se(s,u)});return[r.join(" "),...n?["[OPTIONS]"]:[],...a,...l,...e.subcommands.some(({hidden:s})=>!s)?["<COMMAND>"]:[]].join(" ")}function je(e,r,t=[]){return`Usage: ${xe(e,r,t)}`}function C(e,r,t=[],o=!0){if(e.overrideHelp!==void 0)return e.overrideHelp;let i=[];if(e.beforeHelp!==void 0)i.push(e.beforeHelp);if(e.about!==void 0)i.push(e.about,"");if(e.author!==void 0)i.push(`Author: ${e.author}`,"");i.push(je(e,r,t));let n=e.arguments.filter((s)=>s.kind==="positional"&&!s.hidden);if(n.length>0){i.push("","Arguments:");let s=n.map((u)=>{let f=u.valueName??u.name.toUpperCase();return[` ${Se(u,f)}`,me(u)]});D(i,s)}let a=e.subcommands.filter(({hidden:s})=>!s);if(a.length>0){i.push("","Commands:");let s=a.map((u)=>{let f=u.aliases.filter(({visible:m})=>m).map(({name:m})=>m);return[` ${f.length===0?u.name:`${u.name} (aliases: ${f.join(", ")})`}`,u.about??""]});if(a.length>0&&!e.disableHelpSubcommand)s.push([" help","Print help for a subcommand"]);D(i,s)}let l=[...e.arguments,...t].filter((s)=>s.kind!=="positional"&&!s.hidden).map((s)=>{let u=[...s.short===void 0?[]:[`-${s.short}`],...s.long===void 0?[]:[`--${s.long}`],...s.negativeLong===void 0?[]:[`--${s.negativeLong}`]].join(", "),f=s.kind!=="option"?"":s.requireEquals?vr(s):Z(s);return[` ${u}${f}`,me(s)]});if(!e.disableHelpFlag)l.push([" -h, --help","Print help"]);if(e.version!==void 0&&!e.disableVersionFlag)l.push([" -V, --version","Print version"]);if(l.length>0)i.push("","Options:"),D(i,l);if(o&&e.longAbout!==void 0)i.push("",e.longAbout);if(e.afterHelp!==void 0)i.push("",e.afterHelp);return`${i.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`}function hr(e){return e.valueName??e.parser?.label??"VALUE"}var ue=8;function He(e,r){if(e<=ue&&(r===null||r<=ue))return;if(r===null)return`{${e}..}`;return e===r?`{${e}}`:`{${e}..${r}}`}function Z(e,r=e.minValues){if(e.kind!=="option"||e.maxValues===0)return"";let t=`<${hr(e)}>`,o=He(r,e.maxValues);if(o!==void 0)return` ${t}${o}${e.repeatable?"...":""}`;if(e.maxValues===null){if(r===0)return` [${t}...]`;return` ${[...Array(Math.max(0,r-1)).fill(t),`${t}...`].join(" ")}`}let i=Array(r).fill(t),n=Array(e.maxValues-r).fill(`[${t}]`),a=[...i,...n],l=e.repeatable?"...":"";return a.length===0?"":` ${a.join(" ")}${l}`}function vr(e){let r=e.minValues===0&&e.maxValues!==0?1:e.minValues,t=Z(e,r).trimStart();return e.minValues===0?`[=${t}]`:`=${t}`}function Se(e,r){let t=`<${r}>`,o=`[${r}]`,i=He(e.minValues,e.maxValues);if(i!==void 0)return`${e.presence==="required"?t:o}${i}${e.repeatable?"...":""}`;if(e.maxValues===null){if(e.presence!=="required"){if(e.minValues<=1)return`${o}...`;return`[${[...Array(e.minValues-1).fill(t),`${t}...`].join(" ")}]`}return[...Array(Math.max(0,e.minValues-1)).fill(t),`${t}...`].join(" ")}let n=e.presence==="required"?e.minValues:0,a=Array(n).fill(t),l=Array(e.maxValues-n).fill(o),s=e.repeatable?"...":"";return`${[...a,...l].join(" ")}${s}`}function me(e){let r=[];if(e.help!==void 0)r.push(e.help);if(e.env!==void 0)r.push(`[env: ${e.env}]`);if(e.presence==="default"&&e.kind!=="flag"&&e.kind!=="count")r.push(`[default: ${String(e.defaultValue)}]`);return r.join(" ")}function D(e,r){let t=Math.max(0,...r.map(([o])=>Bun.stringWidth(o)));for(let[o,i]of r){let n=" ".repeat(t-Bun.stringWidth(o));e.push(i===""?o:`${o}${n} ${i}`)}}function br(e,r){for(let{source:t,target:o}of e.overrides){if(!r.cliProvided.has(t))continue;let i=e.arguments.find(({name:n})=>n===o);if(i===void 0)continue;r.values[o]=i.repeatable||i.trailingVarArg?[]:i.presence==="default"?i.defaultValue:void 0,r.provided.delete(o),r.cliProvided.delete(o),delete r.valueCounts[o]}}function fe(e,r){return Array.isArray(e)?e.some((t)=>Object.is(t,r)):Object.is(e,r)}function wr(e,r,t,o){for(let{source:i,target:n}of e.requirements)if(t.provided.has(i)&&!t.provided.has(n))throw p(c.MissingDependency,`argument '${v(e,i)}' requires '${v(e,n)}'`,e,r,o);for(let{source:i,expected:n,target:a}of e.conditionalRequirements)if(fe(t.values[i],n)&&!t.provided.has(a))throw p(c.MissingDependency,`argument '${v(e,i)}' requires '${v(e,a)}' when its value is '${String(n)}'`,e,r,o);for(let i of e.conditionalSetRequirements){let n=i.conditions.map(({source:a,expected:l})=>t.provided.has(a)&&fe(t.values[a],l));if((i.match==="any"?n.some(Boolean):n.every(Boolean))&&!t.provided.has(i.target)){let a=i.match==="any"?" or ":" and ",l=i.conditions.map(({source:s,expected:u})=>`'${v(e,s)}=${String(u)}'`).join(a);throw p(c.MissingDependency,`argument '${v(e,i.target)}' is required when ${l}`,e,r,o)}}for(let{target:i,alternatives:n}of e.requiredUnless)if(!t.provided.has(i)&&!n.some((a)=>t.provided.has(a)))throw p(c.MissingRequiredArgument,`argument '${v(e,i)}' is required unless ${n.map((a)=>`'${v(e,a)}'`).join(" or ")} is present`,e,r,o);for(let{target:i,alternatives:n}of e.requiredUnlessAll)if(!t.provided.has(i)&&!n.every((a)=>t.provided.has(a)))throw p(c.MissingRequiredArgument,`argument '${v(e,i)}' is required unless all of ${n.map((a)=>`'${v(e,a)}'`).join(" and ")} are present`,e,r,o);for(let i of e.exclusiveArguments){if(!t.provided.has(i))continue;let n=[...t.provided].filter((a)=>a!==i);if(n.length>0)throw p(c.ArgumentConflict,`argument '${v(e,i)}' cannot be used with ${n.map((a)=>`'${v(e,a)}'`).join(" and ")}`,e,r,o)}for(let i of e.conflicts){let n=i.filter((a)=>t.provided.has(a));if(n.length>1)throw p(c.ArgumentConflict,`arguments ${n.map((a)=>`'${v(e,a)}'`).join(" and ")} cannot be used together`,e,r,o)}for(let i of e.groups){let n=i.members.filter((a)=>t.provided.has(a));if(i.required&&n.length===0)throw p(c.MissingRequiredArgument,`one of group '${i.name}' is required: ${i.members.map((a)=>v(e,a)).join(", ")}`,e,r,o);if(!i.multiple&&n.length>1)throw p(c.ArgumentConflict,`arguments in group '${i.name}' cannot be used together: ${n.map((a)=>v(e,a)).join(", ")}`,e,r,o);if(n.length>0){let a=i.requires.find((s)=>!t.provided.has(s));if(a!==void 0)throw p(c.MissingDependency,`argument group '${i.name}' requires '${v(e,a)}'`,e,r,o);let l=i.conflicts.find((s)=>t.provided.has(s));if(l!==void 0)throw p(c.ArgumentConflict,`argument group '${i.name}' conflicts with '${v(e,l)}'`,e,r,o)}}}class V{outcome;constructor(e){this.outcome=e}}var ze=new WeakMap;function Ce(e,r,t){let o={defaultColor:t};try{return{ok:!0,type:"value",value:ke(e,[...r],[e.name],[],o)}}catch(i){if(o.colorMode!==void 0){let n=i instanceof V?i.outcome:i;if(typeof n==="object"&&n!==null)ze.set(n,o.colorMode)}if(i instanceof V)return i.outcome;throw i}}function de(e,r,t){try{return Ce(e,r,t)}catch(o){if(o instanceof J)return{ok:!1,type:"error",error:o};throw o}}function ke(e,r,t,o,i){let n={values:{},provided:new Set,cliProvided:new Set,valueCounts:{},session:i,positionalIndex:0},a=e.arguments.filter(({kind:m})=>m==="positional");yr(e,n),Tr(e,o);let l=e.arguments.filter(({global:m})=>m).map((m)=>({argument:m,state:n})),s=[...o,...l],u=0,f=!0;while(u<r.length){let m=r[u];if(m===void 0)break;if(f&&m==="--"){f=!1,u+=1;continue}if(f&&!e.disableHelpFlag&&(m==="--help"||m==="-h"))throw new V({ok:!0,type:"display",kind:x.Help,output:C(e,t,o.map(({argument:A})=>A))});if(f&&!e.disableVersionFlag&&e.version!==void 0&&(m==="--version"||m==="-V"))throw new V({ok:!0,type:"display",kind:x.Version,output:`${e.name} ${e.version}
|
|
11
|
+
`});let d=Er(a,n),T=f&&d!==void 0&&Ar(d,m,e,n,o);if(f&&!T&&m.startsWith("--")&&m.length>2){u=jr(e,r,u,m,t,n,o);continue}if(f&&!T&&m.startsWith("-")&&m!=="-"){u=Hr(e,r,u,m,t,n,o);continue}if(f&&!T){if(m==="help"&&e.subcommands.length>0&&!e.disableHelpSubcommand&&!Vr(e,m))throw new V({ok:!0,type:"display",kind:x.Help,output:xr(e,r.slice(u+1),t,o)});let A=Or(e,m,t,o);if(A!==void 0){n.subcommand=Object.freeze({name:A.name,args:ke(A,r.slice(u+1),[...t,A.name],s,i)}),u=r.length;break}}if(d===void 0){let A=R(m,e,o.map(({argument:P})=>P)),y=e.subcommands.length>0?c.InvalidSubcommand:c.UnknownArgument;throw p(y,`unexpected argument '${m}'${A}`,e,t,o.map(({argument:P})=>P))}if(d.valueTerminator===m){n.positionalIndex+=1,u+=1;continue}Sr(d,m,e,t,n);let F=n.valueCounts[d.name]??0;if(!d.repeatable&&d.maxValues!==null&&F>=d.maxValues)n.positionalIndex+=1;if(d.trailingVarArg)f=!1;u+=1}if($r(e,n,t),br(e,n),zr(e,t,n,o.map(({argument:m})=>m)),e.subcommands.length>0)n.values.subcommand=n.subcommand;for(let m of Object.values(n.values))if(Array.isArray(m))Object.freeze(m);return Object.freeze(n.values)}function yr(e,r){for(let t of e.arguments)if(t.color){let o=Bun.env.NO_COLOR!==void 0;r.values[t.name]=o?!1:r.session.defaultColor,r.session.colorMode=o?"never":"auto"}else if(t.repeatable||t.trailingVarArg)r.values[t.name]=[];else if(t.presence==="default")r.values[t.name]=t.defaultValue;else r.values[t.name]=void 0}function $r(e,r,t){let o=new Set(e.overrides.filter(({source:i})=>r.cliProvided.has(i)).map(({target:i})=>i));for(let i of e.arguments){if(i.env===void 0||r.cliProvided.has(i.name)||o.has(i.name))continue;let n=Bun.env[i.env];if(n===void 0)continue;if(i.kind==="flag"){if(r.values[i.name]=i.color?!1:i.action===w.SetTrue,i.color)r.session.colorMode="never";r.provided.add(i.name);continue}let a=`env:${i.env}`;if(i.kind==="count"){let s=Ue(i,n,a,e,t,G.integer,!0);if(typeof s!=="number"||s<0)throw p(c.InvalidValue,`invalid value for '${a}'`,e,t);r.values[i.name]=s,r.provided.add(i.name);continue}let l=ee(i,n);if(!(i.repeatable&&i.maxValues===1)&&i.maxValues!==null&&l.length>i.maxValues)throw p(c.TooManyValues,`argument '${a}' accepts at most ${i.maxValues} value(s)`,e,t);B(i,l,a,e,t,r,!0),r.cliProvided.delete(i.name)}}function Ar(e,r,t,o,i){if(r==="--"||r==="-"||!r.startsWith("-"))return!1;if(qr(r,t,o,i))return!1;return e.allowHyphenValues||e.allowNegativeNumbers&&qe(r)}function qr(e,r,t,o){let i=X(r,t,o);if(e.startsWith("--")){let a=e.slice(2).split("=",1)[0];return i.some(({argument:l})=>a!==void 0&&O(l).includes(a))}let n=Array.from(e.slice(1))[0];return n!==void 0&&i.some(({argument:a})=>a.short===n)}function Er(e,r){return e[r.positionalIndex]}function X(e,r,t){return[...e.arguments.map((o)=>({argument:o,state:r})),...t]}function Tr(e,r){for(let t of e.arguments)for(let{argument:o}of r){let i=O(t),n=O(o);if(t.color&&o.color||t.short!==void 0&&t.short===o.short||i.some((a)=>n.includes(a)))throw TypeError(`Argument '${t.name}' conflicts with inherited global '${o.name}'`)}}function Vr(e,r){return Ee(e,r).kind==="exact"}function Or(e,r,t,o){return Q(e,r,t,o.map(({argument:i})=>i))}function Q(e,r,t,o){let i=Ee(e,r);if(i.kind==="exact"||i.kind==="unique")return i.command;if(i.kind==="ambiguous")throw p(c.InvalidSubcommand,`subcommand '${r}' is ambiguous: ${i.commands.map(({name:n})=>n).join(", ")}`,e,t,o);return}function xr(e,r,t,o){let i=e,n=[...t],a=o.map(({argument:l})=>l);for(let l of r){let s=[...a,...i.arguments.filter(({global:f})=>f)],u=Q(i,l,n,s);if(u===void 0)throw p(c.InvalidSubcommand,`unrecognized subcommand '${l}'${R(l,i,s)}`,i,n,a);i=u,n=[...n,u.name],a=s}return C(i,n,a)}function jr(e,r,t,o,i,n,a){let{name:l,inlineValue:s}=Ye(o),u=X(e,n,a).find(({argument:d})=>O(d).includes(l));if(u===void 0||u.argument.kind==="positional")throw p(c.UnknownArgument,`unexpected argument '--${l}'${R(`--${l}`,e,a.map(({argument:d})=>d))}`,e,i,a.map(({argument:d})=>d));let{argument:f}=u;if(f.kind==="flag"||f.kind==="count"){if(s!==void 0)throw p(c.TooManyValues,`argument '--${l}' does not accept a value`,e,i);return Ne(f,`--${l}`,e,i,u.state,a.map(({argument:d})=>d),f.negativeLong===l?!1:void 0),t+1}if(f.requireEquals&&s===void 0){if(f.hasDefaultMissingValue)return z(f,[f.defaultMissingValue],`--${l}`,e,i,u.state),t+1;throw p(c.NoEquals,`an equals sign is required for '--${l}=<VALUE>'`,e,i,a.map(({argument:d})=>d))}let m=Ie(f,r,t,s,e,i,`--${l}`,a.map(({argument:d})=>d));if(m.values.length===0&&f.hasDefaultMissingValue)z(f,[f.defaultMissingValue],`--${l}`,e,i,u.state);else B(f,m.values,`--${l}`,e,i,u.state);return m.nextIndex}function Hr(e,r,t,o,i,n,a){let l=Je(o);for(let s=0;s<l.length;s+=1){let u=l[s];if(u===void 0)continue;let f=X(e,n,a).find(({argument:y})=>y.short===u);if(f===void 0||f.argument.kind==="positional")throw p(c.UnknownArgument,`unexpected argument '-${u}'${R(`-${u}`,e,a.map(({argument:y})=>y))}`,e,i,a.map(({argument:y})=>y));let{argument:m}=f;if(m.kind==="flag"||m.kind==="count"){Ne(m,`-${u}`,e,i,f.state,a.map(({argument:y})=>y));continue}let d=l.slice(s+1).join(""),T=d!=="",F=d.startsWith("=")?d.slice(1):d;if(m.requireEquals&&!T){if(m.hasDefaultMissingValue)return z(m,[m.defaultMissingValue],`-${u}`,e,i,f.state),t+1;throw p(c.NoEquals,`an attached value is required for '-${u}<VALUE>'`,e,i,a.map(({argument:y})=>y))}let A=Ie(m,r,t,T?F:void 0,e,i,`-${u}`,a.map(({argument:y})=>y));if(A.values.length===0&&m.hasDefaultMissingValue)z(m,[m.defaultMissingValue],`-${u}`,e,i,f.state);else B(m,A.values,`-${u}`,e,i,f.state);return A.nextIndex}return t+1}function Ie(e,r,t,o,i,n,a,l){let s=[],u=0,f=t+1,m=(d)=>{let T=ee(e,d);if(!(e.repeatable&&e.maxValues===1)&&e.maxValues!==null&&s.length+T.length>e.maxValues)throw p(c.TooManyValues,`argument '${a}' accepts at most ${e.maxValues} value(s)`,i,n,l);s.push(...T),u+=1};if(o!==void 0)m(o);while((e.maxValues===null||s.length<e.maxValues)&&!(e.repeatable&&e.maxValues===1&&u>=1)){let d=r[f];if(d===void 0)break;if(e.valueTerminator===d){f+=1;break}if(Ze(e,d)||s.length>=e.minValues&&Q(i,d,n,l)!==void 0)break;m(d),f+=1}if(s.length<e.minValues)throw p(c.TooFewValues,`argument '${a}' requires at least ${e.minValues} value(s)`,i,n,l);return{values:s,nextIndex:f}}function ee(e,r){return Ke(e,r)}function Sr(e,r,t,o,i){let n=ee(e,r),a=i.valueCounts[e.name]??0;if(!e.repeatable&&e.maxValues!==null&&a+n.length>e.maxValues)throw p(c.TooManyValues,`argument '${S(e)}' accepts at most ${e.maxValues} value(s)`,t,o);B(e,n,r,t,o,i)}function B(e,r,t,o,i,n,a=!1){z(e,r.map((l)=>Ue(e,l,t,o,i,e.parser,a)),t,o,i,n)}function z(e,r,t,o,i,n){let a=e.repeatable||e.trailingVarArg||e.maxValues!==1;if(e.env!==void 0&&n.provided.has(e.name)&&!n.cliProvided.has(e.name))n.values[e.name]=a?[]:void 0,n.provided.delete(e.name),delete n.valueCounts[e.name];if(e.kind==="option"&&!e.repeatable&&n.cliProvided.has(e.name))throw p(c.ArgumentConflict,`argument '${t}' cannot be used more than once`,o,i);if(a){let l=n.values[e.name];if(l===void 0)n.values[e.name]=[...r];else if(Array.isArray(l))l.push(...r);else throw Error(`Internal parser state for '${e.name}' is not an array`)}else if(r.length>0)n.values[e.name]=r[0];n.valueCounts[e.name]=(n.valueCounts[e.name]??0)+r.length,n.provided.add(e.name),n.cliProvided.add(e.name)}function Ne(e,r,t,o,i,n,a){if(e.action===w.Help||e.action===w.HelpShort||e.action===w.HelpLong)throw new V({ok:!0,type:"display",kind:x.Help,output:C(t,o,n,e.action!==w.HelpShort)});if(e.action===w.Version){if(t.version===void 0)throw TypeError(`Command '${o.join(" ")}' must define a version for '${r}'`);throw new V({ok:!0,type:"display",kind:x.Version,output:`${t.name} ${t.version}
|
|
12
|
+
`})}if(e.env!==void 0&&i.provided.has(e.name)&&!i.cliProvided.has(e.name))i.values[e.name]=e.defaultValue,i.provided.delete(e.name);if(e.action===w.SetTrue||e.action===w.SetFalse){if(i.cliProvided.has(e.name))throw p(c.ArgumentConflict,`argument '${r}' cannot be used more than once`,t,o);let l=a??e.action===w.SetTrue;if(i.values[e.name]=e.color&&Bun.env.NO_COLOR!==void 0?!1:l,e.color)i.session.colorMode=i.values[e.name]===!0?"always":"never"}else if(e.action===w.Count){let l=i.values[e.name];i.values[e.name]=typeof l==="number"?l+1:1}else throw Error(`Action '${e.action}' is not a switch action`);i.provided.add(e.name),i.cliProvided.add(e.name)}function Ue(e,r,t,o,i,n=e.parser,a=!1){if(n===void 0)throw Error(`Argument '${e.name}' has no value parser`);try{let l=n.parse(r);if(l===void 0)throw TypeError("a value parser returned undefined");return l}catch(l){let s=l instanceof Error?l.message:String(l);throw p(c.InvalidValue,a?`invalid value for '${t}'`:`invalid value '${r}' for '${t}': ${s}`,o,i)}}function zr(e,r,t,o){let i=e.arguments.filter((a)=>a.presence==="required"&&!t.provided.has(a.name)).map(S);if(i.length>0)throw p(c.MissingRequiredArgument,`the following required arguments were not provided: ${i.join(", ")}`,e,r,o);let n=e.arguments.find((a)=>(a.kind==="option"||a.kind==="positional")&&t.provided.has(a.name)&&(t.valueCounts[a.name]??0)<a.minValues);if(n!==void 0)throw p(c.TooFewValues,`argument '${S(n)}' requires at least ${n.minValues} value(s)`,e,r,o);if(e.argRequiredElseHelp&&t.provided.size===0&&t.subcommand===void 0)throw new V({ok:!0,type:"display",kind:x.Help,output:C(e,r,o)});if(e.subcommandRequired&&t.subcommand===void 0)throw p(c.MissingSubcommand,"a subcommand is required but one was not provided",e,r,o);wr(e,r,t,o)}function Me(e,r,t,o=[]){let i=[...o,...e.arguments.filter((l)=>l.global&&Object.hasOwn(r,l.name)).map((l)=>({argument:l,value:r[l.name]}))],n=r.subcommand;if(typeof n!=="object"||n===null||!("name"in n)||!("args"in n)||typeof n.name!=="string"||typeof n.args!=="object"||n.args===null)return{definition:e,args:r,globals:i,path:t};let a=e.subcommands.find(({name:l})=>l===n.name);if(a===void 0)throw Error(`Internal parser result references unknown subcommand '${n.name}'`);return Me(a,n.args,[...t,a.name],i)}function L(e={}){if(Bun.env.NO_COLOR!==void 0)return!1;return e.color??(process.stdout.isTTY===!0&&Bun.env.TERM!=="dumb")}function Cr(e,r={}){let t={stderr:{stream:process.stderr,writer:r.stderr},stdout:{stream:process.stdout,writer:r.stdout}}[e],o=t.writer===void 0&&t.stream.isTTY===!0&&Bun.env.TERM!=="dumb";return r.color??o}function Re(e,r,t){let o=ze.get(e);if(o===void 0)return;if(Bun.env.NO_COLOR!==void 0||o==="never")return{enabled:!1,force:!1};if(o==="always")return{enabled:!0,force:!0};return{enabled:Cr(r,t),force:t.color===!0}}function kr(e,r){let t=r.stderr??((i)=>console.error(i.trimEnd())),o=Re(e,"stderr",r);return t(o?.enabled===!0?Rr(e.output,o.force):e.output),e.exitCode}var I=Object.freeze({strong:"\x1B[1m",reset:"\x1B[0m"}),Ir="#0891b2",Nr="#dc2626";function Ur(e){let r=e?"ansi-16m":"ansi",t=Bun.color(Ir,r)??"";return{heading:`${I.strong}${t}`,label:t,...I}}function Mr(e){return e.color??(e.stdout===void 0&&process.stdout.isTTY===!0&&Bun.env.NO_COLOR===void 0&&Bun.env.TERM!=="dumb")}function Be(e,r){return e.overrideHelp===r||e.subcommands.some((t)=>Be(t,r))}function Fe(e,r){let t=Ur(r),o=!1;return e.split(`
|
|
13
|
+
`).map((i)=>{if(/^(Arguments|Commands|Options):$/.test(i))return o=!0,`${t.heading}${i}${t.reset}`;if(i==="")return o=!1,i;if(i.startsWith("Usage: "))return`${t.heading}Usage:${t.reset} ${t.strong}${i.slice(7)}${t.reset}`;if(i.startsWith("Author: "))return`${t.heading}Author:${t.reset} ${i.slice(8)}`;if(o&&i.startsWith(" ")){let n=i.slice(2),a=/^(.*?\S)( {2,})(\S.*)$/.exec(n);if(a!==null){let l=a[1]??"",s=a[2]??"",u=a[3]??"";return` ${t.label}${l}${t.reset}${s}${u}`}return` ${t.label}${n}${t.reset}`}return i}).join(`
|
|
14
|
+
`)}function Rr(e,r){let t=r?"ansi-16m":"ansi",o=Bun.color(Nr,t)??"",i=Fe(e,r);return`${I.strong}${o}error:${I.reset}${i.slice(6)}`}function Br(e,r,t){let o=t.stdout??((a)=>console.log(a.trimEnd())),i=Re(r,"stdout",t),n=r.kind===x.Help&&(i?.enabled??Mr(t))&&!Be(e,r.output)?Fe(r.output,i?.force??t.color===!0):r.output;return o(n),0}function Fr(e){if(e===void 0)return 0;if(!Number.isSafeInteger(e)||e<0||e>255)throw RangeError("A command handler exit code must be an integer from 0 to 255");return e}async function Pr(e,r,t){if(r.type==="error")return kr(r.error,t);if(r.type==="display")return Br(e,r,t);let o=Me(e,r.value,[e.name]);if(o.definition.handler===void 0)throw TypeError(`No handler is configured for command '${o.path.join(" ")}'`);let i=Object.freeze({commandPath:Object.freeze([...o.path]),global(a){let l=be(a);if(!l.global)throw TypeError(`Argument '${l.name}' is not global`);let s=o.globals.find((u)=>u.argument===l);if(s===void 0)throw TypeError(`Global argument '${l.name}' is not registered for command '${o.path.join(" ")}'`);return s.value}}),n=await o.definition.handler(o.args,i);return Fr(n)}function ce(e){return e.map(([r,t])=>({source:r,expected:t}))}function pe(e){if(e.some((r,t)=>e.findIndex((o)=>o.source===r.source&&Object.is(o.expected,r.expected))!==t))throw TypeError("A conditional requirement cannot contain duplicate conditions")}function ge(e,r,t,o){let i=e.find(({name:a})=>a===r);if(i===void 0)throw TypeError(`Unknown argument group: ${r}`);let n=[...i[t],...o];if(new Set(n).size!==n.length)throw TypeError(`Group '${r}' has duplicate ${t}`);return e.map((a)=>a.name===r?{...a,[t]:n}:a)}class re{constructor(e){Oe(this,e)}with(e){return new re(cr(g(this),e))}about(e){return this.with({about:e})}longAbout(e){return this.with({longAbout:e})}author(e){return this.with({author:e})}beforeHelp(e){return this.with({beforeHelp:e})}afterHelp(e){return this.with({afterHelp:e})}overrideUsage(e){return this.with({overrideUsage:e})}overrideHelp(e){return this.with({overrideHelp:e})}alias(e){_(e);let r=g(this);return se(r,e),this.with({aliases:[...r.aliases,{name:e,visible:!1}]})}visibleAlias(e){_(e);let r=g(this);return se(r,e),this.with({aliases:[...r.aliases,{name:e,visible:!0}]})}inferSubcommands(e=!0){return this.with({inferSubcommands:e})}disableHelpSubcommand(e=!0){return this.with({disableHelpSubcommand:e})}disableHelpFlag(e=!0){return this.with({disableHelpFlag:e})}disableVersionFlag(e=!0){return this.with({disableVersionFlag:e})}version(e){return this.with({version:e})}hide(e=!0){return this.with({hidden:e})}arg(e){let r=g(this),t=be(e);return dr(r,t),this.with({arguments:[...r.arguments,t]})}subcommand(e){let r=g(this),t=g(e),o=new Set([t.name,...t.aliases.map(({name:n})=>n)]),i=r.subcommands.flatMap((n)=>[n.name,...n.aliases.map(({name:a})=>a)]).find((n)=>o.has(n));if(i!==void 0)throw TypeError(`Duplicate subcommand name or alias: ${i}`);return this.with({subcommands:[...r.subcommands,t]})}requireSubcommand(){return this.with({subcommandRequired:!0})}argRequiredElseHelp(e=!0){return this.with({argRequiredElseHelp:e})}requires(e,r){let t=g(this);return this.with({requirements:[...t.requirements,{source:e,target:r}]})}requiresIf(e,r,t){let o=g(this);return this.with({conditionalRequirements:[...o.conditionalRequirements,{source:e,expected:r,target:t}]})}requiredIfAny(e,r){let t=ce(e);pe(t);let o=g(this);return this.with({conditionalSetRequirements:[...o.conditionalSetRequirements,{target:r,conditions:t,match:"any"}]})}requiredIfAll(e,r){let t=ce(e);pe(t);let o=g(this);return this.with({conditionalSetRequirements:[...o.conditionalSetRequirements,{target:r,conditions:t,match:"all"}]})}requiredUnlessPresent(e,r){if(new Set(e).size!==e.length)throw TypeError("A required-unless list cannot contain duplicate arguments");let t=g(this);return this.with({requiredUnless:[...t.requiredUnless,{target:r,alternatives:e}]})}requiredUnlessAll(e,r){if(new Set(e).size!==e.length)throw TypeError("A required-unless-all list cannot contain duplicate arguments");let t=g(this);return this.with({requiredUnlessAll:[...t.requiredUnlessAll,{target:r,alternatives:e}]})}overrides(e,r){let t=g(this);return this.with({overrides:[...t.overrides,{source:e,target:r}]})}conflicts(e,r,...t){let o=[e,r,...t];if(new Set(o).size!==o.length)throw TypeError("A conflict list cannot contain duplicate arguments");let i=g(this);return this.with({conflicts:[...i.conflicts,o]})}exclusive(e,...r){let t=[e,...r],o=[...g(this).exclusiveArguments,...t];if(new Set(o).size!==o.length)throw TypeError("An exclusive argument cannot be registered more than once");return this.with({exclusiveArguments:o})}group(e,r,t={}){if(r.length===0)throw TypeError(`Argument group '${e}' must contain a member`);if(new Set(r).size!==r.length)throw TypeError(`Argument group '${e}' has duplicate members`);let o=g(this);if(o.groups.some((i)=>i.name===e))throw TypeError(`Duplicate argument group: ${e}`);return this.with({groups:[...o.groups,{name:e,members:r,required:t.required??!1,multiple:t.multiple??!1,requires:[],conflicts:[]}]})}groupRequires(e,r,...t){let o=[r,...t];return this.with({groups:ge(g(this).groups,e,"requires",o)})}groupConflicts(e,r,...t){let o=[r,...t];return this.with({groups:ge(g(this).groups,e,"conflicts",o)})}handler(e){return this.with({handler:e})}parse(e){let r=g(this);return Ce(r,e,L())}tryParse(e){let r=g(this);return de(r,e,L())}run(e={}){let r=Array.isArray(e)?{argv:e}:e,t=r.argv??Bun.argv.slice(2);if(Bun.env.KONSTIT_CLI_COMPLETE==="1")return import("./dynamic-completion-403da357-4jc4w04x.js").then(({runDynamicCompletionRequest:i})=>i(this,{argv:t,...r.stdout===void 0?{}:{stdout:r.stdout}}));let o=g(this);return Pr(o,de(o,t,L(r)),r)}renderHelp(){let e=g(this);return C(e,[e.name],[])}renderUsage(){let e=g(this);return xe(e,[e.name],[])}}function Dr(e){return _(e),new re(Object.freeze({name:e,aliases:Object.freeze([]),arguments:Object.freeze([]),subcommands:Object.freeze([]),requirements:Object.freeze([]),conditionalRequirements:Object.freeze([]),conditionalSetRequirements:Object.freeze([]),requiredUnless:Object.freeze([]),requiredUnlessAll:Object.freeze([]),exclusiveArguments:Object.freeze([]),overrides:Object.freeze([]),conflicts:Object.freeze([]),groups:Object.freeze([]),subcommandRequired:!1,argRequiredElseHelp:!1,inferSubcommands:!1,disableHelpSubcommand:!1,disableHelpFlag:!1,disableVersionFlag:!1,hidden:!1}))}function Jr(e,r={}){mr(r);let t=Dr(e);if(r.about!==void 0)t=t.about(r.about);if(r.longAbout!==void 0)t=t.longAbout(r.longAbout);if(r.author!==void 0)t=t.author(r.author);if(r.beforeHelp!==void 0)t=t.beforeHelp(r.beforeHelp);if(r.afterHelp!==void 0)t=t.afterHelp(r.afterHelp);if(r.overrideUsage!==void 0)t=t.overrideUsage(r.overrideUsage);if(r.overrideHelp!==void 0)t=t.overrideHelp(r.overrideHelp);if(r.disableHelpSubcommand!==void 0)t=t.disableHelpSubcommand(r.disableHelpSubcommand);if(r.disableHelpFlag!==void 0)t=t.disableHelpFlag(r.disableHelpFlag);if(r.disableVersionFlag!==void 0)t=t.disableVersionFlag(r.disableVersionFlag);if(r.version!==void 0)t=t.version(r.version);for(let o of r.visibleAliases??[])t=t.visibleAlias(o);for(let o of r.aliases??[])t=t.alias(o);for(let o of r.args??[])t=t.arg(o);for(let o of r.subcommands??[])t=t.subcommand(o);if(r.inferSubcommands!==void 0)t=t.inferSubcommands(r.inferSubcommands);if(r.subcommandRequired===!0)t=t.requireSubcommand();if(r.defaultToHelp!==void 0)t=t.argRequiredElseHelp(r.defaultToHelp);if(r.hide!==void 0)t=t.hide(r.hide);fr(r,g(t));for(let[o,i]of r.requires??[])t=t.requires(o,i);for(let[o,i,n]of r.requiresIf??[])t=t.requiresIf(o,i,n);for(let{conditions:o,target:i}of r.requiredIfAny??[])t=t.requiredIfAny(o,i);for(let{conditions:o,target:i}of r.requiredIfAll??[])t=t.requiredIfAll(o,i);for(let{alternatives:o,target:i}of r.requiredUnlessPresent??[])t=t.requiredUnlessPresent(o,i);for(let{alternatives:o,target:i}of r.requiredUnlessAll??[])t=t.requiredUnlessAll(o,i);for(let[o,i]of r.overrides??[])t=t.overrides(o,i);for(let o of r.conflicts??[]){let[i,n,...a]=o;t=t.conflicts(i,n,...a)}if(r.exclusive!==void 0){let[o,...i]=r.exclusive;t=t.exclusive(o,...i)}for(let o of r.groups??[]){if(t=t.group(o.name,o.members,{...o.required===void 0?{}:{required:o.required},...o.multiple===void 0?{}:{multiple:o.multiple}}),o.requires!==void 0&&o.requires.length>0){let[i,...n]=o.requires;t=t.groupRequires(o.name,i,...n)}if(o.conflicts!==void 0&&o.conflicts.length>0){let[i,...n]=o.conflicts;t=t.groupConflicts(o.name,i,...n)}}if(r.handler!==void 0)return he(t.handler(r.handler));return he(t)}function he(e){let r=Object.freeze({parse:(t)=>e.parse(t),tryParse:(t)=>e.tryParse(t),run:(t)=>Array.isArray(t)?e.run(t):e.run(t??{}),renderHelp:()=>e.renderHelp(),renderUsage:()=>e.renderUsage()});return Oe(r,g(e)),r}
|
|
15
|
+
export{G as a,w as b,Wr as c,_r as d,Gr as e,Yr as f,O as g,Ye as h,Je as i,qe as j,Ke as k,Ze as l,Ee as m,g as n,Jr as o};
|
|
16
|
+
|
|
17
|
+
//# debugId=9723F2AFDEEE047964756E2164756E21
|