waypoint-codex 0.10.10 → 0.10.11

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 CHANGED
@@ -37,7 +37,7 @@ The philosophy is simple:
37
37
  - more markdown
38
38
  - better continuity for the next agent
39
39
 
40
- By default, Waypoint appends a `.gitignore` snippet that ignores the exact Waypoint-created skill directories and reviewer-agent config files, plus everything under `.waypoint/` except `.waypoint/docs/`, while still ignoring the scaffolded `.waypoint/docs/README.md` and `.waypoint/docs/code-guide.md` assets. User-authored durable docs stay trackable; workspace, context, indexes, and other operational state remain local.
40
+ By default, Waypoint keeps its `.gitignore` rules inside a comment-delimited `# Waypoint state` section. That section ignores the exact Waypoint-created skill directories and reviewer-agent config files, plus everything under `.waypoint/` except `.waypoint/docs/`, while still ignoring the scaffolded `.waypoint/docs/README.md` and `.waypoint/docs/code-guide.md` assets. User-authored durable docs stay trackable; workspace, context, indexes, and other operational state remain local.
41
41
 
42
42
  ## Best fit
43
43
 
package/dist/src/core.js CHANGED
@@ -10,6 +10,42 @@ const DEFAULT_DOCS_INDEX = ".waypoint/DOCS_INDEX.md";
10
10
  const DEFAULT_TRACK_DIR = ".waypoint/track";
11
11
  const DEFAULT_TRACKS_INDEX = ".waypoint/TRACKS_INDEX.md";
12
12
  const DEFAULT_WORKSPACE = ".waypoint/WORKSPACE.md";
13
+ const GITIGNORE_WAYPOINT_START = "# Waypoint state";
14
+ const GITIGNORE_WAYPOINT_END = "# End Waypoint state";
15
+ const LEGACY_WAYPOINT_GITIGNORE_RULES = new Set([
16
+ ".codex/",
17
+ ".codex/config.toml",
18
+ ".codex/agents/",
19
+ ".codex/agents/code-reviewer.toml",
20
+ ".codex/agents/code-health-reviewer.toml",
21
+ ".codex/agents/plan-reviewer.toml",
22
+ ".agents/",
23
+ ".agents/skills/",
24
+ ".agents/skills/planning/",
25
+ ".agents/skills/work-tracker/",
26
+ ".agents/skills/docs-sync/",
27
+ ".agents/skills/code-guide-audit/",
28
+ ".agents/skills/adversarial-review/",
29
+ ".agents/skills/visual-explanations/",
30
+ ".agents/skills/break-it-qa/",
31
+ ".agents/skills/frontend-context-interview/",
32
+ ".agents/skills/backend-context-interview/",
33
+ ".agents/skills/frontend-ship-audit/",
34
+ ".agents/skills/backend-ship-audit/",
35
+ ".agents/skills/conversation-retrospective/",
36
+ ".agents/skills/workspace-compress/",
37
+ ".agents/skills/pre-pr-hygiene/",
38
+ ".agents/skills/pr-review/",
39
+ ".waypoint/",
40
+ ".waypoint/DOCS_INDEX.md",
41
+ ".waypoint/state/",
42
+ ".waypoint/context/",
43
+ ".waypoint/*",
44
+ "!.waypoint/docs/",
45
+ "!.waypoint/docs/**",
46
+ ".waypoint/docs/README.md",
47
+ ".waypoint/docs/code-guide.md",
48
+ ]);
13
49
  const SHIPPED_SKILL_NAMES = [
14
50
  "planning",
15
51
  "work-tracker",
@@ -74,7 +110,8 @@ function appendGitignoreSnippet(projectRoot) {
74
110
  const content = readFileSync(gitignorePath, "utf8");
75
111
  const normalizedLines = content.split(/\r?\n/);
76
112
  const normalizedContent = normalizedLines.join("\n");
77
- if (normalizedContent.includes(snippet)) {
113
+ const headerCount = normalizedLines.filter((line) => line === GITIGNORE_WAYPOINT_START).length;
114
+ if (normalizedContent.includes(snippet) && headerCount <= 1) {
78
115
  return;
79
116
  }
80
117
  const startIndex = normalizedLines.findIndex((line) => line === snippetLines[0]);
@@ -83,31 +120,97 @@ function appendGitignoreSnippet(projectRoot) {
83
120
  return;
84
121
  }
85
122
  const managedLineSet = new Set(snippetLines);
86
- const managedEndLine = snippetLines[snippetLines.length - 1];
87
- let endIndex = normalizedLines.findIndex((line, index) => index >= startIndex && line === managedEndLine);
123
+ const endIndex = findWaypointGitignoreBlockEnd(normalizedLines, startIndex);
88
124
  if (endIndex === -1) {
89
125
  writeText(gitignorePath, `${content.trimEnd()}\n\n${snippet}\n`);
90
126
  return;
91
127
  }
92
128
  const hasForeignLineInsideBlock = normalizedLines
93
129
  .slice(startIndex + 1, endIndex)
94
- .some((line) => line.length > 0 && !managedLineSet.has(line));
130
+ .some((line) => line.length > 0 && !isManagedWaypointGitignoreLine(line, managedLineSet));
131
+ const trailingLines = stripSubsequentWaypointGitignoreBlocks(normalizedLines.slice(endIndex + 1), managedLineSet);
95
132
  if (hasForeignLineInsideBlock) {
96
133
  const foreignLines = normalizedLines
97
134
  .slice(startIndex + 1, endIndex)
98
- .filter((line) => line.length > 0 && !managedLineSet.has(line))
135
+ .filter((line) => line.length > 0 && !isManagedWaypointGitignoreLine(line, managedLineSet))
99
136
  .join("\n");
100
137
  const before = normalizedLines.slice(0, startIndex).join("\n").trimEnd();
101
- const after = normalizedLines.slice(endIndex + 1).join("\n").trimStart();
138
+ const after = trailingLines.join("\n").trimStart();
102
139
  const merged = [before, snippet, foreignLines, after].filter((piece) => piece.length > 0).join("\n\n");
103
140
  writeText(gitignorePath, `${merged}\n`);
104
141
  return;
105
142
  }
106
143
  const before = normalizedLines.slice(0, startIndex).join("\n").trimEnd();
107
- const after = normalizedLines.slice(endIndex + 1).join("\n").trimStart();
144
+ const after = trailingLines.join("\n").trimStart();
108
145
  const merged = [before, snippet, after].filter((piece) => piece.length > 0).join("\n\n");
109
146
  writeText(gitignorePath, `${merged}\n`);
110
147
  }
148
+ function findWaypointGitignoreBlockEnd(lines, startIndex) {
149
+ const explicitEndIndex = lines.findIndex((line, index) => index > startIndex && line === GITIGNORE_WAYPOINT_END);
150
+ if (explicitEndIndex !== -1) {
151
+ return explicitEndIndex;
152
+ }
153
+ return findLegacyWaypointGitignoreBlockEnd(lines, startIndex);
154
+ }
155
+ function findLegacyWaypointGitignoreBlockEnd(lines, startIndex) {
156
+ let scanEndExclusive = lines.length;
157
+ for (let index = startIndex + 1; index < lines.length; index += 1) {
158
+ const line = lines[index];
159
+ if (line.length === 0) {
160
+ scanEndExclusive = index;
161
+ break;
162
+ }
163
+ if (line.startsWith("#") && line !== GITIGNORE_WAYPOINT_START) {
164
+ scanEndExclusive = index;
165
+ break;
166
+ }
167
+ }
168
+ let endIndex = -1;
169
+ for (let index = startIndex + 1; index < scanEndExclusive; index += 1) {
170
+ if (isLegacyWaypointGitignoreRule(lines[index])) {
171
+ endIndex = index;
172
+ }
173
+ }
174
+ return endIndex;
175
+ }
176
+ function isLegacyWaypointGitignoreRule(line) {
177
+ const normalizedLine = line.startsWith("/") ? line.slice(1) : line;
178
+ return LEGACY_WAYPOINT_GITIGNORE_RULES.has(normalizedLine);
179
+ }
180
+ function isManagedWaypointGitignoreLine(line, managedLineSet) {
181
+ return managedLineSet.has(line) || isLegacyWaypointGitignoreRule(line);
182
+ }
183
+ function stripSubsequentWaypointGitignoreBlocks(lines, managedLineSet) {
184
+ const keptLines = [];
185
+ let index = 0;
186
+ while (index < lines.length) {
187
+ if (lines[index] !== GITIGNORE_WAYPOINT_START) {
188
+ keptLines.push(lines[index]);
189
+ index += 1;
190
+ continue;
191
+ }
192
+ const endIndex = findWaypointGitignoreBlockEnd(lines, index);
193
+ if (endIndex === -1) {
194
+ keptLines.push(lines[index]);
195
+ index += 1;
196
+ continue;
197
+ }
198
+ const foreignLines = lines
199
+ .slice(index + 1, endIndex)
200
+ .filter((line) => line.length > 0 && !isManagedWaypointGitignoreLine(line, managedLineSet));
201
+ if (foreignLines.length > 0) {
202
+ if (keptLines.length > 0 && keptLines[keptLines.length - 1] !== "") {
203
+ keptLines.push("");
204
+ }
205
+ keptLines.push(...foreignLines);
206
+ if (endIndex + 1 < lines.length && lines[endIndex + 1] !== "") {
207
+ keptLines.push("");
208
+ }
209
+ }
210
+ index = endIndex + 1;
211
+ }
212
+ return keptLines;
213
+ }
111
214
  function upsertManagedBlock(filePath, block) {
112
215
  if (!existsSync(filePath)) {
113
216
  writeText(filePath, `${block.trim()}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waypoint-codex",
3
- "version": "0.10.10",
3
+ "version": "0.10.11",
4
4
  "description": "Codex-native repository operating system: scaffolding, docs routing, repo-local skills, doctor, and sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,3 +23,4 @@
23
23
  !.waypoint/docs/**
24
24
  .waypoint/docs/README.md
25
25
  .waypoint/docs/code-guide.md
26
+ # End Waypoint state