Skip to content

Commit fdf896f

Browse files
committed
refactor: improve bpmn sidecar
1 parent 88059f5 commit fdf896f

129 files changed

Lines changed: 4161 additions & 910 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
.reasonix
13
node_modules
24
.DS_Store
35
*.pyc

Cargo.lock

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

devenv.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@
180180
"treefmt-nix": "treefmt-nix"
181181
},
182182
"locked": {
183-
"lastModified": 1779427831,
184-
"narHash": "sha256-n+TRxgTBGwOSqmPGhh9gqtFd9oIHadiQI7KUhpKLd04=",
183+
"lastModified": 1779868340,
184+
"narHash": "sha256-TK1oFHU2SPXuB1gUX3SnqNujViWiYIPYTuWxXy1wR6U=",
185185
"owner": "numtide",
186186
"repo": "llm-agents.nix",
187-
"rev": "20e430bd6bc68a3e76f16a31a19504971b1832bd",
187+
"rev": "93c592a1bf2bfcb7e72b9a5344611efcf72917db",
188188
"type": "github"
189189
},
190190
"original": {
@@ -195,11 +195,11 @@
195195
},
196196
"nixpkgs": {
197197
"locked": {
198-
"lastModified": 1778869304,
199-
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
198+
"lastModified": 1779536132,
199+
"narHash": "sha256-q+fF42iv/geEbHfgSzy3tS0FF/EyD6XTZ98E6yxiBO8=",
200200
"owner": "NixOS",
201201
"repo": "nixpkgs",
202-
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
202+
"rev": "3d8f0f3f72a6cd4d93d0ad13203f2ea1cb7e1456",
203203
"type": "github"
204204
},
205205
"original": {

devenv.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ let
4747
in
4848
{
4949
imports = [
50-
nixosModules.claude
50+
# nixosModules.claude
5151
nixosModules.flake-parts.omnibus
5252
nixosModules.files
5353
nixosModules.prek
@@ -144,6 +144,7 @@ in
144144

145145
# https://devenv.sh/pre-commit-hooks/
146146
git-hooks.hooks = {
147+
nixfmt.enable = true;
147148
ruff.enable = true;
148149
rustfmt.enable = true;
149150
clippy.enable = true;

nix/modules/llm.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ in
2929
# # sha256 = "sha256-ONSOVvDLfs8IDq4hI+XYAcMwjXSTBDIJlHB5Xwq107Q=";
3030
# # };
3131
# })
32+
(__inputs__.llm-agents.packages.${system}.reasonix.overrideAttrs rec {
33+
# version = "0.53.0";
34+
# src = pkgs.fetchFromGitHub {
35+
# owner = "esengine";
36+
# repo = "DeepSeek-Reasonix";
37+
# rev = "984e830df42ad065774df2c2a0ce06deb09dfa78";
38+
# sha256 = "sha256-DzTb9V8z9R+NTjvhuLq19jWZCHEYkhyQRH8DoQOBgLo=";
39+
# };
40+
# npmDeps = pkgs.importNpmLock {
41+
# npmRoot = src;
42+
# };
43+
})
3244
__inputs__.llm-agents.packages.${system}.gemini-cli
3345
__inputs__.llm-agents.packages.${system}.rtk
3446
];
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
use super::data::data_artifact_issue;
12
use crate::bpmn_parse_api::BpmnSourceFile;
23
use crate::lint_api::LintIssue;
34

45
pub(super) fn issue_for_tag(
5-
_source: &BpmnSourceFile,
6-
_tag: &str,
6+
source: &BpmnSourceFile,
7+
tag: &str,
78
_parent: Option<&str>,
89
) -> Option<LintIssue> {
9-
None
10+
match tag {
11+
"dataStore" | "dataStoreReference" => Some(data_artifact_issue(source, tag)),
12+
_ => None,
13+
}
1014
}

packages/rust/crates/xiuxian-qianji-client/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ thiserror = { workspace = true }
1717
toml = { workspace = true }
1818
orgize = { workspace = true }
1919
xiuxian-qianji-bpmn-engine = { path = "../xiuxian-qianji-bpmn-engine" }
20-
xiuxian-wendao-parsers = { path = "../xiuxian-wendao-parsers" }
2120

2221
[dev-dependencies]
2322
tempfile = { workspace = true }

packages/rust/crates/xiuxian-qianji-client/src/flowhub/contract.rs

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use std::path::{Path, PathBuf};
66
use orgize::{Org, ast::OrgElementSelector};
77
use serde::Deserialize;
88
use xiuxian_qianji_bpmn_engine::{BpmnSourceFile, lint_bpmn_source};
9-
use xiuxian_wendao_parsers::{OrgizeLintOutputFormat, OrgizeLintRequest, lint_org_files};
109

10+
use super::org_lint::validate_org_syntax;
1111
use crate::QianjiClientError;
1212

1313
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -248,26 +248,14 @@ fn validate_required_org_surface(
248248
surface_path: &Path,
249249
diagnostics: &mut Vec<String>,
250250
) -> Result<bool, QianjiClientError> {
251-
let request = OrgizeLintRequest {
252-
paths: vec![surface_path.to_path_buf()],
253-
output_format: OrgizeLintOutputFormat::Compact,
254-
priority_highest: None,
255-
priority_lowest: None,
256-
priority_default: None,
257-
fix: false,
258-
};
259-
let report = lint_org_files(&request).map_err(|error| {
251+
let source = read_to_string(surface_path, "required Flowhub Org surface").map_err(|error| {
260252
QianjiClientError::message(format!(
261-
"Failed to lint required Flowhub Org surface `{}` from manifest `{}`: {error}",
253+
"Failed to read required Flowhub Org surface `{}` from manifest `{}`: {error}",
262254
required_surface,
263255
manifest_path.display()
264256
))
265257
})?;
266-
if report.is_clean() {
267-
return Ok(true);
268-
}
269-
diagnostics.push(report.render(OrgizeLintOutputFormat::Compact));
270-
Ok(false)
258+
Ok(validate_org_syntax(surface_path, &source, diagnostics))
271259
}
272260

273261
fn validate_required_bpmn_surface(
@@ -325,24 +313,7 @@ fn validate_policy_org_source(
325313
passed &=
326314
validate_policy_contract_graph_selector(policy_path, &source, &properties, diagnostics);
327315

328-
let request = OrgizeLintRequest {
329-
paths: vec![policy_path.to_path_buf()],
330-
output_format: OrgizeLintOutputFormat::Compact,
331-
priority_highest: None,
332-
priority_lowest: None,
333-
priority_default: None,
334-
fix: false,
335-
};
336-
let report = lint_org_files(&request).map_err(|error| {
337-
QianjiClientError::message(format!(
338-
"Failed to lint Flowhub policy entry `{}`: {error}",
339-
policy_path.display()
340-
))
341-
})?;
342-
if !report.is_clean() {
343-
diagnostics.push(report.render(OrgizeLintOutputFormat::Compact));
344-
passed = false;
345-
}
316+
passed &= validate_org_syntax(policy_path, &source, diagnostics);
346317
Ok(passed)
347318
}
348319

@@ -685,24 +656,7 @@ fn validate_org_source(
685656
passed = false;
686657
}
687658

688-
let request = OrgizeLintRequest {
689-
paths: vec![source_pair.org_source.clone()],
690-
output_format: OrgizeLintOutputFormat::Compact,
691-
priority_highest: None,
692-
priority_lowest: None,
693-
priority_default: None,
694-
fix: false,
695-
};
696-
let report = lint_org_files(&request).map_err(|error| {
697-
QianjiClientError::message(format!(
698-
"Failed to lint Flowhub Org source `{}`: {error}",
699-
source_pair.org_source.display()
700-
))
701-
})?;
702-
if !report.is_clean() {
703-
diagnostics.push(report.render(OrgizeLintOutputFormat::Compact));
704-
passed = false;
705-
}
659+
passed &= validate_org_syntax(&source_pair.org_source, &source, diagnostics);
706660
Ok(passed)
707661
}
708662

packages/rust/crates/xiuxian-qianji-client/src/flowhub/materialize/runner.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::fs;
55
use std::path::{Path, PathBuf};
66

77
use sha2::{Digest, Sha256};
8-
use xiuxian_wendao_parsers::{OrgizeLintOutputFormat, OrgizeLintRequest, lint_org_files};
98

109
use crate::flowhub::contract::{
1110
FlowhubSourcePair, list_flowhub_source_pairs, parse_org_properties, property_value,
@@ -17,6 +16,7 @@ use crate::flowhub::model::{
1716
FlowhubScenarioRegistry, FlowhubScenarioRegistrySourcePair, FlowhubScenarioRegistryValidation,
1817
FlowhubSourcePairSummary, FlowhubValidation,
1918
};
19+
use crate::flowhub::org_lint::validate_org_syntax;
2020
use crate::flowhub::parse::{FlowhubAction, FlowhubCommand};
2121
use crate::flowhub::render::{RenderInput, render_output};
2222

@@ -480,26 +480,17 @@ fn validate_generated_org_files(
480480
generated_files: &[FlowhubGeneratedFile],
481481
diagnostics: &mut Vec<String>,
482482
) -> Result<bool, QianjiClientError> {
483-
let paths = generated_files
484-
.iter()
485-
.map(|file| file.path.clone())
486-
.collect::<Vec<_>>();
487-
let request = OrgizeLintRequest {
488-
paths,
489-
output_format: OrgizeLintOutputFormat::Compact,
490-
priority_highest: None,
491-
priority_lowest: None,
492-
priority_default: None,
493-
fix: false,
494-
};
495-
let report = lint_org_files(&request).map_err(|error| {
496-
QianjiClientError::message(format!("Failed to lint generated agent Org files: {error}"))
497-
})?;
498-
if report.is_clean() {
499-
return Ok(true);
483+
let mut passed = true;
484+
for file in generated_files {
485+
let source = fs::read_to_string(&file.path).map_err(|error| {
486+
QianjiClientError::message(format!(
487+
"Failed to read generated agent Org file `{}`: {error}",
488+
file.path.display()
489+
))
490+
})?;
491+
passed &= validate_org_syntax(&file.path, &source, diagnostics);
500492
}
501-
diagnostics.push(report.render(OrgizeLintOutputFormat::Compact));
502-
Ok(false)
493+
Ok(passed)
503494
}
504495

505496
fn validate_generated_source_metadata(

packages/rust/crates/xiuxian-qianji-client/src/flowhub/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mod contract;
44
mod facade;
55
mod materialize;
66
mod model;
7+
mod org_lint;
78
mod parse;
89
mod render;
910

0 commit comments

Comments
 (0)