diff --git a/README.md b/README.md index 3c16551..da04c2f 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,12 @@ export const userRequest = npm run dev ``` +> 또는 다음과 같이 커맨드라인에서 prompt를 붙일 수도 있습니다. + +``` +npm run dev 여러가지 순열들을 제공해주는 Typescript 라이브러리를 제공해 줘 +``` + > 모든 결과파일은 result 폴더 안에 생성됩니다.
diff --git a/package.json b/package.json index 785c63d..26000de 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,31 @@ { - "name": "friday", + "name": "friday-gpt", "description": "A.I 에게 R&R을 부여해서 프로그래밍 업무를 진행시킵니다.", "private": true, "version": "0.0.1", "main": "index.js", "type": "module", "scripts": { + "start": "tsc && node -r dotenv/config dist/dev.js", "dev": "tsc && node -r dotenv/config dist/dev.js", "architect": "tsc && node -r dotenv/config dist/architect.js", "evangelist": "tsc && node -r dotenv/config dist/evangelist.js", "programmer": "tsc && node -r dotenv/config dist/programmer.js", "reviewer": "tsc && node -r dotenv/config dist/reviewer.js", - "new-tts": "tsc && node -r dotenv/config dist/azureSpeak.js" + "new-tts": "tsc && node -r dotenv/config dist/azureSpeak.js", + "lint:fix": "prettier --write . && eslint --fix", + "lint": "prettier --check . && eslint", + "typecheck": "tsc", + "release:patch": "npm run build && npm version patch && npm run build && npm publish && git push --follow-tags" + }, + "repository": { + "type": "git", + "url": "https://github.com/hmmhmmhm/friday-gpt" }, "devDependencies": { "@types/node": "^18.15.11", "chalk": "^5.2.0", + "cleye": "^1.3.2", "dotenv": "^16.0.3", "typescript": "^5.0.4" }, @@ -26,3 +36,4 @@ "sound-play": "^1.1.0" } } + diff --git a/src/architect/index.ts b/src/architect/index.ts index 63c4b0c..0275ba4 100644 --- a/src/architect/index.ts +++ b/src/architect/index.ts @@ -1,4 +1,4 @@ -import { config } from "../input.js"; +import { countConfig } from "../input.js"; import { userRequest } from "../input.js"; import { logger } from "../utils/logger.js"; import { findIsGoodToGo, findWhatIdo } from "../utils/match.js"; @@ -11,14 +11,14 @@ import fs from "node:fs"; export const doArchitect = async () => { logger( - `요청사항에 따른 ${config.architect.draftCount}가지 각기 다른 기획 시안을 생성 중입니다.\n` + `요청사항에 따른 ${countConfig.architect.draftCount}가지 각기 다른 기획 시안을 생성 중입니다.\n` ); speak( - `요청사항에 따른 ${config.architect.draftCount}가지 각기 다른 기획 시안을 생성 중입니다.` + `요청사항에 따른 ${countConfig.architect.draftCount}가지 각기 다른 기획 시안을 생성 중입니다.` ); const drafts: string[] = []; - for (let i = 1; i <= config.architect.draftCount; i++) { + for (let i = 1; i <= countConfig.architect.draftCount; i++) { const draft = await doArchitectThese(userRequest); drafts.push(draft); @@ -36,7 +36,7 @@ export const doArchitect = async () => { let bestDraftNumber = 1; - if (config.architect.draftCount !== 1) { + if (countConfig.architect.draftCount !== 1) { const bestDraftSelection = await doArchitectSelection(drafts); console.log(bestDraftSelection); diff --git a/src/input.ts b/src/input.ts index 343b9ba..49670be 100644 --- a/src/input.ts +++ b/src/input.ts @@ -1,7 +1,29 @@ -export const userRequest = - "키워드를 하나 입력받은다음 youtube.com 에서 해당 키워드의 영상 5개를 다운받는 프로그램을 Typescript 로 작성해줘"; +import { cli } from 'cleye'; +import { version } from '../package.json'; +import { commandName } from './helpers/constants'; -export const config = { +const argv = cli({ + name: commandName, + version: version, + flags: { + prompt: { + type: String, + description: 'Prompt to run', + alias: 'p', + }, + } +}) + +let userRequest = argv._.join(' '); + +// If userRequest is empty, use the provided default value +if (userRequest === "") { + userRequest = "키워드를 하나 입력받은다음 youtube.com 에서 해당 키워드의 영상 5개를 다운받는 프로그램을 Typescript 로 작성해줘"; +} + +export { userRequest }; + +export const countConfig = { architect: { // * 초기 기획서를 몇 개까지 만들고 고민할지 설정합니다. draftCount: 3, diff --git a/tsconfig.json b/tsconfig.json index a7a0451..8aeca33 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,7 +30,7 @@ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Enable importing .json files */ + "resolveJsonModule": true, /* Enable importing .json files */ // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ @@ -90,4 +90,4 @@ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ } -} \ No newline at end of file +}