@pulsemcp/air-cli 0.0.3 → 0.0.4
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/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -40
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +20 -17
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/prepare.d.ts +0 -18
- package/dist/commands/prepare.d.ts.map +1 -1
- package/dist/commands/prepare.js +22 -147
- package/dist/commands/prepare.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +17 -35
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +16 -44
- package/dist/commands/validate.js.map +1 -1
- package/package.json +2 -3
- package/dist/adapter-registry.d.ts +0 -11
- package/dist/adapter-registry.d.ts.map +0 -1
- package/dist/adapter-registry.js +0 -52
- package/dist/adapter-registry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,WAAW,IAAI,OAAO,CAuBrC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,51 +1,22 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import {
|
|
3
|
-
import { resolve, dirname } from "path";
|
|
4
|
-
import { getDefaultAirJsonPath } from "@pulsemcp/air-core";
|
|
2
|
+
import { initConfig } from "@pulsemcp/air-sdk";
|
|
5
3
|
export function initCommand() {
|
|
6
4
|
const cmd = new Command("init")
|
|
7
5
|
.description("Initialize a new AIR configuration at ~/.air/")
|
|
8
6
|
.action(() => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
mkdirSync(airDir, { recursive: true });
|
|
16
|
-
const airJson = {
|
|
17
|
-
name: "my-config",
|
|
18
|
-
description: "",
|
|
19
|
-
skills: ["./skills/skills.json"],
|
|
20
|
-
references: ["./references/references.json"],
|
|
21
|
-
mcp: ["./mcp/mcp.json"],
|
|
22
|
-
plugins: ["./plugins/plugins.json"],
|
|
23
|
-
roots: ["./roots/roots.json"],
|
|
24
|
-
hooks: ["./hooks/hooks.json"],
|
|
25
|
-
};
|
|
26
|
-
const emptyIndex = () => "{}\n";
|
|
27
|
-
writeFileSync(airJsonPath, JSON.stringify(airJson, null, 2) + "\n");
|
|
28
|
-
const files = [
|
|
29
|
-
["skills/skills.json", emptyIndex()],
|
|
30
|
-
["references/references.json", emptyIndex()],
|
|
31
|
-
["mcp/mcp.json", emptyIndex()],
|
|
32
|
-
["plugins/plugins.json", emptyIndex()],
|
|
33
|
-
["roots/roots.json", emptyIndex()],
|
|
34
|
-
["hooks/hooks.json", emptyIndex()],
|
|
35
|
-
];
|
|
36
|
-
for (const [filename, content] of files) {
|
|
37
|
-
const filePath = resolve(airDir, filename);
|
|
38
|
-
mkdirSync(dirname(filePath), { recursive: true });
|
|
39
|
-
if (!existsSync(filePath)) {
|
|
40
|
-
writeFileSync(filePath, content);
|
|
7
|
+
try {
|
|
8
|
+
const result = initConfig();
|
|
9
|
+
console.log(`Initialized AIR configuration at ${result.airDir}/:`);
|
|
10
|
+
for (const file of result.files) {
|
|
11
|
+
console.log(` ${file}`);
|
|
41
12
|
}
|
|
13
|
+
console.log("\nEdit air.json to configure your setup. Run 'air validate ~/.air/air.json' to check.");
|
|
42
14
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
15
|
+
catch (err) {
|
|
16
|
+
const message = err instanceof Error ? err.message : "Unknown error";
|
|
17
|
+
console.error(`Error: ${message}`);
|
|
18
|
+
process.exit(1);
|
|
47
19
|
}
|
|
48
|
-
console.log("\nEdit air.json to configure your setup. Run 'air validate ~/.air/air.json' to check.");
|
|
49
20
|
});
|
|
50
21
|
return cmd;
|
|
51
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,UAAU,WAAW;IACzB,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC5B,WAAW,CAAC,+CAA+C,CAAC;SAC5D,MAAM,CAAC,GAAG,EAAE;QACX,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;YAE5B,OAAO,CAAC,GAAG,CAAC,oCAAoC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;YACnE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YAC3B,CAAC;YACD,OAAO,CAAC,GAAG,CACT,uFAAuF,CACxF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GACX,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACvD,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,WAAW,IAAI,OAAO,CA8JrC"}
|
package/dist/commands/list.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import {
|
|
3
|
-
const VALID_TYPES = [
|
|
4
|
-
"skills",
|
|
5
|
-
"mcp",
|
|
6
|
-
"plugins",
|
|
7
|
-
"roots",
|
|
8
|
-
"hooks",
|
|
9
|
-
"references",
|
|
10
|
-
];
|
|
2
|
+
import { listArtifacts, } from "@pulsemcp/air-sdk";
|
|
11
3
|
export function listCommand() {
|
|
12
4
|
const cmd = new Command("list")
|
|
13
5
|
.description("List available artifacts (skills, mcp, plugins, roots, hooks, references)")
|
|
14
6
|
.argument("<type>", "Artifact type to list: skills, mcp, plugins, roots, hooks, references")
|
|
15
7
|
.action(async (type) => {
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
let result;
|
|
9
|
+
try {
|
|
10
|
+
result = await listArtifacts(type);
|
|
11
|
+
}
|
|
12
|
+
catch (err) {
|
|
13
|
+
const message = err instanceof Error ? err.message : "Unknown error";
|
|
14
|
+
console.error(`Error: ${message}`);
|
|
18
15
|
process.exit(1);
|
|
19
16
|
}
|
|
20
|
-
const
|
|
21
|
-
const artifacts = airJsonPath
|
|
22
|
-
? await resolveArtifacts(airJsonPath)
|
|
23
|
-
: emptyArtifacts();
|
|
17
|
+
const { artifacts } = result;
|
|
24
18
|
const listType = type;
|
|
25
19
|
switch (listType) {
|
|
26
20
|
case "skills": {
|
|
@@ -68,9 +62,18 @@ export function listCommand() {
|
|
|
68
62
|
console.log(`Plugins (${entries.length}):\n`);
|
|
69
63
|
for (const [id, plugin] of entries) {
|
|
70
64
|
const title = plugin.title ? ` (${plugin.title})` : "";
|
|
71
|
-
|
|
65
|
+
const version = plugin.version ? ` v${plugin.version}` : "";
|
|
66
|
+
console.log(` ${id}${title}${version}`);
|
|
72
67
|
console.log(` ${plugin.description}`);
|
|
73
|
-
|
|
68
|
+
if (plugin.skills?.length) {
|
|
69
|
+
console.log(` Skills: ${plugin.skills.join(", ")}`);
|
|
70
|
+
}
|
|
71
|
+
if (plugin.mcp_servers?.length) {
|
|
72
|
+
console.log(` MCP Servers: ${plugin.mcp_servers.join(", ")}`);
|
|
73
|
+
}
|
|
74
|
+
if (plugin.hooks?.length) {
|
|
75
|
+
console.log(` Hooks: ${plugin.hooks.join(", ")}`);
|
|
76
|
+
}
|
|
74
77
|
console.log();
|
|
75
78
|
}
|
|
76
79
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,aAAa,GAGd,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,WAAW;IACzB,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC5B,WAAW,CACV,2EAA2E,CAC5E;SACA,QAAQ,CACP,QAAQ,EACR,uEAAuE,CACxE;SACA,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAC7B,IAAI,MAAM,CAAC;QACX,IAA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EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;oBAC/B,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;oBACtC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;oBACrC,OAAO,CAAC,GAAG,EAAE,CAAC;gBAChB,CAAC;gBACD,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { type RootEntry } from "@pulsemcp/air-core";
|
|
3
|
-
/**
|
|
4
|
-
* Normalize a git remote URL to a comparable form: "github.com/owner/repo"
|
|
5
|
-
* Handles HTTPS, SSH (git@), and trailing .git.
|
|
6
|
-
*/
|
|
7
|
-
export declare function normalizeGitUrl(url: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Detect which root matches the current git repository and subdirectory.
|
|
10
|
-
*
|
|
11
|
-
* Algorithm:
|
|
12
|
-
* 1. Get the git remote URL and relative subdirectory from targetDir
|
|
13
|
-
* 2. Normalize the URL and compare against all root URLs
|
|
14
|
-
* 3. Among roots with matching URLs, pick the best subdirectory match:
|
|
15
|
-
* - Exact match (root.subdirectory === current subdirectory)
|
|
16
|
-
* - Longest prefix match
|
|
17
|
-
* - Root-level (no subdirectory / empty subdirectory)
|
|
18
|
-
*/
|
|
19
|
-
export declare function detectRoot(roots: Record<string, RootEntry>, targetDir: string): RootEntry | undefined;
|
|
20
2
|
export declare function prepareCommand(): Command;
|
|
21
3
|
//# sourceMappingURL=prepare.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../src/commands/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../src/commands/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,cAAc,IAAI,OAAO,CAmExC"}
|
package/dist/commands/prepare.js
CHANGED
|
@@ -1,104 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import {
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
import { getAirJsonPath, resolveArtifacts, } from "@pulsemcp/air-core";
|
|
5
|
-
import { findAdapter, listAvailableAdapters } from "../adapter-registry.js";
|
|
6
|
-
/**
|
|
7
|
-
* Normalize a git remote URL to a comparable form: "github.com/owner/repo"
|
|
8
|
-
* Handles HTTPS, SSH (git@), and trailing .git.
|
|
9
|
-
*/
|
|
10
|
-
export function normalizeGitUrl(url) {
|
|
11
|
-
let normalized = url.trim();
|
|
12
|
-
// SSH format: git@github.com:owner/repo.git → github.com/owner/repo
|
|
13
|
-
const sshMatch = normalized.match(/^git@([^:]+):(.+)$/);
|
|
14
|
-
if (sshMatch) {
|
|
15
|
-
normalized = `${sshMatch[1]}/${sshMatch[2]}`;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
// HTTPS format: https://github.com/owner/repo.git → github.com/owner/repo
|
|
19
|
-
normalized = normalized.replace(/^https?:\/\//, "");
|
|
20
|
-
}
|
|
21
|
-
// Strip trailing .git
|
|
22
|
-
normalized = normalized.replace(/\.git$/, "");
|
|
23
|
-
// Strip trailing slash
|
|
24
|
-
normalized = normalized.replace(/\/$/, "");
|
|
25
|
-
return normalized;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Detect which root matches the current git repository and subdirectory.
|
|
29
|
-
*
|
|
30
|
-
* Algorithm:
|
|
31
|
-
* 1. Get the git remote URL and relative subdirectory from targetDir
|
|
32
|
-
* 2. Normalize the URL and compare against all root URLs
|
|
33
|
-
* 3. Among roots with matching URLs, pick the best subdirectory match:
|
|
34
|
-
* - Exact match (root.subdirectory === current subdirectory)
|
|
35
|
-
* - Longest prefix match
|
|
36
|
-
* - Root-level (no subdirectory / empty subdirectory)
|
|
37
|
-
*/
|
|
38
|
-
export function detectRoot(roots, targetDir) {
|
|
39
|
-
let remoteUrl;
|
|
40
|
-
let relativeDir;
|
|
41
|
-
try {
|
|
42
|
-
remoteUrl = execSync("git remote get-url origin", {
|
|
43
|
-
cwd: targetDir,
|
|
44
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
45
|
-
encoding: "utf-8",
|
|
46
|
-
}).trim();
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
// Not in a git repo or no remote — can't auto-detect
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
relativeDir = execSync("git rev-parse --show-prefix", {
|
|
54
|
-
cwd: targetDir,
|
|
55
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
56
|
-
encoding: "utf-8",
|
|
57
|
-
}).trim();
|
|
58
|
-
// Remove trailing slash
|
|
59
|
-
relativeDir = relativeDir.replace(/\/$/, "");
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
relativeDir = "";
|
|
63
|
-
}
|
|
64
|
-
const normalizedRemote = normalizeGitUrl(remoteUrl);
|
|
65
|
-
// Find all roots whose URL matches this repo
|
|
66
|
-
const matchingRoots = [];
|
|
67
|
-
for (const root of Object.values(roots)) {
|
|
68
|
-
if (!root.url)
|
|
69
|
-
continue;
|
|
70
|
-
const normalizedRootUrl = normalizeGitUrl(root.url);
|
|
71
|
-
if (normalizedRemote === normalizedRootUrl) {
|
|
72
|
-
matchingRoots.push(root);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (matchingRoots.length === 0)
|
|
76
|
-
return undefined;
|
|
77
|
-
// Find best subdirectory match
|
|
78
|
-
// Priority: exact match → longest prefix → root-level (no/empty subdirectory)
|
|
79
|
-
const rootSubdir = (r) => (r.subdirectory || "").replace(/\/$/, "");
|
|
80
|
-
// 1. Exact match
|
|
81
|
-
const exact = matchingRoots.find((r) => rootSubdir(r) === relativeDir);
|
|
82
|
-
if (exact)
|
|
83
|
-
return exact;
|
|
84
|
-
// 2. Longest prefix match (current dir is within root's subdirectory)
|
|
85
|
-
const prefixMatches = matchingRoots
|
|
86
|
-
.filter((r) => {
|
|
87
|
-
const sub = rootSubdir(r);
|
|
88
|
-
if (!sub)
|
|
89
|
-
return false;
|
|
90
|
-
return relativeDir.startsWith(sub + "/") || relativeDir === sub;
|
|
91
|
-
})
|
|
92
|
-
.sort((a, b) => rootSubdir(b).length - rootSubdir(a).length);
|
|
93
|
-
if (prefixMatches.length > 0)
|
|
94
|
-
return prefixMatches[0];
|
|
95
|
-
// 3. Root-level fallback (root with no subdirectory)
|
|
96
|
-
const rootLevel = matchingRoots.find((r) => !rootSubdir(r));
|
|
97
|
-
if (rootLevel)
|
|
98
|
-
return rootLevel;
|
|
99
|
-
// 4. Any matching root as last resort
|
|
100
|
-
return matchingRoots[0];
|
|
101
|
-
}
|
|
2
|
+
import { prepareSession } from "@pulsemcp/air-sdk";
|
|
102
3
|
export function prepareCommand() {
|
|
103
4
|
const cmd = new Command("prepare")
|
|
104
5
|
.description("Prepare a target directory for an agent session (write .mcp.json, inject skills) without starting the agent")
|
|
@@ -109,56 +10,30 @@ export function prepareCommand() {
|
|
|
109
10
|
.option("--skills <ids>", "Comma-separated skill IDs (overrides root defaults)")
|
|
110
11
|
.option("--mcp-servers <ids>", "Comma-separated MCP server IDs (overrides root defaults)")
|
|
111
12
|
.action(async (options) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
// Load and resolve all artifacts
|
|
129
|
-
const artifacts = await resolveArtifacts(airJsonPath);
|
|
130
|
-
// Resolve root: explicit --root, auto-detect, or none
|
|
131
|
-
let root;
|
|
132
|
-
if (options.root) {
|
|
133
|
-
root = artifacts.roots[options.root];
|
|
134
|
-
if (!root) {
|
|
135
|
-
console.error(`Error: Root "${options.root}" not found. Available roots: ${Object.keys(artifacts.roots).join(", ") || "(none)"}`);
|
|
136
|
-
process.exit(1);
|
|
13
|
+
try {
|
|
14
|
+
const result = await prepareSession({
|
|
15
|
+
config: options.config,
|
|
16
|
+
root: options.root,
|
|
17
|
+
target: options.target,
|
|
18
|
+
adapter: options.adapter,
|
|
19
|
+
skills: options.skills
|
|
20
|
+
? options.skills.split(",").map((s) => s.trim())
|
|
21
|
+
: undefined,
|
|
22
|
+
mcpServers: options.mcpServers
|
|
23
|
+
? options.mcpServers.split(",").map((s) => s.trim())
|
|
24
|
+
: undefined,
|
|
25
|
+
});
|
|
26
|
+
if (result.rootAutoDetected && result.root) {
|
|
27
|
+
console.error(`Auto-detected root: ${result.root.name}`);
|
|
137
28
|
}
|
|
29
|
+
// Output structured JSON to stdout for orchestrator consumption
|
|
30
|
+
console.log(JSON.stringify(result.session, null, 2));
|
|
138
31
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (root) {
|
|
144
|
-
console.error(`Auto-detected root: ${root.name}`);
|
|
145
|
-
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
const message = err instanceof Error ? err.message : "Unknown error";
|
|
34
|
+
console.error(`Error: ${message}`);
|
|
35
|
+
process.exit(1);
|
|
146
36
|
}
|
|
147
|
-
// Parse overrides
|
|
148
|
-
const skillOverrides = options.skills
|
|
149
|
-
? options.skills.split(",").map((s) => s.trim())
|
|
150
|
-
: undefined;
|
|
151
|
-
const mcpServerOverrides = options.mcpServers
|
|
152
|
-
? options.mcpServers.split(",").map((s) => s.trim())
|
|
153
|
-
: undefined;
|
|
154
|
-
// Prepare the session
|
|
155
|
-
const result = await adapter.prepareSession(artifacts, options.target, {
|
|
156
|
-
root,
|
|
157
|
-
skillOverrides,
|
|
158
|
-
mcpServerOverrides,
|
|
159
|
-
});
|
|
160
|
-
// Output structured JSON to stdout for orchestrator consumption
|
|
161
|
-
console.log(JSON.stringify(result, null, 2));
|
|
162
37
|
});
|
|
163
38
|
return cmd;
|
|
164
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/commands/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/commands/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;SAC/B,WAAW,CACV,6GAA6G,CAC9G;SACA,MAAM,CACL,iBAAiB,EACjB,kEAAkE,CACnE;SACA,MAAM,CAAC,eAAe,EAAE,wDAAwD,CAAC;SACjF,MAAM,CACL,gBAAgB,EAChB,+CAA+C,EAC/C,OAAO,CAAC,GAAG,EAAE,CACd;SACA,MAAM,CACL,kBAAkB,EAClB,qCAAqC,EACrC,QAAQ,CACT;SACA,MAAM,CACL,gBAAgB,EAChB,qDAAqD,CACtD;SACA,MAAM,CACL,qBAAqB,EACrB,0DAA0D,CAC3D;SACA,MAAM,CACL,KAAK,EAAE,OAON,EAAE,EAAE;QACH,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;gBAClC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACx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ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,YAAY,IAAI,OAAO,CAwDtC"}
|
package/dist/commands/start.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import {
|
|
3
|
-
import { findAdapter, listAvailableAdapters } from "../adapter-registry.js";
|
|
2
|
+
import { startSession, } from "@pulsemcp/air-sdk";
|
|
4
3
|
export function startCommand() {
|
|
5
4
|
const cmd = new Command("start")
|
|
6
5
|
.description("Start an agent session with AIR configs loaded")
|
|
@@ -9,48 +8,31 @@ export function startCommand() {
|
|
|
9
8
|
.option("--dry-run", "Show what would be activated without starting")
|
|
10
9
|
.option("--skip-confirmation", "Don't prompt for confirmation before starting")
|
|
11
10
|
.action(async (agent, options) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
: "No adapters installed";
|
|
19
|
-
console.error(`Error: No adapter found for "${agent}". ${availableMsg}.\n` +
|
|
20
|
-
`Install an adapter: npm install @pulsemcp/air-adapter-${agent}`);
|
|
21
|
-
process.exit(1);
|
|
11
|
+
let result;
|
|
12
|
+
try {
|
|
13
|
+
result = await startSession(agent, {
|
|
14
|
+
root: options.root,
|
|
15
|
+
checkAvailability: !options.dryRun,
|
|
16
|
+
});
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
: emptyArtifacts();
|
|
28
|
-
// Resolve root if specified
|
|
29
|
-
let root;
|
|
30
|
-
if (options.root) {
|
|
31
|
-
root = artifacts.roots[options.root];
|
|
32
|
-
if (!root) {
|
|
33
|
-
console.error(`Error: Root "${options.root}" not found. Available roots: ${Object.keys(artifacts.roots).join(", ") || "(none)"}`);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
const message = err instanceof Error ? err.message : "Unknown error";
|
|
20
|
+
console.error(`Error: ${message}`);
|
|
21
|
+
process.exit(1);
|
|
36
22
|
}
|
|
37
|
-
// Generate config
|
|
38
|
-
const sessionConfig = adapter.generateConfig(artifacts, root);
|
|
39
23
|
// Dry run
|
|
40
24
|
if (options.dryRun) {
|
|
41
|
-
printDryRun(agent, artifacts, root);
|
|
25
|
+
printDryRun(agent, result.artifacts, result.root);
|
|
42
26
|
process.exit(0);
|
|
43
27
|
}
|
|
44
28
|
// Check if agent is available
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
console.error(`Error: ${adapter.displayName} is not installed or not in PATH.`);
|
|
29
|
+
if (!result.agentAvailable) {
|
|
30
|
+
console.error(`Error: ${result.adapterDisplayName} is not installed or not in PATH.`);
|
|
48
31
|
process.exit(1);
|
|
49
32
|
}
|
|
50
|
-
printDryRun(agent, artifacts, root);
|
|
51
|
-
|
|
52
|
-
console.log(
|
|
53
|
-
console.log(`Command: ${startCmd.command} ${startCmd.args.join(" ")}`);
|
|
33
|
+
printDryRun(agent, result.artifacts, result.root);
|
|
34
|
+
console.log(`\nStarting ${result.adapterDisplayName}...`);
|
|
35
|
+
console.log(`Command: ${result.startCommand.command} ${result.startCommand.args.join(" ")}`);
|
|
54
36
|
});
|
|
55
37
|
return cmd;
|
|
56
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,YAAY,GAGb,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,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AC;QAC5C,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACjC,IAAI,IAAI,EAAE,CAAC;gBACT,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,eAAe,IAAI,OAAO,CAoCzC"}
|
|
@@ -1,59 +1,31 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import {
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
import { detectSchemaType, detectSchemaFromValue, isValidSchemaType, validateJson, } from "@pulsemcp/air-core";
|
|
2
|
+
import { validateFile } from "@pulsemcp/air-sdk";
|
|
5
3
|
export function validateCommand() {
|
|
6
4
|
const cmd = new Command("validate")
|
|
7
5
|
.description("Validate a JSON file against its AIR schema")
|
|
8
6
|
.argument("<file>", "Path to the JSON file to validate")
|
|
9
7
|
.option("--schema <type>", "Override schema detection (air, skills, references, mcp, plugins, roots, hooks)")
|
|
10
8
|
.action((file, options) => {
|
|
11
|
-
const filePath = resolve(process.cwd(), file);
|
|
12
|
-
let data;
|
|
13
9
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const message = err instanceof Error ? err.message : "Unknown error";
|
|
19
|
-
console.error(`Error: Could not read or parse "${file}": ${message}`);
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
// Determine schema type: --schema flag > $schema in JSON > filename substring
|
|
23
|
-
let schemaType = null;
|
|
24
|
-
if (options.schema) {
|
|
25
|
-
if (!isValidSchemaType(options.schema)) {
|
|
26
|
-
console.error(`Error: Unknown schema type "${options.schema}". Valid types: air, skills, references, mcp, plugins, roots, hooks`);
|
|
27
|
-
process.exit(1);
|
|
10
|
+
const result = validateFile(file, { schema: options.schema });
|
|
11
|
+
if (result.valid) {
|
|
12
|
+
console.log(`\u2713 ${file} is valid (schema: ${result.schemaType})`);
|
|
13
|
+
process.exit(0);
|
|
28
14
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const schemaValue = data.$schema;
|
|
36
|
-
if (typeof schemaValue === "string") {
|
|
37
|
-
schemaType = detectSchemaFromValue(schemaValue);
|
|
15
|
+
else {
|
|
16
|
+
console.error(`\u2717 ${file} has validation errors (schema: ${result.schemaType}):`);
|
|
17
|
+
for (const error of result.validation.errors) {
|
|
18
|
+
console.error(` ${error.path}: ${error.message}`);
|
|
19
|
+
}
|
|
20
|
+
process.exit(1);
|
|
38
21
|
}
|
|
39
22
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
console.error(`Error: Could not detect schema type for "${file}". Use --schema to specify.`);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
const result = validateJson(data, schemaType);
|
|
48
|
-
if (result.valid) {
|
|
49
|
-
console.log(`\u2713 ${file} is valid (schema: ${schemaType})`);
|
|
50
|
-
process.exit(0);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
console.error(`\u2717 ${file} has validation errors (schema: ${schemaType}):`);
|
|
54
|
-
for (const error of result.errors) {
|
|
55
|
-
console.error(` ${error.path}: ${error.message}`);
|
|
23
|
+
catch (err) {
|
|
24
|
+
let message = err instanceof Error ? err.message : "Unknown error";
|
|
25
|
+
if (message.includes("Could not detect schema type")) {
|
|
26
|
+
message += " Use --schema to specify.";
|
|
56
27
|
}
|
|
28
|
+
console.error(`Error: ${message}`);
|
|
57
29
|
process.exit(1);
|
|
58
30
|
}
|
|
59
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;SAChC,WAAW,CAAC,6CAA6C,CAAC;SAC1D,QAAQ,CAAC,QAAQ,EAAE,mCAAmC,CAAC;SACvD,MAAM,CACL,iBAAiB,EACjB,iFAAiF,CAClF;SACA,MAAM,CAAC,CAAC,IAAY,EAAE,OAA4B,EAAE,EAAE;QACrD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAE9D,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBACjB,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC;gBACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CACX,UAAU,IAAI,mCAAmC,MAAM,CAAC,UAAU,IAAI,CACvE,CAAC;gBACF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;oBAC7C,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACrD,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,OAAO,GACT,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACvD,IAAI,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAC,EAAE,CAAC;gBACrD,OAAO,IAAI,2BAA2B,CAAC;YACzC,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulsemcp/air-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
"lint": "tsc --noEmit"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@pulsemcp/air-
|
|
30
|
-
"@pulsemcp/air-adapter-claude": "0.0.3",
|
|
29
|
+
"@pulsemcp/air-sdk": "0.0.4",
|
|
31
30
|
"commander": "^12.1.0",
|
|
32
31
|
"chalk": "^5.3.0"
|
|
33
32
|
},
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AgentAdapter } from "@pulsemcp/air-core";
|
|
2
|
-
/**
|
|
3
|
-
* Find an adapter by agent name.
|
|
4
|
-
* Returns null if the adapter package isn't installed.
|
|
5
|
-
*/
|
|
6
|
-
export declare function findAdapter(name: string): Promise<AgentAdapter | null>;
|
|
7
|
-
/**
|
|
8
|
-
* List all available adapter names (installed packages only).
|
|
9
|
-
*/
|
|
10
|
-
export declare function listAvailableAdapters(): Promise<string[]>;
|
|
11
|
-
//# sourceMappingURL=adapter-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-registry.d.ts","sourceRoot":"","sources":["../src/adapter-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAC;AAUrE;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAsB9B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAW/D"}
|
package/dist/adapter-registry.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Known adapter packages. The CLI tries to dynamically import each one.
|
|
3
|
-
* If the package is installed, its adapter is available. If not, it's skipped.
|
|
4
|
-
*/
|
|
5
|
-
const KNOWN_ADAPTERS = [
|
|
6
|
-
{ name: "claude", packageName: "@pulsemcp/air-adapter-claude" },
|
|
7
|
-
];
|
|
8
|
-
/**
|
|
9
|
-
* Find an adapter by agent name.
|
|
10
|
-
* Returns null if the adapter package isn't installed.
|
|
11
|
-
*/
|
|
12
|
-
export async function findAdapter(name) {
|
|
13
|
-
// Check known adapters first
|
|
14
|
-
for (const known of KNOWN_ADAPTERS) {
|
|
15
|
-
if (known.name === name) {
|
|
16
|
-
try {
|
|
17
|
-
const mod = await import(known.packageName);
|
|
18
|
-
const ext = mod.default;
|
|
19
|
-
return ext?.adapter ?? null;
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// Try convention-based package name: @pulsemcp/air-adapter-{name}
|
|
27
|
-
try {
|
|
28
|
-
const mod = await import(`@pulsemcp/air-adapter-${name}`);
|
|
29
|
-
const ext = mod.default;
|
|
30
|
-
return ext?.adapter ?? null;
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* List all available adapter names (installed packages only).
|
|
38
|
-
*/
|
|
39
|
-
export async function listAvailableAdapters() {
|
|
40
|
-
const available = [];
|
|
41
|
-
for (const known of KNOWN_ADAPTERS) {
|
|
42
|
-
try {
|
|
43
|
-
await import(known.packageName);
|
|
44
|
-
available.push(known.name);
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
// Not installed
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return available;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=adapter-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-registry.js","sourceRoot":"","sources":["../src/adapter-registry.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,cAAc,GAA4C;IAC9D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;CAChE,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAY;IAEZ,6BAA6B;IAC7B,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;QACnC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAC5C,MAAM,GAAG,GAAG,GAAG,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