osr-mono/packages/osr-ai-templates/common/system.js
2025-01-29 17:53:27 +01:00

153 lines
5.3 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Markdown = exports.TypescriptEnvironmentCLI = exports.TypescriptLibraries = exports.Typescript = exports.Documents = exports.Commons = exports.Exports = exports.OSRTypescript = exports.resolvePackagePath = void 0;
const read_1 = require("@plastichub/fs/read");
const path_1 = require("path");
const resolvePackagePath = (path) => {
return (0, path_1.resolve)((0, path_1.join)(__dirname, path));
};
exports.resolvePackagePath = resolvePackagePath;
const OSRTypescript = (mixin = []) => {
return [
{
role: "user",
content: (0, read_1.sync)((0, exports.resolvePackagePath)("osr-typescript.md"))
}
].concat(mixin);
};
exports.OSRTypescript = OSRTypescript;
const Exports = (mixin = []) => {
return [
{
role: "user",
content: (0, read_1.sync)((0, exports.resolvePackagePath)("osr-exports.md"))
}
].concat(mixin);
};
exports.Exports = Exports;
const Commons = (mixin = []) => {
return [
{
role: "system",
content: "never shorten the output for my prompts!"
},
{
role: "system",
content: "be short, dont explain, just generate code!, with no comments"
},
{
role: "system",
content: "dont add foot notes, or any kind of comments, just generate code!"
},
{
role: "system",
content: "if not specified, always output as markdown"
}
].concat(mixin);
};
exports.Commons = Commons;
const Documents = (mixin = []) => {
return [
{
role: "system",
content: "never shorten the output for my prompts, always process all data!"
},
{
role: "system",
content: "be short, dont explain, just generate code or data, with no comments"
},
{
role: "system",
content: "dont add foot notes, or any kind of comments"
},
{
role: "system",
content: "if not specified, always output as markdown"
}
].concat(mixin);
};
exports.Documents = Documents;
const Typescript = (mixin = []) => {
const defaults = [
{
role: "system",
content: "for Typescript enums, always use double quotes for keys and values"
},
{
role: "system",
content: "for Typescript enums & classes, always use pascal case for names, and export them"
},
{
role: "system",
content: "for Typescript enums, dont add duplicates"
},
{
role: "system",
content: "for Typescript enums, always sort the keys alphabetically"
},
{
role: "system",
content: "for gps coordinates, always use strings, not numbers, in short form"
},
{
role: "system",
content: "for typescript code, please add a comment at the beginning of the file, with the query that generated the code"
},
{
role: "system",
content: "for typescript code : no comments"
},
{
role: "system",
content: "for Typescript : no semi colons, no trailing commas, no spaces in parens, no spaces in brackets, no spaces in braces"
}
];
return defaults.concat(mixin);
};
exports.Typescript = Typescript;
const TypescriptLibraries = (mixin = []) => {
const defaults = [
{
role: "user",
content: "for Typescript, dont use chalk, commander, ora, or any other fancy library, just use the basics, always use imports, never require. use tslog, yargs, axios and Zod whenevern possible"
}
];
return defaults.concat(mixin);
};
exports.TypescriptLibraries = TypescriptLibraries;
const TypescriptEnvironmentCLI = (mixin = []) => {
const layout = [
"src/index.ts (create ts logger)",
"src/main.ts (yargs main entry)",
"src/constants.ts (tslog logger name)",
"src/zod_schemas.ts (all zod schemas go here)",
"src/commands/index.ts (register all commands from src/commands/** here, commands always import functions from src/lib/category )",
"src/commands/types.ts (command to write zod schemas to Typescript interfaces)",
//"src/lib/index.ts (export all functions)",
//"readme.md (add all commands here)",
"package.json (leave dependencies empty, add common scripts)",
];
const defaults = [
{
role: "system",
content: "for Typescript boilerplates, use this layout for CLI projects: \n" + layout.join("\n")
},
{
role: "system",
content: "when using yargs, all commands are async"
},
];
return defaults.concat(mixin);
};
exports.TypescriptEnvironmentCLI = TypescriptEnvironmentCLI;
const Markdown = (mixin = []) => {
const defaults = [
{
role: "system",
content: "for markdown code, please add a caption (header level 1) at the beginning of the file, with the exact query that generated the code"
}
];
return defaults.concat(mixin);
};
exports.Markdown = Markdown;
//# sourceMappingURL=system.js.map