@rvoh/dream
    Preparing search index...

    Class DreamCLI

    Index

    Constructors

    Accessors

    Methods

    • Internal

      Called by Psychic (and other consumers) to programmatically generate a Dream model with all associated files.

      Parameters

      • opts: {
            columnsWithTypes: string[];
            fullyQualifiedModelName: string;
            fullyQualifiedParentName?: string;
            options: {
                connectionName: string;
                includeAdminSerializers: boolean;
                includeInternalSerializers?: boolean;
                modelName?: string;
                serializer: boolean;
                softDelete?: boolean;
                stiBaseSerializer: boolean;
                tableName?: string;
            };
        }

      Returns Promise<void>

    • called under the hood when provisioning both psychic and dream applications.

      Parameters

      • program: Command
      • __namedParameters: {
            initializeDreamApp: (opts?: DreamAppInitOptions) => Promise<any>;
            onSync: () => void | Promise<void>;
            seedDb: () => void | Promise<void>;
        }

      Returns void

    • Starts the Dream console

      Parameters

      • context: Record<string, unknown>

      Returns Promise<void>

    • use this method for initializing a standalone dream application. If using Psychic and Dream together, a different pattern is used, which leverages the generateDreamCli method instead.

      Parameters

      • program: Command
      • __namedParameters: {
            initializeDreamApp: (opts?: DreamAppInitOptions) => Promise<DreamApp>;
            seedDb: () => void | Promise<void>;
        }

      Returns void

    • Run a developer-authored CLI command. Always runs in argv form (the underlying child_process spawn is called with shell: false): command is exec'd literally and opts.args are passed as separate argv elements. Shell-form invocation is intentionally not supported — there is no caller that needs &&-chaining, globs, or other shell features that can't be expressed as argv.

      For backward compatibility, command may contain implicit args separated by whitespace (e.g. 'pnpm psy sync'); the leading token becomes the program and the rest are split out and prepended to any opts.args so the original argument order is preserved:

      DreamCLI.spawn('pnpm psy sync')
        → spawn('pnpm', ['psy', 'sync'])
      
      DreamCLI.spawn('pnpm psy', { args: ['sync', '--flag'] })
        → spawn('pnpm', ['psy', 'sync', '--flag'])
      

      For dev-time CLI glue only (scaffolding, doc generation, type sync). No runtime HTTP request input ever reaches this function. Inputs are constant literals or composed from developer-supplied config (package.json scripts, CLI argv, scaffold templates) — never from runtime request input or any other untrusted external source.

      Argv-form passes config values and paths literally to the child, without interpreting shell metacharacters. Credentials belong in the child's environment, since argv is visible in process listings and in the refused-spawn error.

      Primary gate: every caller restricts spawn use to dev/test code paths (CLI commands, the dev watcher, scaffold-time code generators, generated cli:sync initializers wrapped in if (AppEnv.isDevelopmentOrTest)).

      Backstop: throws SspawnRequiresDevelopmentOrTest when NODE_ENV is anything other than development or test. Checking !isDevelopmentOrTest (rather than isProduction) means staging-style envs and any unforeseen NODE_ENV value also fail closed.

      Parameters

      • command: string
      • Optionalopts: SpawnOptions

      Returns Promise<void>