ark-runtime-kernel 1.2.0 → 1.4.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/README.md +132 -8
- package/bin/ark-check.mjs +355 -48
- package/bin/ark-mcp.mjs +147 -3
- package/bin/ark-shared.mjs +53 -1
- package/dist/eslint/index.cjs +49 -1
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.d.cts +4 -1
- package/dist/eslint/index.d.ts +4 -1
- package/dist/eslint/index.js +49 -2
- package/dist/eslint/index.js.map +1 -1
- package/dist/index.cjs +50 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +50 -2
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.cjs +1 -1
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.js +1 -1
- package/dist/nestjs/index.js.map +1 -1
- package/docs/agent-guide.md +9 -0
- package/docs/ai-gates.md +76 -0
- package/package.json +8 -2
- package/server.json +7 -7
- package/docs/blog/how-i-stopped-claude-from-breaking-my-architecture.md +0 -85
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/version.ts
|
|
4
|
-
var version = "1.
|
|
4
|
+
var version = "1.4.0";
|
|
5
5
|
|
|
6
6
|
// src/kernel/intent/IntentRegistry.ts
|
|
7
7
|
var IntentRegistry = class {
|
|
@@ -1833,12 +1833,13 @@ var defaultElevenLayerDirectories = {
|
|
|
1833
1833
|
function createElevenLayerArkConfig(options = {}) {
|
|
1834
1834
|
const rootDir = options.rootDir ?? "src";
|
|
1835
1835
|
const optional = options.optionalLayers ?? true;
|
|
1836
|
+
const prefix = rootDir === "." ? "" : `${rootDir}/`;
|
|
1836
1837
|
return {
|
|
1837
1838
|
include: options.include ?? [rootDir],
|
|
1838
1839
|
layers: elevenLayerProfile.layers.map((layer) => ({
|
|
1839
1840
|
name: layer.name,
|
|
1840
1841
|
patterns: (defaultElevenLayerDirectories[layer.name] ?? [layer.name]).map(
|
|
1841
|
-
(directory) => `${
|
|
1842
|
+
(directory) => `${prefix}${directory}/**`
|
|
1842
1843
|
),
|
|
1843
1844
|
intentPrefixes: layer.prefixes,
|
|
1844
1845
|
optional
|
|
@@ -2100,6 +2101,33 @@ function tsPublishSourceLiteral(ts, node) {
|
|
|
2100
2101
|
const rawMetadata = tsObjectPropertyValue(ts, firstArg, "metadata");
|
|
2101
2102
|
return tsStringLiteralText(ts, tsObjectPropertyValue(ts, rawMetadata, "source")) ?? tsStringLiteralText(ts, tsObjectPropertyValue(ts, secondArg, "source")) ?? tsStringLiteralText(ts, tsObjectPropertyValue(ts, thirdArg, "source"));
|
|
2102
2103
|
}
|
|
2104
|
+
function analyzeForbiddenGlobals(ts, source, filePath, layer, forbidden) {
|
|
2105
|
+
const entries = new Set(forbidden);
|
|
2106
|
+
if (entries.size === 0) return [];
|
|
2107
|
+
const sourceFile = ts.createSourceFile("generated.ts", source, ts.ScriptTarget.Latest, true);
|
|
2108
|
+
const violations = [];
|
|
2109
|
+
const flag = (name, node) => violations.push(
|
|
2110
|
+
violation("FORBIDDEN_GLOBAL", `${layer} must not use the ambient global "${name}".`, {
|
|
2111
|
+
line: sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1,
|
|
2112
|
+
filePath,
|
|
2113
|
+
target: name,
|
|
2114
|
+
fromLayer: layer,
|
|
2115
|
+
suggestion: "Inject the capability through a port (e.g. a Clock, IdGenerator, or HttpPort) instead of reaching for the ambient global."
|
|
2116
|
+
})
|
|
2117
|
+
);
|
|
2118
|
+
const visit = (node) => {
|
|
2119
|
+
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression)) {
|
|
2120
|
+
const dotted = `${node.expression.text}.${node.name.text}`;
|
|
2121
|
+
if (entries.has(dotted)) flag(dotted, node);
|
|
2122
|
+
else if (entries.has(node.expression.text)) flag(node.expression.text, node);
|
|
2123
|
+
} else if ((ts.isCallExpression(node) || ts.isNewExpression(node)) && node.expression && ts.isIdentifier(node.expression) && entries.has(node.expression.text)) {
|
|
2124
|
+
flag(node.expression.text, node);
|
|
2125
|
+
}
|
|
2126
|
+
ts.forEachChild(node, visit);
|
|
2127
|
+
};
|
|
2128
|
+
visit(sourceFile);
|
|
2129
|
+
return violations;
|
|
2130
|
+
}
|
|
2103
2131
|
function analyzePublishAst(ts, source, context, profile) {
|
|
2104
2132
|
const sourceFile = ts.createSourceFile(
|
|
2105
2133
|
"generated.ts",
|
|
@@ -2298,6 +2326,26 @@ function createAICodeGate(options = {}) {
|
|
|
2298
2326
|
}
|
|
2299
2327
|
}
|
|
2300
2328
|
}
|
|
2329
|
+
if (options.typescript && contextLayer && options.forbiddenGlobals?.[contextLayer]?.length) {
|
|
2330
|
+
try {
|
|
2331
|
+
violations.push(
|
|
2332
|
+
...analyzeForbiddenGlobals(
|
|
2333
|
+
options.typescript,
|
|
2334
|
+
source,
|
|
2335
|
+
filePath,
|
|
2336
|
+
contextLayer,
|
|
2337
|
+
options.forbiddenGlobals[contextLayer]
|
|
2338
|
+
)
|
|
2339
|
+
);
|
|
2340
|
+
} catch (err) {
|
|
2341
|
+
violations.push(
|
|
2342
|
+
violation(
|
|
2343
|
+
"AST_ANALYZER_ERROR",
|
|
2344
|
+
`TypeScript AST analyzer failed: ${err instanceof Error ? err.message : String(err)}`
|
|
2345
|
+
)
|
|
2346
|
+
);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2301
2349
|
if (options.typescript) {
|
|
2302
2350
|
try {
|
|
2303
2351
|
violations.push(
|