unvibecode 0.3.0__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.
- unvibecode-0.3.0/PKG-INFO +133 -0
- unvibecode-0.3.0/README.md +113 -0
- unvibecode-0.3.0/pyproject.toml +40 -0
- unvibecode-0.3.0/setup.cfg +4 -0
- unvibecode-0.3.0/src/shipreadyv2/SOURCE_MANIFEST.json +27 -0
- unvibecode-0.3.0/src/shipreadyv2/__init__.py +3 -0
- unvibecode-0.3.0/src/shipreadyv2/__main__.py +5 -0
- unvibecode-0.3.0/src/shipreadyv2/cli.py +204 -0
- unvibecode-0.3.0/src/shipreadyv2/credentials.py +178 -0
- unvibecode-0.3.0/src/shipreadyv2/customer_runner.py +2457 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/00a_shipreadyv2_fast_lane_v11_api_context_bundle.py +5862 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/01_shipreadyv2_merged_graph_pipeline_5chunks.py +4703 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/02_shipreadyv2_prepare_pass1_inputs.py +996 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/03_shipreadyv2_pass1_full_runner.py +1666 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/04_shipreadyv2_business_path_compiler.py +3444 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/05_shipreadyv2_critical_business_insight_selector_v4.py +1756 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/06_shipreadyv2_step4_v2_with_v4_inputs.py +2155 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/__init__.py +2 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/agent_knowledge_graph.db +0 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/archetype_taxonomy.yaml +2127 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/archetype_taxonomy_pass1_compact.yaml +1922 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/build_pass1_compact_taxonomy.py +330 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/generate_combinedjson.py +184 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/normalized_business_path.schema.json +840 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/shipready_business_insight_implementation_plan_v2.md +1006 -0
- unvibecode-0.3.0/src/shipreadyv2/engine_sources/universal_insight_rules.yaml +875 -0
- unvibecode-0.3.0/src/unvibecode.egg-info/PKG-INFO +133 -0
- unvibecode-0.3.0/src/unvibecode.egg-info/SOURCES.txt +31 -0
- unvibecode-0.3.0/src/unvibecode.egg-info/dependency_links.txt +1 -0
- unvibecode-0.3.0/src/unvibecode.egg-info/entry_points.txt +2 -0
- unvibecode-0.3.0/src/unvibecode.egg-info/requires.txt +12 -0
- unvibecode-0.3.0/src/unvibecode.egg-info/top_level.txt +1 -0
- unvibecode-0.3.0/tests/test_package.py +415 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unvibecode
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Local repository code map and business workflow risk review
|
|
5
|
+
Author: ShipReady
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: jsonschema>=4.20
|
|
10
|
+
Requires-Dist: keyring<27,>=25.6
|
|
11
|
+
Requires-Dist: openai<3,>=2.50
|
|
12
|
+
Requires-Dist: pyvis>=0.3.2
|
|
13
|
+
Requires-Dist: PyYAML>=6.0
|
|
14
|
+
Requires-Dist: tiktoken>=0.8
|
|
15
|
+
Requires-Dist: tinycss2>=1.2
|
|
16
|
+
Requires-Dist: tree-sitter-language-pack>=0.9
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# ShipReadyV2 0.3.0
|
|
22
|
+
|
|
23
|
+
This project packages the authoritative ShipReady sources with the complete
|
|
24
|
+
Customer MVP Runner V9 experience. Version 0.3.0 uses ShipReady's authenticated
|
|
25
|
+
hosted model gateway, so customers do not provide an OpenAI API key.
|
|
26
|
+
|
|
27
|
+
Customer outputs:
|
|
28
|
+
|
|
29
|
+
1. Connected Code Map for LLMs.
|
|
30
|
+
2. Complete repository context ZIP.
|
|
31
|
+
3. Business Workflow Map.
|
|
32
|
+
4. Business Risk Findings, or a scoped no-findings review.
|
|
33
|
+
|
|
34
|
+
The terminal shows the V9 customer dashboard: real Fast Lane milestones,
|
|
35
|
+
fine-grained business-review stages, reviewed-area counts, ETA or elapsed time,
|
|
36
|
+
large-repository context-only messaging, and customer-ready output paths.
|
|
37
|
+
Technical engine output is retained in each run's `technical_logs` folder.
|
|
38
|
+
|
|
39
|
+
## One-time development setup
|
|
40
|
+
|
|
41
|
+
Open this project folder in VS Code and run:
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
|
45
|
+
.\scripts\setup.ps1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This creates `.venv` and installs the project in editable mode. You do not
|
|
49
|
+
need to recreate a source ZIP after changes.
|
|
50
|
+
|
|
51
|
+
## Activate once
|
|
52
|
+
|
|
53
|
+
```powershell
|
|
54
|
+
& ".\.venv\Scripts\shipready.exe" activate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Paste the ShipReady customer access key at the private prompt. The key is
|
|
58
|
+
verified without uploading repository code and stored in the operating
|
|
59
|
+
system's credential manager.
|
|
60
|
+
|
|
61
|
+
## Run a complete review
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
& ".\.venv\Scripts\shipready.exe" review `
|
|
65
|
+
--repository "D:\upstox" `
|
|
66
|
+
--runs-root "D:\shipreadyv2\customer_runs"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Add `--no-open-browser` to create reports without opening browser tabs.
|
|
70
|
+
No customer `.env` file or OpenAI API key is used.
|
|
71
|
+
|
|
72
|
+
For a normal repository, the Connected Code Map, Workflow Map and Risk
|
|
73
|
+
Findings open only after the full review finishes; Risk Findings opens last.
|
|
74
|
+
For a repository above approximately two million tokens, only the Connected
|
|
75
|
+
Code Map and complete context ZIP are produced and the CLI displays one
|
|
76
|
+
customer result rather than a confusing skipped second result.
|
|
77
|
+
|
|
78
|
+
If no candidate meets the evidence threshold, Step 06 is skipped. The review
|
|
79
|
+
completes successfully and publishes a customer report explaining that no
|
|
80
|
+
evidence-supported business risks were identified within the completed scope.
|
|
81
|
+
|
|
82
|
+
## Permanent source workflow
|
|
83
|
+
|
|
84
|
+
Canonical package code:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
src\shipreadyv2\customer_runner.py
|
|
88
|
+
src\shipreadyv2\cli.py
|
|
89
|
+
src\shipreadyv2\engine_sources\
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`customer_runner.py` is the exact supplied V9 runner. The files under
|
|
93
|
+
`engine_sources` are the supplied current analysis sources. Their SHA-256
|
|
94
|
+
hashes are recorded in `SOURCE_MANIFEST.json`. Version 0.3.0 keeps all 16
|
|
95
|
+
authoritative engine and runner sources byte-identical to the validated 0.2.1
|
|
96
|
+
baseline; only the package activation and network adapter changed.
|
|
97
|
+
|
|
98
|
+
For each change:
|
|
99
|
+
|
|
100
|
+
```powershell
|
|
101
|
+
git switch -c "change/short-description"
|
|
102
|
+
# Edit files under src\shipreadyv2
|
|
103
|
+
& ".\.venv\Scripts\python.exe" -m pytest
|
|
104
|
+
git add .
|
|
105
|
+
git commit -m "Describe the change"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Build a release:
|
|
109
|
+
|
|
110
|
+
```powershell
|
|
111
|
+
.\scripts\release.ps1 -Python "$PWD\.venv\Scripts\python.exe"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The wheel is written to `dist`, and `RELEASE_CHECKSUMS.txt` is refreshed.
|
|
115
|
+
Do not edit an installed wheel or files under `site-packages`.
|
|
116
|
+
|
|
117
|
+
## Hosted-service boundary
|
|
118
|
+
|
|
119
|
+
The customer package performs graph construction, context preparation,
|
|
120
|
+
deterministic selection and report rendering locally. The two existing
|
|
121
|
+
structured model requests use:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
https://shipready-api.alphashots.ai/v1
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The package passes a ShipReady customer credential, never an OpenAI key. The
|
|
128
|
+
hosted service allows only ShipReady's two established structured request
|
|
129
|
+
schemas and does not log or persist customer request bodies. A private
|
|
130
|
+
temporary engine directory is removed after every review.
|
|
131
|
+
|
|
132
|
+
For non-interactive automation, `SHIPREADY_ACCESS_KEY` may be supplied in the
|
|
133
|
+
process environment instead of using `shipready activate`.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# ShipReadyV2 0.3.0
|
|
2
|
+
|
|
3
|
+
This project packages the authoritative ShipReady sources with the complete
|
|
4
|
+
Customer MVP Runner V9 experience. Version 0.3.0 uses ShipReady's authenticated
|
|
5
|
+
hosted model gateway, so customers do not provide an OpenAI API key.
|
|
6
|
+
|
|
7
|
+
Customer outputs:
|
|
8
|
+
|
|
9
|
+
1. Connected Code Map for LLMs.
|
|
10
|
+
2. Complete repository context ZIP.
|
|
11
|
+
3. Business Workflow Map.
|
|
12
|
+
4. Business Risk Findings, or a scoped no-findings review.
|
|
13
|
+
|
|
14
|
+
The terminal shows the V9 customer dashboard: real Fast Lane milestones,
|
|
15
|
+
fine-grained business-review stages, reviewed-area counts, ETA or elapsed time,
|
|
16
|
+
large-repository context-only messaging, and customer-ready output paths.
|
|
17
|
+
Technical engine output is retained in each run's `technical_logs` folder.
|
|
18
|
+
|
|
19
|
+
## One-time development setup
|
|
20
|
+
|
|
21
|
+
Open this project folder in VS Code and run:
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
|
25
|
+
.\scripts\setup.ps1
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This creates `.venv` and installs the project in editable mode. You do not
|
|
29
|
+
need to recreate a source ZIP after changes.
|
|
30
|
+
|
|
31
|
+
## Activate once
|
|
32
|
+
|
|
33
|
+
```powershell
|
|
34
|
+
& ".\.venv\Scripts\shipready.exe" activate
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Paste the ShipReady customer access key at the private prompt. The key is
|
|
38
|
+
verified without uploading repository code and stored in the operating
|
|
39
|
+
system's credential manager.
|
|
40
|
+
|
|
41
|
+
## Run a complete review
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
& ".\.venv\Scripts\shipready.exe" review `
|
|
45
|
+
--repository "D:\upstox" `
|
|
46
|
+
--runs-root "D:\shipreadyv2\customer_runs"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Add `--no-open-browser` to create reports without opening browser tabs.
|
|
50
|
+
No customer `.env` file or OpenAI API key is used.
|
|
51
|
+
|
|
52
|
+
For a normal repository, the Connected Code Map, Workflow Map and Risk
|
|
53
|
+
Findings open only after the full review finishes; Risk Findings opens last.
|
|
54
|
+
For a repository above approximately two million tokens, only the Connected
|
|
55
|
+
Code Map and complete context ZIP are produced and the CLI displays one
|
|
56
|
+
customer result rather than a confusing skipped second result.
|
|
57
|
+
|
|
58
|
+
If no candidate meets the evidence threshold, Step 06 is skipped. The review
|
|
59
|
+
completes successfully and publishes a customer report explaining that no
|
|
60
|
+
evidence-supported business risks were identified within the completed scope.
|
|
61
|
+
|
|
62
|
+
## Permanent source workflow
|
|
63
|
+
|
|
64
|
+
Canonical package code:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
src\shipreadyv2\customer_runner.py
|
|
68
|
+
src\shipreadyv2\cli.py
|
|
69
|
+
src\shipreadyv2\engine_sources\
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`customer_runner.py` is the exact supplied V9 runner. The files under
|
|
73
|
+
`engine_sources` are the supplied current analysis sources. Their SHA-256
|
|
74
|
+
hashes are recorded in `SOURCE_MANIFEST.json`. Version 0.3.0 keeps all 16
|
|
75
|
+
authoritative engine and runner sources byte-identical to the validated 0.2.1
|
|
76
|
+
baseline; only the package activation and network adapter changed.
|
|
77
|
+
|
|
78
|
+
For each change:
|
|
79
|
+
|
|
80
|
+
```powershell
|
|
81
|
+
git switch -c "change/short-description"
|
|
82
|
+
# Edit files under src\shipreadyv2
|
|
83
|
+
& ".\.venv\Scripts\python.exe" -m pytest
|
|
84
|
+
git add .
|
|
85
|
+
git commit -m "Describe the change"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Build a release:
|
|
89
|
+
|
|
90
|
+
```powershell
|
|
91
|
+
.\scripts\release.ps1 -Python "$PWD\.venv\Scripts\python.exe"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The wheel is written to `dist`, and `RELEASE_CHECKSUMS.txt` is refreshed.
|
|
95
|
+
Do not edit an installed wheel or files under `site-packages`.
|
|
96
|
+
|
|
97
|
+
## Hosted-service boundary
|
|
98
|
+
|
|
99
|
+
The customer package performs graph construction, context preparation,
|
|
100
|
+
deterministic selection and report rendering locally. The two existing
|
|
101
|
+
structured model requests use:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
https://shipready-api.alphashots.ai/v1
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The package passes a ShipReady customer credential, never an OpenAI key. The
|
|
108
|
+
hosted service allows only ShipReady's two established structured request
|
|
109
|
+
schemas and does not log or persist customer request bodies. A private
|
|
110
|
+
temporary engine directory is removed after every review.
|
|
111
|
+
|
|
112
|
+
For non-interactive automation, `SHIPREADY_ACCESS_KEY` may be supplied in the
|
|
113
|
+
process environment instead of using `shipready activate`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "unvibecode"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Local repository code map and business workflow risk review"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "LicenseRef-Proprietary"
|
|
12
|
+
authors = [{name = "ShipReady"}]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"jsonschema>=4.20",
|
|
15
|
+
"keyring>=25.6,<27",
|
|
16
|
+
"openai>=2.50,<3",
|
|
17
|
+
"pyvis>=0.3.2",
|
|
18
|
+
"PyYAML>=6.0",
|
|
19
|
+
"tiktoken>=0.8",
|
|
20
|
+
"tinycss2>=1.2",
|
|
21
|
+
"tree-sitter-language-pack>=0.9",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = [
|
|
26
|
+
"build>=1.2",
|
|
27
|
+
"pytest>=8.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
shipready = "shipreadyv2.cli:main"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
shipreadyv2 = ["SOURCE_MANIFEST.json", "engine_sources/*"]
|
|
38
|
+
|
|
39
|
+
[tool.pytest.ini_options]
|
|
40
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "shipreadyv2.exact_source_manifest.v2",
|
|
3
|
+
"package_version": "0.3.0",
|
|
4
|
+
"engine_baseline_version": "0.2.1",
|
|
5
|
+
"engine_changes_from_baseline": [],
|
|
6
|
+
"hash_mode": "LF-normalized SHA-256 for text; raw SHA-256 for binary",
|
|
7
|
+
"customer_runner_source": "shipreadyv2_customer_mvp_runner_v9.py",
|
|
8
|
+
"engine_source": "shipreadyv2_fresh_source.zip plus universal_insight_rules.yaml",
|
|
9
|
+
"source_files": {
|
|
10
|
+
"customer_runner.py": "6a0593de05be1a460c0375a431331fb115d6426c507a185a087c801a78055c1d",
|
|
11
|
+
"engine_sources/00a_shipreadyv2_fast_lane_v11_api_context_bundle.py": "1eac10db5403bb470929da4b52eaafb88dbce6b5919492016754e227680e7c3e",
|
|
12
|
+
"engine_sources/01_shipreadyv2_merged_graph_pipeline_5chunks.py": "697f7dda0a65a582939bae75b16d601342fd547adeda1a209778f60903a494a2",
|
|
13
|
+
"engine_sources/02_shipreadyv2_prepare_pass1_inputs.py": "cb5bb27a6d923341e55b2b121e128bcce66edf04937cc3b18e31d5f3989fe891",
|
|
14
|
+
"engine_sources/03_shipreadyv2_pass1_full_runner.py": "40e5a0afd70e55110c1784f5e29332a910fad3b03fe3030492633277ff93caba",
|
|
15
|
+
"engine_sources/04_shipreadyv2_business_path_compiler.py": "7ed142e07cb37b1f90084837b7cb45f63f2718826f121b834c5e1a5a57ffab94",
|
|
16
|
+
"engine_sources/05_shipreadyv2_critical_business_insight_selector_v4.py": "e770c8cd21a06a7a02d8e8f9e8c6f7bedb1a5b7be96fdb6ba646e740f006a011",
|
|
17
|
+
"engine_sources/06_shipreadyv2_step4_v2_with_v4_inputs.py": "6dbc77b72e0066f9fcfb7e5d92026bb6b54b77a8eed687a94971c4d9ab6160c2",
|
|
18
|
+
"engine_sources/agent_knowledge_graph.db": "db362f684eb4d9e43827400f4e11f1dfd7cbfffa5fd481c105cd9d3f14d9f8b2",
|
|
19
|
+
"engine_sources/archetype_taxonomy.yaml": "55e98bdace2af1a1dbe6a73315e651383f9f2ca265a3ad5ca262dbd8acbf1f5f",
|
|
20
|
+
"engine_sources/archetype_taxonomy_pass1_compact.yaml": "93452175b35bd74bc9043766324c8442607e920a70548115c32a0b09a33673e3",
|
|
21
|
+
"engine_sources/build_pass1_compact_taxonomy.py": "5d8692214509c80dddeb2e2eee0d6f80f172d8150b9640db27dbeb07dec69769",
|
|
22
|
+
"engine_sources/generate_combinedjson.py": "1c2ffbb4ec9d40b9b4304abc2848943a69424d3087125993733a1b57064f5267",
|
|
23
|
+
"engine_sources/normalized_business_path.schema.json": "5d408b2cce353ab6ef4b37a0686330ff5610c6d7aaf4bc37fdf9b0aa1fc665cd",
|
|
24
|
+
"engine_sources/shipready_business_insight_implementation_plan_v2.md": "210cc34f9a28c7e4acc4ba39a164f8d78ce5c97b99fb9f9beff308db2bda7eac",
|
|
25
|
+
"engine_sources/universal_insight_rules.yaml": "4aa10f8c581100190c24365fa4188862c49738403db36c6c298ba15c54067ab7"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""Customer-facing command adapter for the preserved ShipReadyV2 workflow."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import contextlib
|
|
7
|
+
import getpass
|
|
8
|
+
import os
|
|
9
|
+
import shutil
|
|
10
|
+
import tempfile
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Iterator, Optional, Sequence
|
|
13
|
+
|
|
14
|
+
from . import __version__
|
|
15
|
+
from . import customer_runner
|
|
16
|
+
from . import credentials
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def bundled_engine_root() -> Path:
|
|
20
|
+
"""Return the installed directory containing the preserved engine files."""
|
|
21
|
+
return Path(__file__).resolve().parent / "engine_sources"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def default_runs_root() -> Path:
|
|
25
|
+
"""Keep customer runs outside the installed Python package."""
|
|
26
|
+
return Path.cwd() / "shipready_results"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@contextlib.contextmanager
|
|
30
|
+
def prepared_runtime_engine(access_key: str) -> Iterator[Path]:
|
|
31
|
+
"""Provide the preserved scripts with a private hosted-service environment.
|
|
32
|
+
|
|
33
|
+
Steps 03 and 06 require an engine-root .env file before they read the
|
|
34
|
+
SDK credential. The value supplied here is a ShipReady customer credential,
|
|
35
|
+
and OPENAI_BASE_URL directs the unmodified OpenAI SDK calls to ShipReady's
|
|
36
|
+
hosted gateway. The customer never supplies an OpenAI API key.
|
|
37
|
+
|
|
38
|
+
Installed package directories may be read-only, so the adapter copies the
|
|
39
|
+
preserved engine into a private temporary directory for the duration of the
|
|
40
|
+
review. The directory and its temporary .env file are removed afterward.
|
|
41
|
+
"""
|
|
42
|
+
access_key = credentials.normalize_access_key(access_key)
|
|
43
|
+
if "\r" in access_key or "\n" in access_key:
|
|
44
|
+
raise customer_runner.CustomerRunError(
|
|
45
|
+
"The ShipReady access key contains an invalid line break"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
hosted_environment = {
|
|
49
|
+
"OPENAI_API_KEY": access_key,
|
|
50
|
+
"OPENAI_BASE_URL": credentials.api_base_url(),
|
|
51
|
+
}
|
|
52
|
+
previous_environment = {
|
|
53
|
+
name: os.environ.get(name)
|
|
54
|
+
for name in hosted_environment
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
with tempfile.TemporaryDirectory(prefix="shipreadyv2-engine-") as temporary:
|
|
58
|
+
runtime_root = Path(temporary) / "engine"
|
|
59
|
+
shutil.copytree(
|
|
60
|
+
bundled_engine_root(),
|
|
61
|
+
runtime_root,
|
|
62
|
+
ignore=shutil.ignore_patterns("__pycache__", "*.pyc"),
|
|
63
|
+
)
|
|
64
|
+
(runtime_root / ".env").write_text(
|
|
65
|
+
(
|
|
66
|
+
f"OPENAI_API_KEY={access_key}\n"
|
|
67
|
+
f"OPENAI_BASE_URL={credentials.api_base_url()}\n"
|
|
68
|
+
),
|
|
69
|
+
encoding="utf-8",
|
|
70
|
+
)
|
|
71
|
+
try:
|
|
72
|
+
os.environ.update(hosted_environment)
|
|
73
|
+
yield runtime_root
|
|
74
|
+
finally:
|
|
75
|
+
for name, previous_value in previous_environment.items():
|
|
76
|
+
if previous_value is None:
|
|
77
|
+
os.environ.pop(name, None)
|
|
78
|
+
else:
|
|
79
|
+
os.environ[name] = previous_value
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
83
|
+
parser = argparse.ArgumentParser(
|
|
84
|
+
prog="shipready",
|
|
85
|
+
description=(
|
|
86
|
+
"Prepare a Connected Code Map for LLMs and, when repository size "
|
|
87
|
+
"permits, a Business Workflow & Risk Review."
|
|
88
|
+
),
|
|
89
|
+
)
|
|
90
|
+
parser.add_argument(
|
|
91
|
+
"--version",
|
|
92
|
+
action="version",
|
|
93
|
+
version=f"%(prog)s {__version__}",
|
|
94
|
+
)
|
|
95
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
96
|
+
|
|
97
|
+
subparsers.add_parser(
|
|
98
|
+
"activate",
|
|
99
|
+
help="Securely activate ShipReady on this computer",
|
|
100
|
+
)
|
|
101
|
+
subparsers.add_parser(
|
|
102
|
+
"deactivate",
|
|
103
|
+
help="Remove the stored ShipReady access key",
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
review = subparsers.add_parser("review", help="Review a source repository")
|
|
107
|
+
review.add_argument("--repository", required=True)
|
|
108
|
+
review.add_argument(
|
|
109
|
+
"--runs-root",
|
|
110
|
+
default=str(default_runs_root()),
|
|
111
|
+
help=(
|
|
112
|
+
"Folder for repository-review runs "
|
|
113
|
+
"(default: ./shipready_results)"
|
|
114
|
+
),
|
|
115
|
+
)
|
|
116
|
+
review.add_argument(
|
|
117
|
+
"--large-repo-token-limit",
|
|
118
|
+
type=int,
|
|
119
|
+
default=customer_runner.DEFAULT_LARGE_REPOSITORY_TOKEN_LIMIT,
|
|
120
|
+
help=(
|
|
121
|
+
"Prepare only the Connected Code Map above this approximate token "
|
|
122
|
+
"count (default: 2000000)"
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
review.add_argument(
|
|
126
|
+
"--no-open-browser",
|
|
127
|
+
action="store_true",
|
|
128
|
+
help="Create customer HTML reports without opening browser tabs",
|
|
129
|
+
)
|
|
130
|
+
return parser
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
134
|
+
parser = build_parser()
|
|
135
|
+
args = parser.parse_args(argv)
|
|
136
|
+
|
|
137
|
+
if args.command == "activate":
|
|
138
|
+
try:
|
|
139
|
+
access_key = credentials.normalize_access_key(
|
|
140
|
+
getpass.getpass("Paste your ShipReady access key: ")
|
|
141
|
+
)
|
|
142
|
+
verification = credentials.verify_access_key(access_key)
|
|
143
|
+
if not verification.valid:
|
|
144
|
+
print(f"[STOPPED] {verification.message}")
|
|
145
|
+
return 2
|
|
146
|
+
credentials.store_access_key(access_key)
|
|
147
|
+
except (credentials.CredentialError, KeyboardInterrupt, EOFError) as exc:
|
|
148
|
+
message = str(exc) or "Activation was cancelled."
|
|
149
|
+
print(f"[STOPPED] {message}")
|
|
150
|
+
return 2
|
|
151
|
+
print("ShipReady access is ready on this computer.")
|
|
152
|
+
return 0
|
|
153
|
+
|
|
154
|
+
if args.command == "deactivate":
|
|
155
|
+
try:
|
|
156
|
+
removed = credentials.delete_access_key()
|
|
157
|
+
except credentials.CredentialError as exc:
|
|
158
|
+
print(f"[STOPPED] {exc}")
|
|
159
|
+
return 2
|
|
160
|
+
if removed:
|
|
161
|
+
print("ShipReady access was removed from this computer.")
|
|
162
|
+
else:
|
|
163
|
+
print("ShipReady was not activated on this computer.")
|
|
164
|
+
return 0
|
|
165
|
+
|
|
166
|
+
if args.command != "review":
|
|
167
|
+
parser.error("A supported command is required")
|
|
168
|
+
if args.large_repo_token_limit <= 0:
|
|
169
|
+
parser.error("--large-repo-token-limit must be greater than zero")
|
|
170
|
+
|
|
171
|
+
try:
|
|
172
|
+
access_key = credentials.load_access_key()
|
|
173
|
+
if not access_key:
|
|
174
|
+
raise credentials.CredentialError(
|
|
175
|
+
"ShipReady is not activated. Run: shipready activate"
|
|
176
|
+
)
|
|
177
|
+
except credentials.CredentialError as exc:
|
|
178
|
+
print(f"[STOPPED] {exc}")
|
|
179
|
+
return 2
|
|
180
|
+
|
|
181
|
+
try:
|
|
182
|
+
with prepared_runtime_engine(access_key) as engine_root:
|
|
183
|
+
runner_args = [
|
|
184
|
+
"start",
|
|
185
|
+
"--repository",
|
|
186
|
+
str(Path(args.repository).expanduser()),
|
|
187
|
+
"--engine-root",
|
|
188
|
+
str(engine_root),
|
|
189
|
+
"--runs-root",
|
|
190
|
+
str(Path(args.runs_root).expanduser()),
|
|
191
|
+
"--large-repo-token-limit",
|
|
192
|
+
str(args.large_repo_token_limit),
|
|
193
|
+
]
|
|
194
|
+
if args.no_open_browser:
|
|
195
|
+
runner_args.append("--no-open-browser")
|
|
196
|
+
|
|
197
|
+
return customer_runner.main(runner_args)
|
|
198
|
+
except customer_runner.CustomerRunError as exc:
|
|
199
|
+
print(f"[STOPPED] {exc}")
|
|
200
|
+
return 2
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
if __name__ == "__main__":
|
|
204
|
+
raise SystemExit(main())
|