算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
install-putior【设计与创意】Install and configure the putior R package for workflow visualization. Covers CRAN and GitHub installation, optional dependencies (mcptools, ellmer, shiny, shinyAce, logger, plumber2), and verification of the complete annotation-to-diagram pipeline. Use when setting up putior for the first time, preparing a machine for workflow visualization tasks, w…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
裝 putior R 套件及其選擇性依賴,使註解至圖之管線於專案中可用。本技能涵蓋核心裝、選擇性擴展之擇與管線之驗證。
mcptools、ellmer)、互動(shiny、shinyAce)、日誌(logger)、ACP(plumber2)確 R 可用且合最低版本要求。
R.Version()$version.string
# Must be >= 4.1.0
# From WSL with Windows R
"/mnt/c/Program Files/R/R-4.5.2/bin/Rscript.exe" -e "cat(R.version.string)"
預期: R 版本字串印出,>= 4.1.0。
失敗時: 裝或升級 R。Windows 自 https://cran.r-project.org/bin/windows/base/ 下。Linux 用 sudo apt install r-base。
自 CRAN(穩定)或 GitHub(開發)裝。
# CRAN (recommended)
install.packages("putior")
# GitHub dev version (if latest features needed)
remotes::install_github("pjt222/putior")
預期: 套件無錯裝。library(putior) 默載。
失敗時: 若 CRAN 裝失敗報「not available for this version of R」,用 GitHub 版。若 GitHub 失敗,核 remotes 已裝:install.packages("remotes")。
依所需功能裝選擇性套件。
# MCP server integration (for AI assistant access)
remotes::install_github("posit-dev/mcptools")
install.packages("ellmer")
# Interactive sandbox
install.packages("shiny")
install.packages("shinyAce")
# Structured logging
install.packages("logger")
# ACP server (agent-to-agent communication)
install.packages("plumber2")
預期: 每套件無錯裝。 各套件之功能:
mcptools + ellmer:令 AI 助理可經 MCP 存取 putiorshiny + shinyAce:啟瀏覽器基之互動沙箱logger:結構化日誌以供除錯plumber2:建 ACP 伺服器供代理間通訊失敗時: mcptools 須先裝 remotes。
Linux 系統依賴錯則裝所需函式庫。
如 sudo apt install libcurl4-openssl-dev 為 httr2 之依賴。
於 macOS 可能需 brew install openssl。
執基本管線以確一切運作。
library(putior)
# Check package version
packageVersion("putior")
# Verify core functions are available
stopifnot(
is.function(put),
is.function(put_auto),
is.function(put_diagram),
is.function(put_generate),
is.function(put_merge),
is.function(put_theme)
)
# Test basic pipeline with a temp file
tmp <- tempfile(fileext = ".R")
writeLines("# put id:'test', label:'Hello putior'", tmp)
cat(put_diagram(put(tmp)))
預期: Mermaid 流程圖代碼印至主控台含 test 與 Hello putior。
關鍵預設:所有掃描函數(
put()、put_auto()、put_generate()、put_merge())預設recursive = TRUE,自動掃子目錄。此為自 0.2.0 前版本之破壞性變更,彼時預設為FALSE。所有掃描函數亦接受exclude參數以供正則為基之檔過濾(如put("./src/", exclude = "test_"))。
若選擇性 shiny 套件已裝,試互動沙箱:
putior::run_sandbox()
此啟基於瀏覽器之編輯器,可試驗 PUT 註解語法並即時見圖渲染。
失敗時: 若 put 未覓,套件未正確裝。以 install.packages("putior", dependencies = TRUE) 重裝。若圖空,驗暫存檔已建且註解語法用單引號於雙引號內。
library(putior) 無錯載packageVersion("putior") 返有效版本put() 於含有效 PUT 註解之檔返一列資料框put_diagram() 產以 flowchart 始之 Mermaid 代碼id:'name',非 id:"name"(某些情境下與註解字串定界符衝突)。RSTUDIO_PANDOC 於 .Renviron 中設。renv::install("putior") 而非 install.packages("putior")。mcptools 可能無 GITHUB_PAT 而失敗。經 usethis::create_github_token() 設之。analyze-codebase-workflow — 裝後調查代碼庫之下步configure-putior-mcp — 裝選擇性依賴後設 MCP 伺服器manage-renv-dependencies — 於 renv 環境內管 putiorconfigure-mcp-server — 通用 MCP 伺服器配置