feat: Mod - Adding test harness to Mod Api to make it easier to write tests and have agent verify mod works
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- À clarifier
- Activité
- Calme
- Stack technique
- node.js, typescript
- Domaine
- cli, developer-experience, testing
Piste de recherche
Commencez par examiner la Mod API et la skill th-mod-builder, puis comparez les commandes Node d’exemple de l’issue avec le workflow actuel du mod. Définissez ce que le harness doit couvrir, comment il doit être exécuté manuellement ou via l’agent, et à quoi doivent ressembler le chargement réussi du module et les vérifications de la sortie ; aucun fichier d’implémentation ni test spécifique n’est identifié.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- build mod
- try to test it
Command Code Version
1.7.0
Operating System
macOS
Terminal/IDE
ghostty
Shell
zsh
Additional context
No response
- Langage dominant
- Aucune donnée de langage
- Étoiles
- 4k
- Forks
- 350
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de CommandCodeAI/command-code
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#855 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
CommandCodeAI/command-code#841 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#655 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#608 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 70/100
CommandCodeAI/command-code#893 ·
Toutes les issues de CommandCodeAI/command-code
Issues similaires
-
Accept -c in more positions Ouvertearea: compat bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
area: dogs bug priority: P3 silent failure test-code
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
phoenixframework/phoenix#6847 ·
-
handle worker groups migrations Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
hust-open-atom-club/hustmirror-cli#52 · 1 commentaire ·