daily-focus 1.2.0-dev.9 → 2.0.0-dev.15
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 +18 -4
- package/SETUP.md +156 -105
- package/dist/{audit-DNTFZOHH.js → audit-AQUBVWPA.js} +4 -3
- package/dist/{chunk-KZNY45XW.js → chunk-72NUDSOV.js} +126 -119
- package/dist/{chunk-GQ3NCWRT.js → chunk-ITUK7XKS.js} +6 -19
- package/dist/{chunk-KL6RU4XT.js → chunk-JTMBBUMD.js} +316 -10
- package/dist/chunk-QG4XXKBP.js +18 -0
- package/dist/chunk-U6EPOXEW.js +570 -0
- package/dist/{chunk-P3E2B2SD.js → chunk-WPXIQPYX.js} +1 -1
- package/dist/{chunk-6SMUSPZG.js → chunk-YPGKXTBX.js} +2 -2
- package/dist/cli.js +19 -12
- package/dist/{demo-TIIXODJG.js → demo-KE6WDWMA.js} +159 -37
- package/dist/{init-XDMAXU2S.js → init-5KJVHWJU.js} +41 -6
- package/dist/{seed-TWT7EDXJ.js → seed-T4VEY6DT.js} +4 -3
- package/dist/{server-WT4CQ3VX.js → server-FFRNYEAO.js} +2000 -743
- package/dist/{service-ZUHI3VKH.js → service-LQ46YRCZ.js} +7 -6
- package/package.json +6 -2
- package/prompts/README.md +20 -4
- package/prompts/assistant.md +7 -1
- package/prompts/morning-brief-personal.md +37 -0
- package/prompts/morning-brief-work.md +37 -0
- package/prompts/onboarding.md +41 -0
- package/public/app.js +806 -287
- package/public/fonts/IBMPlexSans-Variable.woff2 +0 -0
- package/public/fonts/IBMPlexSerif-Italic.woff2 +0 -0
- package/public/fonts/IBMPlexSerif-Medium.woff2 +0 -0
- package/public/fonts/IBMPlexSerif-Regular.woff2 +0 -0
- package/public/fonts/IBMPlexSerif-SemiBold.woff2 +0 -0
- package/public/fonts/OFL.txt +93 -0
- package/public/style.css +1686 -481
- package/dist/chunk-V2UN3JYL.js +0 -140
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
QUICK_ACTIONS
|
|
3
|
-
|
|
2
|
+
QUICK_ACTIONS,
|
|
3
|
+
actionOf,
|
|
4
|
+
autoKeys,
|
|
5
|
+
judge
|
|
6
|
+
} from "./chunk-JTMBBUMD.js";
|
|
4
7
|
import {
|
|
5
8
|
dateFromNow,
|
|
6
9
|
sampleBrief,
|
|
7
10
|
sampleGeneratedAt
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WPXIQPYX.js";
|
|
12
|
+
import "./chunk-ITUK7XKS.js";
|
|
13
|
+
import "./chunk-QG4XXKBP.js";
|
|
9
14
|
import {
|
|
10
15
|
PROFILES,
|
|
16
|
+
SETTINGS_FILE,
|
|
11
17
|
localDateKey
|
|
12
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-72NUDSOV.js";
|
|
13
19
|
import "./chunk-BC2W7NND.js";
|
|
14
20
|
|
|
15
21
|
// src/demo.ts
|
|
@@ -48,36 +54,23 @@ function demoProfile(raw) {
|
|
|
48
54
|
}
|
|
49
55
|
return chosen;
|
|
50
56
|
}
|
|
51
|
-
function demoEnv(base, store
|
|
52
|
-
|
|
57
|
+
function demoEnv(base, store) {
|
|
58
|
+
return { ...base, DAILY_FOCUS_DATA: store, DAILY_FOCUS_PORT: base.DAILY_FOCUS_PORT ?? "0" };
|
|
59
|
+
}
|
|
60
|
+
var DEMO_FIXED = {
|
|
61
|
+
DAILY_FOCUS_AGENT: "off",
|
|
62
|
+
DAILY_FOCUS_ASSISTANT: "off",
|
|
63
|
+
DAILY_FOCUS_CALENDAR: "off"
|
|
64
|
+
};
|
|
65
|
+
function demoSettings(profile) {
|
|
66
|
+
if (profile === "personal") return { DAILY_FOCUS_PROFILE: "personal" };
|
|
53
67
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
DAILY_FOCUS_AGENT: "off",
|
|
61
|
-
DAILY_FOCUS_AGENT_AT: "",
|
|
62
|
-
DAILY_FOCUS_AGENT_DAYS: "",
|
|
63
|
-
DAILY_FOCUS_ASSISTANT: "off",
|
|
64
|
-
DAILY_FOCUS_CALENDAR: "off",
|
|
65
|
-
DAILY_FOCUS_GITHUB: "on",
|
|
66
|
-
DAILY_FOCUS_GITHUB_ACCOUNTS: "",
|
|
67
|
-
DAILY_FOCUS_GITHUB_SCOPE: work ? "acme" : "",
|
|
68
|
-
DAILY_FOCUS_GITHUB_MERGE_GATE_CHECKS: work ? "merge-policy" : "",
|
|
69
|
-
DAILY_FOCUS_GITHUB_POLL_MINUTES: "",
|
|
70
|
-
DAILY_FOCUS_JIRA: work ? "on" : "off",
|
|
71
|
-
DAILY_FOCUS_JIRA_PROJECTS: work ? "PROJ, PLAT" : "",
|
|
72
|
-
DAILY_FOCUS_JIRA_HOLD_STATUSES: work ? "Blocked" : "",
|
|
73
|
-
DAILY_FOCUS_JIRA_IN_PROGRESS_STATUSES: work ? "In Progress, In Review" : "",
|
|
74
|
-
DAILY_FOCUS_JIRA_SITE: "",
|
|
75
|
-
DAILY_FOCUS_JIRA_POLL_MINUTES: "",
|
|
76
|
-
DAILY_FOCUS_FREE_WINDOWS: "",
|
|
77
|
-
DAILY_FOCUS_WORK_START: "",
|
|
78
|
-
DAILY_FOCUS_WORK_END: "",
|
|
79
|
-
DAILY_FOCUS_MIN_FREE_WINDOW: "",
|
|
80
|
-
DAILY_FOCUS_STALE_AFTER_HOURS: ""
|
|
68
|
+
DAILY_FOCUS_PROFILE: "work",
|
|
69
|
+
DAILY_FOCUS_GITHUB_SCOPE: "acme",
|
|
70
|
+
DAILY_FOCUS_GITHUB_MERGE_GATE_CHECKS: "merge-policy",
|
|
71
|
+
DAILY_FOCUS_JIRA_PROJECTS: "PROJ, PLAT",
|
|
72
|
+
DAILY_FOCUS_JIRA_HOLD_STATUSES: "Blocked",
|
|
73
|
+
DAILY_FOCUS_JIRA_IN_PROGRESS_STATUSES: "In Progress, In Review"
|
|
81
74
|
};
|
|
82
75
|
}
|
|
83
76
|
function pull(seed) {
|
|
@@ -118,6 +111,7 @@ function demoPulls(profile, now = /* @__PURE__ */ new Date()) {
|
|
|
118
111
|
reviewDecision: "REVIEW_REQUIRED",
|
|
119
112
|
checks: "failure",
|
|
120
113
|
failingChecks: ["unit-tests (node-20)"],
|
|
114
|
+
headSha: "9c41e07d2b5f3a8e6d1c0b4a7f2e9d8c5b3a1f60",
|
|
121
115
|
mergeStateStatus: "UNSTABLE",
|
|
122
116
|
lastActivityByYou: hoursAgo(now, 3),
|
|
123
117
|
requestedReviewers: ["eli"]
|
|
@@ -258,6 +252,7 @@ function personalPulls(now) {
|
|
|
258
252
|
createdAt: daysAgo(now, 2),
|
|
259
253
|
checks: "failure",
|
|
260
254
|
failingChecks: ["build (macos)"],
|
|
255
|
+
headSha: "3e8a1c5f9b2d7e4a6c0f1b8d3e5a7c9f2b4d6e81",
|
|
261
256
|
mergeStateStatus: "UNSTABLE",
|
|
262
257
|
lastActivityByYou: hoursAgo(now, 15)
|
|
263
258
|
}),
|
|
@@ -367,7 +362,7 @@ function demoTickets(now = /* @__PURE__ */ new Date()) {
|
|
|
367
362
|
statuses: Object.fromEntries(Object.entries(TICKET_STATUSES).map(([project, names]) => [project, [...names]]))
|
|
368
363
|
};
|
|
369
364
|
}
|
|
370
|
-
function demoIntegrations(profile) {
|
|
365
|
+
function demoIntegrations(profile, now = /* @__PURE__ */ new Date()) {
|
|
371
366
|
const world = demoTickets();
|
|
372
367
|
return {
|
|
373
368
|
github: {
|
|
@@ -378,7 +373,7 @@ function demoIntegrations(profile) {
|
|
|
378
373
|
return "demo";
|
|
379
374
|
},
|
|
380
375
|
async fetch() {
|
|
381
|
-
return { login: LOGIN, pulls: demoPulls(profile,
|
|
376
|
+
return { login: LOGIN, pulls: demoPulls(profile, now), warnings: [], orgs: {}, rateLimitRemaining: null };
|
|
382
377
|
}
|
|
383
378
|
},
|
|
384
379
|
jira: {
|
|
@@ -613,7 +608,7 @@ function runLines(seed) {
|
|
|
613
608
|
return lines2;
|
|
614
609
|
}
|
|
615
610
|
const report = seed.messages.at(-1) ?? "";
|
|
616
|
-
lines2.push({ event: "finished", run: seed.id, sessionId: `sample-${seed.id}`, report, messages: seed.messages, at: endedAt });
|
|
611
|
+
lines2.push({ event: "finished", run: seed.id, sessionId: `sample-${seed.id}`, report, messages: seed.messages, steps: seed.steps ?? [], at: endedAt });
|
|
617
612
|
if (seed.question) {
|
|
618
613
|
const turn = `${seed.id}-q1`;
|
|
619
614
|
const replied = new Date(new Date(seed.question.at).getTime() + 48e3).toISOString();
|
|
@@ -735,8 +730,75 @@ function demoAgentLog(profile, now) {
|
|
|
735
730
|
}
|
|
736
731
|
}
|
|
737
732
|
];
|
|
733
|
+
const newest = runs.find((run) => run.id === "run-0");
|
|
734
|
+
newest.steps = demoRunSteps(profile, newest.messages);
|
|
738
735
|
return runs.flatMap(runLines);
|
|
739
736
|
}
|
|
737
|
+
function demoRunSteps(profile, messages) {
|
|
738
|
+
const said2 = (text, by = null) => ({ kind: "message", text, detail: null, state: "done", by });
|
|
739
|
+
const call2 = (text, detail, by = null) => ({ kind: "tool", text, detail, state: "done", by });
|
|
740
|
+
const handoff = (name) => ({ ...call2("Hand part of it to a subagent", name), subagent: name });
|
|
741
|
+
const wait = call2("Wait for its subagents", null);
|
|
742
|
+
const start = [
|
|
743
|
+
said2(messages[0]),
|
|
744
|
+
call2("Run a command", "cat prompt.md focus.md sources.md items.json"),
|
|
745
|
+
call2("Run a command", "tail -n 400 actions.jsonl")
|
|
746
|
+
];
|
|
747
|
+
const finish = [call2("Run a command", "mv items.json.tmp items.json"), said2(messages.at(-1))];
|
|
748
|
+
if (profile === "work") {
|
|
749
|
+
return [
|
|
750
|
+
...start,
|
|
751
|
+
handoff("calendar"),
|
|
752
|
+
handoff("gmail"),
|
|
753
|
+
handoff("github"),
|
|
754
|
+
call2("Google calendar list events", '{"calendar_id":"primary","time_min":"today 00:00"}', "calendar"),
|
|
755
|
+
said2("5 events. The 1:1 with Alice and the design review both sit at 11:00; the lunch & learn is marked free.", "calendar"),
|
|
756
|
+
call2("Gmail search emails", '{"query":"newer_than:3d -category:promotions"}', "gmail"),
|
|
757
|
+
call2("Gmail batch read email", '{"message_ids":["19a2f\u2026","19a31\u2026","19a33\u2026","19a35\u2026"]}', "gmail"),
|
|
758
|
+
said2("31 threads in the window. 4 ask something of you; Bob followed up on Q4 headcount yesterday.", "gmail"),
|
|
759
|
+
call2("Run a command", "gh search prs --review-requested=@me --state=open --json url,title,updatedAt", "github"),
|
|
760
|
+
call2("Run a command", "gh pr checks 3402 -R acme/webapp", "github"),
|
|
761
|
+
said2("A review request from Alice on acme/webapp#3421, and a red check on #3402. The rest is already on the board.", "github"),
|
|
762
|
+
wait,
|
|
763
|
+
said2(messages[1]),
|
|
764
|
+
said2(messages[2]),
|
|
765
|
+
handoff("jira"),
|
|
766
|
+
handoff("slack"),
|
|
767
|
+
handoff("workday"),
|
|
768
|
+
call2("Run a command", 'acli jira workitem search --jql "assignee = currentUser() AND statusCategory != Done"', "jira"),
|
|
769
|
+
said2("PROJ-8842 is still open, with both of its pull requests merged.", "jira"),
|
|
770
|
+
call2("Slack search messages", '{"query":"to:me after:yesterday"}', "slack"),
|
|
771
|
+
said2("One direct question, from Chris in #webapp-dev.", "slack"),
|
|
772
|
+
call2("Workday list inbox tasks", null, "workday"),
|
|
773
|
+
said2("The compliance training is due tonight. The Berlin expense report is still a draft.", "workday"),
|
|
774
|
+
{ ...wait },
|
|
775
|
+
said2(messages[3]),
|
|
776
|
+
...finish
|
|
777
|
+
];
|
|
778
|
+
}
|
|
779
|
+
return [
|
|
780
|
+
...start,
|
|
781
|
+
handoff("calendar"),
|
|
782
|
+
handoff("eboks"),
|
|
783
|
+
handoff("email"),
|
|
784
|
+
call2("Google calendar list events", '{"calendar_id":"personal","time_min":"today 00:00"}', "calendar"),
|
|
785
|
+
call2("Google calendar list events", '{"calendar_id":"family","time_min":"today 00:00"}', "calendar"),
|
|
786
|
+
said2("6 events across Personal and Family. The insurance call at 16:30 overlaps the daycare pickup.", "calendar"),
|
|
787
|
+
call2("Run a command", "eboks list --since 3d --json", "eboks"),
|
|
788
|
+
call2("Run a command", "eboks text --json 4417911204", "eboks"),
|
|
789
|
+
said2("5 letters. The daycare invoice and the tax assessment ask for something; three are confirmations.", "eboks"),
|
|
790
|
+
call2("Gmail search emails", '{"query":"newer_than:3d -category:promotions"}', "email"),
|
|
791
|
+
said2("3 threads need you, the insulation quote among them, quiet for nine days.", "email"),
|
|
792
|
+
wait,
|
|
793
|
+
said2(messages[1]),
|
|
794
|
+
handoff("messages"),
|
|
795
|
+
call2("Run a command", "messages recent --since 3d --json", "messages"),
|
|
796
|
+
said2("Jonas asked about Saturday on Tuesday, and Priya is still waiting for the photos.", "messages"),
|
|
797
|
+
{ ...wait },
|
|
798
|
+
said2(messages[2]),
|
|
799
|
+
...finish
|
|
800
|
+
];
|
|
801
|
+
}
|
|
740
802
|
var call = (text, detail, state = "done") => ({ kind: "tool", text, detail, state });
|
|
741
803
|
var said = (text) => ({ kind: "message", text, detail: null, state: "done" });
|
|
742
804
|
function turnLines(seed) {
|
|
@@ -746,10 +808,27 @@ function turnLines(seed) {
|
|
|
746
808
|
${seed.text}` : quick.request : seed.text ?? "";
|
|
747
809
|
const endedAt = new Date(new Date(seed.at).getTime() + seed.seconds * 1e3).toISOString();
|
|
748
810
|
return [
|
|
749
|
-
{
|
|
811
|
+
{
|
|
812
|
+
event: "started",
|
|
813
|
+
turn: seed.id,
|
|
814
|
+
item: seed.item,
|
|
815
|
+
agent: "claude",
|
|
816
|
+
request,
|
|
817
|
+
action: quick?.id ?? null,
|
|
818
|
+
...seed.auto ? { auto: seed.auto } : {},
|
|
819
|
+
at: seed.at
|
|
820
|
+
},
|
|
750
821
|
{ event: "finished", turn: seed.id, sessionId: `sample-${seed.item}`, reply: seed.reply, steps: seed.steps, at: endedAt }
|
|
751
822
|
];
|
|
752
823
|
}
|
|
824
|
+
function aheadKey(profile, now, id, action) {
|
|
825
|
+
const pr = demoPulls(profile, now).find((candidate) => candidate.id === id);
|
|
826
|
+
if (!pr) throw new Error(`the demo has no pull request ${id}`);
|
|
827
|
+
const row = { ...pr, ...judge(pr, now, null), status: "open", notes: [] };
|
|
828
|
+
const key = autoKeys(row).find((candidate) => actionOf(candidate) === action);
|
|
829
|
+
if (!key) throw new Error(`the demo's ${id} calls for no ${action} ahead`);
|
|
830
|
+
return key;
|
|
831
|
+
}
|
|
753
832
|
function demoAssistantLog(profile, now) {
|
|
754
833
|
const fence = "```";
|
|
755
834
|
const turns = profile === "work" ? [
|
|
@@ -813,10 +892,30 @@ function demoAssistantLog(profile, now) {
|
|
|
813
892
|
"Created: [Gmail draft](https://mail.google.com/mail/u/0/#drafts?compose=18f2a9c4b7)"
|
|
814
893
|
].join("\n")
|
|
815
894
|
},
|
|
895
|
+
{
|
|
896
|
+
id: "turn-d1",
|
|
897
|
+
item: "github:pr:acme/webapp#3398",
|
|
898
|
+
action: "assess-review",
|
|
899
|
+
auto: aheadKey(profile, now, "github:pr:acme/webapp#3398", "assess-review"),
|
|
900
|
+
at: minutesAgo(now, 172),
|
|
901
|
+
seconds: 47,
|
|
902
|
+
steps: [
|
|
903
|
+
call("Read the review comments", "gh pr view 3398 --repo acme/webapp --comments"),
|
|
904
|
+
call("Read the diff", "gh pr diff 3398 --repo acme/webapp")
|
|
905
|
+
],
|
|
906
|
+
reply: [
|
|
907
|
+
"Dana is right: the backoff never resets after a send succeeds.",
|
|
908
|
+
"",
|
|
909
|
+
"She commented on `beacon.ts:41` that `attempt` is only zeroed on page load. The diff bears her out: after one failed send, every later failure waits longer, for the life of the tab. Reset `attempt` in the success branch of `sendBeacon` and add a test where a success between two failures starts the delay over.",
|
|
910
|
+
"",
|
|
911
|
+
"Her second point, capping the delay at 30 seconds rather than 60, is a preference. Sixty is defensible for a beacon nobody waits on; say so and leave it."
|
|
912
|
+
].join("\n")
|
|
913
|
+
},
|
|
816
914
|
{
|
|
817
915
|
id: "turn-c1",
|
|
818
916
|
item: "github:pr:acme/webapp#3402",
|
|
819
917
|
action: "explain-ci",
|
|
918
|
+
auto: aheadKey(profile, now, "github:pr:acme/webapp#3402", "explain-ci"),
|
|
820
919
|
at: minutesAgo(now, 20),
|
|
821
920
|
seconds: 58,
|
|
822
921
|
steps: [
|
|
@@ -826,6 +925,8 @@ function demoAssistantLog(profile, now) {
|
|
|
826
925
|
call("Read the retry code", "gh api repos/acme/webapp/contents/src/tracing/fetch.ts")
|
|
827
926
|
],
|
|
828
927
|
reply: [
|
|
928
|
+
"Yours, not flaky: the retry path drops the trace headers.",
|
|
929
|
+
"",
|
|
829
930
|
"The failing check is `unit-tests (node-20)`, in `tracing/fetch.spec.ts`:",
|
|
830
931
|
"",
|
|
831
932
|
fence,
|
|
@@ -860,6 +961,23 @@ function demoAssistantLog(profile, now) {
|
|
|
860
961
|
"A kind review that asks for the first two and lets the third go is probably right for a first contribution."
|
|
861
962
|
].join("\n")
|
|
862
963
|
},
|
|
964
|
+
{
|
|
965
|
+
id: "turn-p3",
|
|
966
|
+
item: "github:pr:mara-l/pedalboard#51",
|
|
967
|
+
action: "explain-ci",
|
|
968
|
+
auto: aheadKey(profile, now, "github:pr:mara-l/pedalboard#51", "explain-ci"),
|
|
969
|
+
at: minutesAgo(now, 64),
|
|
970
|
+
seconds: 39,
|
|
971
|
+
steps: [
|
|
972
|
+
call("List the checks", "gh pr checks 51 --repo mara-l/pedalboard"),
|
|
973
|
+
call("Read the failing job\u2019s log", "gh run view 4471920 --repo mara-l/pedalboard --log-failed")
|
|
974
|
+
],
|
|
975
|
+
reply: [
|
|
976
|
+
"Not your change: the macOS runner could not download the JUCE cache.",
|
|
977
|
+
"",
|
|
978
|
+
"The `build (macos)` job stops in its setup step with a 503 from the cache server, before any of your code is compiled. The Linux and Windows builds of the same commit pass. Rerun the job; if it fails the same way, the cache key in `.github/workflows/build.yml` can fall back to a fresh download."
|
|
979
|
+
].join("\n")
|
|
980
|
+
},
|
|
863
981
|
{
|
|
864
982
|
id: "turn-p2",
|
|
865
983
|
item: "email:thread:19a0c4e2f1",
|
|
@@ -883,6 +1001,8 @@ async function writeDemoStore(store, profile, now = /* @__PURE__ */ new Date())
|
|
|
883
1001
|
await writeFile(join(store, "archive", `items-${past.date}.json`), `${JSON.stringify(past, null, 2)}
|
|
884
1002
|
`, "utf8");
|
|
885
1003
|
}
|
|
1004
|
+
await writeFile(join(store, SETTINGS_FILE), `${JSON.stringify(demoSettings(profile), null, 2)}
|
|
1005
|
+
`, "utf8");
|
|
886
1006
|
await writeFile(join(store, "focus.md"), FOCUS[profile], "utf8");
|
|
887
1007
|
await writeFile(join(store, "sources.md"), SOURCES[profile], "utf8");
|
|
888
1008
|
await writeFile(join(store, "actions.jsonl"), lines(demoActions(profile, now)), "utf8");
|
|
@@ -890,10 +1010,12 @@ async function writeDemoStore(store, profile, now = /* @__PURE__ */ new Date())
|
|
|
890
1010
|
await writeFile(join(store, "assistant.jsonl"), lines(demoAssistantLog(profile, now)), "utf8");
|
|
891
1011
|
}
|
|
892
1012
|
export {
|
|
1013
|
+
DEMO_FIXED,
|
|
893
1014
|
demoEnv,
|
|
894
1015
|
demoIntegrations,
|
|
895
1016
|
demoProfile,
|
|
896
1017
|
demoPulls,
|
|
1018
|
+
demoSettings,
|
|
897
1019
|
demoTickets,
|
|
898
1020
|
workingDayBack,
|
|
899
1021
|
writeDemoStore
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FOCUS_TEMPLATE,
|
|
3
|
+
applySettingsChange,
|
|
4
|
+
saveSettings,
|
|
3
5
|
sourcesTemplate
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-U6EPOXEW.js";
|
|
5
7
|
import {
|
|
6
8
|
describeLink,
|
|
7
9
|
linkStore
|
|
8
10
|
} from "./chunk-QKT2FAB5.js";
|
|
11
|
+
import "./chunk-QG4XXKBP.js";
|
|
9
12
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
PROFILES,
|
|
14
|
+
layerSettings,
|
|
15
|
+
loadConfig,
|
|
16
|
+
settingSources
|
|
17
|
+
} from "./chunk-72NUDSOV.js";
|
|
12
18
|
import {
|
|
13
19
|
PACKAGED,
|
|
14
20
|
command
|
|
@@ -17,8 +23,32 @@ import {
|
|
|
17
23
|
// scripts/init.ts
|
|
18
24
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
19
25
|
import { platform } from "node:os";
|
|
20
|
-
import { relative } from "node:path";
|
|
21
|
-
|
|
26
|
+
import { dirname, relative } from "node:path";
|
|
27
|
+
import { parseArgs } from "node:util";
|
|
28
|
+
var { values: flags } = parseArgs({ args: process.argv.slice(2), options: { profile: { type: "string" } }, strict: false, allowPositionals: true });
|
|
29
|
+
var asked = typeof flags.profile === "string" ? flags.profile.trim().toLowerCase() : null;
|
|
30
|
+
if (asked !== null && !PROFILES.includes(asked)) {
|
|
31
|
+
console.error(`--profile must be one of ${PROFILES.join(", ")}, got ${JSON.stringify(flags.profile)}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
var sources = settingSources();
|
|
35
|
+
var savedProfile = sources.settings.DAILY_FOCUS_PROFILE?.trim().toLowerCase() || null;
|
|
36
|
+
if (asked !== null && savedProfile !== null && savedProfile !== asked) {
|
|
37
|
+
console.error(`${sources.settingsPath} already says this store briefs the ${savedProfile} profile. Change it in the dashboard's settings.`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
var savesProfile = asked !== null && savedProfile === null;
|
|
41
|
+
if (savesProfile) {
|
|
42
|
+
const applied = applySettingsChange(sources, { DAILY_FOCUS_PROFILE: asked });
|
|
43
|
+
if ("error" in applied) {
|
|
44
|
+
console.error(applied.error);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
await mkdir(dirname(sources.settingsPath), { recursive: true });
|
|
48
|
+
await saveSettings(sources.settingsPath, applied.settings);
|
|
49
|
+
sources = settingSources();
|
|
50
|
+
}
|
|
51
|
+
var config = loadConfig(layerSettings(sources));
|
|
22
52
|
var created = 0;
|
|
23
53
|
var linked = 0;
|
|
24
54
|
var failed = 0;
|
|
@@ -54,6 +84,7 @@ async function writeIfAbsent(path, contents, what) {
|
|
|
54
84
|
console.log(`
|
|
55
85
|
\x1B[1mDaily Focus \u2014 store setup\x1B[0m`);
|
|
56
86
|
console.log(`\x1B[2m${config.dataDir} (${config.profile} profile)\x1B[0m`);
|
|
87
|
+
if (savesProfile) ok(`saved the ${asked} profile`, relative(config.dataDir, sources.settingsPath));
|
|
57
88
|
section("Directories");
|
|
58
89
|
try {
|
|
59
90
|
await mkdir(config.dataDir, { recursive: true });
|
|
@@ -86,8 +117,12 @@ var start = platform() === "darwin" ? `\`${command("service")}\` to run the boar
|
|
|
86
117
|
var demo = PACKAGED ? "daily-focus --demo" : "npm run demo";
|
|
87
118
|
section(next.length > 0 ? "Next" : "Nothing to do");
|
|
88
119
|
if (next.length === 0) {
|
|
120
|
+
const changed = [
|
|
121
|
+
savesProfile ? `Saved the ${asked} profile` : null,
|
|
122
|
+
linked > 0 ? `${savesProfile ? "linked" : "Linked"} ${linked} ${linked === 1 ? "file" : "files"} to this checkout` : null
|
|
123
|
+
].filter((part) => part !== null);
|
|
89
124
|
console.log(
|
|
90
|
-
|
|
125
|
+
changed.length > 0 ? ` The store was already set up. ${changed.join(" and ")}; nothing else changed.` : " The store was already set up. Nothing was changed."
|
|
91
126
|
);
|
|
92
127
|
console.log(` ${start}, \`${command("audit")}\` to check the current brief.`);
|
|
93
128
|
} else {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sampleBrief
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WPXIQPYX.js";
|
|
4
4
|
import {
|
|
5
5
|
Store
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ITUK7XKS.js";
|
|
7
|
+
import "./chunk-QG4XXKBP.js";
|
|
7
8
|
import {
|
|
8
9
|
loadConfig
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-72NUDSOV.js";
|
|
10
11
|
import {
|
|
11
12
|
command
|
|
12
13
|
} from "./chunk-BC2W7NND.js";
|