Omran Ahmad commited on
Commit
80848b6
·
0 Parent(s):

feat: initial archon showroom deployment

Browse files
Files changed (3) hide show
  1. README.md +19 -0
  2. app.py +99 -0
  3. requirements.txt +3 -0
README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: ARCHON Dev Engine Showroom
3
+ emoji: 🛡️
4
+ colorFrom: gray
5
+ colorTo: black
6
+ sdk: streamlit
7
+ app_file: app.py
8
+ pinned: false
9
+ license: mit
10
+ ---
11
+
12
+ # ARCHON Dev Engine Showroom
13
+
14
+ Test your AI-generated backend for production discipline. This space evaluates your code against the ARCHON doctrine:
15
+ - **Async-First**: Prevents blocking I/O in async paths.
16
+ - **Config Discipline**: Protects against hardcoded secrets.
17
+ - **Structured Output**: Enforces reliable JSON patterns.
18
+
19
+ [Get the Cursor Plugin on GitHub](https://github.com/Omran1983/archon-dev-engine)
app.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ import re
4
+
5
+ # --- ARCHON Core Scoring Logic (Adapted for Web) ---
6
+
7
+ def score_content(content):
8
+ scores = {
9
+ "Async-First": 0,
10
+ "Structured Output": 0,
11
+ "Config Discipline": 0
12
+ }
13
+
14
+ # 1. Async Compliance
15
+ if "async " in content or "await " in content:
16
+ scores["Async-First"] = 100
17
+ elif any(kw in content for kw in ["requests.get(", "requests.post(", "urllib.", "time.sleep("]):
18
+ scores["Async-First"] = 0 # Major penalty for blocking I/O
19
+ else:
20
+ scores["Async-First"] = 100 # No I/O detected
21
+
22
+ # 2. Structured Output
23
+ if any(kw in content for kw in ["json.dumps", "pydantic", "BaseModel", "Zod"]):
24
+ scores["Structured Output"] = 100
25
+ elif "print(" in content:
26
+ scores["Structured Output"] = 50
27
+ else:
28
+ scores["Structured Output"] = 100
29
+
30
+ # 3. Config Discipline
31
+ if any(kw in content for kw in ["os.getenv", "environ", "config("]):
32
+ scores["Config Discipline"] = 100
33
+ elif any(kw in content for kw in ["api_key =", "secret =", "password =", "token ="]):
34
+ scores["Config Discipline"] = 0
35
+ else:
36
+ scores["Config Discipline"] = 85
37
+
38
+ return scores
39
+
40
+ # --- Streamlit UI ---
41
+
42
+ st.set_page_config(page_title="ARCHON Showroom", page_icon="🛡️", layout="wide")
43
+
44
+ st.markdown("""
45
+ <style>
46
+ .stApp { background-color: #0d0d0d; color: #e0e0e0; }
47
+ .main { background-color: #0d0d0d; }
48
+ h1, h2, h3 { color: #ffffff !important; }
49
+ .stTextArea textarea { background-color: #1a1a1a !important; color: #00ff00 !important; font-family: 'Courier New', Courier, monospace !important; }
50
+ .stButton button { background-color: #2e2e2e !important; color: white !important; border: 1px solid #444 !important; }
51
+ </style>
52
+ """, unsafe_allow_html=True)
53
+
54
+ st.title("🛡️ ARCHON Dev Engine – Showroom")
55
+ st.subheader("Test your AI-generated backend for production discipline.")
56
+
57
+ col1, col2 = st.columns([2, 1])
58
+
59
+ with col1:
60
+ code_input = st.text_area("Paste code here (Python / TS / JS):", height=400, placeholder="import requests\n\ndef get_data():\n return requests.get(url) # ARCHON will veto this!")
61
+ score_btn = st.button("RUN ARCHON CHECK")
62
+
63
+ with col2:
64
+ if score_btn and code_input:
65
+ res = score_content(code_input)
66
+ overall = sum(res.values()) / len(res)
67
+
68
+ st.metric("ARCHON SCORE", f"{overall:.1f}%")
69
+
70
+ # Display breakdown
71
+ for k, v in res.items():
72
+ color = "green" if v > 80 else "orange" if v > 40 else "red"
73
+ st.markdown(f"**{k}**: :{color}[{v}%]")
74
+ st.progress(v / 100)
75
+
76
+ st.markdown("---")
77
+ if overall > 90:
78
+ st.success("✅ **ELITE**: This code meets ARCHON production standards.")
79
+ elif overall > 60:
80
+ st.warning("⚠️ **STABLE**: Usable, but improvements recommended.")
81
+ else:
82
+ st.error("❌ **FRAGILE**: Immediate refactor required for production.")
83
+
84
+ st.info("ARCHON is a Cursor Plugin that enforces this discipline in real-time. [Get the plugin on GitHub](https://github.com/Omran1983/archon-dev-engine)")
85
+ else:
86
+ st.write("Ready for analysis. Paste code and hit the button.")
87
+ st.markdown("""
88
+ ### Why ARCHON?
89
+ - **Prevents** blocking I/O in async paths.
90
+ - **Enforces** structured data handling.
91
+ - **Protects** against hardcoded secrets.
92
+ """)
93
+
94
+ st.sidebar.image("https://raw.githubusercontent.com/Omran1983/archon-dev-engine/main/demo.gif")
95
+ st.sidebar.markdown("""
96
+ **v0.1.0 Open Alpha**
97
+ Developed by A-ONE GLOBAL RESOURCING LTD.
98
+ [GitHub Repo](https://github.com/Omran1983/archon-dev-engine)
99
+ """)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ plotly