@brik64/cli 0.1.0-beta.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.
@@ -0,0 +1,36 @@
1
+ {
2
+ "schema": "brik64.cli_project_manifest.v1",
3
+ "project": "brik64-cli",
4
+ "cliVersion": "0.1.0-beta.0",
5
+ "semanticSourceStatus": "candidate_pcd_seed",
6
+ "semanticSourceRoot": "pcd/",
7
+ "compositionPcd": "pcd/cli_polymer.pcd",
8
+ "bootstrapEntrypoint": "src/brik.js",
9
+ "publicBinaryName": "brik",
10
+ "claimBoundary": {
11
+ "releaseAuthorized": false,
12
+ "fixpointClaimAuthorized": false,
13
+ "n5ClaimAuthorized": false,
14
+ "formalCertificationAuthorized": false,
15
+ "rustIndependenceClaimAuthorized": false
16
+ },
17
+ "methodologyTransition": {
18
+ "target": "pcd_first_cli_iteration",
19
+ "requiredBeforePublicBeta": [
20
+ "pcd_semantic_source_complete",
21
+ "pcd_polymer_composition_report_present",
22
+ "pcd_certification_report_present",
23
+ "brik_compiler_build_report_present",
24
+ "macos_arm64_execution_report_present",
25
+ "linux_distro_execution_reports_present",
26
+ "windows_x64_execution_report_present",
27
+ "release_claim_boundary_gate_pass"
28
+ ],
29
+ "currentStatus": "bootstrap_non_release"
30
+ },
31
+ "certification": {
32
+ "certifiesFormalCorrectness": false,
33
+ "certifiesTests": false,
34
+ "certifiesFixpoint": false
35
+ }
36
+ }
package/LICENSE ADDED
@@ -0,0 +1,6 @@
1
+ All rights reserved.
2
+
3
+ This public beta repository is published for evaluation of the BRIK64 CLI 0.1
4
+ candidate and its bounded local workflow. Use, redistribution, commercial use,
5
+ and derivative works require a separate license from BRIK64 unless a later
6
+ release explicitly states otherwise.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # BRIK CLI
2
+
3
+ This repository is the iteration surface for the BRIK64 CLI.
4
+
5
+ `brik64-prod` remains the authority for methodology, evidence gates, claim
6
+ boundaries and release certification. This repo is for CLI source, packaging,
7
+ platform builds, local tests and versioned beta artifacts.
8
+
9
+ Current status: public beta pre-release candidate for `0.1.0-beta.0`.
10
+ Do not claim npm publication, GitHub Release publication, universal platform
11
+ support, N5 authorization, formal certification or production readiness unless
12
+ the corresponding `brik64-prod` release gates and public manifests pass.
@@ -0,0 +1,31 @@
1
+ # BRIK CLI Methodology Transition
2
+
3
+ ## Rule
4
+
5
+ The initial beta can use scaffold and operational artifacts while the CLI is
6
+ being made usable. Once the beta CLI is functionally validated, CLI semantics
7
+ must move to BRIK64 methodology:
8
+
9
+ 1. create `.brik` project metadata;
10
+ 2. generate CLI PCDs as the semantic source;
11
+ 3. certify candidate PCDs through the active prod gates;
12
+ 4. compile the CLI through the approved compiler path;
13
+ 5. make future CLI iterations by modifying PCD logic, not by treating emitted
14
+ target code as the semantic source.
15
+
16
+ ## Boundary
17
+
18
+ This document does not claim current fixpoint, N5 authorization, public beta
19
+ release readiness or Rust independence.
20
+
21
+ The transition is blocked until the initial CLI beta has real platform evidence
22
+ and `brik64-prod` release gates allow promotion.
23
+
24
+ ## Required Evidence Before Stronger Claims
25
+
26
+ - `.brik` manifest for the CLI repo.
27
+ - PCD source set for CLI logic.
28
+ - PCD certification reports.
29
+ - Compiler provenance report.
30
+ - Platform execution reports.
31
+ - Fixpoint/reproducibility evidence under the active methodology.
@@ -0,0 +1,27 @@
1
+ # Linux Hetzner Testing
2
+
3
+ Hetzner is the Linux test surface for the CLI beta.
4
+
5
+ Scope:
6
+ - Debian x64 native artifact execution.
7
+ - Ubuntu x64 native artifact execution.
8
+ - Fedora x64 native artifact execution.
9
+ - Alpine x64 musl only with a separate musl artifact or explicit unsupported
10
+ decision.
11
+
12
+ Required evidence per supported distro:
13
+ - distro identity (`/etc/os-release`);
14
+ - architecture (`uname -m`);
15
+ - native binary path;
16
+ - no wrapper evidence;
17
+ - `brik --version` output;
18
+ - BRIK64 ASCII startup output;
19
+ - command-contract smoke;
20
+ - PCD/certify/emit workflow smoke;
21
+ - behavior PASS report.
22
+
23
+ Boundary:
24
+ - No universal Linux claim.
25
+ - No public release authorization.
26
+ - No N5, fixpoint or release-readiness claim from a distro smoke alone.
27
+ - Windows remains waiting for a real PC/runner.
@@ -0,0 +1,27 @@
1
+ # macOS Local Testing
2
+
3
+ This machine is the local macOS test surface for the CLI beta.
4
+
5
+ Current local platform:
6
+ - OS: macOS / Darwin
7
+ - Architecture: arm64
8
+
9
+ Scope:
10
+ - local CLI execution;
11
+ - local install path checks;
12
+ - local command-contract checks;
13
+ - no public release authorization.
14
+
15
+ Out of scope:
16
+ - macOS x64 runner evidence;
17
+ - Windows evidence;
18
+ - universal macOS artifact claims;
19
+ - fixpoint, N5 or release claims.
20
+
21
+ Required evidence before marking macOS local ready:
22
+ - local binary path;
23
+ - `brik --version` output;
24
+ - BRIK64 ASCII startup output;
25
+ - command-contract smoke;
26
+ - PCD/certify/emit local workflow smoke;
27
+ - report stored under `evidence/macos-local/`.
@@ -0,0 +1,12 @@
1
+ # Platform Matrix
2
+
3
+ | Platform | Status | Required Evidence |
4
+ | --- | --- | --- |
5
+ | macOS arm64 local | pending | local binary execution report |
6
+ | Linux Debian x64 | pending | native binary, no wrapper, behavior PASS |
7
+ | Linux Ubuntu x64 | pending | native binary, no wrapper, behavior PASS |
8
+ | Linux Fedora x64 | pending | native binary, no wrapper, behavior PASS |
9
+ | Linux Alpine x64 musl | pending | separate musl artifact or explicit unsupported decision |
10
+ | Windows x64 | waiting | real PC/runner metadata and execution report |
11
+
12
+ Do not collapse these into "all Linux" or "all platforms" claims.
@@ -0,0 +1,30 @@
1
+ # BRIK CLI Repository Boundary
2
+
3
+ ## Lives Here
4
+
5
+ - CLI source code.
6
+ - CLI tests and fixtures.
7
+ - Platform packaging scripts.
8
+ - Local beta artifacts.
9
+ - Per-version changelogs.
10
+
11
+ ## Does Not Live Here
12
+
13
+ - Private engines.
14
+ - Claim-bearing certification authority.
15
+ - Public release authorization.
16
+ - N-level claims.
17
+ - Prod evidence source of truth.
18
+
19
+ ## Authority Split
20
+
21
+ - `brik64-cli`: implementation and packaging iteration.
22
+ - `brik64-prod`: gates, evidence, methodology, release decision and claim
23
+ boundary.
24
+
25
+ ## Platform Scope
26
+
27
+ - macOS local testing can run on the current development machine.
28
+ - Linux testing should run on the Hetzner runner and must be split by distro
29
+ family rather than claimed as universal Linux support.
30
+ - Windows testing remains pending until a real Windows PC/runner is available.
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,31 @@
1
+ {
2
+ "schema_version": "brik64.generated_artifact_manifest.v1",
3
+ "kind": "brik64.bir_artifact_manifest.v1",
4
+ "source_pcd": "/Users/carlosjperez/Documents/GitHub/brik64-cli/pcd/cli_polymer.pcd",
5
+ "source_pcd_sha256": "sha256:776bbd5a15357bf47350a81011f1d12bdf4a04fb843cd035c39f9b3985cb9196",
6
+ "artifact": "/Users/carlosjperez/Documents/GitHub/brik64-prod/out/pit-cycle/BRIK-CLI-BRIKC-COMPILE-EXECUTION-R156-20260601/artifacts/brik_cli_polymer.bir",
7
+ "artifact_sha256": "sha256:37c86b45fb810658459f5c88e9e92ab68945bb11b91179bb0ca0de15c0eec065",
8
+ "target": "bir",
9
+ "claim_authority": "non_claim_artifact_binding",
10
+ "public_claims_allowed": false,
11
+ "certifies_tests": false,
12
+ "bir_metadata": {
13
+ "schema_version": "brik64.numeric_domain_bir_metadata.v1",
14
+ "module": "brik_cli_polymer",
15
+ "string_table_entries": 3,
16
+ "numeric_domain_profile_hash_bound_to_bir": true,
17
+ "numeric_domain_profile_hashes": [],
18
+ "numeric_domain_metadata_strings": [
19
+ "BRIK64-NUMERIC-DOMAIN-PROFILE-BINDING:v1",
20
+ "numeric_domain_profile_required=false",
21
+ "numeric_domain_profile_count=0"
22
+ ]
23
+ },
24
+ "numeric_domain": {
25
+ "schema_version": "brik64.numeric_domain_artifact_binding.v1",
26
+ "profile_required": false,
27
+ "numeric_domain_profile_hashes": [],
28
+ "validation_issues": [],
29
+ "guard_stability_findings": []
30
+ }
31
+ }
@@ -0,0 +1,76 @@
1
+ ; BIR Module: brik_cli_polymer
2
+ ; Version: 1
3
+ ; Inputs: []
4
+ ; Output: Some("tmp_CMP_6")
5
+ ; Vars: 13 slots
6
+ ; Strings: 3 entries
7
+ ; Instructions: 67
8
+
9
+ 0000: PUSH_I64 0
10
+ 0001: STORE $0
11
+ 0002: JUMP +63
12
+ fn::brik_cli_polymer:
13
+ 0003: STORE $5
14
+ 0004: STORE $4
15
+ 0005: STORE $3
16
+ 0006: STORE $2
17
+ 0007: LOAD $3
18
+ 0008: PUSH_I64 0
19
+ 0009: CMP_EQ
20
+ 0010: STORE $6
21
+ 0011: LOAD $6
22
+ 0012: JUMP_IF_NOT +3
23
+ 0013: PUSH_I64 64
24
+ 0014: RET
25
+ 0015: LOAD $2
26
+ 0016: PUSH_I64 1
27
+ 0017: CMP_EQ
28
+ 0018: STORE $7
29
+ 0019: LOAD $7
30
+ 0020: JUMP_IF_NOT +3
31
+ 0021: PUSH_I64 0
32
+ 0022: RET
33
+ 0023: LOAD $2
34
+ 0024: PUSH_I64 2
35
+ 0025: CMP_EQ
36
+ 0026: STORE $8
37
+ 0027: LOAD $8
38
+ 0028: JUMP_IF_NOT +27
39
+ 0029: LOAD $4
40
+ 0030: PUSH_I64 0
41
+ 0031: CMP_EQ
42
+ 0032: STORE $9
43
+ 0033: LOAD $9
44
+ 0034: JUMP_IF_NOT +3
45
+ 0035: PUSH_I64 67
46
+ 0036: RET
47
+ 0037: LOAD $5
48
+ 0038: PUSH_I64 1
49
+ 0039: CMP_LT
50
+ 0040: STORE $10
51
+ 0041: LOAD $10
52
+ 0042: JUMP_IF_NOT +3
53
+ 0043: PUSH_I64 65
54
+ 0044: RET
55
+ 0045: LOAD $5
56
+ 0046: PUSH_I64 3
57
+ 0047: CMP_GT
58
+ 0048: STORE $11
59
+ 0049: LOAD $11
60
+ 0050: JUMP_IF_NOT +3
61
+ 0051: PUSH_I64 65
62
+ 0052: RET
63
+ 0053: PUSH_I64 1
64
+ 0054: RET
65
+ 0055: LOAD $2
66
+ 0056: PUSH_I64 64
67
+ 0057: CMP_EQ
68
+ 0058: STORE $12
69
+ 0059: LOAD $12
70
+ 0060: JUMP_IF_NOT +3
71
+ 0061: PUSH_I64 64
72
+ 0062: RET
73
+ 0063: PUSH_I64 0
74
+ 0064: RET
75
+ 0065: LOAD $12
76
+ 0066: HALT
@@ -0,0 +1,36 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "generator": "brikc v5.0.0-beta.1",
4
+ "timestamp": "2026-06-01T09:27:14Z",
5
+ "issuer": "BRIK-64 v5.0.0-beta.1",
6
+ "valid_from": "2026-06-01T09:27:14Z",
7
+ "verification_url": "https://registry.brik64.dev/cert/341eff541ce59269",
8
+ "signature": "341eff541ce592695ffc34374513e0998ae6d98e571cc29d098b7c572161fe60",
9
+ "source": {
10
+ "file": "/Users/carlosjperez/Documents/GitHub/brik64-cli/pcd/cli_polymer.pcd",
11
+ "hash_sha256": "776bbd5a15357bf47350a81011f1d12bdf4a04fb843cd035c39f9b3985cb9196",
12
+ "language": "pcd"
13
+ },
14
+ "certification": {
15
+ "phi_c": 1.0,
16
+ "level": "CORE",
17
+ "monomers_used": [],
18
+ "monomer_names": [],
19
+ "domain_safe": true,
20
+ "deterministic": true,
21
+ "total_statements": 0
22
+ },
23
+ "target": {
24
+ "language": "bir",
25
+ "file": "/Users/carlosjperez/Documents/GitHub/brik64-prod/out/pit-cycle/BRIK-CLI-BRIKC-COMPILE-EXECUTION-R156-20260601/artifacts/brik_cli_polymer.bir",
26
+ "hash_sha256": "37c86b45fb810658459f5c88e9e92ab68945bb11b91179bb0ca0de15c0eec065",
27
+ "lines": 3
28
+ },
29
+ "chain": {
30
+ "source_hash": "776bbd5a15357bf47350a81011f1d12bdf4a04fb843cd035c39f9b3985cb9196",
31
+ "pcd_hash": "776bbd5a15357bf47350a81011f1d12bdf4a04fb843cd035c39f9b3985cb9196",
32
+ "plan_hash": "c82803e958cd599179090285b9994f310fe2bfdda8c9951d5cbabc036b026c6a",
33
+ "target_hash": "37c86b45fb810658459f5c88e9e92ab68945bb11b91179bb0ca0de15c0eec065",
34
+ "compiler_version": "5.0.0-beta.1"
35
+ }
36
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": "brik64.cli_bir_candidate_package_manifest.v1",
3
+ "generatedAt": "2026-06-01T09:36:21Z",
4
+ "source_compile_report": "out/pit-cycle/BRIK-CLI-BRIKC-COMPILE-EXECUTION-R156-20260601/brik_cli_brikc_compile_execution_report.json",
5
+ "artifact_kind": "cli_polymer_candidate_bir_package",
6
+ "artifacts": {
7
+ "bir": {
8
+ "path": "brik_cli_polymer.bir",
9
+ "sha256": "37c86b45fb810658459f5c88e9e92ab68945bb11b91179bb0ca0de15c0eec065"
10
+ },
11
+ "certificate": {
12
+ "path": "brik_cli_polymer.cert.json",
13
+ "sha256": "0ca22bebf3caf1e4bce7673b90805b54685f8310c517921ef0af29eefbf9ddab"
14
+ }
15
+ },
16
+ "claim_boundary": {
17
+ "package_only": true,
18
+ "executable_binary": false,
19
+ "semantic_execution": false,
20
+ "fixpoint": false,
21
+ "release": false,
22
+ "n5": false
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": "brik64.cli_local_candidate_certificate.v1",
3
+ "generatedAt": "2026-06-03T05:06:50Z",
4
+ "pcd": {
5
+ "path": "pcd/cli_certify_emit.pcd",
6
+ "sha256": "1d73245ebee8592a4eeacdb4b99398baf7c5ddfa3c88c5927f924a871eee7147"
7
+ },
8
+ "certificate": {
9
+ "kind": "local_candidate_certificate",
10
+ "status": "candidate_only",
11
+ "certifiesFormalCorrectness": false,
12
+ "certifiesTests": false,
13
+ "certifiesFixpoint": false,
14
+ "certifiesN5": false,
15
+ "permitsCompile": false
16
+ },
17
+ "claim_boundary": {
18
+ "formal_certification_allowed": false,
19
+ "public_beta_allowed": false,
20
+ "release_allowed": false,
21
+ "n5_claim_allowed": false,
22
+ "rust_independence_claim_allowed": false
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": "brik64.cli_local_candidate_certificate.v1",
3
+ "generatedAt": "2026-06-03T05:06:50Z",
4
+ "pcd": {
5
+ "path": "pcd/cli_core.pcd",
6
+ "sha256": "c1d3167109d842c5b321ed541604bdcff2c7be7865b2aac8116f1db03b557944"
7
+ },
8
+ "certificate": {
9
+ "kind": "local_candidate_certificate",
10
+ "status": "candidate_only",
11
+ "certifiesFormalCorrectness": false,
12
+ "certifiesTests": false,
13
+ "certifiesFixpoint": false,
14
+ "certifiesN5": false,
15
+ "permitsCompile": false
16
+ },
17
+ "claim_boundary": {
18
+ "formal_certification_allowed": false,
19
+ "public_beta_allowed": false,
20
+ "release_allowed": false,
21
+ "n5_claim_allowed": false,
22
+ "rust_independence_claim_allowed": false
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": "brik64.cli_local_candidate_certificate.v1",
3
+ "generatedAt": "2026-06-03T05:06:50Z",
4
+ "pcd": {
5
+ "path": "pcd/cli_init_policy.pcd",
6
+ "sha256": "fae8cf2f18ba00b337236a46ee7d212b1437c7b4eae812ca1e3506651ffdb31d"
7
+ },
8
+ "certificate": {
9
+ "kind": "local_candidate_certificate",
10
+ "status": "candidate_only",
11
+ "certifiesFormalCorrectness": false,
12
+ "certifiesTests": false,
13
+ "certifiesFixpoint": false,
14
+ "certifiesN5": false,
15
+ "permitsCompile": false
16
+ },
17
+ "claim_boundary": {
18
+ "formal_certification_allowed": false,
19
+ "public_beta_allowed": false,
20
+ "release_allowed": false,
21
+ "n5_claim_allowed": false,
22
+ "rust_independence_claim_allowed": false
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": "brik64.cli_local_candidate_certificate.v1",
3
+ "generatedAt": "2026-06-03T05:06:50Z",
4
+ "pcd": {
5
+ "path": "pcd/cli_polymer.pcd",
6
+ "sha256": "776bbd5a15357bf47350a81011f1d12bdf4a04fb843cd035c39f9b3985cb9196"
7
+ },
8
+ "certificate": {
9
+ "kind": "local_candidate_certificate",
10
+ "status": "candidate_only",
11
+ "certifiesFormalCorrectness": false,
12
+ "certifiesTests": false,
13
+ "certifiesFixpoint": false,
14
+ "certifiesN5": false,
15
+ "permitsCompile": false
16
+ },
17
+ "claim_boundary": {
18
+ "formal_certification_allowed": false,
19
+ "public_beta_allowed": false,
20
+ "release_allowed": false,
21
+ "n5_claim_allowed": false,
22
+ "rust_independence_claim_allowed": false
23
+ }
24
+ }
@@ -0,0 +1,7 @@
1
+ # PCD Seed Evidence Boundary
2
+
3
+ This directory is reserved for future reports generated from the candidate PCD
4
+ source in `pcd/`.
5
+
6
+ No report in this directory currently authorizes a public beta, fixpoint claim,
7
+ N5 claim, formal certification claim, or Rust-independence claim.
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@brik64/cli",
3
+ "version": "0.1.0-beta.0",
4
+ "private": false,
5
+ "description": "BRIK64 CLI 0.1 public beta scaffold for local PCD workflows and bounded evidence review.",
6
+ "homepage": "https://docs.brik64.com/cli/install",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/brik64/brik64-cli.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/brik64/brik64-cli/issues"
13
+ },
14
+ "license": "SEE LICENSE IN LICENSE",
15
+ "bin": {
16
+ "brik": "src/brik.js"
17
+ },
18
+ "scripts": {
19
+ "test": "bash tests/smoke.sh"
20
+ }
21
+ }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,15 @@
1
+ # macOS Local Bootstrap Wrapper
2
+
3
+ This directory contains a local macOS bootstrap wrapper for testing:
4
+
5
+ ```bash
6
+ export PATH="/Users/carlosjperez/Documents/GitHub/brik64-cli/packaging/macos-local:$PATH"
7
+ brik --version
8
+ ```
9
+
10
+ Boundary:
11
+ - bootstrap wrapper only;
12
+ - depends on local Node.js;
13
+ - not a native final artifact;
14
+ - not public release evidence;
15
+ - not post-beta `.brik`/PCD semantic source.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
+ REPO_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
5
+ exec node "$REPO_DIR/src/brik.js" "$@"
package/pcd/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # BRIK CLI PCD Seed
2
+
3
+ This directory contains candidate semantic PCD seeds for the local `brik` CLI.
4
+ They are not release artifacts and do not certify formal correctness, N5 status,
5
+ fixpoint, or Rust independence.
6
+
7
+ Current status:
8
+
9
+ - Source of truth for executable behavior remains `src/brik.js`.
10
+ - These PCD files define the transition contract for moving CLI iteration to a
11
+ PCD-first BRIK64 methodology.
12
+ - `cli_polymer.pcd` is the candidate composition contract that binds the CLI
13
+ command PCD seeds before any future compile route.
14
+ - Any future public beta claim must be backed by fresh compiler, certificate,
15
+ platform execution, and release-boundary reports.
16
+
17
+ Required next methodology step:
18
+
19
+ 1. Complete candidate PCD coverage for all CLI behavior.
20
+ 2. Certify candidate PCDs with the active private gate stack.
21
+ 3. Validate the polymer/composition PCD against the certified command PCDs.
22
+ 4. Compile the CLI through the BRIK compiler path.
23
+ 5. Run macOS, Linux distro, and Windows execution reports.
24
+ 6. Promote only if the release claim boundary gate passes.
@@ -0,0 +1,32 @@
1
+ // brik64.pcd_file.v1
2
+ // name: brik_cli_certify_emit
3
+ // status: candidate_pcd_seed
4
+ // certifiesFormalCorrectness: false
5
+ // certifiesTests: false
6
+ // certifiesFixpoint: false
7
+ // commands = "certify,emit"
8
+ // supported_emit_targets = "ts,rust,python"
9
+ // certificate_kind = "local_candidate_certificate"
10
+ // fail_closed_on missing_certificate
11
+ // claim_boundary = "local_candidate_only"
12
+
13
+ PC brik_cli_certify_emit {
14
+ fn brik_cli_certify_emit(pcd_present, certificate_present, target_code, tests_requested) {
15
+ if (pcd_present == 0) {
16
+ return 64;
17
+ }
18
+ if (certificate_present == 0) {
19
+ return 67;
20
+ }
21
+ if (target_code < 1) {
22
+ return 65;
23
+ }
24
+ if (target_code > 3) {
25
+ return 65;
26
+ }
27
+ if (tests_requested == 1) {
28
+ return 2;
29
+ }
30
+ return 1;
31
+ }
32
+ }
@@ -0,0 +1,30 @@
1
+ // brik64.pcd_file.v1
2
+ // name: brik_cli_core
3
+ // status: candidate_pcd_seed
4
+ // certifiesFormalCorrectness: false
5
+ // certifiesTests: false
6
+ // certifiesFixpoint: false
7
+ // product = "brik64-cli"
8
+ // cli_version = "0.1.0-beta.0"
9
+ // public_binary = "brik"
10
+ // execution_status = "bootstrap_non_release"
11
+ // ascii_banner = "BRIK64"
12
+ // claim_boundary = "local_candidate_only"
13
+
14
+ PC brik_cli_core {
15
+ fn brik_cli_core(command_code, json_mode, ci_mode) {
16
+ if (json_mode == 1) {
17
+ return 0;
18
+ }
19
+ if (ci_mode == 1) {
20
+ return 0;
21
+ }
22
+ if (command_code == 0) {
23
+ return 1;
24
+ }
25
+ if (command_code == 64) {
26
+ return 64;
27
+ }
28
+ return 0;
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ // brik64.pcd_file.v1
2
+ // name: brik_cli_init_policy
3
+ // status: candidate_pcd_seed
4
+ // certifiesFormalCorrectness: false
5
+ // certifiesTests: false
6
+ // certifiesFixpoint: false
7
+ // command = "init"
8
+ // writes = ".brik/manifest.json"
9
+ // protected_file = "AGENTS.md"
10
+ // agent_instruction_policy = "consent_required"
11
+ // invariant creates_agents_md == false
12
+ // invariant existing_agents_md_must_not_be_overwritten == true
13
+ // claim_boundary = "local_candidate_only"
14
+
15
+ PC brik_cli_init_policy {
16
+ fn brik_cli_init_policy(workspace_readable, has_brik_dir, has_agents_md, consent_given) {
17
+ if (workspace_readable == 0) {
18
+ return 64;
19
+ }
20
+ if (has_brik_dir == 1) {
21
+ return 0;
22
+ }
23
+ if (has_agents_md == 1) {
24
+ if (consent_given == 0) {
25
+ return 1;
26
+ }
27
+ }
28
+ return 0;
29
+ }
30
+ }
@@ -0,0 +1,52 @@
1
+ // brik64.pcd_file.v1
2
+ // name: brik_cli_polymer
3
+ // status: candidate_pcd_seed
4
+ // certifiesFormalCorrectness: false
5
+ // certifiesTests: false
6
+ // certifiesFixpoint: false
7
+ // product = "brik64-cli"
8
+ // cli_version = "0.1.0-beta.0"
9
+ // composition_kind = "polymer"
10
+ // source_units = "cli_core.pcd,cli_init_policy.pcd,cli_certify_emit.pcd"
11
+ // compile_status = "not_compiled"
12
+ // certificate_status = "candidate_only"
13
+ // reads "pcd/cli_core.pcd"
14
+ // reads "pcd/cli_init_policy.pcd"
15
+ // reads "pcd/cli_certify_emit.pcd"
16
+ // requires ascii_banner == "BRIK64"
17
+ // requires agent_instruction_policy == "consent_required"
18
+ // requires existing_agents_md_must_not_be_overwritten == true
19
+ // requires certificate_before_emit == true
20
+ // requires supported_emit_targets == "ts,rust,python"
21
+ // invariant compile_requires_certified_pcd_batch == true
22
+ // invariant compile_requires_polymer_contract == true
23
+ // invariant public_claim_allowed == false
24
+ // polymer brik_cli_candidate
25
+ // claim_boundary = "local_candidate_only"
26
+
27
+ PC brik_cli_polymer {
28
+ fn brik_cli_polymer(command_code, workspace_readable, certificate_present, target_code) {
29
+ if (workspace_readable == 0) {
30
+ return 64;
31
+ }
32
+ if (command_code == 1) {
33
+ return 0;
34
+ }
35
+ if (command_code == 2) {
36
+ if (certificate_present == 0) {
37
+ return 67;
38
+ }
39
+ if (target_code < 1) {
40
+ return 65;
41
+ }
42
+ if (target_code > 3) {
43
+ return 65;
44
+ }
45
+ return 1;
46
+ }
47
+ if (command_code == 64) {
48
+ return 64;
49
+ }
50
+ return 0;
51
+ }
52
+ }
package/src/.gitkeep ADDED
@@ -0,0 +1 @@
1
+
package/src/brik.js ADDED
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const crypto = require('crypto');
5
+
6
+ process.stdout.on('error', (error) => {
7
+ if (error.code === 'EPIPE') process.exit(0);
8
+ throw error;
9
+ });
10
+
11
+ const version = '0.1.0-beta.0';
12
+ const ascii = [
13
+ ' ____ ____ ___ _ __ __ _ _ ',
14
+ '| __ )| _ \\|_ _| |/ // /_ | || |',
15
+ "| _ \\| |_) || || ' /| '_ \\| || |_",
16
+ '| |_) | _ < | || . \\| (_) |__ _|',
17
+ '|____/|_| \\_\\___|_|\\_\\\\___/ |_| ',
18
+ ].join('\n');
19
+
20
+ function sha256(value) {
21
+ return crypto.createHash('sha256').update(value).digest('hex');
22
+ }
23
+
24
+ function printBanner() {
25
+ process.stdout.write(`${ascii}\n`);
26
+ process.stdout.write(`BRIK64 CLI ${version}\n`);
27
+ process.stdout.write('status=bootstrap_non_release\n');
28
+ }
29
+
30
+ function help() {
31
+ printBanner();
32
+ process.stdout.write('\ncommands:\n');
33
+ process.stdout.write(' init create .brik metadata only\n');
34
+ process.stdout.write(' certify <file.pcd> write local candidate certificate\n');
35
+ process.stdout.write(' emit <file.pcd> emit only when local certificate exists\n');
36
+ process.stdout.write(' --target <ts|rust|python> --out <dir> --tests\n');
37
+ process.stdout.write(' --version print version\n');
38
+ }
39
+
40
+ function readFileRequired(file) {
41
+ if (!file) {
42
+ process.stderr.write('missing_file_argument\n');
43
+ process.exit(64);
44
+ }
45
+ if (!fs.existsSync(file)) {
46
+ process.stderr.write(`file_not_found:${file}\n`);
47
+ process.exit(66);
48
+ }
49
+ return fs.readFileSync(file, 'utf8');
50
+ }
51
+
52
+ function init() {
53
+ const brikDir = path.resolve('.brik');
54
+ fs.mkdirSync(brikDir, { recursive: true });
55
+ const manifestPath = path.join(brikDir, 'manifest.json');
56
+ if (!fs.existsSync(manifestPath)) {
57
+ fs.writeFileSync(manifestPath, JSON.stringify({
58
+ schemaVersion: 'brik64.cli_project_manifest.v1',
59
+ cliVersion: version,
60
+ createdBy: 'brik64-cli-bootstrap',
61
+ claimBoundary: {
62
+ publicBetaAllowed: false,
63
+ releaseAllowed: false,
64
+ generatedAgentsFile: false
65
+ }
66
+ }, null, 2) + '\n');
67
+ }
68
+ process.stdout.write(`created=${path.relative(process.cwd(), manifestPath)}\n`);
69
+ }
70
+
71
+ function certPathFor(file) {
72
+ return `${file}.cert.json`;
73
+ }
74
+
75
+ function parseEmitOptions(args) {
76
+ const options = { target: null, outDir: null, tests: false };
77
+ for (let index = 0; index < args.length; index += 1) {
78
+ const arg = args[index];
79
+ if (arg === '--target') {
80
+ options.target = args[index + 1];
81
+ index += 1;
82
+ } else if (arg === '--out') {
83
+ options.outDir = args[index + 1];
84
+ index += 1;
85
+ } else if (arg === '--tests') {
86
+ options.tests = true;
87
+ } else {
88
+ process.stderr.write(`unknown_emit_option:${arg}\n`);
89
+ process.exit(64);
90
+ }
91
+ }
92
+ return options;
93
+ }
94
+
95
+ function targetSpec(target) {
96
+ const specs = {
97
+ ts: {
98
+ program: 'program.ts',
99
+ test: 'program.test.ts',
100
+ code: (hash) => [
101
+ '// BRIK64 bootstrap emission candidate',
102
+ '// claim: local candidate only',
103
+ `export const pcdSha256 = "${hash}";`,
104
+ 'export function run(): string {',
105
+ ' return `brik:${pcdSha256}`;',
106
+ '}',
107
+ '',
108
+ ].join('\n'),
109
+ testCode: (hash) => [
110
+ 'import { pcdSha256, run } from "./program";',
111
+ '',
112
+ 'if (pcdSha256 !== "' + hash + '") throw new Error("pcd hash mismatch");',
113
+ 'if (run() !== `brik:${pcdSha256}`) throw new Error("run mismatch");',
114
+ 'console.log("brik64 generated ts test: PASS");',
115
+ '',
116
+ ].join('\n'),
117
+ },
118
+ rust: {
119
+ program: 'program.rs',
120
+ test: 'program_test.rs',
121
+ code: (hash) => [
122
+ '// BRIK64 bootstrap emission candidate',
123
+ '// claim: local candidate only',
124
+ `pub const PCD_SHA256: &str = "${hash}";`,
125
+ 'pub fn run() -> String {',
126
+ ' format!("brik:{}", PCD_SHA256)',
127
+ '}',
128
+ '',
129
+ ].join('\n'),
130
+ testCode: (hash) => [
131
+ `const PCD_SHA256: &str = "${hash}";`,
132
+ 'fn run() -> String {',
133
+ ' format!("brik:{}", PCD_SHA256)',
134
+ '}',
135
+ '',
136
+ 'fn main() {',
137
+ ` assert_eq!(PCD_SHA256, "${hash}");`,
138
+ ' assert_eq!(run(), format!("brik:{}", PCD_SHA256));',
139
+ ' println!("brik64 generated rust test: PASS");',
140
+ '}',
141
+ '',
142
+ ].join('\n'),
143
+ },
144
+ python: {
145
+ program: 'program.py',
146
+ test: 'test_program.py',
147
+ code: (hash) => [
148
+ '# BRIK64 bootstrap emission candidate',
149
+ '# claim: local candidate only',
150
+ `PCD_SHA256 = "${hash}"`,
151
+ '',
152
+ 'def run():',
153
+ ' return f"brik:{PCD_SHA256}"',
154
+ '',
155
+ ].join('\n'),
156
+ testCode: (hash) => [
157
+ 'from program import PCD_SHA256, run',
158
+ '',
159
+ `assert PCD_SHA256 == "${hash}"`,
160
+ 'assert run() == f"brik:{PCD_SHA256}"',
161
+ 'print("brik64 generated python test: PASS")',
162
+ '',
163
+ ].join('\n'),
164
+ },
165
+ };
166
+ return specs[target] || null;
167
+ }
168
+
169
+ function certify(file) {
170
+ const source = readFileRequired(file);
171
+ const cert = {
172
+ schemaVersion: 'brik64.cli_local_candidate_certificate.v1',
173
+ cliVersion: version,
174
+ pcd: file,
175
+ semantic_pcd_sha256: sha256(source),
176
+ certifiesFormalCorrectness: false,
177
+ certifiesTests: false,
178
+ claimBoundary: {
179
+ localCandidateOnly: true,
180
+ publicBetaAllowed: false,
181
+ releaseAllowed: false
182
+ }
183
+ };
184
+ const certPath = certPathFor(file);
185
+ fs.writeFileSync(certPath, JSON.stringify(cert, null, 2) + '\n');
186
+ process.stdout.write(`certificate=${certPath}\n`);
187
+ }
188
+
189
+ function emit(file, args = []) {
190
+ const source = readFileRequired(file);
191
+ const certPath = certPathFor(file);
192
+ if (!fs.existsSync(certPath)) {
193
+ process.stderr.write(`certificate_required:${certPath}\n`);
194
+ process.exit(67);
195
+ }
196
+ const cert = JSON.parse(fs.readFileSync(certPath, 'utf8'));
197
+ if (cert.semantic_pcd_sha256 !== sha256(source)) {
198
+ process.stderr.write('certificate_hash_mismatch\n');
199
+ process.exit(68);
200
+ }
201
+ const options = parseEmitOptions(args);
202
+ if (options.target || options.outDir || options.tests) {
203
+ const spec = targetSpec(options.target);
204
+ if (!spec) {
205
+ process.stderr.write('unsupported_target\n');
206
+ process.exit(69);
207
+ }
208
+ if (!options.outDir) {
209
+ process.stderr.write('missing_out_dir\n');
210
+ process.exit(64);
211
+ }
212
+ fs.mkdirSync(options.outDir, { recursive: true });
213
+ fs.writeFileSync(path.join(options.outDir, spec.program), spec.code(cert.semantic_pcd_sha256));
214
+ if (options.tests) {
215
+ fs.writeFileSync(path.join(options.outDir, spec.test), spec.testCode(cert.semantic_pcd_sha256));
216
+ }
217
+ process.stdout.write(`generated=${path.join(options.outDir, spec.program)}\n`);
218
+ if (options.tests) process.stdout.write(`tests=${path.join(options.outDir, spec.test)}\n`);
219
+ return;
220
+ }
221
+ process.stdout.write('// BRIK64 bootstrap emission candidate\n');
222
+ process.stdout.write('// claim: local candidate only\n');
223
+ process.stdout.write(`// pcd_sha256=${cert.semantic_pcd_sha256}\n`);
224
+ }
225
+
226
+ function main() {
227
+ const [cmd, file, ...args] = process.argv.slice(2);
228
+ if (!cmd || cmd === '--help' || cmd === 'help') return help();
229
+ if (cmd === '--version' || cmd === 'version') {
230
+ printBanner();
231
+ return;
232
+ }
233
+ if (cmd === 'init') return init();
234
+ if (cmd === 'certify') return certify(file);
235
+ if (cmd === 'emit') return emit(file, args);
236
+ process.stderr.write(`unknown_command:${cmd}\n`);
237
+ process.exit(2);
238
+ }
239
+
240
+ main();
package/tests/.gitkeep ADDED
@@ -0,0 +1 @@
1
+
package/tests/smoke.sh ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ BRIK="$ROOT_DIR/src/brik.js"
6
+ tmpdir="$(mktemp -d)"
7
+ cleanup() { rm -rf "$tmpdir"; }
8
+ trap cleanup EXIT
9
+
10
+ node "$BRIK" --version | grep -q "BRIK64 CLI 0.1.0-beta.0"
11
+ node "$BRIK" --help | grep -q "status=bootstrap_non_release"
12
+
13
+ (
14
+ cd "$tmpdir"
15
+ node "$BRIK" init
16
+ test -f .brik/manifest.json
17
+ test ! -f AGENTS.md
18
+ )
19
+
20
+ cat >"$tmpdir/program.pcd" <<'PCD'
21
+ program sample
22
+ monomer ADD
23
+ PCD
24
+
25
+ if node "$BRIK" emit "$tmpdir/program.pcd" >/tmp/brik-emit.out 2>/tmp/brik-emit.err; then
26
+ echo "emit should require certificate" >&2
27
+ exit 1
28
+ fi
29
+ grep -q "certificate_required" /tmp/brik-emit.err
30
+
31
+ node "$BRIK" certify "$tmpdir/program.pcd"
32
+ node "$BRIK" emit "$tmpdir/program.pcd" | grep -q "pcd_sha256="
33
+
34
+ for target in ts rust python; do
35
+ out="$tmpdir/out-$target"
36
+ node "$BRIK" emit "$tmpdir/program.pcd" --target "$target" --out "$out" --tests >/tmp/brik-emit-$target.out
37
+ grep -q "generated=" "/tmp/brik-emit-$target.out"
38
+ grep -q "tests=" "/tmp/brik-emit-$target.out"
39
+ done
40
+
41
+ test -f "$tmpdir/out-ts/program.ts"
42
+ test -f "$tmpdir/out-ts/program.test.ts"
43
+ test -f "$tmpdir/out-rust/program.rs"
44
+ test -f "$tmpdir/out-rust/program_test.rs"
45
+ test -f "$tmpdir/out-python/program.py"
46
+ test -f "$tmpdir/out-python/test_program.py"
47
+
48
+ if node "$BRIK" emit "$tmpdir/program.pcd" --target go --out "$tmpdir/out-go" --tests >/tmp/brik-emit-go.out 2>/tmp/brik-emit-go.err; then
49
+ echo "unsupported target should fail closed" >&2
50
+ exit 1
51
+ fi
52
+ grep -q "unsupported_target" /tmp/brik-emit-go.err
53
+
54
+ echo "brik64-cli bootstrap smoke: PASS"