nexarch 0.5.2 → 0.5.3
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,11 +1,11 @@
|
|
|
1
1
|
import { arch, homedir, hostname, platform, release, type as osType, userInfo } from "os";
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import process from "process";
|
|
5
5
|
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
|
-
const CLI_VERSION = "0.5.
|
|
8
|
+
const CLI_VERSION = "0.5.3";
|
|
9
9
|
const AGENT_ENTITY_TYPE = "agent";
|
|
10
10
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
11
11
|
function parseFlag(args, flag) {
|
|
@@ -47,6 +47,32 @@ function getRuntimeMode() {
|
|
|
47
47
|
return "ci";
|
|
48
48
|
return "interactive";
|
|
49
49
|
}
|
|
50
|
+
function detectLikelyApplicationInCwd() {
|
|
51
|
+
const cwd = process.cwd();
|
|
52
|
+
const files = [
|
|
53
|
+
"package.json",
|
|
54
|
+
"pyproject.toml",
|
|
55
|
+
"requirements.txt",
|
|
56
|
+
"go.mod",
|
|
57
|
+
"Cargo.toml",
|
|
58
|
+
"Gemfile",
|
|
59
|
+
"composer.json",
|
|
60
|
+
"pom.xml",
|
|
61
|
+
"build.gradle",
|
|
62
|
+
"build.gradle.kts",
|
|
63
|
+
];
|
|
64
|
+
const evidence = files.filter((file) => existsSync(join(cwd, file)));
|
|
65
|
+
try {
|
|
66
|
+
const entries = readdirSync(cwd);
|
|
67
|
+
if (entries.some((name) => name.toLowerCase().endsWith(".csproj"))) {
|
|
68
|
+
evidence.push("*.csproj");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// non-fatal; ignore
|
|
73
|
+
}
|
|
74
|
+
return { detected: evidence.length > 0, evidence };
|
|
75
|
+
}
|
|
50
76
|
function getSanitizedHostname(redactHostname) {
|
|
51
77
|
const raw = hostname() || "unknown-host";
|
|
52
78
|
return redactHostname ? "redacted" : raw;
|
|
@@ -718,6 +744,7 @@ export async function initAgent(args) {
|
|
|
718
744
|
});
|
|
719
745
|
}
|
|
720
746
|
const allPassed = checks.every((c) => c.ok);
|
|
747
|
+
const appDetection = detectLikelyApplicationInCwd();
|
|
721
748
|
const identifyPrompt = [
|
|
722
749
|
"Please identify your runtime so the workspace can register richer metadata.",
|
|
723
750
|
"Return ONLY the completed command below with real values (no markdown):",
|
|
@@ -751,6 +778,17 @@ export async function initAgent(args) {
|
|
|
751
778
|
detail: "Prompt the coding agent to self-identify and submit via nexarch agent identify",
|
|
752
779
|
prompt: identifyPrompt,
|
|
753
780
|
submitCommandTemplate: `nexarch agent identify --agent-id \"${agentId}\" --provider \"<provider>\" --model \"<model>\" --client \"<client>\" --framework \"<openclaw|n8n|m365-agent-framework|other>\" --session-id \"<session-id>\" --tool-version \"<tool-version>\" --capabilities \"<capability1,capability2>\" --notes \"<optional notes>\" --json`,
|
|
781
|
+
initProjectSuggestion: appDetection.detected
|
|
782
|
+
? {
|
|
783
|
+
shouldPromptUser: true,
|
|
784
|
+
reason: `Detected likely project manifests in cwd: ${appDetection.evidence.join(", ")}`,
|
|
785
|
+
userPrompt: "I found a likely application in this directory. Do you want me to run init-project next?",
|
|
786
|
+
suggestedCommand: "npx nexarch@latest init-project --dir . --json",
|
|
787
|
+
}
|
|
788
|
+
: {
|
|
789
|
+
shouldPromptUser: false,
|
|
790
|
+
reason: "No common application manifest files detected in current directory.",
|
|
791
|
+
},
|
|
754
792
|
},
|
|
755
793
|
companyId: creds.companyId,
|
|
756
794
|
registry: { version: registry.release.version, registryVersion: registry.registryVersion, publishedAt: registry.release.publishedAt },
|
|
@@ -793,6 +831,12 @@ export async function initAgent(args) {
|
|
|
793
831
|
console.log(" Paste this and fill in real values:");
|
|
794
832
|
console.log(`\nrun npx nexarch@latest agent identify --agent-id \"${agentId}\" --provider \"<provider>\" --model \"<model>\" --client \"<client>\" --framework \"<openclaw|n8n|m365-agent-framework|other>\" --tool-version \"<tool-version>\" --capabilities \"<capability1,capability2>\" --json\n`);
|
|
795
833
|
}
|
|
834
|
+
if (appDetection.detected) {
|
|
835
|
+
console.log("\n➡ Optional next step: likely application detected in current directory.");
|
|
836
|
+
console.log(` Detected manifests: ${appDetection.evidence.join(", ")}`);
|
|
837
|
+
console.log(" Ask the user: 'I found a likely application here. Do you want me to run init-project next?'");
|
|
838
|
+
console.log(" Suggested command: npx nexarch@latest init-project --dir . --json");
|
|
839
|
+
}
|
|
796
840
|
}
|
|
797
841
|
else {
|
|
798
842
|
console.log("⚠ Handshake/registration completed with issues.");
|
|
@@ -5,7 +5,6 @@ import { basename, join, relative, resolve as resolvePath } from "node:path";
|
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import { requireCredentials } from "../lib/credentials.js";
|
|
7
7
|
import { callMcpTool } from "../lib/mcp.js";
|
|
8
|
-
import { CURATED_AGENT_ICON_NAMES } from "../lib/application-icons.js";
|
|
9
8
|
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
10
9
|
function parseFlag(args, flag) {
|
|
11
10
|
return args.includes(flag);
|
|
@@ -988,7 +987,6 @@ export async function initProject(args) {
|
|
|
988
987
|
const ecosystemLabel = detectedEcosystems.length > 0
|
|
989
988
|
? detectedEcosystems.join(", ")
|
|
990
989
|
: "unknown";
|
|
991
|
-
const curatedIconList = CURATED_AGENT_ICON_NAMES.join(", ");
|
|
992
990
|
const manifestHint = detectedEcosystems.includes("nodejs")
|
|
993
991
|
? "package.json"
|
|
994
992
|
: detectedEcosystems.includes("python")
|
|
@@ -1022,9 +1020,9 @@ ${subPackages.map((sp) => ` • ${sp.name} (${sp.relativePath})`).join("\n")
|
|
|
1022
1020
|
→ --entity-type technology_component --subtype tech_library
|
|
1023
1021
|
|
|
1024
1022
|
ICON ASSIGNMENT (applications only):
|
|
1025
|
-
• Pick one icon from
|
|
1023
|
+
• Pick one icon from the full Lucide icon set for each application/sub-app.
|
|
1026
1024
|
• If confidence is low, skip --icon rather than guessing.
|
|
1027
|
-
•
|
|
1025
|
+
• Use kebab-case icon names (example: server, workflow, shield-check).
|
|
1028
1026
|
|
|
1029
1027
|
For each sub-package, run update-entity to register it:
|
|
1030
1028
|
|
|
@@ -1034,7 +1032,7 @@ ${subPackages.map((sp) => ` • ${sp.name} (${sp.relativePath})`).join("\n")
|
|
|
1034
1032
|
--subtype "<chosen subtype>" \\
|
|
1035
1033
|
--name "<human readable name>" \\
|
|
1036
1034
|
--description "<what this package does and its role in the project>" \\
|
|
1037
|
-
--icon "<
|
|
1035
|
+
--icon "<lucide icon>" # applications only
|
|
1038
1036
|
|
|
1039
1037
|
Then register it as a resolvable alias so future scans don't re-surface it as a candidate:
|
|
1040
1038
|
|
|
@@ -1158,8 +1156,7 @@ ${subPkgSection}${gapCheckSection}`;
|
|
|
1158
1156
|
instructions: buildEnrichmentInstructions(),
|
|
1159
1157
|
iconHints: {
|
|
1160
1158
|
provider: "lucide",
|
|
1161
|
-
|
|
1162
|
-
note: "Use curated list for agent-selected enrichment icons; omit icon when low confidence.",
|
|
1159
|
+
note: "Use any Lucide icon name for agent-selected enrichment icons; omit icon when low confidence.",
|
|
1163
1160
|
},
|
|
1164
1161
|
projectEntity: {
|
|
1165
1162
|
externalKey: projectExternalKey,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import process from "process";
|
|
2
2
|
import { requireCredentials } from "../lib/credentials.js";
|
|
3
3
|
import { callMcpTool } from "../lib/mcp.js";
|
|
4
|
-
import { CURATED_AGENT_ICON_SET } from "../lib/application-icons.js";
|
|
5
4
|
function parseFlag(args, flag) {
|
|
6
5
|
return args.includes(flag);
|
|
7
6
|
}
|
|
@@ -52,10 +51,6 @@ export async function updateEntity(args) {
|
|
|
52
51
|
const policyContext = policyBundleHash
|
|
53
52
|
? { policyBundleHash, alignmentSummary: { score: 1, violations: [], waivers: [] } }
|
|
54
53
|
: undefined;
|
|
55
|
-
if (iconName && !CURATED_AGENT_ICON_SET.has(iconName)) {
|
|
56
|
-
console.error(`error: --icon must be one of the curated agent icons (got '${iconName}')`);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
54
|
const entity = {
|
|
60
55
|
externalKey,
|
|
61
56
|
entityTypeCode,
|
package/dist/index.js
CHANGED
|
@@ -87,7 +87,7 @@ Usage:
|
|
|
87
87
|
--description <text>
|
|
88
88
|
--entity-type <code> (default: application)
|
|
89
89
|
--subtype <code>
|
|
90
|
-
--icon <lucide-name> (
|
|
90
|
+
--icon <lucide-name> (full Lucide set; for agent enrichment)
|
|
91
91
|
--json
|
|
92
92
|
nexarch add-relationship
|
|
93
93
|
Add a relationship between two existing graph entities.
|