@knpkv/jira-clockify 1.2.1 → 1.4.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 +254 -3
- package/dist/package.json +36 -12
- package/dist/src/agent/agentSettings.d.ts +18 -0
- package/dist/src/agent/agentSettings.d.ts.map +1 -0
- package/dist/src/agent/agentSettings.js +23 -0
- package/dist/src/agent/agentSettings.js.map +1 -0
- package/dist/src/agent/schedule.d.ts +20 -0
- package/dist/src/agent/schedule.d.ts.map +1 -0
- package/dist/src/agent/schedule.js +189 -0
- package/dist/src/agent/schedule.js.map +1 -0
- package/dist/src/agent/sessions.d.ts +427 -0
- package/dist/src/agent/sessions.d.ts.map +1 -0
- package/dist/src/agent/sessions.js +868 -0
- package/dist/src/agent/sessions.js.map +1 -0
- package/dist/src/agent/sourceConsumption.d.ts +79 -0
- package/dist/src/agent/sourceConsumption.d.ts.map +1 -0
- package/dist/src/agent/sourceConsumption.js +191 -0
- package/dist/src/agent/sourceConsumption.js.map +1 -0
- package/dist/src/agent/watch.d.ts +76 -0
- package/dist/src/agent/watch.d.ts.map +1 -0
- package/dist/src/agent/watch.js +45 -0
- package/dist/src/agent/watch.js.map +1 -0
- package/dist/src/agent/writePlanning.d.ts +154 -0
- package/dist/src/agent/writePlanning.d.ts.map +1 -0
- package/dist/src/agent/writePlanning.js +210 -0
- package/dist/src/agent/writePlanning.js.map +1 -0
- package/dist/src/bin.d.ts +3 -0
- package/dist/src/bin.d.ts.map +1 -0
- package/dist/src/bin.js +9 -3
- package/dist/src/bin.js.map +1 -1
- package/dist/src/cli/agentWrite.d.ts +164 -0
- package/dist/src/cli/agentWrite.d.ts.map +1 -0
- package/dist/src/cli/agentWrite.js +362 -0
- package/dist/src/cli/agentWrite.js.map +1 -0
- package/dist/src/cli/auth.d.ts +8 -0
- package/dist/src/cli/auth.d.ts.map +1 -0
- package/dist/src/cli/auth.js +10 -10
- package/dist/src/cli/auth.js.map +1 -1
- package/dist/src/cli/calendar.d.ts +42 -0
- package/dist/src/cli/calendar.d.ts.map +1 -0
- package/dist/src/cli/calendar.js +189 -0
- package/dist/src/cli/calendar.js.map +1 -0
- package/dist/src/cli/config.d.ts +12 -0
- package/dist/src/cli/config.d.ts.map +1 -0
- package/dist/src/cli/config.js +163 -21
- package/dist/src/cli/config.js.map +1 -1
- package/dist/src/cli/fetchTicket.d.ts +51 -0
- package/dist/src/cli/fetchTicket.d.ts.map +1 -0
- package/dist/src/cli/fetchTicket.js +18 -2
- package/dist/src/cli/fetchTicket.js.map +1 -1
- package/dist/src/cli/fuzzySelect.d.ts +24 -0
- package/dist/src/cli/fuzzySelect.d.ts.map +1 -0
- package/dist/src/cli/layers.d.ts +40 -0
- package/dist/src/cli/layers.d.ts.map +1 -0
- package/dist/src/cli/layers.js +56 -12
- package/dist/src/cli/layers.js.map +1 -1
- package/dist/src/cli/list.d.ts +8 -0
- package/dist/src/cli/list.d.ts.map +1 -0
- package/dist/src/cli/list.js +2 -2
- package/dist/src/cli/list.js.map +1 -1
- package/dist/src/cli/reconcile.d.ts +129 -0
- package/dist/src/cli/reconcile.d.ts.map +1 -0
- package/dist/src/cli/reconcile.js +635 -46
- package/dist/src/cli/reconcile.js.map +1 -1
- package/dist/src/cli/root.d.ts +15 -0
- package/dist/src/cli/root.d.ts.map +1 -0
- package/dist/src/cli/root.js +4 -3
- package/dist/src/cli/root.js.map +1 -1
- package/dist/src/cli/runtimeFailure.d.ts +10 -0
- package/dist/src/cli/runtimeFailure.d.ts.map +1 -0
- package/dist/src/cli/runtimeFailure.js +17 -0
- package/dist/src/cli/runtimeFailure.js.map +1 -0
- package/dist/src/cli/setup.d.ts +10 -0
- package/dist/src/cli/setup.d.ts.map +1 -0
- package/dist/src/cli/setup.js +7 -7
- package/dist/src/cli/setup.js.map +1 -1
- package/dist/src/cli/timer/discard.d.ts +4 -0
- package/dist/src/cli/timer/discard.d.ts.map +1 -0
- package/dist/src/cli/timer/discard.js +2 -2
- package/dist/src/cli/timer/discard.js.map +1 -1
- package/dist/src/cli/timer/edit.d.ts +22 -0
- package/dist/src/cli/timer/edit.d.ts.map +1 -0
- package/dist/src/cli/timer/edit.js +62 -42
- package/dist/src/cli/timer/edit.js.map +1 -1
- package/dist/src/cli/timer/index.d.ts +12 -0
- package/dist/src/cli/timer/index.d.ts.map +1 -0
- package/dist/src/cli/timer/log.d.ts +16 -0
- package/dist/src/cli/timer/log.d.ts.map +1 -0
- package/dist/src/cli/timer/log.js +6 -6
- package/dist/src/cli/timer/log.js.map +1 -1
- package/dist/src/cli/timer/start.d.ts +21 -0
- package/dist/src/cli/timer/start.d.ts.map +1 -0
- package/dist/src/cli/timer/start.js +9 -9
- package/dist/src/cli/timer/start.js.map +1 -1
- package/dist/src/cli/timer/status.d.ts +22 -0
- package/dist/src/cli/timer/status.d.ts.map +1 -0
- package/dist/src/cli/timer/status.js +110 -71
- package/dist/src/cli/timer/status.js.map +1 -1
- package/dist/src/cli/timer/stop.d.ts +48 -0
- package/dist/src/cli/timer/stop.d.ts.map +1 -0
- package/dist/src/cli/timer/stop.js +19 -19
- package/dist/src/cli/timer/stop.js.map +1 -1
- package/dist/src/cli/timer.d.ts +11 -0
- package/dist/src/cli/timer.d.ts.map +1 -0
- package/dist/src/cli/timer.js +1 -1
- package/dist/src/cli/timer.js.map +1 -1
- package/dist/src/cli/watch.d.ts +54 -0
- package/dist/src/cli/watch.d.ts.map +1 -0
- package/dist/src/cli/watch.js +412 -0
- package/dist/src/cli/watch.js.map +1 -0
- package/dist/src/cli/watchLease.d.ts +99 -0
- package/dist/src/cli/watchLease.d.ts.map +1 -0
- package/dist/src/cli/watchLease.js +204 -0
- package/dist/src/cli/watchLease.js.map +1 -0
- package/dist/src/cli/writerGuard.d.ts +37 -0
- package/dist/src/cli/writerGuard.d.ts.map +1 -0
- package/dist/src/cli/writerGuard.js +92 -0
- package/dist/src/cli/writerGuard.js.map +1 -0
- package/dist/src/index.d.ts +46 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +46 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/main.d.ts +4 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/services/AgentSessionReader.d.ts +121 -0
- package/dist/src/services/AgentSessionReader.d.ts.map +1 -0
- package/dist/src/services/AgentSessionReader.js +392 -0
- package/dist/src/services/AgentSessionReader.js.map +1 -0
- package/dist/src/services/ClockifyAuth.d.ts +47 -0
- package/dist/src/services/ClockifyAuth.d.ts.map +1 -0
- package/dist/src/services/ClockifyAuth.js +2 -2
- package/dist/src/services/ClockifyAuth.js.map +1 -1
- package/dist/src/services/CodexTranscript.d.ts +112 -0
- package/dist/src/services/CodexTranscript.d.ts.map +1 -0
- package/dist/src/services/CodexTranscript.js +96 -0
- package/dist/src/services/CodexTranscript.js.map +1 -0
- package/dist/src/services/ConfigService.d.ts +99 -0
- package/dist/src/services/ConfigService.d.ts.map +1 -0
- package/dist/src/services/ConfigService.js +79 -7
- package/dist/src/services/ConfigService.js.map +1 -1
- package/dist/src/services/HomeDirectory.d.ts +17 -0
- package/dist/src/services/HomeDirectory.d.ts.map +1 -0
- package/dist/src/services/HomeDirectory.js +1 -1
- package/dist/src/services/IssueFacts.d.ts +127 -0
- package/dist/src/services/IssueFacts.d.ts.map +1 -0
- package/dist/src/services/IssueFacts.js +277 -0
- package/dist/src/services/IssueFacts.js.map +1 -0
- package/dist/src/services/ProviderDeletion.d.ts +19 -0
- package/dist/src/services/ProviderDeletion.d.ts.map +1 -0
- package/dist/src/services/ProviderDeletion.js +37 -0
- package/dist/src/services/ProviderDeletion.js.map +1 -0
- package/dist/src/services/ReconcileService.d.ts +378 -0
- package/dist/src/services/ReconcileService.d.ts.map +1 -0
- package/dist/src/services/ReconcileService.js +1270 -79
- package/dist/src/services/ReconcileService.js.map +1 -1
- package/dist/src/services/SavedEntries.d.ts +40 -0
- package/dist/src/services/SavedEntries.d.ts.map +1 -0
- package/dist/src/services/SavedEntries.js +209 -0
- package/dist/src/services/SavedEntries.js.map +1 -0
- package/dist/src/services/SessionAttributor.d.ts +114 -0
- package/dist/src/services/SessionAttributor.d.ts.map +1 -0
- package/dist/src/services/SessionAttributor.js +240 -0
- package/dist/src/services/SessionAttributor.js.map +1 -0
- package/dist/src/services/SourceLedger.d.ts +104 -0
- package/dist/src/services/SourceLedger.d.ts.map +1 -0
- package/dist/src/services/SourceLedger.js +302 -0
- package/dist/src/services/SourceLedger.js.map +1 -0
- package/dist/src/services/StateWriter.d.ts +39 -0
- package/dist/src/services/StateWriter.d.ts.map +1 -0
- package/dist/src/services/TicketService.d.ts +63 -0
- package/dist/src/services/TicketService.d.ts.map +1 -0
- package/dist/src/services/TimerService.d.ts +145 -0
- package/dist/src/services/TimerService.d.ts.map +1 -0
- package/dist/src/services/TimerService.js +113 -80
- package/dist/src/services/TimerService.js.map +1 -1
- package/dist/src/services/internal/JiraWorklogPost.d.ts +7 -0
- package/dist/src/services/internal/JiraWorklogPost.d.ts.map +1 -0
- package/dist/src/services/internal/JiraWorklogPost.js +32 -0
- package/dist/src/services/internal/JiraWorklogPost.js.map +1 -0
- package/dist/src/testing/fakeHeadless.d.ts +318 -0
- package/dist/src/testing/fakeHeadless.d.ts.map +1 -0
- package/dist/src/testing/fakeHeadless.js +1149 -0
- package/dist/src/testing/fakeHeadless.js.map +1 -0
- package/dist/src/tui/App.d.ts +6 -0
- package/dist/src/tui/App.d.ts.map +1 -0
- package/dist/src/tui/App.js +1 -1
- package/dist/src/tui/App.js.map +1 -1
- package/dist/src/tui/atoms/runtime.d.ts +8 -0
- package/dist/src/tui/atoms/runtime.d.ts.map +1 -0
- package/dist/src/tui/atoms/runtime.js +1 -1
- package/dist/src/tui/atoms/runtime.js.map +1 -1
- package/dist/src/tui/atoms/tickets.d.ts +3 -0
- package/dist/src/tui/atoms/tickets.d.ts.map +1 -0
- package/dist/src/tui/atoms/timer.d.ts +11 -0
- package/dist/src/tui/atoms/timer.d.ts.map +1 -0
- package/dist/src/tui/atoms/timer.js +1 -1
- package/dist/src/tui/atoms/timer.js.map +1 -1
- package/dist/src/tui/atoms/ui.d.ts +11 -0
- package/dist/src/tui/atoms/ui.d.ts.map +1 -0
- package/dist/src/tui/atoms/ui.js +1 -1
- package/dist/src/tui/atoms/ui.js.map +1 -1
- package/dist/src/tui/components/BigTimer.d.ts +2 -0
- package/dist/src/tui/components/BigTimer.d.ts.map +1 -0
- package/dist/src/tui/components/Footer.d.ts +2 -0
- package/dist/src/tui/components/Footer.d.ts.map +1 -0
- package/dist/src/tui/components/Header.d.ts +2 -0
- package/dist/src/tui/components/Header.d.ts.map +1 -0
- package/dist/src/tui/components/Header.js +1 -1
- package/dist/src/tui/components/Header.js.map +1 -1
- package/dist/src/tui/components/PopupInput.d.ts +18 -0
- package/dist/src/tui/components/PopupInput.d.ts.map +1 -0
- package/dist/src/tui/components/PopupMessage.d.ts +20 -0
- package/dist/src/tui/components/PopupMessage.d.ts.map +1 -0
- package/dist/src/tui/components/TicketList.d.ts +2 -0
- package/dist/src/tui/components/TicketList.d.ts.map +1 -0
- package/dist/src/tui/components/TicketList.js +1 -1
- package/dist/src/tui/components/TicketList.js.map +1 -1
- package/dist/src/tui/components/TicketRow.d.ts +8 -0
- package/dist/src/tui/components/TicketRow.d.ts.map +1 -0
- package/dist/src/tui/components/TimerDisplay.d.ts +2 -0
- package/dist/src/tui/components/TimerDisplay.d.ts.map +1 -0
- package/dist/src/tui/components/index.d.ts +12 -0
- package/dist/src/tui/components/index.d.ts.map +1 -0
- package/dist/src/tui/context/theme.d.ts +15 -0
- package/dist/src/tui/context/theme.d.ts.map +1 -0
- package/dist/src/tui/hooks/useElapsedTimer.d.ts +6 -0
- package/dist/src/tui/hooks/useElapsedTimer.d.ts.map +1 -0
- package/dist/src/tui/hooks/useElapsedTimer.js +1 -1
- package/dist/src/tui/hooks/useElapsedTimer.js.map +1 -1
- package/dist/src/tui/hooks/useTerminalSize.d.ts +5 -0
- package/dist/src/tui/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/src/utils/hints.d.ts +12 -0
- package/dist/src/utils/hints.d.ts.map +1 -0
- package/dist/src/utils/hints.js +12 -0
- package/dist/src/utils/hints.js.map +1 -0
- package/dist/src/utils/time.d.ts +104 -0
- package/dist/src/utils/time.d.ts.map +1 -0
- package/dist/src/utils/time.js +74 -8
- package/dist/src/utils/time.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nvim/lua/jcf/state.lua +191 -13
- package/package.json +36 -18
- package/skills/jcf/SKILL.md +93 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-based fuzzy selection prompt using Effect's Terminal service.
|
|
3
|
+
*
|
|
4
|
+
* **Mental model**
|
|
5
|
+
*
|
|
6
|
+
* - **Terminal.readInput**: Acquires a scoped `Mailbox<UserInput>` for key events
|
|
7
|
+
* (replaces raw stdin). Terminal handles raw mode internally.
|
|
8
|
+
* - **Terminal.display**: Writes ANSI output through the platform service.
|
|
9
|
+
* - **Filter as you type**: Narrows choices by substring match, vim-style j/k navigation.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Terminal from "effect/Terminal";
|
|
15
|
+
export interface SelectChoice<A> {
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly value: A;
|
|
18
|
+
}
|
|
19
|
+
export declare const fuzzySelect: <A>(options: {
|
|
20
|
+
readonly message: string;
|
|
21
|
+
readonly choices: ReadonlyArray<SelectChoice<A>>;
|
|
22
|
+
readonly maxVisible?: number;
|
|
23
|
+
}) => Effect.Effect<A & ({} | undefined), import("effect/Cause").Done<void>, Terminal.Terminal>;
|
|
24
|
+
//# sourceMappingURL=fuzzySelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuzzySelect.d.ts","sourceRoot":"","sources":["../../../src/cli/fuzzySelect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAClB;AA+ED,eAAO,MAAM,WAAW,GAAI,CAAC,WAAW;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC7B,8FA8FG,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer composition for the jcf CLI and TUI runtime.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NodeServices } from "@effect/platform-node";
|
|
7
|
+
import { ClockifyApiClient, ClockifyApiConfig } from "@knpkv/clockify-api-client";
|
|
8
|
+
import { JiraApiClient, JiraApiConfig } from "@knpkv/jira-api-client";
|
|
9
|
+
import { JiraAuth } from "@knpkv/jira-cli/JiraAuth";
|
|
10
|
+
import { Layer } from "effect";
|
|
11
|
+
import { ClockifyAuth } from "../services/ClockifyAuth.js";
|
|
12
|
+
/**
|
|
13
|
+
* Diagnostics belong on stderr. The default logger writes to stdout, which corrupts every `--json`
|
|
14
|
+
* output: one warning turns "exactly one JSON value on stdout" into unparseable output for whatever
|
|
15
|
+
* is reading it. Warnings stay visible, just on the stream reserved for them.
|
|
16
|
+
*
|
|
17
|
+
* Part of the layer rather than the binary so the test seam inherits the same routing the real CLI
|
|
18
|
+
* runs with, instead of the two drifting apart.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LogToStderrLive: Layer.Layer<never, never, never>;
|
|
21
|
+
export declare const PlatformLayer: Layer.Layer<import("effect/http/HttpClient").HttpClient | NodeServices.NodeServices, never, never>;
|
|
22
|
+
export declare const HomeDirectoryLive: Layer.Layer<import("../services/HomeDirectory.js").HomeDirectory, import("effect/Config").ConfigError, never>;
|
|
23
|
+
export declare const ClockifyAuthLive: Layer.Layer<ClockifyAuth, import("effect/Config").ConfigError, never>;
|
|
24
|
+
export declare const ConfigLive: Layer.Layer<import("../services/ConfigService.js").ConfigService, import("effect/Config").ConfigError, never>;
|
|
25
|
+
export declare const StateWriterLive: Layer.Layer<import("../services/StateWriter.js").StateWriter, import("effect/Config").ConfigError, never>;
|
|
26
|
+
export declare const SourceLedgerLive: Layer.Layer<import("../services/SourceLedger.js").SourceLedger, import("effect/Config").ConfigError, never>;
|
|
27
|
+
export declare const JiraAuthLive: Layer.Layer<JiraAuth, never, never>;
|
|
28
|
+
export declare const ClockifyApiConfigLive: Layer.Layer<ClockifyApiConfig, import("effect/Config").ConfigError, never>;
|
|
29
|
+
export declare const ClockifyApiLive: Layer.Layer<ClockifyApiClient, import("effect/Config").ConfigError, never>;
|
|
30
|
+
export declare const JiraApiConfigLive: Layer.Layer<JiraApiConfig, never, never>;
|
|
31
|
+
export declare const JiraApiLive: Layer.Layer<JiraApiClient, never, never>;
|
|
32
|
+
export declare const IssueFactsLive: Layer.Layer<import("../services/IssueFacts.js").IssueFacts, import("effect/Config").ConfigError, never>;
|
|
33
|
+
export declare const TicketServiceLive: Layer.Layer<import("../services/TicketService.js").TicketService, import("effect/Config").ConfigError, never>;
|
|
34
|
+
export declare const TimerServiceLive: Layer.Layer<import("../services/TimerService.js").TimerService, import("effect/Config").ConfigError, never>;
|
|
35
|
+
export declare const AgentSessionReaderLive: Layer.Layer<import("../services/AgentSessionReader.js").AgentSessionReader, import("effect/Config").ConfigError, never>;
|
|
36
|
+
export declare const SessionAttributorLive: Layer.Layer<import("../services/SessionAttributor.js").SessionAttributor, import("effect/Config").ConfigError, never>;
|
|
37
|
+
export declare const SavedEntriesLive: Layer.Layer<import("../services/SavedEntries.js").SavedEntries, import("effect/Config").ConfigError, never>;
|
|
38
|
+
export declare const ReconcileServiceLive: Layer.Layer<import("../services/ReconcileService.js").ReconcileService, import("effect/Config").ConfigError, import("effect/FileSystem").FileSystem | import("effect/http/HttpClient").HttpClient | import("effect/Path").Path>;
|
|
39
|
+
export declare const HeadlessLayer: Layer.Layer<import("../services/AgentSessionReader.js").AgentSessionReader | ClockifyApiClient | ClockifyAuth | import("../services/ConfigService.js").ConfigService | import("effect/http/HttpClient").HttpClient | import("../services/IssueFacts.js").IssueFacts | JiraApiClient | JiraAuth | import("../services/ReconcileService.js").ReconcileService | import("../services/SavedEntries.js").SavedEntries | import("../services/SessionAttributor.js").SessionAttributor | import("../services/SourceLedger.js").SourceLedger | import("../services/StateWriter.js").StateWriter | import("../services/TicketService.js").TicketService | import("../services/TimerService.js").TimerService | NodeServices.NodeServices, import("effect/Config").ConfigError, never>;
|
|
40
|
+
//# sourceMappingURL=layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers.d.ts","sourceRoot":"","sources":["../../../src/cli/layers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAkB,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACjF,OAAO,EAAE,aAAa,EAAE,aAAa,EAA0B,MAAM,wBAAwB,CAAA;AAC7F,OAAO,EAAE,QAAQ,EAA0B,MAAM,0BAA0B,CAAA;AAC3E,OAAO,EAAU,KAAK,EAAY,MAAM,QAAQ,CAAA;AAGhD,OAAO,EAAE,YAAY,EAA8B,MAAM,6BAA6B,CAAA;AAgBtF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,kCAA0C,CAAA;AAKtE,eAAO,MAAM,aAAa,oGAAgE,CAAA;AAM1F,eAAO,MAAM,iBAAiB,+GAAqB,CAAA;AACnD,eAAO,MAAM,gBAAgB,uEAAyF,CAAA;AACtH,eAAO,MAAM,UAAU,+GAAmF,CAAA;AAC1G,eAAO,MAAM,eAAe,2GAAwF,CAAA;AACpH,eAAO,MAAM,gBAAgB,6GAAkF,CAAA;AAC/G,eAAO,MAAM,YAAY,qCAAmD,CAAA;AAM5E,eAAO,MAAM,qBAAqB,4EAaK,CAAA;AAEvC,eAAO,MAAM,eAAe,4EAG3B,CAAA;AA0BD,eAAO,MAAM,iBAAiB,0CAoBK,CAAA;AAEnC,eAAO,MAAM,WAAW,0CAGvB,CAAA;AAMD,eAAO,MAAM,cAAc,yGAK1B,CAAA;AAED,eAAO,MAAM,iBAAiB,+GAG7B,CAAA;AAED,eAAO,MAAM,gBAAgB,6GAQ5B,CAAA;AAED,eAAO,MAAM,sBAAsB,yHAIlC,CAAA;AAID,eAAO,MAAM,qBAAqB,uHAIjC,CAAA;AAED,eAAO,MAAM,gBAAgB,6GAK5B,CAAA;AAED,eAAO,MAAM,oBAAoB,iOAWhC,CAAA;AA2BD,eAAO,MAAM,aAAa,8uBAMiB,CAAA"}
|
package/dist/src/cli/layers.js
CHANGED
|
@@ -8,16 +8,31 @@ import { ClockifyApiClient, ClockifyApiConfig } from "@knpkv/clockify-api-client
|
|
|
8
8
|
import { JiraApiClient, JiraApiConfig } from "@knpkv/jira-api-client";
|
|
9
9
|
import { JiraAuth, layer as JiraAuthLayer } from "@knpkv/jira-cli/JiraAuth";
|
|
10
10
|
import { Effect, Layer, Redacted } from "effect";
|
|
11
|
+
import * as Logger from "effect/Logger";
|
|
12
|
+
import { layer as AgentSessionReaderLayer } from "../services/AgentSessionReader.js";
|
|
11
13
|
import { ClockifyAuth, layer as ClockifyAuthLayer } from "../services/ClockifyAuth.js";
|
|
12
14
|
import { layer as ConfigLayer } from "../services/ConfigService.js";
|
|
13
15
|
import { layer as HomeDirectoryLayer } from "../services/HomeDirectory.js";
|
|
16
|
+
import { layer as IssueFactsLayer } from "../services/IssueFacts.js";
|
|
14
17
|
import { layer as ReconcileServiceLayer } from "../services/ReconcileService.js";
|
|
18
|
+
import { layer as SavedEntriesLayer } from "../services/SavedEntries.js";
|
|
19
|
+
import { layer as SessionAttributorLayer } from "../services/SessionAttributor.js";
|
|
20
|
+
import { layer as SourceLedgerLayer } from "../services/SourceLedger.js";
|
|
15
21
|
import { layer as StateWriterLayer } from "../services/StateWriter.js";
|
|
16
22
|
import { layer as TicketServiceLayer } from "../services/TicketService.js";
|
|
17
23
|
import { layer as TimerServiceLayer } from "../services/TimerService.js";
|
|
18
24
|
// ---------------------------------------------------------------------------
|
|
19
25
|
// Platform
|
|
20
26
|
// ---------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* Diagnostics belong on stderr. The default logger writes to stdout, which corrupts every `--json`
|
|
29
|
+
* output: one warning turns "exactly one JSON value on stdout" into unparseable output for whatever
|
|
30
|
+
* is reading it. Warnings stay visible, just on the stream reserved for them.
|
|
31
|
+
*
|
|
32
|
+
* Part of the layer rather than the binary so the test seam inherits the same routing the real CLI
|
|
33
|
+
* runs with, instead of the two drifting apart.
|
|
34
|
+
*/
|
|
35
|
+
export const LogToStderrLive = Layer.succeed(Logger.LogToStderr, true);
|
|
21
36
|
// HttpClient backs TimerService's raw Jira worklog POST. Use the fetch implementation, not
|
|
22
37
|
// undici: the TUI runs under Bun (see main.tsx) where undici fails with a transport error,
|
|
23
38
|
// while fetch works in both Bun and Node — the same fetch the Jira/Clockify API clients use.
|
|
@@ -29,13 +44,14 @@ export const HomeDirectoryLive = HomeDirectoryLayer;
|
|
|
29
44
|
export const ClockifyAuthLive = ClockifyAuthLayer.pipe(Layer.provide(HomeDirectoryLive), Layer.provide(PlatformLayer));
|
|
30
45
|
export const ConfigLive = ConfigLayer.pipe(Layer.provide(HomeDirectoryLive), Layer.provide(PlatformLayer));
|
|
31
46
|
export const StateWriterLive = StateWriterLayer.pipe(Layer.provide(HomeDirectoryLive), Layer.provide(PlatformLayer));
|
|
47
|
+
export const SourceLedgerLive = SourceLedgerLayer.pipe(Layer.provide(ConfigLive), Layer.provide(PlatformLayer));
|
|
32
48
|
export const JiraAuthLive = JiraAuthLayer.pipe(Layer.provide(PlatformLayer));
|
|
33
49
|
// ---------------------------------------------------------------------------
|
|
34
50
|
// API config layers
|
|
35
51
|
// ---------------------------------------------------------------------------
|
|
36
52
|
export const ClockifyApiConfigLive = Layer.effect(ClockifyApiConfig, Effect.gen(function* () {
|
|
37
53
|
const auth = yield* ClockifyAuth;
|
|
38
|
-
return yield* auth.getConfig.pipe(Effect.
|
|
54
|
+
return yield* auth.getConfig.pipe(Effect.orElseSucceed(() => ({
|
|
39
55
|
apiKey: Redacted.make(""),
|
|
40
56
|
workspaceId: "",
|
|
41
57
|
userId: "",
|
|
@@ -53,32 +69,60 @@ export const ClockifyApiLive = ClockifyApiClient.layer.pipe(Layer.provide(Clocki
|
|
|
53
69
|
// `Effect.timeout` is a race, and racing an uninterruptible loser means waiting
|
|
54
70
|
// for it anyway.
|
|
55
71
|
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
72
|
+
// The credential is resolved per request, not once here. An access token lasts
|
|
73
|
+
// about an hour, so a value captured at layer construction is a deadline on the
|
|
74
|
+
// process: `jcf watch` runs all day, and the TUI's runtime
|
|
75
|
+
// (`tui/atoms/runtime.ts`) is memoized for a whole session. Both used to 401
|
|
76
|
+
// every Jira call from the first expiry onward, with the empty-credential
|
|
77
|
+
// fallback below turning any transient failure at startup into the same thing
|
|
78
|
+
// permanently. `resolveAuth` is re-read before each request, so a refresh — by
|
|
79
|
+
// this process or another — reaches the next call.
|
|
80
|
+
//
|
|
81
|
+
// `getAccessToken` is cheap to call repeatedly: it reads the stored token and
|
|
82
|
+
// returns it unless it has actually expired, and holds a lock so concurrent
|
|
83
|
+
// callers share one refresh.
|
|
62
84
|
//
|
|
63
85
|
// `getCloudId` needs no bound; it only reads the stored token file.
|
|
64
86
|
export const JiraApiConfigLive = Layer.effect(JiraApiConfig, Effect.gen(function* () {
|
|
65
87
|
const auth = yield* JiraAuth;
|
|
66
|
-
|
|
67
|
-
|
|
88
|
+
// Infallible by construction, because request preprocessing has nowhere to put an error. An
|
|
89
|
+
// empty token yields the same 401 as never having logged in, which is what the caller reports.
|
|
90
|
+
const resolveAuth = Effect.gen(function* () {
|
|
91
|
+
const accessToken = yield* auth.getAccessToken().pipe(Effect.orElseSucceed(() => Redacted.make("")));
|
|
92
|
+
const cloudId = yield* auth.getCloudId().pipe(Effect.orElseSucceed(() => ""));
|
|
93
|
+
return { type: "oauth2", accessToken, cloudId };
|
|
94
|
+
});
|
|
68
95
|
return {
|
|
69
96
|
baseUrl: "",
|
|
70
|
-
|
|
97
|
+
// Read once for the snapshot every non-refreshing consumer still reads, and again per request.
|
|
98
|
+
auth: yield* resolveAuth,
|
|
99
|
+
resolveAuth
|
|
71
100
|
};
|
|
72
101
|
})).pipe(Layer.provide(JiraAuthLive));
|
|
73
102
|
export const JiraApiLive = JiraApiClient.layer.pipe(Layer.provide(JiraApiConfigLive), Layer.provide(PlatformLayer));
|
|
74
103
|
// ---------------------------------------------------------------------------
|
|
75
104
|
// Service layers
|
|
76
105
|
// ---------------------------------------------------------------------------
|
|
106
|
+
export const IssueFactsLive = IssueFactsLayer.pipe(Layer.provide(HomeDirectoryLive), Layer.provide(JiraApiLive), Layer.provide(JiraAuthLive), Layer.provide(PlatformLayer));
|
|
77
107
|
export const TicketServiceLive = TicketServiceLayer.pipe(Layer.provide(JiraApiLive), Layer.provide(ConfigLive));
|
|
78
108
|
export const TimerServiceLive = TimerServiceLayer.pipe(Layer.provide(ClockifyApiLive), Layer.provide(JiraApiLive), Layer.provide(JiraAuthLive), Layer.provide(ClockifyAuthLive), Layer.provide(ConfigLive), Layer.provide(StateWriterLive), Layer.provide(PlatformLayer));
|
|
79
|
-
export const
|
|
109
|
+
export const AgentSessionReaderLive = AgentSessionReaderLayer.pipe(Layer.provide(HomeDirectoryLive), Layer.provide(ConfigLive), Layer.provide(PlatformLayer));
|
|
110
|
+
// Constructing this spawns nothing — the selected CLI is only invoked when a session no
|
|
111
|
+
// deterministic Attribution Signal could place actually needs attributing.
|
|
112
|
+
export const SessionAttributorLive = SessionAttributorLayer.pipe(Layer.provide(HomeDirectoryLive), Layer.provide(ConfigLive), Layer.provide(PlatformLayer));
|
|
113
|
+
export const SavedEntriesLive = SavedEntriesLayer.pipe(Layer.provide(ClockifyApiLive), Layer.provide(ClockifyAuthLive), Layer.provide(JiraApiLive), Layer.provide(JiraAuthLive));
|
|
114
|
+
export const ReconcileServiceLive = ReconcileServiceLayer.pipe(Layer.provide(HomeDirectoryLive), Layer.provide(ClockifyApiLive), Layer.provide(ClockifyAuthLive), Layer.provide(JiraApiLive), Layer.provide(JiraAuthLive), Layer.provide(ConfigLive), Layer.provide(TimerServiceLive), Layer.provide(AgentSessionReaderLive), Layer.provide(SessionAttributorLive), Layer.provide(SourceLedgerLive));
|
|
80
115
|
// ---------------------------------------------------------------------------
|
|
81
116
|
// Fully closed layer for headless CLI
|
|
82
117
|
// ---------------------------------------------------------------------------
|
|
83
|
-
|
|
118
|
+
/**
|
|
119
|
+
* The services the application services are built *from*.
|
|
120
|
+
*
|
|
121
|
+
* Separated because `Layer.mergeAll` builds its members in parallel: a dependency listed alongside
|
|
122
|
+
* its dependent is not guaranteed to exist when the dependent is constructed. These go underneath
|
|
123
|
+
* via `provideMerge`, which both orders them first and keeps them in the result, so a command can
|
|
124
|
+
* still reach `ConfigService` directly.
|
|
125
|
+
*/
|
|
126
|
+
const FoundationLayer = Layer.mergeAll(ConfigLive, StateWriterLive, SourceLedgerLive, ClockifyAuthLive, ClockifyApiLive, JiraAuthLive, JiraApiLive, AgentSessionReaderLive, SessionAttributorLive, LogToStderrLive).pipe(Layer.provideMerge(PlatformLayer));
|
|
127
|
+
export const HeadlessLayer = Layer.mergeAll(TimerServiceLive, ReconcileServiceLive, SavedEntriesLive, TicketServiceLive, IssueFactsLive).pipe(Layer.provideMerge(FoundationLayer));
|
|
84
128
|
//# sourceMappingURL=layers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layers.js","sourceRoot":"","sources":["../../../src/cli/layers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACjF,OAAO,EAAE,aAAa,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"layers.js","sourceRoot":"","sources":["../../../src/cli/layers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACjF,OAAO,EAAE,aAAa,EAAE,aAAa,EAA0B,MAAM,wBAAwB,CAAA;AAC7F,OAAO,EAAE,QAAQ,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,KAAK,IAAI,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,EAAE,YAAY,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACtF,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAAE,KAAK,IAAI,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAChF,OAAO,EAAE,KAAK,IAAI,iB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C,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from "effect/cli";
|
|
2
|
+
import { TicketService } from "../services/TicketService.js";
|
|
3
|
+
/** `list` command — prints assigned tickets. */
|
|
4
|
+
export declare const list: Command.Command<"list", {
|
|
5
|
+
readonly json: boolean;
|
|
6
|
+
}, {}, import("../services/TicketService.js").TicketError, TicketService>;
|
|
7
|
+
export declare const issue: Command.Command<"issue", {} | {}, {}, import("../services/TicketService.js").TicketError, TicketService>;
|
|
8
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/list.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAmB,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,gDAAgD;AAChD,eAAO,MAAM,IAAI;;yEAsBhB,CAAA;AAED,eAAO,MAAM,KAAK,0GAGjB,CAAA"}
|
package/dist/src/cli/list.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { Console, Effect, SubscriptionRef } from "effect";
|
|
7
|
-
import { Command, Flag as Options } from "effect/
|
|
7
|
+
import { Command, Flag as Options } from "effect/cli";
|
|
8
8
|
import { TicketService } from "../services/TicketService.js";
|
|
9
9
|
/** `list` command — prints assigned tickets. */
|
|
10
|
-
export const list = Command.make("list", { json: Options.
|
|
10
|
+
export const list = Command.make("list", { json: Options.Boolean("json").pipe(Options.withDefault(false)) }, ({ json }) => Effect.gen(function* () {
|
|
11
11
|
const ticketService = yield* TicketService;
|
|
12
12
|
yield* ticketService.refresh;
|
|
13
13
|
yield* Effect.sleep("600 millis");
|
package/dist/src/cli/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cli/list.ts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EAAE,CAAC;YACxB,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;QAC5F,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QACxC,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CACL,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAC7F,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,EAC9C,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAChC,CAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `jcf sync reconcile` — compare Clockify time against Jira worklogs over a period and
|
|
3
|
+
* fill gaps one row at a time.
|
|
4
|
+
*
|
|
5
|
+
* With `--agent claude` the same command switches to a different *source of evidence*: local
|
|
6
|
+
* Claude Code Agent Sessions become Proposed Worklogs for the time neither side recorded. Agent
|
|
7
|
+
* Sessions are never a third side of the reconciliation — see ADR-0006.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { Option, Runtime } from "effect";
|
|
12
|
+
import { Command, Prompt } from "effect/cli";
|
|
13
|
+
import * as Terminal from "effect/Terminal";
|
|
14
|
+
import type { SessionProposal } from "../agent/sessions.js";
|
|
15
|
+
import { ConfigService } from "../services/ConfigService.js";
|
|
16
|
+
import { IssueFacts } from "../services/IssueFacts.js";
|
|
17
|
+
import { type ReconcileDirection, type ReconcilePeriod, type ReconcileRow, ReconcileService, type SessionProposalReport } from "../services/ReconcileService.js";
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the reconcile window from flags (local-day aligned, half-open `[from, to)`):
|
|
20
|
+
* `--since/--until` (custom) wins, else `--week` (last 7 days incl. today), else today.
|
|
21
|
+
*/
|
|
22
|
+
export declare const resolvePeriod: (opts: {
|
|
23
|
+
readonly week: boolean;
|
|
24
|
+
readonly since: string | undefined;
|
|
25
|
+
readonly until: string | undefined;
|
|
26
|
+
}) => ReconcilePeriod | {
|
|
27
|
+
readonly error: string;
|
|
28
|
+
};
|
|
29
|
+
/** `+Xs` worth of work the *target* is missing for this row, or 0 if it's not short. */
|
|
30
|
+
export declare const deltaToApply: (row: ReconcileRow, direction: ReconcileDirection) => number;
|
|
31
|
+
declare const ReconcileUsageError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
32
|
+
readonly _tag: "ReconcileUsageError";
|
|
33
|
+
} & Readonly<A>;
|
|
34
|
+
/** Wrong arguments, not a failed operation. Fails the command so a script sees a non-zero exit. */
|
|
35
|
+
export declare class ReconcileUsageError extends ReconcileUsageError_base<{
|
|
36
|
+
readonly message: string;
|
|
37
|
+
}> {
|
|
38
|
+
readonly [Runtime.errorReported] = false;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Which mode a `reconcile` invocation is in.
|
|
42
|
+
*
|
|
43
|
+
* `--agent` is a *mode switch*, not a direction: it changes where the evidence comes from, so
|
|
44
|
+
* pairing it with a `direction` is contradictory rather than merely redundant. Reporting that as
|
|
45
|
+
* an error is the point — silently honouring one of the two would leave the user guessing which.
|
|
46
|
+
*/
|
|
47
|
+
export type AgentModeResolution = {
|
|
48
|
+
readonly _tag: "Directions";
|
|
49
|
+
} | {
|
|
50
|
+
readonly _tag: "Agent";
|
|
51
|
+
readonly agent: string;
|
|
52
|
+
} | {
|
|
53
|
+
readonly _tag: "UsageError";
|
|
54
|
+
readonly message: string;
|
|
55
|
+
};
|
|
56
|
+
export interface AgentModeInput {
|
|
57
|
+
readonly agent: string | undefined;
|
|
58
|
+
readonly direction: string | undefined;
|
|
59
|
+
readonly json: boolean;
|
|
60
|
+
readonly calendar: boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare const resolveAgentMode: (options: AgentModeInput) => AgentModeResolution;
|
|
63
|
+
/** What a row shows about its ticket beyond the key itself. */
|
|
64
|
+
interface TicketFacts {
|
|
65
|
+
readonly summary: string;
|
|
66
|
+
/** Display name, or null when Jira omits it; this does not establish assignment. */
|
|
67
|
+
readonly assignee: string | null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The `--json` payload: exactly one value, carrying everything the human report shows so an
|
|
71
|
+
* agent reading it is never worse informed than a person.
|
|
72
|
+
*
|
|
73
|
+
* Reporting only: it creates no Clockify entry and no Jira worklog. It does still refresh the local
|
|
74
|
+
* timer-state cache from Clockify, because knowing a Timer is running is what lets the report
|
|
75
|
+
* exclude that day.
|
|
76
|
+
*/
|
|
77
|
+
export declare const agentReportJson: (options: {
|
|
78
|
+
readonly agent: string;
|
|
79
|
+
readonly period: ReconcilePeriod;
|
|
80
|
+
readonly report: SessionProposalReport;
|
|
81
|
+
readonly tickets: ReadonlyMap<string, TicketFacts>;
|
|
82
|
+
readonly ownershipWithheld: ReadonlyArray<SessionProposal & {
|
|
83
|
+
readonly reason: "other-assignee" | "unassigned";
|
|
84
|
+
}>;
|
|
85
|
+
}) => {
|
|
86
|
+
mode: string;
|
|
87
|
+
agent: string;
|
|
88
|
+
from: string;
|
|
89
|
+
to: string;
|
|
90
|
+
sessionCount: number;
|
|
91
|
+
sessionRootCount: number;
|
|
92
|
+
attributorAvailable: boolean;
|
|
93
|
+
attributorCalls: number;
|
|
94
|
+
proposals: (SessionProposal & {
|
|
95
|
+
summary: string | null;
|
|
96
|
+
assignee: string | null;
|
|
97
|
+
startedAt: string | null;
|
|
98
|
+
endedAt: string | null;
|
|
99
|
+
})[];
|
|
100
|
+
withheld: (import("../agent/sessions.js").TicketDayCredit & {
|
|
101
|
+
summary: string | null;
|
|
102
|
+
assignee: string | null;
|
|
103
|
+
startedAt: string | null;
|
|
104
|
+
endedAt: string | null;
|
|
105
|
+
})[];
|
|
106
|
+
ownershipWithheld: (SessionProposal & {
|
|
107
|
+
readonly reason: "other-assignee" | "unassigned";
|
|
108
|
+
} & {
|
|
109
|
+
summary: string | null;
|
|
110
|
+
assignee: string | null;
|
|
111
|
+
startedAt: string | null;
|
|
112
|
+
endedAt: string | null;
|
|
113
|
+
})[];
|
|
114
|
+
unattributed: readonly import("../agent/sessions.js").UnattributedDayCredit[];
|
|
115
|
+
excludedDays: readonly import("../services/ReconcileService.js").ExcludedDay[];
|
|
116
|
+
};
|
|
117
|
+
export declare const reconcile: Command.Command<"reconcile", {
|
|
118
|
+
readonly direction: Option.Option<string>;
|
|
119
|
+
readonly week: boolean;
|
|
120
|
+
readonly day: boolean;
|
|
121
|
+
readonly since: Option.Option<string>;
|
|
122
|
+
readonly until: Option.Option<string>;
|
|
123
|
+
readonly agent: Option.Option<string>;
|
|
124
|
+
readonly json: boolean;
|
|
125
|
+
readonly calendar: boolean;
|
|
126
|
+
}, {}, Terminal.QuitError | import("../services/ReconcileService.js").ReconcileError | ReconcileUsageError, ConfigService | IssueFacts | import("@knpkv/jira-api-client").JiraApiClient | import("@knpkv/jira-cli/JiraAuth").JiraAuth | ReconcileService | Prompt.Environment>;
|
|
127
|
+
export declare const sync: Command.Command<"sync", {} | {}, {}, Terminal.QuitError | import("../services/ReconcileService.js").ReconcileError | ReconcileUsageError, ConfigService | IssueFacts | import("@knpkv/jira-api-client").JiraApiClient | import("@knpkv/jira-cli/JiraAuth").JiraAuth | ReconcileService | Prompt.Environment>;
|
|
128
|
+
export {};
|
|
129
|
+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