github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/README.md (about)

     1  <!--
     2   Copyright 2018 The CUE Authors
     3  
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7  
     8       http://www.apache.org/licenses/LICENSE-2.0
     9  
    10   Unless required by applicable law or agreed to in writing, software
    11   distributed under the License is distributed on an "AS IS" BASIS,
    12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   See the License for the specific language governing permissions and
    14   limitations under the License.
    15  -->
    16  [![Go Reference](https://pkg.go.dev/badge/github.com/joomcode/cue.svg)](https://pkg.go.dev/github.com/joomcode/cue)
    17  [![Github](https://github.com/cue-lang/cue/workflows/Test/badge.svg)](https://github.com/cue-lang/cue/actions)
    18  [![GolangCI](https://golangci.com/badges/github.com/cue-lang/cue.svg)](https://golangci.com/r/github.com/cue-lang/cue)
    19  [![Go 1.16+](https://img.shields.io/badge/go-1.16-9cf.svg)](https://golang.org/dl/)
    20  [![platforms](https://img.shields.io/badge/platforms-linux|windows|macos-inactive.svg)]()
    21  
    22  # The CUE Data Constraint Language
    23  
    24  _Configure, Unify, Execute_
    25  
    26  CUE is an open source data constraint language which aims
    27  to simplify tasks involving defining and using data.
    28  
    29  It is a superset of JSON,
    30  allowing users familiar with JSON to get started quickly.
    31  
    32  
    33  ### What is it for?
    34  
    35  You can use CUE to
    36  
    37  - define a detailed validation schema for your data (manually or automatically from data)
    38  - reduce boilerplate in your data (manually or automatically from schema)
    39  - extract a schema from code
    40  - generate type definitions and validation code
    41  - merge JSON in a principled way
    42  - define and run declarative scripts
    43  
    44  
    45  ### How?
    46  
    47  CUE merges the notion of schema and data.
    48  The same CUE definition can simultaneously be used for validating data
    49  and act as a template to reduce boilerplate.
    50  Schema definition is enriched with fine-grained value definitions
    51  and default values.
    52  At the same time,
    53  data can be simplified by removing values implied by such detailed definitions.
    54  The merging of these two concepts enables
    55  many tasks to be handled in a principled way.
    56  
    57  
    58  Constraints provide a simple and well-defined, yet powerful, alternative
    59  to inheritance,
    60  a common source of complexity with configuration languages.
    61  
    62  
    63  ### CUE Scripting
    64  
    65  The CUE scripting layer defines declarative scripting, expressed in CUE,
    66  on top of data.
    67  This solves three problems:
    68  working around the closedness of CUE definitions (we say CUE is hermetic),
    69  providing an easy way to share common scripts and workflows for using data,
    70  and giving CUE the knowledge of how data is used to optimize validation.
    71  
    72  There are many tools that interpret data or use a specialized language for
    73  a specific domain (Kustomize, Ksonnet).
    74  This solves dealing with data on one level, but the problem it solves may repeat
    75  itself at a higher level when integrating other systems in a workflow.
    76  CUE scripting is generic and allows users to define any workflow.
    77  
    78  
    79  ### Tooling
    80  
    81  CUE is designed for automation.
    82  Some aspects of this are:
    83  
    84  - convert existing YAML and JSON
    85  - automatically simplify configurations
    86  - rich APIs designed for automated tooling
    87  - formatter
    88  - arbitrary-precision arithmetic
    89  - generate CUE templates from source code
    90  - generate source code from CUE definitions (TODO)
    91  
    92  
    93  ### Download and Install
    94  
    95  #### Release builds
    96  
    97  [Download](https://github.com/cue-lang/cue/releases) the latest release from GitHub.
    98  
    99  #### Install using Homebrew
   100  
   101  Using [Homebrew](https://brew.sh), you can install using the CUE Homebrew tap:
   102  
   103  ```
   104  brew install cue-lang/tap/cue
   105  ```
   106  
   107  #### Install from Source
   108  
   109  <!-- Keep the following in sync with cmd/cue/cmd/testdata/script/install*.txt -->
   110  
   111  If you already have Go 1.16 or later installed, the short version is:
   112  
   113  ```
   114  go install github.com/joomcode/cue/cmd/cue@latest
   115  ```
   116  
   117  This will install the `cue` command line tool.
   118  
   119  For more details see [Installing CUE](./doc/install.md).
   120  
   121  
   122  ### Learning CUE
   123  
   124  The fastest way to learn the basics is to follow the
   125  [tutorial on basic language constructs](./doc/tutorial/basics/Readme.md).
   126  
   127  A more elaborate tutorial demonstrating of how to convert and restructure
   128  an existing set of Kubernetes configurations is available in
   129  [written form](./doc/tutorial/kubernetes/README.md).
   130  
   131  ### References
   132  
   133  - [Language Specification](./doc/ref/spec.md): official CUE Language specification.
   134  
   135  - [API](https://pkg.go.dev/github.com/joomcode/cue/cue): the API on pkg.go.dev
   136  
   137  - [Builtin packages](https://pkg.go.dev/github.com/joomcode/cue/pkg): builtins available from CUE programs
   138  
   139  - [`cue` Command line reference](./doc/cmd/cue.md): the `cue` command
   140  
   141  
   142  ### Contributing
   143  
   144  Our canonical Git repository is located at
   145  https://review.gerrithub.io/q/project:cue-lang%252Fcue.
   146  
   147  To contribute, please read the [Contribution Guide](./doc/contribute.md).
   148  
   149  To report issues or make a feature request, use the
   150  [issue tracker](https://cuelang.org/issues).
   151  
   152  Changes can be contributed using Gerrit or Github pull requests.
   153  
   154  
   155  ## Code of Conduct
   156  
   157  Guidelines for participating in CUE community spaces and a reporting process for
   158  handling issues can be found in the [Code of
   159  Conduct](https://cuelang.org/docs/contribution_guidelines/conduct).
   160  
   161  
   162  ## Contact
   163  
   164  You can get in touch with the cuelang community in the following ways:
   165  
   166  - Ask questions via [GitHub Discussions](https://github.com/cue-lang/cue/discussions)
   167  - Chat with us on our
   168    [Slack workspace](https://join.slack.com/t/cuelang/shared_invite/enQtNzQwODc3NzYzNTA0LTAxNWQwZGU2YWFiOWFiOWQ4MjVjNGQ2ZTNlMmIxODc4MDVjMDg5YmIyOTMyMjQ2MTkzMTU5ZjA1OGE0OGE1NmE).
   169  
   170  ---
   171  
   172  Unless otherwise noted, the CUE source files are distributed
   173  under the Apache 2.0 license found in the LICENSE file.
   174  
   175  This is not an officially supported Google product.
   176