alignfirst 0.6.0-preview.1 → 0.7.0-preview.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 CHANGED
@@ -81,6 +81,12 @@ Use your alignfirst-setup-guide skill. What AlignFirst tooling could we add in t
81
81
 
82
82
  The guide installs the selected components and configures the repository. You can remove the setup-guide skill once setup is complete.
83
83
 
84
+ To leave the repository untouched, the guide keeps the project's AlignFirst files in a [companion directory](#companion-directories):
85
+
86
+ ```text
87
+ Use your alignfirst-setup-guide skill. Set up AlignFirst in this project without touching the repository.
88
+ ```
89
+
84
90
  ## CLI commands
85
91
 
86
92
  - `guide` — Print an AlignFirst protocol.
@@ -101,11 +107,10 @@ Run `alignfirst --help` for command usage or `alignfirst guide` to choose a prot
101
107
 
102
108
  ## Companion directories
103
109
 
104
- A companion directory holds a project's AlignFirst files outside its repository, so the repository stays untouched. `~/.config/alignfirst/companions.json` declares which projects have one:
110
+ A companion directory holds a project's AlignFirst files outside its repository, so the repository stays untouched. `~/.alignfirst/companions.json` declares which projects have one:
105
111
 
106
112
  ```json
107
113
  {
108
- "root": "~/alignfirst-companions",
109
114
  "paths": {
110
115
  "~/projects/team-app": { ".plans": false, "_aligndev": true },
111
116
  "~/projects/client-api": {},
@@ -114,7 +119,6 @@ A companion directory holds a project's AlignFirst files outside its repository,
114
119
  }
115
120
  ```
116
121
 
117
- - `root` — the directory that holds the companion directories: an absolute path or a `~/` path.
118
122
  - `paths` — the projects, by absolute or `~/` path. Each value sets flags for the items a companion can hold: `.alignfirst.json`, `.alignfirst.md`, `DEVELOPERS.md`, `docs`, `.plans` and `_aligndev`. A flag is `true`, `false` or `"auto"`.
119
123
 
120
124
  An absent file means no project has a companion. An invalid file makes every command fail; `doctor` reports it and continues.
@@ -123,7 +127,7 @@ An absent file means no project has a companion. An invalid file makes every com
123
127
 
124
128
  A key matches a project when it names the project's main worktree or one of its ancestors, so every worktree of a project shares one companion. `"~": {}` matches every project under the home directory. For each item, the longest matching key that sets the flag wins, and an unset flag is `"auto"`. A bare repository or a directory outside git has no companion.
125
129
 
126
- The companion directory is `<root>/<name>`. The name is the main worktree path relative to the home directory, or the absolute path without its leading `/` outside it, with every `/` replaced by `_`. For example, `~/projects/client-api` gets `<root>/projects_client-api/`.
130
+ The companion directory is `~/.alignfirst/companions/<name>`. The name is the main worktree path relative to the home directory, or the absolute path without its leading `/` outside it, with every `/` replaced by `_`. For example, `~/projects/client-api` gets `~/.alignfirst/companions/projects_client-api/`. To keep the companions elsewhere, make `~/.alignfirst/companions` a symlink.
127
131
 
128
132
  ### Resolution
129
133
 
@@ -146,7 +150,7 @@ The companion directory is `<root>/<name>`. The name is the main worktree path r
146
150
  An agent reads a repository's `AGENTS.md` on its own, but never a companion. When your repositories carry no AlignFirst instructions, add this line to your global agent instructions (`~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or the equivalent):
147
151
 
148
152
  ```text
149
- In a git repository, run `alignfirst context` once before investigating, unless the project's instructions already say so.
153
+ In a git repository, run `alignfirst context` as your first command, whatever the task, unless the project's instructions already say so.
150
154
  ```
151
155
 
152
156
  ## Upgrade from v1, v2, or v3
@@ -12,6 +12,8 @@ export const ITEM_NAMES = [
12
12
  ".plans",
13
13
  "_aligndev",
14
14
  ];
15
+ // The directory holding the companions. A symlink there moves them elsewhere.
16
+ const COMPANIONS_ROOT = "~/.alignfirst/companions";
15
17
  const FLAG = "boolean | 'auto'";
16
18
  const flagsSchema = type({
17
19
  "+": "reject",
@@ -24,7 +26,6 @@ const flagsSchema = type({
24
26
  });
25
27
  const companionsSchema = type({
26
28
  "+": "reject",
27
- root: "string > 0",
28
29
  paths: type.Record("string", flagsSchema),
29
30
  });
30
31
  export function layoutOf(ctx) {
@@ -48,7 +49,7 @@ function resolveCompanion(cwd, home) {
48
49
  return null;
49
50
  const flags = mergeFlags(matches);
50
51
  assertValidFlags(file, flags, matches);
51
- const dir = join(normalizePath(file.root, realHome), companionName(mainWorktree, realHome));
52
+ const dir = join(normalizePath(COMPANIONS_ROOT, realHome), companionName(mainWorktree, realHome));
52
53
  return { dir, exists: pathExists(dir), entries: matches.map((match) => match.key), flags };
53
54
  }
54
55
  function readCompanionsFile(home) {
@@ -65,15 +66,13 @@ function readCompanionsFile(home) {
65
66
  const file = companionsSchema(value);
66
67
  if (file instanceof type.errors)
67
68
  throw invalidCompanions(path, file.summary.split("\n", 1)[0]);
68
- if (!isUserPath(file.root))
69
- throw invalidCompanions(path, `root must be an absolute path or start with ~/: ${file.root}`);
70
69
  const badKey = Object.keys(file.paths).find((key) => !isUserPath(key));
71
70
  if (badKey !== undefined)
72
71
  throw invalidCompanions(path, `paths key must be an absolute path or start with ~/: ${badKey}`);
73
- return { path, root: file.root, paths: file.paths };
72
+ return { path, paths: file.paths };
74
73
  }
75
74
  export function companionsPath(home) {
76
- return join(home, ".config", "alignfirst", "companions.json");
75
+ return join(home, ".alignfirst", "companions.json");
77
76
  }
78
77
  function invalidCompanions(path, detail) {
79
78
  return new CliError(`Invalid ${path}: ${detail}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alignfirst",
3
- "version": "0.6.0-preview.1",
3
+ "version": "0.7.0-preview.0",
4
4
  "license": "CC0-1.0",
5
5
  "author": "Thomas MUR",
6
6
  "description": "The AlignFirst CLI: protocols, work files and docs in one command.",