machineconfig 7.64__py3-none-any.whl → 7.83__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.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/sessions_managers/utils/maker.py +4 -2
- machineconfig/jobs/installer/custom/yazi.py +120 -0
- machineconfig/jobs/installer/custom_dev/nerdfont.py +1 -1
- machineconfig/jobs/installer/custom_dev/nerfont_windows_helper.py +26 -12
- machineconfig/jobs/installer/custom_dev/sysabc.py +26 -5
- machineconfig/jobs/installer/installer_data.json +232 -96
- machineconfig/jobs/installer/powershell_scripts/install_fonts.ps1 +129 -34
- machineconfig/profile/create_helper.py +0 -12
- machineconfig/profile/create_links_export.py +2 -2
- machineconfig/profile/mapper.toml +2 -2
- machineconfig/scripts/__init__.py +0 -4
- machineconfig/scripts/python/agents.py +22 -17
- machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +4 -0
- machineconfig/scripts/python/croshell.py +22 -17
- machineconfig/scripts/python/devops.py +1 -1
- machineconfig/scripts/python/devops_navigator.py +0 -4
- machineconfig/scripts/python/env_manager/env_manager_tui.py +204 -0
- machineconfig/scripts/python/env_manager/path_manager_tui.py +1 -1
- machineconfig/scripts/python/fire_jobs.py +13 -13
- machineconfig/scripts/python/ftpx.py +36 -12
- machineconfig/scripts/python/helpers/ast_search.py +74 -0
- machineconfig/scripts/python/helpers/qr_code.py +166 -0
- machineconfig/scripts/python/helpers/repo_rag.py +325 -0
- machineconfig/scripts/python/helpers/symantic_search.py +25 -0
- machineconfig/scripts/python/helpers_cloud/cloud_copy.py +28 -21
- machineconfig/scripts/python/helpers_cloud/cloud_helpers.py +1 -1
- machineconfig/scripts/python/helpers_cloud/cloud_mount.py +19 -17
- machineconfig/scripts/python/helpers_cloud/cloud_sync.py +8 -7
- machineconfig/scripts/python/helpers_croshell/start_slidev.py +6 -7
- machineconfig/scripts/python/helpers_devops/cli_config.py +10 -0
- machineconfig/scripts/python/helpers_devops/cli_nw.py +90 -10
- machineconfig/scripts/python/helpers_devops/cli_self.py +8 -7
- machineconfig/scripts/python/helpers_devops/cli_share_file.py +7 -7
- machineconfig/scripts/python/helpers_devops/cli_share_server.py +12 -11
- machineconfig/scripts/python/helpers_devops/cli_terminal.py +8 -10
- machineconfig/scripts/python/helpers_devops/cli_utils.py +2 -1
- machineconfig/scripts/python/helpers_devops/devops_status.py +7 -19
- machineconfig/scripts/python/helpers_fire_command/fire_jobs_route_helper.py +20 -9
- machineconfig/scripts/python/helpers_msearch/scripts_linux/fzfg +2 -2
- machineconfig/scripts/python/helpers_msearch/scripts_windows/fzfg.ps1 +58 -1
- machineconfig/scripts/python/helpers_navigator/command_tree.py +50 -18
- machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py +5 -3
- machineconfig/scripts/python/helpers_repos/count_lines.py +40 -11
- machineconfig/scripts/python/helpers_repos/count_lines_frontend.py +1 -1
- machineconfig/scripts/python/helpers_utils/download.py +4 -3
- machineconfig/scripts/python/helpers_utils/path.py +87 -34
- machineconfig/scripts/python/interactive.py +1 -1
- machineconfig/scripts/python/{machineconfig.py → mcfg_entry.py} +4 -0
- machineconfig/scripts/python/msearch.py +55 -6
- machineconfig/scripts/python/nw/address.py +132 -0
- machineconfig/scripts/python/nw/devops_add_ssh_key.py +8 -5
- machineconfig/scripts/python/terminal.py +2 -2
- machineconfig/scripts/python/utils.py +12 -11
- machineconfig/scripts/windows/mounts/mount_ssh.ps1 +1 -1
- machineconfig/settings/lf/windows/lfcd.ps1 +1 -1
- machineconfig/settings/shells/nushell/config.nu +2 -2
- machineconfig/settings/shells/nushell/env.nu +45 -6
- machineconfig/settings/shells/nushell/init.nu +282 -95
- machineconfig/settings/shells/pwsh/init.ps1 +1 -0
- machineconfig/settings/yazi/init.lua +4 -0
- machineconfig/settings/yazi/keymap_linux.toml +11 -4
- machineconfig/settings/yazi/theme.toml +4 -0
- machineconfig/settings/yazi/yazi_linux.toml +84 -0
- machineconfig/settings/yazi/yazi_windows.toml +58 -0
- machineconfig/setup_linux/web_shortcuts/interactive.sh +10 -10
- machineconfig/setup_windows/uv.ps1 +8 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +10 -10
- machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +3 -2
- machineconfig/utils/accessories.py +7 -4
- machineconfig/utils/code.py +4 -2
- machineconfig/utils/installer_utils/github_release_bulk.py +104 -62
- machineconfig/utils/installer_utils/install_from_url.py +200 -0
- machineconfig/utils/installer_utils/installer_class.py +25 -74
- machineconfig/utils/installer_utils/installer_cli.py +40 -50
- machineconfig/utils/installer_utils/installer_helper.py +100 -0
- machineconfig/utils/installer_utils/installer_runner.py +5 -8
- machineconfig/utils/links.py +2 -2
- machineconfig/utils/meta.py +2 -2
- machineconfig/utils/options.py +3 -3
- machineconfig/utils/path_extended.py +1 -1
- machineconfig/utils/path_helper.py +0 -1
- machineconfig/utils/ssh.py +143 -409
- machineconfig/utils/ssh_utils/abc.py +8 -0
- machineconfig/utils/ssh_utils/copy_from_here.py +110 -0
- machineconfig/utils/ssh_utils/copy_to_here.py +302 -0
- machineconfig/utils/ssh_utils/utils.py +141 -0
- machineconfig/utils/ssh_utils/wsl.py +210 -0
- machineconfig/utils/upgrade_packages.py +2 -1
- machineconfig/utils/ve.py +11 -4
- {machineconfig-7.64.dist-info → machineconfig-7.83.dist-info}/METADATA +2 -2
- {machineconfig-7.64.dist-info → machineconfig-7.83.dist-info}/RECORD +96 -89
- {machineconfig-7.64.dist-info → machineconfig-7.83.dist-info}/entry_points.txt +2 -2
- machineconfig/scripts/python/explore.py +0 -49
- machineconfig/scripts/python/helpers_msearch/scripts_linux/fzfag +0 -17
- machineconfig/scripts/python/helpers_msearch/scripts_linux/fzfrga +0 -21
- machineconfig/scripts/python/helpers_msearch/scripts_linux/skrg +0 -4
- machineconfig/scripts/python/helpers_msearch/scripts_windows/fzfb.ps1 +0 -3
- machineconfig/scripts/python/helpers_msearch/scripts_windows/fzfrga.bat +0 -20
- machineconfig/settings/yazi/yazi.toml +0 -17
- machineconfig/setup_linux/others/cli_installation.sh +0 -137
- /machineconfig/{settings/shells/pwsh/profile.ps1 → scripts/python/helpers_fire_command/f.py} +0 -0
- /machineconfig/scripts/{Restore-ThunderbirdProfile.ps1 → windows/mounts/Restore-ThunderbirdProfile.ps1} +0 -0
- {machineconfig-7.64.dist-info → machineconfig-7.83.dist-info}/WHEEL +0 -0
- {machineconfig-7.64.dist-info → machineconfig-7.83.dist-info}/top_level.txt +0 -0
|
@@ -6,6 +6,19 @@ $objShell = New-Object -ComObject Shell.Application
|
|
|
6
6
|
$objFolder = $objShell.Namespace($FONTS)
|
|
7
7
|
$Fontdir = Get-ChildItem -Path $Path -File
|
|
8
8
|
|
|
9
|
+
$invalidCharPattern = "[{0}]" -f ([Regex]::Escape(([string]::Join('', [System.IO.Path]::GetInvalidFileNameChars()))))
|
|
10
|
+
|
|
11
|
+
function Get-FontBaseNameSafe {
|
|
12
|
+
param([string]$Input)
|
|
13
|
+
if ([string]::IsNullOrWhiteSpace($Input)) { return "" }
|
|
14
|
+
$candidate = ($Input -split ',')[0].Trim()
|
|
15
|
+
try { return [System.IO.Path]::GetFileNameWithoutExtension($candidate) }
|
|
16
|
+
catch {
|
|
17
|
+
$sanitized = [Regex]::Replace($candidate, $invalidCharPattern, '')
|
|
18
|
+
return ($sanitized -replace '\\.[^.]+$')
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
# Normalization helper: remove spaces, underscores, hyphens, 'nerd', 'font', and collapse 'nf' for broad matching
|
|
10
23
|
function Normalize-FontName {
|
|
11
24
|
param([string]$Name)
|
|
@@ -17,47 +30,129 @@ function Normalize-FontName {
|
|
|
17
30
|
return $n
|
|
18
31
|
}
|
|
19
32
|
|
|
33
|
+
function Get-FontIdentityForms {
|
|
34
|
+
param([string]$Name)
|
|
35
|
+
if ([string]::IsNullOrWhiteSpace($Name)) { return @() }
|
|
36
|
+
$normalized = Normalize-FontName $Name
|
|
37
|
+
if ([string]::IsNullOrWhiteSpace($normalized)) { return @() }
|
|
38
|
+
|
|
39
|
+
$forms = @()
|
|
40
|
+
$forms += $normalized
|
|
41
|
+
|
|
42
|
+
$stylePattern = '(regular|italic|oblique|bold|bolditalic|semibold|semilight|light|extrabold|extralight|medium|thin|black|book|ultra|heavy|demi|retina|condensed|narrow|windowscompatible|complete|windowscomp|compatibility)+$'
|
|
43
|
+
$stem = $normalized
|
|
44
|
+
while ($stem -match $stylePattern) {
|
|
45
|
+
$stem = [Regex]::Replace($stem, $stylePattern, '')
|
|
46
|
+
if ([string]::IsNullOrWhiteSpace($stem)) { break }
|
|
47
|
+
$forms += $stem
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
$stemForVariants = $stem
|
|
51
|
+
foreach ($tail in @('mono', 'propo')) {
|
|
52
|
+
$tmp = $stemForVariants
|
|
53
|
+
while (-not [string]::IsNullOrWhiteSpace($tmp) -and $tmp.EndsWith($tail)) {
|
|
54
|
+
$tmp = $tmp.Substring(0, $tmp.Length - $tail.Length)
|
|
55
|
+
if ([string]::IsNullOrWhiteSpace($tmp)) { break }
|
|
56
|
+
$forms += $tmp
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return ($forms | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } | Select-Object -Unique)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function Test-FontFormsOverlapFuzzy {
|
|
64
|
+
param(
|
|
65
|
+
[string[]]$CandidateForms,
|
|
66
|
+
[string[]]$ExistingForms
|
|
67
|
+
)
|
|
68
|
+
foreach ($candidate in $CandidateForms) {
|
|
69
|
+
if ([string]::IsNullOrWhiteSpace($candidate)) { continue }
|
|
70
|
+
foreach ($existing in $ExistingForms) {
|
|
71
|
+
if ([string]::IsNullOrWhiteSpace($existing)) { continue }
|
|
72
|
+
if ($existing.Contains($candidate) -or $candidate.Contains($existing)) { return $true }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return $false
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function Merge-UniqueForms {
|
|
79
|
+
param(
|
|
80
|
+
[string[]]$Existing,
|
|
81
|
+
[string[]]$Additional
|
|
82
|
+
)
|
|
83
|
+
return (($Existing + $Additional) | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } | Select-Object -Unique)
|
|
84
|
+
}
|
|
85
|
+
|
|
20
86
|
# Cache installed font basenames once (raw + normalized map)
|
|
21
87
|
$installedFontFiles = Get-ChildItem C:\Windows\Fonts -File
|
|
22
|
-
$installedFonts = @
|
|
23
|
-
foreach ($f in $installedFontFiles) {
|
|
88
|
+
$installedFonts = @()
|
|
89
|
+
foreach ($f in $installedFontFiles) {
|
|
90
|
+
$installedFonts = Merge-UniqueForms $installedFonts (Get-FontIdentityForms $f.BaseName)
|
|
91
|
+
}
|
|
24
92
|
|
|
25
|
-
|
|
93
|
+
$relatedInstalled = $installedFonts | Where-Object { $_ -match 'caskaydiacove|cascadiacode' } | Sort-Object | Get-Unique
|
|
94
|
+
Write-Host "Existing related fonts detected:" $relatedInstalled -ForegroundColor DarkGray
|
|
95
|
+
|
|
96
|
+
$registryFonts = @()
|
|
97
|
+
$fontReg = $null
|
|
98
|
+
try {
|
|
99
|
+
$fontReg = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -ErrorAction Stop
|
|
100
|
+
} catch {
|
|
101
|
+
Write-Host "Registry font list unavailable: $($_.Exception.Message)" -ForegroundColor DarkYellow
|
|
102
|
+
}
|
|
103
|
+
if ($null -ne $fontReg) {
|
|
104
|
+
foreach ($prop in $fontReg.PSObject.Properties) {
|
|
105
|
+
$val = ($prop.Value | Out-String).Trim()
|
|
106
|
+
$nm = ($prop.Name | Out-String).Trim()
|
|
107
|
+
$registryFonts = Merge-UniqueForms $registryFonts (Get-FontIdentityForms (Get-FontBaseNameSafe $val))
|
|
108
|
+
$registryFonts = Merge-UniqueForms $registryFonts (Get-FontIdentityForms (Get-FontBaseNameSafe $nm))
|
|
109
|
+
}
|
|
110
|
+
}
|
|
26
111
|
|
|
27
112
|
foreach ($File in $Fontdir) {
|
|
28
|
-
if ($File.Name -
|
|
29
|
-
$candidateRaw = $File.BaseName
|
|
30
|
-
$candidateNorm = Normalize-FontName $candidateRaw
|
|
31
|
-
|
|
32
|
-
# 1. Exact file existence check (handles .ttf/.otf pairs) before invoking Shell CopyHere.
|
|
33
|
-
$destFile = Join-Path -Path 'C:\Windows\Fonts' -ChildPath $File.Name
|
|
34
|
-
if (Test-Path -LiteralPath $destFile) { Write-Host "Skip (file exists) $($File.Name)" -ForegroundColor Green; continue }
|
|
35
|
-
|
|
36
|
-
# 2. Registry check: Fonts are registered under HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
|
|
37
|
-
try {
|
|
38
|
-
$fontReg = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -ErrorAction Stop
|
|
39
|
-
$regMatch = $false
|
|
40
|
-
foreach ($prop in $fontReg.PSObject.Properties) {
|
|
41
|
-
$val = ($prop.Value | Out-String).Trim()
|
|
42
|
-
$nm = ($prop.Name | Out-String).Trim()
|
|
43
|
-
$valNorm = Normalize-FontName ( [System.IO.Path]::GetFileNameWithoutExtension($val) )
|
|
44
|
-
$nmNorm = Normalize-FontName $nm
|
|
45
|
-
if ($valNorm -eq $candidateNorm -or $nmNorm -eq $candidateNorm -or $nmNorm -match [Regex]::Escape($candidateNorm)) { $regMatch = $true; break }
|
|
46
|
-
}
|
|
47
|
-
if ($regMatch) {
|
|
48
|
-
Write-Host "Skip (registry) $($File.Name)" -ForegroundColor Green
|
|
49
|
-
continue
|
|
50
|
-
}
|
|
51
|
-
} catch {
|
|
52
|
-
Write-Host "Registry font query failed: $($_.Exception.Message) (continuing)" -ForegroundColor DarkYellow
|
|
53
|
-
}
|
|
113
|
+
if ($File.Name -match 'pfb$') { continue }
|
|
54
114
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
115
|
+
$candidateForms = Get-FontIdentityForms $File.BaseName
|
|
116
|
+
if ($candidateForms.Count -eq 0) { $candidateForms = @(Normalize-FontName $File.BaseName) }
|
|
117
|
+
$candidateNorm = if ($candidateForms.Count -gt 0) { $candidateForms[0] } else { '' }
|
|
58
118
|
|
|
59
|
-
|
|
60
|
-
|
|
119
|
+
# 1. Exact file existence check (handles .ttf/.otf pairs) before invoking Shell CopyHere.
|
|
120
|
+
$destFile = Join-Path -Path 'C:\Windows\Fonts' -ChildPath $File.Name
|
|
121
|
+
if (Test-Path -LiteralPath $destFile) {
|
|
122
|
+
Write-Host "Skip (file exists) $($File.Name)" -ForegroundColor Green
|
|
123
|
+
$installedFonts = Merge-UniqueForms $installedFonts $candidateForms
|
|
124
|
+
continue
|
|
61
125
|
}
|
|
126
|
+
|
|
127
|
+
# 2. Registry check: Fonts are registered under HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
|
|
128
|
+
if ($registryFonts.Count -gt 0) {
|
|
129
|
+
$exactRegMatch = $candidateForms | Where-Object { $registryFonts -contains $_ }
|
|
130
|
+
if ($exactRegMatch.Count -gt 0) {
|
|
131
|
+
Write-Host "Skip (registry) $($File.Name)" -ForegroundColor Green
|
|
132
|
+
$installedFonts = Merge-UniqueForms $installedFonts $candidateForms
|
|
133
|
+
continue
|
|
134
|
+
}
|
|
135
|
+
if (Test-FontFormsOverlapFuzzy $candidateForms $registryFonts) {
|
|
136
|
+
Write-Host "Skip (registry family) $($File.Name)" -ForegroundColor Green
|
|
137
|
+
$installedFonts = Merge-UniqueForms $installedFonts $candidateForms
|
|
138
|
+
continue
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
# 3. Original heuristic set: in-memory list
|
|
143
|
+
if (($candidateForms | Where-Object { $installedFonts -contains $_ }).Count -gt 0) {
|
|
144
|
+
Write-Host "Skip (installed map) $($File.Name)" -ForegroundColor Green
|
|
145
|
+
$installedFonts = Merge-UniqueForms $installedFonts $candidateForms
|
|
146
|
+
continue
|
|
147
|
+
}
|
|
148
|
+
if (Test-FontFormsOverlapFuzzy $candidateForms $installedFonts) {
|
|
149
|
+
Write-Host "Skip (installed family) $($File.Name)" -ForegroundColor Green
|
|
150
|
+
$installedFonts = Merge-UniqueForms $installedFonts $candidateForms
|
|
151
|
+
continue
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Write-Host "Installing font (no matches) $($File.Name) | norm=$candidateNorm" -ForegroundColor Yellow
|
|
155
|
+
$objFolder.CopyHere($File.FullName)
|
|
156
|
+
$installedFonts = Merge-UniqueForms $installedFonts $candidateForms
|
|
62
157
|
}
|
|
63
158
|
Write-Host "Font installation script completed." -ForegroundColor Cyan
|
|
@@ -60,15 +60,3 @@ def copy_assets_to_machine(which: Literal["scripts", "settings"]) -> None:
|
|
|
60
60
|
scripts_path = CONFIG_ROOT.joinpath("scripts")
|
|
61
61
|
subprocess.run(f"chmod +x {scripts_path} -R", shell=True, capture_output=True, text=True, check=False)
|
|
62
62
|
console.print("[green]✅ Script permissions updated[/green]")
|
|
63
|
-
|
|
64
|
-
home_dir = Path.home()
|
|
65
|
-
if system_name == "windows":
|
|
66
|
-
yazi_plugins_dir = home_dir.joinpath("AppData", "Roaming", "yazi", "config")
|
|
67
|
-
else:
|
|
68
|
-
yazi_plugins_dir = home_dir.joinpath(".config", "yazi")
|
|
69
|
-
|
|
70
|
-
yazi_plugins_path = yazi_plugins_dir.joinpath("plugins")
|
|
71
|
-
if not yazi_plugins_path.exists():
|
|
72
|
-
yazi_plugins_dir.mkdir(parents=True, exist_ok=True)
|
|
73
|
-
import git
|
|
74
|
-
git.Repo.clone_from("https://github.com/yazi-rs/plugins", yazi_plugins_path)
|
|
@@ -62,8 +62,8 @@ def main_public_from_parser(method: Annotated[Literal["symlink", "s", "copy", "c
|
|
|
62
62
|
apply_mapper(mapper_data=items_objections, on_conflict=ON_CONFLICT_MAPPER[on_conflict], method=method)
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
def main_private_from_parser(method: Annotated[Literal["symlink", "s", "copy", "c"], typer.Option(..., help="Method to use for linking files")],
|
|
66
|
-
on_conflict: Annotated[ON_CONFLICT_LOOSE, typer.Option(..., help="Action to take on conflict")] = "throw-error",
|
|
65
|
+
def main_private_from_parser(method: Annotated[Literal["symlink", "s", "copy", "c"], typer.Option(..., "--method", "-m", help="Method to use for linking files")],
|
|
66
|
+
on_conflict: Annotated[ON_CONFLICT_LOOSE, typer.Option(..., "--on-conflict", "-o", help="Action to take on conflict")] = "throw-error",
|
|
67
67
|
which: Annotated[Optional[str], typer.Option(..., "--which", "-w", help="Specific items to process")] = "all",
|
|
68
68
|
interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Run in interactive mode")] = False):
|
|
69
69
|
from machineconfig.profile.create_links import ConfigMapper, read_mapper
|
|
@@ -94,7 +94,7 @@ config_again = {this = '~/.config/procs/config.toml', to_this = 'CONFIG_ROOT/set
|
|
|
94
94
|
config = {this = '~/.config/rofi/config.rasi', to_this = 'CONFIG_ROOT/settings/rofi/config.rasi'}
|
|
95
95
|
|
|
96
96
|
[yazi_windows]
|
|
97
|
-
yazi = {this = '~/AppData/Roaming/yazi/config/yazi.toml', to_this = 'CONFIG_ROOT/settings/yazi/
|
|
97
|
+
yazi = {this = '~/AppData/Roaming/yazi/config/yazi.toml', to_this = 'CONFIG_ROOT/settings/yazi/yazi_windows.toml'}
|
|
98
98
|
keymap = {this = '~/AppData/Roaming/yazi/config/keymap.toml', to_this = 'CONFIG_ROOT/settings/yazi/keymap_windows.toml'}
|
|
99
99
|
theme = {this = '~/AppData/Roaming/yazi/config/theme.toml', to_this = 'CONFIG_ROOT/settings/yazi/theme.toml'}
|
|
100
100
|
init = {this = '~/AppData/Roaming/yazi/config/init.lua', to_this = 'CONFIG_ROOT/settings/yazi/init.lua'}
|
|
@@ -102,7 +102,7 @@ init = {this = '~/AppData/Roaming/yazi/config/init.lua', to_this = 'CONFIG_ROOT/
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
[yazi_linux]
|
|
105
|
-
yazi = {this = '~/.config/yazi/yazi.toml', to_this = 'CONFIG_ROOT/settings/yazi/
|
|
105
|
+
yazi = {this = '~/.config/yazi/yazi.toml', to_this = 'CONFIG_ROOT/settings/yazi/yazi_linux.toml'}
|
|
106
106
|
keymap = {this = '~/.config/yazi/keymap.toml', to_this = 'CONFIG_ROOT/settings/yazi/keymap_linux.toml'}
|
|
107
107
|
theme = {this = '~/.config/yazi/theme.toml', to_this = 'CONFIG_ROOT/settings/yazi/theme.toml'}
|
|
108
108
|
init = {this = '~/.config/yazi/init.lua', to_this = 'CONFIG_ROOT/settings/yazi/init.lua'}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from pathlib import Path
|
|
6
5
|
from typing import cast, Optional, get_args, Annotated
|
|
7
6
|
import typer
|
|
8
7
|
from machineconfig.scripts.python.helpers_agents.fire_agents_helper_types import AGENTS, HOST, PROVIDER
|
|
@@ -13,22 +12,22 @@ def create(
|
|
|
13
12
|
host: Annotated[HOST, typer.Option(..., "--host", "-h", help=f"Machine to run agents on. One of {', '.join(get_args(HOST))}")],
|
|
14
13
|
model: Annotated[str, typer.Option(..., "--model", "-m", help="Model to use (for crush agent).")],
|
|
15
14
|
provider: Annotated[PROVIDER, typer.Option(..., "--provider", "-p", help=f"Provider to use (for crush agent). One of {', '.join(get_args(PROVIDER)[:3])}")],
|
|
16
|
-
context_path: Annotated[Optional[
|
|
15
|
+
context_path: Annotated[Optional[str], typer.Option(..., "--context-path", "-c", help="Path to the context file/folder, defaults to .ai/todo/")] = None,
|
|
17
16
|
separator: Annotated[str, typer.Option(..., "--separator", "-s", help="Separator for context")] = "\n",
|
|
18
17
|
agent_load: Annotated[int, typer.Option(..., "--agent-load", "-al", help="Number of tasks per prompt")] = 13,
|
|
19
18
|
prompt: Annotated[Optional[str], typer.Option(..., "--prompt", "-P", help="Prompt prefix as string")] = None,
|
|
20
|
-
prompt_path: Annotated[Optional[
|
|
19
|
+
prompt_path: Annotated[Optional[str], typer.Option(..., "--prompt-path", "-pp", help="Path to prompt file")] = None,
|
|
21
20
|
job_name: Annotated[str, typer.Option(..., "--job-name", "-j", help="Job name")] = "AI_Agents",
|
|
22
21
|
separate: Annotated[bool, typer.Option(..., "--separate", "-S", help="Keep prompt material in separate file to the context.")] = True,
|
|
23
|
-
output_path: Annotated[Optional[
|
|
24
|
-
agents_dir: Annotated[Optional[
|
|
22
|
+
output_path: Annotated[Optional[str], typer.Option(..., "--output-path", "-o", help="Path to write the layout.json file")] = None,
|
|
23
|
+
agents_dir: Annotated[Optional[str], typer.Option(..., "--agents-dir", "-ad", help="Directory to store agent files. If not provided, will be constructed automatically.")] = None,
|
|
25
24
|
):
|
|
26
25
|
|
|
27
26
|
from machineconfig.scripts.python.helpers_agents.fire_agents_help_launch import prep_agent_launch, get_agents_launch_layout
|
|
28
27
|
from machineconfig.scripts.python.helpers_agents.fire_agents_load_balancer import chunk_prompts
|
|
29
28
|
from machineconfig.utils.accessories import get_repo_root, randstr
|
|
30
29
|
import json
|
|
31
|
-
|
|
30
|
+
from pathlib import Path
|
|
32
31
|
# validate mutual exclusive
|
|
33
32
|
prompt_options = [prompt, prompt_path]
|
|
34
33
|
provided_prompt = [opt for opt in prompt_options if opt is not None]
|
|
@@ -39,12 +38,13 @@ def create(
|
|
|
39
38
|
if repo_root is None:
|
|
40
39
|
typer.echo("💥 Could not determine the repository root. Please run this script from within a git repository.")
|
|
41
40
|
raise typer.Exit(1)
|
|
41
|
+
return
|
|
42
42
|
typer.echo(f"Operating @ {repo_root}")
|
|
43
43
|
|
|
44
44
|
if context_path is None:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
context_path_resolved = Path(repo_root) / ".ai" / "todo"
|
|
46
|
+
else: context_path_resolved = Path(context_path).expanduser().resolve()
|
|
47
|
+
|
|
48
48
|
if not context_path_resolved.exists():
|
|
49
49
|
raise typer.BadParameter(f"Path does not exist: {context_path_resolved}")
|
|
50
50
|
|
|
@@ -60,20 +60,21 @@ def create(
|
|
|
60
60
|
raise typer.BadParameter(f"Path is neither file nor directory: {context_path_resolved}")
|
|
61
61
|
|
|
62
62
|
if prompt_path is not None:
|
|
63
|
-
prompt_prefix = prompt_path.read_text(encoding="utf-8")
|
|
63
|
+
prompt_prefix = Path(prompt_path).read_text(encoding="utf-8")
|
|
64
64
|
else:
|
|
65
65
|
prompt_prefix = cast(str, prompt)
|
|
66
66
|
agent_selected = agent
|
|
67
|
-
if agents_dir is None:
|
|
67
|
+
if agents_dir is None: agents_dir_obj = Path(repo_root) / ".ai" / f"tmp_prompts/{job_name}_{randstr()}"
|
|
68
68
|
else:
|
|
69
69
|
import shutil
|
|
70
|
-
if agents_dir.exists():
|
|
70
|
+
if Path(agents_dir).exists():
|
|
71
71
|
shutil.rmtree(agents_dir)
|
|
72
|
-
|
|
72
|
+
agents_dir_obj = Path(agents_dir)
|
|
73
|
+
prep_agent_launch(repo_root=repo_root, agents_dir=agents_dir_obj, prompts_material=prompt_material_re_splitted,
|
|
73
74
|
keep_material_in_separate_file=separate,
|
|
74
75
|
prompt_prefix=prompt_prefix, machine=host, agent=agent_selected, model=model, provider=provider,
|
|
75
76
|
job_name=job_name)
|
|
76
|
-
layoutfile = get_agents_launch_layout(session_root=
|
|
77
|
+
layoutfile = get_agents_launch_layout(session_root=agents_dir_obj)
|
|
77
78
|
regenerate_py_code = f"""
|
|
78
79
|
#!/usr/bin/env uv run --python 3.14 --with machineconfig
|
|
79
80
|
agents create "{context_path_resolved}" \\
|
|
@@ -85,11 +86,11 @@ agents create "{context_path_resolved}" \\
|
|
|
85
86
|
--separator "{separator}" \\
|
|
86
87
|
{"--separate" if separate else ""}
|
|
87
88
|
"""
|
|
88
|
-
(
|
|
89
|
-
layout_output_path = output_path if output_path is not None else
|
|
89
|
+
(agents_dir_obj / "aa_agents_relaunch.sh").write_text(data=regenerate_py_code, encoding="utf-8")
|
|
90
|
+
layout_output_path = Path(output_path) if output_path is not None else agents_dir_obj / "layout.json"
|
|
90
91
|
layout_output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
91
92
|
layout_output_path.write_text(data=json.dumps(layoutfile, indent=4), encoding="utf-8")
|
|
92
|
-
typer.echo(f"Created agents in {
|
|
93
|
+
typer.echo(f"Created agents in {agents_dir_obj}")
|
|
93
94
|
typer.echo(f"Ceated layout in {layout_output_path}")
|
|
94
95
|
|
|
95
96
|
|
|
@@ -99,6 +100,7 @@ def collect(
|
|
|
99
100
|
separator: Annotated[str, typer.Option(..., help="Separator to use when concatenating material files")] = "\n",
|
|
100
101
|
) -> None:
|
|
101
102
|
"""Collect all material files from an agent directory and concatenate them."""
|
|
103
|
+
from pathlib import Path
|
|
102
104
|
if not Path(agent_dir).exists() or not Path(agent_dir).is_dir():
|
|
103
105
|
raise typer.BadParameter(f"Agent directory does not exist or is not a directory: {agent_dir}")
|
|
104
106
|
|
|
@@ -137,6 +139,7 @@ def collect(
|
|
|
137
139
|
def template():
|
|
138
140
|
from platform import system
|
|
139
141
|
import machineconfig.scripts.python.helpers_agents as module
|
|
142
|
+
from pathlib import Path
|
|
140
143
|
if system() == "Linux" or system() == "Darwin":
|
|
141
144
|
template_path = Path(module.__file__).parent / "templates/template.sh"
|
|
142
145
|
elif system() == "Windows":
|
|
@@ -157,8 +160,10 @@ def template():
|
|
|
157
160
|
|
|
158
161
|
def init_config():
|
|
159
162
|
from machineconfig.scripts.python.ai.initai import add_ai_configs
|
|
163
|
+
from pathlib import Path
|
|
160
164
|
add_ai_configs(repo_root=Path.cwd())
|
|
161
165
|
|
|
166
|
+
|
|
162
167
|
def get_app():
|
|
163
168
|
agents_app = typer.Typer(help="🤖 AI Agents management subcommands", no_args_is_help=True, add_help_option=False, add_completion=False)
|
|
164
169
|
sep = "\n"
|
|
@@ -40,6 +40,10 @@ applyTo: "**/*.py"
|
|
|
40
40
|
* Make sure all the code is rigorous, no lazy stuff.
|
|
41
41
|
* For example, always avoid default values in arguments of functions. Those are evil and cause confusion. Always be explicit in parameter passing.
|
|
42
42
|
* Please never ever attempt to change code files by writing meta code to do string manipulation on files, e.g. with `sed` command with terminal. Please do change the files one by one, no matter how many there is. Don't worry about time, nor context window size, its okay, take your time and do the legwork. You can stop in the middle and we will have another LLM to help with the rest.
|
|
43
|
+
* Your code is minimal, no unrequested features, no bloat.
|
|
43
44
|
* Please avoid writing README files and avoid docstring and comments in code unless absolutely necessary. Use clear naming conventions instead of documenting.
|
|
44
45
|
* Always prefer to functional style of programming over OOP.
|
|
45
46
|
* When passing arguments or constructing dicts or lists or tuples, avoid breaking lines too much, try to use ~ 150 characters per line before breaking to new one.
|
|
47
|
+
|
|
48
|
+
# Privacy:
|
|
49
|
+
* No matter what, never ever open/read/write/list anything under ~/dotfiles
|
|
@@ -16,13 +16,15 @@ def croshell(
|
|
|
16
16
|
jupyter: Annotated[bool, typer.Option("--jupyter", "-j", help="run in jupyter interactive console")] = False,
|
|
17
17
|
vscode: Annotated[bool, typer.Option("--vscode", "-c", help="open the script in vscode")] = False,
|
|
18
18
|
# streamlit_viewer: Annotated[bool, typer.Option("--streamlit", "-s", help="view in streamlit app")] = False,
|
|
19
|
+
uv_with: Annotated[Optional[str], typer.Option("--uv-with", "-w", help="specify uv with packages to use")] = None,
|
|
19
20
|
visidata: Annotated[bool, typer.Option("--visidata", "-v", help="open data file in visidata")] = False,
|
|
20
21
|
marimo: Annotated[bool, typer.Option("--marimo", "-m", help="open the notebook using marimo if available")] = False,
|
|
21
22
|
) -> None:
|
|
23
|
+
if uv_with is not None: user_uv_with_line = f"--with {uv_with} "
|
|
24
|
+
else: user_uv_with_line = ""
|
|
25
|
+
|
|
22
26
|
from machineconfig.scripts.python.helpers_croshell.crosh import get_read_python_file_pycode, get_read_data_pycode
|
|
23
27
|
from machineconfig.utils.meta import lambda_to_python_script
|
|
24
|
-
from machineconfig.utils.path_helper import get_choice_file
|
|
25
|
-
from machineconfig.utils.path_extended import PathExtended
|
|
26
28
|
from pathlib import Path
|
|
27
29
|
from machineconfig.utils.accessories import randstr
|
|
28
30
|
import json
|
|
@@ -37,13 +39,15 @@ def croshell(
|
|
|
37
39
|
ipython_profile: Optional[str] = profile
|
|
38
40
|
file_obj = Path.cwd() # initialization value, could be modified according to args.
|
|
39
41
|
if path is not None:
|
|
42
|
+
from machineconfig.utils.path_helper import get_choice_file
|
|
40
43
|
choice_file = get_choice_file(path=path, suffixes={".*"})
|
|
41
44
|
if choice_file.suffix == ".py":
|
|
42
45
|
program = choice_file.read_text(encoding="utf-8")
|
|
43
46
|
text = f"📄 Selected file: {choice_file.name}"
|
|
44
47
|
console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
45
48
|
else:
|
|
46
|
-
program = lambda_to_python_script(lambda: get_read_data_pycode(path=str(choice_file)),
|
|
49
|
+
program = lambda_to_python_script(lambda: get_read_data_pycode(path=str(choice_file)),
|
|
50
|
+
in_global=True, import_module=False)
|
|
47
51
|
text = f"📄 Reading data from: {file_obj.name}"
|
|
48
52
|
console.print(Panel(text, title="[bold blue]Info[/bold blue]"))
|
|
49
53
|
else: # if nothing is specified, then run in interactive mode.
|
|
@@ -64,11 +68,12 @@ def croshell(
|
|
|
64
68
|
return textwrap.dedent("\n".join(inspect.getsource(f).splitlines()[1:]))
|
|
65
69
|
preprogram += get_body_simple_function_no_args(preprogram_func)
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
from pathlib import Path
|
|
72
|
+
pyfile = Path.home().joinpath(f"tmp_results/tmp_scripts/python/croshell/{randstr()}/script.py")
|
|
68
73
|
pyfile.parent.mkdir(parents=True, exist_ok=True)
|
|
69
|
-
|
|
70
74
|
title = "Reading Data"
|
|
71
|
-
def_code = lambda_to_python_script(lambda: get_read_python_file_pycode(path=str(pyfile), title=title),
|
|
75
|
+
def_code = lambda_to_python_script(lambda: get_read_python_file_pycode(path=str(pyfile), title=title),
|
|
76
|
+
in_global=False, import_module=False)
|
|
72
77
|
# print(def_code)
|
|
73
78
|
python_program = preprogram + "\n\n" + def_code + program
|
|
74
79
|
pyfile.write_text(python_program, encoding="utf-8")
|
|
@@ -102,37 +107,37 @@ def croshell(
|
|
|
102
107
|
pass
|
|
103
108
|
if visidata:
|
|
104
109
|
if file_obj.suffix == ".json":
|
|
105
|
-
fire_line = f"uv run --python 3.14 --with visidata vd {str(file_obj)}"
|
|
110
|
+
fire_line = f"uv run --python 3.14 {user_uv_with_line} --with visidata vd {str(file_obj)}"
|
|
106
111
|
else:
|
|
107
|
-
fire_line = f"uv run --python 3.14 --with visidata,pyarrow vd {str(file_obj)}"
|
|
112
|
+
fire_line = f"uv run --python 3.14 {user_uv_with_line}--with visidata,pyarrow vd {str(file_obj)}"
|
|
108
113
|
elif marimo:
|
|
109
|
-
if Path.home().joinpath("code/machineconfig").exists(): requirements = f"""--with marimo --project "{str(Path.home().joinpath("code/machineconfig"))}" """
|
|
110
|
-
else: requirements = """--python 3.14 --with "marimo,cowsay,machineconfig[plot]>=7.
|
|
114
|
+
if Path.home().joinpath("code/machineconfig").exists(): requirements = f"""{user_uv_with_line} --with marimo --project "{str(Path.home().joinpath("code/machineconfig"))}" """
|
|
115
|
+
else: requirements = f"""--python 3.14 {user_uv_with_line} user_uv_with_line--with "marimo,cowsay,machineconfig[plot]>=7.83" """
|
|
111
116
|
fire_line = f"""
|
|
112
117
|
cd {str(pyfile.parent)}
|
|
113
118
|
uv run --python 3.14 --with "marimo" marimo convert {pyfile.name} -o marimo_nb.py
|
|
114
119
|
uv run {requirements} marimo edit --host 0.0.0.0 marimo_nb.py
|
|
115
120
|
"""
|
|
116
121
|
elif jupyter:
|
|
117
|
-
if Path.home().joinpath("code/machineconfig").exists(): requirements = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}"
|
|
118
|
-
else: requirements = """--with "cowsay,machineconfig[plot]>=7.
|
|
122
|
+
if Path.home().joinpath("code/machineconfig").exists(): requirements = f"""{user_uv_with_line} --with jupyterlab --project "{str(Path.home().joinpath("code/machineconfig"))}" """
|
|
123
|
+
else: requirements = f"""{user_uv_with_line} --with "cowsay,machineconfig[plot]>=7.83" """
|
|
119
124
|
fire_line = f"uv run {requirements} jupyter-lab {str(nb_target)}"
|
|
120
125
|
elif vscode:
|
|
126
|
+
user_uv_add = f"uv add {uv_with}" if uv_with is not None else ""
|
|
121
127
|
fire_line = f"""
|
|
122
128
|
cd {str(pyfile.parent)}
|
|
123
129
|
uv init --python 3.14
|
|
124
130
|
uv venv
|
|
125
|
-
uv add "cowsay,machineconfig[plot]>=7.
|
|
131
|
+
uv add "cowsay,machineconfig[plot]>=7.83"
|
|
132
|
+
uv add {user_uv_add}
|
|
126
133
|
# code serve-web
|
|
127
134
|
code --new-window {str(pyfile)}
|
|
128
135
|
"""
|
|
129
136
|
else:
|
|
130
137
|
if interpreter == "ipython": profile = f" --profile {ipython_profile} --no-banner"
|
|
131
138
|
else: profile = ""
|
|
132
|
-
if Path.home().joinpath("code/machineconfig").exists(): ve_line = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}" """
|
|
133
|
-
else: ve_line = """--python 3.14 --with "cowsay,machineconfig[plot]>=7.
|
|
134
|
-
# ve_path_maybe, ipython_profile_maybe = get_ve_path_and_ipython_profile(Path.cwd())
|
|
135
|
-
# --python 3.14
|
|
139
|
+
if Path.home().joinpath("code/machineconfig").exists(): ve_line = f"""{user_uv_with_line} --project "{str(Path.home().joinpath("code/machineconfig"))}" """
|
|
140
|
+
else: ve_line = f"""--python 3.14 {user_uv_with_line} --with "cowsay,machineconfig[plot]>=7.83" """
|
|
136
141
|
fire_line = f"uv run {ve_line} {interpreter} {interactivity} {profile} {str(pyfile)}"
|
|
137
142
|
|
|
138
143
|
from machineconfig.utils.code import exit_then_run_shell_script
|
|
@@ -16,7 +16,7 @@ def install(which: Annotated[Optional[str], typer.Argument(..., help="Comma-sepa
|
|
|
16
16
|
) -> None:
|
|
17
17
|
"""📦 Install packages"""
|
|
18
18
|
import machineconfig.utils.installer_utils.installer_cli as installer_entry_point
|
|
19
|
-
installer_entry_point.
|
|
19
|
+
installer_entry_point.main_installer_cli(which=which, group=group, interactive=interactive)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def get_app():
|