midnight-mcp 0.1.15 → 0.1.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.
|
@@ -157,11 +157,24 @@ export declare function compareSyntax(input: CompareSyntaxInput): Promise<{
|
|
|
157
157
|
* This is the source of truth for writing valid, compilable contracts
|
|
158
158
|
*/
|
|
159
159
|
export declare function getLatestSyntax(input: GetLatestSyntaxInput): Promise<{
|
|
160
|
+
repository: string;
|
|
161
|
+
version: string;
|
|
162
|
+
syntaxReference: string;
|
|
163
|
+
sections: string[];
|
|
164
|
+
pitfalls: string[];
|
|
165
|
+
note: string;
|
|
166
|
+
warning?: undefined;
|
|
167
|
+
syntaxFiles?: undefined;
|
|
168
|
+
examplePaths?: undefined;
|
|
169
|
+
} | {
|
|
160
170
|
repository: string;
|
|
161
171
|
version: string;
|
|
162
172
|
warning: string;
|
|
163
173
|
syntaxFiles: never[];
|
|
164
174
|
examplePaths: string[];
|
|
175
|
+
syntaxReference?: undefined;
|
|
176
|
+
sections?: undefined;
|
|
177
|
+
pitfalls?: undefined;
|
|
165
178
|
note?: undefined;
|
|
166
179
|
} | {
|
|
167
180
|
repository: string;
|
|
@@ -171,6 +184,9 @@ export declare function getLatestSyntax(input: GetLatestSyntaxInput): Promise<{
|
|
|
171
184
|
content: string;
|
|
172
185
|
}[];
|
|
173
186
|
note: string;
|
|
187
|
+
syntaxReference?: undefined;
|
|
188
|
+
sections?: undefined;
|
|
189
|
+
pitfalls?: undefined;
|
|
174
190
|
warning?: undefined;
|
|
175
191
|
examplePaths?: undefined;
|
|
176
192
|
}>;
|
|
@@ -6,6 +6,7 @@ import { githubClient } from "../../pipeline/index.js";
|
|
|
6
6
|
import { releaseTracker } from "../../pipeline/releases.js";
|
|
7
7
|
import { logger, DEFAULT_REPOSITORIES, SelfCorrectionHints, } from "../../utils/index.js";
|
|
8
8
|
import { REPO_ALIASES, EXAMPLES } from "./constants.js";
|
|
9
|
+
import { EMBEDDED_DOCS } from "../../resources/content/docs-content.js";
|
|
9
10
|
/**
|
|
10
11
|
* Resolve repository name alias to owner/repo
|
|
11
12
|
*/
|
|
@@ -301,6 +302,36 @@ export async function getLatestSyntax(input) {
|
|
|
301
302
|
// Ensure repo defaults to compact if undefined/empty
|
|
302
303
|
const repoName = input?.repo || "compact";
|
|
303
304
|
logger.debug("Getting latest syntax reference", { repo: repoName });
|
|
305
|
+
// For Compact language, always return our curated reference first
|
|
306
|
+
// This is more reliable than fetching from GitHub and includes pitfalls/patterns
|
|
307
|
+
if (repoName === "compact" || repoName === "midnight-compact") {
|
|
308
|
+
const compactReference = EMBEDDED_DOCS["midnight://docs/compact-reference"];
|
|
309
|
+
if (compactReference) {
|
|
310
|
+
return {
|
|
311
|
+
repository: "midnightntwrk/compact",
|
|
312
|
+
version: "0.16+ (current)",
|
|
313
|
+
syntaxReference: compactReference,
|
|
314
|
+
sections: [
|
|
315
|
+
"Basic Structure",
|
|
316
|
+
"Data Types",
|
|
317
|
+
"Circuits",
|
|
318
|
+
"Witnesses",
|
|
319
|
+
"State Management",
|
|
320
|
+
"Common Patterns",
|
|
321
|
+
"Disclosure in Conditionals (IMPORTANT)",
|
|
322
|
+
"Common Pitfalls & Solutions",
|
|
323
|
+
],
|
|
324
|
+
pitfalls: [
|
|
325
|
+
"Cell<T> wrapper deprecated in 0.15+ - use direct type",
|
|
326
|
+
'Cannot assign string literals to Opaque<"string"> - use enum or parameters',
|
|
327
|
+
"Must disclose() comparisons used in if/else conditions",
|
|
328
|
+
"Counter uses .increment()/.value(), Field uses direct assignment",
|
|
329
|
+
"Boolean returns from witnesses need disclose()",
|
|
330
|
+
],
|
|
331
|
+
note: "This is the curated syntax reference for Compact 0.16+. Includes common pitfalls and correct patterns.",
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
304
335
|
const resolved = resolveRepo(repoName);
|
|
305
336
|
if (!resolved) {
|
|
306
337
|
throw new Error(`Unknown repository: ${repoName}. Available: ${Object.keys(REPO_ALIASES).join(", ")}`);
|