Add jobs in @huggingface/hub & hfjs cli#1925
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
- Add null check for envVars before iterating (matching secretVars pattern) - Add existence check for providedPositionalTokens[i] before accessing .value Co-authored-by: eliott <eliott@huggingface.co>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
- Fix ParsedArgsResult type: multiple optional options can be undefined - Use hf.co/ prefix to identify Space IDs, otherwise treat as Docker image This fixes the issue where org/image Docker images without tags were misidentified as HuggingFace Space IDs Co-authored-by: eliott <eliott@huggingface.co>
coyotte508
commented
Jan 20, 2026
Comment on lines
802
to
811
| if (firstArg.startsWith("hf.co/")) { | ||
| // hf.co/spaces/namespace/space-name or hf.co/namespace/space-name | ||
| const hfCoSpacesMatch = firstArg.match(/^hf\.co\/spaces\/(.+)$/); | ||
| if (hfCoSpacesMatch) { | ||
| spaceId = hfCoSpacesMatch[1]; | ||
| } else { | ||
| // hf.co/namespace/space-name format | ||
| spaceId = firstArg.slice("hf.co/".length); | ||
| } | ||
| } else { |
Member
Author
There was a problem hiding this comment.
@cursor just check on hf.co/spaces/* and extract the space id ("*") do not handle any other format for space id
Everything else is treated as a Docker image. Co-authored-by: eliott <eliott@huggingface.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cf @Wauplin for viz
useful to test jobs change in hf.co (ongoing PRs)
cli only contains a few endpoints, and tries to use same syntax as python lib
diffrence with python cli:
(was complicated to do otherwise)
Note
Adds first-class Jobs support to the JS Hub SDK and CLI.
runJob,listJobs,getJob,duplicateJob,cancelJob, log/event/metric streaming, hardware listing, and full scheduled jobs lifecycle (create,list,get,run,suspend,resume,delete); exported viasrc/lib/jobsand new API types.hfjs): newjobssubcommands—run,ps,hardware,logs—with env/secret flags, hardware flavor selection, log streaming, and namespace auto-resolve; improved--helphandling and advanced arg parsing (multi-value positionals/options).SpaceHardwareFlavorset and introduce job types (ApiJob,ApiScheduledJob, etc.).hfjs help jobs; tsconfig enables source maps.Written by Cursor Bugbot for commit b1e9e87. This will update automatically on new commits. Configure here.