quality-graph-cli 0.1.4__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: quality-graph-cli
3
+ Version: 0.1.7
4
+ Summary: Provider-driven Quality Graph command-line application
5
+ Project-URL: Homepage, https://alchemmist.github.io/quality-graph/
6
+ Project-URL: Documentation, https://alchemmist.github.io/quality-graph/
7
+ License-Expression: MIT
8
+ Requires-Python: >=3.12
9
+ Requires-Dist: quality-graph-core==0.1.7
10
+ Description-Content-Type: text/markdown
11
+
12
+ # qg
13
+
14
+ Provider-driven command-line application for Quality Graph projects.
15
+
16
+ The CLI discovers providers through the `qg.providers` entry-point group. Install it together
17
+ with the GitHub provider using
18
+ `uv tool install quality-graph-cli==0.1.2 --with quality-graph-github==0.1.2`.
19
+
20
+ Initialize a repository with its default branch, generate the provider-owned files, and list
21
+ those paths for repository tooling:
22
+
23
+ ```bash
24
+ qg init \
25
+ --default-branch main \
26
+ --runtime-action alchemmist/quality-graph@<release-commit-sha>
27
+ qg generate
28
+ qg generated-files
29
+ qg validate
30
+ ```
31
+
32
+ The graph declaration can select the generated workflow projections per node:
33
+
34
+ ```yaml
35
+ nodes:
36
+ lint:
37
+ events: [pull-request, push]
38
+ run: make lint
39
+ diff-check:
40
+ events: [pull-request]
41
+ run: make diff-check
42
+ ```
43
+
44
+ Nodes without `events` run for both supported events. See the
45
+ [configuration reference](../../docs/configuration.md) for dependency projection rules.
@@ -0,0 +1,34 @@
1
+ # qg
2
+
3
+ Provider-driven command-line application for Quality Graph projects.
4
+
5
+ The CLI discovers providers through the `qg.providers` entry-point group. Install it together
6
+ with the GitHub provider using
7
+ `uv tool install quality-graph-cli==0.1.2 --with quality-graph-github==0.1.2`.
8
+
9
+ Initialize a repository with its default branch, generate the provider-owned files, and list
10
+ those paths for repository tooling:
11
+
12
+ ```bash
13
+ qg init \
14
+ --default-branch main \
15
+ --runtime-action alchemmist/quality-graph@<release-commit-sha>
16
+ qg generate
17
+ qg generated-files
18
+ qg validate
19
+ ```
20
+
21
+ The graph declaration can select the generated workflow projections per node:
22
+
23
+ ```yaml
24
+ nodes:
25
+ lint:
26
+ events: [pull-request, push]
27
+ run: make lint
28
+ diff-check:
29
+ events: [pull-request]
30
+ run: make diff-check
31
+ ```
32
+
33
+ Nodes without `events` run for both supported events. See the
34
+ [configuration reference](../../docs/configuration.md) for dependency projection rules.
@@ -4,12 +4,16 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "quality-graph-cli"
7
- version = "0.1.4"
7
+ version = "0.1.7"
8
8
  description = "Provider-driven Quality Graph command-line application"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
11
11
  license = "MIT"
12
- dependencies = ["quality-graph-core==0.1.4"]
12
+ dependencies = ["quality-graph-core==0.1.7"]
13
+
14
+ [project.urls]
15
+ Homepage = "https://alchemmist.github.io/quality-graph/"
16
+ Documentation = "https://alchemmist.github.io/quality-graph/"
13
17
 
14
18
  [project.scripts]
15
19
  qg = "qg_cli.cli:main"
@@ -24,6 +24,7 @@ def parser() -> argparse.ArgumentParser:
24
24
  initialize = commands.add_parser("init", help="Create a starter Quality Graph declaration")
25
25
  initialize.add_argument("--root", default=".")
26
26
  initialize.add_argument("--runtime-action", required=True)
27
+ initialize.add_argument("--default-branch", default="main")
27
28
  initialize.add_argument("--preset", choices=("oss", "internal"), default="oss")
28
29
  initialize.add_argument("--force", action="store_true")
29
30
  generate = commands.add_parser("generate", help="Generate committed GitHub workflows")
@@ -79,6 +80,7 @@ def _project_command(args: argparse.Namespace) -> int:
79
80
  Project.initialize(
80
81
  Path(args.root),
81
82
  args.runtime_action,
83
+ default_branch=args.default_branch,
82
84
  preset=args.preset,
83
85
  force=args.force,
84
86
  )
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import json
5
6
  from dataclasses import dataclass
6
7
  from pathlib import Path, PurePosixPath
7
8
  from typing import TYPE_CHECKING, Literal, Self
@@ -117,6 +118,7 @@ class Project:
117
118
  root: Path,
118
119
  runtime_action: str,
119
120
  *,
121
+ default_branch: str = "main",
120
122
  preset: Literal["oss", "internal"] = "oss",
121
123
  force: bool = False,
122
124
  ) -> Self:
@@ -126,17 +128,25 @@ class Project:
126
128
  message = f"Refusing to replace existing declaration: {configuration}"
127
129
  raise FileExistsError(message)
128
130
  provider = load_provider("github")
131
+ source = _starter_configuration(runtime_action, default_branch, preset)
132
+ graph = Graph.from_yaml(source)
133
+ provider.generate(graph)
129
134
  root.mkdir(parents=True, exist_ok=True)
130
- configuration.write_text(_starter_configuration(runtime_action, preset))
131
- return cls(root, Graph.from_yaml(configuration.read_text()), provider)
135
+ configuration.write_text(source)
136
+ return cls(root, graph, provider)
132
137
 
133
138
 
134
- def _starter_configuration(runtime_action: str, preset: Literal["oss", "internal"]) -> str:
139
+ def _starter_configuration(
140
+ runtime_action: str,
141
+ default_branch: str,
142
+ preset: Literal["oss", "internal"],
143
+ ) -> str:
135
144
  runner = "ubuntu-latest" if preset == "oss" else "self-hosted"
136
145
  return f"""version: 0
137
146
  provider:
138
147
  name: github
139
148
  configuration:
149
+ default-branch: {json.dumps(default_branch)}
140
150
  runtime:
141
151
  action: {runtime_action}
142
152
 
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: quality-graph-cli
3
- Version: 0.1.4
4
- Summary: Provider-driven Quality Graph command-line application
5
- License-Expression: MIT
6
- Requires-Python: >=3.12
7
- Requires-Dist: quality-graph-core==0.1.4
8
- Description-Content-Type: text/markdown
9
-
10
- # qg
11
-
12
- Provider-driven command-line application for Quality Graph projects.
13
-
14
- The CLI discovers providers through the `qg.providers` entry-point group. Install it together
15
- with the GitHub provider using
16
- `uv tool install quality-graph-cli==0.1.2 --with quality-graph-github==0.1.2`.
@@ -1,7 +0,0 @@
1
- # qg
2
-
3
- Provider-driven command-line application for Quality Graph projects.
4
-
5
- The CLI discovers providers through the `qg.providers` entry-point group. Install it together
6
- with the GitHub provider using
7
- `uv tool install quality-graph-cli==0.1.2 --with quality-graph-github==0.1.2`.