@osdlc/skillwright 0.0.0-stage → 0.3.7
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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +25 -2
- package/THIRD_PARTY_NOTICES.md +1955 -0
- package/bin/launcher.js +97 -0
- package/package.json +43 -4
package/bin/launcher.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Runs the native binary from the platform package npm installed alongside
|
|
3
|
+
// this one. dist.ts renders it from this template, filling in the
|
|
4
|
+
// placeholders below.
|
|
5
|
+
//
|
|
6
|
+
// It runs on the consumer's machine before any compiled binary is available,
|
|
7
|
+
// so it stays CommonJS and dependency-free.
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
const { spawn } = require('node:child_process')
|
|
11
|
+
const fs = require('node:fs')
|
|
12
|
+
const os = require('node:os')
|
|
13
|
+
const path = require('node:path')
|
|
14
|
+
|
|
15
|
+
const PLATFORM_PACKAGES = JSON.parse('{"darwin-arm64":{"package":"@osdlc/skillwright-darwin-arm64","binary":"bin/skillwright"},"darwin-x64":{"package":"@osdlc/skillwright-darwin-x64","binary":"bin/skillwright"},"linux-x64":{"package":"@osdlc/skillwright-linux-x64","binary":"bin/skillwright"},"linux-arm64":{"package":"@osdlc/skillwright-linux-arm64","binary":"bin/skillwright"}}')
|
|
16
|
+
const BINARY = 'skillwright'
|
|
17
|
+
const LAUNCHER = '@osdlc/skillwright'
|
|
18
|
+
const DEBUG_ENV = 'SKILLWRIGHT_LAUNCHER_DEBUG'
|
|
19
|
+
|
|
20
|
+
function binaryPath() {
|
|
21
|
+
const key = `${process.platform}-${process.arch}`
|
|
22
|
+
const target = PLATFORM_PACKAGES[key]
|
|
23
|
+
if (!target) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`${BINARY} has no build for ${key}. Supported: ${Object.keys(PLATFORM_PACKAGES).join(', ')}.`,
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
const { package: pkg, binary: file } = target
|
|
29
|
+
let bin
|
|
30
|
+
try {
|
|
31
|
+
// Through package.json: always resolvable, never blocked by an "exports" map.
|
|
32
|
+
bin = path.join(path.dirname(require.resolve(`${pkg}/package.json`)), file)
|
|
33
|
+
} catch {
|
|
34
|
+
throw new Error(
|
|
35
|
+
`${BINARY}: the platform package ${pkg} is not installed. ` +
|
|
36
|
+
`It is an optional dependency of ${LAUNCHER}, so it is skipped when optional dependencies are ` +
|
|
37
|
+
'(--omit=optional, --no-optional) or when the lockfile was made on another platform. ' +
|
|
38
|
+
`Reinstall without those, or add ${pkg} directly.`,
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
if (!fs.existsSync(bin)) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`${BINARY}: ${pkg} is installed but its binary ${bin} is missing; try reinstalling.`,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
return { bin, pkg }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let bin, pkg
|
|
50
|
+
try {
|
|
51
|
+
;({ bin, pkg } = binaryPath())
|
|
52
|
+
} catch (error) {
|
|
53
|
+
process.stderr.write(`${error.message}\n`)
|
|
54
|
+
process.exit(1)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (DEBUG_ENV && process.env[DEBUG_ENV]) {
|
|
58
|
+
process.stderr.write(
|
|
59
|
+
`${BINARY} launcher: platform=${process.platform}-${process.arch} package=${pkg} binary=${bin}\n`,
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Inherited stdio, so the binary owns the terminal; exit code and signal pass through.
|
|
64
|
+
// A terminal's Ctrl-C reaches the child directly (same process group), so the
|
|
65
|
+
// launcher ignores SIGINT and waits for the child to exit; forwarding it would
|
|
66
|
+
// deliver it twice. SIGTERM and SIGHUP, usually sent to this pid alone, are
|
|
67
|
+
// forwarded.
|
|
68
|
+
const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit', windowsHide: false })
|
|
69
|
+
process.on('SIGINT', () => {})
|
|
70
|
+
const forwarded = ['SIGTERM', ...(process.platform === 'win32' ? [] : ['SIGHUP'])]
|
|
71
|
+
for (const signal of forwarded) {
|
|
72
|
+
process.on(signal, () => {
|
|
73
|
+
try {
|
|
74
|
+
child.kill(signal)
|
|
75
|
+
} catch {
|
|
76
|
+
// Child already gone; its exit handler finishes up.
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
child.on('error', (error) => {
|
|
81
|
+
process.stderr.write(`${BINARY}: could not run ${bin}: ${error.message}\n`)
|
|
82
|
+
process.exit(1)
|
|
83
|
+
})
|
|
84
|
+
child.on('exit', (code, signal) => {
|
|
85
|
+
if (signal) {
|
|
86
|
+
// Restore default handling so the re-raise ends this process like the child.
|
|
87
|
+
process.removeAllListeners(signal)
|
|
88
|
+
try {
|
|
89
|
+
process.kill(process.pid, signal)
|
|
90
|
+
} catch {
|
|
91
|
+
// Not raisable here (Windows); fall through to the exit code.
|
|
92
|
+
}
|
|
93
|
+
// A signal Node ignores (SIGPIPE) leaves us running: exit the shell way.
|
|
94
|
+
process.exit(128 + (os.constants.signals[signal] ?? 0))
|
|
95
|
+
}
|
|
96
|
+
process.exit(code ?? 1)
|
|
97
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdlc/skillwright",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.7",
|
|
4
|
+
"description": "Publishes a vault of markdown skill notes into the formats of coding-agent tools (Claude Code, Codex, Cursor and Pi).",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"author": "sksizer",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/osdlc/osdlc.git",
|
|
10
|
+
"directory": "packages/rust/skillwright"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/osdlc/osdlc/tree/main/packages/rust/skillwright#readme",
|
|
13
|
+
"bugs": "https://github.com/osdlc/osdlc/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"skillwright",
|
|
16
|
+
"agent",
|
|
17
|
+
"skills",
|
|
18
|
+
"claude-code",
|
|
19
|
+
"codex",
|
|
20
|
+
"cursor",
|
|
21
|
+
"cli"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE-MIT",
|
|
30
|
+
"LICENSE-APACHE",
|
|
31
|
+
"THIRD_PARTY_NOTICES.md"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"bin": {
|
|
37
|
+
"skillwright": "bin/launcher.js"
|
|
38
|
+
},
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"@osdlc/skillwright-darwin-arm64": "0.3.7",
|
|
41
|
+
"@osdlc/skillwright-darwin-x64": "0.3.7",
|
|
42
|
+
"@osdlc/skillwright-linux-x64": "0.3.7",
|
|
43
|
+
"@osdlc/skillwright-linux-arm64": "0.3.7"
|
|
44
|
+
}
|
|
45
|
+
}
|