@jurislm/woodpecker-ci-plugin 2.1.0 → 2.1.2

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "woodpecker-ci",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Manage Woodpecker CI through agent tools.",
5
5
  "author": {
6
6
  "name": "JurisLM",
package/.mcp.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "mcpServers": {
3
3
  "woodpecker-ci": {
4
4
  "type": "stdio",
5
- "command": "bunx",
6
- "args": ["-y", "@jurislm/woodpecker-ci-plugin@latest"],
5
+ "command": "bun",
6
+ "args": ["x", "@jurislm/woodpecker-ci-plugin@latest"],
7
7
  "env_vars": ["WOODPECKER_URL", "WOODPECKER_API_TOKEN"]
8
8
  }
9
9
  }
package/.mcp.json.example CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "mcpServers": {
3
3
  "woodpecker-ci": {
4
- "command": "bunx",
5
- "args": ["-y", "@jurislm/woodpecker-ci-plugin@latest"],
4
+ "command": "bun",
5
+ "args": ["x", "@jurislm/woodpecker-ci-plugin@latest"],
6
6
  "env": {
7
7
  "WOODPECKER_URL": "https://ci.example.com/api",
8
8
  "WOODPECKER_API_TOKEN": "<set-in-host-environment>"
package/README.md CHANGED
@@ -26,8 +26,8 @@ The server does not read `DRONE_TOKEN`.
26
26
  {
27
27
  "mcpServers": {
28
28
  "woodpecker-ci": {
29
- "command": "bunx",
30
- "args": ["-y", "@jurislm/woodpecker-ci-plugin@latest"],
29
+ "command": "bun",
30
+ "args": ["x", "@jurislm/woodpecker-ci-plugin@latest"],
31
31
  "env": {
32
32
  "WOODPECKER_URL": "https://ci.example.com/api",
33
33
  "WOODPECKER_API_TOKEN": "..."
@@ -37,6 +37,13 @@ The server does not read `DRONE_TOKEN`.
37
37
  }
38
38
  ```
39
39
 
40
+ Launch with `bun x` rather than the separate `bunx` executable, which some
41
+ package-manager shims break. When `WOODPECKER_URL` or `WOODPECKER_API_TOKEN` is
42
+ missing, empty, or an unsubstituted `${...}` placeholder, the server fills it
43
+ from `~/.config/jurislm/plugin.env` (`KEY=value` or `export KEY=value` lines;
44
+ override the path with `JURISLM_PLUGIN_ENV`). Host values always take
45
+ precedence and values are never logged.
46
+
40
47
  The server exposes generated OpenAPI operations plus a focused pipeline
41
48
  inspection tool. It excludes `/user/token`, `/version`, and `/debug/pprof` plus
42
49
  its subpaths. The OpenAPI snapshot describes `/version` as JSON, but this
@@ -100,6 +107,7 @@ stop before the provider starts. No token is copied into Codex configuration.
100
107
  ```bash
101
108
  mkdir -p "$HOME/.codex/bin"
102
109
  cp launchers/woodpecker-desktop.zsh "$HOME/.codex/bin/woodpecker-mcp.zsh"
110
+ cp launchers/validate-woodpecker-runtime.mjs "$HOME/.codex/bin/validate-woodpecker-runtime.mjs"
103
111
  ```
104
112
 
105
113
  Configure the absolute launcher path in `~/.codex/config.toml`, preserve your
@@ -119,8 +127,7 @@ WOODPECKER_URL = "https://ci.example.com/api"
119
127
  enabled = false
120
128
  ```
121
129
 
122
- The launcher requires Bun at `$HOME/.bun/bin/bunx` and continues to use
123
- `@latest`. Read `initialize.serverInfo.version` and match the intended release;
130
+ The launcher requires Bun at `$HOME/.bun/bin/bun`, runs the validated [installed desktop runtime](#installed-desktop-runtime) with `--no-env-file --no-install`, without resolving `@latest`. Read `initialize.serverInfo.version` and match the intended release;
124
131
  a marketplace cache version is not the resolved running package version.
125
132
  `codex mcp get` reads a user registration; it does not prove a plugin-provided
126
133
  instance received that environment.
@@ -186,3 +193,14 @@ The configured API token is sent only as bearer authentication and is not
186
193
  included in logs or tool request metadata. Credential fields are removed from
187
194
  response schemas and tool results. Mutation requests are not retried
188
195
  automatically.
196
+
197
+
198
+ ### Installed desktop runtime
199
+
200
+ The desktop launcher requires Bun 1.4.3 or newer and a complete normal installation at `~/.local/share/jurislm/mcp/woodpecker-ci-plugin`. Copy `launchers/woodpecker-desktop.zsh` and its owner-specific `launchers/validate-woodpecker-runtime.mjs` together to the same launcher directory. Keep the existing launcher destination and registration; do not change required-server or tool-approval settings.
201
+
202
+ Prepare each installation or update in a separate staging directory with `bun add --exact @jurislm/woodpecker-ci-plugin@<approved-version>`, then verify `bun install --frozen-lockfile`. The installation's `package.json` and `bun.lock` are the only version authority. Startup validates the declared and resolved source, installed identity and binary path, then executes the installed entry with `--no-env-file --no-install`. It never resolves `@latest`, installs dependencies or loads a working-directory `.env`.
203
+
204
+ For offline recovery, retain a verified released tarball inside the runtime, for example `artifacts/woodpecker-ci-plugin-<version>.tgz`, and declare `file:artifacts/woodpecker-ci-plugin-<version>.tgz`. A complete same-platform Bun dependency cache, including transitive dependencies, is required; a release tarball alone is insufficient. First run `bun install --offline` to generate the lock, then verify a clean `bun install --offline --frozen-lockfile` rebuild. Existing locked installations use the frozen command directly. Absolute or escaping tarball paths, mutable versions, identity mismatches and tarball SHA512 drift are rejected before startup.
205
+
206
+ Before selecting a replacement, run the shipped validator against its staging directory with package name `@jurislm/woodpecker-ci-plugin` and binary name `woodpecker-ci-plugin`, verify published package contents, and perform an offline stdio initialize with dummy credentials. Move the verified complete directory to the runtime path only while this MCP is stopped. Keep the previous installation for rollback. Never copy credentials into the runtime. A successful standalone initialize is not evidence of a desktop reload or provider API access; verify those separately after deployment.
package/dist/config.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const CREDENTIAL_GROUPS: readonly [readonly ["WOODPECKER_URL", "WOODPECKER_API_TOKEN"]];
1
2
  export interface WoodpeckerConfig {
2
3
  baseUrl: string | undefined;
3
4
  token: string | undefined;
package/dist/config.js CHANGED
@@ -1,3 +1,4 @@
1
+ export const CREDENTIAL_GROUPS = [["WOODPECKER_URL", "WOODPECKER_API_TOKEN"]];
1
2
  export function loadConfig(env = process.env) {
2
3
  const baseUrl = env.WOODPECKER_URL?.trim().replace(/\/+$/u, "");
3
4
  const token = env.WOODPECKER_API_TOKEN?.trim();
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,UAAU,CAAC,MAA0C,OAAO,CAAC,GAAG;IAC9E,MAAM,OAAO,GAAG,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChE,MAAM,KAAK,GAAG,GAAG,CAAC,oBAAoB,EAAE,IAAI,EAAE,CAAC;IAC/C,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,SAAS;QAC7B,KAAK,EAAE,KAAK,IAAI,SAAS;QACzB,SAAS,EAAE,MAAM;KAClB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAU,CAAC;AAQvF,MAAM,UAAU,UAAU,CAAC,MAA0C,OAAO,CAAC,GAAG;IAC9E,MAAM,OAAO,GAAG,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChE,MAAM,KAAK,GAAG,GAAG,CAAC,oBAAoB,EAAE,IAAI,EAAE,CAAC;IAC/C,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,SAAS;QAC7B,KAAK,EAAE,KAAK,IAAI,SAAS;QACzB,SAAS,EAAE,MAAM;KAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type Environment = Record<string, string | undefined>;
2
+ export type CredentialGroups = readonly (readonly string[])[];
3
+ export declare const PLUGIN_ENV_PATH_VARIABLE = "JURISLM_PLUGIN_ENV";
4
+ export declare function parsePluginEnv(text: string): Record<string, string>;
5
+ export declare function pluginEnvPath(env: Environment): string;
6
+ export declare function withPluginEnv(env: Environment, groups: CredentialGroups, readText?: (path: string) => string, warn?: (message: string) => void): Environment;
@@ -0,0 +1,67 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join, resolve } from "node:path";
4
+ export const PLUGIN_ENV_PATH_VARIABLE = "JURISLM_PLUGIN_ENV";
5
+ const PLACEHOLDER = /^\$\{[^}]*\}$/u;
6
+ const ASSIGNMENT = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/u;
7
+ function isUnset(value) {
8
+ const trimmed = value?.trim();
9
+ return !trimmed || PLACEHOLDER.test(trimmed);
10
+ }
11
+ export function parsePluginEnv(text) {
12
+ const values = {};
13
+ for (const rawLine of text.split(/\r?\n/u)) {
14
+ const match = ASSIGNMENT.exec(rawLine.trim());
15
+ if (!match)
16
+ continue;
17
+ const [, name, rawValue] = match;
18
+ const quote = rawValue[0];
19
+ if (quote === '"' || quote === "'") {
20
+ const end = rawValue.indexOf(quote, 1);
21
+ if (end > 0)
22
+ values[name] = rawValue.slice(1, end);
23
+ }
24
+ else {
25
+ values[name] = rawValue.replace(/\s+#.*$/u, "").trim();
26
+ }
27
+ }
28
+ return values;
29
+ }
30
+ export function pluginEnvPath(env) {
31
+ const home = env.HOME?.trim() || homedir();
32
+ const override = env[PLUGIN_ENV_PATH_VARIABLE];
33
+ if (!override || isUnset(override))
34
+ return join(home, ".config", "jurislm", "plugin.env");
35
+ const path = override.trim();
36
+ return resolve(path === "~" || path.startsWith("~/") ? join(home, path.slice(1)) : path);
37
+ }
38
+ function readPluginEnv(path, readText, warn) {
39
+ try {
40
+ return parsePluginEnv(readText(path));
41
+ }
42
+ catch (error) {
43
+ const code = error.code;
44
+ if (code !== "ENOENT")
45
+ warn(`Could not read plugin env file ${path} (${code ?? "unknown error"})`);
46
+ return {};
47
+ }
48
+ }
49
+ export function withPluginEnv(env, groups, readText = (path) => readFileSync(path, "utf8"), warn = (message) => console.error(message)) {
50
+ if (groups.every((group) => group.every((name) => !isUnset(env[name]))))
51
+ return env;
52
+ const fileValues = groups.some((group) => group.every((name) => isUnset(env[name]))) ? readPluginEnv(pluginEnvPath(env), readText, warn) : {};
53
+ const resolved = { ...env };
54
+ for (const group of groups) {
55
+ const fillFromFile = group.every((name) => isUnset(env[name]));
56
+ for (const name of group) {
57
+ if (!isUnset(env[name]))
58
+ continue;
59
+ if (fillFromFile && !isUnset(fileValues[name]))
60
+ resolved[name] = fileValues[name];
61
+ else
62
+ delete resolved[name];
63
+ }
64
+ }
65
+ return resolved;
66
+ }
67
+ //# sourceMappingURL=plugin-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-env.js","sourceRoot":"","sources":["../src/plugin-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAK1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,MAAM,WAAW,GAAG,gBAAgB,CAAC;AACrC,MAAM,UAAU,GAAG,sDAAsD,CAAC;AAE1E,SAAS,OAAO,CAAC,KAAyB;IACxC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9B,OAAO,CAAC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC;QACjC,MAAM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,EAAE,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAAE,SAAS;YAClC,IAAI,YAAY,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;;gBAC7E,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
2
  import { createServer } from "../server.js";
3
- import { loadConfig } from "../config.js";
3
+ import { CREDENTIAL_GROUPS, loadConfig } from "../config.js";
4
+ import { withPluginEnv } from "../plugin-env.js";
4
5
  export async function runStdioServer(env = process.env) {
5
- const server = createServer(loadConfig(env));
6
+ const server = createServer(loadConfig(withPluginEnv(env, CREDENTIAL_GROUPS)));
6
7
  await server.connect(new StdioServerTransport());
7
8
  }
8
9
  //# sourceMappingURL=stdio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA0C,OAAO,CAAC,GAAG;IAErD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA0C,OAAO,CAAC,GAAG;IAErD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAC/E,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC"}
@@ -40,7 +40,7 @@ pagination and partial-failure semantics, and binary/stream output behavior.
40
40
  Each local server ships `launchers/<provider>-desktop.zsh`. The host invokes it
41
41
  with `/bin/zsh -f`. It explicitly sources `${ZDOTDIR:-$HOME}/.zshenv`, suppresses
42
42
  startup stdout, preserves stderr, checks required credentials, and execs the
43
- absolute `$HOME/.bun/bin/bunx` path. Preflight startup syntax; reject syntax
43
+ absolute `$HOME/.bun/bin/bun x` path. Preflight startup syntax; reject syntax
44
44
  errors and source status greater than 1. Status 1 may be a benign final
45
45
  optional-file guard; credential completeness still gates execution. Startup
46
46
  values may override inherited values, matching ordinary zsh source behavior.
@@ -51,7 +51,7 @@ variables. Hetzner also retains SSH_AUTH_SOCK. Fix PATH to
51
51
  Woodpecker's URL is supplied by the user MCP `env` setting or existing shell
52
52
  environment; the launcher does not parse global Codex configuration.
53
53
 
54
- Installing this launcher is opt-in. Keep the portable bunx manifest unchanged,
54
+ Installing this launcher is opt-in. Keep the portable `bun x` manifest unchanged,
55
55
  disable only the selected plugin's bundled server, and use a user MCP
56
56
  registration with startup_timeout_sec=30. Keep skills enabled. Preserve
57
57
  unrelated plugin registrations and existing credential sources.
@@ -0,0 +1,44 @@
1
+ import { readFileSync, realpathSync, statSync } from "node:fs";
2
+ import { createHash } from "node:crypto";
3
+ import { normalize, resolve, sep } from "node:path";
4
+
5
+ try {
6
+ const [directory, name, binary] = process.argv.slice(2);
7
+ const root = realpathSync(directory);
8
+ const inside = (path) => {
9
+ const actual = realpathSync(path);
10
+ if (!actual.startsWith(root + sep)) throw new Error();
11
+ return actual;
12
+ };
13
+ const manifest = JSON.parse(readFileSync(inside(resolve(root, "package.json")), "utf8"));
14
+ const lock = Bun.JSONC.parse(readFileSync(inside(resolve(root, "bun.lock")), "utf8"));
15
+ const spec = manifest.dependencies?.[name];
16
+ if (typeof spec !== "string" || lock.workspaces?.[""]?.dependencies?.[name] !== spec) throw new Error();
17
+ const locked = lock.packages?.[name];
18
+ if (!Array.isArray(locked)) throw new Error();
19
+ let version = spec;
20
+ let resolved = spec;
21
+ if (spec.startsWith("file:")) {
22
+ const relative = spec.slice(5);
23
+ if (relative.startsWith("/") || !relative.endsWith(".tgz")) throw new Error();
24
+ const archive = inside(resolve(root, relative));
25
+ resolved = normalize(relative);
26
+ const integrity = "sha512-" + createHash("sha512").update(readFileSync(archive)).digest("base64");
27
+ if (locked.at(-1) !== integrity) throw new Error();
28
+ const packed = Bun.spawnSync(["tar", "-xOf", archive, "package/package.json"], { stdout: "pipe", stderr: "pipe", env: { PATH: "/usr/bin:/bin" } });
29
+ if (packed.exitCode !== 0) throw new Error();
30
+ const metadata = JSON.parse(new TextDecoder().decode(packed.stdout));
31
+ if (metadata.name !== name) throw new Error();
32
+ version = metadata.version;
33
+ }
34
+ if (typeof version !== "string" || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) throw new Error();
35
+ if (locked[0] !== `${name}@${resolved}`) throw new Error();
36
+ const packageRoot = inside(resolve(root, "node_modules", name));
37
+ const installed = JSON.parse(readFileSync(inside(resolve(packageRoot, "package.json")), "utf8"));
38
+ if (installed.name !== name || installed.version !== version || installed.bin?.[binary] !== "dist/index.js") throw new Error();
39
+ const entry = inside(resolve(packageRoot, installed.bin[binary]));
40
+ if (!entry.startsWith(packageRoot + sep) || !statSync(entry).isFile() || inside(resolve(root, "node_modules/.bin", binary)) !== entry) throw new Error();
41
+ } catch {
42
+ console.error("Desktop MCP runtime is missing or inconsistent; reinstall the pinned runtime before starting.");
43
+ process.exit(1);
44
+ }
@@ -27,4 +27,6 @@ for name in ${(k)parameters}; do
27
27
  ;;
28
28
  esac
29
29
  done
30
- exec "$HOME/.bun/bin/bunx" -y @jurislm/woodpecker-ci-plugin@latest
30
+ runtime="$HOME/.local/share/jurislm/mcp/woodpecker-ci-plugin"
31
+ "$HOME/.bun/bin/bun" --no-env-file --no-install "${${(%):-%x}:A:h}/validate-woodpecker-runtime.mjs" "$runtime" @jurislm/woodpecker-ci-plugin woodpecker-ci-plugin || exit $?
32
+ exec "$HOME/.bun/bin/bun" --no-env-file --no-install "$runtime/node_modules/@jurislm/woodpecker-ci-plugin/dist/index.js"
package/mcp.json CHANGED
@@ -3,8 +3,8 @@
3
3
  "mcpServers": {
4
4
  "woodpecker-ci": {
5
5
  "type": "stdio",
6
- "command": "bunx",
7
- "args": ["-y", "@jurislm/woodpecker-ci-plugin@latest"]
6
+ "command": "bun",
7
+ "args": ["x", "@jurislm/woodpecker-ci-plugin@latest"]
8
8
  }
9
9
  }
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jurislm/woodpecker-ci-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Local stdio MCP server for Woodpecker CI",
5
5
  "type": "module",
6
6
  "bin": {
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "woodpecker-ci",
4
- "version": "2.1.0",
4
+ "version": "2.1.2",
5
5
  "description": "Manage Woodpecker CI through agent tools.",
6
6
  "author": {
7
7
  "name": "JurisLM",