mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-06 21:46:40 +02:00
Merge remote-tracking branch 'origin/main' into garrytan/learning-phase-2.5-clean
# Conflicts: # CHANGELOG.md # VERSION
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { TemplateContext } from './types';
|
||||
import { getHostConfig } from '../../hosts/index';
|
||||
|
||||
/**
|
||||
* Preamble architecture — why every skill needs this
|
||||
@@ -13,10 +14,10 @@ import type { TemplateContext } from './types';
|
||||
*/
|
||||
|
||||
function generatePreambleBash(ctx: TemplateContext): string {
|
||||
const hostConfigDir: Record<string, string> = { codex: '.codex', factory: '.factory' };
|
||||
const runtimeRoot = (ctx.host !== 'claude')
|
||||
const hostConfig = getHostConfig(ctx.host);
|
||||
const runtimeRoot = hostConfig.usesEnvVars
|
||||
? `_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
GSTACK_ROOT="$HOME/${hostConfigDir[ctx.host]}/skills/gstack"
|
||||
GSTACK_ROOT="$HOME/${hostConfig.globalRoot}"
|
||||
[ -n "$_ROOT" ] && [ -d "$_ROOT/${ctx.paths.localSkillRoot}" ] && GSTACK_ROOT="$_ROOT/${ctx.paths.localSkillRoot}"
|
||||
GSTACK_BIN="$GSTACK_ROOT/bin"
|
||||
GSTACK_BROWSE="$GSTACK_ROOT/browse/dist"
|
||||
|
||||
+39
-24
@@ -1,4 +1,11 @@
|
||||
export type Host = 'claude' | 'codex' | 'factory';
|
||||
import { ALL_HOST_CONFIGS } from '../../hosts/index';
|
||||
|
||||
/**
|
||||
* Host type — derived from host configs in hosts/*.ts.
|
||||
* Adding a new host: create hosts/myhost.ts + add to hosts/index.ts.
|
||||
* Do NOT hardcode host names here.
|
||||
*/
|
||||
export type Host = (typeof ALL_HOST_CONFIGS)[number]['name'];
|
||||
|
||||
export interface HostPaths {
|
||||
skillRoot: string;
|
||||
@@ -8,29 +15,37 @@ export interface HostPaths {
|
||||
designDir: string;
|
||||
}
|
||||
|
||||
export const HOST_PATHS: Record<Host, HostPaths> = {
|
||||
claude: {
|
||||
skillRoot: '~/.claude/skills/gstack',
|
||||
localSkillRoot: '.claude/skills/gstack',
|
||||
binDir: '~/.claude/skills/gstack/bin',
|
||||
browseDir: '~/.claude/skills/gstack/browse/dist',
|
||||
designDir: '~/.claude/skills/gstack/design/dist',
|
||||
},
|
||||
codex: {
|
||||
skillRoot: '$GSTACK_ROOT',
|
||||
localSkillRoot: '.agents/skills/gstack',
|
||||
binDir: '$GSTACK_BIN',
|
||||
browseDir: '$GSTACK_BROWSE',
|
||||
designDir: '$GSTACK_DESIGN',
|
||||
},
|
||||
factory: {
|
||||
skillRoot: '$GSTACK_ROOT',
|
||||
localSkillRoot: '.factory/skills/gstack',
|
||||
binDir: '$GSTACK_BIN',
|
||||
browseDir: '$GSTACK_BROWSE',
|
||||
designDir: '$GSTACK_DESIGN',
|
||||
},
|
||||
};
|
||||
/**
|
||||
* HOST_PATHS — derived from host configs.
|
||||
* Each config's globalRoot/localSkillRoot determines the path structure.
|
||||
* Non-Claude hosts use $GSTACK_ROOT env vars (set by preamble).
|
||||
*/
|
||||
function buildHostPaths(): Record<string, HostPaths> {
|
||||
const paths: Record<string, HostPaths> = {};
|
||||
for (const config of ALL_HOST_CONFIGS) {
|
||||
if (config.usesEnvVars) {
|
||||
paths[config.name] = {
|
||||
skillRoot: '$GSTACK_ROOT',
|
||||
localSkillRoot: config.localSkillRoot,
|
||||
binDir: '$GSTACK_BIN',
|
||||
browseDir: '$GSTACK_BROWSE',
|
||||
designDir: '$GSTACK_DESIGN',
|
||||
};
|
||||
} else {
|
||||
const root = `~/${config.globalRoot}`;
|
||||
paths[config.name] = {
|
||||
skillRoot: root,
|
||||
localSkillRoot: config.localSkillRoot,
|
||||
binDir: `${root}/bin`,
|
||||
browseDir: `${root}/browse/dist`,
|
||||
designDir: `${root}/design/dist`,
|
||||
};
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
export const HOST_PATHS: Record<string, HostPaths> = buildHostPaths();
|
||||
|
||||
export interface TemplateContext {
|
||||
skillName: string;
|
||||
|
||||
@@ -367,13 +367,9 @@ Minimum 0 per category.
|
||||
}
|
||||
|
||||
export function generateCoAuthorTrailer(ctx: TemplateContext): string {
|
||||
if (ctx.host === 'codex') {
|
||||
return 'Co-Authored-By: OpenAI Codex <noreply@openai.com>';
|
||||
}
|
||||
if (ctx.host === 'factory') {
|
||||
return 'Co-Authored-By: Factory Droid <droid@users.noreply.github.com>';
|
||||
}
|
||||
return 'Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>';
|
||||
const { getHostConfig } = require('../../hosts/index');
|
||||
const hostConfig = getHostConfig(ctx.host);
|
||||
return hostConfig.coAuthorTrailer || 'Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>';
|
||||
}
|
||||
|
||||
export function generateChangelogWorkflow(_ctx: TemplateContext): string {
|
||||
|
||||
Reference in New Issue
Block a user