geneseed 5.5.1 → 6.0.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 +27 -0
- package/README.md +2 -2
- package/SHIPPED.md +2 -2
- package/adapters/opencode/README.md +7 -4
- package/docs/concepts/agents.md +8 -0
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +1 -1
- package/docs/concepts/foreman-mode.md +5 -3
- package/docs/concepts/hooks.md +1 -1
- package/docs/concepts/kits.md +20 -2
- package/docs/concepts/loops.md +5 -0
- package/docs/concepts/skills.md +1 -1
- package/docs/concepts/superpowers-kit.md +79 -0
- package/docs/extending.md +11 -4
- package/docs/guides/install-scripted.md +1 -1
- package/docs/reference/cli.md +2 -0
- package/docs/reference/profiles.md +10 -5
- package/harness.config.json +1 -1
- package/js/README.md +2 -0
- package/js/build/args.mjs +4 -2
- package/js/build/driver.mjs +8 -8
- package/js/build/emit-claude.mjs +5 -3
- package/js/build/emit-opencode.mjs +2 -2
- package/js/build/generate.mjs +1 -1
- package/js/build/profile.mjs +15 -7
- package/js/build/render.mjs +81 -10
- package/js/build/source.mjs +75 -1
- package/js/cli-table.json +17 -2
- package/js/hosts/hooks.mjs +16 -5
- package/js/hosts/installs.mjs +50 -4
- package/js/hosts/native.mjs +104 -3
- package/js/hosts/opencode.mjs +13 -15
- package/js/inspect/checks-authoring.mjs +24 -1
- package/js/inspect/checks-build.mjs +43 -2
- package/js/inspect/checks-counts.mjs +72 -1
- package/js/inspect/diff.mjs +17 -3
- package/js/inspect/doctor.mjs +23 -2
- package/js/inspect/status.mjs +5 -1
- package/js/inspect/validate.mjs +1 -1
- package/js/loop/catalog.mjs +10 -0
- package/js/maintain/kit-migration.mjs +109 -0
- package/js/maintain/plugin-detect.mjs +150 -0
- package/js/maintain/profiles.mjs +46 -5
- package/js/maintain/setup.mjs +45 -11
- package/js/maintain/update.mjs +1 -1
- package/js/web/actions.mjs +28 -7
- package/js/web/api.mjs +3 -1
- package/js/web/profiles-api.mjs +11 -7
- package/package.json +1 -1
- package/profiles/autonomous.json +1 -0
- package/profiles/corporate.json +1 -1
- package/profiles/mentor.json +1 -0
- package/profiles/minimal.json +2 -1
- package/profiles/starter.json +1 -1
- package/src/AGENT.md.tmpl +1 -6
- package/src/agents/_template.md +4 -0
- package/src/agents/advocate.md +1 -0
- package/src/agents/architect.md +1 -0
- package/src/agents/developer.md +12 -4
- package/src/agents/empiricist.md +1 -0
- package/src/agents/explorer.md +1 -0
- package/src/agents/framer.md +1 -0
- package/src/agents/historian.md +1 -0
- package/src/agents/operator.md +1 -0
- package/src/agents/performance.md +2 -1
- package/src/agents/pragmatist.md +1 -0
- package/src/agents/react-reviewer.md +1 -0
- package/src/agents/researcher.md +1 -0
- package/src/agents/reviewer.md +1 -0
- package/src/agents/security.md +1 -0
- package/src/agents/skeptic.md +1 -0
- package/src/agents/spring-reviewer.md +1 -0
- package/src/agents/spring-security.md +1 -0
- package/src/agents/steward.md +1 -0
- package/src/agents/user-advocate.md +1 -0
- package/src/agents/visionary.md +1 -0
- package/src/bricks/ci-fix.md +12 -2
- package/src/kits/superpowers/missing.md +3 -0
- package/src/kits/superpowers/provider.md +7 -0
- package/src/kits/superpowers/rules.md +6 -0
- package/src/kits/superpowers.json +45 -0
- package/src/modes/foreman.md +18 -12
- package/src/skills/commit.md +4 -0
- package/src/skills/parallel-agents.md +2 -2
- package/src/skills/spring-boot/cloud.md +8 -2
- package/src/skills/spring-boot.md +3 -1
- package/src/skills/spring-testing.md +3 -3
- package/src/upstreams.json +1 -1
package/js/inspect/status.mjs
CHANGED
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
installsReferencingShim, openclaudeDualHarnessRoots, themeOfDir, readJsonMaybe, readMaybe,
|
|
53
53
|
} from '../hosts/installs.mjs';
|
|
54
54
|
import { installProfile, rebuildCommand } from '../build/generate.mjs';
|
|
55
|
+
import { providerWarning } from '../maintain/kit-migration.mjs';
|
|
55
56
|
import { isDoctorNote } from './scan.mjs';
|
|
56
57
|
import { pendingDrafts } from '../hosts/hooks-context.mjs';
|
|
57
58
|
import { factCount } from '../hosts/memory-files.mjs';
|
|
@@ -379,7 +380,8 @@ export function statusData() {
|
|
|
379
380
|
// Only when something is kept, so `--json` without kits stays the bytes it was.
|
|
380
381
|
const kept = keptKitFiles(host, scope, root, p.kits);
|
|
381
382
|
const rebuild = rebuildCommand(p.argv);
|
|
382
|
-
|
|
383
|
+
const warn = providerWarning({ host, scope, root, kits: p.kits });
|
|
384
|
+
return { ...p, ...(kept ? { keptKitFiles: kept } : {}), ...(warn ? { providerWarning: warn } : {}), rebuild };
|
|
383
385
|
} catch (e) {
|
|
384
386
|
return { host, scope, root, state: 'unreadable', error: String(e?.message ?? e) };
|
|
385
387
|
}
|
|
@@ -510,10 +512,12 @@ export function statusLines(d, color = false, boxed = true) {
|
|
|
510
512
|
...(p.sharedTier ? ['shared tier: on'] : []),
|
|
511
513
|
// Elided at the default, like the shared tier, so a default row prints what it did.
|
|
512
514
|
...(p.contextWindow && p.contextWindow !== DEFAULT_CONTEXT_WINDOW ? [`context window: ${p.contextWindow}`] : []),
|
|
515
|
+
...(p.tiers && p.tiers !== 'off' ? [`model tiers: ${p.tiers}`] : []),
|
|
513
516
|
// Each elided when armed. The law's text still binds; only its tool-boundary gate is off.
|
|
514
517
|
...GATE_SWITCHES.filter((g) => p[g.key] === false)
|
|
515
518
|
.map((g) => `${g.marker.toLowerCase()}: off${g.law ? ` (Law ${g.law} text still binds)` : ''}`)]
|
|
516
519
|
.join(` ${DOT} `) + where]);
|
|
520
|
+
if (p.providerWarning) rows.push([`${p.host}:${p.scope}`, `${p.providerWarning}${where}`]);
|
|
517
521
|
// R6: a member its owner edited outlives its kit; name it, so turning the kit off is visible.
|
|
518
522
|
for (const [kit, rels] of Object.entries(p.keptKitFiles ?? {})) {
|
|
519
523
|
rows.push([`${p.host}:${p.scope}`, `kept from inactive kit ${kit}: ${rels.join(', ')}${where}`]);
|
package/js/inspect/validate.mjs
CHANGED
|
@@ -155,7 +155,7 @@ export function cmdValidate(args) {
|
|
|
155
155
|
theme: args.theme, footprint: args.footprint, posture: args.posture, mode: args.mode,
|
|
156
156
|
trust: args.trust, doctrines: args.doctrines, excludeRules: args.excludeRules,
|
|
157
157
|
excludeSkills: args.excludeSkills, kits: args.kits, sharedTier: args.sharedTier === 'on',
|
|
158
|
-
contextWindow: args.contextWindow,
|
|
158
|
+
contextWindow: args.contextWindow, tiers: args.tiers,
|
|
159
159
|
...Object.fromEntries(GATE_SWITCHES.map((g) => [g.key, args[g.arg] ? false : null])),
|
|
160
160
|
};
|
|
161
161
|
let scanDirs;
|
package/js/loop/catalog.mjs
CHANGED
|
@@ -72,6 +72,16 @@ const listFiles = (dir, ext) => (isDir(dir)
|
|
|
72
72
|
? readdirSync(dir).filter((n) => n.endsWith(ext) && !n.startsWith('_') && n !== 'README.md').sort()
|
|
73
73
|
: []);
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* A brick is available when the agent or skill it names ships. THE SKILL CHECK READS `src/`, NOT AN
|
|
77
|
+
* INSTALL, and that is a decision, not an oversight: this catalogue serves `geneseed loop next`,
|
|
78
|
+
* which hands the model a brick's prompt and has no install to read (see the module header). A
|
|
79
|
+
* skill of a kit that is off (`debug`, for `ci-fix`) is therefore still "shipped" here. What keeps
|
|
80
|
+
* that honest is the brick, not this check: `ci-fix` carries its CI-specific steps in its own body
|
|
81
|
+
* and tells the model to load the plugin's `systematic-debugging` when there is no `debug` skill,
|
|
82
|
+
* so it works with the superpowers kit on, off, or on a host with no plugin. A brick that needed a
|
|
83
|
+
* kit skill's body would have to say so the same way.
|
|
84
|
+
*/
|
|
75
85
|
function availability(brick, srcRoot) {
|
|
76
86
|
if (brick.agent && !isFile(path.join(srcRoot, 'agents', `${brick.agent}.md`))) {
|
|
77
87
|
return { available: false, reason: `agent ${brick.agent} is not shipped` };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one-time move of an install built before the `superpowers` kit existed.
|
|
3
|
+
*
|
|
4
|
+
* Before the kit, the five vendored superpowers Rites shipped in every install. An install's
|
|
5
|
+
* `Active kits:` line has never named the kit, so its next rebuild would drop all five. This reads
|
|
6
|
+
* the release the install was BUILT by (the `[release X.Y.Z]` in `.geneseed-version`, which every
|
|
7
|
+
* emit writes) and, for one built before `SUPERPOWERS_KIT_SINCE`, turns the kit on, unless the
|
|
8
|
+
* official plugin is seen (then the plugin already provides them, and two providers duplicate
|
|
9
|
+
* each other). One notice line per install says which, and why.
|
|
10
|
+
*
|
|
11
|
+
* `aware` (`kitAwareOfDir`): true: the carrier already shows a build that knows the kit, so the release
|
|
12
|
+
* number is not asked. That covers builds made after the kit but before the release that names it.
|
|
13
|
+
*
|
|
14
|
+
* A marker that is missing or reads as no release (a bundle, a hand-copied tree) is treated as
|
|
15
|
+
* built before: every such install did carry the five Rites. An install built at or after the
|
|
16
|
+
* release keeps what its `Active kits:` line says, so a kit turned off on purpose stays off.
|
|
17
|
+
*
|
|
18
|
+
* Runs inside `installProfile` (`js/build/profile.mjs`), the one read-back `rebuild-all`, `update`
|
|
19
|
+
* and `migrate` share, so `status` shows what a rebuild would do.
|
|
20
|
+
*/
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import { readText } from '../lib/fs.mjs';
|
|
23
|
+
import { versionIsNewer } from '../build/version.mjs';
|
|
24
|
+
import { HOSTS, VERSION_MARKER, isGlobalInstall } from '../hosts/hosts.mjs';
|
|
25
|
+
import { kitAwareOfDir, kitsOfDir } from '../hosts/installs.mjs';
|
|
26
|
+
import { loadKits } from '../build/source.mjs';
|
|
27
|
+
import { describeDetection, detectSuperpowers } from './plugin-detect.mjs';
|
|
28
|
+
|
|
29
|
+
/** The first release where the five Rites are a kit. A build older than this carried them as core. */
|
|
30
|
+
export const SUPERPOWERS_KIT_SINCE = '6.0.0';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The release an install was built by, or null (no marker, or one with no `[release …]`). The marker
|
|
34
|
+
* sits in `root` for a global install and an OpenCode project bundle, and in the host's layer folder
|
|
35
|
+
* (`<root>/.claude` and kin) for the Claude dialects' project installs.
|
|
36
|
+
*/
|
|
37
|
+
export function builtByRelease(root, host = null, scope = 'global') {
|
|
38
|
+
const marker = scope === 'global' ? null : HOSTS.find((h) => h.host === host)?.projectMarker;
|
|
39
|
+
// OpenCode's project bundle keeps the marker at the root; the Claude dialects keep it in their layer folder.
|
|
40
|
+
for (const dir of marker ? [root, path.join(root, marker)] : [root]) {
|
|
41
|
+
try {
|
|
42
|
+
const m = /\[release ([^\]]+)\]/.exec(readText(path.join(dir, VERSION_MARKER)));
|
|
43
|
+
if (m) return m[1];
|
|
44
|
+
} catch { /* not here */ }
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `kits`, plus `superpowers` when this install predates the kit and the plugin is not seen.
|
|
51
|
+
* @param {{ host: string, scope: string, root: string, kits: string[], notify?: ((line: string) => void) | null,
|
|
52
|
+
* aware?: boolean | null, knownKits?: string[], detectRoots?: Parameters<typeof detectSuperpowers>[1] }} a
|
|
53
|
+
*/
|
|
54
|
+
export function migrateSuperpowersKit({ host, scope, root, kits, notify = null, knownKits = [], detectRoots = {}, aware = false }) {
|
|
55
|
+
if (kits.includes('superpowers') || !knownKits.includes('superpowers') || aware !== false) return kits;
|
|
56
|
+
const built = builtByRelease(root, host, scope);
|
|
57
|
+
// `versionIsNewer(a, b)` is a > b; null (unparseable) reads as old, never as current.
|
|
58
|
+
const old = built === null || versionIsNewer(SUPERPOWERS_KIT_SINCE, built) === true;
|
|
59
|
+
if (!old) return kits;
|
|
60
|
+
const d = detectSuperpowers(host, { projectDir: scope === 'project' ? root : null, ...detectRoots });
|
|
61
|
+
const was = built === null ? 'an install with no release marker' : `built by ${built}`;
|
|
62
|
+
if (d.seen) {
|
|
63
|
+
notify?.(`superpowers kit: off — ${was}, before the kit existed; the official plugin is ${describeDetection(d)}`);
|
|
64
|
+
return kits;
|
|
65
|
+
}
|
|
66
|
+
notify?.(`superpowers kit: on — ${was}, before the kit existed, so it keeps its five Rites; the official plugin is ${describeDetection(d)}`);
|
|
67
|
+
return [...kits, 'superpowers'].sort();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The WARN `doctor` and `status` give one install about its workflow provider, or null when it
|
|
72
|
+
* has exactly one. Two states are wrong, and a plugin is only ever read from a file, so each
|
|
73
|
+
* line names what was read (see `plugin-detect.mjs`):
|
|
74
|
+
* - the kit is on and the plugin is seen: two providers, duplicate Rites, about 800 tokens
|
|
75
|
+
* injected per session (start, clear and compact);
|
|
76
|
+
* - the kit is off and the plugin is not seen: no provider at all.
|
|
77
|
+
* @param {{ host: string, scope: string, root: string, kits: string[], detectRoots?: Parameters<typeof detectSuperpowers>[1] }} a
|
|
78
|
+
*/
|
|
79
|
+
export function providerWarning({ host, scope, root, kits, detectRoots = {} }) {
|
|
80
|
+
const d = detectSuperpowers(host, { projectDir: scope === 'project' ? root : null, ...detectRoots });
|
|
81
|
+
const on = kits.includes('superpowers');
|
|
82
|
+
if (on && d.seen) {
|
|
83
|
+
return 'WARN: the superpowers kit is on and the official plugin is also loaded (' + describeDetection(d)
|
|
84
|
+
+ '): the Rites are duplicated and the plugin injects about 800 tokens a session — turn off one of the two';
|
|
85
|
+
}
|
|
86
|
+
if (!on && !d.seen) {
|
|
87
|
+
return d.supported
|
|
88
|
+
? `WARN: no workflow provider — the superpowers kit is off and the official plugin is ${describeDetection(d)}`
|
|
89
|
+
: `WARN: no workflow provider — the superpowers kit is off and ${host} has no superpowers plugin`;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* `kitsOfDir` plus the migration of an install built before the kit: the set a rebuild of `dir`
|
|
96
|
+
* would build with. `installProfile` is the read-back `rebuild-all`, `update`, `migrate` and
|
|
97
|
+
* `status` share; the readers that render or rebuild one install without it (`diff`, the console's
|
|
98
|
+
* restore and build forms) call this instead, so a pre-kit install reads the same set everywhere,
|
|
99
|
+
* or its five Rites would read as drift in one place and be rebuilt away in another.
|
|
100
|
+
* The scope is read off the folder: a host's global config dir is global, anything else a project.
|
|
101
|
+
*/
|
|
102
|
+
export function migratedKitsOfDir(dir, host = null, notify = null) {
|
|
103
|
+
let scope = 'project';
|
|
104
|
+
try { if (isGlobalInstall(host, dir)) scope = 'global'; } catch { /* cannot tell: a project */ }
|
|
105
|
+
return migrateSuperpowersKit({
|
|
106
|
+
host: host ?? '', scope, root: dir, kits: kitsOfDir(dir, host, notify), notify,
|
|
107
|
+
knownKits: [...loadKits().keys()], aware: kitAwareOfDir(dir, host),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is the official superpowers plugin installed on this machine? Read-only and best-effort.
|
|
3
|
+
*
|
|
4
|
+
* FILES ONLY, NEVER A PROCESS. `geneseed` may not start a process (a transitive `child_process` ban), and
|
|
5
|
+
* the plugin managers each hold their state in a file, so the answer is a file read. The answer
|
|
6
|
+
* is therefore one of two sentences, "seen in <file>" or "not seen in <files read>", and never
|
|
7
|
+
* "not enabled": a settings file can say `false` while the desktop app loads the plugin (the
|
|
8
|
+
* app keeps its own state under `rpm/`, undocumented, which is why that file is read last and
|
|
9
|
+
* labelled as app state).
|
|
10
|
+
*
|
|
11
|
+
* NOT ON THE HOOK PATH. `bin/geneseed-hook.mjs` never imports this: a detection costs file
|
|
12
|
+
* reads, and the hook's stdout is a signal channel (AGENTS.md, "What bites").
|
|
13
|
+
*
|
|
14
|
+
* EVERY ROOT IS A PARAMETER. A test passes fixture roots and never the machine's own; only the
|
|
15
|
+
* default arguments (`defaultRoots`) read `$HOME`, the environment and the platform.
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
18
|
+
import os from 'node:os';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import { readText } from '../lib/fs.mjs';
|
|
21
|
+
import { readJsonc } from '../lib/json.mjs';
|
|
22
|
+
|
|
23
|
+
/** The plugin's repository, as the desktop app's manifest records it (`upstreamRepoUrl`). */
|
|
24
|
+
export const SUPERPOWERS_REPO_URL = 'https://github.com/obra/superpowers';
|
|
25
|
+
|
|
26
|
+
/** Hosts whose plugin store this module can read; any other host has no plugin to look for. */
|
|
27
|
+
export const DETECTABLE_HOSTS = ['claude', 'opencode'];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The roots a real machine reads from. Called only when the caller names none.
|
|
31
|
+
* @param {{ env?: NodeJS.ProcessEnv, home?: string, platform?: string }} [from]
|
|
32
|
+
*/
|
|
33
|
+
export function defaultRoots({ env = process.env, home = os.homedir(), platform = process.platform } = {}) {
|
|
34
|
+
const appData = platform === 'win32' ? env.APPDATA ?? path.join(home, 'AppData', 'Roaming')
|
|
35
|
+
: platform === 'darwin' ? path.join(home, 'Library', 'Application Support')
|
|
36
|
+
: env.XDG_CONFIG_HOME ?? path.join(home, '.config');
|
|
37
|
+
return {
|
|
38
|
+
claudeDir: env.CLAUDE_CONFIG_DIR || path.join(home, '.claude'),
|
|
39
|
+
opencodeDir: env.OPENCODE_CONFIG_DIR || path.join(env.XDG_CONFIG_HOME || path.join(home, '.config'), 'opencode'),
|
|
40
|
+
appDataDir: appData,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A settings file as an object: null when it is absent or unparseable (a miss, never an error). */
|
|
45
|
+
function readObject(file) {
|
|
46
|
+
try {
|
|
47
|
+
const [data] = readJsonc(readText(file));
|
|
48
|
+
return data !== null && typeof data === 'object' && !Array.isArray(data) ? data : null;
|
|
49
|
+
} catch { return null; }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const isSuperpowersKey = (k) => /^superpowers(@|$)/.test(String(k));
|
|
53
|
+
|
|
54
|
+
/** Claude Code: `enabledPlugins` holds a `superpowers@<marketplace>` key set to true. */
|
|
55
|
+
function claudeSettingsSee(data) {
|
|
56
|
+
const plugins = data?.enabledPlugins;
|
|
57
|
+
return plugins !== null && typeof plugins === 'object'
|
|
58
|
+
&& Object.entries(plugins).some(([k, v]) => isSuperpowersKey(k) && v === true);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The desktop manifest: a `plugins` entry (or the file itself) whose `upstreamRepoUrl` is the plugin's repository. */
|
|
62
|
+
function manifestSees(d) {
|
|
63
|
+
const same = (u) => typeof u === 'string' && u.replace(/(\.git)?\/*$/, '').toLowerCase() === SUPERPOWERS_REPO_URL;
|
|
64
|
+
return same(d?.upstreamRepoUrl) || (Array.isArray(d?.plugins) && d.plugins.some((e) => same(e?.upstreamRepoUrl)));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** OpenCode: `plugin` (V1) or `plugins` (V2) lists, or holds, a `superpowers@…` entry. */
|
|
68
|
+
function opencodeConfigSees(data) {
|
|
69
|
+
for (const key of ['plugin', 'plugins']) {
|
|
70
|
+
const v = data?.[key];
|
|
71
|
+
const names = Array.isArray(v) ? v.map((e) => (Array.isArray(e) ? e[0] : e)) : v && typeof v === 'object' ? Object.keys(v) : [];
|
|
72
|
+
if (names.some((n) => typeof n === 'string' && isSuperpowersKey(n))) return true;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The desktop app's plugin manifests: two folders below `<appData>/Claude/rpm`, each a `manifest.json`. */
|
|
78
|
+
function desktopManifests(appDataDir) {
|
|
79
|
+
const root = path.join(appDataDir, 'Claude', 'rpm');
|
|
80
|
+
const out = [];
|
|
81
|
+
try {
|
|
82
|
+
for (const a of readdirSync(root, { withFileTypes: true })) {
|
|
83
|
+
if (!a.isDirectory()) continue;
|
|
84
|
+
for (const b of readdirSync(path.join(root, a.name), { withFileTypes: true })) {
|
|
85
|
+
const f = path.join(root, a.name, b.name, 'manifest.json');
|
|
86
|
+
if (b.isDirectory() && existsSync(f)) out.push(f);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch { /* no rpm folder: no desktop app state to read */ }
|
|
90
|
+
return out.sort();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Look for the superpowers plugin for `host`. `{ seen, where, read, state }`: `where` the first
|
|
95
|
+
* file that showed it (null when none did), `read` every file looked at, `state` true when the
|
|
96
|
+
* evidence is the desktop app's own state rather than a settings file. A host with no plugin
|
|
97
|
+
* store to read (Bob, OpenClaude, the bundle) answers `{ seen: false, read: [], supported: false }`.
|
|
98
|
+
* @param {string} host
|
|
99
|
+
* @param {{ claudeDir?: string, opencodeDir?: string, appDataDir?: string, projectDir?: string | null }} [roots]
|
|
100
|
+
*/
|
|
101
|
+
export function detectSuperpowers(host, roots = {}) {
|
|
102
|
+
if (!DETECTABLE_HOSTS.includes(host)) return { seen: false, where: null, read: [], state: false, supported: false };
|
|
103
|
+
const r = { ...defaultRoots(), ...roots };
|
|
104
|
+
const read = [];
|
|
105
|
+
const look = (files, sees) => {
|
|
106
|
+
for (const f of files) {
|
|
107
|
+
if (!existsSync(f)) continue;
|
|
108
|
+
read.push(f);
|
|
109
|
+
if (sees(readObject(f))) return f;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
113
|
+
let where = null;
|
|
114
|
+
let state = false;
|
|
115
|
+
if (host === 'claude') {
|
|
116
|
+
where = look([
|
|
117
|
+
path.join(r.claudeDir, 'settings.json'), path.join(r.claudeDir, 'settings.local.json'),
|
|
118
|
+
...(r.projectDir ? [path.join(r.projectDir, '.claude', 'settings.json'), path.join(r.projectDir, '.claude', 'settings.local.json')] : []),
|
|
119
|
+
], claudeSettingsSee);
|
|
120
|
+
if (!where) {
|
|
121
|
+
where = look(desktopManifests(r.appDataDir), manifestSees);
|
|
122
|
+
state = where !== null;
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
where = look([
|
|
126
|
+
path.join(r.opencodeDir, 'opencode.json'), path.join(r.opencodeDir, 'opencode.jsonc'),
|
|
127
|
+
...(r.projectDir ? [path.join(r.projectDir, 'opencode.json'), path.join(r.projectDir, 'opencode.jsonc')] : []),
|
|
128
|
+
], opencodeConfigSees);
|
|
129
|
+
}
|
|
130
|
+
return { seen: where !== null, where, read, state, supported: true };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The one-line account of a detection, naming the file: never "not enabled". */
|
|
134
|
+
export function describeDetection(d) {
|
|
135
|
+
if (!d.supported) return 'no plugin store to read on this host';
|
|
136
|
+
if (d.seen) return `seen in ${d.where}${d.state ? ' (desktop app state, best-effort)' : ''}`;
|
|
137
|
+
return `not seen in ${d.read.length ? d.read.join(', ') : 'any settings file (none found)'}`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A kit named in a profile's `kitsByDetection`, resolved: on when the plugin is NOT seen (the kit
|
|
142
|
+
* stands in for it), off when it is. A host with no plugin store (Bob, OpenClaude) has nothing to
|
|
143
|
+
* stand in for it, so the kit is on there. The wizard's default and the profile apply share this.
|
|
144
|
+
* @param {string} host
|
|
145
|
+
* @param {Parameters<typeof detectSuperpowers>[1]} [roots]
|
|
146
|
+
*/
|
|
147
|
+
export function superpowersKitDefault(host, roots = {}) {
|
|
148
|
+
const d = detectSuperpowers(host, roots);
|
|
149
|
+
return { on: !d.seen, detection: d, line: describeDetection(d) };
|
|
150
|
+
}
|
package/js/maintain/profiles.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
|
|
|
27
27
|
import path from 'node:path';
|
|
28
28
|
|
|
29
29
|
import {
|
|
30
|
-
CONTEXT_WINDOWS, DEFAULT_CONTEXT_WINDOW, discoverNames, GATE_SWITCHES, knownRuleIds, knownSkillIds, linkedSkillIds, loadKits, PACK_ORDER, ROOT,
|
|
30
|
+
CONTEXT_WINDOWS, DEFAULT_CONTEXT_WINDOW, DEFAULT_TIERS, TIERS_CHOICES, discoverNames, GATE_SWITCHES, knownRuleIds, knownSkillIds, linkedSkillIds, loadKits, PACK_ORDER, ROOT,
|
|
31
31
|
} from '../build/source.mjs';
|
|
32
32
|
import { installProfile, setupBuildArgs } from '../build/profile.mjs';
|
|
33
33
|
import { PRESETS } from '../loop/score.mjs';
|
|
@@ -37,6 +37,7 @@ import { isDir, printErr, printOut } from '../lib/fs.mjs';
|
|
|
37
37
|
import { machineDir } from '../lib/machine-dir.mjs';
|
|
38
38
|
import { NOTE } from '../inspect/scan.mjs';
|
|
39
39
|
import { expanduser, resolvePath } from '../hosts/hosts.mjs';
|
|
40
|
+
import { superpowersKitDefault } from './plugin-detect.mjs';
|
|
40
41
|
|
|
41
42
|
/** Where the shipped profiles live: `profiles/` at the checkout (or package) root. */
|
|
42
43
|
export const PROFILES_DIR = path.join(ROOT, 'profiles');
|
|
@@ -66,9 +67,12 @@ export const BASE_PROFILE = 'starter';
|
|
|
66
67
|
* spec D37 (which supersedes D18 on that point): a profile has no scope, so a project-only field is
|
|
67
68
|
* accepted, used by a project apply, and ignored by a global one, whose install owns the tier.
|
|
68
69
|
* `contextWindow` (`--context-window`) is optional: absent is the default, `200k`.
|
|
70
|
+
* `tiers` (`--tiers`) is optional and means "the profile sets it" only when present: absent keeps the
|
|
71
|
+
* install's own recorded value (`profileBuildArgs`' `current`), `off` on a fresh install. No shipped
|
|
72
|
+
* profile turns it on.
|
|
69
73
|
*/
|
|
70
74
|
export const PROFILE_KEYS = ['description', 'hosts', 'theme', 'footprint', 'posture', 'mode', 'trust',
|
|
71
|
-
'doctrines', 'excludeRules', 'excludeSkills', 'kits', 'sharedTier', 'contextWindow', 'gates', 'login'];
|
|
75
|
+
'doctrines', 'excludeRules', 'excludeSkills', 'kits', 'kitsByDetection', 'sharedTier', 'contextWindow', 'tiers', 'gates', 'login'];
|
|
72
76
|
|
|
73
77
|
/** A profile name: a file stem, never a path. */
|
|
74
78
|
const NAME_RE = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
@@ -139,6 +143,7 @@ export function profileProblems(p) {
|
|
|
139
143
|
choice('mode', discoverNames('modes', 'direct'));
|
|
140
144
|
choice('trust', Object.keys(PRESETS));
|
|
141
145
|
choice('contextWindow', Object.keys(CONTEXT_WINDOWS));
|
|
146
|
+
choice('tiers', [...TIERS_CHOICES]);
|
|
142
147
|
const packs = discoverNames('doctrines', PACK_ORDER[0]);
|
|
143
148
|
if (p.doctrines !== undefined && p.doctrines !== 'all') {
|
|
144
149
|
if (!stringList(p.doctrines)) errs.push(`'doctrines' must be 'all' or a list of: ${list(packs)}`);
|
|
@@ -163,6 +168,18 @@ export function profileProblems(p) {
|
|
|
163
168
|
if (!stringList(p.kits)) errs.push(`'kits' must be a list of: ${list(kits)}`);
|
|
164
169
|
else for (const k of p.kits.filter((x) => !kits.includes(x))) errs.push(`'kits': unknown kit '${k}' (valid: ${list(kits)})`);
|
|
165
170
|
}
|
|
171
|
+
// A kit chosen at apply time by what the machine holds (`kitsByDetection`): only a kit that a
|
|
172
|
+
// plugin can stand in for (`replacedBy`) has anything to detect, and it is on, or by detection, never both.
|
|
173
|
+
if (p.kitsByDetection !== undefined) {
|
|
174
|
+
const all = loadKits();
|
|
175
|
+
const detectable = [...all].filter(([, m]) => m.replacedBy).map(([k]) => k);
|
|
176
|
+
if (!stringList(p.kitsByDetection)) errs.push(`'kitsByDetection' must be a list of: ${list(detectable)}`);
|
|
177
|
+
else {
|
|
178
|
+
for (const k of p.kitsByDetection.filter((x) => !all.has(x))) errs.push(`'kitsByDetection': unknown kit '${k}' (valid: ${list(detectable)})`);
|
|
179
|
+
for (const k of p.kitsByDetection.filter((x) => all.has(x) && !detectable.includes(x))) errs.push(`'kitsByDetection': kit '${k}' has no plugin to detect (valid: ${list(detectable)})`);
|
|
180
|
+
for (const k of p.kitsByDetection.filter((x) => Array.isArray(p.kits) && p.kits.includes(x))) errs.push(`'kitsByDetection': kit '${k}' is also in 'kits' — name it in one`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
166
183
|
if (p.gates !== undefined) {
|
|
167
184
|
const keys = GATE_SWITCHES.map((g) => g.key);
|
|
168
185
|
if (!p.gates || typeof p.gates !== 'object' || Array.isArray(p.gates)) errs.push(`'gates' must be an object keyed by: ${list(keys)}`);
|
|
@@ -217,6 +234,20 @@ export function profileDoctrines(p) {
|
|
|
217
234
|
return PACK_ORDER.filter((d) => want.includes(d));
|
|
218
235
|
}
|
|
219
236
|
|
|
237
|
+
/**
|
|
238
|
+
* The kits profile `p` switches on for `host`: its `kits`, plus each `kitsByDetection` kit the
|
|
239
|
+
* plugin standing in for it is NOT seen for (`superpowersKitDefault`, the wizard's rule). A host
|
|
240
|
+
* with no plugin store to read gets the kit on. `detectRoots` names the roots to read; a test
|
|
241
|
+
* passes fixture roots, and the default is the machine's own.
|
|
242
|
+
*/
|
|
243
|
+
export function profileKits(p, host, project = null, detectRoots = {}) {
|
|
244
|
+
const kits = new Set(p.kits ?? []);
|
|
245
|
+
for (const k of p.kitsByDetection ?? []) {
|
|
246
|
+
if (superpowersKitDefault(host, { ...detectRoots, projectDir: project ?? detectRoots.projectDir ?? null }).on) kits.add(k);
|
|
247
|
+
}
|
|
248
|
+
return [...kits].sort();
|
|
249
|
+
}
|
|
250
|
+
|
|
220
251
|
/**
|
|
221
252
|
* The generator argv that installs profile `p` into `host`: globally, or into the folder
|
|
222
253
|
* `project` when one is given.
|
|
@@ -227,15 +258,18 @@ export function profileDoctrines(p) {
|
|
|
227
258
|
* here; posture and mode elide only at the value the driver would take anyway. `--reset` last,
|
|
228
259
|
* as the wizard does: a profile is a whole selection and wins over the install it lands on (D14).
|
|
229
260
|
*/
|
|
230
|
-
export function profileBuildArgs(p, host, project = null) {
|
|
261
|
+
export function profileBuildArgs(p, host, project = null, current = null, detectRoots = {}) {
|
|
231
262
|
// A stated selection, never null: `'all'` resolves to the packs, a list is the list.
|
|
232
263
|
const doctrines = PACK_ORDER.filter((d) => profileDoctrines(p).includes(d));
|
|
233
264
|
// PROJECT SCOPE (spec D32, D37): `--emit <host> --out <dir> --root <dir>`, and only here the
|
|
234
265
|
// profile's `sharedTier`; a global install owns the tier, so a global apply ignores the field.
|
|
235
266
|
const argv = setupBuildArgs(p.theme, project ? host : `${host}-global`, project, project, p.footprint,
|
|
236
267
|
p.posture, p.mode, doctrines, PACK_ORDER, p.excludeRules ?? [], p.trust, p.excludeSkills ?? [],
|
|
237
|
-
p.gates ?? {}, p
|
|
238
|
-
p.contextWindow ?? DEFAULT_CONTEXT_WINDOW
|
|
268
|
+
p.gates ?? {}, profileKits(p, host, project, detectRoots), project ? p.sharedTier === true : false,
|
|
269
|
+
p.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
|
|
270
|
+
// The profile's own value, else the install's recorded one (`current`), else off: a profile
|
|
271
|
+
// without the key never turns a routed install back off by being applied over it.
|
|
272
|
+
p.tiers ?? current ?? DEFAULT_TIERS);
|
|
239
273
|
if (!p.excludeSkills?.length) argv.push('--exclude-skills', 'none');
|
|
240
274
|
argv.push('--reset');
|
|
241
275
|
return argv;
|
|
@@ -267,6 +301,8 @@ export function profileFromInstall(info, description = '') {
|
|
|
267
301
|
kits: [...(info.kits ?? [])].sort(),
|
|
268
302
|
sharedTier: info.sharedTier === true,
|
|
269
303
|
contextWindow: info.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
|
|
304
|
+
// Written only when on, so a saved profile of a default install is what it always was.
|
|
305
|
+
...(info.tiers && info.tiers !== DEFAULT_TIERS ? { tiers: info.tiers } : {}),
|
|
270
306
|
gates,
|
|
271
307
|
login: true,
|
|
272
308
|
};
|
|
@@ -302,6 +338,11 @@ export function profileDiff(p, base) {
|
|
|
302
338
|
if (t(p) !== t(base)) out.push({ key, base: t(base), now: t(p) });
|
|
303
339
|
continue;
|
|
304
340
|
}
|
|
341
|
+
if (key === 'tiers') {
|
|
342
|
+
const w = (prof) => prof.tiers ?? DEFAULT_TIERS;
|
|
343
|
+
if (w(p) !== w(base)) out.push({ key, base: w(base), now: w(p) });
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
305
346
|
if (key === 'contextWindow') {
|
|
306
347
|
const w = (prof) => prof.contextWindow ?? DEFAULT_CONTEXT_WINDOW;
|
|
307
348
|
if (w(p) !== w(base)) out.push({ key, base: w(base), now: w(p) });
|
package/js/maintain/setup.mjs
CHANGED
|
@@ -50,9 +50,10 @@ import { preserveRefusal } from '../build/profile.mjs';
|
|
|
50
50
|
import { cmdLink } from '../hosts/link.mjs';
|
|
51
51
|
import { autostartInstall, autostartState, transientRoot } from '../hosts/shim.mjs';
|
|
52
52
|
import { loadProfile, profileBuildArgs, profileHosts } from './profiles.mjs';
|
|
53
|
+
import { superpowersKitDefault } from './plugin-detect.mjs';
|
|
53
54
|
import { checkProjectFolder, globalLayering, layeringText } from './profile-scope.mjs';
|
|
54
55
|
import { playLine } from '../ui/anim.mjs';
|
|
55
|
-
import { DEFAULT_CONTEXT_WINDOW, discoverNames, GATE_SWITCHES, PACK_ORDER, ROOT, loadKits } from '../build/source.mjs';
|
|
56
|
+
import { DEFAULT_CONTEXT_WINDOW, DEFAULT_TIERS, discoverNames, GATE_SWITCHES, PACK_ORDER, ROOT, loadKits } from '../build/source.mjs';
|
|
56
57
|
import { exportImprovements } from '../inspect/diff.mjs';
|
|
57
58
|
import { cmdDoctor } from '../inspect/doctor.mjs';
|
|
58
59
|
import { setupBuildArgs } from '../build/generate.mjs';
|
|
@@ -60,7 +61,7 @@ import { SHARED_TIER_BENEFIT, sharedTierCost, sharedTierFigure } from '../inspec
|
|
|
60
61
|
import { GLOBAL_MANIFEST, HOSTS, opencodeConfigDir } from '../hosts/hosts.mjs';
|
|
61
62
|
import {
|
|
62
63
|
claudeCfg, defaultMode, defaultPosture, defaultTheme, EMIT_HOST_SCOPE, gatesOfDir, installedDefaults, installState,
|
|
63
|
-
contextWindowOfDir, readJsonMaybe, sharedTierOfDir, themeFiles,
|
|
64
|
+
contextWindowOfDir, readJsonMaybe, sharedTierOfDir, themeFiles, tiersOfDir,
|
|
64
65
|
} from '../hosts/installs.mjs';
|
|
65
66
|
import { printOut, printErr } from '../lib/fs.mjs';
|
|
66
67
|
import { inNpxCache, which } from '../lib/paths.mjs';
|
|
@@ -233,14 +234,25 @@ function askDoctrines(deployed = null) {
|
|
|
233
234
|
* stdin it always did (and has no kit to carry: `kitsOfDir` drops an unshipped one).
|
|
234
235
|
* Returns the kit list, or null for none (`setupBuildArgs` omits `--kits`).
|
|
235
236
|
*/
|
|
236
|
-
export function askKits(deployed = null, kits = null) {
|
|
237
|
+
export function askKits(deployed = null, kits = null, host = null, detectRoots = {}) {
|
|
237
238
|
try { kits ??= loadKits(); } catch (e) {
|
|
238
239
|
process.stderr.write(`warning: kit question skipped — ${e.message}\n`);
|
|
239
240
|
return null;
|
|
240
241
|
}
|
|
241
242
|
const on = (deployed ?? []).filter((k) => kits.has(k));
|
|
242
|
-
|
|
243
|
-
|
|
243
|
+
// A kit a plugin can stand in for defaults by what this machine holds, not by what was deployed:
|
|
244
|
+
// plugin seen, `no`; not seen (or a host with no plugin, Bob), `yes`. The question names what it saw.
|
|
245
|
+
const picked = [...kits].filter(([k, m]) => {
|
|
246
|
+
let seen = '';
|
|
247
|
+
let def = on.includes(k) ? 'yes' : 'no';
|
|
248
|
+
if (m.replacedBy) {
|
|
249
|
+
const d = superpowersKitDefault(host ?? '', detectRoots);
|
|
250
|
+
seen = ` [the official ${m.replacedBy.upstream} plugin: ${d.line}]`;
|
|
251
|
+
def = d.on ? 'yes' : 'no';
|
|
252
|
+
}
|
|
253
|
+
return askChoice(`Kit ${k} — ${m.description ?? k}${seen}`,
|
|
254
|
+
[['yes', `install the ${k} kit`], ['no', `leave ${k} out`]], def) === 'yes';
|
|
255
|
+
});
|
|
244
256
|
return picked.length ? picked.map(([k]) => k) : null;
|
|
245
257
|
}
|
|
246
258
|
|
|
@@ -312,6 +324,22 @@ export function targetContextWindow(emit, out, machine = DEFAULT_CONTEXT_WINDOW)
|
|
|
312
324
|
}
|
|
313
325
|
}
|
|
314
326
|
|
|
327
|
+
/**
|
|
328
|
+
* The tier routing of the one install a setup answer re-runs, read off it: PRESERVED, NOT ASKED (the
|
|
329
|
+
* web picker owns the question), as `targetContextWindow` does. No install, or unreadable: off.
|
|
330
|
+
*/
|
|
331
|
+
export function targetTiers(emit, out) {
|
|
332
|
+
const [host, scope] = EMIT_HOST_SCOPE.get(emit) ?? [];
|
|
333
|
+
try {
|
|
334
|
+
if (!host) return DEFAULT_TIERS;
|
|
335
|
+
const dir = scope === 'global'
|
|
336
|
+
? HOSTS.find((h) => h.host === host).configDir() : resolveOut(out || '.');
|
|
337
|
+
return installState(dir, host, scope) === 'absent' ? DEFAULT_TIERS : tiersOfDir(dir, host);
|
|
338
|
+
} catch {
|
|
339
|
+
return DEFAULT_TIERS;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
315
343
|
export function collectSetupLines(kitMap = null) {
|
|
316
344
|
printOut('Geneseed setup — answer a few questions; nothing is written until you confirm.\n');
|
|
317
345
|
const inst = installedDefaults();
|
|
@@ -319,9 +347,10 @@ export function collectSetupLines(kitMap = null) {
|
|
|
319
347
|
const posture = askChoice('Posture', postureOptions(), inst.posture || defaultPosture());
|
|
320
348
|
const mode = askChoice('Mode', modeOptions(), inst.mode || defaultMode());
|
|
321
349
|
const doctrines = askDoctrines(inst.doctrines);
|
|
322
|
-
// Kits on stay on (spec A3); `kitsOfDir` already dropped a retired one.
|
|
323
|
-
const kits = askKits(inst.kits, kitMap);
|
|
324
350
|
const emit = askChoice('Install mode', EMIT_OPTIONS, inst.emit || 'opencode-global');
|
|
351
|
+
// Kits on stay on (spec A3); `kitsOfDir` already dropped a retired one. Asked after the install
|
|
352
|
+
// mode: a kit a plugin can replace defaults by what that host's plugin store holds.
|
|
353
|
+
const kits = askKits(inst.kits, kitMap, (EMIT_HOST_SCOPE.get(emit) ?? [])[0] ?? null);
|
|
325
354
|
const footprint = askChoice('Footprint', FOOTPRINT_OPTIONS,
|
|
326
355
|
inst.footprint || 'lean');
|
|
327
356
|
let out = null;
|
|
@@ -359,9 +388,10 @@ export function collectSetupLines(kitMap = null) {
|
|
|
359
388
|
const gates = targetGates(emit, out);
|
|
360
389
|
const gated = Object.values(gates).some((on) => on === false);
|
|
361
390
|
const contextWindow = targetContextWindow(emit, out, inst.contextWindow);
|
|
391
|
+
const tiers = targetTiers(emit, out);
|
|
362
392
|
printOut(`\nAbout to run: geneseed build ${
|
|
363
393
|
setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines, allPacks,
|
|
364
|
-
excludeRules, undefined, excludeSkills, gates, kits, sharedTier, contextWindow).join(' ')} --reset\n`);
|
|
394
|
+
excludeRules, undefined, excludeSkills, gates, kits, sharedTier, contextWindow, tiers).join(' ')} --reset\n`);
|
|
365
395
|
if (!confirm('Proceed?', true)) return null;
|
|
366
396
|
// The key only when there is something to carry, so a selection that excludes no skill and
|
|
367
397
|
// switches off no gate is the same object it was before either existed.
|
|
@@ -369,6 +399,7 @@ export function collectSetupLines(kitMap = null) {
|
|
|
369
399
|
theme, posture, mode, doctrines, excludeRules, ...(excludeSkills ? { excludeSkills } : {}),
|
|
370
400
|
...(gated ? { gates } : {}), ...(kits ? { kits } : {}), ...(sharedTier ? { sharedTier } : {}),
|
|
371
401
|
...(contextWindow !== DEFAULT_CONTEXT_WINDOW ? { contextWindow } : {}),
|
|
402
|
+
...(tiers !== DEFAULT_TIERS ? { tiers } : {}),
|
|
372
403
|
emit, out, root, footprint,
|
|
373
404
|
};
|
|
374
405
|
}
|
|
@@ -564,7 +595,7 @@ export function setupLines() {
|
|
|
564
595
|
const {
|
|
565
596
|
theme, emit, out, root, footprint = 'lean', posture = 'peer', mode = 'direct',
|
|
566
597
|
doctrines = null, excludeRules = null, excludeSkills = null, gates = {}, kits = null,
|
|
567
|
-
sharedTier = false, contextWindow = DEFAULT_CONTEXT_WINDOW,
|
|
598
|
+
sharedTier = false, contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS,
|
|
568
599
|
} = sel;
|
|
569
600
|
if (emit === 'opencode-global') {
|
|
570
601
|
// The build below overwrites the deployed global harness, which may carry hand edits (or
|
|
@@ -584,7 +615,7 @@ export function setupLines() {
|
|
|
584
615
|
// one command and run another.
|
|
585
616
|
const argv = setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines,
|
|
586
617
|
doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits, sharedTier,
|
|
587
|
-
contextWindow);
|
|
618
|
+
contextWindow, tiers);
|
|
588
619
|
// `--reset`: the wizard's answers are a WHOLE selection, and `setupBuildArgs` elides an axis at
|
|
589
620
|
// its default, so answering one back to it (mode direct, posture peer) over an install would
|
|
590
621
|
// otherwise trip the preserve guard (js/build/profile.mjs). The plan line above says the same.
|
|
@@ -819,7 +850,10 @@ function foundHosts(rows) {
|
|
|
819
850
|
export function profileBuilds(p, targets, { project = null, build, exportDrift, changes, configDir }) {
|
|
820
851
|
const results = [];
|
|
821
852
|
for (const t of targets) {
|
|
822
|
-
|
|
853
|
+
// The install's own tier routing rides along unless the profile names one (`profileBuildArgs`).
|
|
854
|
+
let current = null;
|
|
855
|
+
try { current = tiersOfDir(project ? resolveOut(project) : configDir(t.host), t.host); } catch { /* unreadable: the default */ }
|
|
856
|
+
const argv = profileBuildArgs(p, t.host, project, current);
|
|
823
857
|
const moved = changes(argv);
|
|
824
858
|
let saved = null;
|
|
825
859
|
if (!project) {
|
package/js/maintain/update.mjs
CHANGED
|
@@ -772,7 +772,7 @@ export async function installAxes(dir, { installProfile, setupBuildArgs }, notif
|
|
|
772
772
|
if (!existsSync(path.join(String(dir), '.geneseed-emit'))) return [];
|
|
773
773
|
const p = installProfile('opencode', 'global', String(dir), notify);
|
|
774
774
|
return setupBuildArgs('', 'files', null, null, p.footprint, p.posture, p.mode, p.doctrines,
|
|
775
|
-
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier, p.contextWindow).slice(4);
|
|
775
|
+
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier, p.contextWindow, p.tiers).slice(4);
|
|
776
776
|
}
|
|
777
777
|
|
|
778
778
|
/**
|