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
45 changes: 45 additions & 0 deletions .agent/repo=.this/skills/use.npm.alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
#
# SKILL: use.npm.alias
#
# Installs shell aliases that redirect npm commands to pnpm for faster package management.
#
# What it does:
# 1. Creates an alias 'npm.slow' pointing to the original npm binary
# 2. Creates an alias 'npm' that redirects to pnpm
# 3. Sets up pnpm tab completion (works for both pnpm and npm alias)
# 4. Everything goes in ~/.bash_aliases (works in both bash and zsh)
#
# When to use:
# - After setting up a new development environment
# - When you want npm commands to use pnpm transparently
#
# Usage:
# ./.agent/repo=.this/skills/use.npm.alias.sh
#
set -euo pipefail

BASH_ALIASES="${HOME}/.bash_aliases"
touch "$BASH_ALIASES"

# findsert npm.slow (only add if not already defined)
if ! grep -q "^alias npm.slow=" "$BASH_ALIASES" 2>/dev/null; then
NPM_PATH=$(which npm)
echo "alias npm.slow=\"$NPM_PATH\"" >> "$BASH_ALIASES"
echo "👍 findsert: alias npm.slow=\"$NPM_PATH\""
else
echo "👍 findsert: npm.slow alias already exists"
fi

# upsert npm => pnpm
if grep -q "^alias npm=" "$BASH_ALIASES" 2>/dev/null; then
sed -i 's/^alias npm=.*/alias npm="pnpm"/' "$BASH_ALIASES"
else
echo 'alias npm="pnpm"' >> "$BASH_ALIASES"
fi
echo "👍 upsert: alias npm=\"pnpm\""

# report
echo ""
echo "Aliases installed to $BASH_ALIASES"
echo "Run 'source $BASH_ALIASES' or open a new terminal to activate."
16 changes: 12 additions & 4 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ ignores:
- declapract
- declapract-typescript-ehmpathy
- '@commitlint/config-conventional'
- '@trivago/prettier-plugin-sort-imports'
- '@tsconfig/node-lts-strictest'
- core-js
- ts-jest
- husky
- '@oclif/plugin-help'
- oclif
- tsx # used in `./bin/run
- rhachet
- "@tsconfig/node20"
- "@tsconfig/strictest"
- "@biomejs/biome"
- esbuild-register
- "@swc/core"
- "@swc/jest"
- type-fns # used transitively
- "@tsconfig/node-lts-strictest" # likely used in other configs
- core-js # polyfill
- test-fns # test utilities
- ts-jest # kept for compatibility
49 changes: 0 additions & 49 deletions .eslintrc.js

This file was deleted.

109 changes: 109 additions & 0 deletions .github/workflows/.declastruct.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: .declastruct

on:
workflow_call:
inputs:
wish-path:
type: string
description: "the path to the wish declaration"
github-environment:
type: string
description: "the github environment that the apply step will be executed in"
allow-apply:
type: boolean
description: "whether the apply step is enabled. defaults to true on main"
default: ${{ github.ref == 'refs/heads/main' }}
secrets:
github-token:
required: false
description: optional credentials to support authenticating with github provider

jobs:
# install the dependencies
install:
uses: ./.github/workflows/.install.yml

plan:
runs-on: ubuntu-latest
needs: [install]
outputs:
has-changes-planned: ${{ steps.evaluate-plan.outputs.has-changes-planned }}
steps:
- name: checkout
uses: actions/checkout@v3

- name: set node-version
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"

- name: get node-modules from cache
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: ${{ needs.install.outputs.node-modules-cache-key }}

- name: declastruct plan
id: plan
run: npx declastruct plan --wish ${{ inputs.wish-path }} --into ${{ inputs.wish-path }}.plan.json | tee ./plan.log
env:
GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command

- name: evaluate plan
id: evaluate-plan
run: |
# check whether it said there were required changes
if grep "Everything is in sync" ./plan.log
then
echo "has-changes-planned=false" >> "$GITHUB_OUTPUT"
else
echo "has-changes-planned=true" >> "$GITHUB_OUTPUT"
fi

- name: has changes planned?
run: echo "${{ steps.evaluate-plan.outputs.has-changes-planned }}"

- name: upload plan artifact
if: ${{ inputs.allow-apply == true && steps.evaluate-plan.outputs.has-changes-planned == 'true' }}
uses: actions/upload-artifact@v4
with:
name: declastruct-plan
path: |
${{ inputs.wish-path }}.plan.json
retention-days: 1
include-hidden-files: false

apply:
runs-on: ubuntu-latest
environment: ${{ inputs.github-environment }}
needs: [install, plan]
if: ${{ inputs.allow-apply == true && needs.plan.outputs.has-changes-planned == 'true' }}
steps:
- name: checkout
uses: actions/checkout@v3

- name: set node-version
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"

- name: get node-modules from cache
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: ${{ needs.install.outputs.node-modules-cache-key }}

- name: extract directory from wish-path
id: extract-dir
run: echo "wish-dir=$(dirname "${{ inputs.wish-path }}")" >> "$GITHUB_OUTPUT"

- name: download plan artifact
uses: actions/download-artifact@v4
with:
name: declastruct-plan
path: ${{ steps.extract-dir.outputs.wish-dir }}

- name: declastruct apply
run: npx declastruct apply --plan ${{ inputs.wish-path }}.plan.json | tee ./apply.log
env:
GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command
29 changes: 18 additions & 11 deletions .github/workflows/.install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,45 @@ on:
outputs:
node-modules-cache-key:
description: a max(stable) cache key to the node modules of this commit's dependencies
value: ${{ jobs.npm.outputs.node-modules-cache-key }}
value: ${{ jobs.pnpm.outputs.node-modules-cache-key }}

jobs:
npm:
pnpm:
runs-on: ubuntu-24.04
outputs:
node-modules-cache-key: ${{ steps.cache.outputs.cache-primary-key }}
steps:
- name: checkout
uses: actions/checkout@v3

- name: set node-version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

- name: node-modules deps hash
id: deps-hash
run: |
PACKAGE_DEPS_HASH=$(jq '.packages' package-lock.json | jq 'del(."".version)' | md5sum | awk '{print $1}');
PACKAGE_DEPS_HASH=$(md5sum pnpm-lock.yaml | awk '{print $1}');
echo "PACKAGE_DEPS_HASH=$PACKAGE_DEPS_HASH"
echo "package-deps-hash=$PACKAGE_DEPS_HASH" >> "$GITHUB_OUTPUT"
- name: node-modules cache get

- name: node-modules cache check
uses: actions/cache/restore@v4
id: cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ steps.deps-hash.outputs.package-deps-hash }}
key: ${{ runner.os }}-pnpm-${{ steps.deps-hash.outputs.package-deps-hash }}
lookup-only: true

- name: node-modules cache miss setup node
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"

- name: node-modules cache miss setup pnpm
if: steps.cache.outputs.cache-hit != 'true'
uses: pnpm/action-setup@v4

- name: node-modules cache miss install
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts --prefer-offline --no-audit
run: pnpm install --frozen-lockfile --ignore-scripts

- name: node-modules cache set
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
Loading