9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
import * as fs from 'node:fs';
|
|
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
import { TRAE_USER_RULES } from './_fs.js';
|
|
|
|
// -------- user-rules --------
|
|
cli({
|
|
site: 'trae-solo',
|
|
name: 'user-rules',
|
|
access: 'read',
|
|
description: 'Print Trae SOLO user rules (~/.trae/user_rules.md).',
|
|
domain: 'localhost',
|
|
browser: false,
|
|
strategy: Strategy.LOCAL,
|
|
args: [],
|
|
columns: ['Field', 'Value'],
|
|
func: async () => {
|
|
if (!fs.existsSync(TRAE_USER_RULES)) {
|
|
return [{ Field: 'path', Value: TRAE_USER_RULES }, { Field: 'content', Value: '(file does not exist yet)' }];
|
|
}
|
|
const content = fs.readFileSync(TRAE_USER_RULES, 'utf-8');
|
|
const stat = fs.statSync(TRAE_USER_RULES);
|
|
return [
|
|
{ Field: 'path', Value: TRAE_USER_RULES },
|
|
{ Field: 'size', Value: String(stat.size) + ' bytes' },
|
|
{ Field: 'modified', Value: stat.mtime.toISOString().replace('T', ' ').slice(0, 19) },
|
|
{ Field: 'content', Value: content },
|
|
];
|
|
},
|
|
});
|