Skip to content

Conversation

@SasSwart
Copy link
Contributor

@SasSwart SasSwart commented Nov 11, 2025

relates to: coder/internal#1094

This is number 5 of 5 pull requests in an effort to add agent script ordering. It adds CLI commands that allow coder scripts to manage dependencies between one another at runtime.

I used an LLM to produce some of these changes, but I have conducted thorough self review and consider this contribution to be ready for an external reviewer.

@SasSwart SasSwart changed the base branch from main to jjs/internal-1095-branch4-sdk-client November 13, 2025 14:24
@SasSwart SasSwart changed the title Jjs/internal 1095 branch5 cli sync feat(agent): Add CLI commands that allow coder scripts to depend on one another Nov 13, 2025
@mafredri mafredri self-requested a review November 14, 2025 12:03
@SasSwart SasSwart force-pushed the jjs/internal-1095-branch4-sdk-client branch from 831a36b to c300efb Compare November 14, 2025 13:22
@SasSwart SasSwart force-pushed the jjs/internal-1095-branch5-cli-sync branch from 51c9d3b to ce2bf8a Compare November 14, 2025 13:23
@SasSwart SasSwart force-pushed the jjs/internal-1095-branch4-sdk-client branch from c300efb to 234bb48 Compare November 17, 2025 14:18
@SasSwart SasSwart force-pushed the jjs/internal-1095-branch5-cli-sync branch from ce2bf8a to d994626 Compare November 17, 2025 14:27
@SasSwart SasSwart force-pushed the jjs/internal-1095-branch4-sdk-client branch from 234bb48 to 72a8f70 Compare November 24, 2025 10:15
@SasSwart SasSwart force-pushed the jjs/internal-1095-branch5-cli-sync branch from d994626 to c344440 Compare November 25, 2025 13:37
@SasSwart
Copy link
Contributor Author

@mafredri @mtojek Here's what it looks like on Windows:
image

It builds and runs correctly, with an appropriate warning that the feature is not supported on Windows.

@SasSwart
Copy link
Contributor Author

@mafredri @mtojek These are the agent logs:
image

@SasSwart SasSwart marked this pull request as ready for review November 26, 2025 15:17
@SasSwart SasSwart changed the title feat(agent): Add CLI commands that allow coder scripts to depend on one another feat(agent): edd CLI commands that allow coder scripts to depend on one another Nov 26, 2025
@SasSwart SasSwart changed the title feat(agent): edd CLI commands that allow coder scripts to depend on one another feat(agent): add CLI commands to enable coder script interdependency Nov 26, 2025
SasSwart and others added 13 commits November 26, 2025 18:21
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
@SasSwart SasSwart requested a review from mafredri November 27, 2025 10:49
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Basically approved but some final touches would be nice. Also one request for follow-up PR (re client and server unix/windows split).

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

One simplification, but ignore Q about path, I found the answer.

Comment on lines +66 to +78
header := fmt.Sprintf("Unit: %s\nStatus: %s\nReady: %t\n\nDependencies:\n", unit, statusResp.Status, statusResp.IsReady)
if formatter.FormatID() == "table" && len(statusResp.Dependencies) == 0 {
out = header + "No dependencies found"
} else {
out, err = formatter.Format(ctx, statusResp)
if err != nil {
return xerrors.Errorf("format status: %w", err)
}

if formatter.FormatID() == "table" {
out = header + out
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
header := fmt.Sprintf("Unit: %s\nStatus: %s\nReady: %t\n\nDependencies:\n", unit, statusResp.Status, statusResp.IsReady)
if formatter.FormatID() == "table" && len(statusResp.Dependencies) == 0 {
out = header + "No dependencies found"
} else {
out, err = formatter.Format(ctx, statusResp)
if err != nil {
return xerrors.Errorf("format status: %w", err)
}
if formatter.FormatID() == "table" {
out = header + out
}
}
out, err = formatter.Format(ctx, statusResp)
if err != nil {
return xerrors.Errorf("format status: %w", err)
}
if formatter.FormatID() == "table" {
if len(statusResp.Dependencies) == 0 {
out = "No dependencies found"
}
out = fmt.Sprintf("Unit: %s\nStatus: %s\nReady: %t\n\nDependencies:\n%s", unit, statusResp.Status, statusResp.IsReady, out)
}

This seemed a bit complicated, with checking ID multiple times.

@SasSwart SasSwart merged commit 359b11c into jjs/internal-1095-branch4-sdk-client Nov 27, 2025
30 checks passed
@SasSwart SasSwart deleted the jjs/internal-1095-branch5-cli-sync branch November 27, 2025 13:17
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants