@fureworks/scope 0.1.0 → 0.3.0
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/README.md +129 -48
- package/dist/cli/clean.d.ts +7 -0
- package/dist/cli/clean.d.ts.map +1 -0
- package/dist/cli/clean.js +49 -0
- package/dist/cli/clean.js.map +1 -0
- package/dist/cli/config.d.ts +8 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +368 -42
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/diff.d.ts +6 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +63 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +15 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/notifications.d.ts +7 -0
- package/dist/cli/notifications.d.ts.map +1 -0
- package/dist/cli/notifications.js +77 -0
- package/dist/cli/notifications.js.map +1 -0
- package/dist/cli/onboard.d.ts.map +1 -1
- package/dist/cli/onboard.js +2 -1
- package/dist/cli/onboard.js.map +1 -1
- package/dist/cli/plan.d.ts +7 -0
- package/dist/cli/plan.d.ts.map +1 -0
- package/dist/cli/plan.js +111 -0
- package/dist/cli/plan.js.map +1 -0
- package/dist/cli/review.d.ts +6 -0
- package/dist/cli/review.d.ts.map +1 -0
- package/dist/cli/review.js +167 -0
- package/dist/cli/review.js.map +1 -0
- package/dist/cli/snooze.d.ts +12 -0
- package/dist/cli/snooze.d.ts.map +1 -0
- package/dist/cli/snooze.js +155 -0
- package/dist/cli/snooze.js.map +1 -0
- package/dist/cli/today.d.ts.map +1 -1
- package/dist/cli/today.js +85 -11
- package/dist/cli/today.js.map +1 -1
- package/dist/cli/tune.d.ts +8 -0
- package/dist/cli/tune.d.ts.map +1 -0
- package/dist/cli/tune.js +62 -0
- package/dist/cli/tune.js.map +1 -0
- package/dist/engine/__tests__/prioritize.test.d.ts +2 -0
- package/dist/engine/__tests__/prioritize.test.d.ts.map +1 -0
- package/dist/engine/__tests__/prioritize.test.js +199 -0
- package/dist/engine/__tests__/prioritize.test.js.map +1 -0
- package/dist/engine/prioritize.d.ts +10 -2
- package/dist/engine/prioritize.d.ts.map +1 -1
- package/dist/engine/prioritize.js +249 -50
- package/dist/engine/prioritize.js.map +1 -1
- package/dist/index.js +61 -5
- package/dist/index.js.map +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +6 -10
- package/dist/notifications/index.js.map +1 -1
- package/dist/sources/__tests__/git.test.d.ts +2 -0
- package/dist/sources/__tests__/git.test.d.ts.map +1 -0
- package/dist/sources/__tests__/git.test.js +52 -0
- package/dist/sources/__tests__/git.test.js.map +1 -0
- package/dist/sources/activity.d.ts +32 -0
- package/dist/sources/activity.d.ts.map +1 -0
- package/dist/sources/activity.js +101 -0
- package/dist/sources/activity.js.map +1 -0
- package/dist/sources/calendar.d.ts +6 -0
- package/dist/sources/calendar.d.ts.map +1 -1
- package/dist/sources/calendar.js +114 -0
- package/dist/sources/calendar.js.map +1 -1
- package/dist/sources/git.d.ts +3 -0
- package/dist/sources/git.d.ts.map +1 -1
- package/dist/sources/git.js +62 -6
- package/dist/sources/git.js.map +1 -1
- package/dist/sources/issues.d.ts +2 -0
- package/dist/sources/issues.d.ts.map +1 -1
- package/dist/sources/issues.js +33 -0
- package/dist/sources/issues.js.map +1 -1
- package/dist/store/config.d.ts +8 -0
- package/dist/store/config.d.ts.map +1 -1
- package/dist/store/config.js +22 -0
- package/dist/store/config.js.map +1 -1
- package/dist/store/muted.d.ts +17 -0
- package/dist/store/muted.d.ts.map +1 -0
- package/dist/store/muted.js +55 -0
- package/dist/store/muted.js.map +1 -0
- package/dist/store/snapshot.d.ts +12 -0
- package/dist/store/snapshot.d.ts.map +1 -0
- package/dist/store/snapshot.js +41 -0
- package/dist/store/snapshot.js.map +1 -0
- package/package.json +11 -3
- package/src/cli/config.ts +0 -66
- package/src/cli/context.ts +0 -109
- package/src/cli/daemon.ts +0 -217
- package/src/cli/onboard.ts +0 -335
- package/src/cli/status.ts +0 -77
- package/src/cli/switch.ts +0 -93
- package/src/cli/today.ts +0 -114
- package/src/engine/prioritize.ts +0 -257
- package/src/index.ts +0 -58
- package/src/notifications/index.ts +0 -42
- package/src/sources/calendar.ts +0 -170
- package/src/sources/git.ts +0 -168
- package/src/sources/issues.ts +0 -62
- package/src/store/config.ts +0 -104
- package/tsconfig.json +0 -19
package/src/sources/issues.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export interface IssueSignal {
|
|
2
|
-
number: number;
|
|
3
|
-
title: string;
|
|
4
|
-
url: string;
|
|
5
|
-
repo: string;
|
|
6
|
-
ageDays: number;
|
|
7
|
-
labels: string[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface IssueScanResult {
|
|
11
|
-
available: boolean;
|
|
12
|
-
issues: IssueSignal[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export async function scanAssignedIssues(): Promise<IssueScanResult> {
|
|
16
|
-
try {
|
|
17
|
-
const { execSync } = await import("node:child_process");
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
execSync("which gh", { stdio: "pipe" });
|
|
21
|
-
} catch {
|
|
22
|
-
return { available: false, issues: [] };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const result = execSync(
|
|
26
|
-
"gh issue list --assignee @me --state open --json number,title,url,createdAt,labels,repository --limit 20",
|
|
27
|
-
{
|
|
28
|
-
encoding: "utf-8",
|
|
29
|
-
timeout: 10000,
|
|
30
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const parsed = JSON.parse(result) as Array<{
|
|
35
|
-
number: number;
|
|
36
|
-
title: string;
|
|
37
|
-
url: string;
|
|
38
|
-
createdAt: string;
|
|
39
|
-
labels?: Array<{ name?: string }>;
|
|
40
|
-
repository?: { nameWithOwner?: string; name?: string };
|
|
41
|
-
}>;
|
|
42
|
-
|
|
43
|
-
const issues: IssueSignal[] = parsed.map((issue) => {
|
|
44
|
-
const ageDays =
|
|
45
|
-
(Date.now() - new Date(issue.createdAt).getTime()) /
|
|
46
|
-
(1000 * 60 * 60 * 24);
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
number: issue.number,
|
|
50
|
-
title: issue.title,
|
|
51
|
-
url: issue.url,
|
|
52
|
-
repo: issue.repository?.nameWithOwner || issue.repository?.name || "unknown",
|
|
53
|
-
ageDays: Math.round(ageDays * 10) / 10,
|
|
54
|
-
labels: (issue.labels ?? []).map((label) => label.name || "").filter(Boolean),
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return { available: true, issues };
|
|
59
|
-
} catch {
|
|
60
|
-
return { available: true, issues: [] };
|
|
61
|
-
}
|
|
62
|
-
}
|
package/src/store/config.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { parse as parseToml } from "toml";
|
|
5
|
-
|
|
6
|
-
export interface ScopeConfig {
|
|
7
|
-
repos: string[];
|
|
8
|
-
projects: Record<
|
|
9
|
-
string,
|
|
10
|
-
{
|
|
11
|
-
path: string;
|
|
12
|
-
repos?: string[];
|
|
13
|
-
description?: string;
|
|
14
|
-
}
|
|
15
|
-
>;
|
|
16
|
-
calendar: {
|
|
17
|
-
enabled: boolean;
|
|
18
|
-
backend: "gws";
|
|
19
|
-
};
|
|
20
|
-
daemon: {
|
|
21
|
-
enabled: boolean;
|
|
22
|
-
intervalMinutes: number;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const SCOPE_DIR = join(homedir(), ".scope");
|
|
27
|
-
const CONFIG_PATH = join(SCOPE_DIR, "config.toml");
|
|
28
|
-
|
|
29
|
-
export function getScopeDir(): string {
|
|
30
|
-
return SCOPE_DIR;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function ensureScopeDir(): void {
|
|
34
|
-
if (!existsSync(SCOPE_DIR)) {
|
|
35
|
-
mkdirSync(SCOPE_DIR, { recursive: true });
|
|
36
|
-
}
|
|
37
|
-
const contextsDir = join(SCOPE_DIR, "contexts");
|
|
38
|
-
if (!existsSync(contextsDir)) {
|
|
39
|
-
mkdirSync(contextsDir, { recursive: true });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function configExists(): boolean {
|
|
44
|
-
return existsSync(CONFIG_PATH);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function loadConfig(): ScopeConfig {
|
|
48
|
-
if (!configExists()) {
|
|
49
|
-
return {
|
|
50
|
-
repos: [],
|
|
51
|
-
projects: {},
|
|
52
|
-
calendar: { enabled: false, backend: "gws" },
|
|
53
|
-
daemon: { enabled: false, intervalMinutes: 15 },
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const raw = readFileSync(CONFIG_PATH, "utf-8");
|
|
58
|
-
const parsed = parseToml(raw) as Partial<ScopeConfig>;
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
repos: parsed.repos ?? [],
|
|
62
|
-
projects: parsed.projects ?? {},
|
|
63
|
-
calendar: {
|
|
64
|
-
enabled: parsed.calendar?.enabled ?? false,
|
|
65
|
-
backend: parsed.calendar?.backend ?? "gws",
|
|
66
|
-
},
|
|
67
|
-
daemon: {
|
|
68
|
-
enabled: parsed.daemon?.enabled ?? false,
|
|
69
|
-
intervalMinutes: parsed.daemon?.intervalMinutes ?? 15,
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function saveConfig(config: ScopeConfig): void {
|
|
75
|
-
ensureScopeDir();
|
|
76
|
-
|
|
77
|
-
const lines: string[] = [];
|
|
78
|
-
lines.push("# Scope configuration");
|
|
79
|
-
lines.push("");
|
|
80
|
-
lines.push(`repos = [${config.repos.map((r) => `"${r}"`).join(", ")}]`);
|
|
81
|
-
lines.push("");
|
|
82
|
-
lines.push("[calendar]");
|
|
83
|
-
lines.push(`enabled = ${config.calendar.enabled}`);
|
|
84
|
-
lines.push(`backend = "${config.calendar.backend}"`);
|
|
85
|
-
lines.push("");
|
|
86
|
-
lines.push("[daemon]");
|
|
87
|
-
lines.push(`enabled = ${config.daemon.enabled}`);
|
|
88
|
-
lines.push(`intervalMinutes = ${config.daemon.intervalMinutes}`);
|
|
89
|
-
lines.push("");
|
|
90
|
-
|
|
91
|
-
for (const [name, project] of Object.entries(config.projects)) {
|
|
92
|
-
lines.push(`[projects.${name}]`);
|
|
93
|
-
lines.push(`path = "${project.path}"`);
|
|
94
|
-
if (project.repos && project.repos.length > 0) {
|
|
95
|
-
lines.push(`repos = [${project.repos.map((r) => `"${r}"`).join(", ")}]`);
|
|
96
|
-
}
|
|
97
|
-
if (project.description) {
|
|
98
|
-
lines.push(`description = "${project.description}"`);
|
|
99
|
-
}
|
|
100
|
-
lines.push("");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
writeFileSync(CONFIG_PATH, lines.join("\n"), "utf-8");
|
|
104
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "Node16",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"sourceMap": true
|
|
16
|
-
},
|
|
17
|
-
"include": ["src/**/*"],
|
|
18
|
-
"exclude": ["node_modules", "dist"]
|
|
19
|
-
}
|