@sequenceholdings/studio-cli 0.9.10 → 0.9.12
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 +78 -9
- package/dist/atlas-client.js +6 -57
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +9 -1
- package/dist/bin.js +7 -2
- package/dist/cli-attribution.d.ts +3 -0
- package/dist/cli-attribution.js +24 -0
- package/dist/command-contract.d.ts +8 -2
- package/dist/command-contract.js +3 -2
- package/dist/command-help.d.ts +2 -1
- package/dist/command-help.js +19 -3
- package/dist/command-telemetry.d.ts +11 -0
- package/dist/command-telemetry.js +97 -0
- package/dist/edge-auth-headers.d.ts +1 -0
- package/dist/edge-auth-headers.js +40 -0
- package/dist/functions/commands.js +1 -1
- package/dist/functions/manifest.js +2 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +49 -2
- package/dist/orm/apply-source.d.ts +53 -0
- package/dist/orm/apply-source.js +86 -0
- package/dist/orm/delegate.js +18 -2
- package/dist/orm/help.d.ts +1 -1
- package/dist/orm/help.js +2 -0
- package/dist/orm/history.d.ts +23 -0
- package/dist/orm/history.js +58 -0
- package/dist/orm/read.d.ts +1 -1
- package/dist/orm/read.js +4 -2
- package/dist/pipeline/commands.js +2 -1
- package/dist/pipeline/templates.js +5 -2
- package/dist/principals/commands.d.ts +1 -1
- package/dist/principals/commands.js +50 -2
- package/dist/process/commands.js +5 -2
- package/dist/repos/git-credential.d.ts +8 -1
- package/dist/repos/git-credential.js +50 -4
- package/dist/templates/guidance/AGENTS.md +5 -0
- package/package.json +8 -8
- package/templates/guidance/AGENTS.md +5 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ParsedArgs } from '../process/commands.js';
|
|
2
|
-
export declare const PRINCIPALS_USAGE = "usage:\n seq-studio principals search <query> -e <env> [--types user,group,service-account,organization] [--limit <n>]\n seq-studio principals users search <query> -e <env> [--limit <n>]\n seq-studio principals groups list -e <env> [--search <query>] [--limit <n>] [--page <n>]\n seq-studio principals groups show <group-id> -e <env> [--limit <n>] [--offset <n>]\n\n Find the people, groups, service accounts and organizations YOU may grant\n access to, with the exact ids seq-studio access grant takes. Results are JSON;\n each principal carries \"grant\": { \"principalType\", \"principalId\" }.\n Queries need at least 2 characters. search defaults to user,group,service-account.\n\n You see exactly what the Atlas pickers show you, never more:\n people: active users in your organization (Sequence operators: everyone);\n groups: groups you belong to (platform admins: every group), never deleted ones;\n service accounts: accounts you hold actor on; organizations: your own tenant.\n groups show lists a visible group's active members, paged (default 50 per\n page); a group you can't see is reported as not found.\n Authenticate: seq-studio login --env <env> (agent sandbox tokens work too).\n";
|
|
2
|
+
export declare const PRINCIPALS_USAGE = "usage:\n seq-studio principals search <query> -e <env> [--types user,group,service-account,organization] [--limit <n>]\n seq-studio principals users search <query> -e <env> [--limit <n>]\n seq-studio principals groups list -e <env> [--search <query>] [--limit <n>] [--page <n>]\n seq-studio principals groups show <group-id> -e <env> [--limit <n>] [--offset <n>]\n seq-studio principals groups create <name> -e <env> [--description <text>] [--request-id <uuid>]\n seq-studio principals groups members add <group-id> -e <env> --principal-id <user-sub> [--principal-id <user-sub> ...]\n seq-studio principals groups members remove <group-id> -e <env> --principal-id <user-sub>\n\n Find the people, groups, service accounts and organizations YOU may grant\n access to, with the exact ids seq-studio access grant takes. Results are JSON;\n each principal carries \"grant\": { \"principalType\", \"principalId\" }.\n Queries need at least 2 characters. search defaults to user,group,service-account.\n\n You see exactly what the Atlas pickers show you, never more:\n people: active users in your organization (Sequence operators: everyone);\n groups: groups you belong to (platform admins: every group), never deleted ones;\n service accounts: accounts you hold actor on; organizations: your own tenant.\n groups show lists a visible group's active members, paged (default 50 per\n page); a group you can't see is reported as not found.\n Create makes a local group with you as admin. It prints its request UUID\n before sending; reuse --request-id <uuid> to safely retry an uncertain result.\n Member IDs are the authenticated subjects returned by users search, not\n emails or directory row IDs. Add accepts 1\u201350 IDs, leaves existing roles\n unchanged, and rejects disabled or out-of-tenant users. Managing members\n requires permission to administer a CLI-created group in your tenant.\n Remove revokes one member and refuses to\n remove the last group admin. Members may always leave their own group.\n Mutation receipts are JSON.\n Authenticate: seq-studio login --env <env> (agent sandbox tokens work too).\n";
|
|
3
3
|
export declare function runPrincipalsCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { getJson, requestJsonOnce } from '../atlas-client.js';
|
|
2
3
|
import { printCliError } from '../cli-errors.js';
|
|
3
|
-
import { validateCommandInput, wantsHelp } from '../command-input.js';
|
|
4
|
+
import { requiredStringFlag, validateCommandInput, wantsHelp } from '../command-input.js';
|
|
4
5
|
import { buildContext, clientOptions } from '../functions/commands.js';
|
|
5
6
|
const SEARCH_TYPES = ['user', 'group', 'service-account', 'organization'];
|
|
6
7
|
export const PRINCIPALS_USAGE = `usage:
|
|
@@ -8,6 +9,9 @@ export const PRINCIPALS_USAGE = `usage:
|
|
|
8
9
|
seq-studio principals users search <query> -e <env> [--limit <n>]
|
|
9
10
|
seq-studio principals groups list -e <env> [--search <query>] [--limit <n>] [--page <n>]
|
|
10
11
|
seq-studio principals groups show <group-id> -e <env> [--limit <n>] [--offset <n>]
|
|
12
|
+
seq-studio principals groups create <name> -e <env> [--description <text>] [--request-id <uuid>]
|
|
13
|
+
seq-studio principals groups members add <group-id> -e <env> --principal-id <user-sub> [--principal-id <user-sub> ...]
|
|
14
|
+
seq-studio principals groups members remove <group-id> -e <env> --principal-id <user-sub>
|
|
11
15
|
|
|
12
16
|
Find the people, groups, service accounts and organizations YOU may grant
|
|
13
17
|
access to, with the exact ids seq-studio access grant takes. Results are JSON;
|
|
@@ -20,6 +24,15 @@ export const PRINCIPALS_USAGE = `usage:
|
|
|
20
24
|
service accounts: accounts you hold actor on; organizations: your own tenant.
|
|
21
25
|
groups show lists a visible group's active members, paged (default 50 per
|
|
22
26
|
page); a group you can't see is reported as not found.
|
|
27
|
+
Create makes a local group with you as admin. It prints its request UUID
|
|
28
|
+
before sending; reuse --request-id <uuid> to safely retry an uncertain result.
|
|
29
|
+
Member IDs are the authenticated subjects returned by users search, not
|
|
30
|
+
emails or directory row IDs. Add accepts 1–50 IDs, leaves existing roles
|
|
31
|
+
unchanged, and rejects disabled or out-of-tenant users. Managing members
|
|
32
|
+
requires permission to administer a CLI-created group in your tenant.
|
|
33
|
+
Remove revokes one member and refuses to
|
|
34
|
+
remove the last group admin. Members may always leave their own group.
|
|
35
|
+
Mutation receipts are JSON.
|
|
23
36
|
Authenticate: seq-studio login --env <env> (agent sandbox tokens work too).
|
|
24
37
|
`;
|
|
25
38
|
function withGrant(principal) {
|
|
@@ -105,12 +118,47 @@ function present(shape, body) {
|
|
|
105
118
|
members: (record.members ?? []).map(withGrant),
|
|
106
119
|
};
|
|
107
120
|
}
|
|
121
|
+
async function mutateGroup(args) {
|
|
122
|
+
const [action, target, verb] = args.positional;
|
|
123
|
+
if (action === 'create') {
|
|
124
|
+
validateCommandInput({ args, flags: { description: 'string', 'request-id': 'string' }, positional: 2 });
|
|
125
|
+
if (!target?.trim() || target.trim().length > 200)
|
|
126
|
+
throw new Error('Group name must be 1–200 characters.');
|
|
127
|
+
const id = typeof args.flags['request-id'] === 'string' ? args.flags['request-id'] : randomUUID();
|
|
128
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id))
|
|
129
|
+
throw new Error('--request-id must be a UUID.');
|
|
130
|
+
const description = args.flags.description;
|
|
131
|
+
const body = { id, name: target.trim(), ...(typeof description === 'string' ? { description: description.trim() } : {}) };
|
|
132
|
+
const ctx = await buildContext(args);
|
|
133
|
+
console.error(`Group request ID: ${id} (reuse with --request-id to retry)`);
|
|
134
|
+
return requestJsonOnce({ ...clientOptions(ctx), path: '/api/authz/principals/groups', method: 'POST', body });
|
|
135
|
+
}
|
|
136
|
+
if (action === 'members' && (target === 'add' || target === 'remove')) {
|
|
137
|
+
validateCommandInput({ args, flags: { 'principal-id': 'string' }, positional: 3 });
|
|
138
|
+
if (!verb?.trim())
|
|
139
|
+
throw new Error('A group ID is required.');
|
|
140
|
+
const ids = args.repeatedFlags?.['principal-id'] ?? [requiredStringFlag({ args, key: 'principal-id' })];
|
|
141
|
+
if (ids.length < 1 || ids.length > (target === 'add' ? 50 : 1) || new Set(ids).size !== ids.length || ids.some((id) => !id.includes('|') || /[#*\s]/.test(id))) {
|
|
142
|
+
throw new Error('Pass distinct authenticated user subjects with --principal-id (1–50 for add, one for remove).');
|
|
143
|
+
}
|
|
144
|
+
const ctx = await buildContext(args);
|
|
145
|
+
const path = `/api/authz/principals/groups/${encodeURIComponent(verb)}/members`;
|
|
146
|
+
return target === 'add'
|
|
147
|
+
? requestJsonOnce({ ...clientOptions(ctx), path, method: 'POST', body: { principalIds: ids } })
|
|
148
|
+
: requestJsonOnce({ ...clientOptions(ctx), path: `${path}/${encodeURIComponent(ids[0])}`, method: 'DELETE' });
|
|
149
|
+
}
|
|
150
|
+
throw new Error('Usage: seq-studio principals groups create|members add|members remove. See: seq-studio principals --help');
|
|
151
|
+
}
|
|
108
152
|
export async function runPrincipalsCommand(sub, args) {
|
|
109
153
|
if (!sub || wantsHelp({ sub, args })) {
|
|
110
154
|
console.log(PRINCIPALS_USAGE);
|
|
111
155
|
return sub ? 0 : 1;
|
|
112
156
|
}
|
|
113
157
|
try {
|
|
158
|
+
if (sub === 'groups' && (args.positional[0] === 'create' || args.positional[0] === 'members')) {
|
|
159
|
+
console.log(JSON.stringify(await mutateGroup(args), null, 2));
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
114
162
|
const { path, shape } = requestPath(sub, args);
|
|
115
163
|
const ctx = await buildContext(args);
|
|
116
164
|
const body = await getJson({ ...clientOptions(ctx), path });
|
package/dist/process/commands.js
CHANGED
|
@@ -225,9 +225,12 @@ async function tryBuildAgentLoader(args) {
|
|
|
225
225
|
return undefined;
|
|
226
226
|
// Agent loader is only meaningful when we have a target env + token.
|
|
227
227
|
// If either fails to resolve, skip the check; lint will emit a warning
|
|
228
|
-
// for multi-edge agent nodes instead of failing.
|
|
228
|
+
// for multi-edge agent nodes instead of failing. The check is optional, so
|
|
229
|
+
// it never opens a browser login (CI sandboxes would wait out the timeout).
|
|
229
230
|
try {
|
|
230
|
-
const
|
|
231
|
+
const requested = typeof args.flags.env === 'string' ? args.flags.env : undefined;
|
|
232
|
+
const env = await resolveConfiguredEnv({ requested });
|
|
233
|
+
const token = await getAccessToken({ env: env.name, targetUrl: env.url, allowInteractiveLogin: false });
|
|
231
234
|
return buildAgentSchemaLoader({ baseUrl: env.url, token });
|
|
232
235
|
}
|
|
233
236
|
catch {
|
|
@@ -7,10 +7,17 @@ export declare function gitCredentialResponse({ input, operation, envName, clone
|
|
|
7
7
|
envName?: string;
|
|
8
8
|
cloneUrl?: string;
|
|
9
9
|
}): Promise<string>;
|
|
10
|
+
/** Select the stable launcher that invoked this CLI, not the first one on a later Git PATH. */
|
|
11
|
+
export declare function resolveGitHelperLauncher({ scriptPath, launcherHint, searchPath, }?: {
|
|
12
|
+
scriptPath?: string;
|
|
13
|
+
launcherHint?: string;
|
|
14
|
+
searchPath?: string;
|
|
15
|
+
}): Promise<string>;
|
|
10
16
|
/** Store only a helper command, bound to this environment and repository URL. */
|
|
11
|
-
export declare function configureGitLogin({ destDir, envName, cloneUrl, }: {
|
|
17
|
+
export declare function configureGitLogin({ destDir, envName, cloneUrl, launcherPath, }: {
|
|
12
18
|
destDir: string;
|
|
13
19
|
envName: string;
|
|
14
20
|
cloneUrl: string;
|
|
21
|
+
launcherPath?: string;
|
|
15
22
|
}): Promise<void>;
|
|
16
23
|
export declare function gitCredentialCommand(args: ParsedArgs): Promise<number>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
|
+
import { readFile, realpath } from 'node:fs/promises';
|
|
3
|
+
import { basename, delimiter, dirname, isAbsolute, join, resolve } from 'node:path';
|
|
2
4
|
import { promisify } from 'node:util';
|
|
3
5
|
import { getAccessTokenWithMode } from '../auth.js';
|
|
4
6
|
import { resolveConfiguredEnv } from '../config.js';
|
|
@@ -100,11 +102,55 @@ export async function gitCredentialResponse({ input, operation, envName, cloneUr
|
|
|
100
102
|
function shellQuote(value) {
|
|
101
103
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
102
104
|
}
|
|
105
|
+
async function shimRunsScript(candidate, script, target) {
|
|
106
|
+
const shim = await readFile(candidate, 'utf8');
|
|
107
|
+
if (shim.includes(`exec node "${script}" "$@"`))
|
|
108
|
+
return true;
|
|
109
|
+
// pnpm's local and global POSIX shims use $basedir to invoke the package
|
|
110
|
+
// bin. Resolve that literal target without executing a PATH candidate.
|
|
111
|
+
for (const match of shim.matchAll(/^\s*exec (?:node|"\$basedir\/node")\s+"\$basedir\/([^"]+\/dist\/bin\.js)" "\$@"\s*$/gm)) {
|
|
112
|
+
if (await realpath(join(dirname(candidate), match[1])) === target)
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
/** Select the stable launcher that invoked this CLI, not the first one on a later Git PATH. */
|
|
118
|
+
export async function resolveGitHelperLauncher({ scriptPath = process.argv[1], launcherHint = process.env.SEQ_STUDIO_LAUNCHER, searchPath = process.env.PATH, } = {}) {
|
|
119
|
+
if (!scriptPath || !isAbsolute(scriptPath))
|
|
120
|
+
throw new Error('Cannot identify the seq-studio launcher. Run repos clone through an installed seq-studio command.');
|
|
121
|
+
const script = resolve(scriptPath);
|
|
122
|
+
if (launcherHint && isAbsolute(launcherHint) && basename(launcherHint) === 'seq-studio') {
|
|
123
|
+
try {
|
|
124
|
+
// Our installed shell shim exports its own path before execing this build.
|
|
125
|
+
// Require the shim to target this exact script, so an inherited hint from
|
|
126
|
+
// another installation cannot make Git run a different CLI.
|
|
127
|
+
if ((await readFile(launcherHint, 'utf8')).includes(`exec node "${script}" "$@"`))
|
|
128
|
+
return resolve(launcherHint);
|
|
129
|
+
}
|
|
130
|
+
catch { /* Stale or unrelated launcher; look for a matching executable. */ }
|
|
131
|
+
}
|
|
132
|
+
if (basename(script) === 'seq-studio')
|
|
133
|
+
return script; // Node preserves the symlink invocation path.
|
|
134
|
+
const target = await realpath(script);
|
|
135
|
+
for (const directory of (searchPath ?? '').split(delimiter).filter(Boolean)) {
|
|
136
|
+
const candidate = join(directory, 'seq-studio');
|
|
137
|
+
try {
|
|
138
|
+
if (await realpath(candidate) === target)
|
|
139
|
+
return resolve(candidate);
|
|
140
|
+
}
|
|
141
|
+
catch { /* Not an installed launcher in this PATH entry. */ }
|
|
142
|
+
try {
|
|
143
|
+
if (await shimRunsScript(candidate, script, target))
|
|
144
|
+
return resolve(candidate);
|
|
145
|
+
}
|
|
146
|
+
catch { /* Not a matching generated shim. */ }
|
|
147
|
+
}
|
|
148
|
+
throw new Error('Cannot identify a stable seq-studio launcher for Git. Install this CLI with install-cli.sh or invoke its installed executable, then clone again.');
|
|
149
|
+
}
|
|
103
150
|
/** Store only a helper command, bound to this environment and repository URL. */
|
|
104
|
-
export async function configureGitLogin({ destDir, envName, cloneUrl, }) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const helper = `!seq-studio auth git-credential --env ${shellQuote(envName)} --url ${shellQuote(cloneUrl)}`;
|
|
151
|
+
export async function configureGitLogin({ destDir, envName, cloneUrl, launcherPath, }) {
|
|
152
|
+
const launcher = launcherPath ?? await resolveGitHelperLauncher();
|
|
153
|
+
const helper = `!${shellQuote(launcher)} auth git-credential --env ${shellQuote(envName)} --url ${shellQuote(cloneUrl)}`;
|
|
108
154
|
const config = async (...args) => { await exec('git', ['-C', destDir, 'config', '--local', ...args]); };
|
|
109
155
|
// An empty helper resets inherited credential stores for this URL. That keeps
|
|
110
156
|
// an Auth0 access token out of the user's global store/keychain on approval.
|
|
@@ -8,3 +8,8 @@ Start with that site's `/docs/llms.txt` index and follow the relevant pages as
|
|
|
8
8
|
needed. The hosted docs are the single source of truth for platform usage;
|
|
9
9
|
do not duplicate their instructions in this file. If docs access is blocked,
|
|
10
10
|
open the same URL in the signed-in browser.
|
|
11
|
+
|
|
12
|
+
After concrete CLI friction costs time or retries, finish the task, then follow
|
|
13
|
+
the live `/seq-studio/feedback` guide and run `seq-studio feedback submit`
|
|
14
|
+
before the final response. Include the confirmed receipt ID and ticket URL, or
|
|
15
|
+
the sanitized draft and submission evidence if no receipt is confirmed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.12",
|
|
4
4
|
"description": "Unified Sequence Studio CLI — `seq-studio init` / `add` / `deploy` (app monorepos), `seq-studio agents`, `seq-studio process` (Lattice), `seq-studio artifact`, `seq-studio functions` / `secrets`, `seq-studio repos`, and `seq-studio auth whoami`. Includes Auth0 browser login shared with seqapi.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"yaml": "^2.8.4",
|
|
46
46
|
"zod": "4.6.6",
|
|
47
47
|
"@sequenceholdings/agent-spec": "0.1.5",
|
|
48
|
-
"@sequenceholdings/artifact-studio": "0.11.10",
|
|
49
|
-
"@sequenceholdings/managed-functions": "0.5.8",
|
|
50
|
-
"@sequenceholdings/storage": "0.1.6",
|
|
51
48
|
"@sequenceholdings/lattice": "0.1.8",
|
|
52
|
-
"@sequenceholdings/
|
|
49
|
+
"@sequenceholdings/artifact-studio": "0.11.11",
|
|
50
|
+
"@sequenceholdings/managed-functions": "0.5.9",
|
|
51
|
+
"@sequenceholdings/storage": "0.1.7",
|
|
52
|
+
"@sequenceholdings/platform": "0.1.4"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@sequenceholdings/
|
|
56
|
-
"@sequenceholdings/
|
|
55
|
+
"@sequenceholdings/orm": "2.8.5",
|
|
56
|
+
"@sequenceholdings/pipeline-spec": "0.3.8"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@sequenceholdings/orm": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@types/semver": "^7.8.0",
|
|
70
70
|
"typescript": "^5.6.0",
|
|
71
71
|
"vitest": "^4.1.11",
|
|
72
|
-
"@sequenceholdings/pipeline-spec": "0.3.
|
|
72
|
+
"@sequenceholdings/pipeline-spec": "0.3.8",
|
|
73
73
|
"@sequenceholdings/orm": "2.8.5"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
@@ -8,3 +8,8 @@ Start with that site's `/docs/llms.txt` index and follow the relevant pages as
|
|
|
8
8
|
needed. The hosted docs are the single source of truth for platform usage;
|
|
9
9
|
do not duplicate their instructions in this file. If docs access is blocked,
|
|
10
10
|
open the same URL in the signed-in browser.
|
|
11
|
+
|
|
12
|
+
After concrete CLI friction costs time or retries, finish the task, then follow
|
|
13
|
+
the live `/seq-studio/feedback` guide and run `seq-studio feedback submit`
|
|
14
|
+
before the final response. Include the confirmed receipt ID and ticket URL, or
|
|
15
|
+
the sanitized draft and submission evidence if no receipt is confirmed.
|