Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#210 auto install deps when creating a new ts srcbook #210 #342

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/api/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async function init() {
const defaultConfig = {
baseDir: HOME_DIR,
defaultLanguage: 'typescript',
autoInstallDependencies: true,
installId: randomid(),
aiConfig: { provider: 'openai', model: 'gpt-4o' } as const,
aiProvider: 'openai',
Expand Down
3 changes: 3 additions & 0 deletions packages/api/db/schema.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export const configs = sqliteTable('config', {
defaultLanguage: text('default_language').notNull().default('typescript'),
openaiKey: text('openai_api_key'),
anthropicKey: text('anthropic_api_key'),
autoInstallDependencies: integer('auto_install_dependencies', { mode: 'boolean' })
.notNull()
.default(true),
// TODO: This is deprecated in favor of SRCBOOK_DISABLE_ANALYTICS env variable. Remove this.
enabledAnalytics: integer('enabled_analytics', { mode: 'boolean' }).notNull().default(true),
// Stable ID for posthog
Expand Down
1 change: 1 addition & 0 deletions packages/api/drizzle/0012_add_auto_install_dependency.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `config` ADD `auto_install_dependencies` integer DEFAULT true NOT NULL;
261 changes: 261 additions & 0 deletions packages/api/drizzle/meta/0011_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
{
"version": "6",
"dialect": "sqlite",
"id": "b16851ac-e597-411d-9b50-df46ad9d2c99",
"prevId": "aeb418fb-06df-4fc2-8afc-f18d95014b46",
"tables": {
"apps": {
"name": "apps",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"language": {
"name": "language",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"external_id": {
"name": "external_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
}
},
"indexes": {
"apps_external_id_unique": {
"name": "apps_external_id_unique",
"columns": [
"external_id"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"config": {
"name": "config",
"columns": {
"base_dir": {
"name": "base_dir",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"default_language": {
"name": "default_language",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'typescript'"
},
"openai_api_key": {
"name": "openai_api_key",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"anthropic_api_key": {
"name": "anthropic_api_key",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"auto_install_dependencies": {
"name": "auto_install_dependencies",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": true
},
"enabled_analytics": {
"name": "enabled_analytics",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": true
},
"srcbook_installation_id": {
"name": "srcbook_installation_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'mdbjec3psib2rf35a3t3bhsibg'"
},
"ai_provider": {
"name": "ai_provider",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'openai'"
},
"ai_model": {
"name": "ai_model",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'gpt-4o'"
},
"ai_base_url": {
"name": "ai_base_url",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"subscription_email": {
"name": "subscription_email",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"secrets": {
"name": "secrets",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"value": {
"name": "value",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"secrets_name_unique": {
"name": "secrets_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"secrets_to_sessions": {
"name": "secrets_to_sessions",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"session_id": {
"name": "session_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"secret_id": {
"name": "secret_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"secrets_to_sessions_session_id_secret_id_unique": {
"name": "secrets_to_sessions_session_id_secret_id_unique",
"columns": [
"session_id",
"secret_id"
],
"isUnique": true
}
},
"foreignKeys": {
"secrets_to_sessions_secret_id_secrets_id_fk": {
"name": "secrets_to_sessions_secret_id_secrets_id_fk",
"tableFrom": "secrets_to_sessions",
"tableTo": "secrets",
"columnsFrom": [
"secret_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}
Loading