@lamentis/naome 1.1.2 → 1.2.0
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/Cargo.toml +1 -1
- package/LICENSE +180 -21
- package/README.md +49 -6
- package/bin/naome.js +54 -16
- package/crates/naome-cli/Cargo.toml +1 -1
- package/crates/naome-cli/src/check_commands.rs +135 -0
- package/crates/naome-cli/src/cli_args.rs +5 -0
- package/crates/naome-cli/src/dispatcher.rs +36 -0
- package/crates/naome-cli/src/install_bridge.rs +83 -0
- package/crates/naome-cli/src/main.rs +57 -341
- package/crates/naome-cli/src/prompt_commands.rs +68 -0
- package/crates/naome-cli/src/quality_commands.rs +141 -0
- package/crates/naome-cli/src/simple_commands.rs +53 -0
- package/crates/naome-cli/src/workflow_commands.rs +153 -0
- package/crates/naome-core/Cargo.toml +1 -1
- package/crates/naome-core/src/harness_health/integrity.rs +96 -0
- package/crates/naome-core/src/harness_health.rs +14 -126
- package/crates/naome-core/src/install_plan.rs +3 -0
- package/crates/naome-core/src/intent/classifier.rs +171 -0
- package/crates/naome-core/src/intent/envelope.rs +108 -0
- package/crates/naome-core/src/intent/legacy.rs +138 -0
- package/crates/naome-core/src/intent/legacy_response.rs +76 -0
- package/crates/naome-core/src/intent/model.rs +71 -0
- package/crates/naome-core/src/intent/patterns.rs +170 -0
- package/crates/naome-core/src/intent/resolver.rs +162 -0
- package/crates/naome-core/src/intent/resolver_active.rs +17 -0
- package/crates/naome-core/src/intent/resolver_baseline.rs +55 -0
- package/crates/naome-core/src/intent/resolver_catalog.rs +167 -0
- package/crates/naome-core/src/intent/resolver_policy.rs +72 -0
- package/crates/naome-core/src/intent/resolver_shared.rs +55 -0
- package/crates/naome-core/src/intent/risk.rs +40 -0
- package/crates/naome-core/src/intent/segment.rs +170 -0
- package/crates/naome-core/src/intent.rs +64 -879
- package/crates/naome-core/src/journal.rs +9 -20
- package/crates/naome-core/src/lib.rs +13 -0
- package/crates/naome-core/src/quality/adapters.rs +178 -0
- package/crates/naome-core/src/quality/baseline.rs +75 -0
- package/crates/naome-core/src/quality/checks/duplicate_blocks.rs +175 -0
- package/crates/naome-core/src/quality/checks/near_duplicates.rs +130 -0
- package/crates/naome-core/src/quality/checks.rs +228 -0
- package/crates/naome-core/src/quality/cleanup.rs +72 -0
- package/crates/naome-core/src/quality/config.rs +109 -0
- package/crates/naome-core/src/quality/mod.rs +90 -0
- package/crates/naome-core/src/quality/scanner/repo_paths.rs +103 -0
- package/crates/naome-core/src/quality/scanner.rs +367 -0
- package/crates/naome-core/src/quality/types.rs +289 -0
- package/crates/naome-core/src/route.rs +62 -0
- package/crates/naome-core/src/task_state/admission.rs +63 -0
- package/crates/naome-core/src/task_state/admission_proof.rs +72 -0
- package/crates/naome-core/src/task_state/api.rs +130 -0
- package/crates/naome-core/src/task_state/commit_gate.rs +138 -0
- package/crates/naome-core/src/task_state/compact_proof.rs +160 -0
- package/crates/naome-core/src/task_state/completed_refresh.rs +89 -0
- package/crates/naome-core/src/task_state/completion.rs +72 -0
- package/crates/naome-core/src/task_state/deleted_paths.rs +47 -0
- package/crates/naome-core/src/task_state/diff.rs +95 -0
- package/crates/naome-core/src/task_state/evidence.rs +154 -0
- package/crates/naome-core/src/task_state/git_io.rs +86 -0
- package/crates/naome-core/src/task_state/git_parse.rs +86 -0
- package/crates/naome-core/src/task_state/git_refs.rs +37 -0
- package/crates/naome-core/src/task_state/human_review_state.rs +31 -0
- package/crates/naome-core/src/task_state/mod.rs +38 -0
- package/crates/naome-core/src/task_state/process_guard.rs +40 -0
- package/crates/naome-core/src/task_state/progress.rs +123 -0
- package/crates/naome-core/src/task_state/proof.rs +139 -0
- package/crates/naome-core/src/task_state/proof_entry.rs +66 -0
- package/crates/naome-core/src/task_state/proof_model.rs +70 -0
- package/crates/naome-core/src/task_state/proof_sources.rs +76 -0
- package/crates/naome-core/src/task_state/push_gate.rs +49 -0
- package/crates/naome-core/src/task_state/reconcile.rs +7 -0
- package/crates/naome-core/src/task_state/repair.rs +168 -0
- package/crates/naome-core/src/task_state/shape.rs +117 -0
- package/crates/naome-core/src/task_state/task_diff_api.rs +170 -0
- package/crates/naome-core/src/task_state/task_records.rs +131 -0
- package/crates/naome-core/src/task_state/task_references.rs +126 -0
- package/crates/naome-core/src/task_state/types.rs +87 -0
- package/crates/naome-core/src/task_state/util.rs +137 -0
- package/crates/naome-core/src/verification/render.rs +122 -0
- package/crates/naome-core/src/verification.rs +176 -58
- package/crates/naome-core/src/verification_contract.rs +49 -21
- package/crates/naome-core/src/workflow/integrity.rs +123 -0
- package/crates/naome-core/src/workflow/integrity_normalize.rs +7 -0
- package/crates/naome-core/src/workflow/integrity_support.rs +110 -0
- package/crates/naome-core/src/workflow/mod.rs +18 -0
- package/crates/naome-core/src/workflow/mutation.rs +68 -0
- package/crates/naome-core/src/workflow/output.rs +111 -0
- package/crates/naome-core/src/workflow/phase_inference.rs +73 -0
- package/crates/naome-core/src/workflow/phases.rs +169 -0
- package/crates/naome-core/src/workflow/policy.rs +156 -0
- package/crates/naome-core/src/workflow/processes.rs +91 -0
- package/crates/naome-core/src/workflow/types.rs +42 -0
- package/crates/naome-core/tests/harness_health.rs +3 -0
- package/crates/naome-core/tests/intent.rs +97 -792
- package/crates/naome-core/tests/intent_support/mod.rs +133 -0
- package/crates/naome-core/tests/intent_v2.rs +90 -0
- package/crates/naome-core/tests/quality.rs +425 -0
- package/crates/naome-core/tests/route.rs +88 -188
- package/crates/naome-core/tests/task_state.rs +3 -0
- package/crates/naome-core/tests/task_state_compact.rs +110 -0
- package/crates/naome-core/tests/task_state_compact_support/mod.rs +5 -0
- package/crates/naome-core/tests/task_state_compact_support/repo.rs +130 -0
- package/crates/naome-core/tests/task_state_compact_support/states.rs +151 -0
- package/crates/naome-core/tests/workflow_integrity.rs +85 -0
- package/crates/naome-core/tests/workflow_policy.rs +139 -0
- package/crates/naome-core/tests/workflow_support/mod.rs +194 -0
- package/native/darwin-arm64/naome +0 -0
- package/native/linux-x64/naome +0 -0
- package/package.json +2 -2
- package/templates/naome-root/.naome/bin/check-harness-health.js +66 -85
- package/templates/naome-root/.naome/bin/check-task-state.js +9 -10
- package/templates/naome-root/.naome/bin/naome.js +34 -63
- package/templates/naome-root/.naome/manifest.json +20 -18
- package/templates/naome-root/.naome/repository-quality-baseline.json +5 -0
- package/templates/naome-root/.naome/repository-quality.json +24 -0
- package/templates/naome-root/.naome/task-contract.schema.json +93 -11
- package/templates/naome-root/.naome/upgrade-state.json +1 -1
- package/templates/naome-root/.naome/verification.json +37 -0
- package/templates/naome-root/AGENTS.md +3 -0
- package/templates/naome-root/docs/naome/agent-workflow.md +25 -12
- package/templates/naome-root/docs/naome/execution.md +25 -21
- package/templates/naome-root/docs/naome/index.md +4 -3
- package/templates/naome-root/docs/naome/repository-quality.md +43 -0
- package/templates/naome-root/docs/naome/testing.md +12 -0
- package/crates/naome-core/src/task_state.rs +0 -2210
|
@@ -1,158 +1,141 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const crypto = require("node:crypto");
|
|
5
|
+
const childProcess = require("node:child_process");
|
|
6
|
+
const path = require("node:path");
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const nativeBinaryPath = process.platform === "win32" ? ".naome/bin/naome-rust.exe" : ".naome/bin/naome-rust";
|
|
9
9
|
const nativeBinaryName = process.platform === "win32" ? "naome.exe" : "naome";
|
|
10
10
|
|
|
11
11
|
const expectedMachineOwnedIntegrity = Object.freeze({
|
|
12
|
-
"
|
|
13
|
-
".naome/package.json": "sha256:8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a",
|
|
14
|
-
".naome/bin/naome.js": "sha256:7894690ad47700a9a5e7ecb5a94ba42c1a12e2637d2c9f41f0023b1bd8bd22b6",
|
|
12
|
+
".naome/bin/check-harness-health.js": "sha256:dc4de52b79c69600b9ba47b924e2c2b8de61a2cbfab6d1ccc0f1924d963db657",
|
|
15
13
|
".naome/bin/check-task-state.js": "sha256:43c02868072d0d13499aefba2e9a5ec9517d59539fd19ff0f11e3e4623a51b44",
|
|
16
|
-
".naome/bin/
|
|
17
|
-
".naome/
|
|
18
|
-
"
|
|
14
|
+
".naome/bin/naome.js": "sha256:5675f729be6da3cbda1d8b9e0b36821cc98409aae95dff0603ed9161a5eb3b38",
|
|
15
|
+
".naome/package.json": "sha256:8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a",
|
|
16
|
+
".naome/task-contract.schema.json": "sha256:1b3b62350328d0d6d660e36d1d1baaa2b88718530db774f9ab2a9e2fcba369c8",
|
|
17
|
+
"AGENTS.md": "sha256:9192ea81f90bb19f8043513c49b5da9e9598ee694da8356f345e7ccbca0e28df",
|
|
18
|
+
"docs/naome/agent-workflow.md": "sha256:802eb34cf268fc9c5e7aefc28192efef4bf60302d30b3f78e5a61b876ce8a098",
|
|
19
|
+
"docs/naome/execution.md": "sha256:bfc5d55838942ec8e3d790b59e3c634ff5bf6a2298265cef3dca9788a097eafb",
|
|
19
20
|
"docs/naome/first-run.md": "sha256:a1dd0bd17ec9d71955a473cd2c4a615538e89a7d81e8f4e1015a50ab9efe3558",
|
|
20
|
-
"docs/naome/
|
|
21
|
-
"docs/naome/
|
|
22
|
-
"docs/naome/upgrade.md": "sha256:2c60f0441bbd98bd528d109b30a7ded4b0ad55d61ffb9f52edac9e93b7999cb1",
|
|
23
|
-
".naome/bin/naome-rust": "sha256:cc754ae59477577dfc0130cc21c286beaf3f19e2852278bb8f1e8724277eb44b"
|
|
21
|
+
"docs/naome/index.md": "sha256:7d917f1fa368874653bb458384bd9d0b221529e19644028a3143db3d3c144213",
|
|
22
|
+
"docs/naome/upgrade.md": "sha256:2c60f0441bbd98bd528d109b30a7ded4b0ad55d61ffb9f52edac9e93b7999cb1"
|
|
24
23
|
});
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const root = findRoot(process.cwd()) || path.resolve(__dirname, "..", "..");
|
|
26
|
+
const binary = selectBinary(root);
|
|
27
|
+
const result = childProcess.spawnSync(binary, ["check-harness-health", "--root", root], {
|
|
28
|
+
cwd: root,
|
|
29
|
+
encoding: "utf8",
|
|
30
|
+
env: {
|
|
31
|
+
...process.env,
|
|
32
|
+
NAOME_EXPECTED_INTEGRITY_JSON: JSON.stringify(expectedMachineOwnedIntegrity)
|
|
33
|
+
},
|
|
34
|
+
stdio: "inherit"
|
|
35
|
+
});
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
cwd: root,
|
|
32
|
-
encoding: "utf8",
|
|
33
|
-
env: {
|
|
34
|
-
...process.env,
|
|
35
|
-
NAOME_EXPECTED_INTEGRITY_JSON: JSON.stringify(expectedMachineOwnedIntegrity)
|
|
36
|
-
},
|
|
37
|
-
stdio: "inherit"
|
|
38
|
-
});
|
|
37
|
+
process.exit(result.status === null ? 1 : result.status);
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function resolveNativeDecisionBinary(root) {
|
|
44
|
-
const expectedIntegrity = expectedNativeIntegrity(root);
|
|
39
|
+
function selectBinary(rootDir) {
|
|
40
|
+
const wantedHash = manifestNativeHash(rootDir);
|
|
45
41
|
const candidates = [
|
|
46
42
|
process.env.NAOME_NATIVE_BIN,
|
|
47
|
-
join(
|
|
48
|
-
join(
|
|
49
|
-
join(
|
|
43
|
+
path.join(rootDir, nativeBinaryPath),
|
|
44
|
+
path.join(rootDir, "packages", "naome", "target", "release", nativeBinaryName),
|
|
45
|
+
path.join(rootDir, "packages", "naome", "target", "debug", nativeBinaryName)
|
|
50
46
|
].filter(Boolean);
|
|
51
47
|
|
|
52
48
|
for (const candidate of candidates) {
|
|
53
|
-
if (
|
|
49
|
+
if (canRun(candidate, rootDir, wantedHash)) {
|
|
54
50
|
return candidate;
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
if (
|
|
59
|
-
|
|
54
|
+
if (wantedHash) {
|
|
55
|
+
stop(`No runnable NAOME native harness health binary matched ${wantedHash}. Run naome sync again.`);
|
|
60
56
|
}
|
|
61
57
|
|
|
62
|
-
const built =
|
|
63
|
-
if (built &&
|
|
58
|
+
const built = buildFromSource(rootDir);
|
|
59
|
+
if (built && canRun(built, rootDir, null)) {
|
|
64
60
|
return built;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
stop("NAOME native harness health binary is missing or incompatible. Run naome sync again.");
|
|
68
64
|
}
|
|
69
65
|
|
|
70
|
-
function
|
|
71
|
-
if (
|
|
66
|
+
function manifestNativeHash(rootDir) {
|
|
67
|
+
if (isSha(process.env.NAOME_EXPECTED_NATIVE_INTEGRITY)) {
|
|
72
68
|
return process.env.NAOME_EXPECTED_NATIVE_INTEGRITY;
|
|
73
69
|
}
|
|
74
70
|
|
|
75
|
-
const manifestPath = join(root, ".naome", "manifest.json");
|
|
76
|
-
if (!existsSync(manifestPath)) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
let manifest;
|
|
81
71
|
try {
|
|
82
|
-
manifest = JSON.parse(readFileSync(
|
|
72
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(rootDir, ".naome", "manifest.json"), "utf8"));
|
|
73
|
+
return isSha(manifest.integrity?.[nativeBinaryPath]) ? manifest.integrity[nativeBinaryPath] : null;
|
|
83
74
|
} catch {
|
|
84
75
|
return null;
|
|
85
76
|
}
|
|
86
|
-
|
|
87
|
-
const expected = manifest.integrity?.[nativeBinaryRelativePath];
|
|
88
|
-
if (!isIntegrityHash(expected)) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return expected;
|
|
93
77
|
}
|
|
94
78
|
|
|
95
|
-
function
|
|
96
|
-
if (!candidate || !existsSync(candidate)) {
|
|
79
|
+
function canRun(candidate, rootDir, wantedHash) {
|
|
80
|
+
if (!candidate || !fs.existsSync(candidate)) {
|
|
97
81
|
return false;
|
|
98
82
|
}
|
|
99
83
|
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
if (actual !== expectedIntegrity) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
84
|
+
if (wantedHash && fileSha(candidate) !== wantedHash) {
|
|
85
|
+
return false;
|
|
105
86
|
}
|
|
106
87
|
|
|
107
|
-
const probe = spawnSync(candidate, [], {
|
|
108
|
-
cwd:
|
|
88
|
+
const probe = childProcess.spawnSync(candidate, [], {
|
|
89
|
+
cwd: rootDir,
|
|
109
90
|
encoding: "utf8",
|
|
110
91
|
stdio: "ignore"
|
|
111
92
|
});
|
|
112
93
|
return !probe.error && probe.status !== null;
|
|
113
94
|
}
|
|
114
95
|
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
if (!existsSync(
|
|
96
|
+
function buildFromSource(rootDir) {
|
|
97
|
+
const manifest = path.join(rootDir, "packages", "naome", "Cargo.toml");
|
|
98
|
+
if (!fs.existsSync(manifest)) {
|
|
118
99
|
return null;
|
|
119
100
|
}
|
|
120
101
|
|
|
121
|
-
const
|
|
122
|
-
cwd:
|
|
102
|
+
const build = childProcess.spawnSync("cargo", ["build", "--release", "--manifest-path", manifest, "-p", "naome-cli"], {
|
|
103
|
+
cwd: rootDir,
|
|
123
104
|
encoding: "utf8",
|
|
124
105
|
stdio: "ignore"
|
|
125
106
|
});
|
|
126
|
-
if (
|
|
107
|
+
if (build.status !== 0) {
|
|
127
108
|
return null;
|
|
128
109
|
}
|
|
129
110
|
|
|
130
|
-
const
|
|
131
|
-
return existsSync(
|
|
111
|
+
const binaryPath = path.join(rootDir, "packages", "naome", "target", "release", nativeBinaryName);
|
|
112
|
+
return fs.existsSync(binaryPath) ? binaryPath : null;
|
|
132
113
|
}
|
|
133
114
|
|
|
134
|
-
function
|
|
135
|
-
let current = resolve(
|
|
136
|
-
|
|
137
|
-
while (true) {
|
|
138
|
-
if (existsSync(join(current, ".naome", "manifest.json"))) {
|
|
115
|
+
function findRoot(startDir) {
|
|
116
|
+
for (let current = path.resolve(startDir); ;) {
|
|
117
|
+
if (fs.existsSync(path.join(current, ".naome", "manifest.json"))) {
|
|
139
118
|
return current;
|
|
140
119
|
}
|
|
141
120
|
|
|
142
|
-
const parent = dirname(current);
|
|
121
|
+
const parent = path.dirname(current);
|
|
143
122
|
if (parent === current) {
|
|
144
123
|
return null;
|
|
145
124
|
}
|
|
146
|
-
|
|
147
125
|
current = parent;
|
|
148
126
|
}
|
|
149
127
|
}
|
|
150
128
|
|
|
151
|
-
function
|
|
129
|
+
function isSha(value) {
|
|
152
130
|
return typeof value === "string" && /^sha256:[a-f0-9]{64}$/.test(value);
|
|
153
131
|
}
|
|
154
132
|
|
|
155
|
-
function
|
|
133
|
+
function fileSha(filePath) {
|
|
134
|
+
const digest = crypto.createHash("sha256").update(fs.readFileSync(filePath)).digest("hex");
|
|
135
|
+
return `sha256:${digest}`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function stop(message) {
|
|
156
139
|
console.error("NAOME harness health check failed.");
|
|
157
140
|
console.error(`- ${message}`);
|
|
158
141
|
console.error("");
|
|
@@ -160,5 +143,3 @@ function fail(message) {
|
|
|
160
143
|
console.error("Run naome sync to repair machine-owned files after review.");
|
|
161
144
|
process.exit(1);
|
|
162
145
|
}
|
|
163
|
-
|
|
164
|
-
main();
|
|
@@ -9,18 +9,17 @@ const nativeBinaryRelativePath = process.platform === "win32" ? ".naome/bin/naom
|
|
|
9
9
|
const nativeBinaryName = process.platform === "win32" ? "naome.exe" : "naome";
|
|
10
10
|
|
|
11
11
|
const expectedMachineOwnedIntegrity = Object.freeze({
|
|
12
|
-
"
|
|
13
|
-
".naome/package.json": "sha256:8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a",
|
|
14
|
-
".naome/bin/naome.js": "sha256:7894690ad47700a9a5e7ecb5a94ba42c1a12e2637d2c9f41f0023b1bd8bd22b6",
|
|
12
|
+
".naome/bin/check-harness-health.js": "sha256:dc4de52b79c69600b9ba47b924e2c2b8de61a2cbfab6d1ccc0f1924d963db657",
|
|
15
13
|
".naome/bin/check-task-state.js": "sha256:43c02868072d0d13499aefba2e9a5ec9517d59539fd19ff0f11e3e4623a51b44",
|
|
16
|
-
".naome/bin/
|
|
17
|
-
".naome/
|
|
18
|
-
"
|
|
14
|
+
".naome/bin/naome.js": "sha256:5675f729be6da3cbda1d8b9e0b36821cc98409aae95dff0603ed9161a5eb3b38",
|
|
15
|
+
".naome/package.json": "sha256:8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a",
|
|
16
|
+
".naome/task-contract.schema.json": "sha256:1b3b62350328d0d6d660e36d1d1baaa2b88718530db774f9ab2a9e2fcba369c8",
|
|
17
|
+
"AGENTS.md": "sha256:9192ea81f90bb19f8043513c49b5da9e9598ee694da8356f345e7ccbca0e28df",
|
|
18
|
+
"docs/naome/agent-workflow.md": "sha256:802eb34cf268fc9c5e7aefc28192efef4bf60302d30b3f78e5a61b876ce8a098",
|
|
19
|
+
"docs/naome/execution.md": "sha256:bfc5d55838942ec8e3d790b59e3c634ff5bf6a2298265cef3dca9788a097eafb",
|
|
19
20
|
"docs/naome/first-run.md": "sha256:a1dd0bd17ec9d71955a473cd2c4a615538e89a7d81e8f4e1015a50ab9efe3558",
|
|
20
|
-
"docs/naome/
|
|
21
|
-
"docs/naome/
|
|
22
|
-
"docs/naome/upgrade.md": "sha256:2c60f0441bbd98bd528d109b30a7ded4b0ad55d61ffb9f52edac9e93b7999cb1",
|
|
23
|
-
".naome/bin/naome-rust": "sha256:cc754ae59477577dfc0130cc21c286beaf3f19e2852278bb8f1e8724277eb44b"
|
|
21
|
+
"docs/naome/index.md": "sha256:7d917f1fa368874653bb458384bd9d0b221529e19644028a3143db3d3c144213",
|
|
22
|
+
"docs/naome/upgrade.md": "sha256:2c60f0441bbd98bd528d109b30a7ded4b0ad55d61ffb9f52edac9e93b7999cb1"
|
|
24
23
|
});
|
|
25
24
|
|
|
26
25
|
function main(argv) {
|
|
@@ -27,7 +27,7 @@ function main(argv) {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (["status", "next", "intent", "route", "explain", "quality", "cleanup", "refresh-integrity", "workflow"].includes(command)) {
|
|
31
31
|
runNativeDecisionCommand(command, args);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
@@ -46,20 +46,25 @@ function runNativeDecisionCommand(command, args) {
|
|
|
46
46
|
fail("NAOME harness root not found. Run this inside a repository with .naome/task-state.json.");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const
|
|
50
|
-
|
|
49
|
+
const result = spawnNative(root, [command, ...args], { stdio: "inherit" });
|
|
50
|
+
|
|
51
|
+
process.exit(result.status === null ? 1 : result.status);
|
|
52
|
+
}
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
function spawnNative(root, args, options = {}) {
|
|
55
|
+
const nativeBinary = resolveNativeDecisionBinary(root);
|
|
56
|
+
if (!isUsableNativeBinary(nativeBinary, root)) {
|
|
57
|
+
fail("NAOME native decision binary failed integrity or compatibility checks.");
|
|
58
|
+
}
|
|
59
|
+
return spawnSync(nativeBinary, args, {
|
|
53
60
|
cwd: root,
|
|
54
61
|
encoding: "utf8",
|
|
55
62
|
env: {
|
|
56
63
|
...process.env,
|
|
57
64
|
NAOME_NODE_BIN: process.execPath
|
|
58
65
|
},
|
|
59
|
-
|
|
66
|
+
...options
|
|
60
67
|
});
|
|
61
|
-
|
|
62
|
-
process.exit(result.status === null ? 1 : result.status);
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
function resolveNativeDecisionBinary(root) {
|
|
@@ -115,30 +120,22 @@ function buildSourceNativeBinary(root) {
|
|
|
115
120
|
return null;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
|
-
const
|
|
123
|
+
const sourcePath = (...parts) => join(root, "packages", "naome", ...parts);
|
|
124
|
+
const manifestPath = sourcePath("Cargo.toml");
|
|
119
125
|
if (!existsSync(manifestPath)) {
|
|
120
126
|
return null;
|
|
121
127
|
}
|
|
122
128
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
encoding: "utf8",
|
|
126
|
-
stdio: "ignore"
|
|
127
|
-
});
|
|
129
|
+
const buildArgs = ["build", "--release", "--manifest-path", manifestPath, "-p", "naome-cli"];
|
|
130
|
+
const result = spawnSync("cargo", buildArgs, { cwd: root, encoding: "utf8", stdio: "ignore" });
|
|
128
131
|
if (result.status !== 0) {
|
|
129
132
|
return null;
|
|
130
133
|
}
|
|
131
134
|
|
|
132
|
-
const builtPath =
|
|
135
|
+
const builtPath = sourcePath("target", "release", nativeBinaryName);
|
|
133
136
|
return existsSync(builtPath) ? builtPath : null;
|
|
134
137
|
}
|
|
135
138
|
|
|
136
|
-
function verifyNativeBinary(nativeBinary) {
|
|
137
|
-
if (!isUsableNativeBinary(nativeBinary, findHarnessRoot(process.cwd()) || process.cwd())) {
|
|
138
|
-
fail("NAOME native decision binary failed integrity or compatibility checks.");
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
139
|
function commit(args) {
|
|
143
140
|
const root = findHarnessRoot(process.cwd());
|
|
144
141
|
if (!root) {
|
|
@@ -179,16 +176,7 @@ function commitBaseline(root, message, options = {}) {
|
|
|
179
176
|
}
|
|
180
177
|
|
|
181
178
|
function readTaskCommitPaths(root) {
|
|
182
|
-
const
|
|
183
|
-
verifyNativeBinary(nativeBinary);
|
|
184
|
-
const result = spawnSync(nativeBinary, ["commit-paths", "--json"], {
|
|
185
|
-
cwd: root,
|
|
186
|
-
encoding: "utf8",
|
|
187
|
-
env: {
|
|
188
|
-
...process.env,
|
|
189
|
-
NAOME_NODE_BIN: process.execPath
|
|
190
|
-
}
|
|
191
|
-
});
|
|
179
|
+
const result = spawnNative(root, ["commit-paths", "--json"]);
|
|
192
180
|
if (result.status !== 0) {
|
|
193
181
|
fail(`Cannot determine NAOME task commit paths: ${result.stderr.trim() || result.stdout.trim()}`);
|
|
194
182
|
}
|
|
@@ -205,8 +193,6 @@ function readTaskCommitPaths(root) {
|
|
|
205
193
|
}
|
|
206
194
|
|
|
207
195
|
function writeTaskJournal(root, outcome, commitInfo) {
|
|
208
|
-
const nativeBinary = resolveNativeDecisionBinary(root);
|
|
209
|
-
verifyNativeBinary(nativeBinary);
|
|
210
196
|
const args = [
|
|
211
197
|
"journal-task",
|
|
212
198
|
"--outcome",
|
|
@@ -220,14 +206,7 @@ function writeTaskJournal(root, outcome, commitInfo) {
|
|
|
220
206
|
args.push("--commit-after", commitInfo.after);
|
|
221
207
|
}
|
|
222
208
|
|
|
223
|
-
const result =
|
|
224
|
-
cwd: root,
|
|
225
|
-
encoding: "utf8",
|
|
226
|
-
env: {
|
|
227
|
-
...process.env,
|
|
228
|
-
NAOME_NODE_BIN: process.execPath
|
|
229
|
-
}
|
|
230
|
-
});
|
|
209
|
+
const result = spawnNative(root, args);
|
|
231
210
|
if (result.status !== 0) {
|
|
232
211
|
fail(`Cannot write NAOME task journal: ${result.stderr.trim() || result.stdout.trim()}`);
|
|
233
212
|
}
|
|
@@ -261,16 +240,7 @@ function defaultSetupCommitMessage(decision) {
|
|
|
261
240
|
}
|
|
262
241
|
|
|
263
242
|
function readDecision(root) {
|
|
264
|
-
const
|
|
265
|
-
verifyNativeBinary(nativeBinary);
|
|
266
|
-
const result = spawnSync(nativeBinary, ["status", "--json"], {
|
|
267
|
-
cwd: root,
|
|
268
|
-
encoding: "utf8",
|
|
269
|
-
env: {
|
|
270
|
-
...process.env,
|
|
271
|
-
NAOME_NODE_BIN: process.execPath
|
|
272
|
-
}
|
|
273
|
-
});
|
|
243
|
+
const result = spawnNative(root, ["status", "--json"]);
|
|
274
244
|
|
|
275
245
|
if (result.status !== 0) {
|
|
276
246
|
fail(`Cannot read NAOME status: ${result.stderr.trim() || result.stdout.trim()}`);
|
|
@@ -358,10 +328,14 @@ function gitHead(root) {
|
|
|
358
328
|
}
|
|
359
329
|
|
|
360
330
|
function findHarnessRoot(startPath) {
|
|
331
|
+
return findAncestorWithMarker(startPath, [".naome", "task-state.json"]);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function findAncestorWithMarker(startPath, markerParts) {
|
|
361
335
|
let current = resolve(startPath);
|
|
362
336
|
|
|
363
337
|
while (true) {
|
|
364
|
-
if (existsSync(join(current,
|
|
338
|
+
if (existsSync(join(current, ...markerParts))) {
|
|
365
339
|
return current;
|
|
366
340
|
}
|
|
367
341
|
|
|
@@ -384,6 +358,13 @@ function printHelp() {
|
|
|
384
358
|
console.log(" naome route --prompt <text> [--execute] [--json]");
|
|
385
359
|
console.log(" naome explain --prompt-file <path> [--json]");
|
|
386
360
|
console.log(" naome explain --prompt <text> [--json]");
|
|
361
|
+
console.log(" naome quality init [--json]");
|
|
362
|
+
console.log(" naome quality check --changed [--json]");
|
|
363
|
+
console.log(" naome quality report [--json]");
|
|
364
|
+
console.log(" naome cleanup plan [--json]");
|
|
365
|
+
console.log(" naome cleanup route --path <path> [--json]");
|
|
366
|
+
console.log(" naome refresh-integrity [--json]");
|
|
367
|
+
console.log(" naome workflow search-profile|check-search|phases|processes|mutations [--json]");
|
|
387
368
|
console.log(" naome install");
|
|
388
369
|
console.log(" naome sync");
|
|
389
370
|
console.log(" naome commit -m \"type(scope): message\"");
|
|
@@ -399,24 +380,14 @@ function installOrSync(command, args) {
|
|
|
399
380
|
const root = findHarnessRoot(process.cwd()) || process.cwd();
|
|
400
381
|
const packageRoot = sourcePackageRoot(root);
|
|
401
382
|
if (packageRoot) {
|
|
402
|
-
const
|
|
403
|
-
verifyNativeBinary(nativeBinary);
|
|
404
|
-
const result = spawnSync(nativeBinary, [
|
|
383
|
+
const result = spawnNative(root, [
|
|
405
384
|
command,
|
|
406
385
|
"--package-root",
|
|
407
386
|
packageRoot,
|
|
408
387
|
"--installer-js",
|
|
409
388
|
join(packageRoot, "bin", "naome-node.js"),
|
|
410
389
|
...args
|
|
411
|
-
], {
|
|
412
|
-
cwd: root,
|
|
413
|
-
encoding: "utf8",
|
|
414
|
-
env: {
|
|
415
|
-
...process.env,
|
|
416
|
-
NAOME_NODE_BIN: process.execPath
|
|
417
|
-
},
|
|
418
|
-
stdio: "inherit"
|
|
419
|
-
});
|
|
390
|
+
], { stdio: "inherit" });
|
|
420
391
|
process.exit(result.status === null ? 1 : result.status);
|
|
421
392
|
}
|
|
422
393
|
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"harnessVersion": "1.1.1",
|
|
4
|
-
"profile": "standard",
|
|
2
|
+
"harnessVersion": "1.2.0",
|
|
5
3
|
"installedAt": null,
|
|
4
|
+
"integrity": {
|
|
5
|
+
".naome/bin/check-harness-health.js": "sha256:dc4de52b79c69600b9ba47b924e2c2b8de61a2cbfab6d1ccc0f1924d963db657",
|
|
6
|
+
".naome/bin/check-task-state.js": "sha256:43c02868072d0d13499aefba2e9a5ec9517d59539fd19ff0f11e3e4623a51b44",
|
|
7
|
+
".naome/bin/naome.js": "sha256:5675f729be6da3cbda1d8b9e0b36821cc98409aae95dff0603ed9161a5eb3b38",
|
|
8
|
+
".naome/package.json": "sha256:8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a",
|
|
9
|
+
".naome/task-contract.schema.json": "sha256:1b3b62350328d0d6d660e36d1d1baaa2b88718530db774f9ab2a9e2fcba369c8",
|
|
10
|
+
"AGENTS.md": "sha256:9192ea81f90bb19f8043513c49b5da9e9598ee694da8356f345e7ccbca0e28df",
|
|
11
|
+
"docs/naome/agent-workflow.md": "sha256:802eb34cf268fc9c5e7aefc28192efef4bf60302d30b3f78e5a61b876ce8a098",
|
|
12
|
+
"docs/naome/execution.md": "sha256:bfc5d55838942ec8e3d790b59e3c634ff5bf6a2298265cef3dca9788a097eafb",
|
|
13
|
+
"docs/naome/first-run.md": "sha256:a1dd0bd17ec9d71955a473cd2c4a615538e89a7d81e8f4e1015a50ab9efe3558",
|
|
14
|
+
"docs/naome/index.md": "sha256:7d917f1fa368874653bb458384bd9d0b221529e19644028a3143db3d3c144213",
|
|
15
|
+
"docs/naome/upgrade.md": "sha256:2c60f0441bbd98bd528d109b30a7ded4b0ad55d61ffb9f52edac9e93b7999cb1"
|
|
16
|
+
},
|
|
6
17
|
"machineOwned": [
|
|
7
18
|
"AGENTS.md",
|
|
8
19
|
".naome/package.json",
|
|
@@ -16,6 +27,8 @@
|
|
|
16
27
|
"docs/naome/execution.md",
|
|
17
28
|
"docs/naome/upgrade.md"
|
|
18
29
|
],
|
|
30
|
+
"name": "naome",
|
|
31
|
+
"profile": "standard",
|
|
19
32
|
"projectOwned": [
|
|
20
33
|
".naomeignore",
|
|
21
34
|
".naome/init-state.json",
|
|
@@ -23,24 +36,13 @@
|
|
|
23
36
|
".naome/task-state.json",
|
|
24
37
|
".naome/upgrade-state.json",
|
|
25
38
|
".naome/verification.json",
|
|
39
|
+
".naome/repository-quality.json",
|
|
40
|
+
".naome/repository-quality-baseline.json",
|
|
26
41
|
"docs/naome/architecture.md",
|
|
27
42
|
"docs/naome/decisions.md",
|
|
28
43
|
"docs/naome/repo-profile.md",
|
|
44
|
+
"docs/naome/repository-quality.md",
|
|
29
45
|
"docs/naome/security.md",
|
|
30
46
|
"docs/naome/testing.md"
|
|
31
|
-
]
|
|
32
|
-
"integrity": {
|
|
33
|
-
"AGENTS.md": "sha256:84ce882fa6798a144c8c74673d4304fc6bf235b1cc417f7649eea9f7461775de",
|
|
34
|
-
".naome/package.json": "sha256:8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a",
|
|
35
|
-
".naome/bin/naome.js": "sha256:7894690ad47700a9a5e7ecb5a94ba42c1a12e2637d2c9f41f0023b1bd8bd22b6",
|
|
36
|
-
".naome/bin/check-task-state.js": "sha256:43c02868072d0d13499aefba2e9a5ec9517d59539fd19ff0f11e3e4623a51b44",
|
|
37
|
-
".naome/bin/check-harness-health.js": "sha256:dce2a380022dd63d86bd762869debafbc635ab3d7e8fae985e2d429d8ee437ad",
|
|
38
|
-
".naome/task-contract.schema.json": "sha256:c806416d4944eaed6dc48b3760fd0dd5b9b5a7c9ab895697fe36b54c41c1332f",
|
|
39
|
-
"docs/naome/index.md": "sha256:d04691b25ed377c2a3aa2c56965d0db276539aeadcfdd2a2ec1be7ff7706dd6f",
|
|
40
|
-
"docs/naome/first-run.md": "sha256:a1dd0bd17ec9d71955a473cd2c4a615538e89a7d81e8f4e1015a50ab9efe3558",
|
|
41
|
-
"docs/naome/agent-workflow.md": "sha256:43ba8a6814068e1b932b12a392de70b39841dc82df0acdaac459d6714c501b9d",
|
|
42
|
-
"docs/naome/execution.md": "sha256:ad66611b2878d1ba8fe05ddc4cfe9de7fd41de172a0de8295c36227a2700631a",
|
|
43
|
-
"docs/naome/upgrade.md": "sha256:2c60f0441bbd98bd528d109b30a7ded4b0ad55d61ffb9f52edac9e93b7999cb1",
|
|
44
|
-
".naome/bin/naome-rust": "sha256:cc754ae59477577dfc0130cc21c286beaf3f19e2852278bb8f1e8724277eb44b"
|
|
45
|
-
}
|
|
47
|
+
]
|
|
46
48
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "naome.repository-quality.v1",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"status": "ready",
|
|
5
|
+
"limits": {
|
|
6
|
+
"maxFileLines": 450,
|
|
7
|
+
"maxNewFileLines": 300,
|
|
8
|
+
"maxDiffAddedLines": 180,
|
|
9
|
+
"maxFunctionLines": 100,
|
|
10
|
+
"maxTopLevelSymbols": 30,
|
|
11
|
+
"duplicateBlockLines": 10,
|
|
12
|
+
"nearDuplicateSimilarity": 0.9
|
|
13
|
+
},
|
|
14
|
+
"enabledAdapters": [],
|
|
15
|
+
"disabledChecks": [],
|
|
16
|
+
"ignoredPaths": [],
|
|
17
|
+
"generatedPaths": [
|
|
18
|
+
"**/*.min.js",
|
|
19
|
+
"**/*.map",
|
|
20
|
+
"**/dist/**",
|
|
21
|
+
"**/build/**"
|
|
22
|
+
],
|
|
23
|
+
"pathRules": []
|
|
24
|
+
}
|