This document describes a working agreement that agents must obey when implementing features on behalf of humans.
After every single code change, you MUST run both test and quality tasks. This is non-negotiable.
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| SINCE="${1:-HEAD~1}" | |
| query_log() { | |
| local type="$1" | |
| local pattern="^${type}\(.*\):\s" | |
| local GH_HOST="github.com" | |
| local owner="nikoheikkila" |
| type IPv4Tuple = [number, number, number, number]; | |
| type IPv4String = `${number}.${number}.${number}.${number}`; | |
| /** | |
| * TypeScript validates up to a point. | |
| * But we still need runtime validation and a type guard. | |
| **/ | |
| const createIpAddress = (values: number[]): IPv4String => { | |
| if (!isValidIpAddress(values)) { | |
| throw new Error(`Invalid IP address: ${values.join('.')}`); |
| /* Requires '@types/node' to be installed */ | |
| import { deepEqual as equal } from 'node:assert'; | |
| const test = () => { | |
| equal(pixels(), ''); | |
| equal(pixels(0), '0'); | |
| equal(pixels(1), '1px'); | |
| equal(pixels(-1), '-1px'); | |
| equal(pixels(0.5), '1px'); | |
| equal(pixels(0.4), '0'); |
| export abstract class Vehicle { | |
| public abstract wheels: number; | |
| public get name() { | |
| return this.constructor.name; | |
| } | |
| } | |
| export class Bicycle extends Vehicle { | |
| public get wheels() { |
| import Handlebars from "handlebars"; | |
| import fs from "node:fs"; | |
| type Data = Record<string, unknown>; | |
| type Template = (data: Data) => string; | |
| export default class Templater { | |
| private readonly template: Template; | |
| public static using(templatePath: string): Templater { |
| import sys | |
| Weights = dict[str, float] | |
| def calculate_planetary_weight(weight_kg: float) -> Weights: | |
| """ | |
| Calculate a person's weight on different planets in the Solar System. | |
| Input weight should be in kilograms. | |
| Returns a dictionary with weights on each planet in kilograms. |
| # A quick way to record a new time entry using the official Harvest CLI package. | |
| # Usage: `hours duration [alias]` | |
| # Create a new alias for a project/task mapping with `hrvst alias create` if needed. | |
| function hours -d "Record new entry to Harvest" -a hours -a alias | |
| __hrvst_auth | |
| if test (count $argv) -eq 0 | |
| __total_hours | |
| return 0 | |
| end |
| # USAGE | |
| # | |
| # 1. Install Taskfile from <https://taskfile.dev> | |
| # 2. Save this file to $HOME/Taskfile.yml | |
| # 3. Run `task -g <name of the task>` | |
| version: '3' | |
| vars: | |
| EDITOR: nvim # Set this to your preferred text editor |
| export enum Suit { | |
| Club, | |
| Diamond, | |
| Spade, | |
| Heart, | |
| } | |
| export enum Rank { | |
| Two = 2, | |
| Three, |