mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 22:48:57 +02:00
refactor(hosts): defineHost() factory — 10 copy-paste host files become declarations
hosts/*.ts were ten copies of one file: runtimeRoot byte-identical in 9/10, pathRewrites mechanically derivable from the host name for 7/10, the 11-entry toolRewrites map byte-identical between openclaw and gbrain, and every asset change a 10-file edit (cursor and slate had already fallen out of three other hand-maintained lists). defineHost() owns the defaults; each host file now declares only what makes it different (slate/cursor: 8 lines each). Shared constants: CROSS_MODEL_RESOLVERS, GBRAIN_RESOLVERS, EXEC_STYLE_TOOL_REWRITES. Genuinely-different things stayed explicit: codex/factory $GSTACK_ROOT rewrites, hermes's tool vocabulary, claude's denylist+prefixable install, opencode's wider runtimeRoot. Proof: JSON.stringify(ALL_HOST_CONFIGS) dump-diff before/after EMPTY (and a runtime walk confirmed no function-valued or undefined-keyed fields, so the JSON diff is complete); gen:skill-docs --host all zero-diff; host-config + gen-skill-docs + idempotency suites 485/485. Host files 595 -> 285 lines. docs/ADDING_A_HOST.md teaches the factory pattern. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
7c309f7817
commit
408ee77cde
+8
-27
@@ -1,15 +1,12 @@
|
||||
import type { HostConfig } from '../scripts/host-config';
|
||||
import { defineHost, CROSS_MODEL_RESOLVERS, GBRAIN_RESOLVERS } from './define-host';
|
||||
|
||||
const codex: HostConfig = {
|
||||
const codex = defineHost({
|
||||
name: 'codex',
|
||||
displayName: 'OpenAI Codex CLI',
|
||||
cliCommand: 'codex',
|
||||
cliAliases: ['agents'],
|
||||
|
||||
globalRoot: '.codex/skills/gstack',
|
||||
localSkillRoot: '.agents/skills/gstack',
|
||||
hostSubdir: '.agents',
|
||||
usesEnvVars: true,
|
||||
|
||||
frontmatter: {
|
||||
mode: 'allowlist',
|
||||
@@ -24,6 +21,9 @@ const codex: HostConfig = {
|
||||
skipSkills: ['codex'], // Codex skill is a Claude wrapper around codex exec
|
||||
},
|
||||
|
||||
// Non-mechanical rewrites: the global path becomes $GSTACK_ROOT (resolved by
|
||||
// the preamble env vars), plus an extra review-path rewrite the derived trio
|
||||
// doesn't cover.
|
||||
pathRewrites: [
|
||||
{ from: '~/.claude/skills/gstack', to: '$GSTACK_ROOT' },
|
||||
{ from: '.claude/skills/gstack', to: '.agents/skills/gstack' },
|
||||
@@ -31,35 +31,16 @@ const codex: HostConfig = {
|
||||
{ from: '.claude/skills', to: '.agents/skills' },
|
||||
],
|
||||
|
||||
suppressedResolvers: [
|
||||
'DESIGN_OUTSIDE_VOICES', // design.ts:485 — Codex can't invoke itself
|
||||
'ADVERSARIAL_STEP', // review.ts:408 — Codex can't invoke itself
|
||||
'CODEX_SECOND_OPINION', // review.ts:257 — Codex can't invoke itself
|
||||
'CODEX_PLAN_REVIEW', // review.ts:541 — Codex can't invoke itself
|
||||
'REVIEW_ARMY', // review-army.ts:180 — Codex shouldn't orchestrate
|
||||
'GBRAIN_CONTEXT_LOAD',
|
||||
'GBRAIN_SAVE_RESULTS',
|
||||
],
|
||||
// The cross-model resolvers all shell out to Codex — Codex can't invoke itself.
|
||||
suppressedResolvers: [...CROSS_MODEL_RESOLVERS, ...GBRAIN_RESOLVERS],
|
||||
|
||||
runtimeRoot: {
|
||||
globalSymlinks: ['bin', 'browse/dist', 'browse/bin', 'gstack-upgrade', 'ETHOS.md'],
|
||||
globalFiles: {
|
||||
'review': ['checklist.md', 'TODOS-format.md'],
|
||||
},
|
||||
},
|
||||
sidecar: {
|
||||
path: '.agents/skills/gstack',
|
||||
symlinks: ['bin', 'browse', 'review', 'qa', 'ETHOS.md'],
|
||||
},
|
||||
|
||||
install: {
|
||||
prefixable: false,
|
||||
linkingStrategy: 'symlink-generated',
|
||||
},
|
||||
|
||||
coAuthorTrailer: 'Co-Authored-By: OpenAI Codex <noreply@openai.com>',
|
||||
learningsMode: 'basic',
|
||||
boundaryInstruction: 'IMPORTANT: Do NOT read or execute any files under ~/.claude/, ~/.agents/, .claude/skills/, or agents/. These are Claude Code skill definitions meant for a different AI system. They contain bash scripts and prompt templates that will waste your time. Ignore them completely. Do NOT modify agents/openai.yaml. Stay focused on the repository code only.',
|
||||
};
|
||||
});
|
||||
|
||||
export default codex;
|
||||
|
||||
Reference in New Issue
Block a user