dsh-vscode-mode 0.1.47 → 0.1.49
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.md +10 -1
- package/lib/client.js +729 -205
- package/lib/client.js.map +1 -1
- package/lib/index.js +562 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/addToConversation.ts +32 -19
- package/src/client/compat.ts +1 -1
- package/src/client/index.ts +9 -2
- package/src/client/paths.ts +2 -0
- package/src/client/sidebar/SidebarView.ts +82 -16
- package/src/client/sidebar/menuItems.ts +23 -2
- package/src/client/sidebar/panels/FileExplorer.ts +2 -4
- package/src/client/sidebar/panels/RulesPanel.ts +284 -0
- package/src/client/sidebar/panels/index.ts +18 -2
- package/src/client/sidebar/types.ts +5 -0
- package/src/client/sidebarMin.ts +48 -0
- package/src/client/styles/editor.css +43 -0
- package/src/client/ui/EditorView.ts +25 -13
- package/src/client/ui/McpSettings.ts +37 -2
- package/src/client/ui/SideEditorTab.ts +1 -0
- package/src/client/ui/menuPosition.ts +2 -28
- package/src/fileOpenSettings.ts +2 -0
- package/src/index.ts +5 -1
- package/src/rpc.ts +37 -0
- package/src/rules.ts +528 -0
- package/src/shared/rpc.ts +11 -0
- package/src/shared/rules.ts +60 -0
package/src/shared/rpc.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
} from './types.js'
|
|
15
15
|
import type { MpcConfig, MpcProject, MpcProjectSaveInput, MpcServer } from './mcp.js'
|
|
16
16
|
import type { CompatReport, DevFormInfo } from './compat.js'
|
|
17
|
+
import type { RuleInfo, RuleProject, RuleRefInput, RuleSaveInput } from './rules.js'
|
|
17
18
|
import type { LspEnvInstallState, LspExtInfo, LspExtUpdate, LspHover, LspLocation, LspMarketItem, LspPosition, LspSemanticTokens, LspServerStatus, LspSymbol } from './lsp.js'
|
|
18
19
|
|
|
19
20
|
/** webServer 精确路由。 */
|
|
@@ -165,6 +166,11 @@ export interface RpcRequestMap {
|
|
|
165
166
|
'edrv.perf.configGet': {}
|
|
166
167
|
'edrv.perf.configApply': {}
|
|
167
168
|
'edrv.perf.configUndo': {}
|
|
169
|
+
'rules.list': {}
|
|
170
|
+
'rules.read': RuleRefInput
|
|
171
|
+
'rules.save': RuleSaveInput
|
|
172
|
+
'rules.remove': RuleRefInput
|
|
173
|
+
'rules.toggle': RuleRefInput & { enabled: boolean }
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
export type RpcMethod = keyof RpcRequestMap
|
|
@@ -231,6 +237,11 @@ export interface RpcOkMap {
|
|
|
231
237
|
'edrv.perf.configGet': { profileDir?: string; patchPath?: string; applied: boolean; block: string; backup?: string }
|
|
232
238
|
'edrv.perf.configApply': { applied: boolean; backup: string; restart: boolean }
|
|
233
239
|
'edrv.perf.configUndo': { restored: boolean; error?: string; backup?: string }
|
|
240
|
+
'rules.list': { user: RuleInfo[]; projects: RuleProject[] }
|
|
241
|
+
'rules.read': { content: string }
|
|
242
|
+
'rules.save': { rule: RuleInfo }
|
|
243
|
+
'rules.remove': object
|
|
244
|
+
'rules.toggle': { rule: RuleInfo }
|
|
234
245
|
}
|
|
235
246
|
|
|
236
247
|
/** 统一响应:{ok:true, ...payload} 或 {ok:false, error}。 */
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-vscode-mode 规则管理共享数据契约(.mdc 规则文件,参考 Codebuddy/Cursor 规则形态)。
|
|
3
|
+
* 纯类型模块:禁 node/react 导入(与 shared/mcp.ts 同约束)。
|
|
4
|
+
* 作者 ddj 2026年09月03号
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** 规则作用域:用户规则(~/.dsh/rules)或项目规则(<工作区>/.dsh/rules)。 */
|
|
8
|
+
export type RuleScope = 'user' | 'project'
|
|
9
|
+
|
|
10
|
+
/** 规则生效类型(由 frontmatter 推导):总是 / 自动(globs 命中时)/ 手动(仅索引)。 */
|
|
11
|
+
export type RuleType = 'always' | 'auto' | 'manual'
|
|
12
|
+
|
|
13
|
+
/** 一条 .mdc 规则的元信息(列表行展示 + 注入语义所需的最小集)。 */
|
|
14
|
+
export interface RuleInfo {
|
|
15
|
+
scope: RuleScope
|
|
16
|
+
/** 文件名(含 .mdc 后缀,不含路径)。 */
|
|
17
|
+
file: string
|
|
18
|
+
/** 绝对路径(host 解析,供展示与按需读取)。 */
|
|
19
|
+
absPath: string
|
|
20
|
+
/** 相对提示(用户层 rules/ 或项目层 .dsh/rules/)。 */
|
|
21
|
+
relHint: string
|
|
22
|
+
/** frontmatter description(缺失为空串)。 */
|
|
23
|
+
description: string
|
|
24
|
+
type: RuleType
|
|
25
|
+
/** frontmatter globs 归一化列表(类型=auto 时非空)。 */
|
|
26
|
+
globs: string[]
|
|
27
|
+
/** frontmatter enabled(缺省 true;false 时列表仍显示但不注入)。 */
|
|
28
|
+
enabled: boolean
|
|
29
|
+
/** 文件字节数(列表排序/超大提示用)。 */
|
|
30
|
+
size: number
|
|
31
|
+
/** 修改时间毫秒。 */
|
|
32
|
+
mtime: number
|
|
33
|
+
/** frontmatter 解析失败文案(不注入,仅 UI 提示)。 */
|
|
34
|
+
error?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 一个工作区的项目规则聚合(rules.list 的 projects 项)。 */
|
|
38
|
+
export interface RuleProject {
|
|
39
|
+
workspacePath: string
|
|
40
|
+
title: string
|
|
41
|
+
rules: RuleInfo[]
|
|
42
|
+
/** 工作区目录不存在或无规则目录时为 true(UI 显示空态而非报错)。 */
|
|
43
|
+
missingDir?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** 规则保存入参:content 为完整 .mdc 文本(frontmatter + 正文,host 原样写盘)。 */
|
|
47
|
+
export interface RuleSaveInput {
|
|
48
|
+
scope: RuleScope
|
|
49
|
+
/** project 必填:目标工作区绝对路径(须为 DSH 已注册 workspace)。 */
|
|
50
|
+
workspacePath?: string
|
|
51
|
+
file: string
|
|
52
|
+
content: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** 规则读取/删除/开关入参公共字段。 */
|
|
56
|
+
export interface RuleRefInput {
|
|
57
|
+
scope: RuleScope
|
|
58
|
+
workspacePath?: string
|
|
59
|
+
file: string
|
|
60
|
+
}
|