SuperAPI AI Directory

db-list

Coding & development

View repository

Updated 10-15 17:18

About this skill

/db-list — Database registry management

Manages the file .v8-project.json — the registry of the project's infobases. The file stores connection parameters, aliases, and Git branch bindings.

Usage

/db-list                    — показать список баз
/db-list add                — добавить базу (интерактивно)
/db-list remove <id>        — удалить базу из реестра
/db-list show <id|alias>    — подробности по базе

Format .v8-project.json

The file is located in the project root (next to .git/).

{
  "v8path": "C:\\Program Files\\1cv8\\8.3.25.1257\\bin",
  "databases": [
    {
      "id": "dev",
      "name": "Разработка",
      "type": "file",
      "path": "C:\\Bases\\MyApp_Dev",
      "user": "Admin",
      "password": "",
      "aliases": ["dev", "разработка"],
      "branches": ["dev", "develop", "feature/*"],
      "configSrc": "C:\\WS\\myapp\\cfsrc"
    },
    {
      "id": "test",
      "name": "Тестовая",
      "type": "server",
      "server": "srv01",
      "ref": "MyApp_Test",
      "user": "Admin",
      "password": "123",
      "aliases": ["test", "тест"]
    }
  ],
  "default": "dev"
}

Root object fields

Field Type Description
v8path string 1C platform bin directory. Optional — if not set, auto-detection
databases array Array of databases
default string id of the default database

Database object fields

Field Type Required Description
id string yes Unique identifier (Latin characters, no spaces)
name string yes Human-readable name
type "file" / "server" yes Connection type
path string for file Path to the file infobase directory
server string for server 1C server address
ref string for server Database name on the server
user string no 1C user name
password string no Password
aliases string[] no Alternative names for quick access
branches string[] no Git branches or glob patterns (release/*, feature/*), bound to this database
configSrc string no Configuration XML dump directory

Database resolution algorithm

This algorithm is used by ALL skills (db-*, epf-build, epf-dump, erf-build, erf-dump) to determine the target database.

  1. If the user specified connection parameters (path, server) — use directly
  2. If the user specified a database by name — look for a match in this order:
    1. By id (exact match)
    2. By aliases (array match with morphology: “тестовую” = “тестовая” = “тестовой”)
    3. By name (fuzzy match with morphology and case)
  3. If the user did not specify a database — match the current Git branch with databases[].branches:
    • Exact match: branch dev → "branches": ["dev"]
    • Glob pattern: branch release/2.1 → "branches": ["release/*"]
  4. If the branch did not match — use default
  5. If not found or ambiguous — ask the user
  6. If the file .v8-project.json was not found — ask for connection parameters and suggest creating the file

After execution: if the database used is not registered — suggest adding it via /db-list add.

Platform auto-detection

If v8path is not set in the config:

$v8 = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" | Sort-Object -Descending | Select-Object -First 1

Operations

Show the list of databases

Read .v8-project.json, output the table:

ID      Имя           Тип      Путь/Сервер              По умолч.
dev     Разработка    file     C:\Bases\MyApp_Dev       ✓
test    Тестовая      server   srv01/MyApp_Test

Add a database

Ask the user via AskUserQuestion:

  • id, name, type (file/server)
  • path (for file) or server + ref (for server)
  • user, password (optional)
  • aliases, branches (optional)

Add to the array databases. If this is the first database — set it as default.

Delete a database

Delete from the array databases by id. If the one being deleted was default — ask for a new default.

Database details

Output all fields of a specific database.

Building the connection string

For use in command templates of other skills:

File database:

/F "<path>"

Server database:

/S "<server>/<ref>"

Authentication (added if user is set):

/N"<user>" /P"<password>"

Important: there is no space between /N and the name. There is no space between /P and the password. If the password is empty — omit /P entirely.