added prompt context library (#27)

This commit is contained in:
Arwid Thornström
2025-06-17 10:00:25 +02:00
committed by GitHub
parent 8950a83e12
commit 90b9ccc454
5 changed files with 1098 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@
"@octokit/core": "^3.5.1",
"chalk": "^4.1.2",
"cli-select": "^1.1.2",
"clipboardy": "2.3.0",
"enquirer": "^2.3.6",
"gluegun": "latest",
"lodash.snakecase": "^4.1.1",
+12
View File
@@ -0,0 +1,12 @@
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
import { defaultMenuSettings } from '../../globals';
module.exports = {
name: 'ai',
alias: ['ai'],
description: 'AI (ai)',
hidden: false,
run: async (toolbox: GluegunMenuToolbox) => {
await toolbox.menu.showMenu('ai', defaultMenuSettings);
},
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
import * as path from 'path';
import * as fs from 'fs';
import chalk = require('chalk');
const { AutoComplete } = require('enquirer');
const clipboard = require('clipboardy');
module.exports = {
name: 'promptcontextlibrary',
alias: ['pcl'],
description: 'Prompt Context Library (pcl)',
hidden: false,
run: async (toolbox: GluegunMenuToolbox) => {
const currentDir = path.dirname(__filename);
const files = fs
.readdirSync(currentDir)
.filter((file) => file.endsWith('.txt'))
.map((file) => ({
name: file.replace(/-/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase()),
value: file,
}));
console.log(chalk.cyan('📚 Welcome to the Prompt Context Library! 📚'));
const prompt = new AutoComplete({
name: 'context',
message: chalk.yellow('✨ Select a context file:'),
limit: 10,
initial: 0,
choices: files,
});
try {
const answer = await prompt.run();
const filePath = path.join(currentDir, answer);
const fileContent = fs.readFileSync(filePath, 'utf8');
// Copy content to clipboard
await clipboard.write(fileContent);
console.log(chalk.green(`🎯 Selected: ${chalk.bold(answer)}`));
console.log(
chalk.magenta(
'📋 Context has been copied to clipboard and is ready to paste! 🚀'
)
);
} catch (error) {
console.error(chalk.red('❌ Operation cancelled'));
}
},
};
+26
View File
@@ -800,6 +800,11 @@ app-module-path@^2.2.0:
resolved "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz"
integrity sha1-ZBqlXft9am8KgUHEucCqULbCTdU=
arch@^2.1.1:
version "2.2.0"
resolved "https://registry.yarnpkg.com/arch/-/arch-2.2.0.tgz#1bc47818f305764f23ab3306b0bfc086c5a29d11"
integrity sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==
arg@^4.1.0:
version "4.1.3"
resolved "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz"
@@ -1177,6 +1182,15 @@ cli-table3@0.6.0:
optionalDependencies:
colors "^1.1.2"
clipboardy@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-2.3.0.tgz#3c2903650c68e46a91b388985bc2774287dba290"
integrity sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==
dependencies:
arch "^2.1.1"
execa "^1.0.0"
is-wsl "^2.1.1"
cliui@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz"
@@ -2409,6 +2423,11 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2:
is-data-descriptor "^1.0.0"
kind-of "^6.0.2"
is-docker@^2.0.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
is-extendable@^0.1.0, is-extendable@^0.1.1:
version "0.1.1"
resolved "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz"
@@ -2553,6 +2572,13 @@ is-wsl@^1.1.0:
resolved "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz"
integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=
is-wsl@^2.1.1:
version "2.2.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271"
integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==
dependencies:
is-docker "^2.0.0"
isarray@1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"