Compare commits
No commits in common. "f20075576647f6d353b68beab0b3f7c5aabea8cf" and "5ea79ce63d9f70d8c2a21b05512f8cb9cea80ce9" have entirely different histories.
f200755766
...
5ea79ce63d
@ -1,122 +0,0 @@
|
|||||||
/**
|
|
||||||
* Agent Forum v4 - Meta-State Bootstrap Tool
|
|
||||||
* Automatically scaffolds the orphan 'meta-state' branch with initial
|
|
||||||
* JSON-LD requirements, task DAGs, and transition rules.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { ensureDir } from "https://deno.land/std@0.224.0/fs/ensure_dir.ts";
|
|
||||||
import { join } from "https://deno.land/std@0.224.0/path/mod.ts";
|
|
||||||
|
|
||||||
async function runCmd(args: string[], cwd?: string): Promise<string> {
|
|
||||||
const cmd = new Deno.Command("git", {
|
|
||||||
args,
|
|
||||||
cwd,
|
|
||||||
stdout: "piped",
|
|
||||||
stderr: "piped",
|
|
||||||
});
|
|
||||||
const { code, stdout, stderr } = await cmd.output();
|
|
||||||
if (code !== 0) {
|
|
||||||
const errText = new TextDecoder().decode(stderr);
|
|
||||||
throw new Error(`Git command failed: git ${args.join(" ")}\n${errText}`);
|
|
||||||
}
|
|
||||||
return new TextDecoder().decode(stdout).trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
console.log("-> Bootstrapping Agent Forum Meta-State...");
|
|
||||||
|
|
||||||
const tmpDir = await Deno.makeTempDir({ prefix: "meta_state_" });
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 1. Initialize or check out meta-state orphan branch in a temp dir
|
|
||||||
console.log(" Initializing meta-state orphan workspace...");
|
|
||||||
try {
|
|
||||||
await runCmd(["symbolic-ref", "HEAD"], tmpDir);
|
|
||||||
} catch {
|
|
||||||
// Not a git repo yet in tmpDir, clone/init local linkage
|
|
||||||
const repoRoot = await runCmd(["rev-parse", "--show-toplevel"]);
|
|
||||||
await runCmd(["clone", repoRoot, tmpDir]);
|
|
||||||
await runCmd(["checkout", "--orphan", "meta-state"], tmpDir);
|
|
||||||
await runCmd(["rm", "-rf", "."], tmpDir); // Clean slate for orphan branch
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Ensure directories exist
|
|
||||||
await ensureDir(join(tmpDir, "ontologies"));
|
|
||||||
await ensureDir(join(tmpDir, "tasks"));
|
|
||||||
await ensureDir(join(tmpDir, "vectors"));
|
|
||||||
|
|
||||||
// 3. Auto-generate JSON-LD Requirement Graph based on repo inspection
|
|
||||||
console.log(" Generating JSON-LD ontology graph...");
|
|
||||||
let projectName = "Auth-Yes Project";
|
|
||||||
try {
|
|
||||||
const pkgRaw = await Deno.readTextFile("package.json");
|
|
||||||
const pkg = JSON.parse(pkgRaw);
|
|
||||||
if (pkg.name) projectName = pkg.name;
|
|
||||||
} catch {
|
|
||||||
// Default fallback
|
|
||||||
}
|
|
||||||
|
|
||||||
const ontologyGraph = [
|
|
||||||
{
|
|
||||||
"@context": "https://schema.org",
|
|
||||||
"@type": "SoftwareApplication",
|
|
||||||
"name": projectName,
|
|
||||||
"description": "Auto-bootstrapped application architecture for Agent Forum governance."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"@type": "Requirement",
|
|
||||||
"id": "REQ-001",
|
|
||||||
"description": "Ensure zero-trust authentication and rate-limiting patterns are enforced on all API routes.",
|
|
||||||
"status": "Approved"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"@type": "Requirement",
|
|
||||||
"id": "REQ-002",
|
|
||||||
"description": "Maintain strict code-to-documentation parity using SCIP index extraction.",
|
|
||||||
"status": "Approved"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
await Deno.writeTextFile(
|
|
||||||
join(tmpDir, "ontologies", "ontology.graph"),
|
|
||||||
JSON.stringify(ontologyGraph, null, 2)
|
|
||||||
);
|
|
||||||
|
|
||||||
// 4. Auto-generate Initial Task DAG
|
|
||||||
console.log(" Generating initial task backlog DAG...");
|
|
||||||
const initialTask = `id: TASK-001
|
|
||||||
title: Bootstrap Agent Forum Governance
|
|
||||||
status: Done
|
|
||||||
description: Automatically initialized meta-state architecture and baseline requirements.
|
|
||||||
blocked_by: []
|
|
||||||
`;
|
|
||||||
|
|
||||||
await Deno.writeTextFile(
|
|
||||||
join(tmpDir, "tasks", "TASK-001.yaml"),
|
|
||||||
initialTask
|
|
||||||
);
|
|
||||||
|
|
||||||
// 5. Commit and push/update meta-state branch
|
|
||||||
console.log(" Committing meta-state structures...");
|
|
||||||
await runCmd(["add", "."], tmpDir);
|
|
||||||
|
|
||||||
// Check if there are changes to commit
|
|
||||||
const status = await runCmd(["status", "--porcelain"], tmpDir);
|
|
||||||
if (status) {
|
|
||||||
await runCmd(["commit", "-m", "chore(meta-state): bootstrap initial ontologies and task DAGs"], tmpDir);
|
|
||||||
// Push meta-state to local/remote
|
|
||||||
await runCmd(["push", "origin", "meta-state:meta-state"], tmpDir).catch(() => {
|
|
||||||
console.warn("⚠️ Could not push meta-state to remote (offline or remote not set). Local branch updated.");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("🎉 Meta-state successfully bootstrapped!");
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
await Deno.remove(tmpDir, { recursive: true }).catch(() => {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (import.meta.main) {
|
|
||||||
await main();
|
|
||||||
}
|
|
||||||
@ -34,10 +34,9 @@ fi
|
|||||||
# Optional: SCIP / AST Extraction using tree-sitter
|
# Optional: SCIP / AST Extraction using tree-sitter
|
||||||
if command -v tree-sitter &> /dev/null; then
|
if command -v tree-sitter &> /dev/null; then
|
||||||
echo "-> Generating local AST structures..."
|
echo "-> Generating local AST structures..."
|
||||||
|
# Generate AST for TS/JS files if present, fallback gracefully if not parseable
|
||||||
mkdir -p "$REPO_ROOT/.forum/ast"
|
mkdir -p "$REPO_ROOT/.forum/ast"
|
||||||
find "$REPO_ROOT/src" \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) 2>/dev/null | while read -r file; do
|
find "$REPO_ROOT/src" -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" 2>/dev/null | xargs -I {} bash -c 'tree-sitter parse {} > "$REPO_ROOT/.forum/ast/$(basename {}).ast" 2>/dev/null || true'
|
||||||
tree-sitter parse "$file" > "$REPO_ROOT/.forum/ast/$(basename "$file").ast" 2>/dev/null || true
|
|
||||||
done
|
|
||||||
echo " AST structures saved to .forum/ast/"
|
echo " AST structures saved to .forum/ast/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Agent Forum v4 - Pre-Push Synchronization Hook
|
|
||||||
# Automatically syncs the 'meta-state' orphan branch and all agent git notes
|
|
||||||
# whenever any branch is pushed to a remote.
|
|
||||||
|
|
||||||
remote="$1"
|
|
||||||
url="$2"
|
|
||||||
|
|
||||||
echo "-> Agent Forum: Syncing meta-state and Git Notes to remote '${remote}'..."
|
|
||||||
|
|
||||||
# 1. Push the meta-state branch if it exists locally (using --no-verify to stop recursion)
|
|
||||||
if git rev-parse --verify meta-state >/dev/null 2>&1; then
|
|
||||||
git push --no-verify "$remote" meta-state:meta-state --quiet || echo "⚠️ Warning: Failed to push meta-state branch."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 2. Push all agent Git Notes across all namespaces (using --no-verify)
|
|
||||||
git push --no-verify "$remote" 'refs/notes/*' --quiet || echo "⚠️ Warning: Failed to push Git Notes."
|
|
||||||
|
|
||||||
echo "-> Agent Forum: State synchronization complete."
|
|
||||||
exit 0
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -19,7 +19,3 @@ cov_profile/
|
|||||||
/index.scip
|
/index.scip
|
||||||
/reports/
|
/reports/
|
||||||
/.stryker-tmp/
|
/.stryker-tmp/
|
||||||
|
|
||||||
# Agent Forum local runtime artifacts & caches
|
|
||||||
.forum/ast/
|
|
||||||
.forum/security/
|
|
||||||
|
|||||||
2
deno.lock
generated
2
deno.lock
generated
@ -741,8 +741,6 @@
|
|||||||
"https://deno.land/std@0.224.0/front_matter/_formats.ts": "9a8ac1524f93b3ae093bd66864a49fc0088037920c6d60863da136d10f92e04d",
|
"https://deno.land/std@0.224.0/front_matter/_formats.ts": "9a8ac1524f93b3ae093bd66864a49fc0088037920c6d60863da136d10f92e04d",
|
||||||
"https://deno.land/std@0.224.0/front_matter/create_extractor.ts": "642e6e55cd07864b7c8068f88d271290d5d0a13d979ad335e10a7f52046b1f80",
|
"https://deno.land/std@0.224.0/front_matter/create_extractor.ts": "642e6e55cd07864b7c8068f88d271290d5d0a13d979ad335e10a7f52046b1f80",
|
||||||
"https://deno.land/std@0.224.0/front_matter/yaml.ts": "103b8338bec480c6b7a7e245cf6bda72682eb78ed2231c799a4526d52cb6888a",
|
"https://deno.land/std@0.224.0/front_matter/yaml.ts": "103b8338bec480c6b7a7e245cf6bda72682eb78ed2231c799a4526d52cb6888a",
|
||||||
"https://deno.land/std@0.224.0/fs/_get_file_info_type.ts": "da7bec18a7661dba360a1db475b826b18977582ce6fc9b25f3d4ee0403fe8cbd",
|
|
||||||
"https://deno.land/std@0.224.0/fs/ensure_dir.ts": "51a6279016c65d2985f8803c848e2888e206d1b510686a509fa7cc34ce59d29f",
|
|
||||||
"https://deno.land/std@0.224.0/fs/exists.ts": "3d38cb7dcbca3cf313be343a7b8af18a87bddb4b5ca1bd2314be12d06533b50f",
|
"https://deno.land/std@0.224.0/fs/exists.ts": "3d38cb7dcbca3cf313be343a7b8af18a87bddb4b5ca1bd2314be12d06533b50f",
|
||||||
"https://deno.land/std@0.224.0/internal/diff.ts": "6234a4b493ebe65dc67a18a0eb97ef683626a1166a1906232ce186ae9f65f4e6",
|
"https://deno.land/std@0.224.0/internal/diff.ts": "6234a4b493ebe65dc67a18a0eb97ef683626a1166a1906232ce186ae9f65f4e6",
|
||||||
"https://deno.land/std@0.224.0/internal/format.ts": "0a98ee226fd3d43450245b1844b47003419d34d210fa989900861c79820d21c2",
|
"https://deno.land/std@0.224.0/internal/format.ts": "0a98ee226fd3d43450245b1844b47003419d34d210fa989900861c79820d21c2",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user