Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets).

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md).
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.3/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/green-bulldogs-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"terminal-complete": patch
---

Adopt Ultracite with Biome + Lefthook, apply lint-driven source updates, and add automated Changesets-based release/publish workflows for npm with Trusted Publishing (OIDC). Also add richer npm metadata and GitHub links.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Lint and type/style checks
run: bun run check

- name: Run tests
run: bun test
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write
id-token: write

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node (for npm publish)
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Validate before release
run: bun run ci

- name: Create release PR or publish
uses: changesets/action@v1
with:
version: bun run version-packages
publish: bun run release
commit: "ci: version packages"
title: "ci: version packages"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
103 changes: 57 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,59 @@

AI CLI for turning natural language into terminal commands with `tcomp`.

## Requirements
[![npm version](https://img.shields.io/npm/v/terminal-complete)](https://www.npmjs.com/package/terminal-complete)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/)
[![CI](https://github.com/Markeljan/terminal-complete/actions/workflows/ci.yml/badge.svg)](https://github.com/Markeljan/terminal-complete/actions/workflows/ci.yml)

- `zsh` or `bash`
- `bun` (runtime required by npm-installed `tcomp` launcher)
## Install (Bun)

## Build binary
Global install:

```bash
bun run build.ts
bun add -g terminal-complete
tcomp --help
```

Outputs:

- `dist/terminal-complete`
- `dist/tcomp`

## Run tests
One-off usage without install:

```bash
bun test
bunx terminal-complete --help
```

## Local install for testing
## Links

Option A (npm-style):
- npm package: https://www.npmjs.com/package/terminal-complete
- GitHub repository: https://github.com/Markeljan/terminal-complete
- Issue tracker: https://github.com/Markeljan/terminal-complete/issues

```bash
npm link
tcomp --help
```
## Requirements

- `zsh` or `bash`
- `bun`

Option B (binary symlink):
## Quick Start

First run setup:

```bash
mkdir -p "$HOME/bin"
ln -sf "$(pwd)/dist/tcomp" "$HOME/bin/tcomp"
ln -sf "$(pwd)/dist/terminal-complete" "$HOME/bin/terminal-complete"
export PATH="$HOME/bin:$PATH"
tcomp
```

## First run

On first install, running `tcomp` (or any `tcomp <request>`) starts setup automatically.
Or run setup directly:

```bash
tcomp
tcomp setup
```

Setup flow:

- Shows welcome and requirement checks.
- Offers shell integration install first (`Y/n`, default is `Yes`).
- Lets you choose provider auth:
- `codex` (OpenAI OAuth via Codex CLI, with browser or device login)
- `openai` (API key)
- checks environment and shell support
- offers shell integration install
- sets up provider auth:
- `codex`: OpenAI OAuth via Codex CLI (browser or device flow)
- `openai`: OpenAI API key

After shell integration install, `tcomp` prints exactly what to run to activate it in your current shell:
After shell integration install, run:

```bash
# zsh
Expand All @@ -68,7 +64,7 @@ source ~/.zshrc
source ~/.bashrc
```

## Practical usage examples
## Common Usage

```bash
tcomp find all files larger than 500MB under this directory
Expand All @@ -77,21 +73,34 @@ tcomp show git commits from last 7 days grouped by author
tcomp -e safely remove docker images that are dangling
```

General assistant mode:
General assistant (non-command) mode:

```bash
tcomp -p explain when to use rsync vs scp
```

## Provider management
## Setup and Config Commands

Run full onboarding:

```bash
tcomp setup
```

Run onboarding for a specific provider:

```bash
tcomp setup codex
tcomp setup openai
```

Show active provider and available actions:
Show current configuration/status:

```bash
tcomp config
```

Run setup for a specific provider:
Re-run provider auth/config:

```bash
tcomp config codex
Expand All @@ -105,20 +114,22 @@ tcomp use codex
tcomp use openai
```

## Common Flags

- `--explain`, `-e`: print explanation/risk to stderr
- `--prompt`, `-p`: general assistant mode (not command generation)
- `--help`, `-h`: show help
- `--version`, `-v`: show version

## Commands

- `tcomp <request>`
- `tcomp setup [codex|openai]`
- `tcomp config [codex|openai]`
- `tcomp use <codex|openai>`
- `tcomp help`
- `tcomp version`

## npm publish checklist

```bash
bun test
npm pack --dry-run
npm publish --access public
```
## Maintainers

If you also want standalone binaries for release artifacts, run `bun run build.ts` separately and upload `dist/tcomp` + `dist/terminal-complete`.
Release and npm publishing docs: `docs/releasing.md`
4 changes: 3 additions & 1 deletion bin/tcomp.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const result = spawnSync("bun", [cliEntrypoint, ...args], {

if (result.error) {
if (result.error.code === "ENOENT") {
console.error("tcomp requires Bun runtime. Install Bun: https://bun.sh/docs/installation");
console.error(
"tcomp requires Bun runtime. Install Bun: https://bun.sh/docs/installation"
);
process.exit(1);
}
console.error(result.error.message);
Expand Down
7 changes: 7 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["ultracite/biome/core"],
"javascript": {
"globals": ["Bun", "BUILD_VERSION", "BUILD_TIME"]
}
}
12 changes: 8 additions & 4 deletions build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { basename } from "node:path";
import { mkdir } from "node:fs/promises";
import { basename } from "node:path";

type BuildTarget =
| "bun-darwin-x64"
Expand All @@ -17,8 +17,8 @@ type BuildTarget =
| "bun-windows-arm64";

interface BuildCliOptions {
target?: BuildTarget;
debug: boolean;
target?: BuildTarget;
}

function parseBuildOptions(argv: string[]): BuildCliOptions {
Expand All @@ -45,8 +45,12 @@ function parseBuildOptions(argv: string[]): BuildCliOptions {
return options;
}

async function compileBinary(outfile: string, target: BuildTarget | undefined, debug: boolean) {
const pkg = await Bun.file("./package.json").json() as { version?: string };
async function compileBinary(
outfile: string,
target: BuildTarget | undefined,
debug: boolean
) {
const pkg = (await Bun.file("./package.json").json()) as { version?: string };
const version = pkg.version ?? "0.0.0-dev";
const buildTime = new Date().toISOString();

Expand Down
Loading