-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from elsoul/cli
Update - skeet ai
- Loading branch information
Showing
51 changed files
with
586 additions
and
1,071 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
'@skeet-framework/utils': patch | ||
'@skeet-framework/cli': patch | ||
--- | ||
|
||
Update - skeet ai | ||
|
||
```bash | ||
$ skeet ai | ||
╔═════════╤════════╗ | ||
│ Option │ Value │ | ||
╟─────────┼────────╢ | ||
│ AI Type │ Gemini │ | ||
╚═════════╧════════╝ | ||
|
||
🤖 Skeet AI Mode | ||
Type `mode` to change AI mode 🤖 | ||
|
||
|
||
Gemini is selected 🤖 (type 'q' to quit) | ||
|
||
|
||
? What can I do for you? | ||
|
||
You: mode | ||
Skeet: | ||
? 🤖 Select Mode (Use arrow keys) | ||
❯ prisma | ||
typedoc | ||
firestore | ||
function | ||
method | ||
``` | ||
|
||
or directly call skeet ai mode with the option | ||
|
||
```bash | ||
$ skeet ai --mode | ||
? 🤖 Select Mode (Use arrow keys) | ||
❯ prisma | ||
typedoc | ||
firestore | ||
function | ||
method | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,7 @@ | |
} | ||
], | ||
"ai": { | ||
"lang": "ja", | ||
"lang": "en", | ||
"ais": [ | ||
{ | ||
"name": "VertexAI", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { existsAsync } from '@skeet-framework/utils' | ||
import { mkdir, readFile, writeFile } from 'fs/promises' | ||
import { ModeFrequency, defaultModeFrequency } from './modeSelect' | ||
|
||
export const createOrReadModeFrequency = async () => { | ||
const filePath = `./tmp/modeFrequency.json` | ||
if (await existsAsync(filePath)) { | ||
const modeFrequency: ModeFrequency = JSON.parse( | ||
await readFile(filePath, 'utf8'), | ||
) | ||
const sortedKeys = Object.entries(modeFrequency) | ||
.sort((a, b) => b[1] - a[1]) | ||
.map((entry) => entry[0]) | ||
return sortedKeys | ||
} else { | ||
const tmp = './tmp' | ||
if (!(await existsAsync(tmp))) { | ||
await mkdir(tmp) | ||
} | ||
const body = JSON.stringify(defaultModeFrequency, null, 2) | ||
await writeFile(filePath, body, 'utf8') | ||
return Object.keys(defaultModeFrequency) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { readFile, writeFile } from 'fs/promises' | ||
import { ModeFrequency } from './modeSelect' | ||
|
||
export const incrementModeFrequency = async ( | ||
modeKey: keyof ModeFrequency, | ||
): Promise<void> => { | ||
const filePath = `./tmp/modeFrequency.json` | ||
|
||
const modeFrequency: ModeFrequency = JSON.parse( | ||
await readFile(filePath, 'utf8'), | ||
) | ||
|
||
if (modeFrequency[modeKey] !== undefined) { | ||
modeFrequency[modeKey] += 1 | ||
} else { | ||
modeFrequency[modeKey] = 1 | ||
} | ||
await writeFile(filePath, JSON.stringify(modeFrequency, null, 2), 'utf8') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.