first-tree 0.0.2 → 0.0.4
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 +116 -40
- package/dist/cli.js +46 -17
- package/dist/help-Dtdj91HJ.js +25 -0
- package/dist/init--VepFe6N.js +403 -0
- package/dist/installer-cH7N4RNj.js +47 -0
- package/dist/onboarding-C9cYSE6F.js +2 -0
- package/dist/onboarding-CPP8fF4D.js +10 -0
- package/dist/repo-DY57bMqr.js +318 -0
- package/dist/upgrade-Cgx_K2HM.js +135 -0
- package/dist/{verify-CSRIkuoM.js → verify-mC9ZTd1f.js} +118 -29
- package/package.json +33 -10
- package/skills/first-tree/SKILL.md +113 -0
- package/skills/first-tree/agents/openai.yaml +4 -0
- package/skills/first-tree/assets/framework/VERSION +1 -0
- package/skills/first-tree/assets/framework/examples/claude-code/README.md +14 -0
- package/skills/first-tree/assets/framework/examples/claude-code/settings.json +14 -0
- package/skills/first-tree/assets/framework/helpers/generate-codeowners.ts +224 -0
- package/skills/first-tree/assets/framework/helpers/inject-tree-context.sh +15 -0
- package/skills/first-tree/assets/framework/helpers/run-review.ts +193 -0
- package/skills/first-tree/assets/framework/manifest.json +11 -0
- package/skills/first-tree/assets/framework/prompts/pr-review.md +38 -0
- package/skills/first-tree/assets/framework/templates/agents.md.template +49 -0
- package/skills/first-tree/assets/framework/templates/member-node.md.template +18 -0
- package/skills/first-tree/assets/framework/templates/members-domain.md.template +45 -0
- package/skills/first-tree/assets/framework/templates/root-node.md.template +41 -0
- package/skills/first-tree/assets/framework/workflows/codeowners.yml +31 -0
- package/skills/first-tree/assets/framework/workflows/pr-review.yml +146 -0
- package/skills/first-tree/assets/framework/workflows/validate.yml +19 -0
- package/skills/first-tree/engine/commands/help.ts +32 -0
- package/skills/first-tree/engine/commands/init.ts +1 -0
- package/skills/first-tree/engine/commands/upgrade.ts +1 -0
- package/skills/first-tree/engine/commands/verify.ts +1 -0
- package/skills/first-tree/engine/init.ts +414 -0
- package/skills/first-tree/engine/onboarding.ts +10 -0
- package/skills/first-tree/engine/repo.ts +360 -0
- package/skills/first-tree/engine/rules/agent-instructions.ts +59 -0
- package/skills/first-tree/engine/rules/agent-integration.ts +19 -0
- package/skills/first-tree/engine/rules/ci-validation.ts +72 -0
- package/skills/first-tree/engine/rules/framework.ts +13 -0
- package/skills/first-tree/engine/rules/index.ts +41 -0
- package/skills/first-tree/engine/rules/members.ts +21 -0
- package/skills/first-tree/engine/rules/populate-tree.ts +36 -0
- package/skills/first-tree/engine/rules/root-node.ts +41 -0
- package/skills/first-tree/engine/runtime/adapters.ts +22 -0
- package/skills/first-tree/engine/runtime/asset-loader.ts +141 -0
- package/skills/first-tree/engine/runtime/installer.ts +82 -0
- package/skills/first-tree/engine/runtime/upgrader.ts +23 -0
- package/skills/first-tree/engine/upgrade.ts +233 -0
- package/skills/first-tree/engine/validators/members.ts +215 -0
- package/skills/first-tree/engine/validators/nodes.ts +559 -0
- package/skills/first-tree/engine/verify.ts +155 -0
- package/skills/first-tree/references/about.md +36 -0
- package/skills/first-tree/references/maintainer-architecture.md +59 -0
- package/skills/first-tree/references/maintainer-build-and-distribution.md +59 -0
- package/skills/first-tree/references/maintainer-testing.md +58 -0
- package/skills/first-tree/references/maintainer-thin-cli.md +38 -0
- package/skills/first-tree/references/onboarding.md +185 -0
- package/skills/first-tree/references/ownership-and-naming.md +94 -0
- package/skills/first-tree/references/principles.md +113 -0
- package/skills/first-tree/references/source-map.md +94 -0
- package/skills/first-tree/references/upgrade-contract.md +94 -0
- package/skills/first-tree/scripts/check-skill-sync.sh +133 -0
- package/skills/first-tree/scripts/quick_validate.py +95 -0
- package/skills/first-tree/scripts/run-local-cli.sh +35 -0
- package/skills/first-tree/tests/asset-loader.test.ts +75 -0
- package/skills/first-tree/tests/generate-codeowners.test.ts +94 -0
- package/skills/first-tree/tests/helpers.ts +169 -0
- package/skills/first-tree/tests/init.test.ts +250 -0
- package/skills/first-tree/tests/repo.test.ts +440 -0
- package/skills/first-tree/tests/rules.test.ts +413 -0
- package/skills/first-tree/tests/run-review.test.ts +155 -0
- package/skills/first-tree/tests/skill-artifacts.test.ts +311 -0
- package/skills/first-tree/tests/thin-cli.test.ts +104 -0
- package/skills/first-tree/tests/upgrade.test.ts +103 -0
- package/skills/first-tree/tests/validate-members.test.ts +224 -0
- package/skills/first-tree/tests/validate-nodes.test.ts +198 -0
- package/skills/first-tree/tests/verify.test.ts +241 -0
- package/dist/init-CE_944sb.js +0 -283
- package/dist/repo-BByc3VvM.js +0 -111
- package/dist/upgrade-Chr7z0CY.js +0 -82
package/README.md
CHANGED
|
@@ -1,68 +1,144 @@
|
|
|
1
|
-
#
|
|
1
|
+
# first-tree
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`first-tree` publishes the `context-tree` CLI and bundles the canonical
|
|
4
|
+
`first-tree` skill used to bootstrap and maintain Context Tree repos.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Install And Run
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
- One-off use without installing globally:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx first-tree init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- Global install:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g first-tree
|
|
18
|
+
context-tree init
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- Show the installed CLI version:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
context-tree --version
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Show the command list:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
context-tree --help
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Although the npm package is named `first-tree`, the installed CLI command is
|
|
34
|
+
`context-tree`.
|
|
8
35
|
|
|
9
36
|
## Quick Start
|
|
10
37
|
|
|
38
|
+
Recommended workflow: start from your source or workspace repo and let
|
|
39
|
+
`context-tree init` create a sibling dedicated tree repo.
|
|
40
|
+
|
|
11
41
|
```bash
|
|
12
|
-
|
|
42
|
+
cd my-app
|
|
43
|
+
npx first-tree init
|
|
44
|
+
cd ../my-app-context
|
|
13
45
|
```
|
|
14
46
|
|
|
15
|
-
|
|
47
|
+
If you already created a dedicated tree repo yourself, initialize it in place:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
mkdir my-org-context && cd my-org-context
|
|
51
|
+
git init
|
|
52
|
+
context-tree init --here
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `context-tree init` installs `skills/first-tree/`, creates `NODE.md`,
|
|
56
|
+
`AGENTS.md`, `members/NODE.md`, and writes a checklist to
|
|
57
|
+
`skills/first-tree/progress.md`.
|
|
58
|
+
- `context-tree verify` checks both the progress checklist and deterministic
|
|
59
|
+
tree validation. It is expected to fail until the required onboarding tasks
|
|
60
|
+
are complete.
|
|
61
|
+
- `context-tree upgrade` refreshes the installed skill from the currently
|
|
62
|
+
running `first-tree` npm package. To force the newest published package for a
|
|
63
|
+
one-off upgrade, run `npx first-tree@latest upgrade`.
|
|
64
|
+
|
|
65
|
+
The package carries the bundled canonical skill, so `init` and `upgrade`
|
|
66
|
+
install from the package payload instead of cloning this source repo at
|
|
67
|
+
runtime.
|
|
16
68
|
|
|
17
69
|
## Commands
|
|
18
70
|
|
|
19
71
|
| Command | What it does |
|
|
20
|
-
|
|
21
|
-
| `context-tree init` |
|
|
22
|
-
| `context-tree verify` | Run checks against the tree
|
|
23
|
-
| `context-tree upgrade` |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `context-tree init` | Create or refresh a dedicated context tree repo; use `--here` to initialize the current repo in place |
|
|
74
|
+
| `context-tree verify` | Run verification checks against the current tree |
|
|
75
|
+
| `context-tree upgrade` | Refresh the installed skill from the current `first-tree` npm package and write follow-up tasks |
|
|
76
|
+
| `context-tree help onboarding` | Print the onboarding guide |
|
|
77
|
+
| `context-tree --help` | Show the available commands |
|
|
78
|
+
| `context-tree --version` | Print the installed CLI version |
|
|
24
79
|
|
|
25
|
-
##
|
|
80
|
+
## Package Name vs Command
|
|
26
81
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
ownership-and-naming.md
|
|
33
|
-
templates/
|
|
34
|
-
workflows/
|
|
35
|
-
examples/
|
|
36
|
-
NODE.md # root node — your domains (from template)
|
|
37
|
-
AGENT.md # agent instructions with framework markers (from template)
|
|
38
|
-
members/
|
|
39
|
-
NODE.md # members domain (from template)
|
|
40
|
-
```
|
|
82
|
+
- npm package name: `first-tree`
|
|
83
|
+
- installed CLI command: `context-tree`
|
|
84
|
+
- installed skill directory inside a user tree: `skills/first-tree/`
|
|
85
|
+
- when maintainer docs mention "the `first-tree` skill", they mean that
|
|
86
|
+
bundled skill directory, not the npm package name
|
|
41
87
|
|
|
42
|
-
##
|
|
88
|
+
## Runtime And Maintainer Prerequisites
|
|
43
89
|
|
|
44
|
-
|
|
90
|
+
- User trees: the onboarding guide targets Node.js 18+.
|
|
91
|
+
- This source repo: use Node.js 22 and pnpm 10 to match CI and the checked-in
|
|
92
|
+
package manager version.
|
|
45
93
|
|
|
46
|
-
|
|
47
|
-
context-tree upgrade # shows what changed and what to do
|
|
48
|
-
```
|
|
94
|
+
## What This Repo Ships
|
|
49
95
|
|
|
50
|
-
|
|
96
|
+
- `src/` keeps the thin CLI shell that parses commands and dispatches to the
|
|
97
|
+
bundled skill.
|
|
98
|
+
- `skills/first-tree/` is the canonical source for framework behavior, shipped
|
|
99
|
+
templates, maintainer references, and validation logic.
|
|
100
|
+
- `evals/` is maintainer-only developer tooling for the source repo. It is
|
|
101
|
+
intentionally not part of the published package.
|
|
51
102
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
103
|
+
## Developing This Repo
|
|
104
|
+
|
|
105
|
+
Run these commands from the repo root:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pnpm install --frozen-lockfile
|
|
109
|
+
pnpm validate:skill
|
|
110
|
+
pnpm typecheck
|
|
111
|
+
pnpm test
|
|
112
|
+
pnpm build
|
|
113
|
+
```
|
|
56
114
|
|
|
57
|
-
|
|
115
|
+
When package contents or install/upgrade behavior changes, also run:
|
|
58
116
|
|
|
59
117
|
```bash
|
|
60
|
-
pnpm
|
|
61
|
-
pnpm test # run tests
|
|
62
|
-
pnpm typecheck # type check
|
|
63
|
-
pnpm build # build CLI
|
|
118
|
+
pnpm pack
|
|
64
119
|
```
|
|
65
120
|
|
|
121
|
+
## Canonical Documentation
|
|
122
|
+
|
|
123
|
+
All framework documentation, maintainer guidance, and shipped runtime assets
|
|
124
|
+
live in `skills/first-tree/`.
|
|
125
|
+
|
|
126
|
+
- User-facing overview: `skills/first-tree/references/about.md`
|
|
127
|
+
- User onboarding: `skills/first-tree/references/onboarding.md`
|
|
128
|
+
- Maintainer entrypoint: `skills/first-tree/references/source-map.md`
|
|
129
|
+
|
|
130
|
+
If you are maintaining this repo, start with the source map instead of relying
|
|
131
|
+
on root-level prose.
|
|
132
|
+
|
|
133
|
+
## Contributing And Security
|
|
134
|
+
|
|
135
|
+
- Use the GitHub issue forms for bug reports and feature requests so maintainers
|
|
136
|
+
get reproducible context up front.
|
|
137
|
+
- See `CONTRIBUTING.md` for local setup, validation expectations, and where
|
|
138
|
+
changes should live.
|
|
139
|
+
- See `CODE_OF_CONDUCT.md` for community expectations.
|
|
140
|
+
- See `SECURITY.md` for vulnerability reporting guidance.
|
|
141
|
+
|
|
66
142
|
## License
|
|
67
143
|
|
|
68
144
|
Apache 2.0
|
package/dist/cli.js
CHANGED
|
@@ -1,41 +1,70 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
2
4
|
//#region src/cli.ts
|
|
3
5
|
const USAGE = `usage: context-tree <command>
|
|
4
6
|
|
|
7
|
+
New to context-tree? Run \`context-tree help onboarding\` first.
|
|
8
|
+
|
|
5
9
|
Commands:
|
|
6
|
-
init
|
|
7
|
-
verify Run verification checks against
|
|
8
|
-
upgrade
|
|
10
|
+
init Create or refresh a dedicated context tree repo
|
|
11
|
+
verify Run verification checks against a tree repo
|
|
12
|
+
upgrade Refresh the installed skill in a tree repo
|
|
13
|
+
help Show help for a topic (e.g. \`help onboarding\`)
|
|
9
14
|
|
|
10
15
|
Options:
|
|
11
|
-
--help
|
|
16
|
+
--help Show this help message
|
|
17
|
+
--version Show version number
|
|
18
|
+
|
|
19
|
+
Common examples:
|
|
20
|
+
context-tree init
|
|
21
|
+
context-tree init --here
|
|
22
|
+
context-tree verify --tree-path ../my-org-context
|
|
23
|
+
context-tree upgrade --tree-path ../my-org-context
|
|
12
24
|
`;
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
function isDirectExecution(argv1, metaUrl = import.meta.url) {
|
|
26
|
+
if (argv1 === void 0) return false;
|
|
27
|
+
try {
|
|
28
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(metaUrl));
|
|
29
|
+
} catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async function runCli(args, output = console.log) {
|
|
34
|
+
const write = (text) => output(text);
|
|
15
35
|
if (args.length === 0 || args[0] === "--help" || args[0] === "-h") {
|
|
16
|
-
|
|
36
|
+
write(USAGE);
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
if (args[0] === "--version" || args[0] === "-v") {
|
|
40
|
+
const { createRequire } = await import("node:module");
|
|
41
|
+
write(createRequire(import.meta.url)("../package.json").version);
|
|
17
42
|
return 0;
|
|
18
43
|
}
|
|
19
44
|
const command = args[0];
|
|
20
45
|
switch (command) {
|
|
21
46
|
case "init": {
|
|
22
|
-
const { runInit } = await import("./init
|
|
23
|
-
return runInit();
|
|
47
|
+
const { runInit } = await import("./init--VepFe6N.js");
|
|
48
|
+
return runInit(args.slice(1));
|
|
24
49
|
}
|
|
25
50
|
case "verify": {
|
|
26
|
-
const { runVerify } = await import("./verify-
|
|
27
|
-
return runVerify();
|
|
51
|
+
const { runVerify } = await import("./verify-mC9ZTd1f.js");
|
|
52
|
+
return runVerify(args.slice(1));
|
|
28
53
|
}
|
|
29
54
|
case "upgrade": {
|
|
30
|
-
const { runUpgrade } = await import("./upgrade-
|
|
31
|
-
return runUpgrade();
|
|
55
|
+
const { runUpgrade } = await import("./upgrade-Cgx_K2HM.js");
|
|
56
|
+
return runUpgrade(args.slice(1));
|
|
32
57
|
}
|
|
58
|
+
case "help": return (await import("./help-Dtdj91HJ.js")).runHelp(args.slice(1), write);
|
|
33
59
|
default:
|
|
34
|
-
|
|
35
|
-
|
|
60
|
+
write(`Unknown command: ${command}`);
|
|
61
|
+
write(USAGE);
|
|
36
62
|
return 1;
|
|
37
63
|
}
|
|
38
64
|
}
|
|
39
|
-
main()
|
|
65
|
+
async function main() {
|
|
66
|
+
return runCli(process.argv.slice(2));
|
|
67
|
+
}
|
|
68
|
+
if (isDirectExecution(process.argv[1])) main().then((code) => process.exit(code));
|
|
40
69
|
//#endregion
|
|
41
|
-
export {};
|
|
70
|
+
export { USAGE, isDirectExecution, runCli };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region skills/first-tree/engine/commands/help.ts
|
|
2
|
+
const HELP_USAGE = `usage: context-tree help <topic>
|
|
3
|
+
|
|
4
|
+
Topics:
|
|
5
|
+
onboarding How to set up a context tree from scratch
|
|
6
|
+
`;
|
|
7
|
+
async function runHelp(args, output = console.log) {
|
|
8
|
+
const topic = args[0];
|
|
9
|
+
if (!topic || topic === "--help" || topic === "-h") {
|
|
10
|
+
output(HELP_USAGE);
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
switch (topic) {
|
|
14
|
+
case "onboarding": {
|
|
15
|
+
const { runOnboarding } = await import("./onboarding-C9cYSE6F.js");
|
|
16
|
+
return runOnboarding(output);
|
|
17
|
+
}
|
|
18
|
+
default:
|
|
19
|
+
output(`Unknown help topic: ${topic}`);
|
|
20
|
+
output(HELP_USAGE);
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { runHelp };
|