opencode-gitlab-dap 1.10.0 → 1.11.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/dist/index.cjs CHANGED
@@ -2082,18 +2082,6 @@ var FLOW_DISPATCH_GUIDELINES = [
2082
2082
  `resources yourself using GitLab API tools, then dispatch ONE general subagent whose prompt`,
2083
2083
  `includes all flow executions (N flows x M resources) to run in parallel.`
2084
2084
  ].join("\n");
2085
- var AGENT_CREATION_GUIDELINES = `## Creating Custom GitLab Agents
2086
-
2087
- Before calling gitlab_create_agent, you MUST:
2088
- 1. Call gitlab_list_builtin_tools and gitlab_list_project_mcp_servers.
2089
- 2. Ask the user 4 questions using the question tool (one call, all 4 questions):
2090
- - Agent name (suggest one, allow custom)
2091
- - Visibility: Public or Private
2092
- - Tools: show tools grouped by category as multi-select (Search, Issues, MRs, Epics, Files, Git, CI/CD, Security, Audit, Planning, Wiki, API)
2093
- - MCP servers: multi-select from available servers
2094
- 3. Show the generated system prompt and ask for confirmation.
2095
- 4. Only then call gitlab_create_agent. Use full tool GIDs like "gid://gitlab/Ai::Catalog::BuiltInTool/1".
2096
- 5. Ask if the user wants to enable it on the current project.`;
2097
2085
  var FLOW_SCHEMA_REFERENCE = `## Flow YAML Schema Reference
2098
2086
 
2099
2087
  ### Top-level structure (all required unless noted):
@@ -2254,52 +2242,6 @@ prompts:
2254
2242
  user: "Fix this vulnerability: {{vuln_data}}"
2255
2243
  placeholder: history
2256
2244
  \`\`\``;
2257
- var PROJECT_KNOWLEDGE_HINT = `## Project Knowledge
2258
- This project may have persistent memory and skills available via knowledge tools.
2259
- Use gitlab_memory_load to check for existing project context (facts, decisions, patterns).
2260
- Use gitlab_skill_list to discover available task-specific skills.
2261
- When you learn something new about the project, use gitlab_memory_record to preserve it.
2262
- When you complete a significant task, consider using gitlab_memory_log_session to log learnings.
2263
-
2264
- ### Bootstrap Project Memory
2265
- When the user says "bootstrap project memory", "initialize memory", or "build project knowledge":
2266
- 1. FIRST: Determine the project path by running \`run_git_command("remote", ["-v"])\` and extracting the path from the git remote URL (e.g., "git@gitlab.com:my-group/my-project.git" \u2192 "my-group/my-project"). NEVER guess the project path.
2267
- 2. Call gitlab_memory_load with the extracted project path to check if memory already exists.
2268
- 3. **If memory is empty** \u2014 do a full bootstrap:
2269
- a. Gather project knowledge:
2270
- - Read the project README, key config files, and codebase structure (use file/repo tools).
2271
- - Fetch project details via gitlab_get_project.
2272
- - List open issues (gitlab_list_issues, state=opened, limit=20).
2273
- - List open merge requests (gitlab_list_merge_requests, state=opened, limit=10).
2274
- - Check recent pipelines (gitlab_list_pipelines, limit=5).
2275
- - List project members (gitlab_list_project_members).
2276
- b. Record each category as separate memory entries using gitlab_memory_record:
2277
- - fact: project overview (name, purpose, tech stack, language, dependencies)
2278
- - fact: architecture and codebase structure (key files, modules, patterns)
2279
- - fact: CI/CD pipeline configuration (stages, jobs, deployment targets)
2280
- - fact: open issues summary (count, key issues, labels)
2281
- - fact: open MRs summary (count, key MRs, review status)
2282
- - fact: team and contributors
2283
- - pattern: development workflow observations (branching, review process, release cycle)
2284
- c. Log a session with gitlab_memory_log_session summarizing the bootstrap.
2285
- 4. **If memory exists** \u2014 do a smart refresh:
2286
- a. Show a brief summary of existing memory to the user (how many facts, decisions, patterns, date range).
2287
- b. Gather CURRENT project state (same data as step 3a).
2288
- c. Compare current state with each stored fact. For each record:
2289
- - If the fact is still accurate \u2192 keep it (no action).
2290
- - If the fact is outdated \u2192 call gitlab_memory_update(slug, corrected_content).
2291
- - If the fact is no longer relevant (e.g., closed issue) \u2192 call gitlab_memory_archive(slug, reason).
2292
- - If something new is found that's not in memory \u2192 call gitlab_memory_record.
2293
- d. Log a session with gitlab_memory_log_session summarizing the refresh (what was updated, archived, added).
2294
-
2295
- ### Memory Consolidation
2296
- When the user says "consolidate memory", "clean up memory", or "review memory":
2297
- 1. Call gitlab_memory_consolidate to load all records with review instructions.
2298
- 2. Follow the returned instructions to identify stale, duplicate, or contradictory entries.
2299
- 3. Use gitlab_memory_update, gitlab_memory_archive, and gitlab_memory_record as needed.
2300
- 4. Log a consolidation session.
2301
-
2302
- IMPORTANT: Always extract the project path from git remote \u2014 never guess it. Fire multiple gitlab_memory_record calls in parallel \u2014 each creates its own page, so parallel writes are safe.`;
2303
2245
 
2304
2246
  // src/hooks.ts
2305
2247
  function buildFlowSubagentPrompt(flow, projectPath, projectUrl) {
@@ -2458,8 +2400,10 @@ function makeSystemTransformHook(flowAgents, getAuthCache) {
2458
2400
  output.system.push(FLOW_DISPATCH_GUIDELINES);
2459
2401
  }
2460
2402
  if (getAuthCache()) {
2461
- output.system.push(AGENT_CREATION_GUIDELINES);
2462
- output.system.push(PROJECT_KNOWLEDGE_HINT);
2403
+ output.system.push(
2404
+ `## Project Knowledge
2405
+ Project memory tools are available (gitlab_memory_load, gitlab_memory_record, gitlab_memory_recall). Say "bootstrap project memory" to initialize or refresh project knowledge.`
2406
+ );
2463
2407
  }
2464
2408
  };
2465
2409
  }
@@ -3653,17 +3597,37 @@ async function searchWikiPages(instanceUrl, token, scope, id, query) {
3653
3597
  var z5 = import_plugin5.tool.schema;
3654
3598
  var PREFIX = "agents";
3655
3599
  var ARCHIVE_DIR = `${PREFIX}/memory/archive`;
3600
+ var MEMORY_TYPES = [
3601
+ "facts",
3602
+ "decisions",
3603
+ "patterns",
3604
+ "architecture",
3605
+ "conventions",
3606
+ "troubleshooting",
3607
+ "people-and-contexts"
3608
+ ];
3656
3609
  var MEMORY_DIRS = {
3657
- all: [`${PREFIX}/memory/facts`, `${PREFIX}/memory/decisions`, `${PREFIX}/memory/patterns`],
3658
- facts: [`${PREFIX}/memory/facts`],
3659
- decisions: [`${PREFIX}/memory/decisions`],
3660
- patterns: [`${PREFIX}/memory/patterns`],
3610
+ all: MEMORY_TYPES.map((t) => `${PREFIX}/memory/${t}`),
3611
+ ...Object.fromEntries(MEMORY_TYPES.map((t) => [t, [`${PREFIX}/memory/${t}`]])),
3661
3612
  archive: [ARCHIVE_DIR]
3662
3613
  };
3614
+ var RECORD_TYPES = [
3615
+ "fact",
3616
+ "decision",
3617
+ "pattern",
3618
+ "architecture",
3619
+ "convention",
3620
+ "troubleshooting",
3621
+ "people"
3622
+ ];
3663
3623
  var RECORD_DIR = {
3664
3624
  fact: `${PREFIX}/memory/facts`,
3665
3625
  decision: `${PREFIX}/memory/decisions`,
3666
- pattern: `${PREFIX}/memory/patterns`
3626
+ pattern: `${PREFIX}/memory/patterns`,
3627
+ architecture: `${PREFIX}/memory/architecture`,
3628
+ convention: `${PREFIX}/memory/conventions`,
3629
+ troubleshooting: `${PREFIX}/memory/troubleshooting`,
3630
+ people: `${PREFIX}/memory/people-and-contexts`
3667
3631
  };
3668
3632
  var PROJECT_ID_DESC = 'FULL project path with namespace (e.g., "gitlab-org/gitlab"). Must contain a slash. Never use just the project name.';
3669
3633
  function today() {
@@ -3698,11 +3662,11 @@ function makeMemoryTools(ctx) {
3698
3662
  }
3699
3663
  return {
3700
3664
  gitlab_memory_load: (0, import_plugin5.tool)({
3701
- description: "Load project memory to understand context, known facts, past decisions, and observed patterns.\nUse this at the start of complex tasks to check what is already known about the project.\nReturns accumulated knowledge from previous sessions.\nEach entry includes its slug (page path) which can be used with gitlab_memory_update or gitlab_memory_archive.",
3665
+ description: "Load project memory to understand context, known facts, past decisions, and observed patterns.\nUse this at the start of complex tasks to check what is already known about the project.\nReturns accumulated knowledge from previous sessions.\nEach entry includes its slug (page path) which can be used with gitlab_memory_update or gitlab_memory_archive.\n\nBOOTSTRAP WORKFLOW \u2014 when user says 'bootstrap project memory':\n1. Get project path from run_git_command('remote', ['-v']) \u2014 NEVER guess.\n2. Call this tool to check if memory exists.\n3. If empty: gather knowledge (README, gitlab_get_project, gitlab_list_issues, gitlab_list_merge_requests, gitlab_list_pipelines, gitlab_list_project_members), then record using ALL THREE types:\n - type='fact': project overview, tech stack, dependencies, CI/CD config, open issues summary, open MRs summary\n - type='architecture': system design, module structure, key abstractions, data flow\n - type='decision': key architectural choices found in the codebase (framework choices, config patterns, deployment strategy)\n - type='convention': coding standards, naming patterns, commit conventions, review process\n - type='pattern': recurring observations (CI patterns, common failures, release cycle)\n - type='troubleshooting': known issues, workarounds, pipeline failures, common errors\n - type='people': team members, roles, ownership areas, key contacts\n Fire parallel gitlab_memory_record calls \u2014 each creates its own page.\n4. If exists: show summary, gather current state, compare with stored records, use gitlab_memory_update for stale, gitlab_memory_archive for outdated, gitlab_memory_record for new.\n5. Log session with gitlab_memory_log_session.",
3702
3666
  args: {
3703
3667
  project_id: z5.string().describe(PROJECT_ID_DESC),
3704
- type: z5.enum(["all", "facts", "decisions", "patterns", "archive"]).optional().describe(
3705
- 'Which memory to load: "all" (default), "facts", "decisions", "patterns", or "archive" (retired entries)'
3668
+ type: z5.enum(["all", ...MEMORY_TYPES, "archive"]).optional().describe(
3669
+ 'Which memory to load: "all" (default), "facts", "decisions", "patterns", "architecture", "conventions", "troubleshooting", "people-and-contexts", or "archive"'
3706
3670
  ),
3707
3671
  scope: z5.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
3708
3672
  group_id: z5.string().optional().describe("Group path (required when scope is groups)")
@@ -3743,10 +3707,10 @@ ${entries}`
3743
3707
  }
3744
3708
  }),
3745
3709
  gitlab_memory_record: (0, import_plugin5.tool)({
3746
- 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.\nEach record creates its own page \u2014 safe for parallel writes.",
3710
+ description: "Record knowledge in project memory. Each record creates its own page \u2014 safe for parallel writes.\nTypes:\n fact \u2014 stable truths (tech stack, dependencies, deploy targets, project metadata)\n decision \u2014 architectural choices with reasoning (why X over Y)\n pattern \u2014 recurring observations that may evolve into skills\n architecture \u2014 system design, module structure, data flow, key abstractions\n convention \u2014 coding standards, naming patterns, review process, commit conventions\n troubleshooting \u2014 known issues, workarounds, debugging tips, common errors\n people \u2014 team members, roles, ownership areas, contact context",
3747
3711
  args: {
3748
3712
  project_id: z5.string().describe(PROJECT_ID_DESC),
3749
- type: z5.enum(["fact", "decision", "pattern"]).describe("Type of knowledge to record"),
3713
+ type: z5.enum([...RECORD_TYPES]).describe("Type of knowledge to record"),
3750
3714
  content: z5.string().describe("The knowledge to record (markdown)"),
3751
3715
  scope: z5.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
3752
3716
  group_id: z5.string().optional().describe("Group path (required when scope is groups)")
@@ -3860,9 +3824,7 @@ ${entries}`
3860
3824
  description: "Review all memory records and get consolidation instructions.\nLoads all records of the specified type and returns them with their slugs,\nalong with instructions to identify and fix stale, duplicate, or contradictory entries.\nUse this periodically to keep project memory clean and accurate.",
3861
3825
  args: {
3862
3826
  project_id: z5.string().describe(PROJECT_ID_DESC),
3863
- type: z5.enum(["all", "facts", "decisions", "patterns"]).optional().describe(
3864
- 'Which memory to consolidate: "all" (default), "facts", "decisions", or "patterns"'
3865
- ),
3827
+ type: z5.enum(["all", ...MEMORY_TYPES]).optional().describe('Which memory to consolidate: "all" (default) or a specific type'),
3866
3828
  scope: z5.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
3867
3829
  group_id: z5.string().optional().describe("Group path (required when scope is groups)")
3868
3830
  },