@invarn/cli 0.2.0 → 0.2.2

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/sdk.d.mts ADDED
@@ -0,0 +1,36 @@
1
+ import type { McpSdkServerConfigWithInstance } from '@anthropic-ai/claude-agent-sdk';
2
+
3
+ export interface CreateInvarnMcpServerOptions {
4
+ /**
5
+ * Invarn human API key (`inv_human_…`). When omitted, resolves from the
6
+ * `INVARN_TOKEN` env var, then the on-disk profile at
7
+ * `~/.config/invarn/config.json`. Factory throws at construction time if
8
+ * none of these yield a token.
9
+ */
10
+ token?: string;
11
+ /**
12
+ * API base URL. Defaults to the `INVARN_URL` env var or `https://invarn.com`.
13
+ * Override for self-hosted deployments.
14
+ */
15
+ baseUrl?: string;
16
+ /**
17
+ * Allowlist by tool name. Default: all 13 tools. See the package README
18
+ * for the full list of tool names.
19
+ */
20
+ tools?: string[];
21
+ /** Reported as the MCP server version. Defaults to the CLI version. */
22
+ version?: string;
23
+ }
24
+
25
+ /**
26
+ * Build an in-process MCP server exposing invarn's tools to the Claude
27
+ * Agent SDK. The returned object plugs straight into `mcpServers` on the
28
+ * agent's `query()` options.
29
+ *
30
+ * Responses are structured JSON (`JSON.stringify(result, null, 2)` in a
31
+ * single text block) so the LLM parses fields reliably. The stdio CLI
32
+ * (`invarn mcp serve`) keeps its formatted prose for interactive use.
33
+ */
34
+ export function createInvarnMcpServer(
35
+ options?: CreateInvarnMcpServerOptions,
36
+ ): McpSdkServerConfigWithInstance;
package/dist/sdk.mjs CHANGED
@@ -6995,10 +6995,11 @@ async function cancelBuild(buildId) {
6995
6995
  body: "{}"
6996
6996
  });
6997
6997
  }
6998
- async function registerAgent({ name, type, description, repository, commands, overwrite }) {
6998
+ async function registerAgent({ name, type, description, repository, commands, overwrite, triggers }) {
6999
6999
  const body = { name, type, description, commands };
7000
7000
  if (repository) body.repository = repository;
7001
7001
  if (overwrite) body.overwrite = true;
7002
+ if (Array.isArray(triggers) && triggers.length > 0) body.triggers = triggers;
7002
7003
  const res = await request("/agent/register", {
7003
7004
  method: "POST",
7004
7005
  body: JSON.stringify(body)
@@ -8820,7 +8821,8 @@ async function handleAgentRegister(args) {
8820
8821
  description: args.description,
8821
8822
  repository: args.repository,
8822
8823
  commands,
8823
- overwrite: args.overwrite
8824
+ overwrite: args.overwrite,
8825
+ triggers: args.triggers
8824
8826
  });
8825
8827
  if (result.pipelinePath && result.yamlContent) {
8826
8828
  try {
@@ -9144,7 +9146,13 @@ var TOOL_SPECS = [
9144
9146
  name: z2.string().describe('Command name (e.g. "compile")'),
9145
9147
  run: z2.string().describe('Shell command to execute (e.g. "./gradlew assembleDebug")')
9146
9148
  })).describe("List of commands this agent can run"),
9147
- overwrite: z2.boolean().optional().describe("Set true to replace a pipeline file that already exists at .ci/pipelines/agent-<name>.yml in the repo. Use this when re-registering an agent \u2014 e.g. the same repo is connected under another org, or a prior registration was deleted without cleaning up the committed file. Do NOT set this when the existing file is hand-authored YAML unrelated to a prior agent.")
9149
+ overwrite: z2.boolean().optional().describe("Set true to replace a pipeline file that already exists at .ci/pipelines/agent-<name>.yml in the repo. Use this when re-registering an agent \u2014 e.g. the same repo is connected under another org, or a prior registration was deleted without cleaning up the committed file. Do NOT set this when the existing file is hand-authored YAML unrelated to a prior agent."),
9150
+ triggers: z2.array(z2.object({
9151
+ push_branch: z2.string().optional().describe('Match push events where the pushed branch matches this pattern (glob). Use "*" for any branch.'),
9152
+ pull_request_source_branch: z2.string().optional().describe("Match PR events where the source (head) branch matches this pattern."),
9153
+ pull_request_target_branch: z2.string().optional().describe("Match PR events where the target (base) branch matches this pattern."),
9154
+ workflow: z2.string().describe('Workflow to run on match \u2014 must be one of the command names, or the combined "a-and-b-and-c" workflow when multiple commands exist.')
9155
+ })).optional().describe("Events that should trigger this agent automatically. Each rule mirrors cibuild.yml trigger_map entries. Omit to keep the agent manual-only (runnable only via invarn_agent_run). See docs/AGENTS-ROADMAP.md item #2.")
9148
9156
  },
9149
9157
  handler: async (args) => handleAgentRegister(args)
9150
9158
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invarn/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Invarn CLI — run builds, check artifacts, and ship from your terminal",
5
5
  "type": "module",
6
6
  "main": "dist/invarn.cjs",
@@ -9,11 +9,15 @@
9
9
  },
10
10
  "exports": {
11
11
  ".": "./dist/invarn.cjs",
12
- "./sdk": "./dist/sdk.mjs"
12
+ "./sdk": {
13
+ "types": "./dist/sdk.d.mts",
14
+ "default": "./dist/sdk.mjs"
15
+ }
13
16
  },
14
17
  "files": [
15
18
  "dist/invarn.cjs",
16
19
  "dist/sdk.mjs",
20
+ "dist/sdk.d.mts",
17
21
  "README.md"
18
22
  ],
19
23
  "scripts": {