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.cjs
CHANGED
|
@@ -3611,16 +3611,17 @@ async function searchWikiPages(instanceUrl, token, scope, id, query) {
|
|
|
3611
3611
|
|
|
3612
3612
|
// src/tools/memory-tools.ts
|
|
3613
3613
|
var z5 = import_plugin5.tool.schema;
|
|
3614
|
+
var PREFIX = "agents";
|
|
3614
3615
|
var MEMORY_SLUGS = {
|
|
3615
|
-
all: [
|
|
3616
|
-
facts: [
|
|
3617
|
-
decisions: [
|
|
3618
|
-
patterns: [
|
|
3616
|
+
all: [`${PREFIX}/memory/facts`, `${PREFIX}/memory/decisions`, `${PREFIX}/memory/patterns`],
|
|
3617
|
+
facts: [`${PREFIX}/memory/facts`],
|
|
3618
|
+
decisions: [`${PREFIX}/memory/decisions`],
|
|
3619
|
+
patterns: [`${PREFIX}/memory/patterns`]
|
|
3619
3620
|
};
|
|
3620
3621
|
var RECORD_SLUG = {
|
|
3621
|
-
fact:
|
|
3622
|
-
decision:
|
|
3623
|
-
pattern:
|
|
3622
|
+
fact: `${PREFIX}/memory/facts`,
|
|
3623
|
+
decision: `${PREFIX}/memory/decisions`,
|
|
3624
|
+
pattern: `${PREFIX}/memory/patterns`
|
|
3624
3625
|
};
|
|
3625
3626
|
function today() {
|
|
3626
3627
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
@@ -3636,13 +3637,12 @@ async function safeRead(instanceUrl, token, scope, id, slug) {
|
|
|
3636
3637
|
return null;
|
|
3637
3638
|
}
|
|
3638
3639
|
}
|
|
3639
|
-
async function appendToPage(instanceUrl, token, scope, id, slug, newContent
|
|
3640
|
+
async function appendToPage(instanceUrl, token, scope, id, slug, newContent) {
|
|
3640
3641
|
const existing = await safeRead(instanceUrl, token, scope, id, slug);
|
|
3641
3642
|
if (existing !== null) {
|
|
3642
3643
|
await updateWikiPage(instanceUrl, token, scope, id, slug, existing + "\n\n" + newContent);
|
|
3643
3644
|
} else {
|
|
3644
|
-
|
|
3645
|
-
await createWikiPage(instanceUrl, token, scope, id, title, newContent);
|
|
3645
|
+
await createWikiPage(instanceUrl, token, scope, id, slug, newContent);
|
|
3646
3646
|
}
|
|
3647
3647
|
}
|
|
3648
3648
|
function resolveScope(args) {
|
|
@@ -3684,7 +3684,7 @@ ${content}`);
|
|
|
3684
3684
|
}
|
|
3685
3685
|
}),
|
|
3686
3686
|
gitlab_memory_record: (0, import_plugin5.tool)({
|
|
3687
|
-
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.",
|
|
3687
|
+
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.",
|
|
3688
3688
|
args: {
|
|
3689
3689
|
project_id: z5.string().describe('Project path (e.g., "gitlab-org/gitlab"). Use the same value consistently.'),
|
|
3690
3690
|
type: z5.enum(["fact", "decision", "pattern"]).describe("Type of knowledge to record"),
|
|
@@ -3741,7 +3741,7 @@ ${args.content}`;
|
|
|
3741
3741
|
);
|
|
3742
3742
|
if (results.length === 0) return `No knowledge found matching "${args.query}".`;
|
|
3743
3743
|
return results.map((r) => {
|
|
3744
|
-
const category = r.path.
|
|
3744
|
+
const category = r.path.includes("/memory/") ? "memory" : r.path.includes("/skills") ? "skill" : "other";
|
|
3745
3745
|
const snippet = (r.data ?? "").slice(0, 200).replace(/\n/g, " ");
|
|
3746
3746
|
return `[${category}] ${r.path}: ${snippet}`;
|
|
3747
3747
|
}).join("\n\n");
|
|
@@ -3766,23 +3766,14 @@ ${args.content}`;
|
|
|
3766
3766
|
if (!auth) throw new Error("GitLab authentication not available");
|
|
3767
3767
|
const { scope, id } = resolveScope(args);
|
|
3768
3768
|
const date = today();
|
|
3769
|
-
const slug =
|
|
3770
|
-
const pageTitle = `${date}: ${args.title}`;
|
|
3769
|
+
const slug = `${PREFIX}/memory/sessions/${date}-${slugify(args.title)}`;
|
|
3771
3770
|
try {
|
|
3772
|
-
await createWikiPage(auth.instanceUrl, auth.token, scope, id,
|
|
3771
|
+
await createWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.summary);
|
|
3773
3772
|
return `Session logged: ${slug}`;
|
|
3774
3773
|
} catch (err) {
|
|
3775
3774
|
if (err.message?.includes("already exists") || err.message?.includes("422")) {
|
|
3776
3775
|
try {
|
|
3777
|
-
await updateWikiPage(
|
|
3778
|
-
auth.instanceUrl,
|
|
3779
|
-
auth.token,
|
|
3780
|
-
scope,
|
|
3781
|
-
id,
|
|
3782
|
-
slug,
|
|
3783
|
-
args.summary,
|
|
3784
|
-
pageTitle
|
|
3785
|
-
);
|
|
3776
|
+
await updateWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.summary);
|
|
3786
3777
|
return `Session log updated: ${slug}`;
|
|
3787
3778
|
} catch (err2) {
|
|
3788
3779
|
return `Error logging session: ${err2.message}`;
|
|
@@ -3798,6 +3789,9 @@ ${args.content}`;
|
|
|
3798
3789
|
// src/tools/skill-tools.ts
|
|
3799
3790
|
var import_plugin6 = require("@opencode-ai/plugin");
|
|
3800
3791
|
var z6 = import_plugin6.tool.schema;
|
|
3792
|
+
var PREFIX2 = "agents";
|
|
3793
|
+
var SKILLS_PREFIX = `${PREFIX2}/skills`;
|
|
3794
|
+
var DRAFTS_PREFIX = `${PREFIX2}/skills-drafts`;
|
|
3801
3795
|
function resolveScope2(args) {
|
|
3802
3796
|
if (args.scope === "groups" && args.group_id) {
|
|
3803
3797
|
return { scope: "groups", id: args.group_id };
|
|
@@ -3820,13 +3814,17 @@ function makeSkillTools(ctx) {
|
|
|
3820
3814
|
const { scope, id } = resolveScope2(args);
|
|
3821
3815
|
try {
|
|
3822
3816
|
const pages = await listWikiPages(auth.instanceUrl, auth.token, scope, id);
|
|
3823
|
-
const
|
|
3817
|
+
const indexSlug = `${SKILLS_PREFIX}/index`;
|
|
3818
|
+
const skills = pages.filter((p) => p.slug.startsWith(`${SKILLS_PREFIX}/`) && p.slug !== indexSlug).map((p) => ({
|
|
3819
|
+
name: p.slug.slice(SKILLS_PREFIX.length + 1),
|
|
3820
|
+
title: p.title,
|
|
3821
|
+
draft: false
|
|
3822
|
+
}));
|
|
3824
3823
|
let drafts = [];
|
|
3825
3824
|
if (args.include_drafts) {
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
name: p.slug.replace("skills-drafts/", ""),
|
|
3825
|
+
const draftsIndexSlug = `${DRAFTS_PREFIX}/index`;
|
|
3826
|
+
drafts = pages.filter((p) => p.slug.startsWith(`${DRAFTS_PREFIX}/`) && p.slug !== draftsIndexSlug).map((p) => ({
|
|
3827
|
+
name: p.slug.slice(DRAFTS_PREFIX.length + 1),
|
|
3830
3828
|
title: p.title,
|
|
3831
3829
|
draft: true
|
|
3832
3830
|
}));
|
|
@@ -3857,7 +3855,7 @@ function makeSkillTools(ctx) {
|
|
|
3857
3855
|
auth.token,
|
|
3858
3856
|
scope,
|
|
3859
3857
|
id,
|
|
3860
|
-
|
|
3858
|
+
`${SKILLS_PREFIX}/${args.name}`
|
|
3861
3859
|
);
|
|
3862
3860
|
return page.content;
|
|
3863
3861
|
} catch {
|
|
@@ -3867,7 +3865,7 @@ function makeSkillTools(ctx) {
|
|
|
3867
3865
|
auth.token,
|
|
3868
3866
|
scope,
|
|
3869
3867
|
id,
|
|
3870
|
-
|
|
3868
|
+
`${DRAFTS_PREFIX}/${args.name}`
|
|
3871
3869
|
);
|
|
3872
3870
|
return `[DRAFT SKILL]
|
|
3873
3871
|
|
|
@@ -3892,22 +3890,14 @@ ${draft.content}`;
|
|
|
3892
3890
|
const auth = ctx.ensureAuth();
|
|
3893
3891
|
if (!auth) throw new Error("GitLab authentication not available");
|
|
3894
3892
|
const { scope, id } = resolveScope2(args);
|
|
3895
|
-
const prefix = args.draft ?
|
|
3893
|
+
const prefix = args.draft ? DRAFTS_PREFIX : SKILLS_PREFIX;
|
|
3896
3894
|
const slug = `${prefix}/${args.name}`;
|
|
3897
3895
|
try {
|
|
3898
|
-
await updateWikiPage(
|
|
3899
|
-
auth.instanceUrl,
|
|
3900
|
-
auth.token,
|
|
3901
|
-
scope,
|
|
3902
|
-
id,
|
|
3903
|
-
slug,
|
|
3904
|
-
args.content,
|
|
3905
|
-
args.name
|
|
3906
|
-
);
|
|
3896
|
+
await updateWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.content);
|
|
3907
3897
|
return `Updated ${args.draft ? "draft " : ""}skill: ${args.name}`;
|
|
3908
3898
|
} catch {
|
|
3909
3899
|
try {
|
|
3910
|
-
await createWikiPage(auth.instanceUrl, auth.token, scope, id,
|
|
3900
|
+
await createWikiPage(auth.instanceUrl, auth.token, scope, id, slug, args.content);
|
|
3911
3901
|
return `Created ${args.draft ? "draft " : ""}skill: ${args.name}`;
|
|
3912
3902
|
} catch (err) {
|
|
3913
3903
|
return `Error saving skill: ${err.message}`;
|
|
@@ -3927,34 +3917,30 @@ ${draft.content}`;
|
|
|
3927
3917
|
const auth = ctx.ensureAuth();
|
|
3928
3918
|
if (!auth) throw new Error("GitLab authentication not available");
|
|
3929
3919
|
const { scope, id } = resolveScope2(args);
|
|
3920
|
+
const draftSlug = `${DRAFTS_PREFIX}/${args.name}`;
|
|
3921
|
+
const publishedSlug = `${SKILLS_PREFIX}/${args.name}`;
|
|
3930
3922
|
try {
|
|
3931
|
-
const draft = await getWikiPage(
|
|
3932
|
-
auth.instanceUrl,
|
|
3933
|
-
auth.token,
|
|
3934
|
-
scope,
|
|
3935
|
-
id,
|
|
3936
|
-
`skills-drafts/${args.name}`
|
|
3937
|
-
);
|
|
3923
|
+
const draft = await getWikiPage(auth.instanceUrl, auth.token, scope, id, draftSlug);
|
|
3938
3924
|
try {
|
|
3939
3925
|
await updateWikiPage(
|
|
3940
3926
|
auth.instanceUrl,
|
|
3941
3927
|
auth.token,
|
|
3942
3928
|
scope,
|
|
3943
3929
|
id,
|
|
3944
|
-
|
|
3945
|
-
draft.content
|
|
3946
|
-
args.name
|
|
3930
|
+
publishedSlug,
|
|
3931
|
+
draft.content
|
|
3947
3932
|
);
|
|
3948
3933
|
} catch {
|
|
3949
|
-
await createWikiPage(
|
|
3934
|
+
await createWikiPage(
|
|
3935
|
+
auth.instanceUrl,
|
|
3936
|
+
auth.token,
|
|
3937
|
+
scope,
|
|
3938
|
+
id,
|
|
3939
|
+
publishedSlug,
|
|
3940
|
+
draft.content
|
|
3941
|
+
);
|
|
3950
3942
|
}
|
|
3951
|
-
await deleteWikiPage(
|
|
3952
|
-
auth.instanceUrl,
|
|
3953
|
-
auth.token,
|
|
3954
|
-
scope,
|
|
3955
|
-
id,
|
|
3956
|
-
`skills-drafts/${args.name}`
|
|
3957
|
-
);
|
|
3943
|
+
await deleteWikiPage(auth.instanceUrl, auth.token, scope, id, draftSlug);
|
|
3958
3944
|
return `Promoted skill "${args.name}" from draft to published.`;
|
|
3959
3945
|
} catch (err) {
|
|
3960
3946
|
if (err.message?.includes("not found") || err.message?.includes("404")) {
|