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.js CHANGED
@@ -1913,18 +1913,6 @@ var FLOW_DISPATCH_GUIDELINES = [
1913
1913
  `resources yourself using GitLab API tools, then dispatch ONE general subagent whose prompt`,
1914
1914
  `includes all flow executions (N flows x M resources) to run in parallel.`
1915
1915
  ].join("\n");
1916
- var AGENT_CREATION_GUIDELINES = `## Creating Custom GitLab Agents
1917
-
1918
- Before calling gitlab_create_agent, you MUST:
1919
- 1. Call gitlab_list_builtin_tools and gitlab_list_project_mcp_servers.
1920
- 2. Ask the user 4 questions using the question tool (one call, all 4 questions):
1921
- - Agent name (suggest one, allow custom)
1922
- - Visibility: Public or Private
1923
- - Tools: show tools grouped by category as multi-select (Search, Issues, MRs, Epics, Files, Git, CI/CD, Security, Audit, Planning, Wiki, API)
1924
- - MCP servers: multi-select from available servers
1925
- 3. Show the generated system prompt and ask for confirmation.
1926
- 4. Only then call gitlab_create_agent. Use full tool GIDs like "gid://gitlab/Ai::Catalog::BuiltInTool/1".
1927
- 5. Ask if the user wants to enable it on the current project.`;
1928
1916
  var FLOW_SCHEMA_REFERENCE = `## Flow YAML Schema Reference
1929
1917
 
1930
1918
  ### Top-level structure (all required unless noted):
@@ -2085,52 +2073,6 @@ prompts:
2085
2073
  user: "Fix this vulnerability: {{vuln_data}}"
2086
2074
  placeholder: history
2087
2075
  \`\`\``;
2088
- var PROJECT_KNOWLEDGE_HINT = `## Project Knowledge
2089
- This project may have persistent memory and skills available via knowledge tools.
2090
- Use gitlab_memory_load to check for existing project context (facts, decisions, patterns).
2091
- Use gitlab_skill_list to discover available task-specific skills.
2092
- When you learn something new about the project, use gitlab_memory_record to preserve it.
2093
- When you complete a significant task, consider using gitlab_memory_log_session to log learnings.
2094
-
2095
- ### Bootstrap Project Memory
2096
- When the user says "bootstrap project memory", "initialize memory", or "build project knowledge":
2097
- 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.
2098
- 2. Call gitlab_memory_load with the extracted project path to check if memory already exists.
2099
- 3. **If memory is empty** \u2014 do a full bootstrap:
2100
- a. Gather project knowledge:
2101
- - Read the project README, key config files, and codebase structure (use file/repo tools).
2102
- - Fetch project details via gitlab_get_project.
2103
- - List open issues (gitlab_list_issues, state=opened, limit=20).
2104
- - List open merge requests (gitlab_list_merge_requests, state=opened, limit=10).
2105
- - Check recent pipelines (gitlab_list_pipelines, limit=5).
2106
- - List project members (gitlab_list_project_members).
2107
- b. Record each category as separate memory entries using gitlab_memory_record:
2108
- - fact: project overview (name, purpose, tech stack, language, dependencies)
2109
- - fact: architecture and codebase structure (key files, modules, patterns)
2110
- - fact: CI/CD pipeline configuration (stages, jobs, deployment targets)
2111
- - fact: open issues summary (count, key issues, labels)
2112
- - fact: open MRs summary (count, key MRs, review status)
2113
- - fact: team and contributors
2114
- - pattern: development workflow observations (branching, review process, release cycle)
2115
- c. Log a session with gitlab_memory_log_session summarizing the bootstrap.
2116
- 4. **If memory exists** \u2014 do a smart refresh:
2117
- a. Show a brief summary of existing memory to the user (how many facts, decisions, patterns, date range).
2118
- b. Gather CURRENT project state (same data as step 3a).
2119
- c. Compare current state with each stored fact. For each record:
2120
- - If the fact is still accurate \u2192 keep it (no action).
2121
- - If the fact is outdated \u2192 call gitlab_memory_update(slug, corrected_content).
2122
- - If the fact is no longer relevant (e.g., closed issue) \u2192 call gitlab_memory_archive(slug, reason).
2123
- - If something new is found that's not in memory \u2192 call gitlab_memory_record.
2124
- d. Log a session with gitlab_memory_log_session summarizing the refresh (what was updated, archived, added).
2125
-
2126
- ### Memory Consolidation
2127
- When the user says "consolidate memory", "clean up memory", or "review memory":
2128
- 1. Call gitlab_memory_consolidate to load all records with review instructions.
2129
- 2. Follow the returned instructions to identify stale, duplicate, or contradictory entries.
2130
- 3. Use gitlab_memory_update, gitlab_memory_archive, and gitlab_memory_record as needed.
2131
- 4. Log a consolidation session.
2132
-
2133
- 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.`;
2134
2076
 
2135
2077
  // src/hooks.ts
2136
2078
  function buildFlowSubagentPrompt(flow, projectPath, projectUrl) {
@@ -2289,8 +2231,10 @@ function makeSystemTransformHook(flowAgents, getAuthCache) {
2289
2231
  output.system.push(FLOW_DISPATCH_GUIDELINES);
2290
2232
  }
2291
2233
  if (getAuthCache()) {
2292
- output.system.push(AGENT_CREATION_GUIDELINES);
2293
- output.system.push(PROJECT_KNOWLEDGE_HINT);
2234
+ output.system.push(
2235
+ `## Project Knowledge
2236
+ Project memory tools are available (gitlab_memory_load, gitlab_memory_record, gitlab_memory_recall). Say "bootstrap project memory" to initialize or refresh project knowledge.`
2237
+ );
2294
2238
  }
2295
2239
  };
2296
2240
  }
@@ -3484,17 +3428,37 @@ async function searchWikiPages(instanceUrl, token, scope, id, query) {
3484
3428
  var z5 = tool5.schema;
3485
3429
  var PREFIX = "agents";
3486
3430
  var ARCHIVE_DIR = `${PREFIX}/memory/archive`;
3431
+ var MEMORY_TYPES = [
3432
+ "facts",
3433
+ "decisions",
3434
+ "patterns",
3435
+ "architecture",
3436
+ "conventions",
3437
+ "troubleshooting",
3438
+ "people-and-contexts"
3439
+ ];
3487
3440
  var MEMORY_DIRS = {
3488
- all: [`${PREFIX}/memory/facts`, `${PREFIX}/memory/decisions`, `${PREFIX}/memory/patterns`],
3489
- facts: [`${PREFIX}/memory/facts`],
3490
- decisions: [`${PREFIX}/memory/decisions`],
3491
- patterns: [`${PREFIX}/memory/patterns`],
3441
+ all: MEMORY_TYPES.map((t) => `${PREFIX}/memory/${t}`),
3442
+ ...Object.fromEntries(MEMORY_TYPES.map((t) => [t, [`${PREFIX}/memory/${t}`]])),
3492
3443
  archive: [ARCHIVE_DIR]
3493
3444
  };
3445
+ var RECORD_TYPES = [
3446
+ "fact",
3447
+ "decision",
3448
+ "pattern",
3449
+ "architecture",
3450
+ "convention",
3451
+ "troubleshooting",
3452
+ "people"
3453
+ ];
3494
3454
  var RECORD_DIR = {
3495
3455
  fact: `${PREFIX}/memory/facts`,
3496
3456
  decision: `${PREFIX}/memory/decisions`,
3497
- pattern: `${PREFIX}/memory/patterns`
3457
+ pattern: `${PREFIX}/memory/patterns`,
3458
+ architecture: `${PREFIX}/memory/architecture`,
3459
+ convention: `${PREFIX}/memory/conventions`,
3460
+ troubleshooting: `${PREFIX}/memory/troubleshooting`,
3461
+ people: `${PREFIX}/memory/people-and-contexts`
3498
3462
  };
3499
3463
  var PROJECT_ID_DESC = 'FULL project path with namespace (e.g., "gitlab-org/gitlab"). Must contain a slash. Never use just the project name.';
3500
3464
  function today() {
@@ -3529,11 +3493,11 @@ function makeMemoryTools(ctx) {
3529
3493
  }
3530
3494
  return {
3531
3495
  gitlab_memory_load: tool5({
3532
- 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.",
3496
+ 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.",
3533
3497
  args: {
3534
3498
  project_id: z5.string().describe(PROJECT_ID_DESC),
3535
- type: z5.enum(["all", "facts", "decisions", "patterns", "archive"]).optional().describe(
3536
- 'Which memory to load: "all" (default), "facts", "decisions", "patterns", or "archive" (retired entries)'
3499
+ type: z5.enum(["all", ...MEMORY_TYPES, "archive"]).optional().describe(
3500
+ 'Which memory to load: "all" (default), "facts", "decisions", "patterns", "architecture", "conventions", "troubleshooting", "people-and-contexts", or "archive"'
3537
3501
  ),
3538
3502
  scope: z5.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
3539
3503
  group_id: z5.string().optional().describe("Group path (required when scope is groups)")
@@ -3574,10 +3538,10 @@ ${entries}`
3574
3538
  }
3575
3539
  }),
3576
3540
  gitlab_memory_record: tool5({
3577
- 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.",
3541
+ 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",
3578
3542
  args: {
3579
3543
  project_id: z5.string().describe(PROJECT_ID_DESC),
3580
- type: z5.enum(["fact", "decision", "pattern"]).describe("Type of knowledge to record"),
3544
+ type: z5.enum([...RECORD_TYPES]).describe("Type of knowledge to record"),
3581
3545
  content: z5.string().describe("The knowledge to record (markdown)"),
3582
3546
  scope: z5.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
3583
3547
  group_id: z5.string().optional().describe("Group path (required when scope is groups)")
@@ -3691,9 +3655,7 @@ ${entries}`
3691
3655
  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.",
3692
3656
  args: {
3693
3657
  project_id: z5.string().describe(PROJECT_ID_DESC),
3694
- type: z5.enum(["all", "facts", "decisions", "patterns"]).optional().describe(
3695
- 'Which memory to consolidate: "all" (default), "facts", "decisions", or "patterns"'
3696
- ),
3658
+ type: z5.enum(["all", ...MEMORY_TYPES]).optional().describe('Which memory to consolidate: "all" (default) or a specific type'),
3697
3659
  scope: z5.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
3698
3660
  group_id: z5.string().optional().describe("Group path (required when scope is groups)")
3699
3661
  },