Added ChatGPT script to populate descriptions
This commit is contained in:
parent
8e07080453
commit
41b01d8e91
3 changed files with 5371 additions and 5725 deletions
|
@ -31,6 +31,7 @@
|
|||
"prepare": "bash start.sh && (test -f Taskfile.yml && task npm:prepare) || true",
|
||||
"release": "bash start.sh && task publish:semantic-release",
|
||||
"repair": "bash <(curl -sS https://install.doctor/repair)",
|
||||
"sort:software": "yq -i 'sort_keys(..)' software.yml",
|
||||
"start": "test -z $SKIP_NPM_START && bash start.sh || true",
|
||||
"test": "bash start.sh && task donothing",
|
||||
"unpack": "bash start.sh && task npm:bundle:unpack",
|
||||
|
|
57
scripts/software.mjs
Normal file
57
scripts/software.mjs
Normal file
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env zx
|
||||
|
||||
let definitions, softwarePackages
|
||||
|
||||
async function getSoftwareDefinitions() {
|
||||
try {
|
||||
return YAML.parse(fs.readFileSync(`${os.homedir()}/.local/share/chezmoi/software.yml`, 'utf8'))
|
||||
} catch (e) {
|
||||
throw Error('Failed to load software definitions', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function writeSoftwareDefinitions() {
|
||||
try {
|
||||
fs.writeFileSync(fs.readFileSync(`${os.homedir()}/.local/share/chezmoi/software.yml`, YAML.stringify(definitions)))
|
||||
} catch (e) {
|
||||
throw Error('Failed to write new software definitions file', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function populateMissing() {
|
||||
definitions = await getSoftwareDefinitions()
|
||||
softwarePackages = definitions.softwarePackages
|
||||
for (const pkg in softwarePackages) {
|
||||
if (softwarePackages[pkg]._github) {
|
||||
console.log(pkg)
|
||||
if (!softwarePackages[pkg]._desc) {
|
||||
const sgptResponse = await $`sgpt "Describe ${softwarePackages[pkg]._github}. Do not say that you can find more information on its GitHub page."`
|
||||
console.log('--- START - SGPT Response for Description Acquired ---')
|
||||
console.log(sgptResponse.stdout)
|
||||
console.log('--- END - SGPT Response for Description Acquired ---')
|
||||
softwarePackages[pkg]._desc = sgptResponse.stdout
|
||||
}
|
||||
|
||||
if (!softwarePackages[pkg]._name) {
|
||||
const sgptResponse = await $`sgpt "What is the project name of ${softwarePackages[pkg]._github}? Only print the project name without any additional text."`
|
||||
console.log('--- START - SGPT Response for Name Acquired ---')
|
||||
console.log(sgptResponse.stdout)
|
||||
console.log('--- END - SGPT Response for Name Acquired ---')
|
||||
softwarePackages[pkg]._name = sgptResponse.stdout
|
||||
}
|
||||
} else if (softwarePackages[pkg]._github === false) {
|
||||
console.log('No GitHub repository for ' + pkg)
|
||||
} else {
|
||||
console.log('MISSING GITHUB REPOSITORY INFORMATION FOR ' + pkg)
|
||||
}
|
||||
}
|
||||
definitions.softwarePackages = softwarePackages
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await populateMissing()
|
||||
|
||||
}
|
||||
|
||||
console.log('Running script..')
|
||||
main()
|
11038
software.yml
11038
software.yml
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue