@decohere/create 0.0.1-dev.47 → 0.0.1-dev.49

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.
Files changed (124) hide show
  1. package/commonjs/src/cli.js +3 -3
  2. package/commonjs/src/resolve-launch.js +53 -0
  3. package/commonjs/src/runner.js +5 -45
  4. package/commonjs/src/version.js +1 -1
  5. package/es6/src/cli.js +3 -3
  6. package/es6/src/resolve-launch.js +46 -0
  7. package/es6/src/runner.js +8 -57
  8. package/es6/src/version.js +3 -3
  9. package/pack-builder-tgz.mjs +19 -35
  10. package/package.json +4 -11
  11. package/types/src/resolve-launch.d.ts +10 -0
  12. package/types/src/runner.d.ts +3 -13
  13. package/types/src/version.d.ts +0 -2
  14. package/commonjs/src/domain/prompt.js +0 -64
  15. package/commonjs/src/models/compose.model.js +0 -138
  16. package/commonjs/src/models/config-yaml.model.js +0 -88
  17. package/commonjs/src/models/const.js +0 -31
  18. package/commonjs/src/models/dev-container.model.js +0 -100
  19. package/commonjs/src/models/docker-image.model.js +0 -221
  20. package/commonjs/src/models/env-file.model.js +0 -47
  21. package/commonjs/src/models/gitignore.model.js +0 -31
  22. package/commonjs/src/models/launch-json.model.js +0 -74
  23. package/commonjs/src/models/package-json.model.js +0 -133
  24. package/commonjs/src/models/project.model.js +0 -134
  25. package/commonjs/src/models/source-file.js +0 -6
  26. package/commonjs/src/models/tsconfig.model.js +0 -34
  27. package/commonjs/src/models/vscode-settings.model.js +0 -31
  28. package/commonjs/src/program.js +0 -135
  29. package/commonjs/src/resolve-target-dir.js +0 -19
  30. package/commonjs/src/services/scaffold.service.js +0 -62
  31. package/commonjs/src/webapi/api-name.js +0 -95
  32. package/commonjs/src/webapi/const.js +0 -50
  33. package/commonjs/src/webapi/create-api.js +0 -285
  34. package/commonjs/src/webapi/features/auth.feature.js +0 -463
  35. package/commonjs/src/webapi/features/auth0-cli.js +0 -406
  36. package/commonjs/src/webapi/features/biome-format.js +0 -49
  37. package/commonjs/src/webapi/features/database.feature.js +0 -273
  38. package/commonjs/src/webapi/features/finalize.feature.js +0 -91
  39. package/commonjs/src/webapi/features/postman.feature.js +0 -319
  40. package/commonjs/src/webapi/models/api-package-json.model.js +0 -63
  41. package/commonjs/src/webapi/models/auth-config.model.js +0 -26
  42. package/commonjs/src/webapi/models/controller-source-file.model.js +0 -188
  43. package/commonjs/src/webapi/models/github-ci.model.js +0 -193
  44. package/commonjs/src/webapi/models/main-source-file.model.js +0 -165
  45. package/commonjs/src/webapi/models/production-dockerfile.model.js +0 -138
  46. package/commonjs/src/webapi/models/sample-files.model.js +0 -60
  47. package/commonjs/src/webapi/models/webapi-image.model.js +0 -22
  48. package/commonjs/src/webapi/postman/hello-openapi.js +0 -175
  49. package/commonjs/src/webapi/postman/local-view.js +0 -184
  50. package/commonjs/src/webapi/postman/openapi-to-postman.js +0 -202
  51. package/es6/src/domain/prompt.js +0 -43
  52. package/es6/src/models/compose.model.js +0 -132
  53. package/es6/src/models/config-yaml.model.js +0 -76
  54. package/es6/src/models/const.js +0 -21
  55. package/es6/src/models/dev-container.model.js +0 -90
  56. package/es6/src/models/docker-image.model.js +0 -185
  57. package/es6/src/models/env-file.model.js +0 -43
  58. package/es6/src/models/gitignore.model.js +0 -21
  59. package/es6/src/models/launch-json.model.js +0 -64
  60. package/es6/src/models/package-json.model.js +0 -129
  61. package/es6/src/models/project.model.js +0 -119
  62. package/es6/src/models/source-file.js +0 -3
  63. package/es6/src/models/tsconfig.model.js +0 -24
  64. package/es6/src/models/vscode-settings.model.js +0 -21
  65. package/es6/src/program.js +0 -76
  66. package/es6/src/resolve-target-dir.js +0 -9
  67. package/es6/src/services/scaffold.service.js +0 -52
  68. package/es6/src/webapi/api-name.js +0 -59
  69. package/es6/src/webapi/const.js +0 -20
  70. package/es6/src/webapi/create-api.js +0 -265
  71. package/es6/src/webapi/features/auth.feature.js +0 -412
  72. package/es6/src/webapi/features/auth0-cli.js +0 -348
  73. package/es6/src/webapi/features/biome-format.js +0 -42
  74. package/es6/src/webapi/features/database.feature.js +0 -263
  75. package/es6/src/webapi/features/finalize.feature.js +0 -81
  76. package/es6/src/webapi/features/postman.feature.js +0 -253
  77. package/es6/src/webapi/models/api-package-json.model.js +0 -58
  78. package/es6/src/webapi/models/auth-config.model.js +0 -22
  79. package/es6/src/webapi/models/controller-source-file.model.js +0 -179
  80. package/es6/src/webapi/models/github-ci.model.js +0 -186
  81. package/es6/src/webapi/models/main-source-file.model.js +0 -161
  82. package/es6/src/webapi/models/production-dockerfile.model.js +0 -126
  83. package/es6/src/webapi/models/sample-files.model.js +0 -42
  84. package/es6/src/webapi/models/webapi-image.model.js +0 -12
  85. package/es6/src/webapi/postman/hello-openapi.js +0 -168
  86. package/es6/src/webapi/postman/local-view.js +0 -169
  87. package/es6/src/webapi/postman/openapi-to-postman.js +0 -179
  88. package/types/src/domain/prompt.d.ts +0 -4
  89. package/types/src/models/compose.model.d.ts +0 -59
  90. package/types/src/models/config-yaml.model.d.ts +0 -27
  91. package/types/src/models/const.d.ts +0 -19
  92. package/types/src/models/dev-container.model.d.ts +0 -33
  93. package/types/src/models/docker-image.model.d.ts +0 -56
  94. package/types/src/models/env-file.model.d.ts +0 -15
  95. package/types/src/models/gitignore.model.d.ts +0 -6
  96. package/types/src/models/launch-json.model.d.ts +0 -7
  97. package/types/src/models/package-json.model.d.ts +0 -32
  98. package/types/src/models/project.model.d.ts +0 -60
  99. package/types/src/models/source-file.d.ts +0 -11
  100. package/types/src/models/tsconfig.model.d.ts +0 -5
  101. package/types/src/models/vscode-settings.model.d.ts +0 -7
  102. package/types/src/program.d.ts +0 -3
  103. package/types/src/resolve-target-dir.d.ts +0 -5
  104. package/types/src/services/scaffold.service.d.ts +0 -22
  105. package/types/src/webapi/api-name.d.ts +0 -14
  106. package/types/src/webapi/const.d.ts +0 -17
  107. package/types/src/webapi/create-api.d.ts +0 -15
  108. package/types/src/webapi/features/auth.feature.d.ts +0 -10
  109. package/types/src/webapi/features/auth0-cli.d.ts +0 -72
  110. package/types/src/webapi/features/biome-format.d.ts +0 -5
  111. package/types/src/webapi/features/database.feature.d.ts +0 -5
  112. package/types/src/webapi/features/finalize.feature.d.ts +0 -2
  113. package/types/src/webapi/features/postman.feature.d.ts +0 -16
  114. package/types/src/webapi/models/api-package-json.model.d.ts +0 -18
  115. package/types/src/webapi/models/auth-config.model.d.ts +0 -26
  116. package/types/src/webapi/models/controller-source-file.model.d.ts +0 -45
  117. package/types/src/webapi/models/github-ci.model.d.ts +0 -9
  118. package/types/src/webapi/models/main-source-file.model.d.ts +0 -54
  119. package/types/src/webapi/models/production-dockerfile.model.d.ts +0 -20
  120. package/types/src/webapi/models/sample-files.model.d.ts +0 -7
  121. package/types/src/webapi/models/webapi-image.model.d.ts +0 -5
  122. package/types/src/webapi/postman/hello-openapi.d.ts +0 -19
  123. package/types/src/webapi/postman/local-view.d.ts +0 -17
  124. package/types/src/webapi/postman/openapi-to-postman.d.ts +0 -62
@@ -1,27 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- /**
3
- * Builder for a YAML config file (e.g. config/config.yaml or config/config.dev.yaml).
4
- *
5
- * Starts with a base section passed to the constructor. Features call
6
- * `addSection(yaml)` during their scaffold phase to append their own block.
7
- * `files()` joins all sections with a blank line separator.
8
- */
9
- export declare class ConfigYaml implements KeyedModel {
10
- readonly key: string;
11
- private readonly filePath;
12
- private readonly _sections;
13
- constructor(key: string, filePath: string, baseContent: string);
14
- addSection(yaml: string): this;
15
- /** True when a datasource with this `name:` already appears in the file. */
16
- hasDataSource(name: string): boolean;
17
- hasDataSources(): boolean;
18
- /**
19
- * Insert a `dataSources` list item. Used by `webapi add` so we do not write a
20
- * second top-level `database:` key (YAML last-key-wins).
21
- */
22
- appendDataSource(item: string): this;
23
- static fromFile(key: string, relativePath: string, absolutePath: string): ConfigYaml;
24
- files(): SourceFile[];
25
- }
26
- /** Insert a YAML list item under `dataSources:`; append a new `database:` block if missing. */
27
- export declare function injectYamlDataSource(yaml: string, item: string): string;
@@ -1,19 +0,0 @@
1
- export declare const WELL_KNOWN_FILES: {
2
- VSCODE_SETTINGS: string;
3
- LAUNCH_JSON: string;
4
- DOCKER_COMPOSE: string;
5
- DEVCONTAINER_JSON: string;
6
- DOCKERFILE: string;
7
- PRODUCTION_DOCKERFILE: string;
8
- GITHUB_CI: string;
9
- PACKAGE_JSON: string;
10
- API_PACKAGE_JSON: string;
11
- TSCONFIG: string;
12
- MAIN_TS: string;
13
- CONTROLLER_TS: string;
14
- CONFIG_YAML: string;
15
- CONFIG_DEV_YAML: string;
16
- GITIGNORE: string;
17
- AUTH_CONFIG: string;
18
- ENV_FILE: string;
19
- };
@@ -1,33 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- /**
3
- * Model for `.devcontainer/devcontainer.json`.
4
- *
5
- * Features call builder methods (`addExtension`, `forwardPort`, etc.) during
6
- * their configure phase. `MonoRepoScaffold` calls `files()` at render time.
7
- */
8
- export type PortAttributes = {
9
- label?: string;
10
- /** When true, host port must match the container port (no random remap). */
11
- requireLocalPort?: boolean;
12
- onAutoForward?: "notify" | "openBrowser" | "openPreview" | "silent" | "ignore";
13
- };
14
- export declare class DevContainer implements KeyedModel {
15
- readonly key: string;
16
- private readonly _extensions;
17
- private readonly _ports;
18
- private readonly _portAttributes;
19
- private readonly _mounts;
20
- private _postStartCommand?;
21
- private _initializeCommand?;
22
- private _remoteUser;
23
- private _useCompose;
24
- constructor();
25
- addExtension(...ids: string[]): this;
26
- forwardPort(...ports: number[]): this;
27
- setPortAttributes(port: number, attrs: PortAttributes): this;
28
- setPostStartCommand(cmd: string): this;
29
- setInitializeCommand(cmd: string): this;
30
- setRemoteUser(user: string): this;
31
- useCompose(): this;
32
- files(): SourceFile[];
33
- }
@@ -1,56 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export type LayerWriter = (dockerfile: DockerfileModel) => void;
3
- export declare class DockerStep {
4
- readonly key: string;
5
- readonly content: string;
6
- readonly order: number;
7
- constructor(key: string, content: string, order?: number);
8
- static run(key: string, command: string, order?: number): DockerStep;
9
- static raw(key: string, content: string, order?: number): DockerStep;
10
- static entrypoint(key: string, value: string | readonly string[], order?: number): DockerStep;
11
- }
12
- export declare function withCommandHistory(options?: {
13
- historyDir?: string;
14
- historyFileName?: string;
15
- order?: number;
16
- }): LayerWriter;
17
- export declare function withNodeUser(options?: {
18
- username?: string;
19
- includeUserInstruction?: boolean;
20
- order?: number;
21
- }): LayerWriter;
22
- export declare function withPnpm(options?: {
23
- version?: string;
24
- usernameExpr?: string;
25
- order?: number;
26
- }): LayerWriter;
27
- export declare function withWorkspaceNodeModulesOwnership(options?: {
28
- workspaceDir?: string;
29
- usernameExpr?: string;
30
- order?: number;
31
- }): LayerWriter;
32
- export declare function withVsCodeJsDebugBootloaderFix(options?: {
33
- bashrcPath?: string;
34
- order?: number;
35
- }): LayerWriter;
36
- export declare class DockerfileModel implements KeyedModel {
37
- readonly key: string;
38
- private readonly _steps;
39
- private readonly _layerWriters;
40
- private _fromImage;
41
- private _layerCounter;
42
- constructor(baseImage: string);
43
- from(baseImage: string): this;
44
- addLayer(layer: LayerWriter | string, order?: 5000): this;
45
- addStep(step: DockerStep): this;
46
- removeStep(key: string): this;
47
- entrypoint(value: string | readonly string[], order?: 10000): this;
48
- addRunStep(cmd: string): this;
49
- build(): string;
50
- protected registerBaseLayers(): void;
51
- files(): SourceFile[];
52
- }
53
- export declare class DevContainerImageModel extends DockerfileModel {
54
- protected registerBaseLayers(): void;
55
- files(): SourceFile[];
56
- }
@@ -1,15 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- /**
3
- * Accumulates key=value pairs and renders them as a `.env` file.
4
- *
5
- * Register once in the workspace; features call `addEntry` during their
6
- * scaffold phase to contribute environment variables. The final file is
7
- * written at render time when `workspace.scaffold()` is called.
8
- */
9
- export declare class EnvFile implements KeyedModel {
10
- readonly key: string;
11
- private readonly _entries;
12
- addEntry(key: string, value: string): this;
13
- static fromFile(absolutePath: string): EnvFile;
14
- files(): SourceFile[];
15
- }
@@ -1,6 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export declare class Gitignore implements KeyedModel {
3
- readonly key: string;
4
- private ignoreList;
5
- files(): SourceFile[];
6
- }
@@ -1,7 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export declare class LaunchJson implements KeyedModel {
3
- private readonly apiNames;
4
- readonly key: string;
5
- constructor(apiNames?: readonly string[]);
6
- files(): SourceFile[];
7
- }
@@ -1,32 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export type PackageJsonOptions = {
3
- startEntry?: string;
4
- /** API slugs in this workspace. Drives `start:<name>` / `dev:<name>`. */
5
- apiNames?: readonly string[];
6
- /** Host workspace name used in `@<workspace>/<api>` for flux `--project`. */
7
- workspaceName?: string;
8
- };
9
- /**
10
- * Builder for the root `package.json`.
11
- *
12
- * Starts with the core API dependencies. Features call `addDependency` /
13
- * `addDevDependency` during their scaffold phase to inject their own deps
14
- * before `files()` is called at render time.
15
- */
16
- export declare class PackageJson implements KeyedModel {
17
- private readonly name;
18
- readonly key: string;
19
- private _dependencies;
20
- private _devDependencies;
21
- private _scripts;
22
- private _version;
23
- private _type;
24
- private _rest;
25
- constructor(name: string, options?: PackageJsonOptions);
26
- /** Load an existing root package.json so `webapi add` can merge scripts/deps. */
27
- static fromFile(filePath: string): PackageJson;
28
- addDependency(name: string, version: string): this;
29
- addDevDependency(name: string, version: string): this;
30
- addScript(name: string, command: string): this;
31
- files(): SourceFile[];
32
- }
@@ -1,60 +0,0 @@
1
- import type { KeyedModel, SourceFile, SourceFileProvider } from "./source-file.js";
2
- /**
3
- * A sub-unit of the monorepo (e.g. `projects/api`).
4
- *
5
- * Models and files registered here produce paths relative to `dir`. The parent
6
- * `MonoRepoScaffold` calls `files()` and prepends `dir/` to every path, so
7
- * models remain unaware of where they live in the repo.
8
- */
9
- export declare class ProjectScaffold {
10
- readonly dir: string;
11
- private readonly _models;
12
- private readonly _files;
13
- constructor(dir: string);
14
- addModel<T extends KeyedModel>(model: T): T;
15
- addFile(provider: SourceFileProvider): this;
16
- getModel<T extends SourceFileProvider>(key: string): T | undefined;
17
- getModels<T extends SourceFileProvider>(ctor: new (...args: never[]) => T): T[];
18
- /** Returns all files with `dir/` prepended to each path. */
19
- files(): SourceFile[];
20
- }
21
- export declare abstract class WorkspaceScaffold {
22
- readonly files: SourceFile[];
23
- targetDir: string;
24
- private _name;
25
- /** Project name — host directory basename, not the in-container mount path. */
26
- get name(): string;
27
- setName(name: string): this;
28
- /** Add an ad-hoc file provider whose output is included at render time. */
29
- addFile(provider: SourceFileProvider): this;
30
- abstract addModel<T extends KeyedModel>(model: T): T;
31
- abstract getModel<T extends SourceFileProvider>(key: string): T | undefined;
32
- abstract getModels<T extends SourceFileProvider>(ctor: new (...args: never[]) => T): T[];
33
- abstract getProject(dir: string): ProjectScaffold | undefined;
34
- abstract getProjects(): readonly ProjectScaffold[];
35
- abstract scaffold(): Promise<void> | void;
36
- }
37
- export declare class MonoRepoScaffold extends WorkspaceScaffold {
38
- private readonly _models;
39
- private readonly _projects;
40
- /** Register a named project. */
41
- addProject(project: ProjectScaffold): ProjectScaffold;
42
- /** Retrieve a previously-registered project by its directory path. */
43
- getProject(dir: string): ProjectScaffold | undefined;
44
- /** All registered projects, in registration order. */
45
- getProjects(): readonly ProjectScaffold[];
46
- /** Register a named model at workspace level. */
47
- addModel<T extends KeyedModel>(model: T): T;
48
- /**
49
- * Retrieve a model by key. Searches workspace models first, then all
50
- * registered projects in order.
51
- */
52
- getModel<T extends SourceFileProvider>(key: string): T | undefined;
53
- /**
54
- * Retrieve all models of a given type. Searches workspace models and all
55
- * projects, so features can discover controllers across multiple projects.
56
- */
57
- getModels<T extends SourceFileProvider>(ctor: new (...args: never[]) => T): T[];
58
- /** Render all models and projects into files, then write everything to disk. */
59
- scaffold(): Promise<void>;
60
- }
@@ -1,11 +0,0 @@
1
- export interface SourceFileProvider {
2
- files(): SourceFile[];
3
- }
4
- /** A SourceFileProvider that knows its own registration key. */
5
- export interface KeyedModel extends SourceFileProvider {
6
- readonly key: string;
7
- }
8
- export type SourceFile = {
9
- filePath: string;
10
- content: string;
11
- };
@@ -1,5 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export declare class TsConfig implements KeyedModel {
3
- readonly key: string;
4
- files(): SourceFile[];
5
- }
@@ -1,7 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export declare class VSCodeSettings implements KeyedModel {
3
- private readonly title;
4
- readonly key: string;
5
- constructor(title: string);
6
- files(): SourceFile[];
7
- }
@@ -1,3 +0,0 @@
1
- import { Command } from "commander";
2
- export declare function createProgram(): Command;
3
- export declare function runCli(argv?: string[]): Promise<void>;
@@ -1,5 +0,0 @@
1
- /**
2
- * Resolve scaffold destination: positional `webapi my-app` wins over `-d`.
3
- * `npm create … webapi -d my-app` drops `-d` (npm loglevel) and forwards `my-app`.
4
- */
5
- export declare function resolveTargetDir(positional?: string, flag?: string): string;
@@ -1,22 +0,0 @@
1
- import type { WorkspaceScaffold } from "../models/project.model.js";
2
- /**
3
- * A feature has three responsibilities:
4
- * 1. `getOptions` — resolve provider selection and any follow-up questions.
5
- * Receives the options collected so far; returns only the keys it owns.
6
- * Short-circuits if the caller already supplied those keys via CLI flags.
7
- * 2. `scaffold` — mutate the workspace models and/or write files using the
8
- * fully-resolved options. Called after ALL features have gathered options
9
- * but BEFORE files are written to disk.
10
- * 3. `finalize` (optional) — run post-write actions (e.g. install dependencies).
11
- * Called after workspace.scaffold() has flushed all files to disk.
12
- */
13
- export interface Feature<TOptions extends object = object> {
14
- getOptions(workspace: WorkspaceScaffold, cliOptions: Partial<TOptions>): Promise<Partial<TOptions>>;
15
- scaffold(workspace: WorkspaceScaffold, options: TOptions): Promise<void> | void;
16
- finalize?(workspace: WorkspaceScaffold, options: TOptions): Promise<void> | void;
17
- }
18
- declare function scaffold(workspace: WorkspaceScaffold, cliOptions: object, features: Feature[]): Promise<void>;
19
- export declare const ScaffoldService: {
20
- scaffold: typeof scaffold;
21
- };
22
- export {};
@@ -1,14 +0,0 @@
1
- /** Lowercase npm-safe directory slug: `billing`, `admin-api`. */
2
- export declare const API_NAME_PATTERN: RegExp;
3
- export declare class CreateCliError extends Error {
4
- constructor(message: string);
5
- }
6
- export declare function assertValidApiName(name: string): void;
7
- /** Default `["api"]` when the caller omitted `--name`. Rejects duplicates and invalid slugs. */
8
- export declare function parseApiNames(raw: readonly string[] | undefined): string[];
9
- export declare function isDecohereWorkspace(dir: string): boolean;
10
- /** Directory names under `projects/` that already have a `package.json`. */
11
- export declare function listExistingApiNames(dir: string): string[];
12
- /** `billing` → `BILLING`, `admin-api` → `ADMIN_API` — prefix for `{PREFIX}_DB_HOST`. */
13
- export declare function apiEnvPrefix(apiName: string): string;
14
- export declare function apiNameFromProjectDir(dir: string): string;
@@ -1,17 +0,0 @@
1
- /** Default API project slug when `--name` is omitted. */
2
- export declare const DEFAULT_WEBAPI_NAME = "api";
3
- /** Relative path of an API project inside the monorepo. */
4
- export declare function webapiProjectDir(name: string): string;
5
- /**
6
- * Forge release entry for a scaffolded API (`pack: true` → per-target outDir).
7
- * Keep in sync with root `package.json` `"start"` / `"start:<name>"` and Dockerfiles.
8
- */
9
- export declare function webapiReleaseEntry(name: string): string;
10
- /** npm package name for a scaffolded API (`flux serve --project`). */
11
- export declare function webapiPackageName(workspaceName: string, apiName: string): string;
12
- /** Local listen port for the nth API (0-based). Production uses `PORT`. */
13
- export declare function webapiPort(index: number): number;
14
- /** @deprecated Use `webapiProjectDir(name)`. Default path for the first API. */
15
- export declare const WEBAPI_PROJECT_DIR: string;
16
- /** @deprecated Use `webapiReleaseEntry(name)`. Default start entry for the first API. */
17
- export declare const WEBAPI_RELEASE_ENTRY: string;
@@ -1,15 +0,0 @@
1
- export { WEBAPI_PROJECT_DIR, WEBAPI_RELEASE_ENTRY } from "./const.js";
2
- export type ApiOptions = {
3
- d?: string;
4
- /** Host project name (directory basename). Required when scaffolding into `/workspace`. */
5
- projectName?: string;
6
- /** API slugs under `projects/`. Default `["api"]`. Repeatable `--name`. */
7
- names?: string[];
8
- /** Add APIs to an existing Decohere workspace instead of creating a new one. */
9
- add?: boolean;
10
- authProvider?: "auth0" | "none";
11
- databaseProvider?: "none" | "postgres/typeorm";
12
- postmanProvider?: "api" | "local" | "none";
13
- installDependencies?: "yes" | "no";
14
- };
15
- export declare function scaffoldApi(cliOptions: ApiOptions): Promise<void>;
@@ -1,10 +0,0 @@
1
- import type { Feature } from "../../services/scaffold.service.js";
2
- export type AuthOptions = {
3
- authProvider?: "auth0" | "none";
4
- issuerBaseUrl?: string;
5
- audience?: string;
6
- databaseProvider?: "none" | "postgres/typeorm";
7
- adminUsername?: string;
8
- adminPassword?: string;
9
- };
10
- export declare const AuthFeature: Feature<AuthOptions>;
@@ -1,72 +0,0 @@
1
- /** Management API scopes needed for API, SPA, connections, and admin users. */
2
- declare const REQUIRED_SCOPES: string;
3
- /** Default API scopes matching Hello CASL Authorize decorators. */
4
- export declare const HELLO_API_SCOPES: readonly ["read:Hello", "create:Hello", "update:Hello", "delete:Hello"];
5
- export declare const DB_CONNECTION_NAME = "Username-Password-Authentication";
6
- export declare class Auth0AuthError extends Error {
7
- constructor(message: string);
8
- }
9
- export interface Auth0Tenant {
10
- name: string;
11
- active?: boolean;
12
- }
13
- export declare function isInstalled(): boolean;
14
- export declare function listTenants(): Auth0Tenant[];
15
- export declare function login(): boolean;
16
- export declare function listApis(): Array<{
17
- identifier: string;
18
- name: string;
19
- }>;
20
- export declare function createApi(name: string, identifier: string, scopes?: readonly string[]): {
21
- identifier: string;
22
- };
23
- /**
24
- * Replace an API's scopes and enable RBAC policy enforcement.
25
- * Auth0 CLI `--scopes` replaces the full set.
26
- */
27
- export declare function updateApiScopes(identifier: string, scopes?: readonly string[]): void;
28
- export declare function createSpaApp(name: string, callbackUrls: string | readonly string[]): {
29
- client_id: string;
30
- };
31
- export type Auth0App = {
32
- client_id: string;
33
- name: string;
34
- };
35
- export declare function listApps(): Auth0App[];
36
- export declare function updateSpaCallbacks(clientId: string, callbackUrls: string | readonly string[]): void;
37
- /**
38
- * Create a Postman SPA, or reuse an existing app with the same name (re-scaffold).
39
- * Always returns a client_id suitable for Postman auth0ClientId.
40
- */
41
- export declare function ensureSpaApp(name: string, callbackUrls: string | readonly string[]): {
42
- client_id: string;
43
- reused: boolean;
44
- };
45
- /** Enable a database connection for an application (required for username/password login). */
46
- export declare function enableConnectionForClient(connectionName: string, clientId: string): void;
47
- export type AdminDatabaseUser = {
48
- user_id: string;
49
- email: string;
50
- password: string;
51
- username: string;
52
- };
53
- /** Strong default password when the scaffolder caller leaves password blank. */
54
- export declare function generateAdminPassword(): string;
55
- /** Look up a user by email (Management API users-by-email). */
56
- export declare function findUserByEmail(email: string): {
57
- user_id: string;
58
- email: string;
59
- } | null;
60
- /** Reset password so a re-scaffold can write a known password to .env. */
61
- export declare function updateUserPassword(userId: string, password: string): void;
62
- /**
63
- * Create a DB connection root-admin user for local / Postman login.
64
- * If the user already exists, look them up, reset password to `input.password`,
65
- * and return that identity so callers can still write .env credentials.
66
- */
67
- export declare function createAdminDatabaseUser(input: {
68
- email: string;
69
- password: string;
70
- username: string;
71
- }): AdminDatabaseUser;
72
- export { REQUIRED_SCOPES };
@@ -1,5 +0,0 @@
1
- /**
2
- * Format/lint-fix all files in the scaffolded workspace with Biome.
3
- * Prefer a global `biome` binary (builder image); fall back to `npx`.
4
- */
5
- export declare function formatScaffoldedFiles(targetDir: string, paths?: string[]): void;
@@ -1,5 +0,0 @@
1
- import type { Feature } from "../../services/scaffold.service.js";
2
- export type DatabaseOptions = {
3
- databaseProvider?: "none" | "postgres/typeorm";
4
- };
5
- export declare const DatabaseFeature: Feature<DatabaseOptions>;
@@ -1,2 +0,0 @@
1
- import type { Feature } from "../../services/scaffold.service.js";
2
- export declare const FinalizeFeature: Feature;
@@ -1,16 +0,0 @@
1
- import type { Feature } from "../../services/scaffold.service.js";
2
- import { type Auth0Env } from "../postman/openapi-to-postman.js";
3
- /** Postman OAuth callback URLs (popup + "Authorize using browser"). */
4
- declare const POSTMAN_CALLBACKS: readonly ["https://oauth.pstmn.io/v1/callback", "https://oauth.pstmn.io/v1/browser-callback"];
5
- /** Scopes requested for Auth0 access tokens (OIDC + Hello CASL permissions). */
6
- declare const POSTMAN_SCOPES: string;
7
- export type PostmanOptions = {
8
- postmanProvider?: "api" | "local" | "none";
9
- apiKey?: string;
10
- workspaceId?: string;
11
- };
12
- /** Build Postman collection: OpenAPI routes + Auth0 auth overlay. */
13
- export declare function buildHybridPostmanCollection(projectName: string, auth?: Auth0Env): Promise<import("../postman/openapi-to-postman.js").PostmanCollection>;
14
- export declare const PostmanFeature: Feature<PostmanOptions>;
15
- export { buildHelloOpenApiDocument } from "../postman/hello-openapi.js";
16
- export { POSTMAN_CALLBACKS, POSTMAN_SCOPES };
@@ -1,18 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
- /**
3
- * Builder for `projects/<api>/package.json`.
4
- *
5
- * Starts with the core cortex + crucible deps. Features can call
6
- * `addDependency` / `addDevDependency` to extend.
7
- */
8
- export declare class ApiPackageJson implements KeyedModel {
9
- private readonly workspaceName;
10
- private readonly apiName;
11
- readonly key: string;
12
- private readonly _dependencies;
13
- private readonly _devDependencies;
14
- constructor(workspaceName: string, apiName?: string);
15
- addDependency(name: string, version: string): this;
16
- addDevDependency(name: string, version: string): this;
17
- files(): SourceFile[];
18
- }
@@ -1,26 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
- export type AdminUserConfig = {
3
- sub: string;
4
- email: string;
5
- password: string;
6
- username: string;
7
- };
8
- export type AuthConfig = {
9
- issuerBaseUrl: string;
10
- audience: string;
11
- adminUser?: AdminUserConfig;
12
- };
13
- /**
14
- * Data-carrier model for auth configuration.
15
- *
16
- * Registered by AuthFeature when auth0 is configured. Other features (e.g.
17
- * PostmanFeature) retrieve it via workspace.getModel(WELL_KNOWN_FILES.AUTH_CONFIG).
18
- * Produces no files — exists solely so features can communicate auth details.
19
- */
20
- export declare class AuthConfigModel implements KeyedModel {
21
- readonly config: AuthConfig;
22
- readonly key: string;
23
- constructor(config: AuthConfig);
24
- setAdminUser(adminUser: AdminUserConfig): void;
25
- files(): SourceFile[];
26
- }
@@ -1,45 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
- /**
3
- * A controller method. Features call `addDecorator()` to prepend decorators
4
- * before the HTTP verb decorator (e.g. `@AllowAnonymous` before `@Get()`).
5
- */
6
- export declare class ControllerMethod {
7
- readonly name: string;
8
- private readonly _httpDecorator;
9
- private readonly _params;
10
- private readonly _extraDecorators;
11
- private _body;
12
- private _isAsync;
13
- constructor(name: string, _httpDecorator: string, _params: string, isAsync: boolean, body: string[]);
14
- addDecorator(decorator: string): this;
15
- /** Replace the method body lines (used by features that extend generated behaviour). */
16
- setBody(body: string[]): this;
17
- setAsync(isAsync?: boolean): this;
18
- render(): string[];
19
- }
20
- /**
21
- * Model for `projects/api/src/controllers/hello.controller.ts`.
22
- *
23
- * Pre-initialised with all routes and their HTTP decorators. Features mutate
24
- * the model via `getMethod(name).addDecorator(...)`, `addDecorator(...)` (class
25
- * level), `addCortexImport(...)`, `addImport(...)`, and `addConstructorParam(...)`.
26
- */
27
- export declare class ControllerSourceFile implements KeyedModel {
28
- readonly key: string;
29
- private readonly _cortexImports;
30
- private readonly _extraImportGroups;
31
- private readonly _classDecorators;
32
- private readonly _ctorParams;
33
- private readonly _methods;
34
- /** Retrieve a method by name to mutate its decorators. */
35
- getMethod(name: string): ControllerMethod;
36
- /** Add a class-level decorator (e.g. `@Authorize`). */
37
- addDecorator(decorator: string): this;
38
- /** Add a named import from `@decohere/cortex`. */
39
- addCortexImport(name: string, typeOnly?: boolean): this;
40
- /** Add a named import from any other module. */
41
- addImport(name: string, from: string, typeOnly?: boolean): this;
42
- /** Add a constructor parameter (e.g. an injected dependency). */
43
- addConstructorParam(param: string): this;
44
- files(): SourceFile[];
45
- }
@@ -1,9 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
- /**
3
- * Minimal GitHub Actions for scaffolded apps: lint ∥ test, build gate on default branch,
4
- * npm publish after CI (skips private packages). No default forge docker --push.
5
- */
6
- export declare class GithubCiWorkflows implements KeyedModel {
7
- readonly key: string;
8
- files(): SourceFile[];
9
- }