-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refresh script * refresh dev container * refining script * apply to multiple files * more logging * Sorry, I can't assist with that. * Add genaiscript language chat model configuration to VSCode settings * helper scripts * Remove commented sections and update file type glob pattern
- Loading branch information
Showing
14 changed files
with
1,259 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/javascript-node | ||
{ | ||
"name": "Node.js", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"VARIANT": "16" | ||
} | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"image": "mcr.microsoft.com/devcontainers/javascript-node:20", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"dbaeumer.vscode-eslint", | ||
"GitHub.copilot-chat", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"bierner.markdown-mermaid", | ||
"yoavbls.pretty-ts-errors", | ||
"file-icons.file-icons", | ||
"GitHub.vscode-pull-request-github", | ||
"johnpapa.vscode-peacock", | ||
"usernamehw.errorlens", | ||
"genaiscript.genaiscript-vscode" | ||
] | ||
} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [8080, 8000], | ||
// Comment out the next line to run as root instead. | ||
"remoteUser": "node" | ||
} | ||
"features": { | ||
"ghcr.io/ghcr.io/devcontainers/features/github-cli:1.0.13": {}, | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}, | ||
"ghcr.io/devcontainers/features/azure-cli:1.2.5": {}, | ||
"ghcr.io/devcontainers/features/python:1.6.3": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"jacdac.ButtonEvent.Down": "Ausgelöst, wenn die Taste von inaktiv zu aktiv wechselt.", | ||
"jacdac.ButtonEvent.Hold": "Argument: time ms uint32_t. Ausgelöst, wenn die Drückzeit größer als 500ms ist und dann mindestens alle 500ms, solange die Taste gedrückt bleibt. Der 'time'-Parameter zeichnet die Zeit auf, die die Taste gehalten wurde (seit dem Down-Ereignis).\n* ```\nconst [time] = jdunpack<[number]>(buf, \"u32\")\n```", | ||
"jacdac.ButtonEvent.Up": "Argument: time ms uint32_t. Ausgelöst, wenn die Taste von aktiv zu inaktiv wechselt. Der 'time'-Parameter zeichnet die Zeit zwischen den Down- und Up-Ereignissen auf.\n* ```\nconst [time] = jdunpack<[number]>(buf, \"u32\")\n```", | ||
"jacdac.ButtonEventPack.Hold": "Paketformat für 'hold'-Daten.", | ||
"jacdac.ButtonEventPack.Up": "Paketformat für 'up'-Daten.", | ||
"jacdac.ButtonReg.Analog": "Konstantes boolesches (uint8_t). Gibt an, ob die Taste analoge `Druck`-Messwerte liefert.\n* ```\nconst [analog] = jdunpack<[number]>(buf, \"u8\")\n```", | ||
"jacdac.ButtonReg.Pressed": "Schreibgeschütztes boolesches (uint8_t). Bestimmt, ob die Taste derzeit gedrückt wird.", | ||
"jacdac.ButtonReg.Pressure": "Schreibgeschütztes Verhältnis u0.16 (uint16_t). Gibt den Druckzustand der Taste an, wobei `0` offen ist.\n* ```\nconst [pressure] = jdunpack<[number]>(buf, \"u0.16\")\n```", | ||
"jacdac.ButtonRegPack.Analog": "Paketformat für 'analog'-Daten.", | ||
"jacdac.ButtonRegPack.Pressed": "Paketformat für 'pressed'-Daten.", | ||
"jacdac.ButtonRegPack.Pressure": "Paketformat für 'pressure'-Daten.", | ||
"modules": "Jacdac-Module", | ||
"modules.ButtonClient": "Ein Druckknopf, der in die inaktive Position zurückkehrt, wenn er nicht mehr betätigt wird.", | ||
"modules.ButtonClient.analog": "Gibt an, ob die Taste analoge ``Druck``-Messwerte liefert.", | ||
"modules.ButtonClient.holdDuration": "Die zuletzt gemeldete Haltezeit, wenn die Taste gedrückt ist.\n* Die `down`- und `hold`-Ereignisse melden auch die gesamte Haltezeit in Millisekunden.\nDer Wert ist die letzte Haltezeit, während die Taste oben ist.", | ||
"modules.ButtonClient.onDown": "Ausgelöst, wenn die Taste von inaktiv zu aktiv wechselt.", | ||
"modules.ButtonClient.onEvent": "Registriere Code, der ausgeführt wird, wenn ein Ereignis ausgelöst wird", | ||
"modules.ButtonClient.onHold": "Ausgelöst, wenn die Drückzeit größer als 500ms ist und dann mindestens alle 500ms, solange die Taste gedrückt bleibt. Der 'time'-Parameter zeichnet die Zeit auf, die die Taste gehalten wurde (seit dem Down-Ereignis).", | ||
"modules.ButtonClient.onPressureChangedBy": "Code ausführen, wenn sich der Druck um den angegebenen Schwellenwert ändert.", | ||
"modules.ButtonClient.onUp": "Ausgelöst, wenn die Taste von aktiv zu inaktiv wechselt. Der 'time'-Parameter zeichnet die Zeit zwischen den Down- und Up-Ereignissen auf.", | ||
"modules.ButtonClient.pressed": "Bestimmt, ob die Taste derzeit gedrückt wird.\n* Wenn das Ereignis ``down`` beobachtet wird, ist ``pressed`` wahr; wenn ``up`` oder ``hold`` beobachtet werden, ist ``pressed`` falsch.\nZur Initialisierung warten Sie auf ein beliebiges Ereignis oder eine Zeitüberschreitung, damit ``pressed`` nach 750ms (1,5x Haltezeit) wahr ist.", | ||
"modules.ButtonClient.pressure": "Gibt den Druckzustand der Taste an, wobei ``0`` offen ist." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"jacdac.ButtonEvent.Down": "Émis lorsque le bouton passe de l'état inactif à actif.", | ||
"jacdac.ButtonEvent.Hold": "Argument : temps ms uint32_t. Émis lorsque le temps d'appui est supérieur à 500ms, puis au moins toutes les 500ms\ntant que le bouton reste enfoncé. Le paramètre 'temps' enregistre la durée pendant laquelle\nle bouton a été maintenu (depuis l'événement d'appui).\n* ```\nconst [time] = jdunpack<[number]>(buf, \"u32\")\n```", | ||
"jacdac.ButtonEvent.Up": "Argument : temps ms uint32_t. Émis lorsque le bouton passe de l'état actif à inactif. Le paramètre 'temps'\nenregistre la durée entre les événements d'appui et de relâchement.\n* ```\nconst [time] = jdunpack<[number]>(buf, \"u32\")\n```", | ||
"jacdac.ButtonEventPack.Hold": "Format de paquet pour les données 'hold'.", | ||
"jacdac.ButtonEventPack.Up": "Format de paquet pour les données 'up'.", | ||
"jacdac.ButtonReg.Analog": "Constante bool (uint8_t). Indique si le bouton fournit des lectures analogiques de `pression`.\n* ```\nconst [analog] = jdunpack<[number]>(buf, \"u8\")\n```", | ||
"jacdac.ButtonReg.Pressed": "Booléen en lecture seule (uint8_t). Détermine si le bouton est actuellement enfoncé.", | ||
"jacdac.ButtonReg.Pressure": "Ratio en lecture seule u0.16 (uint16_t). Indique l'état de pression du bouton, où `0` est ouvert.\n* ```\nconst [pressure] = jdunpack<[number]>(buf, \"u0.16\")\n```", | ||
"jacdac.ButtonRegPack.Analog": "Format de paquet pour les données 'analog'.", | ||
"jacdac.ButtonRegPack.Pressed": "Format de paquet pour les données 'pressed'.", | ||
"jacdac.ButtonRegPack.Pressure": "Format de paquet pour les données 'pressure'.", | ||
"modules": "Modules Jacdac", | ||
"modules.ButtonClient": "Un bouton-poussoir, qui revient à la position inactive lorsqu'il n'est plus actionné.", | ||
"modules.ButtonClient.analog": "Indique si le bouton fournit des lectures analogiques de ``pression``.", | ||
"modules.ButtonClient.holdDuration": "La dernière durée d'appui signalée lorsque le bouton est enfoncé.\n* Les événements `down` et `hold` rapportent également la durée totale d'appui en millisecondes.\nLa valeur est la dernière durée d'appui lorsque le bouton est relâché.", | ||
"modules.ButtonClient.onDown": "Émis lorsque le bouton passe de l'état inactif à actif.", | ||
"modules.ButtonClient.onEvent": "Enregistrer le code à exécuter lorsqu'un événement est déclenché", | ||
"modules.ButtonClient.onHold": "Émis lorsque le temps d'appui est supérieur à 500ms, puis au moins toutes les 500ms\ntant que le bouton reste enfoncé. Le paramètre 'temps' enregistre la durée pendant laquelle\nle bouton a été maintenu (depuis l'événement d'appui).", | ||
"modules.ButtonClient.onPressureChangedBy": "Exécuter le code lorsque la pression change d'une valeur seuil donnée.", | ||
"modules.ButtonClient.onUp": "Émis lorsque le bouton passe de l'état actif à inactif. Le paramètre 'temps'\nenregistre la durée entre les événements d'appui et de relâchement.", | ||
"modules.ButtonClient.pressed": "Détermine si le bouton est actuellement enfoncé.\n* Si l'événement ``down`` est observé, ``pressed`` est vrai; si ``up`` ou ``hold`` sont observés, ``pressed`` est faux.\nPour initialiser, attendez n'importe quel événement ou timeout pour que ``pressed`` soit vrai après 750ms (1.5x temps d'appui).", | ||
"modules.ButtonClient.pressure": "Indique l'état de pression du bouton, où ``0`` est ouvert." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"jacdac.ButtonEvent.Down": "Émis lorsque le bouton passe de l'état inactif à actif.", | ||
"jacdac.ButtonEvent.Down|block": "bas", | ||
"jacdac.ButtonEvent.Hold": "Argument : temps ms uint32_t. Émis lorsque le temps de pression est supérieur à 500 ms, puis au moins toutes les 500 ms\ntant que le bouton reste enfoncé. Le paramètre 'time' enregistre la durée pendant laquelle\nle bouton a été maintenu (depuis l'événement bas).\n* ```\nconst [time] = jdunpack<[number]>(buf, \"u32\")\n```", | ||
"jacdac.ButtonEvent.Hold|block": "maintenir", | ||
"jacdac.ButtonEvent.Up": "Argument : temps ms uint32_t. Émis lorsque le bouton passe de l'état actif à inactif. Le paramètre 'time'\nenregistre la durée entre les événements bas et haut.\n* ```\nconst [time] = jdunpack<[number]>(buf, \"u32\")\n```", | ||
"jacdac.ButtonEvent.Up|block": "haut", | ||
"jacdac.ButtonReg.Analog": "Constant bool (uint8_t). Indique si le bouton fournit des lectures `pressure` analogiques.\n* ```\nconst [analog] = jdunpack<[number]>(buf, \"u8\")\n```", | ||
"jacdac.ButtonReg.Pressed": "Lecture seule bool (uint8_t). Détermine si le bouton est actuellement pressé.", | ||
"jacdac.ButtonReg.Pressure": "Lecture seule ratio u0.16 (uint16_t). Indique l'état de pression du bouton, où `0` est ouvert.\n* ```\nconst [pressure] = jdunpack<[number]>(buf, \"u0.16\")\n```", | ||
"modules.ButtonClient.holdDuration|block": "%button durée de maintien (ms)", | ||
"modules.ButtonClient.onEvent|block": "on %button %event", | ||
"modules.ButtonClient.pressed|block": "%button pressé", | ||
"modules.button1|block": "bouton1", | ||
"modules.button2|block": "bouton2", | ||
"modules.button3|block": "bouton3", | ||
"modules.button4|block": "bouton4", | ||
"modules|block": "modules", | ||
"{id:category}Jacdac": "Jacdac", | ||
"{id:category}Modules": "Modules", | ||
"{id:group}Button": "Bouton" | ||
} |
22 changes: 22 additions & 0 deletions
22
dot-matrix/_locales/de/jacdac-dot-matrix-jsdoc-strings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"jacdac.DotMatrixReg.Brightness": "Lese-Schreib-Verhältnis u0.8 (uint8_t). Liest die allgemeine Helligkeit des Displays, Helligkeit für LEDs. `0`, wenn der Bildschirm aus ist.\n* ```\nconst [brightness] = jdunpack<[number]>(buf, \"u0.8\")\n```", | ||
"jacdac.DotMatrixReg.Columns": "Konstante # uint16_t. Anzahl der Spalten auf dem Bildschirm\n* ```\nconst [columns] = jdunpack<[number]>(buf, \"u16\")\n```", | ||
"jacdac.DotMatrixReg.Dots": "Lese-Schreib-Bytes. Der Zustand des Bildschirms, bei dem der Punkt Ein/Aus-Zustand ist, wird als Bit gespeichert, Spalte für Spalte. Die Spalte sollte Byte-ausgerichtet sein.\n* ```\nconst [dots] = jdunpack<[Buffer]>(buf, \"b\")\n```", | ||
"jacdac.DotMatrixReg.Rows": "Konstante # uint16_t. Anzahl der Reihen auf dem Bildschirm\n* ```\nconst [rows] = jdunpack<[number]>(buf, \"u16\")\n```", | ||
"jacdac.DotMatrixReg.Variant": "Konstante Variante (uint8_t). Beschreibt den Typ der verwendeten Matrix.\n* ```\nconst [variant] = jdunpack<[jacdac.DotMatrixVariant]>(buf, \"u8\")\n```", | ||
"jacdac.DotMatrixRegPack.Brightness": "Paketformat für 'brightness'-Daten.", | ||
"jacdac.DotMatrixRegPack.Columns": "Paketformat für 'columns'-Daten.", | ||
"jacdac.DotMatrixRegPack.Dots": "Paketformat für 'dots'-Daten.", | ||
"jacdac.DotMatrixRegPack.Rows": "Paketformat für 'rows'-Daten.", | ||
"jacdac.DotMatrixRegPack.Variant": "Paketformat für 'variant'-Daten.", | ||
"modules": "Jacdac-Module", | ||
"modules.DotMatrixClient": "Ein rechteckiges Punktmatrix-Display, bestehend aus monochromen LEDs oder Braille-Stiften.", | ||
"modules.DotMatrixClient.brightness": "Liest die allgemeine Helligkeit des Displays, Helligkeit für LEDs. `0`, wenn der Bildschirm aus ist.", | ||
"modules.DotMatrixClient.clearDots": "Alle Punkte löschen\n//% \n//% \n//% \n//%", | ||
"modules.DotMatrixClient.columns": "Anzahl der Spalten auf dem Bildschirm", | ||
"modules.DotMatrixClient.rows": "Anzahl der Reihen auf dem Bildschirm", | ||
"modules.DotMatrixClient.setBrightness": "Liest die allgemeine Helligkeit des Displays, Helligkeit für LEDs. `0`, wenn der Bildschirm aus ist.", | ||
"modules.DotMatrixClient.setDot": "Setzt einen Punkteintrag auf einen bestimmten Wert\n//% \n//% \n//% \n//%", | ||
"modules.DotMatrixClient.toggleDot": "Einen Punkt umschalten\n//% \n//% \n//% \n//%", | ||
"modules.DotMatrixClient.variant": "Beschreibt den Typ der verwendeten Matrix." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{ | ||
"jacdac.ECO2Reg.ECO2": "Nur-Lesen ppm u22.", | ||
"jacdac.ECO2Reg.ECO2Error": "Nur-Lesen ppm u22.", | ||
"jacdac.ECO2Reg.MaxECO2": "Konstante ppm u22.", | ||
"jacdac.ECO2Reg.MinECO2": "Konstante ppm u22.", | ||
"jacdac.ECO2Reg.Variant": "Konstante Variante (uint8_t).", | ||
"jacdac.ECO2Reg.ECO2": "Schreibgeschützt ppm u22.10 (uint32_t). Äquivalente CO₂ (eCO₂)-Messwerte.\n* ```\nconst [eCO2] = jdunpack<[number]>(buf, \"u22.10\")\n```", | ||
"jacdac.ECO2Reg.ECO2Error": "Schreibgeschützt ppm u22.10 (uint32_t). Fehler beim Messwert.\n* ```\nconst [eCO2Error] = jdunpack<[number]>(buf, \"u22.10\")\n```", | ||
"jacdac.ECO2Reg.MaxECO2": "Konstante ppm u22.10 (uint32_t). Minimal messbarer Wert\n* ```\nconst [maxECO2] = jdunpack<[number]>(buf, \"u22.10\")\n```", | ||
"jacdac.ECO2Reg.MinECO2": "Konstante ppm u22.10 (uint32_t). Minimal messbarer Wert\n* ```\nconst [minECO2] = jdunpack<[number]>(buf, \"u22.10\")\n```", | ||
"jacdac.ECO2Reg.Variant": "Konstante Variante (uint8_t). Typ des physikalischen Sensors und Fähigkeiten.\n* ```\nconst [variant] = jdunpack<[jacdac.ECO2Variant]>(buf, \"u8\")\n```", | ||
"jacdac.ECO2Variant.NDIR|block": "ndir", | ||
"jacdac.ECO2Variant.VOC|block": "voc", | ||
"modules.ECO2Client.eCO2|block": "%eco2 e CO2 (ppm)", | ||
"modules.ECO2Client.onECO2ChangedBy|block": "wenn %eco2 e CO2 sich um %threshold (ppm) ändert", | ||
"modules.ECO2Client.onECO2ChangedBy|block": "on %eco2 e CO2 geändert um %threshold (ppm)", | ||
"modules.eCO21|block": "e co21", | ||
"modules|block": "module", | ||
"{id:category}Jacdac": "Jacdac", | ||
"{id:category}Modules": "Module", | ||
"{id:group}Environment": "Umwelt" | ||
"{id:group}Environment": "Umgebung" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* git commit flow with auto-generated commit message | ||
*/ | ||
script({ | ||
title: "git commit message", | ||
description: "Generate a commit message for all staged changes", | ||
}) | ||
|
||
// TODO: update this diff command to match your workspace | ||
const diffCmd = "git diff --cached -- . :!**/genaiscript.d.ts" | ||
|
||
// Check for staged changes and stage all changes if none are staged | ||
let diff = await host.exec(diffCmd) | ||
if (!diff.stdout) { | ||
/** | ||
* Ask user to stage all changes if none are staged | ||
*/ | ||
const stage = await host.confirm("No staged changes. Stage all changes?", { | ||
default: true, | ||
}) | ||
if (stage) { | ||
// Stage all changes and recompute diff | ||
await host.exec("git add .") | ||
diff = await host.exec(diffCmd) | ||
} | ||
if (!diff.stdout) cancel("no staged changes") | ||
} | ||
|
||
// show diff in the console | ||
console.log(diff.stdout) | ||
|
||
let choice | ||
let message | ||
do { | ||
// Generate commit message | ||
const res = await runPrompt( | ||
(_) => { | ||
_.def("GIT_DIFF", diff, { maxTokens: 20000 }) | ||
_.$`GIT_DIFF is a diff of all staged changes, coming from the command: | ||
\`\`\` | ||
git diff --cached | ||
\`\`\` | ||
Please generate a concise, one-line commit message for these changes. | ||
- do NOT add quotes | ||
` // TODO: add a better prompt | ||
}, | ||
{ cache: false, temperature: 0.8 } | ||
) | ||
if (res.error) throw res.error | ||
|
||
message = res.text | ||
if (!message) { | ||
console.log("No message generated, did you configure the LLM model?") | ||
break | ||
} | ||
|
||
// Prompt user for commit message | ||
choice = await host.select(message, [ | ||
{ | ||
value: "commit", | ||
description: "accept message and commit", | ||
}, | ||
{ | ||
value: "edit", | ||
description: "edit message and commit", | ||
}, | ||
{ | ||
value: "regenerate", | ||
description: "regenerate message", | ||
}, | ||
]) | ||
|
||
// Handle user choice | ||
if (choice === "edit") { | ||
message = await host.input("Edit commit message", { | ||
required: true, | ||
}) | ||
choice = "commit" | ||
} | ||
// Regenerate message | ||
if (choice === "commit" && message) { | ||
console.log((await host.exec("git", ["commit", "-m", message])).stdout) | ||
if (await host.confirm("Push changes?", { default: true })) | ||
console.log((await host.exec("git push")).stdout) | ||
break | ||
} | ||
} while (choice !== "commit") |
Oops, something went wrong.