changeledger 0.6.1 → 0.6.2
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/AGENTS.md +2 -1
- package/package.json +1 -1
- package/src/commands/context.mjs +16 -12
- package/src/contract.mjs +2 -1
- package/templates/contract/core.md +9 -3
package/AGENTS.md
CHANGED
|
@@ -6,7 +6,8 @@ under `.changeledger/changes/`, persistent truth under `.changeledger/specs/`.
|
|
|
6
6
|
<!-- changeledger -->
|
|
7
7
|
> [!IMPORTANT]
|
|
8
8
|
> This repo uses **ChangeLedger**. Before creating or modifying files, run
|
|
9
|
-
> `changeledger context
|
|
9
|
+
> `changeledger context` directly, read its complete output, and follow it.
|
|
10
|
+
> Do not pipe, filter, summarize, limit, or truncate the output before reading it.
|
|
10
11
|
> If the output is truncated/incomplete, stop and restore complete context before
|
|
11
12
|
> proceeding. If the command is unavailable, stop and restore/install
|
|
12
13
|
> ChangeLedger; do not proceed from memory.
|
package/package.json
CHANGED
package/src/commands/context.mjs
CHANGED
|
@@ -7,28 +7,32 @@ import { resolveChange } from '../repo.mjs';
|
|
|
7
7
|
|
|
8
8
|
const MODES = ['implement', 'review', 'spec', 'release'];
|
|
9
9
|
const MODE_CONTEXT = {
|
|
10
|
-
implement: ['
|
|
11
|
-
review: ['
|
|
12
|
-
spec: ['
|
|
13
|
-
release: ['
|
|
10
|
+
implement: ['implement', 'readiness'],
|
|
11
|
+
review: ['review'],
|
|
12
|
+
spec: ['spec', 'readiness'],
|
|
13
|
+
release: ['release'],
|
|
14
14
|
};
|
|
15
15
|
const STATUS_CONTEXT = {
|
|
16
16
|
draft: { mode: 'spec', fragments: MODE_CONTEXT.spec },
|
|
17
17
|
approved: { mode: 'implement', fragments: MODE_CONTEXT.implement },
|
|
18
18
|
'in-progress': { mode: 'implement', fragments: MODE_CONTEXT.implement },
|
|
19
|
-
'in-review': { mode: 'review', fragments:
|
|
20
|
-
blocked: { mode: 'blocked', fragments: ['
|
|
21
|
-
'in-validation': { mode: 'validation', fragments: ['
|
|
22
|
-
done: { mode: 'close', fragments: ['
|
|
23
|
-
discarded: { mode: 'discarded', fragments: ['
|
|
19
|
+
'in-review': { mode: 'review', fragments: MODE_CONTEXT.review },
|
|
20
|
+
blocked: { mode: 'blocked', fragments: ['blocked'] },
|
|
21
|
+
'in-validation': { mode: 'validation', fragments: ['validation'] },
|
|
22
|
+
done: { mode: 'close', fragments: ['close'] },
|
|
23
|
+
discarded: { mode: 'discarded', fragments: ['discarded'] },
|
|
24
24
|
};
|
|
25
|
+
const INCREMENTAL_NOTICE = `This incremental context extends the complete core context already read.
|
|
26
|
+
If the complete base output has not been read, stop and run \`changeledger context\` directly before proceeding.`;
|
|
25
27
|
|
|
26
28
|
function fragment(name) {
|
|
27
29
|
return fs.readFileSync(path.join(contractTemplatesDir, `${name}.md`), 'utf8').trim();
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
function compose(mode, fragments, changeText) {
|
|
31
|
-
const sections = [`Mode: ${mode}
|
|
32
|
+
function compose(mode, fragments, changeText, incremental = true) {
|
|
33
|
+
const sections = [`Mode: ${mode}`];
|
|
34
|
+
if (incremental) sections.push(INCREMENTAL_NOTICE);
|
|
35
|
+
sections.push(...fragments.map(fragment));
|
|
32
36
|
if (changeText) sections.push('---\n\n# Selected change\n', changeText.trim());
|
|
33
37
|
return `${sections.join('\n\n')}\n`;
|
|
34
38
|
}
|
|
@@ -41,7 +45,7 @@ function requireRepo(cwd) {
|
|
|
41
45
|
|
|
42
46
|
export function buildContext(input, cwd = process.cwd()) {
|
|
43
47
|
requireRepo(cwd);
|
|
44
|
-
if (!input) return compose('core', ['core']);
|
|
48
|
+
if (!input) return compose('core', ['core'], undefined, false);
|
|
45
49
|
if (MODES.includes(input)) return compose(input, MODE_CONTEXT[input]);
|
|
46
50
|
|
|
47
51
|
let resolved;
|
package/src/contract.mjs
CHANGED
|
@@ -37,7 +37,8 @@ const LEGACY_CONTRACT_HASHES = new Set([
|
|
|
37
37
|
export const REFERENCE = `${MARKER}
|
|
38
38
|
> [!IMPORTANT]
|
|
39
39
|
> This repo uses **ChangeLedger**. Before creating or modifying files, run
|
|
40
|
-
> \`changeledger context
|
|
40
|
+
> \`changeledger context\` directly, read its complete output, and follow it.
|
|
41
|
+
> Do not pipe, filter, summarize, limit, or truncate the output before reading it.
|
|
41
42
|
> If the output is truncated/incomplete, stop and restore complete context before
|
|
42
43
|
> proceeding. If the command is unavailable, stop and restore/install
|
|
43
44
|
> ChangeLedger; do not proceed from memory.
|
|
@@ -5,9 +5,12 @@ reflection. Work is planned and documented before code is written.
|
|
|
5
5
|
|
|
6
6
|
## Non-negotiable fast path
|
|
7
7
|
|
|
8
|
-
Running `changeledger context` is discovery, not compliance by itself.
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Running `changeledger context` is discovery, not compliance by itself. Run it
|
|
9
|
+
directly, without piping, filtering, summarizing, limiting or truncating output
|
|
10
|
+
before reading it. Read the complete output and follow the current mode. If the
|
|
11
|
+
output is truncated or incomplete, including through tools such as `head`,
|
|
12
|
+
`tail`, `sed` or `grep`, stop and restore complete context before creating or
|
|
13
|
+
modifying files.
|
|
11
14
|
|
|
12
15
|
1. Work starts with conversation. Read-only investigation may clarify a request,
|
|
13
16
|
but create no change or implementation artifact until there is enough clarity
|
|
@@ -63,6 +66,9 @@ never reopen.
|
|
|
63
66
|
|
|
64
67
|
Valid modes: implement, review, spec, release.
|
|
65
68
|
|
|
69
|
+
Run these only after reading the complete base output. Each mode and change-id
|
|
70
|
+
context extends the core context already read without repeating it.
|
|
71
|
+
|
|
66
72
|
- `changeledger context spec`: author or refine a change.
|
|
67
73
|
- `changeledger context implement`: execute an approved change.
|
|
68
74
|
- `changeledger context review`: independently verify completed work.
|