causoryn 0.0.0-stage → 0.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/.claude-plugin/plugin.json +36 -0
- package/.codex-plugin/mcp.json +19 -0
- package/.codex-plugin/plugin.json +38 -0
- package/.zcode-plugin/plugin.json +42 -0
- package/LICENSE +21 -0
- package/README.md +171 -2
- package/THIRD-PARTY-NOTICES.md +443 -0
- package/dist/bundle-manifest.json +39 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +253 -0
- package/dist/doctor.d.ts +13 -0
- package/dist/doctor.js +507 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/mcp-server.mjs +288477 -0
- package/dist/mcp-server.mjs.LEGAL.txt +17 -0
- package/dist/node_modules/better-sqlite3/LICENSE +21 -0
- package/dist/node_modules/better-sqlite3/lib/binding.js +62 -0
- package/dist/node_modules/better-sqlite3/lib/darwin-arm64.js +3 -0
- package/dist/node_modules/better-sqlite3/lib/darwin-x64.js +3 -0
- package/dist/node_modules/better-sqlite3/lib/database.js +109 -0
- package/dist/node_modules/better-sqlite3/lib/index.js +3 -0
- package/dist/node_modules/better-sqlite3/lib/linux-arm64.js +3 -0
- package/dist/node_modules/better-sqlite3/lib/linux-x64.js +3 -0
- package/dist/node_modules/better-sqlite3/lib/linuxmusl-arm64.js +4 -0
- package/dist/node_modules/better-sqlite3/lib/linuxmusl-x64.js +4 -0
- package/dist/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
- package/dist/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
- package/dist/node_modules/better-sqlite3/lib/methods/explain.js +9 -0
- package/dist/node_modules/better-sqlite3/lib/methods/function.js +31 -0
- package/dist/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
- package/dist/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
- package/dist/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
- package/dist/node_modules/better-sqlite3/lib/methods/table.js +195 -0
- package/dist/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
- package/dist/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
- package/dist/node_modules/better-sqlite3/lib/sqlite-error.js +25 -0
- package/dist/node_modules/better-sqlite3/lib/util.js +12 -0
- package/dist/node_modules/better-sqlite3/lib/win32-arm64.js +3 -0
- package/dist/node_modules/better-sqlite3/lib/win32-x64.js +3 -0
- package/dist/node_modules/better-sqlite3/package.json +67 -0
- package/dist/node_modules/better-sqlite3/prebuilds/darwin-arm64.node +0 -0
- package/dist/node_modules/better-sqlite3/prebuilds/darwin-x64.node +0 -0
- package/dist/node_modules/better-sqlite3/prebuilds/linux-arm64.node +0 -0
- package/dist/node_modules/better-sqlite3/prebuilds/linux-x64.node +0 -0
- package/dist/node_modules/better-sqlite3/prebuilds/linuxmusl-arm64.node +0 -0
- package/dist/node_modules/better-sqlite3/prebuilds/linuxmusl-x64.node +0 -0
- package/dist/node_modules/better-sqlite3/prebuilds/win32-arm64.node +0 -0
- package/dist/node_modules/better-sqlite3/prebuilds/win32-x64.node +0 -0
- package/dist/runtime-stage.d.ts +8 -0
- package/dist/runtime-stage.js +159 -0
- package/dist/setup.d.ts +15 -0
- package/dist/setup.js +735 -0
- package/dist/toml-patch.d.ts +10 -0
- package/dist/toml-patch.js +587 -0
- package/dist/types.d.ts +144 -0
- package/dist/types.js +35 -0
- package/dist/typescript-lib/lib.d.ts +22 -0
- package/dist/typescript-lib/lib.decorators.d.ts +384 -0
- package/dist/typescript-lib/lib.decorators.legacy.d.ts +22 -0
- package/dist/typescript-lib/lib.dom.asynciterable.d.ts +41 -0
- package/dist/typescript-lib/lib.dom.d.ts +39429 -0
- package/dist/typescript-lib/lib.dom.iterable.d.ts +571 -0
- package/dist/typescript-lib/lib.es2015.collection.d.ts +147 -0
- package/dist/typescript-lib/lib.es2015.core.d.ts +597 -0
- package/dist/typescript-lib/lib.es2015.d.ts +28 -0
- package/dist/typescript-lib/lib.es2015.generator.d.ts +77 -0
- package/dist/typescript-lib/lib.es2015.iterable.d.ts +605 -0
- package/dist/typescript-lib/lib.es2015.promise.d.ts +81 -0
- package/dist/typescript-lib/lib.es2015.proxy.d.ts +128 -0
- package/dist/typescript-lib/lib.es2015.reflect.d.ts +144 -0
- package/dist/typescript-lib/lib.es2015.symbol.d.ts +46 -0
- package/dist/typescript-lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/dist/typescript-lib/lib.es2016.array.include.d.ts +116 -0
- package/dist/typescript-lib/lib.es2016.d.ts +21 -0
- package/dist/typescript-lib/lib.es2016.full.d.ts +23 -0
- package/dist/typescript-lib/lib.es2016.intl.d.ts +31 -0
- package/dist/typescript-lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/dist/typescript-lib/lib.es2017.d.ts +26 -0
- package/dist/typescript-lib/lib.es2017.date.d.ts +31 -0
- package/dist/typescript-lib/lib.es2017.full.d.ts +23 -0
- package/dist/typescript-lib/lib.es2017.intl.d.ts +44 -0
- package/dist/typescript-lib/lib.es2017.object.d.ts +49 -0
- package/dist/typescript-lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/dist/typescript-lib/lib.es2017.string.d.ts +45 -0
- package/dist/typescript-lib/lib.es2017.typedarrays.d.ts +53 -0
- package/dist/typescript-lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/dist/typescript-lib/lib.es2018.asynciterable.d.ts +53 -0
- package/dist/typescript-lib/lib.es2018.d.ts +24 -0
- package/dist/typescript-lib/lib.es2018.full.d.ts +24 -0
- package/dist/typescript-lib/lib.es2018.intl.d.ts +83 -0
- package/dist/typescript-lib/lib.es2018.promise.d.ts +30 -0
- package/dist/typescript-lib/lib.es2018.regexp.d.ts +37 -0
- package/dist/typescript-lib/lib.es2019.array.d.ts +79 -0
- package/dist/typescript-lib/lib.es2019.d.ts +24 -0
- package/dist/typescript-lib/lib.es2019.full.d.ts +24 -0
- package/dist/typescript-lib/lib.es2019.intl.d.ts +23 -0
- package/dist/typescript-lib/lib.es2019.object.d.ts +33 -0
- package/dist/typescript-lib/lib.es2019.string.d.ts +37 -0
- package/dist/typescript-lib/lib.es2019.symbol.d.ts +24 -0
- package/dist/typescript-lib/lib.es2020.bigint.d.ts +765 -0
- package/dist/typescript-lib/lib.es2020.d.ts +27 -0
- package/dist/typescript-lib/lib.es2020.date.d.ts +42 -0
- package/dist/typescript-lib/lib.es2020.full.d.ts +24 -0
- package/dist/typescript-lib/lib.es2020.intl.d.ts +474 -0
- package/dist/typescript-lib/lib.es2020.number.d.ts +28 -0
- package/dist/typescript-lib/lib.es2020.promise.d.ts +47 -0
- package/dist/typescript-lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/dist/typescript-lib/lib.es2020.string.d.ts +44 -0
- package/dist/typescript-lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/dist/typescript-lib/lib.es2021.d.ts +23 -0
- package/dist/typescript-lib/lib.es2021.full.d.ts +24 -0
- package/dist/typescript-lib/lib.es2021.intl.d.ts +166 -0
- package/dist/typescript-lib/lib.es2021.promise.d.ts +48 -0
- package/dist/typescript-lib/lib.es2021.string.d.ts +33 -0
- package/dist/typescript-lib/lib.es2021.weakref.d.ts +78 -0
- package/dist/typescript-lib/lib.es2022.array.d.ts +121 -0
- package/dist/typescript-lib/lib.es2022.d.ts +25 -0
- package/dist/typescript-lib/lib.es2022.error.d.ts +75 -0
- package/dist/typescript-lib/lib.es2022.full.d.ts +24 -0
- package/dist/typescript-lib/lib.es2022.intl.d.ts +145 -0
- package/dist/typescript-lib/lib.es2022.object.d.ts +26 -0
- package/dist/typescript-lib/lib.es2022.regexp.d.ts +39 -0
- package/dist/typescript-lib/lib.es2022.string.d.ts +25 -0
- package/dist/typescript-lib/lib.es2023.array.d.ts +924 -0
- package/dist/typescript-lib/lib.es2023.collection.d.ts +21 -0
- package/dist/typescript-lib/lib.es2023.d.ts +22 -0
- package/dist/typescript-lib/lib.es2023.full.d.ts +24 -0
- package/dist/typescript-lib/lib.es2023.intl.d.ts +56 -0
- package/dist/typescript-lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/dist/typescript-lib/lib.es2024.collection.d.ts +29 -0
- package/dist/typescript-lib/lib.es2024.d.ts +26 -0
- package/dist/typescript-lib/lib.es2024.full.d.ts +24 -0
- package/dist/typescript-lib/lib.es2024.object.d.ts +29 -0
- package/dist/typescript-lib/lib.es2024.promise.d.ts +35 -0
- package/dist/typescript-lib/lib.es2024.regexp.d.ts +25 -0
- package/dist/typescript-lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/dist/typescript-lib/lib.es2024.string.d.ts +29 -0
- package/dist/typescript-lib/lib.es5.d.ts +4601 -0
- package/dist/typescript-lib/lib.es6.d.ts +23 -0
- package/dist/typescript-lib/lib.esnext.array.d.ts +35 -0
- package/dist/typescript-lib/lib.esnext.collection.d.ts +96 -0
- package/dist/typescript-lib/lib.esnext.d.ts +29 -0
- package/dist/typescript-lib/lib.esnext.decorators.d.ts +28 -0
- package/dist/typescript-lib/lib.esnext.disposable.d.ts +193 -0
- package/dist/typescript-lib/lib.esnext.error.d.ts +24 -0
- package/dist/typescript-lib/lib.esnext.float16.d.ts +445 -0
- package/dist/typescript-lib/lib.esnext.full.d.ts +24 -0
- package/dist/typescript-lib/lib.esnext.intl.d.ts +21 -0
- package/dist/typescript-lib/lib.esnext.iterator.d.ts +148 -0
- package/dist/typescript-lib/lib.esnext.promise.d.ts +34 -0
- package/dist/typescript-lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/dist/typescript-lib/lib.scripthost.d.ts +322 -0
- package/dist/typescript-lib/lib.webworker.asynciterable.d.ts +41 -0
- package/dist/typescript-lib/lib.webworker.d.ts +13150 -0
- package/dist/typescript-lib/lib.webworker.importscripts.d.ts +23 -0
- package/dist/typescript-lib/lib.webworker.iterable.d.ts +340 -0
- package/licenses/Apache-2.0.txt +55 -0
- package/licenses/TypeScript-ThirdPartyNoticeText.txt +193 -0
- package/licenses/better-sqlite3-LICENSE.txt +21 -0
- package/mcp_config.json +16 -0
- package/native/go-worker/PROTOCOL.md +316 -0
- package/native/go-worker/cmd/worker/main.go +440 -0
- package/native/go-worker/go.mod +3 -0
- package/native/go-worker/internal/analyze/analyze.go +820 -0
- package/native/go-worker/internal/analyze/model.go +182 -0
- package/native/go-worker/internal/analyze/routes.go +181 -0
- package/native/python-worker/PROTOCOL.md +342 -0
- package/native/python-worker/worker.py +1190 -0
- package/native/roslyn-worker/Causoryn.RoslynWorker.csproj +40 -0
- package/native/roslyn-worker/Causoryn.RoslynWorker.deps.json +59 -0
- package/native/roslyn-worker/Causoryn.RoslynWorker.dll +0 -0
- package/native/roslyn-worker/Causoryn.RoslynWorker.runtimeconfig.json +13 -0
- package/native/roslyn-worker/Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/native/roslyn-worker/Microsoft.CodeAnalysis.dll +0 -0
- package/native/roslyn-worker/PROTOCOL.md +285 -0
- package/native/roslyn-worker/Program.cs +249 -0
- package/native/roslyn-worker/Protocol.cs +397 -0
- package/native/roslyn-worker/ReferenceResolver.cs +235 -0
- package/native/roslyn-worker/WorkerAnalyzer.cs +1669 -0
- package/native/roslyn-worker/packages.lock.json +30 -0
- package/native/rust-worker/Cargo.lock +107 -0
- package/native/rust-worker/Cargo.toml +23 -0
- package/native/rust-worker/PROTOCOL.md +294 -0
- package/native/rust-worker/src/analyzer.rs +1209 -0
- package/native/rust-worker/src/main.rs +127 -0
- package/native/rust-worker/src/protocol.rs +284 -0
- package/native/rust-worker/src/sha256.rs +136 -0
- package/package.json +71 -4
- package/plugin.json +17 -0
- package/scripts/causoryn.mjs +40 -0
- package/scripts/lib/node-version-guard.mjs +24 -0
- package/scripts/plugin-mcp-launcher.mjs +111 -0
- package/skills/causoryn/SKILL.md +53 -0
- package/skills/map-system/SKILL.md +69 -0
- package/skills/preflight-change/SKILL.md +38 -0
- package/skills/verify-change/SKILL.md +31 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//! Giriş noktası — satır-bazlı stdin/stdout JSON protokol döngüsü (M1-Rust).
|
|
2
|
+
//!
|
|
3
|
+
//! Kırmızı çizgi (proje sözleşmesi 4): stdout'ta YALNIZCA protokol
|
|
4
|
+
//! satırları taşınır; her log satırı stderr'e ([rust-worker] önekiyle)
|
|
5
|
+
//! yazılır. Girdi/çıktı BOM'suz UTF-8'dir; her yanıt tek satırdır
|
|
6
|
+
//! (serde_json string içi yeni satırları \n olarak kaçırır).
|
|
7
|
+
//!
|
|
8
|
+
//! Hata davranışı: bozuk JSON / doğrulama hatası → status:"error" yanıtı
|
|
9
|
+
//! ve döngü DEVAM EDER; yalnızca stdin/stdout'un kendisi kırılırsa süreç
|
|
10
|
+
//! çıkar. Çıkış kodu: 0 = normal EOF, 1 = kablo hatası.
|
|
11
|
+
//!
|
|
12
|
+
//! Stack savunması (roslyn-worker örüntüsü): StackOverflow süreci öldürür;
|
|
13
|
+
//! syn parse/visit derin iç içe AST'lerde stack tüketir. Ana döngü, geniş
|
|
14
|
+
//! stack'li ayrı bir thread'de koşar (256 MB) — derin girdi ya PARSE_ERROR
|
|
15
|
+
//! tanısına ya da başarıyla tamamlanmış analize dönüşür, süreç ölmez.
|
|
16
|
+
|
|
17
|
+
mod analyzer;
|
|
18
|
+
mod protocol;
|
|
19
|
+
mod sha256;
|
|
20
|
+
|
|
21
|
+
use std::io::{BufWriter, Write};
|
|
22
|
+
|
|
23
|
+
use serde_json::Value;
|
|
24
|
+
|
|
25
|
+
fn log(message: &str) {
|
|
26
|
+
eprintln!("[rust-worker] {message}");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fn main() {
|
|
30
|
+
let handle = std::thread::Builder::new()
|
|
31
|
+
.stack_size(256 * 1024 * 1024)
|
|
32
|
+
.spawn(run_loop)
|
|
33
|
+
.expect("çalışma thread'i başlatılamadı");
|
|
34
|
+
let code = handle.join().unwrap_or(1);
|
|
35
|
+
std::process::exit(code);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fn run_loop() -> i32 {
|
|
39
|
+
let stdin = std::io::stdin();
|
|
40
|
+
let mut reader = stdin.lock();
|
|
41
|
+
let stdout = std::io::stdout();
|
|
42
|
+
let mut writer = BufWriter::new(stdout.lock());
|
|
43
|
+
|
|
44
|
+
log(&format!(
|
|
45
|
+
"worker başladı — protokol v{}, analyzer {} v{}",
|
|
46
|
+
protocol::PROTOCOL_VERSION,
|
|
47
|
+
protocol::ANALYZER_ID,
|
|
48
|
+
protocol::ANALYZER_VERSION
|
|
49
|
+
));
|
|
50
|
+
|
|
51
|
+
loop {
|
|
52
|
+
match protocol::read_line_limited(&mut reader, protocol::MAX_REQUEST_LINE_BYTES) {
|
|
53
|
+
Ok(Some((line, exceeded))) => {
|
|
54
|
+
if exceeded {
|
|
55
|
+
// Satır sınırı aşımı: satır içerikle işlenmez; id:null +
|
|
56
|
+
// LIMIT_EXCEEDED yanıtı yazılır ve döngü devam eder.
|
|
57
|
+
let response = protocol::error_response(
|
|
58
|
+
Value::Null,
|
|
59
|
+
"LIMIT_EXCEEDED",
|
|
60
|
+
&format!(
|
|
61
|
+
"istek satırı {} bayt sınırını aştı; satır atlandı",
|
|
62
|
+
protocol::MAX_REQUEST_LINE_BYTES
|
|
63
|
+
),
|
|
64
|
+
);
|
|
65
|
+
if !write_response(&mut writer, &response) {
|
|
66
|
+
return 1;
|
|
67
|
+
}
|
|
68
|
+
log("istek satırı sınırı aşıldı — satır atlandı");
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if line.trim().is_empty() {
|
|
73
|
+
continue; // sessiz satır atlanır (mesaj tek satır JSON)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let response = protocol::handle_line(&line);
|
|
77
|
+
if !write_response(&mut writer, &response) {
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
log(&format!(
|
|
81
|
+
"istek işlendi: id={} status={}",
|
|
82
|
+
describe_id(response.get("id").cloned().unwrap_or(Value::Null)),
|
|
83
|
+
response
|
|
84
|
+
.get("status")
|
|
85
|
+
.and_then(Value::as_str)
|
|
86
|
+
.unwrap_or("(yok)")
|
|
87
|
+
));
|
|
88
|
+
}
|
|
89
|
+
Ok(None) => break, // EOF
|
|
90
|
+
Err(err) => {
|
|
91
|
+
log(&format!("kablo hatası, worker sonlanıyor: {err}"));
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
log("stdin EOF — worker kapanıyor");
|
|
98
|
+
0
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
fn write_response<W: Write>(writer: &mut W, response: &Value) -> bool {
|
|
102
|
+
match serde_json::to_string(response) {
|
|
103
|
+
Ok(line) => {
|
|
104
|
+
if writeln!(writer, "{line}").is_err() {
|
|
105
|
+
log("yanıt yazılamadı (kablo hatası)");
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
if writer.flush().is_err() {
|
|
109
|
+
log("yanıt flush edilemedi (kablo hatası)");
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
true
|
|
113
|
+
}
|
|
114
|
+
Err(err) => {
|
|
115
|
+
log(&format!("yanıt serileştirilemedi: {err}"));
|
|
116
|
+
false
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
fn describe_id(id: Value) -> String {
|
|
122
|
+
match id {
|
|
123
|
+
Value::Null => "(yok)".to_string(),
|
|
124
|
+
Value::String(s) => s,
|
|
125
|
+
other => other.to_string(),
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
//! stdin/stdout satır-bazlı JSON protokol sözleşmesi — PROTOCOL.md v1.
|
|
2
|
+
//!
|
|
3
|
+
//! Kırmızı çizgi (proje sözleşmesi 4): stdout'ta YALNIZCA protokol
|
|
4
|
+
//! satırları taşınır; tüm loglar stderr'e ([rust-worker] önekiyle)
|
|
5
|
+
//! yazılır. JSON serileştirmesi tek satır üretir (serde_json string içi
|
|
6
|
+
//! yeni satırları \n olarak kaçırır) — framing bozulmaz.
|
|
7
|
+
//!
|
|
8
|
+
//! Hata kodları yalnızca TŞ §10.1 + K-008 kümesinden: INVALID_ARGUMENT,
|
|
9
|
+
//! INTERNAL_ERROR, LIMIT_EXCEEDED. Worker kendi hata kodu icat etmez.
|
|
10
|
+
//! İstek düzeyi sorunlar tüm isteği reddeder; döngü DEVAM EDER.
|
|
11
|
+
|
|
12
|
+
use std::collections::BTreeSet;
|
|
13
|
+
use std::io::BufRead;
|
|
14
|
+
|
|
15
|
+
use serde_json::{json, Value};
|
|
16
|
+
|
|
17
|
+
use crate::analyzer::{self, FileEntry};
|
|
18
|
+
|
|
19
|
+
pub const PROTOCOL_VERSION: &str = "1";
|
|
20
|
+
pub const ANALYZER_ID: &str = "rust-worker";
|
|
21
|
+
pub const ANALYZER_VERSION: &str = "0.1.0";
|
|
22
|
+
/// TŞ §7 route katmanı beyanı — capabilities.routeDetection alanına yazılır.
|
|
23
|
+
pub const ROUTE_DETECTION: &str = "rust-attribute-macro-route-pattern";
|
|
24
|
+
|
|
25
|
+
/// Kaynak sınırları (TŞ §9 resource budget; K-010: yalnızca boyut limitleri).
|
|
26
|
+
pub const MAX_REQUEST_LINE_BYTES: usize = 64_000_000;
|
|
27
|
+
pub const MAX_FILE_COUNT: usize = 5_000;
|
|
28
|
+
pub const MAX_FILE_CONTENT_BYTES: usize = 2_000_000;
|
|
29
|
+
/// Yanıt node bütçesi (go worker MaxResponseNodes karşılığı; istek
|
|
30
|
+
/// `maxNodes` ile altına çekilebilir — 1..MAX_RESPONSE_NODES, dışı
|
|
31
|
+
/// INVALID_ARGUMENT). Aşan node'lar YAYINLANMAZ; uçları yayınlanmayan
|
|
32
|
+
/// kenarlar da düşer (dangling yok); RESPONSE_TRUNCATED tanısı yazılır.
|
|
33
|
+
pub const MAX_RESPONSE_NODES: usize = 250_000;
|
|
34
|
+
|
|
35
|
+
pub struct ProtocolError {
|
|
36
|
+
pub code: &'static str,
|
|
37
|
+
pub message: String,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fn invalid(message: String) -> ProtocolError {
|
|
41
|
+
ProtocolError {
|
|
42
|
+
code: "INVALID_ARGUMENT",
|
|
43
|
+
message,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fn limit_exceeded(message: String) -> ProtocolError {
|
|
48
|
+
ProtocolError {
|
|
49
|
+
code: "LIMIT_EXCEEDED",
|
|
50
|
+
message,
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Hata yanıtı üretir; id verilen değerle echo edilir (null olabilir).
|
|
55
|
+
pub fn error_response(id: Value, code: &str, message: &str) -> Value {
|
|
56
|
+
json!({
|
|
57
|
+
"id": id,
|
|
58
|
+
"protocolVersion": PROTOCOL_VERSION,
|
|
59
|
+
"status": "error",
|
|
60
|
+
"error": { "code": code, "message": message },
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// Bozuk satırlarda bile echo yapılabilecek 'id' alanını kurtarır.
|
|
65
|
+
pub fn extract_id(line: &str) -> Value {
|
|
66
|
+
serde_json::from_str::<Value>(line)
|
|
67
|
+
.ok()
|
|
68
|
+
.and_then(|value| value.get("id").cloned())
|
|
69
|
+
.unwrap_or(Value::Null)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// Tek satır isteği işler; her sonuç TAM BİR yanıt Value'sudur.
|
|
73
|
+
pub fn handle_line(line: &str) -> Value {
|
|
74
|
+
match process_request(line) {
|
|
75
|
+
Ok(response) => response,
|
|
76
|
+
Err(err) => error_response(extract_id(line), err.code, &err.message),
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// Boyut sınırlı satır okuyucu (roslyn LimitedLineReader karşılığı):
|
|
81
|
+
/// satır sınırı aşılırsa satır DISCARD edilir ve exceeded=true döner;
|
|
82
|
+
/// '\r' atlanır (CRLF tolere; JSON string içindeki CR zaten \r kaçışlıdır).
|
|
83
|
+
/// EOF'ta newline'sız kalıntı son satır olarak döner.
|
|
84
|
+
pub fn read_line_limited(
|
|
85
|
+
reader: &mut impl BufRead,
|
|
86
|
+
max_bytes: usize,
|
|
87
|
+
) -> std::io::Result<Option<(String, bool)>> {
|
|
88
|
+
let mut buf: Vec<u8> = Vec::new();
|
|
89
|
+
let mut discarding = false;
|
|
90
|
+
loop {
|
|
91
|
+
let available = reader.fill_buf()?;
|
|
92
|
+
if available.is_empty() {
|
|
93
|
+
if discarding {
|
|
94
|
+
return Ok(Some((String::new(), true)));
|
|
95
|
+
}
|
|
96
|
+
if buf.is_empty() {
|
|
97
|
+
return Ok(None);
|
|
98
|
+
}
|
|
99
|
+
return Ok(Some((String::from_utf8_lossy(&buf).into_owned(), false)));
|
|
100
|
+
}
|
|
101
|
+
let mut consumed = 0usize;
|
|
102
|
+
let mut hit_newline = false;
|
|
103
|
+
for &byte in available {
|
|
104
|
+
consumed += 1;
|
|
105
|
+
if byte == b'\n' {
|
|
106
|
+
hit_newline = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
if byte == b'\r' {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if !discarding {
|
|
113
|
+
buf.push(byte);
|
|
114
|
+
if buf.len() > max_bytes {
|
|
115
|
+
discarding = true;
|
|
116
|
+
buf.clear();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
reader.consume(consumed);
|
|
121
|
+
if hit_newline {
|
|
122
|
+
if discarding {
|
|
123
|
+
return Ok(Some((String::new(), true)));
|
|
124
|
+
}
|
|
125
|
+
return Ok(Some((String::from_utf8_lossy(&buf).into_owned(), false)));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
fn validate_path(path: &str) -> Result<(), ProtocolError> {
|
|
131
|
+
if path.starts_with('/')
|
|
132
|
+
|| (path.len() >= 2
|
|
133
|
+
&& path.as_bytes()[1] == b':'
|
|
134
|
+
&& path.as_bytes()[0].is_ascii_alphabetic())
|
|
135
|
+
{
|
|
136
|
+
return Err(invalid(format!(
|
|
137
|
+
"Mutlak kaynak yolu kabul edilmez: {path}"
|
|
138
|
+
)));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
for segment in path.split('/') {
|
|
142
|
+
if segment.is_empty() || segment == "." {
|
|
143
|
+
return Err(invalid(format!(
|
|
144
|
+
"Kaynak yolu boş/geçersiz segment içeriyor: {path}"
|
|
145
|
+
)));
|
|
146
|
+
}
|
|
147
|
+
if segment == ".." {
|
|
148
|
+
return Err(invalid(format!(
|
|
149
|
+
"Kaynak yolu kök dışına çıkıyor: {path}"
|
|
150
|
+
)));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Ok(())
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
fn process_request(line: &str) -> Result<Value, ProtocolError> {
|
|
158
|
+
let value: Value = serde_json::from_str(line)
|
|
159
|
+
.map_err(|e| invalid(format!("istek JSON'u ayrıştırılamadı: {e}")))?;
|
|
160
|
+
let obj = value
|
|
161
|
+
.as_object()
|
|
162
|
+
.ok_or_else(|| invalid("istek JSON'u bir nesne olmalı".to_string()))?;
|
|
163
|
+
|
|
164
|
+
let id = obj
|
|
165
|
+
.get("id")
|
|
166
|
+
.ok_or_else(|| invalid("id zorunludur".to_string()))?;
|
|
167
|
+
if !id.is_string() && !id.is_number() {
|
|
168
|
+
return Err(invalid("id string ya da sayı olmalıdır".to_string()));
|
|
169
|
+
}
|
|
170
|
+
let id = id.clone();
|
|
171
|
+
|
|
172
|
+
// Kesin şema reddi (Zod strictObject disipliniyle aynı).
|
|
173
|
+
for key in obj.keys() {
|
|
174
|
+
if !matches!(
|
|
175
|
+
key.as_str(),
|
|
176
|
+
"id" | "type" | "protocolVersion" | "files" | "maxNodes"
|
|
177
|
+
) {
|
|
178
|
+
return Err(invalid(format!("bilinmeyen üst-düzey alan: '{key}'")));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
let typ = obj
|
|
183
|
+
.get("type")
|
|
184
|
+
.and_then(Value::as_str)
|
|
185
|
+
.ok_or_else(|| invalid("type zorunludur".to_string()))?;
|
|
186
|
+
if typ != "analyze" {
|
|
187
|
+
return Err(invalid(format!(
|
|
188
|
+
"bilinmeyen istek türü: '{typ}' (desteklenen: 'analyze')"
|
|
189
|
+
)));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if let Some(pv) = obj.get("protocolVersion") {
|
|
193
|
+
if pv.as_str() != Some(PROTOCOL_VERSION) {
|
|
194
|
+
return Err(invalid(format!(
|
|
195
|
+
"desteklenmeyen protocolVersion: {pv} (desteklenen: '{PROTOCOL_VERSION}')"
|
|
196
|
+
)));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Yanıt node bütçesi (go worker main.go doğrulama deseni): tam sayı
|
|
201
|
+
// (bool DEĞİL — JSON true/false sayı değildir) ve 1..MAX_RESPONSE_NODES
|
|
202
|
+
// aralığında olmalıdır. Verilmezse analyzer MaxResponseNodes uygular.
|
|
203
|
+
let max_nodes = match obj.get("maxNodes") {
|
|
204
|
+
Some(value) => {
|
|
205
|
+
if value.is_boolean() || !(value.is_i64() || value.is_u64()) {
|
|
206
|
+
return Err(invalid("maxNodes tam sayı olmalıdır".to_string()));
|
|
207
|
+
}
|
|
208
|
+
let raw = value
|
|
209
|
+
.as_i64()
|
|
210
|
+
.ok_or_else(|| invalid("maxNodes tam sayı olmalıdır".to_string()))?;
|
|
211
|
+
if raw < 1 || raw > MAX_RESPONSE_NODES as i64 {
|
|
212
|
+
return Err(invalid(format!(
|
|
213
|
+
"maxNodes 1..{MAX_RESPONSE_NODES} aralığında olmalıdır: {raw}"
|
|
214
|
+
)));
|
|
215
|
+
}
|
|
216
|
+
Some(raw as usize)
|
|
217
|
+
}
|
|
218
|
+
None => None,
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
let files = obj
|
|
222
|
+
.get("files")
|
|
223
|
+
.ok_or_else(|| invalid("files zorunludur".to_string()))?;
|
|
224
|
+
let arr = files
|
|
225
|
+
.as_array()
|
|
226
|
+
.ok_or_else(|| invalid("files bir dizi olmalıdır".to_string()))?;
|
|
227
|
+
if arr.is_empty() {
|
|
228
|
+
return Err(invalid("files en az 1 dosya içermelidir".to_string()));
|
|
229
|
+
}
|
|
230
|
+
if arr.len() > MAX_FILE_COUNT {
|
|
231
|
+
return Err(limit_exceeded(format!(
|
|
232
|
+
"dosya sayısı sınırı aşıldı: {} > {}",
|
|
233
|
+
arr.len(),
|
|
234
|
+
MAX_FILE_COUNT
|
|
235
|
+
)));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
let mut seen: BTreeSet<String> = BTreeSet::new();
|
|
239
|
+
let mut entries: Vec<FileEntry> = Vec::with_capacity(arr.len());
|
|
240
|
+
for file in arr {
|
|
241
|
+
let fobj = file
|
|
242
|
+
.as_object()
|
|
243
|
+
.ok_or_else(|| invalid("files[] girdisi nesne olmalıdır".to_string()))?;
|
|
244
|
+
for key in fobj.keys() {
|
|
245
|
+
if !matches!(key.as_str(), "path" | "content") {
|
|
246
|
+
return Err(invalid(format!("files[] bilinmeyen alan: '{key}'")));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
let path = fobj
|
|
250
|
+
.get("path")
|
|
251
|
+
.and_then(Value::as_str)
|
|
252
|
+
.ok_or_else(|| invalid("files[].path string olmalıdır".to_string()))?;
|
|
253
|
+
let content = fobj
|
|
254
|
+
.get("content")
|
|
255
|
+
.and_then(Value::as_str)
|
|
256
|
+
.ok_or_else(|| invalid("files[].content string olmalıdır".to_string()))?;
|
|
257
|
+
|
|
258
|
+
validate_path(path)?;
|
|
259
|
+
if !seen.insert(path.to_string()) {
|
|
260
|
+
return Err(invalid(format!(
|
|
261
|
+
"aynı kaynak yolu iki kez verildi: {path}"
|
|
262
|
+
)));
|
|
263
|
+
}
|
|
264
|
+
if content.len() > MAX_FILE_CONTENT_BYTES {
|
|
265
|
+
return Err(limit_exceeded(format!(
|
|
266
|
+
"dosya içerik sınırı aşıldı: {} bayt > {} bayt ({})",
|
|
267
|
+
content.len(),
|
|
268
|
+
MAX_FILE_CONTENT_BYTES,
|
|
269
|
+
path
|
|
270
|
+
)));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
entries.push(FileEntry {
|
|
274
|
+
path: path.to_string(),
|
|
275
|
+
content: content.to_string(),
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Determinizm (TŞ §8 invariant iv/vi): kaynaklar relativePath'e göre
|
|
280
|
+
// sıralanır; analiz çıktısı kanonik anahtarla sıralanır.
|
|
281
|
+
entries.sort_by(|a, b| a.path.cmp(&b.path));
|
|
282
|
+
|
|
283
|
+
Ok(analyzer::analyze(&id, &entries, max_nodes.unwrap_or(0)))
|
|
284
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//! Bağımlılıksız SHA-256 (FIPS 180-4) — M1-Rust.
|
|
2
|
+
//!
|
|
3
|
+
//! Evidence.span.sourceHash, istek dosya içeriğinin UTF-8 SHA-256 özetidir
|
|
4
|
+
//! (TŞ §8). M1 diliminin bağımlılık sözleşmesi yalnızca syn 2 + serde_json
|
|
5
|
+
//! izin verdiğinden sha2 vb. crates.io paketi eklenmez; burada saf Rust
|
|
6
|
+
//! uygulanır. Doğrulama: tests/rust-worker.test.ts ve adapters/rust testi,
|
|
7
|
+
//! worker'ın ürettiği sourceHash'i Node `crypto.createHash("sha256")`
|
|
8
|
+
//! özetiyle birebir karşılaştırır (aynı test kümesi bozuk implementasyonu
|
|
9
|
+
//! FAIL ile yakalar — sessiz yanlış özet imkânsızdır).
|
|
10
|
+
|
|
11
|
+
const K: [u32; 64] = [
|
|
12
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
13
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
14
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
15
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
16
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
17
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
18
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
19
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
pub struct Sha256 {
|
|
23
|
+
state: [u32; 8],
|
|
24
|
+
buf: [u8; 64],
|
|
25
|
+
buf_len: usize,
|
|
26
|
+
total_len: u64,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
impl Sha256 {
|
|
30
|
+
pub fn new() -> Self {
|
|
31
|
+
Sha256 {
|
|
32
|
+
state: [
|
|
33
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
|
34
|
+
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
35
|
+
],
|
|
36
|
+
buf: [0u8; 64],
|
|
37
|
+
buf_len: 0,
|
|
38
|
+
total_len: 0,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn update(&mut self, mut data: &[u8]) {
|
|
43
|
+
self.total_len = self.total_len.wrapping_add(data.len() as u64);
|
|
44
|
+
if self.buf_len > 0 {
|
|
45
|
+
let need = 64 - self.buf_len;
|
|
46
|
+
let take = need.min(data.len());
|
|
47
|
+
self.buf[self.buf_len..self.buf_len + take].copy_from_slice(&data[..take]);
|
|
48
|
+
self.buf_len += take;
|
|
49
|
+
data = &data[take..];
|
|
50
|
+
if self.buf_len == 64 {
|
|
51
|
+
let block = self.buf;
|
|
52
|
+
self.compress(&block);
|
|
53
|
+
self.buf_len = 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
while data.len() >= 64 {
|
|
57
|
+
let mut block = [0u8; 64];
|
|
58
|
+
block.copy_from_slice(&data[..64]);
|
|
59
|
+
self.compress(&block);
|
|
60
|
+
data = &data[64..];
|
|
61
|
+
}
|
|
62
|
+
if !data.is_empty() {
|
|
63
|
+
self.buf[..data.len()].copy_from_slice(data);
|
|
64
|
+
self.buf_len = data.len();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pub fn finalize(mut self) -> [u8; 32] {
|
|
69
|
+
let bit_len = self.total_len.wrapping_mul(8);
|
|
70
|
+
self.update(&[0x80]);
|
|
71
|
+
while self.buf_len != 56 {
|
|
72
|
+
self.update(&[0x00]);
|
|
73
|
+
}
|
|
74
|
+
self.update(&bit_len.to_be_bytes());
|
|
75
|
+
let mut out = [0u8; 32];
|
|
76
|
+
for (i, word) in self.state.iter().enumerate() {
|
|
77
|
+
out[i * 4..i * 4 + 4].copy_from_slice(&word.to_be_bytes());
|
|
78
|
+
}
|
|
79
|
+
out
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fn compress(&mut self, block: &[u8; 64]) {
|
|
83
|
+
let mut w = [0u32; 64];
|
|
84
|
+
for i in 0..16 {
|
|
85
|
+
w[i] = u32::from_be_bytes([
|
|
86
|
+
block[i * 4],
|
|
87
|
+
block[i * 4 + 1],
|
|
88
|
+
block[i * 4 + 2],
|
|
89
|
+
block[i * 4 + 3],
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
for i in 16..64 {
|
|
93
|
+
let s0 = w[i - 15].rotate_right(7) ^ w[i - 15].rotate_right(18) ^ (w[i - 15] >> 3);
|
|
94
|
+
let s1 = w[i - 2].rotate_right(17) ^ w[i - 2].rotate_right(19) ^ (w[i - 2] >> 10);
|
|
95
|
+
w[i] = w[i - 16]
|
|
96
|
+
.wrapping_add(s0)
|
|
97
|
+
.wrapping_add(w[i - 7])
|
|
98
|
+
.wrapping_add(s1);
|
|
99
|
+
}
|
|
100
|
+
let mut h = self.state;
|
|
101
|
+
for i in 0..64 {
|
|
102
|
+
let s1 = h[4].rotate_right(6) ^ h[4].rotate_right(11) ^ h[4].rotate_right(25);
|
|
103
|
+
let ch = (h[4] & h[5]) ^ ((!h[4]) & h[6]);
|
|
104
|
+
let temp1 = h[7]
|
|
105
|
+
.wrapping_add(s1)
|
|
106
|
+
.wrapping_add(ch)
|
|
107
|
+
.wrapping_add(K[i])
|
|
108
|
+
.wrapping_add(w[i]);
|
|
109
|
+
let s0 = h[0].rotate_right(2) ^ h[0].rotate_right(13) ^ h[0].rotate_right(22);
|
|
110
|
+
let maj = (h[0] & h[1]) ^ (h[0] & h[2]) ^ (h[1] & h[2]);
|
|
111
|
+
let temp2 = s0.wrapping_add(maj);
|
|
112
|
+
h[7] = h[6];
|
|
113
|
+
h[6] = h[5];
|
|
114
|
+
h[5] = h[4];
|
|
115
|
+
h[4] = h[3].wrapping_add(temp1);
|
|
116
|
+
h[3] = h[2];
|
|
117
|
+
h[2] = h[1];
|
|
118
|
+
h[1] = h[0];
|
|
119
|
+
h[0] = temp1.wrapping_add(temp2);
|
|
120
|
+
}
|
|
121
|
+
for i in 0..8 {
|
|
122
|
+
self.state[i] = self.state[i].wrapping_add(h[i]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
pub fn sha256_hex(data: &[u8]) -> String {
|
|
128
|
+
let mut hasher = Sha256::new();
|
|
129
|
+
hasher.update(data);
|
|
130
|
+
let digest = hasher.finalize();
|
|
131
|
+
let mut s = String::with_capacity(64);
|
|
132
|
+
for byte in digest {
|
|
133
|
+
s.push_str(&format!("{byte:02x}"));
|
|
134
|
+
}
|
|
135
|
+
s
|
|
136
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "causoryn",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"mcpName": "io.github.mrbekox/causoryn",
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"description": "Deterministic, local, LLM-free codebase and change intelligence MCP server and plugin for Antigravity, Claude Code, Codex, and ZCode (GLM).",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "Causoryn Contributors",
|
|
14
|
+
"url": "https://github.com/MrBekoX/Causoryn"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/MrBekoX/Causoryn#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/MrBekoX/Causoryn.git",
|
|
20
|
+
"directory": "packages/causoryn"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/MrBekoX/Causoryn/issues"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mcp",
|
|
27
|
+
"model-context-protocol",
|
|
28
|
+
"code-analysis",
|
|
29
|
+
"static-analysis",
|
|
30
|
+
"architecture-map",
|
|
31
|
+
"preflight",
|
|
32
|
+
"antigravity",
|
|
33
|
+
"claude-code",
|
|
34
|
+
"codex",
|
|
35
|
+
"zcode",
|
|
36
|
+
"glm"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=24"
|
|
40
|
+
},
|
|
41
|
+
"bin": {
|
|
42
|
+
"causoryn": "scripts/causoryn.mjs"
|
|
43
|
+
},
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
47
|
+
"default": "./dist/index.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist/**",
|
|
52
|
+
"!dist/**/*.map",
|
|
53
|
+
"scripts/causoryn.mjs",
|
|
54
|
+
"scripts/plugin-mcp-launcher.mjs",
|
|
55
|
+
"scripts/lib/**",
|
|
56
|
+
"native/**",
|
|
57
|
+
"skills/**",
|
|
58
|
+
".claude-plugin/**",
|
|
59
|
+
".zcode-plugin/**",
|
|
60
|
+
".codex-plugin/**",
|
|
61
|
+
"plugin.json",
|
|
62
|
+
"mcp_config.json",
|
|
63
|
+
"README.md",
|
|
64
|
+
"LICENSE",
|
|
65
|
+
"THIRD-PARTY-NOTICES.md",
|
|
66
|
+
"licenses/**"
|
|
67
|
+
],
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build:package": "node scripts/build-package.mjs",
|
|
70
|
+
"prepack": "node scripts/verify-package-ready.mjs"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {}
|
|
73
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "causoryn",
|
|
3
|
+
"displayName": "Causoryn",
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"description": "Local, evidence-backed codebase and change intelligence via MCP.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Causoryn Contributors",
|
|
8
|
+
"url": "https://github.com/MrBekoX/Causoryn"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/MrBekoX/Causoryn#readme",
|
|
11
|
+
"repository": "https://github.com/MrBekoX/Causoryn",
|
|
12
|
+
"suggestedPrompts": [
|
|
13
|
+
"Map this workspace and show evidence for critical dependencies",
|
|
14
|
+
"Run a change preflight for the selected endpoint",
|
|
15
|
+
"Verify my working-tree changes against architecture contracts"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `causoryn` CLI giriş noktası (`mcp`, `setup`, `doctor`, `--version`, `--help`).
|
|
4
|
+
*
|
|
5
|
+
* Kırmızı çizgi: `mcp` alt komutunda `stdout` YALNIZCA MCP JSON-RPC protokolüne
|
|
6
|
+
* aittir; hiçbir başlık/log `stdout`'a yazılmaz, doğrudan `dist/mcp-server.mjs`
|
|
7
|
+
* modülüne saf devir yapılır.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
12
|
+
|
|
13
|
+
import { assertSupportedNodeVersion } from "./lib/node-version-guard.mjs";
|
|
14
|
+
|
|
15
|
+
assertSupportedNodeVersion();
|
|
16
|
+
|
|
17
|
+
const PKG_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
18
|
+
const rawArgs = process.argv.slice(2);
|
|
19
|
+
|
|
20
|
+
if (rawArgs[0] === "mcp") {
|
|
21
|
+
const mcpBundlePath = path.join(PKG_ROOT, "dist", "mcp-server.mjs");
|
|
22
|
+
if (!existsSync(mcpBundlePath)) {
|
|
23
|
+
console.error(
|
|
24
|
+
`[causoryn] derlenmiş MCP sunucu paketi bulunamadı: ${mcpBundlePath} (önce build:package çalıştırın)`,
|
|
25
|
+
);
|
|
26
|
+
process.exit(2);
|
|
27
|
+
}
|
|
28
|
+
process.env["CAUSORYN_ASSET_ROOT"] ??= PKG_ROOT;
|
|
29
|
+
process.argv = [process.argv[0] ?? process.execPath, mcpBundlePath, ...rawArgs];
|
|
30
|
+
await import(pathToFileURL(mcpBundlePath).href);
|
|
31
|
+
} else {
|
|
32
|
+
const cliModulePath = path.join(PKG_ROOT, "dist", "index.js");
|
|
33
|
+
if (!existsSync(cliModulePath)) {
|
|
34
|
+
console.error(`[causoryn] CLI modülü derlenmemiş: ${cliModulePath}`);
|
|
35
|
+
process.exit(2);
|
|
36
|
+
}
|
|
37
|
+
const { runCli } = await import(pathToFileURL(cliModulePath).href);
|
|
38
|
+
const exitCode = await runCli(rawArgs);
|
|
39
|
+
process.exitCode = exitCode;
|
|
40
|
+
}
|