opencode-discord-presence 0.1.5 → 0.2.0
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/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/config.d.ts +0 -45
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -65
- package/dist/config.js.map +0 -1
- package/dist/i18n/index.d.ts +0 -10
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/index.js +0 -32
- package/dist/i18n/index.js.map +0 -1
- package/dist/i18n/locales/en.d.ts +0 -3
- package/dist/i18n/locales/en.d.ts.map +0 -1
- package/dist/i18n/locales/en.js +0 -13
- package/dist/i18n/locales/en.js.map +0 -1
- package/dist/i18n/locales/ja.d.ts +0 -3
- package/dist/i18n/locales/ja.d.ts.map +0 -1
- package/dist/i18n/locales/ja.js +0 -13
- package/dist/i18n/locales/ja.js.map +0 -1
- package/dist/i18n/locales/ko.d.ts +0 -14
- package/dist/i18n/locales/ko.d.ts.map +0 -1
- package/dist/i18n/locales/ko.js +0 -14
- package/dist/i18n/locales/ko.js.map +0 -1
- package/dist/i18n/locales/zh.d.ts +0 -3
- package/dist/i18n/locales/zh.d.ts.map +0 -1
- package/dist/i18n/locales/zh.js +0 -13
- package/dist/i18n/locales/zh.js.map +0 -1
- package/dist/plugin.d.ts +0 -38
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -144
- package/dist/plugin.js.map +0 -1
- package/dist/services/discord-rpc.d.ts +0 -83
- package/dist/services/discord-rpc.d.ts.map +0 -1
- package/dist/services/discord-rpc.js +0 -200
- package/dist/services/discord-rpc.js.map +0 -1
- package/dist/types/index.d.ts +0 -68
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +0 -1
- package/dist/utils/format.d.ts +0 -45
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js +0 -103
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/particle.d.ts +0 -34
- package/dist/utils/particle.d.ts.map +0 -1
- package/dist/utils/particle.js +0 -83
- package/dist/utils/particle.js.map +0 -1
- package/dist/utils/project.d.ts +0 -32
- package/dist/utils/project.d.ts.map +0 -1
- package/dist/utils/project.js +0 -81
- package/dist/utils/project.js.map +0 -1
package/dist/utils/project.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Project name detection utility
|
|
3
|
-
* @module opencode-discord-presence/utils/project
|
|
4
|
-
*
|
|
5
|
-
* Detects the current project name from Git remote URL or directory name.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Get the project name from Git remote URL or directory path
|
|
9
|
-
*
|
|
10
|
-
* Priority:
|
|
11
|
-
* 1. Git remote URL (if provided) - extracts repo name
|
|
12
|
-
* 2. Directory path (if provided) - extracts folder name
|
|
13
|
-
* 3. Fallback - "Unknown Project"
|
|
14
|
-
*
|
|
15
|
-
* @param remoteUrl - Git remote URL (optional)
|
|
16
|
-
* @param directory - Current working directory path (optional)
|
|
17
|
-
* @returns Project name
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* getProjectName("git@github.com:user/my-repo.git")
|
|
22
|
-
* // "my-repo"
|
|
23
|
-
*
|
|
24
|
-
* getProjectName(undefined, "/Users/dev/my-project")
|
|
25
|
-
* // "my-project"
|
|
26
|
-
*
|
|
27
|
-
* getProjectName(undefined, undefined)
|
|
28
|
-
* // "Unknown Project"
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function getProjectName(remoteUrl?: string, directory?: string): string;
|
|
32
|
-
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0CH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAe7E"}
|
package/dist/utils/project.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Project name detection utility
|
|
3
|
-
* @module opencode-discord-presence/utils/project
|
|
4
|
-
*
|
|
5
|
-
* Detects the current project name from Git remote URL or directory name.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Extract project name from a Git remote URL
|
|
9
|
-
*
|
|
10
|
-
* @param remoteUrl - Git remote URL (SSH or HTTPS format)
|
|
11
|
-
* @returns Repository name without .git extension, or null if parsing fails
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* parseGitUrl("git@github.com:user/my-repo.git") // "my-repo"
|
|
16
|
-
* parseGitUrl("https://github.com/user/my-repo.git") // "my-repo"
|
|
17
|
-
* parseGitUrl("https://github.com/user/my-repo") // "my-repo"
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
function parseGitUrl(remoteUrl) {
|
|
21
|
-
// SSH format: git@github.com:user/repo.git
|
|
22
|
-
const sshMatch = remoteUrl.match(/git@[^:]+:([^/]+)\/([^/]+?)(?:\.git)?$/);
|
|
23
|
-
if (sshMatch) {
|
|
24
|
-
return sshMatch[2];
|
|
25
|
-
}
|
|
26
|
-
// HTTPS format: https://github.com/user/repo.git
|
|
27
|
-
const httpsMatch = remoteUrl.match(/https?:\/\/[^/]+\/([^/]+)\/([^/]+?)(?:\.git)?$/);
|
|
28
|
-
if (httpsMatch) {
|
|
29
|
-
return httpsMatch[2];
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Extract directory name from a path
|
|
35
|
-
*
|
|
36
|
-
* @param path - Full directory path
|
|
37
|
-
* @returns Last component of the path
|
|
38
|
-
*/
|
|
39
|
-
function getDirectoryName(path) {
|
|
40
|
-
const parts = path.split(/[/\\]/).filter(Boolean);
|
|
41
|
-
return parts[parts.length - 1] || "Unknown Project";
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get the project name from Git remote URL or directory path
|
|
45
|
-
*
|
|
46
|
-
* Priority:
|
|
47
|
-
* 1. Git remote URL (if provided) - extracts repo name
|
|
48
|
-
* 2. Directory path (if provided) - extracts folder name
|
|
49
|
-
* 3. Fallback - "Unknown Project"
|
|
50
|
-
*
|
|
51
|
-
* @param remoteUrl - Git remote URL (optional)
|
|
52
|
-
* @param directory - Current working directory path (optional)
|
|
53
|
-
* @returns Project name
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* getProjectName("git@github.com:user/my-repo.git")
|
|
58
|
-
* // "my-repo"
|
|
59
|
-
*
|
|
60
|
-
* getProjectName(undefined, "/Users/dev/my-project")
|
|
61
|
-
* // "my-project"
|
|
62
|
-
*
|
|
63
|
-
* getProjectName(undefined, undefined)
|
|
64
|
-
* // "Unknown Project"
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export function getProjectName(remoteUrl, directory) {
|
|
68
|
-
// Try Git remote URL first
|
|
69
|
-
if (remoteUrl) {
|
|
70
|
-
const repoName = parseGitUrl(remoteUrl);
|
|
71
|
-
if (repoName) {
|
|
72
|
-
return repoName;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// Fall back to directory name
|
|
76
|
-
if (directory) {
|
|
77
|
-
return getDirectoryName(directory);
|
|
78
|
-
}
|
|
79
|
-
return "Unknown Project";
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=project.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,SAAS,WAAW,CAAC,SAAiB;IACpC,2CAA2C;IAC3C,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC1E,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IAED,iDAAiD;IACjD,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACpF,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC,CAAC,CAAC,CAAA;IACtB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjD,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,iBAAiB,CAAA;AACrD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,cAAc,CAAC,SAAkB,EAAE,SAAkB;IACnE,2BAA2B;IAC3B,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAA;QACvC,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAA;QACjB,CAAC;IACH,CAAC;IAED,8BAA8B;IAC9B,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAAA;IACpC,CAAC;IAED,OAAO,iBAAiB,CAAA;AAC1B,CAAC"}
|