insta 0.0.82 → 0.1.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.
- package/README.md +28 -29
- package/dist/agent.js +2 -2
- package/dist/api.js +19 -4
- package/dist/build-logs.js +32 -8
- package/dist/commands/agent-policy.js +1 -1
- package/dist/commands/auth.js +32 -18
- package/dist/commands/billing.js +5 -5
- package/dist/commands/compute.js +83 -41
- package/dist/commands/db-query.js +18 -14
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/domain.js +49 -2
- package/dist/commands/env.js +1 -1
- package/dist/commands/managed-db.js +34 -0
- package/dist/commands/mcp.js +2 -2
- package/dist/commands/metrics.js +6 -5
- package/dist/commands/observe.js +2 -2
- package/dist/commands/{db.js → postgres.js} +32 -32
- package/dist/commands/regions.js +1 -1
- package/dist/commands/services.js +31 -70
- package/dist/commands/setup.js +8 -7
- package/dist/commands/storage.js +17 -2
- package/dist/commands/template.js +4 -4
- package/dist/commands/upgrade.js +20 -8
- package/dist/config.js +49 -31
- package/dist/deploy-archive.js +65 -56
- package/dist/ensure-skills.js +1 -1
- package/dist/index.js +227 -161
- package/dist/observe/hook.js +1 -1
- package/dist/observe/install.js +1 -1
- package/dist/resolve-service.js +4 -4
- package/dist/telemetry.js +8 -8
- package/dist/util.js +9 -6
- package/package.json +1 -1
package/dist/resolve-service.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `insta
|
|
1
|
+
// `insta service add` with no type (or no name): the kinds are otherwise only discoverable by
|
|
2
2
|
// guessing wrong and reading `type must be postgres|storage|compute|redis|mysql|mongodb`, so missing arguments answer
|
|
3
3
|
// "what can I add?" instead. The list mirrors the dashboard's Add Service menu (frontend
|
|
4
4
|
// `add-service-button.tsx`) — Docker Image sits BESIDE Empty Service, not under it, because
|
|
@@ -41,8 +41,8 @@ export function suggestServiceName(ref) {
|
|
|
41
41
|
/** The non-interactive command for a kind — what an agent should run instead of being asked. */
|
|
42
42
|
export function kindCommand(k) {
|
|
43
43
|
if (k.needsImage)
|
|
44
|
-
return `insta
|
|
45
|
-
return `insta
|
|
44
|
+
return `insta service add compute <name> --image <ref> --port <n>`;
|
|
45
|
+
return `insta service add ${k.type} ${k.defaultName}`;
|
|
46
46
|
}
|
|
47
47
|
/** The kind list, one line each — what a terminal picks from and an agent reads. */
|
|
48
48
|
export function serviceKindLines() {
|
|
@@ -57,7 +57,7 @@ export function missingArgsMessage(type) {
|
|
|
57
57
|
return ['what to add:', ...serviceKindLines()].join('\n');
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Fill in whatever `insta
|
|
60
|
+
* Fill in whatever `insta service add` was not given. An unknown type passes straight through so
|
|
61
61
|
* `assertType` — not this — reports it, keeping one wording for a bad type everywhere. Flags that
|
|
62
62
|
* were already supplied are never asked for again.
|
|
63
63
|
*/
|
package/dist/telemetry.js
CHANGED
|
@@ -29,17 +29,17 @@ const SERVICE = oneOf(SERVICE_TYPES);
|
|
|
29
29
|
// `login`/`env use` accept the name case-insensitively; so does this.
|
|
30
30
|
const ENV = (v) => isEnvName(v.trim().toLowerCase());
|
|
31
31
|
const ON_OFF = oneOf(['on', 'off']);
|
|
32
|
-
const TARGET = oneOf(['db', 'compute', 'redis', 'mysql', 'mongodb']);
|
|
33
32
|
const POLICY_ACTION = (v) => /^(?:secrets|deploy|project|branch|service|storage)(?:\.[a-zA-Z]+)?$/.test(v);
|
|
34
33
|
const SAFE_ARGS = {
|
|
35
34
|
'env use': { 0: ENV }, 'project link': { 0: ID },
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'compute always-on': { 0: ON_OFF }, '
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'agent
|
|
35
|
+
'service add': { 0: SERVICE }, 'service remove': { 0: SERVICE }, 'service rename': { 0: SERVICE },
|
|
36
|
+
'storage set-access': { 0: oneOf(['public', 'private']) },
|
|
37
|
+
'compute scale': { 0: NUMBER },
|
|
38
|
+
'compute always-on': { 0: ON_OFF }, 'postgres always-on': { 0: ON_OFF },
|
|
39
|
+
'redis always-on': { 0: ON_OFF }, 'mysql always-on': { 0: ON_OFF }, 'mongodb always-on': { 0: ON_OFF },
|
|
40
|
+
'template info': { 0: SLUG }, 'billing subscribe': { 0: oneOf(['pro', 'team']) },
|
|
41
|
+
'agent approvals approve': { 0: ID }, 'agent approvals deny': { 0: ID },
|
|
42
|
+
'agent policy rule set': { 0: POLICY_ACTION, 1: oneOf(['allow', 'deny', 'approve']) }, 'config autoupdate': { 0: ON_OFF },
|
|
43
43
|
};
|
|
44
44
|
const SAFE_OPTIONS = {
|
|
45
45
|
org: ID, project: ID, region: REGION, env: ENV, oauth: oneOf(['github', 'google']),
|
package/dist/util.js
CHANGED
|
@@ -204,20 +204,23 @@ export function handleApproval(res, json) {
|
|
|
204
204
|
if (res.status === 202 && res.body?.status === 'approval_required') {
|
|
205
205
|
if (json)
|
|
206
206
|
printJson(res.body);
|
|
207
|
-
process.stderr.write(`approval required for ${res.body.action} — run: insta approvals approve ${res.body.approvalId}\n`);
|
|
207
|
+
process.stderr.write(`approval required for ${res.body.action} — run: insta agent approvals approve ${res.body.approvalId}\n`);
|
|
208
208
|
process.exitCode = 2;
|
|
209
209
|
return true;
|
|
210
210
|
}
|
|
211
211
|
return false;
|
|
212
212
|
}
|
|
213
|
-
// Neutral op → an `insta` command string. Unknown ops fall back to reason-only (no crash).
|
|
213
|
+
// Neutral op → an `insta` command string. Unknown ops fall back to reason-only (no crash). The
|
|
214
|
+
// platform names an observability target with its component word (`db` for postgres); the CLI
|
|
215
|
+
// groups by service type, so the target becomes the parent command.
|
|
216
|
+
const targetGroup = (a) => (a.target === 'db' ? 'postgres' : String(a.target ?? 'compute'));
|
|
214
217
|
const OP_COMMAND = {
|
|
215
|
-
'service.add': (a) => `insta
|
|
218
|
+
'service.add': (a) => `insta service add ${a.type ?? '<type>'} ${a.name ?? '<name>'}`,
|
|
216
219
|
deploy: (a) => `insta deploy${a.branch ? ` --branch ${a.branch}` : ''}`,
|
|
217
220
|
'secrets.set': (a) => `insta secrets set ${a.name ?? '<NAME>'} ${a.value ?? '<value>'}`,
|
|
218
|
-
metrics: (a) => `insta
|
|
219
|
-
logs: (a) => `insta
|
|
220
|
-
'approvals.approve': (a) => `insta approvals approve ${a.approvalId ?? '<id>'}`,
|
|
221
|
+
metrics: (a) => `insta ${targetGroup(a)} metrics`,
|
|
222
|
+
logs: (a) => `insta ${targetGroup(a)} logs`,
|
|
223
|
+
'approvals.approve': (a) => `insta agent approvals approve ${a.approvalId ?? '<id>'}`,
|
|
221
224
|
};
|
|
222
225
|
// Pure — builds the printable lines (unit-tested). Empty input → [].
|
|
223
226
|
export function nextActionsLines(actions) {
|