windlass-agent 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Parth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
1
+ # Windlass
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A coding agent for the terminal: you describe a change, and it reads your code, edits files and runs commands in
4
+ your project until the change is done. It is one program, `windlass` (`wl` for short), with a line interface, a
5
+ full-screen interface, and a server for editors (the Agent Client Protocol). It signs in with a ChatGPT plan.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install -g windlass-agent
11
+ windlass --version
12
+ ```
13
+
14
+ This installs the executable for your machine (Linux or macOS, x64 or arm64; Linux with glibc) from a package of
15
+ its own, `windlass-agent-<os>-<arch>`, which npm picks as an optional dependency. Nothing else is needed at run time:
16
+ not Bun, and Node only to start it. If optional dependencies are left out (`--omit=optional`), `windlass` says which
17
+ package is missing.
18
+
19
+ To run you also need `git`, GNU `env` (coreutils) and, on Linux, `bwrap` (bubblewrap) for the sandbox.
20
+
21
+ ## Use
22
+
23
+ ```sh
24
+ windlass login # sign in with your ChatGPT plan
25
+ windlass --demo list # scripted sessions: no model, no sign-in
26
+ windlass tui # the full-screen interface, in your project's folder
27
+ windlass "fix the failing test"
28
+ ```
29
+
30
+ The [README](https://github.com/parthg1901/windlass#readme) and the
31
+ [user guide](https://github.com/parthg1901/windlass/blob/main/docs/user-guide.md) have the rest. MIT licence.
package/launcher.mjs ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+ // The command the npm package installs (its `bin`, for the binary and each alias). It finds the
3
+ // executable for this machine in the platform package npm installed beside it (an optional
4
+ // dependency, `<this package>-<os>-<arch>`, which npm picks by its `os`, `cpu` and `libc`) and runs it
5
+ // with the same arguments, standard input, output and error, and environment, then exits as it did:
6
+ // with its exit code, or by the same signal.
7
+ //
8
+ // It runs on Node (the `engines` version or later) and on Bun, uses nothing but their built-in
9
+ // modules, and names no product: the package's names come from the package.json beside it.
10
+ //
11
+ // Signals: SIGTERM and SIGHUP are passed on to the executable. SIGINT and SIGQUIT are passed on
12
+ // only when no standard stream is a terminal: from a terminal, Ctrl-C and Ctrl-\ already reach the
13
+ // executable, which is in the same process group, and a second copy would count as a second press.
14
+ // Either way this process does not die of them before the executable has ended.
15
+ import { spawn } from "node:child_process"
16
+ import { readFileSync } from "node:fs"
17
+ import { createRequire } from "node:module"
18
+ import { constants } from "node:os"
19
+ import { dirname, join } from "node:path"
20
+ import { isatty } from "node:tty"
21
+ import { fileURLToPath } from "node:url"
22
+
23
+ const here = dirname(fileURLToPath(import.meta.url))
24
+ const manifestPath = join(here, "package.json")
25
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"))
26
+ // The binary's name is the first `bin` entry; the others are its aliases.
27
+ const binary = Object.keys(manifest.bin ?? {})[0] ?? manifest.name
28
+ const platform = `${process.platform}-${process.arch}`
29
+ const platformPackage = `${manifest.name}-${platform}`
30
+ const known = Object.keys(manifest.optionalDependencies ?? {})
31
+
32
+ function fail(lines) {
33
+ process.stderr.write(lines.map((line) => `${binary}: ${line}\n`).join(""))
34
+ process.exit(1)
35
+ }
36
+
37
+ /** Whether this is Linux with musl instead of glibc (Alpine, for one), which the Linux executables do not run on. */
38
+ function musl() {
39
+ if (process.platform !== "linux") return false
40
+ try {
41
+ const header = process.report?.getReport?.()?.header
42
+ return header !== undefined && header.glibcVersionRuntime === undefined
43
+ } catch {
44
+ return false
45
+ }
46
+ }
47
+
48
+ function executable() {
49
+ const reinstall = `Reinstall with optional dependencies included: npm install -g ${manifest.name}`
50
+ if (!known.includes(platformPackage)) {
51
+ const targets = known.map((name) => name.slice(manifest.name.length + 1)).join(", ")
52
+ fail([`there is no executable for this machine (${platform}) in ${manifest.name}; there are executables for ${targets}.`])
53
+ }
54
+ let found
55
+ try {
56
+ found = createRequire(manifestPath).resolve(`${platformPackage}/package.json`)
57
+ } catch {
58
+ if (musl()) fail([`${platformPackage} is not installed: its executable needs glibc, and this Linux uses musl.`])
59
+ fail([
60
+ `${platformPackage}, the package with the executable for this machine (${platform}), is not installed.`,
61
+ `npm leaves it out when optional dependencies are omitted (--omit=optional, --no-optional, or omit=optional in an .npmrc).`,
62
+ reinstall,
63
+ ])
64
+ }
65
+ const installed = JSON.parse(readFileSync(found, "utf8")).version
66
+ if (installed !== manifest.version)
67
+ fail([`${platformPackage} is version ${installed}, but ${manifest.name} is version ${manifest.version}; they must be the same.`, reinstall])
68
+ return join(dirname(found), "bin", binary)
69
+ }
70
+
71
+ const path = executable()
72
+ const terminal = [0, 1, 2].some((fd) => isatty(fd))
73
+ let child = null
74
+ // Listening before the executable starts, so that no signal arrives while nobody would pass it on.
75
+ const handlers = ["SIGTERM", "SIGHUP", "SIGINT", "SIGQUIT"].map((signal) => {
76
+ const handler = () => {
77
+ if ((signal === "SIGINT" || signal === "SIGQUIT") && terminal) return
78
+ if (child !== null && child.exitCode === null && child.signalCode === null) child.kill(signal)
79
+ }
80
+ process.on(signal, handler)
81
+ return [signal, handler]
82
+ })
83
+
84
+ child = spawn(path, process.argv.slice(2), { stdio: "inherit" })
85
+ let started = false
86
+ child.on("spawn", () => {
87
+ started = true
88
+ })
89
+ child.on("error", (error) => {
90
+ if (!started) fail([`could not run ${path}: ${error.message}`])
91
+ })
92
+ child.on("exit", (code, signal) => {
93
+ for (const [name, handler] of handlers) process.off(name, handler)
94
+ if (signal === null) process.exit(code ?? 1)
95
+ // Ended by a signal: end by the same one, so whoever started this sees what happened. Should it not end
96
+ // this process (it is ignored here), exit with the shell's number for it instead.
97
+ process.kill(process.pid, signal)
98
+ setTimeout(() => process.exit(128 + (constants.signals[signal] ?? 0)), 200)
99
+ })
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "windlass-agent",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Windlass: a coding agent for the terminal that signs in with a ChatGPT plan",
4
+ "keywords": [
5
+ "coding-agent",
6
+ "agent",
7
+ "cli",
8
+ "terminal",
9
+ "chatgpt",
10
+ "acp"
11
+ ],
12
+ "version": "0.1.0",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/parthg1901/windlass.git"
17
+ },
18
+ "homepage": "https://github.com/parthg1901/windlass#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/parthg1901/windlass/issues"
21
+ },
22
+ "bin": {
23
+ "windlass": "launcher.mjs",
24
+ "wl": "launcher.mjs"
25
+ },
26
+ "files": [
27
+ "launcher.mjs"
28
+ ],
29
+ "engines": {
30
+ "node": ">=18"
31
+ },
32
+ "optionalDependencies": {
33
+ "windlass-agent-linux-x64": "0.1.0",
34
+ "windlass-agent-linux-arm64": "0.1.0",
35
+ "windlass-agent-darwin-x64": "0.1.0",
36
+ "windlass-agent-darwin-arm64": "0.1.0"
37
+ }
38
+ }