@freetison/git-super 0.2.0 → 0.2.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/bin/git-super.mjs CHANGED
File without changes
@@ -3,7 +3,7 @@
3
3
  * Handles auth login, logout, status, and context management
4
4
  */
5
5
 
6
- import { readFileSync, writeFileSync } from 'node:fs';
6
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
7
7
  import { getConfigPath, listOrganizations, loadConfig } from '../config/config-loader.mjs';
8
8
  import { ProviderRegistry } from '../providers/provider-registry.mjs';
9
9
  import { openBrowser } from '../auth/oauth-flows.mjs';
@@ -304,11 +304,29 @@ function handleContextSwitch(args) {
304
304
 
305
305
  try {
306
306
  const configPath = getConfigPath();
307
+
308
+ // Create initial config if it doesn't exist
309
+ if (!existsSync(configPath)) {
310
+ const initialConfig = {
311
+ activeOrg: 'local',
312
+ organizations: {
313
+ local: {
314
+ name: 'Local Development',
315
+ aiProvider: 'ollama',
316
+ aiModel: 'mistral:latest',
317
+ ollamaUrl: 'http://localhost:11434',
318
+ },
319
+ },
320
+ };
321
+ writeFileSync(configPath, JSON.stringify(initialConfig, null, 2));
322
+ log(`\nšŸ“ Created initial configuration at: ${configPath}`, 'cyan');
323
+ }
324
+
307
325
  const content = readFileSync(configPath, 'utf-8');
308
326
  const config = JSON.parse(content);
309
327
 
310
328
  if (!config.organizations || !config.organizations[targetOrg]) {
311
- throw new Error(`Organization '${targetOrg}' not found`);
329
+ throw new Error(`Organization '${targetOrg}' not found. Run 'git super context list' to see available organizations.`);
312
330
  }
313
331
 
314
332
  // Update active org
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freetison/git-super",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "AI-powered git commits with OAuth/SSO support - works with any repo, supports enterprise authentication",
5
5
  "author": "Angel Sola",
6
6
  "license": "MIT",
@@ -13,12 +13,6 @@
13
13
  "lib",
14
14
  "README.md"
15
15
  ],
16
- "scripts": {
17
- "test": "vitest run",
18
- "test:watch": "vitest",
19
- "test:coverage": "vitest run --coverage",
20
- "postinstall": "echo 'šŸ’” Run: git config --global alias.super \"!git-super\"'"
21
- },
22
16
  "keywords": [
23
17
  "git",
24
18
  "ai",
@@ -55,5 +49,11 @@
55
49
  "type": "git",
56
50
  "url": "https://github.com/freetison/git-super",
57
51
  "directory": ""
52
+ },
53
+ "scripts": {
54
+ "test": "vitest run",
55
+ "test:watch": "vitest",
56
+ "test:coverage": "vitest run --coverage",
57
+ "postinstall": "echo 'šŸ’” Run: git config --global alias.super \"!git-super\"'"
58
58
  }
59
- }
59
+ }