Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .machine_readable/INTENT.contractile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@

; === Purpose (what this repo IS) ===
(purpose
"{{ONE_PARAGRAPH_PURPOSE}}"
"UbiCity (Ubiquitous City of Learning) captures, maps, and analyzes learning experiences that happen outside traditional institutional boundaries — making the city itself a learning environment. Provides JSON Schema for experiences, CLI capture tool (quick/full/template), mapper for hotspots/network/learner journeys, minimal viable protocol (4-week experiment), and Voyant export for text analysis."
)

; === Anti-Purpose (what this repo is NOT — prevents scope creep) ===
(anti-purpose
"{{ONE_PARAGRAPH_ANTI_PURPOSE}}"
"This is NOT a general-purpose LMS or formal education platform, NOT smart-city infrastructure or surveillance, NOT a framework — it is a focused toolkit for documenting urban learning as it happens and discovering patterns organically from captured data, not prescribing curriculum."
; Examples:
; "This is NOT a general-purpose database — it solves one specific problem."
; "This is NOT a framework — it is a library with a focused API."
Expand All @@ -65,8 +65,8 @@

; === Ecosystem Position ===
(ecosystem
(belongs-to "{{MONOREPO_OR_STANDALONE}}")
(depends-on ("{{DEP1}}" "{{DEP2}}"))
(depended-on-by ("{{CONSUMER1}}" "{{CONSUMER2}}"))
(belongs-to "standalone")
(depends-on ("deno" "rescript"))
(depended-on-by ("ubicity-data" "voyant-tools"))
)
)
2 changes: 1 addition & 1 deletion .machine_readable/agent_instructions/methodology.a2ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ perfective = 10 # % for SPDX headers, doc updates, formatting, style
# Customise this per project — the template default is generic.

[methodology.unique-strength]
description = "{{PROJECT_UNIQUE_STRENGTH}}"
description = "Ubiquitous city learning capture — dissolving formal/informal learning boundaries by capturing, mapping, and analyzing urban learning experiences that happen outside traditional institutional boundaries; JSON Schema + capture CLI + mapper analysis + Voyant export"
deepen-not-broaden = true

# ============================================================================
Expand Down
54 changes: 26 additions & 28 deletions ABI-FFI-README.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
\{\{~ Aditionally delete this line and fill out the template below ~}}

== \{\{PROJECT}} ABI/FFI Documentation
== UBICITY ABI/FFI Documentation

=== Overview

Expand Down Expand Up @@ -29,7 +27,7 @@ compatibility
▼
┌─────────────────────────────────────────────┐
│ C Headers (auto-generated) │
│ generated/abi/{{project}}.h │
│ generated/abi/ubicity.h │
└─────────────────┬───────────────────────────┘
│
│ imported by
Expand All @@ -42,7 +40,7 @@ compatibility
│ - Memory-safe by default │
└─────────────────┬───────────────────────────┘
│
│ compiled to lib{{project}}.so/.a
│ compiled to libubicity.so/.a
▼
┌─────────────────────────────────────────────┐
│ Any Language via C ABI │
Expand All @@ -53,7 +51,7 @@ compatibility
=== Directory Structure

....
{{project}}/
ubicity/
├── src/
│ ├── abi/ # ABI definitions (Idris2)
│ │ ├── Types.idr # Core type definitions with proofs
Expand All @@ -70,11 +68,11 @@ compatibility
│ ├── test/
│ │ └── integration_test.zig
│ └── include/
│ └── {{project}}.h # C header (optional, can be generated)
│ └── ubicity.h # C header (optional, can be generated)
│
├── generated/ # Auto-generated files
│ └── abi/
│ └── {{project}}.h # Generated from Idris2 ABI
│ └── ubicity.h # Generated from Idris2 ABI
│
└── bindings/ # Language-specific wrappers (optional)
├── rust/
Expand Down Expand Up @@ -213,7 +211,7 @@ zig build test # Run tests
[source,bash]
----
cd src/abi
idris2 --cg c-header Types.idr -o ../../generated/abi/{{project}}.h
idris2 --cg c-header Types.idr -o ../../generated/abi/ubicity.h
----

==== Cross-Compile
Expand All @@ -238,19 +236,19 @@ zig build -Dtarget=x86_64-windows

[source,c]
----
#include "{{project}}.h"
#include "ubicity.h"

int main() {
void* handle = {{project}}_init();
void* handle = ubicity_init();
if (!handle) return 1;

int result = {{project}}_process(handle, 42);
int result = ubicity_process(handle, 42);
if (result != 0) {
const char* err = {{project}}_last_error();
const char* err = ubicity_last_error();
fprintf(stderr, "Error: %s\n", err);
}

{{project}}_free(handle);
ubicity_free(handle);
return 0;
}
----
Expand All @@ -259,14 +257,14 @@ Compile with:

[source,bash]
----
gcc -o example example.c -l{{project}} -L./zig-out/lib
gcc -o example example.c -lubicity -L./zig-out/lib
----

==== From Idris2

[source,idris]
----
import {{PROJECT}}.ABI.Foreign
import UBICITY.ABI.Foreign

main : IO ()
main = do
Expand All @@ -284,22 +282,22 @@ main = do

[source,rust]
----
#[link(name = "{{project}}")]
#[link(name = "ubicity")]
extern "C" {
fn {{project}}_init() -> *mut std::ffi::c_void;
fn {{project}}_free(handle: *mut std::ffi::c_void);
fn {{project}}_process(handle: *mut std::ffi::c_void, input: u32) -> i32;
fn ubicity_init() -> *mut std::ffi::c_void;
fn ubicity_free(handle: *mut std::ffi::c_void);
fn ubicity_process(handle: *mut std::ffi::c_void, input: u32) -> i32;
}

fn main() {
unsafe {
let handle = {{project}}_init();
let handle = ubicity_init();
assert!(!handle.is_null());

let result = {{project}}_process(handle, 42);
let result = ubicity_process(handle, 42);
assert_eq!(result, 0);

{{project}}_free(handle);
ubicity_free(handle);
}
}
----
Expand All @@ -308,21 +306,21 @@ fn main() {

[source,julia]
----
const lib{{project}} = "lib{{project}}"
const libubicity = "libubicity"

function init()
handle = ccall((:{{project}}_init, lib{{project}}), Ptr{Cvoid}, ())
handle = ccall((:ubicity_init, libubicity), Ptr{Cvoid}, ())
handle == C_NULL && error("Failed to initialize")
handle
end

function process(handle, input)
result = ccall((:{{project}}_process, lib{{project}}), Cint, (Ptr{Cvoid}, UInt32), handle, input)
result = ccall((:ubicity_process, libubicity), Cint, (Ptr{Cvoid}, UInt32), handle, input)
result
end

function cleanup(handle)
ccall((:{{project}}_free, lib{{project}}), Cvoid, (Ptr{Cvoid},), handle)
ccall((:ubicity_free, libubicity), Cvoid, (Ptr{Cvoid},), handle)
end

# Usage
Expand Down Expand Up @@ -381,7 +379,7 @@ When modifying the ABI/FFI:
+
[source,bash]
----
idris2 --cg c-header src/abi/Types.idr -o generated/abi/{{project}}.h
idris2 --cg c-header src/abi/Types.idr -o generated/abi/ubicity.h
----
. *Update FFI implementation* (`+ffi/zig/src/main.zig+`)
* Implement new functions
Expand Down
24 changes: 19 additions & 5 deletions QUICKSTART-DEV.adoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Template: QUICKSTART-DEV.adoc — clone → build → test → PR
// Replace ubicity, {{BUILD_CMD}}, {{TEST_CMD}}, {{LANG_STACK}} with actuals
// Replace ubicity, just build
# or: rescript build && cd wasm && cargo build --release --target wasm32-unknown-unknown, just test
# or: deno test --allow-read --allow-write tests/
# Idris2 tests: just test-core (requires idris2 0.8.0+), Deno (TypeScript) + ReScript + Rust/WASM + Idris2 (ABI proofs) + JSON Schema — see README.adoc for overview with actuals
= ubicity — Quick Start for Developers
:toc:
:toclevels: 2

== Tech Stack

{{LANG_STACK}}
Deno (TypeScript) + ReScript + Rust/WASM + Idris2 (ABI proofs) + JSON Schema — see README.adoc for overview

== Set Up Development Environment

Expand Down Expand Up @@ -38,14 +41,17 @@ just setup-dev

[source,bash]
----
{{BUILD_CMD}}
just build
# or: rescript build && cd wasm && cargo build --release --target wasm32-unknown-unknown
----

== Test

[source,bash]
----
{{TEST_CMD}}
just test
# or: deno test --allow-read --allow-write tests/
# Idris2 tests: just test-core (requires idris2 0.8.0+)
----

== Project Structure
Expand Down Expand Up @@ -91,7 +97,15 @@ just panic-scan # No new security issues
Read `.machine_readable/MUST.contractile` before making changes.
Key invariants that must never be violated:

{{MUST_INVARIANTS}}
* No hardcoded absolute paths — use env vars, XDG dirs, or relative references
* No new TypeScript/Python/Go files — Deno-only for JS/TS, ReScript for frontend, Rust for WASM
* No npm/bun/yarn/pnpm — Deno only
* No believe_me / assert_total (Idris2), no Admitted/sorry/unsafeCoerce
* SPDX-License-Identifier header on every source file
* .machine_readable/ directory and 0-AI-MANIFEST.a2ml preserved
* No removal of CI workflows without approval, all GitHub Actions SHA-pinned
* Tests must not be deleted or weakened, generated code only in generated/
* No OWASP top 10, no modification of ABI contracts without proof update

== LLM/AI Agent Development

Expand Down
16 changes: 13 additions & 3 deletions QUICKSTART-MAINTAINER.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Template: QUICKSTART-MAINTAINER.adoc — packaging, deploying, and maintaining
// Replace ubicity, ubicity, {{DEPS}} with actuals
// Replace ubicity, ubicity, * Deno 1.40+ (JS/TS runtime)
* Rust + cargo (WASM build, optional)
* ReScript (frontend, optional)
* wasm-pack + wasm-opt (WASM optimization, optional)
* Idris2 0.8.0+ (ABI proofs, optional — for formal verification)
* just (task runner) with actuals
= ubicity — Quick Start for Platform Maintainers
:toc:
:toclevels: 2
Expand All @@ -12,7 +17,12 @@ distribution on your platform.

== Runtime Dependencies

{{DEPS}}
* Deno 1.40+ (JS/TS runtime)
* Rust + cargo (WASM build, optional)
* ReScript (frontend, optional)
* wasm-pack + wasm-opt (WASM optimization, optional)
* Idris2 0.8.0+ (ABI proofs, optional — for formal verification)
* just (task runner)

== Build from Source

Expand All @@ -23,7 +33,7 @@ cd ubicity
just build-release
----

Output: `{{BUILD_OUTPUT_PATH}}`
Output: `./bin/ubicity and ./bin/ubicity-capture (Deno compile), ./wasm/pkg/ (WASM), ./lib/ (ReScript JS)`

== Packaging

Expand Down
Loading
Loading