nexarch 0.2.9 → 0.3.1

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.
@@ -36,13 +36,8 @@ function loadIdentity() {
36
36
  }
37
37
  }
38
38
  const COMMAND_TYPE_HINTS = {
39
- update_project: "Re-scan the project with `npx nexarch init-project` to update the architecture graph.",
40
- drift_audit: "Compare the current codebase to the architecture graph and report any drift or missing entities.",
41
- access_audit: "Audit which agents and users have access to this application and report findings.",
42
- gap_check: "Run a gap analysis: identify architecturally significant platforms or infrastructure not yet in the graph.",
43
39
  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
- enrich_entity: "Update the entity description, subtype, and metadata using information from the README or codebase.",
45
- register_aliases: "Find internal package names that are unresolved and register them as company aliases.",
40
+ data_model_review: "Goal: infer enterprise canonical logical data assets and map concrete physical implementations. 1) Identify logical business entities (canonical names, singular, enterprise meaning) and upsert as data_asset:data_logical. 2) Identify physical stores (tables/collections/files/indexes) and upsert as data_asset:data_physical with attributes (database, schema, table_name, store_type, source_system). 3) Link logical -> physical via implemented_by. 4) Link apps/services to physical via reads/writes. 5) Link logical assets to data domains via belongs_to_domain where evidence exists. 6) Avoid duplicate logical entities: reuse canonical logical entities if concept already exists. 7) Mark uncertain mappings with lower confidence in attributes.confidence.score and include rationale in command summary.",
46
41
  custom: "Execute the custom instructions provided.",
47
42
  };
48
43
  export async function checkIn(args) {
@@ -80,7 +75,7 @@ export async function checkIn(args) {
80
75
  return;
81
76
  }
82
77
  const cmd = result.command;
83
- const hint = COMMAND_TYPE_HINTS[cmd.command_type] ?? "";
78
+ const hint = COMMAND_TYPE_HINTS[cmd.command_type] ?? "No built-in playbook for this command type. Follow the command instructions and complete/fail it explicitly.";
84
79
  console.log(`\n╔══════════════════════════════════════════════════════════════════╗`);
85
80
  console.log(`║ COMMAND QUEUED — action required ║`);
86
81
  console.log(`╚══════════════════════════════════════════════════════════════════╝`);
@@ -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 detectFromGitConfig(dir) {
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
- const url = match[1].trim();
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: dir,
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: { source_dir: dir, scanned_at: nowIso, package_json_count: packageJsonCount },
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.2.9" },
65
+ clientInfo: { name: "nexarch-cli", version: "0.3.1" },
66
66
  }, options);
67
67
  }
68
68
  export async function mcpListTools(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexarch",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "Connect AI coding tools to your Nexarch architecture workspace",
5
5
  "keywords": [
6
6
  "nexarch",