@automaton-labs/aib 0.0.9 → 0.0.10
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.
|
@@ -120,28 +120,61 @@ function upgradeConfig(cwd) {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
const added = {};
|
|
123
|
+
const removed = [];
|
|
123
124
|
const config = { ...workspace.config };
|
|
125
|
+
const legacySessionTtl = typeof config["session.ttlMinutes"] === "number"
|
|
126
|
+
? config["session.ttlMinutes"]
|
|
127
|
+
: null;
|
|
128
|
+
const sessionDefaults = {
|
|
129
|
+
...workspace_root_1.MATERIALIZED_SESSION_DEFAULTS,
|
|
130
|
+
"session.ttlCleanMinutes": legacySessionTtl ?? 60,
|
|
131
|
+
"session.ttlDeleteMinutes": legacySessionTtl ?? 60
|
|
132
|
+
};
|
|
133
|
+
for (const [key, value] of Object.entries(sessionDefaults)) {
|
|
134
|
+
if (!Object.prototype.hasOwnProperty.call(config, key)) {
|
|
135
|
+
config[key] = value;
|
|
136
|
+
added[key] = value;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
124
139
|
for (const [key, value] of Object.entries(workspace_root_1.MATERIALIZED_INSPECT_DEFAULTS)) {
|
|
125
140
|
if (!Object.prototype.hasOwnProperty.call(config, key)) {
|
|
126
141
|
config[key] = value;
|
|
127
142
|
added[key] = value;
|
|
128
143
|
}
|
|
129
144
|
}
|
|
145
|
+
for (const [key, value] of Object.entries(workspace_root_1.MATERIALIZED_OUTPUT_DEFAULTS)) {
|
|
146
|
+
if (!Object.prototype.hasOwnProperty.call(config, key)) {
|
|
147
|
+
config[key] = value;
|
|
148
|
+
added[key] = value;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
130
151
|
if (!Object.prototype.hasOwnProperty.call(config, "tsc")) {
|
|
131
152
|
config.tsc = workspace_root_1.MATERIALIZED_TSC_DEFAULTS.tsc ?? null;
|
|
132
153
|
added.tsc = config.tsc;
|
|
133
154
|
}
|
|
134
|
-
|
|
155
|
+
for (const key of [
|
|
156
|
+
"session.ttlMinutes",
|
|
157
|
+
"runtime.managedIdeTtlMinutes",
|
|
158
|
+
"runtime.managedIdeWatchdogIntervalMs",
|
|
159
|
+
"runtime.autoStopManagedIde"
|
|
160
|
+
]) {
|
|
161
|
+
if (Object.prototype.hasOwnProperty.call(config, key)) {
|
|
162
|
+
delete config[key];
|
|
163
|
+
removed.push(key);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (Object.keys(added).length > 0 || removed.length > 0) {
|
|
135
167
|
fs.writeFileSync(workspace.configPath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
136
168
|
}
|
|
137
169
|
return (0, agent_text_1.attachAgentText)({
|
|
138
170
|
ok: true,
|
|
139
|
-
status: Object.keys(added).length > 0 ? "upgraded" : "up-to-date",
|
|
171
|
+
status: Object.keys(added).length > 0 || removed.length > 0 ? "upgraded" : "up-to-date",
|
|
140
172
|
root: workspace.root,
|
|
141
173
|
configPath: workspace.configPath,
|
|
142
174
|
added,
|
|
143
|
-
|
|
144
|
-
|
|
175
|
+
removed,
|
|
176
|
+
unchanged: "other fields preserved"
|
|
177
|
+
}, (0, config_output_1.formatConfigUpgradeText)(added, removed));
|
|
145
178
|
}
|
|
146
179
|
function parseConfigView(args) {
|
|
147
180
|
if (args.length === 0) {
|
|
@@ -223,9 +256,7 @@ function readConfigTextInput(cwd) {
|
|
|
223
256
|
sessionAutoClean: summary["session.autoClean"] !== false,
|
|
224
257
|
sessionTtlCleanMinutes: typeof summary["session.ttlCleanMinutes"] === "number" ? summary["session.ttlCleanMinutes"] : 60,
|
|
225
258
|
sessionAutoDelete: summary["session.autoDelete"] !== false,
|
|
226
|
-
sessionTtlDeleteMinutes: typeof summary["session.ttlDeleteMinutes"] === "number" ? summary["session.ttlDeleteMinutes"] : 60
|
|
227
|
-
runtimeAutoStopManagedIde: summary["runtime.autoStopManagedIde"] !== false,
|
|
228
|
-
runtimeManagedIdeTtlMinutes: typeof summary["runtime.managedIdeTtlMinutes"] === "number" ? summary["runtime.managedIdeTtlMinutes"] : 15
|
|
259
|
+
sessionTtlDeleteMinutes: typeof summary["session.ttlDeleteMinutes"] === "number" ? summary["session.ttlDeleteMinutes"] : 60
|
|
229
260
|
};
|
|
230
261
|
}
|
|
231
262
|
function readTscConfig(config) {
|
|
@@ -108,23 +108,31 @@ function formatSessionDirMutationText(input, changed) {
|
|
|
108
108
|
"other config fields preserved"
|
|
109
109
|
].join("\n");
|
|
110
110
|
}
|
|
111
|
-
function formatConfigUpgradeText(added) {
|
|
111
|
+
function formatConfigUpgradeText(added, removed) {
|
|
112
112
|
const entries = Object.entries(added);
|
|
113
|
-
if (entries.length === 0) {
|
|
113
|
+
if (entries.length === 0 && removed.length === 0) {
|
|
114
114
|
return [
|
|
115
115
|
"aib config is up to date",
|
|
116
116
|
"",
|
|
117
117
|
"unchanged: existing fields preserved"
|
|
118
118
|
].join("\n");
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
const lines = [
|
|
121
121
|
"aib config upgraded",
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
...entries.map(([key, value]) => ` ${key}: ${value}`)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
];
|
|
123
|
+
if (entries.length > 0) {
|
|
124
|
+
lines.push("", "added:", ...entries.map(([key, value]) => ` ${key}: ${formatUpgradeValue(value)}`));
|
|
125
|
+
}
|
|
126
|
+
if (removed.length > 0) {
|
|
127
|
+
lines.push("", "removed:", ...removed.map((key) => ` ${key}`));
|
|
128
|
+
}
|
|
129
|
+
lines.push("", "unchanged: other fields preserved");
|
|
130
|
+
return lines.join("\n");
|
|
131
|
+
}
|
|
132
|
+
function formatUpgradeValue(value) {
|
|
133
|
+
return value !== null && typeof value === "object"
|
|
134
|
+
? JSON.stringify(value)
|
|
135
|
+
: String(value);
|
|
128
136
|
}
|
|
129
137
|
function configSessionPayload(input) {
|
|
130
138
|
return {
|
|
@@ -133,9 +141,7 @@ function configSessionPayload(input) {
|
|
|
133
141
|
"session.autoClean": input.sessionAutoClean,
|
|
134
142
|
"session.ttlCleanMinutes": input.sessionTtlCleanMinutes,
|
|
135
143
|
"session.autoDelete": input.sessionAutoDelete,
|
|
136
|
-
"session.ttlDeleteMinutes": input.sessionTtlDeleteMinutes
|
|
137
|
-
"runtime.autoStopManagedIde": input.runtimeAutoStopManagedIde,
|
|
138
|
-
"runtime.managedIdeTtlMinutes": input.runtimeManagedIdeTtlMinutes
|
|
144
|
+
"session.ttlDeleteMinutes": input.sessionTtlDeleteMinutes
|
|
139
145
|
};
|
|
140
146
|
}
|
|
141
147
|
function formatConfigHeader(input) {
|
|
@@ -151,7 +157,7 @@ function formatSessionLines(input) {
|
|
|
151
157
|
if (input.sessionDir) {
|
|
152
158
|
lines.push(`new sessions: <sessionDir>/<name>/**`);
|
|
153
159
|
}
|
|
154
|
-
lines.push(`session cleanup: ${formatTtl(input.sessionAutoClean, input.sessionTtlCleanMinutes)}`, `session deletion: ${formatTtl(input.sessionAutoDelete, input.sessionTtlDeleteMinutes)}
|
|
160
|
+
lines.push(`session cleanup: ${formatTtl(input.sessionAutoClean, input.sessionTtlCleanMinutes)}`, `session deletion: ${formatTtl(input.sessionAutoDelete, input.sessionTtlDeleteMinutes)}`);
|
|
155
161
|
return lines.length > 0 ? ["", ...lines] : [];
|
|
156
162
|
}
|
|
157
163
|
function formatConfigSections(input, sections) {
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.MATERIALIZED_TSC_DEFAULTS = exports.MATERIALIZED_INSPECT_DEFAULTS = exports.AIB_CONFIG_FILE_NAME = void 0;
|
|
36
|
+
exports.MATERIALIZED_TSC_DEFAULTS = exports.MATERIALIZED_OUTPUT_DEFAULTS = exports.MATERIALIZED_SESSION_DEFAULTS = exports.MATERIALIZED_INSPECT_DEFAULTS = exports.AIB_CONFIG_FILE_NAME = void 0;
|
|
37
37
|
exports.initWorkspaceRoot = initWorkspaceRoot;
|
|
38
38
|
exports.resolveWorkspaceRoot = resolveWorkspaceRoot;
|
|
39
39
|
exports.resolveWorkspaceRootFromConfig = resolveWorkspaceRootFromConfig;
|
|
@@ -58,6 +58,16 @@ exports.MATERIALIZED_INSPECT_DEFAULTS = {
|
|
|
58
58
|
"inspect.usages.maxCodeBlocks": 8,
|
|
59
59
|
"inspect.members.maxItems": 20
|
|
60
60
|
};
|
|
61
|
+
exports.MATERIALIZED_SESSION_DEFAULTS = {
|
|
62
|
+
"session.autoDelete": true,
|
|
63
|
+
"session.ttlDeleteMinutes": 60,
|
|
64
|
+
"session.autoClean": true,
|
|
65
|
+
"session.ttlCleanMinutes": 60
|
|
66
|
+
};
|
|
67
|
+
exports.MATERIALIZED_OUTPUT_DEFAULTS = {
|
|
68
|
+
"qr.outputCapKb": 32,
|
|
69
|
+
"rg.outputCapKb": 32
|
|
70
|
+
};
|
|
61
71
|
exports.MATERIALIZED_TSC_DEFAULTS = {
|
|
62
72
|
tsc: {
|
|
63
73
|
outputCapKb: 12,
|
|
@@ -82,15 +92,12 @@ function initWorkspaceRoot(cwd, options = {}) {
|
|
|
82
92
|
"session.ttlDeleteMinutes": ttlDeleteMinutes,
|
|
83
93
|
"session.autoClean": readBoolean(existing["session.autoClean"]) ?? true,
|
|
84
94
|
"session.ttlCleanMinutes": ttlCleanMinutes,
|
|
85
|
-
"runtime.managedIdeTtlMinutes": readNumber(existing["runtime.managedIdeTtlMinutes"]) ?? 15,
|
|
86
|
-
"runtime.managedIdeWatchdogIntervalMs": readNumber(existing["runtime.managedIdeWatchdogIntervalMs"]) ?? 30000,
|
|
87
|
-
"runtime.autoStopManagedIde": readBoolean(existing["runtime.autoStopManagedIde"]) ?? true,
|
|
88
95
|
...(!existed ? exports.MATERIALIZED_INSPECT_DEFAULTS : {}),
|
|
96
|
+
...(!existed ? exports.MATERIALIZED_OUTPUT_DEFAULTS : {}),
|
|
89
97
|
...(!existed && !Object.prototype.hasOwnProperty.call(existing, "tsc") ? exports.MATERIALIZED_TSC_DEFAULTS : {})
|
|
90
98
|
};
|
|
91
99
|
fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
92
100
|
const sessionTtlMinutes = readNumber(config["session.ttlCleanMinutes"]) ?? 60;
|
|
93
|
-
const runtimeTtlMinutes = readNumber(config["runtime.managedIdeTtlMinutes"]) ?? 15;
|
|
94
101
|
const changed = !existed || JSON.stringify(existing) !== JSON.stringify(config);
|
|
95
102
|
return {
|
|
96
103
|
status: !existed ? "created" : changed ? "updated" : "unchanged",
|
|
@@ -103,8 +110,6 @@ function initWorkspaceRoot(cwd, options = {}) {
|
|
|
103
110
|
"session.ttlCleanMinutes": sessionTtlMinutes,
|
|
104
111
|
"session.autoDelete": readBoolean(config["session.autoDelete"]) ?? true,
|
|
105
112
|
"session.ttlDeleteMinutes": readNumber(config["session.ttlDeleteMinutes"]) ?? 60,
|
|
106
|
-
"runtime.autoStopManagedIde": readBoolean(config["runtime.autoStopManagedIde"]) ?? true,
|
|
107
|
-
"runtime.managedIdeTtlMinutes": runtimeTtlMinutes,
|
|
108
113
|
...(!sessionDir ? { next: "Set the default session directory: aib config --session-dir .tmp/aib" } : {})
|
|
109
114
|
};
|
|
110
115
|
}
|
|
@@ -200,9 +205,7 @@ function workspaceConfigSummary(config) {
|
|
|
200
205
|
"session.autoClean": readBoolean(config["session.autoClean"]) ?? true,
|
|
201
206
|
"session.ttlCleanMinutes": readNumber(config["session.ttlCleanMinutes"]) ?? legacySessionTtl ?? 60,
|
|
202
207
|
"session.autoDelete": readBoolean(config["session.autoDelete"]) ?? true,
|
|
203
|
-
"session.ttlDeleteMinutes": readNumber(config["session.ttlDeleteMinutes"]) ?? legacySessionTtl ?? 60
|
|
204
|
-
"runtime.autoStopManagedIde": readBoolean(config["runtime.autoStopManagedIde"]) ?? true,
|
|
205
|
-
"runtime.managedIdeTtlMinutes": readNumber(config["runtime.managedIdeTtlMinutes"]) ?? 15
|
|
208
|
+
"session.ttlDeleteMinutes": readNumber(config["session.ttlDeleteMinutes"]) ?? legacySessionTtl ?? 60
|
|
206
209
|
};
|
|
207
210
|
}
|
|
208
211
|
function isPathInsideOrEqual(parent, child) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automaton-labs/aib",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Agent-oriented CLI for understanding and changing TypeScript and JavaScript workspaces.",
|
|
3
|
+
"version": "0.0.10",
|
|
4
|
+
"description": "Agent-oriented CLI for understanding and changing TypeScript and JavaScript workspaces.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|