workspai 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +624 -0
- package/contracts/agent-customization-pack.v1.json +229 -0
- package/contracts/analyze-last-run.v1.json +106 -0
- package/contracts/artifact-remediation-plan.v1.json +163 -0
- package/contracts/backend-import-stack-parity.snapshot.json +37 -0
- package/contracts/cli-log-event.v1.json +51 -0
- package/contracts/create-planner-capabilities.v1.json +251 -0
- package/contracts/doctor-project-evidence.v1.json +304 -0
- package/contracts/doctor-remediation-plan.v1.json +496 -0
- package/contracts/doctor-workspace-evidence.v1.json +315 -0
- package/contracts/extension-cli-compatibility.v1.json +26 -0
- package/contracts/infra-stack.v1.json +305 -0
- package/contracts/module-layout.v1.json +34 -0
- package/contracts/module-support.v1.json +20 -0
- package/contracts/pipeline-last-run.v1.json +80 -0
- package/contracts/release-readiness.v1.json +60 -0
- package/contracts/runtime-command-surface.v1.json +364 -0
- package/contracts/workspace-intelligence/agent-action-outcome.v1.json +38 -0
- package/contracts/workspace-intelligence/blocker-resolution.v1.json +65 -0
- package/contracts/workspace-intelligence/doctor-fix-result.v1.json +44 -0
- package/contracts/workspace-intelligence/fact-freshness.v1.json +58 -0
- package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +115 -0
- package/contracts/workspace-intelligence/workspace-context.v1.json +142 -0
- package/contracts/workspace-intelligence/workspace-contract-verify.v1.json +51 -0
- package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +152 -0
- package/contracts/workspace-intelligence/workspace-explain.v1.json +31 -0
- package/contracts/workspace-intelligence/workspace-impact.v1.json +114 -0
- package/contracts/workspace-intelligence/workspace-intelligence-history.v1.json +40 -0
- package/contracts/workspace-intelligence/workspace-model-diff.v1.json +105 -0
- package/contracts/workspace-intelligence/workspace-model-snapshot.v1.json +36 -0
- package/contracts/workspace-intelligence/workspace-model.v1.json +135 -0
- package/contracts/workspace-intelligence/workspace-operational-skill.v1.json +37 -0
- package/contracts/workspace-intelligence/workspace-skills-index.v1.json +27 -0
- package/contracts/workspace-intelligence/workspace-verify.v1.json +213 -0
- package/contracts/workspace-registry.v1.json +83 -0
- package/contracts/workspace-run-last.v1.json +112 -0
- package/data/modules-embeddings.json +16953 -0
- package/dist/analyze-5BU4QIPK.js +1 -0
- package/dist/artifact-remediation-plan-5GJWPPRS.js +3 -0
- package/dist/autopilot-release-QYUOVB26.js +1 -0
- package/dist/chunk-22DT744Z.js +1 -0
- package/dist/chunk-2E6WGUN6.js +1 -0
- package/dist/chunk-2FIX2MDC.js +1 -0
- package/dist/chunk-3KXW53QI.js +1 -0
- package/dist/chunk-3ZK2GU7C.js +1 -0
- package/dist/chunk-4KUIFXHM.js +5 -0
- package/dist/chunk-54XJNLYC.js +13 -0
- package/dist/chunk-5SWNSJGW.js +1 -0
- package/dist/chunk-5XATWNME.js +1 -0
- package/dist/chunk-753LOKFZ.js +2 -0
- package/dist/chunk-7YHK5NM3.js +2 -0
- package/dist/chunk-A5FBGRJA.js +1 -0
- package/dist/chunk-AAKUNWPR.js +78 -0
- package/dist/chunk-AFSZHLQT.js +1 -0
- package/dist/chunk-AQ4XZZC6.js +1 -0
- package/dist/chunk-CVTCPPEF.js +1 -0
- package/dist/chunk-DNAY5ALC.js +1 -0
- package/dist/chunk-EWYYLJQY.js +2 -0
- package/dist/chunk-GSWPGELT.js +2 -0
- package/dist/chunk-GZTYAEWX.js +1 -0
- package/dist/chunk-HTYMXMQM.js +1 -0
- package/dist/chunk-IBJEQHJR.js +205 -0
- package/dist/chunk-ICGWHIMK.js +1 -0
- package/dist/chunk-JEI6BTZI.js +3 -0
- package/dist/chunk-JHC6SCJC.js +1 -0
- package/dist/chunk-LO4C4VXR.js +4 -0
- package/dist/chunk-LPZFK3Y6.js +920 -0
- package/dist/chunk-LUP4U6EE.js +1 -0
- package/dist/chunk-LYC6AIF2.js +2 -0
- package/dist/chunk-LZQNVH7D.js +1 -0
- package/dist/chunk-NAAQMSO3.js +1 -0
- package/dist/chunk-NFUXULIF.js +1 -0
- package/dist/chunk-OCGZNSOE.js +1 -0
- package/dist/chunk-OJEWQO3Z.js +33 -0
- package/dist/chunk-OL64GWQC.js +9 -0
- package/dist/chunk-PI5KUXDA.js +7 -0
- package/dist/chunk-PYCJWW4B.js +1 -0
- package/dist/chunk-RE773WOX.js +13 -0
- package/dist/chunk-RO73VVHW.js +2 -0
- package/dist/chunk-S5KTATOU.js +1 -0
- package/dist/chunk-SI3AQKIP.js +1 -0
- package/dist/chunk-T3GJ7YVG.js +1 -0
- package/dist/chunk-T6OR6YOI.js +2 -0
- package/dist/chunk-VRDF2J46.js +653 -0
- package/dist/chunk-VZKSNUEE.js +2 -0
- package/dist/chunk-WU4ZRRA5.js +4 -0
- package/dist/chunk-XEJD4KCV.js +33 -0
- package/dist/chunk-XZGVNGRB.js +1 -0
- package/dist/chunk-Y45WZR5N.js +5 -0
- package/dist/create-WRZO4HK2.js +1 -0
- package/dist/demo-kit-AJ5LIM5G.js +149 -0
- package/dist/doctor-MF3M3FS3.js +1 -0
- package/dist/dotnet-webapi-clean-IPY3MCGQ.js +425 -0
- package/dist/gofiber-standard-N5N3QGH3.js +1397 -0
- package/dist/gogin-standard-LAWQTBWL.js +1459 -0
- package/dist/imported-projects-registry-FOIE27WT.js +1 -0
- package/dist/index.d.ts +141 -0
- package/dist/index.js +454 -0
- package/dist/managed-agent-markers-AXUM75OE.js +8 -0
- package/dist/module-layout-NZ43RSC5.js +1 -0
- package/dist/pipeline-QCUHFWDY.js +5 -0
- package/dist/platform-capabilities-XAVU4HSM.js +1 -0
- package/dist/pythonRapidkitExec-3L3XJBSY.js +1 -0
- package/dist/springboot-standard-OZYF7ZM7.js +697 -0
- package/dist/workspace-PR6VZRBG.js +1 -0
- package/dist/workspace-agent-sync-KTYF3HQR.js +1 -0
- package/dist/workspace-archive-GCZNI44O.js +3 -0
- package/dist/workspace-context-QUTOP2XV.js +1 -0
- package/dist/workspace-contract-XUGMCUSQ.js +1 -0
- package/dist/workspace-explain-JEONEGZZ.js +1 -0
- package/dist/workspace-explain-contract-DNS2YEL7.js +1 -0
- package/dist/workspace-feedback-R6H4UFZB.js +1 -0
- package/dist/workspace-foundation-KGSV4E6D.js +1 -0
- package/dist/workspace-graph-2A5THUCI.js +1 -0
- package/dist/workspace-history-CGCK2DJI.js +1 -0
- package/dist/workspace-intelligence-QJGVL37U.js +1 -0
- package/dist/workspace-marker-SMBC3Z2Q.js +1 -0
- package/dist/workspace-mcp-serve-AK4MYEHQ.js +3 -0
- package/dist/workspace-model-PNXXOGPO.js +1 -0
- package/dist/workspace-python-engine-state-MTWIIZPY.js +2 -0
- package/dist/workspace-registry-summary-RUJE6RPH.js +1 -0
- package/dist/workspace-run-Y7YMUIHX.js +1 -0
- package/dist/workspace-verify-WSDUUTR5.js +1 -0
- package/dist/workspace-watch-AGPOJ74Q.js +1 -0
- package/docs/AI_DYNAMIC_INTEGRATION.md +440 -0
- package/docs/AI_EXAMPLES.md +419 -0
- package/docs/AI_FEATURES.md +460 -0
- package/docs/AI_QUICKSTART.md +245 -0
- package/docs/DEVELOPMENT.md +90 -0
- package/docs/From Code to Shared Understanding.png +0 -0
- package/docs/OPEN_SOURCE_USER_SCENARIOS.md +170 -0
- package/docs/OPTIMIZATION_GUIDE.md +504 -0
- package/docs/PACKAGE_MANAGER_POLICY.md +25 -0
- package/docs/README.md +125 -0
- package/docs/SECURITY.md +63 -0
- package/docs/SETUP.md +107 -0
- package/docs/UTILITIES.md +221 -0
- package/docs/WORKSPACE_MARKER_SPEC.md +276 -0
- package/docs/ci-workflows.md +59 -0
- package/docs/commands-reference.md +172 -0
- package/docs/config-file-guide.md +299 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +333 -0
- package/docs/contracts/CLI_LOG_EVENT_STREAM.md +123 -0
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +138 -0
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +60 -0
- package/docs/contracts/README.md +86 -0
- package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +98 -0
- package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +75 -0
- package/docs/contracts/rapidkit-cli-contracts.json +239 -0
- package/docs/create-planner-capabilities.md +81 -0
- package/docs/doctor-command.md +467 -0
- package/docs/examples/ci-agent-grounding.yml +65 -0
- package/docs/from-code-to-shared-understanding.md +45 -0
- package/docs/governance-policy.enterprise.example.json +40 -0
- package/docs/mirror-config.enterprise.example.json +60 -0
- package/docs/policies.workspace.example.yml +23 -0
- package/docs/workspace-operations.md +160 -0
- package/docs/workspace-run.md +104 -0
- package/package.json +179 -0
- package/rapidkit.config.example.cjs +62 -0
- package/scripts/check-agent-customization-drift.mjs +78 -0
- package/scripts/check-cli-resolution.cjs +72 -0
- package/scripts/enforce-package-manager.cjs +10 -0
- package/scripts/enterprise-package-smoke.mjs +463 -0
- package/scripts/prepack-enterprise.mjs +43 -0
- package/templates/generator.js +179 -0
- package/templates/kits/fastapi-ddd/README.md.j2 +117 -0
- package/templates/kits/fastapi-ddd/common/env.example.j2 +10 -0
- package/templates/kits/fastapi-ddd/env.example.j2 +1 -0
- package/templates/kits/fastapi-ddd/pyproject.toml.j2 +64 -0
- package/templates/kits/fastapi-ddd/src/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/app/__init__.py.j2 +11 -0
- package/templates/kits/fastapi-ddd/src/app/application/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/application/interfaces.py.j2 +43 -0
- package/templates/kits/fastapi-ddd/src/app/application/use_cases/__init__.py.j2 +6 -0
- package/templates/kits/fastapi-ddd/src/app/application/use_cases/health.py.j2 +14 -0
- package/templates/kits/fastapi-ddd/src/app/application/use_cases/notes.py.j2 +24 -0
- package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +16 -0
- package/templates/kits/fastapi-ddd/src/app/domain/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/app/domain/models/__init__.py.j2 +6 -0
- package/templates/kits/fastapi-ddd/src/app/domain/models/health.py.j2 +16 -0
- package/templates/kits/fastapi-ddd/src/app/domain/models/note.py.j2 +27 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/__init__.py.j2 +6 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/health.py.j2 +17 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/notes.py.j2 +28 -0
- package/templates/kits/fastapi-ddd/src/app/main.py.j2 +61 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/dependencies/__init__.py.j2 +19 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/router.py.j2 +10 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/health.py.j2 +27 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/notes.py.j2 +50 -0
- package/templates/kits/fastapi-ddd/src/app/shared/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/shared/result.py.j2 +28 -0
- package/templates/kits/fastapi-ddd/src/cli.py.j2 +170 -0
- package/templates/kits/fastapi-ddd/src/main.py.j2 +35 -0
- package/templates/kits/fastapi-ddd/src/modules/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/routing/__init__.py.j2 +13 -0
- package/templates/kits/fastapi-ddd/src/routing/health.py.j2 +7 -0
- package/templates/kits/fastapi-ddd/src/routing/notes.py.j2 +7 -0
- package/templates/kits/fastapi-ddd/tests/__init__.py.j2 +1 -0
- package/templates/kits/fastapi-ddd/tests/test_app_factory.py.j2 +22 -0
- package/templates/kits/fastapi-ddd/tests/test_health.py.j2 +17 -0
- package/templates/kits/fastapi-ddd/tests/test_notes.py.j2 +27 -0
- package/templates/kits/fastapi-standard/README.md.j2 +140 -0
- package/templates/kits/fastapi-standard/common/env.example.j2 +10 -0
- package/templates/kits/fastapi-standard/env.example.j2 +1 -0
- package/templates/kits/fastapi-standard/pyproject.toml.j2 +64 -0
- package/templates/kits/fastapi-standard/src/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-standard/src/cli.py.j2 +171 -0
- package/templates/kits/fastapi-standard/src/main.py.j2 +66 -0
- package/templates/kits/fastapi-standard/src/modules/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-standard/src/routing/__init__.py.j2 +16 -0
- package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +71 -0
- package/templates/kits/fastapi-standard/src/routing/health.py.j2 +22 -0
- package/templates/kits/fastapi-standard/tests/__init__.py.j2 +1 -0
- package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +29 -0
- package/templates/kits/fastapi-standard/tests/test_health.py.j2 +17 -0
- package/templates/kits/nestjs-standard/Dockerfile.j2 +41 -0
- package/templates/kits/nestjs-standard/README.md.j2 +134 -0
- package/templates/kits/nestjs-standard/docker-compose.yml.j2 +94 -0
- package/templates/kits/nestjs-standard/docs/README.md.j2 +15 -0
- package/templates/kits/nestjs-standard/env.example.j2 +18 -0
- package/templates/kits/nestjs-standard/eslint.config.cjs.j2 +9 -0
- package/templates/kits/nestjs-standard/jest.config.ts.j2 +28 -0
- package/templates/kits/nestjs-standard/nest-cli.json.j2 +10 -0
- package/templates/kits/nestjs-standard/package.json.j2 +101 -0
- package/templates/kits/nestjs-standard/src/app.controller.ts.j2 +14 -0
- package/templates/kits/nestjs-standard/src/app.module.ts.j2 +26 -0
- package/templates/kits/nestjs-standard/src/app.service.ts.j2 +16 -0
- package/templates/kits/nestjs-standard/src/auth/auth.controller.ts.j2 +20 -0
- package/templates/kits/nestjs-standard/src/auth/auth.module.ts.j2 +13 -0
- package/templates/kits/nestjs-standard/src/auth/auth.service.ts.j2 +6 -0
- package/templates/kits/nestjs-standard/src/auth/entities/token.entity.ts.j2 +3 -0
- package/templates/kits/nestjs-standard/src/auth/entities/user.entity.ts.j2 +3 -0
- package/templates/kits/nestjs-standard/src/auth/entities/webauthn.entity.ts.j2 +3 -0
- package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +85 -0
- package/templates/kits/nestjs-standard/src/config/index.ts.j2 +2 -0
- package/templates/kits/nestjs-standard/src/config/validation.ts.j2 +21 -0
- package/templates/kits/nestjs-standard/src/examples/dto/create-note.dto.ts.j2 +11 -0
- package/templates/kits/nestjs-standard/src/examples/examples.controller.ts.j2 +24 -0
- package/templates/kits/nestjs-standard/src/examples/examples.module.ts.j2 +10 -0
- package/templates/kits/nestjs-standard/src/examples/examples.service.ts.j2 +33 -0
- package/templates/kits/nestjs-standard/src/main.ts.j2 +53 -0
- package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +25 -0
- package/templates/kits/nestjs-standard/test/app.controller.spec.ts.j2 +24 -0
- package/templates/kits/nestjs-standard/test/app.e2e-spec.ts.j2 +60 -0
- package/templates/kits/nestjs-standard/test/examples.controller.spec.ts.j2 +28 -0
- package/templates/kits/nestjs-standard/test/jest-e2e.json.j2 +15 -0
- package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +12 -0
- package/templates/kits/nestjs-standard/tsconfig.json.j2 +26 -0
- package/workspai.config.example.cjs +62 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Body, Controller, Get, Param, ParseIntPipe, Post } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { CreateNoteDto } from './dto/create-note.dto';
|
|
4
|
+
import { ExamplesService } from './examples.service';
|
|
5
|
+
|
|
6
|
+
@Controller('examples/notes')
|
|
7
|
+
export class ExamplesController {
|
|
8
|
+
constructor(private readonly examplesService: ExamplesService) {}
|
|
9
|
+
|
|
10
|
+
@Post()
|
|
11
|
+
create(@Body() payload: CreateNoteDto) {
|
|
12
|
+
return this.examplesService.create(payload);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@Get()
|
|
16
|
+
findAll() {
|
|
17
|
+
return this.examplesService.findAll();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Get(':id')
|
|
21
|
+
findOne(@Param('id', ParseIntPipe) id: number) {
|
|
22
|
+
return this.examplesService.findOne(id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { ExamplesController } from './examples.controller';
|
|
4
|
+
import { ExamplesService } from './examples.service';
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
controllers: [ExamplesController],
|
|
8
|
+
providers: [ExamplesService],
|
|
9
|
+
})
|
|
10
|
+
export class ExamplesModule {}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { CreateNoteDto } from './dto/create-note.dto';
|
|
4
|
+
|
|
5
|
+
export interface ExampleNote {
|
|
6
|
+
id: number;
|
|
7
|
+
title: string;
|
|
8
|
+
body: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class ExamplesService {
|
|
13
|
+
private notes: ExampleNote[] = [];
|
|
14
|
+
private sequence = 1;
|
|
15
|
+
|
|
16
|
+
create(payload: CreateNoteDto): ExampleNote {
|
|
17
|
+
const note: ExampleNote = { id: this.sequence++, ...payload };
|
|
18
|
+
this.notes.push(note);
|
|
19
|
+
return note;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
findAll(): ExampleNote[] {
|
|
23
|
+
return [...this.notes];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
findOne(id: number): ExampleNote {
|
|
27
|
+
const note = this.notes.find((entry) => entry.id === id);
|
|
28
|
+
if (!note) {
|
|
29
|
+
throw new NotFoundException('Note not found');
|
|
30
|
+
}
|
|
31
|
+
return note;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
|
3
|
+
import { NestFactory } from '@nestjs/core';
|
|
4
|
+
import helmet from 'helmet';
|
|
5
|
+
import compression from 'compression';
|
|
6
|
+
|
|
7
|
+
import { AppModule } from './app.module';
|
|
8
|
+
|
|
9
|
+
async function bootstrap() {
|
|
10
|
+
const app = await NestFactory.create(AppModule, {
|
|
11
|
+
bufferLogs: true,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const logger = new Logger('Bootstrap');
|
|
15
|
+
|
|
16
|
+
app.use(helmet());
|
|
17
|
+
app.use(compression());
|
|
18
|
+
|
|
19
|
+
app.enableCors({
|
|
20
|
+
origin: '*',
|
|
21
|
+
credentials: true,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// <<<inject:global-middleware>>>
|
|
25
|
+
|
|
26
|
+
const port = parseInt(process.env.PORT ?? '8000', 10);
|
|
27
|
+
const host = process.env.HOST ?? '0.0.0.0';
|
|
28
|
+
|
|
29
|
+
// Enable Swagger docs in development or when explicitly requested.
|
|
30
|
+
const enableDocs = process.env.RAPIDKIT_ENABLE_SWAGGER === '1' || process.env.NODE_ENV !== 'production';
|
|
31
|
+
if (enableDocs) {
|
|
32
|
+
const config = new DocumentBuilder()
|
|
33
|
+
.setTitle('{{ project_name | default("Workspai App") }} API')
|
|
34
|
+
.setDescription('Auto-generated API docs')
|
|
35
|
+
.setVersion('{{ app_version | default("1.0.0") }}')
|
|
36
|
+
.addBearerAuth()
|
|
37
|
+
.build();
|
|
38
|
+
|
|
39
|
+
const document = SwaggerModule.createDocument(app, config);
|
|
40
|
+
SwaggerModule.setup('docs', app, document);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
await app.listen(port, host);
|
|
44
|
+
|
|
45
|
+
logger.log(`🚀 Application is running on http://${host}:${port}`);
|
|
46
|
+
// <<<inject:bootstrap-hooks>>>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
bootstrap().catch((error) => {
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
console.error('❌ Failed to bootstrap application', error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports, global-require */
|
|
2
|
+
|
|
3
|
+
import type { DynamicModule, Type } from '@nestjs/common';
|
|
4
|
+
|
|
5
|
+
// Central export for dynamically injected RapidKit Core modules
|
|
6
|
+
|
|
7
|
+
type ModuleRef = DynamicModule | Type<unknown>;
|
|
8
|
+
|
|
9
|
+
const registerOptionalModule = (loader: () => ModuleRef | null | undefined): ModuleRef | null => {
|
|
10
|
+
try {
|
|
11
|
+
const resolved = loader();
|
|
12
|
+
return resolved ?? null;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const optionalModules: Array<ModuleRef | null> = [
|
|
19
|
+
registerOptionalModule(() => require('../config/logging.module').LoggingModule as ModuleRef),
|
|
20
|
+
registerOptionalModule(() => require('../config/settings.module').SettingsModule as ModuleRef),
|
|
21
|
+
registerOptionalModule(() => require('../deployment/deployment.module').DeploymentModule as ModuleRef),
|
|
22
|
+
// <<<inject:module-exports>>>
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const rapidkitModules: ModuleRef[] = optionalModules.filter(Boolean) as ModuleRef[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
|
|
3
|
+
import { AppController } from '../src/app.controller';
|
|
4
|
+
import { AppService } from '../src/app.service';
|
|
5
|
+
|
|
6
|
+
describe('AppController', () => {
|
|
7
|
+
let appController: AppController;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
const app: TestingModule = await Test.createTestingModule({
|
|
11
|
+
controllers: [AppController],
|
|
12
|
+
providers: [AppService],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
appController = app.get<AppController>(AppController);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should return health status', () => {
|
|
19
|
+
const result = appController.getHealth();
|
|
20
|
+
expect(result).toHaveProperty('status', 'ok');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// <<<inject:controller-tests>>>
|
|
24
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { INestApplication } from '@nestjs/common';
|
|
3
|
+
import request from 'supertest';
|
|
4
|
+
|
|
5
|
+
import { AppModule } from '../src/app.module';
|
|
6
|
+
|
|
7
|
+
describe('AppController (e2e)', () => {
|
|
8
|
+
let app: INestApplication;
|
|
9
|
+
|
|
10
|
+
beforeAll(async () => {
|
|
11
|
+
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
12
|
+
imports: [AppModule],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
app = moduleFixture.createNestApplication();
|
|
16
|
+
await app.init();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterAll(async () => {
|
|
20
|
+
await app.close();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('/health (GET)', () => {
|
|
24
|
+
return request(app.getHttpServer())
|
|
25
|
+
.get('/health')
|
|
26
|
+
.expect(200)
|
|
27
|
+
.expect((res) => {
|
|
28
|
+
expect(res.body).toEqual(
|
|
29
|
+
expect.objectContaining({
|
|
30
|
+
status: 'ok',
|
|
31
|
+
timestamp: expect.any(String),
|
|
32
|
+
version: expect.any(String),
|
|
33
|
+
uptime: expect.any(Number),
|
|
34
|
+
module: expect.any(String),
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('/examples/notes (POST + GET)', async () => {
|
|
41
|
+
const server = app.getHttpServer();
|
|
42
|
+
const createResponse = await request(server)
|
|
43
|
+
.post('/examples/notes')
|
|
44
|
+
.send({ title: 'ddd', body: 'documented via e2e' })
|
|
45
|
+
.expect(201);
|
|
46
|
+
|
|
47
|
+
const noteId = createResponse.body.id;
|
|
48
|
+
|
|
49
|
+
await request(server)
|
|
50
|
+
.get('/examples/notes')
|
|
51
|
+
.expect(200)
|
|
52
|
+
.expect((res) => {
|
|
53
|
+
expect(res.body).toEqual(
|
|
54
|
+
expect.arrayContaining([expect.objectContaining({ id: noteId, title: 'ddd' })]),
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// <<<inject:e2e-tests>>>
|
|
60
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
|
|
3
|
+
import { ExamplesController } from '../src/examples/examples.controller';
|
|
4
|
+
import { ExamplesService } from '../src/examples/examples.service';
|
|
5
|
+
|
|
6
|
+
describe('ExamplesController', () => {
|
|
7
|
+
let controller: ExamplesController;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
11
|
+
controllers: [ExamplesController],
|
|
12
|
+
providers: [ExamplesService],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
controller = module.get<ExamplesController>(ExamplesController);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('creates and retrieves notes', () => {
|
|
19
|
+
const created = controller.create({ title: 'spec', body: 'covered by tests' });
|
|
20
|
+
expect(created).toMatchObject({ id: 1, title: 'spec' });
|
|
21
|
+
|
|
22
|
+
const list = controller.findAll();
|
|
23
|
+
expect(list).toHaveLength(1);
|
|
24
|
+
|
|
25
|
+
const single = controller.findOne(created.id);
|
|
26
|
+
expect(single).toMatchObject({ id: created.id, title: 'spec' });
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"moduleFileExtensions": ["js", "json", "ts"],
|
|
3
|
+
"rootDir": "../",
|
|
4
|
+
"testEnvironment": "node",
|
|
5
|
+
"testRegex": ".e2e-spec.ts$",
|
|
6
|
+
"transform": {
|
|
7
|
+
"^.+\\.ts$": "ts-jest"
|
|
8
|
+
},
|
|
9
|
+
"setupFiles": ["dotenv/config"],
|
|
10
|
+
"moduleNameMapper": {
|
|
11
|
+
"^@config/(.*)$": "<rootDir>/src/config/$1",
|
|
12
|
+
"^@modules/(.*)$": "<rootDir>/src/modules/$1",
|
|
13
|
+
"^@shared/(.*)$": "<rootDir>/src/shared/$1"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"sourceMap": false,
|
|
7
|
+
"removeComments": true,
|
|
8
|
+
"incremental": false
|
|
9
|
+
},
|
|
10
|
+
"exclude": ["node_modules", "test", "src/**/*.spec.ts", "src/**/*.e2e-spec.ts"],
|
|
11
|
+
"include": ["src/.workspai/**/*.ts", "src/.rapidkit/**/*.ts", "src/**/*.ts"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"removeComments": true,
|
|
6
|
+
"emitDecoratorMetadata": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"target": "es2021",
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"incremental": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"esModuleInterop": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@config/*": ["src/config/*"],
|
|
20
|
+
"@modules/*": ["src/modules/*"],
|
|
21
|
+
"@shared/*": ["src/shared/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"exclude": ["node_modules", "dist"],
|
|
25
|
+
"include": ["src/.workspai/**/*.ts", "src/.rapidkit/**/*.ts", "src/**/*.ts", "test/**/*.ts"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspai Configuration File
|
|
3
|
+
*
|
|
4
|
+
* Place this file in your project root as:
|
|
5
|
+
* - workspai.config.cjs (CommonJS explicit, safest across package types)
|
|
6
|
+
* - workspai.config.mjs (ES Module, use export default)
|
|
7
|
+
* - workspai.config.js (only when it matches your package.json module type)
|
|
8
|
+
*
|
|
9
|
+
* Legacy rapidkit.config.* files are still read during migration, but new
|
|
10
|
+
* projects should prefer workspai.config.cjs or workspai.config.mjs.
|
|
11
|
+
*
|
|
12
|
+
* This file is automatically detected when creating workspaces or projects.
|
|
13
|
+
* CLI arguments override config file settings.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
// Workspace configuration
|
|
18
|
+
workspace: {
|
|
19
|
+
// Default author name for new workspaces
|
|
20
|
+
defaultAuthor: 'Your Name or Team',
|
|
21
|
+
|
|
22
|
+
// Default Python version to use
|
|
23
|
+
// Options: '3.10' | '3.11' | '3.12'
|
|
24
|
+
pythonVersion: '3.10',
|
|
25
|
+
|
|
26
|
+
// Default installation method for RapidKit Core
|
|
27
|
+
// Options: 'poetry' | 'venv' | 'pipx'
|
|
28
|
+
installMethod: 'poetry',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// Project configuration
|
|
32
|
+
projects: {
|
|
33
|
+
// Default kit/template to use when creating projects
|
|
34
|
+
// Examples: 'fastapi.standard', 'fastapi.ddd', 'nestjs.standard'
|
|
35
|
+
defaultKit: 'fastapi.standard',
|
|
36
|
+
|
|
37
|
+
// Default modules to add to new projects
|
|
38
|
+
// These modules will be automatically added after project creation
|
|
39
|
+
addDefaultModules: [
|
|
40
|
+
// 'prisma', // Database ORM
|
|
41
|
+
// 'redis', // Caching
|
|
42
|
+
// 'auth-jwt', // JWT Authentication
|
|
43
|
+
// 'monitoring', // Monitoring and logging
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
// Skip git initialization by default
|
|
47
|
+
skipGit: false,
|
|
48
|
+
|
|
49
|
+
// Skip dependency installation by default
|
|
50
|
+
skipInstall: false,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Example usage:
|
|
55
|
+
// npx workspai my-workspace
|
|
56
|
+
// -> Uses config: author='Your Name or Team', pythonVersion='3.10', installMethod='poetry'
|
|
57
|
+
//
|
|
58
|
+
// npx workspai my-workspace --author "Different Author"
|
|
59
|
+
// -> Overrides: author='Different Author', but still uses pythonVersion='3.10', installMethod='poetry'
|
|
60
|
+
//
|
|
61
|
+
// npx workspai create project my-api
|
|
62
|
+
// -> Uses config: defaultKit='fastapi.standard', adds default modules
|