@danmoisan/drm-copilot-mcp 1.1.2 → 1.1.3

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/out/mcp-server.js CHANGED
@@ -17261,6 +17261,7 @@ function toMcpToolResult(result) {
17261
17261
  ...result.bundledSourcePath === void 0 ? {} : { bundled_source_path: result.bundledSourcePath },
17262
17262
  ...result.destinationPath === void 0 ? {} : { destination_path: result.destinationPath },
17263
17263
  ...result.renderedTree === void 0 ? {} : { rendered_tree: result.renderedTree },
17264
+ ...result.targetRepository === void 0 ? {} : { target_repository: result.targetRepository },
17264
17265
  ...result.warnings === void 0 ? {} : { warnings: result.warnings }
17265
17266
  };
17266
17267
  }
@@ -31723,12 +31724,17 @@ function splitCombinedOutput(combined) {
31723
31724
  var RealGhClient = class {
31724
31725
  ghPath;
31725
31726
  runner;
31727
+ repo;
31726
31728
  /**
31727
31729
  * Construct a client, resolving and validating the `gh` executable.
31728
31730
  *
31729
31731
  * @param options Optional injected `runner` (defaults to
31730
- * {@link SpawnSyncGhCommandRunner}) and `ghPathLookup` (defaults to
31731
- * {@link defaultGhPathLookup}) so tests never touch the real PATH.
31732
+ * {@link SpawnSyncGhCommandRunner}), `ghPathLookup` (defaults to
31733
+ * {@link defaultGhPathLookup}) so tests never touch the real PATH, and
31734
+ * `repo` — an explicit `owner/name` target repository. When `repo` is
31735
+ * supplied, every repository-scoped invocation names it explicitly so the
31736
+ * process working directory cannot influence repository selection; when it
31737
+ * is omitted the argument vectors are unchanged.
31732
31738
  * @throws Error With {@link GH_NOT_FOUND_MESSAGE} when `gh` cannot be resolved.
31733
31739
  */
31734
31740
  constructor(options) {
@@ -31739,6 +31745,16 @@ var RealGhClient = class {
31739
31745
  }
31740
31746
  this.ghPath = resolved;
31741
31747
  this.runner = options?.runner ?? new SpawnSyncGhCommandRunner();
31748
+ this.repo = options?.repo;
31749
+ }
31750
+ /**
31751
+ * Repository selector fragment spliced after the subcommand words.
31752
+ *
31753
+ * @returns `["--repo", "<owner/name>"]` when bound, otherwise an empty vector
31754
+ * so an unbound client keeps its pre-change argument vectors exactly.
31755
+ */
31756
+ repoSelector() {
31757
+ return this.repo === void 0 ? [] : ["--repo", this.repo];
31742
31758
  }
31743
31759
  /**
31744
31760
  * Run a `gh` invocation and build a {@link GhResult} from combined output.
@@ -31771,6 +31787,7 @@ var RealGhClient = class {
31771
31787
  const args = [
31772
31788
  "issue",
31773
31789
  "create",
31790
+ ...this.repoSelector(),
31774
31791
  "--title",
31775
31792
  title,
31776
31793
  "--body-file",
@@ -31790,6 +31807,7 @@ var RealGhClient = class {
31790
31807
  const args = [
31791
31808
  "label",
31792
31809
  "create",
31810
+ ...this.repoSelector(),
31793
31811
  label,
31794
31812
  "--color",
31795
31813
  FEATURE_LABEL_COLOR,
@@ -31808,6 +31826,7 @@ var RealGhClient = class {
31808
31826
  const args = [
31809
31827
  "issue",
31810
31828
  "view",
31829
+ ...this.repoSelector(),
31811
31830
  issueNumber,
31812
31831
  "--json",
31813
31832
  "number,title,url,author,updatedAt"
@@ -32241,6 +32260,78 @@ function promotePotential(options) {
32241
32260
  return { exitCode: 0, messages, destination: destPath };
32242
32261
  }
32243
32262
 
32263
+ // ../../extensions/drm-copilot/src/lib/potential-to-issue/repo-slug.ts
32264
+ var REPO_SLUG_UNRESOLVED_PREFIX = "Unable to resolve the target repository from workspace root";
32265
+ var REPO_VIEW_ARGS = [
32266
+ "repo",
32267
+ "view",
32268
+ "--json",
32269
+ "nameWithOwner"
32270
+ ];
32271
+ var NAME_WITH_OWNER_FIELD = "nameWithOwner";
32272
+ function defaultGhProgramName() {
32273
+ return "gh";
32274
+ }
32275
+ function unresolved(workspaceRoot, reason) {
32276
+ return new Error(
32277
+ `${REPO_SLUG_UNRESOLVED_PREFIX} ${workspaceRoot}: ${reason}`
32278
+ );
32279
+ }
32280
+ function extractSlug(stdout, workspaceRoot) {
32281
+ let payload;
32282
+ try {
32283
+ payload = JSON.parse(stdout);
32284
+ } catch (error2) {
32285
+ throw unresolved(
32286
+ workspaceRoot,
32287
+ `the resolution command produced unparseable output (${String(error2)})`
32288
+ );
32289
+ }
32290
+ if (typeof payload !== "object" || payload === null) {
32291
+ throw unresolved(
32292
+ workspaceRoot,
32293
+ "the resolution output is parseable but is not an object"
32294
+ );
32295
+ }
32296
+ if (!(NAME_WITH_OWNER_FIELD in payload)) {
32297
+ throw unresolved(
32298
+ workspaceRoot,
32299
+ `the resolution output carries no ${NAME_WITH_OWNER_FIELD} field`
32300
+ );
32301
+ }
32302
+ const slug = payload[NAME_WITH_OWNER_FIELD];
32303
+ if (typeof slug !== "string") {
32304
+ throw unresolved(
32305
+ workspaceRoot,
32306
+ `the ${NAME_WITH_OWNER_FIELD} field is not a string`
32307
+ );
32308
+ }
32309
+ return slug;
32310
+ }
32311
+ function resolveRepoSlug(input) {
32312
+ const { runner, workspaceRoot } = input;
32313
+ const ghPath = (input.ghPathLookup ?? defaultGhProgramName)();
32314
+ const result = runner.run([ghPath, ...REPO_VIEW_ARGS], {
32315
+ cwd: workspaceRoot,
32316
+ allowError: true
32317
+ });
32318
+ if (result.code !== 0) {
32319
+ const detail = result.stderr.trim();
32320
+ throw unresolved(
32321
+ workspaceRoot,
32322
+ `the resolution command exited ${String(result.code)}${detail === "" ? "" : `: ${detail}`}`
32323
+ );
32324
+ }
32325
+ const stdout = result.stdout.trim();
32326
+ if (stdout === "") {
32327
+ throw unresolved(
32328
+ workspaceRoot,
32329
+ "the resolution command produced empty output"
32330
+ );
32331
+ }
32332
+ return extractSlug(stdout, workspaceRoot);
32333
+ }
32334
+
32244
32335
  // ../../extensions/drm-copilot/src/lib/potential-to-issue/potential-to-issue-service-call.ts
32245
32336
  var CommandRunnerGhAdapter = class {
32246
32337
  constructor(runner) {
@@ -32265,7 +32356,12 @@ var CommandRunnerGhAdapter = class {
32265
32356
  }
32266
32357
  };
32267
32358
  function potentialToIssueServiceCall(input) {
32268
- const ghClient = input.gh ?? new RealGhClient({ runner: new CommandRunnerGhAdapter(input.runner) });
32359
+ const resolveSlug = input.repoSlugResolver ?? ((workspaceRoot) => resolveRepoSlug({ runner: input.runner, workspaceRoot }));
32360
+ const targetRepository = resolveSlug(input.workspaceRoot);
32361
+ const ghClient = input.gh ?? new RealGhClient({
32362
+ runner: new CommandRunnerGhAdapter(input.runner),
32363
+ repo: targetRepository
32364
+ });
32269
32365
  const fileSystem = input.fileSystem ?? new RealPotentialFileSystem();
32270
32366
  const outcome = promotePotential({
32271
32367
  potentialPath: input.potentialPath,
@@ -32292,6 +32388,7 @@ ${outcome.messages.join("\n")}` : "";
32292
32388
  tool: "potential_to_issue",
32293
32389
  workspaceRoot: input.workspaceRoot,
32294
32390
  summary,
32391
+ targetRepository,
32295
32392
  ...outcome.destination === void 0 ? {} : { destinationPath: normalizeGeneratedPath(outcome.destination) },
32296
32393
  ...issueUrl === null ? {} : { artifacts: [issueUrl] }
32297
32394
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danmoisan/drm-copilot-mcp",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Stdio MCP server exposing drm-copilot repo-automation tools.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -9,9 +9,8 @@
9
9
  "Bash(bash .claude/lib/bash/compute-concurrency-batches.sh*)",
10
10
  "Bash(bash .claude/lib/bash/validate-parallel-manifest.sh*)",
11
11
  "Read",
12
- "Edit(/docs/**)",
13
- "Write(/docs/**)",
14
- "Write(/artifacts/**)",
12
+ "Edit(docs/**)",
13
+ "Edit(artifacts/**)",
15
14
  "mcp__drm-copilot__run_poshqc_format",
16
15
  "mcp__drm-copilot__run_poshqc_analyze",
17
16
  "mcp__drm-copilot__run_poshqc_test",
@@ -64,17 +63,13 @@
64
63
  "Skill(execute-hard-lock *)",
65
64
  "Skill(identify-session-id *)",
66
65
  "Skill(show-my-agent-tree *)",
67
- "Skill(mermaid-diagram *)",
68
- "Edit(/.claude/skills/execute-hard-lock/**)",
69
- "Edit(/.claude/skills/feature-review-workflow/**)",
70
- "Edit(/.claude/skills/csharp-qa-gate/**)"
66
+ "Skill(mermaid-diagram *)"
71
67
  ],
72
68
  "deny": [
73
69
  "Read(./.env)",
74
70
  "Read(./.env.*)",
75
71
  "Read(./secrets/**)",
76
- "Edit(./secrets/**)",
77
- "Write(./secrets/**)"
72
+ "Edit(./secrets/**)"
78
73
  ],
79
74
  "additionalDirectories": [
80
75
  "c:\\Users\\DanMoisan\\repos\\drm-copilot\\.claude\\skills\\execute-hard-lock"
@@ -2,7 +2,7 @@ default_permissions = ":danger-full-access"
2
2
 
3
3
  [mcp_servers.drm-copilot]
4
4
  command = "npx"
5
- args = ["-y", "@danmoisan/drm-copilot-mcp@1.1.2"]
5
+ args = ["-y", "@danmoisan/drm-copilot-mcp@1.1.3"]
6
6
  required = true
7
7
  enabled_tools = [
8
8
  "collect_commit_context",