first-tree 0.0.6 → 0.0.8

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.
Files changed (43) hide show
  1. package/README.md +16 -5
  2. package/dist/bootstrap-YRjfHJp7.js +28 -0
  3. package/dist/cli.js +14 -5
  4. package/dist/{help-DV9-AaFp.js → help-CDfaFrzl.js} +1 -1
  5. package/dist/{init-BgGH2_yC.js → init-DjSVkUeR.js} +19 -8
  6. package/dist/onboarding-BiHx2jy5.js +10 -0
  7. package/dist/onboarding-Ce033qaW.js +2 -0
  8. package/dist/publish-D0crNDjz.js +504 -0
  9. package/dist/{repo-Cc5U4DWT.js → repo-BeVpMoHi.js} +2 -15
  10. package/dist/{source-integration-CuKjoheT.js → source-integration-DMxnl8Dw.js} +2 -6
  11. package/dist/{upgrade-BvA9oKmi.js → upgrade-B_NTlNrx.js} +2 -4
  12. package/dist/{verify-G8gNXzDX.js → verify-Chhm1vOF.js} +3 -3
  13. package/package.json +1 -1
  14. package/skills/first-tree/SKILL.md +25 -6
  15. package/skills/first-tree/agents/openai.yaml +1 -1
  16. package/skills/first-tree/assets/framework/VERSION +1 -1
  17. package/skills/first-tree/engine/commands/publish.ts +5 -0
  18. package/skills/first-tree/engine/init.ts +24 -6
  19. package/skills/first-tree/engine/publish.ts +807 -0
  20. package/skills/first-tree/engine/repo.ts +0 -8
  21. package/skills/first-tree/engine/runtime/adapters.ts +0 -2
  22. package/skills/first-tree/engine/runtime/asset-loader.ts +1 -36
  23. package/skills/first-tree/engine/runtime/bootstrap.ts +40 -0
  24. package/skills/first-tree/engine/runtime/installer.ts +0 -2
  25. package/skills/first-tree/engine/upgrade.ts +0 -11
  26. package/skills/first-tree/engine/validators/nodes.ts +2 -11
  27. package/skills/first-tree/references/maintainer-build-and-distribution.md +3 -0
  28. package/skills/first-tree/references/maintainer-thin-cli.md +1 -1
  29. package/skills/first-tree/references/onboarding.md +18 -12
  30. package/skills/first-tree/references/source-map.md +3 -1
  31. package/skills/first-tree/references/source-workspace-installation.md +25 -13
  32. package/skills/first-tree/references/upgrade-contract.md +15 -8
  33. package/skills/first-tree/scripts/check-skill-sync.sh +0 -1
  34. package/skills/first-tree/tests/asset-loader.test.ts +0 -24
  35. package/skills/first-tree/tests/helpers.ts +0 -14
  36. package/skills/first-tree/tests/init.test.ts +25 -0
  37. package/skills/first-tree/tests/publish.test.ts +248 -0
  38. package/skills/first-tree/tests/repo.test.ts +0 -25
  39. package/skills/first-tree/tests/skill-artifacts.test.ts +16 -1
  40. package/skills/first-tree/tests/thin-cli.test.ts +6 -0
  41. package/skills/first-tree/tests/upgrade.test.ts +0 -21
  42. package/dist/onboarding-D7fGGOMN.js +0 -10
  43. package/dist/onboarding-lASHHmgO.js +0 -2
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: first-tree
3
- description: Maintain the canonical `first-tree` skill and the thin `context-tree` CLI distributed by the `first-tree` npm package. Use when modifying `context-tree` commands (`init`, `verify`, `upgrade`, `help onboarding`), the installed skill payload under `assets/framework/`, maintainer references, or the build, packaging, test, and CI wiring that supports the framework.
3
+ description: Maintain the canonical `first-tree` skill and the thin `context-tree` CLI distributed by the `first-tree` npm package. Use when modifying `context-tree` commands (`init`, `publish`, `verify`, `upgrade`, `help onboarding`), the installed skill payload under `assets/framework/`, maintainer references, or the build, packaging, test, and CI wiring that supports the framework.
4
4
  ---
5
5
 
6
6
  # First Tree
@@ -59,6 +59,10 @@ repos.
59
59
 
60
60
  ### Working In A User Tree Repo
61
61
 
62
+ - When the task is to "install and use first-tree" in an existing
63
+ source/workspace repo, start with
64
+ `references/source-workspace-installation.md` and follow that workflow
65
+ end-to-end before improvising.
62
66
  - When a user asks to install first-tree for an existing source/workspace repo,
63
67
  the current repo keeps only the installed skill plus a
64
68
  `FIRST-TREE-SOURCE-INTEGRATION:` line in `AGENTS.md` and `CLAUDE.md`. Do not
@@ -68,20 +72,35 @@ repos.
68
72
  into the source/workspace repo and scaffolds tree files only in the
69
73
  dedicated tree repo. Use `--here` to initialize the current repo in place
70
74
  when you are already inside the tree repo.
75
+ - `context-tree publish --open-pr` is the default second-stage command after
76
+ `init` for source/workspace installs. Run it from the dedicated tree repo
77
+ once the initial tree version is ready to push.
78
+ - Never run `context-tree init --here` in a source/workspace repo unless the
79
+ user explicitly wants that repo itself to become the dedicated Context Tree.
80
+ `--here` is for when you have already switched into the `*-context` repo.
71
81
  - `context-tree init` installs this skill into the target tree repo and
72
82
  scaffolds `.agents/skills/first-tree/`, `.claude/skills/first-tree/`,
73
83
  `NODE.md`, `AGENTS.md`, and `members/NODE.md`.
74
- - The default source/workspace workflow is: create or reuse `<repo>-context`,
75
- prefer pushing it in the same GitHub organization as the source repo, add it
76
- back to the source/workspace repo as a git submodule, and open a PR to the
77
- source/workspace repo's default branch instead of merging automatically.
84
+ - The default source/workspace workflow is: run `context-tree init` from the
85
+ source repo, draft the first tree version in `<repo>-context`, then run
86
+ `context-tree publish --open-pr` from that dedicated tree repo.
87
+ - After `context-tree publish` succeeds, treat the source/workspace repo's
88
+ submodule checkout as the canonical local working copy for the tree. The
89
+ temporary sibling bootstrap checkout can be deleted when you no longer need
90
+ it.
91
+ - If the dedicated tree repo was initialized manually with `context-tree init --here`
92
+ and does not have bootstrap metadata yet, pass `--source-repo PATH` to
93
+ `context-tree publish`.
94
+ - If permissions, auth, or local filesystem constraints block the dedicated
95
+ repo workflow, stop and report the blocker. Do not fall back to in-place tree
96
+ bootstrap in the source/workspace repo.
78
97
  - `context-tree upgrade` refreshes the installed skill from the copy bundled
79
98
  with the currently running `first-tree` package. In a source/workspace repo
80
99
  it refreshes only the local skill plus the
81
100
  `FIRST-TREE-SOURCE-INTEGRATION:` line; upgrade the dedicated tree repo
82
101
  separately with `--tree-path`. To pick up a newer framework, run a newer
83
102
  package version first. It also migrates older repos that still use
84
- `skills/first-tree/` or `skills/first-tree-cli-framework/`.
103
+ `skills/first-tree/`.
85
104
  - The user's tree content lives outside the skill; the skill only carries the
86
105
  reusable framework payload plus maintenance guidance.
87
106
  - The tree still stores decisions, constraints, and ownership; execution detail
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "First Tree"
3
3
  short_description: "Maintain the First Tree skill and thin Context Tree CLI"
4
- default_prompt: "Use $first-tree to maintain the canonical first-tree skill, its thin context-tree CLI, or its build, packaging, test, eval, and CI wiring. When a source/workspace repo installs first-tree, keep that repo limited to local skill integration plus the FIRST-TREE-SOURCE-INTEGRATION marker lines, and keep all NODE.md/tree content only in a dedicated sibling *-context repo."
4
+ default_prompt: "Use $first-tree to maintain the canonical first-tree skill, its thin context-tree CLI, or its build, packaging, test, eval, and CI wiring. When a source/workspace repo installs first-tree, read references/source-workspace-installation.md first, keep that repo limited to local skill integration plus the FIRST-TREE-SOURCE-INTEGRATION marker lines, and keep all NODE.md/tree content only in a dedicated sibling *-context repo. Never choose context-tree init --here in the source/workspace repo unless the user explicitly wants that repo itself to become the tree."
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.2
@@ -0,0 +1,5 @@
1
+ export {
2
+ PUBLISH_USAGE,
3
+ parsePublishArgs,
4
+ runPublishCli as runPublish,
5
+ } from "#skill/engine/publish.js";
@@ -16,6 +16,7 @@ import {
16
16
  renderTemplateFile,
17
17
  resolveBundledPackageRoot,
18
18
  } from "#skill/engine/runtime/installer.js";
19
+ import { writeBootstrapState } from "#skill/engine/runtime/bootstrap.js";
19
20
  import {
20
21
  AGENT_INSTRUCTIONS_FILE,
21
22
  AGENT_INSTRUCTIONS_TEMPLATE,
@@ -42,8 +43,11 @@ the first-tree skill in the current repo, updates \`AGENTS.md\` and \`CLAUDE.md\
42
43
  with a \`${SOURCE_INTEGRATION_MARKER}\` line, and creates a sibling dedicated tree
43
44
  repo named \`<repo>-context\`.
44
45
 
46
+ Do not use \`--here\` inside a source/workspace repo unless you explicitly want
47
+ that repo itself to become the Context Tree.
48
+
45
49
  Options:
46
- --here Initialize the current repo in place
50
+ --here Initialize the current repo in place after you are already in the dedicated tree repo
47
51
  --tree-name NAME Name the dedicated sibling tree repo to create
48
52
  --tree-path PATH Use an explicit tree repo path
49
53
  --help Show this help message
@@ -119,13 +123,10 @@ export function formatTaskList(
119
123
  );
120
124
  lines.push("## Source Workspace Workflow");
121
125
  lines.push(
122
- `- [ ] Publish this dedicated tree repo to the same GitHub organization as \`${context.sourceRepoName}\``,
123
- );
124
- lines.push(
125
- `- [ ] Add this tree repo back to \`${context.sourceRepoName}\` as a git submodule after the remote exists`,
126
+ `- [ ] When this initial tree version is ready, run \`context-tree publish --open-pr\` from this dedicated tree repo. It will create or reuse the GitHub \`*-context\` repo, add it back to \`${context.sourceRepoName}\` as a git submodule, and open the source/workspace PR.`,
126
127
  );
127
128
  lines.push(
128
- `- [ ] Open a PR against the source/workspace repo's default branch with only the installed skill, the \`${SOURCE_INTEGRATION_MARKER}\` marker lines in \`${AGENT_INSTRUCTIONS_FILE}\` / \`${CLAUDE_INSTRUCTIONS_FILE}\`, and the new submodule pointer`,
129
+ `- [ ] After publish succeeds, treat the source/workspace repo's \`${context.sourceRepoName}\` submodule checkout as the canonical local working copy for this tree. The temporary sibling bootstrap repo can be deleted when you no longer need it.`,
129
130
  );
130
131
  lines.push("");
131
132
  }
@@ -202,6 +203,15 @@ export function runInit(repo?: Repo, options?: InitOptions): number {
202
203
  return 1;
203
204
  }
204
205
  const r = initTarget.repo;
206
+ if (options?.here && sourceRepo.isLikelySourceRepo() && !sourceRepo.looksLikeTreeRepo()) {
207
+ console.log(
208
+ "Warning: `context-tree init --here` is initializing this source/workspace" +
209
+ " repo in place. This will create `NODE.md`, `members/`, and tree-scoped" +
210
+ ` ${AGENT_INSTRUCTIONS_FILE} here. Use plain \`context-tree init\` to create` +
211
+ " a sibling dedicated tree repo instead.",
212
+ );
213
+ console.log();
214
+ }
205
215
  const taskListContext = initTarget.dedicatedTreeRepo
206
216
  ? {
207
217
  dedicatedTreeRepo: true,
@@ -287,6 +297,14 @@ export function runInit(repo?: Repo, options?: InitOptions): number {
287
297
  }
288
298
  }
289
299
 
300
+ if (initTarget.dedicatedTreeRepo) {
301
+ writeBootstrapState(r.root, {
302
+ sourceRepoName: sourceRepo.repoName(),
303
+ sourceRepoPath: relativePathFrom(r.root, sourceRepo.root),
304
+ treeRepoName: r.repoName(),
305
+ });
306
+ }
307
+
290
308
  console.log(ONBOARDING_TEXT);
291
309
  console.log("---\n");
292
310