Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow no context in cli #279

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/cli/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ async function run(
if (scriptRx.test(tool)) toolFiles.push(tool)

if (!specs?.length) {
specContent = await getStdin()
specContent = (await getStdin() || "\n")
spec = "stdin.gpspec.md"
} else if (specs.length === 1 && gpspecRx.test(specs[0])) {
spec = specs[0]
Expand Down Expand Up @@ -482,7 +482,7 @@ ${Array.from(files)
process.exit(FILES_NOT_FOUND)
}

if (specContent) host.setVirtualFile(spec, specContent)
if (specContent !== undefined) host.setVirtualFile(spec, specContent)

const prj = await buildProject({
toolFiles,
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/oai_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export async function initToken(force = false) {
"token not specified",
{
type: "no_token",
message: "token not configured, please run command 'key help'",
message:
"token not configured, see https://microsoft.github.io/genaiscript/reference/token/",
param: undefined,
code: "no_token",
},
Expand Down Expand Up @@ -168,4 +169,4 @@ export async function parseTokenFromEnv(
}
}
return undefined
}
}
Loading