changeledger 0.6.0 → 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 CHANGED
@@ -6,8 +6,11 @@ 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` (or `changeledger context <change-id>`) and follow its output.
10
- > If the command is unavailable, stop and restore/install ChangeLedger; do not proceed from memory.
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.
11
+ > If the output is truncated/incomplete, stop and restore complete context before
12
+ > proceeding. If the command is unavailable, stop and restore/install
13
+ > ChangeLedger; do not proceed from memory.
11
14
 
12
15
  The canonical ChangeLedger contract is split into task-focused fragments under
13
16
  [`templates/contract/`](templates/contract/). The deterministic
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "changeledger",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Turn conversations into buildable changes.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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: ['core', 'implement', 'readiness'],
11
- review: ['core', 'review'],
12
- spec: ['core', 'spec', 'readiness'],
13
- release: ['core', '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: ['core', 'review'] },
20
- blocked: { mode: 'blocked', fragments: ['core', 'blocked'] },
21
- 'in-validation': { mode: 'validation', fragments: ['core', 'validation'] },
22
- done: { mode: 'close', fragments: ['core', 'close'] },
23
- discarded: { mode: 'discarded', fragments: ['core', 'discarded'] },
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}`, ...fragments.map(fragment)];
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,8 +37,11 @@ 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\` (or \`changeledger context <change-id>\`) and follow its output.
41
- > If the command is unavailable, stop and restore/install ChangeLedger; do not proceed from memory.
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.
42
+ > If the output is truncated/incomplete, stop and restore complete context before
43
+ > proceeding. If the command is unavailable, stop and restore/install
44
+ > ChangeLedger; do not proceed from memory.
42
45
  `;
43
46
 
44
47
  export const contractLink = (changeledgerDir) => path.join(changeledgerDir, 'AGENTS.md');
@@ -5,6 +5,13 @@ 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. 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.
14
+
8
15
  1. Work starts with conversation. Read-only investigation may clarify a request,
9
16
  but create no change or implementation artifact until there is enough clarity
10
17
  to document faithfully **and** the human explicitly authorizes documentation. A direct request such
@@ -22,6 +29,11 @@ reflection. Work is planned and documented before code is written.
22
29
  8. After human acceptance, graduate persistent truth or record an explicit skip,
23
30
  then archive the done change.
24
31
 
32
+ If no approved or in-progress change applies, do not silently edit repository
33
+ files. Create or update a change, or ask the human whether a purely operational,
34
+ reversible edit with no persistent truth or observable behavior change should be
35
+ done directly. If unsure, document it in ChangeLedger.
36
+
25
37
  Humans consume changes in `changeledger view`; write for the rendered view.
26
38
 
27
39
  ## Lifecycle
@@ -54,6 +66,9 @@ never reopen.
54
66
 
55
67
  Valid modes: implement, review, spec, release.
56
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
+
57
72
  - `changeledger context spec`: author or refine a change.
58
73
  - `changeledger context implement`: execute an approved change.
59
74
  - `changeledger context review`: independently verify completed work.