opencode-gitlab-dap 1.8.0 → 1.8.1
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/index.cjs +46 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -60
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3442,16 +3442,17 @@ async function searchWikiPages(instanceUrl, token, scope, id, query) {
|
|
|
3442
3442
|
|
|
3443
3443
|
// src/tools/memory-tools.ts
|
|
3444
3444
|
var z5 = tool5.schema;
|
|
3445
|
+
var PREFIX = "agents";
|
|
3445
3446
|
var MEMORY_SLUGS = {
|
|
3446
|
-
all: [
|
|
3447
|
-
facts: [
|
|
3448
|
-
decisions: [
|
|
3449
|
-
patterns: [
|
|
3447
|
+
all: [`${PREFIX}/memory/facts`, `${PREFIX}/memory/decisions`, `${PREFIX}/memory/patterns`],
|
|
3448
|
+
facts: [`${PREFIX}/memory/facts`],
|
|
3449
|
+
decisions: [`${PREFIX}/memory/decisions`],
|
|
3450
|
+
patterns: [`${PREFIX}/memory/patterns`]
|
|
3450
3451
|
};
|
|
3451
3452
|
var RECORD_SLUG = {
|
|
3452
|
-
fact:
|
|
3453
|
-
decision:
|
|
3454
|
-
pattern:
|
|
3453
|
+
fact: `${PREFIX}/memory/facts`,
|
|
3454
|
+
decision: `${PREFIX}/memory/decisions`,
|
|
3455
|
+
pattern: `${PREFIX}/memory/patterns`
|
|
3455
3456
|
};
|
|
3456
3457
|
function today() {
|
|
3457
3458
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
@@ -3467,13 +3468,12 @@ async function safeRead(instanceUrl, token, scope, id, slug) {
|
|
|
3467
3468
|
return null;
|
|
3468
3469
|
}
|
|
3469
3470
|
}
|
|
3470
|
-
async function appendToPage(instanceUrl, token, scope, id, slug, newContent
|
|
3471
|
+
async function appendToPage(instanceUrl, token, scope, id, slug, newContent) {
|
|
3471
3472
|
const existing = await safeRead(instanceUrl, token, scope, id, slug);
|
|
3472
3473
|
if (existing !== null) {
|
|
3473
3474
|
await updateWikiPage(instanceUrl, token, scope, id, slug, existing + "\n\n" + newContent);
|
|
3474
3475
|
} else {
|
|
3475
|
-
|
|
3476
|
-
await createWikiPage(instanceUrl, token, scope, id, title, newContent);
|
|
3476
|
+
await createWikiPage(instanceUrl, token, scope, id, slug, newContent);
|
|
3477
3477
|
}
|
|
3478
3478
|
}
|
|
3479
3479
|
function resolveScope(args) {
|
|
@@ -3515,7 +3515,7 @@ ${content}`);
|
|
|
3515
3515
|
}
|
|
3516
3516
|
}),
|
|
3517
3517
|
gitlab_memory_record: tool5({
|
|
3518
|
-
description: "Record a fact, decision, or pattern in project memory.\nFacts: stable truths about the project (e.g., deploy targets, tech stack, team conventions).\nDecisions: architectural choices with reasoning (why X was chosen over Y).\nPatterns: recurring observations that may evolve into skills over time.\nEntries are automatically timestamped.",
|
|
3518
|
+
description: "Record a fact, decision, or pattern in project memory.\nFacts: stable truths about the project (e.g., deploy targets, tech stack, team conventions).\nDecisions: architectural choices with reasoning (why X was chosen over Y).\nPatterns: recurring observations that may evolve into skills over time.\nEntries are automatically timestamped and appended to the appropriate memory page.\nMultiple facts can be recorded in a single call by separating them with newlines.",
|
|
3519
3519
|
args: {
|
|
3520
3520
|
project_id: z5.string().describe('Project path (e.g., "gitlab-org/gitlab"). Use the same value consistently.'),
|
|
3521
3521
|
type: z5.enum(["fact", "decision", "pattern"]).describe("Type of knowledge to record"),
|
|
@@ -3572,7 +3572,7 @@ ${args.content}`;
|
|
|
3572
3572
|
);
|
|
3573
3573
|
if (results.length === 0) return `No knowledge found matching "${args.query}".`;
|
|
3574
3574
|
return results.map((r) => {
|
|
3575
|
-
const category = r.path.
|
|
3575
|
+
const category = r.path.includes("/memory/") ? "memory" : r.path.includes("/skills") ? "skill" : "other";
|
|
3576
3576
|
const snippet = (r.data ?? "").slice(0, 200).replace(/\n/g, " ");
|
|
3577
3577
|
return `[${category}] ${r.path}: ${snippet}`;
|
|
3578
3578
|
}).join("\n\n");
|
|
@@ -3597,23 +3597,14 @@ ${args.content}`;
|
|
|
3597
3597
|
if (!auth) throw new Error("GitLab authentication not available");
|
|
3598
3598
|
const { scope, id } = resolveScope(args);
|
|
3599
3599
|
const date = today();
|
|
3600
|
-
const slug =
|
|
3601
|
-
const pageTitle = `${date}: ${args.title}`;
|
|
3600
|
+
const slug = `${PREFIX}/memory/sessions/${date}-${slugify(args.title)}`;
|
|
3602
3601
|
try {
|
|
3603
|
-
await createWikiPage(auth.instanceUrl, auth.token, scope, id,
|
|
3602
|
+
await createWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.summary);
|
|
3604
3603
|
return `Session logged: ${slug}`;
|
|
3605
3604
|
} catch (err) {
|
|
3606
3605
|
if (err.message?.includes("already exists") || err.message?.includes("422")) {
|
|
3607
3606
|
try {
|
|
3608
|
-
await updateWikiPage(
|
|
3609
|
-
auth.instanceUrl,
|
|
3610
|
-
auth.token,
|
|
3611
|
-
scope,
|
|
3612
|
-
id,
|
|
3613
|
-
slug,
|
|
3614
|
-
args.summary,
|
|
3615
|
-
pageTitle
|
|
3616
|
-
);
|
|
3607
|
+
await updateWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.summary);
|
|
3617
3608
|
return `Session log updated: ${slug}`;
|
|
3618
3609
|
} catch (err2) {
|
|
3619
3610
|
return `Error logging session: ${err2.message}`;
|
|
@@ -3629,6 +3620,9 @@ ${args.content}`;
|
|
|
3629
3620
|
// src/tools/skill-tools.ts
|
|
3630
3621
|
import { tool as tool6 } from "@opencode-ai/plugin";
|
|
3631
3622
|
var z6 = tool6.schema;
|
|
3623
|
+
var PREFIX2 = "agents";
|
|
3624
|
+
var SKILLS_PREFIX = `${PREFIX2}/skills`;
|
|
3625
|
+
var DRAFTS_PREFIX = `${PREFIX2}/skills-drafts`;
|
|
3632
3626
|
function resolveScope2(args) {
|
|
3633
3627
|
if (args.scope === "groups" && args.group_id) {
|
|
3634
3628
|
return { scope: "groups", id: args.group_id };
|
|
@@ -3651,13 +3645,17 @@ function makeSkillTools(ctx) {
|
|
|
3651
3645
|
const { scope, id } = resolveScope2(args);
|
|
3652
3646
|
try {
|
|
3653
3647
|
const pages = await listWikiPages(auth.instanceUrl, auth.token, scope, id);
|
|
3654
|
-
const
|
|
3648
|
+
const indexSlug = `${SKILLS_PREFIX}/index`;
|
|
3649
|
+
const skills = pages.filter((p) => p.slug.startsWith(`${SKILLS_PREFIX}/`) && p.slug !== indexSlug).map((p) => ({
|
|
3650
|
+
name: p.slug.slice(SKILLS_PREFIX.length + 1),
|
|
3651
|
+
title: p.title,
|
|
3652
|
+
draft: false
|
|
3653
|
+
}));
|
|
3655
3654
|
let drafts = [];
|
|
3656
3655
|
if (args.include_drafts) {
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
name: p.slug.replace("skills-drafts/", ""),
|
|
3656
|
+
const draftsIndexSlug = `${DRAFTS_PREFIX}/index`;
|
|
3657
|
+
drafts = pages.filter((p) => p.slug.startsWith(`${DRAFTS_PREFIX}/`) && p.slug !== draftsIndexSlug).map((p) => ({
|
|
3658
|
+
name: p.slug.slice(DRAFTS_PREFIX.length + 1),
|
|
3661
3659
|
title: p.title,
|
|
3662
3660
|
draft: true
|
|
3663
3661
|
}));
|
|
@@ -3688,7 +3686,7 @@ function makeSkillTools(ctx) {
|
|
|
3688
3686
|
auth.token,
|
|
3689
3687
|
scope,
|
|
3690
3688
|
id,
|
|
3691
|
-
|
|
3689
|
+
`${SKILLS_PREFIX}/${args.name}`
|
|
3692
3690
|
);
|
|
3693
3691
|
return page.content;
|
|
3694
3692
|
} catch {
|
|
@@ -3698,7 +3696,7 @@ function makeSkillTools(ctx) {
|
|
|
3698
3696
|
auth.token,
|
|
3699
3697
|
scope,
|
|
3700
3698
|
id,
|
|
3701
|
-
|
|
3699
|
+
`${DRAFTS_PREFIX}/${args.name}`
|
|
3702
3700
|
);
|
|
3703
3701
|
return `[DRAFT SKILL]
|
|
3704
3702
|
|
|
@@ -3723,22 +3721,14 @@ ${draft.content}`;
|
|
|
3723
3721
|
const auth = ctx.ensureAuth();
|
|
3724
3722
|
if (!auth) throw new Error("GitLab authentication not available");
|
|
3725
3723
|
const { scope, id } = resolveScope2(args);
|
|
3726
|
-
const prefix = args.draft ?
|
|
3724
|
+
const prefix = args.draft ? DRAFTS_PREFIX : SKILLS_PREFIX;
|
|
3727
3725
|
const slug = `${prefix}/${args.name}`;
|
|
3728
3726
|
try {
|
|
3729
|
-
await updateWikiPage(
|
|
3730
|
-
auth.instanceUrl,
|
|
3731
|
-
auth.token,
|
|
3732
|
-
scope,
|
|
3733
|
-
id,
|
|
3734
|
-
slug,
|
|
3735
|
-
args.content,
|
|
3736
|
-
args.name
|
|
3737
|
-
);
|
|
3727
|
+
await updateWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.content);
|
|
3738
3728
|
return `Updated ${args.draft ? "draft " : ""}skill: ${args.name}`;
|
|
3739
3729
|
} catch {
|
|
3740
3730
|
try {
|
|
3741
|
-
await createWikiPage(auth.instanceUrl, auth.token, scope, id,
|
|
3731
|
+
await createWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.content);
|
|
3742
3732
|
return `Created ${args.draft ? "draft " : ""}skill: ${args.name}`;
|
|
3743
3733
|
} catch (err) {
|
|
3744
3734
|
return `Error saving skill: ${err.message}`;
|
|
@@ -3758,34 +3748,30 @@ ${draft.content}`;
|
|
|
3758
3748
|
const auth = ctx.ensureAuth();
|
|
3759
3749
|
if (!auth) throw new Error("GitLab authentication not available");
|
|
3760
3750
|
const { scope, id } = resolveScope2(args);
|
|
3751
|
+
const draftSlug = `${DRAFTS_PREFIX}/${args.name}`;
|
|
3752
|
+
const publishedSlug = `${SKILLS_PREFIX}/${args.name}`;
|
|
3761
3753
|
try {
|
|
3762
|
-
const draft = await getWikiPage(
|
|
3763
|
-
auth.instanceUrl,
|
|
3764
|
-
auth.token,
|
|
3765
|
-
scope,
|
|
3766
|
-
id,
|
|
3767
|
-
`skills-drafts/${args.name}`
|
|
3768
|
-
);
|
|
3754
|
+
const draft = await getWikiPage(auth.instanceUrl, auth.token, scope, id, draftSlug);
|
|
3769
3755
|
try {
|
|
3770
3756
|
await updateWikiPage(
|
|
3771
3757
|
auth.instanceUrl,
|
|
3772
3758
|
auth.token,
|
|
3773
3759
|
scope,
|
|
3774
3760
|
id,
|
|
3775
|
-
|
|
3776
|
-
draft.content
|
|
3777
|
-
args.name
|
|
3761
|
+
publishedSlug,
|
|
3762
|
+
draft.content
|
|
3778
3763
|
);
|
|
3779
3764
|
} catch {
|
|
3780
|
-
await createWikiPage(
|
|
3765
|
+
await createWikiPage(
|
|
3766
|
+
auth.instanceUrl,
|
|
3767
|
+
auth.token,
|
|
3768
|
+
scope,
|
|
3769
|
+
id,
|
|
3770
|
+
publishedSlug,
|
|
3771
|
+
draft.content
|
|
3772
|
+
);
|
|
3781
3773
|
}
|
|
3782
|
-
await deleteWikiPage(
|
|
3783
|
-
auth.instanceUrl,
|
|
3784
|
-
auth.token,
|
|
3785
|
-
scope,
|
|
3786
|
-
id,
|
|
3787
|
-
`skills-drafts/${args.name}`
|
|
3788
|
-
);
|
|
3774
|
+
await deleteWikiPage(auth.instanceUrl, auth.token, scope, id, draftSlug);
|
|
3789
3775
|
return `Promoted skill "${args.name}" from draft to published.`;
|
|
3790
3776
|
} catch (err) {
|
|
3791
3777
|
if (err.message?.includes("not found") || err.message?.includes("404")) {
|