Repository navigation
Closed
Labels
area/cliAll about go code on dagger CLI
Description
Overview
In the context of the shell, it's no longer necessary to auto-print objects. Instead, there should be a .print and perhaps also a .json builtin, that you can easily add to the pipeline. By default, a pipeline that succeeds should simply print nothing.
Examples
No print when returning an object:
⋈ .http https://dagger.io
⋈
To learn more, .doc:
⋈ .http https://dagger.io | .doc
File
DESCRIPTION
A file.
REFERENCE
https://docs.dagger.io/api/reference/#definition-File
FUNCTIONS
contents Retrieves the contents of the file.
digest Return the file's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same
Dagger engine.
export Writes the file to a file path on the host.
name Retrieves the name of the file.
size Retrieves the size of the file, in bytes.
sync Force evaluation in the engine.
with-name Retrieves this file with its name set to the given name.
with-timestamps Retrieves this file with its created/modified timestamps set to the given time.
SEE ALSO
".doc <function>" for more information on a function.
To know the type, .type:
⋈ .http https://dagger.io | .type
File
To print the contents, .print. Note the absence of _Type field, another hack we no longer need:
⋈ .http https://dagger.io | .print
digest: sha256:e37c20d68d9cf63cd164ef06220b6b7b6ea4bc98aed5cc982e3de09c2622c028
name: 78c79fe99761c116238476f0b5a6a528b621e80398bfbaaa991abe41c4942a0d
size: 838056
A special case to encode the object to JSON:
⋈ .http https://dagger.io | .json
{
"digest": "sha256:e37c20d68d9cf63cd164ef06220b6b7b6ea4bc98aed5cc982e3de09c2622c028",
"name": "78c79fe99761c116238476f0b5a6a528b621e80398bfbaaa991abe41c4942a0d",
"size": 838056
}
⋈
Activity
helderco commentedon Nov 19, 2024
Is there a need for
.typewhen that already shows in.doc? At minimum this is what.docshows:Format:
Another example
dagger-dev ⋈ version | .doc SCALAR string Primitive type.Want to bikeshed
.doc?helderco commentedon Nov 19, 2024
Isn't it going to be confusing if nothing happens? Let's say a new user creates a
Lintfunction that returns adagger.Containerbased on something seen elsewhere. In the CLI the first thing they may try is to call the function directly, but then nothing happens:Additionally with
.print, what would be the behavior on a scalar?dagger-dev ⋈ version | .printsourishkrout commentedon Dec 20, 2024
@helderco to answer your question from #9258
I'm looking to integrate the Shell into Runme's notebook UX as per the video below. We already have this for the CLI, aka
dagger callwhere under the hood, we redirectstdoutto process the type information atomically. This works great which is why I'd like it back, please :-).Response.Payload.mp4
Coming back to the original issue, it makes sense not to print "objects by default", I see a few ways of solving this:
dagger shellCLI-flag or ENV var or both.<snippet> | .docor<snippet> | .jsonto fetch type information etc. However, Runme runs cells atomically, which means 2x bootstrapping and potential latency if caching isn't practical due to late binding.Of course, I'm open to alternative proposals. However, I'd prefer running cells atomically because that's what a user will do. Please let me know if you have questions. Thanks so much for your help, @helderco.
sourishkrout commentedon Jan 8, 2025
Update
@shykes & @helderco:
I've completed an MVP implementation of the Dagger Shell into Runme (screenshot below). I've recorded a little demo here: https://www.youtube.com/watch?v=01-JF77eDhc
Please note that merely running Dagger Shell in the notebooks works without "printing objects". However, as discussed in my previous comment, the UX integration does require getting hold of the object's type information. I'm running a custom build off #9258 to enable this.
Pending more polish, this integration already works well and feels natural.
I'd love to do a live demo, e.g. at the Community Call, if you are interested.
shykes commentedon Jan 8, 2025
@sourishkrout regardless of whether we add auto-printing of objects, I feel like it would be better for you not to depend so much on a "cosmetic" decision that might still change later. I'm confident there's a way for you to not care either way, and still have the cool UX integration.
For example: if you need type information, couldn't you under the hood call
<TARGET_PIPELINE> | .doc? That will give you a complete introspection of all available functions for the returned type (including its type). At the moment it's human-readable format, but we could easily add a flag to output it in json for example, eg..doc --json. Then you don't have to worry about parsing a_Typefrom the actual value - you already have all the information you need.wdyt?
sourishkrout commentedon Jan 14, 2025
@shykes, 👍 agreed. Building Runme's UX integration on a stable "API" makes sense.
That should work 👌 . Unlike regular POSIX-shells, e.g. bash/zsh running
dagger call, Runme can deeply integrate with Dagger Shell directly. A.doc --jsonflag has my vote.Meanwhile, we'll push forward with the Dagger Shell integration into Runme's Kernel, which is not contingent on this issue.
sourishkrout commentedon Feb 11, 2025
Native Dagger Shell support landed in Runme's notebooks as of
v3.12.0. Currently working on bringing support into the CLI sorunme run EXTENSIONarrives at the same artifact.The UX-level integration that initially connected back to this issue is currently disabled. However, I might send a draft PR to implement the
.doc --jsonflag for discussion.Works great otherwise:
Here's a video clip: https://www.youtube.com/watch?v=IKQQFVmB4UI
shykes commentedon Feb 19, 2025
I believe @vito took this?
sourishkrout commentedon Feb 19, 2025
Thanks, @shykes. I'm happy to help if you need anything, @vito. Just holler.
sourishkrout commentedon Feb 21, 2025
Update: Dagger Shell is now fully integrated and supported in both the notebook UX and Runme's CLI!