Skip to content

Commit eb351e6

Browse files
author
linyuqiao
committed
refactor: centralize usings
1 parent 1014509 commit eb351e6

15 files changed

Lines changed: 41 additions & 58 deletions

YCode.CLI/AgentContext.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Microsoft.Extensions.AI;
2-
31
namespace YCode.CLI
42
{
53
[Inject]
@@ -44,3 +42,4 @@ public void EnsureContextBlock(string text)
4442
}
4543
}
4644

45+

YCode.CLI/IAgentTool.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
51
namespace YCode.CLI
62
{
73
internal interface IAgentTool
@@ -15,3 +11,4 @@ internal interface IAgentTool
1511
}
1612
}
1713

14+

YCode.CLI/Managers/AgentManager.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Text.Json.Nodes;
2-
31
namespace YCode.CLI
42
{
53
[Inject]
@@ -39,3 +37,4 @@ public string GetDescription()
3937
}
4038
}
4139

40+

YCode.CLI/Managers/McpManager.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using Microsoft.Extensions.AI;
2-
using ModelContextProtocol.Client;
3-
41
namespace YCode.CLI
52
{
63
[Inject]
@@ -89,3 +86,4 @@ public AITool[] GetTools(Func<AITool, bool> filter)
8986

9087

9188

89+

YCode.CLI/Managers/MemoryManager.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System.Text;
2-
using System.Text.Json;
3-
using System.Text.Json.Serialization;
4-
using System.Text.RegularExpressions;
5-
using Microsoft.Extensions.AI;
6-
71
namespace YCode.CLI
82
{
93
[Inject]
@@ -599,3 +593,4 @@ internal class MemoryItem
599593

600594

601595

596+

YCode.CLI/Managers/SkillsManager.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System.Text.Json.Nodes;
2-
using System.Text.RegularExpressions;
3-
using YamlDotNet.Serialization;
4-
51
namespace YCode.CLI
62
{
73
[Inject]
@@ -166,3 +162,4 @@ public string[] GetSkills()
166162

167163

168164

165+

YCode.CLI/Managers/ToolManager.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Microsoft.Extensions.AI;
6-
71
namespace YCode.CLI
82
{
93
[Inject]
@@ -49,3 +43,4 @@ public Task<AITool[]> Register(params (Delegate @delegate, string name, string d
4943

5044

5145

46+

YCode.CLI/Program.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
using Microsoft.Extensions.AI;
2-
using Microsoft.Extensions.DependencyInjection;
3-
using OpenAI;
4-
using Spectre.Console;
5-
using System.ClientModel;
6-
using System.Text;
7-
using YCode.CLI;
8-
91
Console.OutputEncoding = Encoding.UTF8;
102

113
var host = new ServiceCollection();
@@ -84,6 +76,7 @@ Keep reasoning internal. Do not expose long chain-of-thought. Output only concis
8476
- Deduplicate before writing memory; keep memory atomic and searchable.
8577
- When user mentions long-term preference, persist it to `profile`.
8678
- When a project rule is stated, persist it to `project`.
79+
- When tracking progress (development updates or Todo changes), summarize goals and status into `daily` and persist stable milestones or decisions into `project`.
8780
8881
## Execution rules
8982
- Never invent file paths; discover first.
@@ -116,9 +109,9 @@ Keep reasoning internal. Do not expose long chain-of-thought. Output only concis
116109
Endpoint = new Uri(config.Uri),
117110

118111
}).GetChatClient(config.Model)
119-
.CreateAIAgent(instructions: system, tools: tools);
112+
.AsAIAgent(instructions: system, tools: tools);
120113

121-
var thread = agent.GetNewThread();
114+
var thread = await agent.CreateSessionAsync();
122115

123116
try
124117
{
@@ -469,3 +462,4 @@ public void Dispose()
469462
}
470463

471464
#endregion
465+

YCode.CLI/ServiceRegistration.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using Microsoft.Extensions.DependencyInjection;
2-
using System.Linq;
3-
using System.Reflection;
4-
51
namespace YCode.CLI
62
{
73
internal static class ServiceRegistration
@@ -94,3 +90,4 @@ public InjectAttribute(ServiceLifetime lifetime = ServiceLifetime.Singleton) : b
9490
}
9591
}
9692

93+

YCode.CLI/Tools/FileTools.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Text;
3-
41
namespace YCode.CLI
52
{
63
[Inject<IAgentTool>]
@@ -486,3 +483,4 @@ public static string NormalizePath(string path, AppConfig config)
486483

487484

488485

486+

0 commit comments

Comments
 (0)