aptly 0.1.21 → 0.1.22
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.en.md +3 -10
- package/README.ja.md +3 -10
- package/README.md +3 -10
- package/README.zh-CN.md +3 -10
- package/dist/bin/aptly.js +32 -8
- package/dist/src/automatic-hook.js +4 -4
- package/dist/src/cli-help.js +4 -2
- package/dist/src/context-retry.js +1 -1
- package/dist/src/core.d.ts +2 -2
- package/dist/src/core.js +39 -9
- package/dist/src/doctor.d.ts +1 -0
- package/dist/src/doctor.js +1 -1
- package/dist/src/provider.js +9 -3
- package/dist/src/server.js +16 -2
- package/dist/src/setup.d.ts +2 -1
- package/dist/src/setup.js +15 -13
- package/dist/src/stable-runtime.d.ts +4 -0
- package/dist/src/stable-runtime.js +119 -18
- package/dist/src/update.d.ts +19 -0
- package/dist/src/update.js +84 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/guide/en/configuration.md +16 -1
- package/docs/guide/en/installation.md +20 -3
- package/docs/guide/ja/configuration.md +16 -1
- package/docs/guide/ja/installation.md +20 -3
- package/docs/guide/ko/configuration.md +16 -1
- package/docs/guide/ko/installation.md +20 -3
- package/docs/guide/zh-CN/configuration.md +16 -1
- package/docs/guide/zh-CN/installation.md +20 -3
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ function canonicalAllowed(path) {
|
|
|
44
44
|
}
|
|
45
45
|
return current;
|
|
46
46
|
}
|
|
47
|
+
const launchName = (mode) => mode === 'npx' ? 'launch-npx' : 'launch';
|
|
47
48
|
/** Shape only. Reads OS alias metadata, never runtime bytes or credentials. */
|
|
48
49
|
export function stableReference(entry, { home = homedir() } = {}) {
|
|
49
50
|
const command = object(entry) ? entry.command : undefined;
|
|
@@ -58,10 +59,10 @@ export function stableReference(entry, { home = homedir() } = {}) {
|
|
|
58
59
|
if (!cleanAbsolute(command) || Object.hasOwn(entry, 'url') || (entry.type !== undefined && entry.type !== 'stdio') || !Array.isArray(entry.args) || entry.args.length !== 1 || entry.args[0] !== 'serve')
|
|
59
60
|
fail('stable_runtime_unverified');
|
|
60
61
|
const suffix = relative(base, candidate).split(sep);
|
|
61
|
-
if (suffix.length !== 2 || !/^[a-f0-9]{64}$/.test(suffix[0]) ||
|
|
62
|
+
if (suffix.length !== 2 || !/^[a-f0-9]{64}$/.test(suffix[0]) || !['launch', 'launch-npx'].includes(suffix[1]))
|
|
62
63
|
fail('stable_runtime_unverified');
|
|
63
64
|
const runtimeRoot = join(baseFor(canonicalHome), suffix[0]);
|
|
64
|
-
return frozen({ command: join(runtimeRoot,
|
|
65
|
+
return frozen({ command: join(runtimeRoot, suffix[1]), args: ['serve'], generation: suffix[0], runtimeRoot, launcher: suffix[1] === 'launch-npx' ? 'npx' : 'stable' });
|
|
65
66
|
}
|
|
66
67
|
function platform() { if (process.platform === 'win32')
|
|
67
68
|
fail('stable_launcher_platform_unsupported'); }
|
|
@@ -150,6 +151,81 @@ async function main(){
|
|
|
150
151
|
main().catch(()=>{if(!quiet){process.stderr.write('aptly: stable_runtime_unavailable\n');process.exitCode=1;}});
|
|
151
152
|
`;
|
|
152
153
|
const bootstrapHash = digest(bootstrap);
|
|
154
|
+
// Adapt the verified bootstrap without changing any released stable generation.
|
|
155
|
+
const npxBootstrap = [
|
|
156
|
+
["path.join(root,'launch')", "path.join(root,'launch-npx')"],
|
|
157
|
+
["if(mode!=='serve'&&mode!=='observe')bad();if(mode==='serve'&&process.argv.length!==3)bad();",
|
|
158
|
+
"if(mode!=='serve'&&mode!=='serve-verified'&&mode!=='observe')bad();if(!quiet&&process.argv.length!==3)bad();"],
|
|
159
|
+
["if(mode==='serve'){const server", "if(mode==='serve')await runNpx(m,payload);\n else if(mode==='serve-verified'){restoreHostPath();const server"],
|
|
160
|
+
].reduce((source, [before, after]) => {
|
|
161
|
+
if (source.split(before).length !== 2)
|
|
162
|
+
fail('stable_runtime_unverified');
|
|
163
|
+
return source.replace(before, () => after);
|
|
164
|
+
}, bootstrap)
|
|
165
|
+
+ String.raw `
|
|
166
|
+
function restoreHostPath(){
|
|
167
|
+
const present=process.env.APTLY_HOST_PATH_PRESENT,value=process.env.APTLY_HOST_PATH;
|
|
168
|
+
delete process.env.APTLY_HOST_PATH_PRESENT;delete process.env.APTLY_HOST_PATH;
|
|
169
|
+
if(present==='1'&&value!==undefined)process.env.PATH=value;
|
|
170
|
+
else if(present==='0'&&value===undefined)delete process.env.PATH;
|
|
171
|
+
else bad();
|
|
172
|
+
}
|
|
173
|
+
async function runNpx(m,payload){
|
|
174
|
+
const processes=require('node:child_process');
|
|
175
|
+
const bin=path.dirname(process.execPath),prefix=path.dirname(bin);
|
|
176
|
+
const candidates=[path.join(prefix,'lib/node_modules/npm/bin/npx-cli.js'),path.join(prefix,'share/nodejs/npm/bin/npx-cli.js')];
|
|
177
|
+
const npx=candidates.find(file=>{
|
|
178
|
+
try{
|
|
179
|
+
let current=file;
|
|
180
|
+
if(!fs.lstatSync(file).isFile())return false;
|
|
181
|
+
for(;;){
|
|
182
|
+
const s=fs.lstatSync(current);
|
|
183
|
+
const stickyRoot=s.isDirectory()&&s.uid===0&&(s.mode&512)!==0;
|
|
184
|
+
if(s.isSymbolicLink()||((s.mode&18)&&!stickyRoot)||(process.getuid&&s.uid!==0&&s.uid!==process.getuid()))return false;
|
|
185
|
+
const parent=path.dirname(current);if(parent===current)return true;current=parent;
|
|
186
|
+
}
|
|
187
|
+
}catch{return false;}
|
|
188
|
+
});
|
|
189
|
+
if(!npx)bad();
|
|
190
|
+
const work=fs.mkdtempSync(path.join(root,'.npx-session-'));
|
|
191
|
+
const quote=value=>"'"+value.replaceAll("'","'\\''")+"'";
|
|
192
|
+
try{
|
|
193
|
+
const modules=path.join(work,'node_modules');
|
|
194
|
+
fs.mkdirSync(modules,{mode:0o700});
|
|
195
|
+
fs.symlinkSync(payload,path.join(modules,'aptly'),'dir');
|
|
196
|
+
fs.writeFileSync(path.join(work,'package.json'),JSON.stringify({name:'aptly-launcher',private:true,dependencies:{aptly:m.version}}),{mode:0o600});
|
|
197
|
+
for(const name of ['user-npmrc','global-npmrc'])fs.writeFileSync(path.join(work,name),'',{mode:0o600});
|
|
198
|
+
const env=Object.fromEntries(Object.entries(process.env).filter(([name])=>!/^npm_/i.test(name)&&!['NODE_OPTIONS','NODE_PATH','NODE_REPL_EXTERNAL_MODULE','INIT_CWD'].includes(name)));
|
|
199
|
+
delete env.APTLY_HOST_PATH;delete env.APTLY_HOST_PATH_PRESENT;
|
|
200
|
+
env.APTLY_HOST_PATH_PRESENT=Object.hasOwn(process.env,'PATH')?'1':'0';
|
|
201
|
+
if(env.APTLY_HOST_PATH_PRESENT==='1')env.APTLY_HOST_PATH=process.env.PATH;
|
|
202
|
+
Object.assign(env,{PATH:bin+':/usr/bin:/bin',npm_config_cache:path.join(work,'cache'),npm_config_userconfig:path.join(work,'user-npmrc'),
|
|
203
|
+
npm_config_globalconfig:path.join(work,'global-npmrc'),npm_config_registry:'https://registry.npmjs.org/',npm_config_update_notifier:'false',
|
|
204
|
+
npm_config_prefix:path.join(work,'global'),npm_config_global:'false',npm_config_script_shell:'/bin/sh',
|
|
205
|
+
npm_config_audit:'false',npm_config_fund:'false',npm_config_loglevel:'silent'});
|
|
206
|
+
const command='exec '+quote(process.execPath)+' --no-warnings '+quote(path.join(root,'bootstrap.cjs'))+' serve-verified';
|
|
207
|
+
const child=processes.spawn(process.execPath,[npx,'--offline','--no','--ignore-scripts','--package=aptly@'+m.version,'--call',command],
|
|
208
|
+
{cwd:work,env,stdio:['inherit','inherit','ignore'],detached:true});
|
|
209
|
+
let killTimer,stopping=false;
|
|
210
|
+
const signals=['SIGINT','SIGTERM','SIGHUP'];
|
|
211
|
+
const forward=signal=>{
|
|
212
|
+
if(!child.pid)return;
|
|
213
|
+
stopping=true;
|
|
214
|
+
try{process.kill(-child.pid,signal);}catch{}
|
|
215
|
+
killTimer??=setTimeout(()=>{try{process.kill(-child.pid,'SIGKILL');}catch{}},2000);
|
|
216
|
+
};
|
|
217
|
+
const handlers=new Map(signals.map(signal=>[signal,()=>forward(signal)]));
|
|
218
|
+
for(const [signal,handle]of handlers)process.on(signal,handle);
|
|
219
|
+
try{
|
|
220
|
+
const code=await new Promise((resolve,reject)=>{child.once('error',reject);child.once('close',resolve);});
|
|
221
|
+
if(code!==0&&!stopping)bad();
|
|
222
|
+
}finally{clearTimeout(killTimer);for(const [signal,handle]of handlers)process.off(signal,handle);}
|
|
223
|
+
}finally{fs.rmSync(work,{recursive:true,force:true});}
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
const npxBootstrapHash = digest(npxBootstrap);
|
|
227
|
+
const bootstrapFor = (mode) => mode === 'npx' ? npxBootstrap : bootstrap;
|
|
228
|
+
const hashFor = (mode) => mode === 'npx' ? npxBootstrapHash : bootstrapHash;
|
|
153
229
|
function sourceFiles(packageRoot) {
|
|
154
230
|
const root = canonicalAllowed(packageRoot), files = [];
|
|
155
231
|
let bytes = 0;
|
|
@@ -263,12 +339,12 @@ function sourceFiles(packageRoot) {
|
|
|
263
339
|
return { files, version: metadata.version };
|
|
264
340
|
}
|
|
265
341
|
function manifestBody(manifest) { return { schema_version: manifest.schema_version, kind: manifest.kind, version: manifest.version, home: manifest.home, node_path: manifest.node_path, launcher_revision: manifest.launcher_revision, bootstrap_sha256: manifest.bootstrap_sha256, launcher_sha256: manifest.launcher_sha256, files: manifest.files }; }
|
|
266
|
-
function readManifest(root, home) {
|
|
342
|
+
function readManifest(root, home, mode) {
|
|
267
343
|
const value = JSON.parse(readPrivate(join(root, 'manifest.json'), stableRuntimeLimits.manifestBytes).toString('utf8'));
|
|
268
|
-
if (!exact(value, ['schema_version', 'kind', 'version', 'home', 'node_path', 'launcher_revision', 'bootstrap_sha256', 'launcher_sha256', 'files', 'generation']) || value.schema_version !== 1 || value.kind !== 'aptly-stable-runtime' || value.launcher_revision !== 1 || value.home !== home || !cleanAbsolute(value.node_path) || typeof value.version !== 'string' || !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(value.version) || value.bootstrap_sha256 !==
|
|
344
|
+
if (!exact(value, ['schema_version', 'kind', 'version', 'home', 'node_path', 'launcher_revision', 'bootstrap_sha256', 'launcher_sha256', 'files', 'generation']) || value.schema_version !== 1 || value.kind !== 'aptly-stable-runtime' || value.launcher_revision !== 1 || value.home !== home || !cleanAbsolute(value.node_path) || typeof value.version !== 'string' || !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(value.version) || value.bootstrap_sha256 !== hashFor(mode) || !Array.isArray(value.files) || value.files.length > stableRuntimeLimits.files)
|
|
269
345
|
fail('stable_runtime_unverified');
|
|
270
|
-
const expectedLauncher = launcher(value.node_path, home);
|
|
271
|
-
if (value.launcher_sha256 !== digest(expectedLauncher) || readPrivate(
|
|
346
|
+
const expectedLauncher = launcher(value.node_path, home, mode), entry = join(root, launchName(mode));
|
|
347
|
+
if (value.launcher_sha256 !== digest(expectedLauncher) || readPrivate(entry, 65536).toString('utf8') !== expectedLauncher || readPrivate(join(root, 'bootstrap.cjs'), 65536).toString('utf8') !== bootstrapFor(mode) || (lstatSync(entry).mode & 0o100) === 0)
|
|
272
348
|
fail('stable_runtime_unverified');
|
|
273
349
|
let bytes = 0, previous = '';
|
|
274
350
|
for (const f of value.files) {
|
|
@@ -329,10 +405,26 @@ export function planStableRuntime(options) {
|
|
|
329
405
|
platform();
|
|
330
406
|
try {
|
|
331
407
|
const root = canonicalAllowed(options.packageRoot), home = canonicalAllowed(options.home ?? homedir()), nodePath = options.nodePath ?? process.execPath;
|
|
408
|
+
const mode = options.launcher ?? 'stable';
|
|
332
409
|
if (!cleanAbsolute(home) || !cleanAbsolute(nodePath) || !cleanAbsolute(options.packageRoot))
|
|
333
410
|
fail('stable_source_unverified');
|
|
334
411
|
// Existing parents may be absent in a dry run; never create them here.
|
|
335
412
|
safeAncestors(home);
|
|
413
|
+
if (mode === 'npx') {
|
|
414
|
+
const prefix = dirname(dirname(nodePath));
|
|
415
|
+
const cli = ['lib/node_modules/npm/bin/npx-cli.js', 'share/nodejs/npm/bin/npx-cli.js'].some(relative => {
|
|
416
|
+
const file = join(prefix, relative);
|
|
417
|
+
try {
|
|
418
|
+
safeAncestors(file);
|
|
419
|
+
return lstatSync(file).isFile();
|
|
420
|
+
}
|
|
421
|
+
catch {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
if (!cli)
|
|
426
|
+
fail('stable_source_unverified');
|
|
427
|
+
}
|
|
336
428
|
let existing = baseFor(home);
|
|
337
429
|
while (!existsSync(existing)) {
|
|
338
430
|
const parent = dirname(existing);
|
|
@@ -344,11 +436,13 @@ export function planStableRuntime(options) {
|
|
|
344
436
|
assertNoRedirectedAncestors(existing);
|
|
345
437
|
if (existsSync(baseFor(home)))
|
|
346
438
|
privatePath(baseFor(home), true);
|
|
347
|
-
const captured = sourceFiles(root)
|
|
439
|
+
const captured = sourceFiles(root);
|
|
440
|
+
const body = { schema_version: 1, kind: 'aptly-stable-runtime', version: captured.version, home, node_path: nodePath, launcher_revision: 1, bootstrap_sha256: hashFor(mode), launcher_sha256: digest(launcher(nodePath, home, mode)), files: captured.files.map(({ path, size, sha256 }) => ({ path, size, sha256 })) };
|
|
348
441
|
const generation = digest(JSON.stringify(body)), runtimeRoot = join(baseFor(home), generation), manifest = { ...body, generation };
|
|
349
442
|
if (Buffer.byteLength(JSON.stringify(manifest) + '\n') > stableRuntimeLimits.manifestBytes)
|
|
350
443
|
fail('stable_runtime_limit');
|
|
351
|
-
const
|
|
444
|
+
const command = join(runtimeRoot, launchName(mode));
|
|
445
|
+
const plan = frozen({ command, args: ['serve'], packageRoot: join(runtimeRoot, 'payload'), payloadRoot: join(runtimeRoot, 'payload'), runtimeRoot, version: captured.version, generation, manifest, integrity: 'full', launcher: mode, descriptor: { command, args: ['serve'] } });
|
|
352
446
|
if (existsSync(runtimeRoot) && !validateStableRegistration(plan.descriptor, { home }))
|
|
353
447
|
fail('stable_runtime_unverified');
|
|
354
448
|
plans.set(plan, { root, files: captured.files });
|
|
@@ -439,8 +533,8 @@ export function materializeStableRuntime(plan) {
|
|
|
439
533
|
ensureDirectory(dirname(target), true);
|
|
440
534
|
writeDurable(target, data, 0o600);
|
|
441
535
|
}
|
|
442
|
-
writeDurable(join(stage, 'bootstrap.cjs'),
|
|
443
|
-
writeDurable(join(stage,
|
|
536
|
+
writeDurable(join(stage, 'bootstrap.cjs'), bootstrapFor(plan.launcher), 0o600);
|
|
537
|
+
writeDurable(join(stage, launchName(plan.launcher)), launcher(plan.manifest.node_path, plan.manifest.home, plan.launcher), 0o700);
|
|
444
538
|
writeDurable(join(stage, 'manifest.json'), JSON.stringify(plan.manifest) + '\n', 0o600);
|
|
445
539
|
validatePayload(stage, plan.manifest, false);
|
|
446
540
|
assertSource(plan, captured);
|
|
@@ -500,13 +594,13 @@ export function validateStableRegistration(entry, { home = homedir(), metadataOn
|
|
|
500
594
|
return null;
|
|
501
595
|
platform();
|
|
502
596
|
try {
|
|
503
|
-
const selectedHome = canonicalAllowed(home), { command, runtimeRoot } = reference;
|
|
597
|
+
const selectedHome = canonicalAllowed(home), { command, runtimeRoot, launcher: mode } = reference;
|
|
504
598
|
checkedRoot(runtimeRoot, selectedHome);
|
|
505
|
-
const before = identity(join(runtimeRoot, 'manifest.json')), manifest = readManifest(runtimeRoot, selectedHome);
|
|
599
|
+
const before = identity(join(runtimeRoot, 'manifest.json')), manifest = readManifest(runtimeRoot, selectedHome, mode);
|
|
506
600
|
validatePayload(runtimeRoot, manifest, metadataOnly);
|
|
507
601
|
if (before !== identity(join(runtimeRoot, 'manifest.json')))
|
|
508
602
|
fail('stable_runtime_unverified');
|
|
509
|
-
return frozen({ command, args: ['serve'], packageRoot: join(runtimeRoot, 'payload'), runtimeRoot, version: manifest.version, generation: manifest.generation, manifest, integrity: metadataOnly ? 'metadata' : 'full' });
|
|
603
|
+
return frozen({ command, args: ['serve'], packageRoot: join(runtimeRoot, 'payload'), runtimeRoot, version: manifest.version, generation: manifest.generation, manifest, integrity: metadataOnly ? 'metadata' : 'full', launcher: mode });
|
|
510
604
|
}
|
|
511
605
|
catch {
|
|
512
606
|
fail('stable_runtime_unverified');
|
|
@@ -528,7 +622,14 @@ export function stableObserverCommand(registration, client, policyPath) {
|
|
|
528
622
|
fail('stable_runtime_unverified');
|
|
529
623
|
}
|
|
530
624
|
}
|
|
531
|
-
function launcher(nodePath, home) {
|
|
625
|
+
function launcher(nodePath, home, mode) {
|
|
626
|
+
const name = launchName(mode);
|
|
627
|
+
const requireNpm = mode === 'npx' ? ` if [ "$quiet" -eq 0 ]; then
|
|
628
|
+
prefix=\${candidate%/*/*}
|
|
629
|
+
qualify_file "$prefix/lib/node_modules/npm/bin/npx-cli.js" private ||
|
|
630
|
+
qualify_file "$prefix/share/nodejs/npm/bin/npx-cli.js" private || return 1
|
|
631
|
+
fi
|
|
632
|
+
` : '';
|
|
532
633
|
return `#!/bin/sh
|
|
533
634
|
# Aptly immutable stable launcher v1. No login profiles or shell evaluation.
|
|
534
635
|
quiet=0
|
|
@@ -538,7 +639,7 @@ unset NODE_OPTIONS NODE_PATH NODE_REPL_EXTERNAL_MODULE
|
|
|
538
639
|
for utility in /usr/bin/env /usr/bin/uname /usr/bin/id /usr/bin/stat /usr/bin/sort /usr/bin/readlink /bin/date /bin/sleep; do
|
|
539
640
|
[ -x "$utility" ] || stop
|
|
540
641
|
done
|
|
541
|
-
case "$0" in
|
|
642
|
+
case "$0" in /*/${name}) root=\${0%/${name}};; *) stop;; esac
|
|
542
643
|
kernel=$(/usr/bin/uname -s) || stop
|
|
543
644
|
case "$kernel" in Darwin|Linux) :;; *) stop;; esac
|
|
544
645
|
owner=$(/usr/bin/id -u) || stop
|
|
@@ -601,12 +702,12 @@ private_file() {
|
|
|
601
702
|
[ "$user" = "$owner" ] && [ "$((0$bits & 077))" -eq 0 ] && [ "$links" = 1 ]
|
|
602
703
|
}
|
|
603
704
|
# Reject directories/FIFOs/links and unsafe ancestry BEFORE opening hash input.
|
|
604
|
-
private_file "$root
|
|
705
|
+
private_file "$root/${name}" && [ -x "$root/${name}" ] || stop
|
|
605
706
|
private_file "$root/bootstrap.cjs" || stop
|
|
606
707
|
if [ -x /usr/bin/sha256sum ]; then sum=$(/usr/bin/env -i PATH=/usr/bin:/bin LC_ALL=C /usr/bin/sha256sum "$root/bootstrap.cjs" 2>/dev/null) || stop
|
|
607
708
|
elif [ -x /usr/bin/shasum ]; then sum=$(/usr/bin/env -i PATH=/usr/bin:/bin LC_ALL=C /usr/bin/shasum -a 256 "$root/bootstrap.cjs" 2>/dev/null) || stop
|
|
608
709
|
else stop; fi
|
|
609
|
-
[ "\${sum%% *}" = ${quote(
|
|
710
|
+
[ "\${sum%% *}" = ${quote(hashFor(mode))} ] || stop
|
|
610
711
|
count=0
|
|
611
712
|
seen=
|
|
612
713
|
try_node() {
|
|
@@ -636,7 +737,7 @@ try_node() {
|
|
|
636
737
|
kill "$watchdog" 2>/dev/null; wait "$watchdog" 2>/dev/null
|
|
637
738
|
budget || stop
|
|
638
739
|
[ "$status" -eq 0 ] || return 1
|
|
639
|
-
# APTLY_OBSERVER_BEGIN
|
|
740
|
+
${requireNpm} # APTLY_OBSERVER_BEGIN
|
|
640
741
|
if [ "$quiet" -eq 1 ]; then
|
|
641
742
|
exec 3<&0 || stop
|
|
642
743
|
observer_child=
|
package/dist/src/update.d.ts
CHANGED
|
@@ -11,3 +11,22 @@ export interface UpdateDependencies {
|
|
|
11
11
|
export declare function updateGlobalInstallation(options: {
|
|
12
12
|
packageRoot: string;
|
|
13
13
|
}, dependencies?: UpdateDependencies): UpdateResult;
|
|
14
|
+
type UpdateClient = 'codex' | 'claude';
|
|
15
|
+
type MigrationResult = {
|
|
16
|
+
client: UpdateClient;
|
|
17
|
+
status: 'configured' | 'unchanged' | 'skipped' | 'error';
|
|
18
|
+
codes: string[];
|
|
19
|
+
requires_hook_review?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type UpdateMigrationResult = UpdateResult & {
|
|
22
|
+
migration?: MigrationResult;
|
|
23
|
+
migrations?: MigrationResult[];
|
|
24
|
+
};
|
|
25
|
+
/** Update first, then let the verified fresh CLI migrate the selected or existing owned hosts. */
|
|
26
|
+
export declare function updateGlobalAndMigrate(options: {
|
|
27
|
+
packageRoot: string;
|
|
28
|
+
client?: UpdateClient;
|
|
29
|
+
}, dependencies?: UpdateDependencies & {
|
|
30
|
+
platform?: NodeJS.Platform;
|
|
31
|
+
}): UpdateMigrationResult;
|
|
32
|
+
export {};
|
package/dist/src/update.js
CHANGED
|
@@ -66,3 +66,87 @@ export function updateGlobalInstallation(options, dependencies = {}) {
|
|
|
66
66
|
return { status: 'error', codes: [code] };
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
function readMigration(raw, client, exitedWithError) {
|
|
70
|
+
if (typeof raw !== 'string' || Buffer.byteLength(raw) > 65536)
|
|
71
|
+
return;
|
|
72
|
+
try {
|
|
73
|
+
const value = JSON.parse(raw);
|
|
74
|
+
if (!value || !Array.isArray(value.clients) || value.clients.length !== 1)
|
|
75
|
+
return;
|
|
76
|
+
const result = value.clients[0];
|
|
77
|
+
if (!result || result.client !== client || !Array.isArray(result.codes) || result.codes.length > 64 ||
|
|
78
|
+
!result.codes.every((code) => typeof code === 'string' && /^[a-z0-9_]{1,100}$/.test(code)) ||
|
|
79
|
+
(result.requires_hook_review !== undefined && typeof result.requires_hook_review !== 'boolean'))
|
|
80
|
+
return;
|
|
81
|
+
const valid = exitedWithError
|
|
82
|
+
? value.status === 'partial' && result.status === 'error' && result.codes.length > 0
|
|
83
|
+
: value.status === 'complete' && ['configured', 'unchanged'].includes(result.status) && result.codes.includes('launcher_migrated');
|
|
84
|
+
if (!valid)
|
|
85
|
+
return;
|
|
86
|
+
return { client, status: result.status, codes: result.codes, ...(result.requires_hook_review !== undefined ? { requires_hook_review: result.requires_hook_review } : {}) };
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function runMigration(cli, client, dependencies, automatic) {
|
|
93
|
+
const failure = (code) => ({ client, status: 'error', codes: [code] });
|
|
94
|
+
let raw, exitedWithError = false;
|
|
95
|
+
try {
|
|
96
|
+
// Inherit the caller's selected host homes. The new CLI revalidates ownership.
|
|
97
|
+
raw = (dependencies.run ?? runNpm)(dependencies.nodePath ?? process.execPath, [cli, 'setup', '--client', client, '--migrate-launcher', '--launcher', 'npx'], 120000);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const child = error;
|
|
101
|
+
if (child?.code === 'ETIMEDOUT' || child?.code === 'ENOBUFS' || typeof child?.signal === 'string')
|
|
102
|
+
return failure('launcher_migration_unverified');
|
|
103
|
+
if (child?.status !== 1)
|
|
104
|
+
return failure('launcher_migration_failed');
|
|
105
|
+
exitedWithError = true;
|
|
106
|
+
raw = child.stdout;
|
|
107
|
+
}
|
|
108
|
+
const result = readMigration(raw, client, exitedWithError);
|
|
109
|
+
if (!result)
|
|
110
|
+
return failure('launcher_migration_failed');
|
|
111
|
+
if (automatic && result.status === 'error' && result.codes.length === 1 && ['launcher_migration_not_owned', 'launcher_migration_not_standard'].includes(result.codes[0]))
|
|
112
|
+
return { ...result, status: 'skipped' };
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
/** Update first, then let the verified fresh CLI migrate the selected or existing owned hosts. */
|
|
116
|
+
export function updateGlobalAndMigrate(options, dependencies = {}) {
|
|
117
|
+
const supported = ['darwin', 'linux'].includes(dependencies.platform ?? process.platform);
|
|
118
|
+
if (!supported && options.client)
|
|
119
|
+
return { status: 'error', codes: ['npx_launcher_platform_unsupported'] };
|
|
120
|
+
const updated = updateGlobalInstallation(options, dependencies);
|
|
121
|
+
if (updated.status !== 'complete' || !supported)
|
|
122
|
+
return updated;
|
|
123
|
+
const errorResult = (code) => ({ status: 'error', version: updated.version, codes: ['package_updated', code, 'mcp_restart_required'] });
|
|
124
|
+
const migrate = (client, automatic) => {
|
|
125
|
+
try {
|
|
126
|
+
if (lstatSync(options.packageRoot).isSymbolicLink() || verifyPackage(options.packageRoot) !== updated.version)
|
|
127
|
+
failed('update_result_unverified');
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return { client, status: 'error', codes: ['update_result_unverified'] };
|
|
131
|
+
}
|
|
132
|
+
return runMigration(join(options.packageRoot, 'dist', 'bin', 'aptly.js'), client, dependencies, automatic);
|
|
133
|
+
};
|
|
134
|
+
if (options.client) {
|
|
135
|
+
const migration = migrate(options.client, false);
|
|
136
|
+
if (migration.status === 'error') {
|
|
137
|
+
const [first] = migration.codes;
|
|
138
|
+
return errorResult(['update_result_unverified', 'launcher_migration_unverified'].includes(first) ? first : 'launcher_migration_failed');
|
|
139
|
+
}
|
|
140
|
+
return { status: 'complete', version: updated.version, codes: ['package_updated', 'launcher_migrated', 'mcp_restart_required'], migration };
|
|
141
|
+
}
|
|
142
|
+
const clients = ['codex', 'claude'];
|
|
143
|
+
const migrations = clients.map(client => migrate(client, true));
|
|
144
|
+
const errors = migrations.filter(result => result.status === 'error');
|
|
145
|
+
if (errors.length) {
|
|
146
|
+
const codes = new Set(errors.map(result => ['update_result_unverified', 'launcher_migration_unverified'].includes(result.codes[0]) ? result.codes[0] : 'launcher_migration_failed'));
|
|
147
|
+
return { status: 'error', version: updated.version, codes: ['package_updated', ...codes, 'mcp_restart_required'], migrations };
|
|
148
|
+
}
|
|
149
|
+
if (migrations.every(result => result.status === 'skipped'))
|
|
150
|
+
return { ...updated, migrations };
|
|
151
|
+
return { status: 'complete', version: updated.version, codes: ['package_updated', 'launcher_migrated', 'mcp_restart_required'], migrations };
|
|
152
|
+
}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.22";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.22';
|
|
@@ -74,7 +74,7 @@ aptly setup --client codex --migrate-launcher --launcher stable --dry-run
|
|
|
74
74
|
aptly setup --client codex --migrate-launcher --launcher stable
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
If you continue using stable, run the same command after updating global Aptly to update the preserved copy. Ordinary `setup` does not replace it; an old copy reports `stable_snapshot_outdated`. Migration updates owned MCP and statistics observers together. Modified launchers and Hooks are not adopted. To target a preserved standard registration, review it and add `--include-existing`. Approve changed Codex Hooks again in `/hooks`.
|
|
78
78
|
|
|
79
79
|
<details>
|
|
80
80
|
<summary>Launcher limits and recovery</summary>
|
|
@@ -87,6 +87,21 @@ If ownership matches, a missing, damaged, or older-format copy can be explicitly
|
|
|
87
87
|
|
|
88
88
|
</details>
|
|
89
89
|
|
|
90
|
+
### Managed npx launcher
|
|
91
|
+
|
|
92
|
+
On macOS and Linux, bare `aptly update` updates the package, then attempts to migrate unchanged Aptly-owned Codex and Claude Code registrations in the configuration homes selected by the current environment to managed npx. Direct and stable registrations are eligible; custom or unmanaged registrations and absent registrations are left alone. Failures are reported per host, so one host can succeed while another fails. The first `aptly update` from 0.1.21 only updates the package; run it again with the new CLI. On Windows, bare update changes only the package.
|
|
93
|
+
|
|
94
|
+
Node.js 24 or later with bundled npm is required. Aptly preserves a pinned snapshot of the installed package and dependencies, then runs `npx` offline in an isolated working directory with clean npm configuration. MCP startup does not contact the registry or select `latest`.
|
|
95
|
+
|
|
96
|
+
To migrate one host explicitly, review the dry run before applying it. For Claude Code, replace `codex` with `claude`.
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
aptly setup --client codex --migrate-launcher --launcher npx --dry-run
|
|
100
|
+
aptly setup --client codex --migrate-launcher --launcher npx
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`aptly update --client codex --launcher npx` also targets one host. Explicit managed migration is unsupported on Windows. Check package and migration results separately. Hooks and credentials are preserved subject to ownership checks. Trust changed Codex Hooks again in `/hooks`, then restart the host.
|
|
104
|
+
|
|
90
105
|
<a id="guide-models-and-environment"></a>
|
|
91
106
|
|
|
92
107
|
## Models and environment variables
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
## Contents
|
|
8
8
|
|
|
9
9
|
- [Installation](#guide-installation)
|
|
10
|
+
- [Verify setup](#guide-verify-setup)
|
|
10
11
|
- [Windows PowerShell](#guide-windows-powershell)
|
|
11
12
|
- [Allow npm install scripts](#guide-npm-install-scripts)
|
|
12
13
|
- [Package updates](#guide-package-updates)
|
|
@@ -33,6 +34,21 @@ The install script registers MCP and Hooks in host directories that already exis
|
|
|
33
34
|
|
|
34
35
|
If you use `CODEX_HOME` or `CLAUDE_CONFIG_DIR`, set the same value for installation and setup. Aptly keeps your existing settings and launcher wrappers. See [account homes and keys](configuration.md).
|
|
35
36
|
|
|
37
|
+
<a id="guide-verify-setup"></a>
|
|
38
|
+
|
|
39
|
+
## Verify setup
|
|
40
|
+
|
|
41
|
+
Check the setup plan and key registration readiness for the selected host. Replace `codex` with `claude` for Claude Code. On Windows PowerShell, use `aptly.cmd`.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
aptly setup --check --client codex
|
|
45
|
+
aptly set env OPENAI_API_KEY --client codex --check
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Both commands leave files unchanged. `setup --check` checks the setup plan at the time you run it. The key check reports registration and Linux store readiness without reading or storing a key or testing API authentication. Use the running host to verify its behavior separately. Exit code `0` means the check found no error. Exit code `1` indicates a partial failure or command error. Inspect each host’s `status` and `codes` in the JSON output.
|
|
49
|
+
|
|
50
|
+
After setup, restart the host and MCP; in Codex, review and trust the Hook in `/hooks`. [Recommendation and Hook argument updates](routing.md#guide-automatic-routing) are distinct observations; neither proves that a child ran or completed. Check execution and completion separately in the host. See [troubleshooting](troubleshooting.md).
|
|
51
|
+
|
|
36
52
|
<a id="guide-windows-powershell"></a>
|
|
37
53
|
|
|
38
54
|
## Windows PowerShell
|
|
@@ -75,13 +91,14 @@ Stop the relevant hosts, MCP servers, and CLI processes, then run from a verifie
|
|
|
75
91
|
|
|
76
92
|
```sh
|
|
77
93
|
aptly update
|
|
78
|
-
aptly setup --client all
|
|
79
94
|
aptly --version
|
|
80
95
|
```
|
|
81
96
|
|
|
82
|
-
`update`
|
|
97
|
+
`update` updates the package in the same npm prefix without running install scripts. On macOS and Linux, the new CLI then attempts to migrate unchanged Aptly-owned Codex and Claude Code registrations in the configuration homes selected by the current environment to managed npx. Direct and stable registrations are eligible; custom or unmanaged registrations and absent registrations are left alone. Check package and per-host migration results separately: one host can succeed while another fails. On Windows, the command updates only the package.
|
|
98
|
+
|
|
99
|
+
The existing 0.1.21 updater only updates the package on its first run. Run `aptly update` again with the newly installed CLI to attempt migration of existing registrations; setup is not required for them. Use `aptly setup` for a new registration if needed. Hooks, credentials, and transmission choices are preserved subject to ownership checks. Trust changed Codex Hooks again in `/hooks` and restart the host. Review the [transmission scope](transmission.md) and explicitly choose it if needed.
|
|
83
100
|
|
|
84
|
-
|
|
101
|
+
On npm errors or local/source installations, use the manual installation command above. npm configuration with `dry-run=true` is rejected. If the old Node path has disappeared, follow [launcher recovery](troubleshooting.md#guide-launcher-recovery).
|
|
85
102
|
|
|
86
103
|
<details>
|
|
87
104
|
<summary>Upgrade from a pre-0.1.2 ledger</summary>
|
|
@@ -74,7 +74,7 @@ aptly setup --client codex --migrate-launcher --launcher stable --dry-run
|
|
|
74
74
|
aptly setup --client codex --migrate-launcher --launcher stable
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
stable を使い続ける場合は、グローバル Aptly の更新後に同じコマンドで保存コピーを更新してください。通常の `setup` はコピーを置き換えず、古いコピーは `stable_snapshot_outdated` で通知します。移行時は所有する MCP・統計オブザーバーを併せて更新します。変更されたランチャー・Hook は引き継ぎません。保持された標準登録が対象なら確認後に `--include-existing` を追加してください。Codex の変更された Hook は `/hooks` で再承認します。
|
|
78
78
|
|
|
79
79
|
<details>
|
|
80
80
|
<summary>ランチャーの制限と復旧</summary>
|
|
@@ -87,6 +87,21 @@ aptly setup --client codex --migrate-launcher --launcher stable
|
|
|
87
87
|
|
|
88
88
|
</details>
|
|
89
89
|
|
|
90
|
+
### 管理型 npx ランチャー
|
|
91
|
+
|
|
92
|
+
macOS・Linux では引数なしの `aptly update` がパッケージを更新した後、現在の環境で選択された設定ホームにある、変更されていない Aptly 所有の Codex・Claude Code 登録を管理型 npx に移行を試みます。direct・stable 登録が対象で、カスタム・非管理の登録や存在しない登録はそのままです。失敗はホスト別に報告され、一方が成功しても他方は失敗する場合があります。0.1.21 からの初回 `aptly update` はパッケージのみ更新するため、新しい CLI で再実行してください。Windows では引数なしの更新はパッケージのみ更新します。
|
|
93
|
+
|
|
94
|
+
npm を同梱する Node.js 24 以上が必要です。インストール済みパッケージと依存関係の固定スナップショットを保存し、分離された作業ディレクトリとクリーンな npm 設定で `npx` をオフライン実行します。MCP 起動時にレジストリへアクセスしたり `latest` を選択したりしません。
|
|
95
|
+
|
|
96
|
+
単一ホストを明示的に移行するには dry run を確認してから実行してください。Claude Code では `codex` を `claude` に置き換えます。
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
aptly setup --client codex --migrate-launcher --launcher npx --dry-run
|
|
100
|
+
aptly setup --client codex --migrate-launcher --launcher npx
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`aptly update --client codex --launcher npx` も単一ホストが対象です。Windows での明示的な管理型移行には対応しません。パッケージと移行の結果を個別に確認してください。Hook と資格情報は所有権確認を条件に保持します。変更された Codex Hook を `/hooks` で再承認し、ホストを再起動してください。
|
|
104
|
+
|
|
90
105
|
<a id="guide-models-and-environment"></a>
|
|
91
106
|
|
|
92
107
|
## モデルと環境変数
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
## この文書の目次
|
|
8
8
|
|
|
9
9
|
- [インストール](#guide-installation)
|
|
10
|
+
- [設定の確認](#guide-verify-setup)
|
|
10
11
|
- [Windows PowerShell](#guide-windows-powershell)
|
|
11
12
|
- [npm インストールスクリプトの許可](#guide-npm-install-scripts)
|
|
12
13
|
- [パッケージの更新](#guide-package-updates)
|
|
@@ -33,6 +34,21 @@ aptly --version
|
|
|
33
34
|
|
|
34
35
|
`CODEX_HOME` や `CLAUDE_CONFIG_DIR` を使う場合は、インストールと設定の両方で同じ値を指定してください。Aptly は既存の設定と実行ラッパーを維持します。詳しくは[アカウントホーム・キー設定](configuration.md)を参照してください。
|
|
35
36
|
|
|
37
|
+
<a id="guide-verify-setup"></a>
|
|
38
|
+
|
|
39
|
+
## 設定の確認
|
|
40
|
+
|
|
41
|
+
次のコマンドで、選択したホストの設定計画とキー登録の準備状態を確認してください。Claude Code の場合は `codex` を `claude` に変更してください。Windows PowerShell では `aptly.cmd` を使用してください。
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
aptly setup --check --client codex
|
|
45
|
+
aptly set env OPENAI_API_KEY --client codex --check
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
どちらのコマンドもファイルを変更しません。`setup --check` は通常の設定計画をその時点で確認するもので、実行中のホストは検証しません。キーの `--check` は登録と Linux の保存先の準備状態を確認しますが、キーの読み取り・保存や API 認証の検証は行いません。終了コード `0` は確認でエラーがなかったことを示し、`1` は部分的な失敗またはコマンドエラーを示します。JSON 出力のホストごとの `status` と `codes` を確認してください。
|
|
49
|
+
|
|
50
|
+
設定後はホストと MCP を再起動し、Codex では `/hooks` で Hook を確認・信頼してください。[推薦と Hook の引数変更](routing.md#guide-automatic-routing)は別の観測であり、どちらも子エージェントの実行や完了を証明しません。実行と完了はホストで別途確認してください。[トラブルシューティング](troubleshooting.md)も参照してください。
|
|
51
|
+
|
|
36
52
|
<a id="guide-windows-powershell"></a>
|
|
37
53
|
|
|
38
54
|
## Windows PowerShell
|
|
@@ -75,13 +91,14 @@ aptly setup --client all
|
|
|
75
91
|
|
|
76
92
|
```sh
|
|
77
93
|
aptly update
|
|
78
|
-
aptly setup --client all
|
|
79
94
|
aptly --version
|
|
80
95
|
```
|
|
81
96
|
|
|
82
|
-
`update`
|
|
97
|
+
`update` はインストールスクリプトを実行せず、同じ npm prefix のパッケージを更新します。macOS・Linux では、新しい CLI が現在の環境で選択された設定ホームにある、変更されていない Aptly 所有の Codex・Claude Code 登録を管理型 npx に移行を試みます。direct・stable 登録が対象で、カスタム・非管理の登録や存在しない登録はそのままです。パッケージとホスト別の移行結果を個別に確認してください。一方が成功しても他方は失敗する場合があります。Windows ではパッケージのみ更新します。
|
|
98
|
+
|
|
99
|
+
0.1.21 のアップデータ は初回にパッケージのみ更新します。新しい CLI で `aptly update` を再実行すると既存登録の移行を試みます。既存登録に setup は不要です。新規登録には必要に応じて `aptly setup` を使えます。Hook・資格情報・送信範囲の選択は所有権確認を条件に保持します。変更された Codex Hook を `/hooks` で再承認し、ホストを再起動してください。[送信範囲](transmission.md)を確認し、必要に応じて明示的に選択してください。
|
|
83
100
|
|
|
84
|
-
|
|
101
|
+
npm エラーやローカル・ソースインストールでは上記の手動インストールコマンドを使ってください。`dry-run=true` の npm 設定は拒否します。以前の Node パスがなくなった場合は[実行パスの復旧](troubleshooting.md#guide-launcher-recovery)を参照してください。
|
|
85
102
|
|
|
86
103
|
<details>
|
|
87
104
|
<summary>0.1.2 より前の台帳からのアップグレード</summary>
|
|
@@ -74,7 +74,7 @@ aptly setup --client codex --migrate-launcher --launcher stable --dry-run
|
|
|
74
74
|
aptly setup --client codex --migrate-launcher --launcher stable
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
전역 Aptly 업데이트
|
|
77
|
+
stable을 계속 사용하는 경우 전역 Aptly 업데이트 후 같은 명령으로 보존 사본을 갱신하십시오. 일반 `setup`은 사본을 교체하지 않으며 오래된 사본은 `stable_snapshot_outdated`로 알립니다. 전환은 소유한 MCP·통계 관찰자를 함께 갱신합니다. 수정된 실행기·Hook은 인수하지 않습니다. 보존된 표준 등록이 대상이면 검토 후 `--include-existing`을 추가하십시오. Codex의 변경된 Hook은 `/hooks`에서 다시 승인합니다.
|
|
78
78
|
|
|
79
79
|
<details>
|
|
80
80
|
<summary>실행기 제한과 복구</summary>
|
|
@@ -87,6 +87,21 @@ aptly setup --client codex --migrate-launcher --launcher stable
|
|
|
87
87
|
|
|
88
88
|
</details>
|
|
89
89
|
|
|
90
|
+
### 관리형 npx 실행기
|
|
91
|
+
|
|
92
|
+
macOS·Linux에서 인자 없이 실행한 `aptly update`는 패키지 업데이트 후 현재 환경에서 선택된 설정 홈의 변경되지 않은 Aptly 소유 Codex·Claude Code 등록을 관리형 npx로 전환을 시도합니다. direct와 stable 등록이 대상이며 사용자 지정·비관리 등록과 미등록 호스트는 그대로 둡니다. 호스트별 실패를 따로 보고하며 한 호스트가 성공해도 다른 호스트는 실패할 수 있습니다. 0.1.21에서는 첫 `aptly update`가 패키지만 갱신하므로 새 CLI로 다시 실행하십시오. Windows의 기본 업데이트는 패키지만 갱신합니다.
|
|
93
|
+
|
|
94
|
+
번들 npm이 포함된 Node.js 24 이상이 필요합니다. 설치된 패키지와 의존성의 고정 사본을 보존하고 전용 작업 디렉터리와 정리된 npm 설정에서 `npx`를 오프라인으로 실행합니다. MCP 시작 시 레지스트리에 접근하거나 `latest`를 선택하지 않습니다.
|
|
95
|
+
|
|
96
|
+
한 호스트를 명시적으로 전환하려면 dry run을 검토한 후 실행하십시오. Claude Code는 `codex`를 `claude`로 바꾸십시오.
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
aptly setup --client codex --migrate-launcher --launcher npx --dry-run
|
|
100
|
+
aptly setup --client codex --migrate-launcher --launcher npx
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`aptly update --client codex --launcher npx`도 단일 호스트를 대상으로 합니다. 명시적 관리형 전환은 Windows에서 지원하지 않습니다. 패키지와 전환 결과를 각각 확인하십시오. Hook·자격 정보는 소유권 확인 범위에서 보존합니다. 변경된 Codex Hook은 `/hooks`에서 다시 승인하고 호스트를 재시작하십시오.
|
|
104
|
+
|
|
90
105
|
<a id="guide-models-and-environment"></a>
|
|
91
106
|
|
|
92
107
|
## 모델과 환경변수
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
## 이 문서의 목차
|
|
8
8
|
|
|
9
9
|
- [설치](#guide-installation)
|
|
10
|
+
- [설정 확인](#guide-verify-setup)
|
|
10
11
|
- [Windows PowerShell](#guide-windows-powershell)
|
|
11
12
|
- [npm 설치 스크립트 허용](#guide-npm-install-scripts)
|
|
12
13
|
- [패키지 업데이트](#guide-package-updates)
|
|
@@ -33,6 +34,21 @@ aptly --version
|
|
|
33
34
|
|
|
34
35
|
`CODEX_HOME`이나 `CLAUDE_CONFIG_DIR`을 사용한다면 설치와 설정 명령을 실행할 때 같은 값을 지정하십시오. Aptly는 기존 설정과 실행 래퍼를 그대로 둡니다. [계정 홈·키 설정](configuration.md)을 참고하십시오.
|
|
35
36
|
|
|
37
|
+
<a id="guide-verify-setup"></a>
|
|
38
|
+
|
|
39
|
+
## 설정 확인
|
|
40
|
+
|
|
41
|
+
다음 명령으로 선택한 호스트의 설정 계획과 키 등록 준비 상태를 점검하십시오. Claude Code는 `codex`를 `claude`로 바꾸십시오. Windows PowerShell에서는 `aptly.cmd`를 사용하십시오.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
aptly setup --check --client codex
|
|
45
|
+
aptly set env OPENAI_API_KEY --client codex --check
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
두 명령은 파일을 변경하지 않습니다. `setup --check`는 일반 설정 계획을 실행 시점에 점검하는 명령이며 실행 중인 호스트를 확인하지 않습니다. 키의 `--check`는 등록과 Linux 저장소 준비 상태를 점검하지만 키를 읽거나 저장하지 않고 API 인증도 검증하지 않습니다. 종료 코드 `0`은 점검에 오류가 없다는 뜻이고 `1`은 부분 실패 또는 명령 오류입니다. JSON 출력에서 호스트별 `status`와 `codes`를 확인하십시오.
|
|
49
|
+
|
|
50
|
+
설정 후 호스트와 MCP를 재시작하고 Codex에서는 `/hooks`에서 Hook을 검토·신뢰하십시오. [추천과 Hook 인자 변경 관찰](routing.md#guide-automatic-routing)은 구분되며, 어느 쪽도 자식 실행이나 완료를 증명하지 않습니다. 실제 실행과 완료는 호스트에서 별도로 확인하십시오. [문제 해결](troubleshooting.md)을 참고하십시오.
|
|
51
|
+
|
|
36
52
|
<a id="guide-windows-powershell"></a>
|
|
37
53
|
|
|
38
54
|
## Windows PowerShell
|
|
@@ -75,13 +91,14 @@ aptly setup --client all
|
|
|
75
91
|
|
|
76
92
|
```sh
|
|
77
93
|
aptly update
|
|
78
|
-
aptly setup --client all
|
|
79
94
|
aptly --version
|
|
80
95
|
```
|
|
81
96
|
|
|
82
|
-
`update`는 같은 npm prefix
|
|
97
|
+
`update`는 설치 스크립트 없이 같은 npm prefix의 패키지를 업데이트합니다. macOS·Linux에서는 새 CLI가 현재 환경에서 선택된 설정 홈의 변경되지 않은 Aptly 소유 Codex·Claude Code 등록을 관리형 npx로 전환을 시도합니다. direct와 stable 등록이 대상이며 사용자 지정·비관리 등록과 미등록 호스트는 그대로 둡니다. 패키지 업데이트와 호스트별 전환 결과를 각각 확인하십시오. 한 호스트가 성공해도 다른 호스트는 실패할 수 있습니다. Windows에서는 패키지만 업데이트합니다.
|
|
98
|
+
|
|
99
|
+
0.1.21에서는 첫 실행에서 패키지만 업데이트합니다. 설치된 새 CLI로 `aptly update`를 다시 실행하면 기존 등록의 전환을 시도합니다. 기존 등록에 `setup`은 필요하지 않습니다. 새 등록에는 `aptly setup`을 사용할 수 있습니다. 소유권 확인 범위에서 Hook·자격 정보와 전송 범위를 보존합니다. 변경된 Codex Hook은 `/hooks`에서 다시 승인하고 호스트를 재시작하십시오. 전송 범위는 [전송 안내](transmission.md)에서 확인하고 필요하면 명시적으로 선택하십시오.
|
|
83
100
|
|
|
84
|
-
|
|
101
|
+
npm 오류나 로컬·소스 설치에서는 위 수동 설치 명령을 사용하십시오. `dry-run=true`인 npm 설정은 거절합니다. 기존 Node 경로가 사라졌다면 [실행 경로 복구](troubleshooting.md#guide-launcher-recovery)를 따르십시오.
|
|
85
102
|
|
|
86
103
|
<details>
|
|
87
104
|
<summary>0.1.2 이전 원장에서 업그레이드</summary>
|