nexarch 0.2.8 → 0.3.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/dist/commands/check-in.js +1 -1
- package/dist/commands/init-project.js +36 -16
- package/dist/lib/mcp.js +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ const COMMAND_TYPE_HINTS = {
|
|
|
40
40
|
drift_audit: "Compare the current codebase to the architecture graph and report any drift or missing entities.",
|
|
41
41
|
access_audit: "Audit which agents and users have access to this application and report findings.",
|
|
42
42
|
gap_check: "Run a gap analysis: identify architecturally significant platforms or infrastructure not yet in the graph.",
|
|
43
|
-
policy_check: "
|
|
43
|
+
policy_check: "Step 1: call nexarch_get_entity_policy_controls with entityExternalKey set to target_entity_key — this returns controls, each with a rules array (rule id, name, ruleText). Step 2: for each rule, examine the codebase and evaluate whether it passes, partially passes, or fails. Step 3: call nexarch_submit_policy_audit with applicationEntityKey, commandId, agentKey, and a findings array containing one entry per rule with policyControlId, policyRuleId, result (pass/partial/fail), rationale, and missingRequirements. Step 4: mark the command done with a brief summary. If no controls are returned, run command-fail with error 'No policy controls linked'.",
|
|
44
44
|
enrich_entity: "Update the entity description, subtype, and metadata using information from the README or codebase.",
|
|
45
45
|
register_aliases: "Find internal package names that are unresolved and register them as company aliases.",
|
|
46
46
|
custom: "Execute the custom instructions provided.",
|
|
@@ -37,27 +37,33 @@ function parseEnvKeys(content) {
|
|
|
37
37
|
.filter((key) => /^[A-Z][A-Z0-9_]{2,}$/.test(key))
|
|
38
38
|
.filter((key) => !ENV_KEY_NOISE.test(key));
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function gitOriginUrl(dir) {
|
|
41
41
|
const configPath = join(dir, ".git", "config");
|
|
42
42
|
if (!existsSync(configPath))
|
|
43
|
-
return
|
|
43
|
+
return null;
|
|
44
44
|
try {
|
|
45
45
|
const content = readFileSync(configPath, "utf8");
|
|
46
|
-
// Match url under [remote "origin"]
|
|
47
46
|
const match = content.match(/\[remote\s+"origin"\][^\[]*url\s*=\s*([^\n]+)/s);
|
|
48
47
|
if (!match)
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
if (url.includes("github.com"))
|
|
52
|
-
return ["github"];
|
|
53
|
-
if (url.includes("gitlab.com"))
|
|
54
|
-
return ["gitlab"];
|
|
55
|
-
if (url.includes("bitbucket.org"))
|
|
56
|
-
return ["bitbucket"];
|
|
57
|
-
if (url.includes("dev.azure.com") || url.includes("visualstudio.com"))
|
|
58
|
-
return ["azure-devops"];
|
|
48
|
+
return null;
|
|
49
|
+
return match[1].trim();
|
|
59
50
|
}
|
|
60
|
-
catch {
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function detectFromGitConfig(dir) {
|
|
56
|
+
const url = gitOriginUrl(dir);
|
|
57
|
+
if (!url)
|
|
58
|
+
return [];
|
|
59
|
+
if (url.includes("github.com"))
|
|
60
|
+
return ["github"];
|
|
61
|
+
if (url.includes("gitlab.com"))
|
|
62
|
+
return ["gitlab"];
|
|
63
|
+
if (url.includes("bitbucket.org"))
|
|
64
|
+
return ["bitbucket"];
|
|
65
|
+
if (url.includes("dev.azure.com") || url.includes("visualstudio.com"))
|
|
66
|
+
return ["azure-devops"];
|
|
61
67
|
return [];
|
|
62
68
|
}
|
|
63
69
|
function detectFromFilesystem(dir) {
|
|
@@ -555,6 +561,9 @@ export async function initProject(args) {
|
|
|
555
561
|
const dir = resolvePath(dirArg);
|
|
556
562
|
const nameOverride = parseOptionValue(args, "--name");
|
|
557
563
|
const entityTypeOverride = parseOptionValue(args, "--entity-type") ?? "application";
|
|
564
|
+
const repoRefOverride = parseOptionValue(args, "--repo-ref");
|
|
565
|
+
const repoUrlOverride = parseOptionValue(args, "--repo-url");
|
|
566
|
+
const repoPathOverride = parseOptionValue(args, "--repo-path");
|
|
558
567
|
const creds = requireCredentials();
|
|
559
568
|
const mcpOpts = { companyId: creds.companyId };
|
|
560
569
|
if (!asJson)
|
|
@@ -619,10 +628,15 @@ export async function initProject(args) {
|
|
|
619
628
|
const policies = parseToolText(policiesRaw);
|
|
620
629
|
const policyBundleHash = policies.policyBundleHash ?? null;
|
|
621
630
|
const nowIso = new Date().toISOString();
|
|
631
|
+
const repoRef = repoRefOverride ?? dir;
|
|
632
|
+
const repoPath = repoPathOverride ?? dir;
|
|
633
|
+
const repoUrl = repoUrlOverride ?? null;
|
|
622
634
|
const agentContext = {
|
|
623
635
|
agentId: "nexarch-cli:init-project",
|
|
624
636
|
agentRunId: `init-project-${Date.now()}`,
|
|
625
|
-
repoRef
|
|
637
|
+
repoRef,
|
|
638
|
+
repoPath,
|
|
639
|
+
...(repoUrl ? { repoUrl } : {}),
|
|
626
640
|
observedAt: nowIso,
|
|
627
641
|
source: "nexarch-cli",
|
|
628
642
|
model: "n/a",
|
|
@@ -641,7 +655,13 @@ export async function initProject(args) {
|
|
|
641
655
|
...(projectSubtype ? { entitySubtypeCode: projectSubtype } : {}),
|
|
642
656
|
name: displayName,
|
|
643
657
|
confidence: 1,
|
|
644
|
-
attributes: {
|
|
658
|
+
attributes: {
|
|
659
|
+
source_dir: dir,
|
|
660
|
+
scanned_at: nowIso,
|
|
661
|
+
package_json_count: packageJsonCount,
|
|
662
|
+
...(repoUrl ? { repository_url: repoUrl } : {}),
|
|
663
|
+
repository_ref: repoRef,
|
|
664
|
+
},
|
|
645
665
|
});
|
|
646
666
|
// Resolved reference entities (deduplicated by canonical external ref)
|
|
647
667
|
const seenRefs = new Set();
|
package/dist/lib/mcp.js
CHANGED
|
@@ -62,7 +62,7 @@ export async function mcpInitialize(options = {}) {
|
|
|
62
62
|
return callMcpRpc("initialize", {
|
|
63
63
|
protocolVersion: "2024-11-05",
|
|
64
64
|
capabilities: {},
|
|
65
|
-
clientInfo: { name: "nexarch-cli", version: "0.
|
|
65
|
+
clientInfo: { name: "nexarch-cli", version: "0.3.0" },
|
|
66
66
|
}, options);
|
|
67
67
|
}
|
|
68
68
|
export async function mcpListTools(options = {}) {
|