Your Name 8 miesięcy temu
rodzic
commit
57b22ee467

+ 7 - 5
.roo/rules-orchestrator/rules.md

@@ -3,11 +3,13 @@
 
 
 ## 工作流程
-1. 理解需求,给出发难,向用户阐述方案
-    - 用户确认方案可行
-    - 询问本次工作模式
+1. 理解需求,给出详细方案,向用户阐述方案
+    - 用户确认方案是否可行
+        * 可行,进入下一步
+        * 其他任何选择,回到第一步
+2. 询问本次工作模式(要将工作模式传递给子任务)
         * 全自动:中途不向用户发起任何询问
         * 交互式:可以向用户发起询问来做出决定
-2. 梳理工作计划
+3. 梳理工作计划
     - 创建工作计划到 work/DEV.md
-3. 按照工作计划,采用多个子任务来完成整个工作
+4. 按照工作计划,采用多个子任务来完成整个工作

+ 73 - 0
UCore/Commands/GenerateAppTreeCommand.php

@@ -0,0 +1,73 @@
+<?php
+
+namespace UCore\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\File;
+
+/**
+ * 生成 app 目录的文件树并保存到 app/tree.md
+ */
+class GenerateAppTreeCommand extends Command
+{
+    /**
+     * 命令的名称和签名。
+     *
+     * @var string
+     */
+    protected $signature = 'ucore:generate-apptree';
+
+    /**
+     * 命令的描述。
+     *
+     * @var string
+     */
+    protected $description = '生成 app 目录的文件树并保存到 app/tree.md';
+
+    /**
+     * 执行控制台命令。
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        $appPath = base_path('app');
+        $outputFile = base_path('app/tree.md');
+
+        $tree = $this->generateDirectoryTree($appPath);
+
+        File::put($outputFile, $tree);
+
+        $this->info('File tree generated successfully at app/tree.md');
+
+        return Command::SUCCESS;
+    }
+
+    /**
+     * 生成目录树结构为字符串
+     *
+     * @param string $directory 目录路径
+     * @param string $prefix 前缀,用于格式化输出
+     * @return string 返回目录树的字符串表示
+     */
+    private function generateDirectoryTree(string $directory, string $prefix = ''): string
+    {
+        $tree = '';
+        $files = scandir($directory);
+
+        foreach ($files as $file) {
+            if ($file === '.' || $file === '..') {
+                continue;
+            }
+
+            $filePath = $directory . DIRECTORY_SEPARATOR . $file;
+            $tree .= $prefix . $file . "\n";
+
+            if (is_dir($filePath)) {
+                $tree .= $this->generateDirectoryTree($filePath, $prefix . '    ');
+            }
+        }
+
+        return $tree;
+    }
+}

+ 4 - 1
noai.md

@@ -70,4 +70,7 @@ AppGame模块,增加登陆成功事件
 
 app/Module下 数据仓库(Repository)里不应该有任何方法,修复已创建的所有数据仓库,注意检查已经定义的方法是否被使用,如果没有使用,删除该方法
 
-app/Module下 Repository 类,应该位于各模块的 Repositorys 目录,找出目录错误的,移动到正确的目录,并修复引用
+app/Module下 Repository 类,应该位于各模块的 Repositorys 目录,找出目录错误的,移动到正确的目录,并修复引用
+
+
+在 UCore/Commands 下写一个命令,生成app目录的文件列表,到 app/tree.md