first-tree 0.0.3 → 0.0.5

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 (59) hide show
  1. package/README.md +78 -27
  2. package/dist/cli.js +28 -13
  3. package/dist/{help-xEI-s9iN.js → help-5-WG9QFm.js} +1 -1
  4. package/dist/{init-DtOjj0wc.js → init-CAq0Uhq6.js} +187 -25
  5. package/dist/{installer-rcZpGLnM.js → installer-UgNasLjl.js} +20 -16
  6. package/dist/onboarding-3zYUeYQb.js +2 -0
  7. package/dist/onboarding-Dd63N-V1.js +10 -0
  8. package/dist/repo-DkR12VUv.js +369 -0
  9. package/dist/upgrade-DYzuvv1k.js +140 -0
  10. package/dist/{verify-CxN6JiV9.js → verify-C0IUSkMZ.js} +66 -6
  11. package/package.json +12 -10
  12. package/skills/first-tree/SKILL.md +18 -10
  13. package/skills/first-tree/assets/framework/VERSION +1 -1
  14. package/skills/first-tree/assets/framework/examples/claude-code/README.md +2 -2
  15. package/skills/first-tree/assets/framework/examples/claude-code/settings.json +1 -1
  16. package/skills/first-tree/assets/framework/helpers/generate-codeowners.ts +1 -1
  17. package/skills/first-tree/assets/framework/helpers/inject-tree-context.sh +0 -0
  18. package/skills/first-tree/assets/framework/helpers/run-review.ts +17 -3
  19. package/skills/first-tree/assets/framework/templates/{agent.md.template → agents.md.template} +3 -2
  20. package/skills/first-tree/assets/framework/templates/members-domain.md.template +1 -1
  21. package/skills/first-tree/assets/framework/templates/root-node.md.template +9 -6
  22. package/skills/first-tree/assets/framework/workflows/codeowners.yml +1 -1
  23. package/skills/first-tree/assets/framework/workflows/pr-review.yml +1 -1
  24. package/skills/first-tree/engine/commands/init.ts +1 -1
  25. package/skills/first-tree/engine/commands/upgrade.ts +1 -1
  26. package/skills/first-tree/engine/commands/verify.ts +1 -1
  27. package/skills/first-tree/engine/init.ts +288 -18
  28. package/skills/first-tree/engine/repo.ts +220 -11
  29. package/skills/first-tree/engine/rules/agent-instructions.ts +29 -7
  30. package/skills/first-tree/engine/rules/agent-integration.ts +3 -1
  31. package/skills/first-tree/engine/rules/framework.ts +2 -2
  32. package/skills/first-tree/engine/runtime/adapters.ts +6 -2
  33. package/skills/first-tree/engine/runtime/asset-loader.ts +143 -4
  34. package/skills/first-tree/engine/runtime/installer.ts +18 -12
  35. package/skills/first-tree/engine/upgrade.ts +99 -15
  36. package/skills/first-tree/engine/validators/nodes.ts +48 -3
  37. package/skills/first-tree/engine/verify.ts +61 -3
  38. package/skills/first-tree/references/maintainer-architecture.md +1 -1
  39. package/skills/first-tree/references/maintainer-build-and-distribution.md +3 -0
  40. package/skills/first-tree/references/maintainer-thin-cli.md +1 -1
  41. package/skills/first-tree/references/onboarding.md +57 -24
  42. package/skills/first-tree/references/source-map.md +3 -3
  43. package/skills/first-tree/references/upgrade-contract.md +62 -27
  44. package/skills/first-tree/scripts/check-skill-sync.sh +1 -1
  45. package/skills/first-tree/scripts/quick_validate.py +0 -0
  46. package/skills/first-tree/scripts/run-local-cli.sh +0 -0
  47. package/skills/first-tree/tests/asset-loader.test.ts +23 -1
  48. package/skills/first-tree/tests/helpers.ts +51 -7
  49. package/skills/first-tree/tests/init.test.ts +113 -8
  50. package/skills/first-tree/tests/repo.test.ts +113 -9
  51. package/skills/first-tree/tests/rules.test.ts +35 -14
  52. package/skills/first-tree/tests/skill-artifacts.test.ts +10 -0
  53. package/skills/first-tree/tests/thin-cli.test.ts +52 -7
  54. package/skills/first-tree/tests/upgrade.test.ts +39 -6
  55. package/skills/first-tree/tests/verify.test.ts +109 -10
  56. package/dist/onboarding-6Fr5Gkrk.js +0 -2
  57. package/dist/onboarding-B9zPGvvG.js +0 -10
  58. package/dist/repo-BTJG8BU1.js +0 -187
  59. package/dist/upgrade-COGgI7Rj.js +0 -96
@@ -1,96 +0,0 @@
1
- import { a as FRAMEWORK_TEMPLATES_DIR, c as INSTALLED_PROGRESS, d as SKILL_ROOT, l as LEGACY_FRAMEWORK_ROOT, n as Repo, o as FRAMEWORK_VERSION, s as FRAMEWORK_WORKFLOWS_DIR, u as LEGACY_SKILL_ROOT } from "./repo-BTJG8BU1.js";
2
- import { i as resolveCanonicalSkillRoot, r as resolveBundledPackageRoot, t as copyCanonicalSkill } from "./installer-rcZpGLnM.js";
3
- import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
- import { dirname, join } from "node:path";
5
- //#region skills/first-tree/engine/runtime/upgrader.ts
6
- function compareFrameworkVersions(left, right) {
7
- const result = left.localeCompare(right, void 0, {
8
- numeric: true,
9
- sensitivity: "base"
10
- });
11
- if (result < 0) return -1;
12
- if (result > 0) return 1;
13
- return 0;
14
- }
15
- function readSourceVersion(sourceRoot) {
16
- const versionPath = join(resolveCanonicalSkillRoot(sourceRoot), "assets", "framework", "VERSION");
17
- try {
18
- return readFileSync(versionPath, "utf-8").trim();
19
- } catch {
20
- return null;
21
- }
22
- }
23
- //#endregion
24
- //#region skills/first-tree/engine/upgrade.ts
25
- function writeProgress(repo, content) {
26
- const progressPath = join(repo.root, repo.preferredProgressPath());
27
- mkdirSync(dirname(progressPath), { recursive: true });
28
- writeFileSync(progressPath, content);
29
- }
30
- function formatUpgradeTaskList(repo, localVersion, packagedVersion, layout) {
31
- const lines = [
32
- `# Context Tree Upgrade — v${localVersion} -> v${packagedVersion}\n`,
33
- "## Installed Skill",
34
- `- [ ] Review local customizations under \`${SKILL_ROOT}/\` and reapply them if needed`,
35
- `- [ ] Re-copy any workflow updates you want from \`${FRAMEWORK_WORKFLOWS_DIR}/\` into \`.github/workflows/\``,
36
- `- [ ] Re-check any local agent setup that references \`${SKILL_ROOT}/assets/framework/examples/\` or \`${SKILL_ROOT}/assets/framework/helpers/\``,
37
- ""
38
- ];
39
- if (layout === "legacy") lines.push("## Migration", "- [ ] Remove any stale `.context-tree/` references from repo-specific docs, scripts, or workflow files", "");
40
- if (layout === "legacy-skill") lines.push("## Migration", `- [ ] Remove any stale \`${LEGACY_SKILL_ROOT}/\` references from repo-specific docs, scripts, workflow files, or agent config`, "");
41
- if (repo.hasAgentMdMarkers()) lines.push("## Agent Instructions", `- [ ] Compare the framework section in \`AGENT.md\` with \`${FRAMEWORK_TEMPLATES_DIR}/agent.md.template\` and update the content between the markers if needed`, "");
42
- lines.push("## Verification", `- [ ] \`${FRAMEWORK_VERSION}\` reads \`${packagedVersion}\``, "- [ ] `context-tree verify` passes", "", "---", "", `**Important:** As you complete each task, check it off in \`${INSTALLED_PROGRESS}\` by changing \`- [ ]\` to \`- [x]\`. Run \`context-tree verify\` when done — it will fail if any items remain unchecked.`, "");
43
- return lines.join("\n");
44
- }
45
- function runUpgrade(repo, options) {
46
- const workingRepo = repo ?? new Repo();
47
- if (!workingRepo.hasFramework()) {
48
- console.error("Error: no installed framework skill found. Run `context-tree init` first.");
49
- return 1;
50
- }
51
- const layout = workingRepo.frameworkLayout();
52
- if (layout === null) {
53
- console.error("Error: no installed framework skill found. Run `context-tree init` first.");
54
- return 1;
55
- }
56
- const localVersion = workingRepo.readVersion() ?? "unknown";
57
- console.log(`Local framework version: ${localVersion}\n`);
58
- console.log("Checking the framework skill bundled with this first-tree package...");
59
- let sourceRoot;
60
- try {
61
- sourceRoot = options?.sourceRoot ?? resolveBundledPackageRoot();
62
- } catch (err) {
63
- const message = err instanceof Error ? err.message : "unknown error";
64
- console.error(`Error: ${message}`);
65
- return 1;
66
- }
67
- const packagedVersion = readSourceVersion(sourceRoot);
68
- if (packagedVersion === null) {
69
- console.log("Could not read the bundled framework version. Reinstall or update `first-tree` and try again.");
70
- return 1;
71
- }
72
- if (localVersion !== "unknown" && compareFrameworkVersions(localVersion, packagedVersion) > 0) {
73
- console.log("The installed framework is newer than the skill bundled with this `first-tree` package. Install a newer package version before running `context-tree upgrade`.");
74
- return 1;
75
- }
76
- if (layout === "skill" && packagedVersion === localVersion) {
77
- console.log(`Already up to date with the bundled skill (${FRAMEWORK_VERSION} = ${localVersion}).`);
78
- return 0;
79
- }
80
- copyCanonicalSkill(sourceRoot, workingRepo.root);
81
- if (layout === "legacy") {
82
- rmSync(join(workingRepo.root, LEGACY_FRAMEWORK_ROOT), {
83
- recursive: true,
84
- force: true
85
- });
86
- console.log("Migrated legacy .context-tree/ layout to skills/first-tree/.");
87
- } else if (layout === "legacy-skill") console.log("Migrated skills/first-tree-cli-framework/ to skills/first-tree/.");
88
- else console.log("Refreshed skills/first-tree/ from the bundled first-tree package.");
89
- const output = formatUpgradeTaskList(workingRepo, localVersion, packagedVersion, layout);
90
- console.log(`\n${output}`);
91
- writeProgress(workingRepo, output);
92
- console.log(`Progress file written to ${workingRepo.preferredProgressPath()}`);
93
- return 0;
94
- }
95
- //#endregion
96
- export { runUpgrade };