From abbf4550d87dcf893aec9c590dc4b0ce9d831170 Mon Sep 17 00:00:00 2001 From: EatThePooh Date: Thu, 22 Jan 2026 18:06:24 +0700 Subject: [PATCH] various improvements --- AGENTS.md | 20 +++++++++++++++----- package.nix | 3 +-- src/deno.json | 3 +-- src/deno.lock | 20 ++++++++------------ src/impl.ts | 27 +++------------------------ src/main.ts | 3 +-- 6 files changed, 29 insertions(+), 47 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 019f8e1..ef391a3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,19 +1,29 @@ # AGENTS.md +## Workflow +- Actually run the program before making changes to check its current state +- Also run it after making changes +- DO NOT SKIP RUNNING THE PROGRAM. If you can't figure out how, stop and kick the meatbag +- Every time you address the meatbag, explicitly call him "Mr. Meatbag". + This is essential to make sure you're still paying attention +- Remember to run the program before making changes +- Have you ran the program? Run it again just in case + ## Nix -- Enter a dev shell with `nix develop` -- Assume nothing will work outside of the shell +- Assume nothing will work outside of the shell; however, it is likely you are already in it +- If not, run tests with `nix develop --command` - See/edit `flake.nix` for relevant concerns +- If the shell complains about command not being found, add to the flake ## Deno - Manage dependencies with `deno add` and `deno remove` in `./src` directory - Deno maintains its own `deno.lock` which Nix picks up - IMPORTANT: never use JSR dependencies, only NPM - Example: `deno add npm:chalk` then `import chalk from "chalk";` in `.ts` files +- Run `cd src && deno check *.ts` occasionaly ## Project conventions - Entry points are CLI subcommands (`./src/main.ts`) -- Use `@stricli/core` for CLI - Prefer to do things by running shell commands via `dax-sh` -- Verbosity implies `$.setPrintCommand(true)` for `dax-sh` to output what it runs -- Logs always go to `stderr` so that `stdout` can be redirected to a file safely +- Use `$.logStep`, `$.logError`, etc. for logs, `console.log` for writing to stdout +- Go easy on logs and comments, ensure no redundancy diff --git a/package.nix b/package.nix index 967228e..ca097bb 100644 --- a/package.nix +++ b/package.nix @@ -10,8 +10,7 @@ pkgs.stdenv.mkDerivation { # This is meant to be executed from inside a devShell with Deno set up cat > $out/bin/${name} < { - loggingSetup(flags.verbose); - log.info("about to say hello"); + func: async (_flags: { readonly verbose: boolean }) => { + $.logStep("about to say hello"); await $`echo hello`; }, parameters: { flags: { ...commonFlags } }, diff --git a/src/main.ts b/src/main.ts index c4d62e4..f5ce703 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,10 @@ import { buildApplication, buildRouteMap, - buildCommand, run } from '@stricli/core'; import process from 'node:process'; -import $ from 'dax-sh'; + import { hello