@pi-in-go/pig 0.2.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 +21 -0
- package/NOTICE +47 -0
- package/README.md +19 -0
- package/bin/pig.js +117 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright Hewlett Packard Enterprise Development LP
|
|
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/NOTICE
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
SPDX-FileCopyrightText: Copyright Hewlett Packard Enterprise Development LP
|
|
2
|
+
SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
PiG
|
|
5
|
+
===
|
|
6
|
+
|
|
7
|
+
PiG is a Go implementation designed to provide behavior corresponding to the Pi coding-agent project:
|
|
8
|
+
|
|
9
|
+
https://github.com/earendil-works/pi/
|
|
10
|
+
|
|
11
|
+
Pi is distributed under the MIT License and carries this notice:
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2025 Mario Zechner
|
|
14
|
+
|
|
15
|
+
PiG is not an official release of the upstream Pi project. The upstream maintainers do not endorse PiG. PiG preserves upstream copyright and license notices where applicable. See `LICENSE`, `docs/project/PROVENANCE.md`, the repository SPDX metadata, and this notice.
|
|
16
|
+
|
|
17
|
+
Embedded third-party software
|
|
18
|
+
-----------------------------
|
|
19
|
+
|
|
20
|
+
PiG embeds the following third-party browser assets in exported HTML transcripts:
|
|
21
|
+
|
|
22
|
+
- Highlight.js 11.9.0, Copyright (c) 2006, Ivan Sagalaev, BSD-3-Clause.
|
|
23
|
+
- Marked 15.0.4, Copyright (c) 2018+, MarkedJS and Copyright (c) 2011-2018, Christopher Jeffrey, MIT; bundled Markdown material is Copyright 2004 John Gruber, BSD-3-Clause.
|
|
24
|
+
|
|
25
|
+
See `THIRD_PARTY_NOTICES.md` for the applicable license texts. Dependencies included in a release are recorded in that release's SPDX SBOM.
|
|
26
|
+
|
|
27
|
+
PiG also contains a Go port of `grok-mermaid` 0.2.2 and data generated from its width table:
|
|
28
|
+
|
|
29
|
+
- Source: <https://github.com/xl0/grok-mermaid/tree/v0.2.2>
|
|
30
|
+
- Copyright 2023-2026 SpaceXAI
|
|
31
|
+
- Copyright 2026 Alexey Zaytsev
|
|
32
|
+
- License: Apache-2.0
|
|
33
|
+
|
|
34
|
+
The generated width table also derives from `unicode-width` 0.2.0, Copyright (c) 2015 The Rust Project Developers, used under its MIT option.
|
|
35
|
+
|
|
36
|
+
PiG ports upstream Pi code that incorporates material from OpenTUI, `ansi-regex`, and `strip-ansi`. Their notices are retained in the corresponding source files and in `THIRD_PARTY_NOTICES.md`.
|
|
37
|
+
|
|
38
|
+
The project banner and derived social banners adapt the Go gopher, which was designed by Renee French and is licensed under CC-BY-4.0. The license text is in `LICENSES/CC-BY-4.0.txt`.
|
|
39
|
+
|
|
40
|
+
`CODE_OF_CONDUCT.md` adapts Contributor Covenant 2.1 under CC-BY-4.0. Its source and attribution are retained in that document and in `THIRD_PARTY_NOTICES.md`.
|
|
41
|
+
|
|
42
|
+
Unicode character data
|
|
43
|
+
----------------------
|
|
44
|
+
|
|
45
|
+
`tui/widthx/unicode_tables.go` includes data derived from Unicode 17.0.0.
|
|
46
|
+
Copyright © 1991-2026 Unicode, Inc. Distributed under Unicode License V3;
|
|
47
|
+
see `LICENSES/Unicode-3.0.txt` and `THIRD_PARTY_NOTICES.md`.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @pi-in-go/pig
|
|
2
|
+
|
|
3
|
+
PiG is the Go port of the Pi coding agent. PiG 0.2.0 is based on Pi 0.87.1.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @pi-in-go/pig # install `pig`
|
|
7
|
+
npx @pi-in-go/pig --version # or run it without installing
|
|
8
|
+
npm update -g @pi-in-go/pig # update
|
|
9
|
+
npm uninstall -g @pi-in-go/pig # uninstall
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`pig` is a native binary. npm installs the one matching your platform
|
|
13
|
+
(`@pi-in-go/pig-<os>-<cpu>`, as an optional dependency) and this package's small
|
|
14
|
+
Node.js (>= 18) launcher runs it. Supported: macOS, Linux and Windows on x64
|
|
15
|
+
and arm64. Installing with `--no-optional`/`--omit=optional` leaves the binary
|
|
16
|
+
out; reinstall without that flag.
|
|
17
|
+
|
|
18
|
+
Other install methods, documentation and source: https://pi-in-go.dev and
|
|
19
|
+
https://github.com/MichaelKinsy/PiG.
|
package/bin/pig.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-FileCopyrightText: Copyright Hewlett Packard Enterprise Development LP
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
//
|
|
5
|
+
// npm launcher for PiG. `pig` itself is a native Go binary shipped in one
|
|
6
|
+
// platform package per os/cpu pair (installed through optionalDependencies,
|
|
7
|
+
// the esbuild/biome pattern; no postinstall download). This script only finds
|
|
8
|
+
// that binary and runs it with the caller's stdio, arguments, exit status and
|
|
9
|
+
// signals.
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const { spawn } = require("child_process");
|
|
14
|
+
|
|
15
|
+
const SCOPE = "@pi-in-go";
|
|
16
|
+
|
|
17
|
+
// process.platform/process.arch -> platform package. Keep in sync with
|
|
18
|
+
// TARGETS in automation/release/npm/pack_npm.py.
|
|
19
|
+
const PLATFORM_PACKAGES = {
|
|
20
|
+
"darwin arm64": `${SCOPE}/pig-darwin-arm64`,
|
|
21
|
+
"darwin x64": `${SCOPE}/pig-darwin-x64`,
|
|
22
|
+
"linux arm64": `${SCOPE}/pig-linux-arm64`,
|
|
23
|
+
"linux x64": `${SCOPE}/pig-linux-x64`,
|
|
24
|
+
"win32 arm64": `${SCOPE}/pig-win32-arm64`,
|
|
25
|
+
"win32 x64": `${SCOPE}/pig-win32-x64`,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const OTHER_METHODS =
|
|
29
|
+
"Other ways to install PiG:\n" +
|
|
30
|
+
" curl -fsSL https://pi-in-go.dev/install.sh | sh\n" +
|
|
31
|
+
" go install github.com/MichaelKinsy/PiG/cmd/pig@latest\n" +
|
|
32
|
+
" https://github.com/MichaelKinsy/PiG/releases";
|
|
33
|
+
|
|
34
|
+
function platformPackage(platform, arch) {
|
|
35
|
+
return PLATFORM_PACKAGES[`${platform} ${arch}`] || null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function binaryName(platform) {
|
|
39
|
+
return platform === "win32" ? "pig.exe" : "pig";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// resolveBinary returns the absolute path of the native pig binary, or throws
|
|
43
|
+
// an Error whose message tells the user what to do.
|
|
44
|
+
function resolveBinary(platform, arch, resolve) {
|
|
45
|
+
const pkg = platformPackage(platform, arch);
|
|
46
|
+
if (!pkg) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`PiG has no npm package for ${platform}/${arch}. ` +
|
|
49
|
+
`Supported: ${Object.keys(PLATFORM_PACKAGES).map((k) => k.replace(" ", "/")).join(", ")}.\n` +
|
|
50
|
+
OTHER_METHODS,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
let manifest;
|
|
54
|
+
try {
|
|
55
|
+
manifest = (resolve || require.resolve)(`${pkg}/package.json`);
|
|
56
|
+
} catch (_) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`The PiG platform package ${pkg} is not installed.\n` +
|
|
59
|
+
"npm installs it automatically as an optional dependency of @pi-in-go/pig; it is missing\n" +
|
|
60
|
+
"when optional dependencies were skipped (--no-optional, --omit=optional) or the\n" +
|
|
61
|
+
"lockfile was created on another platform. Reinstall with optional dependencies:\n" +
|
|
62
|
+
" npm install -g @pi-in-go/pig\n" +
|
|
63
|
+
OTHER_METHODS,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return path.join(path.dirname(manifest), binaryName(platform));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT", "SIGBREAK"];
|
|
70
|
+
|
|
71
|
+
function main() {
|
|
72
|
+
let binary;
|
|
73
|
+
try {
|
|
74
|
+
binary = resolveBinary(process.platform, process.arch);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
process.stderr.write(`pig (npm launcher): ${err.message}\n`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: "inherit", windowsHide: false });
|
|
81
|
+
const handlers = {};
|
|
82
|
+
for (const signal of FORWARDED_SIGNALS) {
|
|
83
|
+
handlers[signal] = () => {
|
|
84
|
+
try {
|
|
85
|
+
child.kill(signal);
|
|
86
|
+
} catch (_) {
|
|
87
|
+
// The child already exited or the signal is unsupported here.
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
try {
|
|
91
|
+
process.on(signal, handlers[signal]);
|
|
92
|
+
} catch (_) {
|
|
93
|
+
// Signal not supported on this platform.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
child.on("error", (err) => {
|
|
98
|
+
process.stderr.write(`pig (npm launcher): cannot run ${binary}: ${err.message}\n${OTHER_METHODS}\n`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
child.on("exit", (code, signal) => {
|
|
103
|
+
for (const s of Object.keys(handlers)) process.removeListener(s, handlers[s]);
|
|
104
|
+
if (signal) {
|
|
105
|
+
// Die from the same signal so the caller sees the real termination cause.
|
|
106
|
+
process.kill(process.pid, signal);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
process.exit(code === null ? 1 : code);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
module.exports = { PLATFORM_PACKAGES, platformPackage, binaryName, resolveBinary };
|
|
114
|
+
|
|
115
|
+
if (require.main === module) {
|
|
116
|
+
main();
|
|
117
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-in-go/pig",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "PiG, the Go port of the Pi coding agent (based on Pi 0.87.1)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://pi-in-go.dev",
|
|
7
|
+
"bugs": "https://github.com/MichaelKinsy/PiG/issues",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/MichaelKinsy/PiG.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"pig",
|
|
14
|
+
"pi",
|
|
15
|
+
"coding-agent",
|
|
16
|
+
"cli",
|
|
17
|
+
"ai"
|
|
18
|
+
],
|
|
19
|
+
"bin": {
|
|
20
|
+
"pig": "bin/pig.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"bin/pig.js",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"NOTICE"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"optionalDependencies": {
|
|
32
|
+
"@pi-in-go/pig-darwin-arm64": "0.2.0",
|
|
33
|
+
"@pi-in-go/pig-darwin-x64": "0.2.0",
|
|
34
|
+
"@pi-in-go/pig-linux-arm64": "0.2.0",
|
|
35
|
+
"@pi-in-go/pig-linux-x64": "0.2.0",
|
|
36
|
+
"@pi-in-go/pig-win32-arm64": "0.2.0",
|
|
37
|
+
"@pi-in-go/pig-win32-x64": "0.2.0"
|
|
38
|
+
}
|
|
39
|
+
}
|