@@ -45,62 +45,292 @@ sequenceDiagram
4545 LSAP-->>Agent: 2. Structured Markdown (Callers + Code Context)
4646```
4747
48- ## Interaction Example
48+ ## Interaction Examples
4949
5050LSAP's interaction design strictly follows the ** Markdown-First** principle: input expresses intent, and output provides refined knowledge.
5151
52- ### Request: Semantic Search (Demonstrating Composed Capabilities)
52+ ### 1. Find References
5353
54- The Agent only needs to issue a high-level command without worrying about underlying row/column calculations or file reading:
54+ ** Request: **
5555
56- ``` jsonc
57- // Intent: Find all usages of 'DateUtil.format_date' to refactor it
56+ ``` json
5857{
5958 "locate" : {
60- " file_path" : " src/utils.py" ,
61- // we can find the def ...
62- " find" : " def format_date<|>" , // use `<|>` to identify the exact position
63- // ... or we can use locate
64- " locate" : " DateUtil.format_date" , // use hierarchical path to identify symbol
59+ "file_path" : " src/models.py" ,
60+ "locate" : " User.validate"
6561 },
6662 "mode" : " references" ,
67- " max_items" : 10 ,
63+ "max_items" : 2
6864}
6965```
7066
71- ### Response: Structured Knowledge
72-
73- LSAP aggregates the results of ` references ` (locations), ` documentSymbol ` (caller context), and ` read ` (code snippets):
67+ ** Response:**
7468
7569```` markdown
7670# References Found
7771
78- Total references: 45 | Showing: 2
72+ Total references: 12 | Showing: 2
73+
74+ ### src/auth/login.py:45
75+
76+ In ` LoginHandler.authenticate ` (` method ` )
77+
78+ ``` python
79+ if not User.validate(credentials):
80+ raise AuthError()
81+ ```
82+
83+ ### src/api/register.py:28
84+
85+ In ` register_user ` (` function ` )
86+
87+ ``` python
88+ User.validate(new_user_data)
89+ ```
90+ ````
91+
92+ ### 2. File Outline
93+
94+ ** Request:**
95+
96+ ``` json
97+ {
98+ "file_path" : " src/models.py" ,
99+ "mode" : " outline"
100+ }
101+ ```
102+
103+ ** Response:**
79104
80- ### ` src/ui/header.py ` :28
105+ ```` markdown
106+ # Outline for ` src/models.py `
107+
108+ ## User (` class ` )
81109
82- In ` Header.render ` (` Method ` )
110+ ### User.validate (` method ` )
83111
84112``` python
85- formatted = format_date(user.last_login)
113+ def validate ( data : dict ) -> bool
86114```
87115
88- ### ` src/api/views.py ` :42
116+ -- -
89117
90- In ` UserDetail.get ` (` Method ` )
118+ Validate user data before saving.
119+
120+ # ## User.save (`method`)
91121
92122```python
93- return {" date" : format_date(obj.created_at)}
123+ async def save(self ) -> None
124+ ```
125+
126+ # # Post (`class`)
127+
128+ # ## Post.publish (`method`)
129+
130+ ```python
131+ async def publish(self ) -> PublishResult
94132```
95133````
96134
135+ # ## 3. Safe Rename (Two-Step Workflow)
136+
137+ ** Request (Preview):**
138+
139+ ```json
140+ {
141+ " locate" : {
142+ " file_path" : " src/models.py" ,
143+ " locate" : " User.validate"
144+ },
145+ " new_name" : " validate_data" ,
146+ " mode" : " rename_preview"
147+ }
148+ ```
149+
150+ ** Response:**
151+
152+ ```` markdown
153+ # Rename Preview: ` validate ` → ` validate_data `
154+
155+ ID: ` abc123 `
156+ Summary: Affects 3 files and 8 occurrences.
157+
158+ ## ` src/models.py `
159+
160+ Line 15:
161+
162+ ``` diff
163+ - def validate(data: dict) -> bool:
164+ + def validate_data(data: dict) -> bool:
165+ ```
166+
167+ ## ` src/auth/login.py `
168+
169+ Line 45:
170+
171+ ``` diff
172+ - if not User.validate(credentials):
173+ + if not User.validate_data(credentials):
174+ ```
175+
176+ ---
177+
178+ > [ !TIP]
179+ > To apply this rename, use ` rename_execute ` with ` rename_id="abc123" ` .
180+ ````
181+
182+ ** Request (Execute):**
183+
184+ ``` json
185+ {
186+ "rename_id" : " abc123" ,
187+ "exclude_files" : [" tests/**" ],
188+ "mode" : " rename_execute"
189+ }
190+ ```
191+
192+ ** Response:**
193+
194+ ``` markdown
195+ # Rename Applied: ` validate ` → ` validate_data `
196+
197+ Summary: Modified 3 files with 8 occurrences.
198+
199+ - ` src/models.py ` : 1 occurrence
200+ - ` src/auth/login.py ` : 4 occurrences
201+ - ` src/api/register.py ` : 3 occurrences
202+
203+ ---
204+
205+ > [ !NOTE]
206+ > Rename completed successfully. Excluded files: ` tests/** ` .
207+ > [ !IMPORTANT]
208+ > You must manually rename the symbol in the excluded files to maintain consistency.
209+ ```
210+
211+ ### 2. File Outline
212+
213+ ** Request:**
214+
215+ ``` json
216+ {
217+ "file_path" : " src/lsap/capability/rename.py" ,
218+ "mode" : " outline"
219+ }
220+ ```
221+
222+ ** Response:**
223+
224+ ```` markdown
225+ # Outline for ` src/lsap/capability/rename.py `
226+
227+ ## CachedRename (` class ` )
228+
229+ ## \_ get_old_name (` function ` )
230+
231+ ``` python
232+ def _get_old_name (
233+ reader : DocumentReader,
234+ pos : Position,
235+ res : PrepareRenameResult
236+ ) -> str
237+ ```
238+
239+ # # \_matches_exclude_patterns (`function`)
240+
241+ ```python
242+ def _matches_exclude_patterns(
243+ path: Path,
244+ patterns: Sequence[str ],
245+ workspace_root: Path
246+ ) -> bool
247+ ```
248+
249+ -- -
250+
251+ Check if path matches any of the exclude patterns.
252+ ````
253+
254+ # ## 3. Safe Rename (Two-Step Workflow)
255+
256+ ** Request (Preview):**
257+
258+ ```json
259+ {
260+ " locate" : {
261+ " file_path" : " src/lsap/schema/rename.py" ,
262+ " locate" : " RenameDiff"
263+ },
264+ " new_name" : " LineChange" ,
265+ " mode" : " rename_preview"
266+ }
267+ ```
268+
269+ ** Response:**
270+
271+ ```` markdown
272+ # Rename Preview: ` RenameDiff ` → ` LineChange `
273+
274+ ID: ` 045d72 `
275+ Summary: Affects 2 files and 7 occurrences.
276+
277+ ## ` src/lsap/schema/rename.py `
278+
279+ Line 10:
280+
281+ ``` diff
282+ - class RenameDiff(BaseModel):
283+ + class LineChange(BaseModel):
284+ ```
285+
286+ Line 22:
287+
288+ ``` diff
289+ - diffs: list[RenameDiff]
290+ + diffs: list[LineChange]
291+ ```
292+
293+ ---
294+
295+ > [ !TIP]
296+ > To apply this rename, use ` rename_execute ` with ` rename_id="045d72" ` .
297+ ````
298+
299+ ** Request (Execute):**
300+
301+ ``` json
302+ {
303+ "rename_id" : " 045d72" ,
304+ "exclude_files" : [" tests/**/*.py" ],
305+ "mode" : " rename_execute"
306+ }
307+ ```
308+
309+ ** Response:**
310+
311+ ``` markdown
312+ # Rename Applied: ` RenameDiff ` → ` LineChange `
313+
314+ Summary: Modified 2 files with 7 occurrences.
315+
316+ - ` src/lsap/schema/rename.py ` : 2 occurrences
317+ - ` src/lsap/capability/rename.py ` : 5 occurrences
318+
319+ ---
320+
321+ > [ !NOTE]
322+ > Rename completed successfully. Excluded files: ` tests/**/*.py ` .
323+ > [ !IMPORTANT]
324+ > You must manually rename the symbol in the excluded files to maintain consistency.
325+ ```
326+
97327## I'm Not Convinced...
98328
99329### "LSAP Just Replicates LSP—What's Special?"
100330
101331While LSP provides ** atomic operations** , LSAP offers ** composed capabilities** .
102332
103- For instance, the ** [ Relation API] ( docs/schemas/draft/relation.md ) ** finds call paths between functions in a single request (handling traversal, cycles, and formatting), a task requiring complex orchestration in raw LSP. Similarly, the ** [ Unified Hierarchy API ] ( docs/schemas/draft/hierarchy.md ) ** delivers unified graph representations optimized for agents .
333+ For instance, the ** [ Relation API] ( docs/schemas/draft/relation.md ) ** (still in draft, but soon will be released) finds call paths between functions in a single request (handling traversal, cycles, and formatting), a task requiring complex orchestration in raw LSP.
104334
105335LSAP centralizes these patterns, preventing agents from wasting tokens on orchestration and enabling advanced capabilities like architectural and impact analysis.
106336
@@ -119,7 +349,7 @@ LSAP **centralizes** complexity. Instead of every Agent reimplementing LSP orche
119349
120350### Claude Code
121351
122- Claude Code have native LSP supports now - Well [ they don't] ( https://www.reddit.com/r/ClaudeAI/comments/1q6q9my/claudecode_v210_just_dropped/ )
352+ Claude Code have native LSP supports now - Well [ they don't] ( https://www.reddit.com/r/ClaudeAI/comments/1q6q9my/claudecode_v210_just_dropped/ ) .
123353
124354### Serena
125355
0 commit comments