Skip to content

Commit bc2f323

Browse files
committed
chore: update docs/INSTALL.md, packages/core/state/sqlite/migrations.ts, packages/core/state/sqlite/sqlite-connection.adapter.ts +1 more
1 parent 568164e commit bc2f323

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

docs/INSTALL.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ quieras versionar la colección para revisarla en los PRs.
235235
| `history` | Lista las generaciones previas guardadas en `~/.tanit/history.jsonl` con `--limit N`, filtro por `--project`, salida `--json` y `--clear`. |
236236
| `sync` | Reutiliza la pipeline de generación para sincronizar el estado; con `--dry-run` inspecciona sin escribir archivos. |
237237
| `serve` | Inicia el host local para servir la interfaz y sus operaciones de aplicación. |
238+
| `scan` | Escanea el proyecto y, con `--shadow`, persiste opcionalmente un snapshot de estado sin cambiar la autoridad de lectura. |
238239

239240
### `history` — ver qué se ha generado antes
240241

@@ -251,6 +252,12 @@ apisrc sync --project-root .
251252
apisrc sync --project-root . --dry-run
252253
```
253254

255+
Para inspeccionar rutas y escribir el estado durable en modo shadow:
256+
257+
```sh
258+
apisrc scan --project-root . --shadow
259+
```
260+
254261
Para iniciar el host local de la interfaz y sus operaciones:
255262

256263
```sh

packages/core/state/sqlite/migrations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const STATE_DATABASE_MIGRATIONS: readonly IStateMigration[] = [
5151
version: 1,
5252
up: (database) => database.exec(SCHEMA_SQL),
5353
down: (database) => {
54-
for (const table of [...STATE_DB_TABLES].reverse()) database.exec(`DROP TABLE IF EXISTS ${table};`);
54+
for (const table of [...STATE_DB_TABLES].reverse()) database.exec(`DROP TABLE IF EXISTS ${table};`); // lint:sast ignore — table procede exclusivamente de STATE_DB_TABLES.
5555
},
5656
},
5757
{
@@ -70,7 +70,7 @@ function readVersion(database: IStateMigrationDatabase): number {
7070
}
7171

7272
function setVersion(database: IStateMigrationDatabase, version: number): void {
73-
database.exec(`PRAGMA user_version = ${version}`);
73+
database.exec(`PRAGMA user_version = ${version}`); // lint:sast ignore — version es numérica y procede de migraciones internas.
7474
}
7575

7676
function validateSchema(database: IStateMigrationDatabase): void {

packages/core/state/sqlite/sqlite-connection.adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface IStateDatabaseConnection {
1919
export function openStateDatabase(path = resolveStateDatabasePath()): IStateDatabaseConnection {
2020
mkdirSync(dirname(path), { recursive: true });
2121
const database = new Database(path, { create: true, strict: true });
22-
database.exec(`PRAGMA foreign_keys = ON; PRAGMA journal_mode = WAL; PRAGMA busy_timeout = ${STATE_DB_BUSY_TIMEOUT_MS};`);
22+
database.exec(`PRAGMA foreign_keys = ON; PRAGMA journal_mode = WAL; PRAGMA busy_timeout = ${STATE_DB_BUSY_TIMEOUT_MS};`); // lint:sast ignore — timeout es una constante numérica interna.
2323
const version = migrateStateDatabase(database);
2424
if (version !== STATE_DB_SCHEMA_VERSION) {
2525
database.close();

tests/core/state/sqlite/migrations.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe("state database migrations", () => {
4545

4646
it("rejects an unknown future version", () => {
4747
const database = new Database(":memory:");
48-
database.exec(`PRAGMA user_version = ${STATE_DB_SCHEMA_VERSION + 1}`);
48+
database.exec(`PRAGMA user_version = ${STATE_DB_SCHEMA_VERSION + 1}`); // lint:sast ignore — version derivada de una constante numérica.
4949
expect(() => migrateStateDatabase(database)).toThrow(StateDatabaseMigrationError);
5050
database.close();
5151
});
@@ -54,7 +54,7 @@ describe("state database migrations", () => {
5454
const database = new Database(":memory:");
5555
database.exec("PRAGMA user_version = 2; CREATE TABLE projects (broken TEXT)");
5656
for (const table of ["snapshots", "services", "operations", "servers", "auth_profiles", "schemas", "diagnostics", "provenance", "source_files"]) {
57-
database.exec(`CREATE TABLE ${table} (placeholder TEXT)`);
57+
database.exec(`CREATE TABLE ${table} (placeholder TEXT)`); // lint:sast ignore — table es una lista literal cerrada del test.
5858
}
5959
expect(() => migrateStateDatabase(database)).toThrow(StateDatabaseMigrationError);
6060
database.close();

0 commit comments

Comments
 (0)