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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 10 additions & 3 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@ jobs:
# this map" while the same build served from /trinity/ worked. Copying
# the directories rather than named files means the next data file
# arrives without anyone remembering to add a line here.
for dir in t27 queen wasm fonts; do
[ -d "apps/website/dist/$dir" ] || continue
# Every directory the build produced, not a list of the ones that
# existed when this was written. The name list said t27 queen wasm
# fonts while dist also held agents crons docs functions skills tools
# -- the six generated catalogs behind the Explorer tabs -- so those
# were live on the apex only because someone had copied them by hand,
# and the next clean deploy would have 404ed them.
for path in apps/website/dist/*/; do
dir=$(basename "$path")
[ "$dir" = assets ] && continue # copied above, then pruned
mkdir -p "ghio/$dir"
cp -R "apps/website/dist/$dir/." "ghio/$dir/"
cp -R "$path." "ghio/$dir/"
done
node - <<'EOF'
const {readFileSync, readdirSync, unlinkSync} = require('node:fs');
Expand Down
61 changes: 53 additions & 8 deletions .github/workflows/t27-world-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
# signal-health-self.yml commits its numbers.
#
# Publishing stays with deploy-site.yml, manual on purpose: content is approved
# before it goes out. The five founding sources are not refreshed here either;
# they come from a local t27 checkout that carries the teaching course on a
# branch not yet on t27 master (see sync-t27-specs.mjs), and a re-vendor from
# GitHub alone would delete it from the site.
# before it goes out.
#
# The five founding sources ARE refreshed here now. They used to be excluded
# because sync-t27-specs.mjs read a working copy at /Users/playom/t27, which no
# runner has -- so the repository holding two thirds of the corpus was the one
# repository this job could not touch, and gHashTag/t27 drifted 540 specs behind
# its own master while this job ran nightly. It reads GitHub now, and the
# teaching course, which lives on a branch never merged to master, comes in
# through a named overlay ref that contributes only the paths master lacks.
name: t27 world scan

on:
Expand All @@ -24,6 +29,7 @@ on:

permissions:
contents: write
pull-requests: write

jobs:
scan:
Expand All @@ -50,6 +56,13 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
# The founding sources first, because this writes the manifest the
# vendor step then merges discovered worlds into. It used to be left
# out of this job on the grounds that it read a working copy on one
# developer's laptop -- which it no longer does, and which is why
# gHashTag/t27 sat 540 specs behind its own master while a daily job
# claimed to keep the catalog current.
node scripts/sync-t27-specs.mjs
npm run discover -- scan --out "$RUNNER_TEMP/discovery.json"
npm run discover -- vendor --report "$RUNNER_TEMP/discovery.json"
npm run core -- index
Expand Down Expand Up @@ -79,9 +92,19 @@ jobs:
npm run check:tools
npm run check:docs

- name: Commit if the catalog changed
# Ruleset 23148303 ("T27 mandatory work report") requires the status check
# "T27 work report" on refs/heads/main and lists no bypass actors, so the
# `git push` this step used to end with is rejected with GH013 -- the same
# answer a person gets. The way in is the way everyone else takes: a branch,
# a pull request, and a report the validator accepts. The report is
# generated from the artifacts this run just wrote (scripts/
# catalog-work-report.mjs), so it states the refresh that happened rather
# than a template.
- name: Open or update the catalog pull request
env:
GH_TOKEN: ${{ github.token }}
run: |
set -uo pipefail
set -euo pipefail
git config user.name 't27 world scan'
git config user.email 'admin@t27.ai'
git add public/t27 public/skills public/crons public/agents public/tools public/functions public/docs qa/language-exceptions.json
Expand All @@ -91,5 +114,27 @@ jobs:
fi
N=$(node -e "const m=require('./public/t27/manifest.json');console.log(m.repos.length+' repositories, '+m.specCount+' specs')")
git commit -q -m "t27 worlds: refresh the catalog ($N)"
git push -q
echo "- committed: $N" >> "$GITHUB_STEP_SUMMARY"
BRANCH=bot/t27-world-scan
# The bot's own branch, and only ever this job writes it -- so the
# lease is against the copy this run started from, not against a human.
git push -q --force-with-lease origin "HEAD:refs/heads/$BRANCH"
SHA=$(git rev-parse HEAD)
node scripts/catalog-work-report.mjs --head-sha "$SHA" --out "$RUNNER_TEMP/catalog-report.md"
PR=$(gh pr list --head "$BRANCH" --base main --state open --json number --jq '.[0].number // empty')
if [ -n "$PR" ]; then
# Yesterday's refresh is still open: move it to today's commit and
# today's numbers rather than opening a second one beside it.
gh pr edit "$PR" --title "t27 worlds: refresh the catalog ($N)" --body-file "$RUNNER_TEMP/catalog-report.md"
else
gh pr create --base main --head "$BRANCH" \
--title "t27 worlds: refresh the catalog ($N)" \
--body-file "$RUNNER_TEMP/catalog-report.md"
PR=$(gh pr list --head "$BRANCH" --base main --state open --json number --jq '.[0].number // empty')
fi
echo "- pushed $BRANCH and opened/updated PR #$PR: $N" >> "$GITHUB_STEP_SUMMARY"
# Auto-merge lands it once "T27 work report" goes green. Without the
# repository setting it stays an open pull request for a person to
# merge, which is a worse outcome but not a failed run.
if ! gh pr merge "$PR" --squash --auto; then
echo "- auto-merge unavailable; PR #$PR is open and waiting" >> "$GITHUB_STEP_SUMMARY"
fi
2 changes: 1 addition & 1 deletion apps/website/public/agents/spec-agents.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/website/public/crons/spec-crons.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/website/public/docs/system-docs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/website/public/functions/spec-functions.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/website/public/skills/skills-core.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":1,"provenance":{"manifestSha256":"77041c2fff42fe594a45d1df412c22df5b2c7e15befa7d191ea11fc42e041c30","specManifestSha256":"4970a54d1cc7fc3954c66a9a11f885d7b2b4633614618f7896adb94cb3589e28","indexerSha256":"e7ad55414d2d48fa05cc7e2619af06bc4d3c82d6018c8a373adf3dc7402faff3"},"skillCount":26,"coverage":{"skillsBound":["t27/tri","t27/tri-pipeline","t27/wrap-up"],"skillsUnbound":["t27/measure-corpus","t27/phi-loop","t27/wave-audit","trinity/blog-post","trinity/board-sync","trinity/cloud","trinity/doctor","trinity/farm-garden","trinity/fpga-synth","trinity/god-mode","trinity/implement-issue","trinity/queen-hive-visuals","trinity/review-code","trinity/run-tests","trinity/scholar","trinity/status","trinity/tech-tree","trinity/tri","trinity/trinity-test","trinity/ux-wave","trinity/vibee-gen","trinity/vsa-verify","trinity/wave"],"skillsBroken":[],"specsWithSkill":["compiler/skill/registry.t27","specs/automation/wrapup-auto.t27","specs/pipeline/e2e_test.t27"],"specsWithoutSkill":853,"baselineUnbound":23},"skillToSpecs":{"t27/tri":["compiler/skill/registry.t27"],"t27/tri-pipeline":["specs/pipeline/e2e_test.t27"],"t27/wrap-up":["specs/automation/wrapup-auto.t27"]},"specToSkills":{"compiler/skill/registry.t27":["t27/tri"],"specs/automation/wrapup-auto.t27":["t27/wrap-up"],"specs/pipeline/e2e_test.t27":["t27/tri-pipeline"]}}
{"version":1,"provenance":{"manifestSha256":"77041c2fff42fe594a45d1df412c22df5b2c7e15befa7d191ea11fc42e041c30","specManifestSha256":"d03407c0fefe8cf1aaed1b85acda93964dbb3e213e0dd64cc015665e806272a8","indexerSha256":"e7ad55414d2d48fa05cc7e2619af06bc4d3c82d6018c8a373adf3dc7402faff3"},"skillCount":26,"coverage":{"skillsBound":["t27/tri","t27/tri-pipeline","t27/wrap-up"],"skillsUnbound":["t27/measure-corpus","t27/phi-loop","t27/wave-audit","trinity/blog-post","trinity/board-sync","trinity/cloud","trinity/doctor","trinity/farm-garden","trinity/fpga-synth","trinity/god-mode","trinity/implement-issue","trinity/queen-hive-visuals","trinity/review-code","trinity/run-tests","trinity/scholar","trinity/status","trinity/tech-tree","trinity/tri","trinity/trinity-test","trinity/ux-wave","trinity/vibee-gen","trinity/vsa-verify","trinity/wave"],"skillsBroken":[],"specsWithSkill":["compiler/skill/registry.t27","specs/automation/wrapup-auto.t27","specs/pipeline/e2e_test.t27"],"specsWithoutSkill":1404,"baselineUnbound":23},"skillToSpecs":{"t27/tri":["compiler/skill/registry.t27"],"t27/tri-pipeline":["specs/pipeline/e2e_test.t27"],"t27/wrap-up":["specs/automation/wrapup-auto.t27"]},"specToSkills":{"compiler/skill/registry.t27":["t27/tri"],"specs/automation/wrapup-auto.t27":["t27/wrap-up"],"specs/pipeline/e2e_test.t27":["t27/tri-pipeline"]}}
2 changes: 1 addition & 1 deletion apps/website/public/skills/spec-skills.json

Large diffs are not rendered by default.

195 changes: 195 additions & 0 deletions apps/website/public/t27/files/bootstrap/src/codegen_python.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
// bootstrap/src/codegen_python.rs
// Python Code Generator for CLARA (TA2 Deliverable)
// φ² + 1/φ² = 3 | TRINITY
//
// Generates Python code from .t27 specifications for PyTorch integration
// NOTE: This is a specification stub - full implementation is P1 priority
//
// ─────────────────────────────────────────────────────────────────────────────────────────────

module codegen_python {
use base::types;
use parser;

// ═════════════════════════════════════════════════════════════════
// CONFIGURATION
// ════════════════════════════════════════════════════════════════

/// Python module prefix for generated code
pub const PYTHON_MODULE_PREFIX : []const u8 = b"t27_";

// ══════════════════════════════════════════════════════════════════
// TYPE MAPPINGS
// ══════════════════════════════════════════════════════════════════════════════════════

/// T27 Trit → Python type
fn map_trit_to_python_type(tn : Trit) -> []const u8 {
// For basic implementation, use int mapping
// K_TRUE -> 1, K_FALSE -> 0, K_UNKNOWN -> 0
// Better: Use Python's bool or enum
if (tn == .pos) {
return "bool";
} else if (tn == .neg) {
return "bool";
} else {
return "int"; // For unknown, use int (0 or 1)
}
}

/// T27 array → Python list
fn map_trit_array_to_python_list(array : [MAX_ARGS]Trit) -> []const u8 {
// Array mapping: [-1, 0, +1] as Python list
var result : [array.len * 8]u8 = undefined;
var i : usize = 0;
var j : usize = 0;

while (i < array.len) {
result[i] = map_trit_to_python_type(array[i]);
i += 1;
j += 8;
}

return result;
}

/// T27 struct → Python class
fn map_struct_to_python_class(node : *Node) -> []const u8 {
// Extract struct name and fields
var class_name : []const u8 = undefined;
var fields : [32]u8 = undefined;
var field_count : u8 = 0;

// Get struct name from node type identifier
match node.kind {
StructDecl => {
const name = node.name;
fields = &node.fields;
},
_ => {
// For other types, skip for now
class_name = "Any";
}
}

// Process each field
// For now, just store field names
// Real implementation would traverse fields

var i : usize = 0;
while (i < field_count) {
var field_name = extract_identifier(&node.fields[i]);
fields[field_count] = field_name;
field_count += 1;
i += 1;
}

var result : [field_count]u8 = undefined;
return result;
}

/// Extract identifier from field node (strips module::, namespace::)
fn extract_identifier(node : *Node) -> []const u8 {
// Strip module:: and namespace:: prefixes
// Get raw name
var raw_name : []const u8 = node.name;
var name_len = raw_name.len;

// Skip common prefixes
var i : usize = 6; // len("module::")
if (string_starts_with_prefix(&raw_name, i, "module::")) { i += 7; }
if (string_starts_with_prefix(&raw_name, i, "namespace::")) { i += 11; }

return raw_name[i..name_len];
}

/// Strip module:: prefixes from identifier
fn strip_prefixes(name : []const u8) -> []const u8 {
var start_idx : usize = 0;
var write_idx : usize = 0;

while (start_idx < name.len && write_idx < 32) {
// Copy to output if it's a valid char for Python
if (name[start_idx] == ':' ||
name[start_idx + 1] == '_' ||
name[start_idx + 1] == '.' ||
!name[start_idx + 1].is_ascii()) {
// Skip or invalid character
start_idx += 1;
} else {
name[write_idx] = name[start_idx + 1];
write_idx += 1;
}
}

return name[0..write_idx];
}

/// Generate Python function from function node
fn gen_function(fn_node : *Node) -> []const u8 {
var func_name = fn_node.name;
var params = gen_params(fn_node);

// For stub: just generate def name(params) -> pass
// Full implementation would handle default values, docstrings, etc.

var result : [256]u8 = undefined;
var offset : usize = 0;

offset = string_copy_str(&mut offset, "def ");
offset = string_copy_str(&mut offset, func_name);
offset = gen_params(&mut offset, params, false);
offset = string_copy_str(&mut offset, "):\n");
offset = indent_lines(&mut offset, INDENT);

return result[0..offset];
}

/// Generate parameters from params node
fn gen_params(params_node : *Node) -> []const u8 {
var result : [256]u8 = undefined;
var offset : usize = 0;

// For now, just generate params list: param1, param2, ...
var param_count : usize = 0;

while (offset < params_node.value.arg_count) {
var param = &params_node.args[offset];

// Generate param name (default "param" + N)
offset = string_copy_str(&mut offset, "param");
offset = string_copy_str(&mut offset, param_count);
offset = string_copy_str(&mut offset, ": ");

// Just stub: "param1" (no default value)
param_count += 1;
offset += 1;
}

return result[0..offset];
}

// ════════════════════════════════════════════════════
// TESTS
// ══════════════════════════════════════════════════════

test map_trit_to_python_type {
given node = ExprIdentifier { name = "test_trit", value = "" }
when call map_trit_to_python_type(node)
then result == "bool"
}

test gen_function_basic {
given fn = ExprIdentifier { name = "test_func", value = "" }
when call gen_function(fn)
then result starts with "def test_func("
}
}

// ════════════════════════════════════════════════════════
// Invariant: Python generator always produces valid syntax
invariant python_output_is_valid {
given output = generate_python_class(ExprIdentifier { name = "test_module" })
then output contains "class test_module"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_01

// shape: [[]X",
// 52 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/builder.t27:14
// signals: doubled-bracket,odd-quote
pub struct Damaged {
items : [[]T",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_02

// shape: [[]X X",
// 37 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:14
// signals: doubled-bracket,odd-quote
pub struct Damaged {
field_type : [[]Const u8",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_03

// shape: [[]X [,
// 10 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:23
// signals: doubled-bracket
pub struct Damaged {
steps : [[]Const [,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_04

// shape: [[][,
// 7 line(s) in the corpus share this shape
// first seen: specs/tri/encoding/mime.t27:15
// signals: doubled-bracket
pub struct Damaged {
to : [[][,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_05

// shape: [[9]X",
// 5 line(s) in the corpus share this shape
// first seen: specs/tri/crypto/hmac.t27:14
// signals: odd-quote
pub struct Damaged {
opad : [[64]U8",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_06

// shape: [?[]X X",
// 3 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:36
// signals: doubled-bracket,odd-quote
pub struct Damaged {
error_msg : [?[]Const u8",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_07

// shape: [X.X([]X X)",
// 2 line(s) in the corpus share this shape
// first seen: specs/tri/encoding/html.t27:15
// signals: odd-quote
pub struct Damaged {
attributes : [std.StringHashMap([]Const u8)",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_08

// shape: [[9]?X",
// 2 line(s) in the corpus share this shape
// first seen: specs/tri/trees/octree.t27:24
// signals: odd-quote
pub struct Damaged {
children : [[8]?OctNode",
}
Loading
Loading