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
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

25 changes: 0 additions & 25 deletions .eslintrc.js

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "yarn"
node-version: '22'
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Setup legacy belt-cli
run: cd packages/belt-cli && npm install -g .

- name: Run lint
run: yarn precommit
- name: Run turbo
run: yarn turbo --env-mode=loose typecheck build test

# - name: Run turbo
# run: SKIP_ENV_VALIDATION=true yarn turbo --env-mode=loose typecheck build
- name: Run lint
run: bash ./.husky/pre-commit
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ fl.sh
test.sh
config/vim/.netrwhist
config/karabiner/automatic_backups
dist
.turbo

node_modules
.yarn/*
Expand Down
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

yarn lint && yarn lint:shell
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.biome": true
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
69 changes: 69 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Repository Overview

This is a personal dotfiles repository containing configuration files and a custom CLI tool called "belt". The repository uses a yarn workspace monorepo structure with a single package `belt-cli` in the packages directory.

## Architecture

- **Root Level**: Main dotfiles configuration including zshrc, tmux.conf, and various config folders
- **packages/belt-cli**: A Node.js CLI tool that provides custom commands for dotfile management and development tasks
- **config/**: Contains configuration files for various tools (VS Code, iTerm, Karabiner, Obsidian, tmux, zsh)
- **scripts/**: Utility scripts for various system administration tasks
- **snippets/**: Code snippets organized by language

## Key Components

### Belt CLI (`packages/belt-cli/`)
The belt CLI is a command registry system that allows running custom commands with namespacing. Commands are defined in `package.json` under the `belt.commands` section and include:

- `ewnd9:incantation`: Regenerate snippets
- `ewnd9:init`: Initialize project
- `ewnd9:provision`: Provision/sync dotfiles
- `ewnd9:lint-shell`: Lint dotfiles shell scripts
- `repo:open`: Open repository in browser

### Configuration Management
The repository manages configurations for:
- **Shell**: Zsh with custom prompt (Pure), autosuggestions, and git integration
- **Editor**: VS Code settings, keybindings, and snippets
- **Terminal**: iTerm themes and tmux configurations
- **System**: Karabiner keyboard remapping, Obsidian settings

## Common Development Commands

### Linting
```bash
yarn lint # Lint JavaScript files in packages
yarn lint:shell # Lint shell scripts using belt CLI
```

### Belt CLI Usage
```bash
belt list # Show available commands
belt ewnd9:provision # Sync dotfiles
belt ewnd9:lint-shell # Lint shell scripts
```

### Setup/Installation
```bash
./init.sh # Initial setup script
./reload.sh # Reload configurations
```

## Development Workflow

The repository follows these patterns:
- JavaScript files use ES modules and modern Node.js features
- Shell scripts are located in various directories and linted via belt CLI
- Configuration files are symlinked from this repository to their target locations
- The belt CLI system allows extending functionality through modular commands

## Package Management

- Uses Yarn v4.9.4+ with workspace configuration
- Single workspace package at `packages/belt-cli`
- Global installation of belt CLI for system-wide access
- Dependencies managed at workspace level where appropriate
25 changes: 25 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
"files": {
"includes": ["**", "!node_modules/*", "!**/node_modules/*", "!**/dist/*"]
},
"linter": {
"enabled": true,
"rules": {
"suspicious": {
"noExplicitAny": "off"
}
}
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double"
}
}
}
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "22.13.0"
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
"packages/*"
],
"devDependencies": {
"babel-eslint": "^8.2.3",
"eslint": "^4.19.1",
"husky": "^0.14.3"
"@biomejs/biome": "^2.2.2",
"@tsconfig/node-ts": "^23.6.1",
"@tsconfig/node22": "^22.0.2",
"@types/node": "22",
"husky": "^9.1.7",
"turbo": "^2.5.6",
"typescript": "^5.9.2"
},
"scripts": {
"precommit": "yarn lint && yarn lint:shell",
"lint": "eslint 'packages/**/*.js'",
"lint:shell": "belt ewnd9:lint-shell"
"lint": "biome check ./packages/belt-cli/ --write",
"lint:shell": "belt ewnd9:lint-shell",
"prepare": "husky"
}
}
84 changes: 2 additions & 82 deletions packages/belt-cli/cli.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,4 @@
#!/usr/bin/env node

'use strict';

const path = require('path');
const argv = require('minimist')(process.argv.slice(2), { string: '_' });

if (argv._[0] === 'list') {
printHelp();
} else if (argv._.length > 0) {
run({ argv });
} else {
printHelp();
}

async function run({ argv }) {
const commands = getCommands();
const command = commands[argv._[0]];

if (!command) {
throw new Error(`unknown command "${argv._[0]}"`);
}

argv._.splice(0, 1);

const ctx = {
argv,
command,
};

const mod = require(command.scriptPath);
await mod.run(ctx);
}

function printHelp() {
const groupBy = require('lodash.groupby');
const sortBy = require('lodash.sortby');
const commands = getCommands();

const groups = Object.entries(groupBy(Object.entries(commands), ([command]) => {
const parts = command.split(':');
return parts.length === 1 ? '_' : parts[0];
}));

const noPrefix = groups.find(_ => _[0] === '_') || ['_', []];
const prefixed = sortBy(groups.filter(_ => _[0] !== '_'), '[0]');

sortBy(noPrefix[1], '[0]').forEach(([command, info]) => {
console.log(`- ${command} (${info.description})`);
});

let prevLength = noPrefix[1].length;

prefixed.forEach(([, commands]) => {
if (prevLength > 1) {
console.log();
}

sortBy(commands, '[0]').forEach(([command, info]) => {
console.log(`- ${command} (${info.description})`);
});

prevLength = commands.length;
});
}

function getCommands() {
const pkgPath = require.resolve('./package.json');
const pkgDir = path.dirname(pkgPath);
const pkg = require(pkgPath);
return Object.entries(pkg.belt.commands).reduce((commands, [name, info]) => {
const scriptPath = `${pkgDir}/${info.script}`;
commands[name] = {
name,
pkg,
pkgName: pkg.name,
pkgPath,
scriptPath,
description: info.description || '<no-description>'
};

return commands;
}, {});
}
// eslint-disable-next-line
await import('./dist/index.js');
101 changes: 0 additions & 101 deletions packages/belt-cli/commands/incantation/index.js

This file was deleted.

Loading
Loading