@pilllesss/yorn 1.0.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/README.md +84 -0
- package/dist/modes/interactive/theme/dark.json +90 -0
- package/dist/modes/interactive/theme/light.json +89 -0
- package/dist/modes/interactive/theme/theme-schema.json +352 -0
- package/dist/providers/data/.manifest.json +1 -0
- package/dist/providers/data/amazon-bedrock.json +1 -0
- package/dist/providers/data/ant-ling.json +1 -0
- package/dist/providers/data/anthropic.json +1 -0
- package/dist/providers/data/azure-openai-responses.json +1 -0
- package/dist/providers/data/baseten.json +1 -0
- package/dist/providers/data/cerebras.json +1 -0
- package/dist/providers/data/cloudflare-ai-gateway.json +1 -0
- package/dist/providers/data/cloudflare-workers-ai.json +1 -0
- package/dist/providers/data/deepseek.json +1 -0
- package/dist/providers/data/fireworks.json +1 -0
- package/dist/providers/data/github-copilot.json +1 -0
- package/dist/providers/data/google-vertex.json +1 -0
- package/dist/providers/data/google.json +1 -0
- package/dist/providers/data/groq.json +1 -0
- package/dist/providers/data/huggingface.json +1 -0
- package/dist/providers/data/kimi-coding.json +1 -0
- package/dist/providers/data/minimax-cn.json +1 -0
- package/dist/providers/data/minimax.json +1 -0
- package/dist/providers/data/mistral.json +1 -0
- package/dist/providers/data/moonshotai-cn.json +1 -0
- package/dist/providers/data/moonshotai.json +1 -0
- package/dist/providers/data/nvidia.json +1 -0
- package/dist/providers/data/openai-codex.json +1 -0
- package/dist/providers/data/openai.json +1 -0
- package/dist/providers/data/opencode-go.json +1 -0
- package/dist/providers/data/opencode.json +1 -0
- package/dist/providers/data/openrouter.json +1 -0
- package/dist/providers/data/qwen-token-plan-cn.json +1 -0
- package/dist/providers/data/qwen-token-plan-individual.json +1 -0
- package/dist/providers/data/qwen-token-plan.json +1 -0
- package/dist/providers/data/together.json +1 -0
- package/dist/providers/data/vercel-ai-gateway.json +1 -0
- package/dist/providers/data/xai.json +1 -0
- package/dist/providers/data/xiaomi-token-plan-ams.json +1 -0
- package/dist/providers/data/xiaomi-token-plan-cn.json +1 -0
- package/dist/providers/data/xiaomi-token-plan-sgp.json +1 -0
- package/dist/providers/data/xiaomi.json +1 -0
- package/dist/providers/data/zai-coding-cn.json +1 -0
- package/dist/providers/data/zai.json +1 -0
- package/dist/skills/add-provider/SKILL.md +151 -0
- package/dist/skills/agent-browser/SKILL.md +51 -0
- package/dist/skills/frontend-design/LICENSE.txt +177 -0
- package/dist/skills/frontend-design/SKILL.md +55 -0
- package/dist/skills/goal/SKILL.md +44 -0
- package/dist/skills/goal/pyproject.toml +17 -0
- package/dist/skills/goal/src/goal/__init__.py +52 -0
- package/dist/skills/graphify/SKILL.md +710 -0
- package/dist/skills/graphify/references/add-watch.md +56 -0
- package/dist/skills/graphify/references/exports.md +87 -0
- package/dist/skills/graphify/references/extraction-spec.md +70 -0
- package/dist/skills/graphify/references/github-and-merge.md +46 -0
- package/dist/skills/graphify/references/hooks.md +33 -0
- package/dist/skills/graphify/references/query.md +311 -0
- package/dist/skills/graphify/references/transcribe.md +52 -0
- package/dist/skills/graphify/references/update.md +210 -0
- package/dist/skills/screenshot/SKILL.md +267 -0
- package/dist/skills/screenshot/scripts/ensure_macos_permissions.sh +54 -0
- package/dist/skills/screenshot/scripts/macos_display_info.swift +22 -0
- package/dist/skills/screenshot/scripts/macos_permissions.swift +40 -0
- package/dist/skills/screenshot/scripts/macos_window_info.swift +126 -0
- package/dist/skills/screenshot/scripts/take_screenshot.ps1 +163 -0
- package/dist/skills/screenshot/scripts/take_screenshot.py +585 -0
- package/dist/skills/security-best-practices/LICENSE.txt +201 -0
- package/dist/skills/security-best-practices/SKILL.md +86 -0
- package/dist/skills/security-best-practices/agents/openai.yaml +4 -0
- package/dist/skills/security-best-practices/references/golang-general-backend-security.md +826 -0
- package/dist/skills/security-best-practices/references/javascript-express-web-server-security.md +1158 -0
- package/dist/skills/security-best-practices/references/javascript-general-web-frontend-security.md +747 -0
- package/dist/skills/security-best-practices/references/javascript-jquery-web-frontend-security.md +678 -0
- package/dist/skills/security-best-practices/references/javascript-typescript-nextjs-web-server-security.md +1144 -0
- package/dist/skills/security-best-practices/references/javascript-typescript-react-web-frontend-security.md +990 -0
- package/dist/skills/security-best-practices/references/javascript-typescript-vue-web-frontend-security.md +791 -0
- package/dist/skills/security-best-practices/references/python-django-web-server-security.md +882 -0
- package/dist/skills/security-best-practices/references/python-fastapi-web-server-security.md +1036 -0
- package/dist/skills/security-best-practices/references/python-flask-web-server-security.md +705 -0
- package/dist/skills/theme-factory/LICENSE.txt +202 -0
- package/dist/skills/theme-factory/SKILL.md +59 -0
- package/dist/skills/theme-factory/theme-showcase.pdf +0 -0
- package/dist/skills/theme-factory/themes/arctic-frost.md +19 -0
- package/dist/skills/theme-factory/themes/botanical-garden.md +19 -0
- package/dist/skills/theme-factory/themes/desert-rose.md +19 -0
- package/dist/skills/theme-factory/themes/forest-canopy.md +19 -0
- package/dist/skills/theme-factory/themes/golden-hour.md +19 -0
- package/dist/skills/theme-factory/themes/midnight-galaxy.md +19 -0
- package/dist/skills/theme-factory/themes/modern-minimalist.md +19 -0
- package/dist/skills/theme-factory/themes/ocean-depths.md +19 -0
- package/dist/skills/theme-factory/themes/sunset-boulevard.md +19 -0
- package/dist/skills/theme-factory/themes/tech-innovation.md +19 -0
- package/dist/yorn.cjs +1773 -0
- package/package.json +86 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import AppKit
|
|
2
|
+
import CoreGraphics
|
|
3
|
+
import Foundation
|
|
4
|
+
|
|
5
|
+
struct Bounds: Encodable {
|
|
6
|
+
let x: Int
|
|
7
|
+
let y: Int
|
|
8
|
+
let width: Int
|
|
9
|
+
let height: Int
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
struct WindowInfo: Encodable {
|
|
13
|
+
let id: Int
|
|
14
|
+
let owner: String
|
|
15
|
+
let name: String
|
|
16
|
+
let layer: Int
|
|
17
|
+
let bounds: Bounds
|
|
18
|
+
let area: Int
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
struct Response: Encodable {
|
|
22
|
+
let count: Int
|
|
23
|
+
let selected: WindowInfo?
|
|
24
|
+
let windows: [WindowInfo]?
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
func value(for flag: String) -> String? {
|
|
28
|
+
guard let idx = CommandLine.arguments.firstIndex(of: flag) else {
|
|
29
|
+
return nil
|
|
30
|
+
}
|
|
31
|
+
let next = CommandLine.arguments.index(after: idx)
|
|
32
|
+
guard next < CommandLine.arguments.endIndex else {
|
|
33
|
+
return nil
|
|
34
|
+
}
|
|
35
|
+
return CommandLine.arguments[next]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let frontmostFlag = CommandLine.arguments.contains("--frontmost")
|
|
39
|
+
let explicitApp = value(for: "--app")
|
|
40
|
+
let frontmostName = frontmostFlag ? NSWorkspace.shared.frontmostApplication?.localizedName : nil
|
|
41
|
+
if frontmostFlag && frontmostName == nil {
|
|
42
|
+
fputs("{\"count\":0}\n", stderr)
|
|
43
|
+
exit(1)
|
|
44
|
+
}
|
|
45
|
+
let appFilter = (explicitApp ?? frontmostName)?.lowercased()
|
|
46
|
+
let nameFilter = value(for: "--window-name")?.lowercased()
|
|
47
|
+
let includeList = CommandLine.arguments.contains("--list")
|
|
48
|
+
|
|
49
|
+
let options: CGWindowListOption = [.optionOnScreenOnly, .excludeDesktopElements]
|
|
50
|
+
guard let raw = CGWindowListCopyWindowInfo(options, kCGNullWindowID) as? [[String: Any]] else {
|
|
51
|
+
fputs("{\"count\":0}\n", stderr)
|
|
52
|
+
exit(1)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var exactMatches: [WindowInfo] = []
|
|
56
|
+
var partialMatches: [WindowInfo] = []
|
|
57
|
+
exactMatches.reserveCapacity(raw.count)
|
|
58
|
+
partialMatches.reserveCapacity(raw.count)
|
|
59
|
+
|
|
60
|
+
for entry in raw {
|
|
61
|
+
guard let owner = entry[kCGWindowOwnerName as String] as? String else { continue }
|
|
62
|
+
let ownerLower = owner.lowercased()
|
|
63
|
+
if let appFilter, !ownerLower.contains(appFilter) { continue }
|
|
64
|
+
|
|
65
|
+
let name = (entry[kCGWindowName as String] as? String) ?? ""
|
|
66
|
+
if let nameFilter, !name.lowercased().contains(nameFilter) { continue }
|
|
67
|
+
|
|
68
|
+
guard let number = entry[kCGWindowNumber as String] as? Int else { continue }
|
|
69
|
+
let layer = (entry[kCGWindowLayer as String] as? Int) ?? 0
|
|
70
|
+
|
|
71
|
+
guard let boundsDict = entry[kCGWindowBounds as String] as? [String: Any] else { continue }
|
|
72
|
+
let x = Int((boundsDict["X"] as? Double) ?? 0)
|
|
73
|
+
let y = Int((boundsDict["Y"] as? Double) ?? 0)
|
|
74
|
+
let width = Int((boundsDict["Width"] as? Double) ?? 0)
|
|
75
|
+
let height = Int((boundsDict["Height"] as? Double) ?? 0)
|
|
76
|
+
if width <= 0 || height <= 0 { continue }
|
|
77
|
+
|
|
78
|
+
let bounds = Bounds(x: x, y: y, width: width, height: height)
|
|
79
|
+
let area = width * height
|
|
80
|
+
let info = WindowInfo(id: number, owner: owner, name: name, layer: layer, bounds: bounds, area: area)
|
|
81
|
+
if let appFilter, ownerLower == appFilter {
|
|
82
|
+
exactMatches.append(info)
|
|
83
|
+
} else {
|
|
84
|
+
partialMatches.append(info)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let windows: [WindowInfo]
|
|
89
|
+
if appFilter != nil && !exactMatches.isEmpty {
|
|
90
|
+
windows = exactMatches
|
|
91
|
+
} else {
|
|
92
|
+
windows = partialMatches
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
func rank(_ window: WindowInfo) -> (Int, Int) {
|
|
96
|
+
// Prefer normal-layer windows, then larger area.
|
|
97
|
+
let layerScore = window.layer == 0 ? 0 : 1
|
|
98
|
+
return (layerScore, -window.area)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
let ordered: [WindowInfo]
|
|
102
|
+
if frontmostFlag {
|
|
103
|
+
ordered = windows
|
|
104
|
+
} else {
|
|
105
|
+
ordered = windows.sorted { rank($0) < rank($1) }
|
|
106
|
+
}
|
|
107
|
+
let selected = ordered.first
|
|
108
|
+
|
|
109
|
+
let list: [WindowInfo]?
|
|
110
|
+
if includeList {
|
|
111
|
+
list = ordered
|
|
112
|
+
} else {
|
|
113
|
+
list = nil
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let response = Response(count: windows.count, selected: selected, windows: list)
|
|
117
|
+
let encoder = JSONEncoder()
|
|
118
|
+
encoder.outputFormatting = [.sortedKeys]
|
|
119
|
+
|
|
120
|
+
if let data = try? encoder.encode(response),
|
|
121
|
+
let json = String(data: data, encoding: .utf8) {
|
|
122
|
+
print(json)
|
|
123
|
+
} else {
|
|
124
|
+
fputs("{\"count\":\(windows.count)}\n", stderr)
|
|
125
|
+
exit(1)
|
|
126
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[string]$Path,
|
|
3
|
+
[ValidateSet("default", "temp")][string]$Mode = "default",
|
|
4
|
+
[string]$Format = "png",
|
|
5
|
+
[string]$Region,
|
|
6
|
+
[switch]$ActiveWindow,
|
|
7
|
+
[int]$WindowHandle
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
Set-StrictMode -Version Latest
|
|
11
|
+
$ErrorActionPreference = "Stop"
|
|
12
|
+
|
|
13
|
+
function Get-Timestamp {
|
|
14
|
+
Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Get-DefaultDirectory {
|
|
18
|
+
$home = [Environment]::GetFolderPath("UserProfile")
|
|
19
|
+
$pictures = Join-Path $home "Pictures"
|
|
20
|
+
$screenshots = Join-Path $pictures "Screenshots"
|
|
21
|
+
if (Test-Path $screenshots) { return $screenshots }
|
|
22
|
+
if (Test-Path $pictures) { return $pictures }
|
|
23
|
+
return $home
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function New-DefaultFilename {
|
|
27
|
+
param([string]$Prefix)
|
|
28
|
+
if (-not $Prefix) { $Prefix = "screenshot" }
|
|
29
|
+
"$Prefix-$(Get-Timestamp).$Format"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function Resolve-OutputPath {
|
|
33
|
+
if ($Path) {
|
|
34
|
+
$expanded = [Environment]::ExpandEnvironmentVariables($Path)
|
|
35
|
+
$homeDir = [Environment]::GetFolderPath("UserProfile")
|
|
36
|
+
if ($expanded -eq "~") {
|
|
37
|
+
$expanded = $homeDir
|
|
38
|
+
} elseif ($expanded.StartsWith("~/") -or $expanded.StartsWith("~\\")) {
|
|
39
|
+
$expanded = Join-Path $homeDir $expanded.Substring(2)
|
|
40
|
+
}
|
|
41
|
+
$full = [System.IO.Path]::GetFullPath($expanded)
|
|
42
|
+
if ((Test-Path $full) -and (Get-Item $full).PSIsContainer) {
|
|
43
|
+
$full = Join-Path $full (New-DefaultFilename "")
|
|
44
|
+
} elseif (($expanded.EndsWith("\") -or $expanded.EndsWith("/")) -and -not (Test-Path $full)) {
|
|
45
|
+
New-Item -ItemType Directory -Path $full -Force | Out-Null
|
|
46
|
+
$full = Join-Path $full (New-DefaultFilename "")
|
|
47
|
+
} elseif ([System.IO.Path]::GetExtension($full) -eq "") {
|
|
48
|
+
$full = "$full.$Format"
|
|
49
|
+
}
|
|
50
|
+
$parent = Split-Path -Parent $full
|
|
51
|
+
if ($parent) {
|
|
52
|
+
New-Item -ItemType Directory -Path $parent -Force | Out-Null
|
|
53
|
+
}
|
|
54
|
+
return $full
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if ($Mode -eq "temp") {
|
|
58
|
+
$tmp = [System.IO.Path]::GetTempPath()
|
|
59
|
+
return Join-Path $tmp (New-DefaultFilename "codex-shot")
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$dest = Get-DefaultDirectory
|
|
63
|
+
return Join-Path $dest (New-DefaultFilename "")
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function Parse-Region {
|
|
67
|
+
if (-not $Region) { return $null }
|
|
68
|
+
$parts = $Region.Split(",") | ForEach-Object { $_.Trim() }
|
|
69
|
+
if ($parts.Length -ne 4) {
|
|
70
|
+
throw "Region must be x,y,w,h"
|
|
71
|
+
}
|
|
72
|
+
$values = $parts | ForEach-Object {
|
|
73
|
+
$out = 0
|
|
74
|
+
if (-not [int]::TryParse($_, [ref]$out)) {
|
|
75
|
+
throw "Region values must be integers"
|
|
76
|
+
}
|
|
77
|
+
$out
|
|
78
|
+
}
|
|
79
|
+
if ($values[2] -le 0 -or $values[3] -le 0) {
|
|
80
|
+
throw "Region width and height must be positive"
|
|
81
|
+
}
|
|
82
|
+
return $values
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if ($Region -and $ActiveWindow) {
|
|
86
|
+
throw "Choose either -Region or -ActiveWindow"
|
|
87
|
+
}
|
|
88
|
+
if ($Region -and $WindowHandle) {
|
|
89
|
+
throw "Choose either -Region or -WindowHandle"
|
|
90
|
+
}
|
|
91
|
+
if ($ActiveWindow -and $WindowHandle) {
|
|
92
|
+
throw "Choose either -ActiveWindow or -WindowHandle"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$regionValues = Parse-Region
|
|
96
|
+
$outputPath = Resolve-OutputPath
|
|
97
|
+
|
|
98
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
99
|
+
Add-Type -AssemblyName System.Drawing
|
|
100
|
+
|
|
101
|
+
$imageFormat = switch ($Format.ToLowerInvariant()) {
|
|
102
|
+
"png" { [System.Drawing.Imaging.ImageFormat]::Png }
|
|
103
|
+
"jpg" { [System.Drawing.Imaging.ImageFormat]::Jpeg }
|
|
104
|
+
"jpeg" { [System.Drawing.Imaging.ImageFormat]::Jpeg }
|
|
105
|
+
"bmp" { [System.Drawing.Imaging.ImageFormat]::Bmp }
|
|
106
|
+
default { throw "Unsupported format: $Format" }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Add-Type @"
|
|
110
|
+
using System;
|
|
111
|
+
using System.Runtime.InteropServices;
|
|
112
|
+
public static class NativeMethods {
|
|
113
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
114
|
+
public struct RECT {
|
|
115
|
+
public int Left;
|
|
116
|
+
public int Top;
|
|
117
|
+
public int Right;
|
|
118
|
+
public int Bottom;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[DllImport("user32.dll")]
|
|
122
|
+
public static extern IntPtr GetForegroundWindow();
|
|
123
|
+
|
|
124
|
+
[DllImport("user32.dll")]
|
|
125
|
+
public static extern bool GetWindowRect(IntPtr hWnd, out RECT rect);
|
|
126
|
+
}
|
|
127
|
+
"@
|
|
128
|
+
|
|
129
|
+
if ($regionValues) {
|
|
130
|
+
$x = $regionValues[0]
|
|
131
|
+
$y = $regionValues[1]
|
|
132
|
+
$w = $regionValues[2]
|
|
133
|
+
$h = $regionValues[3]
|
|
134
|
+
$bounds = New-Object System.Drawing.Rectangle($x, $y, $w, $h)
|
|
135
|
+
} elseif ($ActiveWindow -or $WindowHandle) {
|
|
136
|
+
$handle = if ($WindowHandle) { [IntPtr]$WindowHandle } else { [NativeMethods]::GetForegroundWindow() }
|
|
137
|
+
$rect = New-Object NativeMethods+RECT
|
|
138
|
+
if (-not [NativeMethods]::GetWindowRect($handle, [ref]$rect)) {
|
|
139
|
+
throw "Failed to get window bounds"
|
|
140
|
+
}
|
|
141
|
+
$width = $rect.Right - $rect.Left
|
|
142
|
+
$height = $rect.Bottom - $rect.Top
|
|
143
|
+
$bounds = New-Object System.Drawing.Rectangle($rect.Left, $rect.Top, $width, $height)
|
|
144
|
+
} else {
|
|
145
|
+
$vs = [System.Windows.Forms.SystemInformation]::VirtualScreen
|
|
146
|
+
$bounds = New-Object System.Drawing.Rectangle($vs.Left, $vs.Top, $vs.Width, $vs.Height)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
$bitmap = New-Object System.Drawing.Bitmap($bounds.Width, $bounds.Height)
|
|
150
|
+
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
$source = New-Object System.Drawing.Point($bounds.Left, $bounds.Top)
|
|
154
|
+
$target = [System.Drawing.Point]::Empty
|
|
155
|
+
$size = New-Object System.Drawing.Size($bounds.Width, $bounds.Height)
|
|
156
|
+
$graphics.CopyFromScreen($source, $target, $size)
|
|
157
|
+
$bitmap.Save($outputPath, $imageFormat)
|
|
158
|
+
} finally {
|
|
159
|
+
$graphics.Dispose()
|
|
160
|
+
$bitmap.Dispose()
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
Write-Output $outputPath
|