Skip to content

Velocitas create concept

dennismeister93 edited this page Aug 15, 2023 · 29 revisions

Motivation

To create a backbone project and automate template generation on GitHub command velocitas create is going to be introduced.

We are using RFC2119 to define keywords for requirements.
  1. MUST This word, or the terms "REQUIRED" or "SHALL", means that the definition is an absolute requirement of the specification
  2. MUST NOT This phrase, or the phrase "SHALL NOT", means that the definition is an absolute prohibition of the specification.
  3. SHOULD This word, or the adjective "RECOMMENDED", means that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
  4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" means that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.
  5. MAY This word, or the adjective "OPTIONAL", means that an item is truly optional. One vendor may choose to include the item because a particular marketplace requires it or because the vendor feels that it enhances the product while another vendor may omit the same item. An implementation that does not include a particular option MUST be prepared to interoperate with another implementation that does include the option, though perhaps with reduced functionality. In the same vein an implementation that does include a particular option MUST be prepared to interoperate with another implementation that does not include the option (except, of course, for the feature the option provides.)

Requirements

# Description Remarks
1 velocitas create command must be introduced
2 Running velocitas create without parameters must guide through the project creation process (aka Interactive Mode), allowing the developer to add APIs and services at creation time which will reference the correct Velocitas CLI packages (either provided by Velocitas or by a 3rd party).
3 In addition to an Interactive Mode, there must be a CLI mode where all of the arguments shall be passable as arguments.
4 To simplify UX-experience default create behavior may be introduced.
5 Environmental per-conditions:
5.1 velocitas create command must properly work on the DevContainer based on Ubuntu 22.04 and on default GitHub Runner based on Ubuntu 22.04
5.2 velocitas create command should be available locally on Mac, Linux
5.3 velocitas create command may be available locally on Windows (with and w/o corporate proxy)
5.4 GITHUB_API_TOKEN must be provided by a user as environmental variable
6 Other repository changes
6.1 Content of example folder inside vehicle-app-sdk-, where is python or cpp, must provide all necessary artifacts to build up output of create command
6.1.1 example folder must contain launch.json to be reused in creation setup

Creation modes

Parameter Mode

velocitas create [FLAGS...]

Create a project based on a set of parameters.

USAGE
  $ velocitas create [FLAGS...]

FLAGS
  -n, --name=<string>          (mandatory) This value will define the Vehicle App name. The folder will be created with the same name. Name will be re-used in the manifest.
  -l, --language=<option>      (mandatory) Defines Project Language. Currently supported values: cpp, python.
  -s, --source=<url>           (optional) URL to a registry with package/service list. Must contain default value (tbd)
  -p, --package=<option>       (optional) Defines which packages must be installed. If not provided - all packages should be installed. 
                               Multiple occurrences are possible. Based on this packages .velocitas.json will be generated.
  --example=<string>           (optional) Specify an example, based on which user Vehicle Application will be generated.
   

EXAMPLES
$ cd /home/user/
$ velocitas create \
    --name=VApp \
    --language=python \
    --package=runtimes[@version] \
    --package=devcontainer[@version] \
    --

# Project Created.

$ ls
# VApp //folder with default content must be created.

Config Mode

USAGE
  $ velocitas create [FLAGS...]

FLAGS
  --config=create-config.json

create-config.json

{
  // (mandatory) This value will define the Vehicle App name. 
  // The folder will be created with the same name. 
  // Name will be re-used in the manifest.
  "name": "VApp",
  // (mandatory) Defines Project Language. Currently supported values: 
  // cpp, python.
  "language": "python/sdk",
  // (optional) URL to a registry with package/service list. 
  // Must contain default value (tbd)
  "source": "url",
  // (optional) Specify an example, based on which user Vehicle Application will be generated. 
  "example": "SeatAdjuster",
  // (optional) Defines which packages must be installed. 
  // If not provided - all packages should be installed. 
  // Multiple occurrences are possible. Based on this 
  // packages .velocitas.json will be generated.
  "packages":
    [
       "devenv-devcontainer-setup@latest",
       "devenv-github-templates@latest",
       "devenv-github-workflows@latest",
       "devenv-runtimes@latest"
    ]
}

!!! Only one mode can be selected either Config or Parameter one.

Interactive Mode

If velocitas create is invoked without any parameters, the Interactive Mode shall play a role.

$ velocitas create
... Creating a new Velocitas project!
> 1. What is the name of your project?
MyVehicleApp

> 2. Which programming language would you like to use for your project?
[x] Python
[ ] C++

## If GITHUB_API_TOKEN is not found in environmental variables...

> 3. Please paste your GITHUB_API_TOKEN to be able to fetch additional data.
GithubAPITokenValue (pasted, entered)

## Fetch possible packages.
> 4. Which package would you like to use? (multiple selections are possible)
[x] devenv-devcontainer-setup@latest
[x] devenv-github-templates@latest
[x] devenv-github-workflows@latest
[x] devenv-runtimes@latest

> 5. Which example would you like to use? (only a single selection is possible)
[x] SeatAdjuster
[ ] DogMode
[ ] WiperApp

... Project created!

Default Mode

see #config-mode

Clone this wiki locally