Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check Generated Files
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
verify-generation:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Run commands generation command
run: make gen
- name: Verify no changes were generated
run: |
# Check if there are any uncommitted changes in the working directory
if [ -z "$(git status --porcelain)" ]; then
echo "::notice::Generated files are up to date. No changes detected."
else
echo "::error::Detected uncommitted changes after running the generation command. Please run the generator and commit the changes."
git status
git diff
exit 1
fi
Comment on lines +12 to +28

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Semgrep identified an issue in your code:
No explicit GITHUB_TOKEN permissions found at the workflow or job level. Add a permissions: block at the workflow root (applies to all jobs) or per job with least privilege (e.g., contents: read and only specific writes like pull-requests: write if needed).

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by missing-explicit-permissions.

You can view more details about this finding in the Semgrep AppSec Platform.

build:
runs-on: ubuntu-latest
needs: verify-generation
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Build the cli binary
run: make build
Comment on lines +30 to +36

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Semgrep identified an issue in your code:
No explicit GITHUB_TOKEN permissions found at the workflow or job level. Add a permissions: block at the workflow root (applies to all jobs) or per job with least privilege (e.g., contents: read and only specific writes like pull-requests: write if needed).

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by missing-explicit-permissions.

You can view more details about this finding in the Semgrep AppSec Platform.

12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*.dll
*.so
*.dylib
/cloud-cli
/temporal-cloud

# Test binary, built with `go test -c`
*.test
Expand All @@ -18,7 +20,7 @@ coverage.*
profile.cov

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/

# Go workspace file
go.work
Expand All @@ -28,5 +30,9 @@ go.work.sum
.env

# Editor/IDE
# .idea/
# .vscode/
.idea/
.vscode/

# bots and other local information
.local/
.claude/
130 changes: 130 additions & 0 deletions AGENTS.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Agents

## Overview

This repository contains the CLI Plugin for Temporal Cloud (`temporal-cloud`).

## Project Structure

- `cmd/temporal-cloud/` - Main entry point for the CLI
- `temporalcloudcli/` - Core CLI implementation
- `cloud.go` - The cloud specific client implementation including auth and clients for cloud ops api service
- `commands.go` - The command context thats passed around and the root command implementation
- `commands.gen.go` - Generated command code, do not edit
- `commands.login.go` - Login command implementation
- `commands.namespace.go` - Namespace command implementation
- `commands.yml` - Command configuration, used to generate commands.gen.go
- `common.go` - Shared utilities, constants, and types used across the CLI
- `namespace.go` - The namespace client implementation
- `internal/printer/` - Output formatting utilities

## Building

```bash
make
```

## Usage

The plugin is meant to be an extension to the Temporal CLI. After building, the plugin binary should be copied to some place in your `PATH` and renamed to `temporal-cloud`. After that, you can use it as follows:

```bash
temporal cloud <command> [flags]
```


### Use Anchor Comments
Add specially formatted comments throughout the codebase, where appropriate, for yourself as inline knowledge that can be easily `grep`ped for.

- Use `AIDEV-NOTE:`, `AIDEV-TODO:`, or `AIDEV-QUESTION:` (all-caps prefix) for comments aimed at AI and developers.
- **Important:** Before scanning files, always first try to **grep for existing anchors** `AIDEV-*` in relevant subdirectories.
- **Update relevant anchors** when modifying associated code.
- **Do not remove `AIDEV-NOTE`s** without explicit human instruction.
- Make sure to add relevant anchor comments, whenever a file or piece of code is:
* too complex, or
* very important, or
* confusing, or
* could have a bug

### General Code Style Guide
- Keep all `const`, `type`, and `var` at the top of the file.
- Group multiple `const`, `type` and `var` declarations together. e.g.
```go
type (
CompanyName string
CompanyID string
)
```

- Limit lines to 120 characters.
- Avoid stuttering in names. When a name's context (like the enclosing type or package) already implies part of the name, do not repeat it.

**Bad:**
```go
type User struct {
UserName string
UserID int
}

func (u User) GetUserName() string {
return u.UserName
}
```

**Good:**
```go
type User struct {
Name string
ID int
}

func (u User) GetName() string {
return u.Name
}
```

- Add an EOF newline for new files you create.

## AI Communication Guidelines

### Plan Before Implementing
Before providing your final implementation, use <implementation_planning> tags to:

1. Break down the feature into smaller, manageable tasks.
2. Consider potential challenges for each task and how to address them.
3. Provide a high-level outline of the code structure, including function names and their purposes.
4. List specific test cases you plan to implement.
5. State which error handling approaches you will use for different scenarios.
6. Discuss the trade-offs inherent in your design decisions, including:
* Performance trade-offs
* Scalability trade-offs
* Complexity trade-offs
* Security trade-offs
7. Reason about the failure modes of your design. How does it handle crashes? A 10x increase in load?

### Code Explanation Format
When explaining code mechanics with verb constructions (e.g., "calls", "sends", "is processed"), follow this format:
1. **Bold** the verb in the sentence
2. Immediately after the sentence, provide a clickable code citation showing the exact line where that action occurs
3. Use the format: `[filepath:line](filepath:line)` for clickable code citations

**Example:**
When the account entity module initializes, it **registers** activities with the Temporal worker using prefixed names:

[entities/account/internal/fx.go:22](entities/account/internal/fx.go:22)
```go
w.RegisterActivityWithOptions(a, activity.RegisterOptions{Name: ActivityNamePrefix})
```

## What AI _Must_ Do

1. Use environment variables instead of committing secrets
2. Always ask instead of assuming business logic
3. Add to AIDEV comments or ask instead of removing them
4. Stay focused on the task at hand. When in doubt about whether a change is related to the task, ask.

## Development Process
1. Follow the style guide rules above.
2. When a new `.go` file is created, git add it.
3. Before saying that you're "done", ensure the following checks pass:
- `make all`
1 change: 1 addition & 0 deletions CLAUDE.md
8 changes: 8 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @temporalio/saas will be requested for review when
# someone opens a pull request.
* @temporalio/saas
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: all gen build

all: gen build

gen:
go tool gen-commands -input ./temporalcloudcli/commands.yml -pkg temporalcloudcli > ./temporalcloudcli/commands.gen.go

build:
go build ./cmd/temporal-cloud
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# temporal-cloud
# cloud-cli
CLI Plugin for Temporal Cloud
13 changes: 13 additions & 0 deletions cmd/temporal-cloud/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"context"

"github.com/temporalio/cloud-cli/temporalcloudcli"
)

func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
temporalcloudcli.Execute(ctx, temporalcloudcli.CommandOptions{})
}
66 changes: 66 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module github.com/temporalio/cloud-cli

go 1.25.3

require (
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.18.0
github.com/kylelemons/godebug v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.11.1
github.com/temporalio/cli/cliext v0.0.0-20251219224619-5b50c14ff5c9
github.com/temporalio/ui-server/v2 v2.42.1
go.temporal.io/api v1.59.0
go.temporal.io/cloud-sdk v0.6.0
go.temporal.io/sdk v1.38.0
go.temporal.io/sdk/contrib/envconfig v0.1.0
go.temporal.io/server v1.29.1
golang.org/x/oauth2 v0.34.0
golang.org/x/term v0.38.0
google.golang.org/grpc v1.78.0
)

require (
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/clipperhouse/stringish v0.1.1 // indirect
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.7.0-rc.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/labstack/echo/v4 v4.13.4 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/nexus-rpc/sdk-go v0.5.1 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/temporalio/cli v1.5.2-0.20251212213638-36bff7182259 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/text v0.32.0 // indirect
golang.org/x/time v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251222181119-0a764e51fe1b // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
golang.org/x/sys v0.39.0 // indirect
google.golang.org/protobuf v1.36.11
)

tool github.com/temporalio/cli/cmd/gen-commands
Loading
Loading