feat: add monitoring template support to generator

- Add scene_kind field to GenerateSceneRequest
- Update generate_scene_package to use analyze_scene_source_with_hint
- Implement scene_toml_monitoring for simplified monitoring scene manifests
- Add scene_toml router to dispatch to different templates based on SceneKind
- Add --scene-kind CLI option to sg_scene_generate binary
- Add generator_emits_monitoring_template test
- Create monitoring fixture with index.html (no meta tag, tests hint param)

Monitoring templates have simplified scene.toml without org/period resolvers.

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
木炎
2026-04-16 23:51:11 +08:00
parent 87cee36173
commit 73edf1e5cf
4 changed files with 361 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ fn generator_writes_registration_ready_package_with_scene_toml() {
source_dir: PathBuf::from("tests/fixtures/generated_scene/report_collection"),
scene_id: "sample-report-scene".to_string(),
scene_name: "示例报表场景".to_string(),
scene_kind: None,
output_root: output_root.clone(),
lessons_path: PathBuf::from("docs/superpowers/references/tq-lineloss-lessons-learned.toml"),
})
@@ -141,3 +142,27 @@ fn analyzer_hint_overrides_meta() {
assert_eq!(analysis.scene_kind, SceneKind::Monitoring);
}
#[test]
fn generator_emits_monitoring_template() {
let output_root = temp_workspace("sgclaw-monitoring-generator");
generate_scene_package(GenerateSceneRequest {
source_dir: PathBuf::from("tests/fixtures/generated_scene/monitoring"),
scene_id: "sample-monitor-scene".to_string(),
scene_name: "示例监测场景".to_string(),
scene_kind: Some(SceneKind::Monitoring),
output_root: output_root.clone(),
lessons_path: PathBuf::from("docs/superpowers/references/tq-lineloss-lessons-learned.toml"),
})
.unwrap();
let skill_root = output_root.join("skills/sample-monitor-scene");
assert!(skill_root.join("SKILL.toml").exists());
assert!(skill_root.join("scene.toml").exists());
let generated_manifest = fs::read_to_string(skill_root.join("scene.toml")).unwrap();
assert!(generated_manifest.contains("category = \"monitoring\""));
// 监测类不应该有 org/period resolver
assert!(!generated_manifest.contains("resolver = \"dictionary_entity\""));
}