Merge pull request #437 from kongdayan/fix/status-count-nested-rules

fix(status): count nested rule files recursively
This commit is contained in:
jeff
2026-09-08 20:09:37 +08:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
+8
View File
@@ -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
View File
@@ -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'));