Skip to content

Commit

Permalink
allow no context in cli (#279)
Browse files Browse the repository at this point in the history
* allow running without context

* use new line
  • Loading branch information
pelikhan authored Mar 21, 2024
1 parent 9b5679f commit 16ce383
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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
}
}

0 comments on commit 16ce383

Please sign in to comment.