@coggit/core 0.2.0

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +21 -0
  3. package/README.md +42 -0
  4. package/dist/acceptance.d.ts +7 -0
  5. package/dist/affected.d.ts +7 -0
  6. package/dist/cognition/handbooks.d.ts +3 -0
  7. package/dist/cognition/index.d.ts +34 -0
  8. package/dist/cognition/templates.d.ts +3 -0
  9. package/dist/cognitionDiscovery.d.ts +9 -0
  10. package/dist/cognitionDocumentFacts.d.ts +6 -0
  11. package/dist/cognitionRoutes.d.ts +10 -0
  12. package/dist/cognitionTypes.d.ts +100 -0
  13. package/dist/directoryEntrySourceFact.d.ts +8 -0
  14. package/dist/gitignore.d.ts +28 -0
  15. package/dist/hash.d.ts +13 -0
  16. package/dist/identity.d.ts +76 -0
  17. package/dist/interfaces.d.ts +174 -0
  18. package/dist/internal.d.ts +57 -0
  19. package/dist/internal.js +14229 -0
  20. package/dist/layout.d.ts +3 -0
  21. package/dist/locks.d.ts +44 -0
  22. package/dist/logger.d.ts +17 -0
  23. package/dist/maintenance.d.ts +7 -0
  24. package/dist/maintenancePresentation.d.ts +16 -0
  25. package/dist/mapping.d.ts +98 -0
  26. package/dist/operationTypes.d.ts +45 -0
  27. package/dist/operations.d.ts +228 -0
  28. package/dist/path-utils.d.ts +26 -0
  29. package/dist/pathHints.d.ts +31 -0
  30. package/dist/project/buildSnapshot.d.ts +10 -0
  31. package/dist/project/discover.d.ts +32 -0
  32. package/dist/project/index.d.ts +8 -0
  33. package/dist/project/init.d.ts +22 -0
  34. package/dist/project/project.d.ts +44 -0
  35. package/dist/project/projectContext.d.ts +4 -0
  36. package/dist/project/workspace.d.ts +5 -0
  37. package/dist/projection.d.ts +34 -0
  38. package/dist/public.d.ts +50 -0
  39. package/dist/public.js +13733 -0
  40. package/dist/registry/inMemoryRegistryProvider.d.ts +18 -0
  41. package/dist/registry/index.d.ts +104 -0
  42. package/dist/registry/reconcile.d.ts +82 -0
  43. package/dist/registry/sourceRelocation.d.ts +11 -0
  44. package/dist/registryTypes.d.ts +52 -0
  45. package/dist/routesProjection.d.ts +65 -0
  46. package/dist/snapshot/index.d.ts +3 -0
  47. package/dist/snapshot/mappingIndex.d.ts +2 -0
  48. package/dist/snapshot/tree.d.ts +15 -0
  49. package/dist/snapshotTypes.d.ts +133 -0
  50. package/dist/sourceStructureIgnore.d.ts +4 -0
  51. package/dist/status/evidence.d.ts +44 -0
  52. package/dist/status/index.d.ts +89 -0
  53. package/dist/status/lookupCognition.d.ts +23 -0
  54. package/dist/status/statusAgentPresentation.d.ts +37 -0
  55. package/dist/status/statusPresentation.d.ts +43 -0
  56. package/dist/status/statusTriage.d.ts +50 -0
  57. package/dist/status/statusTypes.d.ts +240 -0
  58. package/dist/systemPrompt.d.ts +24 -0
  59. package/dist/time.d.ts +2 -0
  60. package/dist/types.d.ts +5 -0
  61. package/dist/uri-utils.d.ts +35 -0
  62. package/dist/watchHost.d.ts +44 -0
  63. package/dist/watchPipeline.d.ts +31 -0
  64. package/package.json +48 -0
@@ -0,0 +1,5 @@
1
+ import type { CoggitWorkspaceRoot } from '../types';
2
+ import type { ConfigProvider, FileSystem, UriComponents, WorkspaceFolderInfo } from '../interfaces';
3
+ import type { CoggitLogger } from '../logger';
4
+ export declare function discoverWorkspaceRoots(fs: FileSystem, config: ConfigProvider, logger?: CoggitLogger): Promise<CoggitWorkspaceRoot[]>;
5
+ export declare function readWorkspaceRoot(fs: FileSystem, workspaceFolder: WorkspaceFolderInfo, configUri: UriComponents, logger?: CoggitLogger): Promise<CoggitWorkspaceRoot | undefined>;
@@ -0,0 +1,34 @@
1
+ import type { CoggitSnapshot, CoggitTreeNode, TreeProjectionNode } from './types.js';
2
+ /**
3
+ * Result of depth-limited tree projection.
4
+ * Nodes beyond the requested depth are stripped; truncation flags report how many.
5
+ */
6
+ export interface TreeDepthResult<T> {
7
+ nodes: T[];
8
+ truncated: boolean;
9
+ omittedChildrenCount: number;
10
+ }
11
+ /**
12
+ * Generic tree depth limiter.
13
+ * Strips children beyond `depth` and reports truncation stats.
14
+ * Works on any tree-like structure where nodes have an optional `children` array.
15
+ */
16
+ export declare function applyTreeDepth<T extends {
17
+ children?: T[];
18
+ truncated?: boolean;
19
+ omittedChildrenCount?: number;
20
+ }>(nodes: T[], depth: number): TreeDepthResult<T>;
21
+ export interface ProjectionOptions {
22
+ depth?: number;
23
+ scope?: 'tracked' | 'untracked' | 'issues' | 'all';
24
+ }
25
+ /**
26
+ * Project a single Coggit tree node (and its descendants) into TreeProjectionNode[].
27
+ * Applies depth limiting and scope filtering.
28
+ */
29
+ export declare function projectTreeFromSnapshot(node: CoggitTreeNode, options?: ProjectionOptions): TreeProjectionNode[];
30
+ /**
31
+ * Project all roots of a Coggit snapshot into TreeProjectionNode[].
32
+ * Applies depth limiting and scope filtering.
33
+ */
34
+ export declare function projectSnapshotTree(snapshot: CoggitSnapshot, options?: ProjectionOptions): TreeProjectionNode[];
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Public SDK surface for `@coggit/core`.
3
+ *
4
+ * This is the curated barrel exposed through the package `.` export. It
5
+ * intentionally omits the watch family (`calculateAffected`, `applyWatchEventToProjects`,
6
+ * `createWatchHost`, watch types) — v1 is reconcile-on-read and watch authority
7
+ * remains adapter-only — and adds the port contracts runtime adapters must
8
+ * implement against. `internal.ts` stays the full internal barrel (the
9
+ * `@coggit/core/internal` export for in-repo consumers).
10
+ */
11
+ export { initProject } from './project';
12
+ export { findProjectRoot } from './project';
13
+ export { RuntimeAcceptanceEvidence, createCoggitServices, discoverCoggitProjects, openCoggitProject, buildSnapshotFromProjects, } from './project';
14
+ export { projectContextFromRoot } from './project';
15
+ export { noOpProjectLockManager, ProjectLockError, } from './locks';
16
+ export { ADD_OPERATION_ERROR_CODES, CORE_OPERATION_IDS, addOperation, resolveOperation, routesOperation, findProjectNode, handbookCatalog, handbookIdForCognitionKind, handbookIdForNodeKind, operationIssue, projectContext, snapshotOperation, statusOperation, } from './operations';
17
+ export type { AddOperationError, AddOperationErrorCode, AddOperationResult, ResolveErrorCode, ResolveOperationError, ResolveOperationResult, CoggitHandbookCatalogEntry, CoggitOperationAction, CoggitOperationIssue, CoggitProjectContext, CoreOperationId, RoutesOperationResult, SnapshotOperationResult, SnapshotOperationOptions, SnapshotOperationScope, SourcePathCandidatesExpander, StatusOperationOptions, StatusOperationResult, } from './operations';
18
+ export type { CoggitProjectDiscoveryOptions, RegistryInitFailurePolicy, } from './project';
19
+ export { getCognitionHandbook, getCognitionTemplate } from './cognition';
20
+ export { getCoggitSystemPrompt, MINIMAL_SYSTEM_PROMPT } from './systemPrompt';
21
+ export type { CoggitSystemPrompt, CoggitSystemPromptKind } from './systemPrompt';
22
+ export { applyTreeDepth, projectSnapshotTree, projectTreeFromSnapshot, } from './projection';
23
+ export { DEFAULT_ROUTES_DEPTH, assembleRoutesContent, countRouteNodes, flattenRoutesProjection, projectRoutesEntries, routeProjectionLineText, selectRoutesBySourcePath, toRoutesStructuredOutput, } from './routesProjection';
24
+ export type { AssembleRoutesContentOptions, RoutesPresentationContent, RoutesPresentationFormat, RoutesStructuredOutput, } from './routesProjection';
25
+ export { projectStatusAgentPresentation, renderStatusAgentInspectionText, renderStatusAgentPresentation, } from './status/statusAgentPresentation';
26
+ export type { StatusAgentActionLegendEntry, StatusAgentActionRole, StatusAgentIssueLegendEntry, StatusAgentIssueRow, StatusAgentPresentation, StatusAgentSeverityLevel, } from './status/statusAgentPresentation';
27
+ export { projectStatusMissPresentation, projectStatusPresentation, renderStatusPresentation, } from './status/statusPresentation';
28
+ export type { StatusMissPresentation, StatusPresentationFormat, StatusPresentationIssue, StatusPresentationView, } from './status/statusPresentation';
29
+ export { tryGetCognitionPath } from './status/lookupCognition';
30
+ export type { CognitionLookupHit } from './status/lookupCognition';
31
+ export { projectMaintenancePresentation, renderMaintenancePresentation, } from './maintenancePresentation';
32
+ export type { MaintenanceIssueCode, MaintenancePresentationFormat, MaintenancePresentationItem, MaintenancePresentationView, } from './maintenancePresentation';
33
+ export { projectStatusTriage } from './status/statusTriage';
34
+ export type { StatusTriageEntry, StatusTriageView, } from './status/statusTriage';
35
+ export { buildMappingIndex, } from './snapshot';
36
+ export { detectMisplacedCognitionEntries, detectOrphanedCognitionEntries, detectStrayCognitionEntries, detectUnboundCognitionEntries, } from './maintenance';
37
+ export { describeObservedStatus, aggregateNodeStatus, collectSubtreeIssues, computeRuntimeStatus, countSubtreeIssues, inspectNodeStatus, projectStatusResultToNodeStatus, querySubtreeIssues, summarizeRepresentativeMtime, } from './status';
38
+ export { normalizeSourcePathInput, toCognitionFileUri, toCognitionFolderReadmeUri, toRelativeUriPath, } from './mapping';
39
+ export { PATH_HINT_MESSAGE, PATH_MISS_MESSAGE, pathHintsTryText, pathMissMessage, renderPathMissText, suggestPathHints, } from './pathHints';
40
+ export { externalPathFromString, uriRelativePath, } from './uri-utils';
41
+ export { createEnvCoggitLogger, debugLog, errorLog, infoLog, logEvent, nullCoggitLogger, warnLog, } from './logger';
42
+ export type { CoggitLogEvent, CoggitLogLevel, CoggitLogger, } from './logger';
43
+ export type { AddCognitionKind, AddCognitionOptions, AddCognitionResult, CognitionHandbook, CognitionKind, CognitionTemplate, } from './cognition';
44
+ export type { ProjectLockContext, ProjectLockManager, } from './locks';
45
+ export type { CoggitSnapshot, CoggitTreeNode, CoggitWorkspaceRoot, CognitionDiscoveryEntry, CognitionCoveragePresence, LocatedStatusIssue, MaintenanceDiagnostic, MisplacedCognitionEntry, NodeStatusInspection, NodeStatusResult, NodeStatusTriageEntry, ObservedStatus, OrphanedCognitionEntry, SourceCandidateState, StrayCognitionEntry, UnboundCognitionEntry, } from './types';
46
+ export { discoverWorkspaceRoots, readWorkspaceRoot } from './project';
47
+ export { buildSnapshot } from './project';
48
+ export type { UriComponents, UriKey, FileSystem, FileStat, WorkspaceFolderInfo, ConfigProvider, RegistryProviderFactory, AcceptanceStore, ResolveResult, CoggitServices, CoggitProject, SourcePathResolution, } from './interfaces';
49
+ export type { RegistryProvider, RegistryFile, AcceptedPair, CognitionRoutes, } from './types';
50
+ export type { BuildCognitionRoutesOptions } from './cognitionRoutes';