@gonzih/cc-tg 0.9.39 → 0.9.41
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/router.d.ts +5 -4
- package/dist/router.js +9 -6
- package/package.json +1 -1
package/dist/router.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* the appropriate cc-agent meta-agent instead of the local Claude session.
|
|
6
6
|
*
|
|
7
7
|
* Tag formats:
|
|
8
|
-
* #repo-name → namespace=repo-name, repo=https://github.com/{DEFAULT_GITHUB_ORG}/repo-name
|
|
8
|
+
* #repo-name → namespace=repo-name, repo=https://github.com/{DEFAULT_GITHUB_ORG}/repo-name (null if DEFAULT_GITHUB_ORG unset)
|
|
9
9
|
* #org/repo → namespace=repo, repo=https://github.com/org/repo
|
|
10
10
|
*/
|
|
11
11
|
import { Redis } from "ioredis";
|
|
@@ -19,13 +19,14 @@ export interface RoutingTag {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Parse the first #tag or #org/repo token from a message.
|
|
22
|
-
* Returns null when no routing tag is present
|
|
22
|
+
* Returns null when no routing tag is present, or when the short #repo format is used
|
|
23
|
+
* without DEFAULT_GITHUB_ORG being set (operators must configure this explicitly).
|
|
23
24
|
*
|
|
24
25
|
* Examples:
|
|
25
|
-
* "#cc-agent fix the bug" → { namespace: "cc-agent", repoUrl: "…/
|
|
26
|
+
* "#cc-agent fix the bug" → null if DEFAULT_GITHUB_ORG unset; { namespace: "cc-agent", repoUrl: "…/{org}/cc-agent", … } if set
|
|
26
27
|
* "#gonzih/of-stack deploy it" → { namespace: "of-stack", repoUrl: "…/gonzih/of-stack", … }
|
|
27
28
|
* "#org/repo do something" → { namespace: "repo", repoUrl: "…/org/repo", … }
|
|
28
|
-
* "please help #of-stack with this" →
|
|
29
|
+
* "please help #of-stack with this" → null if DEFAULT_GITHUB_ORG unset
|
|
29
30
|
*/
|
|
30
31
|
export declare function parseRoutingTag(text: string): RoutingTag | null;
|
|
31
32
|
/**
|
package/dist/router.js
CHANGED
|
@@ -5,22 +5,23 @@
|
|
|
5
5
|
* the appropriate cc-agent meta-agent instead of the local Claude session.
|
|
6
6
|
*
|
|
7
7
|
* Tag formats:
|
|
8
|
-
* #repo-name → namespace=repo-name, repo=https://github.com/{DEFAULT_GITHUB_ORG}/repo-name
|
|
8
|
+
* #repo-name → namespace=repo-name, repo=https://github.com/{DEFAULT_GITHUB_ORG}/repo-name (null if DEFAULT_GITHUB_ORG unset)
|
|
9
9
|
* #org/repo → namespace=repo, repo=https://github.com/org/repo
|
|
10
10
|
*/
|
|
11
11
|
import { execSync } from "child_process";
|
|
12
12
|
/**
|
|
13
13
|
* Parse the first #tag or #org/repo token from a message.
|
|
14
|
-
* Returns null when no routing tag is present
|
|
14
|
+
* Returns null when no routing tag is present, or when the short #repo format is used
|
|
15
|
+
* without DEFAULT_GITHUB_ORG being set (operators must configure this explicitly).
|
|
15
16
|
*
|
|
16
17
|
* Examples:
|
|
17
|
-
* "#cc-agent fix the bug" → { namespace: "cc-agent", repoUrl: "…/
|
|
18
|
+
* "#cc-agent fix the bug" → null if DEFAULT_GITHUB_ORG unset; { namespace: "cc-agent", repoUrl: "…/{org}/cc-agent", … } if set
|
|
18
19
|
* "#gonzih/of-stack deploy it" → { namespace: "of-stack", repoUrl: "…/gonzih/of-stack", … }
|
|
19
20
|
* "#org/repo do something" → { namespace: "repo", repoUrl: "…/org/repo", … }
|
|
20
|
-
* "please help #of-stack with this" →
|
|
21
|
+
* "please help #of-stack with this" → null if DEFAULT_GITHUB_ORG unset
|
|
21
22
|
*/
|
|
22
23
|
export function parseRoutingTag(text) {
|
|
23
|
-
const defaultOrg = process.env.DEFAULT_GITHUB_ORG
|
|
24
|
+
const defaultOrg = process.env.DEFAULT_GITHUB_ORG;
|
|
24
25
|
// Match #word or #org/repo — each segment: starts with alphanumeric, allows ._- inside
|
|
25
26
|
const match = text.match(/#([a-zA-Z0-9][a-zA-Z0-9._-]*)(?:\/([a-zA-Z0-9][a-zA-Z0-9._-]*))?/);
|
|
26
27
|
if (!match)
|
|
@@ -36,7 +37,9 @@ export function parseRoutingTag(text) {
|
|
|
36
37
|
repoUrl = `https://github.com/${part1}/${part2}`;
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
|
-
// #repo format —
|
|
40
|
+
// #repo format — requires DEFAULT_GITHUB_ORG; return null if unset
|
|
41
|
+
if (!defaultOrg)
|
|
42
|
+
return null;
|
|
40
43
|
namespace = part1;
|
|
41
44
|
repoUrl = `https://github.com/${defaultOrg}/${part1}`;
|
|
42
45
|
}
|