paragma 0.1.3-rc.1 → 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/README.md +136 -50
- package/SHA256SUMS +6 -0
- package/bin/pg +30 -24
- package/install.js +100 -0
- package/package.json +8 -3
- package/bin/pg-darwin-arm64 +0 -0
- package/bin/pg-darwin-x64 +0 -0
- package/bin/pg-linux-arm64 +0 -0
- package/bin/pg-linux-x64 +0 -0
- package/bin/pg-win32-arm64.exe +0 -0
- package/bin/pg-win32-x64.exe +0 -0
package/README.md
CHANGED
|
@@ -2,99 +2,185 @@
|
|
|
2
2
|
<img src="https://raw.githubusercontent.com/Utku4836/Paragma/main/.github/assets/banner.png" width="100%" alt="Paragma">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
+
<p align="center">
|
|
6
|
+
<b>Project memory for AI coding agents.</b><br>
|
|
7
|
+
Rules, decisions, past errors with their fixes, and the handoff between conversations: kept as Markdown on your computer, found in one call.
|
|
8
|
+
</p>
|
|
9
|
+
|
|
5
10
|
<p align="center">
|
|
6
11
|
<a href="#install">Install</a> ·
|
|
7
|
-
<a href="#
|
|
12
|
+
<a href="#what-the-agent-sees">What the agent sees</a> ·
|
|
8
13
|
<a href="#results">Results</a> ·
|
|
14
|
+
<a href="#commands">Commands</a> ·
|
|
9
15
|
<a href="#how-it-works">How it works</a>
|
|
10
16
|
</p>
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g paragma
|
|
24
|
+
pg setup
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
That is all. `npm` fetches the build of `pg` for your computer (Windows, macOS or Linux, on x64 or arm64) and checks it against the release's SHA-256 sums. It needs Node 18 or later. `pg setup` then opens a small screen where you pick your coding agents and where Paragma should be read: in every conversation, or only in one project's folder.
|
|
28
|
+
|
|
29
|
+
<details>
|
|
30
|
+
<summary>Without npm</summary>
|
|
31
|
+
|
|
32
|
+
Download `pg` for your platform from the [releases](https://github.com/Utku4836/Paragma/releases), put it on your `PATH` and run `pg setup`. Each release lists the SHA-256 of every file in `SHA256SUMS`.
|
|
33
|
+
|
|
34
|
+
</details>
|
|
35
|
+
|
|
36
|
+
Your memory lives in `~/.paragma`, outside your repositories. Paragma never opens a network connection; the search model is built into `pg`.
|
|
13
37
|
|
|
14
38
|
## Why
|
|
15
39
|
|
|
16
|
-
|
|
40
|
+
A coding agent starts every conversation from zero. It rediscovers the project's rules, tries the obvious fix for an error that was already solved the other way, and forgets the decisions you gave it yesterday. Notes help, but an agent reading files searches, opens and re-opens until it trusts it has seen enough, and each step re-reads the whole conversation.
|
|
41
|
+
|
|
42
|
+
Paragma gives the agent what it needs in one step:
|
|
43
|
+
|
|
44
|
+
- **The work continues.** `pg open` returns the goal, the open steps, the last conversation's handoff, and the rules, decisions and past errors that match the work.
|
|
45
|
+
- **Known errors come back with their fix.** `pg run -- go test ./...` reads the test output, says which failures are new, still failing or flaky, and prints the recorded cause and fix next to a failure seen before, in this project or another.
|
|
46
|
+
- **Memory knows the code.** Notes are linked to files and functions, follow them when they are renamed, and say when the code they describe has changed since.
|
|
47
|
+
|
|
48
|
+
## What the agent sees
|
|
49
|
+
|
|
50
|
+
A new conversation on earlier work runs `pg open` and starts from this:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
$ pg open
|
|
54
|
+
ok shop (continued)
|
|
55
|
+
goal: Refunds through the new payment provider
|
|
56
|
+
steps: 1 open, 1 done
|
|
57
|
+
- [ ] 2. Move refunds to it
|
|
58
|
+
last handoff (2026-11-01 17:43Z · shop):
|
|
59
|
+
Provider client added and tested. Refunds still use the old provider.
|
|
60
|
+
matching the goal and steps:
|
|
61
|
+
r1 rule General: Money is int64 cents, never float.
|
|
62
|
+
d1 decision: Refunds over 500 EUR need a second approval
|
|
63
|
+
e1 error: payments/refund_test.go:41: refund window: got 29 days, want 30
|
|
64
|
+
stack: go
|
|
65
|
+
tests: pg run -- go test ./...
|
|
66
|
+
likely code: payments/refund.go#Refund
|
|
67
|
+
its tests first: pg run -- go test ./payments/
|
|
68
|
+
```
|
|
17
69
|
|
|
18
|
-
|
|
70
|
+
When the refund test fails again, the agent does not have to find the cause a second time:
|
|
19
71
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
72
|
+
```text
|
|
73
|
+
$ pg find "refund window off by one day"
|
|
74
|
+
[e1 error] errors/payments-refund-test-go-refund-window
|
|
75
|
+
## Cause
|
|
76
|
+
The window was counted from the order, not from delivery
|
|
77
|
+
## Fix
|
|
78
|
+
Count from the delivery date
|
|
79
|
+
```
|
|
23
80
|
|
|
24
81
|
## Results
|
|
25
82
|
|
|
26
|
-
|
|
83
|
+
We measured whether agents do the same work with less effort when the same knowledge comes through Paragma instead of plain Markdown files. Every run starts from a fresh copy of a small Go project and a memory of 1,539 notes (rules, decisions, recorded errors, journals). Both conditions hold identical knowledge and equivalent instructions; only the access differs. Hidden tests, which the agent never sees, check the result.
|
|
27
84
|
|
|
28
|
-
|
|
|
85
|
+
| Agent and model | Tasks | Score, files → Paragma | Tokens processed | Tool calls | Time |
|
|
29
86
|
| --- | --- | --- | --- | --- | --- |
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
| 1,539 notes | **Paragma** | 17/17 | **12** | **0.32M** | **163 s** |
|
|
87
|
+
| Antigravity, Gemini 3.8 Flash | 5 questions | 5/5 → 5/5 | 1.95M → **0.32M** | 76 → **22** | 8.6 → **3.2** min |
|
|
88
|
+
| Antigravity, Gemini 3.8 Flash | 3 coding tasks | 3/3 → 3/3 | 6.92M → **3.60M** | 173 → **129** | 46 → **18** min |
|
|
89
|
+
| OpenCode, GLM-5.3 Flash | 2 coding tasks | 2/2 → 2/2 | 1.12M → **0.54M** | 87 → **58** | 15 → **7** min |
|
|
34
90
|
|
|
35
|
-
|
|
91
|
+
In every pair of runs, the same task with the same model, Paragma used fewer tokens. Over all runs plain files needed **2.2 times the tokens**, 1.6 times the tool calls and 2.5 times the time, with the same scores.
|
|
36
92
|
|
|
37
|
-
|
|
93
|
+
The coding tasks are a recurring error whose obvious fix is wrong, a feature finished in a second conversation that only knows what the first one recorded, and a change governed by project rules. Each cell ran once, so small differences are not established. Setup, scenarios and every number: [bench/RESULTS.md](bench/RESULTS.md).
|
|
38
94
|
|
|
39
|
-
##
|
|
95
|
+
## Connect your agent
|
|
40
96
|
|
|
41
97
|
```bash
|
|
42
|
-
|
|
98
|
+
pg setup
|
|
43
99
|
```
|
|
44
100
|
|
|
45
|
-
|
|
101
|
+
```text
|
|
102
|
+
██████╗ █████╗ ██████╗ █████╗ ██████╗ ███╗ ███╗ █████╗
|
|
103
|
+
...
|
|
104
|
+
memory for coding agents · v0.2.0
|
|
46
105
|
|
|
47
|
-
|
|
48
|
-
|
|
106
|
+
Connect Paragma to an agent
|
|
107
|
+
|
|
108
|
+
› Claude Code CLI · desktop ✓ every conversation
|
|
109
|
+
Codex CLI · desktop
|
|
110
|
+
Antigravity CLI · IDE
|
|
111
|
+
OpenCode CLI
|
|
112
|
+
|
|
113
|
+
↑↓ move enter choose q quit
|
|
49
114
|
```
|
|
50
115
|
|
|
51
|
-
|
|
116
|
+
`pg setup` finds the agents on your computer, including their desktop apps, and adds a short "Memory (Paragma)" section where each one reads its instructions. Choose **every conversation**, **one conversation** from the agent's own history (Paragma then goes into that conversation's folder), or **this folder**. Esc goes back a step. The rest of the file is left as it is, and when a new version of Paragma changes its instructions, `pg` updates the sections it wrote by itself.
|
|
52
117
|
|
|
53
|
-
|
|
118
|
+
| Agent | Every conversation | One folder |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| Claude Code | `~/.claude/CLAUDE.md` | `CLAUDE.md` |
|
|
121
|
+
| Codex | `~/.codex/AGENTS.md` | `AGENTS.md` |
|
|
122
|
+
| Antigravity | `~/.gemini/AGENTS.md` | `AGENTS.md` |
|
|
123
|
+
| OpenCode | `~/.config/opencode/AGENTS.md` | `AGENTS.md` |
|
|
54
124
|
|
|
55
|
-
|
|
56
|
-
pg setup
|
|
57
|
-
```
|
|
125
|
+
In scripts: `pg setup codex --global`, `pg setup claude --dir .`, `pg setup all --global`, `pg setup --list`.
|
|
58
126
|
|
|
59
|
-
|
|
127
|
+
## Commands
|
|
60
128
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
129
|
+
The section `pg setup` writes is short: when to call `pg`. The details are in three skills the agent reads when it needs them (`pg skill coding`, `pg skill projects`, `pg skill knowledge`, also kept as files in `~/.paragma/skills/`), and `pg <command> --help` explains every option.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pg open shop --goal "Refunds through the new provider" --step "Add the client" --step "Move refunds" \
|
|
133
|
+
--decision "Refunds over 500 EUR need a second approval"
|
|
134
|
+
# start or continue the work; prints the brief
|
|
135
|
+
pg find "refund window" # a topic, a question, an error line, a file or a function
|
|
136
|
+
pg read payments/refund.go#Refund # one function with the notes about it; also a note, or file:10-20
|
|
137
|
+
pg run -- go test ./... # what fails, what is new, flaky or fixed, and the known fix
|
|
138
|
+
pg write --rule "Money is int64 cents, never float."
|
|
139
|
+
pg write --decision "..." --why "..." --alternatives "..."
|
|
140
|
+
pg write --error "<error line>" --cause "..." --fix "..."
|
|
141
|
+
pg write payments/provider --file notes.md # a note; long text from a file or stdin (-)
|
|
142
|
+
pg finish --done 1 "what changed, what is next" # tick off steps, leave the handoff
|
|
143
|
+
pg tree # the code: files and symbols, with the notes about them marked
|
|
144
|
+
pg ls # projects, or the notes of one; also pg mv, pg rm, pg doctor
|
|
145
|
+
```
|
|
67
146
|
|
|
68
|
-
|
|
147
|
+
Many `pg` calls can run at once, from several conversations. `pg rm` moves notes to `.archive/` instead of deleting them.
|
|
69
148
|
|
|
70
|
-
|
|
149
|
+
### Secrets
|
|
71
150
|
|
|
72
|
-
|
|
151
|
+
API keys and tokens never need to appear in a conversation. Each project has its own `<project>.env`; a secret is saved under a title, and the agent uses it by name:
|
|
73
152
|
|
|
74
153
|
```bash
|
|
75
|
-
pg
|
|
76
|
-
pg
|
|
77
|
-
pg run -- go test ./... # on failure: the known fix; on success: rules for the files you changed
|
|
78
|
-
pg start payments --goal "Card payments" --step "Webhook" --step "Tests" --decision "Discount before VAT"
|
|
79
|
-
pg done t2f4 # mark a step done; prints the next one in full
|
|
80
|
-
pg resume payments # in a new conversation: goal, decisions, open steps, changed code
|
|
81
|
-
pg error record --from-last --cause "CRLF checkout" --fix "Normalise line endings before hashing"
|
|
154
|
+
pg write --secret "Npm publish token" - # the value from stdin; shown only as npm_***
|
|
155
|
+
pg run -- npm publish --token '$NPM_PUBLISH_TOKEN'
|
|
82
156
|
```
|
|
83
157
|
|
|
158
|
+
`pg run` puts the value in place itself, on every platform, and prints `$NPM_PUBLISH_TOKEN` again wherever the value would appear in the output. Keys pasted into notes are masked and not kept. In a test with 50 keys and ten requests in plain words, the right key came first every time and was used through `pg run` without its value appearing in any output.
|
|
159
|
+
|
|
84
160
|
## How it works
|
|
85
161
|
|
|
86
|
-
- **
|
|
87
|
-
- **
|
|
88
|
-
- **
|
|
89
|
-
- **
|
|
162
|
+
- **Plain Markdown.** Each project is a folder in `~/.paragma/projects/`: `project.md` (goal, steps, handoffs), `rules.md`, `decisions/`, `errors/` and any notes you like. Open it in any editor; edits are picked up on the next call.
|
|
163
|
+
- **Hybrid search.** Full-text search (SQLite FTS5) and meaning search with a multilingual embedding model built into the binary ([potion-multilingual-128M](https://huggingface.co/minishlab/potion-multilingual-128M), reduced to Latin scripts and 4-bit), merged by rank. A question in Turkish finds a note written in English.
|
|
164
|
+
- **Code awareness.** tree-sitter reads 19 languages: files, functions, types, what each function calls. Notes are linked to code by path and symbol, and record the state of the code when they were written, so a note says when it may be out of date.
|
|
165
|
+
- **Records that merge.** Writing a rule, decision or error that is already known updates the existing one instead of adding a copy; a decision that contradicts an earlier one is pointed out.
|
|
166
|
+
- **One binary.** `pg` is written in Rust: no runtime, no server, no network. The indexes next to the notes can be deleted at any time and are rebuilt.
|
|
167
|
+
|
|
168
|
+
## How it is tested
|
|
169
|
+
|
|
170
|
+
- **Unit tests** on Windows, macOS and Linux for every change; **end-to-end tests** of every command before each release.
|
|
171
|
+
- **Stress and robustness**, also before each release: every command from three conversations at once; notes in CRLF, BOM, UTF-16 and Latin-1, empty and very large files, binary files, symlink loops; the first code index built by twelve processes at the same time.
|
|
172
|
+
- **Search quality:** 70 questions in English, Turkish, Spanish, German, French and Portuguese against a memory of 1,335 notes (`bench/quality.py`), run before every change to ranking: 153 of the 168 expected facts are found, and nothing is returned for questions memory cannot answer.
|
|
173
|
+
- **Rehearsal:** the agent test tasks replayed step by step without a model (`bench/rehearsal.py`), to catch mistakes before spending a model's time.
|
|
174
|
+
- **Agent tests:** the results above. The project, the memory, the questions, the scenarios and their hidden tests are in [bench/](bench/).
|
|
90
175
|
|
|
91
|
-
##
|
|
176
|
+
## Building from source
|
|
92
177
|
|
|
93
178
|
```bash
|
|
94
|
-
|
|
95
|
-
|
|
179
|
+
bash tools/build-model/fetch.sh # downloads the source model (about 500 MB) and builds model/
|
|
180
|
+
cargo build --release # target/release/pg
|
|
181
|
+
cargo test --release
|
|
96
182
|
```
|
|
97
183
|
|
|
98
184
|
## License
|
|
99
185
|
|
|
100
|
-
[MIT](LICENSE)
|
|
186
|
+
[MIT](LICENSE). The embedded model, potion-multilingual-128M by Minish Lab, is MIT licensed; the tree-sitter grammars are MIT licensed; SQLite is in the public domain.
|
package/SHA256SUMS
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
85f7cbfb097973c808958e273665d967b994df147d602bc40f0c63590c00ee89 pg-darwin-arm64
|
|
2
|
+
c039ede83cabaea004d8d32c4ea101379fc308403f383cb07acd8434c91bdda3 pg-darwin-x64
|
|
3
|
+
b9bf323ace43552d4d03ba51005c304d708c795fea45626f4eb163310cb1f4d1 pg-linux-arm64
|
|
4
|
+
9380819f75ba6cecc9d1c9962715e75ec014b41912b0b3fe96252d806787c7c0 pg-linux-x64
|
|
5
|
+
eb324808e058af46b9e8ec5f97764f15bed167935bf89c517589279ec32adc3f pg-windows-arm64.exe
|
|
6
|
+
2d28a8b3c87313db3124171f412180ea7b85a3cdb3b593929a0835b689fb15fe pg-windows-x64.exe
|
package/bin/pg
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Runs the native pg binary for this
|
|
3
|
-
//
|
|
4
|
-
|
|
2
|
+
// Runs the native pg binary for this computer, downloading it first when
|
|
3
|
+
// the install did not (install scripts turned off, or no network then).
|
|
4
|
+
"use strict";
|
|
5
5
|
const { spawnSync } = require("child_process");
|
|
6
6
|
const fs = require("fs");
|
|
7
|
-
const
|
|
7
|
+
const { install, binaryPath } = require("../install.js");
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (process.platform !== "win32") {
|
|
16
|
-
try {
|
|
17
|
-
fs.accessSync(exe, fs.constants.X_OK);
|
|
18
|
-
} catch {
|
|
19
|
-
try { fs.chmodSync(exe, 0o755); } catch {}
|
|
9
|
+
async function main() {
|
|
10
|
+
let exe = binaryPath();
|
|
11
|
+
if (!exe) {
|
|
12
|
+
console.error(`paragma: no prebuilt pg for ${process.platform}/${process.arch}.`);
|
|
13
|
+
console.error("Build it from source: https://github.com/Utku4836/Paragma");
|
|
14
|
+
process.exit(7);
|
|
20
15
|
}
|
|
16
|
+
if (!fs.existsSync(exe)) {
|
|
17
|
+
try {
|
|
18
|
+
exe = await install();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.error(`paragma: ${e.message}`);
|
|
21
|
+
console.error("Download pg by hand from https://github.com/Utku4836/Paragma/releases");
|
|
22
|
+
process.exit(7);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const r = spawnSync(exe, process.argv.slice(2), { stdio: "inherit" });
|
|
26
|
+
if (r.error) {
|
|
27
|
+
console.error("paragma: " + r.error.message);
|
|
28
|
+
process.exit(7);
|
|
29
|
+
}
|
|
30
|
+
if (r.signal) {
|
|
31
|
+
process.kill(process.pid, r.signal);
|
|
32
|
+
}
|
|
33
|
+
process.exit(r.status === null ? 1 : r.status);
|
|
21
34
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.error("paragma: " + r.error.message);
|
|
25
|
-
process.exit(7);
|
|
26
|
-
}
|
|
27
|
-
if (r.signal) {
|
|
28
|
-
process.kill(process.pid, r.signal);
|
|
29
|
-
}
|
|
30
|
-
process.exit(r.status === null ? 1 : r.status);
|
|
35
|
+
|
|
36
|
+
main();
|
package/install.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Downloads the pg binary for this computer from the GitHub release of this
|
|
3
|
+
// package's version and checks it against SHA256SUMS (packed into the
|
|
4
|
+
// package when it was published). Runs after `npm install`; when install
|
|
5
|
+
// scripts are turned off, bin/pg runs it on the first call instead.
|
|
6
|
+
"use strict";
|
|
7
|
+
const crypto = require("crypto");
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const https = require("https");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
const zlib = require("zlib");
|
|
12
|
+
|
|
13
|
+
const REPO = "Utku4836/Paragma";
|
|
14
|
+
const OS = { win32: "windows", linux: "linux", darwin: "darwin" };
|
|
15
|
+
const ARCH = { x64: "x64", arm64: "arm64" };
|
|
16
|
+
|
|
17
|
+
/** The release asset's name for this computer: pg-windows-x64.exe */
|
|
18
|
+
function assetName() {
|
|
19
|
+
const os = OS[process.platform];
|
|
20
|
+
const arch = ARCH[process.arch];
|
|
21
|
+
if (!os || !arch) return null;
|
|
22
|
+
return `pg-${os}-${arch}${os === "windows" ? ".exe" : ""}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Where the binary is kept: next to bin/pg, inside the package. */
|
|
26
|
+
function binaryPath() {
|
|
27
|
+
const name = assetName();
|
|
28
|
+
return name && path.join(__dirname, "bin", name);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function expectedSum(name) {
|
|
32
|
+
const file = path.join(__dirname, "SHA256SUMS");
|
|
33
|
+
if (!fs.existsSync(file)) return null;
|
|
34
|
+
for (const line of fs.readFileSync(file, "utf8").split("\n")) {
|
|
35
|
+
const [sum, asset] = line.trim().split(/\s+\*?/);
|
|
36
|
+
if (asset === name) return sum;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function get(url, redirects = 5) {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
https
|
|
44
|
+
.get(url, { headers: { "User-Agent": "paragma-installer" } }, (res) => {
|
|
45
|
+
if ([301, 302, 303, 307, 308].includes(res.statusCode) && res.headers.location && redirects > 0) {
|
|
46
|
+
res.resume();
|
|
47
|
+
resolve(get(new URL(res.headers.location, url).toString(), redirects - 1));
|
|
48
|
+
} else if (res.statusCode !== 200) {
|
|
49
|
+
res.resume();
|
|
50
|
+
reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
51
|
+
} else {
|
|
52
|
+
resolve(res);
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
.on("error", reject);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Downloads, unpacks and checks the binary; returns its path. */
|
|
60
|
+
async function install({ quiet = false } = {}) {
|
|
61
|
+
const name = assetName();
|
|
62
|
+
if (!name) throw new Error(`no pg build for ${process.platform}/${process.arch}`);
|
|
63
|
+
const dest = binaryPath();
|
|
64
|
+
if (fs.existsSync(dest)) return dest;
|
|
65
|
+
const version = require("./package.json").version;
|
|
66
|
+
const url = `https://github.com/${REPO}/releases/download/v${version}/${name}.gz`;
|
|
67
|
+
if (!quiet) process.stderr.write(`paragma: downloading pg ${version} for ${process.platform}/${process.arch}...\n`);
|
|
68
|
+
const res = await get(url);
|
|
69
|
+
const tmp = `${dest}.${process.pid}.tmp`;
|
|
70
|
+
const hash = crypto.createHash("sha256");
|
|
71
|
+
await new Promise((resolve, reject) => {
|
|
72
|
+
const gunzip = zlib.createGunzip();
|
|
73
|
+
const out = fs.createWriteStream(tmp, { mode: 0o755 });
|
|
74
|
+
gunzip.on("data", (chunk) => hash.update(chunk));
|
|
75
|
+
res.on("error", reject);
|
|
76
|
+
gunzip.on("error", reject);
|
|
77
|
+
out.on("error", reject);
|
|
78
|
+
out.on("finish", resolve);
|
|
79
|
+
res.pipe(gunzip).pipe(out);
|
|
80
|
+
});
|
|
81
|
+
const sum = hash.digest("hex");
|
|
82
|
+
const want = expectedSum(name);
|
|
83
|
+
if (want && sum !== want) {
|
|
84
|
+
fs.rmSync(tmp, { force: true });
|
|
85
|
+
throw new Error(`the downloaded ${name} does not match its checksum`);
|
|
86
|
+
}
|
|
87
|
+
fs.renameSync(tmp, dest);
|
|
88
|
+
if (process.platform !== "win32") fs.chmodSync(dest, 0o755);
|
|
89
|
+
if (!quiet) process.stderr.write("paragma: ready. Connect your coding agents with: pg setup\n");
|
|
90
|
+
return dest;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = { install, binaryPath, assetName };
|
|
94
|
+
|
|
95
|
+
if (require.main === module) {
|
|
96
|
+
install().catch((e) => {
|
|
97
|
+
// the install itself does not fail: bin/pg tries again on the first call
|
|
98
|
+
process.stderr.write(`paragma: ${e.message}; pg will try again when it first runs.\n`);
|
|
99
|
+
});
|
|
100
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paragma",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Project memory for AI coding agents: rules, decisions, past errors with their fixes, and handoffs between conversations, found by hybrid search.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"agents",
|
|
@@ -21,8 +21,13 @@
|
|
|
21
21
|
"bin": {
|
|
22
22
|
"pg": "bin/pg"
|
|
23
23
|
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"postinstall": "node install.js"
|
|
26
|
+
},
|
|
24
27
|
"files": [
|
|
25
|
-
"bin",
|
|
28
|
+
"bin/pg",
|
|
29
|
+
"install.js",
|
|
30
|
+
"SHA256SUMS",
|
|
26
31
|
"README.md"
|
|
27
32
|
],
|
|
28
33
|
"os": [
|
package/bin/pg-darwin-arm64
DELETED
|
Binary file
|
package/bin/pg-darwin-x64
DELETED
|
Binary file
|
package/bin/pg-linux-arm64
DELETED
|
Binary file
|
package/bin/pg-linux-x64
DELETED
|
Binary file
|
package/bin/pg-win32-arm64.exe
DELETED
|
Binary file
|
package/bin/pg-win32-x64.exe
DELETED
|
Binary file
|