claude-opencode-viewer 2.6.35 → 2.6.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +7 -7
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -643,7 +643,7 @@ const requestHandler = async (req, res) => {
|
|
|
643
643
|
});
|
|
644
644
|
try {
|
|
645
645
|
const gitCwd = process.env.PROJECT_DIR || process.cwd();
|
|
646
|
-
const { stdout } = await execFileAsync('git', ['status', '--porcelain'], {
|
|
646
|
+
const { stdout } = await execFileAsync('git', ['-c', 'safe.directory=*', 'status', '--porcelain'], {
|
|
647
647
|
cwd: gitCwd, encoding: 'utf-8', timeout: 5000,
|
|
648
648
|
});
|
|
649
649
|
const changes = stdout.split('\n').filter(Boolean).map(line => ({
|
|
@@ -675,7 +675,7 @@ const requestHandler = async (req, res) => {
|
|
|
675
675
|
for (const file of fileList) {
|
|
676
676
|
if (file.includes('..') || file.startsWith('/')) continue;
|
|
677
677
|
try {
|
|
678
|
-
const { stdout: statusOut } = await execFileAsync('git', ['status', '--porcelain', '--', file], { cwd, encoding: 'utf-8', timeout: 3000 });
|
|
678
|
+
const { stdout: statusOut } = await execFileAsync('git', ['-c', 'safe.directory=*', 'status', '--porcelain', '--', file], { cwd, encoding: 'utf-8', timeout: 3000 });
|
|
679
679
|
if (!statusOut.trim()) continue;
|
|
680
680
|
const status = statusOut.substring(0, 2).trim();
|
|
681
681
|
const is_new = status === 'A' || status === '??';
|
|
@@ -683,7 +683,7 @@ const requestHandler = async (req, res) => {
|
|
|
683
683
|
let is_binary = false;
|
|
684
684
|
if (!is_deleted) {
|
|
685
685
|
try {
|
|
686
|
-
const { stdout: dc } = await execFileAsync('git', ['diff', '--numstat', 'HEAD', '--', file], { cwd, encoding: 'utf-8', timeout: 3000 });
|
|
686
|
+
const { stdout: dc } = await execFileAsync('git', ['-c', 'safe.directory=*', 'diff', '--numstat', 'HEAD', '--', file], { cwd, encoding: 'utf-8', timeout: 3000 });
|
|
687
687
|
if (dc.includes('-\t-\t')) is_binary = true;
|
|
688
688
|
} catch {}
|
|
689
689
|
}
|
|
@@ -691,7 +691,7 @@ const requestHandler = async (req, res) => {
|
|
|
691
691
|
if (!is_binary) {
|
|
692
692
|
if (!is_new) {
|
|
693
693
|
try {
|
|
694
|
-
const { stdout } = await execFileAsync('git', ['show', `HEAD:${file}`], { cwd, encoding: 'utf-8', timeout: 5000, maxBuffer: 5 * 1024 * 1024 });
|
|
694
|
+
const { stdout } = await execFileAsync('git', ['-c', 'safe.directory=*', 'show', `HEAD:${file}`], { cwd, encoding: 'utf-8', timeout: 5000, maxBuffer: 5 * 1024 * 1024 });
|
|
695
695
|
old_content = stdout;
|
|
696
696
|
} catch {}
|
|
697
697
|
}
|
|
@@ -711,8 +711,8 @@ const requestHandler = async (req, res) => {
|
|
|
711
711
|
// 获取 unified diff
|
|
712
712
|
try {
|
|
713
713
|
const diffArgs = is_new
|
|
714
|
-
? ['diff', '--no-color', '-U3', '--no-index', '/dev/null', file]
|
|
715
|
-
: ['diff', '--no-color', '-U3', 'HEAD', '--', file];
|
|
714
|
+
? ['-c', 'safe.directory=*', 'diff', '--no-color', '-U3', '--no-index', '/dev/null', file]
|
|
715
|
+
: ['-c', 'safe.directory=*', 'diff', '--no-color', '-U3', 'HEAD', '--', file];
|
|
716
716
|
const { stdout } = await execFileAsync('git', diffArgs, { cwd, encoding: 'utf-8', timeout: 5000, maxBuffer: 5 * 1024 * 1024 });
|
|
717
717
|
unified_diff = stdout;
|
|
718
718
|
} catch (e) {
|
|
@@ -730,7 +730,7 @@ const requestHandler = async (req, res) => {
|
|
|
730
730
|
if (req.url === '/api/docs') {
|
|
731
731
|
res.writeHead(200, { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' });
|
|
732
732
|
try {
|
|
733
|
-
const docsRoot =
|
|
733
|
+
const docsRoot = process.env.PROJECT_DIR || process.cwd();
|
|
734
734
|
const EXCLUDE = new Set(['readme.md', 'changelog.md', 'license.md', 'claude.md', 'agents.md', 'contributing.md', 'security.md', 'context.md']);
|
|
735
735
|
const files = [];
|
|
736
736
|
const SKIP_DIRS = new Set(['node_modules', '.git', '.opencode', '.claude', '.idea', '.vscode']);
|