Conversation
a62ab07 to
7a4a80c
Compare
7a4a80c to
981a67c
Compare
| [ | ||
| ubuntu-latest, | ||
| macos-latest, | ||
| macos-15-intel, |
ca47499 to
ca0942e
Compare
| "sort" | ||
| "strings" | ||
|
|
||
| "go.temporal.io/server/common/primitives/timestamp" |
There was a problem hiding this comment.
Copied parseDuration to remove server dependency here.
37c08bb to
4423bb2
Compare
| s.NoError(res.Err) | ||
| out := res.Stdout.String() | ||
| var out string | ||
| s.EventuallyWithT(func(t *assert.CollectT) { |
| assert.Contains(t, res.Stdout.String(), deploymentName1) | ||
| assert.Contains(t, res.Stdout.String(), version1.BuildID) | ||
| assert.Contains(t, res.Stdout.String(), deploymentName2) | ||
| assert.Contains(t, res.Stdout.String(), version2.BuildID) |
4423bb2 to
4daadfb
Compare
4daadfb to
04e6f13
Compare
.github/workflows/ci.yaml
Outdated
| if: ${{ matrix.checkGenCommands }} | ||
| run: | | ||
| go run ./internal/cmd/gen-commands | ||
| go run ./cmd/gen-commands -pkg temporalcli -context "*CommandContext" < internal/temporalcli/commands.yaml > internal/temporalcli/commands.gen.go |
There was a problem hiding this comment.
This is where I would invoke make gen but received strong objections last time.
There was a problem hiding this comment.
Yes, IMO we should avoid adding platform dependent code. Any contributor on any supported platform should be able to basically run the same commands as our CI does
| - name: Generate docs, confirm working | ||
| if: ${{ matrix.checkGenCommands }} | ||
| run: | | ||
| go run ./cmd/gen-docs -output dist/docs < internal/temporalcli/commands.yaml | ||
|
|
There was a problem hiding this comment.
Better to know immediately if this is broken.
04e6f13 to
f58bd71
Compare
| buf bytes.Buffer | ||
| allCommands []Command | ||
| OptionSets []OptionSets | ||
| contextType string |
There was a problem hiding this comment.
Allow custom context name.
f58bd71 to
4398183
Compare
| return &s | ||
| } | ||
|
|
||
| var reDays = regexp.MustCompile(`(\d+(\.\d*)?|(\.\d+))d`) |
There was a problem hiding this comment.
As this is generated code, I think it's fine for the var and type to not be at the top here to keep the codegen simple. Similarly, a single generated file seems easier do manage and generate then multiple.
|
|
||
| // appendGoSource parses a Go source file, registers its imports, and appends | ||
| // everything after the import block to the output buffer. | ||
| func (c *codeWriter) appendGoSource(src string) error { |
There was a problem hiding this comment.
It was either this, string literals or regex; this seems like the best approach to me.
4398183 to
505b732
Compare
.github/workflows/ci.yaml
Outdated
| if: ${{ matrix.checkGenCommands }} | ||
| run: | | ||
| go run ./internal/cmd/gen-commands | ||
| go run ./cmd/gen-commands -pkg temporalcli -context "*CommandContext" < internal/temporalcli/commands.yaml > internal/temporalcli/commands.gen.go |
There was a problem hiding this comment.
Yes, IMO we should avoid adding platform dependent code. Any contributor on any supported platform should be able to basically run the same commands as our CI does
There was a problem hiding this comment.
I think this and the other could also be considered a "hidden" internal sub-command of the existing CLI (probably manually added, not via existing yaml file, which allows it to be easily versioned/downloaded and doesn't require these top-level dirs. The bootstrapping problem is very slight.
There was a problem hiding this comment.
That's fair; since it is an internal tool only. 👍
There was a problem hiding this comment.
I was saying they could be just commands on the existing binary (but hidden from "help"). Technically a completely different binary is fine too, but you lose the ability to easily download/version this binary.
There was a problem hiding this comment.
Oh, sorry, I misread. I have mixed feelings about including it directly in the Temporal CLI; it feels like it shouldn't be including the dev tooling itself.
AFAICS go run github.com/temporalio/cli/internal/cmd/gen-commands@<version> is how you'd run the command generator. And it would respond to the same git tags as the Temporal CLI as it's in the same repo.
Or should we consider moving it to a separate repo; now that we a standalone binary?
There was a problem hiding this comment.
I'm ok w/ how you have it now, just a thought of making it a separate command gets all of the packaging/deployment benefits, but what you have here is fine
There was a problem hiding this comment.
👍 we can always make adjustments later once we some learnings.
cmd/gen-commands/main.go
Outdated
| flag.Parse() | ||
|
|
||
| // Read input from stdin | ||
| yamlBytes, err := io.ReadAll(os.Stdin) |
There was a problem hiding this comment.
Personal preference is to (also?) accept files for both directions, but it's not a big deal for an internal tool
There was a problem hiding this comment.
👍 I'll change it to a file input, no strong opinions on my end
CONTRIBUTING.md
Outdated
| [commands.gen.go](internal/temporalcli/commands.gen.go) file from code, simply run: | ||
|
|
||
| go run ./internal/cmd/gen-commands | ||
| make gen |
There was a problem hiding this comment.
We support contributors on all of our supported platforms and therefore contributing guide should work across all platforms we support IMO
There was a problem hiding this comment.
Consider this a Freudian slip. Fixed.
b2a3b4c to
3ac1c49
Compare
There was a problem hiding this comment.
I was saying they could be just commands on the existing binary (but hidden from "help"). Technically a completely different binary is fine too, but you lose the ability to easily download/version this binary.
gen-commands
Outdated
There was a problem hiding this comment.
Were these committed intentionally?

What was changed
Make
gen-commandsandgen-docsa binary that can be used any YAML input.Why?
Temporal wants to re-use the
commandsgentool for other internal CLIs.It is not supported for users outside of Temporal.
Checklist
Closes
How was this tested: