ES
Tooling & InternalsCompiler · ABI v3

Packages, Libraries & Frameworks (npm-Style Workflow)

Create reusable Wysna libraries and frameworks with wysna init --lib, install local/tar/URL/registry packages with wysna add and wysna install, verify SHA-256 lockfiles, and import pkg/<alias>/<module>.

Wysna includes a built-in, zero-Python package manager inside the native SDK (wysna) combining npm-like ergonomics (wysna init, wysna add, wysna install, wysna remove, wysna packages list, wysna packages search) with deterministic SHA-256 content-addressed pinning in wysna.lock and vendor/<sha256>/.

Unlike npm, Wysna never executes arbitrary post-install lifecycle scripts and resolves every direct and transitive dependency into a flat content-addressed vendor/<sha256>/ store.


Command Equivalent Behavior
wysna init [name] [--lib] npm init Scaffolds an application or library (--lib adds src/lib.wysna, tests/lib_test.wysna, .gitignore). Without name, initializes the current working directory safely without overwriting existing files.
wysna add <spec> [--as alias] npm install <pkg> Resolves a local dir (../my-lib), .tar archive, https:///http:///file:// URL, or registry spec (name[@version]), verifies SHA-256, materializes under vendor/<sha256>/, updates wysna.toml, and refreshes wysna.lock.
wysna install [spec] npm install / npm ci With no spec, installs all dependencies declared in wysna.toml (checking local cache first, then url / registry). Use --frozen --offline in CI to require cached checksum hits and a synced wysna.lock.
wysna remove <alias> [--prune] npm uninstall Removes [dependencies.<alias>] from wysna.toml and refreshes wysna.lock. With --prune, deletes unreferenced vendor/<sha256>/ directories safely.
wysna packages list npm ls Lists declared dependencies, versions, installation status, and lock status (synced | stale | missing).
wysna packages search [query] npm search Searches a static wysna.registry-index/1 JSON catalog (--registry URL or WYSNA_REGISTRY).
wysna packages pack -o out.tar npm pack Emits a canonical USTAR v1 tarball (excluding vendor/) and outputs its deterministic archive_sha256.

Creating & Publishing a Reusable Library or Framework

Section titled “Creating & Publishing a Reusable Library or Framework”
Terminal window
wysna init http-router --lib
cd http-router

Generated layout:

http-router/
├── .gitignore # Ignores build/, .wysna_cache/, vendor/
├── wysna.toml # Manifest v1 (package, toolchain, targets, tests)
├── src/
│ ├── lib.wysna # Public library / framework entrypoint
│ └── main.wysna # Runnable smoke binary
└── tests/
└── lib_test.wysna # Automated unit test importing lib and std/test

2. Design Public APIs & Barrel Re-Exports (pub import)

Section titled “2. Design Public APIs & Barrel Re-Exports (pub import)”

Declarations in Wysna are module-private by default. Export public types and functions with pub, and re-export sub-modules cleanly from src/lib.wysna with pub import so consumers have a clean framework entrypoint:

src/router.wysna
pub struct Route {
pub method: str
pub path: str
}
pub fn make_route(method: str, path: str) -> Route {
return Route { method: method, path: path }
}
# src/lib.wysna — barrel entrypoint for the package
pub import "./router"
pub fn framework_version() -> str {
return "1.0.0"
}

Validate and run the library’s tests:

Terminal window
wysna project check
wysna project test

From any sibling service or app, add the library directory directly:

Terminal window
wysna init my-service
cd my-service
wysna add ../http-router

Wysna packs ../http-router (excluding nested vendor/), verifies its SHA-256 digest, flattens any transitive dependencies into my-service/vendor/<sha256>/, adds [dependencies.http-router] to wysna.toml, and updates wysna.lock.

Import the library using the pkg/<alias>/ namespace:

# Namespace import
import "pkg/http-router/lib" as router
# Or selective import
from "pkg/http-router/router" use { Route, make_route }
fn main() -> unit {
let r = make_route("GET", "/health")
print(router.framework_version(), r.method, r.path)
}

Build and run:

Terminal window
wysna project check --frozen
wysna project run

4. Pack & Publish to a Static JSON Registry (wysna.registry-index/1)

Section titled “4. Pack & Publish to a Static JSON Registry (wysna.registry-index/1)”

Emit a deterministic USTAR v1 tarball:

Terminal window
wysna packages pack --manifest http-router/wysna.toml -o dist/http-router-1.0.0.tar --output-format=json-v1

Upload dist/http-router-1.0.0.tar to GitHub Releases, S3, or any HTTPS/local file server, note result.archive_sha256, and add an entry to your static index.json:

{
"schema_version": "wysna.registry-index/1",
"packages": {
"http-router": {
"description": "Lightweight deterministic HTTP router for Wysna services",
"latest": "1.0.0",
"versions": {
"1.0.0": {
"url": "tarballs/http-router-1.0.0.tar",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
}
}
}
}

Relative url values resolve against the directory of the index URL. Consumers search and install directly by version:

Terminal window
wysna packages search router --registry https://packages.example.com/index.json
wysna add http-router@1.0.0 --registry https://packages.example.com/index.json

wysna.toml Dependency Schema & Cache Layout

Section titled “wysna.toml Dependency Schema & Cache Layout”
[dependencies.http-router]
path = "vendor/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
version = "1.0.0"
url = "https://packages.example.com/tarballs/http-router-1.0.0.tar"
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
registry = "https://packages.example.com/index.json"
  • If path is omitted and sha256 is present, Wysna resolves vendor/<sha256> automatically.
  • Content-addressed archive cache priority: --cache DIR -> WYSNA_PACKAGE_CACHE_HOME -> $XDG_CACHE_HOME/wysna/packages-v1 (or $HOME/.cache/wysna/packages-v1 on POSIX, %LOCALAPPDATA%\Wysna\packages-v1 on Windows).
  • Recommended CI flow: Commit wysna.toml and wysna.lock (keep vendor/ ignored in .gitignore), then restore and verify offline:
Terminal window
wysna install --frozen --offline
wysna project check --frozen
wysna project test --frozen

See Project Anatomy & wysna.toml and Cross-Agent Skills for machine-readable --output-format=json-v1 schemas (wysna.package-add/1, wysna.package-install/1, wysna.package-remove/1, wysna.package-list/1, wysna.package-search/1).