Skip to content

Commit 4e6abdd

Browse files
committed
run format
1 parent dde47b7 commit 4e6abdd

File tree

8 files changed

+47
-50
lines changed

8 files changed

+47
-50
lines changed

.vscode/settings.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"editor.defaultFormatter": "biomejs.biome",
3-
"editor.formatOnSave": true,
4-
"editor.formatOnType": true,
5-
"[typescript]": {
2+
"[json]": {
63
"editor.defaultFormatter": "biomejs.biome"
74
},
8-
"[typescriptreact]": {
5+
"[prisma]": {
6+
"editor.defaultFormatter": "Prisma.prisma"
7+
},
8+
"[typescript]": {
99
"editor.defaultFormatter": "biomejs.biome"
1010
},
11-
"[json]": {
11+
"[typescriptreact]": {
1212
"editor.defaultFormatter": "biomejs.biome"
1313
},
1414
"editor.codeActionsOnSave": {
1515
"quickfix.biome": "explicit",
1616
"source.organizeImports.biome": "explicit"
1717
},
18-
"[prisma]": {
19-
"editor.defaultFormatter": "Prisma.prisma"
20-
}
18+
"editor.defaultFormatter": "biomejs.biome",
19+
"editor.formatOnSave": true,
20+
"editor.formatOnType": true
2121
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- [2025-07-01] [run format](https://github.com/RubricLab/cli/commit/7ca23a6d4940452913b3111c1d43b7179638dcf9)
12
- [2025-07-01] [consolidate biome format script](https://github.com/RubricLab/cli/commit/ea2999efb0c28c7a217e81245026d3009bc78081)
23
- [2025-06-25] [Use package post-commit hooks](https://github.com/RubricLab/cli/commit/93141e16972175bb4b23d83f75c7c800662b7f85)
34
- [2025-05-31] [upgrade to zod/v4](https://github.com/RubricLab/cli/commit/732c6745223fce13a322c1d2c6015e3dfbc1443e)

lib/colors.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
const colors = {
2-
reset: '\x1b[0m',
2+
blue: '\x1b[34m',
33
bold: '\x1b[1m',
4-
red: '\x1b[31m',
4+
cyan: '\x1b[36m',
55
green: '\x1b[32m',
6-
yellow: '\x1b[33m',
7-
blue: '\x1b[34m',
86
magenta: '\x1b[35m',
9-
cyan: '\x1b[36m'
7+
red: '\x1b[31m',
8+
reset: '\x1b[0m',
9+
yellow: '\x1b[33m'
1010
}
1111

1212
export const format = {
13+
command: (text: string) => `${colors.cyan}${text}${colors.reset}`,
1314
error: (text: string) => `${colors.red}${colors.bold}${text}${colors.reset}`,
14-
success: (text: string) => `${colors.green}${colors.bold}${text}${colors.reset}`,
15-
warning: (text: string) => `${colors.yellow}${colors.bold}${text}${colors.reset}`,
1615
info: (text: string) => `${colors.blue}${colors.bold}${text}${colors.reset}`,
17-
command: (text: string) => `${colors.cyan}${text}${colors.reset}`,
1816
parameter: (text: string) => `${colors.magenta}${text}${colors.reset}`,
19-
title: (text: string) => `${colors.bold}${text}${colors.reset}`
17+
success: (text: string) => `${colors.green}${colors.bold}${text}${colors.reset}`,
18+
title: (text: string) => `${colors.bold}${text}${colors.reset}`,
19+
warning: (text: string) => `${colors.yellow}${colors.bold}${text}${colors.reset}`
2020
}

lib/help.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ export function showHelp({
1515
const cmd = commands.find(c => c.name === command)
1616
if (!cmd) {
1717
console.error(format.error(`Unknown command: ${command}`))
18-
showHelp({ commands, cliName })
18+
showHelp({ cliName, commands })
1919
return
2020
}
21-
showCommandHelp({ command: cmd, cliName })
21+
showCommandHelp({ cliName, command: cmd })
2222
return
2323
}
2424

@@ -38,13 +38,7 @@ export function showHelp({
3838
console.log(' Show version information')
3939
}
4040

41-
function showCommandHelp({
42-
command,
43-
cliName
44-
}: {
45-
command: Command
46-
cliName: string
47-
}): void {
41+
function showCommandHelp({ command, cliName }: { command: Command; cliName: string }): void {
4842
console.log(`\n${format.title('USAGE')}`)
4943
console.log(` ${cliName} ${command.name} [options]`)
5044

lib/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { parseCommand } from './parse'
22
import type { CLI, Command } from './types'
3+
34
export { format } from './colors'
5+
46
import type { z } from 'zod/v4'
57
export type { Command, CLI }
68

@@ -14,9 +16,9 @@ export function createCLI(config: {
1416
commands: config.commands,
1517
parse: async (argv = process.argv.slice(2)) => {
1618
await parseCommand({
17-
commands: config.commands,
1819
argv,
1920
cliName: config.name,
21+
commands: config.commands,
2022
version: config.version
2123
})
2224
}
@@ -30,9 +32,9 @@ export function createCommand<T extends z.ZodSchema>(config: {
3032
handler: (args: z.infer<T>) => void | Promise<void>
3133
}): Command<T> {
3234
return {
33-
name: config.name,
34-
description: config.description,
3535
args: config.args,
36-
handler: config.handler
36+
description: config.description,
37+
handler: config.handler,
38+
name: config.name
3739
}
3840
}

lib/parse.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ describe('parseArgs', () => {
9292

9393
it.skip('should handle combined short-form flags with a value', () => {
9494
const schema = z.object({
95-
name: z.string(),
96-
bool: z.boolean().optional()
95+
bool: z.boolean().optional(),
96+
name: z.string()
9797
})
9898
const argv = ['-nf', 'test']
9999
const result = parseArgs({ argv, schema })
100-
expect(result).toEqual({ name: 'test', bool: true })
100+
expect(result).toEqual({ bool: true, name: 'test' })
101101
})
102102
})

lib/parse.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export async function parseCommand({
1616
version: string
1717
}): Promise<void> {
1818
if (argv.length === 0) {
19-
showHelp({ commands, cliName })
19+
showHelp({ cliName, commands })
2020
return
2121
}
2222

2323
if (argv[0] === '--help' || argv[0] === '-h') {
24-
showHelp({ commands, cliName, command: argv[1] || '' })
24+
showHelp({ cliName, command: argv[1] || '', commands })
2525
return
2626
}
2727

@@ -35,7 +35,7 @@ export async function parseCommand({
3535

3636
if (!command) {
3737
console.error(format.error(`Unknown command: ${commandName}`))
38-
showHelp({ commands, cliName })
38+
showHelp({ cliName, commands })
3939
process.exit(1)
4040
}
4141

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
2-
"scripts": {
3-
"prepare": "bun x @rubriclab/package prepare",
4-
"bleed": "bun x npm-check-updates -u",
5-
"clean": "rm -rf .next && rm -rf node_modules",
6-
"format": "bun x biome check . --write"
7-
},
8-
"name": "@rubriclab/cli",
9-
"version": "0.0.10",
10-
"main": "lib/index.ts",
11-
"private": false,
122
"dependencies": {
133
"@rubriclab/config": "*",
144
"@rubriclab/package": "*"
155
},
6+
"main": "lib/index.ts",
7+
"name": "@rubriclab/cli",
168
"peerDependencies": {
179
"zod": "^3.25.0"
1810
},
11+
"private": false,
12+
"publishConfig": {
13+
"access": "public"
14+
},
15+
"scripts": {
16+
"bleed": "bun x npm-check-updates -u",
17+
"clean": "rm -rf .next && rm -rf node_modules",
18+
"format": "bun x biome check . --write",
19+
"prepare": "bun x @rubriclab/package prepare"
20+
},
1921
"simple-git-hooks": {
2022
"post-commit": "bun x @rubriclab/package post-commit"
2123
},
22-
"publishConfig": {
23-
"access": "public"
24-
}
24+
"version": "0.0.11"
2525
}

0 commit comments

Comments
 (0)