@skitterbyte/skitterspec 23.0.1 → 23.1.1

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.
@@ -170,9 +170,12 @@ function parsePhase(text, name) {
170
170
  * The tracker ticket a spec is linked to, as `{ id, url }`, or null.
171
171
  *
172
172
  * Read straight out of the overview's frontmatter, where every provider stamps
173
- * it. The base is tracker-free, so this knows nothing about Linear beyond the
174
- * two key names a provider writes — an unlinked spec, or a project with no
175
- * provider installed, simply has neither and gets `null`.
173
+ * it. The base is tracker-free, so it hardcodes no provider's key names:
174
+ * every provider stamps `<prefix>_identifier` (`linear_identifier`,
175
+ * `jira_identifier`, …) with `<prefix>_url` beside it, so the id is whichever
176
+ * key matches that shape. A caller that knows the exact field (from
177
+ * `branch.identifierField`) may pass it; an unlinked spec, or a project with no
178
+ * provider installed, has no matching key and gets `null`.
176
179
  *
177
180
  * ONLY http(s) URLS SURVIVE. The value comes out of a file someone edits, and
178
181
  * the page turns it into an `href`; `javascript:` in that position is script
@@ -180,7 +183,7 @@ function parsePhase(text, name) {
180
183
  * still worth having, so the id is kept and the link dropped rather than the
181
184
  * whole ticket.
182
185
  */
183
- function readTicket(text) {
186
+ function readTicket(text, identifierField) {
184
187
  const fm = /^---\n([\s\S]*?)\n---/.exec(text)
185
188
  if (!fm) return null
186
189
  const field = (name) => {
@@ -189,9 +192,20 @@ function readTicket(text) {
189
192
  const v = m[1].trim().replace(/^["']|["']$/g, '').trim()
190
193
  return v || null
191
194
  }
192
- const id = field('linear_identifier')
195
+ let idField = identifierField || null
196
+ if (!idField) {
197
+ // First stamped `<prefix>_identifier` key wins. Two providers stamping one
198
+ // spec does not happen — the distributions are install-one-of.
199
+ const m = /^([A-Za-z][A-Za-z0-9]*)_identifier:/m.exec(fm[1])
200
+ idField = m ? `${m[1]}_identifier` : null
201
+ }
202
+ if (!idField) return null
203
+ const id = field(idField)
193
204
  if (!id) return null
194
- const url = field('linear_url')
205
+ const urlField = idField.endsWith('_identifier')
206
+ ? idField.replace(/_identifier$/, '_url')
207
+ : `${idField}_url`
208
+ const url = field(urlField)
195
209
  return { id, url: url && /^https?:\/\//i.test(url) ? url : null }
196
210
  }
197
211
 
@@ -204,7 +218,7 @@ function readTicket(text) {
204
218
  * routes to omitting the header — the page rendered without one yesterday and
205
219
  * still does (`.claude/rules/negative-checks.md` rule 4).
206
220
  */
207
- function readOverview(specDir, { overviewFile = '00-overview.md' } = {}) {
221
+ function readOverview(specDir, { overviewFile = '00-overview.md', identifierField = null } = {}) {
208
222
  let text
209
223
  try {
210
224
  text = fs.readFileSync(path.join(specDir, overviewFile), 'utf8')
@@ -213,7 +227,7 @@ function readOverview(specDir, { overviewFile = '00-overview.md' } = {}) {
213
227
  }
214
228
  const problem = sectionOf(text, 'Problem') || sectionOf(text, 'Symptom')
215
229
  const impact = impactRows(sectionOf(text, 'Impact'))
216
- const ticket = readTicket(text)
230
+ const ticket = readTicket(text, identifierField)
217
231
  // The ticket counts towards "is there anything to say": a spec linked to a
218
232
  // tracker but carrying neither section still has a header worth drawing.
219
233
  if (!problem && !impact && !ticket) return null
package/src/init.js CHANGED
@@ -125,7 +125,7 @@ function detectPackageManager(dir) {
125
125
 
126
126
  // The bin names a distribution may expose. A provider superset ships its own
127
127
  // name alongside `skitterspec`, and either proves the engine is reachable.
128
- const ENGINE_BINS = ['skitterspec', 'skitterspec-linear']
128
+ const ENGINE_BINS = ['skitterspec', 'skitterspec-linear', 'skitterspec-jira']
129
129
 
130
130
  function binNames() {
131
131
  return process.platform === 'win32'
@@ -272,7 +272,7 @@ function assertComposedAssets() {
272
272
  const SPEC_MARKER_START = '<!-- skitterspec:start -->'
273
273
  const SPEC_MARKER_END = '<!-- skitterspec:end -->'
274
274
 
275
- const report = { created: [], updated: [], skipped: [], refused: [], removed: [], customized: [], adopted: [], healed: [], warnings: [] }
275
+ const report = { created: [], updated: [], skipped: [], refused: [], removed: [], customized: [], adopted: [], healed: [], warnings: [], suggestions: [] }
276
276
 
277
277
  function resetReport() {
278
278
  for (const k of Object.keys(report)) report[k].length = 0
@@ -905,6 +905,7 @@ function resync(dir, { force = false, claudeMd = true, diff = false } = {}) {
905
905
  // asserts over the entry points rather than over this call.
906
906
  registerReviewGateHook(dir)
907
907
  if (claudeMd) installClaudeMd(dir, { mode: 'update' })
908
+ suggestReleaseWith(dir)
908
909
  flushManifest(dir)
909
910
  printReport(dir, 'resync', { diff })
910
911
  }
@@ -913,8 +914,8 @@ function resync(dir, { force = false, claudeMd = true, diff = false } = {}) {
913
914
  // never delete spec content or active config (defense-in-depth — the manifest
914
915
  // never lists these, but a tampered/foreign entry must still be refused).
915
916
  const PROTECTED_SPEC_BUCKETS = ['backlog', 'in-progress', 'complete', 'cancelled']
916
- const PROTECTED_CONFIG = ['env.config.json', 'linear.config.json']
917
- const PROTECTED_DIRS = ['linear-base', 'linear-backups']
917
+ const PROTECTED_CONFIG = ['env.config.json', 'linear.config.json', 'jira.config.json']
918
+ const PROTECTED_DIRS = ['linear-base', 'linear-backups', 'jira-base', 'jira-backups']
918
919
 
919
920
  function assertSafeToDelete(relPath, managedSet) {
920
921
  const norm = relPath.split(path.sep).join('/')
@@ -1003,6 +1004,10 @@ function printReport(dir, mode, { diff = false } = {}) {
1003
1004
  ' (rm <path>, then re-run), or leave it linked and edit the asset.\n',
1004
1005
  )
1005
1006
  }
1007
+ if (report.suggestions.length) {
1008
+ process.stdout.write('\nsuggestions:\n')
1009
+ for (const x of report.suggestions) process.stdout.write(` - ${x}\n`)
1010
+ }
1006
1011
  if (report.warnings.length) {
1007
1012
  process.stdout.write('\nwarnings:\n')
1008
1013
  for (const w of report.warnings) process.stdout.write(` ! ${w}\n`)
@@ -1066,6 +1071,32 @@ function printReport(dir, mode, { diff = false } = {}) {
1066
1071
  // `mode` here is the INSTALL mode ('init' | 'update'), long-standing and
1067
1072
  // unrelated to the config's own `mode` key — which arrives as `workspaceMode`
1068
1073
  // precisely so the two cannot be confused at a call site.
1074
+ /**
1075
+ * Suggest `hotfix.releaseWith` where skittership's hotfix release is installed
1076
+ * and nothing is configured yet. SUGGESTED, NEVER WRITTEN: it changes what a
1077
+ * hotfix land does — a version commit and the project's own tag scheme — and
1078
+ * that is the project's decision, not something an install makes for it.
1079
+ *
1080
+ * Silent unless both signals are present: the script on disk, and an
1081
+ * isolation config that leaves `releaseWith` empty. A config that cannot be
1082
+ * read is cannot-tell, and says nothing.
1083
+ */
1084
+ function suggestReleaseWith(dir) {
1085
+ if (!fs.existsSync(path.join(dir, 'scripts', 'release-hotfix.cjs'))) return
1086
+ let loaded
1087
+ try {
1088
+ loaded = require('./env/config.js').loadEnvConfig(dir)
1089
+ } catch {
1090
+ return
1091
+ }
1092
+ if (!loaded || !loaded.present || loaded.config.hotfix.releaseWith) return
1093
+ report.suggestions.push(
1094
+ 'scripts/release-hotfix.cjs is installed — to have hotfix land cut its release, set ' +
1095
+ '"hotfix": { "releaseWith": "node scripts/release-hotfix.cjs --json" } in ' +
1096
+ 'specs/.core/env.config.json',
1097
+ )
1098
+ }
1099
+
1069
1100
  async function init({ dir, force, claudeMd, mode, isolation, workspaceMode, gating }) {
1070
1101
  if (!fs.existsSync(dir)) throw new Error(`target dir does not exist: ${dir}`)
1071
1102
  resetReport()
@@ -1081,6 +1112,7 @@ async function init({ dir, force, claudeMd, mode, isolation, workspaceMode, gati
1081
1112
  if (mode !== 'update') installIsolation(dir, { enabled: isolation, workspaceMode }, { force })
1082
1113
  if (mode !== 'update') installGating(dir, { enabled: gating }, { force })
1083
1114
  if (claudeMd) installClaudeMd(dir, { mode })
1115
+ suggestReleaseWith(dir)
1084
1116
 
1085
1117
  // Record what we wrote (and migrate a pre-manifest repo) so a later resync can
1086
1118
  // tell our files from the user's.