CommandCodeAI / CommandCodeAI/command-code

feat: Mod - Adding test harness to Mod Api to make it easier to write tests and have agent verify mod works

Aperta
#612 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Nessun dato sulla lingua
Stelle
4k
Fork
350
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Summary

When writing and iterating on a mod, I find the the model will write a temp script which imports some of the mod functions to test the output and if it works properly, for example:

xecute Shell Command
Command Code needs to execute node --experimental-strip-types --no-warnings -e "
Promise.all([
  import('./.commandcode/mods/erd.ts'),
  import('./.commandcode/mods/erd/markdown.ts'),
  import('./.commandcode/mods/erd/renderer.ts'),
  import('./.commandcode/mods/erd/commands.ts'),
  import('./.commandcode/mods/erd/tools.ts'),
]).then(() => { console.log('ALL MODULES LOAD OK'); }).catch(e => { console.error('FAIL', e); process.exit(1); });
" 2>&1 | head -20.

Press [ctrl+e] to explain this command

❯ 1. Yes

Some are more involved and check output not just if load.


Execute Shell Command
Command Code needs to execute node --experimental-strip-types --no-warnings -e "
const fs = require('fs');
Promise.all([
  import('./.commandcode/mods/erd/parser.ts'),
  import('./.commandcode/mods/erd/queries.ts'),
  import('./.commandcode/mods/erd/markdown.ts'),
]).then(([p, q, md]) => {
  const sql = fs.readFileSync('schema/schema.sql', 'utf8');
  const schema = p.parseSchema(sql, 'sqlite');
  console.log('listTables →', md.renderMarkdown(q.listTables(schema)).length, 'lines');
  console.log('listIndexes →', md.renderMarkdown(q.listIndexes(schema)).length, 'lines');
  console.log('listForeignKeys →', md.renderMarkdown(q.listForeignKeys(schema)).length, 'lines');
  console.log('findColumn →', md.renderMarkdown(q.findColumn(schema, 'id')).length, 'lines');
  console.log('schemaSummary →', md.renderMarkdown(q.schemaSummary(schema, 'sqlite')).length, 'lines');
  console.log('describeTable →', md.renderMarkdown(q.describeTable(schema, 'users', 'sqlite')).length, 'lines');
  console.log('ALL QUERY FUNCTIONS RENDER CLEANLY');
}).catch(e => { console.error('FAIL', e); process.exit(1); });
" 2>&1 | head -20.

Press [ctrl+e] to explain this command

❯ 1. Yes
  2. Yes, don't ask again for this exact command in this project
  3. No, tell Command Code what to do differently
Expected Behavior

Would be useful as mods get more complex an refactor to have a proper test harness or suite like vitest that can be run easily manually or within agent as part of th mod-builder skill.

Actual Behavior

Mode has to cobble together one off scripts and runs that have to be permitted each Tim since the command is unique often per run so hard to write permissions to allow.

Can see from example above the shell command on-line a script and not sure I'd want to permit blanket node --experimental-strip-types --no-warnings -e allow permissions here.

Steps to reproduce the issue
  1. build mod
  2. try to test it
Command Code Version

1.7.0

Operating System

macOS

Terminal/IDE

ghostty

Shell

zsh

Additional context

No response

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando la Mod API e la skill th-mod-builder, quindi confronta i comandi Node di esempio nell’issue con il workflow attuale del mod. Definisci cosa dovrebbe coprire l’harness, come dovrebbe essere eseguito manualmente o tramite l’agente e come dovrebbero essere il caricamento riuscito del modulo e i controlli sull’output; non sono stati identificati file di implementazione o test specifici.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
node.js, typescript
Ambito
cli, developer-experience, testing
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.