geneseed 5.3.1 → 5.5.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/CHANGELOG.md +102 -0
- package/README.md +51 -18
- package/SHIPPED.md +7 -7
- package/adapters/bob/README.md +12 -1
- package/adapters/opencode/README.md +5 -3
- package/adapters/opencode/plugins/geneseed-context.js +77 -10
- package/adapters/opencode/plugins/geneseed-guard.js +106 -22
- package/adapters/opencode/plugins/geneseed-learn.js +641 -6
- package/bin/geneseed-cli.mjs +10 -0
- package/bin/geneseed-hook.mjs +5 -4
- package/docs/PRD.md +1 -1
- package/docs/README.md +1 -0
- package/docs/concepts/agents.md +14 -2
- package/docs/concepts/collaboration.md +2 -2
- package/docs/concepts/enforcement-table.md +5 -2
- package/docs/concepts/exclusions.md +16 -2
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/foreman-mode.md +23 -4
- package/docs/concepts/hook-gates.md +4 -4
- package/docs/concepts/hooks.md +25 -7
- package/docs/concepts/host-matrix.md +4 -4
- package/docs/concepts/hosts.md +1 -1
- package/docs/concepts/kits.md +12 -2
- package/docs/concepts/loop-bricks.md +3 -3
- package/docs/concepts/loops.md +6 -4
- package/docs/concepts/ownership.md +1 -1
- package/docs/concepts/rules.md +2 -2
- package/docs/concepts/shared-tier.md +1 -1
- package/docs/concepts/skills.md +21 -1
- package/docs/concepts/themes.md +1 -1
- package/docs/extending.md +73 -29
- package/docs/guides/auto-merge.md +100 -0
- package/docs/guides/choose-your-setup.md +1 -1
- package/docs/guides/headless.md +1 -1
- package/docs/guides/install-clone.md +19 -1
- package/docs/guides/install-scripted.md +8 -2
- package/docs/guides/install.md +20 -2
- package/docs/guides/loop-finish.md +3 -3
- package/docs/guides/loop-running.md +4 -4
- package/docs/guides/project-context.md +1 -1
- package/docs/guides/run-a-factory.md +2 -2
- package/docs/guides/setup-doctrines.md +2 -2
- package/docs/guides/setup-footprint.md +1 -1
- package/docs/guides/uninstall.md +3 -3
- package/docs/guides/upgrade.md +2 -2
- package/docs/guides/worktree.md +1 -1
- package/docs/reference/env-context.md +1 -1
- package/docs/reference/environment.md +4 -2
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-guard.md +1 -1
- package/docs/reference/plugin-learn.md +5 -1
- package/docs/reference/plugin-workflow.md +1 -1
- package/docs/reference/profiles.md +142 -0
- package/docs/reference/troubleshoot-doctor.md +1 -1
- package/docs/reference/troubleshoot-hooks.md +2 -2
- package/docs/reference/troubleshoot-install.md +3 -3
- package/docs/reference/troubleshoot-tools.md +1 -1
- package/docs/token-footprint.md +11 -6
- package/docs/understand/design-choices-engineering.md +1 -1
- package/docs/understand/enforced-vs-asked.md +1 -1
- package/docs/understand/machine-claude.md +2 -2
- package/docs/understand/on-your-machine.md +1 -1
- package/docs/web-ui.md +8 -6
- package/harness.config.json +1 -1
- package/js/README.md +11 -3
- package/js/build/args.mjs +16 -4
- package/js/build/catalog.mjs +11 -1
- package/js/build/driver.mjs +74 -16
- package/js/build/emit-claude.mjs +32 -5
- package/js/build/emit-opencode.mjs +16 -9
- package/js/build/export.mjs +1 -1
- package/js/build/generate.mjs +12 -157
- package/js/build/notes-migrate.mjs +99 -0
- package/js/build/profile.mjs +326 -0
- package/js/build/render.mjs +110 -8
- package/js/build/retired-skills.mjs +60 -13
- package/js/build/source.mjs +100 -3
- package/js/build/stubs.mjs +4 -1
- package/js/cli-table.json +212 -7
- package/js/hosts/agent-runs.mjs +205 -0
- package/js/hosts/done-checks.mjs +3 -1
- package/js/hosts/hooks-done.mjs +428 -63
- package/js/hosts/hooks-learn.mjs +89 -3
- package/js/hosts/hooks-prims.mjs +44 -4
- package/js/hosts/hooks.mjs +159 -9
- package/js/hosts/hosts.mjs +10 -0
- package/js/hosts/installs.mjs +44 -2
- package/js/hosts/link.mjs +45 -10
- package/js/hosts/native.mjs +61 -7
- package/js/hosts/opencode.mjs +1 -1
- package/js/hosts/settings.mjs +101 -3
- package/js/hosts/spec-feedback.mjs +538 -0
- package/js/hosts/usage.mjs +67 -8
- package/js/inspect/agent-scores.mjs +118 -0
- package/js/inspect/checks-authoring.mjs +2 -1
- package/js/inspect/checks-build.mjs +20 -4
- package/js/inspect/checks-constitution.mjs +32 -0
- package/js/inspect/checks-repo.mjs +27 -2
- package/js/inspect/cost.mjs +6 -5
- package/js/inspect/diff.mjs +46 -8
- package/js/inspect/doctor.mjs +4 -0
- package/js/inspect/inventory.mjs +1 -1
- package/js/inspect/status.mjs +3 -1
- package/js/inspect/validate.mjs +1 -0
- package/js/lib/machine-dir.mjs +8 -0
- package/js/lib/paths.mjs +4 -1
- package/js/maintain/profile-scope.mjs +145 -0
- package/js/maintain/profiles.mjs +486 -0
- package/js/maintain/setup.mjs +413 -15
- package/js/maintain/uninstall.mjs +4 -1
- package/js/maintain/update.mjs +4 -2
- package/js/web/actions.mjs +44 -41
- package/js/web/api.mjs +13 -3
- package/js/web/handler.mjs +8 -0
- package/js/web/jobs.mjs +5 -4
- package/js/web/profiles-api.mjs +201 -0
- package/js/web/routes.mjs +5 -0
- package/package.json +2 -1
- package/profiles/guillaume-claude-global.json +16 -0
- package/profiles/starter.json +14 -0
- package/registry.json +14 -0
- package/src/AGENT.md.tmpl +16 -18
- package/src/agents/_self-improvement.md +15 -7
- package/src/agents/_template.md +4 -2
- package/src/agents/advocate.md +1 -1
- package/src/agents/architect.md +1 -1
- package/src/agents/developer.md +10 -3
- package/src/agents/devops-engineer.md +1 -1
- package/src/agents/docker-expert.md +1 -1
- package/src/agents/docs.md +1 -1
- package/src/agents/empiricist.md +1 -1
- package/src/agents/explorer.md +4 -2
- package/src/agents/framer.md +1 -1
- package/src/agents/historian.md +1 -1
- package/src/agents/kubernetes-specialist.md +1 -1
- package/src/agents/memory-curator.md +1 -1
- package/src/agents/operator.md +1 -1
- package/src/agents/performance.md +1 -1
- package/src/agents/pragmatist.md +1 -1
- package/src/agents/react-engineer.md +1 -1
- package/src/agents/react-reviewer.md +1 -1
- package/src/agents/researcher.md +1 -1
- package/src/agents/reviewer.md +10 -3
- package/src/agents/security.md +1 -1
- package/src/agents/skeptic.md +1 -1
- package/src/agents/spring-boot-engineer.md +1 -1
- package/src/agents/spring-reviewer.md +1 -1
- package/src/agents/spring-security.md +1 -1
- package/src/agents/steward.md +1 -1
- package/src/agents/tester.md +4 -2
- package/src/agents/user-advocate.md +1 -1
- package/src/agents/visionary.md +1 -1
- package/src/bricks/pr-open.md +3 -2
- package/src/doctrines/ops.md +2 -2
- package/src/doctrines/process.md +40 -36
- package/src/factories/analysis-to-build.json +1 -1
- package/src/factories/bug-report-to-fix.json +1 -1
- package/src/factories/issue-to-pr.json +1 -1
- package/src/kits/terminal-tools/rules.md +10 -0
- package/src/kits/terminal-tools.json +13 -0
- package/src/licenses/herdr.txt +201 -0
- package/src/memory/README.md +12 -2
- package/src/modes/foreman.md +25 -9
- package/src/skill-descriptions.json +63 -0
- package/src/skills/_self-improvement.md +42 -24
- package/src/skills/_template.md +3 -1
- package/src/skills/brainstorm.md +35 -22
- package/src/skills/commit.md +17 -17
- package/src/skills/daydream/VENDOR.md +6 -0
- package/src/skills/debug/ci.md +1 -1
- package/src/skills/dependencies.md +3 -3
- package/src/skills/diagram-design/VENDOR.md +4 -0
- package/src/skills/document-project.md +3 -2
- package/src/skills/explain-changes/VENDOR.md +5 -1
- package/src/skills/factory.md +13 -4
- package/src/skills/geneseed.md +4 -2
- package/src/skills/git-history.md +5 -7
- package/src/skills/herdr.md +135 -0
- package/src/skills/loop.md +3 -2
- package/src/skills/opencode-cli.md +84 -0
- package/src/skills/parallel-agents.md +11 -0
- package/src/skills/pipeline.md +3 -3
- package/src/skills/plan.md +5 -4
- package/src/skills/react-view-transitions/VENDOR.md +7 -1
- package/src/skills/release.md +11 -9
- package/src/skills/review-response.md +4 -2
- package/src/skills/rule/approve.md +2 -1
- package/src/skills/rule.md +27 -1
- package/src/skills/ship.md +54 -7
- package/src/skills/skill-forge.md +5 -3
- package/src/skills/token-report/VENDOR.md +5 -1
- package/src/skills/worktree.md +2 -2
- package/src/upstreams.json +9 -2
- package/themes/README.md +3 -1
- package/themes/_TEMPLATE.json +2 -0
- package/themes/biker.json +2 -0
- package/themes/commentator.json +2 -0
- package/themes/cyberpunk.json +2 -0
- package/themes/gamer.json +2 -0
- package/themes/imperial.json +2 -0
- package/themes/joker.json +2 -0
- package/themes/marvin.json +2 -0
- package/themes/mean.json +2 -0
- package/themes/military.json +2 -0
- package/themes/neutral.json +2 -0
- package/themes/pirate.json +2 -0
- package/themes/sports.json +2 -0
- package/themes/verstappen.json +2 -0
- package/themes/wizard.json +2 -0
- package/web/dist/assets/{ActiveLoops-BJJN3P-V.js → ActiveLoops-DOJCPPPc.js} +1 -1
- package/web/dist/assets/Activity-LKsDzsnK.js +1 -0
- package/web/dist/assets/ActivityDetail-DhwTfPm6.js +1 -0
- package/web/dist/assets/{Bonsai-BBl4XXqs.js → Bonsai-CePMLrpr.js} +1 -1
- package/web/dist/assets/{CopyButton-Beven8yn.js → CopyButton-CuoaJ6k7.js} +1 -1
- package/web/dist/assets/Dashboard-D1VKuvLe.js +2 -0
- package/web/dist/assets/Docs-CUrHJKaU.js +5 -0
- package/web/dist/assets/Factories-Ci1XfmSy.js +1 -0
- package/web/dist/assets/{GreenhouseView-Bce212qd.js → GreenhouseView-CNfH2lPK.js} +1 -1
- package/web/dist/assets/Installs-ZHQZM1iS.js +3 -0
- package/web/dist/assets/{JournalView-CV4omyww.js → JournalView-CMsWahkS.js} +1 -1
- package/web/dist/assets/Kits-CkliyK0n.js +1 -0
- package/web/dist/assets/Laws-hh4O3HZ4.js +4 -0
- package/web/dist/assets/{LibRows-Dag1s0ZX.js → LibRows-Brv0Hmkr.js} +1 -1
- package/web/dist/assets/Library-BYmiLjJr.js +3 -0
- package/web/dist/assets/Loops-ytm-xJ68.js +2 -0
- package/web/dist/assets/{OperatorHudView-JmYY1pBR.js → OperatorHudView-KaqCx_HP.js} +1 -1
- package/web/dist/assets/Personal-CmcnRKYE.js +2 -0
- package/web/dist/assets/Settings-tUrpdOfq.js +1 -0
- package/web/dist/assets/{Tabs-8zsyEPSK.js → Tabs-CD7etcGD.js} +1 -1
- package/web/dist/assets/api-CZ-x0iWG.js +1 -0
- package/web/dist/assets/{controls-D4wmg_pl.js → controls-CK7qHA8H.js} +1 -1
- package/web/dist/assets/{index-CRWqKxfY.css → index-Ba_Kg3Af.css} +1 -1
- package/web/dist/assets/index-COKbhFNo.js +6 -0
- package/web/dist/index.html +3 -3
- package/web/dist/assets/Activity-WQ3ykgxU.js +0 -1
- package/web/dist/assets/ActivityDetail-7rt04SkS.js +0 -1
- package/web/dist/assets/Dashboard-BgLArtgu.js +0 -2
- package/web/dist/assets/Docs-B5aHp86J.js +0 -5
- package/web/dist/assets/Factories-BjqzXAw8.js +0 -1
- package/web/dist/assets/Installs-B1OsrHXF.js +0 -3
- package/web/dist/assets/Kits-CW1e7xNa.js +0 -1
- package/web/dist/assets/Laws-1Ckf1lbs.js +0 -4
- package/web/dist/assets/Library-B3FuFLel.js +0 -3
- package/web/dist/assets/Loops-CwqgnLNw.js +0 -2
- package/web/dist/assets/Personal-DKLgLa7Z.js +0 -2
- package/web/dist/assets/Settings-BwErnh-R.js +0 -1
- package/web/dist/assets/api-DLDVY3K-.js +0 -1
- package/web/dist/assets/index-Ce6qF2nG.js +0 -6
package/js/maintain/setup.mjs
CHANGED
|
@@ -45,20 +45,25 @@ import { existsSync, readdirSync } from 'node:fs';
|
|
|
45
45
|
import os from 'node:os';
|
|
46
46
|
import path from 'node:path';
|
|
47
47
|
|
|
48
|
-
import { main as driverMain, resolveOut } from '../build/driver.mjs';
|
|
48
|
+
import { main as driverMain, parseDriverArgs, resolveOut } from '../build/driver.mjs';
|
|
49
|
+
import { preserveRefusal } from '../build/profile.mjs';
|
|
50
|
+
import { cmdLink } from '../hosts/link.mjs';
|
|
51
|
+
import { autostartInstall, autostartState, transientRoot } from '../hosts/shim.mjs';
|
|
52
|
+
import { loadProfile, profileBuildArgs, profileHosts } from './profiles.mjs';
|
|
53
|
+
import { checkProjectFolder, globalLayering, layeringText } from './profile-scope.mjs';
|
|
49
54
|
import { playLine } from '../ui/anim.mjs';
|
|
50
|
-
import { discoverNames, GATE_SWITCHES, PACK_ORDER, loadKits } from '../build/source.mjs';
|
|
55
|
+
import { DEFAULT_CONTEXT_WINDOW, discoverNames, GATE_SWITCHES, PACK_ORDER, ROOT, loadKits } from '../build/source.mjs';
|
|
51
56
|
import { exportImprovements } from '../inspect/diff.mjs';
|
|
52
57
|
import { cmdDoctor } from '../inspect/doctor.mjs';
|
|
53
58
|
import { setupBuildArgs } from '../build/generate.mjs';
|
|
54
59
|
import { SHARED_TIER_BENEFIT, sharedTierCost, sharedTierFigure } from '../inspect/cost.mjs';
|
|
55
60
|
import { GLOBAL_MANIFEST, HOSTS, opencodeConfigDir } from '../hosts/hosts.mjs';
|
|
56
61
|
import {
|
|
57
|
-
claudeCfg, defaultMode, defaultPosture, defaultTheme, EMIT_HOST_SCOPE, gatesOfDir, installedDefaults,
|
|
58
|
-
readJsonMaybe, sharedTierOfDir, themeFiles,
|
|
62
|
+
claudeCfg, defaultMode, defaultPosture, defaultTheme, EMIT_HOST_SCOPE, gatesOfDir, installedDefaults, installState,
|
|
63
|
+
contextWindowOfDir, readJsonMaybe, sharedTierOfDir, themeFiles,
|
|
59
64
|
} from '../hosts/installs.mjs';
|
|
60
65
|
import { printOut, printErr } from '../lib/fs.mjs';
|
|
61
|
-
import { which } from '../lib/paths.mjs';
|
|
66
|
+
import { inNpxCache, which } from '../lib/paths.mjs';
|
|
62
67
|
import { ask, askChoice, confirm } from '../lib/prompt.mjs';
|
|
63
68
|
import { parseIntStrict } from '../lib/text.mjs';
|
|
64
69
|
import { NO_WINDOW } from '../lib/proc.mjs';
|
|
@@ -288,6 +293,25 @@ function targetGates(emit, out) {
|
|
|
288
293
|
}
|
|
289
294
|
}
|
|
290
295
|
|
|
296
|
+
/**
|
|
297
|
+
* The context window of the one install a setup answer re-runs, read off it as `targetGates`
|
|
298
|
+
* reads the gates. PRESERVED, NOT ASKED: the wizard's questions are answered by holding Enter and
|
|
299
|
+
* every recorded probe compares them byte for byte, so the option is set with the flag, a profile
|
|
300
|
+
* or the console. A target with no install takes `machine`, the machine's answer
|
|
301
|
+
* (`installedDefaults`), as the CLI's new project does. Unreadable reads as the default.
|
|
302
|
+
*/
|
|
303
|
+
export function targetContextWindow(emit, out, machine = DEFAULT_CONTEXT_WINDOW) {
|
|
304
|
+
const [host, scope] = EMIT_HOST_SCOPE.get(emit) ?? [];
|
|
305
|
+
try {
|
|
306
|
+
if (!host) return contextWindowOfDir(resolveOut(out || 'Harness'));
|
|
307
|
+
const dir = scope === 'global'
|
|
308
|
+
? HOSTS.find((h) => h.host === host).configDir() : resolveOut(out || '.');
|
|
309
|
+
return installState(dir, host, scope) === 'absent' ? machine : contextWindowOfDir(dir, host);
|
|
310
|
+
} catch {
|
|
311
|
+
return DEFAULT_CONTEXT_WINDOW;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
291
315
|
export function collectSetupLines(kitMap = null) {
|
|
292
316
|
printOut('Geneseed setup — answer a few questions; nothing is written until you confirm.\n');
|
|
293
317
|
const inst = installedDefaults();
|
|
@@ -334,15 +358,17 @@ export function collectSetupLines(kitMap = null) {
|
|
|
334
358
|
// `setupBuildArgs` elides an armed gate, so an all-armed install prints what it always did.
|
|
335
359
|
const gates = targetGates(emit, out);
|
|
336
360
|
const gated = Object.values(gates).some((on) => on === false);
|
|
361
|
+
const contextWindow = targetContextWindow(emit, out, inst.contextWindow);
|
|
337
362
|
printOut(`\nAbout to run: geneseed build ${
|
|
338
363
|
setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines, allPacks,
|
|
339
|
-
excludeRules, undefined, excludeSkills, gates, kits, sharedTier).join(' ')}\n`);
|
|
364
|
+
excludeRules, undefined, excludeSkills, gates, kits, sharedTier, contextWindow).join(' ')} --reset\n`);
|
|
340
365
|
if (!confirm('Proceed?', true)) return null;
|
|
341
366
|
// The key only when there is something to carry, so a selection that excludes no skill and
|
|
342
367
|
// switches off no gate is the same object it was before either existed.
|
|
343
368
|
return {
|
|
344
369
|
theme, posture, mode, doctrines, excludeRules, ...(excludeSkills ? { excludeSkills } : {}),
|
|
345
370
|
...(gated ? { gates } : {}), ...(kits ? { kits } : {}), ...(sharedTier ? { sharedTier } : {}),
|
|
371
|
+
...(contextWindow !== DEFAULT_CONTEXT_WINDOW ? { contextWindow } : {}),
|
|
346
372
|
emit, out, root, footprint,
|
|
347
373
|
};
|
|
348
374
|
}
|
|
@@ -488,6 +514,22 @@ export function setupSummaryLines(theme, emit, out, root, ok) {
|
|
|
488
514
|
// the flow
|
|
489
515
|
// --------------------------------------------------------------------------------------
|
|
490
516
|
|
|
517
|
+
/**
|
|
518
|
+
* The note a setup run from the npx cache ends with; empty anywhere else.
|
|
519
|
+
*
|
|
520
|
+
* `npx geneseed setup` puts no `geneseed` command on PATH, and `link` must not: its launcher would
|
|
521
|
+
* name the npx cache, which npm prunes (`inNpxCache`). A global install is the lasting copy, so
|
|
522
|
+
* the note points there. A hint, not an act: running npm from here would breach the CLI's spawn
|
|
523
|
+
* ban and reach the network (decided 2026-11-13, O1 over an offered `npm i -g`).
|
|
524
|
+
*/
|
|
525
|
+
export function npxPathHint(root = ROOT) {
|
|
526
|
+
if (!inNpxCache(root)) return [];
|
|
527
|
+
return [
|
|
528
|
+
'This setup ran from the npx cache, so there is no `geneseed` command in your terminal.',
|
|
529
|
+
'For a lasting one: npm install -g geneseed, then run geneseed setup again.',
|
|
530
|
+
];
|
|
531
|
+
}
|
|
532
|
+
|
|
491
533
|
/**
|
|
492
534
|
* Gather, export drift, build, summarise, offer the doctor.
|
|
493
535
|
*
|
|
@@ -522,7 +564,7 @@ export function setupLines() {
|
|
|
522
564
|
const {
|
|
523
565
|
theme, emit, out, root, footprint = 'lean', posture = 'peer', mode = 'direct',
|
|
524
566
|
doctrines = null, excludeRules = null, excludeSkills = null, gates = {}, kits = null,
|
|
525
|
-
sharedTier = false,
|
|
567
|
+
sharedTier = false, contextWindow = DEFAULT_CONTEXT_WINDOW,
|
|
526
568
|
} = sel;
|
|
527
569
|
if (emit === 'opencode-global') {
|
|
528
570
|
// The build below overwrites the deployed global harness, which may carry hand edits (or
|
|
@@ -541,7 +583,12 @@ export function setupLines() {
|
|
|
541
583
|
// runs must carry the pack selection the plan line just previewed, or the wizard would print
|
|
542
584
|
// one command and run another.
|
|
543
585
|
const argv = setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines,
|
|
544
|
-
doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits, sharedTier
|
|
586
|
+
doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits, sharedTier,
|
|
587
|
+
contextWindow);
|
|
588
|
+
// `--reset`: the wizard's answers are a WHOLE selection, and `setupBuildArgs` elides an axis at
|
|
589
|
+
// its default, so answering one back to it (mode direct, posture peer) over an install would
|
|
590
|
+
// otherwise trip the preserve guard (js/build/profile.mjs). The plan line above says the same.
|
|
591
|
+
argv.push('--reset');
|
|
545
592
|
printOut(`Running: geneseed build ${argv.join(' ')}\n`);
|
|
546
593
|
const rc = driverMain(argv);
|
|
547
594
|
if (rc !== 0) {
|
|
@@ -554,6 +601,7 @@ export function setupLines() {
|
|
|
554
601
|
for (const [kind, text] of setupSummaryLines(theme, emit, out, root, true)) {
|
|
555
602
|
printOut(`${{ ok: '✓', warn: '!', info: '-' }[kind] ?? '-'} ${text}\n`);
|
|
556
603
|
}
|
|
604
|
+
for (const line of npxPathHint()) printOut(`! ${line}\n`);
|
|
557
605
|
if (confirm('\nRun a health check (doctor) now?', true)) {
|
|
558
606
|
// Scoped to the theme just installed — no full-sweep noise post-install.
|
|
559
607
|
return cmdDoctor({ theme, all: false, bundle: null, noBundle: false });
|
|
@@ -568,12 +616,15 @@ export function setupLines() {
|
|
|
568
616
|
* only part of this file the acceptance matrix compares. `process.stdin.isTTY` is `undefined`
|
|
569
617
|
* off a terminal rather than `false`, which is why it is negated rather than compared.
|
|
570
618
|
*/
|
|
571
|
-
export async function cmdSetup() {
|
|
619
|
+
export async function cmdSetup(args = {}) {
|
|
572
620
|
const refusal = (await import('./update.mjs')).gateRefusal();
|
|
573
621
|
if (refusal) {
|
|
574
622
|
printErr(`[setup] not started: ${refusal}\n`);
|
|
575
623
|
return 1;
|
|
576
624
|
}
|
|
625
|
+
// Before the TTY refusal: a profile run asks nothing, so a script or a remote shell may run it
|
|
626
|
+
// (install profiles, D15).
|
|
627
|
+
if (args?.profile) return setupProfile(args.profile);
|
|
577
628
|
if (!process.stdin.isTTY) {
|
|
578
629
|
printErr('[setup] needs an interactive terminal. Non-interactive? e.g.:\n'
|
|
579
630
|
+ ' geneseed build --emit opencode-global --theme neutral\n');
|
|
@@ -583,6 +634,17 @@ export async function cmdSetup() {
|
|
|
583
634
|
return setupLines();
|
|
584
635
|
}
|
|
585
636
|
|
|
637
|
+
/**
|
|
638
|
+
* `[label, command, install url]` per host, in HOSTS order. The command is also the host id a
|
|
639
|
+
* profile lists (`setupProfile` pairs a `hostTools` row with its host by this index).
|
|
640
|
+
*/
|
|
641
|
+
const HOST_TOOLS = [
|
|
642
|
+
['OpenCode', 'opencode', 'https://opencode.ai/docs/'],
|
|
643
|
+
['Claude Code', 'claude', 'https://code.claude.com/docs/en/setup'],
|
|
644
|
+
['IBM Bob', 'bob', 'https://bob.ibm.com/'],
|
|
645
|
+
['OpenClaude', 'openclaude', 'https://openclaude.gitlawb.com/'],
|
|
646
|
+
];
|
|
647
|
+
|
|
586
648
|
/**
|
|
587
649
|
* The AI coding tools Geneseed installs into, as `[label, present, url, where]` rows in HOSTS
|
|
588
650
|
* order. `where` is the path found OFF the PATH (see `userInstall`), else null.
|
|
@@ -600,12 +662,7 @@ export async function cmdSetup() {
|
|
|
600
662
|
* test, which cannot rely on what this machine happens to have installed.
|
|
601
663
|
*/
|
|
602
664
|
export function hostTools({ lookup = which, userLookup = userInstall } = {}) {
|
|
603
|
-
return [
|
|
604
|
-
['OpenCode', 'opencode', 'https://opencode.ai/docs/'],
|
|
605
|
-
['Claude Code', 'claude', 'https://code.claude.com/docs/en/setup'],
|
|
606
|
-
['IBM Bob', 'bob', 'https://bob.ibm.com/'],
|
|
607
|
-
['OpenClaude', 'openclaude', 'https://openclaude.gitlawb.com/'],
|
|
608
|
-
].map(([label, cmd, url]) => {
|
|
665
|
+
return HOST_TOOLS.map(([label, cmd, url]) => {
|
|
609
666
|
if (lookup(cmd)) return [label, true, url, null];
|
|
610
667
|
const where = userLookup(cmd);
|
|
611
668
|
return [label, Boolean(where), url, where || null];
|
|
@@ -691,3 +748,344 @@ function toolsReport(tools = hostTools()) {
|
|
|
691
748
|
printOut('Stopped. Run setup again once a tool is installed.\n');
|
|
692
749
|
return false;
|
|
693
750
|
}
|
|
751
|
+
|
|
752
|
+
// --------------------------------------------------------------------------------------
|
|
753
|
+
// the profile run (`setup --profile <name>`)
|
|
754
|
+
// --------------------------------------------------------------------------------------
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* What a profile run would change back on `argv`'s target install, global or project (spec D14): the preserve
|
|
758
|
+
* guard's own comparison, run on the argv WITHOUT `--reset` (with it the guard returns null) and
|
|
759
|
+
* with no flag counted as given, so every setting that differs is listed. `[]` when there is no
|
|
760
|
+
* install there yet, or when the argv cannot be parsed (the build then refuses on its own terms).
|
|
761
|
+
*/
|
|
762
|
+
export function profileChanges(argv) {
|
|
763
|
+
try {
|
|
764
|
+
const args = parseDriverArgs(argv.filter((a) => a !== '--reset'));
|
|
765
|
+
// A project emit's target is its `--out` folder (`guardTarget`); a global one ignores it.
|
|
766
|
+
return preserveRefusal(args, new Set(), args.out ?? null)?.changes ?? [];
|
|
767
|
+
} catch {
|
|
768
|
+
return [];
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* The login item, as one `{ ok, text }` line for the summary. Rewritten only when it is absent
|
|
774
|
+
* or stale (spec D7); a hand-written one is left alone with a warning that names it. `null`
|
|
775
|
+
* where the platform has no login item Geneseed writes. `state` and `install` are the test's
|
|
776
|
+
* seams; the defaults are `js/hosts/shim.mjs`'s.
|
|
777
|
+
*/
|
|
778
|
+
export function loginItem({ state = autostartState, install = autostartInstall } = {}) {
|
|
779
|
+
const cur = state();
|
|
780
|
+
if (!cur) return null;
|
|
781
|
+
if (cur.state === 'ours') return { ok: true, text: `login item already set: ${cur.file}` };
|
|
782
|
+
if (cur.state === 'hand') {
|
|
783
|
+
return { ok: false, text: `login item not written: ${cur.file} was not written by Geneseed, so it is left alone` };
|
|
784
|
+
}
|
|
785
|
+
const r = install();
|
|
786
|
+
if (r.ok) return { ok: true, text: `login item written: ${cur.file}` };
|
|
787
|
+
return { ok: false, text: `login item not written: ${r.error} (see docs/guides/autostart.md)` };
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Start the console without a browser, or restart it when it already runs so it serves the code
|
|
792
|
+
* just pulled (spec D21). `restartDaemon` with `onlyIfRunning` false is exactly that: it stops a
|
|
793
|
+
* live console first and starts one either way. The URL comes from the daemon record AFTER the
|
|
794
|
+
* start, because a busy port moves the console to another one. Lazy: `js/web/daemon.mjs` spawns,
|
|
795
|
+
* and only this arm of `setup` needs it.
|
|
796
|
+
*/
|
|
797
|
+
async function defaultConsole() {
|
|
798
|
+
const [{ readDaemon, restartDaemon }, { webState }] = await Promise.all([
|
|
799
|
+
import('../web/daemon.mjs'), import('../web/state.mjs'),
|
|
800
|
+
]);
|
|
801
|
+
const rc = await restartDaemon(null, null, false);
|
|
802
|
+
const url = readDaemon(webState(null).target)?.url ?? null;
|
|
803
|
+
return { ok: rc === 0 && Boolean(url), url };
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/** `hostTools` rows as `{ label, host, url, present }`, in HOSTS order. */
|
|
807
|
+
function foundHosts(rows) {
|
|
808
|
+
return HOST_TOOLS.map(([label, host, url], i) => ({ label, host, url, present: Boolean(rows[i]?.[1]) }));
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* The per-host builds of a profile run, shared by `setup --profile` and `profile apply` (spec
|
|
813
|
+
* D16, D19, D33): for each target host, the settings the build will change back (D14), the local
|
|
814
|
+
* edits exported first (D19, a global install only: `diffCollect` reads no drift off a project
|
|
815
|
+
* install), then the build. A failure is recorded and the loop goes on.
|
|
816
|
+
*
|
|
817
|
+
* `project` set builds each host's project emit into that folder (D32); null builds globally.
|
|
818
|
+
*/
|
|
819
|
+
export function profileBuilds(p, targets, { project = null, build, exportDrift, changes, configDir }) {
|
|
820
|
+
const results = [];
|
|
821
|
+
for (const t of targets) {
|
|
822
|
+
const argv = profileBuildArgs(p, t.host, project);
|
|
823
|
+
const moved = changes(argv);
|
|
824
|
+
let saved = null;
|
|
825
|
+
if (!project) {
|
|
826
|
+
try {
|
|
827
|
+
[saved] = exportDrift(configDir(t.host));
|
|
828
|
+
} catch (e) {
|
|
829
|
+
printOut(`! could not export local edits of ${t.label} (${e && e.message}) - continuing.\n`);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
printOut(`Running: geneseed build ${argv.join(' ')}\n`);
|
|
833
|
+
let rc;
|
|
834
|
+
try {
|
|
835
|
+
rc = build(argv);
|
|
836
|
+
} catch (e) {
|
|
837
|
+
rc = e && e.exitCode ? e.exitCode : 1;
|
|
838
|
+
printErr(`[setup] ${t.label}: ${e && e.message}\n`);
|
|
839
|
+
}
|
|
840
|
+
results.push({ ...t, argv, rc, moved, saved, project });
|
|
841
|
+
}
|
|
842
|
+
return results;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/** The summary lines of `profileBuilds`' results: each host, what it put back, what it saved. */
|
|
846
|
+
export function profileBuildLines(results) {
|
|
847
|
+
const out = [];
|
|
848
|
+
for (const r of results) {
|
|
849
|
+
if (r.rc === 0) {
|
|
850
|
+
out.push(` ok ${r.label}: installed (${r.project ? `${r.host} project in ${r.project}` : `${r.host}-global`})`);
|
|
851
|
+
} else {
|
|
852
|
+
// D25: no --force on a profile run. The build's own output names the file it refused.
|
|
853
|
+
out.push(` FAIL ${r.label}: build failed (exit ${r.rc}) - see its output above. If it names a file`,
|
|
854
|
+
' of yours at a name Geneseed ships, move that file, or replace it with:',
|
|
855
|
+
` geneseed build ${r.argv.join(' ')} --force`);
|
|
856
|
+
}
|
|
857
|
+
// Only a build that ran put anything back; a failed one left the install as it was.
|
|
858
|
+
if (r.rc === 0 && r.moved.length) {
|
|
859
|
+
out.push(` changed back to the profile: ${r.moved.map((c) => `${c.name} ${c.from} -> ${c.to}`).join(', ')}`);
|
|
860
|
+
}
|
|
861
|
+
if (r.saved) out.push(` local edits saved to ${r.saved} (hand that file to your agent to back-port them)`);
|
|
862
|
+
}
|
|
863
|
+
return out;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* `geneseed setup --profile <name>` — the whole install with no question asked.
|
|
868
|
+
*
|
|
869
|
+
* The flow is the spec's ("Flow of `geneseed setup --profile <name>`"): load the profile, find
|
|
870
|
+
* the hosts it lists on this machine (D27), build each one globally (a failure is recorded and
|
|
871
|
+
* the loop goes on, D16), then `link` (always, D23), the login item and the console (warnings,
|
|
872
|
+
* never failures), the doctor scoped to the profile's theme (D22), and an ASCII summary — the
|
|
873
|
+
* install scripts run in cmd.exe, whose codepage turns an em dash into mojibake.
|
|
874
|
+
*
|
|
875
|
+
* EVERY SIDE EFFECT IS A SEAM in `deps`, because each one reaches outside the checkout: `link`
|
|
876
|
+
* writes the real user PATH (PowerShell, HKCU) or a shell rc file, the login item writes the
|
|
877
|
+
* Startup folder or a LaunchAgent, the console spawns a daemon. A test injects all of them; the
|
|
878
|
+
* defaults are the real ones and only the CLI reaches them.
|
|
879
|
+
*/
|
|
880
|
+
export async function setupProfile(name, deps = {}) {
|
|
881
|
+
const {
|
|
882
|
+
load = loadProfile, tools = null, build = driverMain, exportDrift = exportImprovements,
|
|
883
|
+
changes = profileChanges, link = (report) => cmdLink({ dir: null }, { unattended: true, report }),
|
|
884
|
+
autostart = loginItem, startConsole = defaultConsole, transient = transientRoot(ROOT),
|
|
885
|
+
doctor = (theme) => cmdDoctor({ theme, all: false, bundle: null, noBundle: false }),
|
|
886
|
+
configDir = (host) => HOSTS.find((h) => h.host === host).configDir(),
|
|
887
|
+
platform = process.platform,
|
|
888
|
+
} = deps;
|
|
889
|
+
const loaded = load(name);
|
|
890
|
+
if (!loaded.ok) {
|
|
891
|
+
printErr(`[setup] ${loaded.error}\n`);
|
|
892
|
+
return 1;
|
|
893
|
+
}
|
|
894
|
+
const p = loaded.profile;
|
|
895
|
+
const found = foundHosts(tools ?? hostTools());
|
|
896
|
+
const listed = found.filter((t) => p.hosts.includes(t.host));
|
|
897
|
+
const targets = listed.filter((t) => t.present);
|
|
898
|
+
printOut(`Geneseed setup - profile '${name}'${p.description ? `: ${p.description}` : ''}\n\n`);
|
|
899
|
+
if (!targets.length) {
|
|
900
|
+
// D3: nothing installed, each listed tool's install link, a non-zero exit.
|
|
901
|
+
printOut('None of the AI coding tools this profile installs into was found on this machine:\n');
|
|
902
|
+
for (const t of listed) printOut(` -- ${t.label} - install: ${t.url}\n`);
|
|
903
|
+
printOut('\nInstall one of them, then run this command again. Nothing was installed.\n');
|
|
904
|
+
return 1;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
const results = profileBuilds(p, targets, { build, exportDrift, changes, configDir });
|
|
908
|
+
const built = results.filter((r) => r.rc === 0);
|
|
909
|
+
|
|
910
|
+
printOut('\n');
|
|
911
|
+
// A TEMPORARY COPY (an agent worktree, the npx cache) gets neither the PATH launcher nor the
|
|
912
|
+
// login item: both would point at a folder that is about to disappear (`transientRoot`).
|
|
913
|
+
const report = {};
|
|
914
|
+
let linkRc = 0;
|
|
915
|
+
if (!transient) {
|
|
916
|
+
try {
|
|
917
|
+
linkRc = link(report);
|
|
918
|
+
} catch (e) {
|
|
919
|
+
linkRc = 1;
|
|
920
|
+
printErr(`[setup] link: ${e && e.message}\n`);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
let login = null;
|
|
925
|
+
let consoleUrl = null;
|
|
926
|
+
let consoleOk = true;
|
|
927
|
+
if (p.login !== false) {
|
|
928
|
+
if (transient) {
|
|
929
|
+
login = { ok: false, text: `login item not written: ${ROOT} is a temporary copy - run this from a lasting clone` };
|
|
930
|
+
} else if (platform === 'win32' || platform === 'darwin') {
|
|
931
|
+
try {
|
|
932
|
+
login = autostart();
|
|
933
|
+
} catch (e) {
|
|
934
|
+
login = { ok: false, text: `login item not written: ${e && e.message}` };
|
|
935
|
+
}
|
|
936
|
+
} else {
|
|
937
|
+
// D24: no login item here, and the console still starts now.
|
|
938
|
+
login = { ok: false, text: 'no login item exists for this platform - start the console with: geneseed web start' };
|
|
939
|
+
}
|
|
940
|
+
try {
|
|
941
|
+
const c = await startConsole();
|
|
942
|
+
consoleOk = c.ok;
|
|
943
|
+
consoleUrl = c.url;
|
|
944
|
+
} catch (e) {
|
|
945
|
+
consoleOk = false;
|
|
946
|
+
printErr(`[setup] web console: ${e && e.message}\n`);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// The doctor only over a harness that was written: with every build failed there is nothing
|
|
951
|
+
// for it to check that the failures above have not already said.
|
|
952
|
+
let doctorRc = null;
|
|
953
|
+
if (built.length) {
|
|
954
|
+
printOut('\n');
|
|
955
|
+
try {
|
|
956
|
+
doctorRc = doctor(p.theme);
|
|
957
|
+
} catch (e) {
|
|
958
|
+
doctorRc = 1;
|
|
959
|
+
printErr(`[setup] doctor: ${e && e.message}\n`);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const out = ['', `Summary - profile '${name}'`, ...profileBuildLines(results)];
|
|
964
|
+
for (const t of listed.filter((x) => !x.present)) out.push(` -- ${t.label}: not found - install: ${t.url}`);
|
|
965
|
+
for (const t of found.filter((x) => x.present && !p.hosts.includes(x.host))) {
|
|
966
|
+
out.push(` -- ${t.label}: found, not in this profile - left as it is`);
|
|
967
|
+
}
|
|
968
|
+
if (transient) {
|
|
969
|
+
out.push(` ! geneseed not put on PATH: ${ROOT} is a temporary copy - run this from a lasting clone`);
|
|
970
|
+
} else if (report.foreign) {
|
|
971
|
+
out.push(` ! geneseed on PATH: ${report.foreign} is not a launcher Geneseed wrote, so it was left alone`);
|
|
972
|
+
} else if (linkRc !== 0) {
|
|
973
|
+
out.push(' ! geneseed is not on PATH - run geneseed.cmd (Windows) or ./geneseed from this folder');
|
|
974
|
+
} else if (report.onPath === false) {
|
|
975
|
+
// `link` wrote the launcher and exits 0, but could not put its folder on PATH.
|
|
976
|
+
out.push(` ! geneseed is not on PATH yet: add ${report.pathDir} to your PATH by hand,`,
|
|
977
|
+
' or run geneseed.cmd (Windows) or ./geneseed from this folder');
|
|
978
|
+
} else {
|
|
979
|
+
out.push(' ok geneseed on PATH (open a NEW terminal to use it)');
|
|
980
|
+
}
|
|
981
|
+
if (report.rcFile) out.push(` added the PATH block to ${report.rcFile}`);
|
|
982
|
+
if (login) out.push(` ${login.ok ? 'ok ' : '! '} ${login.text}`);
|
|
983
|
+
if (p.login !== false) {
|
|
984
|
+
out.push(consoleOk && consoleUrl ? ` ok web console: ${consoleUrl}`
|
|
985
|
+
: ' ! web console did not start - run: geneseed web start');
|
|
986
|
+
}
|
|
987
|
+
if (doctorRc !== null) out.push(doctorRc === 0 ? ' ok doctor' : ' FAIL doctor reported problems - see its output above');
|
|
988
|
+
out.push('', 'Next steps:',
|
|
989
|
+
` 1. Open the web console: ${consoleUrl ?? 'geneseed web start'}`,
|
|
990
|
+
' 2. Run: geneseed --help',
|
|
991
|
+
' 3. Read the Understand docs: https://github.com/Arylmera/Geneseed/blob/main/docs/understand/',
|
|
992
|
+
'');
|
|
993
|
+
printOut(`${out.join('\n')}\n`);
|
|
994
|
+
return results.some((r) => r.rc !== 0) || (doctorRc !== null && doctorRc !== 0) ? 1 : 0;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// --------------------------------------------------------------------------------------
|
|
998
|
+
// `geneseed profile apply <name> [--project <dir>] [--hosts a,b]`
|
|
999
|
+
// --------------------------------------------------------------------------------------
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* `geneseed profile apply` — build one profile, globally or into one project folder (spec D32,
|
|
1003
|
+
* D33, D37, D41).
|
|
1004
|
+
*
|
|
1005
|
+
* THE SCOPE IS CHOSEN HERE, NOT IN THE PROFILE. Global builds `<host>-global` for each host;
|
|
1006
|
+
* `--project <dir>` builds `--emit <host> --out <dir> --root <dir>`, and only there does the
|
|
1007
|
+
* profile's `sharedTier` count (D37). The hosts are the profile's, narrowed by `--hosts` (which
|
|
1008
|
+
* may name only the profile's own, D41), and of those the ones this machine has: a missing one is
|
|
1009
|
+
* a summary line, as in `setup --profile`. Every other install is left as it is.
|
|
1010
|
+
*
|
|
1011
|
+
* NOT THE ONBOARDING (D33): no `link`, no login item, no console, no doctor — `setup --profile`
|
|
1012
|
+
* does those. The build loop and its summary lines are `setupProfile`'s own (`profileBuilds`,
|
|
1013
|
+
* `profileBuildLines`), so a failure on one host never stops the others (D16) and the settings a
|
|
1014
|
+
* build changes back are listed (D14).
|
|
1015
|
+
*
|
|
1016
|
+
* In project scope, a host whose GLOBAL install is active gets one more line (D39): both root
|
|
1017
|
+
* files load in the folder, and the global gates that still run there (`globalLayering`).
|
|
1018
|
+
*
|
|
1019
|
+
* `src` is the profile sources' seam; `deps` the side effects', as in `setupProfile`.
|
|
1020
|
+
* @param {any} args
|
|
1021
|
+
* @param {{ src?: { shippedDir?: string, personalDir?: string } }} [opts]
|
|
1022
|
+
* @param {any} [deps]
|
|
1023
|
+
*/
|
|
1024
|
+
export function cmdProfileApply(args, { src = {} } = {}, deps = {}) {
|
|
1025
|
+
const {
|
|
1026
|
+
load = (n) => loadProfile(n, src), tools = null, build = driverMain, exportDrift = exportImprovements,
|
|
1027
|
+
changes = profileChanges, configDir = (host) => HOSTS.find((h) => h.host === host).configDir(),
|
|
1028
|
+
layering = (host) => globalLayering(host, { configDir }),
|
|
1029
|
+
} = deps;
|
|
1030
|
+
const loaded = load(args.name);
|
|
1031
|
+
if (!loaded.ok) {
|
|
1032
|
+
printErr(`[profile] ${loaded.error}\n`);
|
|
1033
|
+
return 1;
|
|
1034
|
+
}
|
|
1035
|
+
const p = loaded.profile;
|
|
1036
|
+
let picked = p.hosts;
|
|
1037
|
+
if (args.hosts) {
|
|
1038
|
+
picked = [...new Set(String(args.hosts).split(',').map((h) => h.trim()).filter(Boolean))];
|
|
1039
|
+
// Two different mistakes, named apart: a word that is no host at all, and a real host this
|
|
1040
|
+
// profile does not list (D41: apply builds only the profile's own hosts).
|
|
1041
|
+
const known = profileHosts();
|
|
1042
|
+
const quote = (xs) => xs.map((h) => `'${h}'`).join(', ');
|
|
1043
|
+
const unknown = picked.filter((h) => !known.includes(h));
|
|
1044
|
+
const outside = picked.filter((h) => known.includes(h) && !p.hosts.includes(h));
|
|
1045
|
+
if (!picked.length || unknown.length || outside.length) {
|
|
1046
|
+
const why = !picked.length ? ['none given'] : [
|
|
1047
|
+
...(unknown.length ? [`not a host: ${quote(unknown)} (hosts: ${known.join(', ')})`] : []),
|
|
1048
|
+
...(outside.length ? [`not in this profile: ${quote(outside)}`] : []),
|
|
1049
|
+
];
|
|
1050
|
+
printErr(`geneseed: error: --hosts: ${why.join('; ')} (profile '${args.name}' lists: ${p.hosts.join(', ')})\n`);
|
|
1051
|
+
return 2;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
const found = foundHosts(tools ?? hostTools());
|
|
1055
|
+
const listed = found.filter((t) => picked.includes(t.host));
|
|
1056
|
+
const targets = listed.filter((t) => t.present);
|
|
1057
|
+
let project = null;
|
|
1058
|
+
if (args.project) {
|
|
1059
|
+
// The hosts about to be built: a folder whose `.claude` (…) IS that host's global install is
|
|
1060
|
+
// refused for that host (`markerCollision`), so a project build never lands on the global.
|
|
1061
|
+
const r = checkProjectFolder(args.project, targets.map((t) => t.host));
|
|
1062
|
+
if (r.error) {
|
|
1063
|
+
printErr(`[profile] --project: ${r.error}\n`);
|
|
1064
|
+
return 1;
|
|
1065
|
+
}
|
|
1066
|
+
project = r.root;
|
|
1067
|
+
}
|
|
1068
|
+
const scope = project ? `project ${project}` : 'global';
|
|
1069
|
+
printOut(`Geneseed profile apply - '${args.name}' (${loaded.source ?? 'shipped'}) - ${scope}\n\n`);
|
|
1070
|
+
if (!targets.length) {
|
|
1071
|
+
printOut('None of the AI coding tools this apply builds was found on this machine:\n');
|
|
1072
|
+
for (const t of listed) printOut(` -- ${t.label} - install: ${t.url}\n`);
|
|
1073
|
+
printOut('\nInstall one of them, then run this command again. Nothing was built.\n');
|
|
1074
|
+
return 1;
|
|
1075
|
+
}
|
|
1076
|
+
const results = profileBuilds(p, targets, { project, build, exportDrift, changes, configDir });
|
|
1077
|
+
const out = ['', `Summary - profile '${args.name}', ${scope}`, ...profileBuildLines(results)];
|
|
1078
|
+
for (const t of listed.filter((x) => !x.present)) out.push(` -- ${t.label}: not found - install: ${t.url}`);
|
|
1079
|
+
for (const t of found.filter((x) => x.present && !picked.includes(x.host))) {
|
|
1080
|
+
out.push(` -- ${t.label}: ${p.hosts.includes(t.host) ? 'not picked' : 'not in this profile'} - left as it is`);
|
|
1081
|
+
}
|
|
1082
|
+
if (project) {
|
|
1083
|
+
for (const r of results.filter((x) => x.rc === 0)) {
|
|
1084
|
+
const text = layeringText(r.label, layering(r.host), project);
|
|
1085
|
+
if (text) out.push(` note ${text}`);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
out.push('');
|
|
1089
|
+
printOut(`${out.join('\n')}\n`);
|
|
1090
|
+
return results.some((r) => r.rc !== 0) ? 1 : 0;
|
|
1091
|
+
}
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
loadJsonObject, mergeClaudeSettings, opencodeTarget, OPENCODE_SENTINEL, opencodeSentinelWrite,
|
|
69
69
|
OWNED_VERDICT,
|
|
70
70
|
settingsIntegrityCheck, wireClaudeExcludes, unwireClaudeExcludes,
|
|
71
|
-
unwireClaudeSettings, wireClaudeEnv, unwireClaudeEnv,
|
|
71
|
+
unwireClaudeSettings, wireClaudeEnv, unwireClaudeEnv, wireClaudeListing, unwireClaudeListing,
|
|
72
72
|
} from '../hosts/settings.mjs';
|
|
73
73
|
import { printOut, printErr, readText, writeText, isFile, isDir, isOsError } from '../lib/fs.mjs';
|
|
74
74
|
import { indexOfDeepEqual, isDict, jsonDumps, deepEquals } from '../lib/json.mjs';
|
|
@@ -349,6 +349,7 @@ export function claudeUninstall(cfg, archiveMemory, force = false) {
|
|
|
349
349
|
const unwired = unwireClaudeSettings(sf, hooks, cfg);
|
|
350
350
|
unwireClaudeExcludes(sf, managed.settings_excludes || []);
|
|
351
351
|
unwireClaudeEnv(sf, managed.settings_env);
|
|
352
|
+
unwireClaudeListing(sf, managed.settings_listing);
|
|
352
353
|
// The unwire is VERIFIED, not assumed: a commented settings file is never rewritten, so a
|
|
353
354
|
// supposedly-uninstalled repo could keep firing Geneseed's hooks. Loud, never fatal.
|
|
354
355
|
settingsIntegrityCheck(sf, managed, 'absent');
|
|
@@ -1304,6 +1305,7 @@ function claudeDeactivate(root, scope = 'global', host = 'claude') {
|
|
|
1304
1305
|
unwireClaudeSettings(settingsFile(cfg, managed), managed.settings_hooks || [], cfg);
|
|
1305
1306
|
unwireClaudeExcludes(settingsFile(cfg, managed), managed.settings_excludes || []);
|
|
1306
1307
|
unwireClaudeEnv(settingsFile(cfg, managed), managed.settings_env);
|
|
1308
|
+
unwireClaudeListing(settingsFile(cfg, managed), managed.settings_listing);
|
|
1307
1309
|
// The same integrity check the uninstall path runs: a deactivate that silently failed to
|
|
1308
1310
|
// unwire would leave hooks firing in a repo the user believes is off.
|
|
1309
1311
|
settingsIntegrityCheck(settingsFile(cfg, managed), managed, 'absent');
|
|
@@ -1362,6 +1364,7 @@ function claudeReactivate(root, scope = 'global', host = 'claude') {
|
|
|
1362
1364
|
wireClaudeExcludes(settingsFile(cfg, managed), managed.settings_excludes || []);
|
|
1363
1365
|
// Only what the manifest records: a reactivate restores this install's own keys, never new ones.
|
|
1364
1366
|
if (isDict(managed.settings_env)) wireClaudeEnv(settingsFile(cfg, managed), managed.settings_env);
|
|
1367
|
+
if (isDict(managed.settings_listing)) wireClaudeListing(settingsFile(cfg, managed), managed.settings_listing);
|
|
1365
1368
|
cleanHostStash(cfg, host);
|
|
1366
1369
|
return { ok: true, kind: host, moved };
|
|
1367
1370
|
}
|
package/js/maintain/update.mjs
CHANGED
|
@@ -749,7 +749,9 @@ async function drainStdout() {
|
|
|
749
749
|
|
|
750
750
|
/**
|
|
751
751
|
* The flags that re-emit the install at `dir` on its OWN axes — footprint, posture, mode,
|
|
752
|
-
* trust, doctrine packs, excluded rules — or `[]`
|
|
752
|
+
* trust, doctrine packs, excluded rules, excluded skills, gates, kits, shared tier — or `[]`
|
|
753
|
+
* when no build ever wrote a marker there. Every axis the preserve guard compares
|
|
754
|
+
* (js/build/profile.mjs) has to be here, or `upgrade` is refused on the one it left out.
|
|
753
755
|
*
|
|
754
756
|
* WITHOUT THEM THE REBUILD RESETS THE INSTALL. The generator's defaults are not the install's:
|
|
755
757
|
* a missing `--footprint` is `lean`, and posture, mode, packs and excluded rules come from
|
|
@@ -770,7 +772,7 @@ export async function installAxes(dir, { installProfile, setupBuildArgs }, notif
|
|
|
770
772
|
if (!existsSync(path.join(String(dir), '.geneseed-emit'))) return [];
|
|
771
773
|
const p = installProfile('opencode', 'global', String(dir), notify);
|
|
772
774
|
return setupBuildArgs('', 'files', null, null, p.footprint, p.posture, p.mode, p.doctrines,
|
|
773
|
-
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits).slice(4);
|
|
775
|
+
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier, p.contextWindow).slice(4);
|
|
774
776
|
}
|
|
775
777
|
|
|
776
778
|
/**
|