@microvac/plugin-issue-defaults 0.0.0-stage → 0.1.0-rc.17
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/LICENSE +22 -0
- package/package.json +32 -4
- package/src/client.js +50 -0
- package/src/index.js +33 -0
- package/src/page.d.ts +4 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Paperclip AI
|
|
4
|
+
Copyright (c) 2026 Microvac contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microvac/plugin-issue-defaults",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-rc.17",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Microvac plugin: the defaults a new issue starts with (by default, no assignee).",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js",
|
|
9
|
+
"./client": "./src/client.js",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"src"
|
|
14
|
+
],
|
|
15
|
+
"dsh": {
|
|
16
|
+
"client": {
|
|
17
|
+
"platform": "web",
|
|
18
|
+
"inject": [
|
|
19
|
+
"hooks"
|
|
20
|
+
],
|
|
21
|
+
"immediately": true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@deepseek-ai/schemastery": "3.20.0-alpha.2"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"typecheck": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/microvac-ai/microvac"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/client.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* Client face of the `issue-defaults` plugin, in the page module loader's
|
|
4
|
+
* format (`dsh-client-modules` serves it under `/plugins` as is). It decides
|
|
5
|
+
* the assignee a new issue starts with, through the UI hook point
|
|
6
|
+
* `issue/default-assignee`. A page's prefill or a restored draft never reach
|
|
7
|
+
* the hook point, so they are kept.
|
|
8
|
+
*
|
|
9
|
+
* The policy is the host face's volatile `policy` field, synced by
|
|
10
|
+
* `dsh-client-modules`; the client face must not declare a Config of its own.
|
|
11
|
+
*/
|
|
12
|
+
window.__ModuleLoader__.load({
|
|
13
|
+
id: "@microvac/plugin-issue-defaults",
|
|
14
|
+
factory: () => {
|
|
15
|
+
/**
|
|
16
|
+
* - `unassigned`: no assignee; the user picks one.
|
|
17
|
+
* - `last-used`: Paperclip's choice, the last assignee used in this
|
|
18
|
+
* company, else the primary agent.
|
|
19
|
+
* - `primary-agent`: the company's primary agent (else its CEO, else its
|
|
20
|
+
* first agent).
|
|
21
|
+
*/
|
|
22
|
+
const POLICIES = ["unassigned", "last-used", "primary-agent"];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} policy
|
|
26
|
+
* @param {string} paperclipPick - assignee Paperclip picked, the `last-used` result.
|
|
27
|
+
* @param {{ recent: string, primary: string }} candidates
|
|
28
|
+
* @returns {string} an assignee selection value, `""` for no assignee.
|
|
29
|
+
*/
|
|
30
|
+
function resolveDefaultAssignee(policy, paperclipPick, candidates) {
|
|
31
|
+
if (policy === "last-used") return paperclipPick;
|
|
32
|
+
if (policy === "primary-agent") return candidates.primary;
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
name: "@microvac/plugin-issue-defaults",
|
|
38
|
+
inject: ["hooks"],
|
|
39
|
+
POLICIES,
|
|
40
|
+
/**
|
|
41
|
+
* @param {{ hooks: { register(name: string, handler: (value: string, context: { recent: string, primary: string }) => string): () => void } }} ctx
|
|
42
|
+
* @param {{ policy?: { get(): string | undefined } }} config
|
|
43
|
+
*/
|
|
44
|
+
apply(ctx, config) {
|
|
45
|
+
ctx.hooks.register("issue/default-assignee", (value, context) =>
|
|
46
|
+
resolveDefaultAssignee(config.policy?.get() ?? "unassigned", value, context));
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
});
|
package/src/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* Host face of the `issue-defaults` plugin. It only holds the configuration:
|
|
4
|
+
* `policy` is volatile, so `dsh-client-modules` syncs it to the client face
|
|
5
|
+
* (`./client.js`), which applies it in the new issue dialog. Plain JavaScript:
|
|
6
|
+
* the kernel's loader imports plugins with Node's own `import()`.
|
|
7
|
+
*
|
|
8
|
+
* # microvac.yml
|
|
9
|
+
* - id: issue-defaults
|
|
10
|
+
* name: "@microvac/plugin-issue-defaults"
|
|
11
|
+
* config:
|
|
12
|
+
* policy: last-used
|
|
13
|
+
*/
|
|
14
|
+
import z from "@deepseek-ai/schemastery";
|
|
15
|
+
|
|
16
|
+
export const name = "@microvac/plugin-issue-defaults";
|
|
17
|
+
|
|
18
|
+
/** Same list, same order, as `POLICIES` in `./client.js`; the default first. */
|
|
19
|
+
const POLICIES = /** @type {const} */ (["unassigned", "last-used", "primary-agent"]);
|
|
20
|
+
|
|
21
|
+
export const Config = z.object({
|
|
22
|
+
policy: z
|
|
23
|
+
.union(POLICIES)
|
|
24
|
+
.default("unassigned")
|
|
25
|
+
.volatile()
|
|
26
|
+
.description(
|
|
27
|
+
"Assignee a new issue starts with when nothing explicit chose one: " +
|
|
28
|
+
"none (unassigned), the last one used (last-used), or the company's primary agent (primary-agent).",
|
|
29
|
+
),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/** The host face has nothing to start. */
|
|
33
|
+
export function apply() {}
|
package/src/page.d.ts
ADDED
package/README.md
DELETED