Skip to content

feat: SSH Command from Files#5358

Open
andrecalil wants to merge 13 commits into
mainfrom
feat/ssh-command-from-file
Open

feat: SSH Command from Files#5358
andrecalil wants to merge 13 commits into
mainfrom
feat/ssh-command-from-file

Conversation

@andrecalil

Copy link
Copy Markdown
Collaborator

Summary

Introduces a new source option for SSH commands: inline (current) or file.
This should offer a better UX for large commands.

Resolves #5344

Signed-off-by: André Calil <andre@calil.com.br>
@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

Comment thread pkg/components/ssh/ssh.go
Comment thread pkg/components/ssh/ssh.go
@superplane-gh-integration-9000

superplane-gh-integration-9000 Bot commented Jun 12, 2026

Copy link
Copy Markdown

Docs Impact Review

The SSH component reference will auto-update, but the Files concept page needs a new section explaining that user-defined scripts can be stored in the repository and referenced by components.

Suggested docs updates:

  • docs/concepts/files (https://docs.superplane.com/concepts/files) — Add a new subsection (e.g. "Adding your own files" or "User files") to the "What's in the repository" section. Explain that beyond canvas.yaml and console.yaml, users can upload arbitrary files (e.g. shell scripts under scripts/) via the Files tab, and that components such as SSH Command can reference those files by path. The current table lists only the two system files, which will actively mislead users trying to configure "From file" mode for SSH.

Why: The PR introduces a new commandSource field on the SSH node with an "From file" option that reads a script from the app's git repository at publish and execution time. The component reference docs are auto-generated and will pick up the new fields automatically. However, the Files concept page currently states the repository contains only canvas.yaml and console.yaml — a user following the docs to set up file-backed SSH commands will find no guidance on how to add a script file to the repository, making the feature effectively undiscoverable from the docs.


Maintainers: Reply with /docs-agree to open a tracking issue in superplanehq/docs (and assign it to you), or /docs-reject to dismiss this check.

Posted automatically by warp-gateway · commit 434bbc3

@AleksandarCole

Copy link
Copy Markdown
Collaborator

/docs-agree

@superplane-gh-integration-9000

Copy link
Copy Markdown

Tracking docs update in superplanehq/docs#115: superplanehq/docs#115

Assigned @AleksandarCole.

Signed-off-by: André Calil <andre@calil.com.br>
Comment thread web_src/src/pages/app/mappers/ssh.ts
…-file

Signed-off-by: André Calil <andre@calil.com.br>
Signed-off-by: André Calil <andre@calil.com.br>
Comment thread pkg/components/ssh/ssh.go Outdated
Signed-off-by: André Calil <andre@calil.com.br>
Signed-off-by: André Calil <andre@calil.com.br>
Comment thread web_src/src/pages/app/mappers/ssh.ts
Signed-off-by: André Calil <andre@calil.com.br>
Signed-off-by: André Calil <andre@calil.com.br>
Signed-off-by: André Calil <andre@calil.com.br>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 948b78a. Configure here.

Comment thread pkg/components/ssh/ssh.go Outdated
Signed-off-by: André Calil <andre@calil.com.br>
Comment thread pkg/components/ssh/ssh.go
// (pipefail, declare -A) that the &&-join would destroy.
func (c *SSHCommand) buildExecutionCommand(metadata ExecutionMetadata) (string, error) {
if metadata.CommandSource == CommandSourceFile {
return c.buildScriptCommand(metadata.WorkingDirectory, metadata.Environment, metadata.Commands), nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we storing the file contents in the node metadata?

Comment thread pkg/components/ssh/ssh.go
func (c *SSHCommand) buildScriptCommand(workingDirectory string, environment []EnvironmentVariable, script string) string {
finalScript := script
if workingDirectory != "" {
finalScript = fmt.Sprintf("cd %s || exit 1\n%s", shellQuote(workingDirectory), script)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if when using a file, we actually copied that file into the host, and executed the file with bash? I'm guessing that would make the experience of using multi-line or full-on scripts a lot easier

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Interesting. Addressing this now.

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.

Support file as source for a SSH command

3 participants