Merge pull request 'refactor: jsc-statusbar 改名為 jsc-mod' (#30) from refactor/statusbar-to-jsc-mod into main
Reviewed-on: https://gitea.jsc.idv.tw/jiantw83/jsc-marketplace/pulls/30
This commit was merged in pull request #30.
This commit is contained in:
@@ -6,8 +6,8 @@
|
|||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
"name": "jsc-statusbar",
|
"name": "jsc-mod",
|
||||||
"source": "./plugins/jsc-statusbar",
|
"source": "./plugins/jsc-mod",
|
||||||
"description": "輸入框上方單行狀態列:模型、目錄、分支、5h/7d 額度與重置、context、CPU/記憶體/磁碟"
|
"description": "輸入框上方單行狀態列:模型、目錄、分支、5h/7d 額度與重置、context、CPU/記憶體/磁碟"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ JSC 自用 Claude Code mods 的 marketplace。每個插件皆可單獨安裝、
|
|||||||
|
|
||||||
## 插件
|
## 插件
|
||||||
|
|
||||||
### [jsc-statusbar](plugins/jsc-statusbar) `0.0.4`
|
### [jsc-mod](plugins/jsc-mod) `0.0.1`
|
||||||
|
|
||||||
輸入框上方單行狀態列:模型、目錄、分支、5h/7d 額度與重置、context、CPU/記憶體/磁碟。
|
輸入框上方單行狀態列:模型、目錄、分支、5h/7d 額度與重置、context、CPU/記憶體/磁碟。
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ Matt Pocock 的工程技能整套(grilling、spec/ticket、TDD、code review
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
claude plugin marketplace add https://gitea.jsc.idv.tw/jiantw83/jsc-marketplace.git
|
claude plugin marketplace add https://gitea.jsc.idv.tw/jiantw83/jsc-marketplace.git
|
||||||
claude plugin install jsc-statusbar@jsc-marketplace
|
claude plugin install jsc-mod@jsc-marketplace
|
||||||
claude plugin install jsc-companion@jsc-marketplace
|
claude plugin install jsc-companion@jsc-marketplace
|
||||||
claude plugin install jsc-herdr@jsc-marketplace
|
claude plugin install jsc-herdr@jsc-marketplace
|
||||||
claude plugin install jsc-claude@jsc-marketplace
|
claude plugin install jsc-claude@jsc-marketplace
|
||||||
@@ -45,7 +45,7 @@ claude plugin install jsc-matt@jsc-marketplace
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
claude plugin marketplace update jsc-marketplace
|
claude plugin marketplace update jsc-marketplace
|
||||||
claude plugin update jsc-statusbar@jsc-marketplace
|
claude plugin update jsc-mod@jsc-marketplace
|
||||||
claude plugin update jsc-companion@jsc-marketplace
|
claude plugin update jsc-companion@jsc-marketplace
|
||||||
claude plugin update jsc-herdr@jsc-marketplace
|
claude plugin update jsc-herdr@jsc-marketplace
|
||||||
claude plugin update jsc-claude@jsc-marketplace
|
claude plugin update jsc-claude@jsc-marketplace
|
||||||
@@ -57,7 +57,7 @@ claude plugin update jsc-matt@jsc-marketplace
|
|||||||
## 移除
|
## 移除
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
claude plugin uninstall jsc-statusbar@jsc-marketplace
|
claude plugin uninstall jsc-mod@jsc-marketplace
|
||||||
claude plugin uninstall jsc-companion@jsc-marketplace
|
claude plugin uninstall jsc-companion@jsc-marketplace
|
||||||
claude plugin uninstall jsc-herdr@jsc-marketplace
|
claude plugin uninstall jsc-herdr@jsc-marketplace
|
||||||
claude plugin uninstall jsc-claude@jsc-marketplace
|
claude plugin uninstall jsc-claude@jsc-marketplace
|
||||||
@@ -65,7 +65,7 @@ claude plugin uninstall jsc-matt@jsc-marketplace
|
|||||||
claude plugin marketplace remove jsc-marketplace
|
claude plugin marketplace remove jsc-marketplace
|
||||||
```
|
```
|
||||||
|
|
||||||
曾安裝舊名稱(`statusbar`、`companion`、`herdr`、`herdr-issue`、`jsc-eli5`)的環境,請先 `claude plugin uninstall <舊名>@jsc-marketplace` 再安裝新名稱。`jsc-eli5` 已改名為 `jsc-claude`,指令為 `/jsc-claude:eli5`。
|
曾安裝舊名稱(`statusbar`、`jsc-statusbar`、`companion`、`herdr`、`herdr-issue`、`jsc-eli5`)的環境,請先 `claude plugin uninstall <舊名>@jsc-marketplace` 再安裝新名稱。`jsc-eli5` 已改名為 `jsc-claude`,指令為 `/jsc-claude:eli5`。
|
||||||
|
|
||||||
## 授權
|
## 授權
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// 角色行用的字串片段與寬度計算(與 statusbar 外掛各自獨立,不互相依賴)
|
// 角色行用的字串片段與寬度計算(與 jsc-mod 外掛各自獨立,不互相依賴)
|
||||||
export type Seg = { text: string; color?: string; dim?: boolean; bold?: boolean }
|
export type Seg = { text: string; color?: string; dim?: boolean; bold?: boolean }
|
||||||
|
|
||||||
export function bar(p: number, cells = 5): string {
|
export function bar(p: number, cells = 5): string {
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-statusbar",
|
"name": "jsc-mod",
|
||||||
"version": "0.0.4",
|
"version": "0.0.1",
|
||||||
"description": "輸入框上方的單行狀態列:模型、目錄、分支、5h/7d 額度與重置、context、CPU/記憶體/磁碟",
|
"description": "輸入框上方的單行狀態列:模型、目錄、分支、5h/7d 額度與重置、context、CPU/記憶體/磁碟",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"types": "./types/index.d.ts",
|
"types": "./types/index.d.ts",
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# jsc-mod
|
||||||
|
|
||||||
|
## 指令
|
||||||
|
|
||||||
|
### `/jsc-mod:statusline on`
|
||||||
|
|
||||||
|
開啟狀態列。
|
||||||
|
|
||||||
|
```text
|
||||||
|
/jsc-mod:statusline on
|
||||||
|
```
|
||||||
|
|
||||||
|
### `/jsc-mod:statusline off`
|
||||||
|
|
||||||
|
隱藏狀態列。
|
||||||
|
|
||||||
|
```text
|
||||||
|
/jsc-mod:statusline off
|
||||||
|
```
|
||||||
|
|
||||||
|
### `/jsc-mod:statusline compact`
|
||||||
|
|
||||||
|
改用極窄版狀態列。
|
||||||
|
|
||||||
|
```text
|
||||||
|
/jsc-mod:statusline compact
|
||||||
|
```
|
||||||
@@ -91,7 +91,7 @@ describe('format', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('band', () => {
|
describe('band', () => {
|
||||||
test('draws one line above the prompt and hides with /statusbar off', async ($, on) => {
|
test('draws one line above the prompt and hides with /statusline off', async ($, on) => {
|
||||||
on('session.model', () => ({ value: 'claude-opus-5-5' }))
|
on('session.model', () => ({ value: 'claude-opus-5-5' }))
|
||||||
on('session.cwd', () => ({ value: '/home/dev/work/luopan' }))
|
on('session.cwd', () => ({ value: '/home/dev/work/luopan' }))
|
||||||
const props = {
|
const props = {
|
||||||
@@ -103,12 +103,12 @@ describe('band', () => {
|
|||||||
view: {},
|
view: {},
|
||||||
}
|
}
|
||||||
for (const surface of ['terminal', 'desktop'] as const) {
|
for (const surface of ['terminal', 'desktop'] as const) {
|
||||||
const ui = await $.ui.mount({ plugin: 'jsc-statusbar', surface, component: 'AbovePrompt', props })
|
const ui = await $.ui.mount({ plugin: 'jsc-mod', surface, component: 'AbovePrompt', props })
|
||||||
expect(await ui.find({ type: 'Text', text: /◆ Opus 5\.5/ })).toBeDefined()
|
expect(await ui.find({ type: 'Text', text: /◆ Opus 5\.5/ })).toBeDefined()
|
||||||
expect(await ui.find({ type: 'Text', text: /5h —/ })).toBeDefined()
|
expect(await ui.find({ type: 'Text', text: /5h —/ })).toBeDefined()
|
||||||
await ui.unmount()
|
await ui.unmount()
|
||||||
}
|
}
|
||||||
const ran = await $.command.run({ command: 'statusbar', args: 'off' } as Parameters<typeof $.command.run>[0])
|
const ran = await $.command.run({ command: 'statusline', args: 'off' } as Parameters<typeof $.command.run>[0])
|
||||||
expect(JSON.stringify(ran)).toContain('隱藏')
|
expect(JSON.stringify(ran)).toContain('隱藏')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -5,12 +5,12 @@ import type { Mode, Sys, Usage, Window } from '../types'
|
|||||||
import { fit, cpuPercent, parseCpu, parseDf, parseGit, parseMem, parseOffset } from './format'
|
import { fit, cpuPercent, parseCpu, parseDf, parseGit, parseMem, parseOffset } from './format'
|
||||||
import type { CpuSample } from './format'
|
import type { CpuSample } from './format'
|
||||||
|
|
||||||
const usageAtom = atom({ plugin: 'jsc-statusbar', key: 'usage' } as const, {})
|
const usageAtom = atom({ plugin: 'jsc-mod', key: 'usage' } as const, {})
|
||||||
const gitAtom = atom({ plugin: 'jsc-statusbar', key: 'git' } as const, null)
|
const gitAtom = atom({ plugin: 'jsc-mod', key: 'git' } as const, null)
|
||||||
const sysAtom = atom({ plugin: 'jsc-statusbar', key: 'sys' } as const, {})
|
const sysAtom = atom({ plugin: 'jsc-mod', key: 'sys' } as const, {})
|
||||||
const modeAtom = atom({ plugin: 'jsc-statusbar', key: 'mode' } as const, 'auto')
|
const modeAtom = atom({ plugin: 'jsc-mod', key: 'mode' } as const, 'auto')
|
||||||
const alertedAtom = atom({ plugin: 'jsc-statusbar', key: 'alerted' } as const, [])
|
const alertedAtom = atom({ plugin: 'jsc-mod', key: 'alerted' } as const, [])
|
||||||
const effortAtom = atom({ plugin: 'jsc-statusbar', key: 'effort' } as const, null)
|
const effortAtom = atom({ plugin: 'jsc-mod', key: 'effort' } as const, null)
|
||||||
|
|
||||||
const SYS_MS = 3000
|
const SYS_MS = 3000
|
||||||
const GIT_MS = 15_000
|
const GIT_MS = 15_000
|
||||||
@@ -111,7 +111,7 @@ async function runHud($: EngineInterface, args: string) {
|
|||||||
export const register: Register = on => {
|
export const register: Register = on => {
|
||||||
on('session.start', async ($, e, next) => {
|
on('session.start', async ($, e, next) => {
|
||||||
await $.command.register({
|
await $.command.register({
|
||||||
name: 'statusbar',
|
name: 'statusline',
|
||||||
description: '切換輸入框上方的狀態列',
|
description: '切換輸入框上方的狀態列',
|
||||||
argumentHint: 'on | off | compact',
|
argumentHint: 'on | off | compact',
|
||||||
})
|
})
|
||||||
@@ -161,7 +161,7 @@ export const register: Register = on => {
|
|||||||
return ran
|
return ran
|
||||||
})
|
})
|
||||||
|
|
||||||
on('command.run', { command: 'statusbar' }, ($, e) => runHud($, e.args))
|
on('command.run', { command: 'statusline' }, ($, e) => runHud($, e.args))
|
||||||
|
|
||||||
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
|
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
|
||||||
const mode = await read($, modeAtom)
|
const mode = await read($, modeAtom)
|
||||||
@@ -16,7 +16,7 @@ export type Mode = 'auto' | 'compact' | 'off'
|
|||||||
|
|
||||||
declare module 'claude-code' {
|
declare module 'claude-code' {
|
||||||
interface PluginState {
|
interface PluginState {
|
||||||
'jsc-statusbar': {
|
'jsc-mod': {
|
||||||
usage: Usage
|
usage: Usage
|
||||||
git: Git | null
|
git: Git | null
|
||||||
sys: Sys
|
sys: Sys
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
# jsc-statusbar
|
|
||||||
|
|
||||||
## 指令
|
|
||||||
|
|
||||||
### `/statusbar on`
|
|
||||||
|
|
||||||
開啟狀態列。
|
|
||||||
|
|
||||||
```text
|
|
||||||
/statusbar on
|
|
||||||
```
|
|
||||||
|
|
||||||
### `/statusbar off`
|
|
||||||
|
|
||||||
隱藏狀態列。
|
|
||||||
|
|
||||||
```text
|
|
||||||
/statusbar off
|
|
||||||
```
|
|
||||||
|
|
||||||
### `/statusbar compact`
|
|
||||||
|
|
||||||
改用極窄版狀態列。
|
|
||||||
|
|
||||||
```text
|
|
||||||
/statusbar compact
|
|
||||||
```
|
|
||||||
Reference in New Issue
Block a user