@pulsemcp/air-sdk 0.0.11 → 0.0.13
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/extension-loader.d.ts.map +1 -1
- package/dist/extension-loader.js +26 -2
- package/dist/extension-loader.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/init-from-repo.d.ts +101 -0
- package/dist/init-from-repo.d.ts.map +1 -0
- package/dist/init-from-repo.js +328 -0
- package/dist/init-from-repo.js.map +1 -0
- package/dist/init.d.ts +1 -4
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +3 -29
- package/dist/init.js.map +1 -1
- package/dist/prepare.d.ts +3 -3
- package/dist/prepare.d.ts.map +1 -1
- package/dist/prepare.js +12 -12
- package/dist/prepare.js.map +1 -1
- package/dist/start.d.ts.map +1 -1
- package/dist/start.js +16 -4
- package/dist/start.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-loader.d.ts","sourceRoot":"","sources":["../src/extension-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension-loader.d.ts","sourceRoot":"","sources":["../src/extension-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,oBAAoB,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,yCAAyC;IACzC,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,iEAAiE;IACjE,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,iDAAiD;IACjD,GAAG,EAAE,YAAY,EAAE,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAAE,EACpB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAiB3B"}
|
package/dist/extension-loader.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
import { join, resolve } from "path";
|
|
2
3
|
import { pathToFileURL } from "url";
|
|
3
4
|
/**
|
|
4
5
|
* Load extensions from the `extensions` array in air.json.
|
|
@@ -40,7 +41,30 @@ async function loadSingleExtension(specifier, airJsonDir) {
|
|
|
40
41
|
mod = await import(fileUrl);
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
|
-
|
|
44
|
+
// Try resolving npm packages from the project directory (airJsonDir)
|
|
45
|
+
// first, then fall back to the SDK's own resolution. When the CLI is
|
|
46
|
+
// installed globally, `air install` puts packages under
|
|
47
|
+
// <airJsonDir>/node_modules/ which Node's default resolution from the
|
|
48
|
+
// SDK bundle would never find. The fallback covers the local
|
|
49
|
+
// development / workspace case where packages live in the SDK's own
|
|
50
|
+
// node_modules tree.
|
|
51
|
+
try {
|
|
52
|
+
const projectRequire = createRequire(join(airJsonDir, "__placeholder.js"));
|
|
53
|
+
const resolved = projectRequire.resolve(specifier);
|
|
54
|
+
mod = await import(pathToFileURL(resolved).href);
|
|
55
|
+
}
|
|
56
|
+
catch (projectErr) {
|
|
57
|
+
// Only fall back to SDK-local resolution when the package wasn't
|
|
58
|
+
// found in the project directory. Re-throw other errors (e.g.
|
|
59
|
+
// syntax errors in the resolved module) so they aren't masked.
|
|
60
|
+
const code = projectErr?.code;
|
|
61
|
+
if (code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND") {
|
|
62
|
+
mod = await import(specifier);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
throw projectErr;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
44
68
|
}
|
|
45
69
|
}
|
|
46
70
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-loader.js","sourceRoot":"","sources":["../src/extension-loader.ts"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G,GAAG,CAAC,OAAO,CAAC;IAElC,2DAA2D;IAC3D,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;QACxC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,SAAS,EAAE;gBACT,SAAS,EAAE,aAA8C;aAC1D;SACF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,aAAa,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,cAAc,SAAS,0CAA0C;YAC/D,0DAA0D,CAC7D,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,aAA6B,CAAC;IAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,cAAc,SAAS,uCAAuC,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { validateFile } from "./validate.js";
|
|
|
6
6
|
export type { ValidateFileOptions, ValidateFileResult } from "./validate.js";
|
|
7
7
|
export { initConfig } from "./init.js";
|
|
8
8
|
export type { InitConfigOptions, InitConfigResult } from "./init.js";
|
|
9
|
+
export { initFromRepo, smartInit, InitFromRepoError } from "./init-from-repo.js";
|
|
10
|
+
export type { InitFromRepoOptions, InitFromRepoResult, InitFromRepoErrorCode, DiscoveredArtifact, SmartInitResult, } from "./init-from-repo.js";
|
|
9
11
|
export { listArtifacts, VALID_ARTIFACT_TYPES } from "./list.js";
|
|
10
12
|
export type { ArtifactType, ListArtifactsOptions, ListArtifactsResult } from "./list.js";
|
|
11
13
|
export { startSession } from "./start.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,qBAAqB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6 +13,7 @@ export { normalizeGitUrl, detectRoot } from "./root-detection.js";
|
|
|
13
13
|
// High-level operations
|
|
14
14
|
export { validateFile } from "./validate.js";
|
|
15
15
|
export { initConfig } from "./init.js";
|
|
16
|
+
export { initFromRepo, smartInit, InitFromRepoError } from "./init-from-repo.js";
|
|
16
17
|
export { listArtifacts, VALID_ARTIFACT_TYPES } from "./list.js";
|
|
17
18
|
export { startSession } from "./start.js";
|
|
18
19
|
export { prepareSession } from "./prepare.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO;AACL,oBAAoB;AACpB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,cAAc;AACd,aAAa;AACb,YAAY;AACZ,UAAU;AACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAoC5B,mBAAmB;AACnB,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,iBAAiB;AACjB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,wBAAwB;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,sBAAsB;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMjD,mBAAmB;AACnB,OAAO,EAAE,cAAc,EAAE,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AAC;AAGtD,oBAAoB;AACpB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type SchemaType } from "@pulsemcp/air-core";
|
|
2
|
+
/** Error codes for `initFromRepo` failures. */
|
|
3
|
+
export type InitFromRepoErrorCode = "EXISTS" | "NO_GIT" | "NO_REMOTE" | "NO_GITHUB" | "NO_ARTIFACTS";
|
|
4
|
+
/**
|
|
5
|
+
* Typed error thrown by `initFromRepo` for classifiable failure conditions.
|
|
6
|
+
* Consumers can switch on `code` instead of matching error messages.
|
|
7
|
+
*/
|
|
8
|
+
export declare class InitFromRepoError extends Error {
|
|
9
|
+
readonly code: InitFromRepoErrorCode;
|
|
10
|
+
constructor(message: string, code: InitFromRepoErrorCode);
|
|
11
|
+
}
|
|
12
|
+
export interface InitFromRepoOptions {
|
|
13
|
+
/** Working directory (must be inside a git repo). Defaults to process.cwd(). */
|
|
14
|
+
cwd?: string;
|
|
15
|
+
/** Path for the generated air.json. Defaults to ~/.air/air.json. */
|
|
16
|
+
path?: string;
|
|
17
|
+
/** Overwrite existing air.json if it exists. */
|
|
18
|
+
force?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface DiscoveredArtifact {
|
|
21
|
+
/** Artifact type (skills, references, mcp, etc.) */
|
|
22
|
+
type: SchemaType;
|
|
23
|
+
/** Path relative to repo root. */
|
|
24
|
+
repoPath: string;
|
|
25
|
+
/** Generated github:// URI. */
|
|
26
|
+
uri: string;
|
|
27
|
+
}
|
|
28
|
+
export interface InitFromRepoResult {
|
|
29
|
+
/** Absolute path to the created air.json. */
|
|
30
|
+
airJsonPath: string;
|
|
31
|
+
/** Absolute path to the AIR config directory. */
|
|
32
|
+
airDir: string;
|
|
33
|
+
/** GitHub owner/repo detected from git remote. */
|
|
34
|
+
repo: string;
|
|
35
|
+
/** Branch used for github:// URIs. */
|
|
36
|
+
branch: string;
|
|
37
|
+
/** Discovered artifact files grouped by type. */
|
|
38
|
+
discovered: DiscoveredArtifact[];
|
|
39
|
+
/** Whether an existing config was overwritten. */
|
|
40
|
+
overwritten: boolean;
|
|
41
|
+
/** Absolute path to the auto-generated roots.json, if created. */
|
|
42
|
+
generatedRootsPath: string;
|
|
43
|
+
/** Name/key of the auto-generated root entry. */
|
|
44
|
+
generatedRootName: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Parse a git remote URL and extract the GitHub owner/repo.
|
|
48
|
+
* Supports HTTPS and SSH formats.
|
|
49
|
+
*
|
|
50
|
+
* @returns "owner/repo" string
|
|
51
|
+
* @throws Error if the URL is not a github.com URL
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseGitHubRemote(remoteUrl: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Detect the default branch name for the remote.
|
|
56
|
+
*
|
|
57
|
+
* Tries `git symbolic-ref refs/remotes/origin/HEAD` first,
|
|
58
|
+
* then checks for common branch names (main, master).
|
|
59
|
+
* Falls back to "main".
|
|
60
|
+
*/
|
|
61
|
+
export declare function detectDefaultBranch(cwd: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Discover AIR artifact index files in the git repository.
|
|
64
|
+
*
|
|
65
|
+
* Lists tracked JSON files via `git ls-files`, detects their schema type
|
|
66
|
+
* by filename, and validates them against the schema. Returns only files
|
|
67
|
+
* that are valid artifact indexes.
|
|
68
|
+
*/
|
|
69
|
+
export declare function discoverArtifacts(repoRoot: string, repo: string, branch: string): DiscoveredArtifact[];
|
|
70
|
+
/**
|
|
71
|
+
* Initialize an AIR config from artifact files discovered in a git repository.
|
|
72
|
+
*
|
|
73
|
+
* Scans the git repo for artifact index files (skills.json, mcp.json, etc.),
|
|
74
|
+
* detects the GitHub remote, and generates an air.json with github:// URIs
|
|
75
|
+
* pointing to the repository's default branch.
|
|
76
|
+
*
|
|
77
|
+
* Also auto-generates a roots.json entry describing the current repo,
|
|
78
|
+
* populated with default_skills, default_mcp_servers, and default_hooks
|
|
79
|
+
* from the discovered artifacts.
|
|
80
|
+
*
|
|
81
|
+
* @throws Error if not in a git repo, no GitHub remote, no artifacts found,
|
|
82
|
+
* or air.json already exists (unless force is true).
|
|
83
|
+
*/
|
|
84
|
+
export declare function initFromRepo(options?: InitFromRepoOptions): InitFromRepoResult;
|
|
85
|
+
/** Result from `smartInit` — discriminated by `mode`. */
|
|
86
|
+
export type SmartInitResult = ({
|
|
87
|
+
mode: "repo";
|
|
88
|
+
} & InitFromRepoResult) | {
|
|
89
|
+
mode: "blank";
|
|
90
|
+
airJsonPath: string;
|
|
91
|
+
airDir: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* High-level init that tries repo-based discovery first and falls back to
|
|
95
|
+
* blank scaffolding when no git context or artifacts are available.
|
|
96
|
+
*
|
|
97
|
+
* @throws InitFromRepoError with code "EXISTS" if config exists and force is false.
|
|
98
|
+
* @throws Error for unexpected failures.
|
|
99
|
+
*/
|
|
100
|
+
export declare function smartInit(options?: InitFromRepoOptions): SmartInitResult;
|
|
101
|
+
//# sourceMappingURL=init-from-repo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-from-repo.d.ts","sourceRoot":"","sources":["../src/init-from-repo.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAQ5B,+CAA+C;AAC/C,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,WAAW,GACX,cAAc,CAAC;AAEnB;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;aAGxB,IAAI,EAAE,qBAAqB;gBAD3C,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,qBAAqB;CAK9C;AAED,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CA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,CAAC;CAChB,CAAC;AAEN;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,eAAe,CA4BxE"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { execFileSync } from "child_process";
|
|
2
|
+
import { readFileSync, existsSync, writeFileSync, mkdirSync, unlinkSync, } from "fs";
|
|
3
|
+
import { resolve, dirname } from "path";
|
|
4
|
+
import { getDefaultAirJsonPath, detectSchemaType, getAllSchemaTypes, validateJson, } from "@pulsemcp/air-core";
|
|
5
|
+
import { initConfig } from "./init.js";
|
|
6
|
+
/** Artifact types that map to air.json properties (all schema types except "air"). */
|
|
7
|
+
const ARTIFACT_TYPES = getAllSchemaTypes().filter((t) => t !== "air");
|
|
8
|
+
/**
|
|
9
|
+
* Typed error thrown by `initFromRepo` for classifiable failure conditions.
|
|
10
|
+
* Consumers can switch on `code` instead of matching error messages.
|
|
11
|
+
*/
|
|
12
|
+
export class InitFromRepoError extends Error {
|
|
13
|
+
code;
|
|
14
|
+
constructor(message, code) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.name = "InitFromRepoError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the git repository root directory.
|
|
22
|
+
*/
|
|
23
|
+
function getRepoRoot(cwd) {
|
|
24
|
+
return execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
25
|
+
cwd,
|
|
26
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
27
|
+
encoding: "utf-8",
|
|
28
|
+
}).trim();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parse a git remote URL and extract the GitHub owner/repo.
|
|
32
|
+
* Supports HTTPS and SSH formats.
|
|
33
|
+
*
|
|
34
|
+
* @returns "owner/repo" string
|
|
35
|
+
* @throws Error if the URL is not a github.com URL
|
|
36
|
+
*/
|
|
37
|
+
export function parseGitHubRemote(remoteUrl) {
|
|
38
|
+
const trimmed = remoteUrl.trim();
|
|
39
|
+
// SSH: git@github.com:owner/repo.git
|
|
40
|
+
const sshMatch = trimmed.match(/^git@github\.com:(.+?)(?:\.git)?$/);
|
|
41
|
+
if (sshMatch)
|
|
42
|
+
return sshMatch[1];
|
|
43
|
+
// HTTPS: https://github.com/owner/repo.git
|
|
44
|
+
const httpsMatch = trimmed.match(/^https?:\/\/github\.com\/(.+?)(?:\.git)?$/);
|
|
45
|
+
if (httpsMatch)
|
|
46
|
+
return httpsMatch[1];
|
|
47
|
+
throw new Error(`Could not parse GitHub owner/repo from remote URL: "${trimmed}"\n` +
|
|
48
|
+
`Expected a github.com URL (HTTPS or SSH).`);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the git remote URL for the given remote name.
|
|
52
|
+
*/
|
|
53
|
+
function getRemoteUrl(cwd, remote = "origin") {
|
|
54
|
+
return execFileSync("git", ["remote", "get-url", remote], {
|
|
55
|
+
cwd,
|
|
56
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
57
|
+
encoding: "utf-8",
|
|
58
|
+
}).trim();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Detect the default branch name for the remote.
|
|
62
|
+
*
|
|
63
|
+
* Tries `git symbolic-ref refs/remotes/origin/HEAD` first,
|
|
64
|
+
* then checks for common branch names (main, master).
|
|
65
|
+
* Falls back to "main".
|
|
66
|
+
*/
|
|
67
|
+
export function detectDefaultBranch(cwd) {
|
|
68
|
+
// Try symbolic-ref (works when remote HEAD is set)
|
|
69
|
+
try {
|
|
70
|
+
const ref = execFileSync("git", ["symbolic-ref", "refs/remotes/origin/HEAD"], {
|
|
71
|
+
cwd,
|
|
72
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
73
|
+
encoding: "utf-8",
|
|
74
|
+
}).trim();
|
|
75
|
+
const branch = ref.replace(/^refs\/remotes\/origin\//, "");
|
|
76
|
+
if (branch)
|
|
77
|
+
return branch;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Ignore — try fallbacks
|
|
81
|
+
}
|
|
82
|
+
// Probe common branch names
|
|
83
|
+
for (const branch of ["main", "master"]) {
|
|
84
|
+
try {
|
|
85
|
+
execFileSync("git", ["rev-parse", "--verify", `origin/${branch}`], {
|
|
86
|
+
cwd,
|
|
87
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
88
|
+
encoding: "utf-8",
|
|
89
|
+
});
|
|
90
|
+
return branch;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// continue
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return "main";
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Discover AIR artifact index files in the git repository.
|
|
100
|
+
*
|
|
101
|
+
* Lists tracked JSON files via `git ls-files`, detects their schema type
|
|
102
|
+
* by filename, and validates them against the schema. Returns only files
|
|
103
|
+
* that are valid artifact indexes.
|
|
104
|
+
*/
|
|
105
|
+
export function discoverArtifacts(repoRoot, repo, branch) {
|
|
106
|
+
let output;
|
|
107
|
+
try {
|
|
108
|
+
output = execFileSync("git", ["ls-files", "--", "*.json"], {
|
|
109
|
+
cwd: repoRoot,
|
|
110
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
111
|
+
encoding: "utf-8",
|
|
112
|
+
}).trim();
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
if (!output)
|
|
118
|
+
return [];
|
|
119
|
+
const jsonFiles = output.split("\n").filter(Boolean);
|
|
120
|
+
const discovered = [];
|
|
121
|
+
for (const file of jsonFiles) {
|
|
122
|
+
// Skip files in node_modules or hidden directories (root or nested)
|
|
123
|
+
if (file.includes("node_modules/") || /(?:^|\/)\./.test(file))
|
|
124
|
+
continue;
|
|
125
|
+
const schemaType = detectSchemaType(file);
|
|
126
|
+
// Skip non-artifact files and air.json configs
|
|
127
|
+
if (!schemaType || schemaType === "air")
|
|
128
|
+
continue;
|
|
129
|
+
if (!ARTIFACT_TYPES.includes(schemaType))
|
|
130
|
+
continue;
|
|
131
|
+
// Validate the file actually matches the schema
|
|
132
|
+
const filePath = resolve(repoRoot, file);
|
|
133
|
+
try {
|
|
134
|
+
const content = readFileSync(filePath, "utf-8");
|
|
135
|
+
const data = JSON.parse(content);
|
|
136
|
+
const result = validateJson(data, schemaType);
|
|
137
|
+
if (!result.valid)
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
discovered.push({
|
|
144
|
+
type: schemaType,
|
|
145
|
+
repoPath: file,
|
|
146
|
+
uri: `github://${repo}@${branch}/${file}`,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return discovered;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Extract artifact entry IDs from discovered artifact files.
|
|
153
|
+
* Reads each file, parses the JSON, and collects the top-level keys (IDs).
|
|
154
|
+
*/
|
|
155
|
+
function extractArtifactIds(discovered, repoRoot) {
|
|
156
|
+
const ids = {};
|
|
157
|
+
for (const artifact of discovered) {
|
|
158
|
+
const filePath = resolve(repoRoot, artifact.repoPath);
|
|
159
|
+
try {
|
|
160
|
+
const content = readFileSync(filePath, "utf-8");
|
|
161
|
+
const data = JSON.parse(content);
|
|
162
|
+
const { $schema, ...entries } = data;
|
|
163
|
+
const entryIds = Object.keys(entries);
|
|
164
|
+
if (entryIds.length > 0) {
|
|
165
|
+
if (!ids[artifact.type])
|
|
166
|
+
ids[artifact.type] = [];
|
|
167
|
+
ids[artifact.type].push(...entryIds);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return ids;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Initialize an AIR config from artifact files discovered in a git repository.
|
|
178
|
+
*
|
|
179
|
+
* Scans the git repo for artifact index files (skills.json, mcp.json, etc.),
|
|
180
|
+
* detects the GitHub remote, and generates an air.json with github:// URIs
|
|
181
|
+
* pointing to the repository's default branch.
|
|
182
|
+
*
|
|
183
|
+
* Also auto-generates a roots.json entry describing the current repo,
|
|
184
|
+
* populated with default_skills, default_mcp_servers, and default_hooks
|
|
185
|
+
* from the discovered artifacts.
|
|
186
|
+
*
|
|
187
|
+
* @throws Error if not in a git repo, no GitHub remote, no artifacts found,
|
|
188
|
+
* or air.json already exists (unless force is true).
|
|
189
|
+
*/
|
|
190
|
+
export function initFromRepo(options) {
|
|
191
|
+
const cwd = options?.cwd ?? process.cwd();
|
|
192
|
+
const airJsonPath = options?.path ?? getDefaultAirJsonPath();
|
|
193
|
+
const force = options?.force ?? false;
|
|
194
|
+
const airDir = dirname(airJsonPath);
|
|
195
|
+
// Check for existing config
|
|
196
|
+
const overwritten = existsSync(airJsonPath);
|
|
197
|
+
if (overwritten && !force) {
|
|
198
|
+
throw new InitFromRepoError(`${airJsonPath} already exists.`, "EXISTS");
|
|
199
|
+
}
|
|
200
|
+
// Get repo root
|
|
201
|
+
let repoRoot;
|
|
202
|
+
try {
|
|
203
|
+
repoRoot = getRepoRoot(cwd);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
throw new InitFromRepoError("Not inside a git repository. Run this command from within a git repo " +
|
|
207
|
+
"that contains AIR artifact index files.", "NO_GIT");
|
|
208
|
+
}
|
|
209
|
+
// Get GitHub remote
|
|
210
|
+
let remoteUrl;
|
|
211
|
+
try {
|
|
212
|
+
remoteUrl = getRemoteUrl(cwd);
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
throw new InitFromRepoError("No git remote named 'origin' found. " +
|
|
216
|
+
"Add a GitHub remote with: git remote add origin <url>", "NO_REMOTE");
|
|
217
|
+
}
|
|
218
|
+
let repo;
|
|
219
|
+
try {
|
|
220
|
+
repo = parseGitHubRemote(remoteUrl);
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
throw new InitFromRepoError(err instanceof Error ? err.message : String(err), "NO_GITHUB");
|
|
224
|
+
}
|
|
225
|
+
const branch = detectDefaultBranch(cwd);
|
|
226
|
+
const discovered = discoverArtifacts(repoRoot, repo, branch);
|
|
227
|
+
if (discovered.length === 0) {
|
|
228
|
+
throw new InitFromRepoError("No AIR artifact index files found in this repository.\n" +
|
|
229
|
+
"Expected files like skills.json, mcp.json, references.json, etc.", "NO_ARTIFACTS");
|
|
230
|
+
}
|
|
231
|
+
// Group URIs by artifact type
|
|
232
|
+
const grouped = {};
|
|
233
|
+
for (const artifact of discovered) {
|
|
234
|
+
if (!grouped[artifact.type]) {
|
|
235
|
+
grouped[artifact.type] = [];
|
|
236
|
+
}
|
|
237
|
+
grouped[artifact.type].push(artifact.uri);
|
|
238
|
+
}
|
|
239
|
+
// Derive config name from repo name
|
|
240
|
+
const repoName = repo.split("/")[1] || "my-config";
|
|
241
|
+
const configName = repoName.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
242
|
+
// Auto-generate roots.json for the current repo
|
|
243
|
+
const artifactIds = extractArtifactIds(discovered, repoRoot);
|
|
244
|
+
const rootEntry = {
|
|
245
|
+
display_name: configName,
|
|
246
|
+
description: `Agent root for ${repo}.`,
|
|
247
|
+
url: remoteUrl.trim(),
|
|
248
|
+
default_branch: branch,
|
|
249
|
+
...(artifactIds.skills?.length && { default_skills: artifactIds.skills }),
|
|
250
|
+
...(artifactIds.mcp?.length && { default_mcp_servers: artifactIds.mcp }),
|
|
251
|
+
...(artifactIds.plugins?.length && { default_plugins: artifactIds.plugins }),
|
|
252
|
+
...(artifactIds.hooks?.length && { default_hooks: artifactIds.hooks }),
|
|
253
|
+
};
|
|
254
|
+
const rootsDir = resolve(airDir, "roots");
|
|
255
|
+
mkdirSync(rootsDir, { recursive: true });
|
|
256
|
+
const rootsJson = {
|
|
257
|
+
$schema: "https://raw.githubusercontent.com/pulsemcp/air/main/schemas/roots.schema.json",
|
|
258
|
+
[configName]: rootEntry,
|
|
259
|
+
};
|
|
260
|
+
const rootsPath = resolve(rootsDir, "roots.json");
|
|
261
|
+
writeFileSync(rootsPath, JSON.stringify(rootsJson, null, 2) + "\n");
|
|
262
|
+
// Build air.json — include auto-generated roots.json first, then discovered
|
|
263
|
+
const airJson = {
|
|
264
|
+
name: configName,
|
|
265
|
+
extensions: ["@pulsemcp/air-provider-github"],
|
|
266
|
+
};
|
|
267
|
+
for (const type of ARTIFACT_TYPES) {
|
|
268
|
+
if (type === "roots") {
|
|
269
|
+
// Combine auto-generated local roots with any discovered roots
|
|
270
|
+
airJson.roots = [
|
|
271
|
+
"./roots/roots.json",
|
|
272
|
+
...(grouped.roots || []),
|
|
273
|
+
];
|
|
274
|
+
}
|
|
275
|
+
else if (grouped[type]) {
|
|
276
|
+
airJson[type] = grouped[type];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// Write config
|
|
280
|
+
mkdirSync(airDir, { recursive: true });
|
|
281
|
+
writeFileSync(airJsonPath, JSON.stringify(airJson, null, 2) + "\n");
|
|
282
|
+
return {
|
|
283
|
+
airJsonPath,
|
|
284
|
+
airDir,
|
|
285
|
+
repo,
|
|
286
|
+
branch,
|
|
287
|
+
discovered,
|
|
288
|
+
overwritten,
|
|
289
|
+
generatedRootsPath: rootsPath,
|
|
290
|
+
generatedRootName: configName,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* High-level init that tries repo-based discovery first and falls back to
|
|
295
|
+
* blank scaffolding when no git context or artifacts are available.
|
|
296
|
+
*
|
|
297
|
+
* @throws InitFromRepoError with code "EXISTS" if config exists and force is false.
|
|
298
|
+
* @throws Error for unexpected failures.
|
|
299
|
+
*/
|
|
300
|
+
export function smartInit(options) {
|
|
301
|
+
const force = options?.force ?? false;
|
|
302
|
+
try {
|
|
303
|
+
const result = initFromRepo(options);
|
|
304
|
+
return { mode: "repo", ...result };
|
|
305
|
+
}
|
|
306
|
+
catch (err) {
|
|
307
|
+
if (!(err instanceof InitFromRepoError))
|
|
308
|
+
throw err;
|
|
309
|
+
// Config already exists — don't silently fall back
|
|
310
|
+
if (err.code === "EXISTS")
|
|
311
|
+
throw err;
|
|
312
|
+
// Fallback conditions: no git, no remote, non-GitHub remote, no artifacts
|
|
313
|
+
if (force) {
|
|
314
|
+
const targetPath = options?.path ?? getDefaultAirJsonPath();
|
|
315
|
+
if (existsSync(targetPath)) {
|
|
316
|
+
unlinkSync(targetPath);
|
|
317
|
+
}
|
|
318
|
+
// Clean up auto-generated roots.json from a previous repo-mode init
|
|
319
|
+
const rootsPath = resolve(dirname(targetPath), "roots", "roots.json");
|
|
320
|
+
if (existsSync(rootsPath)) {
|
|
321
|
+
unlinkSync(rootsPath);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const result = initConfig({ path: options?.path });
|
|
325
|
+
return { mode: "blank", ...result };
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=init-from-repo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-from-repo.js","sourceRoot":"","sources":["../src/init-from-repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,UAAU,EACV,aAAa,EACb,SAAS,EACT,UAAU,GACX,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GAGb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,sFAAsF;AACtF,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC,MAAM,CAC/C,CAAC,CAAC,EAAmC,EAAE,CAAC,CAAC,KAAK,KAAK,CACpD,CAAC;AAUF;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ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UAAU;KAC9B,CAAC;AACJ,CAAC;AAWD;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,OAA6B;IACrD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,KAAK,CAAC;IAEtC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,CAAC,GAAG,YAAY,iBAAiB,CAAC;YAAE,MAAM,GAAG,CAAC;QAEnD,mDAAmD;QACnD,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,GAAG,CAAC;QAErC,0EAA0E;QAC1E,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,UAAU,GAAG,OAAO,EAAE,IAAI,IAAI,qBAAqB,EAAE,CAAC;YAC5D,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC3B,UAAU,CAAC,UAAU,CAAC,CAAC;YACzB,CAAC;YACD,oEAAoE;YACpE,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;YACtE,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC1B,UAAU,CAAC,SAAS,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IACtC,CAAC;AACH,CAAC"}
|
package/dist/init.d.ts
CHANGED
|
@@ -7,14 +7,11 @@ export interface InitConfigResult {
|
|
|
7
7
|
airJsonPath: string;
|
|
8
8
|
/** Absolute path to the AIR config directory. */
|
|
9
9
|
airDir: string;
|
|
10
|
-
/** List of files in the config directory (relative to airDir). */
|
|
11
|
-
files: string[];
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* Initialize a new AIR configuration directory.
|
|
15
13
|
*
|
|
16
|
-
* Creates air.json
|
|
17
|
-
* path (defaults to ~/.air/).
|
|
14
|
+
* Creates a minimal air.json at the specified path (defaults to ~/.air/).
|
|
18
15
|
*
|
|
19
16
|
* @throws Error if air.json already exists at the target path.
|
|
20
17
|
*/
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAiBxE"}
|
package/dist/init.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { writeFileSync, existsSync, mkdirSync } from "fs";
|
|
2
|
-
import {
|
|
2
|
+
import { dirname } from "path";
|
|
3
3
|
import { getDefaultAirJsonPath } from "@pulsemcp/air-core";
|
|
4
4
|
/**
|
|
5
5
|
* Initialize a new AIR configuration directory.
|
|
6
6
|
*
|
|
7
|
-
* Creates air.json
|
|
8
|
-
* path (defaults to ~/.air/).
|
|
7
|
+
* Creates a minimal air.json at the specified path (defaults to ~/.air/).
|
|
9
8
|
*
|
|
10
9
|
* @throws Error if air.json already exists at the target path.
|
|
11
10
|
*/
|
|
@@ -18,33 +17,8 @@ export function initConfig(options) {
|
|
|
18
17
|
mkdirSync(airDir, { recursive: true });
|
|
19
18
|
const airJson = {
|
|
20
19
|
name: "my-config",
|
|
21
|
-
description: "",
|
|
22
|
-
skills: ["./skills/skills.json"],
|
|
23
|
-
references: ["./references/references.json"],
|
|
24
|
-
mcp: ["./mcp/mcp.json"],
|
|
25
|
-
plugins: ["./plugins/plugins.json"],
|
|
26
|
-
roots: ["./roots/roots.json"],
|
|
27
|
-
hooks: ["./hooks/hooks.json"],
|
|
28
20
|
};
|
|
29
|
-
const emptyIndex = () => "{}\n";
|
|
30
21
|
writeFileSync(airJsonPath, JSON.stringify(airJson, null, 2) + "\n");
|
|
31
|
-
|
|
32
|
-
["skills/skills.json", emptyIndex()],
|
|
33
|
-
["references/references.json", emptyIndex()],
|
|
34
|
-
["mcp/mcp.json", emptyIndex()],
|
|
35
|
-
["plugins/plugins.json", emptyIndex()],
|
|
36
|
-
["roots/roots.json", emptyIndex()],
|
|
37
|
-
["hooks/hooks.json", emptyIndex()],
|
|
38
|
-
];
|
|
39
|
-
const files = ["air.json"];
|
|
40
|
-
for (const [filename, content] of indexFiles) {
|
|
41
|
-
const filePath = resolve(airDir, filename);
|
|
42
|
-
mkdirSync(dirname(filePath), { recursive: true });
|
|
43
|
-
if (!existsSync(filePath)) {
|
|
44
|
-
writeFileSync(filePath, content);
|
|
45
|
-
}
|
|
46
|
-
files.push(filename);
|
|
47
|
-
}
|
|
48
|
-
return { airJsonPath, airDir, files };
|
|
22
|
+
return { airJsonPath, airDir };
|
|
49
23
|
}
|
|
50
24
|
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAc3D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAA2B;IACpD,MAAM,WAAW,GAAG,OAAO,EAAE,IAAI,IAAI,qBAAqB,EAAE,CAAC;IAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpC,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW,kBAAkB,CAAC,CAAC;IACpD,CAAC;IAED,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvC,MAAM,OAAO,GAAG;QACd,IAAI,EAAE,WAAW;KAClB,CAAC;IAEF,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/prepare.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export interface PrepareSessionOptions {
|
|
|
7
7
|
root?: string;
|
|
8
8
|
/** Target directory to prepare. Defaults to process.cwd(). */
|
|
9
9
|
target?: string;
|
|
10
|
-
/** Agent adapter name.
|
|
11
|
-
adapter
|
|
10
|
+
/** Agent adapter name (e.g., "claude"). Required. */
|
|
11
|
+
adapter: string;
|
|
12
12
|
/** Skill IDs to activate (overrides root defaults). */
|
|
13
13
|
skills?: string[];
|
|
14
14
|
/** MCP server IDs to activate (overrides root defaults). */
|
|
@@ -53,5 +53,5 @@ export interface PrepareSessionResult {
|
|
|
53
53
|
*
|
|
54
54
|
* @throws Error if the adapter is not found, air.json is not found, or the specified root doesn't exist.
|
|
55
55
|
*/
|
|
56
|
-
export declare function prepareSession(options
|
|
56
|
+
export declare function prepareSession(options: PrepareSessionOptions): Promise<PrepareSessionResult>;
|
|
57
57
|
//# sourceMappingURL=prepare.d.ts.map
|
package/dist/prepare.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAS9E,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAS9E,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,OAAO,EAAE,eAAe,CAAC;IACzB,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAsG/B"}
|
package/dist/prepare.js
CHANGED
|
@@ -16,13 +16,13 @@ import { findUnresolvedVars, unresolvedVarsMessage, } from "./validate-config.js
|
|
|
16
16
|
* @throws Error if the adapter is not found, air.json is not found, or the specified root doesn't exist.
|
|
17
17
|
*/
|
|
18
18
|
export async function prepareSession(options) {
|
|
19
|
-
const airJsonPath = options
|
|
19
|
+
const airJsonPath = options.config ?? getAirJsonPath();
|
|
20
20
|
if (!airJsonPath) {
|
|
21
21
|
throw new Error("No air.json found. Specify a config path or set AIR_CONFIG env var.");
|
|
22
22
|
}
|
|
23
23
|
// Use pre-loaded extensions or load from air.json
|
|
24
24
|
let loaded;
|
|
25
|
-
if (options
|
|
25
|
+
if (options.extensions) {
|
|
26
26
|
loaded = options.extensions;
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
@@ -31,7 +31,7 @@ export async function prepareSession(options) {
|
|
|
31
31
|
loaded = await loadExtensions(airConfig.extensions || [], airJsonDir);
|
|
32
32
|
}
|
|
33
33
|
// Find adapter: prefer extension-provided, fall back to registry
|
|
34
|
-
const adapterName = options
|
|
34
|
+
const adapterName = options.adapter;
|
|
35
35
|
let adapter = loaded.adapters.find((ext) => ext.adapter?.name === adapterName)?.adapter ??
|
|
36
36
|
null;
|
|
37
37
|
if (!adapter) {
|
|
@@ -52,25 +52,25 @@ export async function prepareSession(options) {
|
|
|
52
52
|
// Detect or validate root
|
|
53
53
|
let root;
|
|
54
54
|
let rootAutoDetected = false;
|
|
55
|
-
if (options
|
|
55
|
+
if (options.root) {
|
|
56
56
|
root = artifacts.roots[options.root];
|
|
57
57
|
if (!root) {
|
|
58
58
|
throw new Error(`Root "${options.root}" not found. Available roots: ${Object.keys(artifacts.roots).join(", ") || "(none)"}`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
const targetDir = resolve(options
|
|
62
|
+
const targetDir = resolve(options.target ?? process.cwd());
|
|
63
63
|
root = detectRoot(artifacts.roots, targetDir);
|
|
64
64
|
if (root) {
|
|
65
65
|
rootAutoDetected = true;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
// Adapter writes .mcp.json and injects skills (no secret resolution)
|
|
69
|
-
const session = await adapter.prepareSession(artifacts, options
|
|
69
|
+
const session = await adapter.prepareSession(artifacts, options.target ?? process.cwd(), {
|
|
70
70
|
root,
|
|
71
|
-
skillOverrides: options
|
|
72
|
-
mcpServerOverrides: options
|
|
73
|
-
skipSubagentMerge: options
|
|
71
|
+
skillOverrides: options.skills,
|
|
72
|
+
mcpServerOverrides: options.mcpServers,
|
|
73
|
+
skipSubagentMerge: options.skipSubagentMerge,
|
|
74
74
|
});
|
|
75
75
|
// Run transforms in extension-list order on the written .mcp.json
|
|
76
76
|
const mcpConfigPath = session.configFiles.find((f) => f.endsWith(".mcp.json"));
|
|
@@ -78,14 +78,14 @@ export async function prepareSession(options) {
|
|
|
78
78
|
await runTransforms({
|
|
79
79
|
transforms: loaded.transforms,
|
|
80
80
|
mcpConfigPath,
|
|
81
|
-
targetDir: options
|
|
81
|
+
targetDir: options.target ?? process.cwd(),
|
|
82
82
|
root,
|
|
83
83
|
artifacts,
|
|
84
|
-
extensionOptions: options
|
|
84
|
+
extensionOptions: options.extensionOptions ?? {},
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
// Final validation: ensure no unresolved ${VAR} patterns remain
|
|
88
|
-
if (!options
|
|
88
|
+
if (!options.skipValidation && mcpConfigPath) {
|
|
89
89
|
const config = JSON.parse(readFileSync(mcpConfigPath, "utf-8"));
|
|
90
90
|
const unresolved = findUnresolvedVars(config);
|
|
91
91
|
if (unresolved.length > 0) {
|
package/dist/prepare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,GAGjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAyB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAgD9B;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,
|
|
1
|
+
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,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AAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;AAC7C,CAAC"}
|
package/dist/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAI5B,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,gCAAgC;IAChC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oCAAoC;IACpC,aAAa,EAAE,kBAAkB,CAAC;IAClC,4FAA4F;IAC5F,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,sCAAsC;IACtC,YAAY,EAAE,YAAY,CAAC;IAC3B,sCAAsC;IACtC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAqD7B"}
|
package/dist/start.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolve, dirname } from "path";
|
|
2
|
+
import { getAirJsonPath, loadAirConfig, resolveArtifacts, emptyArtifacts, } from "@pulsemcp/air-core";
|
|
2
3
|
import { findAdapter, listAvailableAdapters } from "./adapter-registry.js";
|
|
4
|
+
import { loadExtensions } from "./extension-loader.js";
|
|
3
5
|
/**
|
|
4
6
|
* Prepare to start an agent session.
|
|
5
7
|
*
|
|
@@ -19,9 +21,19 @@ export async function startSession(agent, options) {
|
|
|
19
21
|
`Install an adapter: npm install @pulsemcp/air-adapter-${agent}`);
|
|
20
22
|
}
|
|
21
23
|
const airJsonPath = options?.config || getAirJsonPath();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let artifacts;
|
|
25
|
+
if (airJsonPath) {
|
|
26
|
+
const airConfig = loadAirConfig(airJsonPath);
|
|
27
|
+
const airJsonDir = dirname(resolve(airJsonPath));
|
|
28
|
+
const loaded = await loadExtensions(airConfig.extensions || [], airJsonDir);
|
|
29
|
+
const providers = loaded.providers
|
|
30
|
+
.map((ext) => ext.provider)
|
|
31
|
+
.filter(Boolean);
|
|
32
|
+
artifacts = await resolveArtifacts(airJsonPath, { providers });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
artifacts = emptyArtifacts();
|
|
36
|
+
}
|
|
25
37
|
let root;
|
|
26
38
|
if (options?.root) {
|
|
27
39
|
root = artifacts.roots[options.root];
|
package/dist/start.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,GAKf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,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E,EAAE,SAAS,EAAE,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,SAAS,GAAG,cAAc,EAAE,CAAC;IAC/B,CAAC;IAED,IAAI,IAA2B,CAAC;IAChC,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CACb,SAAS,OAAO,CAAC,IAAI,iCAAiC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE,CAC5G,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,iBAAiB,IAAI,IAAI,CAAC;QACzD,CAAC,CAAC,MAAM,OAAO,CAAC,WAAW,EAAE;QAC7B,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAE9D,OAAO;QACL,SAAS;QACT,IAAI;QACJ,aAAa;QACb,cAAc;QACd,YAAY;QACZ,kBAAkB,EAAE,OAAO,CAAC,WAAW;KACxC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulsemcp/air-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"lint": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@pulsemcp/air-core": "0.0.
|
|
32
|
+
"@pulsemcp/air-core": "0.0.13"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^22.10.0",
|