claude-scope 0.2.1 → 0.2.3
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/dist/claude-scope.cjs +17 -3
- package/package.json +1 -1
package/dist/claude-scope.cjs
CHANGED
|
@@ -279,7 +279,7 @@ var GitWidget = class {
|
|
|
279
279
|
if (!branch) {
|
|
280
280
|
return null;
|
|
281
281
|
}
|
|
282
|
-
return
|
|
282
|
+
return branch;
|
|
283
283
|
} catch {
|
|
284
284
|
return null;
|
|
285
285
|
}
|
|
@@ -643,7 +643,7 @@ var OutputStyleSchema = object({
|
|
|
643
643
|
name: string()
|
|
644
644
|
});
|
|
645
645
|
var StdinDataSchema = object({
|
|
646
|
-
hook_event_name: literal("Status"),
|
|
646
|
+
hook_event_name: optional(literal("Status")),
|
|
647
647
|
session_id: string(),
|
|
648
648
|
transcript_path: string(),
|
|
649
649
|
cwd: string(),
|
|
@@ -722,7 +722,8 @@ async function main() {
|
|
|
722
722
|
try {
|
|
723
723
|
const stdin = await readStdin();
|
|
724
724
|
if (!stdin || stdin.trim().length === 0) {
|
|
725
|
-
|
|
725
|
+
const fallback = await tryGitFallback();
|
|
726
|
+
return fallback;
|
|
726
727
|
}
|
|
727
728
|
const provider = new StdinProvider();
|
|
728
729
|
const stdinData = await provider.parse(stdin);
|
|
@@ -748,6 +749,19 @@ async function main() {
|
|
|
748
749
|
);
|
|
749
750
|
return output || "";
|
|
750
751
|
} catch (error) {
|
|
752
|
+
const fallback = await tryGitFallback();
|
|
753
|
+
return fallback;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
async function tryGitFallback() {
|
|
757
|
+
try {
|
|
758
|
+
const cwd = process.cwd();
|
|
759
|
+
const widget = new GitWidget();
|
|
760
|
+
await widget.initialize({ config: {} });
|
|
761
|
+
await widget.update({ cwd, session_id: "fallback" });
|
|
762
|
+
const result = await widget.render({ width: 80, timestamp: Date.now() });
|
|
763
|
+
return result || "";
|
|
764
|
+
} catch {
|
|
751
765
|
return "";
|
|
752
766
|
}
|
|
753
767
|
}
|