arkgate 2.8.2 → 2.9.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +75 -2
  2. package/README.md +6 -2
  3. package/bin/ark-check.mjs +10 -2
  4. package/bin/ark-layer-match.mjs +88 -5
  5. package/bin/ark-mcp.mjs +7 -70
  6. package/bin/ark-shared.mjs +89 -9
  7. package/bin/ark.mjs +8 -2
  8. package/bin/lib/agent-gates.mjs +104 -20
  9. package/bin/lib/architecture-scan.mjs +16 -4
  10. package/bin/lib/config-warnings.mjs +12 -3
  11. package/bin/lib/core-ratchet.mjs +152 -0
  12. package/bin/lib/doctor-plan.mjs +20 -0
  13. package/bin/lib/import-resolve.mjs +133 -0
  14. package/bin/lib/presets.mjs +207 -11
  15. package/bin/lib/remediation.mjs +15 -0
  16. package/bin/lib/suggestions.mjs +8 -3
  17. package/dist/eslint/index.cjs +63 -5
  18. package/dist/eslint/index.cjs.map +1 -1
  19. package/dist/eslint/index.d.cts +33 -1
  20. package/dist/eslint/index.d.ts +33 -1
  21. package/dist/eslint/index.js +63 -5
  22. package/dist/eslint/index.js.map +1 -1
  23. package/dist/index.cjs +103 -14
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +21 -9
  26. package/dist/index.d.ts +21 -9
  27. package/dist/index.js +103 -14
  28. package/dist/index.js.map +1 -1
  29. package/dist/nestjs/index.cjs +78 -4
  30. package/dist/nestjs/index.cjs.map +1 -1
  31. package/dist/nestjs/index.d.cts +1 -1
  32. package/dist/nestjs/index.d.ts +1 -1
  33. package/dist/nestjs/index.js +78 -4
  34. package/dist/nestjs/index.js.map +1 -1
  35. package/dist/runtime/index.cjs +103 -14
  36. package/dist/runtime/index.cjs.map +1 -1
  37. package/dist/runtime/index.d.cts +1 -1
  38. package/dist/runtime/index.d.ts +1 -1
  39. package/dist/runtime/index.js +103 -14
  40. package/dist/runtime/index.js.map +1 -1
  41. package/dist/{types-CSJhEOk2.d.cts → types-D6Q8WHes.d.cts} +7 -0
  42. package/dist/{types-CSJhEOk2.d.ts → types-D6Q8WHes.d.ts} +7 -0
  43. package/docs/agent-guide.md +55 -4
  44. package/docs/brownfield-adoption.md +1 -1
  45. package/docs/package-surface.md +3 -0
  46. package/package.json +4 -2
  47. package/server.json +2 -2
  48. package/templates/architecture-playbook.json +65 -1
  49. package/templates/policy-packs/enthusiast-ddd-bounded-contexts.json +19 -0
  50. package/templates/policy-packs/enthusiast-ui-surface.json +18 -0
  51. package/templates/policy-packs/enthusiast-vertical-slice.json +18 -0
  52. package/templates/skills/ark-adopt.md +4 -0
  53. package/templates/skills/ark-architect.md +5 -1
  54. package/templates/skills/ark-autopilot.md +6 -1
  55. package/templates/skills/ark-fix.md +3 -0
  56. package/templates/skills/ark-place.md +7 -0
  57. package/templates/skills/ark-think.md +43 -0
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
2
- import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-CSJhEOk2.cjs';
2
+ import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-D6Q8WHes.cjs';
3
3
 
4
4
  /** Injection token for the Ark kernel instance. */
5
5
  declare const ARK_KERNEL: unique symbol;
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
2
- import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-CSJhEOk2.js';
2
+ import { A as ArkKernel, C as CreateArkKernelOptions } from '../types-D6Q8WHes.js';
3
3
 
4
4
  /** Injection token for the Ark kernel instance. */
5
5
  declare const ARK_KERNEL: unique symbol;
@@ -577,6 +577,82 @@ async function recordInterceptorError(interceptor, event, error, deps) {
577
577
  });
578
578
  }
579
579
 
580
+ // src/domain/layerMatch.ts
581
+ function normalizeGlobSeparators(pattern) {
582
+ let out = "";
583
+ for (let i = 0; i < pattern.length; i += 1) {
584
+ const c = pattern[i];
585
+ if (c === "\\" && i + 1 < pattern.length) {
586
+ const next = pattern[i + 1];
587
+ if ("*?{}[],".includes(next) || next === "\\") {
588
+ out += "\\" + next;
589
+ i += 1;
590
+ continue;
591
+ }
592
+ out += "/";
593
+ continue;
594
+ }
595
+ out += c;
596
+ }
597
+ return out;
598
+ }
599
+ function sliceIdForPath(relPath, sliceFolders) {
600
+ if (!sliceFolders?.length) return void 0;
601
+ const parts = String(relPath).split(/[/\\]/).filter(Boolean);
602
+ const folders = new Set(sliceFolders.map((s) => String(s).toLowerCase()));
603
+ for (let i = 0; i < parts.length - 1; i += 1) {
604
+ if (folders.has(parts[i].toLowerCase())) {
605
+ return `${parts[i]}/${parts[i + 1]}`;
606
+ }
607
+ }
608
+ return void 0;
609
+ }
610
+ function inferSliceFoldersFromPatterns(patterns) {
611
+ const out = /* @__PURE__ */ new Set();
612
+ for (const pattern of patterns ?? []) {
613
+ const glob = normalizeGlobSeparators(String(pattern));
614
+ const parts = glob.split("/").filter(Boolean);
615
+ for (let i = 0; i < parts.length; i += 1) {
616
+ const part = parts[i];
617
+ if ((part === "**" || part === "*") && i > 0) {
618
+ const prev = parts[i - 1];
619
+ if (prev && !prev.includes("*") && !prev.includes("{") && !prev.includes("}")) {
620
+ out.add(prev);
621
+ }
622
+ }
623
+ }
624
+ }
625
+ return [...out];
626
+ }
627
+ function resolveSliceFolders(rule, layerName, layers) {
628
+ if (Array.isArray(rule.sliceFolders) && rule.sliceFolders.length > 0) {
629
+ return rule.sliceFolders.filter((s) => typeof s === "string" && s.length > 0);
630
+ }
631
+ const layer = (layers ?? []).find((l) => l.name === layerName);
632
+ return inferSliceFoldersFromPatterns(layer?.patterns);
633
+ }
634
+ function findDeniedEdgeRule(rules, from, to, options) {
635
+ for (const rule of rules ?? []) {
636
+ if (rule.from !== from || rule.to !== to) continue;
637
+ if (rule.allowed !== false) continue;
638
+ if (rule.peerIsolation) {
639
+ const fromPath = options?.fromPath;
640
+ const toPath = options?.toPath;
641
+ if (!fromPath || !toPath) continue;
642
+ const folders = resolveSliceFolders(rule, from, options?.layers);
643
+ if (folders.length === 0) continue;
644
+ const fromSlice = sliceIdForPath(fromPath, folders);
645
+ const toSlice = sliceIdForPath(toPath, folders);
646
+ if (!fromSlice || !toSlice) continue;
647
+ if (fromSlice !== toSlice) return rule;
648
+ continue;
649
+ }
650
+ if (from === to) continue;
651
+ return rule;
652
+ }
653
+ return void 0;
654
+ }
655
+
580
656
  // src/kernel/event-bus/observedLayerFlow.ts
581
657
  async function assertObservedLayerFlowAllowed(event, deps) {
582
658
  if (deps.mode === "off" || !deps.architectureProfile) {
@@ -588,9 +664,7 @@ async function assertObservedLayerFlowAllowed(event, deps) {
588
664
  const fromLayer = profile.resolveLayer(source);
589
665
  const toLayer = profile.resolveLayer(event.intent);
590
666
  if (!fromLayer || !toLayer) return;
591
- const blocked = profile.rules.find(
592
- (rule) => !rule.allowed && rule.from === fromLayer && rule.to === toLayer
593
- );
667
+ const blocked = findDeniedEdgeRule(profile.rules, fromLayer, toLayer);
594
668
  if (!blocked) return;
595
669
  const severity = deps.mode;
596
670
  const message = blocked.message ?? `Observed layer violation: "${source}" (${fromLayer}) must not produce "${event.intent}" (${toLayer}).`;
@@ -1704,7 +1778,7 @@ var elevenLayerProfile = createArchitectureProfile({
1704
1778
  var MANIFEST_SCHEMA_VERSION = "1.0";
1705
1779
 
1706
1780
  // src/version.ts
1707
- var version = "2.8.2";
1781
+ var version = "2.9.0";
1708
1782
 
1709
1783
  // src/kernel/manifest/createArkManifest.ts
1710
1784
  function policyId(name) {