@giamme/forge 0.15.0 → 0.16.0
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.
- package/CHANGELOG.md +29 -0
- package/VERSION +1 -1
- package/docs/artifacts.md +1 -1
- package/docs/commands.md +14 -3
- package/docs/forge-ui.md +14 -0
- package/docs/memory.md +22 -0
- package/docs/reviews.md +7 -0
- package/forge +11 -0
- package/package.json +1 -1
- package/references/dataset.md +5 -2
- package/references/decompose.md +51 -5
- package/references/harnesses.md +4 -1
- package/references/solo.md +5 -1
- package/references/ui.md +10 -1
- package/scripts/forge-artifact.sh +53 -0
- package/scripts/forge-contract.py +55 -8
- package/scripts/forge-control.py +0 -2
- package/scripts/forge-dispatch.sh +28 -12
- package/scripts/forge-fail-first.py +3 -1
- package/scripts/forge-guard.py +247 -8
- package/scripts/forge-issues.py +12 -0
- package/scripts/forge-lib-adopt.sh +260 -0
- package/scripts/forge-lib-attribute.sh +10 -2
- package/scripts/forge-lib-plans.sh +16 -4
- package/scripts/forge-lib-review.sh +8 -2
- package/scripts/forge-lib-task.sh +19 -5
- package/scripts/forge-memory.sh +41 -4
- package/scripts/forge-metrics.sh +7 -0
- package/scripts/forge-parallel.sh +96 -13
- package/scripts/forge-route.py +16 -2
- package/scripts/forge-runs-rm.py +23 -7
- package/scripts/forge-runtime.py +25 -2
- package/scripts/forge-schedule.py +5 -2
- package/scripts/forge-shadow.py +2 -0
- package/scripts/forge-solo.sh +6 -0
- package/scripts/forge_dataset/cli.py +16 -0
- package/scripts/forge_dataset/export.py +1 -0
- package/scripts/forge_dataset/harvest.py +11 -0
- package/scripts/forge_dataset/history.py +126 -0
- package/scripts/forge_dataset/worktrees.py +95 -0
- package/scripts/forge_memory_list.py +153 -0
- package/scripts/forge_worktrees.py +88 -0
- package/ui/README.md +31 -0
- package/ui/docs/api.md +81 -4
- package/ui/forge_ui/__init__.py +14 -1
- package/ui/forge_ui/__main__.py +1 -1
- package/ui/forge_ui/control.py +77 -0
- package/ui/forge_ui/findings.py +7 -0
- package/ui/forge_ui/projects.py +571 -0
- package/ui/forge_ui/reader.py +27 -7
- package/ui/forge_ui/static/app.js +99 -21
- package/ui/forge_ui/static/cloudui.js +6 -2
- package/ui/forge_ui/static/convo.js +1 -1
- package/ui/forge_ui/static/diffview.js +2 -2
- package/ui/forge_ui/static/files.js +1 -1
- package/ui/forge_ui/static/index.html +5 -1
- package/ui/forge_ui/static/panel.js +28 -2
- package/ui/forge_ui/static/projectsview.js +372 -0
- package/ui/forge_ui/static/settings.js +136 -4
- package/ui/forge_ui/static/style.css +93 -3
- package/ui/forge_ui/static/uikit.js +94 -1
- package/ui/forge_ui/static/worktreesview.js +250 -0
- package/ui/forge_ui/worktrees.py +570 -0
package/ui/forge_ui/__init__.py
CHANGED
|
@@ -4,7 +4,20 @@ from __future__ import annotations
|
|
|
4
4
|
import hashlib
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
# forge's own version: this package ships inside forge, and two numbers could only disagree. What a
|
|
8
|
+
# running server reports is what it started with, which an upgrade underneath it does not change.
|
|
9
|
+
VERSION_FILE = Path(__file__).resolve().parents[2] / 'VERSION'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def read_version(path=VERSION_FILE):
|
|
13
|
+
"""The first line of forge's VERSION file, or None when it cannot be read."""
|
|
14
|
+
try:
|
|
15
|
+
return Path(path).read_text(encoding='utf-8').split('\n', 1)[0].strip() or None
|
|
16
|
+
except (OSError, ValueError):
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__version__ = read_version()
|
|
8
21
|
|
|
9
22
|
|
|
10
23
|
def build_id():
|
package/ui/forge_ui/__main__.py
CHANGED
|
@@ -38,7 +38,7 @@ def _parser():
|
|
|
38
38
|
parser.add_argument('--read-only', action='store_true',
|
|
39
39
|
help='answer no write at all (also FORGE_UI_READONLY=1); the page shows no controls')
|
|
40
40
|
parser.add_argument('--open', action='store_true', help='open the page in the browser once started')
|
|
41
|
-
parser.add_argument('--version', action='version', version=f'forge-ui {__version__}')
|
|
41
|
+
parser.add_argument('--version', action='version', version=f'forge-ui {__version__ or "unknown"}')
|
|
42
42
|
return parser
|
|
43
43
|
|
|
44
44
|
|
package/ui/forge_ui/control.py
CHANGED
|
@@ -784,6 +784,78 @@ def _reviewer_outcomes(ctx):
|
|
|
784
784
|
return ctx.call('dataset', 'reviewers', '--json')
|
|
785
785
|
|
|
786
786
|
|
|
787
|
+
def _project_call(ctx, *args):
|
|
788
|
+
status, body = ctx.call(*args)
|
|
789
|
+
return body if status == 200 else None
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
def _projects(ctx):
|
|
793
|
+
# The Projects screen (#126): forge_ui/projects.py, which reads run dirs here and the rest through the CLI.
|
|
794
|
+
from forge_ui import projects
|
|
795
|
+
ctx.route = 'projects'
|
|
796
|
+
try:
|
|
797
|
+
_query_params(ctx.query, ())
|
|
798
|
+
except BadBody as exc:
|
|
799
|
+
return _invalid(str(exc))
|
|
800
|
+
return 200, projects.screen(ctx.server).listing(ctx.server.catalog)
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
def _project(ctx):
|
|
804
|
+
from forge_ui import projects
|
|
805
|
+
ctx.route = 'project'
|
|
806
|
+
try:
|
|
807
|
+
_query_params(ctx.query, ())
|
|
808
|
+
except BadBody as exc:
|
|
809
|
+
return _invalid(str(exc))
|
|
810
|
+
found = projects.screen(ctx.server).detail(ctx.server.catalog, ctx.key)
|
|
811
|
+
return (404, {'error': 'not found'}) if found is None else (200, found)
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
def _project_findings(ctx):
|
|
815
|
+
from forge_ui import projects
|
|
816
|
+
ctx.route = 'project findings'
|
|
817
|
+
try:
|
|
818
|
+
refresh = _bit(_query_params(ctx.query, ('refresh',)), 'refresh')
|
|
819
|
+
except BadBody as exc:
|
|
820
|
+
return _invalid(str(exc))
|
|
821
|
+
# --offline: no gh call; the listing says which findings are dismissed, filed (as recorded) or swept.
|
|
822
|
+
found = projects.screen(ctx.server).findings(
|
|
823
|
+
ctx.server.catalog, ctx.key, lambda: _project_call(ctx, 'dataset', 'history', '--json'),
|
|
824
|
+
lambda path: _project_call(ctx, 'issues', path, '--json', '--offline', '--all-runs', '--include-plausible',
|
|
825
|
+
'--include-dismissed'), refresh=refresh)
|
|
826
|
+
return (404, {'error': 'not found'}) if found is None else (200, found)
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
def _project_memories(ctx):
|
|
830
|
+
from forge_ui import projects
|
|
831
|
+
ctx.route = 'project memories'
|
|
832
|
+
try:
|
|
833
|
+
refresh = _bit(_query_params(ctx.query, ('refresh',)), 'refresh')
|
|
834
|
+
except BadBody as exc:
|
|
835
|
+
return _invalid(str(exc))
|
|
836
|
+
found = projects.screen(ctx.server).memories(
|
|
837
|
+
ctx.server.catalog, ctx.key, lambda path: _project_call(ctx, 'memory', 'learnings', path, '--json'),
|
|
838
|
+
lambda: _project_call(ctx, 'dataset', 'history', '--json'), refresh=refresh)
|
|
839
|
+
return (404, {'error': 'not found'}) if found is None else (200, found)
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
def _worktrees(ctx):
|
|
843
|
+
# The Worktrees screen (#125): git and the run dirs, read here, plus the history `forge dataset worktrees`
|
|
844
|
+
# keeps, read through the CLI. Cached per server (worktrees.CACHE_S); ?refresh=1 reads everything again.
|
|
845
|
+
from forge_ui import worktrees
|
|
846
|
+
ctx.route = 'worktrees'
|
|
847
|
+
try:
|
|
848
|
+
params = _query_params(ctx.query, ('refresh',))
|
|
849
|
+
refresh = _bit(params, 'refresh')
|
|
850
|
+
except BadBody as exc:
|
|
851
|
+
return _invalid(str(exc))
|
|
852
|
+
|
|
853
|
+
def history():
|
|
854
|
+
status, body = ctx.call('dataset', 'worktrees', '--json')
|
|
855
|
+
return body if status == 200 else None
|
|
856
|
+
return 200, worktrees.screen(ctx.server).answer(ctx.server.catalog, history, refresh=refresh)
|
|
857
|
+
|
|
858
|
+
|
|
787
859
|
ROUTES = [
|
|
788
860
|
('GET', re.compile(r'/api/runs/([0-9a-f]{12})/controls'), _show),
|
|
789
861
|
('POST', re.compile(r'/api/runs/([0-9a-f]{12})/controls'), _change),
|
|
@@ -796,6 +868,11 @@ ROUTES = [
|
|
|
796
868
|
('GET', re.compile(r'/api/config()'), _config_get),
|
|
797
869
|
('POST', re.compile(r'/api/config()'), _config_set),
|
|
798
870
|
('GET', re.compile(r'/api/models/reviewers()'), _reviewer_outcomes),
|
|
871
|
+
('GET', re.compile(r'/api/worktrees()'), _worktrees),
|
|
872
|
+
('GET', re.compile(r'/api/projects()'), _projects),
|
|
873
|
+
('GET', re.compile(r'/api/projects/([0-9a-f]{8})'), _project),
|
|
874
|
+
('GET', re.compile(r'/api/projects/([0-9a-f]{8})/findings'), _project_findings),
|
|
875
|
+
('GET', re.compile(r'/api/projects/([0-9a-f]{8})/memories'), _project_memories),
|
|
799
876
|
]
|
|
800
877
|
|
|
801
878
|
|
package/ui/forge_ui/findings.py
CHANGED
|
@@ -116,6 +116,13 @@ def listing(text, limit=200):
|
|
|
116
116
|
return result
|
|
117
117
|
|
|
118
118
|
|
|
119
|
+
def tests(text):
|
|
120
|
+
"""What the reply says about its tests (forge-contract.py's tests_report), or None."""
|
|
121
|
+
module = _load()
|
|
122
|
+
report = getattr(module, 'tests_report', None)
|
|
123
|
+
return report(text[:_MAX_CHARS]) if report and text else None
|
|
124
|
+
|
|
125
|
+
|
|
119
126
|
def parse_gate(text):
|
|
120
127
|
"""A qa.gate line: threshold, decision, worst, n_confirmed, n_unlabelled, n_below; None if malformed."""
|
|
121
128
|
line = next((item for item in (text or '').splitlines() if item.strip()), None)
|