agent-facets 0.2.2 → 0.3.3
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/bin/facet +181 -0
- package/bin/package.json +3 -0
- package/package.json +17 -37
- package/postinstall.mjs +210 -0
- package/.package.json.bak +0 -44
- package/.turbo/turbo-build.log +0 -3
- package/CHANGELOG.md +0 -85
- package/bunfig.toml +0 -2
- package/dist/facet +0 -0
- package/src/__tests__/cli.test.ts +0 -195
- package/src/__tests__/create-build.test.ts +0 -227
- package/src/__tests__/edit-integration.test.ts +0 -171
- package/src/__tests__/resolve-dir.test.ts +0 -95
- package/src/commands/build.ts +0 -58
- package/src/commands/create/index.ts +0 -76
- package/src/commands/create/types.ts +0 -9
- package/src/commands/create/wizard.tsx +0 -75
- package/src/commands/create-scaffold.ts +0 -184
- package/src/commands/edit/index.ts +0 -144
- package/src/commands/edit/wizard.tsx +0 -74
- package/src/commands/resolve-dir.ts +0 -98
- package/src/commands.ts +0 -40
- package/src/help.ts +0 -43
- package/src/index.ts +0 -10
- package/src/run.ts +0 -82
- package/src/suggest.ts +0 -35
- package/src/tui/components/asset-description.tsx +0 -17
- package/src/tui/components/asset-field-picker.tsx +0 -78
- package/src/tui/components/asset-inline-input.tsx +0 -91
- package/src/tui/components/asset-item.tsx +0 -44
- package/src/tui/components/asset-section.tsx +0 -191
- package/src/tui/components/button.tsx +0 -92
- package/src/tui/components/editable-field.tsx +0 -172
- package/src/tui/components/exit-toast.tsx +0 -20
- package/src/tui/components/reconciliation-item.tsx +0 -129
- package/src/tui/components/stage-row.tsx +0 -45
- package/src/tui/components/version-selector.tsx +0 -79
- package/src/tui/context/focus-mode-context.ts +0 -36
- package/src/tui/context/focus-order-context.ts +0 -68
- package/src/tui/context/form-state-context.ts +0 -260
- package/src/tui/editor.ts +0 -40
- package/src/tui/gradient.ts +0 -1
- package/src/tui/hooks/use-exit-keys.ts +0 -75
- package/src/tui/hooks/use-navigation-keys.ts +0 -34
- package/src/tui/layouts/wizard-layout.tsx +0 -41
- package/src/tui/theme.ts +0 -1
- package/src/tui/views/build/build-view.tsx +0 -152
- package/src/tui/views/create/confirm-view.tsx +0 -74
- package/src/tui/views/create/create-view.tsx +0 -158
- package/src/tui/views/create/wizard.tsx +0 -97
- package/src/tui/views/edit/edit-confirm-view.tsx +0 -93
- package/src/tui/views/edit/edit-types.ts +0 -34
- package/src/tui/views/edit/edit-view.tsx +0 -140
- package/src/tui/views/edit/manifest-to-form.ts +0 -38
- package/src/tui/views/edit/reconciliation-view.tsx +0 -170
- package/src/tui/views/edit/use-edit-session.ts +0 -125
- package/src/tui/views/edit/wizard.tsx +0 -129
- package/src/version.ts +0 -3
- package/tsconfig.json +0 -4
package/bin/facet
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
17
|
+
process.exit(code)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Resolution #1: Environment variable override
|
|
21
|
+
const envPath = process.env.FACET_BIN_PATH
|
|
22
|
+
if (envPath) {
|
|
23
|
+
run(envPath)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Resolution #2: Cached hard-link from postinstall
|
|
27
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
28
|
+
const scriptDir = path.dirname(scriptPath)
|
|
29
|
+
|
|
30
|
+
const cached = path.join(scriptDir, ".facet")
|
|
31
|
+
if (fs.existsSync(cached)) {
|
|
32
|
+
run(cached)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Resolution #3: Platform package lookup
|
|
36
|
+
const platformMap = {
|
|
37
|
+
darwin: "darwin",
|
|
38
|
+
linux: "linux",
|
|
39
|
+
win32: "windows",
|
|
40
|
+
}
|
|
41
|
+
const archMap = {
|
|
42
|
+
x64: "x64",
|
|
43
|
+
arm64: "arm64",
|
|
44
|
+
arm: "arm",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let platform = platformMap[os.platform()]
|
|
48
|
+
if (!platform) {
|
|
49
|
+
platform = os.platform()
|
|
50
|
+
}
|
|
51
|
+
let arch = archMap[os.arch()]
|
|
52
|
+
if (!arch) {
|
|
53
|
+
arch = os.arch()
|
|
54
|
+
}
|
|
55
|
+
const base = "@agent-facets/cli-" + platform + "-" + arch
|
|
56
|
+
const binary = platform === "windows" ? "facet.exe" : "facet"
|
|
57
|
+
|
|
58
|
+
function supportsAvx2() {
|
|
59
|
+
if (arch !== "x64") return false
|
|
60
|
+
|
|
61
|
+
if (platform === "linux") {
|
|
62
|
+
try {
|
|
63
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
64
|
+
} catch {
|
|
65
|
+
return false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (platform === "darwin") {
|
|
70
|
+
try {
|
|
71
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
72
|
+
encoding: "utf8",
|
|
73
|
+
timeout: 1500,
|
|
74
|
+
})
|
|
75
|
+
if (result.status !== 0) return false
|
|
76
|
+
return (result.stdout || "").trim() === "1"
|
|
77
|
+
} catch {
|
|
78
|
+
return false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (platform === "windows") {
|
|
83
|
+
const cmd =
|
|
84
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
85
|
+
|
|
86
|
+
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
87
|
+
try {
|
|
88
|
+
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
89
|
+
encoding: "utf8",
|
|
90
|
+
timeout: 3000,
|
|
91
|
+
windowsHide: true,
|
|
92
|
+
})
|
|
93
|
+
if (result.status !== 0) continue
|
|
94
|
+
const out = (result.stdout || "").trim().toLowerCase()
|
|
95
|
+
if (out === "true" || out === "1") return true
|
|
96
|
+
if (out === "false" || out === "0") return false
|
|
97
|
+
} catch {
|
|
98
|
+
continue
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return false
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return false
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const names = (() => {
|
|
109
|
+
const avx2 = supportsAvx2()
|
|
110
|
+
const baseline = arch === "x64" && !avx2
|
|
111
|
+
|
|
112
|
+
if (platform === "linux") {
|
|
113
|
+
const musl = (() => {
|
|
114
|
+
try {
|
|
115
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
116
|
+
} catch {
|
|
117
|
+
// ignore
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
122
|
+
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
123
|
+
if (text.includes("musl")) return true
|
|
124
|
+
} catch {
|
|
125
|
+
// ignore
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return false
|
|
129
|
+
})()
|
|
130
|
+
|
|
131
|
+
if (musl) {
|
|
132
|
+
if (arch === "x64") {
|
|
133
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
134
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
135
|
+
}
|
|
136
|
+
return [`${base}-musl`, base]
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (arch === "x64") {
|
|
140
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
141
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
142
|
+
}
|
|
143
|
+
return [base, `${base}-musl`]
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (arch === "x64") {
|
|
147
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
148
|
+
return [base, `${base}-baseline`]
|
|
149
|
+
}
|
|
150
|
+
return [base]
|
|
151
|
+
})()
|
|
152
|
+
|
|
153
|
+
function findBinary(startDir) {
|
|
154
|
+
let current = startDir
|
|
155
|
+
for (;;) {
|
|
156
|
+
const modules = path.join(current, "node_modules")
|
|
157
|
+
if (fs.existsSync(modules)) {
|
|
158
|
+
for (const name of names) {
|
|
159
|
+
const candidate = path.join(modules, name, "bin", binary)
|
|
160
|
+
if (fs.existsSync(candidate)) return candidate
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const parent = path.dirname(current)
|
|
164
|
+
if (parent === current) {
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
current = parent
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const resolved = findBinary(scriptDir)
|
|
172
|
+
if (!resolved) {
|
|
173
|
+
console.error(
|
|
174
|
+
"It seems that your package manager failed to install the right version of the facet CLI for your platform. You can try manually installing " +
|
|
175
|
+
names.map((n) => `"${n}"`).join(" or ") +
|
|
176
|
+
" package",
|
|
177
|
+
)
|
|
178
|
+
process.exit(1)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
run(resolved)
|
package/bin/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,44 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-facets",
|
|
3
|
-
"
|
|
4
|
-
"type": "git",
|
|
5
|
-
"url": "https://github.com/agent-facets/facets",
|
|
6
|
-
"directory": "packages/cli"
|
|
7
|
-
},
|
|
8
|
-
"version": "0.2.2",
|
|
9
|
-
"type": "module",
|
|
3
|
+
"version": "0.3.3",
|
|
10
4
|
"bin": {
|
|
11
|
-
"facet": "./
|
|
5
|
+
"facet": "./bin/facet"
|
|
12
6
|
},
|
|
13
7
|
"scripts": {
|
|
14
|
-
"
|
|
15
|
-
"prepack": "bun ../../scripts/prepack.ts",
|
|
16
|
-
"postpack": "bun ../../scripts/postpack.ts",
|
|
17
|
-
"types": "tsc --noEmit",
|
|
18
|
-
"test": "bun test --timeout 15000"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@bomb.sh/args": "0.3.1",
|
|
22
|
-
"@types/react": "19.2.14",
|
|
23
|
-
"arktype": "2.1.29",
|
|
24
|
-
"ink": "6.8.0",
|
|
25
|
-
"ink-gradient": "4.0.0",
|
|
26
|
-
"ink-spinner": "5.0.0",
|
|
27
|
-
"ink-text-input": "6.0.0",
|
|
28
|
-
"react": "19.2.4",
|
|
29
|
-
"react-devtools-core": "7.0.1"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@agent-facets/brand": "0.2.1",
|
|
33
|
-
"@agent-facets/core": "0.2.1",
|
|
34
|
-
"@types/bun": "1.3.10",
|
|
35
|
-
"ink-testing-library": "4.0.0"
|
|
36
|
-
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"typescript": "^5 || ^6"
|
|
8
|
+
"postinstall": "node ./postinstall.mjs"
|
|
39
9
|
},
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
10
|
+
"optionalDependencies": {
|
|
11
|
+
"@agent-facets/cli-windows-x64-baseline": "0.3.3",
|
|
12
|
+
"@agent-facets/cli-windows-x64": "0.3.3",
|
|
13
|
+
"@agent-facets/cli-windows-arm64": "0.3.3",
|
|
14
|
+
"@agent-facets/cli-darwin-x64-baseline": "0.3.3",
|
|
15
|
+
"@agent-facets/cli-darwin-x64": "0.3.3",
|
|
16
|
+
"@agent-facets/cli-darwin-arm64": "0.3.3",
|
|
17
|
+
"@agent-facets/cli-linux-x64-baseline-musl": "0.3.3",
|
|
18
|
+
"@agent-facets/cli-linux-x64-musl": "0.3.3",
|
|
19
|
+
"@agent-facets/cli-linux-arm64-musl": "0.3.3",
|
|
20
|
+
"@agent-facets/cli-linux-x64-baseline": "0.3.3",
|
|
21
|
+
"@agent-facets/cli-linux-x64": "0.3.3",
|
|
22
|
+
"@agent-facets/cli-linux-arm64": "0.3.3"
|
|
43
23
|
}
|
|
44
|
-
}
|
|
24
|
+
}
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Postinstall script for agent-facets.
|
|
3
|
+
*
|
|
4
|
+
* Detects the current platform, architecture, AVX2 support, and musl libc,
|
|
5
|
+
* then hard-links the optimal binary to bin/.facet for fast launcher resolution.
|
|
6
|
+
*
|
|
7
|
+
* Silent failure — if anything goes wrong, the launcher's fallback logic handles it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { spawnSync } from 'node:child_process'
|
|
11
|
+
import { chmodSync, copyFileSync, existsSync, linkSync, mkdirSync, readFileSync, unlinkSync } from 'node:fs'
|
|
12
|
+
import { createRequire } from 'node:module'
|
|
13
|
+
import { arch as osArch, platform as osPlatform } from 'node:os'
|
|
14
|
+
import { dirname, join, resolve } from 'node:path'
|
|
15
|
+
import { fileURLToPath } from 'node:url'
|
|
16
|
+
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
18
|
+
const require = createRequire(import.meta.url)
|
|
19
|
+
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Platform detection
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
function detectPlatform() {
|
|
25
|
+
const platformMap = { darwin: 'darwin', linux: 'linux', win32: 'windows' }
|
|
26
|
+
const archMap = { x64: 'x64', arm64: 'arm64', arm: 'arm' }
|
|
27
|
+
const platform = platformMap[osPlatform()] || osPlatform()
|
|
28
|
+
const arch = archMap[osArch()] || osArch()
|
|
29
|
+
return { platform, arch }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// AVX2 detection
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
function supportsAvx2(platform) {
|
|
37
|
+
if (platform === 'linux') {
|
|
38
|
+
try {
|
|
39
|
+
return /(^|\s)avx2(\s|$)/i.test(readFileSync('/proc/cpuinfo', 'utf8'))
|
|
40
|
+
} catch {
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (platform === 'darwin') {
|
|
46
|
+
try {
|
|
47
|
+
const result = spawnSync('sysctl', ['-n', 'hw.optional.avx2_0'], {
|
|
48
|
+
encoding: 'utf8',
|
|
49
|
+
timeout: 1500,
|
|
50
|
+
})
|
|
51
|
+
if (result.status !== 0) return false
|
|
52
|
+
return (result.stdout || '').trim() === '1'
|
|
53
|
+
} catch {
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (platform === 'windows') {
|
|
59
|
+
const cmd =
|
|
60
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
61
|
+
|
|
62
|
+
for (const exe of ['powershell.exe', 'pwsh.exe', 'pwsh', 'powershell']) {
|
|
63
|
+
try {
|
|
64
|
+
const result = spawnSync(exe, ['-NoProfile', '-NonInteractive', '-Command', cmd], {
|
|
65
|
+
encoding: 'utf8',
|
|
66
|
+
timeout: 3000,
|
|
67
|
+
windowsHide: true,
|
|
68
|
+
})
|
|
69
|
+
if (result.status !== 0) continue
|
|
70
|
+
const out = (result.stdout || '').trim().toLowerCase()
|
|
71
|
+
if (out === 'true' || out === '1') return true
|
|
72
|
+
if (out === 'false' || out === '0') return false
|
|
73
|
+
} catch {}
|
|
74
|
+
}
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return false
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// musl detection (Linux only)
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
function isMusl() {
|
|
86
|
+
try {
|
|
87
|
+
if (existsSync('/etc/alpine-release')) return true
|
|
88
|
+
} catch {
|
|
89
|
+
// ignore
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
const result = spawnSync('ldd', ['--version'], { encoding: 'utf8' })
|
|
94
|
+
const text = ((result.stdout || '') + (result.stderr || '')).toLowerCase()
|
|
95
|
+
if (text.includes('musl')) return true
|
|
96
|
+
} catch {
|
|
97
|
+
// ignore
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return false
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Build priority-ordered candidate list
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
function buildCandidates(platform, arch, opts = {}) {
|
|
108
|
+
const base = `@agent-facets/cli-${platform}-${arch}`
|
|
109
|
+
const avx2 = opts.avx2 !== undefined ? opts.avx2 : arch === 'x64' ? supportsAvx2(platform) : false
|
|
110
|
+
const baseline = arch === 'x64' && !avx2
|
|
111
|
+
|
|
112
|
+
if (platform === 'linux') {
|
|
113
|
+
const musl = opts.musl !== undefined ? opts.musl : isMusl()
|
|
114
|
+
|
|
115
|
+
if (musl) {
|
|
116
|
+
if (arch === 'x64') {
|
|
117
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
118
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
119
|
+
}
|
|
120
|
+
return [`${base}-musl`, base]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (arch === 'x64') {
|
|
124
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
125
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
126
|
+
}
|
|
127
|
+
return [base, `${base}-musl`]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (arch === 'x64') {
|
|
131
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
132
|
+
return [base, `${base}-baseline`]
|
|
133
|
+
}
|
|
134
|
+
return [base]
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// Find the binary via require.resolve
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
|
|
141
|
+
function findBinary(candidates) {
|
|
142
|
+
const binaryName = osPlatform() === 'win32' ? 'facet.exe' : 'facet'
|
|
143
|
+
|
|
144
|
+
for (const candidate of candidates) {
|
|
145
|
+
try {
|
|
146
|
+
const pkgPath = require.resolve(`${candidate}/package.json`)
|
|
147
|
+
const pkgDir = dirname(pkgPath)
|
|
148
|
+
const binaryPath = join(pkgDir, 'bin', binaryName)
|
|
149
|
+
if (existsSync(binaryPath)) return binaryPath
|
|
150
|
+
} catch {
|
|
151
|
+
// Package not installed — try next candidate
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return undefined
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Main
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
|
|
162
|
+
function main() {
|
|
163
|
+
// Windows: no-op — the .exe is used directly
|
|
164
|
+
if (osPlatform() === 'win32') return
|
|
165
|
+
|
|
166
|
+
const { platform, arch } = detectPlatform()
|
|
167
|
+
const candidates = buildCandidates(platform, arch)
|
|
168
|
+
const binaryPath = findBinary(candidates)
|
|
169
|
+
|
|
170
|
+
if (!binaryPath) return // No binary found — launcher fallback handles it
|
|
171
|
+
|
|
172
|
+
const binDir = join(__dirname, '..', 'bin')
|
|
173
|
+
const targetPath = join(binDir, '.facet')
|
|
174
|
+
|
|
175
|
+
// Ensure bin directory exists
|
|
176
|
+
mkdirSync(binDir, { recursive: true })
|
|
177
|
+
|
|
178
|
+
// Remove existing cached binary
|
|
179
|
+
try {
|
|
180
|
+
unlinkSync(targetPath)
|
|
181
|
+
} catch {
|
|
182
|
+
// Doesn't exist — fine
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Hard-link (copy fallback on cross-device)
|
|
186
|
+
try {
|
|
187
|
+
linkSync(binaryPath, targetPath)
|
|
188
|
+
} catch {
|
|
189
|
+
copyFileSync(binaryPath, targetPath)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
chmodSync(targetPath, 0o755)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Guard: only run main() when executed directly, not when imported by tests
|
|
196
|
+
const scriptPath = fileURLToPath(import.meta.url)
|
|
197
|
+
const isDirectExecution = process.argv[1] && resolve(process.argv[1]) === scriptPath
|
|
198
|
+
|
|
199
|
+
if (isDirectExecution) {
|
|
200
|
+
try {
|
|
201
|
+
main()
|
|
202
|
+
} catch (e) {
|
|
203
|
+
// Log the error but exit 0 — launcher fallback will handle binary resolution.
|
|
204
|
+
// We don't want a postinstall failure to break `npm install`.
|
|
205
|
+
console.error('[agent-facets postinstall] failed to cache platform binary:', e.message || e)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Exports for testing — these are no-ops when run as a script
|
|
210
|
+
export { buildCandidates, detectPlatform }
|
package/.package.json.bak
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "agent-facets",
|
|
3
|
-
"repository": {
|
|
4
|
-
"type": "git",
|
|
5
|
-
"url": "https://github.com/agent-facets/facets",
|
|
6
|
-
"directory": "packages/cli"
|
|
7
|
-
},
|
|
8
|
-
"version": "0.2.2",
|
|
9
|
-
"type": "module",
|
|
10
|
-
"bin": {
|
|
11
|
-
"facet": "./dist/facet"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "bun build src/index.ts --compile --outfile dist/facet",
|
|
15
|
-
"prepack": "bun ../../scripts/prepack.ts",
|
|
16
|
-
"postpack": "bun ../../scripts/postpack.ts",
|
|
17
|
-
"types": "tsc --noEmit",
|
|
18
|
-
"test": "bun test --timeout 15000"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@bomb.sh/args": "0.3.1",
|
|
22
|
-
"@types/react": "19.2.14",
|
|
23
|
-
"arktype": "2.1.29",
|
|
24
|
-
"ink": "6.8.0",
|
|
25
|
-
"ink-gradient": "4.0.0",
|
|
26
|
-
"ink-spinner": "5.0.0",
|
|
27
|
-
"ink-text-input": "6.0.0",
|
|
28
|
-
"react": "19.2.4",
|
|
29
|
-
"react-devtools-core": "7.0.1"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@agent-facets/brand": "workspace:*",
|
|
33
|
-
"@agent-facets/core": "workspace:*",
|
|
34
|
-
"@types/bun": "1.3.10",
|
|
35
|
-
"ink-testing-library": "4.0.0"
|
|
36
|
-
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"typescript": "^5 || ^6"
|
|
39
|
-
},
|
|
40
|
-
"publishConfig": {
|
|
41
|
-
"access": "public",
|
|
42
|
-
"provenance": false
|
|
43
|
-
}
|
|
44
|
-
}
|
package/.turbo/turbo-build.log
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# agent-facets
|
|
2
|
-
|
|
3
|
-
## 0.2.2
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [#39](https://github.com/agent-facets/facets/pull/39) [`f380b7b`](https://github.com/agent-facets/facets/commit/f380b7bc5115acec1f974ef1401eba199a2f90fb) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Ensure release CI works in isolation
|
|
8
|
-
- [#46](https://github.com/agent-facets/facets/pull/46) [`a5cbb89`](https://github.com/agent-facets/facets/commit/a5cbb89a46e14e2f79749ea7eafb5aebbd3504b7) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Ensure all CI runs and provenance is managed correctly across packages
|
|
9
|
-
|
|
10
|
-
## 0.2.1
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- [#39](https://github.com/agent-facets/facets/pull/39) [`f380b7b`](https://github.com/agent-facets/facets/commit/f380b7bc5115acec1f974ef1401eba199a2f90fb) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Ensure release CI works in isolation
|
|
15
|
-
|
|
16
|
-
## 0.2.0
|
|
17
|
-
|
|
18
|
-
### Minor Changes
|
|
19
|
-
|
|
20
|
-
- [#35](https://github.com/agent-facets/facets/pull/35) [`6350718`](https://github.com/agent-facets/facets/commit/63507188f1bb3a7276cd4812f69f7d16d1778fd6) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Ensure proper release isolation
|
|
21
|
-
|
|
22
|
-
### Patch Changes
|
|
23
|
-
|
|
24
|
-
- [#37](https://github.com/agent-facets/facets/pull/37) [`1c48260`](https://github.com/agent-facets/facets/commit/1c48260ab77fd27e64be6c5884aa6c447e3639e0) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Better dev & ci dependency management via mise
|
|
25
|
-
- [#33](https://github.com/agent-facets/facets/pull/33) [`540e126`](https://github.com/agent-facets/facets/commit/540e126e677de98a9b3d4e39542df37de8756b73) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Ensure CI runs tests before release and notify Slack when failures occur.
|
|
26
|
-
|
|
27
|
-
## 0.1.4
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- [`098fd08`](https://github.com/agent-facets/facets/commit/098fd08bf5d9970babc5c57bee6a155bffcecd97) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Better CLI parameter validation
|
|
32
|
-
|
|
33
|
-
- [`5262cbe`](https://github.com/agent-facets/facets/commit/5262cbe66df02c625430309878e6061ccde183de) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Fix publishing by properly categorizing dev dependencies
|
|
34
|
-
|
|
35
|
-
- [`d3b9439`](https://github.com/agent-facets/facets/commit/d3b9439466e0eb65687901426e2ebd6c5a333c60) Thanks [@eXamadeus](https://github.com/eXamadeus)! - Use better github attribution for changesets
|
|
36
|
-
|
|
37
|
-
## 0.1.3
|
|
38
|
-
|
|
39
|
-
### Patch Changes
|
|
40
|
-
|
|
41
|
-
- 66b179f: Wire up the facet edit command
|
|
42
|
-
|
|
43
|
-
## 0.1.2
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- bb87748: This is a CI improvement so we release faster and cleaner
|
|
48
|
-
- 95e2f38: Migrate NPM packages from `@ex-machina` to `@agent-facets` org.
|
|
49
|
-
|
|
50
|
-
- `@ex-machina/facet-core` is now `@agent-facets/core`
|
|
51
|
-
- `@ex-machina/facet` is now `agent-facets`
|
|
52
|
-
|
|
53
|
-
- Updated dependencies [bb87748]
|
|
54
|
-
- Updated dependencies [95e2f38]
|
|
55
|
-
- @agent-facets/brand@0.1.1
|
|
56
|
-
- @agent-facets/core@0.1.2
|
|
57
|
-
|
|
58
|
-
## 0.1.1
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- 5813b90: Small test for change set management in CI
|
|
63
|
-
- Updated dependencies [5813b90]
|
|
64
|
-
- @agent-facets/core@0.1.1
|
|
65
|
-
|
|
66
|
-
## 0.1.0
|
|
67
|
-
|
|
68
|
-
### Minor Changes
|
|
69
|
-
|
|
70
|
-
- 2243bbf: Added basic create command to CLI
|
|
71
|
-
|
|
72
|
-
### Patch Changes
|
|
73
|
-
|
|
74
|
-
- Updated dependencies [2243bbf]
|
|
75
|
-
- @agent-facets/core@0.1.0
|
|
76
|
-
|
|
77
|
-
## 0.0.1
|
|
78
|
-
|
|
79
|
-
### Patch Changes
|
|
80
|
-
|
|
81
|
-
- 74e3d25: Should be 0.0.1 now
|
|
82
|
-
- 74e3d25: Initial publishing
|
|
83
|
-
- Updated dependencies [74e3d25]
|
|
84
|
-
- Updated dependencies [74e3d25]
|
|
85
|
-
- @agent-facets/core@0.0.1
|
package/bunfig.toml
DELETED
package/dist/facet
DELETED
|
Binary file
|