codetrail-cli 1.4.1__py3-none-any.whl
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.
- codetrail/__init__.py +3 -0
- codetrail/__main__.py +5 -0
- codetrail/agents/__init__.py +4 -0
- codetrail/agents/convert.py +92 -0
- codetrail/agents/export.py +284 -0
- codetrail/agents/instructions.py +42 -0
- codetrail/agents/protocol.py +111 -0
- codetrail/agents/tools.py +185 -0
- codetrail/assistant/__init__.py +161 -0
- codetrail/assistant/claude_code.py +330 -0
- codetrail/assistant/codex.py +260 -0
- codetrail/assistant/environment.py +66 -0
- codetrail/assistant/estimate.py +225 -0
- codetrail/assistant/fake.py +74 -0
- codetrail/assistant/guard.py +80 -0
- codetrail/assistant/guard_hook.py +58 -0
- codetrail/assistant/local.py +245 -0
- codetrail/assistant/local_tools.py +177 -0
- codetrail/assistant/prompts.py +404 -0
- codetrail/assistant/routing.py +86 -0
- codetrail/assistant/runner.py +120 -0
- codetrail/assistant/status.py +186 -0
- codetrail/assistant/usage.py +93 -0
- codetrail/bridge.py +292 -0
- codetrail/cli.py +407 -0
- codetrail/config.py +485 -0
- codetrail/database/__init__.py +60 -0
- codetrail/database/migrations/0001_facts.sql +34 -0
- codetrail/database/migrations/0002_settings.sql +5 -0
- codetrail/database/migrations/0003_learning.sql +34 -0
- codetrail/database/migrations/0004_assistant_usage.sql +24 -0
- codetrail/database/migrations/0005_page_failures.sql +7 -0
- codetrail/database/migrations/0006_metric_values.sql +9 -0
- codetrail/errors.py +5 -0
- codetrail/extract/__init__.py +249 -0
- codetrail/extract/adr.py +98 -0
- codetrail/extract/github_actions.py +140 -0
- codetrail/extract/openapi.py +101 -0
- codetrail/extract/python.py +221 -0
- codetrail/extract/swift.py +204 -0
- codetrail/extract/terraform.py +166 -0
- codetrail/extract/typescript.py +464 -0
- codetrail/facts/__init__.py +112 -0
- codetrail/facts/store.py +209 -0
- codetrail/generate/__init__.py +1 -0
- codetrail/generate/failures.py +31 -0
- codetrail/generate/outline.py +159 -0
- codetrail/generate/revise.py +72 -0
- codetrail/generate/run.py +530 -0
- codetrail/generate/scope.py +135 -0
- codetrail/generate/validate.py +218 -0
- codetrail/guide/__init__.py +147 -0
- codetrail/learn/__init__.py +143 -0
- codetrail/learn/routes.py +139 -0
- codetrail/locales/ar/LC_MESSAGES/codetrail.mo +0 -0
- codetrail/locales/ar/LC_MESSAGES/codetrail.po +2236 -0
- codetrail/locales/codetrail.pot +1942 -0
- codetrail/lock.py +114 -0
- codetrail/metrics/__init__.py +6 -0
- codetrail/metrics/activity.py +96 -0
- codetrail/metrics/churn.py +156 -0
- codetrail/metrics/commits.py +45 -0
- codetrail/metrics/coverage.py +114 -0
- codetrail/metrics/decisions.py +77 -0
- codetrail/metrics/history.py +47 -0
- codetrail/metrics/inventory.py +63 -0
- codetrail/metrics/rationale.py +74 -0
- codetrail/metrics/releases.py +26 -0
- codetrail/metrics/report.py +111 -0
- codetrail/metrics/repository.py +128 -0
- codetrail/metrics/size.py +95 -0
- codetrail/py.typed +0 -0
- codetrail/remove.py +50 -0
- codetrail/repo/__init__.py +4 -0
- codetrail/repo/git.py +56 -0
- codetrail/repo/gitleaks.toml +6 -0
- codetrail/repo/history.py +262 -0
- codetrail/repo/mirror.py +137 -0
- codetrail/repo/refresh.py +41 -0
- codetrail/repo/rules.py +83 -0
- codetrail/repo/secrets.py +145 -0
- codetrail/repo/signal.py +65 -0
- codetrail/repo/source.py +166 -0
- codetrail/search.py +178 -0
- codetrail/server.py +45 -0
- codetrail/system.py +484 -0
- codetrail/update.py +276 -0
- codetrail/web/__init__.py +1 -0
- codetrail/web/app.py +897 -0
- codetrail/web/diagrams.py +414 -0
- codetrail/web/documentation.py +146 -0
- codetrail/web/i18n.py +44 -0
- codetrail/web/navigation.py +127 -0
- codetrail/web/render.py +126 -0
- codetrail/web/repository_view.py +230 -0
- codetrail/web/security.py +171 -0
- codetrail/web/static/brand/favicon.svg +1 -0
- codetrail/web/static/brand/mark.svg +1 -0
- codetrail/web/static/css/base.css +192 -0
- codetrail/web/static/css/components.css +2254 -0
- codetrail/web/static/css/content.css +310 -0
- codetrail/web/static/css/layout.css +410 -0
- codetrail/web/static/css/print.css +42 -0
- codetrail/web/static/css/tokens.css +228 -0
- codetrail/web/static/js/api.js +49 -0
- codetrail/web/static/js/ask.js +182 -0
- codetrail/web/static/js/d2-worker.js +34 -0
- codetrail/web/static/js/d2.js +28 -0
- codetrail/web/static/js/diagram.js +52 -0
- codetrail/web/static/js/documentation.js +24 -0
- codetrail/web/static/js/learning.js +47 -0
- codetrail/web/static/js/main.js +38 -0
- codetrail/web/static/js/outline.js +44 -0
- codetrail/web/static/js/palette.js +211 -0
- codetrail/web/static/js/repository.js +528 -0
- codetrail/web/static/js/resize.js +126 -0
- codetrail/web/static/js/shortcuts.js +87 -0
- codetrail/web/static/js/sidebar.js +194 -0
- codetrail/web/static/js/theme-init.js +27 -0
- codetrail/web/static/js/theme.js +42 -0
- codetrail/web/static/js/update.js +107 -0
- codetrail/web/static/vendor/d2/LICENSE +375 -0
- codetrail/web/static/vendor/d2/LICENSE-elk +263 -0
- codetrail/web/static/vendor/d2/LICENSE-wasm_exec +27 -0
- codetrail/web/static/vendor/d2/VERSION +12 -0
- codetrail/web/static/vendor/d2/d2.wasm +0 -0
- codetrail/web/static/vendor/d2/elk.js +105914 -0
- codetrail/web/static/vendor/d2/wasm_exec.js +656 -0
- codetrail/web/static/vendor/inter/InterVariable-Italic.woff2 +0 -0
- codetrail/web/static/vendor/inter/InterVariable.woff2 +0 -0
- codetrail/web/static/vendor/inter/LICENSE.txt +92 -0
- codetrail/web/static/vendor/inter/VERSION +6 -0
- codetrail/web/static/vendor/noto-sans-arabic/NotoSansArabic-wght.woff2 +0 -0
- codetrail/web/static/vendor/noto-sans-arabic/OFL.txt +93 -0
- codetrail/web/static/vendor/noto-sans-arabic/VERSION +12 -0
- codetrail/web/target_view.py +63 -0
- codetrail/web/templates/answers.html +25 -0
- codetrail/web/templates/area.html +46 -0
- codetrail/web/templates/base.html +37 -0
- codetrail/web/templates/decisions.html +30 -0
- codetrail/web/templates/diagram.html +10 -0
- codetrail/web/templates/digests.html +24 -0
- codetrail/web/templates/documentation.html +247 -0
- codetrail/web/templates/error.html +9 -0
- codetrail/web/templates/estimate.html +48 -0
- codetrail/web/templates/fact.html +29 -0
- codetrail/web/templates/home.html +196 -0
- codetrail/web/templates/layout/ask_panel.html +27 -0
- codetrail/web/templates/layout/header.html +32 -0
- codetrail/web/templates/layout/icons.html +27 -0
- codetrail/web/templates/layout/outline.html +4 -0
- codetrail/web/templates/layout/palette.html +27 -0
- codetrail/web/templates/layout/shortcuts.html +27 -0
- codetrail/web/templates/layout/sidebar.html +79 -0
- codetrail/web/templates/layout/update_dialog.html +18 -0
- codetrail/web/templates/macros.html +13 -0
- codetrail/web/templates/page.html +93 -0
- codetrail/web/templates/progress.html +46 -0
- codetrail/web/templates/repository.html +369 -0
- codetrail/web/templates/search.html +31 -0
- codetrail/web/templates/source.html +15 -0
- codetrail/web/templates/system.html +43 -0
- codetrail/web/templates/system_arrows.html +17 -0
- codetrail/web/templates/system_legend.html +9 -0
- codetrail/web/templates/update_log.html +30 -0
- codetrail/web/trend.py +22 -0
- codetrail_cli-1.4.1.dist-info/METADATA +372 -0
- codetrail_cli-1.4.1.dist-info/RECORD +171 -0
- codetrail_cli-1.4.1.dist-info/WHEEL +4 -0
- codetrail_cli-1.4.1.dist-info/entry_points.txt +3 -0
- codetrail_cli-1.4.1.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Inter 4.1
|
|
2
|
+
source: https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip (web/InterVariable.woff2, web/InterVariable-Italic.woff2, LICENSE.txt)
|
|
3
|
+
licence: SIL Open Font License 1.1 (LICENSE.txt)
|
|
4
|
+
sha256:
|
|
5
|
+
693b77d4f32ee9b8bfc995589b5fad5e99adf2832738661f5402f9978429a8e3 InterVariable.woff2
|
|
6
|
+
e564f652916db6c139570fefb9524a77c4d48f30c92928de9db19b6b5c7a262a InterVariable-Italic.woff2
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/arabic)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://openfontlicense.org
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Noto Sans Arabic 2.013
|
|
2
|
+
source: https://github.com/notofonts/arabic/releases/download/NotoSansArabic-v2.013/NotoSansArabic-v2.013.zip
|
|
3
|
+
(NotoSansArabic/unhinted/slim-variable-ttf/NotoSansArabic[wght].ttf and OFL.txt)
|
|
4
|
+
converted: the release ships no WOFF2, so the TTF was compressed losslessly; with every tool pinned, this gives the
|
|
5
|
+
same bytes again:
|
|
6
|
+
uvx --python 3.14.7 --from 'fonttools[woff]==4.60.2' --with 'brotli==1.2.0' fonttools ttLib.woff2 compress -o NotoSansArabic-wght.woff2 'NotoSansArabic[wght].ttf'
|
|
7
|
+
licence: SIL Open Font License 1.1 (OFL.txt)
|
|
8
|
+
sha256 of the sources:
|
|
9
|
+
1301aceaea84c501cf2e6dcfb3182e2328c8eae5725817fcb239672bda7154f1 NotoSansArabic-v2.013.zip
|
|
10
|
+
3fae4d7239d1faa55b234bda8091019a5251ff79df40d5e29367d84bed2a8138 NotoSansArabic[wght].ttf
|
|
11
|
+
sha256:
|
|
12
|
+
011d31980bdc998dd3a00e365326c69e2417a76ecff020ffb8cb84752adc45f2 NotoSansArabic-wght.woff2
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""What the page reads for one target: the sources' manifest, the fact store and the source text.
|
|
2
|
+
|
|
3
|
+
Source text is served only for paths listed in the manifest's files, which passed the exclusion rules, and only from
|
|
4
|
+
`source/`.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from collections import Counter
|
|
10
|
+
from collections.abc import Iterator
|
|
11
|
+
from contextlib import contextmanager
|
|
12
|
+
from pathlib import PurePosixPath
|
|
13
|
+
|
|
14
|
+
from codetrail.config import Paths
|
|
15
|
+
from codetrail.database import connect
|
|
16
|
+
from codetrail.facts.store import FactStore
|
|
17
|
+
from codetrail.repo.source import SourceManifest
|
|
18
|
+
|
|
19
|
+
MAX_SOURCE_BYTES = 2_000_000
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TargetView:
|
|
23
|
+
def __init__(self, paths: Paths, name: str) -> None:
|
|
24
|
+
self.name = name
|
|
25
|
+
self.data = paths.target_data(name)
|
|
26
|
+
|
|
27
|
+
def manifest(self) -> SourceManifest | None:
|
|
28
|
+
return SourceManifest.load(self.data / "source.json")
|
|
29
|
+
|
|
30
|
+
@contextmanager
|
|
31
|
+
def store(self) -> Iterator[FactStore]:
|
|
32
|
+
connection = connect(self.data / "codetrail.db")
|
|
33
|
+
try:
|
|
34
|
+
yield FactStore(connection)
|
|
35
|
+
finally:
|
|
36
|
+
connection.close()
|
|
37
|
+
|
|
38
|
+
def areas(self) -> list[tuple[str, int]]:
|
|
39
|
+
"""Top-level folders of the visible files, with how many files each holds."""
|
|
40
|
+
manifest = self.manifest()
|
|
41
|
+
if manifest is None:
|
|
42
|
+
return []
|
|
43
|
+
counts = Counter(path.split("/", 1)[0] for path in manifest.files if "/" in path)
|
|
44
|
+
return sorted(counts.items())
|
|
45
|
+
|
|
46
|
+
def files_under(self, scope: str) -> list[str]:
|
|
47
|
+
manifest = self.manifest()
|
|
48
|
+
prefix = scope.rstrip("/") + "/"
|
|
49
|
+
return [path for path in manifest.files if path.startswith(prefix)] if manifest else []
|
|
50
|
+
|
|
51
|
+
def read_source(self, path: str) -> str | None:
|
|
52
|
+
"""The text of a visible file, or None when it isn't visible, isn't text, or is too large to show."""
|
|
53
|
+
manifest = self.manifest()
|
|
54
|
+
if manifest is None or path not in manifest.files:
|
|
55
|
+
return None
|
|
56
|
+
root = (self.data / "source").resolve()
|
|
57
|
+
file = (root / PurePosixPath(path)).resolve()
|
|
58
|
+
if not file.is_relative_to(root) or not file.is_file() or file.stat().st_size > MAX_SOURCE_BYTES:
|
|
59
|
+
return None
|
|
60
|
+
try:
|
|
61
|
+
return file.read_text(encoding="utf-8")
|
|
62
|
+
except UnicodeDecodeError:
|
|
63
|
+
return None
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
{% block title %}{{ _("Saved answers") }}{% endblock %}
|
|
3
|
+
{% block content %}
|
|
4
|
+
<div class="wide">
|
|
5
|
+
<header class="page-head">
|
|
6
|
+
<h1>{{ _("Saved answers") }}</h1>
|
|
7
|
+
<p class="muted">{{ _("Answers you saved to the guide, newest first. They aren't rewritten when the code changes; a mark shows when the files they were written from have changed.") }}</p>
|
|
8
|
+
</header>
|
|
9
|
+
{% if answers %}
|
|
10
|
+
<ul class="list">
|
|
11
|
+
{% for answer, changed in answers %}
|
|
12
|
+
<li><a class="grow" href="/pages/{{ answer.id }}" dir="auto">{{ answer.title }}</a>
|
|
13
|
+
{% if changed %}<span class="pill pill-changed">{{ _("sources changed") }}</span>{% endif %}
|
|
14
|
+
<span class="faint">{{ (answer.meta.get("asked_at") if answer.meta.get("asked_at") is string else "")[:10] }}</span></li>
|
|
15
|
+
{% endfor %}
|
|
16
|
+
</ul>
|
|
17
|
+
{% else %}
|
|
18
|
+
<section class="empty">
|
|
19
|
+
<h2>{{ _("Keep the answers worth keeping") }}</h2>
|
|
20
|
+
<p>{{ _("Ask a question from any page (press A), then choose Save to guide. Saved answers become part of the guide, and search finds them.") }}</p>
|
|
21
|
+
<button type="button" class="button primary" data-ask-open>{{ _("Ask a question") }}</button>
|
|
22
|
+
</section>
|
|
23
|
+
{% endif %}
|
|
24
|
+
</div>
|
|
25
|
+
{% endblock %}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
{% block title %}{{ scope }}{% endblock %}
|
|
3
|
+
{% block content %}
|
|
4
|
+
<div class="wide">
|
|
5
|
+
<header class="page-head">
|
|
6
|
+
<p class="eyebrow">{{ _("Folder") }}</p>
|
|
7
|
+
<h1 lang="en" dir="ltr">{{ scope }}/</h1>
|
|
8
|
+
<p class="muted">{% trans count=files|length %}{{ count }} visible file{% pluralize %}{{ count }} visible files{% endtrans %}</p>
|
|
9
|
+
</header>
|
|
10
|
+
|
|
11
|
+
{% if system.nodes %}
|
|
12
|
+
<section>
|
|
13
|
+
<div class="section-head"><h2>{{ _("Where it fits") }}</h2><a href="/system">{{ _("See the whole system") }}</a></div>
|
|
14
|
+
<p class="muted">{{ _("The parts in this folder and the parts they connect to.") }}</p>
|
|
15
|
+
{% with diagram=system %}{% include "diagram.html" %}{% include "system_legend.html" %}{% endwith %}
|
|
16
|
+
</section>
|
|
17
|
+
{% endif %}
|
|
18
|
+
|
|
19
|
+
{% for project, diagram in projects %}
|
|
20
|
+
<section>
|
|
21
|
+
<h2>{{ _("Dependencies of") }} <a href="/facts/{{ project.id|urlencode|replace("/", "%2F") }}" lang="en" dir="ltr">{{ project.attributes.get("name", project.id) }}</a></h2>
|
|
22
|
+
{% with diagram=diagram %}{% include "diagram.html" %}{% endwith %}
|
|
23
|
+
</section>
|
|
24
|
+
{% endfor %}
|
|
25
|
+
|
|
26
|
+
{% if imports.nodes %}
|
|
27
|
+
<section>
|
|
28
|
+
<h2>{{ _("Imports") }}</h2>
|
|
29
|
+
{% if imports.rolled_up %}<p class="muted">{{ _("Too many modules to show one by one: folders are shown, with the number of imports on each arrow.") }}</p>{% endif %}
|
|
30
|
+
{% with diagram=imports %}{% include "diagram.html" %}{% endwith %}
|
|
31
|
+
</section>
|
|
32
|
+
{% endif %}
|
|
33
|
+
|
|
34
|
+
{% if decisions %}
|
|
35
|
+
<section>
|
|
36
|
+
<h2>{{ _("Decisions") }}</h2>
|
|
37
|
+
<ul class="list" lang="en" dir="ltr">{% for decision in decisions %}<li><a class="grow" href="/facts/{{ decision.id|urlencode|replace("/", "%2F") }}">{{ decision.attributes.number }}. {{ decision.attributes.title }}</a></li>{% endfor %}</ul>
|
|
38
|
+
</section>
|
|
39
|
+
{% endif %}
|
|
40
|
+
|
|
41
|
+
<section>
|
|
42
|
+
<h2>{{ _("Files") }}</h2>
|
|
43
|
+
<ul class="files" lang="en" dir="ltr">{% for path in files %}<li><a href="/source/{{ path|urlencode }}">{{ path }}</a></li>{% endfor %}</ul>
|
|
44
|
+
</section>
|
|
45
|
+
</div>
|
|
46
|
+
{% endblock %}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{% from "macros.html" import cost with context %}{% from "layout/icons.html" import icon %}<!doctype html>
|
|
2
|
+
<html lang="{{ language.code }}" dir="{{ language.direction }}">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="codetrail-token" content="{{ token }}">
|
|
7
|
+
<meta name="color-scheme" content="light dark">
|
|
8
|
+
<title>{% block title %}{{ target }}{% endblock %} · Codetrail</title>
|
|
9
|
+
<link rel="icon" href="/static/brand/favicon.svg" type="image/svg+xml">
|
|
10
|
+
<link rel="preload" href="/static/vendor/inter/InterVariable.woff2" as="font" type="font/woff2" crossorigin>
|
|
11
|
+
<link rel="stylesheet" href="/static/css/tokens.css">
|
|
12
|
+
<link rel="stylesheet" href="/static/css/base.css">
|
|
13
|
+
<link rel="stylesheet" href="/static/css/layout.css">
|
|
14
|
+
<link rel="stylesheet" href="/static/css/components.css">
|
|
15
|
+
<link rel="stylesheet" href="/static/css/content.css">
|
|
16
|
+
<link rel="stylesheet" href="/static/css/print.css" media="print">
|
|
17
|
+
<script src="/static/js/theme-init.js"></script>
|
|
18
|
+
<script type="module" src="/static/js/main.js"></script>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<a class="skip-link" href="#content">{{ _("Skip to content") }}</a>
|
|
22
|
+
{% include "layout/header.html" %}
|
|
23
|
+
<div class="shell">
|
|
24
|
+
{% include "layout/sidebar.html" %}
|
|
25
|
+
<div class="page-area">
|
|
26
|
+
<main id="content" class="content" tabindex="-1">
|
|
27
|
+
{% block content %}{% endblock %}
|
|
28
|
+
</main>
|
|
29
|
+
{% include "layout/outline.html" %}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
{% include "layout/ask_panel.html" %}
|
|
33
|
+
{% include "layout/palette.html" %}
|
|
34
|
+
{% include "layout/shortcuts.html" %}
|
|
35
|
+
{% include "layout/update_dialog.html" %}
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
{% block title %}{{ _("Decisions") }}{% endblock %}
|
|
3
|
+
{% block content %}
|
|
4
|
+
<div class="wide">
|
|
5
|
+
<header class="page-head">
|
|
6
|
+
<h1>{{ _("Decisions") }}</h1>
|
|
7
|
+
<p class="muted">{{ _("The repository's architecture decision records, as Codetrail found them.") }}</p>
|
|
8
|
+
</header>
|
|
9
|
+
{% if decisions %}
|
|
10
|
+
<table class="decisions" lang="en" dir="ltr">
|
|
11
|
+
<thead><tr><th>#</th><th>Title</th><th>Status</th><th>Date</th></tr></thead>
|
|
12
|
+
<tbody>
|
|
13
|
+
{% for decision in decisions %}
|
|
14
|
+
<tr>
|
|
15
|
+
<td><a href="/facts/{{ decision.id|urlencode|replace("/", "%2F") }}">{{ decision.attributes.number }}</a></td>
|
|
16
|
+
<td><a href="/source/{{ decision.attributes.path|urlencode }}">{{ decision.attributes.title }}</a></td>
|
|
17
|
+
<td>{% if decision.attributes.get("status") %}<span class="pill">{{ decision.attributes.get("status", "") }}</span>{% endif %}</td>
|
|
18
|
+
<td class="faint">{{ decision.attributes.get("date", "") }}</td>
|
|
19
|
+
</tr>
|
|
20
|
+
{% endfor %}
|
|
21
|
+
</tbody>
|
|
22
|
+
</table>
|
|
23
|
+
{% else %}
|
|
24
|
+
<section class="empty">
|
|
25
|
+
<h2>{{ _("No decisions found") }}</h2>
|
|
26
|
+
<p>{{ _("Codetrail looks for architecture decision records where the target's settings say they live.") }}</p>
|
|
27
|
+
</section>
|
|
28
|
+
{% endif %}
|
|
29
|
+
</div>
|
|
30
|
+
{% endblock %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% from "layout/icons.html" import icon %}
|
|
2
|
+
<figure class="diagram-block" lang="en" dir="ltr" data-alt="{{ diagram.nodes|map(attribute='label')|join(', ') }}">
|
|
3
|
+
<div class="diagram-tools"><button type="button" class="icon-button" data-diagram-enlarge aria-pressed="false" aria-label="{{ _('Enlarge the diagram') }}" title="{{ _('Enlarge the diagram') }}">{{ icon("expand") }}</button></div>
|
|
4
|
+
<pre class="diagram">{{ diagram.d2 }}</pre>
|
|
5
|
+
<figcaption>
|
|
6
|
+
<details><summary>{{ _("What each box links to") }}</summary>
|
|
7
|
+
<ul>{% for node in diagram.nodes %}<li><a href="{{ node.link }}">{{ node.label }}</a></li>{% endfor %}</ul>
|
|
8
|
+
</details>
|
|
9
|
+
</figcaption>
|
|
10
|
+
</figure>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
{% block title %}{{ _("Digests") }}{% endblock %}
|
|
3
|
+
{% block content %}
|
|
4
|
+
<div class="wide">
|
|
5
|
+
<header class="page-head">
|
|
6
|
+
<h1>{{ _("Digests") }}</h1>
|
|
7
|
+
<p class="muted">{{ _("What changed in the repository at each update, and why, newest first.") }}</p>
|
|
8
|
+
</header>
|
|
9
|
+
{% if digests %}
|
|
10
|
+
<ul class="list" lang="en" dir="ltr">
|
|
11
|
+
{% for digest in digests %}
|
|
12
|
+
<li><a class="grow" href="/pages/{{ digest.id }}">{{ digest.title }}</a>
|
|
13
|
+
{% if digest.id in unread %}<span class="pill pill-read" lang="{{ language.code }}" dir="{{ language.direction }}">{{ _("unread") }}</span>{% endif %}
|
|
14
|
+
<span class="faint">{{ (digest.meta.get("written_at") if digest.meta.get("written_at") is string else "")[:10] }}</span></li>
|
|
15
|
+
{% endfor %}
|
|
16
|
+
</ul>
|
|
17
|
+
{% else %}
|
|
18
|
+
<section class="empty">
|
|
19
|
+
<h2>{{ _("No digests yet") }}</h2>
|
|
20
|
+
<p>{{ _("Each update writes a digest of what changed since the last one.") }}</p>
|
|
21
|
+
</section>
|
|
22
|
+
{% endif %}
|
|
23
|
+
</div>
|
|
24
|
+
{% endblock %}
|