Skip to content

Commit 1ecaf91

Browse files
Rename GitHub Sharing → GitHub Publishing + fix gh CLI detection
Naming: - Rename section to "🧬 GitHub Publishing" (DNA emoji for dreamweaving) - Update description: "Publish DreamSongs as static GitHub Pages sites" - Remove Windows fallback language (WSL works for full system) gh CLI Detection Fix: - Add getExtendedEnv() to include common PATH locations - Obsidian/Electron doesn't inherit full shell PATH - Now checks /opt/homebrew/bin, /usr/local/bin, ~/.local/bin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8fb7fe9 commit 1ecaf91

2 files changed

Lines changed: 34 additions & 12 deletions

File tree

src/features/github-publishing/settings-section.ts

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* GitHub Sharing Settings Section
2+
* GitHub Publishing Settings Section
33
*
4-
* Feature-owned settings UI for GitHub-based sharing (fallback when Radicle unavailable).
5-
* Rendered within the main settings panel.
4+
* Feature-owned settings UI for publishing DreamSongs to GitHub Pages.
5+
* Mirrors DreamNode repos to GitHub and creates static DreamSong sites.
66
*/
77

88
import type InterBrainPlugin from '../../main';
@@ -14,22 +14,43 @@ interface GitHubIdentity {
1414
ghVersion: string;
1515
}
1616

17+
/**
18+
* Get environment with extended PATH for gh CLI detection
19+
* Obsidian/Electron may not have the full shell PATH
20+
*/
21+
function getExtendedEnv(): Record<string, string> {
22+
const nodeProcess = (globalThis as any).process;
23+
const env = { ...nodeProcess?.env };
24+
25+
// Add common gh install locations to PATH
26+
const extraPaths = [
27+
'/opt/homebrew/bin', // macOS ARM Homebrew
28+
'/usr/local/bin', // macOS Intel Homebrew / Linux
29+
'/usr/bin', // System
30+
`${env.HOME}/.local/bin`, // Linux user installs
31+
].filter(Boolean);
32+
33+
env.PATH = [...extraPaths, env.PATH].join(':');
34+
return env;
35+
}
36+
1737
/**
1838
* Get GitHub identity (username and gh version)
1939
*/
2040
async function getGitHubIdentity(): Promise<GitHubIdentity | null> {
2141
const { exec } = require('child_process');
2242
const { promisify } = require('util');
2343
const execAsync = promisify(exec);
44+
const env = getExtendedEnv();
2445

2546
try {
2647
// Get gh version
27-
const versionResult = await execAsync('gh --version');
48+
const versionResult = await execAsync('gh --version', { env });
2849
const versionMatch = versionResult.stdout.match(/gh version ([\d.]+)/);
2950
const ghVersion = versionMatch ? versionMatch[1] : 'unknown';
3051

3152
// Get authenticated username via gh api
32-
const userResult = await execAsync('gh api user --jq .login');
53+
const userResult = await execAsync('gh api user --jq .login', { env });
3354
const username = userResult.stdout.trim();
3455

3556
if (username) {
@@ -48,12 +69,13 @@ export async function checkGitHubStatus(): Promise<FeatureStatus> {
4869
const { exec } = require('child_process');
4970
const { promisify } = require('util');
5071
const execAsync = promisify(exec);
72+
const env = getExtendedEnv();
5173

5274
try {
5375
// Step 1: Check if gh CLI is installed
5476
let ghVersion: string | null = null;
5577
try {
56-
const versionResult = await execAsync('gh --version');
78+
const versionResult = await execAsync('gh --version', { env });
5779
const versionMatch = versionResult.stdout.match(/gh version ([\d.]+)/);
5880
ghVersion = versionMatch ? versionMatch[1] : 'installed';
5981
} catch {
@@ -68,7 +90,7 @@ export async function checkGitHubStatus(): Promise<FeatureStatus> {
6890

6991
// Step 2: Check if authenticated
7092
try {
71-
const userResult = await execAsync('gh api user --jq .login');
93+
const userResult = await execAsync('gh api user --jq .login', { env });
7294
const username = userResult.stdout.trim();
7395

7496
if (username) {
@@ -108,22 +130,22 @@ export async function checkGitHubStatus(): Promise<FeatureStatus> {
108130
}
109131

110132
/**
111-
* Create the GitHub sharing settings section
133+
* Create the GitHub publishing settings section
112134
*/
113135
export function createGitHubSettingsSection(
114136
containerEl: HTMLElement,
115137
_plugin: InterBrainPlugin,
116138
status: FeatureStatus | undefined
117139
): void {
118-
const header = containerEl.createEl('h2', { text: '📤 GitHub Sharing (Fallback)' });
140+
const header = containerEl.createEl('h2', { text: '🧬 GitHub Publishing' });
119141
header.id = 'github-section';
120142

121143
if (status) {
122144
createStatusDisplay(containerEl, status);
123145
}
124146

125147
containerEl.createEl('p', {
126-
text: 'GitHub is used automatically when Radicle is unavailable or on Windows. Creates GitHub repositories and GitHub Pages sites for DreamNodes.',
148+
text: 'Publish DreamSongs as static GitHub Pages sites. Also mirrors DreamNode repositories to GitHub as open source.',
127149
cls: 'setting-item-description'
128150
});
129151

src/features/settings/settings-tab.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class InterBrainSettingTab extends PluginSettingTab {
124124
);
125125

126126
// ============================================================
127-
// GitHub Sharing Section (feature-owned)
127+
// GitHub Publishing Section (feature-owned)
128128
// ============================================================
129129
createGitHubSettingsSection(
130130
containerEl,
@@ -195,7 +195,7 @@ export class InterBrainSettingTab extends PluginSettingTab {
195195
{ name: 'Transcription', status: this.systemStatus.transcription, sectionId: 'transcription-section' },
196196
{ name: 'Web Link Analyzer', status: this.systemStatus.webLinkAnalyzer, sectionId: 'web-link-analyzer-section' },
197197
{ name: 'Radicle Network', status: this.systemStatus.radicle, sectionId: 'radicle-section' },
198-
{ name: 'GitHub Sharing', status: this.systemStatus.github, sectionId: 'github-section' },
198+
{ name: 'GitHub Publishing', status: this.systemStatus.github, sectionId: 'github-section' },
199199
{ name: 'Claude API', status: this.systemStatus.claudeApi, sectionId: 'ai-section' }
200200
];
201201

0 commit comments

Comments
 (0)