Skip to content

Conversation

@AlePouroullis
Copy link

@AlePouroullis AlePouroullis commented May 21, 2025

Command example output

npx humanloop --help

Screenshot 2025-05-23 at 16 56 35

npx humanloop pull --help

Screenshot 2025-05-23 at 16 57 10

npx humanloop pull

Screenshot 2025-05-23 at 17 04 27

fern-api bot and others added 19 commits May 21, 2025 14:35
…pt idioms

- Rename SyncClient to FileSyncer and update client options to match Python SDK
- Add useLocalFiles, localFilesDirectory, and cacheSize options
- Update pull method to return [successful, failed] arrays
- Improve TypeScript terminology in docstrings (array vs tuple/list)
- Fix type errors and error handling

Makes the codebase more consistent with Python SDK while improving
TypeScript idioms and type safety.
- Create new unified `overloadClient` function that handles both log and call methods
- Simplify client initialization by directly overloading parent class instances
- Replace SyncClient with direct FileSyncer instance for cleaner file handling
- Standardize tracing context, local file handling, and evaluation context across all client types
@AlePouroullis AlePouroullis changed the title P sync clean new new p_sync: FileSyncer + CLI + Local File Usage May 21, 2025
@andreibratu andreibratu self-requested a review May 23, 2025 12:12
Comment on lines +12 to +22
const LogType = {
SUCCESS: "\x1b[92m", // green
ERROR: "\x1b[91m", // red
INFO: "\x1b[96m", // cyan
WARN: "\x1b[93m", // yellow
RESET: "\x1b[0m",
} as const;

function log(message: string, type: keyof typeof LogType): void {
console.log(`${LogType[type]}${message}${LogType.RESET}`);
}

Choose a reason for hiding this comment

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

move to a separate util module

.description("Pull Prompt and Agent files from Humanloop to your local filesystem")
.addHelpText(
"after",
"\nThis command will:\n" +
Copy link

@andreibratu andreibratu May 23, 2025

Choose a reason for hiding this comment

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

Add a screnshot on PR conversation showing how the help menu is printed

): T {
const originalLog = client.log.bind(client);

const _overloadedLog = async (

Choose a reason for hiding this comment

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

does typing work ok? think this guard was in place for a reason

* For example, an invalid path format (absolute paths, leading/trailing slashes, etc.)
* or a file not being found.
*/
function handleLocalFiles<T extends LogRequestType>(

Choose a reason for hiding this comment

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

There's some similar logic in resolve File in eval.run(...). Modifying it now could take a while, but do add it in the Linear project for milestone 2

// If file_type is already specified in request, prioritize user-provided value
if (fileType in request && typeof request[fileType as keyof T] !== "string") {
console.warn(
`Ignoring local file for \`${filePath}\` as ${fileType} parameters were directly provided. ` +

Choose a reason for hiding this comment

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

Message could be better worded

/**
* Normalize a path to the standard Humanloop API format.
*
* This function is primarily used when interacting with the Humanloop API to ensure paths

Choose a reason for hiding this comment

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

Comment on lines +27 to +33
const LogType = {
DEBUG: "\x1b[90m", // gray
INFO: "\x1b[96m", // cyan
WARN: "\x1b[93m", // yellow
ERROR: "\x1b[91m", // red
RESET: "\x1b[0m",
} as const;

Choose a reason for hiding this comment

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

This can also go in the common logging module mentioned earlier

Copy link

@andreibratu andreibratu left a comment

Choose a reason for hiding this comment

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

logic looks good - i think we can use libraries in two places + i have some questions

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.

3 participants