brik64 2.0.0-beta.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/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # brik64 (npm)
2
+
3
+ Install the BRIK-64 PCD compiler and toolchain via npm:
4
+
5
+ ```sh
6
+ npm install -g brik64
7
+ brikc --version
8
+ brikc run hello_world.pcd
9
+ ```
10
+
11
+ ## What is BRIK-64?
12
+
13
+ BRIK-64 is a **Digital Circuitality** architecture: programs as verified circuits.
14
+
15
+ - **PCD** (Printed Circuit Description) — deterministic, formally verified language
16
+ - **64 canonical monomers** — atomic operations, composed via EVA algebra
17
+ - **TCE** — Thermodynamic Coherence Engine certifies every program
18
+ - **AI-native** — finite operation space prevents incorrect programs from compiling
19
+
20
+ ## Commands
21
+
22
+ | Command | Description |
23
+ |---------|-------------|
24
+ | `brikc run file.pcd` | Compile and run a .pcd program |
25
+ | `brikc fmt file.pcd` | Format a .pcd source file |
26
+ | `brikc check file.pcd` | Type-check without running |
27
+ | `brikc build file.pcd` | Full pipeline to BIR bytecode |
28
+ | `brikc catalog list` | List all 64 monomers |
29
+
30
+ ## License
31
+
32
+ BRIK-64 Community License v1.0 — free for individuals and startups (<$1M revenue).
33
+ Commercial license required for enterprises. See [LICENSE](../../LICENSE).
34
+
35
+ © 2026 BRIK-64 Inc.
package/bin/brikc ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ // BRIK-64 brikc placeholder — replaced by native binary on postinstall
3
+ // If you see this, run: npm install brik64
4
+ console.error('[brik64] Installation incomplete. Run: npm install brik64');
5
+ process.exit(1);
package/bin/brikcheck ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ // BRIK-64 brikcheck placeholder — replaced by native binary on postinstall
3
+ console.error('[brik64] Installation incomplete. Run: npm install brik64');
4
+ process.exit(1);
package/bin/brikfmt ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ // BRIK-64 brikfmt placeholder — replaced by native binary on postinstall
3
+ console.error('[brik64] Installation incomplete. Run: npm install brik64');
4
+ process.exit(1);
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "brik64",
3
+ "version": "2.0.0-beta.3",
4
+ "description": "BRIK-64 PCD compiler and toolchain — install brikc, brikfmt, brikcheck",
5
+ "keywords": [
6
+ "brik64", "pcd", "compiler", "digital-circuitality",
7
+ "formal-verification", "ai-safety", "policy-circuits"
8
+ ],
9
+ "homepage": "https://brik64.dev",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/brik64/brik64-compiler-core"
13
+ },
14
+ "license": "SEE LICENSE IN LICENSE",
15
+ "author": "Carlos J. Pérez <carlos@brik64.dev> (https://ub.academia.edu/CarlosPerez)",
16
+ "bin": {
17
+ "brikc": "bin/brikc",
18
+ "brikfmt": "bin/brikfmt",
19
+ "brikcheck": "bin/brikcheck"
20
+ },
21
+ "scripts": {
22
+ "postinstall": "node scripts/install.js"
23
+ },
24
+ "os": ["linux", "darwin"],
25
+ "cpu": ["x64", "arm64"],
26
+ "engines": {
27
+ "node": ">=16"
28
+ },
29
+ "files": [
30
+ "bin/",
31
+ "scripts/",
32
+ "README.md"
33
+ ]
34
+ }
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * BRIK-64 npm postinstall script
4
+ * Downloads the brikc binary for the current platform from GitHub Releases.
5
+ */
6
+ const https = require('https');
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const { execFileSync } = require('child_process');
10
+
11
+ const VERSION = require('../package.json').version;
12
+ const BASE_URL = `https://github.com/brik64/brik64-dist-releases/releases/download/beta-${VERSION}`;
13
+
14
+ function getPlatform() {
15
+ const os = process.platform;
16
+ const arch = process.arch;
17
+ if (os === 'darwin' && arch === 'arm64') return 'macos-arm64';
18
+ if (os === 'darwin' && arch === 'x64') return 'macos-intel';
19
+ if (os === 'linux' && arch === 'x64') return 'linux-x86_64';
20
+ if (os === 'linux' && arch === 'arm64') return 'linux-arm64';
21
+ return null;
22
+ }
23
+
24
+ function download(url, dest) {
25
+ return new Promise((resolve, reject) => {
26
+ const file = fs.createWriteStream(dest);
27
+ function get(u) {
28
+ https.get(u, res => {
29
+ if (res.statusCode === 301 || res.statusCode === 302) {
30
+ return get(res.headers.location);
31
+ }
32
+ if (res.statusCode !== 200) {
33
+ return reject(new Error(`HTTP ${res.statusCode} for ${u}`));
34
+ }
35
+ res.pipe(file);
36
+ file.on('finish', () => file.close(resolve));
37
+ }).on('error', reject);
38
+ }
39
+ get(url);
40
+ });
41
+ }
42
+
43
+ async function main() {
44
+ const platform = getPlatform();
45
+ if (!platform) {
46
+ console.warn(`[brik64] Unsupported platform: ${process.platform}/${process.arch}`);
47
+ console.warn(`[brik64] Download manually from: ${BASE_URL}/`);
48
+ process.exit(0);
49
+ }
50
+
51
+ const binDir = path.join(__dirname, '..', 'bin');
52
+ if (!fs.existsSync(binDir)) fs.mkdirSync(binDir, { recursive: true });
53
+
54
+ const binaryName = `brikc-beta-${platform}`;
55
+ const url = `${BASE_URL}/${binaryName}`;
56
+ const dest = path.join(binDir, 'brikc');
57
+
58
+ console.log(`[brik64] Installing brikc ${VERSION} for ${platform}...`);
59
+ try {
60
+ await download(url, dest);
61
+ fs.chmodSync(dest, 0o755);
62
+
63
+ // Remove macOS quarantine (safe: no user input in args)
64
+ if (process.platform === 'darwin') {
65
+ try { execFileSync('xattr', ['-d', 'com.apple.quarantine', dest], { stdio: 'ignore' }); } catch (_) {}
66
+ }
67
+
68
+ // Symlinks for brikfmt and brikcheck
69
+ for (const alias of ['brikfmt', 'brikcheck']) {
70
+ const aliasPath = path.join(binDir, alias);
71
+ if (fs.existsSync(aliasPath)) fs.unlinkSync(aliasPath);
72
+ fs.symlinkSync('brikc', aliasPath);
73
+ }
74
+
75
+ console.log(`[brik64] Installed: ${dest}`);
76
+ try { execFileSync(dest, ['--version']); } catch (_) {}
77
+ } catch (err) {
78
+ console.error(`[brik64] Download failed: ${err.message}`);
79
+ console.error(`[brik64] Download manually from: ${url}`);
80
+ // Don't fail postinstall — allow graceful degradation
81
+ process.exit(0);
82
+ }
83
+ }
84
+
85
+ main();