@kevisual/project-search 0.0.9 → 0.0.10

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/app.d.ts CHANGED
@@ -121,7 +121,7 @@ type ProjectDoc = {
121
121
  /**
122
122
  * 文档 ID,使用 path 的 base64url 编码
123
123
  */
124
- id: string;
124
+ id?: string;
125
125
  name?: string;
126
126
  path: string;
127
127
  /**
@@ -137,9 +137,9 @@ type ProjectDoc = {
137
137
  description?: string;
138
138
  link?: string;
139
139
  /**
140
- * 项目状态:active 活动中 | inactive 非活动
140
+ * 项目状态:active 活动中 | inactive 非活动 | unlive 未初始化
141
141
  */
142
- status?: 'active' | 'inactive';
142
+ status?: 'active' | 'inactive' | 'unlive';
143
143
  };
144
144
  declare class ProjectStore {
145
145
  meiliSearch: MeiliSearch;
@@ -150,12 +150,7 @@ declare class ProjectStore {
150
150
  private get index();
151
151
  ensureIndex(): Promise<void>;
152
152
  init(): Promise<void>;
153
- addProject(input: {
154
- name?: string;
155
- path: string;
156
- repo: string;
157
- status?: 'active' | 'inactive';
158
- }): Promise<void>;
153
+ addProject(input: Partial<ProjectDoc>): Promise<void>;
159
154
  removeProject(projectPath: string): Promise<void>;
160
155
  listProjects(): Promise<ProjectDoc[]>;
161
156
  getProject(projectPath: string): Promise<ProjectDoc | null>;
@@ -167,7 +162,7 @@ declare class ProjectStore {
167
162
  summary?: string;
168
163
  description?: string;
169
164
  link?: string;
170
- status?: 'active' | 'inactive';
165
+ status?: 'active' | 'inactive' | 'unlive';
171
166
  }): Promise<void>;
172
167
  }
173
168
 
@@ -186,24 +181,9 @@ declare class ProjectListener {
186
181
  }
187
182
 
188
183
  type Project = {
189
- name?: string;
190
- path: string;
191
- /**
192
- * 用 git remote url 唯一标识项目,方便搜索结果展示和过滤
193
- */
194
- repo: string;
195
184
  listener: ProjectListener;
196
- };
197
- type ProjectInput = Omit<Project, "listener">;
198
- type ProjectInfo = Omit<Project, "listener"> & {
199
- status: "active" | "inactive";
200
- id?: string;
201
- title?: string;
202
- tags?: string[];
203
- summary?: string;
204
- description?: string;
205
- link?: string;
206
- };
185
+ } & ProjectDoc;
186
+ type ProjectInfo = ProjectDoc;
207
187
  type ProjectManagerOpt = {
208
188
  meiliSearchOptions?: {
209
189
  apiHost?: string;
@@ -217,17 +197,22 @@ declare class ProjectManager implements ProjectManagerInterface {
217
197
  emitter: EventEmitter;
218
198
  constructor(options?: ProjectManagerOpt);
219
199
  /**
220
- * 初始化:从 store 加载已持久化的项目,检查本地目录存在后启动监听
200
+ * 初始化:从 store 加载已持久化的项目,检查本地目录存在后
201
+ * 只对 status 为 active 的项目启动监听,inactive 的只加载不监听
221
202
  */
222
203
  init(): Promise<void>;
223
204
  /**
224
- * 添加项目:创建监听器、启动监听、触发全量初始同步
205
+ * 添加项目:创建监听器、可选启动监听、触发全量初始同步
225
206
  */
226
- addProject(input: ProjectInput): Promise<ProjectInfo>;
207
+ addProject(input: ProjectDoc, options?: {
208
+ startListening?: boolean;
209
+ }): Promise<ProjectInfo>;
227
210
  removeProject(projectPath: string): Promise<void>;
228
211
  getProject(projectPath: string): Project;
229
212
  /** 停止项目文件监听,但不删除索引数据 */
230
213
  stopProject(projectPath: string): Promise<void>;
214
+ /** 启动项目文件监听 */
215
+ startProject(projectPath: string): Promise<void>;
231
216
  getProjectInfo(project: Project): Promise<ProjectInfo>;
232
217
  listProjects(): Promise<ProjectInfo[]>;
233
218
  getFile(filepath: string): Promise<{