@arcbridge/core 0.1.2 → 0.1.4
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/index.d.ts +35 -22
- package/dist/index.js +522 -65
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import
|
|
2
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
3
3
|
|
|
4
4
|
declare const ServiceSchema: z.ZodObject<{
|
|
5
5
|
name: z.ZodString;
|
|
@@ -720,13 +720,24 @@ declare const AgentRoleSchema: z.ZodObject<{
|
|
|
720
720
|
}>;
|
|
721
721
|
type AgentRole = z.infer<typeof AgentRoleSchema>;
|
|
722
722
|
|
|
723
|
-
|
|
724
|
-
|
|
723
|
+
/** Re-export DatabaseSync as Database for use across the codebase. */
|
|
724
|
+
type Database = DatabaseSync;
|
|
725
|
+
declare function suppressSqliteWarning(): void;
|
|
726
|
+
declare function openDatabase(dbPath: string): Database;
|
|
727
|
+
declare function openMemoryDatabase(): Database;
|
|
728
|
+
/**
|
|
729
|
+
* Wrap a synchronous function in a SQLite transaction (BEGIN/COMMIT/ROLLBACK).
|
|
730
|
+
* Supports nesting via SAVEPOINTs — inner calls create savepoints
|
|
731
|
+
* instead of starting a new transaction.
|
|
732
|
+
*
|
|
733
|
+
* fn must be synchronous — passing an async function will throw.
|
|
734
|
+
*/
|
|
735
|
+
declare function transaction<T>(db: Database, fn: () => T): T;
|
|
725
736
|
|
|
726
737
|
declare const CURRENT_SCHEMA_VERSION = 2;
|
|
727
|
-
declare function initializeSchema(db: Database
|
|
738
|
+
declare function initializeSchema(db: Database): void;
|
|
728
739
|
|
|
729
|
-
declare function migrate(db: Database
|
|
740
|
+
declare function migrate(db: Database): void;
|
|
730
741
|
|
|
731
742
|
interface InitProjectInput {
|
|
732
743
|
name: string;
|
|
@@ -751,14 +762,14 @@ declare function generatePlan(targetDir: string, input: InitProjectInput): void;
|
|
|
751
762
|
declare function generateAgentRoles(targetDir: string, template?: string): AgentRole[];
|
|
752
763
|
|
|
753
764
|
interface GenerateDatabaseResult {
|
|
754
|
-
db: Database
|
|
765
|
+
db: Database;
|
|
755
766
|
warnings: string[];
|
|
756
767
|
}
|
|
757
768
|
/**
|
|
758
769
|
* Re-read arc42 files from disk and update the database.
|
|
759
770
|
* Uses INSERT OR REPLACE to pick up changes made since initial generation.
|
|
760
771
|
*/
|
|
761
|
-
declare function refreshFromDocs(db: Database
|
|
772
|
+
declare function refreshFromDocs(db: Database, targetDir: string): string[];
|
|
762
773
|
declare function generateDatabase(targetDir: string, input: InitProjectInput): GenerateDatabaseResult;
|
|
763
774
|
|
|
764
775
|
interface IndexerOptions {
|
|
@@ -818,7 +829,7 @@ declare function discoverDotnetServices(projectRoot: string): DotnetProjectInfo[
|
|
|
818
829
|
* Scan the project root for package dependency manifests (package.json, .csproj)
|
|
819
830
|
* and write discovered dependencies to the package_dependencies table.
|
|
820
831
|
*/
|
|
821
|
-
declare function indexPackageDependencies(db: Database
|
|
832
|
+
declare function indexPackageDependencies(db: Database, projectRoot: string, service?: string): number;
|
|
822
833
|
|
|
823
834
|
type ProjectLanguage = "typescript" | "csharp" | "auto";
|
|
824
835
|
/**
|
|
@@ -831,7 +842,7 @@ declare function detectProjectLanguage(projectRoot: string): "typescript" | "csh
|
|
|
831
842
|
* Index a project, auto-detecting the language unless explicitly specified.
|
|
832
843
|
* Dispatches to the TypeScript or .NET indexer accordingly.
|
|
833
844
|
*/
|
|
834
|
-
declare function indexProject(db: Database
|
|
845
|
+
declare function indexProject(db: Database, options: IndexerOptions): Promise<IndexResult>;
|
|
835
846
|
|
|
836
847
|
type DriftKind = "undocumented_module" | "missing_module" | "dependency_violation" | "unlinked_test" | "stale_adr" | "new_dependency";
|
|
837
848
|
type DriftSeverity = "info" | "warning" | "error";
|
|
@@ -853,12 +864,12 @@ interface DriftOptions {
|
|
|
853
864
|
* Compares building block code_paths against actual indexed files,
|
|
854
865
|
* checks cross-block dependencies, and validates ADR references.
|
|
855
866
|
*/
|
|
856
|
-
declare function detectDrift(db: Database
|
|
867
|
+
declare function detectDrift(db: Database, options?: DriftOptions): DriftEntry[];
|
|
857
868
|
/**
|
|
858
869
|
* Write drift entries to the drift_log table.
|
|
859
870
|
* Clears existing unresolved entries and inserts fresh ones.
|
|
860
871
|
*/
|
|
861
|
-
declare function writeDriftLog(db: Database
|
|
872
|
+
declare function writeDriftLog(db: Database, entries: DriftEntry[]): void;
|
|
862
873
|
|
|
863
874
|
interface TaskInferenceResult {
|
|
864
875
|
taskId: string;
|
|
@@ -870,11 +881,11 @@ interface TaskInferenceResult {
|
|
|
870
881
|
* Infer task status from code state.
|
|
871
882
|
* Checks if building block code exists, acceptance criteria symbols are present, etc.
|
|
872
883
|
*/
|
|
873
|
-
declare function inferTaskStatuses(db: Database
|
|
884
|
+
declare function inferTaskStatuses(db: Database, phaseId: string): TaskInferenceResult[];
|
|
874
885
|
/**
|
|
875
886
|
* Apply inferred statuses to the database and optionally write back to YAML.
|
|
876
887
|
*/
|
|
877
|
-
declare function applyInferences(db: Database
|
|
888
|
+
declare function applyInferences(db: Database, inferences: TaskInferenceResult[], projectRoot: string): void;
|
|
878
889
|
|
|
879
890
|
/**
|
|
880
891
|
* Update a task's status in the YAML task file.
|
|
@@ -998,10 +1009,10 @@ interface MetricsResult {
|
|
|
998
1009
|
}
|
|
999
1010
|
type ExportFormat = "json" | "csv" | "markdown";
|
|
1000
1011
|
|
|
1001
|
-
declare function insertActivity(db: Database
|
|
1002
|
-
declare function getSessionTotals(db: Database
|
|
1003
|
-
declare function queryMetrics(db: Database
|
|
1004
|
-
declare function exportMetrics(db: Database
|
|
1012
|
+
declare function insertActivity(db: Database, params: InsertActivityParams): number;
|
|
1013
|
+
declare function getSessionTotals(db: Database, since?: string, model?: string): SessionTotals;
|
|
1014
|
+
declare function queryMetrics(db: Database, params: QueryMetricsParams): MetricsResult;
|
|
1015
|
+
declare function exportMetrics(db: Database, projectRoot: string, format: ExportFormat, params: Omit<QueryMetricsParams, "groupBy" | "limit">, maxRows?: number): string;
|
|
1005
1016
|
|
|
1006
1017
|
interface ChangedFile {
|
|
1007
1018
|
status: "added" | "modified" | "deleted" | "renamed";
|
|
@@ -1020,9 +1031,11 @@ interface GitRef {
|
|
|
1020
1031
|
* - "last-phase" → commit stored in arcbridge_meta under "phase_sync_commit", or HEAD~5 fallback
|
|
1021
1032
|
* - anything else → treated as a literal git ref (branch, tag, SHA)
|
|
1022
1033
|
*/
|
|
1023
|
-
declare function resolveRef(projectRoot: string, since: string, db?: Database
|
|
1034
|
+
declare function resolveRef(projectRoot: string, since: string, db?: Database): GitRef;
|
|
1024
1035
|
/**
|
|
1025
|
-
* Get list of changed files between a ref and HEAD.
|
|
1036
|
+
* Get list of changed files between a ref and HEAD, including uncommitted changes.
|
|
1037
|
+
* Merges committed diffs with staged+unstaged working tree changes so that
|
|
1038
|
+
* practice reviews and drift checks see all work, not just committed code.
|
|
1026
1039
|
*/
|
|
1027
1040
|
declare function getChangedFiles(projectRoot: string, ref: string): ChangedFile[];
|
|
1028
1041
|
/**
|
|
@@ -1036,7 +1049,7 @@ declare function getHeadSha(projectRoot: string): string | null;
|
|
|
1036
1049
|
/**
|
|
1037
1050
|
* Store the current sync point in arcbridge_meta.
|
|
1038
1051
|
*/
|
|
1039
|
-
declare function setSyncCommit(db: Database
|
|
1052
|
+
declare function setSyncCommit(db: Database, key: "last_sync_commit" | "phase_sync_commit", sha: string): void;
|
|
1040
1053
|
|
|
1041
1054
|
type TestOutcome = "passed" | "failed" | "missing" | "error";
|
|
1042
1055
|
interface ScenarioTestResult {
|
|
@@ -1062,7 +1075,7 @@ interface VerifyResult {
|
|
|
1062
1075
|
*
|
|
1063
1076
|
* Optionally filter by specific scenario IDs.
|
|
1064
1077
|
*/
|
|
1065
|
-
declare function verifyScenarios(db: Database
|
|
1078
|
+
declare function verifyScenarios(db: Database, projectRoot: string, options: {
|
|
1066
1079
|
testCommand: string;
|
|
1067
1080
|
timeoutMs: number;
|
|
1068
1081
|
scenarioIds?: string[];
|
|
@@ -1097,4 +1110,4 @@ declare function loadConfig(projectRoot: string): {
|
|
|
1097
1110
|
error: string | null;
|
|
1098
1111
|
};
|
|
1099
1112
|
|
|
1100
|
-
export { type ActivityRow, type AdrFrontmatter, AdrFrontmatterSchema, type AgentRole, AgentRoleSchema, type AggregatedRow, type ArcBridgeConfig, ArcBridgeConfigSchema, type BuildingBlock, BuildingBlockSchema, type BuildingBlocksFrontmatter, BuildingBlocksFrontmatterSchema, CURRENT_SCHEMA_VERSION, type ChangedFile, type DotnetProjectInfo, type DriftEntry, type DriftKind, type DriftOptions, type DriftSeverity, type ExportFormat, type ExtractedSymbol, type GenerateDatabaseResult, type GitRef, type IndexResult, type IndexerOptions, type InitProjectInput, type InsertActivityParams, type LatestQualitySnapshot, type LoadRolesResult, type MetricsResult, type Phase, PhaseSchema, type PhasesFile, PhasesFileSchema, type ProjectLanguage, QualityCategorySchema, QualityPrioritySchema, type QualityScenario, QualityScenarioSchema, QualityScenarioStatusSchema, type QualityScenariosFile, QualityScenariosFileSchema, type QueryMetricsParams, type ScenarioTestResult, type Service, type SessionTotals, type SymbolKind, type Task, type TaskFile, TaskFileSchema, type TaskInferenceResult, TaskSchema, type TestOutcome, type VerifyResult, addTaskToYaml, applyInferences, detectDrift, detectProjectLanguage, discoverDotnetServices, exportMetrics, generateAgentRoles, generateArc42, generateConfig, generateDatabase, generatePlan, generateSyncFiles, getChangedFiles, getHeadSha, getSessionTotals, getUncommittedChanges, indexPackageDependencies, indexProject, inferTaskStatuses, initializeSchema, insertActivity, loadConfig, loadRole, loadRoles, migrate, openDatabase, openMemoryDatabase, queryMetrics, refreshFromDocs, resolveRef, setSyncCommit, syncPhaseToYaml, syncScenarioToYaml, syncTaskToYaml, verifyScenarios, writeDriftLog };
|
|
1113
|
+
export { type ActivityRow, type AdrFrontmatter, AdrFrontmatterSchema, type AgentRole, AgentRoleSchema, type AggregatedRow, type ArcBridgeConfig, ArcBridgeConfigSchema, type BuildingBlock, BuildingBlockSchema, type BuildingBlocksFrontmatter, BuildingBlocksFrontmatterSchema, CURRENT_SCHEMA_VERSION, type ChangedFile, type Database, type DotnetProjectInfo, type DriftEntry, type DriftKind, type DriftOptions, type DriftSeverity, type ExportFormat, type ExtractedSymbol, type GenerateDatabaseResult, type GitRef, type IndexResult, type IndexerOptions, type InitProjectInput, type InsertActivityParams, type LatestQualitySnapshot, type LoadRolesResult, type MetricsResult, type Phase, PhaseSchema, type PhasesFile, PhasesFileSchema, type ProjectLanguage, QualityCategorySchema, QualityPrioritySchema, type QualityScenario, QualityScenarioSchema, QualityScenarioStatusSchema, type QualityScenariosFile, QualityScenariosFileSchema, type QueryMetricsParams, type ScenarioTestResult, type Service, type SessionTotals, type SymbolKind, type Task, type TaskFile, TaskFileSchema, type TaskInferenceResult, TaskSchema, type TestOutcome, type VerifyResult, addTaskToYaml, applyInferences, detectDrift, detectProjectLanguage, discoverDotnetServices, exportMetrics, generateAgentRoles, generateArc42, generateConfig, generateDatabase, generatePlan, generateSyncFiles, getChangedFiles, getHeadSha, getSessionTotals, getUncommittedChanges, indexPackageDependencies, indexProject, inferTaskStatuses, initializeSchema, insertActivity, loadConfig, loadRole, loadRoles, migrate, openDatabase, openMemoryDatabase, queryMetrics, refreshFromDocs, resolveRef, setSyncCommit, suppressSqliteWarning, syncPhaseToYaml, syncScenarioToYaml, syncTaskToYaml, transaction, verifyScenarios, writeDriftLog };
|