@lamentis/naome 1.3.14 → 1.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +2 -2
- package/crates/naome-cli/Cargo.toml +1 -1
- package/crates/naome-cli/src/architecture_commands.rs +5 -4
- package/crates/naome-cli/src/quality_commands.rs +4 -4
- package/crates/naome-core/Cargo.toml +1 -1
- package/crates/naome-core/src/architecture/config/parser/sections.rs +1 -1
- package/crates/naome-core/src/architecture/config.rs +1 -1
- package/crates/naome-core/src/architecture/model.rs +19 -0
- package/crates/naome-core/src/architecture/output.rs +166 -22
- package/crates/naome-core/src/architecture/rules/budgets.rs +2 -1
- package/crates/naome-core/src/architecture/rules.rs +5 -2
- package/crates/naome-core/src/architecture.rs +4 -4
- package/crates/naome-core/src/intent/legacy.rs +1 -1
- package/crates/naome-core/src/intent/model.rs +27 -0
- package/crates/naome-core/src/intent/resolver.rs +3 -28
- package/crates/naome-core/src/intent/resolver_baseline.rs +1 -2
- package/crates/naome-core/src/intent/resolver_policy.rs +1 -2
- package/crates/naome-core/src/intent.rs +2 -1
- package/crates/naome-core/src/lib.rs +7 -7
- package/crates/naome-core/src/quality/adapter_ios.rs +3 -1
- package/crates/naome-core/src/quality/adapter_support.rs +32 -0
- package/crates/naome-core/src/quality/adapters.rs +8 -25
- package/crates/naome-core/src/quality/analysis_model.rs +33 -0
- package/crates/naome-core/src/quality/cache.rs +1 -1
- package/crates/naome-core/src/quality/checks/duplicate_blocks.rs +2 -1
- package/crates/naome-core/src/quality/checks/near_duplicates.rs +2 -1
- package/crates/naome-core/src/quality/mod.rs +1 -0
- package/crates/naome-core/src/quality/scanner/analysis.rs +1 -1
- package/crates/naome-core/src/quality/scanner.rs +1 -32
- package/crates/naome-core/src/quality/semantic/extract.rs +2 -1
- package/crates/naome-core/src/quality/structure/adapter_ios.rs +1 -1
- package/crates/naome-core/src/quality/structure/adapter_model.rs +23 -0
- package/crates/naome-core/src/quality/structure/adapters.rs +2 -23
- package/crates/naome-core/src/quality/structure/config.rs +2 -1
- package/crates/naome-core/src/quality/structure/defaults.rs +2 -2
- package/crates/naome-core/src/quality/structure/mod.rs +1 -0
- package/crates/naome-core/src/quality/structure/model.rs +6 -6
- package/crates/naome-core/src/repository_model.rs +6 -1
- package/crates/naome-core/src/route/builtin_checks.rs +1 -1
- package/crates/naome-core/src/route/builtin_require.rs +1 -1
- package/crates/naome-core/src/route/execution.rs +2 -34
- package/crates/naome-core/src/route/execution_baselines.rs +1 -1
- package/crates/naome-core/src/route/execution_model.rs +37 -0
- package/crates/naome-core/src/route/execution_support.rs +1 -1
- package/crates/naome-core/src/route/execution_tasks.rs +1 -1
- package/crates/naome-core/src/route/quality_gate.rs +0 -1
- package/crates/naome-core/src/route.rs +3 -1
- package/crates/naome-core/src/task_state/api.rs +5 -4
- package/crates/naome-core/src/task_state/commit_gate.rs +1 -1
- package/crates/naome-core/src/task_state/compact_proof.rs +2 -2
- package/crates/naome-core/src/task_state/completed_refresh.rs +0 -13
- package/crates/naome-core/src/task_state/completion.rs +13 -4
- package/crates/naome-core/src/task_state/mod.rs +1 -1
- package/crates/naome-core/src/task_state/progress.rs +1 -1
- package/crates/naome-core/src/task_state/proof.rs +1 -4
- package/crates/naome-core/src/task_state/proof_entry.rs +1 -1
- package/crates/naome-core/src/task_state/proof_model.rs +2 -18
- package/crates/naome-core/src/task_state/proof_sources.rs +2 -2
- package/crates/naome-core/src/task_state/proof_types.rs +17 -0
- package/crates/naome-core/src/task_state/shape.rs +1 -1
- package/crates/naome-core/src/task_state/task_diff_api.rs +1 -1
- package/crates/naome-core/src/verification_contract_policy.rs +2 -6
- package/crates/naome-core/src/workflow/agent/proof.rs +1 -1
- package/crates/naome-core/src/workflow/agent.rs +1 -1
- package/crates/naome-core/src/workflow/mod.rs +3 -1
- package/crates/naome-core/src/workflow/phase_inference.rs +1 -1
- package/crates/naome-core/src/workflow/phase_model.rs +22 -0
- package/crates/naome-core/src/workflow/phases.rs +1 -21
- package/crates/naome-core/tests/architecture_config.rs +67 -0
- package/native/darwin-arm64/naome +0 -0
- package/native/linux-x64/naome +0 -0
- package/package.json +1 -1
- package/crates/naome-core/src/task_state/reconcile.rs +0 -7
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
use std::collections::HashSet;
|
|
2
|
+
|
|
3
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
4
|
+
pub struct FileAnalysis {
|
|
5
|
+
pub path: String,
|
|
6
|
+
pub line_count: usize,
|
|
7
|
+
pub added_lines: usize,
|
|
8
|
+
pub raw_lines: Vec<String>,
|
|
9
|
+
pub normalized_lines: Vec<NormalizedLine>,
|
|
10
|
+
pub symbols: Vec<SymbolAnalysis>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
14
|
+
pub struct NormalizedLine {
|
|
15
|
+
pub line_number: usize,
|
|
16
|
+
pub value: String,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
20
|
+
pub struct SymbolAnalysis {
|
|
21
|
+
pub kind: String,
|
|
22
|
+
pub name: String,
|
|
23
|
+
pub start_line: usize,
|
|
24
|
+
pub end_line: usize,
|
|
25
|
+
pub indent: usize,
|
|
26
|
+
pub tokens: HashSet<String>,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
impl SymbolAnalysis {
|
|
30
|
+
pub fn line_count(&self) -> usize {
|
|
31
|
+
self.end_line.saturating_sub(self.start_line) + 1
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -2,7 +2,8 @@ use std::collections::{HashMap, HashSet};
|
|
|
2
2
|
|
|
3
3
|
use sha2::{Digest, Sha256};
|
|
4
4
|
|
|
5
|
-
use super::super::
|
|
5
|
+
use super::super::analysis_model::NormalizedLine;
|
|
6
|
+
use super::super::scanner::{stable_fingerprint, QualityContext};
|
|
6
7
|
use super::super::types::QualityViolation;
|
|
7
8
|
use super::{is_code_like_path, QualityCheck};
|
|
8
9
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
use std::collections::HashSet;
|
|
2
2
|
|
|
3
|
-
use super::super::
|
|
3
|
+
use super::super::analysis_model::{FileAnalysis, SymbolAnalysis};
|
|
4
|
+
use super::super::scanner::QualityContext;
|
|
4
5
|
use super::super::types::QualityViolation;
|
|
5
6
|
use super::{is_code_like_path, violation, QualityCheck};
|
|
6
7
|
|
|
@@ -4,7 +4,7 @@ use std::collections::{HashMap, HashSet};
|
|
|
4
4
|
use std::fs;
|
|
5
5
|
use std::path::Path;
|
|
6
6
|
|
|
7
|
-
use
|
|
7
|
+
use crate::quality::analysis_model::{FileAnalysis, NormalizedLine, SymbolAnalysis};
|
|
8
8
|
use crate::quality::cache::{content_hash, QualityCache};
|
|
9
9
|
use normalize::{normalize_line, token_set};
|
|
10
10
|
|
|
@@ -11,6 +11,7 @@ use crate::{git, models::NaomeError, paths};
|
|
|
11
11
|
pub(crate) use repo_paths::collect_repo_paths;
|
|
12
12
|
use repo_paths::{added_lines_by_path, regular_repo_file_path, tracked_blob_hashes};
|
|
13
13
|
|
|
14
|
+
use super::analysis_model::FileAnalysis;
|
|
14
15
|
use super::cache::QualityCache;
|
|
15
16
|
use super::types::{
|
|
16
17
|
default_generated_paths, default_ignored_paths, QualityLimits, QualityMode,
|
|
@@ -55,38 +56,6 @@ impl QualityContext {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
59
|
-
pub struct FileAnalysis {
|
|
60
|
-
pub path: String,
|
|
61
|
-
pub line_count: usize,
|
|
62
|
-
pub added_lines: usize,
|
|
63
|
-
pub raw_lines: Vec<String>,
|
|
64
|
-
pub normalized_lines: Vec<NormalizedLine>,
|
|
65
|
-
pub symbols: Vec<SymbolAnalysis>,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
69
|
-
pub struct NormalizedLine {
|
|
70
|
-
pub line_number: usize,
|
|
71
|
-
pub value: String,
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
75
|
-
pub struct SymbolAnalysis {
|
|
76
|
-
pub kind: String,
|
|
77
|
-
pub name: String,
|
|
78
|
-
pub start_line: usize,
|
|
79
|
-
pub end_line: usize,
|
|
80
|
-
pub indent: usize,
|
|
81
|
-
pub tokens: HashSet<String>,
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
impl SymbolAnalysis {
|
|
85
|
-
pub fn line_count(&self) -> usize {
|
|
86
|
-
self.end_line.saturating_sub(self.start_line) + 1
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
59
|
pub fn scan_repository(
|
|
91
60
|
root: &Path,
|
|
92
61
|
mode: QualityMode,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
use std::collections::BTreeSet;
|
|
2
2
|
|
|
3
3
|
use super::model::ObjectCandidate;
|
|
4
|
-
use crate::quality::
|
|
4
|
+
use crate::quality::analysis_model::{FileAnalysis, SymbolAnalysis};
|
|
5
|
+
use crate::quality::scanner::stable_fingerprint;
|
|
5
6
|
|
|
6
7
|
pub(super) fn extract_object_candidates(file: &FileAnalysis) -> Vec<ObjectCandidate> {
|
|
7
8
|
let mut candidates = Vec::new();
|
|
@@ -4,7 +4,7 @@ use crate::quality::adapter_support::{
|
|
|
4
4
|
detects_swiftui_project, detects_xcode_project, detects_xctest_project,
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
use super::
|
|
7
|
+
use super::adapter_model::StructureAdapter;
|
|
8
8
|
|
|
9
9
|
pub(super) fn adapters() -> Vec<StructureAdapter> {
|
|
10
10
|
let mut adapters = Vec::new();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
use crate::quality::adapter_support::{AdapterDescriptor, RepoSignals};
|
|
2
|
+
|
|
3
|
+
#[derive(Clone, Copy)]
|
|
4
|
+
pub(super) struct StructureAdapter {
|
|
5
|
+
pub(super) id: &'static str,
|
|
6
|
+
pub(super) detect: fn(&RepoSignals<'_>) -> bool,
|
|
7
|
+
pub(super) source_roots: &'static [&'static str],
|
|
8
|
+
pub(super) test_roots: &'static [&'static str],
|
|
9
|
+
pub(super) generated_roots: &'static [&'static str],
|
|
10
|
+
pub(super) artifact_roots: &'static [&'static str],
|
|
11
|
+
pub(super) module_roots: &'static [&'static str],
|
|
12
|
+
pub(super) allowed_root_files: &'static [&'static str],
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
impl AdapterDescriptor for StructureAdapter {
|
|
16
|
+
fn id(&self) -> &'static str {
|
|
17
|
+
self.id
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fn detects(&self, signals: &RepoSignals<'_>) -> bool {
|
|
21
|
+
(self.detect)(signals)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -2,36 +2,15 @@ use crate::models::NaomeError;
|
|
|
2
2
|
|
|
3
3
|
use crate::quality::adapter_support::{
|
|
4
4
|
detected_ids, detects_javascript_typescript_project, detects_rust_project, extend_unique,
|
|
5
|
-
find_adapter_by_id, validate_ids,
|
|
5
|
+
find_adapter_by_id, validate_ids,
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
use super::adapter_ios;
|
|
9
|
+
use super::adapter_model::StructureAdapter;
|
|
9
10
|
use super::model::RepositoryStructureConfig;
|
|
10
11
|
|
|
11
12
|
const CONFIG_PATH: &str = ".naome/repository-structure.json";
|
|
12
13
|
|
|
13
|
-
#[derive(Clone, Copy)]
|
|
14
|
-
pub(super) struct StructureAdapter {
|
|
15
|
-
pub(super) id: &'static str,
|
|
16
|
-
pub(super) detect: fn(&RepoSignals<'_>) -> bool,
|
|
17
|
-
pub(super) source_roots: &'static [&'static str],
|
|
18
|
-
pub(super) test_roots: &'static [&'static str],
|
|
19
|
-
pub(super) generated_roots: &'static [&'static str],
|
|
20
|
-
pub(super) artifact_roots: &'static [&'static str],
|
|
21
|
-
pub(super) module_roots: &'static [&'static str],
|
|
22
|
-
pub(super) allowed_root_files: &'static [&'static str],
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
impl AdapterDescriptor for StructureAdapter {
|
|
26
|
-
fn id(&self) -> &'static str {
|
|
27
|
-
self.id
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
fn detects(&self, signals: &RepoSignals<'_>) -> bool {
|
|
31
|
-
(self.detect)(signals)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
14
|
pub fn detected_structure_adapter_ids(paths: &[String]) -> Vec<String> {
|
|
36
15
|
let registry = registry();
|
|
37
16
|
detected_ids(paths, ®istry)
|
|
@@ -8,6 +8,7 @@ use super::adapters::{
|
|
|
8
8
|
};
|
|
9
9
|
use crate::quality::config_support::validate_ready_schema;
|
|
10
10
|
|
|
11
|
+
use super::defaults::default_structure_config;
|
|
11
12
|
use super::model::RepositoryStructureConfig;
|
|
12
13
|
|
|
13
14
|
const CONFIG_RELATIVE_PATH: &str = ".naome/repository-structure.json";
|
|
@@ -68,7 +69,7 @@ pub fn write_default_structure_config_if_missing(
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
fn generated_structure_config(paths: &[String]) -> RepositoryStructureConfig {
|
|
71
|
-
let mut config =
|
|
72
|
+
let mut config = default_structure_config();
|
|
72
73
|
config.enabled_adapters = detected_structure_adapter_ids(paths);
|
|
73
74
|
config
|
|
74
75
|
}
|
|
@@ -24,11 +24,11 @@ pub fn default_structure_config() -> RepositoryStructureConfig {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
pub fn default_changed_policy() -> String {
|
|
27
|
-
|
|
27
|
+
super::model::default_changed_policy()
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
pub fn default_debt_policy() -> String {
|
|
31
|
-
|
|
31
|
+
super::model::default_debt_policy()
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const DEFAULT_SOURCE_ROOTS: &[&str] = &[
|
|
@@ -2,8 +2,6 @@ use std::collections::{BTreeMap, BTreeSet};
|
|
|
2
2
|
|
|
3
3
|
use serde::{Deserialize, Serialize};
|
|
4
4
|
|
|
5
|
-
use super::defaults::{default_changed_policy, default_debt_policy, default_structure_config};
|
|
6
|
-
|
|
7
5
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
8
6
|
#[serde(rename_all = "camelCase")]
|
|
9
7
|
pub struct StructureLimits {
|
|
@@ -81,10 +79,12 @@ pub struct RepositoryStructureConfig {
|
|
|
81
79
|
pub limits: StructureLimits,
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
pub(super) fn default_changed_policy() -> String {
|
|
83
|
+
"block".to_string()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
pub(super) fn default_debt_policy() -> String {
|
|
87
|
+
"report".to_string()
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
#[derive(Debug, Clone, Serialize)]
|
|
@@ -125,7 +125,12 @@ fn model_evidence_paths(model: &RepositoryModel) -> Vec<String> {
|
|
|
125
125
|
.iter()
|
|
126
126
|
.flat_map(|fact| fact.evidence.iter())
|
|
127
127
|
.chain(model.roots.iter().flat_map(|root| root.evidence.iter()))
|
|
128
|
-
.chain(
|
|
128
|
+
.chain(
|
|
129
|
+
model
|
|
130
|
+
.entities
|
|
131
|
+
.iter()
|
|
132
|
+
.flat_map(|entity| entity.evidence.iter()),
|
|
133
|
+
)
|
|
129
134
|
.chain(model.path_facts.iter().map(|fact| &fact.path))
|
|
130
135
|
.chain(
|
|
131
136
|
model
|
|
@@ -4,7 +4,7 @@ use crate::harness_health::{validate_harness_health, HarnessHealthOptions};
|
|
|
4
4
|
use crate::models::NaomeError;
|
|
5
5
|
use crate::quality::{check_repository_quality, check_semantic_legacy, QualityMode};
|
|
6
6
|
use crate::route::git_ops::{command_output, git_output};
|
|
7
|
-
use crate::route::
|
|
7
|
+
use crate::route::quality_gate_config::QualityCheck;
|
|
8
8
|
use crate::task_state::{validate_task_state, TaskStateMode, TaskStateOptions};
|
|
9
9
|
use crate::verification_contract::validate_verification_contract;
|
|
10
10
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
use std::path::
|
|
1
|
+
use std::path::Path;
|
|
2
2
|
|
|
3
3
|
use crate::intent::IntentDecision;
|
|
4
|
-
use crate::journal::TaskJournalEntry;
|
|
5
4
|
use crate::models::{Decision, NaomeError};
|
|
6
5
|
|
|
7
6
|
use super::execution_baselines::{
|
|
@@ -9,41 +8,10 @@ use super::execution_baselines::{
|
|
|
9
8
|
baseline_harness_refresh_then_completed_task, baseline_harness_refresh_then_worktree,
|
|
10
9
|
baseline_pure_harness_refresh, baseline_setup, commit_upgrade_baseline,
|
|
11
10
|
};
|
|
11
|
+
use super::execution_model::RouteExecution;
|
|
12
12
|
use super::execution_tasks::{
|
|
13
13
|
commit_user_diff, create_task_worktree, journal_external_baseline_if_needed,
|
|
14
14
|
};
|
|
15
|
-
use super::RouteWorktree;
|
|
16
|
-
|
|
17
|
-
pub(super) struct RouteExecution {
|
|
18
|
-
pub(super) mutation_performed: bool,
|
|
19
|
-
pub(super) executed_actions: Vec<String>,
|
|
20
|
-
pub(super) journal_entry: Option<TaskJournalEntry>,
|
|
21
|
-
pub(super) user_message: String,
|
|
22
|
-
pub(super) task_root: PathBuf,
|
|
23
|
-
pub(super) worktree: Option<RouteWorktree>,
|
|
24
|
-
pub(super) route_allowed: bool,
|
|
25
|
-
pub(super) human_options: Vec<String>,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
impl RouteExecution {
|
|
29
|
-
pub(super) fn from_intent(root: &Path, intent: &IntentDecision) -> Self {
|
|
30
|
-
Self {
|
|
31
|
-
mutation_performed: false,
|
|
32
|
-
executed_actions: Vec::new(),
|
|
33
|
-
journal_entry: None,
|
|
34
|
-
user_message: intent.user_message.clone(),
|
|
35
|
-
task_root: root.to_path_buf(),
|
|
36
|
-
worktree: None,
|
|
37
|
-
route_allowed: intent.allowed,
|
|
38
|
-
human_options: intent.human_options.clone(),
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
pub(super) fn mark_action(&mut self, action: &str) {
|
|
43
|
-
self.mutation_performed = true;
|
|
44
|
-
self.executed_actions.push(action.to_string());
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
15
|
|
|
48
16
|
pub(super) fn execute_route_policy(
|
|
49
17
|
root: &Path,
|
|
@@ -5,7 +5,7 @@ use crate::task_state::{
|
|
|
5
5
|
completed_task_harness_refresh_diff, harness_refresh_diff, harness_refresh_with_unrelated_diff,
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
use super::
|
|
8
|
+
use super::execution_model::RouteExecution;
|
|
9
9
|
use super::execution_support::{commit_completed_task, commit_harness_paths, set_created_worktree};
|
|
10
10
|
use super::git_ops::{git_add_all, git_commit, git_head};
|
|
11
11
|
use super::worktree::{
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
use std::path::{Path, PathBuf};
|
|
2
|
+
|
|
3
|
+
use crate::intent::IntentDecision;
|
|
4
|
+
use crate::journal::TaskJournalEntry;
|
|
5
|
+
|
|
6
|
+
use super::RouteWorktree;
|
|
7
|
+
|
|
8
|
+
pub(super) struct RouteExecution {
|
|
9
|
+
pub(super) mutation_performed: bool,
|
|
10
|
+
pub(super) executed_actions: Vec<String>,
|
|
11
|
+
pub(super) journal_entry: Option<TaskJournalEntry>,
|
|
12
|
+
pub(super) user_message: String,
|
|
13
|
+
pub(super) task_root: PathBuf,
|
|
14
|
+
pub(super) worktree: Option<RouteWorktree>,
|
|
15
|
+
pub(super) route_allowed: bool,
|
|
16
|
+
pub(super) human_options: Vec<String>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl RouteExecution {
|
|
20
|
+
pub(super) fn from_intent(root: &Path, intent: &IntentDecision) -> Self {
|
|
21
|
+
Self {
|
|
22
|
+
mutation_performed: false,
|
|
23
|
+
executed_actions: Vec::new(),
|
|
24
|
+
journal_entry: None,
|
|
25
|
+
user_message: intent.user_message.clone(),
|
|
26
|
+
task_root: root.to_path_buf(),
|
|
27
|
+
worktree: None,
|
|
28
|
+
route_allowed: intent.allowed,
|
|
29
|
+
human_options: intent.human_options.clone(),
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub(super) fn mark_action(&mut self, action: &str) {
|
|
34
|
+
self.mutation_performed = true;
|
|
35
|
+
self.executed_actions.push(action.to_string());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
|
|
|
3
3
|
use crate::journal::append_task_journal;
|
|
4
4
|
use crate::models::{Decision, NaomeError};
|
|
5
5
|
|
|
6
|
-
use super::
|
|
6
|
+
use super::execution_model::RouteExecution;
|
|
7
7
|
use super::git_ops::{git_add_completed_task_paths, git_commit, git_head, git_stage_only_paths};
|
|
8
8
|
use super::RouteWorktree;
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@ use crate::git;
|
|
|
4
4
|
use crate::journal::append_task_journal;
|
|
5
5
|
use crate::models::{Decision, NaomeError};
|
|
6
6
|
|
|
7
|
-
use super::
|
|
7
|
+
use super::execution_model::RouteExecution;
|
|
8
8
|
use super::execution_support::{initial_decision_completed, set_created_worktree};
|
|
9
9
|
use super::git_ops::{git_commit, git_head, git_stage_only_paths};
|
|
10
10
|
use super::quality_gate::run_user_diff_quality_gate;
|
|
@@ -4,7 +4,6 @@ use crate::git;
|
|
|
4
4
|
use crate::models::NaomeError;
|
|
5
5
|
|
|
6
6
|
use super::builtin_checks::run_quality_check;
|
|
7
|
-
pub(super) use super::quality_gate_config::QualityCheck;
|
|
8
7
|
use super::quality_gate_config::{user_diff_check_ids, verification_checks};
|
|
9
8
|
use super::quality_gate_snapshot::{
|
|
10
9
|
changed_path_snapshot, read_head_verification, sorted_path_set,
|
|
@@ -12,6 +12,7 @@ mod builtin_require;
|
|
|
12
12
|
mod context;
|
|
13
13
|
mod execution;
|
|
14
14
|
mod execution_baselines;
|
|
15
|
+
mod execution_model;
|
|
15
16
|
mod execution_support;
|
|
16
17
|
mod execution_tasks;
|
|
17
18
|
mod git_ops;
|
|
@@ -26,7 +27,8 @@ use self::context::{
|
|
|
26
27
|
can_create_task, discarded_actions, required_context_for_intent, required_context_for_route,
|
|
27
28
|
winning_rule, would_mutate,
|
|
28
29
|
};
|
|
29
|
-
use self::execution::
|
|
30
|
+
use self::execution::execute_route_policy;
|
|
31
|
+
use self::execution_model::RouteExecution;
|
|
30
32
|
|
|
31
33
|
const MAX_NAOME_TASK_WORKTREES: usize = 25;
|
|
32
34
|
|
|
@@ -5,12 +5,13 @@ use serde_json::Value;
|
|
|
5
5
|
use crate::models::NaomeError;
|
|
6
6
|
use crate::task_ledger::{read_task_state_projection, validate_task_state_projection_is_current};
|
|
7
7
|
|
|
8
|
-
use super::
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
use super::admission::validate_admission;
|
|
9
|
+
use super::commit_gate::validate_commit_gate;
|
|
10
|
+
use super::completion::validate_complete_task;
|
|
11
11
|
use super::diff::validate_human_review_blocker_paths;
|
|
12
|
+
use super::progress::validate_progress;
|
|
12
13
|
use super::proof::validate_proof_evidence_covers_changed_paths;
|
|
13
|
-
use super::
|
|
14
|
+
use super::push_gate::validate_push_gate;
|
|
14
15
|
use super::shape::{
|
|
15
16
|
format_blocker, validate_active_task, validate_active_task_references, validate_blocker,
|
|
16
17
|
validate_idle_state, validate_pending_upgrade, validate_task_state_shape,
|
|
@@ -7,7 +7,7 @@ use super::diff::task_diff_from_entries;
|
|
|
7
7
|
use super::git_io::read_git_staged_changed_entries;
|
|
8
8
|
use super::process_guard::{validate_no_active_processes, ProcessGate};
|
|
9
9
|
use super::progress::{validate_init_complete, validate_upgrade_complete};
|
|
10
|
-
use super::
|
|
10
|
+
use super::repair::{
|
|
11
11
|
is_deterministic_harness_refresh_diff, is_harness_repair_diff,
|
|
12
12
|
is_install_or_upgrade_baseline_diff,
|
|
13
13
|
};
|
|
@@ -5,11 +5,11 @@ use serde_json::Value;
|
|
|
5
5
|
|
|
6
6
|
use crate::models::NaomeError;
|
|
7
7
|
|
|
8
|
-
use super::
|
|
8
|
+
use super::evidence::{
|
|
9
9
|
validate_control_state_paths, validate_evidence_array, validate_evidence_paths,
|
|
10
10
|
};
|
|
11
|
-
use super::proof_model::{CanonicalProof, VerificationDefaults};
|
|
12
11
|
use super::proof_sources::read_path_sets;
|
|
12
|
+
use super::proof_types::{CanonicalProof, VerificationDefaults};
|
|
13
13
|
use super::util::{is_iso_datetime, require_string};
|
|
14
14
|
|
|
15
15
|
pub(super) fn compact_proofs(
|
|
@@ -10,19 +10,6 @@ use super::types::{
|
|
|
10
10
|
TaskStateMode, TaskStateOptions,
|
|
11
11
|
};
|
|
12
12
|
use super::util::{matches_any_pattern, string_array};
|
|
13
|
-
pub(super) fn add_completed_task_diff_notice(
|
|
14
|
-
root: &Path,
|
|
15
|
-
notices: &mut Vec<String>,
|
|
16
|
-
) -> Result<(), NaomeError> {
|
|
17
|
-
let changed_paths = read_git_changed_paths(root)?;
|
|
18
|
-
if changed_paths.is_empty() {
|
|
19
|
-
return Ok(());
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
notices.push(format!("Task is complete and verified. Changed paths: {}. NAOME intent can baseline it automatically before the next distinct task; only surface human choices when intent blocks or the user explicitly asks to review, revise, cancel, or commit.", changed_paths.join(", ")));
|
|
23
|
-
Ok(())
|
|
24
|
-
}
|
|
25
|
-
|
|
26
13
|
pub fn completed_task_harness_refresh_diff(
|
|
27
14
|
root: &Path,
|
|
28
15
|
) -> Result<Option<CompletedTaskHarnessRefreshDiff>, NaomeError> {
|
|
@@ -3,14 +3,10 @@ use std::path::Path;
|
|
|
3
3
|
|
|
4
4
|
use serde_json::Value;
|
|
5
5
|
|
|
6
|
-
pub(super) use super::admission::validate_admission;
|
|
7
|
-
pub(super) use super::commit_gate::validate_commit_gate;
|
|
8
6
|
use super::diff::validate_changed_entries;
|
|
9
7
|
use super::git_io::read_git_changed_entries;
|
|
10
8
|
use super::process_guard::{validate_no_active_processes, ProcessGate};
|
|
11
|
-
pub(super) use super::progress::validate_progress;
|
|
12
9
|
use super::proof::{validate_proof_evidence_covers_changed_entries, validate_proof_results};
|
|
13
|
-
use super::reconcile::add_completed_task_diff_notice;
|
|
14
10
|
use super::shape::{read_verification_check_ids, validate_required_check_ids};
|
|
15
11
|
use super::types::ChangedEntry;
|
|
16
12
|
use crate::models::NaomeError;
|
|
@@ -58,6 +54,19 @@ pub(super) fn validate_complete_task(
|
|
|
58
54
|
Ok(())
|
|
59
55
|
}
|
|
60
56
|
|
|
57
|
+
fn add_completed_task_diff_notice(
|
|
58
|
+
root: &Path,
|
|
59
|
+
notices: &mut Vec<String>,
|
|
60
|
+
) -> Result<(), NaomeError> {
|
|
61
|
+
let changed_paths = super::git_io::read_git_changed_paths(root)?;
|
|
62
|
+
if changed_paths.is_empty() {
|
|
63
|
+
return Ok(());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
notices.push(format!("Task is complete and verified. Changed paths: {}. NAOME intent can baseline it automatically before the next distinct task; only surface human choices when intent blocks or the user explicitly asks to review, revise, cancel, or commit.", changed_paths.join(", ")));
|
|
67
|
+
Ok(())
|
|
68
|
+
}
|
|
69
|
+
|
|
61
70
|
pub(super) fn validate_complete_task_against_entries(
|
|
62
71
|
active_task: &Value,
|
|
63
72
|
root: &Path,
|
|
@@ -8,7 +8,7 @@ use crate::repository_model_drift;
|
|
|
8
8
|
use super::diff::validate_changed_paths;
|
|
9
9
|
use super::git_io::read_git_changed_paths;
|
|
10
10
|
use super::human_review_state::validate_human_review_state;
|
|
11
|
-
use super::
|
|
11
|
+
use super::push_gate::format_dirty_diff_admission_blocker;
|
|
12
12
|
use super::shape::{
|
|
13
13
|
format_blocker, validate_active_task, validate_active_task_references, validate_blocker,
|
|
14
14
|
validate_pending_upgrade,
|
|
@@ -6,10 +6,7 @@ use serde_json::Value;
|
|
|
6
6
|
use crate::models::NaomeError;
|
|
7
7
|
|
|
8
8
|
use super::diff::task_diff_from_entries;
|
|
9
|
-
|
|
10
|
-
evidence_entry_path, validate_control_state_paths, validate_control_state_patterns,
|
|
11
|
-
validate_evidence_array, validate_evidence_paths,
|
|
12
|
-
};
|
|
9
|
+
use super::evidence::evidence_entry_path;
|
|
13
10
|
use super::git_io::read_git_changed_entries;
|
|
14
11
|
use super::proof_entry::validate_proof_result;
|
|
15
12
|
use super::proof_model::canonical_proofs;
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
use std::path::Path;
|
|
2
2
|
|
|
3
|
-
use serde_json::Value;
|
|
4
|
-
|
|
5
3
|
use crate::models::NaomeError;
|
|
6
4
|
|
|
7
5
|
use super::compact_proof::compact_proofs;
|
|
8
6
|
use super::proof_sources::{check_id_from_proof, read_verification_defaults};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
pub(crate) struct CanonicalProof {
|
|
12
|
-
pub(crate) check_id: String,
|
|
13
|
-
pub(crate) command: String,
|
|
14
|
-
pub(crate) cwd: String,
|
|
15
|
-
pub(crate) exit_code: i64,
|
|
16
|
-
pub(crate) checked_at: String,
|
|
17
|
-
pub(crate) evidence: Vec<Value>,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#[derive(Debug, Clone)]
|
|
21
|
-
pub(super) struct VerificationDefaults {
|
|
22
|
-
pub(super) command: String,
|
|
23
|
-
pub(super) cwd: String,
|
|
24
|
-
}
|
|
7
|
+
use super::proof_types::CanonicalProof;
|
|
8
|
+
use serde_json::Value;
|
|
25
9
|
|
|
26
10
|
pub(crate) fn canonical_proofs(
|
|
27
11
|
active_task: &Value,
|
|
@@ -5,10 +5,10 @@ use serde_json::Value;
|
|
|
5
5
|
|
|
6
6
|
use crate::models::NaomeError;
|
|
7
7
|
|
|
8
|
-
use super::
|
|
8
|
+
use super::evidence::{
|
|
9
9
|
validate_control_state_paths, validate_evidence_array, validate_evidence_paths,
|
|
10
10
|
};
|
|
11
|
-
use super::
|
|
11
|
+
use super::proof_types::VerificationDefaults;
|
|
12
12
|
use super::util::read_json;
|
|
13
13
|
|
|
14
14
|
pub(super) fn read_path_sets(
|