@llman-sdd/cli 0.7.1 → 0.7.3
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/package.json +2 -2
- package/src/cli-shared.ts +60 -1
- package/src/commands/change.ts +43 -3
- package/src/commands/validate.ts +1 -0
- package/src/main.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llman-sdd/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Spec-driven development workflow CLI (the `llman-sdd` command)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "bun run ./scripts/build-binary.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@llman-sdd/core": "0.7.
|
|
30
|
+
"@llman-sdd/core": "0.7.3",
|
|
31
31
|
"commander": "^15.0.0"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
package/src/cli-shared.ts
CHANGED
|
@@ -12,8 +12,10 @@ import {
|
|
|
12
12
|
loadConfig,
|
|
13
13
|
loadConfigDetail,
|
|
14
14
|
makeEmbeddedTemplateIo,
|
|
15
|
+
readSddState,
|
|
15
16
|
resolveChangeId,
|
|
16
17
|
resolveInstanceRoot,
|
|
18
|
+
semverLt,
|
|
17
19
|
type TemplateIo,
|
|
18
20
|
} from '@llman-sdd/core';
|
|
19
21
|
import type { Command } from 'commander';
|
|
@@ -32,7 +34,42 @@ export type { Command } from 'commander';
|
|
|
32
34
|
|
|
33
35
|
// Injected at binary build time by scripts/build-binary.ts; falls back to the
|
|
34
36
|
// package version when running from source.
|
|
35
|
-
|
|
37
|
+
const baseVersion = process.env.LLMAN_SDD_VERSION ?? pkg.version;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Dev-tree marker (`+dirty.N`): appended when the checkout has uncommitted
|
|
41
|
+
* changes, so `--version` / drift notices distinguish "released build" from
|
|
42
|
+
* "hacking on the library" at a glance. Best-effort — git failure keeps the
|
|
43
|
+
* plain version; cached per process.
|
|
44
|
+
*/
|
|
45
|
+
let dirtySuffix: string | null | undefined;
|
|
46
|
+
|
|
47
|
+
function computeDirtySuffix(): string {
|
|
48
|
+
try {
|
|
49
|
+
const probe = Bun.spawnSync(['git', 'status', '--porcelain'], {
|
|
50
|
+
cwd: import.meta.dir,
|
|
51
|
+
stdout: 'pipe',
|
|
52
|
+
stderr: 'ignore',
|
|
53
|
+
});
|
|
54
|
+
if (probe.exitCode !== 0) return '';
|
|
55
|
+
const lines = probe.stdout
|
|
56
|
+
.toString()
|
|
57
|
+
.split('\n')
|
|
58
|
+
.map((l) => l.trim())
|
|
59
|
+
.filter((l) => l !== '');
|
|
60
|
+
return lines.length > 0 ? `+dirty.${lines.length}` : '';
|
|
61
|
+
} catch {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function versionDisplay(): string {
|
|
67
|
+
dirtySuffix ??= computeDirtySuffix();
|
|
68
|
+
return `${baseVersion}${dirtySuffix}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Package version without the dirty suffix (drift comparison baseline). */
|
|
72
|
+
export const version: string = baseVersion;
|
|
36
73
|
|
|
37
74
|
// Compiled single-file binaries have no on-disk templates and Bun <= 1.4.x has
|
|
38
75
|
// no embedding mechanism, so scripts/build-binary.ts injects the template
|
|
@@ -115,10 +152,32 @@ export function warnLegacyBddOnce(source: string): void {
|
|
|
115
152
|
warnLegacyBdd(loadConfigDetail(source).legacyBddElevated);
|
|
116
153
|
}
|
|
117
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Version-drift notice (version-awareness): when the project was scaffolded by
|
|
157
|
+
* an older llman-sdd, surface one stderr line per process so humans and agents
|
|
158
|
+
* see the update hint. Silent-OK when no/corrupt state; never load-bearing;
|
|
159
|
+
* no override flags by design (noise is bounded by once-per-process + strict
|
|
160
|
+
* older-than comparison).
|
|
161
|
+
*/
|
|
162
|
+
let versionDriftShown = false;
|
|
163
|
+
|
|
164
|
+
export function noteVersionDriftOnce(root: string = process.cwd()): void {
|
|
165
|
+
if (versionDriftShown) return;
|
|
166
|
+
versionDriftShown = true;
|
|
167
|
+
const io = makeIo(root);
|
|
168
|
+
const state = readSddState(io);
|
|
169
|
+
if (state === null) return;
|
|
170
|
+
if (!semverLt(state.cli_version, version)) return;
|
|
171
|
+
console.error(
|
|
172
|
+
`[NOTE] this project was scaffolded with llman-sdd ${state.cli_version}; installed CLI is ${version}. Skill templates/behaviour may have changed — review the changelog and run \`llman-sdd init --update\`.`,
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
118
176
|
export function loadCliConfig(): ReturnType<typeof loadConfig> | null {
|
|
119
177
|
if (!existsSync('llmanspec/config.yaml')) return null;
|
|
120
178
|
const detail = loadConfigDetail(readFileSync('llmanspec/config.yaml', 'utf8'));
|
|
121
179
|
warnLegacyBdd(detail.legacyBddElevated);
|
|
180
|
+
noteVersionDriftOnce();
|
|
122
181
|
return detail.config;
|
|
123
182
|
}
|
|
124
183
|
|
package/src/commands/change.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
attachChange,
|
|
9
9
|
changeDiff,
|
|
10
10
|
changeDiffInfo,
|
|
11
|
+
defaultBranch,
|
|
11
12
|
deriveChangeId,
|
|
12
13
|
finalizeChange,
|
|
13
14
|
harvestAcrossWorktrees,
|
|
@@ -22,6 +23,7 @@ import {
|
|
|
22
23
|
decideCloseOutHarness,
|
|
23
24
|
extractFrontmatter,
|
|
24
25
|
readNeedsSpecsChange,
|
|
26
|
+
type GitLike,
|
|
25
27
|
} from '@llman-sdd/core';
|
|
26
28
|
import { Option, type Command } from 'commander';
|
|
27
29
|
|
|
@@ -40,6 +42,38 @@ function runValidateSweep(): boolean {
|
|
|
40
42
|
return report.verdicts.some((v) => !v.ok);
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
/** r95: human-readable provenance of a recorded base_branch. */
|
|
46
|
+
const BASE_SOURCE_HUMAN: Record<string, string> = {
|
|
47
|
+
flag: '--base',
|
|
48
|
+
config: 'branch.<name>.base',
|
|
49
|
+
upstream: 'local upstream',
|
|
50
|
+
worktree: 'current branch (worktree mode)',
|
|
51
|
+
default: 'default-branch resolution',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** r95: deviation warning when the recorded base_branch is not the default
|
|
55
|
+
* branch — surfaced on attach and on start's --base/--worktree paths. Runs
|
|
56
|
+
* after start/attach already wrote their effects, so an unresolvable default
|
|
57
|
+
* branch skips the warning instead of failing the command. */
|
|
58
|
+
function warnBaseBranchDeviation(
|
|
59
|
+
git: GitLike,
|
|
60
|
+
result: { baseBranch: string; baseSource: string },
|
|
61
|
+
): void {
|
|
62
|
+
let def: string;
|
|
63
|
+
try {
|
|
64
|
+
def = defaultBranch(git);
|
|
65
|
+
} catch {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (result.baseBranch === def) return;
|
|
69
|
+
const human = BASE_SOURCE_HUMAN[result.baseSource] ?? result.baseSource;
|
|
70
|
+
console.error(
|
|
71
|
+
`[WARNING] base_branch \`${result.baseBranch}\` deviates from default branch \`${def}\` ` +
|
|
72
|
+
`(source: ${human}); merge target defaults to \`${result.baseBranch}\` — ` +
|
|
73
|
+
'pass --base <branch> to override',
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
43
77
|
/** r81: run or refuse the spec verification command before any merge or rename. */
|
|
44
78
|
function enforceCloseOutHarness(id: string, noCheck: boolean): void {
|
|
45
79
|
const proposalPath = `llmanspec/changes/${id}/proposal.md`;
|
|
@@ -166,7 +200,7 @@ export function registerChange(program: Command): void {
|
|
|
166
200
|
)
|
|
167
201
|
.option(
|
|
168
202
|
'--base <branch>',
|
|
169
|
-
'explicit fork-source branch to record (must
|
|
203
|
+
'explicit fork-source branch to record (must be an existing local branch differing from the new branch; exempts the default-branch gate)',
|
|
170
204
|
)
|
|
171
205
|
.option(
|
|
172
206
|
'--worktree',
|
|
@@ -183,6 +217,7 @@ export function registerChange(program: Command): void {
|
|
|
183
217
|
worktreeRoot: config?.sdd?.worktree_root ?? undefined,
|
|
184
218
|
worktreeNaming: config?.sdd?.worktree_naming ?? undefined,
|
|
185
219
|
});
|
|
220
|
+
warnBaseBranchDeviation(git, result);
|
|
186
221
|
console.log(
|
|
187
222
|
`started change \`${resolved.id}\` → branch \`${result.branch}\` base \`${result.baseSha}\` base-branch \`${result.baseBranch}\``,
|
|
188
223
|
);
|
|
@@ -194,13 +229,18 @@ export function registerChange(program: Command): void {
|
|
|
194
229
|
.description('Bind the change to the current feature branch')
|
|
195
230
|
.argument('<id>')
|
|
196
231
|
.option('--force', 'rebind an already attached change to the current branch')
|
|
197
|
-
.option(
|
|
232
|
+
.option(
|
|
233
|
+
'--base <branch>',
|
|
234
|
+
'explicit fork-point branch to record (must be an existing local branch)',
|
|
235
|
+
)
|
|
198
236
|
.action((id: string, options: { force?: boolean; base?: string }) => {
|
|
199
237
|
const resolved = resolveChangeIdOrExit(program, id);
|
|
200
|
-
const
|
|
238
|
+
const git = makeCliGit(process.cwd());
|
|
239
|
+
const result = attachChange(git, newIo(), resolved.id, {
|
|
201
240
|
force: options.force,
|
|
202
241
|
base: options.base,
|
|
203
242
|
});
|
|
243
|
+
warnBaseBranchDeviation(git, result);
|
|
204
244
|
console.log(
|
|
205
245
|
`attached change \`${resolved.id}\` → branch \`${result.branch}\` base \`${result.baseSha}\` base-branch \`${result.baseBranch}\``,
|
|
206
246
|
);
|
package/src/commands/validate.ts
CHANGED
|
@@ -99,6 +99,7 @@ function specV1Items(
|
|
|
99
99
|
root: process.cwd(),
|
|
100
100
|
specRel,
|
|
101
101
|
scope: scopes.map(liftScope),
|
|
102
|
+
reviewedThrough: entry.doc.header.reviewedThrough,
|
|
102
103
|
baseRefEnv: process.env.LLMANSPEC_BASE_REF,
|
|
103
104
|
});
|
|
104
105
|
let issues: ChangeIssue[] = verdict.items.map((i) => ({
|
package/src/main.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
|
|
4
|
-
import { CliError,
|
|
4
|
+
import { CliError, versionDisplay } from './cli-shared.ts';
|
|
5
5
|
import { registerArchive } from './commands/archive.ts';
|
|
6
6
|
import { registerChange } from './commands/change.ts';
|
|
7
7
|
import { registerConfig } from './commands/config.ts';
|
|
@@ -27,7 +27,7 @@ const program = new Command();
|
|
|
27
27
|
program.exitOverride();
|
|
28
28
|
program.configureOutput({ outputError: () => {} });
|
|
29
29
|
|
|
30
|
-
program.name('llman-sdd').description('Spec-driven development workflow').version(
|
|
30
|
+
program.name('llman-sdd').description('Spec-driven development workflow').version(versionDisplay());
|
|
31
31
|
program.option(
|
|
32
32
|
'--max-scan-depth <n>',
|
|
33
33
|
'max depth when scanning llmanspec/changes/ for proposal.md (min 1, default 8)',
|