create-cogitator-app 0.7.1 → 0.8.1

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/dist/lib.d.ts CHANGED
@@ -160,6 +160,10 @@ interface SetupState {
160
160
  keyWritten: boolean;
161
161
  /** Whether the Ollama model is known to be pulled. */
162
162
  modelReady: boolean;
163
+ /** Whether the compose services were started already. */
164
+ servicesStarted?: boolean;
165
+ /** Whether the Ollama container compose started is pulling the model. */
166
+ modelPulling?: boolean;
163
167
  }
164
168
 
165
169
  interface PlanOptions {
@@ -178,6 +182,8 @@ interface ProjectPlan {
178
182
  env: EnvVar[];
179
183
  /** Compose services the project starts locally. */
180
184
  services: string[];
185
+ /** The services among them that run a task and exit, such as pulling the Ollama models. */
186
+ oneShotServices: string[];
181
187
  warnings: string[];
182
188
  /** The command that creates this project again. */
183
189
  command: string;
@@ -528,6 +534,35 @@ declare function createFromTemplate(template: RemoteTemplate, options: StarterOp
528
534
  token?: string;
529
535
  }): Promise<StarterResult>;
530
536
 
537
+ /**
538
+ * Whether Docker can start the project's services: the compose plugin is
539
+ * installed and the daemon answers. Never throws.
540
+ */
541
+ declare function dockerComposeAvailable(cwd: string): Promise<boolean>;
542
+ /**
543
+ * Starts the compose services of a scaffolded project in `directory` and
544
+ * waits until the long-running ones are healthy, or running when they have no
545
+ * healthcheck. One-shot services, such as the one that pulls the Ollama
546
+ * models, start afterwards without waiting, since `--wait` is not meant for
547
+ * containers that exit. Resolves with how it went and never throws.
548
+ */
549
+ declare function startServices(directory: string, plan: Pick<ProjectPlan, 'services' | 'oneShotServices'>): Promise<StepResult>;
550
+
551
+ type ComposeServices = Pick<ProjectPlan, 'services' | 'oneShotServices'>;
552
+ /**
553
+ * The services to start: all of them, but the Ollama ones when an Ollama
554
+ * already answers where the project looks for it. The project uses that one,
555
+ * and a second one in compose could not bind its port anyway.
556
+ */
557
+ declare function servicesToStart(plan: ComposeServices, ollamaUrl?: string): Promise<ComposeServices>;
558
+ /**
559
+ * Offers to start the project's compose services when it has some and Docker
560
+ * is ready, and starts them on a yes. Only for an interactive run: the caller
561
+ * never asks in CI, with `--yes`, `--json` or without a TTY. Resolves with
562
+ * whether they were started.
563
+ */
564
+ declare function offerServices(directory: string, plan: ComposeServices): Promise<boolean>;
565
+
531
566
  /** A combination the generated project could not work with, and how to fix it. */
532
567
  interface CompatIssue {
533
568
  message: string;
@@ -669,8 +704,10 @@ interface OllamaModel {
669
704
  size: number;
670
705
  }
671
706
  /**
672
- * The Ollama server the generated code talks to: `OLLAMA_BASE_URL`, which it
673
- * reads, then `OLLAMA_HOST`, which the Ollama CLI reads, then the local default.
707
+ * The Ollama server the generated project talks to: `OLLAMA_BASE_URL`, which
708
+ * its `cogitator.yml` reads, else the local default. `OLLAMA_HOST` is where
709
+ * the Ollama server listens, often `0.0.0.0`, and the project never reads it.
710
+ * A bare host gets port 11434, the way Ollama reads its own address.
674
711
  */
675
712
  declare function resolveOllamaUrl(env?: Record<string, string | undefined>): string;
676
713
  /** The models installed in the Ollama at `baseUrl`, or `undefined` when it does not answer. */
@@ -730,6 +767,8 @@ declare const VERSIONS: {
730
767
  readonly typesNode: "^24.19.1";
731
768
  readonly tsx: "^4.23.15";
732
769
  readonly vitest: "^5.0.3";
770
+ /** A peer vitest requires and Yarn, unlike npm, pnpm and Bun, does not install by itself. */
771
+ readonly vite: "^8.3.4";
733
772
  readonly biome: "^2.5.15";
734
773
  readonly express: "^5.2.1";
735
774
  readonly typesExpress: "^5.0.6";
@@ -884,6 +923,10 @@ interface Io {
884
923
  interface RunDeps {
885
924
  fetch?: typeof fetch;
886
925
  env?: NodeJS.ProcessEnv;
926
+ /** The terminal input, which decides with `env` whether anything is asked. */
927
+ stdin?: {
928
+ isTTY?: boolean;
929
+ };
887
930
  /** Where telemetry goes, the release's Umami website by default. */
888
931
  telemetry?: {
889
932
  websiteId?: string;
@@ -897,4 +940,41 @@ declare function run(argv: readonly string[], io?: Io, deps?: RunDeps): Promise<
897
940
  /** The candidate closest to `input`, when it is close enough to be a typo of it. */
898
941
  declare function closest(input: string, candidates: readonly string[]): string | undefined;
899
942
 
900
- export { APP_CHOICES, APP_KINDS, type AddChanges, type AddConflict, AddConflictError, type AddNote, type AddOptions, type AddPlan, type AddResult, type AppKind, CHANNELS, CHANNEL_CHOICES, CODING_AGENTS, CODING_AGENT_CHOICES, type ChannelKind, type Choice, CodedError, type CodingAgent, type CompatIssue, DEFAULT_OLLAMA_URL, DEFAULT_PRESET, DEPLOY_CHOICES, DEPLOY_TARGETS, type DeployTarget, type DownloadResult, type ExampleEntry, type ExamplePlan, type ExamplePlanOptions, FEATURES, FEATURE_CHOICES, type FailedStep, type FeatureId, type FileChange, IMAGES, IncompatibleSpecError, type KeyCheck, type LLMProvider, LOCK_PATH, MANIFEST_KEY, MEMORIES, MEMORY_CHOICES, type MemoryKind, type ModelChoice, type ModelChoices, type ModelSource, NotAScaffoldedProjectError, OLLAMA_SUGGESTED_MODELS, type OllamaModel, PACKAGE_MANAGERS, PAYLOAD_FIELDS, PRESETS, PROVIDERS, PROVIDER_INFO, type PackageManager, type PlanOptions, type PreparedTemplate, type Preset, type ProjectPlan, type ProjectSpec, type ProjectSpecInput, ProjectSpecSchema, type ProviderInfo, type RemoteTemplate, SERVERS, SERVER_CHOICES, type ScaffoldFailure, type ScaffoldLock, type ScaffoldLogger, type ScaffoldManifest, type ScaffoldOptions, type ScaffoldResult, type ServerFramework, type StarterOptions, type StarterResult, type StepResult, TELEMETRY_DOCS, TELEMETRY_HOST, type TelemetryPayload, VECTOR_STORES, VECTOR_STORE_CHOICES, VERSIONS, type VectorStore, addToProject, assertCompatible, bareModel, changesDependencies, checkApiKey, closest, cloudModelChoices, cogitatorVersion, compatibilityIssues, createFromExample, createFromTemplate, defaultModel, describeKeyCheck, describeModel, describeTemplate, detectPackageManager, detectPackageManagerSpec, downloadTemplate, exampleFileUrl, exampleRef, examples, execCommand, fetchExampleFiles, findExample, findPreset, firstRunNotice, formatProject, hasOllamaModel, hashContent, installCommand, installErrorCode, installFailure, knownCogitatorVersions, listOllamaModels, modelChoices, ollamaModelChoices, parseExampleArgument, parseSpec, payloadFor, planAdd, planExample, planProject, prepareTemplate, presetIds, providerEnvKey, providerInfo, pullOllamaModel, qualifiedModel, readLock, resolveExample, resolveOllamaUrl, run, runScript, scaffold, scaffolderVersion, sendTelemetry, silentLogger, telemetryDisabledReason, telemetryErrorCode, telemetryWebsiteId, templateArchive, unifiedDiff, updateLock, validateProjectName, writeFiles, writeLock };
943
+ interface CliArgs {
944
+ directory?: string;
945
+ preset?: string;
946
+ remote?: RemoteTemplate;
947
+ example?: string;
948
+ app?: AppKind;
949
+ server?: ServerFramework;
950
+ channels?: ChannelKind[];
951
+ memory?: MemoryKind;
952
+ vectorStore?: VectorStore;
953
+ features?: FeatureId[];
954
+ deploy?: DeployTarget;
955
+ compose?: boolean;
956
+ provider?: LLMProvider;
957
+ model?: string;
958
+ apiKey?: string;
959
+ packageManager?: PackageManager;
960
+ codingAgents?: CodingAgent[];
961
+ git?: boolean;
962
+ install?: boolean;
963
+ telemetry?: boolean;
964
+ yes: boolean;
965
+ dryRun: boolean;
966
+ json: boolean;
967
+ help: boolean;
968
+ version: boolean;
969
+ listTemplates: boolean;
970
+ listExamples: boolean;
971
+ }
972
+ /**
973
+ * Whether to ask questions: only at a terminal, and never with `--yes`,
974
+ * `--json` or in CI, where nobody can answer.
975
+ */
976
+ declare function isInteractive(args: Pick<CliArgs, 'yes' | 'json'>, env?: NodeJS.ProcessEnv, stdin?: {
977
+ isTTY?: boolean;
978
+ }): boolean;
979
+
980
+ export { APP_CHOICES, APP_KINDS, type AddChanges, type AddConflict, AddConflictError, type AddNote, type AddOptions, type AddPlan, type AddResult, type AppKind, CHANNELS, CHANNEL_CHOICES, CODING_AGENTS, CODING_AGENT_CHOICES, type ChannelKind, type Choice, CodedError, type CodingAgent, type CompatIssue, DEFAULT_OLLAMA_URL, DEFAULT_PRESET, DEPLOY_CHOICES, DEPLOY_TARGETS, type DeployTarget, type DownloadResult, type ExampleEntry, type ExamplePlan, type ExamplePlanOptions, FEATURES, FEATURE_CHOICES, type FailedStep, type FeatureId, type FileChange, IMAGES, IncompatibleSpecError, type KeyCheck, type LLMProvider, LOCK_PATH, MANIFEST_KEY, MEMORIES, MEMORY_CHOICES, type MemoryKind, type ModelChoice, type ModelChoices, type ModelSource, NotAScaffoldedProjectError, OLLAMA_SUGGESTED_MODELS, type OllamaModel, PACKAGE_MANAGERS, PAYLOAD_FIELDS, PRESETS, PROVIDERS, PROVIDER_INFO, type PackageManager, type PlanOptions, type PreparedTemplate, type Preset, type ProjectPlan, type ProjectSpec, type ProjectSpecInput, ProjectSpecSchema, type ProviderInfo, type RemoteTemplate, SERVERS, SERVER_CHOICES, type ScaffoldFailure, type ScaffoldLock, type ScaffoldLogger, type ScaffoldManifest, type ScaffoldOptions, type ScaffoldResult, type ServerFramework, type StarterOptions, type StarterResult, type StepResult, TELEMETRY_DOCS, TELEMETRY_HOST, type TelemetryPayload, VECTOR_STORES, VECTOR_STORE_CHOICES, VERSIONS, type VectorStore, addToProject, assertCompatible, bareModel, changesDependencies, checkApiKey, closest, cloudModelChoices, cogitatorVersion, compatibilityIssues, createFromExample, createFromTemplate, defaultModel, describeKeyCheck, describeModel, describeTemplate, detectPackageManager, detectPackageManagerSpec, dockerComposeAvailable, downloadTemplate, exampleFileUrl, exampleRef, examples, execCommand, fetchExampleFiles, findExample, findPreset, firstRunNotice, formatProject, hasOllamaModel, hashContent, installCommand, installErrorCode, installFailure, isInteractive, knownCogitatorVersions, listOllamaModels, modelChoices, offerServices, ollamaModelChoices, parseExampleArgument, parseSpec, payloadFor, planAdd, planExample, planProject, prepareTemplate, presetIds, providerEnvKey, providerInfo, pullOllamaModel, qualifiedModel, readLock, resolveExample, resolveOllamaUrl, run, runScript, scaffold, scaffolderVersion, sendTelemetry, servicesToStart, silentLogger, startServices, telemetryDisabledReason, telemetryErrorCode, telemetryWebsiteId, templateArchive, unifiedDiff, updateLock, validateProjectName, writeFiles, writeLock };