nexarch 0.5.11 → 0.5.12

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.
@@ -1,5 +1,5 @@
1
1
  import process from "process";
2
- import { existsSync, readFileSync } from "fs";
2
+ import { existsSync, readFileSync, readdirSync, statSync } from "fs";
3
3
  import { join } from "path";
4
4
  import { homedir } from "os";
5
5
  import { requireCredentials } from "../lib/credentials.js";
@@ -35,6 +35,66 @@ function loadIdentity() {
35
35
  return { agentKey: null, projectKeys: [] };
36
36
  }
37
37
  }
38
+ function safeReadText(path, maxChars = 6000) {
39
+ if (!existsSync(path))
40
+ return null;
41
+ try {
42
+ return readFileSync(path, "utf8").slice(0, maxChars);
43
+ }
44
+ catch {
45
+ return null;
46
+ }
47
+ }
48
+ function collectEvidenceFromRepo() {
49
+ const cwd = process.cwd();
50
+ const readme = safeReadText(join(cwd, "README.md"), 8000)
51
+ ?? safeReadText(join(cwd, "readme.md"), 8000)
52
+ ?? undefined;
53
+ const packageJson = safeReadText(join(cwd, "package.json"), 5000);
54
+ const notes = [];
55
+ if (packageJson)
56
+ notes.push("package.json detected");
57
+ const files = [];
58
+ if (packageJson)
59
+ files.push({ path: "package.json", content: packageJson });
60
+ const srcDir = join(cwd, "src");
61
+ if (existsSync(srcDir)) {
62
+ try {
63
+ const entries = readdirSync(srcDir)
64
+ .filter((name) => /\.(ts|tsx|js|jsx)$/i.test(name))
65
+ .slice(0, 8);
66
+ for (const name of entries) {
67
+ const full = join(srcDir, name);
68
+ try {
69
+ if (!statSync(full).isFile())
70
+ continue;
71
+ const content = safeReadText(full, 4000);
72
+ if (content)
73
+ files.push({ path: `src/${name}`, content });
74
+ }
75
+ catch {
76
+ // ignore per-file failures
77
+ }
78
+ }
79
+ if (entries.length > 0)
80
+ notes.push(`included ${entries.length} source file snippet(s)`);
81
+ }
82
+ catch {
83
+ // ignore directory read issues
84
+ }
85
+ }
86
+ const summary = [
87
+ `cwd=${cwd}`,
88
+ readme ? "README included" : "README missing",
89
+ files.length > 0 ? `evidence files=${files.length}` : "no evidence files collected",
90
+ ].join("; ");
91
+ return {
92
+ summary,
93
+ ...(readme ? { readme } : {}),
94
+ ...(notes.length ? { notes: notes.join("; ") } : {}),
95
+ ...(files.length ? { files } : {}),
96
+ };
97
+ }
38
98
  export async function checkIn(args) {
39
99
  const asJson = parseFlag(args, "--json");
40
100
  const agentKeyArg = parseOptionValue(args, "--agent-key");
@@ -54,9 +114,11 @@ export async function checkIn(args) {
54
114
  return;
55
115
  }
56
116
  const mcpOpts = { companyId: creds.companyId };
117
+ const evidence = collectEvidenceFromRepo();
57
118
  const raw = await callMcpTool("nexarch_claim_command", {
58
119
  agentKey,
59
120
  ...(resolvedProjectKeys.length > 0 ? { projectKeys: resolvedProjectKeys } : {}),
121
+ evidence,
60
122
  companyId: creds.companyId,
61
123
  }, mcpOpts);
62
124
  const result = parseToolText(raw);
@@ -75,6 +137,18 @@ export async function checkIn(args) {
75
137
  const s = result.audit.summary ?? {};
76
138
  console.log(`Policy audit run: ${result.audit.runId} (${s.passCount ?? 0} pass, ${s.partialCount ?? 0} partial, ${s.failCount ?? 0} fail)`);
77
139
  }
140
+ const preview = result.audit?.findingsPreview ?? [];
141
+ if (preview.length > 0) {
142
+ console.log("\nTop findings:");
143
+ for (const finding of preview.slice(0, 5)) {
144
+ console.log(`- [${finding.result ?? "unknown"}] ${finding.control ?? "Control"} / ${finding.rule ?? "Rule"}`);
145
+ if (finding.rationale)
146
+ console.log(` rationale: ${finding.rationale}`);
147
+ if (finding.missingRequirements && finding.missingRequirements.length) {
148
+ console.log(` missing: ${finding.missingRequirements.slice(0, 2).join(" | ")}`);
149
+ }
150
+ }
151
+ }
78
152
  return;
79
153
  }
80
154
  console.log(`\n╔══════════════════════════════════════════════════════════════════╗`);
@@ -6,7 +6,7 @@ import { requireCredentials } from "../lib/credentials.js";
6
6
  import { fetchAgentRegistryOrThrow } from "../lib/agent-registry.js";
7
7
  import { callMcpTool, mcpInitialize, mcpListTools } from "../lib/mcp.js";
8
8
  import { buildVersionAttributes } from "../lib/version-normalization.js";
9
- const CLI_VERSION = "0.5.11";
9
+ const CLI_VERSION = "0.5.12";
10
10
  const AGENT_ENTITY_TYPE = "agent";
11
11
  const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
12
12
  function parseFlag(args, flag) {
package/dist/lib/mcp.js CHANGED
@@ -68,7 +68,7 @@ export async function mcpInitialize(options = {}) {
68
68
  return callMcpRpc("initialize", {
69
69
  protocolVersion: "2024-11-05",
70
70
  capabilities: {},
71
- clientInfo: { name: "nexarch-cli", version: "0.5.11" },
71
+ clientInfo: { name: "nexarch-cli", version: "0.5.12" },
72
72
  }, options);
73
73
  }
74
74
  export async function mcpListTools(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexarch",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "Your architecture workspace for AI delivery.",
5
5
  "keywords": [
6
6
  "nexarch",