Skip to content

Commit d6fd648

Browse files
committed
feat: Added uv completions and rb completions and test completions script
1 parent 2f1e5db commit d6fd648

4 files changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { completionModules } from './__generated__/completions-index.js'
2+
3+
async function main() {
4+
const results = await Promise.allSettled(
5+
completionModules.map(async ({ resourceType, parameterPath, fetch }) => {
6+
const values = await fetch()
7+
return { resourceType, parameterPath, values }
8+
})
9+
)
10+
11+
for (const result of results) {
12+
if (result.status === 'rejected') {
13+
console.error(`FAILED: ${result.reason}`)
14+
continue
15+
}
16+
17+
const { resourceType, parameterPath, values } = result.value
18+
const label = `${resourceType}${parameterPath}`
19+
console.log(`\n${label} (${values.length} total)`)
20+
console.log(` Top 5: ${values.slice(0, 5).join(', ')}`)
21+
}
22+
}
23+
24+
main().catch(console.error)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
type PyenvPythonVersions = Array<{
2+
name: string
3+
path: string
4+
sha: string
5+
size: string
6+
}>
7+
8+
export default async function loadPythonVersions(): Promise<string[]> {
9+
const response = await fetch('https://api.github.com/repos/pyenv/pyenv/contents/plugins/python-build/share/python-build', {
10+
method: 'GET',
11+
headers: {
12+
'User-Agent': 'CodifyCLI'
13+
}
14+
})
15+
if (!response.ok) {
16+
throw new Error(`Unable to load pyenv versions ${await response.text()}`)
17+
}
18+
19+
const pyenvVersions = await response.json() as PyenvPythonVersions
20+
return pyenvVersions.map((v) => v.name)
21+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default async function loadPipPackages(): Promise<string[]> {
2+
const response = await fetch('https://hugovk.dev/top-pypi-packages/top-pypi-packages.min.json')
3+
const data = await response.json() as { rows: { project: string }[] }
4+
5+
return data.rows.map((r) => r.project)
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default async function loadRubyVersions(): Promise<string[]> {
2+
const response = await fetch('https://api.github.com/repos/rbenv/ruby-build/contents/share/ruby-build')
3+
const data = await response.json() as { name: string }[]
4+
5+
return data.map((entry) => entry.name)
6+
}

0 commit comments

Comments
 (0)