opencode-discord-presence 0.2.6 → 0.2.8
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/README.ko.md +27 -36
- package/README.md +27 -22
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -3
- package/dist/config.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +32 -3
- package/dist/plugin.js.map +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/particle.d.ts +16 -0
- package/dist/utils/particle.d.ts.map +1 -0
- package/dist/utils/particle.js +42 -0
- package/dist/utils/particle.js.map +1 -0
- package/package.json +4 -4
package/README.ko.md
CHANGED
|
@@ -10,9 +10,7 @@ OpenCode 세션 상태를 Discord Rich Presence로 표시합니다. 현재 사
|
|
|
10
10
|
- **실시간 에이전트 표시** - 현재 사용 중인 AI 에이전트 (Claude, Prometheus 등) 표시
|
|
11
11
|
- **모델 정보** - 활성 모델 표시 (Claude Sonnet, GPT-4 등)
|
|
12
12
|
- **세션 시간 추적** - 코딩 시간 표시
|
|
13
|
-
-
|
|
14
|
-
- **프로젝트 이름** - Git 또는 디렉토리에서 현재 프로젝트 이름 표시
|
|
15
|
-
- **다국어 지원** - 한국어, 영어, 일본어, 중국어 지원
|
|
13
|
+
- **한국어 지원** - 한국어 조사 자동 처리 (을/를, 은/는)
|
|
16
14
|
- **유휴 감지** - 휴식 중일 때 자동으로 상태 변경
|
|
17
15
|
|
|
18
16
|
## 설치
|
|
@@ -42,32 +40,37 @@ pnpm add opencode-discord-presence
|
|
|
42
40
|
|
|
43
41
|
## 설정
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
홈 디렉토리 또는 프로젝트 루트에 `.discord-presence.json` 파일을 생성하세요:
|
|
46
44
|
|
|
47
45
|
```json
|
|
48
46
|
{
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"applicationId": "YOUR_DISCORD_APP_ID",
|
|
53
|
-
"showSessionTime": true,
|
|
54
|
-
"showTokenUsage": true,
|
|
55
|
-
"showProjectName": true,
|
|
56
|
-
"language": "ko"
|
|
57
|
-
}
|
|
47
|
+
"enabled": true,
|
|
48
|
+
"applicationId": "YOUR_DISCORD_APP_ID",
|
|
49
|
+
"language": "ko"
|
|
58
50
|
}
|
|
59
51
|
```
|
|
60
52
|
|
|
53
|
+
또는 환경변수를 사용할 수 있습니다:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
OPENCODE_DISCORD_ENABLED=true
|
|
57
|
+
OPENCODE_DISCORD_CLIENT_ID=YOUR_APP_ID
|
|
58
|
+
OPENCODE_DISCORD_LANGUAGE=ko
|
|
59
|
+
```
|
|
60
|
+
|
|
61
61
|
### 설정 옵션
|
|
62
62
|
|
|
63
63
|
| 옵션 | 타입 | 기본값 | 설명 |
|
|
64
64
|
|------|------|--------|------|
|
|
65
65
|
| `enabled` | `boolean` | `true` | 플러그인 활성화/비활성화 |
|
|
66
66
|
| `applicationId` | `string` | (내장) | 커스텀 브랜딩을 위한 Discord Application ID |
|
|
67
|
-
| `
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
| `language` | `string` | `"en"` | 표시 언어 (`"en"` 또는 `"ko"`) |
|
|
68
|
+
|
|
69
|
+
### 설정 파일 우선순위
|
|
70
|
+
|
|
71
|
+
1. 프로젝트 디렉토리: `.discord-presence.json`
|
|
72
|
+
2. 홈 디렉토리: `~/.discord-presence.json`
|
|
73
|
+
3. 환경변수
|
|
71
74
|
|
|
72
75
|
## 커스텀 Discord Application
|
|
73
76
|
|
|
@@ -93,23 +96,16 @@ pnpm add opencode-discord-presence
|
|
|
93
96
|
플러그인은 OpenCode의 이벤트 시스템에 연결됩니다:
|
|
94
97
|
|
|
95
98
|
- **chat.message** - 메시지 송수신 시 현재 에이전트와 모델을 추적하여 presence 업데이트
|
|
96
|
-
- **event** - 세션 상태 변경 (유휴, 활성)
|
|
99
|
+
- **event** - 세션 상태 변경 (유휴, 활성) 감지
|
|
97
100
|
|
|
98
101
|
### Presence 상태
|
|
99
102
|
|
|
100
|
-
| 상태 |
|
|
101
|
-
|
|
102
|
-
| 활성 | "Prometheus를 갈구는중" | 에이전트로 활발히 코딩 중 |
|
|
103
|
-
| 유휴 | "Prometheus는 휴식중" | 세션이 유휴 상태 |
|
|
104
|
-
|
|
105
|
-
### 지원 언어
|
|
103
|
+
| 상태 | 영어 | 한국어 | 설명 |
|
|
104
|
+
|------|------|--------|------|
|
|
105
|
+
| 활성 | "Working with Prometheus" | "Prometheus를 갈구는중" | 에이전트로 활발히 코딩 중 |
|
|
106
|
+
| 유휴 | "Prometheus is idle" | "Prometheus는 휴식중" | 세션이 유휴 상태 |
|
|
106
107
|
|
|
107
|
-
|
|
108
|
-
|------|------|---------------|
|
|
109
|
-
| 한국어 | `ko` | "Prometheus를 갈구는중" |
|
|
110
|
-
| English | `en` | "Working with Prometheus" |
|
|
111
|
-
| 日本語 | `ja` | "Prometheusで作業中" |
|
|
112
|
-
| 中文 | `zh` | "正在使用 Prometheus" |
|
|
108
|
+
한국어 조사 (을/를, 은/는)는 에이전트 이름의 받침 유무에 따라 자동으로 선택됩니다.
|
|
113
109
|
|
|
114
110
|
## 개발
|
|
115
111
|
|
|
@@ -145,15 +141,10 @@ src/
|
|
|
145
141
|
├── config.ts # 설정 관리
|
|
146
142
|
├── types/
|
|
147
143
|
│ └── index.ts # TypeScript 타입 정의
|
|
148
|
-
├── i18n/
|
|
149
|
-
│ ├── index.ts # 다국어 지원
|
|
150
|
-
│ └── locales/ # 언어별 번역 파일
|
|
151
144
|
├── services/
|
|
152
145
|
│ └── discord-rpc.ts # Discord RPC 서비스 (싱글톤)
|
|
153
146
|
└── utils/
|
|
154
|
-
|
|
155
|
-
├── particle.ts # 한국어 조사 처리
|
|
156
|
-
└── project.ts # 프로젝트 이름 감지
|
|
147
|
+
└── particle.ts # 한국어 조사 처리 (을/를, 은/는)
|
|
157
148
|
```
|
|
158
149
|
|
|
159
150
|
## 기여하기
|
package/README.md
CHANGED
|
@@ -12,8 +12,6 @@ Display your current OpenCode session status in Discord Rich Presence. Show whic
|
|
|
12
12
|
- **Real-time agent display** - Shows which AI agent (Claude, Prometheus, etc.) you're currently using
|
|
13
13
|
- **Model information** - Displays the active model (Claude Sonnet, GPT-4, etc.)
|
|
14
14
|
- **Session time tracking** - Shows how long you've been coding
|
|
15
|
-
- **Token usage** - Track input/output tokens consumed in your session
|
|
16
|
-
- **Project name** - Display your current project from Git or directory
|
|
17
15
|
- **Korean language support** - Proper Korean particle handling (을/를, 은/는)
|
|
18
16
|
- **Idle detection** - Automatically shows when you're taking a break
|
|
19
17
|
|
|
@@ -44,30 +42,37 @@ That's it! The plugin will automatically connect to Discord and display your ses
|
|
|
44
42
|
|
|
45
43
|
## Configuration
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
Create a `.discord-presence.json` file in your home directory or project root:
|
|
48
46
|
|
|
49
47
|
```json
|
|
50
48
|
{
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"applicationId": "YOUR_DISCORD_APP_ID",
|
|
55
|
-
"showSessionTime": true,
|
|
56
|
-
"showTokenUsage": true,
|
|
57
|
-
"showProjectName": true
|
|
58
|
-
}
|
|
49
|
+
"enabled": true,
|
|
50
|
+
"applicationId": "YOUR_DISCORD_APP_ID",
|
|
51
|
+
"language": "ko"
|
|
59
52
|
}
|
|
60
53
|
```
|
|
61
54
|
|
|
55
|
+
Or use environment variables:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
OPENCODE_DISCORD_ENABLED=true
|
|
59
|
+
OPENCODE_DISCORD_CLIENT_ID=YOUR_APP_ID
|
|
60
|
+
OPENCODE_DISCORD_LANGUAGE=ko
|
|
61
|
+
```
|
|
62
|
+
|
|
62
63
|
### Configuration Options
|
|
63
64
|
|
|
64
65
|
| Option | Type | Default | Description |
|
|
65
66
|
|--------|------|---------|-------------|
|
|
66
67
|
| `enabled` | `boolean` | `true` | Enable or disable the plugin |
|
|
67
68
|
| `applicationId` | `string` | (built-in) | Custom Discord Application ID for your own branding |
|
|
68
|
-
| `
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
| `language` | `string` | `"en"` | Display language (`"en"` or `"ko"`) |
|
|
70
|
+
|
|
71
|
+
### Config File Priority
|
|
72
|
+
|
|
73
|
+
1. Project directory: `.discord-presence.json`
|
|
74
|
+
2. Home directory: `~/.discord-presence.json`
|
|
75
|
+
3. Environment variables
|
|
71
76
|
|
|
72
77
|
## Custom Discord Application
|
|
73
78
|
|
|
@@ -93,14 +98,16 @@ For custom branding (your own images and app name):
|
|
|
93
98
|
The plugin hooks into OpenCode's event system:
|
|
94
99
|
|
|
95
100
|
- **chat.message** - Updates presence when you send/receive messages, tracking the current agent and model
|
|
96
|
-
- **event** - Listens for session state changes (idle, active)
|
|
101
|
+
- **event** - Listens for session state changes (idle, active)
|
|
97
102
|
|
|
98
103
|
### Presence States
|
|
99
104
|
|
|
100
|
-
| State |
|
|
101
|
-
|
|
102
|
-
| Active | "Prometheus를 갈구는중" | You're actively coding with an agent |
|
|
103
|
-
| Idle | "Prometheus는 휴식중" | Session is idle |
|
|
105
|
+
| State | English | Korean | Description |
|
|
106
|
+
|-------|---------|--------|-------------|
|
|
107
|
+
| Active | "Working with Prometheus" | "Prometheus를 갈구는중" | You're actively coding with an agent |
|
|
108
|
+
| Idle | "Prometheus is idle" | "Prometheus는 휴식중" | Session is idle |
|
|
109
|
+
|
|
110
|
+
Korean particles (을/를, 은/는) are automatically selected based on whether the agent name ends with a consonant (받침).
|
|
104
111
|
|
|
105
112
|
## Development
|
|
106
113
|
|
|
@@ -139,9 +146,7 @@ src/
|
|
|
139
146
|
├── services/
|
|
140
147
|
│ └── discord-rpc.ts # Discord RPC service (singleton)
|
|
141
148
|
└── utils/
|
|
142
|
-
|
|
143
|
-
├── particle.ts # Korean particle detection
|
|
144
|
-
└── project.ts # Project name detection
|
|
149
|
+
└── particle.ts # Korean particle handling (을/를, 은/는)
|
|
145
150
|
```
|
|
146
151
|
|
|
147
152
|
## Contributing
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PresenceConfig } from "./types/index.js";
|
|
1
|
+
import type { DiscordPresenceOptions, PresenceConfig } from "./types/index.js";
|
|
2
2
|
export declare const DEFAULT_CLIENT_ID = "1466770544748662819";
|
|
3
|
-
export declare function getConfig(): PresenceConfig;
|
|
3
|
+
export declare function getConfig(options?: DiscordPresenceOptions): PresenceConfig;
|
|
4
4
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAY,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAExF,eAAO,MAAM,iBAAiB,wBAAwB,CAAA;AAQtD,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,cAAc,CAU1E"}
|
package/dist/config.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
export const DEFAULT_CLIENT_ID = "1466770544748662819";
|
|
2
|
-
|
|
2
|
+
function parseLanguage(lang) {
|
|
3
|
+
const normalized = lang?.toLowerCase();
|
|
4
|
+
if (normalized === "ko" || normalized === "kr" || normalized === "korean")
|
|
5
|
+
return "ko";
|
|
6
|
+
return "en";
|
|
7
|
+
}
|
|
8
|
+
export function getConfig(options) {
|
|
9
|
+
const envEnabled = process.env.OPENCODE_DISCORD_ENABLED;
|
|
10
|
+
const envClientId = process.env.OPENCODE_DISCORD_CLIENT_ID;
|
|
11
|
+
const envLanguage = process.env.OPENCODE_DISCORD_LANGUAGE;
|
|
3
12
|
return {
|
|
4
|
-
enabled:
|
|
5
|
-
clientId:
|
|
13
|
+
enabled: options?.enabled ?? envEnabled !== "false",
|
|
14
|
+
clientId: options?.applicationId ?? envClientId ?? DEFAULT_CLIENT_ID,
|
|
15
|
+
language: parseLanguage(options?.language ?? envLanguage),
|
|
6
16
|
};
|
|
7
17
|
}
|
|
8
18
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAA;AAEtD,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAA;AAEtD,SAAS,aAAa,CAAC,IAAa;IAClC,MAAM,UAAU,GAAG,IAAI,EAAE,WAAW,EAAE,CAAA;IACtC,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACtF,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgC;IACxD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAA;IACvD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAA;IAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAA;IAEzD,OAAO;QACL,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,UAAU,KAAK,OAAO;QACnD,QAAQ,EAAE,OAAO,EAAE,aAAa,IAAI,WAAW,IAAI,iBAAiB;QACpE,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,QAAQ,IAAI,WAAW,CAAC;KAC1D,CAAA;AACH,CAAC"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAqCjD,eAAO,MAAM,uBAAuB,EAAE,MAmCrC,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,17 +1,46 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
1
3
|
import { getConfig } from "./config.js";
|
|
2
4
|
import { DiscordRPCService } from "./services/discord-rpc.js";
|
|
5
|
+
import { getObjectParticle, getTopicParticle } from "./utils/particle.js";
|
|
3
6
|
let rpc = null;
|
|
4
7
|
let currentAgent = "OpenCode";
|
|
5
8
|
let currentModel = "";
|
|
9
|
+
function getPresenceDetails(agent, idle, language) {
|
|
10
|
+
if (language === "ko") {
|
|
11
|
+
if (idle) {
|
|
12
|
+
return `${agent}${getTopicParticle(agent)} 휴식중`;
|
|
13
|
+
}
|
|
14
|
+
return `${agent}${getObjectParticle(agent)} 갈구는중`;
|
|
15
|
+
}
|
|
16
|
+
return idle ? `${agent} is idle` : `Working with ${agent}`;
|
|
17
|
+
}
|
|
18
|
+
async function loadConfigFile(directory) {
|
|
19
|
+
const paths = [
|
|
20
|
+
join(directory, ".discord-presence.json"),
|
|
21
|
+
join(homedir(), ".discord-presence.json"),
|
|
22
|
+
];
|
|
23
|
+
for (const configPath of paths) {
|
|
24
|
+
const file = Bun.file(configPath);
|
|
25
|
+
if (await file.exists()) {
|
|
26
|
+
try {
|
|
27
|
+
return (await file.json());
|
|
28
|
+
}
|
|
29
|
+
catch { }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
6
34
|
export const OpenCodeDiscordPresence = async (ctx) => {
|
|
7
|
-
const
|
|
35
|
+
const fileOptions = await loadConfigFile(ctx.directory);
|
|
36
|
+
const config = getConfig(fileOptions);
|
|
8
37
|
if (!config.enabled)
|
|
9
38
|
return {};
|
|
10
39
|
rpc = new DiscordRPCService(config.clientId);
|
|
11
40
|
const updatePresence = async (idle = false) => {
|
|
12
41
|
if (!rpc)
|
|
13
42
|
return;
|
|
14
|
-
const details =
|
|
43
|
+
const details = getPresenceDetails(currentAgent, idle, config.language);
|
|
15
44
|
const state = currentModel || undefined;
|
|
16
45
|
await rpc.setPresence(details, state);
|
|
17
46
|
};
|
|
@@ -20,7 +49,7 @@ export const OpenCodeDiscordPresence = async (ctx) => {
|
|
|
20
49
|
await updatePresence(false);
|
|
21
50
|
}
|
|
22
51
|
return {
|
|
23
|
-
"chat.message": async (input) => {
|
|
52
|
+
"chat.message": async (input, _output) => {
|
|
24
53
|
if (input.agent)
|
|
25
54
|
currentAgent = input.agent;
|
|
26
55
|
if (input.model?.modelID)
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEzE,IAAI,GAAG,GAA6B,IAAI,CAAA;AACxC,IAAI,YAAY,GAAG,UAAU,CAAA;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pc";
|
|
2
|
+
export type Language = "en" | "ko";
|
|
2
3
|
export interface PresenceConfig {
|
|
3
4
|
enabled: boolean;
|
|
4
5
|
clientId: string;
|
|
6
|
+
language: Language;
|
|
7
|
+
}
|
|
8
|
+
export interface DiscordPresenceOptions {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
applicationId?: string;
|
|
11
|
+
language?: string;
|
|
5
12
|
}
|
|
6
13
|
export interface PresenceState {
|
|
7
14
|
agent: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAA;AAElC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;CACd;AAED,YAAY,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Korean particle utilities
|
|
3
|
+
* Handles proper particle selection based on whether the preceding character
|
|
4
|
+
* ends with a consonant (받침) or not.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get the appropriate particle for 을/를 (object marker)
|
|
8
|
+
* 을 after consonant, 를 after vowel
|
|
9
|
+
*/
|
|
10
|
+
export declare function getObjectParticle(word: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the appropriate particle for 은/는 (topic marker)
|
|
13
|
+
* 은 after consonant, 는 after vowel
|
|
14
|
+
*/
|
|
15
|
+
export declare function getTopicParticle(word: string): string;
|
|
16
|
+
//# sourceMappingURL=particle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particle.d.ts","sourceRoot":"","sources":["../../src/utils/particle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAItD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Korean particle utilities
|
|
3
|
+
* Handles proper particle selection based on whether the preceding character
|
|
4
|
+
* ends with a consonant (받침) or not.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if a character has a final consonant (받침)
|
|
8
|
+
*/
|
|
9
|
+
function hasFinalConsonant(char) {
|
|
10
|
+
const code = char.charCodeAt(0);
|
|
11
|
+
// Korean syllable block range: 0xAC00 ~ 0xD7A3
|
|
12
|
+
if (code < 0xac00 || code > 0xd7a3) {
|
|
13
|
+
// Non-Korean character: treat numbers/letters as having no final consonant
|
|
14
|
+
// except for certain consonant-ending letters
|
|
15
|
+
const consonantEndingChars = /[lmnr136780]$/i;
|
|
16
|
+
return consonantEndingChars.test(char);
|
|
17
|
+
}
|
|
18
|
+
// Korean syllable: check if it has a final consonant
|
|
19
|
+
// (code - 0xAC00) % 28 === 0 means no final consonant
|
|
20
|
+
return (code - 0xac00) % 28 !== 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the appropriate particle for 을/를 (object marker)
|
|
24
|
+
* 을 after consonant, 를 after vowel
|
|
25
|
+
*/
|
|
26
|
+
export function getObjectParticle(word) {
|
|
27
|
+
if (!word || word.length === 0)
|
|
28
|
+
return "를";
|
|
29
|
+
const lastChar = word[word.length - 1];
|
|
30
|
+
return hasFinalConsonant(lastChar) ? "을" : "를";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the appropriate particle for 은/는 (topic marker)
|
|
34
|
+
* 은 after consonant, 는 after vowel
|
|
35
|
+
*/
|
|
36
|
+
export function getTopicParticle(word) {
|
|
37
|
+
if (!word || word.length === 0)
|
|
38
|
+
return "는";
|
|
39
|
+
const lastChar = word[word.length - 1];
|
|
40
|
+
return hasFinalConsonant(lastChar) ? "은" : "는";
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=particle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particle.js","sourceRoot":"","sources":["../../src/utils/particle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IAC/B,+CAA+C;IAC/C,IAAI,IAAI,GAAG,MAAM,IAAI,IAAI,GAAG,MAAM,EAAE,CAAC;QACnC,2EAA2E;QAC3E,8CAA8C;QAC9C,MAAM,oBAAoB,GAAG,gBAAgB,CAAA;QAC7C,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;IACD,qDAAqD;IACrD,sDAAsD;IACtD,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAA;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACtC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAA;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACtC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;AAChD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-discord-presence",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Discord Rich Presence plugin for OpenCode - Display your current AI agent, model, and status in Discord",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
|
-
"url": "https://github.com/Puri12/opencode-
|
|
43
|
+
"url": "https://github.com/Puri12/opencode-discord-presence"
|
|
44
44
|
},
|
|
45
45
|
"bugs": {
|
|
46
|
-
"url": "https://github.com/Puri12/opencode-
|
|
46
|
+
"url": "https://github.com/Puri12/opencode-discord-presence/issues"
|
|
47
47
|
},
|
|
48
|
-
"homepage": "https://github.com/Puri12/opencode-
|
|
48
|
+
"homepage": "https://github.com/Puri12/opencode-discord-presence#readme",
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=18.0.0",
|
|
51
51
|
"bun": ">=1.1.0"
|