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

EPD-572 Setup CLI repo #1

Merged
merged 33 commits into from
Feb 19, 2024
Merged

EPD-572 Setup CLI repo #1

merged 33 commits into from
Feb 19, 2024

Conversation

nicolewhite
Copy link
Contributor

No description provided.

Copy link

linear bot commented Feb 8, 2024

EPD-572 CLI scaffolding

@nicolewhite nicolewhite requested a review from adamnolte February 8, 2024 19:19
Nicole White added 3 commits February 8, 2024 18:00
This will make it easier to add evals since the public API
won't need to look up test cases by hash every time
import { startInteractiveCLI, interactiveEmitter } from './interactive-cli';
import net from 'net';

function findAvailablePort(startPort: number): Promise<number> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chatgpt wrote that for me

adamnolte
adamnolte previously approved these changes Feb 9, 2024
@@ -0,0 +1,4 @@
.prettierignore
*.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i don't think you need this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was going to add e2e tests for both the python and ts sdks so will just leave it

@@ -0,0 +1,100 @@
#!/bin/env node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this here if it's on the bin/cli.js file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah b/c the bin/cli.js file executes this file:

// The location of the built CLI entrypoint relative to this file's location
const CLI_PATH = '../dist/cli.mjs';

function runCLI() {
  return spawn(
    process.execPath,
    [
      '--no-warnings',
      '--experimental-vm-modules',
      ...process.execArgv,
      path.join(__dirname, CLI_PATH),
      // Slice off the first two arguments, which are the path to Node and the path to this file
      ...process.argv.slice(2),
    ],
    {
      stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
    },
  )

and tsup will make it executable: https://tsup.egoist.dev/#building-cli-app

Comment on lines +107 to +111
if (!resp.ok) {
throw new Error(
`POST ${path} failed: ${resp.status} ${await resp.text()}`,
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a follow up, but it might be nice to implement a retry here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can retry on 500s but won't retry on anything lower

Comment on lines 481 to 484
// Wait for listeners to be set up in the progress component
await new Promise((resolve) => {
setTimeout(resolve, 10);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 10 here arbitrary? is there a way to do a callback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah was gonna come back to this but lemme look at it more

@nicolewhite nicolewhite merged commit 27e5593 into main Feb 19, 2024
2 checks passed
@nicolewhite nicolewhite deleted the nicole/epd-572-cli-scaffolding branch February 19, 2024 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants