mirror of
https://github.com/Tencent/teamai-cli.git
synced 2026-10-02 03:14:40 +08:00
Merge pull request #437 from kongdayan/fix/status-count-nested-rules
fix(status): count nested rule files recursively
This commit is contained in:
@@ -155,4 +155,12 @@ describe('teamai list / status resource coverage', () => {
|
||||
expect(out).toMatch(/hooks:\s*1/);
|
||||
expect(out).toMatch(/mcp:\s*1/);
|
||||
});
|
||||
|
||||
it('status counts nested rule files', async () => {
|
||||
await fse.ensureDir(path.join(repoPath, 'rules', 'common'));
|
||||
await fse.writeFile(path.join(repoPath, 'rules', 'common', 'example.md'), '# Rule\n');
|
||||
await status({});
|
||||
const out = lines.join('\n');
|
||||
expect(out).toMatch(/rules:\s*1/);
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import { getRepoStatus } from './utils/git.js';
|
||||
import { assertSafeResourceName } from './utils/path-safety.js';
|
||||
import { log } from './utils/logger.js';
|
||||
import { getAllHandlers } from './resources/index.js';
|
||||
import { listDirs, listFiles, pathExists, readFileSafe } from './utils/fs.js';
|
||||
import { listDirs, listFiles, listFilesRecursive, pathExists, readFileSafe } from './utils/fs.js';
|
||||
import { SkillsHandler } from './resources/skills.js';
|
||||
import { detectInstalledAgents, type ResolvedAgent } from './known-agents.js';
|
||||
import {
|
||||
@@ -79,7 +79,7 @@ export async function status(options: GlobalOptions): Promise<void> {
|
||||
const skillsDirs = await listDirs(path.join(repoPath, 'skills'));
|
||||
counts.skills = skillsDirs.length;
|
||||
|
||||
const rulesFiles = (await listFiles(path.join(repoPath, 'rules'))).filter(f => f.endsWith('.md'));
|
||||
const rulesFiles = (await listFilesRecursive(path.join(repoPath, 'rules'))).filter(f => f.endsWith('.md'));
|
||||
counts.rules = rulesFiles.length;
|
||||
|
||||
const docsExists = await pathExists(path.join(repoPath, 'docs'));
|
||||
|
||||
Reference in New Issue
Block a user