cyrus-config-updater 0.2.72-test.1 → 0.2.72
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/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/scripts/gh-cyrus.cjs +50 -11
package/dist/types.d.ts
CHANGED
|
@@ -66,10 +66,12 @@ export declare const CyrusConfigPayloadSchema: z.ZodObject<{
|
|
|
66
66
|
slackAllowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
67
|
githubAllowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
68
|
slackMcpConfigs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
zulipMcpConfigs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
70
|
linearMcpConfigs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
71
|
githubMcpConfigs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
72
|
strictMcpConfig: z.ZodOptional<z.ZodBoolean>;
|
|
72
73
|
issueUpdateTrigger: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
maxConcurrentSessions: z.ZodOptional<z.ZodNumber>;
|
|
73
75
|
slackThreadFollowing: z.ZodOptional<z.ZodBoolean>;
|
|
74
76
|
prReviewTrigger: z.ZodOptional<z.ZodBoolean>;
|
|
75
77
|
userAccessControl: z.ZodOptional<z.ZodObject<{
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,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AE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyrus-config-updater",
|
|
3
|
-
"version": "0.2.72
|
|
3
|
+
"version": "0.2.72",
|
|
4
4
|
"description": "Configuration update handlers for Cyrus agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
25
25
|
"fastify": "^5.12.1",
|
|
26
26
|
"zod": "^4.3.6",
|
|
27
|
-
"cyrus-core": "0.2.72
|
|
27
|
+
"cyrus-core": "0.2.72"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.12.7",
|
|
31
31
|
"typescript": "^5.4.5",
|
|
32
|
-
"vitest": "^4.1.
|
|
32
|
+
"vitest": "^4.1.11"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"config",
|
package/scripts/gh-cyrus.cjs
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Resolution order for the target org:
|
|
13
13
|
* 1. An explicit `-R` / `--repo` argument (strongest signal).
|
|
14
|
-
* 2.
|
|
14
|
+
* 2. A positional repository for `repo view`, `clone`, or `fork`.
|
|
15
|
+
* 3. GH_REPO, then the cwd's `remote.origin.url` (how gh infers "the current
|
|
15
16
|
* repository").
|
|
16
17
|
* Then the token, from `<cyrusHome>/github-tokens.json` (pushed by
|
|
17
18
|
* cyrus-hosted):
|
|
@@ -65,25 +66,61 @@ function ownerFromArgs(args) {
|
|
|
65
66
|
if (arg.startsWith("-R=")) {
|
|
66
67
|
return ownerFromRepoRef(arg.slice("-R=".length));
|
|
67
68
|
}
|
|
69
|
+
if (arg.startsWith("-R") && arg.length > 2) {
|
|
70
|
+
return ownerFromRepoRef(arg.slice(2));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return ownerFromPositionalRepo(args);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Parse only commands whose first positional argument is a repository.
|
|
77
|
+
* Do not scan arbitrary argument text: branch names, titles, and clone
|
|
78
|
+
* destinations can all look like OWNER/REPO without selecting a repository.
|
|
79
|
+
*/
|
|
80
|
+
function ownerFromPositionalRepo(args) {
|
|
81
|
+
if (args[0] !== "repo") return "";
|
|
82
|
+
const valueFlags = {
|
|
83
|
+
view: new Set([
|
|
84
|
+
"--branch",
|
|
85
|
+
"-b",
|
|
86
|
+
"--json",
|
|
87
|
+
"--jq",
|
|
88
|
+
"-q",
|
|
89
|
+
"--template",
|
|
90
|
+
"-t",
|
|
91
|
+
]),
|
|
92
|
+
clone: new Set(["--upstream-remote-name", "-u"]),
|
|
93
|
+
fork: new Set(["--fork-name", "--org", "--remote-name"]),
|
|
94
|
+
}[args[1]];
|
|
95
|
+
if (!valueFlags) return "";
|
|
96
|
+
for (let i = 2; i < args.length; i++) {
|
|
97
|
+
const arg = args[i];
|
|
98
|
+
if (arg === "--") {
|
|
99
|
+
// clone/fork forward everything after -- as git flags.
|
|
100
|
+
return args[1] === "view" ? ownerFromRepoRef(args[i + 1]) : "";
|
|
101
|
+
}
|
|
102
|
+
if (valueFlags.has(arg)) {
|
|
103
|
+
i++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (arg.startsWith("-")) continue;
|
|
107
|
+
return ownerFromRepoRef(arg);
|
|
68
108
|
}
|
|
69
109
|
return "";
|
|
70
110
|
}
|
|
71
111
|
|
|
72
112
|
/** Owner of the cwd's origin remote, or "" when not in a GitHub repo. */
|
|
73
113
|
function ownerFromCwd() {
|
|
74
|
-
const result = spawnSync(
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
{ encoding: "utf8" },
|
|
78
|
-
);
|
|
114
|
+
const result = spawnSync("git", ["config", "--get", "remote.origin.url"], {
|
|
115
|
+
encoding: "utf8",
|
|
116
|
+
});
|
|
79
117
|
if (result.status !== 0) return "";
|
|
80
118
|
return ownerFromRepoRef((result.stdout || "").trim());
|
|
81
119
|
}
|
|
82
120
|
|
|
83
121
|
/** Non-expired tokens from the Cyrus token store file. */
|
|
84
122
|
function loadValidTokens() {
|
|
85
|
-
const cyrusHome =
|
|
86
|
-
process.env.CYRUS_HOME || path.join(os.homedir(), ".cyrus");
|
|
123
|
+
const cyrusHome = process.env.CYRUS_HOME || path.join(os.homedir(), ".cyrus");
|
|
87
124
|
const tokensFile = path.join(cyrusHome, "github-tokens.json");
|
|
88
125
|
let tokens = [];
|
|
89
126
|
try {
|
|
@@ -94,15 +131,17 @@ function loadValidTokens() {
|
|
|
94
131
|
}
|
|
95
132
|
const now = Date.now();
|
|
96
133
|
return tokens.filter((t) => {
|
|
97
|
-
if (!t || typeof t.token !== "string" || t.token.length === 0)
|
|
98
|
-
return false;
|
|
134
|
+
if (!t || typeof t.token !== "string" || t.token.length === 0) return false;
|
|
99
135
|
const expiresAt = Date.parse(t.expiresAt);
|
|
100
136
|
return !Number.isNaN(expiresAt) && expiresAt > now;
|
|
101
137
|
});
|
|
102
138
|
}
|
|
103
139
|
|
|
104
140
|
function resolveToken(args) {
|
|
105
|
-
const owner =
|
|
141
|
+
const owner =
|
|
142
|
+
ownerFromArgs(args) ||
|
|
143
|
+
ownerFromRepoRef(process.env.GH_REPO) ||
|
|
144
|
+
ownerFromCwd();
|
|
106
145
|
const valid = loadValidTokens();
|
|
107
146
|
|
|
108
147
|
if (owner) {
|