nomoreide 0.1.69 → 0.1.71

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.
Files changed (47) hide show
  1. package/dist/core/agent-env-actions.d.ts +117 -0
  2. package/dist/core/agent-env-actions.js +234 -0
  3. package/dist/core/agent-env-actions.js.map +1 -0
  4. package/dist/core/agent-env-writers.d.ts +46 -0
  5. package/dist/core/agent-env-writers.js +385 -0
  6. package/dist/core/agent-env-writers.js.map +1 -0
  7. package/dist/core/agent-profiles/apply.d.ts +36 -0
  8. package/dist/core/agent-profiles/apply.js +160 -0
  9. package/dist/core/agent-profiles/apply.js.map +1 -0
  10. package/dist/core/agent-profiles/credentials.d.ts +26 -0
  11. package/dist/core/agent-profiles/credentials.js +151 -0
  12. package/dist/core/agent-profiles/credentials.js.map +1 -0
  13. package/dist/core/agent-profiles/index.d.ts +10 -0
  14. package/dist/core/agent-profiles/index.js +11 -0
  15. package/dist/core/agent-profiles/index.js.map +1 -0
  16. package/dist/core/agent-profiles/store.d.ts +35 -0
  17. package/dist/core/agent-profiles/store.js +210 -0
  18. package/dist/core/agent-profiles/store.js.map +1 -0
  19. package/dist/core/agent-profiles/transfer.d.ts +26 -0
  20. package/dist/core/agent-profiles/transfer.js +141 -0
  21. package/dist/core/agent-profiles/transfer.js.map +1 -0
  22. package/dist/core/agent-profiles/types.d.ts +250 -0
  23. package/dist/core/agent-profiles/types.js +63 -0
  24. package/dist/core/agent-profiles/types.js.map +1 -0
  25. package/dist/mcp/tools/agent-env.d.ts +4 -3
  26. package/dist/mcp/tools/agent-env.js +129 -9
  27. package/dist/mcp/tools/agent-env.js.map +1 -1
  28. package/dist/mcp/tools/agent-profiles.d.ts +9 -0
  29. package/dist/mcp/tools/agent-profiles.js +165 -0
  30. package/dist/mcp/tools/agent-profiles.js.map +1 -0
  31. package/dist/mcp/tools/index.d.ts +1 -1
  32. package/dist/mcp/tools/index.js +3 -0
  33. package/dist/mcp/tools/index.js.map +1 -1
  34. package/dist/web/client/assets/{code-editor-B4fwOZmz.js → code-editor-B0j6kcLb.js} +1 -1
  35. package/dist/web/client/assets/{index-Bv9X1Rmi.js → index-DAiSqTLR.js} +139 -139
  36. package/dist/web/client/assets/index-n7aEcfkd.css +1 -0
  37. package/dist/web/client/index.html +2 -2
  38. package/dist/web/routes/agent-env-routes.d.ts +5 -3
  39. package/dist/web/routes/agent-env-routes.js +54 -4
  40. package/dist/web/routes/agent-env-routes.js.map +1 -1
  41. package/dist/web/routes/agent-profile-routes.d.ts +8 -0
  42. package/dist/web/routes/agent-profile-routes.js +180 -0
  43. package/dist/web/routes/agent-profile-routes.js.map +1 -0
  44. package/dist/web/routes/index.js +2 -0
  45. package/dist/web/routes/index.js.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/web/client/assets/index-CNvFKnAK.css +0 -1
@@ -0,0 +1,250 @@
1
+ /**
2
+ * Agent Profiles (ROR-62) — named bundles of MCP servers + skills that can be
3
+ * saved, applied to agents, and shared as portable `.tar.gz` archives.
4
+ *
5
+ * Profiles use nomoreide's own vocabulary (the same local/remote MCP shapes
6
+ * the agent-env readers emit) and are stored as Zod-validated JSON under
7
+ * `~/.config/nomoreide/agent-profiles/<name>/`. This deliberately does NOT
8
+ * read brainctl's YAML profiles — brainctl users migrate by re-snapshotting
9
+ * their live agent configs (one call), which recreates the profile here.
10
+ */
11
+ import { z } from "zod";
12
+ export declare const profileLocalMcpSchema: z.ZodObject<{
13
+ kind: z.ZodLiteral<"local">;
14
+ command: z.ZodString;
15
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
16
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ command: string;
19
+ kind: "local";
20
+ env?: Record<string, string> | undefined;
21
+ args?: string[] | undefined;
22
+ }, {
23
+ command: string;
24
+ kind: "local";
25
+ env?: Record<string, string> | undefined;
26
+ args?: string[] | undefined;
27
+ }>;
28
+ export declare const profileRemoteMcpSchema: z.ZodObject<{
29
+ kind: z.ZodLiteral<"remote">;
30
+ transport: z.ZodEnum<["http", "sse"]>;
31
+ url: z.ZodString;
32
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
33
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ kind: "remote";
36
+ url: string;
37
+ transport: "http" | "sse";
38
+ env?: Record<string, string> | undefined;
39
+ headers?: Record<string, string> | undefined;
40
+ }, {
41
+ kind: "remote";
42
+ url: string;
43
+ transport: "http" | "sse";
44
+ env?: Record<string, string> | undefined;
45
+ headers?: Record<string, string> | undefined;
46
+ }>;
47
+ export declare const profileMcpSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
48
+ kind: z.ZodLiteral<"local">;
49
+ command: z.ZodString;
50
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
51
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ command: string;
54
+ kind: "local";
55
+ env?: Record<string, string> | undefined;
56
+ args?: string[] | undefined;
57
+ }, {
58
+ command: string;
59
+ kind: "local";
60
+ env?: Record<string, string> | undefined;
61
+ args?: string[] | undefined;
62
+ }>, z.ZodObject<{
63
+ kind: z.ZodLiteral<"remote">;
64
+ transport: z.ZodEnum<["http", "sse"]>;
65
+ url: z.ZodString;
66
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
67
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ kind: "remote";
70
+ url: string;
71
+ transport: "http" | "sse";
72
+ env?: Record<string, string> | undefined;
73
+ headers?: Record<string, string> | undefined;
74
+ }, {
75
+ kind: "remote";
76
+ url: string;
77
+ transport: "http" | "sse";
78
+ env?: Record<string, string> | undefined;
79
+ headers?: Record<string, string> | undefined;
80
+ }>]>;
81
+ export type ProfileLocalMcp = z.infer<typeof profileLocalMcpSchema>;
82
+ export type ProfileRemoteMcp = z.infer<typeof profileRemoteMcpSchema>;
83
+ export type ProfileMcp = z.infer<typeof profileMcpSchema>;
84
+ /** A skill bundled with the profile; its files live at `<profile>/skills/<name>/`. */
85
+ export declare const profileSkillSchema: z.ZodObject<{
86
+ name: z.ZodString;
87
+ }, "strip", z.ZodTypeAny, {
88
+ name: string;
89
+ }, {
90
+ name: string;
91
+ }>;
92
+ export declare const PROFILE_NAME_PATTERN: RegExp;
93
+ export declare const profileSchema: z.ZodObject<{
94
+ name: z.ZodString;
95
+ description: z.ZodOptional<z.ZodString>;
96
+ mcps: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
97
+ kind: z.ZodLiteral<"local">;
98
+ command: z.ZodString;
99
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
100
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ command: string;
103
+ kind: "local";
104
+ env?: Record<string, string> | undefined;
105
+ args?: string[] | undefined;
106
+ }, {
107
+ command: string;
108
+ kind: "local";
109
+ env?: Record<string, string> | undefined;
110
+ args?: string[] | undefined;
111
+ }>, z.ZodObject<{
112
+ kind: z.ZodLiteral<"remote">;
113
+ transport: z.ZodEnum<["http", "sse"]>;
114
+ url: z.ZodString;
115
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
116
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ kind: "remote";
119
+ url: string;
120
+ transport: "http" | "sse";
121
+ env?: Record<string, string> | undefined;
122
+ headers?: Record<string, string> | undefined;
123
+ }, {
124
+ kind: "remote";
125
+ url: string;
126
+ transport: "http" | "sse";
127
+ env?: Record<string, string> | undefined;
128
+ headers?: Record<string, string> | undefined;
129
+ }>]>>>;
130
+ skills: z.ZodDefault<z.ZodArray<z.ZodObject<{
131
+ name: z.ZodString;
132
+ }, "strip", z.ZodTypeAny, {
133
+ name: string;
134
+ }, {
135
+ name: string;
136
+ }>, "many">>;
137
+ }, "strip", z.ZodTypeAny, {
138
+ skills: {
139
+ name: string;
140
+ }[];
141
+ name: string;
142
+ mcps: Record<string, {
143
+ command: string;
144
+ kind: "local";
145
+ env?: Record<string, string> | undefined;
146
+ args?: string[] | undefined;
147
+ } | {
148
+ kind: "remote";
149
+ url: string;
150
+ transport: "http" | "sse";
151
+ env?: Record<string, string> | undefined;
152
+ headers?: Record<string, string> | undefined;
153
+ }>;
154
+ description?: string | undefined;
155
+ }, {
156
+ name: string;
157
+ skills?: {
158
+ name: string;
159
+ }[] | undefined;
160
+ description?: string | undefined;
161
+ mcps?: Record<string, {
162
+ command: string;
163
+ kind: "local";
164
+ env?: Record<string, string> | undefined;
165
+ args?: string[] | undefined;
166
+ } | {
167
+ kind: "remote";
168
+ url: string;
169
+ transport: "http" | "sse";
170
+ env?: Record<string, string> | undefined;
171
+ headers?: Record<string, string> | undefined;
172
+ }> | undefined;
173
+ }>;
174
+ export type Profile = z.infer<typeof profileSchema>;
175
+ /** Credential a portable archive needs filled in at import time. */
176
+ export declare const credentialSpecSchema: z.ZodObject<{
177
+ key: z.ZodString;
178
+ required: z.ZodDefault<z.ZodBoolean>;
179
+ description: z.ZodOptional<z.ZodString>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ key: string;
182
+ required: boolean;
183
+ description?: string | undefined;
184
+ }, {
185
+ key: string;
186
+ description?: string | undefined;
187
+ required?: boolean | undefined;
188
+ }>;
189
+ export type CredentialSpec = z.infer<typeof credentialSpecSchema>;
190
+ /** `manifest.json` inside a portable archive. */
191
+ export declare const profileManifestSchema: z.ZodObject<{
192
+ schemaVersion: z.ZodLiteral<1>;
193
+ profileName: z.ZodString;
194
+ createdBy: z.ZodOptional<z.ZodObject<{
195
+ tool: z.ZodString;
196
+ version: z.ZodString;
197
+ }, "strip", z.ZodTypeAny, {
198
+ version: string;
199
+ tool: string;
200
+ }, {
201
+ version: string;
202
+ tool: string;
203
+ }>>;
204
+ credentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
205
+ key: z.ZodString;
206
+ required: z.ZodDefault<z.ZodBoolean>;
207
+ description: z.ZodOptional<z.ZodString>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ key: string;
210
+ required: boolean;
211
+ description?: string | undefined;
212
+ }, {
213
+ key: string;
214
+ description?: string | undefined;
215
+ required?: boolean | undefined;
216
+ }>, "many">>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ schemaVersion: 1;
219
+ profileName: string;
220
+ createdBy?: {
221
+ version: string;
222
+ tool: string;
223
+ } | undefined;
224
+ credentials?: {
225
+ key: string;
226
+ required: boolean;
227
+ description?: string | undefined;
228
+ }[] | undefined;
229
+ }, {
230
+ schemaVersion: 1;
231
+ profileName: string;
232
+ createdBy?: {
233
+ version: string;
234
+ tool: string;
235
+ } | undefined;
236
+ credentials?: {
237
+ key: string;
238
+ description?: string | undefined;
239
+ required?: boolean | undefined;
240
+ }[] | undefined;
241
+ }>;
242
+ export type ProfileManifest = z.infer<typeof profileManifestSchema>;
243
+ export interface ProfileSummary {
244
+ name: string;
245
+ description?: string;
246
+ mcpCount: number;
247
+ skillCount: number;
248
+ updatedAt: string;
249
+ }
250
+ export declare function slugifyProfileName(input: string): string;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Agent Profiles (ROR-62) — named bundles of MCP servers + skills that can be
3
+ * saved, applied to agents, and shared as portable `.tar.gz` archives.
4
+ *
5
+ * Profiles use nomoreide's own vocabulary (the same local/remote MCP shapes
6
+ * the agent-env readers emit) and are stored as Zod-validated JSON under
7
+ * `~/.config/nomoreide/agent-profiles/<name>/`. This deliberately does NOT
8
+ * read brainctl's YAML profiles — brainctl users migrate by re-snapshotting
9
+ * their live agent configs (one call), which recreates the profile here.
10
+ */
11
+ import { z } from "zod";
12
+ const stringMapSchema = z.record(z.string());
13
+ export const profileLocalMcpSchema = z.object({
14
+ kind: z.literal("local"),
15
+ command: z.string().min(1),
16
+ args: z.array(z.string()).optional(),
17
+ env: stringMapSchema.optional(),
18
+ });
19
+ export const profileRemoteMcpSchema = z.object({
20
+ kind: z.literal("remote"),
21
+ transport: z.enum(["http", "sse"]),
22
+ url: z.string().min(1),
23
+ headers: stringMapSchema.optional(),
24
+ env: stringMapSchema.optional(),
25
+ });
26
+ export const profileMcpSchema = z.discriminatedUnion("kind", [
27
+ profileLocalMcpSchema,
28
+ profileRemoteMcpSchema,
29
+ ]);
30
+ /** A skill bundled with the profile; its files live at `<profile>/skills/<name>/`. */
31
+ export const profileSkillSchema = z.object({
32
+ name: z.string().min(1),
33
+ });
34
+ export const PROFILE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
35
+ export const profileSchema = z.object({
36
+ name: z.string().regex(PROFILE_NAME_PATTERN),
37
+ description: z.string().optional(),
38
+ mcps: z.record(profileMcpSchema).default({}),
39
+ skills: z.array(profileSkillSchema).default([]),
40
+ });
41
+ /** Credential a portable archive needs filled in at import time. */
42
+ export const credentialSpecSchema = z.object({
43
+ key: z.string().min(1),
44
+ required: z.boolean().default(true),
45
+ description: z.string().optional(),
46
+ });
47
+ /** `manifest.json` inside a portable archive. */
48
+ export const profileManifestSchema = z.object({
49
+ schemaVersion: z.literal(1),
50
+ profileName: z.string().min(1),
51
+ createdBy: z.object({ tool: z.string(), version: z.string() }).optional(),
52
+ credentials: z.array(credentialSpecSchema).optional(),
53
+ });
54
+ export function slugifyProfileName(input) {
55
+ return input
56
+ .trim()
57
+ .toLowerCase()
58
+ .replace(/[\s_]+/g, "-")
59
+ .replace(/[^a-z0-9.-]/g, "")
60
+ .replace(/-+/g, "-")
61
+ .replace(/^[-.]+|[-.]+$/g, "");
62
+ }
63
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../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ACT,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import type { FastMCP } from "fastmcp";
2
2
  import { type ToolContext } from "./context.js";
3
- export declare const AGENT_ENV_TOOL_NAMES: readonly ["nomoreide_agents_status", "nomoreide_agents_read_configs", "nomoreide_agents_doctor"];
3
+ export declare const AGENT_ENV_TOOL_NAMES: readonly ["nomoreide_agents_status", "nomoreide_agents_read_configs", "nomoreide_agents_doctor", "nomoreide_agents_add_mcp", "nomoreide_agents_remove_mcp", "nomoreide_agents_move_mcp_scope", "nomoreide_agents_move_skill_scope", "nomoreide_agents_snapshot_agent"];
4
4
  /**
5
- * Read-only (ROR-60). Mutating agent configs is Phase 2 (ROR-61) and will live
6
- * behind the write-guarded agent-env-actions module.
5
+ * Read tools shipped with ROR-60; write tools (ROR-61) are apply-scoped — each
6
+ * stages one change through the write-guarded agent-env-actions module and
7
+ * applies it immediately, echoing the backup files it created.
7
8
  */
8
9
  export declare function registerAgentEnvTools(server: FastMCP, _ctx: ToolContext): void;
@@ -1,21 +1,30 @@
1
1
  import { z } from "zod";
2
+ import { applyChanges, snapshotAgent, } from "../../core/agent-env-actions.js";
3
+ import { addMcp } from "../../core/agent-env-writers.js";
2
4
  import { getAgentAvailability, readAllAgentConfigs, runAgentDoctor, } from "../../core/agent-env/index.js";
3
5
  import { stringify } from "./context.js";
4
6
  export const AGENT_ENV_TOOL_NAMES = [
5
7
  "nomoreide_agents_status",
6
8
  "nomoreide_agents_read_configs",
7
9
  "nomoreide_agents_doctor",
10
+ "nomoreide_agents_add_mcp",
11
+ "nomoreide_agents_remove_mcp",
12
+ "nomoreide_agents_move_mcp_scope",
13
+ "nomoreide_agents_move_skill_scope",
14
+ "nomoreide_agents_snapshot_agent",
8
15
  ];
9
- const agentEnvCwdSchema = z.object({
10
- cwd: z
11
- .string()
12
- .min(1)
13
- .optional()
14
- .describe("Project directory used to resolve project-scoped MCPs and skills."),
15
- });
16
+ const agentSchema = z.enum(["claude", "codex", "antigravity"]);
17
+ const scopeSchema = z.enum(["user", "project"]);
18
+ const cwdField = z
19
+ .string()
20
+ .min(1)
21
+ .optional()
22
+ .describe("Project directory used to resolve project-scoped MCPs and skills.");
23
+ const agentEnvCwdSchema = z.object({ cwd: cwdField });
16
24
  /**
17
- * Read-only (ROR-60). Mutating agent configs is Phase 2 (ROR-61) and will live
18
- * behind the write-guarded agent-env-actions module.
25
+ * Read tools shipped with ROR-60; write tools (ROR-61) are apply-scoped — each
26
+ * stages one change through the write-guarded agent-env-actions module and
27
+ * applies it immediately, echoing the backup files it created.
19
28
  */
20
29
  export function registerAgentEnvTools(server, _ctx) {
21
30
  server.addTool({
@@ -36,5 +45,116 @@ export function registerAgentEnvTools(server, _ctx) {
36
45
  parameters: agentEnvCwdSchema,
37
46
  execute: async ({ cwd }) => stringify(await runAgentDoctor({ cwd: cwd ?? process.cwd() })),
38
47
  });
48
+ server.addTool({
49
+ name: "nomoreide_agents_add_mcp",
50
+ description: "Add (or overwrite) an MCP server in a coding agent's config. Provide command/args/env for a stdio server, or url (+ transport) for a remote one. The previous config file is backed up first; the backup path is returned.",
51
+ parameters: z.object({
52
+ agent: agentSchema,
53
+ key: z.string().min(1).describe("MCP server name."),
54
+ command: z.string().optional().describe("Executable for a stdio MCP server."),
55
+ args: z.array(z.string()).optional(),
56
+ env: z.record(z.string()).optional(),
57
+ url: z.string().optional().describe("URL for a remote MCP server."),
58
+ transport: z.enum(["http", "sse"]).optional().describe("Remote transport (default http)."),
59
+ scope: scopeSchema.default("user"),
60
+ cwd: cwdField,
61
+ }),
62
+ execute: async (input) => {
63
+ if (!input.command && !input.url) {
64
+ throw new Error("Provide either command (stdio server) or url (remote server).");
65
+ }
66
+ const outcome = await addMcp({
67
+ cwd: input.cwd ?? process.cwd(),
68
+ agent: input.agent,
69
+ key: input.key,
70
+ scope: input.scope,
71
+ entry: input.command
72
+ ? { command: input.command, args: input.args, env: input.env }
73
+ : undefined,
74
+ remoteEntry: input.url
75
+ ? { transport: input.transport ?? "http", url: input.url }
76
+ : undefined,
77
+ });
78
+ return stringify({ ok: true, agent: input.agent, key: input.key, ...outcome });
79
+ },
80
+ });
81
+ server.addTool({
82
+ name: "nomoreide_agents_remove_mcp",
83
+ description: "Remove an MCP server from a coding agent's config. The config file is backed up first; the backup path is returned.",
84
+ parameters: z.object({
85
+ agent: agentSchema,
86
+ key: z.string().min(1),
87
+ scope: scopeSchema.default("user"),
88
+ cwd: cwdField,
89
+ }),
90
+ execute: async (input) => stringify(await applyChanges({
91
+ cwd: input.cwd ?? process.cwd(),
92
+ changes: [
93
+ {
94
+ category: "mcp",
95
+ action: "remove",
96
+ name: input.key,
97
+ sourceAgent: input.agent,
98
+ sourceScope: input.scope,
99
+ },
100
+ ],
101
+ })),
102
+ });
103
+ server.addTool({
104
+ name: "nomoreide_agents_move_mcp_scope",
105
+ description: "Move an MCP server between an agent's user (global) and project scope. Config files are backed up first; backup paths are returned.",
106
+ parameters: z.object({
107
+ agent: agentSchema,
108
+ key: z.string().min(1),
109
+ fromScope: scopeSchema,
110
+ toScope: scopeSchema,
111
+ cwd: cwdField,
112
+ }),
113
+ execute: async (input) => stringify(await applyChanges({
114
+ cwd: input.cwd ?? process.cwd(),
115
+ changes: [
116
+ {
117
+ category: "mcp",
118
+ action: "move",
119
+ name: input.key,
120
+ sourceAgent: input.agent,
121
+ sourceScope: input.fromScope,
122
+ targetAgent: input.agent,
123
+ targetScope: input.toScope,
124
+ },
125
+ ],
126
+ })),
127
+ });
128
+ server.addTool({
129
+ name: "nomoreide_agents_move_skill_scope",
130
+ description: "Move a skill between user and project scope (Claude only — other agents have no project skills). The removed source directory is backed up; the backup path is returned.",
131
+ parameters: z.object({
132
+ agent: agentSchema,
133
+ skillName: z.string().min(1),
134
+ fromScope: scopeSchema,
135
+ toScope: scopeSchema,
136
+ cwd: cwdField,
137
+ }),
138
+ execute: async (input) => stringify(await applyChanges({
139
+ cwd: input.cwd ?? process.cwd(),
140
+ changes: [
141
+ {
142
+ category: "skill",
143
+ action: "move",
144
+ name: input.skillName,
145
+ sourceAgent: input.agent,
146
+ sourceScope: input.fromScope,
147
+ targetAgent: input.agent,
148
+ targetScope: input.toScope,
149
+ },
150
+ ],
151
+ })),
152
+ });
153
+ server.addTool({
154
+ name: "nomoreide_agents_snapshot_agent",
155
+ description: "Snapshot a coding agent's live config file to a timestamped .bak.* copy before bulk edits. Returns the backup path.",
156
+ parameters: z.object({ agent: agentSchema, cwd: cwdField }),
157
+ execute: async (input) => stringify(await snapshotAgent({ cwd: input.cwd ?? process.cwd(), agent: input.agent })),
158
+ });
39
159
  }
40
160
  //# sourceMappingURL=agent-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../../src/mcp/tools/agent-env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,yBAAyB;IACzB,+BAA+B;IAC/B,yBAAyB;CACjB,CAAC;AAEX,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,mEAAmE,CAAC;CACjF,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAe,EAAE,IAAiB;IACtE,MAAM,CAAC,OAAO,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C,CAAC,CAAC;YAC5B,SAAS,EAAE,WAAW;YACtB,OAAO,EAAE,WAAW;YACpB,GAAG,EAAE,QAAQ;SACd,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CACvB,SAAS,CACP,MAAM,YAAY,CAAC;YACjB,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;YAC/B,OAAO,EAAE;gBACP;oBACE,QAAQ,EAAE,OAAO;oBACjB,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,KAAK,CAAC,SAAS;oBACrB,WAAW,EAAE,KAAK,CAAC,KAAK;oBACxB,WAAW,EAAE,KAAK,CAAC,SAAS;oBAC5B,WAAW,EAAE,KAAK,CAAC,KAAK;oBACxB,WAAW,EAAE,KAAK,CAAC,OAAO;iBAC3B;aACF;SACF,CAAC,CACH;KACJ,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC;QACb,IAAI,EAAE,iCAAiC;QACvC,WAAW,EACT,qHAAqH;QACvH,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;QAC3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CACvB,SAAS,CACP,MAAM,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAC7E;KACJ,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { FastMCP } from "fastmcp";
2
+ import { type ToolContext } from "./context.js";
3
+ export declare const AGENT_PROFILE_TOOL_NAMES: readonly ["nomoreide_profiles_list", "nomoreide_profiles_get", "nomoreide_profiles_create", "nomoreide_profiles_update", "nomoreide_profiles_delete", "nomoreide_profiles_snapshot", "nomoreide_profiles_apply", "nomoreide_profiles_export", "nomoreide_profiles_import", "nomoreide_profiles_copy_items"];
4
+ /**
5
+ * Agent Profiles (ROR-62): named MCP+skill bundles. Mutations of agent
6
+ * configs (apply) flow through the write-guarded agent-env layer and echo
7
+ * backup paths; profile CRUD only touches `~/.config/nomoreide/agent-profiles/`.
8
+ */
9
+ export declare function registerAgentProfileTools(server: FastMCP, _ctx: ToolContext): void;