@skitterbyte/skitterspec-github 3.1.2 → 3.1.3

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.
@@ -21,24 +21,11 @@ if (!existsSync(join(__dirname, '..', 'src'))) {
21
21
 
22
22
  const { run, HELP } = require('../src/cli.js')
23
23
 
24
- // The provider's isolation defaults, registered beneath the project's own
25
- // env.config.json so `spec-env stage` claims this provider's snapshot sidecar
26
- // without a hand edit (see common src/env/config.js, setProviderEnvDefaults).
27
- require('../src/env/config.js').setProviderEnvDefaults(
28
- require('../src/vendor/github/config.js').ENV_CONFIG_DEFAULTS,
29
- )
30
- // Its config file too: present, it is what makes `land.specDocs` default to
31
- // "branch" (see common src/env/config.js, setProviderConfigFile).
32
- require('../src/env/config.js').setProviderConfigFile(
33
- require('../src/vendor/github/config.js').CONFIG_FILE,
34
- )
35
- // GitHub holds ideas: an issue carrying `intake.ideaLabel`, kept off the board.
36
- // Registered so `skitterspec idea` hands GitHub the command instead of writing
37
- // specs/ideas.md (see common src/idea.js, selectStore).
38
- require('../src/idea.js').setProviderIdeaStore({
39
- supports: true,
40
- run: (sub, argv, { cwd, out } = {}) =>
41
- require('../src/vendor/github/cli-sync.js').specSync(['idea', sub, ...argv], { cwd, out }),
24
+ // The provider's registrations on the engine: env defaults, config file and
25
+ // idea store (see src/register.js, which the base bin also calls).
26
+ require('../src/vendor/github/register.js').register({
27
+ envConfig: require('../src/env/config.js'),
28
+ idea: require('../src/idea.js'),
42
29
  })
43
30
  const {
44
31
  PROVIDER_COMMANDS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skitterbyte/skitterspec-github",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "Spec-driven development for Claude Code, with one-way GitHub sync — a superset of @skitterbyte/skitterspec: the base filesystem workflow plus /spec-status · /spec-push · /spec-claim and the spec-sync CLI, mirroring specs to GitHub Issues, sub-issues and a Projects v2 board, with GitHub Releases. The repo is canonical; GitHub is a generated mirror. Install this OR the base OR one other superset — exactly one.",
5
5
  "keywords": [
6
6
  "claude",
@@ -0,0 +1,92 @@
1
+ 'use strict'
2
+
3
+ // The base `skitterspec` bin, in a project with a ticketing provider set up.
4
+ //
5
+ // Providers stopped answering to `skitterspec` (#278), so the bare name always
6
+ // runs this distribution — and a provider's registrations (the `land.specDocs`
7
+ // default, its env defaults, its idea store) used to happen only in its own
8
+ // bin. Here the base finds the provider the project configured, loads that
9
+ // provider's `src/register.js` from where it is installed, and hands it the
10
+ // base's own engine modules to register on.
11
+
12
+ const { existsSync } = require('node:fs')
13
+ const { dirname, join } = require('node:path')
14
+
15
+ // Each provider: its config file, and where its register module lives — in the
16
+ // published superset (vendored under src/vendor/) and in the workspace source
17
+ // package, tried in that order.
18
+ const PROVIDERS = [
19
+ { name: 'linear', configFile: join('specs', '.core', 'linear.config.json') },
20
+ { name: 'jira', configFile: join('specs', '.core', 'jira.config.json') },
21
+ { name: 'github', configFile: join('specs', '.core', 'github.config.json') },
22
+ { name: 'azure-boards', configFile: join('specs', '.core', 'azure-boards.config.json') },
23
+ ].map((p) => ({
24
+ ...p,
25
+ candidates: [
26
+ [`@skitterbyte/skitterspec-${p.name}`, join('src', 'vendor', p.name, 'register.js')],
27
+ [`@skitterbyte/skitterspec-provider-${p.name}`, join('src', 'register.js')],
28
+ ],
29
+ }))
30
+
31
+ // The nearest directory at or above `from` holding `specs/.core`. A worktree
32
+ // tracks its own, so a spec's worktree answers for itself.
33
+ function projectDir(from) {
34
+ for (let dir = from; ; dir = dirname(dir)) {
35
+ if (existsSync(join(dir, 'specs', '.core'))) return dir
36
+ if (dirname(dir) === dir) return null
37
+ }
38
+ }
39
+
40
+ // Where `name` is installed, looked for beside the base (a global install puts
41
+ // the provider next to it) and then from the project (a local install).
42
+ function resolvePackage(name, paths) {
43
+ try {
44
+ return dirname(require.resolve(`${name}/package.json`, { paths }))
45
+ } catch {
46
+ return null
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Register the provider configured in the project at or above `cwd` on the
52
+ * base engine's `envConfig` and `idea` modules.
53
+ *
54
+ * Returns `{ provider, registered }`: `registered` is `'full'` (its register
55
+ * module ran), `'config'` (not installed — only its config file is registered,
56
+ * so `land.specDocs` still defaults to "branch"), or `null` (nothing done).
57
+ *
58
+ * WHAT WOULD FOOL THIS: two provider config files in one project is a project
59
+ * this cannot read, so nothing is registered and it warns — the base's own
60
+ * behaviour, never a guess between them. A provider installed somewhere Node's
61
+ * resolution cannot see from the base or the project reads as not installed,
62
+ * and the config file alone is still the positive signal for the lane.
63
+ */
64
+ function registerConfiguredProvider({ cwd, envConfig, idea, resolve = resolvePackage, warn = () => {} }) {
65
+ const dir = projectDir(cwd)
66
+ if (!dir) return { provider: null, registered: null }
67
+ const configured = PROVIDERS.filter((p) => existsSync(join(dir, p.configFile)))
68
+ if (configured.length === 0) return { provider: null, registered: null }
69
+ if (configured.length > 1) {
70
+ warn(
71
+ `skitterspec: more than one ticketing provider is configured here (${configured.map((p) => p.configFile).join(', ')}) — registering none`,
72
+ )
73
+ return { provider: null, registered: null }
74
+ }
75
+ const p = configured[0]
76
+ const paths = [__dirname, dir]
77
+ for (const [pkg, rel] of p.candidates) {
78
+ const root = resolve(pkg, paths)
79
+ if (root && existsSync(join(root, rel))) {
80
+ require(join(root, rel)).register({ envConfig, idea })
81
+ return { provider: p.name, registered: 'full' }
82
+ }
83
+ }
84
+ envConfig.setProviderConfigFile(p.configFile)
85
+ warn(
86
+ `skitterspec: ${p.configFile} is here but @skitterbyte/skitterspec-${p.name} is not installed beside this one — ` +
87
+ 'spec docs ride the branch, but install it for its ideas and env defaults',
88
+ )
89
+ return { provider: p.name, registered: 'config' }
90
+ }
91
+
92
+ module.exports = { registerConfiguredProvider, PROVIDERS }
@@ -0,0 +1,29 @@
1
+ 'use strict'
2
+
3
+ // What this provider tells the shared engine at start-up. Its own bin calls
4
+ // this, and so does the base `skitterspec` bin when it finds this provider
5
+ // configured in the project (common src/provider.js). A published superset
6
+ // carries its own copy of the engine, so the caller passes in the modules to
7
+ // register ON: registering on this package's copy would leave the base bin's
8
+ // engine as unregistered as before.
9
+
10
+ const { CONFIG_FILE, ENV_CONFIG_DEFAULTS } = require('./config.js')
11
+
12
+ function register({ envConfig, idea }) {
13
+ // The isolation defaults, beneath the project's own env.config.json, so
14
+ // `spec-env stage` claims this provider's snapshot sidecar without a hand
15
+ // edit (see common src/env/config.js, setProviderEnvDefaults).
16
+ envConfig.setProviderEnvDefaults(ENV_CONFIG_DEFAULTS)
17
+ // The config file: present, it is what makes `land.specDocs` default to
18
+ // "branch" (see common src/env/config.js, setProviderConfigFile).
19
+ envConfig.setProviderConfigFile(CONFIG_FILE)
20
+ // GitHub holds ideas: an issue carrying `intake.ideaLabel`, kept off the
21
+ // board, so `skitterspec idea` hands GitHub the command instead of writing
22
+ // specs/ideas.md (see common src/idea.js, selectStore).
23
+ idea.setProviderIdeaStore({
24
+ supports: true,
25
+ run: (sub, argv, { cwd, out } = {}) => require('./cli-sync.js').specSync(['idea', sub, ...argv], { cwd, out }),
26
+ })
27
+ }
28
+
29
+ module.exports = { register }