@denisvieiradev/gitwise-core 0.1.0 → 1.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as LLMProvider, P as ProviderConfig, M as ModelTier } from './types-DnMpR1qf.js';
2
- export { a as LLMChatRequest, b as LLMChatResponse, c as ModelConfig } from './types-DnMpR1qf.js';
1
+ import { P as ProviderKind, L as LLMProvider, a as ProviderConfig, M as ModelTier } from './types-BURqSokx.js';
2
+ export { b as LLMChatRequest, c as LLMChatResponse, d as ModelConfig, e as PROVIDER_KINDS } from './types-BURqSokx.js';
3
3
 
4
4
  declare const EXIT_CODES: Readonly<Record<string, number>>;
5
5
  interface GitwiseErrorArgs {
@@ -283,6 +283,12 @@ declare function acquireRepoLock(repoPath: string, options?: AcquireRepoLockOpti
283
283
 
284
284
  declare function resolveClaudeBinary(customPath?: string): string | null;
285
285
 
286
+ declare function resolveCodexBinary(customPath?: string): string | null;
287
+
288
+ declare function resolveCopilotBinary(customPath?: string): string | null;
289
+
290
+ declare function resolveKiroBinary(customPath?: string): string | null;
291
+
286
292
  /**
287
293
  * Release-lifecycle strategy abstraction. Narrow on purpose (per ADR-002):
288
294
  * it covers branch creation, merge targets, and the develop-branch requirement
@@ -307,18 +313,24 @@ interface ModelConfig {
307
313
  balanced: string;
308
314
  powerful: string;
309
315
  }
316
+ /** MDL-01: per-provider model map — each ProviderKind keeps its own tier IDs. */
317
+ type ModelsByProvider = Record<ProviderKind, ModelConfig>;
310
318
  /** Persisted in ~/.gitwise/config.json */
311
319
  interface UserConfig {
312
- provider: "api" | "claude-code";
320
+ provider: ProviderKind;
313
321
  claudeCliPath?: string;
314
- models: ModelConfig;
322
+ codexCliPath?: string;
323
+ copilotCliPath?: string;
324
+ kiroCliPath?: string;
325
+ models: ModelsByProvider;
315
326
  language: Language;
316
327
  defaultBaseBranch?: string;
317
328
  commitConvention: CommitConvention;
318
329
  }
319
330
  /** Loaded from <cwd>/.gitwise.json — all fields are optional */
320
331
  interface RepoConfig {
321
- models?: Partial<ModelConfig>;
332
+ /** Flat tiers apply to the active provider; provider-keyed blocks target that provider and win over flat tiers. */
333
+ models?: Partial<ModelConfig> & Partial<Record<ProviderKind, Partial<ModelConfig>>>;
322
334
  language?: Language;
323
335
  defaultBaseBranch?: string;
324
336
  commitConvention?: CommitConvention;
@@ -409,6 +421,8 @@ interface CommitPlan {
409
421
  input: number;
410
422
  output: number;
411
423
  };
424
+ /** AD-002: false when the active provider doesn't report token usage. */
425
+ tokensAvailable: boolean;
412
426
  }
413
427
  type SplitMode = "auto" | "never" | "always";
414
428
  interface CommitOptions {
@@ -430,6 +444,8 @@ interface CommitAlternatives {
430
444
  input: number;
431
445
  output: number;
432
446
  };
447
+ /** AD-002: false when the active provider doesn't report token usage. */
448
+ tokensAvailable: boolean;
433
449
  }
434
450
  interface ApplyCommitPlanOptions {
435
451
  push?: boolean;
@@ -505,6 +521,8 @@ interface ReviewResult {
505
521
  input: number;
506
522
  output: number;
507
523
  };
524
+ /** AD-002: false when the active provider doesn't report token usage. */
525
+ tokensAvailable: boolean;
508
526
  }
509
527
  interface ReviewOptions {
510
528
  cwd: string;
@@ -525,6 +543,8 @@ interface PrDraft {
525
543
  input: number;
526
544
  output: number;
527
545
  };
546
+ /** AD-002: false when the active provider doesn't report token usage. */
547
+ tokensAvailable: boolean;
528
548
  }
529
549
  interface PrOptions {
530
550
  cwd: string;
@@ -567,6 +587,12 @@ interface PersistedReleasePlan {
567
587
  input: number;
568
588
  output: number;
569
589
  };
590
+ /**
591
+ * AD-002: false when the active provider didn't report token usage.
592
+ * Missing on a plan persisted before this field existed — the validator
593
+ * (isPersistedReleasePlan) defaults an absent field to `true` (T15).
594
+ */
595
+ tokensAvailable: boolean;
570
596
  }
571
597
  declare function saveReleasePlan(cwd: string, plan: PersistedReleasePlan): Promise<void>;
572
598
  declare function loadReleasePlan(cwd: string): Promise<PersistedReleasePlan | null>;
@@ -591,6 +617,13 @@ interface ReleasePlan {
591
617
  input: number;
592
618
  output: number;
593
619
  };
620
+ /**
621
+ * AD-002: the logical AND of every contributing LLM call's tokensAvailable
622
+ * (version-suggestion, changelog, notes) — false if any of them didn't
623
+ * report usage. In practice always uniform within one run, since a run
624
+ * uses exactly one provider.
625
+ */
626
+ tokensAvailable: boolean;
594
627
  }
595
628
  interface ReleaseOptions {
596
629
  cwd: string;
@@ -721,7 +754,12 @@ interface FinishReleaseOptions {
721
754
  * failed strategy merge (typically gitflow's develop merge when develop has
722
755
  * advanced) surfaces as `FINISH_MERGE_CONFLICT` — the repo is left mid-merge
723
756
  * for manual recovery (`git merge --continue` then tag + push by hand) since
724
- * the plan can no longer be re-run.
757
+ * the plan can no longer be re-run. A failure in step 9 (tag creation, or a
758
+ * rejected push — typically a non-fast-forward because origin's mainBranch
759
+ * advanced, e.g. a CI bot commit, while this release was being prepared or
760
+ * finished) surfaces as `FINISH_PUSH_FAILED` with the exact fetch/merge/push
761
+ * recovery commands embedded in the message; merge (never rebase) is required
762
+ * because the tag, if already created, is pinned to the release commit's hash.
725
763
  */
726
764
  declare function finishRelease(opts: FinishReleaseOptions): Promise<void>;
727
765
  interface AbortReleaseOptions {
@@ -784,19 +822,7 @@ interface RunReleaseInProcessOptions extends PrepareReleaseOptions {
784
822
  * caller declined via `confirm`.
785
823
  */
786
824
  declare function runReleaseInProcess(opts: RunReleaseInProcessOptions): Promise<PersistedReleasePlan | null>;
787
- /**
788
- * Step factory for atomically bumping the `version` field of a single
789
- * manifest (package.json or sibling plugin.json) under a {@link Transaction}.
790
- *
791
- * `apply` reads the manifest's prior bytes (Buffer, not parsed JSON, so any
792
- * trailing newline or formatting in the on-disk file is preserved verbatim
793
- * for rollback), rewrites the `version` field in place via `writeJSON`, and
794
- * returns the captured prior bytes as the step result. `compensate` writes
795
- * those bytes back, restoring the file byte-for-byte regardless of what the
796
- * apply path produced. Steps are intended to run sequentially so ordering is
797
- * deterministic per ADR-004.
798
- */
799
- declare function writeWorkspaceVersionStep(manifestPath: string, newVersion: string): Step<Buffer>;
825
+ declare function writeWorkspaceVersionStep(manifestPath: string, newVersion: string, workspaceNames?: ReadonlySet<string>): Step<Buffer>;
800
826
  /**
801
827
  * Propagate `version` into every workspace manifest under a {@link Transaction}
802
828
  * so that a write failure on `packages[N]/package.json` reliably restores the
@@ -828,7 +854,21 @@ declare function propagateVersionToWorkspaces(cwd: string, version: string): Pro
828
854
  */
829
855
  declare function detectWorkspaceRoot(cwd: string): Promise<boolean>;
830
856
 
857
+ declare function formatTokens(tokens: {
858
+ input: number;
859
+ output: number;
860
+ }, tokensAvailable: boolean): string;
861
+
831
862
  declare function createProvider(config: ProviderConfig): LLMProvider;
863
+ /**
864
+ * The single place that turns a MergedConfig (+ optional API key) into the
865
+ * ProviderConfig createProvider() expects — narrowing the per-provider
866
+ * `models` map down to the active provider's tier block and threading every
867
+ * per-tool CLI path field through. Replaces the 8 duplicated inline
868
+ * `{ kind: config.provider, models: config.models, ... }` object literals
869
+ * that predated the per-provider models map (MDL-03, MDL-04).
870
+ */
871
+ declare function buildProviderConfig(merged: MergedConfig, apiKey?: string): ProviderConfig;
832
872
 
833
873
  declare const COMMAND_TIER_MAP: Record<string, ModelTier>;
834
874
  declare function resolveModelTier(command: string): ModelTier;
@@ -837,4 +877,4 @@ declare const SUPPORTED_COMMANDS: (keyof typeof COMMAND_TIER_MAP)[];
837
877
  declare const version: string;
838
878
  declare const __placeholder__: unique symbol;
839
879
 
840
- export { type AbortReleaseOptions, type AcquireRepoLockOptions, type ApplyCommitParams, type ApplyCommitPlanOptions, type ApplyPrOptions, type ApplyPrResult, type ApplyReleaseOptions, type BumpType, type ChangedFile, type CommitAlternatives, type CommitConvention, type CommitEntry, type CommitOptions, type CommitPlan, type CommitStepResult, type ModelConfig as ConfigModelConfig, type CreatePRParams, type CreateReleaseParams, DEFAULT_USER_CONFIG, EXIT_CODES, type FinishReleaseOptions, GitwiseError, type GitwiseErrorArgs, LLMProvider, type Language, type LoadTemplateOptions, type LockPayload, type Logger, type MergedConfig, ModelTier, type PRResult, type PersistedReleasePlan, type PrDraft, type PrOptions, type PrepareReleaseOptions, ProviderConfig, type ReleaseOptions, type ReleasePlan, type ReleaseStrategy, type ReleaseStrategyName, type RepoConfig, type ReviewFinding, type ReviewOptions, type ReviewResult, type RollbackFailure, type RollbackResult, type RunReleaseInProcessOptions, STALE_LOCK_MS, SUPPORTED_COMMANDS, type SplitMode, type Step, Transaction, type UpdatePRParams, type UserConfig, __placeholder__, abortRelease, acquireRepoLock, applyCommitPlan, applyOneCommitStep, applyPr, applyRelease, bumpVersion, commit, createProvider, createReleaseStrategy, debug, deleteReleasePlan, detectWorkspaceRoot, ensureDir, ensureGitignored, env, error, fileExists, finishRelease, getApiKey, getMergedConfig, git, github, heuristicBump, info, interpolate, isVerbose, loadAndInterpolate, loadReleasePlan, loadTemplate, parseCommitResponse, pr, prepareRelease, propagateVersionToWorkspaces, readJSON, readRepoConfig, readUserConfig, release, resolveClaudeBinary, resolveModelTier, review, runReleaseInProcess, saveReleasePlan, setVerbose, stashList, takeNamedStashStep, version, warn, wrapError, writeApiKey, writeJSON, writeUserConfig, writeWorkspaceVersionStep };
880
+ export { type AbortReleaseOptions, type AcquireRepoLockOptions, type ApplyCommitParams, type ApplyCommitPlanOptions, type ApplyPrOptions, type ApplyPrResult, type ApplyReleaseOptions, type BumpType, type ChangedFile, type CommitAlternatives, type CommitConvention, type CommitEntry, type CommitOptions, type CommitPlan, type CommitStepResult, type ModelConfig as ConfigModelConfig, type CreatePRParams, type CreateReleaseParams, DEFAULT_USER_CONFIG, EXIT_CODES, type FinishReleaseOptions, GitwiseError, type GitwiseErrorArgs, LLMProvider, type Language, type LoadTemplateOptions, type LockPayload, type Logger, type MergedConfig, ModelTier, type ModelsByProvider, type PRResult, type PersistedReleasePlan, type PrDraft, type PrOptions, type PrepareReleaseOptions, ProviderConfig, ProviderKind, type ReleaseOptions, type ReleasePlan, type ReleaseStrategy, type ReleaseStrategyName, type RepoConfig, type ReviewFinding, type ReviewOptions, type ReviewResult, type RollbackFailure, type RollbackResult, type RunReleaseInProcessOptions, STALE_LOCK_MS, SUPPORTED_COMMANDS, type SplitMode, type Step, Transaction, type UpdatePRParams, type UserConfig, __placeholder__, abortRelease, acquireRepoLock, applyCommitPlan, applyOneCommitStep, applyPr, applyRelease, buildProviderConfig, bumpVersion, commit, createProvider, createReleaseStrategy, debug, deleteReleasePlan, detectWorkspaceRoot, ensureDir, ensureGitignored, env, error, fileExists, finishRelease, formatTokens, getApiKey, getMergedConfig, git, github, heuristicBump, info, interpolate, isVerbose, loadAndInterpolate, loadReleasePlan, loadTemplate, parseCommitResponse, pr, prepareRelease, propagateVersionToWorkspaces, readJSON, readRepoConfig, readUserConfig, release, resolveClaudeBinary, resolveCodexBinary, resolveCopilotBinary, resolveKiroBinary, resolveModelTier, review, runReleaseInProcess, saveReleasePlan, setVerbose, stashList, takeNamedStashStep, version, warn, wrapError, writeApiKey, writeJSON, writeUserConfig, writeWorkspaceVersionStep };