archelps 0.1.1__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.
- archelps-0.1.1/LICENSE +21 -0
- archelps-0.1.1/MANIFEST.in +3 -0
- archelps-0.1.1/PKG-INFO +224 -0
- archelps-0.1.1/README.md +200 -0
- archelps-0.1.1/__init__.py +3 -0
- archelps-0.1.1/__main__.py +3 -0
- archelps-0.1.1/archelps.egg-info/PKG-INFO +224 -0
- archelps-0.1.1/archelps.egg-info/SOURCES.txt +44 -0
- archelps-0.1.1/archelps.egg-info/dependency_links.txt +1 -0
- archelps-0.1.1/archelps.egg-info/entry_points.txt +2 -0
- archelps-0.1.1/archelps.egg-info/requires.txt +6 -0
- archelps-0.1.1/archelps.egg-info/top_level.txt +1 -0
- archelps-0.1.1/cli.py +148 -0
- archelps-0.1.1/config.py +180 -0
- archelps-0.1.1/contract.py +125 -0
- archelps-0.1.1/data.schema.json +104 -0
- archelps-0.1.1/oauth.py +472 -0
- archelps-0.1.1/onboarding.py +620 -0
- archelps-0.1.1/pyproject.toml +47 -0
- archelps-0.1.1/scanner.py +212 -0
- archelps-0.1.1/setup.cfg +4 -0
- archelps-0.1.1/tests/conftest.py +55 -0
- archelps-0.1.1/tests/test_cli.py +86 -0
- archelps-0.1.1/tests/test_contract.py +155 -0
- archelps-0.1.1/tests/test_oauth.py +349 -0
- archelps-0.1.1/tests/test_scanner.py +259 -0
- archelps-0.1.1/tests/test_setup.py +389 -0
- archelps-0.1.1/tests/test_tls.py +247 -0
- archelps-0.1.1/tests/test_upload.py +353 -0
- archelps-0.1.1/tests/tls/ca.pem +10 -0
- archelps-0.1.1/tests/tls/localhost-key.pem +5 -0
- archelps-0.1.1/tests/tls/localhost.pem +10 -0
- archelps-0.1.1/tests/tls/other-ca.pem +10 -0
- archelps-0.1.1/upload.py +153 -0
archelps-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
archelps-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: archelps
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Arc CLI: connect Git repositories to Arc Items using literal source markers
|
|
5
|
+
Author: Arc
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://archelps.com
|
|
8
|
+
Project-URL: Documentation, https://app.archelps.com/api-guide
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: click<9,>=8.1
|
|
19
|
+
Requires-Dist: certifi>=2026.6.17
|
|
20
|
+
Provides-Extra: test
|
|
21
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
22
|
+
Requires-Dist: jsonschema>=4; extra == "test"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Arc CLI
|
|
26
|
+
|
|
27
|
+
Arc CLI's Connect commands record literal Arc Item markers in Git and upload file/line
|
|
28
|
+
locations to Arc. It uses Python 3.11 or later and Click, with plain terminal prompts. The
|
|
29
|
+
standalone package is MIT licensed; Arc's application/backend licence is unchanged.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
python -m pip install --upgrade archelps
|
|
33
|
+
arc connect init
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Setup and generated CI use the latest published package without a version
|
|
37
|
+
constraint. `--upgrade` also updates an existing installation.
|
|
38
|
+
|
|
39
|
+
The executable is `arc`. Connect groups the existing Git workflow under
|
|
40
|
+
`arc connect init`, `arc connect scan` and `arc connect upload`; `arc logout`
|
|
41
|
+
clears the saved sign-in. Setup handles browser sign-in. There is no separate
|
|
42
|
+
login command or general API command group.
|
|
43
|
+
|
|
44
|
+
Run setup in an interactive terminal inside a GitHub.com or GitLab.com repository.
|
|
45
|
+
Self-hosted GitLab is not currently supported.
|
|
46
|
+
Sign in through Cognito in the browser, then return to the terminal. Choose one
|
|
47
|
+
Organization and one or more Programs by name or number; confirm each Program's
|
|
48
|
+
repository-specific marker label immediately after selection. Existing registered
|
|
49
|
+
labels are frozen and reused. Confirm the repository/default branch, then choose
|
|
50
|
+
GitHub Actions, GitLab CI or other CI independently of the repository host. Declining
|
|
51
|
+
repository confirmation cancels setup; rerun with `--repository-url` and
|
|
52
|
+
`--default-branch` to correct it.
|
|
53
|
+
|
|
54
|
+
Setup writes secrets-free `.arc/config.json` with `schema_version`, `api_url`,
|
|
55
|
+
`organization_id`, `git`, `ci`, `programs` and `marker_instructions`. `git` contains
|
|
56
|
+
provider, canonical repository URL and default branch. Each Program entry contains
|
|
57
|
+
`program_id`, frozen `label`, `source_id` and `token_env` (`ARC_TOKEN_<LABEL>`).
|
|
58
|
+
Custom setup configuration paths must stay inside the repository for CI. Commit
|
|
59
|
+
the configuration and generated CI file, including the config if Git ignore rules
|
|
60
|
+
exclude it. Setup creates no hooks, tracked mapping/data file or customer README.
|
|
61
|
+
|
|
62
|
+
## Credentials and recovery
|
|
63
|
+
|
|
64
|
+
Setup automatically creates one personal write token per Program/source through
|
|
65
|
+
the OAuth-only `POST /programs/{program_id}/code-links/sources/{source_id}/token`
|
|
66
|
+
route. Source setup requires `program.manage`; token issuance also requires
|
|
67
|
+
`program.edit` and the normal personal-token membership/MFA rules. Write mode does
|
|
68
|
+
not grant Program permissions. Uploads recheck current authority.
|
|
69
|
+
|
|
70
|
+
Returned secrets are saved outside the repository in a private
|
|
71
|
+
`~/.arc-connect/ci-<hash>.json`, partitioned by checkout, API target and signed-in
|
|
72
|
+
account. The CLI prints only that path and CI secret names. Read the private file
|
|
73
|
+
and paste each value into its named CI secret or masked/protected variable, such
|
|
74
|
+
as `ARC_TOKEN_BRAKES`. Upload reads these environment variables; it does not read
|
|
75
|
+
the private handoff file.
|
|
76
|
+
|
|
77
|
+
Repeated init reuses saved settings and local credentials. A secrets-free draft
|
|
78
|
+
under Git's private metadata preserves selected Programs/labels during interrupted
|
|
79
|
+
registration. Configuration is saved before token issuance/CI generation. If an
|
|
80
|
+
existing server token has no local copy, setup requires an explicit replacement
|
|
81
|
+
choice; declining preserves it. `arc connect init --replace-tokens` deliberately
|
|
82
|
+
revokes and replaces only the current user's configured source tokens. Update CI
|
|
83
|
+
secrets afterward. No setup mutation is automatically retried after an uncertain
|
|
84
|
+
response.
|
|
85
|
+
|
|
86
|
+
Use `arc connect init --reconfigure` to choose Organization, Programs, repository
|
|
87
|
+
or CI again. An explicit API target conflicting with saved setup fails before
|
|
88
|
+
authentication unless reconfiguration is requested. Repeating init reconnects a
|
|
89
|
+
removed source through the existing source service. Superseded hooks/root files
|
|
90
|
+
have no compatibility path and are not deleted automatically.
|
|
91
|
+
|
|
92
|
+
Cognito credentials are cached separately at `~/.arc-connect/tokens.json`, with
|
|
93
|
+
private permissions, PKCE S256, state validation and domain/client/resource/scope
|
|
94
|
+
binding. Redirects do not receive bearer credentials. An expired refresh credential
|
|
95
|
+
reopens sign-in. `arc logout` clears a corrupt cache or revokes the cached
|
|
96
|
+
refresh token and removes the cache; it warns when revocation cannot be confirmed.
|
|
97
|
+
Issued access tokens can remain valid for up to 15 minutes. Personal CI tokens
|
|
98
|
+
remain separately managed.
|
|
99
|
+
|
|
100
|
+
HTTPS uses Python's default trusted certificates plus certifi's bundled roots.
|
|
101
|
+
An explicit `SSL_CERT_FILE` or `SSL_CERT_DIR` selects only that configured trust
|
|
102
|
+
store. Certificate errors retain saved credentials and stop with a clear error;
|
|
103
|
+
they do not reopen sign-in or retry uploads. Certificate and hostname checks stay enabled.
|
|
104
|
+
|
|
105
|
+
Production defaults are API transport `https://api.archelps.com/api/v1/public`,
|
|
106
|
+
Cognito domain `https://arc5-production.auth.eu-west-2.amazoncognito.com`, public
|
|
107
|
+
API client `3foiu1p2hb5nm09dc95g5c4m0j`, and audience/scope resource
|
|
108
|
+
`https://arc5-api.onrender.com/api/v1/public`. Transport and audience are distinct.
|
|
109
|
+
Use `--api-url`, `--cognito-domain`, `--client-id`, `--resource` and `--cache` for
|
|
110
|
+
another environment. `ARC_API_URL`, `ARC_COGNITO_DOMAIN`, `COGNITO_API_CLIENT_IDS`
|
|
111
|
+
and `ARC_API_RESOURCE` are also supported. Custom OAuth cache paths must remain
|
|
112
|
+
outside Git; the CI handoff is saved beside that cache.
|
|
113
|
+
|
|
114
|
+
## Literal markers and scanning
|
|
115
|
+
|
|
116
|
+
Copy the real marker from an Arc Item and place it near associated code or tests:
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
# ARC-BRAKES-REQ-001
|
|
120
|
+
def stop():
|
|
121
|
+
...
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The syntax is `ARC-<PROGRAM_LABEL>-<ITEM_IDENTIFIER>`. Labels use uppercase ASCII
|
|
125
|
+
letters, digits and underscores, start with a letter and have at most 32 characters.
|
|
126
|
+
Canonical Item prefixes are `SYS`, `REQ`, `PROP`, `TST`, `TPL` and `RSK`, followed
|
|
127
|
+
by at least three digits. Leading zeros and the literal marker are preserved;
|
|
128
|
+
several markers can share a line. Unicode word characters and hyphens prevent
|
|
129
|
+
matches embedded in longer identifiers. Never invent identifiers or substitute
|
|
130
|
+
import identifiers. Coding agents can read `.arc/config.json` for configured labels
|
|
131
|
+
and marker guidance. A code link is not proof that an Item's obligation is met.
|
|
132
|
+
|
|
133
|
+
`arc connect scan` prints deterministic schema `1.0.0` JSON from one exact `HEAD` commit
|
|
134
|
+
without writing files or changing the index. Sequential Git search scans tracked
|
|
135
|
+
regular text; binary/LFS/submodule/symlink payloads, `.arc/` and a custom config
|
|
136
|
+
path are excluded. There is no AI, language parser, concurrency or incremental
|
|
137
|
+
cache. Git failures never produce successful empty reports. `--repo` selects a
|
|
138
|
+
checkout and `--config` a secrets-free configuration path relative to its Git root;
|
|
139
|
+
Connect's common options are accepted before or after its `init`, `scan` or
|
|
140
|
+
`upload` subcommand.
|
|
141
|
+
|
|
142
|
+
## CI reports
|
|
143
|
+
|
|
144
|
+
GitHub Actions generates `.github/workflows/arc.yml`: a separate default-branch
|
|
145
|
+
push workflow that checks out the exact event SHA, installs the latest published
|
|
146
|
+
package and runs `arc connect upload` with `continue-on-error: true`.
|
|
147
|
+
|
|
148
|
+
GitHub, GitLab and other-CI instructions all install with
|
|
149
|
+
`python -m pip install --upgrade archelps`, without a version constraint.
|
|
150
|
+
|
|
151
|
+
GitLab CI generates `.arc/gitlab-ci.yml`; append the printed include to your
|
|
152
|
+
existing `.gitlab-ci.yml`, merging with existing includes:
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
include:
|
|
156
|
+
- local: '/.arc/gitlab-ci.yml'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Select GitLab CI during setup, or run `arc connect init --ci gitlab`. In the
|
|
160
|
+
GitLab project, open **Settings → CI/CD → Variables** and add each named
|
|
161
|
+
`ARC_TOKEN_<LABEL>` from the private handoff file as a masked variable. Use
|
|
162
|
+
protected variables only when the configured default branch is protected.
|
|
163
|
+
Commit `.arc/config.json`, `.arc/gitlab-ci.yml`, the include and your Item markers,
|
|
164
|
+
then push to that branch. A runner must be available. Check the `arc` job's upload
|
|
165
|
+
output, then Arc's **Last sync** and the Item's **Code links**; the job allows
|
|
166
|
+
failure, so a successful overall pipeline does not prove the upload succeeded.
|
|
167
|
+
|
|
168
|
+
Its job uses default-branch push rules with `when: always`, stage `.post` and
|
|
169
|
+
`allow_failure: true`, so earlier job failures do not skip it. Global workflow
|
|
170
|
+
rules must still allow that pipeline to be created. Existing customer files and
|
|
171
|
+
symlinks are preserved; setup prints generated content for manual insertion when
|
|
172
|
+
needed and never rewrites the customer's GitLab pipeline. Changing CI removes only
|
|
173
|
+
Arc-generated files for the other CI choice and prints a reminder to remove an
|
|
174
|
+
obsolete GitLab include.
|
|
175
|
+
|
|
176
|
+
Other CI receives exact-checkout, secret and nonblocking-step instructions. After
|
|
177
|
+
checking out the exact event commit, pass the commit and branch together for a
|
|
178
|
+
detached checkout, using your CI's actual event variables:
|
|
179
|
+
|
|
180
|
+
```sh
|
|
181
|
+
arc connect upload --commit-sha "$YOUR_CI_COMMIT_SHA" --branch "$YOUR_CI_BRANCH"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Configure the step to allow failure. GitHub/GitLab events are checked automatically;
|
|
185
|
+
a mismatched checkout fails before sending and other branches skip. Keep CI token
|
|
186
|
+
names from `.arc/config.json` and do not expose tokens to pull-request pipelines.
|
|
187
|
+
|
|
188
|
+
Upload scans one pinned commit and generates JSON in memory. One complete data
|
|
189
|
+
format, `schema_version: "1.0.0"`, contains the full `commit_sha`, `scanner_version`
|
|
190
|
+
and `git` repository identity with Program UUID/label marker locations. Each
|
|
191
|
+
Program is sent separately through its own token to
|
|
192
|
+
`POST /api/v1/public/programs/{program_id}/code-links/sources/{source_id}/reports`.
|
|
193
|
+
Reports are bounded to 32 MiB and 500,000 locations. Network, 429 and 5xx failures
|
|
194
|
+
use at most three total attempts with identical bodies; other API failures do not
|
|
195
|
+
retry. Missing/failed tokens do not prevent remaining Program uploads; the direct
|
|
196
|
+
command returns nonzero if any fail while generated CI remains nonblocking.
|
|
197
|
+
|
|
198
|
+
`data.schema.json` describes both scan output and uploads; there is no nested report
|
|
199
|
+
wrapper. Scan output can contain all configured Programs; each upload contains
|
|
200
|
+
exactly one Program matching its token and route. Config's independent
|
|
201
|
+
`schema_version` remains integer `1`, and the CLI package version is `0.1.1`.
|
|
202
|
+
Future data-schema releases must deploy server acceptance before publishing a CLI
|
|
203
|
+
that sends the new format. The current data schema remains `1.0.0`; no compatibility
|
|
204
|
+
implementation is added by this release policy.
|
|
205
|
+
No source text or secrets are uploaded. Arc retains five report bodies
|
|
206
|
+
and resolved projections, with older deduplication receipts. Invalid/failed reports
|
|
207
|
+
preserve current links; complete empty reports clear them. Duplicate retries never
|
|
208
|
+
promote old reports. Removal hides links and disables uploads; identical source
|
|
209
|
+
reconnection restores the retained current report. These links do not create Item
|
|
210
|
+
revisions or appear in historic model views.
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
```sh
|
|
215
|
+
python -m pip install '.[test]'
|
|
216
|
+
# Run only tests created or edited for the current change; for example:
|
|
217
|
+
python -m pytest --confcutdir=. tests/test_setup.py::test_noninteractive_init_does_not_open_browser
|
|
218
|
+
python -m build
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The standalone `archelps` package root maps the existing `arc_connect` Python
|
|
222
|
+
module to this directory and does not package the Arc backend or its dependencies.
|
|
223
|
+
Click and certifi are the runtime dependencies. The internal module name and private
|
|
224
|
+
`~/.arc-connect` credential location are unchanged.
|
archelps-0.1.1/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Arc CLI
|
|
2
|
+
|
|
3
|
+
Arc CLI's Connect commands record literal Arc Item markers in Git and upload file/line
|
|
4
|
+
locations to Arc. It uses Python 3.11 or later and Click, with plain terminal prompts. The
|
|
5
|
+
standalone package is MIT licensed; Arc's application/backend licence is unchanged.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
python -m pip install --upgrade archelps
|
|
9
|
+
arc connect init
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Setup and generated CI use the latest published package without a version
|
|
13
|
+
constraint. `--upgrade` also updates an existing installation.
|
|
14
|
+
|
|
15
|
+
The executable is `arc`. Connect groups the existing Git workflow under
|
|
16
|
+
`arc connect init`, `arc connect scan` and `arc connect upload`; `arc logout`
|
|
17
|
+
clears the saved sign-in. Setup handles browser sign-in. There is no separate
|
|
18
|
+
login command or general API command group.
|
|
19
|
+
|
|
20
|
+
Run setup in an interactive terminal inside a GitHub.com or GitLab.com repository.
|
|
21
|
+
Self-hosted GitLab is not currently supported.
|
|
22
|
+
Sign in through Cognito in the browser, then return to the terminal. Choose one
|
|
23
|
+
Organization and one or more Programs by name or number; confirm each Program's
|
|
24
|
+
repository-specific marker label immediately after selection. Existing registered
|
|
25
|
+
labels are frozen and reused. Confirm the repository/default branch, then choose
|
|
26
|
+
GitHub Actions, GitLab CI or other CI independently of the repository host. Declining
|
|
27
|
+
repository confirmation cancels setup; rerun with `--repository-url` and
|
|
28
|
+
`--default-branch` to correct it.
|
|
29
|
+
|
|
30
|
+
Setup writes secrets-free `.arc/config.json` with `schema_version`, `api_url`,
|
|
31
|
+
`organization_id`, `git`, `ci`, `programs` and `marker_instructions`. `git` contains
|
|
32
|
+
provider, canonical repository URL and default branch. Each Program entry contains
|
|
33
|
+
`program_id`, frozen `label`, `source_id` and `token_env` (`ARC_TOKEN_<LABEL>`).
|
|
34
|
+
Custom setup configuration paths must stay inside the repository for CI. Commit
|
|
35
|
+
the configuration and generated CI file, including the config if Git ignore rules
|
|
36
|
+
exclude it. Setup creates no hooks, tracked mapping/data file or customer README.
|
|
37
|
+
|
|
38
|
+
## Credentials and recovery
|
|
39
|
+
|
|
40
|
+
Setup automatically creates one personal write token per Program/source through
|
|
41
|
+
the OAuth-only `POST /programs/{program_id}/code-links/sources/{source_id}/token`
|
|
42
|
+
route. Source setup requires `program.manage`; token issuance also requires
|
|
43
|
+
`program.edit` and the normal personal-token membership/MFA rules. Write mode does
|
|
44
|
+
not grant Program permissions. Uploads recheck current authority.
|
|
45
|
+
|
|
46
|
+
Returned secrets are saved outside the repository in a private
|
|
47
|
+
`~/.arc-connect/ci-<hash>.json`, partitioned by checkout, API target and signed-in
|
|
48
|
+
account. The CLI prints only that path and CI secret names. Read the private file
|
|
49
|
+
and paste each value into its named CI secret or masked/protected variable, such
|
|
50
|
+
as `ARC_TOKEN_BRAKES`. Upload reads these environment variables; it does not read
|
|
51
|
+
the private handoff file.
|
|
52
|
+
|
|
53
|
+
Repeated init reuses saved settings and local credentials. A secrets-free draft
|
|
54
|
+
under Git's private metadata preserves selected Programs/labels during interrupted
|
|
55
|
+
registration. Configuration is saved before token issuance/CI generation. If an
|
|
56
|
+
existing server token has no local copy, setup requires an explicit replacement
|
|
57
|
+
choice; declining preserves it. `arc connect init --replace-tokens` deliberately
|
|
58
|
+
revokes and replaces only the current user's configured source tokens. Update CI
|
|
59
|
+
secrets afterward. No setup mutation is automatically retried after an uncertain
|
|
60
|
+
response.
|
|
61
|
+
|
|
62
|
+
Use `arc connect init --reconfigure` to choose Organization, Programs, repository
|
|
63
|
+
or CI again. An explicit API target conflicting with saved setup fails before
|
|
64
|
+
authentication unless reconfiguration is requested. Repeating init reconnects a
|
|
65
|
+
removed source through the existing source service. Superseded hooks/root files
|
|
66
|
+
have no compatibility path and are not deleted automatically.
|
|
67
|
+
|
|
68
|
+
Cognito credentials are cached separately at `~/.arc-connect/tokens.json`, with
|
|
69
|
+
private permissions, PKCE S256, state validation and domain/client/resource/scope
|
|
70
|
+
binding. Redirects do not receive bearer credentials. An expired refresh credential
|
|
71
|
+
reopens sign-in. `arc logout` clears a corrupt cache or revokes the cached
|
|
72
|
+
refresh token and removes the cache; it warns when revocation cannot be confirmed.
|
|
73
|
+
Issued access tokens can remain valid for up to 15 minutes. Personal CI tokens
|
|
74
|
+
remain separately managed.
|
|
75
|
+
|
|
76
|
+
HTTPS uses Python's default trusted certificates plus certifi's bundled roots.
|
|
77
|
+
An explicit `SSL_CERT_FILE` or `SSL_CERT_DIR` selects only that configured trust
|
|
78
|
+
store. Certificate errors retain saved credentials and stop with a clear error;
|
|
79
|
+
they do not reopen sign-in or retry uploads. Certificate and hostname checks stay enabled.
|
|
80
|
+
|
|
81
|
+
Production defaults are API transport `https://api.archelps.com/api/v1/public`,
|
|
82
|
+
Cognito domain `https://arc5-production.auth.eu-west-2.amazoncognito.com`, public
|
|
83
|
+
API client `3foiu1p2hb5nm09dc95g5c4m0j`, and audience/scope resource
|
|
84
|
+
`https://arc5-api.onrender.com/api/v1/public`. Transport and audience are distinct.
|
|
85
|
+
Use `--api-url`, `--cognito-domain`, `--client-id`, `--resource` and `--cache` for
|
|
86
|
+
another environment. `ARC_API_URL`, `ARC_COGNITO_DOMAIN`, `COGNITO_API_CLIENT_IDS`
|
|
87
|
+
and `ARC_API_RESOURCE` are also supported. Custom OAuth cache paths must remain
|
|
88
|
+
outside Git; the CI handoff is saved beside that cache.
|
|
89
|
+
|
|
90
|
+
## Literal markers and scanning
|
|
91
|
+
|
|
92
|
+
Copy the real marker from an Arc Item and place it near associated code or tests:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# ARC-BRAKES-REQ-001
|
|
96
|
+
def stop():
|
|
97
|
+
...
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The syntax is `ARC-<PROGRAM_LABEL>-<ITEM_IDENTIFIER>`. Labels use uppercase ASCII
|
|
101
|
+
letters, digits and underscores, start with a letter and have at most 32 characters.
|
|
102
|
+
Canonical Item prefixes are `SYS`, `REQ`, `PROP`, `TST`, `TPL` and `RSK`, followed
|
|
103
|
+
by at least three digits. Leading zeros and the literal marker are preserved;
|
|
104
|
+
several markers can share a line. Unicode word characters and hyphens prevent
|
|
105
|
+
matches embedded in longer identifiers. Never invent identifiers or substitute
|
|
106
|
+
import identifiers. Coding agents can read `.arc/config.json` for configured labels
|
|
107
|
+
and marker guidance. A code link is not proof that an Item's obligation is met.
|
|
108
|
+
|
|
109
|
+
`arc connect scan` prints deterministic schema `1.0.0` JSON from one exact `HEAD` commit
|
|
110
|
+
without writing files or changing the index. Sequential Git search scans tracked
|
|
111
|
+
regular text; binary/LFS/submodule/symlink payloads, `.arc/` and a custom config
|
|
112
|
+
path are excluded. There is no AI, language parser, concurrency or incremental
|
|
113
|
+
cache. Git failures never produce successful empty reports. `--repo` selects a
|
|
114
|
+
checkout and `--config` a secrets-free configuration path relative to its Git root;
|
|
115
|
+
Connect's common options are accepted before or after its `init`, `scan` or
|
|
116
|
+
`upload` subcommand.
|
|
117
|
+
|
|
118
|
+
## CI reports
|
|
119
|
+
|
|
120
|
+
GitHub Actions generates `.github/workflows/arc.yml`: a separate default-branch
|
|
121
|
+
push workflow that checks out the exact event SHA, installs the latest published
|
|
122
|
+
package and runs `arc connect upload` with `continue-on-error: true`.
|
|
123
|
+
|
|
124
|
+
GitHub, GitLab and other-CI instructions all install with
|
|
125
|
+
`python -m pip install --upgrade archelps`, without a version constraint.
|
|
126
|
+
|
|
127
|
+
GitLab CI generates `.arc/gitlab-ci.yml`; append the printed include to your
|
|
128
|
+
existing `.gitlab-ci.yml`, merging with existing includes:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
include:
|
|
132
|
+
- local: '/.arc/gitlab-ci.yml'
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Select GitLab CI during setup, or run `arc connect init --ci gitlab`. In the
|
|
136
|
+
GitLab project, open **Settings → CI/CD → Variables** and add each named
|
|
137
|
+
`ARC_TOKEN_<LABEL>` from the private handoff file as a masked variable. Use
|
|
138
|
+
protected variables only when the configured default branch is protected.
|
|
139
|
+
Commit `.arc/config.json`, `.arc/gitlab-ci.yml`, the include and your Item markers,
|
|
140
|
+
then push to that branch. A runner must be available. Check the `arc` job's upload
|
|
141
|
+
output, then Arc's **Last sync** and the Item's **Code links**; the job allows
|
|
142
|
+
failure, so a successful overall pipeline does not prove the upload succeeded.
|
|
143
|
+
|
|
144
|
+
Its job uses default-branch push rules with `when: always`, stage `.post` and
|
|
145
|
+
`allow_failure: true`, so earlier job failures do not skip it. Global workflow
|
|
146
|
+
rules must still allow that pipeline to be created. Existing customer files and
|
|
147
|
+
symlinks are preserved; setup prints generated content for manual insertion when
|
|
148
|
+
needed and never rewrites the customer's GitLab pipeline. Changing CI removes only
|
|
149
|
+
Arc-generated files for the other CI choice and prints a reminder to remove an
|
|
150
|
+
obsolete GitLab include.
|
|
151
|
+
|
|
152
|
+
Other CI receives exact-checkout, secret and nonblocking-step instructions. After
|
|
153
|
+
checking out the exact event commit, pass the commit and branch together for a
|
|
154
|
+
detached checkout, using your CI's actual event variables:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
arc connect upload --commit-sha "$YOUR_CI_COMMIT_SHA" --branch "$YOUR_CI_BRANCH"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Configure the step to allow failure. GitHub/GitLab events are checked automatically;
|
|
161
|
+
a mismatched checkout fails before sending and other branches skip. Keep CI token
|
|
162
|
+
names from `.arc/config.json` and do not expose tokens to pull-request pipelines.
|
|
163
|
+
|
|
164
|
+
Upload scans one pinned commit and generates JSON in memory. One complete data
|
|
165
|
+
format, `schema_version: "1.0.0"`, contains the full `commit_sha`, `scanner_version`
|
|
166
|
+
and `git` repository identity with Program UUID/label marker locations. Each
|
|
167
|
+
Program is sent separately through its own token to
|
|
168
|
+
`POST /api/v1/public/programs/{program_id}/code-links/sources/{source_id}/reports`.
|
|
169
|
+
Reports are bounded to 32 MiB and 500,000 locations. Network, 429 and 5xx failures
|
|
170
|
+
use at most three total attempts with identical bodies; other API failures do not
|
|
171
|
+
retry. Missing/failed tokens do not prevent remaining Program uploads; the direct
|
|
172
|
+
command returns nonzero if any fail while generated CI remains nonblocking.
|
|
173
|
+
|
|
174
|
+
`data.schema.json` describes both scan output and uploads; there is no nested report
|
|
175
|
+
wrapper. Scan output can contain all configured Programs; each upload contains
|
|
176
|
+
exactly one Program matching its token and route. Config's independent
|
|
177
|
+
`schema_version` remains integer `1`, and the CLI package version is `0.1.1`.
|
|
178
|
+
Future data-schema releases must deploy server acceptance before publishing a CLI
|
|
179
|
+
that sends the new format. The current data schema remains `1.0.0`; no compatibility
|
|
180
|
+
implementation is added by this release policy.
|
|
181
|
+
No source text or secrets are uploaded. Arc retains five report bodies
|
|
182
|
+
and resolved projections, with older deduplication receipts. Invalid/failed reports
|
|
183
|
+
preserve current links; complete empty reports clear them. Duplicate retries never
|
|
184
|
+
promote old reports. Removal hides links and disables uploads; identical source
|
|
185
|
+
reconnection restores the retained current report. These links do not create Item
|
|
186
|
+
revisions or appear in historic model views.
|
|
187
|
+
|
|
188
|
+
## Development
|
|
189
|
+
|
|
190
|
+
```sh
|
|
191
|
+
python -m pip install '.[test]'
|
|
192
|
+
# Run only tests created or edited for the current change; for example:
|
|
193
|
+
python -m pytest --confcutdir=. tests/test_setup.py::test_noninteractive_init_does_not_open_browser
|
|
194
|
+
python -m build
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The standalone `archelps` package root maps the existing `arc_connect` Python
|
|
198
|
+
module to this directory and does not package the Arc backend or its dependencies.
|
|
199
|
+
Click and certifi are the runtime dependencies. The internal module name and private
|
|
200
|
+
`~/.arc-connect` credential location are unchanged.
|