dhis2_init_webapp
Initialize a DHIS2 web application project with proper scaffolding by specifying app name, type, and template to create structured health information system applications.
Instructions
Initialize a new DHIS2 web application project with proper scaffolding
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appName | Yes | Name of the application (e.g., "my-health-app") | |
| appTitle | Yes | Human-readable title of the application | |
| appDescription | No | Description of the application | |
| namespace | No | App namespace (defaults to appName if not provided) | |
| appType | No | Type of DHIS2 application | |
| template | No | App template to use | |
| typescript | No | Use TypeScript (default: true) | |
| pwa | No | Enable Progressive Web App features | |
| outputPath | No | Directory path where to create the app (default: current directory) |
Implementation Reference
- src/index.ts:961-971 (handler)Primary handler for the dhis2_init_webapp tool. Destructures input parameters and invokes generateWebAppInitInstructions to produce a comprehensive Markdown guide for initializing a DHIS2 web application.case 'dhis2_init_webapp': const { appName, appTitle, appDescription, namespace, appType, template, typescript, pwa, outputPath } = args as any; const initInstructions = generateWebAppInitInstructions(appName, appTitle, appDescription, { namespace, appType, template, typescript, pwa, outputPath }); return { content: [ { type: 'text', text: initInstructions, }, ], };
- src/webapp-generators.ts:6-71 (helper)Core helper function that generates detailed Markdown instructions for DHIS2 web app setup, including project structure, commands, templates, PWA config, and next steps.export function generateWebAppInitInstructions( appName: string, appTitle: string, appDescription: string, options: any = {} ): string { const { namespace, appType = 'app', template = 'basic', typescript = true, pwa = false, outputPath = './' } = options; return `# DHIS2 Web App Initialization Guide ## App Configuration - **App Name**: ${appName} - **App Title**: ${appTitle} - **Description**: ${appDescription || 'A DHIS2 web application'} - **Namespace**: ${namespace || appName} - **App Type**: ${appType} - **Template**: ${template} - **TypeScript**: ${typescript ? 'Yes' : 'No'} - **PWA Enabled**: ${pwa ? 'Yes' : 'No'} - **Output Path**: ${outputPath} ## Quick Start Commands \`\`\`bash # Initialize new DHIS2 app using App Platform npx @dhis2/cli-app-scripts init ${appName} # Navigate to project directory cd ${appName} # Install dependencies yarn install # Start development server yarn start \`\`\` ## Project Structure \`\`\` ${appName}/ ├── src/ │ ├── App.js${typescript ? 'x' : ''} │ ├── components/ │ └── index.js${typescript ? 'x' : ''} ├── public/ │ └── manifest.webapp ├── d2.config.js ├── package.json ${typescript ? '├── tsconfig.json' : ''} ${pwa ? '├── workbox.config.js' : ''} └── README.md \`\`\` ## Next Steps 1. Configure your DHIS2 instance connection 2. Set up proxy for development 3. Add CORS allowlist configuration 4. Implement your app components 5. Test with different DHIS2 versions ## Template-Specific Features ${generateTemplateFeatures(template)} ${pwa ? generatePWAConfiguration() : ''} `; }
- src/permission-system.ts:133-133 (registration)Registers permission requirement for dhis2_init_webapp tool: requires 'canConfigureApps' permission. Part of TOOL_PERMISSIONS map used for filtering tool access.['dhis2_init_webapp', 'canConfigureApps'],
- Configures dhis2_init_webapp as a trigger for the 'development-pipeline' multi-server composition workflow, enabling automated follow-up actions like git commits and notifications.triggers: ['dhis2_init_webapp'] });