Bash Refactor Plan 1
Scope: Create the Write_Typescript skill and forge-bash project scaffold
Spec: Bash Refactor Spec
Prior plan: None
Task 1 — Create Write_Typescript Skill
Spec Section 3: “A new skill at
Forge/Skills/Write_Typescript/SKILL.mdcaptures the TypeScript conventions from Section 1.”
Create the skill file at Forge/Skills/Write_Typescript/SKILL.md with these conventions:
- Runtime & build: esbuild bundles
src/index.tstodist/index.js— a single-file ESM bundle executed withnode dist/index.js. Nonode_modulesat runtime. - Module system: ESM only (
"type": "module"inpackage.json). - MCP SDK:
McpServerfrom@modelcontextprotocol/sdk/server/mcp.js,StdioServerTransportfrom@modelcontextprotocol/sdk/server/stdio.js. - Schema validation: Zod via
zod/v4import. - Project structure:
src/index.tsentry,dist/output (gitignored),package.json,tsconfig.json. - Build command:
esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js - Type checking:
tsc --noEmit(separate from build; esbuild doesn’t type-check). - Error handling: Tools return
{ content: [{ type: 'text', text: error }], isError: true }. - Logging:
console.error()for debug/diagnostic output (stdout is reserved for MCP protocol). - Naming: kebab-case for directories and file names; PascalCase for TypeScript types/interfaces.
- Railway env: Shared utility for reading
/proc/1/environto inject Railway environment variables.
The skill follows the standard format: procedure outline and essential rules in SKILL.md (≤500 words). No references/ directory needed unless extended examples are required later.
Add sidebar entry using the Update_Sidebar skill. Build to verify.
Task 2 — Create forge-bash Project Scaffold
Spec Sections 1–2: Project layout and TypeScript implementation standard.
Create the directory structure at Forge/Configs-debian/mcp-servers/forge-bash/:
package.json contents:
"name": "forge-bash","version": "1.0.0","type": "module"- Scripts:
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js","typecheck": "tsc --noEmit" - Dependencies:
@modelcontextprotocol/sdk,zod,@cfworker/json-schema(peer dep of SDK) - Dev dependencies:
esbuild,typescript,@types/node
tsconfig.json contents:
"target": "ES2022","module": "NodeNext","moduleResolution": "NodeNext""strict": true,"outDir": "dist","rootDir": "src""include": ["src"]
README.md: Brief description of forge-bash, build instructions, and link to the Spec.
src/index.ts: Stub — just the McpServer setup with a placeholder run tool that returns “not yet implemented”. This validates the build pipeline works end-to-end:
After creating files, install dependencies and build:
cd Forge/Configs-debian/mcp-servers/forge-bash && npm installnpm run buildnpm run typecheck
Add dist/ to .gitignore (append to repo root .gitignore if not already present).
No sidebar entry needed for non-markdown source files (file-view pages are auto-generated).