aligndev 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -10
- package/dist/code/code-cli.js +17 -1
- package/dist/code/native-context.js +5 -3
- package/dist/config.d.ts +2 -2
- package/dist/config.js +16 -11
- package/package.json +1 -1
- package/templates/guide/code.md +7 -2
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ Then ask your session to work with aligndev.
|
|
|
85
85
|
```json
|
|
86
86
|
{
|
|
87
87
|
"code": {
|
|
88
|
-
"profiles": { "work": { "agent": "claude"
|
|
88
|
+
"profiles": { "work": { "agent": "claude" } }
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
```
|
|
@@ -99,9 +99,9 @@ For multiple accounts and independent quota sources:
|
|
|
99
99
|
"code": {
|
|
100
100
|
"profile": "codex-personal",
|
|
101
101
|
"profiles": {
|
|
102
|
-
"codex-personal": { "agent": "codex", "
|
|
102
|
+
"codex-personal": { "agent": "codex", "defaultModel": "sol" },
|
|
103
103
|
"claude-personal": {
|
|
104
|
-
"agent": "claude", "default": true, "
|
|
104
|
+
"agent": "claude", "default": true, "defaultModel": "opus",
|
|
105
105
|
"unset": ["ANTHROPIC_API_KEY"]
|
|
106
106
|
},
|
|
107
107
|
"claude-work": {
|
|
@@ -109,14 +109,14 @@ For multiple accounts and independent quota sources:
|
|
|
109
109
|
"unset": ["ANTHROPIC_API_KEY"]
|
|
110
110
|
},
|
|
111
111
|
"pi-codex": {
|
|
112
|
-
"agent": "pi", "default": true, "
|
|
112
|
+
"agent": "pi", "default": true, "defaultModel": "sol",
|
|
113
113
|
"modelAliases": { "sol": "openai/sol" },
|
|
114
|
-
"quota": { "source": "codex"
|
|
114
|
+
"quota": { "source": "codex" }
|
|
115
115
|
},
|
|
116
116
|
"pi-anthropic": {
|
|
117
117
|
"agent": "pi", "configDir": "~/.pi/anthropic", "defaultModel": "opus",
|
|
118
118
|
"modelAliases": { "opus": "anthropic/opus" },
|
|
119
|
-
"quota": { "source": "claude"
|
|
119
|
+
"quota": { "source": "claude" }
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -135,9 +135,9 @@ Remove `code.profile` above to use automatic per-agent selection: the sole Codex
|
|
|
135
135
|
Each profile accepts:
|
|
136
136
|
|
|
137
137
|
- `default` — optional boolean preference for this profile's agent. With several matching profiles, exactly one true flag selects the preference. Omitted and false are equivalent; a sole matching profile needs no flag. At most one true flag per agent is allowed, even with a named choice. Independent defaults for different agents are valid. The flag never selects an agent kind.
|
|
138
|
-
- `configDir` — native
|
|
138
|
+
- `configDir` — native directory selection through `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `PI_CODING_AGENT_DIR`. Omit it for ordinary setup: the caller's variable is inherited unless `env` or `unset` changes it; without a variable, native defaults apply. `null` deliberately removes that variable to force native-default directory behavior. A string resolves and sets it, including when naming the default path. `~/` uses the configured home; relative paths resolve against the settings directory.
|
|
139
139
|
- `env` — literal environment values for non-secret configuration. No interpolation or shell expansion. Keep credentials in native stores or separately provisioned process environments.
|
|
140
|
-
- `unset` — inherited variables to remove, including API keys that select an unintended authentication route. A variable cannot occur in both `env` and `unset`.
|
|
140
|
+
- `unset` — inherited variables to remove, including API keys that select an unintended authentication route. A variable cannot occur in both `env` and `unset`. A string or null `configDir` cannot coexist with its native directory variable in either field.
|
|
141
141
|
- `defaultModel` — new-session default, validated against accepted names. Omission uses the native default.
|
|
142
142
|
- `models` — a nonempty list replaces accepted names. Otherwise Claude accepts `fable`, `opus`, `sonnet`, `haiku`, Codex accepts `astra`, `sol`, `terra`, `luna`, and both add configured alias names. Pi accepts every nonblank selector. An empty list adds no override.
|
|
143
143
|
- `modelAliases` — one-step user-facing name → native selector mappings. Validate the chosen name first, expand once, then apply native handling. A Codex alias target such as `sol` still resolves through its bundled catalog.
|
|
@@ -146,9 +146,11 @@ Each profile accepts:
|
|
|
146
146
|
|
|
147
147
|
Selection for new sessions, help, `guide code`, and quota: `--profile` → project registry selection → `code.profile` → automatic resolution. Resume inserts its latest recorded named profile before the global selection. Named choices bypass parent detection; a missing name fails rather than falling through. Automatic resolution selects a sole matching profile or the unique true flag among several matches; without either, several matches are ambiguous. No matching profile uses the detected agent's built-ins. Without a parent, zero or several profiles require a named choice, regardless of flags. Several detected kinds always require a named choice. Project selections use the actual working directory, matching linked worktrees through AlignFirst; help/guide/quota need no `.plans` or Git repository. `--profile` is rejected on status and unrelated guide topics.
|
|
148
148
|
|
|
149
|
-
`aligndev code quota [--profile <name>]` needs neither a ticket nor `.plans` and starts no coding session. Explicit quota settings start from the original caller environment, apply only their own `unset`, `env` and source-specific `configDir`, then strip parent-session identities. Coding-profile overrides and Pi credentials are not copied into the quota environment. The same path and validation rules apply.
|
|
149
|
+
`aligndev code quota [--profile <name>]` needs neither a ticket nor `.plans` and starts no coding session. Explicit quota settings start from the original caller environment, apply only their own `unset`, `env` and source-specific `configDir`, then strip parent-session identities. Coding-profile overrides and Pi credentials are not copied into the quota environment. The same path and validation rules apply. Select quota storage only when needed: omission inherits independently from the original caller, null removes the source's native directory variable, and a string selects explicit storage. Pair each Pi profile with the intended Codex or Claude account, using a custom quota directory when account separation is intended. Reports name the profile and native source; the limits belong to that CLI's account. AlignDev does not verify that it matches Pi's account or infer it from a model. Native requests time out after 30 seconds and await bounded process cleanup.
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
For example, `"configDir": null` forces native-default mode despite an inherited directory variable; `"configDir": "~/.claude-work"` deliberately selects custom Claude storage. On macOS, explicitly setting `CLAUDE_CONFIG_DIR` to the default path can select different Keychain credentials from leaving it unset. Such a string remains valid and is distinct from omission or null. Confirm the intended mode before changing an existing selection; AlignDev performs no settings rewrite, credential transfer or automatic login. A null reset changes only directory routing, not HOME, PATH or API-key precedence.
|
|
152
|
+
|
|
153
|
+
The child inherits the caller environment, removes `unset`, then applies `env` and the directory selection (setting a string or removing the native variable for null). Parent-session identities are stripped afterward, and required adapter values win. The same finalized environment reaches discovery, execution and native context lookup. Help, guides and failures identify native storage selected through a string `configDir`, a null reset, profile environment overrides, inherited variables or profile removal. They show environment-variable names and origins, never their values. Login must reproduce that effective environment and cwd. No environment values are printed or saved in run metadata.
|
|
152
154
|
|
|
153
155
|
Resume requires the same native agent and, for Pi, the same real directory. A selected account must contain the native conversation; failure never falls back to an old profile or accepts a new conversation. `--model` overrides the recorded user-facing model; otherwise that name is retained and validated under the current profile. A disallowed retained name requires an explicit replacement; a recorded null keeps the native conversation's model. Profile defaults apply only to new sessions. Retained aliases use the selected profile's current mappings, so changing a mapping can change the native target. Session metadata records profile, agent, chosen name, native ID and cwd; historical records with blank or missing profiles read as null. Unless an explicit, project or global named choice replaces null, resume uses detected built-ins, ignoring configured profile counts and flags, and records null in the new run. No or several detected parents still fail. Original records remain unchanged. A deleted recorded name needs an explicit or project replacement; global selection and inference cannot rescue it. Status reads durable metadata even when launch settings are invalid or a profile has been deleted.
|
|
154
156
|
|
|
@@ -173,6 +175,8 @@ Install the setup skill where your agent will assemble the deployment's private
|
|
|
173
175
|
npx -y skills add https://github.com/paleo/alignfirst --global --skill alignfirst-setup-guide
|
|
174
176
|
```
|
|
175
177
|
|
|
178
|
+
Deployments require null or a string for every coding profile and enabled explicit quota source; omission is invalid there. Generated service defaults use null. Inventory still records absolute filesystem paths, while native commands unset the directory variable for null or set its resolved value for a string.
|
|
179
|
+
|
|
176
180
|
Then ask the agent to create an assistant. The skill collects the deployment values, renders one Slack or Discord variant and one Claude Code, Codex or Pi variant, and writes the installation, security, operation and recovery runbooks. Each managed project receives the full preparation contract: the `alignfirst context` section in its `AGENTS.md`, an optional work-files repository, docmap, isolated workspaces and a project-specific `DEVELOPERS.md`.
|
|
177
181
|
|
|
178
182
|
## Under the Hood
|
package/dist/code/code-cli.js
CHANGED
|
@@ -765,6 +765,18 @@ Config (~/.alignfirst/aligndev.settings.json):
|
|
|
765
765
|
code.profile Global named profile. Effective profile: ${profile ?? "(built-in)"} (selected: ${agent}).
|
|
766
766
|
code.profiles Complete named profiles: agent, default, configDir, env, unset,
|
|
767
767
|
defaultModel, models, modelAliases, skipPermissions, quota. No inheritance.
|
|
768
|
+
profile.configDir Omit for ordinary setup: inherit the native directory variable unless
|
|
769
|
+
env/unset changes it; otherwise use native defaults. null deliberately
|
|
770
|
+
removes it for native-default mode. A string resolves and sets it,
|
|
771
|
+
even when naming the default path. ~/ uses the configured home;
|
|
772
|
+
relative paths use the settings directory. String/null conflicts with
|
|
773
|
+
the matching native variable in env/unset: CLAUDE_CONFIG_DIR (claude),
|
|
774
|
+
CODEX_HOME (codex), PI_CODING_AGENT_DIR (pi).
|
|
775
|
+
profile.quota source: claude, codex or none. Enabled sources use the same omitted/null/
|
|
776
|
+
string directory rules, starting from the original caller env without
|
|
777
|
+
coding-profile overrides. Omitted Claude/Codex quota uses the coding
|
|
778
|
+
environment; pi requires an explicit source or none. none accepts no
|
|
779
|
+
other recognized fields, including configDir: null.
|
|
768
780
|
profile.default Optional boolean preference for that agent; at most one true per agent.
|
|
769
781
|
A sole matching profile is inferred without a flag. No matching profile
|
|
770
782
|
uses detected built-ins. Without a parent, only a sole total profile is
|
|
@@ -780,7 +792,11 @@ Native configuration: ${describeNativeStorage(code)}.
|
|
|
780
792
|
Login must use the same effective environment as the child: apply profile unset/env/configDir,
|
|
781
793
|
including HOME, PATH and credential routing, from the same working directory. Then use
|
|
782
794
|
${authenticationInstruction(agent)}. A bare login in another shell may use a different account.
|
|
783
|
-
Environment values are omitted.
|
|
795
|
+
Environment values are omitted. A null reset changes directory routing only, not HOME, PATH
|
|
796
|
+
or API-key precedence. On macOS, setting Claude's default path can select different Keychain
|
|
797
|
+
credentials from an unset CLAUDE_CONFIG_DIR. Confirm the intended mode before changing existing
|
|
798
|
+
strings; no automatic settings rewrite, login or credential transfer occurs. OpenClaw deployments
|
|
799
|
+
require null/string selections for every coding profile and enabled explicit quota source.
|
|
784
800
|
|
|
785
801
|
Selected-agent permissions: ${permissionMode}
|
|
786
802
|
The project's companion directory is prepared before launch; pi uses ordinary OS access.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CONFIG_DIRECTORY_VARIABLES } from "../config.js";
|
|
2
2
|
export function describeNativeStorage(code) {
|
|
3
3
|
const variable = CONFIG_DIRECTORY_VARIABLES[code.agent];
|
|
4
|
-
const directory = code.configDir ===
|
|
5
|
-
?
|
|
6
|
-
:
|
|
4
|
+
const directory = code.configDir === null
|
|
5
|
+
? `${variable}: unset by configDir: null; native defaults apply`
|
|
6
|
+
: code.configDir === undefined
|
|
7
|
+
? describeVariable(code, variable)
|
|
8
|
+
: `${variable}: configDir ${JSON.stringify(code.configDir)}`;
|
|
7
9
|
const home = ["HOME", "USERPROFILE"]
|
|
8
10
|
.filter((name) => code.childEnv[name] !== undefined || code.unset?.includes(name))
|
|
9
11
|
.map((name) => describeVariable(code, name));
|
package/dist/config.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface CodeSettings {
|
|
|
24
24
|
export interface CodingProfile {
|
|
25
25
|
agent: CodingAgent;
|
|
26
26
|
default?: boolean;
|
|
27
|
-
configDir?: string;
|
|
27
|
+
configDir?: string | null;
|
|
28
28
|
defaultModel?: string;
|
|
29
29
|
models?: string[];
|
|
30
30
|
modelAliases?: Record<string, string>;
|
|
@@ -35,7 +35,7 @@ export interface CodingProfile {
|
|
|
35
35
|
}
|
|
36
36
|
export interface QuotaSettings {
|
|
37
37
|
source: "claude" | "codex" | "none";
|
|
38
|
-
configDir?: string;
|
|
38
|
+
configDir?: string | null;
|
|
39
39
|
env?: Record<string, string>;
|
|
40
40
|
unset?: string[];
|
|
41
41
|
}
|
package/dist/config.js
CHANGED
|
@@ -48,7 +48,7 @@ export function loadConfig(home) {
|
|
|
48
48
|
for (const [name, profile] of Object.entries(code.profiles ?? {})) {
|
|
49
49
|
const field = `code.profiles[${JSON.stringify(name)}]`;
|
|
50
50
|
validateEnvironment(profile, profile.agent, field, path);
|
|
51
|
-
if (profile.configDir
|
|
51
|
+
if (typeof profile.configDir === "string")
|
|
52
52
|
profile.configDir = resolvePath(profile.configDir, home, path);
|
|
53
53
|
if (profile.quota !== undefined) {
|
|
54
54
|
const quota = profile.quota;
|
|
@@ -60,7 +60,7 @@ export function loadConfig(home) {
|
|
|
60
60
|
else {
|
|
61
61
|
validateEnvironment(quota, quota.source, `${field}.quota`, path);
|
|
62
62
|
}
|
|
63
|
-
if (quota.configDir
|
|
63
|
+
if (typeof quota.configDir === "string")
|
|
64
64
|
quota.configDir = resolvePath(quota.configDir, home, path);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -130,6 +130,8 @@ function invalidConfig(path, detail) {
|
|
|
130
130
|
return new Error(`Error: invalid aligndev config ${path}: ${detail}`);
|
|
131
131
|
}
|
|
132
132
|
function directoryValue(value, path) {
|
|
133
|
+
if (value === null)
|
|
134
|
+
return null;
|
|
133
135
|
nonblankString(value, path);
|
|
134
136
|
return nulFreeString(value, path);
|
|
135
137
|
}
|
|
@@ -157,18 +159,24 @@ export function resolveQuotaConfig(code, callerEnv) {
|
|
|
157
159
|
if (quota === undefined) {
|
|
158
160
|
if (code.agent === "pi") {
|
|
159
161
|
throw new Error("Pi account quota is unsupported without explicit configuration: " +
|
|
160
|
-
"set quota.source to claude or codex
|
|
162
|
+
"set quota.source to claude or codex, or none to disable it.");
|
|
161
163
|
}
|
|
162
164
|
return { source: code.agent, env: code.childEnv };
|
|
163
165
|
}
|
|
164
|
-
const overrides = { ...quota.env };
|
|
165
|
-
if (quota.configDir !== undefined)
|
|
166
|
-
overrides[CONFIG_DIRECTORY_VARIABLES[quota.source]] = quota.configDir;
|
|
167
166
|
return {
|
|
168
167
|
source: quota.source,
|
|
169
|
-
env:
|
|
168
|
+
env: buildNativeEnv(callerEnv, quota, quota.source),
|
|
170
169
|
};
|
|
171
170
|
}
|
|
171
|
+
function buildNativeEnv(callerEnv, settings, agent, required = {}) {
|
|
172
|
+
const variable = CONFIG_DIRECTORY_VARIABLES[agent];
|
|
173
|
+
const overrides = { ...settings.env };
|
|
174
|
+
if (typeof settings.configDir === "string")
|
|
175
|
+
overrides[variable] = settings.configDir;
|
|
176
|
+
const unset = settings.unset ?? [];
|
|
177
|
+
const removals = settings.configDir === null ? [...unset, variable] : unset;
|
|
178
|
+
return buildAgentEnv(callerEnv, removals, overrides, required);
|
|
179
|
+
}
|
|
172
180
|
export function resolveCodeConfig(config, env, selection = {}) {
|
|
173
181
|
validateReferences(config);
|
|
174
182
|
const name = selection.explicit ?? selection.project?.profile ?? selection.recorded ?? config.code.profile;
|
|
@@ -186,15 +194,12 @@ export function resolveCodeConfig(config, env, selection = {}) {
|
|
|
186
194
|
effectiveName = automatic.name;
|
|
187
195
|
}
|
|
188
196
|
checkDefaultModel(profile, config.path, effectiveName);
|
|
189
|
-
const overrides = { ...profile.env };
|
|
190
|
-
if (profile.configDir !== undefined)
|
|
191
|
-
overrides[CONFIG_DIRECTORY_VARIABLES[profile.agent]] = profile.configDir;
|
|
192
197
|
return {
|
|
193
198
|
...profile,
|
|
194
199
|
profile: effectiveName ?? null,
|
|
195
200
|
skipPermissions: profile.skipPermissions ?? false,
|
|
196
201
|
unset: profile.unset ?? [],
|
|
197
|
-
childEnv:
|
|
202
|
+
childEnv: buildNativeEnv(env, profile, profile.agent, createAgentAdapter(profile.agent).env),
|
|
198
203
|
};
|
|
199
204
|
}
|
|
200
205
|
function validateReferences(config) {
|
package/package.json
CHANGED
package/templates/guide/code.md
CHANGED
|
@@ -199,9 +199,14 @@ Automatic resolution uses a sole profile matching the detected agent, or that ag
|
|
|
199
199
|
|
|
200
200
|
Historical resumes with a null or missing profile use detected built-ins unless an explicit, project or global named choice replaces them. They ignore profile counts and flags, still require one detected parent and keep null in the new record. Original transcripts remain unchanged. A deleted recorded name requires an explicit or project replacement; global settings and inference cannot rescue it.
|
|
201
201
|
|
|
202
|
-
Profiles select native configuration/authentication through `
|
|
202
|
+
Profiles select native configuration/authentication through `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `PI_CODING_AGENT_DIR`. For ordinary setup, omit `configDir`: inherit the caller's variable unless `env` or `unset` changes it; otherwise native defaults apply. `configDir: null` deliberately removes the variable to force native-default directory behavior. A string resolves and sets it, even when naming the default path. `~/` uses the configured home; relative paths use the settings directory. A string or null conflicts with the matching variable in `env` or `unset`. `env` values are literal non-secret configuration; credentials remain in native stores or provisioned process environments. Parent identities are stripped after these overrides. Environment values are never recorded in session metadata.
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
On macOS, explicitly setting Claude's default path can select different Keychain credentials from leaving `CLAUDE_CONFIG_DIR` unset. Strings remain valid deliberate selections; confirm the intended mode before changing one. A null reset changes only directory routing, not HOME, PATH or API-key precedence. There is no automatic login, credential transfer or settings rewrite.
|
|
205
|
+
{{#openclaw}}
|
|
206
|
+
Deployment settings require null or an explicit string for every coding profile and enabled explicit quota source. Generated service defaults use null. Inventory paths remain absolute filesystem paths; native commands must unset the directory variable for null or set its resolved value for a string. Shared paths do not imply the same invocation mode.
|
|
207
|
+
{{/openclaw}}
|
|
208
|
+
|
|
209
|
+
Select a user-facing model name, validate it against the accepted names, expand one `modelAliases` mapping, then apply native handling. Without a nonempty `models` override, Claude/Codex add alias names to their native default names; Pi accepts any nonblank selector. Pi exact provider-qualified IDs pin models; fuzzy selectors and thinking suffixes pass through to Pi. Use separate Pi profiles for Codex-backed and Anthropic-backed choices; AlignDev never guesses providers or accounts. Omitted quota uses a native Claude/Codex profile's environment; Pi needs explicit `quota.source: "codex"` or `"claude"`. `"none"` disables quota. Explicit quota starts from the caller environment, applies only quota `unset/env/configDir` and strips parent identities. It never copies coding-profile overrides or Pi credentials. Choose quota storage only when needed: omitted `configDir` inherits independently from the original caller, null removes the source's directory variable, and a string selects explicit storage. Coding and explicit-quota resets do not affect each other. Disabled quota accepts no other fields, including `configDir: null`. Quota paths follow profile expansion rules. Do not infer account pairing from model selection or retry against a different account after failure.
|
|
205
210
|
|
|
206
211
|
Resume keeps the latest user-facing model unless `--model` replaces it; new-session defaults are ignored. A retained name disallowed by the selected profile requires an explicit accepted replacement. Null keeps the native conversation model. Retained aliases use current mappings, which can change their native targets. Resume requires the same agent and native identity; Pi also requires its recorded real directory. An unavailable conversation fails under the selected account with no fallback, copying or replacement conversation. Run metadata records the effective profile (or null), agent, model name, native ID and cwd. Historical records stay readable; status does not validate launch profiles.
|
|
207
212
|
|