@git.zone/cli 2.23.0 → 2.24.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 (28) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts/mod_services/classes.dockercontainer.d.ts +81 -0
  3. package/dist_ts/mod_services/classes.dockercontainer.js +205 -10
  4. package/dist_ts/mod_services/classes.globalregistry.d.ts +10 -0
  5. package/dist_ts/mod_services/classes.globalregistry.js +23 -1
  6. package/dist_ts/mod_services/classes.serviceconfiguration.d.ts +39 -1
  7. package/dist_ts/mod_services/classes.serviceconfiguration.js +86 -20
  8. package/dist_ts/mod_services/classes.servicedatamarker.d.ts +93 -0
  9. package/dist_ts/mod_services/classes.servicedatamarker.js +166 -0
  10. package/dist_ts/mod_services/classes.servicemanager.d.ts +82 -5
  11. package/dist_ts/mod_services/classes.servicemanager.js +258 -64
  12. package/dist_ts/mod_services/classes.servicepruner.d.ts +102 -0
  13. package/dist_ts/mod_services/classes.servicepruner.js +410 -0
  14. package/dist_ts/mod_services/helpers.d.ts +15 -0
  15. package/dist_ts/mod_services/helpers.js +57 -1
  16. package/dist_ts/mod_services/index.js +307 -53
  17. package/package.json +3 -2
  18. package/readme.hints.md +88 -0
  19. package/readme.md +71 -5
  20. package/ts/00_commitinfo_data.ts +1 -1
  21. package/ts/mod_services/classes.dockercontainer.ts +244 -13
  22. package/ts/mod_services/classes.globalregistry.ts +27 -0
  23. package/ts/mod_services/classes.serviceconfiguration.ts +101 -22
  24. package/ts/mod_services/classes.servicedatamarker.ts +228 -0
  25. package/ts/mod_services/classes.servicemanager.ts +365 -72
  26. package/ts/mod_services/classes.servicepruner.ts +532 -0
  27. package/ts/mod_services/helpers.ts +60 -0
  28. package/ts/mod_services/index.ts +437 -58
@@ -1,3 +1,33 @@
1
+ import { ServiceConfiguration } from './classes.serviceconfiguration.js';
2
+ import { type TServiceName } from './classes.servicedatamarker.js';
3
+ import type { ContainerStatus } from './classes.dockercontainer.js';
4
+ export interface IServiceStatus {
5
+ service: TServiceName;
6
+ enabled: boolean;
7
+ container: string;
8
+ status: ContainerStatus;
9
+ port: string;
10
+ connectionString: string;
11
+ dataDirectory: string;
12
+ dataSizeBytes: number;
13
+ /** Only meaningful when the container does not exist yet. */
14
+ portAvailable: boolean | null;
15
+ /** MongoDB only: whether the instance enforces authentication. */
16
+ authEnabled?: boolean;
17
+ }
18
+ export interface IServicesStatus {
19
+ project: {
20
+ name: string;
21
+ path: string;
22
+ enabledServices: string[];
23
+ };
24
+ services: {
25
+ mongodb: IServiceStatus;
26
+ minio: IServiceStatus;
27
+ elasticsearch: IServiceStatus;
28
+ };
29
+ totalDataBytes: number;
30
+ }
1
31
  export declare class ServiceManager {
2
32
  private config;
3
33
  private docker;
@@ -8,6 +38,10 @@ export declare class ServiceManager {
8
38
  * Initialize the service manager
9
39
  */
10
40
  init(): Promise<void>;
41
+ /**
42
+ * Expose the resolved service configuration to the command layer.
43
+ */
44
+ getConfiguration(): ServiceConfiguration;
11
45
  /**
12
46
  * Load service configuration from .smartconfig.json
13
47
  */
@@ -21,15 +55,31 @@ export declare class ServiceManager {
21
55
  */
22
56
  private isServiceEnabled;
23
57
  /**
24
- * Register this project with the global registry
58
+ * Prepare a service's data directory: create it and record tool ownership.
59
+ *
60
+ * The marker written here is what later allows `gitzone services prune` to
61
+ * prove the directory is reclaimable instead of guessing from its path.
25
62
  */
26
- private registerWithGlobalRegistry;
63
+ private prepareDataDirectory;
64
+ /**
65
+ * Register this project with the global registry.
66
+ *
67
+ * Public and called from the command layer after any start path: previously
68
+ * only `startAll` registered, so `gitzone services start mongo` created a
69
+ * container the registry never knew about and prune could never account for.
70
+ */
71
+ registerWithGlobalRegistry(): Promise<void>;
27
72
  /**
28
73
  * Start all enabled services
29
74
  */
30
75
  startAll(): Promise<void>;
31
76
  /**
32
- * Stop all enabled services
77
+ * Stop every service container belonging to this project.
78
+ *
79
+ * Deliberately not filtered by the enabled-service list: disabling a service
80
+ * previously left its container running with no command able to stop it,
81
+ * which is how projects accumulated forgotten containers. Stopping a service
82
+ * that is not running is a no-op, so covering all three is always safe.
33
83
  */
34
84
  stopAll(): Promise<void>;
35
85
  /**
@@ -52,9 +102,21 @@ export declare class ServiceManager {
52
102
  */
53
103
  private ensureMongoKeyfile;
54
104
  /**
55
- * Check whether the container was created with --replSet
105
+ * The mongod argv the container was created with
56
106
  */
57
- private mongoContainerHasReplSet;
107
+ private getMongoContainerCmd;
108
+ /**
109
+ * Make sure the configured root user exists when auth is enabled.
110
+ *
111
+ * `MONGO_INITDB_ROOT_USERNAME` only takes effect on an empty dbpath, so data
112
+ * that was first created with auth disabled has no user at all. Enabling auth
113
+ * over it would leave an unusable database. MongoDB's localhost exception is
114
+ * the designed bootstrap path for exactly this: while zero users exist, a
115
+ * connection from localhost — which, inside the container, is what this is —
116
+ * may create the first one. If users already exist the exception does not
117
+ * apply and creation fails, so this can never overwrite or escalate anything.
118
+ */
119
+ private ensureMongoRootUser;
58
120
  /**
59
121
  * Initiate the single-node replica set once mongod is reachable
60
122
  */
@@ -79,10 +141,25 @@ export declare class ServiceManager {
79
141
  * Stop Elasticsearch service
80
142
  */
81
143
  stopElasticsearch(): Promise<void>;
144
+ /**
145
+ * Collect service status as structured data.
146
+ *
147
+ * This is the machine-readable surface behind `gitzone services status
148
+ * --json`; consumers such as test suites can read a connection string from it
149
+ * without scraping human output or re-deriving it from `.nogit/env.json`.
150
+ */
151
+ collectStatus(): Promise<IServicesStatus>;
82
152
  /**
83
153
  * Show service status
84
154
  */
85
155
  showStatus(): Promise<void>;
156
+ /**
157
+ * Report on-disk size of this project's service data.
158
+ *
159
+ * Reporting comes before any deletion: knowing what a project holds is what
160
+ * makes reclaiming it a decision rather than a guess.
161
+ */
162
+ showDiskUsage(): Promise<void>;
86
163
  /**
87
164
  * Show configuration
88
165
  */