一键导入
swarm-advanced-features
Export/import, versioning, migrations, and backup/restore. Use when adding enterprise/production features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Export/import, versioning, migrations, and backup/restore. Use when adding enterprise/production features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
GOAP-based orchestrator for managing GitHub issues, creating action plans, and executing workspace operations with branch/PR workflow.
Configure and troubleshoot npm OIDC Trusted Publishing for GitHub Actions. Use when npm publish fails with E404, OIDC errors, or provenance issues.
GitHub release management, crates.io trusted publishing, npm provenance, and GitHub Pages documentation. Use when creating releases, publishing packages, or deploying docs.
Git commit conventions, validation gates, and CI/CD workflows. Use when committing changes, verifying gates, or working with GitHub Actions.
Validate merge readiness with atomic commits and GitHub Actions checks using gh CLI; use for pre-merge verification and CI truth validation.
Apply TRIZ inventive principles to solve problems that seem to have no good solution. Use after triz-analysis has identified contradictions.
| name | swarm-advanced-features |
| description | Export/import, versioning, migrations, and backup/restore. Use when adding enterprise/production features. |
pub async fn export_json(&self, path: &Path) -> Result<usize> {
let file = File::create(path)?;
let writer = BufWriter::new(file);
let mut count = 0;
// Stream concepts in chunks
for chunk in self.singularity.concepts().chunks(1000) {
for concept in chunk {
serde_json::to_writer(&mut writer, concept)?;
count += 1;
}
}
Ok(count)
}
CREATE TABLE concept_versions (
concept_id TEXT NOT NULL,
version INTEGER NOT NULL,
vector BLOB NOT NULL,
metadata TEXT NOT NULL,
modified_at INTEGER NOT NULL,
PRIMARY KEY (concept_id, version),
FOREIGN KEY (concept_id) REFERENCES concepts(id) ON DELETE CASCADE
);
pub struct Migration {
version: u32,
up: &'static str,
down: &'static str,
}
pub async fn run_migrations(&self, target: u32) -> Result<()> {
let current = self.get_schema_version().await?;
for migration in &MIGRATIONS[current as usize..target as usize] {
let conn = self.connect().await?;
conn.execute(migration.up, ()).await?;
self.set_schema_version(migration.version).await?;
}
Ok(())
}
pub async fn backup(&self, path: &Path) -> Result<()> {
// SQLite: VACUUM INTO
let conn = self.connect().await?;
conn.execute(&format!("VACUUM INTO '{}'", path.display()), ()).await?;
self.verify_backup(path).await?;
Ok(())
}
{
"version": "0.1.0",
"exported_at": 1700000000,
"schema_version": 5,
"concepts": [...],
"associations": [...],
"concept_versions": [...]
}
All files must remain ≤ 500 lines. Refactor to new modules if needed.