Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
commands: >
[
"build",
"types",
"test",
"deps"
"lint",
"publint",
"test"
]
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.json
*.md
*.yml
*.jsonc
16 changes: 16 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- intent-skills:start -->
# Skill mappings - when working in these areas, load the linked skill file into context.
skills:
- task: "Building packages for publish or generating declarations"
load: "node_modules/@bomb.sh/tools/skills/build/SKILL.md"
- task: "Writing or running tests"
load: "node_modules/@bomb.sh/tools/skills/test/SKILL.md"
- task: "Development workflow, command ordering, monorepo filtering"
load: "node_modules/@bomb.sh/tools/skills/lifecycle/SKILL.md"
- task: "Linting, code quality, or understanding lint violations"
load: "node_modules/@bomb.sh/tools/skills/lint/SKILL.md"
- task: "Formatting source files before committing"
load: "node_modules/@bomb.sh/tools/skills/format/SKILL.md"
- task: "Migrating off biome, unbuild, or other tools to bsh toolchain"
load: "node_modules/@bomb.sh/tools/skills/migrate/SKILL.md"
<!-- intent-skills:end -->
47 changes: 0 additions & 47 deletions biome.json

This file was deleted.

15 changes: 0 additions & 15 deletions build.preset.ts

This file was deleted.

4 changes: 2 additions & 2 deletions examples/basic/autocomplete-multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ${color.cyan('Filter and select multiple items in a single interface:')}
- Press ${color.yellow('Enter')} when done selecting all items
- Press ${color.yellow('Ctrl+C')} to cancel
`,
'Instructions'
'Instructions',
);

// Frameworks in alphabetical order
Expand Down Expand Up @@ -80,7 +80,7 @@ ${color.cyan('Filter and select multiple items in a single interface:')}
// Display selected frameworks with detailed information
p.note(
`You selected ${color.green(selectedFrameworks.length)} frameworks:`,
'Selection Complete'
'Selection Complete',
);

// Show each selected framework with its details
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ${color.cyan('This example demonstrates the type-ahead autocomplete feature:')}
- Press ${color.yellow('Enter')} to select the highlighted option
- Press ${color.yellow('Ctrl+C')} to cancel
`,
'Instructions'
'Instructions',
);

const countries = [
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function main() {
p.cancel('Operation cancelled.');
process.exit(0);
},
}
},
);

if (project.install) {
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/spinner-cancel-advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function main() {
onCancel: () => {
p.note(
'You cancelled during processing. Any completed work will be saved.',
'Processing Cancelled'
'Processing Cancelled',
);
},
});
Expand Down Expand Up @@ -114,7 +114,7 @@ async function main() {
onCancel: () => {
p.note(
'Final operation was cancelled, but processing results are still valid.',
'Final Stage Cancelled'
'Final Stage Cancelled',
);
},
});
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {
await setTimeout(1000);
}
}
})()
})(),
);

p.outro(`Problems? ${color.underline(color.cyan('https://example.com/issues'))}`);
Expand Down
4 changes: 2 additions & 2 deletions examples/changesets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function main() {
const major = Array.isArray(results.major) ? results.major : [];
const minor = Array.isArray(results.minor) ? results.minor : [];
const possiblePackages = packages.filter(
(pkg) => !major.includes(pkg) && !minor.includes(pkg)
(pkg) => !major.includes(pkg) && !minor.includes(pkg),
);
if (possiblePackages.length === 0) return;
const note = possiblePackages.join(color.dim(', '));
Expand All @@ -67,7 +67,7 @@ async function main() {
},
{
onCancel,
}
},
);

const message = await p.multiline({
Expand Down
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,21 @@
"private": true,
"type": "module",
"scripts": {
"stub": "pnpm -r run build --stub",
"build": "pnpm --filter \"@clack/*\" run build",
"start": "pnpm run dev",
"dev": "pnpm --filter @example/changesets run start",
"format": "biome check --write",
"lint": "biome lint --write --unsafe",
"types": "tsc --noEmit",
"deps": "pnpm exec knip --production",
"format": "bsh format",
"lint": "pnpm -r run lint",
"publint": "pnpm -r run publint",
"test": "pnpm --color -r run test",
"pretest": "pnpm run build"
},
"devDependencies": {
"@biomejs/biome": "^2.1.2",
"@bomb.sh/tools": "https://pkg.pr.new/@bomb.sh/tools@400d677",
"@changesets/cli": "^2.29.5",
"@types/node": "^20.19.39",
"jsr": "^0.13.4",
"knip": "^5.62.0",
"typescript": "^6.0.3",
"unbuild": "^3.6.0"
"typescript": "^6.0.3"
},
"packageManager": "pnpm@10.33.0",
"volta": {
Expand Down
7 changes: 0 additions & 7 deletions packages/core/build.config.ts

This file was deleted.

9 changes: 4 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@
"node": ">= 20.12.0"
},
"scripts": {
"build": "unbuild",
"build": "bsh build",
"prepack": "pnpm build",
"test": "vitest run"
"test": "bsh test",
"lint": "bsh lint",
"publint": "pnpm build && bsh publint"
},
"dependencies": {
"fast-wrap-ansi": "^0.2.0",
"sisteransi": "^1.0.5"
},
"devDependencies": {
"vitest": "^3.2.4"
}
}
22 changes: 11 additions & 11 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
export type { AutocompleteOptions } from './prompts/autocomplete.js';
export { default as AutocompletePrompt } from './prompts/autocomplete.js';
export { AutocompletePrompt } from './prompts/autocomplete.js';
export type { ConfirmOptions } from './prompts/confirm.js';
export { default as ConfirmPrompt } from './prompts/confirm.js';
export { ConfirmPrompt } from './prompts/confirm.js';
export type { DateFormat, DateOptions, DateParts } from './prompts/date.js';
export { default as DatePrompt } from './prompts/date.js';
export { DatePrompt } from './prompts/date.js';
export type { GroupMultiSelectOptions } from './prompts/group-multiselect.js';
export { default as GroupMultiSelectPrompt } from './prompts/group-multiselect.js';
export { GroupMultiSelectPrompt } from './prompts/group-multiselect.js';
export type { MultiLineOptions } from './prompts/multi-line.js';
export { default as MultiLinePrompt } from './prompts/multi-line.js';
export { MultiLinePrompt } from './prompts/multi-line.js';
export type { MultiSelectOptions } from './prompts/multi-select.js';
export { default as MultiSelectPrompt } from './prompts/multi-select.js';
export { MultiSelectPrompt } from './prompts/multi-select.js';
export type { PasswordOptions } from './prompts/password.js';
export { default as PasswordPrompt } from './prompts/password.js';
export { PasswordPrompt } from './prompts/password.js';
export type { PromptOptions } from './prompts/prompt.js';
export { default as Prompt } from './prompts/prompt.js';
export { Prompt } from './prompts/prompt.js';
export type { SelectOptions } from './prompts/select.js';
export { default as SelectPrompt } from './prompts/select.js';
export { SelectPrompt } from './prompts/select.js';
export type { SelectKeyOptions } from './prompts/select-key.js';
export { default as SelectKeyPrompt } from './prompts/select-key.js';
export { SelectKeyPrompt } from './prompts/select-key.js';
export type { TextOptions } from './prompts/text.js';
export { default as TextPrompt } from './prompts/text.js';
export { TextPrompt } from './prompts/text.js';
export type { ClackState as State } from './types.js';
export { block, getColumns, getRows, isCancel, wrapTextWithPrefix } from './utils/index.js';
export type { ClackSettings } from './utils/settings.js';
Expand Down
16 changes: 8 additions & 8 deletions packages/core/src/prompts/autocomplete.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Key } from 'node:readline';
import { styleText } from 'node:util';
import { findCursor } from '../utils/cursor.js';
import Prompt, { type PromptOptions } from './prompt.js';
import { Prompt, type PromptOptions } from './prompt.js';

interface OptionLike {
value: unknown;
Expand All @@ -13,7 +13,7 @@ type FilterFunction<T extends OptionLike> = (search: string, opt: T) => boolean;

function getCursorForValue<T extends OptionLike>(
selected: T['value'] | undefined,
items: T[]
items: T[],
): number {
if (selected === undefined) {
return 0;
Expand Down Expand Up @@ -46,8 +46,10 @@ function normalisedValue<T>(multiple: boolean, values: T[] | undefined): T | T[]
return values[0];
}

export interface AutocompleteOptions<T extends OptionLike>
extends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {
export interface AutocompleteOptions<T extends OptionLike> extends PromptOptions<
T['value'] | T['value'][],
AutocompletePrompt<T>
> {
options: T[] | ((this: AutocompletePrompt<T>) => T[]);
filter?: FilterFunction<T>;
multiple?: boolean;
Expand All @@ -60,9 +62,7 @@ export interface AutocompleteOptions<T extends OptionLike>
placeholder?: string;
}

export default class AutocompletePrompt<T extends OptionLike> extends Prompt<
T['value'] | T['value'][]
> {
export class AutocompletePrompt<T extends OptionLike> extends Prompt<T['value'] | T['value'][]> {
filteredOptions: T[];
multiple: boolean;
isNavigating = false;
Expand Down Expand Up @@ -162,7 +162,7 @@ export default class AutocompletePrompt<T extends OptionLike> extends Prompt<
placeholder !== undefined &&
placeholder !== '' &&
options.some(
(opt) => !opt.disabled && (this.#filterFn ? this.#filterFn(placeholder, opt) : true)
(opt) => !opt.disabled && (this.#filterFn ? this.#filterFn(placeholder, opt) : true),
);
if (key.name === 'tab' && isEmptyOrOnlyTab && placeholderMatchesOption) {
if (this.userInput === '\t') {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/prompts/confirm.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { cursor } from 'sisteransi';
import Prompt, { type PromptOptions } from './prompt.js';
import { Prompt, type PromptOptions } from './prompt.js';

export interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> {
active: string;
inactive: string;
initialValue?: boolean;
}

export default class ConfirmPrompt extends Prompt<boolean> {
export class ConfirmPrompt extends Prompt<boolean> {
get cursor() {
return this.value ? 0 : 1;
}
Expand Down
Loading
Loading