{"id":50531904,"url":"https://github.com/timcsy/semorphe","last_synced_at":"2026-06-03T14:30:38.039Z","repository":{"id":342068196,"uuid":"1172691934","full_name":"timcsy/semorphe","owner":"timcsy","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-28T02:42:59.000Z","size":2929,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-28T04:24:47.820Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://timcsy.github.io/semorphe/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timcsy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-04T15:39:42.000Z","updated_at":"2026-04-28T02:43:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/timcsy/semorphe","commit_stats":null,"previous_names":["timcsy/code-blockly","timcsy/semorphe"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/timcsy/semorphe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2Fsemorphe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2Fsemorphe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2Fsemorphe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2Fsemorphe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timcsy","download_url":"https://codeload.github.com/timcsy/semorphe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2Fsemorphe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33870025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-03T14:30:36.951Z","updated_at":"2026-06-03T14:30:38.017Z","avatar_url":"https://github.com/timcsy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/logo/semorphe-dark.svg\" width=\"128\" height=\"128\" alt=\"Semorphe Logo\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eSemorphe\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e唯一真實，各式投影。\u003c/strong\u003e\u003cbr\u003e\n  解構語法之散，重塑形態之模。\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/language-TypeScript-blue\" alt=\"TypeScript\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/blockly-12.4.1-4285F4\" alt=\"Blockly\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/license-MIT-green\" alt=\"MIT License\"\u003e\n\u003c/p\u003e\n\n---\n\n**Semorphe**（散模費，σημορφή）是一套以語義樹為核心的程式教學工具，讓程式碼與積木之間能雙向即時轉換。\n\n名稱由希臘文 σῆμα（語義）與 μορφή（形態）組合而成 — 一棵語義樹是唯一真實，積木與程式碼只是它的不同投影。\n\n## 特色\n\n- **雙向同步** — 修改積木即時更新程式碼，修改程式碼即時更新積木\n- **語義樹驅動** — 以 Semantic Tree 為 Single Source of Truth，非簡單的文字↔積木映射\n- **認知分級** — L0 初學 / L1 進階 / L2 完整，漸進式揭露 C++ 功能\n- **多種程式碼風格** — APCS（cout/cin）、競賽（printf/scanf）、Google 風格一鍵切換\n- **優雅降級** — 不支援的語法自動降級為原始碼積木，標註信心度\n- **VSCode 延伸模組** — 直接在編輯器側邊欄使用積木面板\n\n## 快速開始\n\n```bash\n# 安裝依賴\nnpm install\n\n# 啟動開發伺服器\nnpm run dev\n\n# 執行測試\nnpm test\n\n# 建置\nnpm run build\n```\n\n## 架構\n\n```\nsrc/\n├── core/           # 語義樹、投影引擎、block spec registry\n├── languages/      # 語言模組（目前支援 C++）\n├── interpreter/    # 語義樹直譯器\n└── ui/             # Blockly 面板、Monaco 編輯器、同步控制器\n```\n\n核心原則：語義樹（Semantic Tree）是唯一的真實來源。積木（Blockly）和程式碼（Monaco）都是語義樹的投影。所有轉換都透過語義層進行，不直接在兩種視覺表示之間映射。\n\n## 概念管線（Concept Pipeline）\n\nSemorphe 提供一套 Claude Code skill，用於系統化地新增語言概念支援。從研究語言特性到完整整合，全程由 AI 輔助完成。\n\n### 概覽\n\n```\n/concept.discover  →  /concept.generate  →  /concept.roundtrip  →  /concept.fuzz  →  /concept.integrate\n    研究 \u0026 分類         產生實作產出物          目標性 round-trip        資訊隔離盲測          最終關卡 \u0026 註冊\n```\n\n或直接使用端到端管線一次完成：\n\n```\n/concept.pipeline cpp \u003calgorithm\u003e\n```\n\n### 各 Skill 說明\n\n| Skill | 指令 | 用途 |\n|-------|------|------|\n| **概念探索** | `/concept.discover {lang} {target}` | 研究函式庫/語言特性，萃取概念、按 Topic 層級樹分類、提出命名 |\n| **概念產生** | `/concept.generate {lang} {concept}` | 產生 BlockSpec JSON、generator、lifter、渲染映射、測試 |\n| **Round-Trip 測試** | `/concept.roundtrip {lang} {concept}` | 對特定程式執行 lift → generate → 比較 stdout 的驗證 |\n| **模糊測試** | `/concept.fuzz {lang} {difficulty} {scope} {count}` | 雙代理架構：Agent A（不知實作）出題，Agent B 驗證正確性 |\n| **整合** | `/concept.integrate {lang} {concept}` | 執行所有驗證（tsc、test、round-trip），通過後完成註冊 |\n| **端到端管線** | `/concept.pipeline {lang} {target}` | 串接上述 5 個 skill，一個指令從研究到整合 |\n| **概念重構** | `/concept.refactor {lang} audit\\|fix\\|migrate\\|i18n-fix\\|full` | 審計四路完備性、信心等級、i18n 標籤風格；修復缺失產出物；遷移 JSON pattern；清理技術債 |\n\n### 使用範例\n\n```bash\n# 探索 C++ \u003calgorithm\u003e 標頭檔的概念\n/concept.discover cpp \u003calgorithm\u003e\n\n# 為特定概念產生實作\n/concept.generate cpp sort_range\n\n# 驗證 round-trip 正確性\n/concept.roundtrip cpp sort_range\n\n# 用盲測找出邊界案例\n/concept.fuzz cpp medium loops 20\n\n# 完整管線：從研究到整合\n/concept.pipeline cpp \u003calgorithm\u003e\n\n# 快速管線（跳過模糊測試）\n/concept.pipeline python list comprehension --skip-fuzz\n\n# 只處理特定概念\n/concept.pipeline java Stream API --concepts=stream_map,stream_filter\n\n# 審計現有概念實作（四路完備性、信心等級、雙重註冊、i18n 標籤）\n/concept.refactor cpp audit\n\n# 只審計 i18n 標籤風格一致性\n/concept.refactor cpp audit i18n\n\n# 修復特定概念的缺失產出物\n/concept.refactor cpp fix cout\n\n# 修復整個 STD 模組\n/concept.refactor cpp fix vector\n\n# 修復該語言所有概念\n/concept.refactor cpp fix all\n\n# 將特定 hand-written lifter 遷移至 JSON pattern\n/concept.refactor cpp migrate if\n\n# 修復 i18n 標籤風格不一致問題\n/concept.refactor cpp i18n-fix\n\n# 完整重構：audit → fix → dedup → migrate → render-fix → i18n-fix → purge\n/concept.refactor cpp full\n```\n\n### 檔案存放位置\n\n概念的實作檔案依層級存放：\n\n| 層級 | blocks.json | concepts.json | generators | lifters |\n|------|-------------|---------------|------------|---------|\n| **核心語法** | `src/languages/{lang}/core/blocks.json` | `src/languages/{lang}/core/concepts.json` | `src/languages/{lang}/core/generators/` | `src/languages/{lang}/core/lifters/` |\n| **標準庫模組** | `src/languages/{lang}/std/{module}/blocks.json` | `src/languages/{lang}/std/{module}/concepts.json` | `src/languages/{lang}/std/{module}/generators.ts` | `src/languages/{lang}/std/{module}/lifters.ts` |\n\n詳細的 skill 定義在 `.claude/skills/concept-*/SKILL.md`。\n\n## VSCode 延伸模組\n\n```bash\ncd vscode-ext\nnpm install\nnode esbuild.mjs\n# 按 F5 啟動 Extension Development Host\n```\n\n詳見 [vscode-ext/README.md](vscode-ext/README.md)。\n\n## 授權\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimcsy%2Fsemorphe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimcsy%2Fsemorphe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimcsy%2Fsemorphe/lists"}