Function bodies 868 total
createUpdateListener function · typescript · L61-L69 (9 LOC)app/src/lib/editor/extensions.ts
export function createUpdateListener(
onChange: (content: string) => void
): Extension {
return EditorView.updateListener.of((update) => {
if (update.docChanged) {
onChange(update.state.doc.toString());
}
});
}createUpdateListener function · typescript · L61-L69 (9 LOC)app/src/lib/editor/extensions.ts
export function createUpdateListener(
onChange: (content: string) => void
): Extension {
return EditorView.updateListener.of((update) => {
if (update.docChanged) {
onChange(update.state.doc.toString());
}
});
}createUpdateListener function · typescript · L61-L69 (9 LOC)app/src/lib/editor/extensions.ts
export function createUpdateListener(
onChange: (content: string) => void
): Extension {
return EditorView.updateListener.of((update) => {
if (update.docChanged) {
onChange(update.state.doc.toString());
}
});
}createUpdateListener function · typescript · L61-L69 (9 LOC)app/src/lib/editor/extensions.ts
export function createUpdateListener(
onChange: (content: string) => void
): Extension {
return EditorView.updateListener.of((update) => {
if (update.docChanged) {
onChange(update.state.doc.toString());
}
});
}createExtensions function · typescript · L72-L74 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensions(
onChange: (content: string) => void,
config: EditorConfig = {}createExtensions function · typescript · L72-L74 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensions(
onChange: (content: string) => void,
config: EditorConfig = {}createExtensions function · typescript · L72-L74 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensions(
onChange: (content: string) => void,
config: EditorConfig = {}Powered by Repobility — scan your code at https://repobility.com
createExtensions function · typescript · L72-L74 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensions(
onChange: (content: string) => void,
config: EditorConfig = {}wrapSelection function · typescript · L183-L213 (31 LOC)app/src/lib/editor/extensions.ts
function wrapSelection(view: EditorView, prefix: string, suffix: string): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
// Check if already wrapped
const beforeText = view.state.sliceDoc(Math.max(0, from - prefix.length), from);
const afterText = view.state.sliceDoc(to, to + suffix.length);
if (beforeText === prefix && afterText === suffix) {
// Remove wrapping
view.dispatch({
changes: [
{ from: from - prefix.length, to: from, insert: '' },
{ from: to, to: to + suffix.length, insert: '' },
],
selection: { anchor: from - prefix.length, head: to - prefix.length },
});
} else {
// Add wrapping
view.dispatch({
changes: [
{ from, insert: prefix },
{ from: to, insert: suffix },
],
selection: {
anchor: from + prefix.length,
head: to + prefix.length,
},
});
}
}wrapSelection function · typescript · L183-L213 (31 LOC)app/src/lib/editor/extensions.ts
function wrapSelection(view: EditorView, prefix: string, suffix: string): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
// Check if already wrapped
const beforeText = view.state.sliceDoc(Math.max(0, from - prefix.length), from);
const afterText = view.state.sliceDoc(to, to + suffix.length);
if (beforeText === prefix && afterText === suffix) {
// Remove wrapping
view.dispatch({
changes: [
{ from: from - prefix.length, to: from, insert: '' },
{ from: to, to: to + suffix.length, insert: '' },
],
selection: { anchor: from - prefix.length, head: to - prefix.length },
});
} else {
// Add wrapping
view.dispatch({
changes: [
{ from, insert: prefix },
{ from: to, insert: suffix },
],
selection: {
anchor: from + prefix.length,
head: to + prefix.length,
},
});
}
}wrapSelection function · typescript · L183-L213 (31 LOC)app/src/lib/editor/extensions.ts
function wrapSelection(view: EditorView, prefix: string, suffix: string): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
// Check if already wrapped
const beforeText = view.state.sliceDoc(Math.max(0, from - prefix.length), from);
const afterText = view.state.sliceDoc(to, to + suffix.length);
if (beforeText === prefix && afterText === suffix) {
// Remove wrapping
view.dispatch({
changes: [
{ from: from - prefix.length, to: from, insert: '' },
{ from: to, to: to + suffix.length, insert: '' },
],
selection: { anchor: from - prefix.length, head: to - prefix.length },
});
} else {
// Add wrapping
view.dispatch({
changes: [
{ from, insert: prefix },
{ from: to, insert: suffix },
],
selection: {
anchor: from + prefix.length,
head: to + prefix.length,
},
});
}
}wrapSelection function · typescript · L183-L213 (31 LOC)app/src/lib/editor/extensions.ts
function wrapSelection(view: EditorView, prefix: string, suffix: string): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
// Check if already wrapped
const beforeText = view.state.sliceDoc(Math.max(0, from - prefix.length), from);
const afterText = view.state.sliceDoc(to, to + suffix.length);
if (beforeText === prefix && afterText === suffix) {
// Remove wrapping
view.dispatch({
changes: [
{ from: from - prefix.length, to: from, insert: '' },
{ from: to, to: to + suffix.length, insert: '' },
],
selection: { anchor: from - prefix.length, head: to - prefix.length },
});
} else {
// Add wrapping
view.dispatch({
changes: [
{ from, insert: prefix },
{ from: to, insert: suffix },
],
selection: {
anchor: from + prefix.length,
head: to + prefix.length,
},
});
}
}insertLink function · typescript · L216-L233 (18 LOC)app/src/lib/editor/extensions.ts
function insertLink(view: EditorView): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
if (selectedText) {
// Wrap selection as link text
view.dispatch({
changes: { from, to, insert: `[${selectedText}](url)` },
selection: { anchor: from + selectedText.length + 3, head: from + selectedText.length + 6 },
});
} else {
// Insert empty link template
view.dispatch({
changes: { from, insert: '[text](url)' },
selection: { anchor: from + 1, head: from + 5 },
});
}
}insertLink function · typescript · L216-L233 (18 LOC)app/src/lib/editor/extensions.ts
function insertLink(view: EditorView): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
if (selectedText) {
// Wrap selection as link text
view.dispatch({
changes: { from, to, insert: `[${selectedText}](url)` },
selection: { anchor: from + selectedText.length + 3, head: from + selectedText.length + 6 },
});
} else {
// Insert empty link template
view.dispatch({
changes: { from, insert: '[text](url)' },
selection: { anchor: from + 1, head: from + 5 },
});
}
}insertLink function · typescript · L216-L233 (18 LOC)app/src/lib/editor/extensions.ts
function insertLink(view: EditorView): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
if (selectedText) {
// Wrap selection as link text
view.dispatch({
changes: { from, to, insert: `[${selectedText}](url)` },
selection: { anchor: from + selectedText.length + 3, head: from + selectedText.length + 6 },
});
} else {
// Insert empty link template
view.dispatch({
changes: { from, insert: '[text](url)' },
selection: { anchor: from + 1, head: from + 5 },
});
}
}Repobility · severity-and-effort ranking · https://repobility.com
insertLink function · typescript · L216-L233 (18 LOC)app/src/lib/editor/extensions.ts
function insertLink(view: EditorView): void {
const { from, to } = view.state.selection.main;
const selectedText = view.state.sliceDoc(from, to);
if (selectedText) {
// Wrap selection as link text
view.dispatch({
changes: { from, to, insert: `[${selectedText}](url)` },
selection: { anchor: from + selectedText.length + 3, head: from + selectedText.length + 6 },
});
} else {
// Insert empty link template
view.dispatch({
changes: { from, insert: '[text](url)' },
selection: { anchor: from + 1, head: from + 5 },
});
}
}createExtensionsWithKeymap function · typescript · L236-L238 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensionsWithKeymap(
onChange: (content: string) => void,
config: EditorConfig = {}createExtensionsWithKeymap function · typescript · L236-L238 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensionsWithKeymap(
onChange: (content: string) => void,
config: EditorConfig = {}createExtensionsWithKeymap function · typescript · L236-L238 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensionsWithKeymap(
onChange: (content: string) => void,
config: EditorConfig = {}createExtensionsWithKeymap function · typescript · L236-L238 (3 LOC)app/src/lib/editor/extensions.ts
export function createExtensionsWithKeymap(
onChange: (content: string) => void,
config: EditorConfig = {}getLineDecorations function · typescript · L62-L114 (53 LOC)app/src/lib/editor/markers.ts
function getLineDecorations(
view: EditorView,
markers: MarkerConfig[] = defaultMarkers
): DecorationSet {
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
for (let pos = from; pos <= to; ) {
const line = view.state.doc.lineAt(pos);
const lineText = line.text;
// Skip empty lines
if (lineText.trim()) {
// Check for leading whitespace (for nested content)
const leadingMatch = lineText.match(/^(\s*)/);
const indent = leadingMatch ? leadingMatch[1].length : 0;
const contentStart = lineText.substring(indent);
// Check each marker pattern
for (const marker of markers) {
const pattern =
typeof marker.prefix === 'string'
? new RegExp(`^${escapeRegex(marker.prefix)}`)
: marker.prefix;
if (pattern.test(contentStart)) {
// Apply line decoration
builder.add(
line.getLineDecorations function · typescript · L62-L114 (53 LOC)app/src/lib/editor/markers.ts
function getLineDecorations(
view: EditorView,
markers: MarkerConfig[] = defaultMarkers
): DecorationSet {
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
for (let pos = from; pos <= to; ) {
const line = view.state.doc.lineAt(pos);
const lineText = line.text;
// Skip empty lines
if (lineText.trim()) {
// Check for leading whitespace (for nested content)
const leadingMatch = lineText.match(/^(\s*)/);
const indent = leadingMatch ? leadingMatch[1].length : 0;
const contentStart = lineText.substring(indent);
// Check each marker pattern
for (const marker of markers) {
const pattern =
typeof marker.prefix === 'string'
? new RegExp(`^${escapeRegex(marker.prefix)}`)
: marker.prefix;
if (pattern.test(contentStart)) {
// Apply line decoration
builder.add(
line.getLineDecorations function · typescript · L62-L114 (53 LOC)app/src/lib/editor/markers.ts
function getLineDecorations(
view: EditorView,
markers: MarkerConfig[] = defaultMarkers
): DecorationSet {
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
for (let pos = from; pos <= to; ) {
const line = view.state.doc.lineAt(pos);
const lineText = line.text;
// Skip empty lines
if (lineText.trim()) {
// Check for leading whitespace (for nested content)
const leadingMatch = lineText.match(/^(\s*)/);
const indent = leadingMatch ? leadingMatch[1].length : 0;
const contentStart = lineText.substring(indent);
// Check each marker pattern
for (const marker of markers) {
const pattern =
typeof marker.prefix === 'string'
? new RegExp(`^${escapeRegex(marker.prefix)}`)
: marker.prefix;
if (pattern.test(contentStart)) {
// Apply line decoration
builder.add(
line.If a scraper extracted this row, it came from Repobility (https://repobility.com)
getLineDecorations function · typescript · L62-L114 (53 LOC)app/src/lib/editor/markers.ts
function getLineDecorations(
view: EditorView,
markers: MarkerConfig[] = defaultMarkers
): DecorationSet {
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
for (let pos = from; pos <= to; ) {
const line = view.state.doc.lineAt(pos);
const lineText = line.text;
// Skip empty lines
if (lineText.trim()) {
// Check for leading whitespace (for nested content)
const leadingMatch = lineText.match(/^(\s*)/);
const indent = leadingMatch ? leadingMatch[1].length : 0;
const contentStart = lineText.substring(indent);
// Check each marker pattern
for (const marker of markers) {
const pattern =
typeof marker.prefix === 'string'
? new RegExp(`^${escapeRegex(marker.prefix)}`)
: marker.prefix;
if (pattern.test(contentStart)) {
// Apply line decoration
builder.add(
line.escapeRegex function · typescript · L117-L119 (3 LOC)app/src/lib/editor/markers.ts
function escapeRegex(str: string): string {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}escapeRegex function · typescript · L117-L119 (3 LOC)app/src/lib/editor/markers.ts
function escapeRegex(str: string): string {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}escapeRegex function · typescript · L117-L119 (3 LOC)app/src/lib/editor/markers.ts
function escapeRegex(str: string): string {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}escapeRegex function · typescript · L117-L119 (3 LOC)app/src/lib/editor/markers.ts
function escapeRegex(str: string): string {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}getTagDecorations function · typescript · L43-L98 (56 LOC)app/src/lib/editor/tagDecorations.ts
function getTagDecorations(view: EditorView): DecorationSet {
const tags = view.state.field(knownTagsField);
if (tags.length === 0) return Decoration.none;
const categories = view.state.field(tagCategoriesField);
// Build a set for O(1) lookup
const tagSet = new Set(tags.map((t) => t.toLowerCase()));
// Also build a set of just the name parts (for #name matching of category:name tags)
const nameToFullTag = new Map<string, string>();
for (const t of tags) {
const lower = t.toLowerCase();
const idx = lower.indexOf(':');
if (idx > 0) {
nameToFullTag.set(lower.slice(idx + 1), lower);
}
}
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
const text = view.state.sliceDoc(from, to);
// Match #tagname and #category:name patterns
const regex = /(?:^|(?<=\s))#([a-zA-Z][\w-]*(?::[a-zA-Z][\w-]*)?)/g;
let match: RegExpExecArray | null;
while ((match = regex.exec(text)) !== null) {
getTagDecorations function · typescript · L43-L98 (56 LOC)app/src/lib/editor/tagDecorations.ts
function getTagDecorations(view: EditorView): DecorationSet {
const tags = view.state.field(knownTagsField);
if (tags.length === 0) return Decoration.none;
const categories = view.state.field(tagCategoriesField);
// Build a set for O(1) lookup
const tagSet = new Set(tags.map((t) => t.toLowerCase()));
// Also build a set of just the name parts (for #name matching of category:name tags)
const nameToFullTag = new Map<string, string>();
for (const t of tags) {
const lower = t.toLowerCase();
const idx = lower.indexOf(':');
if (idx > 0) {
nameToFullTag.set(lower.slice(idx + 1), lower);
}
}
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
const text = view.state.sliceDoc(from, to);
// Match #tagname and #category:name patterns
const regex = /(?:^|(?<=\s))#([a-zA-Z][\w-]*(?::[a-zA-Z][\w-]*)?)/g;
let match: RegExpExecArray | null;
while ((match = regex.exec(text)) !== null) {
getTagDecorations function · typescript · L43-L98 (56 LOC)app/src/lib/editor/tagDecorations.ts
function getTagDecorations(view: EditorView): DecorationSet {
const tags = view.state.field(knownTagsField);
if (tags.length === 0) return Decoration.none;
const categories = view.state.field(tagCategoriesField);
// Build a set for O(1) lookup
const tagSet = new Set(tags.map((t) => t.toLowerCase()));
// Also build a set of just the name parts (for #name matching of category:name tags)
const nameToFullTag = new Map<string, string>();
for (const t of tags) {
const lower = t.toLowerCase();
const idx = lower.indexOf(':');
if (idx > 0) {
nameToFullTag.set(lower.slice(idx + 1), lower);
}
}
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
const text = view.state.sliceDoc(from, to);
// Match #tagname and #category:name patterns
const regex = /(?:^|(?<=\s))#([a-zA-Z][\w-]*(?::[a-zA-Z][\w-]*)?)/g;
let match: RegExpExecArray | null;
while ((match = regex.exec(text)) !== null) {
Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
getTagDecorations function · typescript · L43-L98 (56 LOC)app/src/lib/editor/tagDecorations.ts
function getTagDecorations(view: EditorView): DecorationSet {
const tags = view.state.field(knownTagsField);
if (tags.length === 0) return Decoration.none;
const categories = view.state.field(tagCategoriesField);
// Build a set for O(1) lookup
const tagSet = new Set(tags.map((t) => t.toLowerCase()));
// Also build a set of just the name parts (for #name matching of category:name tags)
const nameToFullTag = new Map<string, string>();
for (const t of tags) {
const lower = t.toLowerCase();
const idx = lower.indexOf(':');
if (idx > 0) {
nameToFullTag.set(lower.slice(idx + 1), lower);
}
}
const builder = new RangeSetBuilder<Decoration>();
for (const { from, to } of view.visibleRanges) {
const text = view.state.sliceDoc(from, to);
// Match #tagname and #category:name patterns
const regex = /(?:^|(?<=\s))#([a-zA-Z][\w-]*(?::[a-zA-Z][\w-]*)?)/g;
let match: RegExpExecArray | null;
while ((match = regex.exec(text)) !== null) {
createActionsStore function · typescript · L28-L93 (66 LOC)app/src/lib/stores/actions.ts
function createActionsStore() {
const { subscribe, set, update } = writable<ActionsState>(defaultState);
return {
subscribe,
/** Load actions from .chronicle/actions.json via Rust command */
load: async () => {
const workspace = get(currentWorkspace);
if (!workspace || !isTauri()) return;
update((s) => ({ ...s, isLoading: true, error: null }));
try {
const invoke = await getInvoke();
const raw = await invoke<string>('read_actions_file', {
workspacePath: workspace.path,
});
const parsed: ActionItem[] = JSON.parse(raw);
update((s) => ({
...s,
actions: parsed,
lastLoaded: new Date(),
isLoading: false,
}));
} catch (e) {
// File may not exist yet — that is fine
const msg = e instanceof Error ? e.message : String(e);
if (msg.includes('not found') || msg.includes('No such file') || msg.includes('Failed to read')) {
createActionsStore function · typescript · L28-L93 (66 LOC)app/src/lib/stores/actions.ts
function createActionsStore() {
const { subscribe, set, update } = writable<ActionsState>(defaultState);
return {
subscribe,
/** Load actions from .chronicle/actions.json via Rust command */
load: async () => {
const workspace = get(currentWorkspace);
if (!workspace || !isTauri()) return;
update((s) => ({ ...s, isLoading: true, error: null }));
try {
const invoke = await getInvoke();
const raw = await invoke<string>('read_actions_file', {
workspacePath: workspace.path,
});
const parsed: ActionItem[] = JSON.parse(raw);
update((s) => ({
...s,
actions: parsed,
lastLoaded: new Date(),
isLoading: false,
}));
} catch (e) {
// File may not exist yet — that is fine
const msg = e instanceof Error ? e.message : String(e);
if (msg.includes('not found') || msg.includes('No such file') || msg.includes('Failed to read')) {
createActionsStore function · typescript · L28-L93 (66 LOC)app/src/lib/stores/actions.ts
function createActionsStore() {
const { subscribe, set, update } = writable<ActionsState>(defaultState);
return {
subscribe,
/** Load actions from .chronicle/actions.json via Rust command */
load: async () => {
const workspace = get(currentWorkspace);
if (!workspace || !isTauri()) return;
update((s) => ({ ...s, isLoading: true, error: null }));
try {
const invoke = await getInvoke();
const raw = await invoke<string>('read_actions_file', {
workspacePath: workspace.path,
});
const parsed: ActionItem[] = JSON.parse(raw);
update((s) => ({
...s,
actions: parsed,
lastLoaded: new Date(),
isLoading: false,
}));
} catch (e) {
// File may not exist yet — that is fine
const msg = e instanceof Error ? e.message : String(e);
if (msg.includes('not found') || msg.includes('No such file') || msg.includes('Failed to read')) {
createActionsStore function · typescript · L28-L93 (66 LOC)app/src/lib/stores/actions.ts
function createActionsStore() {
const { subscribe, set, update } = writable<ActionsState>(defaultState);
return {
subscribe,
/** Load actions from .chronicle/actions.json via Rust command */
load: async () => {
const workspace = get(currentWorkspace);
if (!workspace || !isTauri()) return;
update((s) => ({ ...s, isLoading: true, error: null }));
try {
const invoke = await getInvoke();
const raw = await invoke<string>('read_actions_file', {
workspacePath: workspace.path,
});
const parsed: ActionItem[] = JSON.parse(raw);
update((s) => ({
...s,
actions: parsed,
lastLoaded: new Date(),
isLoading: false,
}));
} catch (e) {
// File may not exist yet — that is fine
const msg = e instanceof Error ? e.message : String(e);
if (msg.includes('not found') || msg.includes('No such file') || msg.includes('Failed to read')) {
initActionsListener function · typescript · L154-L161 (8 LOC)app/src/lib/stores/actions.ts
export function initActionsListener(): () => void {
// Load initially
actionsStore.load();
// No additional file watcher needed — actions are loaded on demand
// Return a no-op cleanup function
return () => {};
}initActionsListener function · typescript · L154-L161 (8 LOC)app/src/lib/stores/actions.ts
export function initActionsListener(): () => void {
// Load initially
actionsStore.load();
// No additional file watcher needed — actions are loaded on demand
// Return a no-op cleanup function
return () => {};
}initActionsListener function · typescript · L154-L161 (8 LOC)app/src/lib/stores/actions.ts
export function initActionsListener(): () => void {
// Load initially
actionsStore.load();
// No additional file watcher needed — actions are loaded on demand
// Return a no-op cleanup function
return () => {};
}Powered by Repobility — scan your code at https://repobility.com
initActionsListener function · typescript · L154-L161 (8 LOC)app/src/lib/stores/actions.ts
export function initActionsListener(): () => void {
// Load initially
actionsStore.load();
// No additional file watcher needed — actions are loaded on demand
// Return a no-op cleanup function
return () => {};
}createAgentStatusStore function · typescript · L15-L58 (44 LOC)app/src/lib/stores/agentStatus.ts
function createAgentStatusStore() {
const { subscribe, set, update } = writable<AgentStatusState>(defaultState);
return {
subscribe,
setRunning: (running: boolean) => {
update((s) => ({
...s,
isRunning: running,
lastRun: running ? s.lastRun : new Date(),
}));
},
loadStatus: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<Record<string, string>>('get_agent_status', {
workspacePath: ws.path,
});
// Find the most recent run timestamp
let latest: Date | null = null;
for (const ts of Object.values(data)) {
if (typeof ts === 'string') {
const d = new Date(ts);
if (!isNaN(d.getTime()) && (!latest || d > latest)) {
latest = d;
}
}
}
if (latest) {
update((s) => ({ ...s, lcreateAgentStatusStore function · typescript · L15-L58 (44 LOC)app/src/lib/stores/agentStatus.ts
function createAgentStatusStore() {
const { subscribe, set, update } = writable<AgentStatusState>(defaultState);
return {
subscribe,
setRunning: (running: boolean) => {
update((s) => ({
...s,
isRunning: running,
lastRun: running ? s.lastRun : new Date(),
}));
},
loadStatus: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<Record<string, string>>('get_agent_status', {
workspacePath: ws.path,
});
// Find the most recent run timestamp
let latest: Date | null = null;
for (const ts of Object.values(data)) {
if (typeof ts === 'string') {
const d = new Date(ts);
if (!isNaN(d.getTime()) && (!latest || d > latest)) {
latest = d;
}
}
}
if (latest) {
update((s) => ({ ...s, lcreateAgentStatusStore function · typescript · L15-L58 (44 LOC)app/src/lib/stores/agentStatus.ts
function createAgentStatusStore() {
const { subscribe, set, update } = writable<AgentStatusState>(defaultState);
return {
subscribe,
setRunning: (running: boolean) => {
update((s) => ({
...s,
isRunning: running,
lastRun: running ? s.lastRun : new Date(),
}));
},
loadStatus: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<Record<string, string>>('get_agent_status', {
workspacePath: ws.path,
});
// Find the most recent run timestamp
let latest: Date | null = null;
for (const ts of Object.values(data)) {
if (typeof ts === 'string') {
const d = new Date(ts);
if (!isNaN(d.getTime()) && (!latest || d > latest)) {
latest = d;
}
}
}
if (latest) {
update((s) => ({ ...s, lcreateAgentStatusStore function · typescript · L15-L58 (44 LOC)app/src/lib/stores/agentStatus.ts
function createAgentStatusStore() {
const { subscribe, set, update } = writable<AgentStatusState>(defaultState);
return {
subscribe,
setRunning: (running: boolean) => {
update((s) => ({
...s,
isRunning: running,
lastRun: running ? s.lastRun : new Date(),
}));
},
loadStatus: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<Record<string, string>>('get_agent_status', {
workspacePath: ws.path,
});
// Find the most recent run timestamp
let latest: Date | null = null;
for (const ts of Object.values(data)) {
if (typeof ts === 'string') {
const d = new Date(ts);
if (!isNaN(d.getTime()) && (!latest || d > latest)) {
latest = d;
}
}
}
if (latest) {
update((s) => ({ ...s, linitAgentListeners function · typescript · L66-L85 (20 LOC)app/src/lib/stores/agentStatus.ts
export async function initAgentListeners(): Promise<(() => void)[]> {
if (!isTauri()) return [];
const { listen } = await import('@tauri-apps/api/event');
const unlisteners: (() => void)[] = [];
unlisteners.push(
await listen('claude:agents-started', () => {
agentStatusStore.setRunning(true);
})
);
unlisteners.push(
await listen('claude:agents-completed', () => {
agentStatusStore.setRunning(false);
})
);
return unlisteners;
}initAgentListeners function · typescript · L66-L85 (20 LOC)app/src/lib/stores/agentStatus.ts
export async function initAgentListeners(): Promise<(() => void)[]> {
if (!isTauri()) return [];
const { listen } = await import('@tauri-apps/api/event');
const unlisteners: (() => void)[] = [];
unlisteners.push(
await listen('claude:agents-started', () => {
agentStatusStore.setRunning(true);
})
);
unlisteners.push(
await listen('claude:agents-completed', () => {
agentStatusStore.setRunning(false);
})
);
return unlisteners;
}initAgentListeners function · typescript · L66-L85 (20 LOC)app/src/lib/stores/agentStatus.ts
export async function initAgentListeners(): Promise<(() => void)[]> {
if (!isTauri()) return [];
const { listen } = await import('@tauri-apps/api/event');
const unlisteners: (() => void)[] = [];
unlisteners.push(
await listen('claude:agents-started', () => {
agentStatusStore.setRunning(true);
})
);
unlisteners.push(
await listen('claude:agents-completed', () => {
agentStatusStore.setRunning(false);
})
);
return unlisteners;
}Repobility · severity-and-effort ranking · https://repobility.com
initAgentListeners function · typescript · L66-L85 (20 LOC)app/src/lib/stores/agentStatus.ts
export async function initAgentListeners(): Promise<(() => void)[]> {
if (!isTauri()) return [];
const { listen } = await import('@tauri-apps/api/event');
const unlisteners: (() => void)[] = [];
unlisteners.push(
await listen('claude:agents-started', () => {
agentStatusStore.setRunning(true);
})
);
unlisteners.push(
await listen('claude:agents-completed', () => {
agentStatusStore.setRunning(false);
})
);
return unlisteners;
}autoExpandAIPanel function · typescript · L81-L85 (5 LOC)app/src/lib/stores/aiOutput.ts
function autoExpandAIPanel() {
if (!manualOverride) {
uiStore.setCollapsed('aiOutput', false);
}
}autoExpandAIPanel function · typescript · L81-L85 (5 LOC)app/src/lib/stores/aiOutput.ts
function autoExpandAIPanel() {
if (!manualOverride) {
uiStore.setCollapsed('aiOutput', false);
}
}page 1 / 18next ›