loopctl-mcp-server 3.12.0 → 3.13.0
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/index.js +25 -14
- package/lib/handoff.js +16 -13
- package/lib/project-update.js +14 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3841,8 +3841,12 @@ const TOOLS = [
|
|
|
3841
3841
|
inputSchema: {
|
|
3842
3842
|
type: "object",
|
|
3843
3843
|
properties: {
|
|
3844
|
-
name: { type: "string", description: "Project name." },
|
|
3845
|
-
slug: {
|
|
3844
|
+
name: { type: "string", description: "Project name: the same string as slug." },
|
|
3845
|
+
slug: {
|
|
3846
|
+
type: "string",
|
|
3847
|
+
description:
|
|
3848
|
+
"The repo basename, lowercased, underscores kept (lowercase alphanumerics, hyphens, underscores; 2-63 chars).",
|
|
3849
|
+
},
|
|
3846
3850
|
repo_url: { type: "string", description: "GitHub repo URL." },
|
|
3847
3851
|
description: { type: "string", description: "Project description." },
|
|
3848
3852
|
tech_stack: { type: "string", description: "Tech stack summary." },
|
|
@@ -3862,8 +3866,15 @@ const TOOLS = [
|
|
|
3862
3866
|
inputSchema: {
|
|
3863
3867
|
type: "object",
|
|
3864
3868
|
properties: {
|
|
3865
|
-
name: {
|
|
3866
|
-
|
|
3869
|
+
name: {
|
|
3870
|
+
type: "string",
|
|
3871
|
+
description: "Scope name: the same string as slug (a different one is refused 422).",
|
|
3872
|
+
},
|
|
3873
|
+
slug: {
|
|
3874
|
+
type: "string",
|
|
3875
|
+
description:
|
|
3876
|
+
"The repo basename, lowercased, underscores kept (lowercase alphanumerics, hyphens, underscores; 2-63 chars).",
|
|
3877
|
+
},
|
|
3867
3878
|
repo_url: {
|
|
3868
3879
|
type: "string",
|
|
3869
3880
|
description: "Repo URL, so resolve_project can map a repo to this scope.",
|
|
@@ -3918,12 +3929,12 @@ const TOOLS = [
|
|
|
3918
3929
|
repo_url: {
|
|
3919
3930
|
type: "string",
|
|
3920
3931
|
description:
|
|
3921
|
-
"The repo's git remote (git@github.com:owner/repo.git, https://github.com/owner/repo, or bare owner/repo). The usual way to name the channel; also used to derive the kb-scope slug
|
|
3932
|
+
"The repo's git remote (git@github.com:owner/repo.git, https://github.com/owner/repo, or bare owner/repo). The usual way to name the channel; also used to derive the kb-scope slug if one must be created: the repo basename lowercased, underscores kept, and the name is the same string.",
|
|
3922
3933
|
},
|
|
3923
3934
|
slug: {
|
|
3924
3935
|
type: "string",
|
|
3925
3936
|
description:
|
|
3926
|
-
"Explicit project slug, if you know it or want to override the slug derived from repo_url (lowercase alphanumerics and
|
|
3937
|
+
"Explicit project slug, if you know it or want to override the slug derived from repo_url (lowercase alphanumerics, hyphens and underscores, 2-63 chars).",
|
|
3927
3938
|
},
|
|
3928
3939
|
project_id: {
|
|
3929
3940
|
type: "string",
|
|
@@ -3959,11 +3970,6 @@ const TOOLS = [
|
|
|
3959
3970
|
description:
|
|
3960
3971
|
"Default true: create a kind: kb scope when the repo has no project yet (this is what makes a handoff possible on a fresh repo; it consumes one max_projects slot, and the response reports channel.created). Pass false to fail with an actionable error instead of creating anything.",
|
|
3961
3972
|
},
|
|
3962
|
-
name: {
|
|
3963
|
-
type: "string",
|
|
3964
|
-
description:
|
|
3965
|
-
"Scope name, used ONLY if a channel must be created. Defaults to the repo basename.",
|
|
3966
|
-
},
|
|
3967
3973
|
description: {
|
|
3968
3974
|
type: "string",
|
|
3969
3975
|
description: "Scope description, used ONLY if a channel must be created.",
|
|
@@ -4297,7 +4303,7 @@ const TOOLS = [
|
|
|
4297
4303
|
{
|
|
4298
4304
|
name: "delete_project",
|
|
4299
4305
|
description:
|
|
4300
|
-
"ARCHIVE a project (DELETE /api/v1/projects/:id sets status to archived; it removes no rows). Its epics, stories and audit entries stay, and an already-archived project is a no-op. The SLUG stays taken: slugs are unique per tenant across archived projects too, resolve_project by that slug still returns the archived project, create_project with it is refused 422, and
|
|
4306
|
+
"ARCHIVE a project (DELETE /api/v1/projects/:id sets status to archived; it removes no rows). Its epics, stories and audit entries stay, and an already-archived project is a no-op. The SLUG stays taken: slugs are unique per tenant across archived projects too, resolve_project by that slug still returns the archived project, create_project with it is refused 422, and archiving never releases it, so a new project needs a different one. The one way a slug is freed: update_project renaming a kb scope (never a work project) releases the kb scope's old slug. The way back: restore_project for a work project, restore_kb_scope for a kb scope. Sent with LOOPCTL_USER_KEY verbatim when it is set (a global LOOPCTL_API_KEY does not displace it), else with the default key. Refusals: 403 insufficient_role below user role, 403 custody_tier_required on an agent-rooted tenant (the human-anchor gate), 404 for an id not in your tenant.",
|
|
4301
4307
|
inputSchema: {
|
|
4302
4308
|
type: "object",
|
|
4303
4309
|
properties: {
|
|
@@ -4327,12 +4333,17 @@ const TOOLS = [
|
|
|
4327
4333
|
{
|
|
4328
4334
|
name: "update_project",
|
|
4329
4335
|
description:
|
|
4330
|
-
"UPDATE a project's fields (PATCH /api/v1/projects/:id): name, repo_url, description, tech_stack, mission, metadata. Send only what changes; a field left out is left alone, and a call naming none is refused locally.
|
|
4336
|
+
"UPDATE a project's fields (PATCH /api/v1/projects/:id): name, slug, repo_url, description, tech_stack, mission, metadata. Send only what changes; a field left out is left alone, and a call naming none is refused locally. Only a kind: kb scope's slug can change: its name follows the slug, a kb name different from its slug is 422, and a slug another project holds (archived included) is 422; a work project's slug change is 422. Status is not settable here (archive with delete_project, restore with restore_project). Setting repo_url makes resolve_project({repo_url}) and SessionStart find the project, so it must be the ONLY active project carrying that URL: a second one makes every lookup for the repo 409 ambiguous_resolution fleet-wide. Sent with LOOPCTL_ORCH_KEY verbatim, else LOOPCTL_USER_KEY, else the default key. Refusals: 403 insufficient_role below orchestrator role, 403 custody_tier_required on an agent-rooted tenant (the human-anchor gate), 404 for an id not in your tenant, 422 for an invalid field.",
|
|
4331
4337
|
inputSchema: {
|
|
4332
4338
|
type: "object",
|
|
4333
4339
|
properties: {
|
|
4334
4340
|
project_id: { type: "string", description: "The project's UUID." },
|
|
4335
|
-
name: { type: "string", description: "New name." },
|
|
4341
|
+
name: { type: "string", description: "New name. For a kb scope it must equal the slug." },
|
|
4342
|
+
slug: {
|
|
4343
|
+
type: "string",
|
|
4344
|
+
description:
|
|
4345
|
+
"New slug, kb scopes only (lowercase alphanumerics, hyphens, underscores; 2-63 chars). For a repo channel, the repo basename verbatim, e.g. home_care_billing.",
|
|
4346
|
+
},
|
|
4336
4347
|
repo_url: { type: "string", description: "Git remote URL, e.g. https://github.com/owner/repo." },
|
|
4337
4348
|
description: { type: "string", description: "New description." },
|
|
4338
4349
|
tech_stack: { type: "string", description: "New tech stack summary." },
|
package/lib/handoff.js
CHANGED
|
@@ -41,7 +41,7 @@ export const HANDOFF_KEY_PREFIX = "handoff:";
|
|
|
41
41
|
export const KEY_MAX_BYTES = 200;
|
|
42
42
|
|
|
43
43
|
// Mirrors Loopctl.Projects.Project's slug rules (lib/loopctl/projects/project.ex:31,137):
|
|
44
|
-
// /^[a-z0-9][a-z0-
|
|
44
|
+
// /^[a-z0-9][a-z0-9_-]*[a-z0-9]$/, 2..63 chars. A derived slug that cannot satisfy these
|
|
45
45
|
// is reported as underivable rather than sent on to fail server-side.
|
|
46
46
|
export const SLUG_MIN_LENGTH = 2;
|
|
47
47
|
export const SLUG_MAX_LENGTH = 63;
|
|
@@ -124,7 +124,7 @@ export function handoffKey(anchor) {
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* The repo basename from a git remote URL or a bare owner/repo, with original casing
|
|
127
|
-
* preserved
|
|
127
|
+
* preserved; `deriveSlug` lowercases it.
|
|
128
128
|
*
|
|
129
129
|
* Handles: git@github.com:owner/repo.git, https://github.com/owner/repo(/),
|
|
130
130
|
* ssh://git@host/owner/repo.git, bare owner/repo, and trailing query/fragment.
|
|
@@ -150,8 +150,10 @@ export function repoBasename(repoUrl) {
|
|
|
150
150
|
*
|
|
151
151
|
* DETERMINISM IS THE POINT (#528 AC4): the created scope must be re-resolvable by the
|
|
152
152
|
* same derivation on a retry, or a repeated handoff would create a second scope and burn
|
|
153
|
-
* the tenant's max_projects budget.
|
|
154
|
-
*
|
|
153
|
+
* the tenant's max_projects budget. The slug is the repo basename lowercased with `_` KEPT
|
|
154
|
+
* (#1038: repo home_care_billing -> slug home_care_billing); only other non-alphanumeric
|
|
155
|
+
* runs become `-`. The server resolves a slug on its folded form too, so a channel still
|
|
156
|
+
* stored under the old hyphenated slug is found rather than duplicated.
|
|
155
157
|
*
|
|
156
158
|
* Returns null when nothing valid can be derived — the caller then asks for an explicit
|
|
157
159
|
* slug instead of sending a doomed create.
|
|
@@ -162,13 +164,13 @@ export function deriveSlug(repoUrl) {
|
|
|
162
164
|
|
|
163
165
|
const slug = basename
|
|
164
166
|
.toLowerCase()
|
|
165
|
-
.replace(/[^a-z0-
|
|
167
|
+
.replace(/[^a-z0-9_]+/g, "-")
|
|
166
168
|
.replace(/-+/g, "-")
|
|
167
|
-
.replace(
|
|
169
|
+
.replace(/^[-_]+|[-_]+$/g, "")
|
|
168
170
|
.slice(0, SLUG_MAX_LENGTH)
|
|
169
|
-
// A mid-string
|
|
171
|
+
// A mid-string separator can land last after truncation; the server's format regex
|
|
170
172
|
// requires an alphanumeric final character.
|
|
171
|
-
.replace(
|
|
173
|
+
.replace(/[-_]+$/, "");
|
|
172
174
|
|
|
173
175
|
return slug.length >= SLUG_MIN_LENGTH ? slug : null;
|
|
174
176
|
}
|
|
@@ -248,7 +250,7 @@ function createRemediation(status) {
|
|
|
248
250
|
* Returns a channel summary, or an `apiCall`-shaped failure.
|
|
249
251
|
*/
|
|
250
252
|
async function ensureChannel(
|
|
251
|
-
{ project_id, repo_url, slug,
|
|
253
|
+
{ project_id, repo_url, slug, description, tech_stack, create_channel },
|
|
252
254
|
{ resolveProject, createKbScope },
|
|
253
255
|
) {
|
|
254
256
|
// An explicit project_id is taken at face value — the caller already resolved it, and
|
|
@@ -305,12 +307,14 @@ async function ensureChannel(
|
|
|
305
307
|
0,
|
|
306
308
|
`Could not derive a valid project slug from repo_url ${JSON.stringify(repo_url)} ` +
|
|
307
309
|
`(needs ${SLUG_MIN_LENGTH}-${SLUG_MAX_LENGTH} chars of lowercase alphanumerics and ` +
|
|
308
|
-
`hyphens). Pass an explicit slug.`,
|
|
310
|
+
`hyphens or underscores). Pass an explicit slug.`,
|
|
309
311
|
);
|
|
310
312
|
}
|
|
311
313
|
|
|
312
314
|
const created = await createKbScope({
|
|
313
|
-
|
|
315
|
+
// A channel's name IS its slug (#1038): the server refuses a kb scope whose name
|
|
316
|
+
// differs, so the tool takes no `name` at all.
|
|
317
|
+
name: createSlug,
|
|
314
318
|
slug: createSlug,
|
|
315
319
|
repo_url,
|
|
316
320
|
description,
|
|
@@ -360,7 +364,6 @@ export async function createHandoff(args = {}, deps = {}) {
|
|
|
360
364
|
project_id,
|
|
361
365
|
repo_url,
|
|
362
366
|
slug,
|
|
363
|
-
name,
|
|
364
367
|
description,
|
|
365
368
|
tech_stack,
|
|
366
369
|
to_host,
|
|
@@ -383,7 +386,7 @@ export async function createHandoff(args = {}, deps = {}) {
|
|
|
383
386
|
}
|
|
384
387
|
|
|
385
388
|
const channel = await ensureChannel(
|
|
386
|
-
{ project_id, repo_url, slug,
|
|
389
|
+
{ project_id, repo_url, slug, description, tech_stack, create_channel },
|
|
387
390
|
deps,
|
|
388
391
|
);
|
|
389
392
|
if (channel?.error === true) return channel;
|
package/lib/project-update.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* loopctl #1036). Without it no session could set a work project's `repo_url`, so SessionStart,
|
|
4
4
|
* which resolves channels by `repo_url`, found no channel for that repo.
|
|
5
5
|
*
|
|
6
|
-
* WHAT THE ENDPOINT ACCEPTS: `name`, `repo_url`, `description`, `tech_stack`,
|
|
7
|
-
* `metadata`. It drops every nil, so a request naming none is a 200 that changes
|
|
8
|
-
* refused here. `slug`
|
|
9
|
-
*
|
|
6
|
+
* WHAT THE ENDPOINT ACCEPTS: `name`, `slug`, `repo_url`, `description`, `tech_stack`,
|
|
7
|
+
* `mission`, `metadata`. It drops every nil, so a request naming none is a 200 that changes
|
|
8
|
+
* nothing: refused here. Only a kind: kb scope's `slug` can change, and its name follows it
|
|
9
|
+
* (#1038); a work project's slug change is a 422. A body carrying `status` is a 422 (archive
|
|
10
|
+
* and restore have their own routes), so it is never sent. An empty `mission` clears it.
|
|
10
11
|
*
|
|
11
12
|
* KEY: orchestrator role on a human-anchored tenant; index.js injects the orchestrator-pinned
|
|
12
13
|
* `apiCall`, as it does for the epic writes.
|
|
@@ -14,7 +15,15 @@
|
|
|
14
15
|
|
|
15
16
|
import { uuid as uuidRefusal } from "./delivery-loop.js";
|
|
16
17
|
|
|
17
|
-
export const PROJECT_UPDATABLE = [
|
|
18
|
+
export const PROJECT_UPDATABLE = [
|
|
19
|
+
"name",
|
|
20
|
+
"slug",
|
|
21
|
+
"repo_url",
|
|
22
|
+
"description",
|
|
23
|
+
"tech_stack",
|
|
24
|
+
"mission",
|
|
25
|
+
"metadata",
|
|
26
|
+
];
|
|
18
27
|
|
|
19
28
|
export function projectPath(projectId) {
|
|
20
29
|
return `/api/v1/projects/${encodeURIComponent(projectId)}`;
|