-
-
-

-
# DevStream
-[](https://makeapullrequest.com)
-
-[](https://goreportcard.com/report/github.com/devstream-io/devstream)
-[](https://github.com/devstream-io/devstream/releases)
-[](https://bestpractices.coreinfrastructure.org/projects/6202)
-[](https://cloud-native.slack.com/archives/C03LA2B8K0A)
-
-| English | [中文](README_zh.md) |
-| --- | --- |
-
-
-
-## DevStream, What Is It Anyway?
-
-TL;DR: DevStream (CLI tool named `dtm`) is an open-source DevOps toolchain manager.
-
-[v0.6.0 Demo](https://www.youtube.com/watch?v=q7TK3vFr1kg)
-
-Imagine you are starting a new project or ramping up a new team. Before writing the first line of code, you have to figure out the tools to run an effective SDLC process and from development to deployment.
-
-Typically, you'd need the following pieces in place to work effectively:
-
-- Project management software or issue tracking tools (JIRA, etc.)
-- Source code management (GitHub, Bitbucket, etc.)
-- Continuous integration tools (Jenkins, CircleCI, Travis CI, etc.)
-- Continuous delivery/deployment tools (Flux CD/Flux2, Argo CD, etc.)
-- A single source of truth for secrets and credentials (secrets manager, e.g., Vault by HashiCorp)
-- Some tools for centralized logging and monitoring (for example, ELK, Prometheus/Grafana);
-
-The list could go on for quite a bit, but you get the idea!
-
-There are many challenges in creating an effective and personalized workflow:
-
-- There are too many choices. Which is best? There is no "one-size-fits-all" answer because it totally depends on your needs and preferences.
-- Integration between different pieces is challenging, creating silos and fragmentation.
-- The software world evolves fast. What's best today might not make sense tomorrow. If you want to switch parts or tools out, it can be challenging and resource intensive to manage.
-
-To be fair, there are a few integrated products out there that may contain everything you might need, but they might not suit your specific requirements perfectly. So, the chances are, you will still want to go out and do your research, find the best pieces, and integrate them yourself. That being said, to choose, launch, connect, and manage all these pieces take a lot of time and energy.
-
-You might be seeing where we are going with this...
-
-We wanted to make it easy to set up these personalized and flexible toolchains, so we built DevStream, an open-source DevOps toolchain manager.
-
-Think of the Linux kernel V.S. different distributions. Different distros offer different packages so that you can always choose the best for your need.
-
-Or, think of `yum`, `apt`, or `apk`. You can easily set it up with your favorite packages for any new environment using these package managers.
-
-DevStream aims to be the package manager for DevOps tools.
-
-To be more ambitious, DevStream wants to be the Linux kernel, around which different distros can be created with various components so that you can always have the best components for each part of your SDLC workflow.
-
-## Why `dtm`?
-
-Q: The CLI tool is named `dtm`, while the tool itself is called DevStream. What the heck?! Where is the consistency?
-
-A: Inspired by [`git`](https://github.com/git/git#readme), the name is (depending on your mood):
-
-- a symmetric, scientific acronym of **d**evs**t**rea**m**.
-- "devops toolchain manager": you're in a good mood, and it actually works for you.
-- "dead to me": when it breaks.
-
-## Why Use DevStream?
-
-No more manual curl/wget download, apt install, helm install; no more local experiments and playing around just to get a piece of tool installed correctly.
-
-Define your desired DevOps tools in a single human-readable YAML config file, and at the press of a button (one single command), you will have your whole DevOps toolchain and SDLC workflow set up. Five Minutes. One Command.
-
-Want to install another different tool for a try? No problem.
-
-Want to remove or reinstall a specific piece in the workflow? DevStream has got your back!
-
-## Quick Start
-
-If you want to get a quick start, follow our [quick start](https://docs.devstream.io/en/latest/quickstart/) doc now.
-
-## Best Practices Toolchain Integration
-
-DevStream supports the management of many tools. You can flexibly combine some tools to meet the DevOps toolchain your need.
-
-And yes, if you ask me if any recommended practices that can be used out of the box,
-
-I am happy to tell you that we have, and we are constantly adding more possible combinations,
-
-so you are more than welcome to tell us what combinations you expect.
-
-- [GitOps Toolchain](https://docs.devstream.io/en/latest/best-practices/gitops/)
-- [GitLab, Jenkins and Harbor On Premise Toolchain (Chinese only for now)](https://docs.devstream.io/en/latest/best-practices/gitlab-jenkins-harbor-java-springboot.zh/)
-
-## Supported DevOps Tools
-
-DevStream already supports many tools and it's still growing. For a complete list of supported tools, check out our [list of plugins](https://docs.devstream.io/en/latest/plugins/plugins-list/) document.
-
-Alternatively, run `dtm list plugins` and it will show you all the available plugins.
-
-## Dev Info
-
-### Pre-requisites
-
-- Git
-- Go (1.18+)
-
-### Development Guide
-
-- [Development Environment Setup](https://docs.devstream.io/en/latest/development/dev/dev-env-setup)
-- [Code linter](https://docs.devstream.io/en/latest/development/dev/lint)
-- [Build the source code](https://docs.devstream.io/en/latest/development/dev/build)
-- [Test the source code: unit test, e2e test](https://docs.devstream.io/en/latest/development/dev/test)
-- [Create a plugin](https://docs.devstream.io/en/latest/development/dev/creating-a-plugin)
-
-## Contribute
-
-First of all, thanks for wanting to contribute to DevStream! For more details on how to contribute, contributor growth program, style guide and more, please check out our [CONTRIBUTING](./CONTRIBUTING.md) document.
-
-## Community
-
-We will regularly organize `DevStream Community Meeting`, please visit the [wiki](https://github.com/devstream-io/devstream/wiki) page for details.
-
-Please join our Slack channel. Here's how:
-
-1. [Invite yourself to CNCF's Slack if you haven't done so](https://slack.cncf.io).
- - Input your email address, and click "get my invite."
- - Open your inbox, find the invitation email, and click "join now."
- - You can join by Email or with your Google account; follow the instructions.
-2. Join DevStream channel, there are two ways to do so:
- - Use [this link](https://cloud-native.slack.com/messages/devstream) to join the channel.
- - In your Slack app, on the left side navigation bar, move your mouse to the "Channels" section, and there should emerge a "plus" sign on the right. Click, and select "browse channels." Input "devstream", and join.
-3. For Mandarin-speaking users and contributors, you are also encouraged to join the [devstream-mandarin](https://cloud-native.slack.com/messages/devstream-mandarin) channel, where all discussions will be in Mandarin.
-
-For WeChat users, you can also join our WeChat group:
-
-
-
-## Code of Conduct
-
-[DevStream code of conduct](./CODE_OF_CONDUCT.md)
-
-As of Jun 2022, we joined CNCF sandbox. We also need to follow the [CNCF Community Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
+to be updated
diff --git a/README_zh.md b/README_zh.md
deleted file mode 100644
index 9e112c151..000000000
--- a/README_zh.md
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-

-
-# DevStream
-
-[](https://makeapullrequest.com)
-
-[](https://goreportcard.com/report/github.com/devstream-io/devstream)
-[](https://bestpractices.coreinfrastructure.org/projects/6202)
-[](https://github.com/devstream-io/devstream/releases)
-[](https://cloud-native.slack.com/archives/C03LA2B8K0A)
-
-| [English](README.md) | 中文 |
-| --- | --- |
-
-
-
-## DevStream 是什么?
-TL;DR: DevStream(CLI工具名为`dtm`)是一个开源的DevOps工具链管理器。
-
-[v0.6.0 Demo](https://www.bilibili.com/video/BV1W3411P7oW/)
-
-想象你正在开始一个新的项目或组建一个新的团队。在写第一行代码之前,你需要一个能够高效运转SDLC(软件开发生命周期)和承载开发至部署全过程的工具。
-
-通常情况下,你需要以下几个部分来高效地工作。
-
-- 项目管理软件或 `issue` 追溯工具(JIRA等)
-- 源代码管理(GitHub、Bitbucket等)
-- 持续集成(Jenkins、CircleCI、Travis CI等)
-- 持续交付/部署(Flux CD/Flux2、Argo CD等)
-- 密钥和证书的单一事实来源(A single source of truth)(密钥管理器,如HashiCorp的Vault)
-- 集成化的日志和监控工具(例如,ELK、Prometheus/Grafana)
-- ......
-
-具体内容远远不止这些,不过你应该已经明白意思了。
-
-在创建一个高效、定制化的工作流上,当前有许多挑战。
-
-- 我们有很多选择。哪个是最好的?没有"放之四海而皆准"的答案,因为这完全取决于你的需求和喜好。
-- 不同部分之间的整合是非常具有挑战性的,否则将导致项目孤岛化、碎片化。
-- 软件领域演进很快。今天最好的东西可能明天就毫无意义。如果你想换掉一些组件或工具,管理起来会很困难,也很耗费资源。
-
-说实话,有一些产品可能包含你需要的一切,但它们可能并不完全适合你的具体要求。因此,你仍然需要自己去搜寻,找到最好的组件,并自己将它们整合起来。也就是说,选择、启动、连接和管理所有这些组件需要大量的时间和精力。
-
-你可能已经看到了我们想要做的事情......
-
-我们想简化整合组件的过程,所以我们建立了DevStream,一个开源的DevOps工具链管理器。
-
-想一想Linux内核与不同发行版的关系。不同的发行版提供不同的软件包,这样你就可以随时选择你最需要的。
-
-或者,想想`yum`、`apt`或`apk`。你可以使用这些包管理器为任何新环境轻松设置你最喜欢的软件包。
-
-**DevStream的目标是成为DevOps工具的软件包管理器。**
-
-**更具野心的是,DevStream想成为Linux内核,你可以用各种组件创建不同的发行版,为SDLC工作流的每个部分选择最适合的组件。**
-
-## 为什么是 `dtm` ?
-Q:CLI被命名为 `dtm`,而工具本身被称为 `DevStream`。这是怎么回事!?一致性在哪里?
-
-A:受 [`git`](https://github.com/git/git#readme) 的启发,这个名字可以是(取决于你的心情):
-
-- "**d**evs**t**rea**m**": 一个对称缩写。
-- "**D**evops **T**oolchain **M**anager":当它对你有用的时候。
-- "**d**ead **t**o **m**e":当它崩溃的时候。
-
-## 为什么使用DevStream?
-
-不再需要手动的 `curl/wget` 下载、`apt` 安装、`helm` 安装;不再需要预先的本地试验以保证组件能正确安装。
-
-在一个人类可读的 `YAML` 配置文件中定义你所需要的DevOps工具,只需按一个按钮(或一个命令),你就能建立起整个DevOps工具链和SDLC工作流。
-
-五分钟,一个命令。
-
-想安装另一个不同的工具来试一试?没问题。
-
-想删除或重新安装工作流中的某个特定部分?DevStream已经帮你解决了!
-
-## 快速入门
-
-现在就跟随我们的[快速入门](https://docs.devstream.io/en/latest/quickstart.zh/)文档开始使用 DevStream
-
-## 最佳实践
-
-DevStream支持许多工具的管理。你可以灵活地结合一些工具来满足你所需要的DevOps工具链。
-
-是的,如果你问我是否有可以开箱即用的推荐实践。
-
-我很高兴地告诉你,我们有,而且我们正在不断增加更多可能的组合。
-
-我们非常欢迎你告诉我们你期望的组合。
-
-- [GitOps工具链](https://docs.devstream.io/en/latest/best-practices/gitops.zh/)
-- [用 DevStream 搭建 GitLab + Jenkins + Harbor 工具链,管理 Java Spring Boot 项目开发生命周期全流程](https://docs.devstream.io/en/latest/best-practices/gitlab-jenkins-harbor-java-springboot.zh/)
-
-## 支持的DevOps工具
-
-DevStream已经支持许多工具,而且还在不断增加。关于支持的工具的完整列表,请查看我们的 [插件列表](https://docs.devstream.io/en/latest/plugins/plugins-list) 文档。
-
-或者,运行 `dtm list plugins`,它将显示所有可用的插件。
-
-## 开发指南
-
-### 前提条件
-
-- Git
-- Go (1.18版本以上)
-
-### 开发指南
-
-- [开发环境搭建](https://docs.devstream.io/en/latest/development/dev/dev-env-setup.zh)
-- [代码格式检查](https://docs.devstream.io/en/latest/development/dev/lint.zh)
-- [源码构建](https://docs.devstream.io/en/latest/development/dev/build.zh)
-- [代码测试:单元测试(unit test)、端到端测试(e2e test)](https://docs.devstream.io/en/latest/development/dev/test.zh)
-- [开发新插件](https://docs.devstream.io/en/latest/development/dev/creating-a-plugin.zh)
-
-## 贡献
-
-首先,感谢你愿意为DevStream做贡献!
-
-关于如何贡献、贡献者成长计划、风格指南等更多细节,请查看我们的 [CONTRIBUTING](CONTRIBUTING.md) 文档。
-
-## 社区
-
-我们将定期组织 "DevStream Community Meeting",请访问 [WIKI](https://github.com/devstream-io/devstream/wiki) 页面了解详情。
-
-另外,请加入我们的Slack channel,请参见如下步骤:
-
-1. [给自己发送进入CNCF的Slack的邀请](https://slack.cncf.io)。
- - 输入邮箱地址,点击"get my invite"。
- - 打开收件箱,找到邀请邮件,点击邮件中的"join now"。
- - 你可以用邮箱地址或者Google账号等方式加入,跟随屏幕提示即可。
-2. 对于会说英文的用户:加入DevStream的英语频道。以下两种方式均可:
- - [点击这里](https://cloud-native.slack.com/messages/devstream)。
- - 在Slack app里,在左侧的导航栏,找到“频道”区域,将鼠标移动到上面,这时“频道”的右侧会出现一个加号。点击加号,然后选择“浏览频道”。输入"devstream",找到频道然后加入。
-3. 对于只说中文的用户,可以加入[devstream-mandarin](https://cloud-native.slack.com/messages/devstream-mandarin)频道,这里的讨论都是用中文进行的。
-
-对于使用微信的用户,请扫描二维码进群:
-
-
-
-## 行为守则
-
-[DevStream行为守则](/CODE_OF_CONDUCT.md)
-
-DevStream于2022年6月加入CNCF沙盒。我们也需要遵循[云原生计算基金会(CNCF)社区行为准则](https://github.com/cncf/foundation/blob/main/code-of-conduct-languages/zh.md).
diff --git a/ROADMAP.md b/ROADMAP.md
index eb9f5d745..258cd5725 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,109 +1 @@
-# Roadmap
-
-## 1 New Tools to Support (Plugins)
-
-- artifactory: https://github.com/devstream-io/devstream/issues/607
-- Jenkins pipeline plugin: https://github.com/devstream-io/devstream/issues/582
-- Cloudflare IP List Monitor: https://github.com/devstream-io/devstream/issues/560
-- Use Validator for Config Validation: https://github.com/devstream-io/devstream/issues/558
-- GitLab CE: https://github.com/devstream-io/devstream/issues/509
-- zendao: https://github.com/devstream-io/devstream/issues/508
-- Tekton
-- Jira-GitHub, Jira-GitLab integration
-- Jenkins-GitHub, Jenkins-GitLab integration
-- ArgoCD-GitHub SSO integration
-- Repository bootstrapping for Python/Nodejs for GitHub, Golang/Python/Nodejs for GitLab
-- GitLab CI workflows for Python/Nodejs
-- FluxCD plugin
-- Trello-GitLab Integration
-
-## 2 Core Features
-
-General:
-
-- single config profile support: https://github.com/devstream-io/devstream/issues/596
-- make sure people who don't have optimum internet connections (e.g., users behind firewall or proxy) can still use DevStream smoothly.
-
-### `dtm show config`
-
-This is already supported, but we will improve the features of it, for example:
-
-- show the default configs of multiple plugins that are used together
-- interactive: user select plugin then show the default config
-
-## 3 Quality of Life Improvements for Developers
-
-### Automated End-to-End Testing in a Staging Environment
-
-- AWS EC2 (linux-amd64) creation with Terraform/Ansible
-- Push notification to Slack/Lark when the testing environment is occupied or released
-
-### Misc
-
-- Integrate the golangci-lint command in the makefile https://github.com/devstream-io/devstream/issues/632
-- Push notification when CI failed: https://github.com/devstream-io/devstream/issues/636
-- Shorter CI time: for example, adding packages into a base image
-- More end-to-end tests coverage, to test more typical usecases and plugins
-- Push notification to core committers when there is a new PR ready for review
-
-## 4 Already Done
-
-Core:
-- local state support: https://github.com/devstream-io/devstream/issues/16
-- pluginmanager module: https://github.com/devstream-io/devstream/issues/17
-- statemanager supports concurrent map: https://github.com/devstream-io/devstream/issues/71
-- pluginmanager download status bar: https://github.com/devstream-io/devstream/issues/88, https://github.com/devstream-io/devstream/issues/98
-- multi-plugin instance support: https://github.com/devstream-io/devstream/issues/136
-- force delete feature: https://github.com/devstream-io/devstream/issues/177, https://github.com/devstream-io/devstream/issues/278
-- `verify` command: https://github.com/devstream-io/devstream/issues/252, https://github.com/devstream-io/devstream/issues/253
-- output support: https://github.com/devstream-io/devstream/issues/324
-- Homebrew support: https://github.com/devstream-io/devstream/issues/351, https://github.com/devstream-io/devstream/issues/372
-- remote state: https://github.com/devstream-io/devstream/issues/378, https://github.com/devstream-io/devstream/issues/485
-- autocomplete: https://github.com/devstream-io/devstream/issues/380
-- generate default config: https://github.com/devstream-io/devstream/issues/383
-- list all plugins: https://github.com/devstream-io/devstream/issues/384
-- config supports global variables: https://github.com/devstream-io/devstream/issues/393
-- plugin status: https://github.com/devstream-io/devstream/issues/401
-- parallel download: https://github.com/devstream-io/devstream/issues/579
-- plugins released to AWS S3 instead of GitHub releases page
-
-Plugins:
-- Jenkins plugin: https://github.com/devstream-io/devstream/issues/11
-- GitLab CI plugin: https://github.com/devstream-io/devstream/issues/12
-- GitHub Actions plugin for Nodejs and Python: https://github.com/devstream-io/devstream/issues/14
-- GitHub Actions plugin supports test coverage: https://github.com/devstream-io/devstream/issues/133
-- GitHub repo scaffolding for Golang plugin: https://github.com/devstream-io/devstream/issues/191, https://github.com/devstream-io/devstream/issues/520
-- Prometheus/grafana plugin: https://github.com/devstream-io/devstream/issues/231
-- Helm type plugins support values: https://github.com/devstream-io/devstream/issues/272
-- openldap plugin: https://github.com/devstream-io/devstream/issues/284
-- trello plugin: https://github.com/devstream-io/devstream/issues/307, https://github.com/devstream-io/devstream/issues/314
-- GitLab CI generic plugin: https://github.com/devstream-io/devstream/issues/377
-- Helm generic plugin: https://github.com/devstream-io/devstream/issues/424
-
-Develop:
-- cross-platform build: https://github.com/devstream-io/devstream/issues/21, https://github.com/devstream-io/devstream/issues/170
-- end to end test: https://github.com/devstream-io/devstream/issues/50, https://github.com/devstream-io/devstream/issues/118
-- logging level: https://github.com/devstream-io/devstream/issues/176
-- parallel build: https://github.com/devstream-io/devstream/issues/361
-- automated release: https://github.com/devstream-io/devstream/issues/364
-- command to help contributors to generate scaffolding code: https://github.com/devstream-io/devstream/issues/454, https://github.com/devstream-io/devstream/issues/443, https://github.com/devstream-io/devstream/issues/436
-- params validation improvement: https://github.com/devstream-io/devstream/issues/511
-- editor config: https://github.com/devstream-io/devstream/issues/629
-
-By versions:
-
-v0.3.1:
-- automated release: when a new tag is generated, build binaries for different platforms/OS and distribute the binaries to the plugin storage.
-
-v0.3.0:
-- "Destroy" and "force delete": everything can be cleared up without any residue or side effects.
-- "Output": all plugin's output is printed for users to review.
-- Plugin dependency management: a common way to handle plugin dependencies and execution order using graph/topology sort.
-- Automated e2e testing: AWS EKS cluster with Terraform.
-- Trello plugin that creates boards.
-
-v0.4.0-v0.5.0:
-- generic GitLab CI plugin
-- define variables and use it in the config file.
-- auto-complete support for `dtm` commands
-- HashiCorp Vault
+todo
diff --git a/SECURITY.md b/SECURITY.md
index cb7c3d3ed..ab70a6ddd 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -1,6 +1,6 @@
# DevStream Security Policy
-Version: **v0.1 (2022-02-28)**
+Version: **v0.12 (2023-04-24)**
## Overview
@@ -20,7 +20,6 @@ In some cases, where a security fix needs complex re-design of a feature or is o
Please report vulnerabilities by e-mail to the following address:
-- tiexin.guo@merico.dev
- tao.hu@merico.dev
If you find a security-related bug in DevStream, we kindly ask you to disclose responsibly and give us appropriate time to react to mitigate the vulnerability.
diff --git a/cmd/devstream/apply.go b/cmd/devstream/apply.go
deleted file mode 100644
index c1abf3694..000000000
--- a/cmd/devstream/apply.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package main
-
-import (
- "os"
- "strings"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/pluginengine"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var applyCMD = &cobra.Command{
- Use: "apply",
- Short: "Create or update DevOps tools according to DevStream configuration file",
- Long: `Create or update DevOps tools according to DevStream configuration file.
-DevStream will generate and execute a new plan based on the config file and the state file by default.`,
- Run: applyCMDFunc,
- SuggestFor: []string{"install"},
-}
-
-func applyCMDFunc(cmd *cobra.Command, args []string) {
- checkConfigFile()
- log.Info("Apply started.")
- if err := pluginengine.Apply(configFilePath, continueDirectly); err != nil {
- log.Errorf("Apply failed => %s.", err)
- if strings.Contains(err.Error(), "config not valid") {
- log.Info("It seems your config file is not valid. Please check the official documentation https://docs.devstream.io, or use the \"dtm show config\" command to get an example.")
- }
- os.Exit(1)
- }
- log.Success("Apply finished.")
-}
-
-func init() {
- addFlagConfigFile(applyCMD)
- addFlagPluginDir(applyCMD)
- addFlagContinueDirectly(applyCMD)
-}
diff --git a/cmd/devstream/common.go b/cmd/devstream/common.go
deleted file mode 100644
index c6944d415..000000000
--- a/cmd/devstream/common.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package main
-
-import (
- "os"
- "strings"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/completion"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var (
- configFilePath string
- pluginDir string
- continueDirectly bool
-)
-
-const (
- configFlagName = "config-file"
- pluginDirFlagName = "plugin-dir"
- defaultPluginDir = "~/.devstream/plugins"
-)
-
-func checkConfigFile() {
- if strings.TrimSpace(configFilePath) == "" {
- log.Errorf(`Config file is required. You could use "-f filename" or "-f directory" to specify it.`)
- os.Exit(1)
- }
-}
-
-func addFlagConfigFile(cmd *cobra.Command) {
- cmd.Flags().StringVarP(&configFilePath, configFlagName, "f", "", "config file or directory")
- completion.FlagFilenameCompletion(cmd, configFlagName)
-}
-
-func addFlagPluginDir(cmd *cobra.Command) {
- cmd.Flags().StringVarP(&pluginDir, pluginDirFlagName, "d", defaultPluginDir, "plugins directory")
- completion.FlagDirnameCompletion(cmd, pluginDirFlagName)
-}
-
-func addFlagContinueDirectly(cmd *cobra.Command) {
- cmd.Flags().BoolVarP(&continueDirectly, "yes", "y", false, "continue directly without confirmation")
-}
diff --git a/cmd/devstream/completion.go b/cmd/devstream/completion.go
deleted file mode 100644
index c7ea6a49e..000000000
--- a/cmd/devstream/completion.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package main
-
-import (
- "io"
- "os"
- "path/filepath"
-
- "github.com/spf13/cobra"
-
- cobracompletefig "github.com/withfig/autocomplete-tools/integrations/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/completion"
-)
-
-func completionCMD(out io.Writer) *cobra.Command {
- cmd := &cobra.Command{
- Use: "completion",
- Short: "Generate the autocompletion script for dtm for the specified shell",
- Long: "See each sub-command's help for details on how to use the generated script.",
- DisableFlagsInUseLine: true,
- Args: cobra.ExactValidArgs(1),
- }
-
- binaryName := filepath.Base(os.Args[0])
- bash := &cobra.Command{
- Use: "bash",
- Short: "generate autocompletion script for bash",
- Example: completion.BashExample(binaryName),
- RunE: func(cmd *cobra.Command, args []string) error {
- return completion.CompletionBash(out, cmd)
- },
- }
-
- zsh := &cobra.Command{
- Use: "zsh",
- Short: "generate autocompletion script for zsh",
- Example: completion.ZshExample(binaryName),
- RunE: func(cmd *cobra.Command, args []string) error {
- return completion.CompletionZsh(out, cmd)
- },
- }
-
- fish := &cobra.Command{
- Use: "fish",
- Short: "generate autocompletion script for fish",
- Example: completion.FishExample(binaryName),
- RunE: func(cmd *cobra.Command, args []string) error {
- return cmd.Root().GenFishCompletion(out, true)
- },
- }
-
- powershell := &cobra.Command{
- Use: "powershell",
- Short: "generate autocompletion script for powershell",
- Example: completion.PowershellExample(binaryName),
- RunE: func(cmd *cobra.Command, args []string) error {
- return cmd.Root().GenPowerShellCompletionWithDesc(out)
- },
- }
-
- cmd.AddCommand(bash, zsh, fish, powershell, cobracompletefig.CreateCompletionSpecCommand(cobracompletefig.Opts{Use: "fig"}))
-
- return cmd
-}
diff --git a/cmd/devstream/create.go b/cmd/devstream/create.go
deleted file mode 100644
index 18fc7b5a9..000000000
--- a/cmd/devstream/create.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/create"
-)
-
-var createCMD = &cobra.Command{
- Use: "create",
- Short: "create",
- Long: `create.`,
- Run: createCMDFunc,
-}
-
-func createCMDFunc(cmd *cobra.Command, args []string) {
- err := create.Create()
- if err != nil && err.Error() != "^C" {
- fmt.Printf("Failed with error: %s", err)
- }
-}
diff --git a/cmd/devstream/delete.go b/cmd/devstream/delete.go
deleted file mode 100644
index b2cd65a1c..000000000
--- a/cmd/devstream/delete.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package main
-
-import (
- "os"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/pluginengine"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var isForceDelete bool
-
-var deleteCMD = &cobra.Command{
- Use: "delete",
- Short: "Delete DevOps tools according to DevStream configuration file",
- Long: `Delete DevOps tools according to DevStream configuration file.
-DevStream will delete everything defined in the config file, regardless of the state.`,
- Run: deleteCMDFunc,
-}
-
-func deleteCMDFunc(cmd *cobra.Command, args []string) {
- checkConfigFile()
- log.Info("Delete started.")
- if err := pluginengine.Remove(configFilePath, continueDirectly, isForceDelete); err != nil {
- log.Errorf("Delete error: %s.", err)
- os.Exit(1)
- }
-
- log.Success("Delete finished.")
-}
-
-func init() {
- addFlagConfigFile(deleteCMD)
- addFlagPluginDir(deleteCMD)
- addFlagContinueDirectly(deleteCMD)
-
- deleteCMD.Flags().BoolVarP(&isForceDelete, "force", "", false, "force delete by config")
-}
diff --git a/cmd/devstream/destroy.go b/cmd/devstream/destroy.go
deleted file mode 100644
index f5f5afeb8..000000000
--- a/cmd/devstream/destroy.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package main
-
-import (
- "os"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/pluginengine"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var isForceDestroy bool
-
-var destroyCMD = &cobra.Command{
- Use: "destroy",
- Short: "Destroy DevOps tools deployment according to DevStream configuration file & state file",
- Long: `Destroy DevOps tools deployment according to DevStream configuration file & state file.`,
- Run: destroyCMDFunc,
-}
-
-func destroyCMDFunc(cmd *cobra.Command, args []string) {
- checkConfigFile()
- log.Info("Destroy started.")
- if err := pluginengine.Destroy(configFilePath, continueDirectly, isForceDestroy); err != nil {
- log.Errorf("Destroy failed => %s.", err)
- os.Exit(1)
- }
- log.Success("Destroy finished.")
-}
-
-func init() {
- addFlagConfigFile(destroyCMD)
- addFlagPluginDir(destroyCMD)
- addFlagContinueDirectly(destroyCMD)
-
- destroyCMD.Flags().BoolVarP(&isForceDestroy, "force", "", false, "force destroy by config")
-}
diff --git a/cmd/devstream/develop.go b/cmd/devstream/develop.go
deleted file mode 100644
index 95aeaa5be..000000000
--- a/cmd/devstream/develop.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package main
-
-import (
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/develop"
- "github.com/devstream-io/devstream/pkg/util/cli"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var (
- name string
- all bool
-)
-
-var validatePluginFlagNames = []string{
- "name",
- "all",
-}
-
-var developCMD = &cobra.Command{
- Use: "develop",
- Short: "Develop is used for develop a new plugin",
-}
-
-var developCreatePluginCMD = &cobra.Command{
- Use: "create-plugin",
- Short: "Create a new plugin",
- Long: `Create-plugin is used for creating a new plugin.
-Examples:
- dtm develop create-plugin --name=YOUR-PLUGIN-NAME`,
- Run: developCreateCMDFunc,
-}
-
-var developValidatePluginCMD = &cobra.Command{
- Use: "validate-plugin",
- Short: "Validate a plugin",
- Long: `Validate-plugin is used for validating an existing plugin or all plugins.
-Examples:
- dtm develop validate-plugin --name=YOUR-PLUGIN-NAME,
- dtm develop validate-plugin --all`,
- Run: developValidateCMDFunc,
- PreRun: cli.BindPFlags(validatePluginFlagNames),
-}
-
-func developCreateCMDFunc(cmd *cobra.Command, args []string) {
- if err := develop.CreatePlugin(); err != nil {
- log.Fatal(err)
- }
-}
-
-func developValidateCMDFunc(cmd *cobra.Command, args []string) {
- if err := develop.ValidatePlugin(); err != nil {
- log.Fatal(err)
- }
-}
-
-func init() {
- developCMD.AddCommand(developCreatePluginCMD)
- developCMD.AddCommand(developValidatePluginCMD)
-
- developCreatePluginCMD.PersistentFlags().StringVarP(&name, "name", "n", "", "specify name of the plugin to be created")
-
- developValidatePluginCMD.PersistentFlags().StringVarP(&name, "name", "n", "", "specify name of the plugin to be validated")
- developValidatePluginCMD.PersistentFlags().BoolVarP(&all, "all", "a", false, "validate all plugins")
-}
diff --git a/cmd/devstream/init.go b/cmd/devstream/init.go
deleted file mode 100644
index d5a466f43..000000000
--- a/cmd/devstream/init.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package main
-
-import (
- "errors"
- "fmt"
- "runtime"
- "strings"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/cmd/devstream/list"
- "github.com/devstream-io/devstream/internal/pkg/configmanager"
- "github.com/devstream-io/devstream/internal/pkg/pluginmanager"
- "github.com/devstream-io/devstream/internal/pkg/version"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var initCMD = &cobra.Command{
- Use: "init",
- Short: "Download needed plugins according to the config file",
- Long: `Download needed plugins according to the config file`,
- Run: initCMDFunc,
-}
-
-var (
- downloadOnly bool // download plugins only, from command line flags
- downloadAll bool // download all plugins
- pluginsToDownload []string // download specific plugins
- initOS string // download plugins for specific os
- initArch string // download plugins for specific arch
-)
-
-func initCMDFunc(_ *cobra.Command, _ []string) {
- if version.Dev {
- log.Fatalf("Dev version plugins can't be downloaded from the remote plugin repo; please run `make build-plugin.PLUGIN_NAME` to build them locally.")
- }
-
- var (
- tools configmanager.Tools
- err error
- )
-
- if downloadOnly {
- // download plugins from flags
- tools, err = GetPluginsFromFlags()
- } else {
- // download plugins according to the config file
- tools, err = GetPluginsFromConfig()
- }
-
- if err != nil {
- log.Fatal(err)
- }
-
- pluginDir, err = pluginmanager.GetPluginDir()
- if err != nil {
- log.Fatal(err)
- }
- log.Debugf("Plugin directory: %s.", pluginDir)
-
- if err = pluginmanager.DownloadPlugins(tools, pluginDir, initOS, initArch); err != nil {
- log.Fatal(err)
- }
-
- fmt.Println()
- log.Success("Initialize finished.")
-}
-
-func GetPluginsFromConfig() (tools configmanager.Tools, err error) {
- cfg, err := configmanager.NewManager(configFilePath).LoadConfig()
- if err != nil {
- return nil, err
- }
-
- return cfg.Tools, nil
-}
-
-func GetPluginsFromFlags() (tools configmanager.Tools, err error) {
- // 1. get plugins from flags
- var pluginsName []string
- if downloadAll {
- // download all plugins
- pluginsName = list.PluginsNameSlice()
- } else {
- // download specific plugins
- for _, pluginName := range pluginsToDownload {
- if p := strings.ToLower(strings.TrimSpace(pluginName)); p != "" {
- pluginsName = append(pluginsName, p)
- }
- }
- // check if plugins to download are supported by dtm
- for _, plugin := range pluginsName {
- if _, ok := list.PluginNamesMap()[plugin]; !ok {
- return nil, fmt.Errorf("plugin %s is not supported by dtm", plugin)
- }
- }
- }
-
- if len(pluginsName) == 0 {
- return nil, errors.New("please use --plugins to specify plugins to download or use --all to download all plugins")
- }
- log.Debugf("plugins to download: %v", pluginsName)
-
- if initOS == "" || initArch == "" {
- return nil, fmt.Errorf("once you use the --all flag, you must specify the --os and --arch flags")
- }
-
- log.Infof("Plugins to download: %v", pluginsName)
-
- // build the plugin list
- for _, pluginName := range pluginsName {
- tools = append(tools, &configmanager.Tool{Name: pluginName})
- }
-
- return tools, nil
-}
-
-func init() {
- addFlagConfigFile(initCMD)
- addFlagPluginDir(initCMD)
-
- // downloading specific plugins from flags
- initCMD.Flags().BoolVar(&downloadOnly, "download-only", false, "download plugins only")
- initCMD.Flags().StringSliceVarP(&pluginsToDownload, "plugins", "p", []string{}, "the plugins to be downloaded")
- initCMD.Flags().BoolVarP(&downloadAll, "all", "a", false, "download all plugins")
- initCMD.Flags().StringVar(&initOS, "os", runtime.GOOS, "download plugins for specific os")
- initCMD.Flags().StringVar(&initArch, "arch", runtime.GOARCH, "download plugins for specific arch")
-}
diff --git a/cmd/devstream/list.go b/cmd/devstream/list.go
deleted file mode 100644
index ca0b92145..000000000
--- a/cmd/devstream/list.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package main
-
-import (
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/cmd/devstream/list"
-)
-
-var (
- pluginFilter string
-)
-
-var listCMD = &cobra.Command{
- Use: "list",
- Short: "This command only supports listing plugins now",
-}
-
-var listPluginsCMD = &cobra.Command{
- Use: "plugins",
- Short: "List all plugins",
- Long: `This command lists all of the plugins.
-Examples:
- dtm list plugins
- dtm list plugins --filter=argo.*
- dtm list plugins -r ^argo
-`,
- Run: listPluginsCMDFunc,
-}
-
-func listPluginsCMDFunc(_ *cobra.Command, _ []string) {
- list.List(pluginFilter)
-}
-
-// TODO Use `--group=somegroup` to filter the specified groups on feature
-func init() {
- listCMD.AddCommand(listPluginsCMD)
-
- listPluginsCMD.PersistentFlags().StringVarP(&pluginFilter, "filter", "r", "", "filter plugin by regex")
-}
diff --git a/cmd/devstream/list/list.go b/cmd/devstream/list/list.go
deleted file mode 100644
index c75a999c2..000000000
--- a/cmd/devstream/list/list.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package list
-
-import (
- "fmt"
- "regexp"
- "sort"
- "strings"
-)
-
-// list is the version of DevStream.
-// Assign the value when building with the -X parameter. Example:
-// -X github.com/devstream-io/devstream/cmd/devstream/list.PluginsName=${PLUGINS_NAME}
-// See the Makefile for more info.
-
-var PluginsName string
-
-// List all plugins name
-func List(pluginFilter string) {
- r, _ := regexp.Compile(pluginFilter)
- for _, pluginName := range PluginsNameSlice() {
- if r.Match([]byte(pluginName)) {
- fmt.Println(pluginName)
- }
- }
-}
-
-// PluginsNameSlice Gets plugins name in slice
-func PluginsNameSlice() []string {
- listPluginsName := strings.Fields(PluginsName)
- sort.Strings(listPluginsName)
- return listPluginsName
-}
-
-// PluginNamesMap Gets plugins name in map
-func PluginNamesMap() map[string]struct{} {
- mp := make(map[string]struct{})
-
- listPluginsName := strings.Fields(PluginsName)
-
- for _, pluginName := range listPluginsName {
- mp[pluginName] = struct{}{}
- }
-
- return mp
-}
diff --git a/cmd/devstream/main.go b/cmd/devstream/main.go
deleted file mode 100644
index ffea2e158..000000000
--- a/cmd/devstream/main.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package main
-
-import (
- "os"
-
- "github.com/sirupsen/logrus"
- "github.com/spf13/cobra"
- "github.com/spf13/viper"
-
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var (
- isDebug bool
- rootCMD = &cobra.Command{
- Use: "dtm",
- Short: `DevStream is an open-source DevOps toolchain manager`,
- Long: `DevStream is an open-source DevOps toolchain manager
-
-###### #####
-# # ###### # # # # ##### ##### ###### ## # #
-# # # # # # # # # # # # ## ##
-# # ##### # # ##### # # # ##### # # # ## #
-# # # # # # # ##### # ###### # #
-# # # # # # # # # # # # # # #
-###### ###### ## ##### # # # ###### # # # #
-`,
- PersistentPreRun: func(cmd *cobra.Command, args []string) {
- initLog()
- },
- }
-)
-
-func init() {
- cobra.OnInitialize(initConfig)
- rootCMD.PersistentFlags().BoolVarP(&isDebug, "debug", "", false, "debug level log")
- rootCMD.AddCommand(completionCMD(os.Stdout))
- rootCMD.AddCommand(versionCMD)
- rootCMD.AddCommand(initCMD)
- rootCMD.AddCommand(applyCMD)
- rootCMD.AddCommand(deleteCMD)
- rootCMD.AddCommand(destroyCMD)
- rootCMD.AddCommand(verifyCMD)
- rootCMD.AddCommand(developCMD)
- rootCMD.AddCommand(listCMD)
- rootCMD.AddCommand(showCMD)
- rootCMD.AddCommand(upgradeCMD)
-
- rootCMD.AddCommand(startCMD)
- rootCMD.AddCommand(createCMD)
-}
-
-func initConfig() {
- viper.AutomaticEnv()
- if err := viper.BindEnv("github_token"); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindEnv("kubeconfig"); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindEnv("dockerhub_username"); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindEnv("dockerhub_token"); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindEnv("trello_api_key"); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindEnv("trello_token"); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindPFlags(rootCMD.Flags()); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindPFlags(developCreatePluginCMD.Flags()); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindPFlags(developValidatePluginCMD.Flags()); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindPFlags(showConfigCMD.Flags()); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindPFlags(showStatusCMD.Flags()); err != nil {
- log.Fatal(err)
- }
- if err := viper.BindPFlags(initCMD.Flags()); err != nil {
- log.Fatal(err)
- }
-}
-
-func initLog() {
- if isDebug {
- logrus.SetLevel(logrus.DebugLevel)
- log.Infof("Log level is: %s.", logrus.GetLevel())
- } else {
- logrus.SetLevel(logrus.InfoLevel)
- }
-}
-
-func main() {
-
- err := rootCMD.Execute()
- if err != nil {
- os.Exit(1)
- }
-}
diff --git a/cmd/devstream/show.go b/cmd/devstream/show.go
deleted file mode 100644
index 0ef7e4851..000000000
--- a/cmd/devstream/show.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package main
-
-import (
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/completion"
- "github.com/devstream-io/devstream/internal/pkg/show/config"
- "github.com/devstream-io/devstream/internal/pkg/show/status"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var plugin string
-var instanceID string
-var statusAllFlag bool
-var template string
-
-var showCMD = &cobra.Command{
- Use: "show",
- Short: "Show is used to print plugins' configuration templates or status",
-}
-
-var showConfigCMD = &cobra.Command{
- Use: "config",
- Short: "Show configuration information",
- Long: `Show config is used for showing plugins' template configuration information.
-Examples:
- dtm show config --plugin=A-PLUGIN-NAME,
- dtm show config --template=quickstart,
- dtm show config --template=gitops,
- dtm show config --template=apps`,
- Run: showConfigCMDFunc,
-}
-
-var showStatusCMD = &cobra.Command{
- Use: "status",
- Short: "Show status information",
- Long: `Show status is used for showing plugins' status information.
-Examples:
- dtm show status --plugin=A-PLUGIN-NAME --id=A-PLUGIN-INSTANCE-ID
- dtm show status -p=A-PLUGIN-NAME -i=INSTANCE-ID
- dtm show status --all
- dtm show status -a`,
- Run: showStatusCMDFunc,
-}
-
-func showConfigCMDFunc(_ *cobra.Command, _ []string) {
- log.Debug("Show configuration information.")
- if err := config.Show(); err != nil {
- log.Fatal(err)
- }
-}
-
-func showStatusCMDFunc(_ *cobra.Command, _ []string) {
- log.Debug("Show status information.")
- if err := status.Show(configFilePath); err != nil {
- log.Fatal(err)
- }
-}
-
-func init() {
- showCMD.AddCommand(showConfigCMD)
- showCMD.AddCommand(showStatusCMD)
-
- addFlagConfigFile(showConfigCMD)
- addFlagPluginDir(showConfigCMD)
-
- showConfigCMD.Flags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
- showConfigCMD.Flags().StringVarP(&template, "template", "t", "", "print a template config, e.g. quickstart/gitops/...")
- completion.FlagPluginsCompletion(showConfigCMD, "plugin")
-
- showStatusCMD.Flags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
- showStatusCMD.Flags().StringVarP(&instanceID, "id", "i", "", "specify id with the plugin instance")
- showStatusCMD.Flags().BoolVarP(&statusAllFlag, "all", "a", false, "show all instances of all plugins status")
-}
diff --git a/cmd/devstream/start.go b/cmd/devstream/start.go
deleted file mode 100644
index ab2213967..000000000
--- a/cmd/devstream/start.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/start"
-)
-
-var startCMD = &cobra.Command{
- Use: "start",
- Short: "start",
- Long: `start.`,
- Run: startCMDFunc,
-}
-
-func startCMDFunc(_ *cobra.Command, _ []string) {
- err := start.Start()
- if err != nil && err.Error() != "^C" {
- fmt.Printf("Failed with error: %s", err)
- }
-}
diff --git a/cmd/devstream/upgrade.go b/cmd/devstream/upgrade.go
deleted file mode 100644
index 2302ffdd3..000000000
--- a/cmd/devstream/upgrade.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package main
-
-import (
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/upgrade"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var upgradeCMD = &cobra.Command{
- Use: "upgrade",
- Short: "Upgrade dtm to the latest release version",
- Long: `Upgrade dtm to the latest release version.`,
- Run: upgradeCMDFunc,
-}
-
-func upgradeCMDFunc(cmd *cobra.Command, args []string) {
- if err := upgrade.Upgrade(continueDirectly); err != nil {
- log.Fatal(err)
- }
-}
-
-func init() {
- addFlagContinueDirectly(upgradeCMD)
-}
diff --git a/cmd/devstream/verify.go b/cmd/devstream/verify.go
deleted file mode 100644
index e86e67756..000000000
--- a/cmd/devstream/verify.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package main
-
-import (
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/pluginengine"
- "github.com/devstream-io/devstream/pkg/util/log"
-)
-
-var verifyCMD = &cobra.Command{
- Use: "verify",
- Short: "Verify DevOps tools according to DevStream config file and state",
- Long: `Verify DevOps tools according to DevStream config file and state.`,
- Run: verifyCMDFunc,
-}
-
-func verifyCMDFunc(cmd *cobra.Command, args []string) {
- log.Info("Verify started.")
- if pluginengine.Verify(configFilePath) {
- log.Success("Verify succeeded.")
- } else {
- log.Info("Verify finished.")
- }
-}
-
-func init() {
- addFlagConfigFile(verifyCMD)
- addFlagPluginDir(verifyCMD)
-}
diff --git a/cmd/devstream/version.go b/cmd/devstream/version.go
deleted file mode 100644
index ecdaf99c6..000000000
--- a/cmd/devstream/version.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/spf13/cobra"
-
- "github.com/devstream-io/devstream/internal/pkg/version"
-)
-
-var versionCMD = &cobra.Command{
- Use: "version",
- Short: "Print the version number of DevStream",
- Long: `All software has versions. This is DevStream's`,
- Run: versionCMDFunc,
-}
-
-func versionCMDFunc(cmd *cobra.Command, args []string) {
- fmt.Println(version.Version)
-}
diff --git a/cmd/github.go b/cmd/github.go
new file mode 100644
index 000000000..4c1c64d52
--- /dev/null
+++ b/cmd/github.go
@@ -0,0 +1,22 @@
+package cmd
+
+import (
+ "github.com/spf13/cobra"
+
+ "github.com/devstream-io/devstream/internal/pkg/github"
+)
+
+// githubCmd represents the github command
+var githubCmd = &cobra.Command{
+ Use: "github",
+ Short: "github is used to execute github operations",
+ Long: `github is used to execute github operations
+ 参考 gh`,
+ Run: func(cmd *cobra.Command, args []string) {
+ github.Run()
+ },
+}
+
+func init() {
+ rootCmd.AddCommand(githubCmd)
+}
diff --git a/cmd/patch.go b/cmd/patch.go
new file mode 100644
index 000000000..ac11ec684
--- /dev/null
+++ b/cmd/patch.go
@@ -0,0 +1,49 @@
+/*
+Copyright © 2023 NAME HERE