gityo 0.0.0 → 1.0.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # gityo
2
2
 
3
- `gityo` is a CLI that helps you stage changes, write or generate a commit message, commit, and optionally run a post-commit git action.
3
+ `gityo` is a CLI that writes or generates a commit message for your changes, stages them, creates the commit, and optionally runs a post-commit git action.
4
4
 
5
5
  It is built for people who want a faster commit flow without turning git into a wall of commands.
6
6
 
@@ -18,9 +18,8 @@ npx gityo
18
18
 
19
19
  ## What it does
20
20
 
21
- - lets you choose which changed files to stage
22
- - lets you write your own commit message
23
- - can generate a commit message with AI
21
+ - writes or generates a commit message based on your current git state
22
+ - stages everything when nothing is staged yet
24
23
  - creates the commit for you
25
24
  - can run a post-commit action like `git push`
26
25
 
@@ -34,48 +33,87 @@ gityo
34
33
 
35
34
  Typical flow:
36
35
 
37
- 1. Pick files to stage
38
- 2. Type a commit message or generate one
36
+ 1. Write a commit message or generate one (from staged files if any, otherwise all changes)
37
+ 2. Stage everything if nothing is staged
39
38
  3. Create the commit
40
39
  4. Optionally run the configured post-commit action
41
40
 
41
+ If you already staged files before running `gityo`, only those are used for the message and committed — your other changes are left alone.
42
+
42
43
  ## Common commands
43
44
 
44
45
  ```bash
45
46
  gityo
46
- gityo --stage
47
47
  gityo --generate
48
+ gityo --model fast --generate
48
49
  gityo --message "fix login redirect bug"
49
50
  gityo --yolo
50
51
  ```
51
52
 
52
53
  ## AI setup
53
54
 
54
- If you want AI-generated commit messages, set a model once and reuse it:
55
+ A configured model is required — gityo won't run without one, and the API key must be resolvable from your environment even when you pass `--message`. Models live in a `models` map in your config file. Each key is a name you can pick with `--model`; the `default` key is used when you don't pass `--model`:
55
56
 
56
- ```bash
57
- gityo config set model openai gpt-4.1 YOUR_API_KEY
57
+ ```json
58
+ {
59
+ "$schema": "https://github.com/NazmusSayad/gityo/raw/refs/heads/schema/schema.json",
60
+ "models": {
61
+ "default": {
62
+ "npm": "@openrouter/ai-sdk-provider",
63
+ "apiKeyEnv": "OPENROUTER_API_KEY",
64
+ "model": "deepseek/deepseek-chat"
65
+ },
66
+ "fast": {
67
+ "npm": "@ai-sdk/openai",
68
+ "apiKeyEnv": "OPENAI_API_KEY",
69
+ "model": "gpt-4.1-mini"
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ Each model config:
76
+
77
+ - `npm` — the provider package, one of 30 supported AI SDK providers (autocompleted by the schema). Optional; defaults to `@ai-sdk/openai-compatible`
78
+ - `apiKeyEnv` — environment variable(s) holding the API key, tried in order
79
+ - `model` — the model ID
80
+ - `apiUrl` — optional base URL (required when `npm` is `@ai-sdk/openai-compatible`)
81
+ - `options` — extra provider options passed to the provider factory
82
+
83
+ `apiKeyEnv` accepts a single variable name or an array of names:
84
+
85
+ ```json
86
+ "apiKeyEnv": ["GITYO_API_KEY", "OPENROUTER_API_KEY"]
87
+ ```
88
+
89
+ OpenAI-compatible example without `npm`:
90
+
91
+ ```json
92
+ "local": {
93
+ "apiKeyEnv": "MY_API_KEY",
94
+ "model": "my-model",
95
+ "apiUrl": "https://my-endpoint.example.com/v1"
96
+ }
58
97
  ```
59
98
 
60
99
  Then use:
61
100
 
62
101
  ```bash
63
102
  gityo --generate
103
+ gityo --model fast --generate
64
104
  ```
65
105
 
66
- Supported providers include OpenAI, Anthropic, Google, OpenRouter, and compatible custom endpoints.
106
+ Providers are the official Vercel AI SDK packages: `@ai-sdk/openai`, `@ai-sdk/openai-compatible`, `@ai-sdk/anthropic`, `@ai-sdk/google`, `@ai-sdk/xai`, `@ai-sdk/azure`, `@ai-sdk/amazon-bedrock`, `@ai-sdk/groq`, `@ai-sdk/mistral`, `@ai-sdk/deepseek`, `@ai-sdk/togetherai`, `@ai-sdk/fireworks`, `@ai-sdk/perplexity`, `@ai-sdk/cohere`, `@ai-sdk/cerebras`, `@ai-sdk/luma`, `@ai-sdk/fal`, `@ai-sdk/deepinfra`, `@ai-sdk/google-vertex`, `@openrouter/ai-sdk-provider`, plus `ai-sdk-ollama`, `ollama-ai-provider-v2`, `workers-ai-provider`, `zhipu-ai-provider`, `sambanova-ai-provider`, `vercel-minimax-ai-provider`, `@aihubmix/ai-sdk-provider`, `ai-gateway-provider`, `@friendliai/ai-provider`, `@helicone/ai-sdk-provider`, and `ai-sdk-provider-opencode-sdk`.
67
107
 
68
108
  ## Config
69
109
 
70
- View your current config:
110
+ Show where your config files live:
71
111
 
72
112
  ```bash
73
113
  gityo config
74
114
  ```
75
115
 
76
- You can also write config manually.
77
-
78
- Project config goes in:
116
+ Config is edited by hand in a JSON file. Project config goes in:
79
117
 
80
118
  ```text
81
119
  .gityo.config.json
@@ -95,7 +133,7 @@ You can also add repo-specific writing instructions in:
95
133
 
96
134
  That file is useful when you want commit messages in a certain tone or format for one project.
97
135
 
98
- If you want editor autocomplete and validation, use this schema:
136
+ Set `$schema` in your config file for editor autocomplete and validation:
99
137
 
100
138
  ```text
101
139
  https://github.com/NazmusSayad/gityo/raw/refs/heads/schema/schema.json
@@ -106,9 +144,12 @@ Example:
106
144
  ```json
107
145
  {
108
146
  "$schema": "https://github.com/NazmusSayad/gityo/raw/refs/heads/schema/schema.json",
109
- "model": {
110
- "provider": "openai",
111
- "name": "gpt-4.1"
147
+ "models": {
148
+ "default": {
149
+ "npm": "@ai-sdk/openai",
150
+ "apiKeyEnv": "OPENAI_API_KEY",
151
+ "model": "gpt-4.1"
152
+ }
112
153
  },
113
154
  "autoAcceptMessage": false,
114
155
  "postCommand": "push",
@@ -131,14 +172,6 @@ Priority is simple:
131
172
  - `.gityo.config.json` for project config
132
173
  - `~/.config/gityo.json` for your defaults
133
174
 
134
- A few useful examples:
135
-
136
- ```bash
137
- gityo config set postCommand push
138
- gityo config set autoRunPostCommand true
139
- gityo config set autoAcceptCommitMessage true
140
- ```
141
-
142
175
  ## Good for
143
176
 
144
177
  - quick everyday commits
@@ -149,4 +182,6 @@ gityo config set autoAcceptCommitMessage true
149
182
 
150
183
  - run it inside a git repo
151
184
  - if there are no changed files, it exits early
185
+ - if anything is already staged, the message is generated from staged files only and those are committed as-is
186
+ - if nothing is staged, the message is generated from all changes and everything is staged before committing
152
187
  - `--yolo` is the fastest mode and skips the usual prompts
@@ -0,0 +1,35 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
9
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
10
+ var __export = (all) => {
11
+ let target = {};
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ return target;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+ var __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
34
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
35
+ export { __toCommonJS as a, __require as i, __esmMin as n, __toDynamicImportESM as o, __export as r, __toESM as s, __commonJSMin as t };
@@ -0,0 +1,43 @@
1
+ import { n as __esmMin } from "./chunk-CjLZ-eKX.js";
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
5
+ return typeof o$1;
6
+ } : function(o$1) {
7
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
8
+ }, _typeof(o);
9
+ }
10
+ var init_typeof = __esmMin((() => {}));
11
+ function toPrimitive(t, r) {
12
+ if ("object" != _typeof(t) || !t) return t;
13
+ var e = t[Symbol.toPrimitive];
14
+ if (void 0 !== e) {
15
+ var i = e.call(t, r || "default");
16
+ if ("object" != _typeof(i)) return i;
17
+ throw new TypeError("@@toPrimitive must return a primitive value.");
18
+ }
19
+ return ("string" === r ? String : Number)(t);
20
+ }
21
+ var init_toPrimitive = __esmMin((() => {
22
+ init_typeof();
23
+ }));
24
+ function toPropertyKey(t) {
25
+ var i = toPrimitive(t, "string");
26
+ return "symbol" == _typeof(i) ? i : i + "";
27
+ }
28
+ var init_toPropertyKey = __esmMin((() => {
29
+ init_typeof();
30
+ init_toPrimitive();
31
+ }));
32
+ function _defineProperty(e, r, t) {
33
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
34
+ value: t,
35
+ enumerable: !0,
36
+ configurable: !0,
37
+ writable: !0
38
+ }) : e[r] = t, e;
39
+ }
40
+ var init_defineProperty = __esmMin((() => {
41
+ init_toPropertyKey();
42
+ }));
43
+ export { init_defineProperty as n, _defineProperty as t };