45 lines
1.2 KiB
TypeScript
Executable File
45 lines
1.2 KiB
TypeScript
Executable File
#!/usr/bin/env runts -- --allow-all
|
|
|
|
import {parseArgs} from "jsr:@std/cli/parse-args";
|
|
import {exit, log, ProcessBar,} from "https://script.hatter.ink/@67/deno-commons-mod.ts";
|
|
import {howto} from "https://script.hatter.ink/@1/deno-ai-mod.ts";
|
|
|
|
async function main() {
|
|
const flags = parseArgs(Deno.args, {
|
|
boolean: ["help"],
|
|
alias: {
|
|
h: "help",
|
|
},
|
|
});
|
|
|
|
if (flags.help) {
|
|
console.log(`howto.ts
|
|
|
|
howto.ts --help - show help
|
|
howto.ts 'MESSAGE' - generate command line for MESSAGE
|
|
`);
|
|
exit(0);
|
|
}
|
|
|
|
const message = (flags._)
|
|
? flags._.join(" ")
|
|
: prompt("Input your message: ");
|
|
if (!message) {
|
|
throw new Error("Message is required");
|
|
}
|
|
const summary = await new ProcessBar("AI howto").call(
|
|
async (): Promise<string> => {
|
|
return await howto(message);
|
|
},
|
|
);
|
|
log.success(`AI howto command line message: \n${summary}`);
|
|
}
|
|
|
|
main().catch((err) => {
|
|
log.error(err);
|
|
process.exit(0);
|
|
}).then(() => process.exit(0));
|
|
|
|
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260412T135613+08:00.MEUCIQDbJGYgxtAv1d6Vrmyj
|
|
// vQDEJGFUuZuH1UQOYQhWRzN69wIgS8tw92nMpF5TLQy/qS4uk7w7d8iY8rmT6DR+V3jg0lM=
|